Version Description
- add javascript trigger
- Fix author filter
Download this release
Release Info
Developer | techlabpro1 |
Plugin | The Post Grid |
Version | 2.2.71 |
Comparing to | |
See all releases |
Code changes from version 2.2.70 to 2.2.71
- README.txt +6 -2
- assets/js/admin.js +0 -37
- assets/js/rttpg.js +4 -1
- assets/vendor/ace/ace.js +0 -11
- assets/vendor/ace/mode-css.js +0 -1
- assets/vendor/ace/mode/css/csslint.js +0 -9628
- assets/vendor/ace/worker-css.js +0 -1
- lib/classes/rtTPGFrontEnd.php +25 -26
- lib/classes/rtTPGHelper.php +1 -1
- lib/classes/rtTPGHook.php +17 -0
- lib/classes/rtTPGInit.php +2 -16
- lib/classes/rtTPGOptions.php +54 -46
- lib/classes/rtTPGShortCode.php +2 -2
- the-post-grid.php +1 -1
README.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: techlabpro1
|
|
3 |
Donate link:
|
4 |
Tags: post grid, content grid, post display, post format, post view, blog display, news display, post
|
5 |
Requires at least: 4.5
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 2.2.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -138,6 +138,10 @@ For any bug or suggestion please mail support@radiustheme.com
|
|
138 |
|
139 |
== Changelog ==
|
140 |
|
|
|
|
|
|
|
|
|
141 |
= 2.2.70 =
|
142 |
* Fix JetPack lazy load
|
143 |
|
3 |
Donate link:
|
4 |
Tags: post grid, content grid, post display, post format, post view, blog display, news display, post
|
5 |
Requires at least: 4.5
|
6 |
+
Tested up to: 5.1
|
7 |
+
Stable tag: 2.2.71
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
138 |
|
139 |
== Changelog ==
|
140 |
|
141 |
+
= 2.2.71 =
|
142 |
+
* add javascript trigger
|
143 |
+
* Fix author filter
|
144 |
+
|
145 |
= 2.2.70 =
|
146 |
* Fix JetPack lazy load
|
147 |
|
assets/js/admin.js
CHANGED
@@ -128,44 +128,7 @@ function rtTPGTermListByTaxonomy( $this ){
|
|
128 |
}
|
129 |
|
130 |
}
|
131 |
-
|
132 |
-
( function( global, $ ) {
|
133 |
-
var editor,
|
134 |
-
syncCSS = function() {
|
135 |
-
thpSyncCss();
|
136 |
-
},
|
137 |
-
loadAce = function() {
|
138 |
-
$('.rt-custom-css').each(function(){
|
139 |
-
var id = $(this).find('.custom-css').attr('id');
|
140 |
-
editor = ace.edit( id );
|
141 |
-
global.safecss_editor = editor;
|
142 |
-
editor.getSession().setUseWrapMode( true );
|
143 |
-
editor.setShowPrintMargin( false );
|
144 |
-
editor.getSession().setValue( $(this).find('.custom_css_textarea').val() );
|
145 |
-
editor.getSession().setMode( "ace/mode/css" );
|
146 |
-
});
|
147 |
-
|
148 |
-
jQuery.fn.spin&&$( '.custom_css_container' ).spin( false );
|
149 |
-
$( '#post' ).submit( syncCSS );
|
150 |
-
};
|
151 |
-
if ( $.browser.msie&&parseInt( $.browser.version, 10 ) <= 7 ) {
|
152 |
-
$( '.custom_css_container' ).hide();
|
153 |
-
$( '.custom_css_textarea' ).show();
|
154 |
-
return false;
|
155 |
-
} else {
|
156 |
-
$( global ).load( loadAce );
|
157 |
-
}
|
158 |
-
global.aceSyncCSS = syncCSS;
|
159 |
-
} )( this, jQuery );
|
160 |
-
|
161 |
-
function thpSyncCss(){
|
162 |
-
jQuery('.rt-custom-css').each(function(){
|
163 |
-
var e = ace.edit( jQuery(this).find('.custom-css').attr('id') );
|
164 |
-
jQuery(this).find('.custom_css_textarea').val( e.getSession().getValue() );
|
165 |
-
});
|
166 |
-
}
|
167 |
function rtTPGSettings(e){
|
168 |
-
thpSyncCss();
|
169 |
jQuery('rt-response').hide();
|
170 |
var arg = jQuery( e ).serialize();
|
171 |
var bindElement = jQuery('.rtSaveButton');
|
128 |
}
|
129 |
|
130 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
function rtTPGSettings(e){
|
|
|
132 |
jQuery('rt-response').hide();
|
133 |
var arg = jQuery( e ).serialize();
|
134 |
var bindElement = jQuery('.rtSaveButton');
|
assets/js/rttpg.js
CHANGED
@@ -16,6 +16,7 @@
|
|
16 |
var $isotopeHolder = $(this).find('.tpg-isotope');
|
17 |
var $isotope = $isotopeHolder.find('.rt-tpg-isotope');
|
18 |
if ($isotope.length) {
|
|
|
19 |
tpgFixLazyLoad();
|
20 |
var isotope = $isotope.imagesLoaded(function () {
|
21 |
$.when(tgpHeightResize()).done(function () {
|
@@ -24,6 +25,7 @@
|
|
24 |
});
|
25 |
setTimeout(function () {
|
26 |
isotope.isotope();
|
|
|
27 |
}, 100);
|
28 |
});
|
29 |
});
|
@@ -36,12 +38,14 @@
|
|
36 |
$(this).addClass('selected');
|
37 |
});
|
38 |
}
|
|
|
39 |
});
|
40 |
};
|
41 |
initTpg();
|
42 |
$(window).on('load resize', function () {
|
43 |
tgpHeightResize();
|
44 |
overlayIconResizeTpg();
|
|
|
45 |
});
|
46 |
|
47 |
function tgpHeightResize() {
|
@@ -81,5 +85,4 @@
|
|
81 |
});
|
82 |
}
|
83 |
|
84 |
-
|
85 |
})(jQuery);
|
16 |
var $isotopeHolder = $(this).find('.tpg-isotope');
|
17 |
var $isotope = $isotopeHolder.find('.rt-tpg-isotope');
|
18 |
if ($isotope.length) {
|
19 |
+
$isotopeHolder.trigger('tpg_item_before_load');
|
20 |
tpgFixLazyLoad();
|
21 |
var isotope = $isotope.imagesLoaded(function () {
|
22 |
$.when(tgpHeightResize()).done(function () {
|
25 |
});
|
26 |
setTimeout(function () {
|
27 |
isotope.isotope();
|
28 |
+
$isotopeHolder.trigger('tpg_item_after_load');
|
29 |
}, 100);
|
30 |
});
|
31 |
});
|
38 |
$(this).addClass('selected');
|
39 |
});
|
40 |
}
|
41 |
+
$isotopeHolder.trigger("tpg_loaded");
|
42 |
});
|
43 |
};
|
44 |
initTpg();
|
45 |
$(window).on('load resize', function () {
|
46 |
tgpHeightResize();
|
47 |
overlayIconResizeTpg();
|
48 |
+
$(".rt-tpg-container").trigger("tpg_loaded");
|
49 |
});
|
50 |
|
51 |
function tgpHeightResize() {
|
85 |
});
|
86 |
}
|
87 |
|
|
|
88 |
})(jQuery);
|
assets/vendor/ace/ace.js
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
(function(){function h(a){var c=function(a,b){return e("",a,b)},f=b;a&&(b[a]||(b[a]={}),f=b[a]);if(!f.define||!f.define.packaged)d.original=f.define,f.define=d,f.define.packaged=!0;if(!f.require||!f.require.packaged)e.original=f.require,f.require=c,f.require.packaged=!0}var a="",b=function(){return this}();if(!a&&typeof requirejs!="undefined"){var c=b.define;b.define=function(a,b,d){return typeof d!="function"?c.apply(this,arguments):c(a,b,function(a,c,e){return b[2]=="module"&&(e.packaged=!0),d.apply(this,arguments)})},b.define.packaged=!0;return}var d=function(a,b,c){if(typeof a!="string"){d.original?d.original.apply(window,arguments):(console.error("dropping module because define wasn't a string."),console.trace());return}arguments.length==2&&(c=b),d.modules||(d.modules={}),d.modules[a]=c},e=function(a,b,c){if(Object.prototype.toString.call(b)==="[object Array]"){var d=[];for(var f=0,h=b.length;f<h;++f){var i=g(a,b[f]);if(!i&&e.original)return e.original.apply(window,arguments);d.push(i)}c&&c.apply(null,d)}else{if(typeof b=="string"){var j=g(a,b);return!j&&e.original?e.original.apply(window,arguments):(c&&c(),j)}if(e.original)return e.original.apply(window,arguments)}},f=function(a,b){if(b.indexOf("!")!==-1){var c=b.split("!");return f(a,c[0])+"!"+f(a,c[1])}if(b.charAt(0)=="."){var d=a.split("/").slice(0,-1).join("/");b=d+"/"+b;while(b.indexOf(".")!==-1&&e!=b){var e=b;b=b.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return b},g=function(a,b){b=f(a,b);var c=d.modules[b];if(!c)return null;if(typeof c=="function"){var g={},h={id:b,uri:"",exports:g,packaged:!0},i=function(a,c){return e(b,a,c)},j=c(i,g,h);return g=j||h.exports,d.modules[b]=g,g}return c};h(a)})(),define("ace/ace",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/dom","ace/lib/event","ace/editor","ace/edit_session","ace/undomanager","ace/virtual_renderer","ace/multi_select","ace/worker/worker_client","ace/keyboard/hash_handler","ace/keyboard/state_handler","ace/placeholder","ace/config","ace/theme/textmate"],function(a,b,c){a("./lib/fixoldbrowsers");var d=a("./lib/dom"),e=a("./lib/event"),f=a("./editor").Editor,g=a("./edit_session").EditSession,h=a("./undomanager").UndoManager,i=a("./virtual_renderer").VirtualRenderer,j=a("./multi_select").MultiSelect;a("./worker/worker_client"),a("./keyboard/hash_handler"),a("./keyboard/state_handler"),a("./placeholder"),b.config=a("./config"),b.edit=function(b){if(typeof b=="string"){var c=b;(b=document.getElementById(b))||console.log("can't match div #"+c)}if(b.env&&b.env.editor instanceof f)return b.env.editor;var k=new g(d.getInnerText(b));k.setUndoManager(new h),b.innerHTML="";var l=new f(new i(b,a("./theme/textmate")));new j(l),l.setSession(k);var m={};return m.document=k,m.editor=l,l.resize(),e.addListener(window,"resize",function(){l.resize()}),b.env=m,l.env=m,l}}),define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/regexp","ace/lib/es5-shim"],function(a,b,c){a("./regexp"),a("./es5-shim")}),define("ace/lib/regexp",["require","exports","module"],function(a,b,c){function g(a){return(a.global?"g":"")+(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.extended?"x":"")+(a.sticky?"y":"")}function h(a,b,c){if(Array.prototype.indexOf)return a.indexOf(b,c);for(var d=c||0;d<a.length;d++)if(a[d]===b)return d;return-1}var d={exec:RegExp.prototype.exec,test:RegExp.prototype.test,match:String.prototype.match,replace:String.prototype.replace,split:String.prototype.split},e=d.exec.call(/()??/,"")[1]===undefined,f=function(){var a=/^/g;return d.test.call(a,""),!a.lastIndex}();if(f&&e)return;RegExp.prototype.exec=function(a){var b=d.exec.apply(this,arguments),c,i;if(typeof a=="string"&&b){!e&&b.length>1&&h(b,"")>-1&&(i=RegExp(this.source,d.replace.call(g(this),"g","")),d.replace.call(a.slice(b.index),i,function(){for(var a=1;a<arguments.length-2;a++)arguments[a]===undefined&&(b[a]=undefined)}));if(this._xregexp&&this._xregexp.captureNames)for(var j=1;j<b.length;j++)c=this._xregexp.captureNames[j-1],c&&(b[c]=b[j]);!f&&this.global&&!b[0].length&&this.lastIndex>b.index&&this.lastIndex--}return b},f||(RegExp.prototype.test=function(a){var b=d.exec.call(this,a);return b&&this.global&&!b[0].length&&this.lastIndex>b.index&&this.lastIndex--,!!b})}),define("ace/lib/es5-shim",["require","exports","module"],function(a,b,c){function p(a){try{return Object.defineProperty(a,"sentinel",{}),"sentinel"in a}catch(b){}}Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=g.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,h=c.apply(f,d.concat(g.call(arguments)));return h!==null&&Object(h)===h?h:f}return c.apply(b,d.concat(g.call(arguments)))};return e});var d=Function.prototype.call,e=Array.prototype,f=Object.prototype,g=e.slice,h=d.bind(f.toString),i=d.bind(f.hasOwnProperty),j,k,l,m,n;if(n=i(f,"__defineGetter__"))j=d.bind(f.__defineGetter__),k=d.bind(f.__defineSetter__),l=d.bind(f.__lookupGetter__),m=d.bind(f.__lookupSetter__);Array.isArray||(Array.isArray=function(b){return h(b)=="[object Array]"}),Array.prototype.forEach||(Array.prototype.forEach=function(b){var c=G(this),d=arguments[1],e=0,f=c.length>>>0;if(h(b)!="[object Function]")throw new TypeError;while(e<f)e in c&&b.call(d,c[e],e,c),e++}),Array.prototype.map||(Array.prototype.map=function(b){var c=G(this),d=c.length>>>0,e=Array(d),f=arguments[1];if(h(b)!="[object Function]")throw new TypeError;for(var g=0;g<d;g++)g in c&&(e[g]=b.call(f,c[g],g,c));return e}),Array.prototype.filter||(Array.prototype.filter=function(b){var c=G(this),d=c.length>>>0,e=[],f=arguments[1];if(h(b)!="[object Function]")throw new TypeError;for(var g=0;g<d;g++)g in c&&b.call(f,c[g],g,c)&&e.push(c[g]);return e}),Array.prototype.every||(Array.prototype.every=function(b){var c=G(this),d=c.length>>>0,e=arguments[1];if(h(b)!="[object Function]")throw new TypeError;for(var f=0;f<d;f++)if(f in c&&!b.call(e,c[f],f,c))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(b){var c=G(this),d=c.length>>>0,e=arguments[1];if(h(b)!="[object Function]")throw new TypeError;for(var f=0;f<d;f++)if(f in c&&b.call(e,c[f],f,c))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(b){var c=G(this),d=c.length>>>0;if(h(b)!="[object Function]")throw new TypeError;if(!d&&arguments.length==1)throw new TypeError;var e=0,f;if(arguments.length>=2)f=arguments[1];else do{if(e in c){f=c[e++];break}if(++e>=d)throw new TypeError}while(!0);for(;e<d;e++)e in c&&(f=b.call(void 0,f,c[e],e,c));return f}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(b){var c=G(this),d=c.length>>>0;if(h(b)!="[object Function]")throw new TypeError;if(!d&&arguments.length==1)throw new TypeError;var e,f=d-1;if(arguments.length>=2)e=arguments[1];else do{if(f in c){e=c[f--];break}if(--f<0)throw new TypeError}while(!0);do f in this&&(e=b.call(void 0,e,c[f],f,c));while(f--);return e}),Array.prototype.indexOf||(Array.prototype.indexOf=function(b){var c=G(this),d=c.length>>>0;if(!d)return-1;var e=0;arguments.length>1&&(e=E(arguments[1])),e=e>=0?e:Math.max(0,d+e);for(;e<d;e++)if(e in c&&c[e]===b)return e;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(b){var c=G(this),d=c.length>>>0;if(!d)return-1;var e=d-1;arguments.length>1&&(e=Math.min(e,E(arguments[1]))),e=e>=0?e:d-Math.abs(e);for(;e>=0;e--)if(e in c&&b===c[e])return e;return-1}),Object.getPrototypeOf||(Object.getPrototypeOf=function(b){return b.__proto__||(b.constructor?b.constructor.prototype:f)});if(!Object.getOwnPropertyDescriptor){var o="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(b,c){if(typeof b!="object"&&typeof b!="function"||b===null)throw new TypeError(o+b);if(!i(b,c))return;var d,e,g;d={enumerable:!0,configurable:!0};if(n){var h=b.__proto__;b.__proto__=f;var e=l(b,c),g=m(b,c);b.__proto__=h;if(e||g)return e&&(d.get=e),g&&(d.set=g),d}return d.value=b[c],d}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(b){return Object.keys(b)}),Object.create||(Object.create=function(b,c){var d;if(b===null)d={__proto__:null};else{if(typeof b!="object")throw new TypeError("typeof prototype["+typeof b+"] != 'object'");var e=function(){};e.prototype=b,d=new e,d.__proto__=b}return c!==void 0&&Object.defineProperties(d,c),d});if(Object.defineProperty){var q=p({}),r=typeof document=="undefined"||p(document.createElement("div"));if(!q||!r)var s=Object.defineProperty}if(!Object.defineProperty||s){var t="Property description must be an object: ",u="Object.defineProperty called on non-object: ",v="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(b,c,d){if(typeof b!="object"&&typeof b!="function"||b===null)throw new TypeError(u+b);if(typeof d!="object"&&typeof d!="function"||d===null)throw new TypeError(t+d);if(s)try{return s.call(Object,b,c,d)}catch(e){}if(i(d,"value"))if(n&&(l(b,c)||m(b,c))){var g=b.__proto__;b.__proto__=f,delete b[c],b[c]=d.value,b.__proto__=g}else b[c]=d.value;else{if(!n)throw new TypeError(v);i(d,"get")&&j(b,c,d.get),i(d,"set")&&k(b,c,d.set)}return b}}Object.defineProperties||(Object.defineProperties=function(b,c){for(var d in c)i(c,d)&&Object.defineProperty(b,d,c[d]);return b}),Object.seal||(Object.seal=function(b){return b}),Object.freeze||(Object.freeze=function(b){return b});try{Object.freeze(function(){})}catch(w){Object.freeze=function(b){return function(c){return typeof c=="function"?c:b(c)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(b){return b}),Object.isSealed||(Object.isSealed=function(b){return!1}),Object.isFrozen||(Object.isFrozen=function(b){return!1}),Object.isExtensible||(Object.isExtensible=function(b){if(Object(b)===b)throw new TypeError;var c="";while(i(b,c))c+="?";b[c]=!0;var d=i(b,c);return delete b[c],d});if(!Object.keys){var x=!0,y=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],z=y.length;for(var A in{toString:null})x=!1;Object.keys=function H(a){if(typeof a!="object"&&typeof a!="function"||a===null)throw new TypeError("Object.keys called on a non-object");var H=[];for(var b in a)i(a,b)&&H.push(b);if(x)for(var c=0,d=z;c<d;c++){var e=y[c];i(a,e)&&H.push(e)}return H}}if(!Date.prototype.toISOString||(new Date(-621987552e5)).toISOString().indexOf("-000001")===-1)Date.prototype.toISOString=function(){var b,c,d,e;if(!isFinite(this))throw new RangeError;b=[this.getUTCMonth()+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()],e=this.getUTCFullYear(),e=(e<0?"-":e>9999?"+":"")+("00000"+Math.abs(e)).slice(0<=e&&e<=9999?-4:-6),c=b.length;while(c--)d=b[c],d<10&&(b[c]="0"+d);return e+"-"+b.slice(0,2).join("-")+"T"+b.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"};Date.now||(Date.now=function(){return(new Date).getTime()}),Date.prototype.toJSON||(Date.prototype.toJSON=function(b){if(typeof this.toISOString!="function")throw new TypeError;return this.toISOString()}),Date.parse("+275760-09-13T00:00:00.000Z")!==864e13&&(Date=function(a){var b=function e(b,c,d,f,g,h,i){var j=arguments.length;if(this instanceof a){var k=j==1&&String(b)===b?new a(e.parse(b)):j>=7?new a(b,c,d,f,g,h,i):j>=6?new a(b,c,d,f,g,h):j>=5?new a(b,c,d,f,g):j>=4?new a(b,c,d,f):j>=3?new a(b,c,d):j>=2?new a(b,c):j>=1?new a(b):new a;return k.constructor=e,k}return a.apply(this,arguments)},c=new RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d{3}))?)?(?:Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$");for(var d in a)b[d]=a[d];return b.now=a.now,b.UTC=a.UTC,b.prototype=a.prototype,b.prototype.constructor=b,b.parse=function(d){var e=c.exec(d);if(e){e.shift();for(var f=1;f<7;f++)e[f]=+(e[f]||(f<3?1:0)),f==1&&e[f]--;var g=+e.pop(),h=+e.pop(),i=e.pop(),j=0;if(i){if(h>23||g>59)return NaN;j=(h*60+g)*6e4*(i=="+"?-1:1)}var k=+e[0];return 0<=k&&k<=99?(e[0]=k+400,a.UTC.apply(this,e)+j-126227808e5):a.UTC.apply(this,e)+j}return a.parse.apply(this,arguments)},b}(Date));var B=" \n\f\r \u2028\u2029";if(!String.prototype.trim||B.trim()){B="["+B+"]";var C=new RegExp("^"+B+B+"*"),D=new RegExp(B+B+"*$");String.prototype.trim=function(){return String(this).replace(C,"").replace(D,"")}}var E=function(a){return a=+a,a!==a?a=0:a!==0&&a!==1/0&&a!==-Infinity&&(a=(a>0||-1)*Math.floor(Math.abs(a))),a},F="a"[0]!="a",G=function(a){if(a==null)throw new TypeError;return F&&typeof a=="string"&&a?a.split(""):Object(a)}}),define("ace/lib/dom",["require","exports","module"],function(a,b,c){var d="http://www.w3.org/1999/xhtml";b.createElement=function(a,b){return document.createElementNS?document.createElementNS(b||d,a):document.createElement(a)},b.setText=function(a,b){a.innerText!==undefined&&(a.innerText=b),a.textContent!==undefined&&(a.textContent=b)},b.hasCssClass=function(a,b){var c=a.className.split(/\s+/g);return c.indexOf(b)!==-1},b.addCssClass=function(a,c){b.hasCssClass(a,c)||(a.className+=" "+c)},b.removeCssClass=function(a,b){var c=a.className.split(/\s+/g);for(;;){var d=c.indexOf(b);if(d==-1)break;c.splice(d,1)}a.className=c.join(" ")},b.toggleCssClass=function(a,b){var c=a.className.split(/\s+/g),d=!0;for(;;){var e=c.indexOf(b);if(e==-1)break;d=!1,c.splice(e,1)}return d&&c.push(b),a.className=c.join(" "),d},b.setCssClass=function(a,c,d){d?b.addCssClass(a,c):b.removeCssClass(a,c)},b.hasCssString=function(a,b){var c=0,d;b=b||document;if(b.createStyleSheet&&(d=b.styleSheets)){while(c<d.length)if(d[c++].owningElement.id===a)return!0}else if(d=b.getElementsByTagName("style"))while(c<d.length)if(d[c++].id===a)return!0;return!1},b.importCssString=function(c,e,f){f=f||document;if(e&&b.hasCssString(e,f))return null;var g;if(f.createStyleSheet)g=f.createStyleSheet(),g.cssText=c,e&&(g.owningElement.id=e);else{g=f.createElementNS?f.createElementNS(d,"style"):f.createElement("style"),g.appendChild(f.createTextNode(c)),e&&(g.id=e);var h=f.getElementsByTagName("head")[0]||f.documentElement;h.appendChild(g)}},b.importCssStylsheet=function(a,c){if(c.createStyleSheet)c.createStyleSheet(a);else{var d=b.createElement("link");d.rel="stylesheet",d.href=a;var e=c.getElementsByTagName("head")[0]||c.documentElement;e.appendChild(d)}},b.getInnerWidth=function(a){return parseInt(b.computedStyle(a,"paddingLeft"),10)+parseInt(b.computedStyle(a,"paddingRight"),10)+a.clientWidth},b.getInnerHeight=function(a){return parseInt(b.computedStyle(a,"paddingTop"),10)+parseInt(b.computedStyle(a,"paddingBottom"),10)+a.clientHeight},window.pageYOffset!==undefined?(b.getPageScrollTop=function(){return window.pageYOffset},b.getPageScrollLeft=function(){return window.pageXOffset}):(b.getPageScrollTop=function(){return document.body.scrollTop},b.getPageScrollLeft=function(){return document.body.scrollLeft}),window.getComputedStyle?b.computedStyle=function(a,b){return b?(window.getComputedStyle(a,"")||{})[b]||"":window.getComputedStyle(a,"")||{}}:b.computedStyle=function(a,b){return b?a.currentStyle[b]:a.currentStyle},b.scrollbarWidth=function(a){var c=b.createElement("p");c.style.width="100%",c.style.minWidth="0px",c.style.height="200px";var d=b.createElement("div"),e=d.style;e.position="absolute",e.left="-10000px",e.overflow="hidden",e.width="200px",e.minWidth="0px",e.height="150px",d.appendChild(c);var f=a.body||a.documentElement;f.appendChild(d);var g=c.offsetWidth;e.overflow="scroll";var h=c.offsetWidth;return g==h&&(h=d.clientWidth),f.removeChild(d),g-h},b.setInnerHtml=function(a,b){var c=a.cloneNode(!1);return c.innerHTML=b,a.parentNode.replaceChild(c,a),c},b.setInnerText=function(a,b){var c=a.ownerDocument;c.body&&"textContent"in c.body?a.textContent=b:a.innerText=b},b.getInnerText=function(a){var b=a.ownerDocument;return b.body&&"textContent"in b.body?a.textContent:a.innerText||a.textContent||""},b.getParentWindow=function(a){return a.defaultView||a.parentWindow}}),define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent","ace/lib/dom"],function(a,b,c){function g(a,b,c){var f=0;!e.isOpera||"KeyboardEvent"in window||!e.isMac?f=0|(b.ctrlKey?1:0)|(b.altKey?2:0)|(b.shiftKey?4:0)|(b.metaKey?8:0):f=0|(b.metaKey?1:0)|(b.altKey?2:0)|(b.shiftKey?4:0)|(b.ctrlKey?8:0);if(c in d.MODIFIER_KEYS){switch(d.MODIFIER_KEYS[c]){case"Alt":f=2;break;case"Shift":f=4;break;case"Ctrl":f=1;break;default:f=8}c=0}return f&8&&(c==91||c==93)&&(c=0),!!f||c in d.FUNCTION_KEYS||c in d.PRINTABLE_KEYS?a(b,f,c):!1}var d=a("./keys"),e=a("./useragent"),f=a("./dom");b.addListener=function(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1);if(a.attachEvent){var d=function(){c(window.event)};c._wrapper=d,a.attachEvent("on"+b,d)}},b.removeListener=function(a,b,c){if(a.removeEventListener)return a.removeEventListener(b,c,!1);a.detachEvent&&a.detachEvent("on"+b,c._wrapper||c)},b.stopEvent=function(a){return b.stopPropagation(a),b.preventDefault(a),!1},b.stopPropagation=function(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},b.preventDefault=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1},b.getButton=function(a){return a.type=="dblclick"?0:a.type=="contextmenu"||a.ctrlKey&&e.isMac?2:a.preventDefault?a.button:{1:0,2:2,4:1}[a.button]},document.documentElement.setCapture?b.capture=function(a,c,d){function f(g){c(g),e||(e=!0,d(g)),b.removeListener(a,"mousemove",c),b.removeListener(a,"mouseup",f),b.removeListener(a,"losecapture",f),a.releaseCapture()}var e=!1;b.addListener(a,"mousemove",c),b.addListener(a,"mouseup",f),b.addListener(a,"losecapture",f),a.setCapture()}:b.capture=function(a,b,c){function d(a){b&&b(a),c&&c(a),document.removeEventListener("mousemove",b,!0),document.removeEventListener("mouseup",d,!0),a.stopPropagation()}document.addEventListener("mousemove",b,!0),document.addEventListener("mouseup",d,!0)},b.addMouseWheelListener=function(a,c){var d=8,e=function(a){a.wheelDelta!==undefined?a.wheelDeltaX!==undefined?(a.wheelX=-a.wheelDeltaX/d,a.wheelY=-a.wheelDeltaY/d):(a.wheelX=0,a.wheelY=-a.wheelDelta/d):a.axis&&a.axis==a.HORIZONTAL_AXIS?(a.wheelX=(a.detail||0)*5,a.wheelY=0):(a.wheelX=0,a.wheelY=(a.detail||0)*5),c(a)};b.addListener(a,"DOMMouseScroll",e),b.addListener(a,"mousewheel",e)},b.addMultiMouseDownListener=function(a,c,d,f){var g=0,h,i,j,k={2:"dblclick",3:"tripleclick",4:"quadclick"};b.addListener(a,"mousedown",function(a){if(b.getButton(a)!=0)g=0;else{var e=Math.abs(a.clientX-h)>5||Math.abs(a.clientY-i)>5;if(!j||e)g=0;g+=1,j&&clearTimeout(j),j=setTimeout(function(){j=null},c[g-1]||600)}g==1&&(h=a.clientX,i=a.clientY),d[f]("mousedown",a);if(g>4)g=0;else if(g>1)return d[f](k[g],a)}),e.isOldIE&&b.addListener(a,"dblclick",function(a){g=2,j&&clearTimeout(j),j=setTimeout(function(){j=null},c[g-1]||600),d[f]("mousedown",a),d[f](k[g],a)})},b.addCommandKeyListener=function(a,c){var d=b.addListener;if(e.isOldGecko||e.isOpera&&!("KeyboardEvent"in window)){var f=null;d(a,"keydown",function(a){f=a.keyCode}),d(a,"keypress",function(a){return g(c,a,f)})}else{var h=null;d(a,"keydown",function(a){return h=a.keyIdentifier||a.keyCode,g(c,a,a.keyCode)})}};if(window.postMessage&&!e.isOldIE){var h=1;b.nextTick=function(a,c){c=c||window;var d="zero-timeout-message-"+h;b.addListener(c,"message",function e(f){f.data==d&&(b.stopPropagation(f),b.removeListener(c,"message",e),a())}),c.postMessage(d,"*")}}else b.nextTick=function(a,b){b=b||window,window.setTimeout(a,0)}}),define("ace/lib/keys",["require","exports","module","ace/lib/oop"],function(a,b,c){var d=a("./oop"),e=function(){var a={MODIFIER_KEYS:{16:"Shift",17:"Ctrl",18:"Alt",224:"Meta"},KEY_MODS:{ctrl:1,alt:2,option:2,shift:4,meta:8,command:8},FUNCTION_KEYS:{8:"Backspace",9:"Tab",13:"Return",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Numlock",145:"Scrolllock"},PRINTABLE_KEYS:{32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",188:",",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}};for(var b in a.FUNCTION_KEYS){var c=a.FUNCTION_KEYS[b].toLowerCase();a[c]=parseInt(b,10)}return d.mixin(a,a.MODIFIER_KEYS),d.mixin(a,a.PRINTABLE_KEYS),d.mixin(a,a.FUNCTION_KEYS),a.enter=a["return"],a.escape=a.esc,a.del=a["delete"],a[173]="-",a}();d.mixin(b,e),b.keyCodeToString=function(a){return(e[a]||String.fromCharCode(a)).toLowerCase()}}),define("ace/lib/oop",["require","exports","module"],function(a,b,c){b.inherits=function(){var a=function(){};return function(b,c){a.prototype=c.prototype,b.super_=c.prototype,b.prototype=new a,b.prototype.constructor=b}}(),b.mixin=function(a,b){for(var c in b)a[c]=b[c]},b.implement=function(a,c){b.mixin(a,c)}}),define("ace/lib/useragent",["require","exports","module"],function(a,b,c){var d=(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase(),e=navigator.userAgent;b.isWin=d=="win",b.isMac=d=="mac",b.isLinux=d=="linux",b.isIE=navigator.appName=="Microsoft Internet Explorer"&&parseFloat(navigator.userAgent.match(/MSIE ([0-9]+[\.0-9]+)/)[1]),b.isOldIE=b.isIE&&b.isIE<9,b.isGecko=b.isMozilla=window.controllers&&window.navigator.product==="Gecko",b.isOldGecko=b.isGecko&&parseInt((navigator.userAgent.match(/rv\:(\d+)/)||[])[1],10)<4,b.isOpera=window.opera&&Object.prototype.toString.call(window.opera)=="[object Opera]",b.isWebKit=parseFloat(e.split("WebKit/")[1])||undefined,b.isChrome=parseFloat(e.split(" Chrome/")[1])||undefined,b.isAIR=e.indexOf("AdobeAIR")>=0,b.isIPad=e.indexOf("iPad")>=0,b.isTouchPad=e.indexOf("TouchPad")>=0,b.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},b.getOS=function(){return b.isMac?b.OS.MAC:b.isLinux?b.OS.LINUX:b.OS.WINDOWS}}),define("ace/editor",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/oop","ace/lib/lang","ace/lib/useragent","ace/keyboard/textinput","ace/mouse/mouse_handler","ace/mouse/fold_handler","ace/keyboard/keybinding","ace/edit_session","ace/search","ace/range","ace/lib/event_emitter","ace/commands/command_manager","ace/commands/default_commands"],function(a,b,c){a("./lib/fixoldbrowsers");var d=a("./lib/oop"),e=a("./lib/lang"),f=a("./lib/useragent"),g=a("./keyboard/textinput").TextInput,h=a("./mouse/mouse_handler").MouseHandler,i=a("./mouse/fold_handler").FoldHandler,j=a("./keyboard/keybinding").KeyBinding,k=a("./edit_session").EditSession,l=a("./search").Search,m=a("./range").Range,n=a("./lib/event_emitter").EventEmitter,o=a("./commands/command_manager").CommandManager,p=a("./commands/default_commands").commands,q=function(a,b){var c=a.getContainerElement();this.container=c,this.renderer=a,this.commands=new o(f.isMac?"mac":"win",p),this.textInput=new g(a.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.keyBinding=new j(this),this.$mouseHandler=new h(this),new i(this),this.$blockScrolling=0,this.$search=(new l).set({wrap:!0}),this.setSession(b||new k(""))};(function(){d.implement(this,n),this.setKeyboardHandler=function(a){this.keyBinding.setKeyboardHandler(a)},this.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},this.setSession=function(a){if(this.session==a)return;if(this.session){var b=this.session;this.session.removeEventListener("change",this.$onDocumentChange),this.session.removeEventListener("changeMode",this.$onChangeMode),this.session.removeEventListener("tokenizerUpdate",this.$onTokenizerUpdate),this.session.removeEventListener("changeTabSize",this.$onChangeTabSize),this.session.removeEventListener("changeWrapLimit",this.$onChangeWrapLimit),this.session.removeEventListener("changeWrapMode",this.$onChangeWrapMode),this.session.removeEventListener("onChangeFold",this.$onChangeFold),this.session.removeEventListener("changeFrontMarker",this.$onChangeFrontMarker),this.session.removeEventListener("changeBackMarker",this.$onChangeBackMarker),this.session.removeEventListener("changeBreakpoint",this.$onChangeBreakpoint),this.session.removeEventListener("changeAnnotation",this.$onChangeAnnotation),this.session.removeEventListener("changeOverwrite",this.$onCursorChange),this.session.removeEventListener("changeScrollTop",this.$onScrollTopChange),this.session.removeEventListener("changeLeftTop",this.$onScrollLeftChange);var c=this.session.getSelection();c.removeEventListener("changeCursor",this.$onCursorChange),c.removeEventListener("changeSelection",this.$onSelectionChange)}this.session=a,this.$onDocumentChange=this.onDocumentChange.bind(this),a.addEventListener("change",this.$onDocumentChange),this.renderer.setSession(a),this.$onChangeMode=this.onChangeMode.bind(this),a.addEventListener("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),a.addEventListener("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),a.addEventListener("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),a.addEventListener("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),a.addEventListener("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),a.addEventListener("changeFold",this.$onChangeFold),this.$onChangeFrontMarker=this.onChangeFrontMarker.bind(this),this.session.addEventListener("changeFrontMarker",this.$onChangeFrontMarker),this.$onChangeBackMarker=this.onChangeBackMarker.bind(this),this.session.addEventListener("changeBackMarker",this.$onChangeBackMarker),this.$onChangeBreakpoint=this.onChangeBreakpoint.bind(this),this.session.addEventListener("changeBreakpoint",this.$onChangeBreakpoint),this.$onChangeAnnotation=this.onChangeAnnotation.bind(this),this.session.addEventListener("changeAnnotation",this.$onChangeAnnotation),this.$onCursorChange=this.onCursorChange.bind(this),this.session.addEventListener("changeOverwrite",this.$onCursorChange),this.$onScrollTopChange=this.onScrollTopChange.bind(this),this.session.addEventListener("changeScrollTop",this.$onScrollTopChange),this.$onScrollLeftChange=this.onScrollLeftChange.bind(this),this.session.addEventListener("changeScrollLeft",this.$onScrollLeftChange),this.selection=a.getSelection(),this.selection.addEventListener("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.addEventListener("changeSelection",this.$onSelectionChange),this.onChangeMode(),this.$blockScrolling+=1,this.onCursorChange(),this.$blockScrolling-=1,this.onScrollTopChange(),this.onScrollLeftChange(),this.onSelectionChange(),this.onChangeFrontMarker(),this.onChangeBackMarker(),this.onChangeBreakpoint(),this.onChangeAnnotation(),this.session.getUseWrapMode()&&this.renderer.adjustWrapLimit(),this.renderer.updateFull(),this._emit("changeSession",{session:a,oldSession:b})},this.getSession=function(){return this.session},this.setValue=function(a,b){return this.session.doc.setValue(a),b?b==1?this.navigateFileEnd():b==-1&&this.navigateFileStart():this.selectAll(),a},this.getValue=function(){return this.session.getValue()},this.getSelection=function(){return this.selection},this.resize=function(a){this.renderer.onResize(a)},this.setTheme=function(a){this.renderer.setTheme(a)},this.getTheme=function(){return this.renderer.getTheme()},this.setStyle=function(a){this.renderer.setStyle(a)},this.unsetStyle=function(a){this.renderer.unsetStyle(a)},this.setFontSize=function(a){this.container.style.fontSize=a,this.renderer.updateFontSize()},this.$highlightBrackets=function(){this.session.$bracketHighlight&&(this.session.removeMarker(this.session.$bracketHighlight),this.session.$bracketHighlight=null);if(this.$highlightPending)return;var a=this;this.$highlightPending=!0,setTimeout(function(){a.$highlightPending=!1;var b=a.session.findMatchingBracket(a.getCursorPosition());if(b){var c=new m(b.row,b.column,b.row,b.column+1);a.session.$bracketHighlight=a.session.addMarker(c,"ace_bracket","text")}},10)},this.focus=function(){var a=this;setTimeout(function(){a.textInput.focus()}),this.textInput.focus()},this.isFocused=function(){return this.textInput.isFocused()},this.blur=function(){this.textInput.blur()},this.onFocus=function(){if(this.$isFocused)return;this.$isFocused=!0,this.renderer.showCursor(),this.renderer.visualizeFocus(),this._emit("focus")},this.onBlur=function(){if(!this.$isFocused)return;this.$isFocused=!1,this.renderer.hideCursor(),this.renderer.visualizeBlur(),this._emit("blur")},this.$cursorChange=function(){this.renderer.updateCursor()},this.onDocumentChange=function(a){var b=a.data,c=b.range,d;c.start.row==c.end.row&&b.action!="insertLines"&&b.action!="removeLines"?d=c.end.row:d=Infinity,this.renderer.updateLines(c.start.row,d),this._emit("change",a),this.$cursorChange()},this.onTokenizerUpdate=function(a){var b=a.data;this.renderer.updateLines(b.first,b.last)},this.onScrollTopChange=function(){this.renderer.scrollToY(this.session.getScrollTop())},this.onScrollLeftChange=function(){this.renderer.scrollToX(this.session.getScrollLeft())},this.onCursorChange=function(){this.$cursorChange(),this.$blockScrolling||this.renderer.scrollCursorIntoView(),this.$highlightBrackets(),this.$updateHighlightActiveLine(),this._emit("changeSelection")},this.$updateHighlightActiveLine=function(){var a=this.getSession();a.$highlightLineMarker&&a.removeMarker(a.$highlightLineMarker),a.$highlightLineMarker=null;if(this.$highlightActiveLine){var b=this.getCursorPosition(),c=this.session.getFoldLine(b.row);if(this.getSelectionStyle()!="line"||!this.selection.isMultiLine()){var d;c?d=new m(c.start.row,0,c.end.row+1,0):d=new m(b.row,0,b.row+1,0),a.$highlightLineMarker=a.addMarker(d,"ace_active_line","background")}}},this.onSelectionChange=function(a){var b=this.session;b.$selectionMarker&&b.removeMarker(b.$selectionMarker),b.$selectionMarker=null;if(!this.selection.isEmpty()){var c=this.selection.getRange(),d=this.getSelectionStyle();b.$selectionMarker=b.addMarker(c,"ace_selection",d)}else this.$updateHighlightActiveLine();var e=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(e),this._emit("changeSelection")},this.$getSelectionHighLightRegexp=function(){var a=this.session,b=this.getSelectionRange();if(b.isEmpty()||b.isMultiLine())return;var c=b.start.column-1,d=b.end.column+1,e=a.getLine(b.start.row),f=e.length,g=e.substring(Math.max(c,0),Math.min(d,f));if(c>=0&&/^[\w\d]/.test(g)||d<=f&&/[\w\d]$/.test(g))return;g=e.substring(b.start.column,b.end.column);if(!/^[\w\d]+$/.test(g))return;var h=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:g});return h},this.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},this.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},this.onChangeBreakpoint=function(){this.renderer.updateBreakpoints()},this.onChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},this.onChangeMode=function(){this.renderer.updateText()},this.onChangeWrapLimit=function(){this.renderer.updateFull()},this.onChangeWrapMode=function(){this.renderer.onResize(!0)},this.onChangeFold=function(){this.$updateHighlightActiveLine(),this.renderer.updateFull()},this.getCopyText=function(){var a="";return this.selection.isEmpty()||(a=this.session.getTextRange(this.getSelectionRange())),this._emit("copy",a),a},this.onCopy=function(){this.commands.exec("copy",this)},this.onCut=function(){this.commands.exec("cut",this)},this.onPaste=function(a){if(this.$readOnly)return;this._emit("paste",a),this.insert(a)},this.insert=function(a){var b=this.session,c=b.getMode(),d=this.getCursorPosition();if(this.getBehavioursEnabled()){var e=c.transformAction(b.getState(d.row),"insertion",this,b,a);e&&(a=e.text)}a=a.replace(" ",this.session.getTabString());if(!this.selection.isEmpty())d=this.session.remove(this.getSelectionRange()),this.clearSelection();else if(this.session.getOverwrite()){var f=new m.fromPoints(d,d);f.end.column+=a.length,this.session.remove(f)}this.clearSelection();var g=d.column,h=b.getState(d.row),i=c.checkOutdent(h,b.getLine(d.row),a),j=b.getLine(d.row),k=c.getNextLineIndent(h,j.slice(0,d.column),b.getTabString()),l=b.insert(d,a);e&&e.selection&&(e.selection.length==2?this.selection.setSelectionRange(new m(d.row,g+e.selection[0],d.row,g+e.selection[1])):this.selection.setSelectionRange(new m(d.row+e.selection[0],e.selection[1],d.row+e.selection[2],e.selection[3])));var h=b.getState(d.row);if(b.getDocument().isNewLine(a)){this.moveCursorTo(d.row+1,0);var n=b.getTabSize(),o=Number.MAX_VALUE;for(var p=d.row+1;p<=l.row;++p){var q=0;j=b.getLine(p);for(var r=0;r<j.length;++r)if(j.charAt(r)==" ")q+=n;else{if(j.charAt(r)!=" ")break;q+=1}/[^\s]/.test(j)&&(o=Math.min(q,o))}for(var p=d.row+1;p<=l.row;++p){var s=o;j=b.getLine(p);for(var r=0;r<j.length&&s>0;++r)j.charAt(r)==" "?s-=n:j.charAt(r)==" "&&(s-=1);b.remove(new m(p,0,p,r))}b.indentRows(d.row+1,l.row,k)}i&&c.autoOutdent(h,b,d.row)},this.onTextInput=function(a){this.keyBinding.onTextInput(a)},this.onCommandKey=function(a,b,c){this.keyBinding.onCommandKey(a,b,c)},this.setOverwrite=function(a){this.session.setOverwrite(a)},this.getOverwrite=function(){return this.session.getOverwrite()},this.toggleOverwrite=function(){this.session.toggleOverwrite()},this.setScrollSpeed=function(a){this.$mouseHandler.setScrollSpeed(a)},this.getScrollSpeed=function(){return this.$mouseHandler.getScrollSpeed()},this.setDragDelay=function(a){this.$mouseHandler.setDragDelay(a)},this.getDragDelay=function(){return this.$mouseHandler.getDragDelay()},this.$selectionStyle="line",this.setSelectionStyle=function(a){if(this.$selectionStyle==a)return;this.$selectionStyle=a,this.onSelectionChange(),this._emit("changeSelectionStyle",{data:a})},this.getSelectionStyle=function(){return this.$selectionStyle},this.$highlightActiveLine=!0,this.setHighlightActiveLine=function(a){if(this.$highlightActiveLine==a)return;this.$highlightActiveLine=a,this.$updateHighlightActiveLine()},this.getHighlightActiveLine=function(){return this.$highlightActiveLine},this.$highlightGutterLine=!0,this.setHighlightGutterLine=function(a){if(this.$highlightGutterLine==a)return;this.renderer.setHighlightGutterLine(a),this.$highlightGutterLine=a},this.getHighlightGutterLine=function(){return this.$highlightGutterLine},this.$highlightSelectedWord=!0,this.setHighlightSelectedWord=function(a){if(this.$highlightSelectedWord==a)return;this.$highlightSelectedWord=a,this.$onSelectionChange()},this.getHighlightSelectedWord=function(){return this.$highlightSelectedWord},this.setAnimatedScroll=function(a){this.renderer.setAnimatedScroll(a)},this.getAnimatedScroll=function(){return this.renderer.getAnimatedScroll()},this.setShowInvisibles=function(a){this.renderer.setShowInvisibles(a)},this.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},this.setDisplayIndentGuides=function(a){this.renderer.setDisplayIndentGuides(a)},this.getDisplayIndentGuides=function(){return this.renderer.getDisplayIndentGuides()},this.setShowPrintMargin=function(a){this.renderer.setShowPrintMargin(a)},this.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},this.setPrintMarginColumn=function(a){this.renderer.setPrintMarginColumn(a)},this.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},this.$readOnly=!1,this.setReadOnly=function(a){this.$readOnly=a},this.getReadOnly=function(){return this.$readOnly},this.$modeBehaviours=!0,this.setBehavioursEnabled=function(a){this.$modeBehaviours=a},this.getBehavioursEnabled=function(){return this.$modeBehaviours},this.setShowFoldWidgets=function(a){var b=this.renderer.$gutterLayer;if(b.getShowFoldWidgets()==a)return;this.renderer.$gutterLayer.setShowFoldWidgets(a),this.$showFoldWidgets=a,this.renderer.updateFull()},this.getShowFoldWidgets=function(){return this.renderer.$gutterLayer.getShowFoldWidgets()},this.setFadeFoldWidgets=function(a){this.renderer.setFadeFoldWidgets(a)},this.getFadeFoldWidgets=function(){return this.renderer.getFadeFoldWidgets()},this.remove=function(a){this.selection.isEmpty()&&(a=="left"?this.selection.selectLeft():this.selection.selectRight());var b=this.getSelectionRange();if(this.getBehavioursEnabled()){var c=this.session,d=c.getState(b.start.row),e=c.getMode().transformAction(d,"deletion",this,c,b);e&&(b=e)}this.session.remove(b),this.clearSelection()},this.removeWordRight=function(){this.selection.isEmpty()&&this.selection.selectWordRight(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeWordLeft=function(){this.selection.isEmpty()&&this.selection.selectWordLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeToLineStart=function(){this.selection.isEmpty()&&this.selection.selectLineStart(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeToLineEnd=function(){this.selection.isEmpty()&&this.selection.selectLineEnd();var a=this.getSelectionRange();a.start.column==a.end.column&&a.start.row==a.end.row&&(a.end.column=0,a.end.row++),this.session.remove(a),this.clearSelection()},this.splitLine=function(){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var a=this.getCursorPosition();this.insert("\n"),this.moveCursorToPosition(a)},this.transposeLetters=function(){if(!this.selection.isEmpty())return;var a=this.getCursorPosition(),b=a.column;if(b===0)return;var c=this.session.getLine(a.row),d,e;b<c.length?(d=c.charAt(b)+c.charAt(b-1),e=new m(a.row,b-1,a.row,b+1)):(d=c.charAt(b-1)+c.charAt(b-2),e=new m(a.row,b-2,a.row,b)),this.session.replace(e,d)},this.toLowerCase=function(){var a=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var b=this.getSelectionRange(),c=this.session.getTextRange(b);this.session.replace(b,c.toLowerCase()),this.selection.setSelectionRange(a)},this.toUpperCase=function(){var a=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var b=this.getSelectionRange(),c=this.session.getTextRange(b);this.session.replace(b,c.toUpperCase()),this.selection.setSelectionRange(a)},this.indent=function(){var a=this.session,b=this.getSelectionRange();if(!(b.start.row<b.end.row||b.start.column<b.end.column)){var d;if(this.session.getUseSoftTabs()){var f=a.getTabSize(),g=this.getCursorPosition(),h=a.documentToScreenColumn(g.row,g.column),i=f-h%f;d=e.stringRepeat(" ",i)}else d=" ";return this.insert(d)}var c=this.$getSelectedRows();a.indentRows(c.first,c.last," ")},this.blockOutdent=function(){var a=this.session.getSelection();this.session.outdentRows(a.getRange())},this.toggleCommentLines=function(){var a=this.session.getState(this.getCursorPosition().row),b=this.$getSelectedRows();this.session.getMode().toggleCommentLines(a,this.session,b.first,b.last)},this.removeLines=function(){var a=this.$getSelectedRows(),b;a.first===0||a.last+1<this.session.getLength()?b=new m(a.first,0,a.last+1,0):b=new m(a.first-1,this.session.getLine(a.first-1).length,a.last,this.session.getLine(a.last).length),this.session.remove(b),this.clearSelection()},this.duplicateSelection=function(){var a=this.selection,b=this.session,c=a.getRange();if(c.isEmpty()){var d=c.start.row;b.duplicateLines(d,d)}else{var e=a.isBackwards(),f=a.isBackwards()?c.start:c.end,g=b.insert(f,b.getTextRange(c),!1);c.start=f,c.end=g,a.setSelectionRange(c,e)}},this.moveLinesDown=function(){this.$moveLines(function(a,b){return this.session.moveLinesDown(a,b)})},this.moveLinesUp=function(){this.$moveLines(function(a,b){return this.session.moveLinesUp(a,b)})},this.moveText=function(a,b){return this.$readOnly?null:this.session.moveText(a,b)},this.copyLinesUp=function(){this.$moveLines(function(a,b){return this.session.duplicateLines(a,b),0})},this.copyLinesDown=function(){this.$moveLines(function(a,b){return this.session.duplicateLines(a,b)})},this.$moveLines=function(a){var b=this.$getSelectedRows(),c=this.selection;if(!c.isMultiLine())var d=c.getRange(),e=c.isBackwards();var f=a.call(this,b.first,b.last);d?(d.start.row+=f,d.end.row+=f,c.setSelectionRange(d,e)):(c.setSelectionAnchor(b.last+f+1,0),c.$moveSelection(function(){c.moveCursorTo(b.first+f,0)}))},this.$getSelectedRows=function(){var a=this.getSelectionRange().collapseRows();return{first:a.start.row,last:a.end.row}},this.onCompositionStart=function(a){this.renderer.showComposition(this.getCursorPosition())},this.onCompositionUpdate=function(a){this.renderer.setCompositionText(a)},this.onCompositionEnd=function(){this.renderer.hideComposition()},this.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},this.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},this.isRowVisible=function(a){return a>=this.getFirstVisibleRow()&&a<=this.getLastVisibleRow()},this.isRowFullyVisible=function(a){return a>=this.renderer.getFirstFullyVisibleRow()&&a<=this.renderer.getLastFullyVisibleRow()},this.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},this.$moveByPage=function(a,b){var c=this.renderer,d=this.renderer.layerConfig,e=a*Math.floor(d.height/d.lineHeight);this.$blockScrolling++,b==1?this.selection.$moveSelection(function(){this.moveCursorBy(e,0)}):b==0&&(this.selection.moveCursorBy(e,0),this.selection.clearSelection()),this.$blockScrolling--;var f=c.scrollTop;c.scrollBy(0,e*d.lineHeight),b!=null&&c.scrollCursorIntoView(null,.5),c.animateScrolling(f)},this.selectPageDown=function(){this.$moveByPage(1,!0)},this.selectPageUp=function(){this.$moveByPage(-1,!0)},this.gotoPageDown=function(){this.$moveByPage(1,!1)},this.gotoPageUp=function(){this.$moveByPage(-1,!1)},this.scrollPageDown=function(){this.$moveByPage(1)},this.scrollPageUp=function(){this.$moveByPage(-1)},this.scrollToRow=function(a){this.renderer.scrollToRow(a)},this.scrollToLine=function(a,b,c,d){this.renderer.scrollToLine(a,b,c,d)},this.centerSelection=function(){var a=this.getSelectionRange(),b={row:Math.floor(a.start.row+(a.end.row-a.start.row)/2),column:Math.floor(a.start.column+(a.end.column-a.start.column)/2)};this.renderer.alignCursor(b,.5)},this.getCursorPosition=function(){return this.selection.getCursor()},this.getCursorPositionScreen=function(){return this.session.documentToScreenPosition(this.getCursorPosition())},this.getSelectionRange=function(){return this.selection.getRange()},this.selectAll=function(){this.$blockScrolling+=1,this.selection.selectAll(),this.$blockScrolling-=1},this.clearSelection=function(){this.selection.clearSelection()},this.moveCursorTo=function(a,b){this.selection.moveCursorTo(a,b)},this.moveCursorToPosition=function(a){this.selection.moveCursorToPosition(a)},this.jumpToMatching=function(a){var b=this.getCursorPosition(),c=this.session.getBracketRange(b);if(!c){c=this.find({needle:/[{}()\[\]]/g,preventScroll:!0,start:{row:b.row,column:b.column-1}});if(!c)return;var d=c.start;d.row==b.row&&Math.abs(d.column-b.column)<2&&(c=this.session.getBracketRange(d))}d=c&&c.cursor||d,d&&(a?c&&c.isEqual(this.getSelectionRange())?this.clearSelection():this.selection.selectTo(d.row,d.column):(this.clearSelection(),this.moveCursorTo(d.row,d.column)))},this.gotoLine=function(a,b,c){this.selection.clearSelection(),this.session.unfold({row:a-1,column:b||0}),this.$blockScrolling+=1,this.moveCursorTo(a-1,b||0),this.$blockScrolling-=1,this.isRowFullyVisible(a-1)||this.scrollToLine(a-1,!0,c)},this.navigateTo=function(a,b){this.clearSelection(),this.moveCursorTo(a,b)},this.navigateUp=function(a){this.selection.clearSelection(),a=a||1,this.selection.moveCursorBy(-a,0)},this.navigateDown=function(a){this.selection.clearSelection(),a=a||1,this.selection.moveCursorBy(a,0)},this.navigateLeft=function(a){if(!this.selection.isEmpty()){var b=this.getSelectionRange().start;this.moveCursorToPosition(b)}else{a=a||1;while(a--)this.selection.moveCursorLeft()}this.clearSelection()},this.navigateRight=function(a){if(!this.selection.isEmpty()){var b=this.getSelectionRange().end;this.moveCursorToPosition(b)}else{a=a||1;while(a--)this.selection.moveCursorRight()}this.clearSelection()},this.navigateLineStart=function(){this.selection.moveCursorLineStart(),this.clearSelection()},this.navigateLineEnd=function(){this.selection.moveCursorLineEnd(),this.clearSelection()},this.navigateFileEnd=function(){var a=this.renderer.scrollTop;this.selection.moveCursorFileEnd(),this.clearSelection(),this.renderer.animateScrolling(a)},this.navigateFileStart=function(){var a=this.renderer.scrollTop;this.selection.moveCursorFileStart(),this.clearSelection(),this.renderer.animateScrolling(a)},this.navigateWordRight=function(){this.selection.moveCursorWordRight(),this.clearSelection()},this.navigateWordLeft=function(){this.selection.moveCursorWordLeft(),this.clearSelection()},this.replace=function(a,b){b&&this.$search.set(b);var c=this.$search.find(this.session),d=0;return c?(this.$tryReplace(c,a)&&(d=1),c!==null&&(this.selection.setSelectionRange(c),this.renderer.scrollSelectionIntoView(c.start,c.end)),d):d},this.replaceAll=function(a,b){b&&this.$search.set(b);var c=this.$search.findAll(this.session),d=0;if(!c.length)return d;this.$blockScrolling+=1;var e=this.getSelectionRange();this.clearSelection(),this.selection.moveCursorTo(0,0);for(var f=c.length-1;f>=0;--f)this.$tryReplace(c[f],a)&&d++;return this.selection.setSelectionRange(e),this.$blockScrolling-=1,d},this.$tryReplace=function(a,b){var c=this.session.getTextRange(a);return b=this.$search.replace(c,b),b!==null?(a.end=this.session.replace(a,b),a):null},this.getLastSearchOptions=function(){return this.$search.getOptions()},this.find=function(a,b,c){b||(b={}),typeof a=="string"||a instanceof RegExp?b.needle=a:typeof a=="object"&&d.mixin(b,a);var e=this.selection.getRange();b.needle==null&&(a=this.session.getTextRange(e)||this.$search.$options.needle,a||(e=this.session.getWordRange(e.start.row,e.start.column),a=this.session.getTextRange(e)),this.$search.set({needle:a})),this.$search.set(b),b.start||this.$search.set({start:e});var f=this.$search.find(this.session);if(b.preventScroll)return f;if(f)return this.revealRange(f,c),f;b.backwards?e.start=e.end:e.end=e.start,this.selection.setRange(e)},this.findNext=function(a,b){this.find({skipCurrent:!0,backwards:!1},a,b)},this.findPrevious=function(a,b){this.find(a,{skipCurrent:!0,backwards:!0},b)},this.revealRange=function(a,b){this.$blockScrolling+=1,this.session.unfold(a),this.selection.setSelectionRange(a),this.$blockScrolling-=1;var c=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(a.start,a.end,.5),b!=0&&this.renderer.animateScrolling(c)},this.undo=function(){this.$blockScrolling++,this.session.getUndoManager().undo(),this.$blockScrolling--,this.renderer.scrollCursorIntoView(null,.5)},this.redo=function(){this.$blockScrolling++,this.session.getUndoManager().redo(),this.$blockScrolling--,this.renderer.scrollCursorIntoView(null,.5)},this.destroy=function(){this.renderer.destroy()}}).call(q.prototype),b.Editor=q}),define("ace/lib/lang",["require","exports","module"],function(a,b,c){b.stringReverse=function(a){return a.split("").reverse().join("")},b.stringRepeat=function(a,b){return(new Array(b+1)).join(a)};var d=/^\s\s*/,e=/\s\s*$/;b.stringTrimLeft=function(a){return a.replace(d,"")},b.stringTrimRight=function(a){return a.replace(e,"")},b.copyObject=function(a){var b={};for(var c in a)b[c]=a[c];return b},b.copyArray=function(a){var b=[];for(var c=0,d=a.length;c<d;c++)a[c]&&typeof a[c]=="object"?b[c]=this.copyObject(a[c]):b[c]=a[c];return b},b.deepCopy=function(a){if(typeof a!="object")return a;var b=a.constructor();for(var c in a)typeof a[c]=="object"?b[c]=this.deepCopy(a[c]):b[c]=a[c];return b},b.arrayToMap=function(a){var b={};for(var c=0;c<a.length;c++)b[a[c]]=1;return b},b.createMap=function(a){var b=Object.create(null);for(var c in a)b[c]=a[c];return b},b.arrayRemove=function(a,b){for(var c=0;c<=a.length;c++)b===a[c]&&a.splice(c,1)},b.escapeRegExp=function(a){return a.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},b.getMatchOffsets=function(a,b){var c=[];return a.replace(b,function(a){c.push({offset:arguments[arguments.length-2],length:a.length})}),c},b.deferredCall=function(a){var b=null,c=function(){b=null,a()},d=function(a){return d.cancel(),b=setTimeout(c,a||0),d};return d.schedule=d,d.call=function(){return this.cancel(),a(),d},d.cancel=function(){return clearTimeout(b),b=null,d},d}}),define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/dom"],function(a,b,c){var d=a("../lib/event"),e=a("../lib/useragent"),f=a("../lib/dom"),g=function(a,b){function l(a){try{a?(c.value=g,c.selectionStart=0,c.selectionEnd=1):c.select()}catch(b){}}function m(a){if(!i){var d=a||c.value;d&&(d.length>1&&(d.charAt(0)==g?d=d.substr(1):d.charAt(d.length-1)==g&&(d=d.slice(0,-1))),d&&d!=g&&(j?b.onPaste(d):b.onTextInput(d)))}i=!1,j=!1,l(!0)}function v(){return document.activeElement===c}function w(){setTimeout(function(){k&&(c.style.cssText=k,k=""),m(),b.renderer.$keepTextAreaAtCursor==null&&(b.renderer.$keepTextAreaAtCursor=!0,b.renderer.$moveTextAreaToCursor())},0)}var c=f.createElement("textarea");e.isTouchPad&&c.setAttribute("x-palm-disable-auto-cap",!0),c.setAttribute("wrap","off"),c.style.top="-2em",a.insertBefore(c,a.firstChild);var g=e.isIE?"":"\0";l(!0),v()&&b.onFocus();var h=!1,i=!1,j=!1,k="",n=function(a){h||m(a.data),setTimeout(function(){h||l(!0)},0)},o=function(a){setTimeout(function(){h||c.value!=""&&m()},0)},p=function(a){h=!0,b.onCompositionStart(),setTimeout(q,0)},q=function(){if(!h)return;b.onCompositionUpdate(c.value)},r=function(a){h=!1,b.onCompositionEnd()},s=function(a){i=!0;var d=b.getCopyText();d?c.value=d:a.preventDefault(),l(),setTimeout(function(){m()},0)},t=function(a){i=!0;var d=b.getCopyText();d?(c.value=d,b.onCut()):a.preventDefault(),l(),setTimeout(function(){m()},0)};d.addCommandKeyListener(c,b.onCommandKey.bind(b)),d.addListener(c,"input",n);if(e.isOldIE){var u={13:1,27:1};d.addListener(c,"keyup",function(a){h&&(!c.value||u[a.keyCode])&&setTimeout(r,0);if((c.value.charCodeAt(0)|0)<129)return;h?q():p()}),d.addListener(c,"propertychange",function(){c.value!=g&&setTimeout(m,0)})}d.addListener(c,"paste",function(a){j=!0,a.clipboardData&&a.clipboardData.getData?(m(a.clipboardData.getData("text/plain")),a.preventDefault()):o()}),"onbeforecopy"in c&&typeof clipboardData!="undefined"?(d.addListener(c,"beforecopy",function(a){if(k)return;var c=b.getCopyText();c?clipboardData.setData("Text",c):a.preventDefault()}),d.addListener(a,"keydown",function(a){if(a.ctrlKey&&a.keyCode==88){var c=b.getCopyText();c&&(clipboardData.setData("Text",c),b.onCut()),d.preventDefault(a)}}),d.addListener(c,"cut",t)):!e.isOpera||"KeyboardEvent"in window?(d.addListener(c,"copy",s),d.addListener(c,"cut",t)):d.addListener(a,"keydown",function(a){if(e.isMac&&!a.metaKey||!a.ctrlKey)return;if(a.keyCode==88||a.keyCode==67){var d=b.getCopyText();d&&(c.value=d,c.select(),a.keyCode==88&&b.onCut())}}),d.addListener(c,"compositionstart",p),e.isGecko&&d.addListener(c,"text",q),e.isWebKit&&d.addListener(c,"keyup",q),d.addListener(c,"compositionend",r),d.addListener(c,"blur",function(){b.onBlur()}),d.addListener(c,"focus",function(){b.onFocus(),l()}),this.focus=function(){l(),c.focus()},this.blur=function(){c.blur()},this.isFocused=v,this.getElement=function(){return c},this.onContextMenu=function(a){k||(k=c.style.cssText),c.style.cssText="position:fixed; z-index:100000;"+(e.isIE?"background:rgba(0, 0, 0, 0.03); opacity:0.1;":"")+"left:"+(a.clientX-2)+"px; top:"+(a.clientY-2)+"px;",b.selection.isEmpty()?c.value="":l(!0);if(a.type!="mousedown")return;b.renderer.$keepTextAreaAtCursor&&(b.renderer.$keepTextAreaAtCursor=null),e.isWin&&(e.isGecko||e.isIE)&&d.capture(b.container,function(a){c.style.left=a.clientX-2+"px",c.style.top=a.clientY-2+"px"},w)},this.onContextMenuClose=w,e.isGecko||d.addListener(c,"contextmenu",function(a){b.textInput.onContextMenu(a),w()})};b.TextInput=g}),define("ace/mouse/mouse_handler",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/mouse/default_handlers","ace/mouse/default_gutter_handler","ace/mouse/mouse_event","ace/mouse/dragdrop"],function(a,b,c){var d=a("../lib/event"),e=a("../lib/useragent"),f=a("./default_handlers").DefaultHandlers,g=a("./default_gutter_handler").GutterHandler,h=a("./mouse_event").MouseEvent,i=a("./dragdrop").DragdropHandler,j=function(a){this.editor=a,new f(this),new g(this),new i(this),d.addListener(a.container,"mousedown",function(b){return a.focus(),d.preventDefault(b)});var b=a.renderer.getMouseEventTarget();d.addListener(b,"click",this.onMouseEvent.bind(this,"click")),d.addListener(b,"mousemove",this.onMouseMove.bind(this,"mousemove")),d.addMultiMouseDownListener(b,[300,300,250],this,"onMouseEvent"),d.addMouseWheelListener(a.container,this.onMouseWheel.bind(this,"mousewheel"));var c=a.renderer.$gutter;d.addListener(c,"mousedown",this.onMouseEvent.bind(this,"guttermousedown")),d.addListener(c,"click",this.onMouseEvent.bind(this,"gutterclick")),d.addListener(c,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick")),d.addListener(c,"mousemove",this.onMouseEvent.bind(this,"guttermousemove"))};(function(){this.$scrollSpeed=1,this.setScrollSpeed=function(a){this.$scrollSpeed=a},this.getScrollSpeed=function(){return this.$scrollSpeed},this.onMouseEvent=function(a,b){this.editor._emit(a,new h(b,this.editor))},this.$dragDelay=250,this.setDragDelay=function(a){this.$dragDelay=a},this.getDragDelay=function(){return this.$dragDelay},this.onMouseMove=function(a,b){var c=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;if(!c||!c.length)return;this.editor._emit(a,new h(b,this.editor))},this.onMouseWheel=function(a,b){var c=new h(b,this.editor);c.speed=this.$scrollSpeed*2,c.wheelX=b.wheelX,c.wheelY=b.wheelY,this.editor._emit(a,c)},this.setState=function(a){this.state=a},this.captureMouse=function(a,b){b&&this.setState(b),this.x=a.x,this.y=a.y;var c=this.editor.renderer;c.$keepTextAreaAtCursor&&(c.$keepTextAreaAtCursor=null);var f=this,g=function(a){f.x=a.clientX,f.y=a.clientY},h=function(a){clearInterval(j),f[f.state+"End"]&&f[f.state+"End"](a),f.$clickSelection=null,c.$keepTextAreaAtCursor==null&&(c.$keepTextAreaAtCursor=!0,c.$moveTextAreaToCursor())},i=function(){f[f.state]&&f[f.state]()};if(e.isOldIE&&a.domEvent.type=="dblclick"){setTimeout(function(){i(),h(a.domEvent)});return}d.capture(this.editor.container,g,h);var j=setInterval(i,20)}}).call(j.prototype),b.MouseHandler=j}),define("ace/mouse/default_handlers",["require","exports","module","ace/lib/dom","ace/lib/useragent"],function(a,b,c){function g(a){a.$clickSelection=null;var b=a.editor;b.setDefaultHandler("mousedown",this.onMouseDown.bind(a)),b.setDefaultHandler("dblclick",this.onDoubleClick.bind(a)),b.setDefaultHandler("tripleclick",this.onTripleClick.bind(a)),b.setDefaultHandler("quadclick",this.onQuadClick.bind(a)),b.setDefaultHandler("mousewheel",this.onMouseWheel.bind(a));var c=["select","startSelect","drag","dragEnd","dragWait","dragWaitEnd","startDrag","focusWait"];c.forEach(function(b){a[b]=this[b]},this),a.selectByLines=this.extendSelectionBy.bind(a,"getLineRange"),a.selectByWords=this.extendSelectionBy.bind(a,"getWordRange"),a.$focusWaitTimout=250}function h(a,b,c,d){return Math.sqrt(Math.pow(c-a,2)+Math.pow(d-b,2))}function i(a,b){if(a.start.row==a.end.row)var c=2*b.column-a.start.column-a.end.column;else var c=2*b.row-a.start.row-a.end.row;return c<0?{cursor:a.start,anchor:a.end}:{cursor:a.end,anchor:a.start}}var d=a("../lib/dom"),e=a("../lib/useragent"),f=5;(function(){this.onMouseDown=function(a){var b=a.inSelection(),c=a.getDocumentPosition();this.mousedownEvent=a;var d=this.editor,e=a.getButton();if(e!==0){var f=d.getSelectionRange(),g=f.isEmpty();g&&(d.moveCursorToPosition(c),d.selection.clearSelection()),d.textInput.onContextMenu(a.domEvent);return}if(b&&!d.isFocused()){d.focus();if(this.$focusWaitTimout&&!this.$clickSelection)return this.setState("focusWait"),this.captureMouse(a),a.preventDefault()}return!b||this.$clickSelection||a.getShiftKey()?this.startSelect(c):b&&(this.mousedownEvent.time=(new Date).getTime(),this.setState("dragWait")),this.captureMouse(a),a.preventDefault()},this.startSelect=function(a){a=a||this.editor.renderer.screenToTextCoordinates(this.x,this.y),this.mousedownEvent.getShiftKey()?this.editor.selection.selectToPosition(a):this.$clickSelection||(this.editor.moveCursorToPosition(a),this.editor.selection.clearSelection()),this.setState("select")},this.select=function(){var a,b=this.editor,c=b.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var d=this.$clickSelection.comparePoint(c);if(d==-1)a=this.$clickSelection.end;else if(d==1)a=this.$clickSelection.start;else{var e=i(this.$clickSelection,c);c=e.cursor,a=e.anchor}b.selection.setSelectionAnchor(a.row,a.column)}b.selection.selectToPosition(c),b.renderer.scrollCursorIntoView()},this.extendSelectionBy=function(a){var b,c=this.editor,d=c.renderer.screenToTextCoordinates(this.x,this.y),e=c.selection[a](d.row,d.column);if(this.$clickSelection){var f=this.$clickSelection.comparePoint(e.start),g=this.$clickSelection.comparePoint(e.end);if(f==-1&&g<=0){b=this.$clickSelection.end;if(e.end.row!=d.row||e.end.column!=d.column)d=e.start}else if(g==1&&f>=0){b=this.$clickSelection.start;if(e.start.row!=d.row||e.start.column!=d.column)d=e.end}else if(f==-1&&g==1)d=e.end,b=e.start;else{var h=i(this.$clickSelection,d);d=h.cursor,b=h.anchor}c.selection.setSelectionAnchor(b.row,b.column)}c.selection.selectToPosition(d),c.renderer.scrollCursorIntoView()},this.startDrag=function(){var a=this.editor;this.setState("drag"),this.dragRange=a.getSelectionRange();var b=a.getSelectionStyle();this.dragSelectionMarker=a.session.addMarker(this.dragRange,"ace_selection",b),a.clearSelection(),d.addCssClass(a.container,"ace_dragging"),this.$dragKeybinding||(this.$dragKeybinding={handleKeyboard:function(a,b,c,d){if(c=="esc")return{command:this.command}},command:{exec:function(a){var b=a.$mouseHandler;b.dragCursor=null,b.dragEnd(),b.startSelect()}}}),a.keyBinding.addKeyboardHandler(this.$dragKeybinding)},this.focusWait=function(){var a=h(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),b=(new Date).getTime();(a>f||b-this.mousedownEvent.time>this.$focusWaitTimout)&&this.startSelect()},this.dragWait=function(a){var b=h(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),c=(new Date).getTime(),d=this.editor;b>f?this.startSelect(this.mousedownEvent.getDocumentPosition()):c-this.mousedownEvent.time>d.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(a){this.mousedownEvent.domEvent=a,this.startSelect()},this.drag=function(){var a=this.editor;this.dragCursor=a.renderer.screenToTextCoordinates(this.x,this.y),a.moveCursorToPosition(this.dragCursor),a.renderer.scrollCursorIntoView()},this.dragEnd=function(a){var b=this.editor,c=this.dragCursor,e=this.dragRange;d.removeCssClass(b.container,"ace_dragging"),b.session.removeMarker(this.dragSelectionMarker),b.keyBinding.removeKeyboardHandler(this.$dragKeybinding);if(!c)return;b.clearSelection();if(a&&(a.ctrlKey||a.altKey)){var f=b.session,g=e;g.end=f.insert(c,f.getTextRange(e)),g.start=c}else{if(e.contains(c.row,c.column))return;var g=b.moveText(e,c)}if(!g)return;b.selection.setSelectionRange(g)},this.onDoubleClick=function(a){var b=a.getDocumentPosition(),c=this.editor,d=c.session,e=d.getBracketRange(b);if(e){e.isEmpty()&&(e.start.column--,e.end.column++),this.$clickSelection=e,this.setState("select");return}this.$clickSelection=c.selection.getWordRange(b.row,b.column),this.setState("selectByWords")},this.onTripleClick=function(a){var b=a.getDocumentPosition(),c=this.editor;this.setState("selectByLines"),this.$clickSelection=c.selection.getLineRange(b.row)},this.onQuadClick=function(a){var b=this.editor;b.selectAll(),this.$clickSelection=b.getSelectionRange(),this.setState("null")},this.onMouseWheel=function(a){if(a.getShiftKey()||a.getAccelKey())return;var b=this.editor,c=b.renderer.isScrollableBy(a.wheelX*a.speed,a.wheelY*a.speed);if(c)this.$passScrollEvent=!1;else{if(this.$passScrollEvent)return;if(!this.$scrollStopTimeout){var d=this;this.$scrollStopTimeout=setTimeout(function(){d.$passScrollEvent=!0,d.$scrollStopTimeout=null},200)}}return b.renderer.scrollBy(a.wheelX*a.speed,a.wheelY*a.speed),a.preventDefault()}}).call(g.prototype),b.DefaultHandlers=g}),define("ace/mouse/default_gutter_handler",["require","exports","module","ace/lib/dom","ace/lib/event"],function(a,b,c){function f(a){function j(){h=d.createElement("div"),h.className="ace_gutter_tooltip",h.style.maxWidth="500px",h.style.display="none",b.container.appendChild(h)}function k(){h||j();var a=g.getDocumentPosition().row,d=c.$annotations[a];if(!d)return l();var e=b.session.getLength();if(a==e){var f=b.renderer.pixelToScreenCoordinates(0,g.y).row,k=g.$pos;if(f>b.session.documentToScreenRow(k.row,k.column))return l()}if(i==d)return;i=d.text.join("\n"),h.style.display="block",h.innerHTML=i,b.on("mousewheel",l),m(g)}function l(){f&&(f=clearTimeout(f)),i&&(h.style.display="none",i=null,b.removeEventListener("mousewheel",l))}function m(a){var c=b.renderer.$gutter.getBoundingClientRect();h.style.left=a.x-c.left+15+"px",a.y+3*b.renderer.lineHeight+15<c.bottom?(h.style.bottom="",h.style.top=a.y-c.top+15+"px"):(h.style.top="",h.style.bottom=c.bottom-a.y+5+"px")}var b=a.editor,c=b.renderer.$gutterLayer;a.editor.setDefaultHandler("guttermousedown",function(d){if(!b.isFocused())return;var e=c.getRegion(d);if(e)return;var f=d.getDocumentPosition().row,g=b.session.selection;return d.getShiftKey()?g.selectTo(f,0):a.$clickSelection=b.selection.getLineRange(f),a.captureMouse(d,"selectByLines"),d.preventDefault()});var f,g,h,i;a.editor.setDefaultHandler("guttermousemove",function(a){var b=a.domEvent.target||a.domEvent.srcElement;if(d.hasCssClass(b,"ace_fold-widget"))return l();i&&m(a),g=a;if(f)return;f=setTimeout(function(){f=null,g?k():l()},50)}),e.addListener(b.renderer.$gutter,"mouseout",function(a){g=null;if(!i||f)return;f=setTimeout(function(){f=null,l()},50)})}var d=a("../lib/dom"),e=a("../lib/event");b.GutterHandler=f}),define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(a,b,c){var d=a("../lib/event"),e=a("../lib/useragent"),f=b.MouseEvent=function(a,b){this.domEvent=a,this.editor=b,this.x=this.clientX=a.clientX,this.y=this.clientY=a.clientY,this.$pos=null,this.$inSelection=null,this.propagationStopped=!1,this.defaultPrevented=!1};(function(){this.stopPropagation=function(){d.stopPropagation(this.domEvent),this.propagationStopped=!0},this.preventDefault=function(){d.preventDefault(this.domEvent),this.defaultPrevented=!0},this.stop=function(){this.stopPropagation(),this.preventDefault()},this.getDocumentPosition=function(){return this.$pos?this.$pos:(this.$pos=this.editor.renderer.screenToTextCoordinates(this.clientX,this.clientY),this.$pos)},this.inSelection=function(){if(this.$inSelection!==null)return this.$inSelection;var a=this.editor;if(a.getReadOnly())this.$inSelection=!1;else{var b=a.getSelectionRange();if(b.isEmpty())this.$inSelection=!1;else{var c=this.getDocumentPosition();this.$inSelection=b.contains(c.row,c.column)}}return this.$inSelection},this.getButton=function(){return d.getButton(this.domEvent)},this.getShiftKey=function(){return this.domEvent.shiftKey},this.getAccelKey=e.isMac?function(){return this.domEvent.metaKey}:function(){return this.domEvent.ctrlKey}}).call(f.prototype)}),define("ace/mouse/dragdrop",["require","exports","module","ace/lib/event"],function(a,b,c){var d=a("../lib/event"),e=function(a){var b=a.editor,c,e,f,g,h,i,j,k=0,l=b.container;d.addListener(l,"dragenter",function(a){k++;if(!c){h=b.getSelectionRange(),i=b.selection.isBackwards();var e=b.getSelectionStyle();c=b.session.addMarker(h,"ace_selection",e),b.clearSelection(),clearInterval(g),g=setInterval(m,20)}return d.preventDefault(a)}),d.addListener(l,"dragover",function(a){return e=a.clientX,f=a.clientY,d.preventDefault(a)});var m=function(){j=b.renderer.screenToTextCoordinates(e,f),b.moveCursorToPosition(j),b.renderer.scrollCursorIntoView()};d.addListener(l,"dragleave",function(a){k--;if(k>0)return;return console.log(a.type,k,a.target),clearInterval(g),b.session.removeMarker(c),c=null,b.selection.setSelectionRange(h,i),d.preventDefault(a)}),d.addListener(l,"drop",function(a){return console.log(a.type,k,a.target),k=0,clearInterval(g),b.session.removeMarker(c),c=null,h.end=b.session.insert(j,a.dataTransfer.getData("Text")),h.start=j,b.focus(),b.selection.setSelectionRange(h),d.preventDefault(a)})};b.DragdropHandler=e}),define("ace/mouse/fold_handler",["require","exports","module"],function(a,b,c){function d(a){a.on("click",function(b){var c=b.getDocumentPosition(),d=a.session,e=d.getFoldAt(c.row,c.column,1);e&&(b.getAccelKey()?d.removeFold(e):d.expandFold(e),b.stop())}),a.on("gutterclick",function(b){var c=a.renderer.$gutterLayer.getRegion(b);if(c=="foldWidgets"){var d=b.getDocumentPosition().row,e=a.session;e.foldWidgets&&e.foldWidgets[d]&&a.session.onFoldWidgetClick(d,b),b.stop()}})}b.FoldHandler=d}),define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(a,b,c){var d=a("../lib/keys"),e=a("../lib/event"),f=function(a){this.$editor=a,this.$data={},this.$handlers=[],this.setDefaultHandler(a.commands)};(function(){this.setDefaultHandler=function(a){this.removeKeyboardHandler(this.$defaultHandler),this.$defaultHandler=a,this.addKeyboardHandler(a,0),this.$data={editor:this.$editor}},this.setKeyboardHandler=function(a){if(this.$handlers[this.$handlers.length-1]==a)return;while(this.$handlers[1])this.removeKeyboardHandler(this.$handlers[1]);this.addKeyboardHandler(a,1)},this.addKeyboardHandler=function(a,b){if(!a)return;var c=this.$handlers.indexOf(a);c!=-1&&this.$handlers.splice(c,1),b==undefined?this.$handlers.push(a):this.$handlers.splice(b,0,a),c==-1&&a.attach&&a.attach(this.$editor)},this.removeKeyboardHandler=function(a){var b=this.$handlers.indexOf(a);return b==-1?!1:(this.$handlers.splice(b,1),a.detach&&a.detach(this.$editor),!0)},this.getKeyboardHandler=function(){return this.$handlers[this.$handlers.length-1]},this.$callKeyboardHandlers=function(a,b,c,d){var f;for(var g=this.$handlers.length;g--;){f=this.$handlers[g].handleKeyboard(this.$data,a,b,c,d);if(f&&f.command)break}if(!f||!f.command)return!1;var h=!1,i=this.$editor.commands;return f.command!="null"?h=i.exec(f.command,this.$editor,f.args,d):h=f.passEvent!=1,h&&d&&a!=-1&&e.stopEvent(d),h},this.onCommandKey=function(a,b,c){var e=d.keyCodeToString(c);this.$callKeyboardHandlers(b,e,c,a)},this.onTextInput=function(a){var b=this.$callKeyboardHandlers(-1,a);b||this.$editor.commands.exec("insertstring",this.$editor,a)}}).call(f.prototype),b.KeyBinding=f}),define("ace/edit_session",["require","exports","module","ace/config","ace/lib/oop","ace/lib/lang","ace/lib/net","ace/lib/event_emitter","ace/selection","ace/mode/text","ace/range","ace/document","ace/background_tokenizer","ace/search_highlight","ace/edit_session/folding","ace/edit_session/bracket_match"],function(a,b,c){var d=a("./config"),e=a("./lib/oop"),f=a("./lib/lang"),g=a("./lib/net"),h=a("./lib/event_emitter").EventEmitter,i=a("./selection").Selection,j=a("./mode/text").Mode,k=a("./range").Range,l=a("./document").Document,m=a("./background_tokenizer").BackgroundTokenizer,n=a("./search_highlight").SearchHighlight,o=function(a,b){this.$modified=!0,this.$breakpoints=[],this.$decorations=[],this.$frontMarkers={},this.$backMarkers={},this.$markerId=1,this.$resetRowCache(0),this.$wrapData=[],this.$foldData=[],this.$rowLengthCache=[],this.$undoSelect=!0,this.$foldData.toString=function(){var a="";return this.forEach(function(b){a+="\n"+b.toString()}),a},typeof a=="object"&&a.getLine?this.setDocument(a):this.setDocument(new l(a)),this.selection=new i(this),this.setMode(b)};(function(){function s(a){return a<4352?!1:a>=4352&&a<=4447||a>=4515&&a<=4519||a>=4602&&a<=4607||a>=9001&&a<=9002||a>=11904&&a<=11929||a>=11931&&a<=12019||a>=12032&&a<=12245||a>=12272&&a<=12283||a>=12288&&a<=12350||a>=12353&&a<=12438||a>=12441&&a<=12543||a>=12549&&a<=12589||a>=12593&&a<=12686||a>=12688&&a<=12730||a>=12736&&a<=12771||a>=12784&&a<=12830||a>=12832&&a<=12871||a>=12880&&a<=13054||a>=13056&&a<=19903||a>=19968&&a<=42124||a>=42128&&a<=42182||a>=43360&&a<=43388||a>=44032&&a<=55203||a>=55216&&a<=55238||a>=55243&&a<=55291||a>=63744&&a<=64255||a>=65040&&a<=65049||a>=65072&&a<=65106||a>=65108&&a<=65126||a>=65128&&a<=65131||a>=65281&&a<=65376||a>=65504&&a<=65510}e.implement(this,h),this.setDocument=function(a){if(this.doc)throw new Error("Document is already set");this.doc=a,a.on("change",this.onChange.bind(this)),this.on("changeFold",this.onChangeFold.bind(this)),this.bgTokenizer&&(this.bgTokenizer.setDocument(this.getDocument()),this.bgTokenizer.start(0))},this.getDocument=function(){return this.doc},this.$resetRowCache=function(a){if(!a){this.$docRowCache=[],this.$screenRowCache=[];return}var b=this.$getRowCacheIndex(this.$docRowCache,a)+1,c=this.$docRowCache.length;this.$docRowCache.splice(b,c),this.$screenRowCache.splice(b,c)},this.$getRowCacheIndex=function(a,b){var c=0,d=a.length-1;while(c<=d){var e=c+d>>1,f=a[e];if(b>f)c=e+1;else{if(!(b<f))return e;d=e-1}}return c&&c-1},this.onChangeFold=function(a){var b=a.data;this.$resetRowCache(b.start.row)},this.onChange=function(a){var b=a.data;this.$modified=!0,this.$resetRowCache(b.range.start.row);var c=this.$updateInternalDataOnChange(a);!this.$fromUndo&&this.$undoManager&&!b.ignore&&(this.$deltasDoc.push(b),c&&c.length!=0&&this.$deltasFold.push({action:"removeFolds",folds:c}),this.$informUndoManager.schedule()),this.bgTokenizer.$updateOnChange(b),this._emit("change",a)},this.setValue=function(a){this.doc.setValue(a),this.selection.moveCursorTo(0,0),this.selection.clearSelection(),this.$resetRowCache(0),this.$deltas=[],this.$deltasDoc=[],this.$deltasFold=[],this.getUndoManager().reset()},this.getValue=this.toString=function(){return this.doc.getValue()},this.getSelection=function(){return this.selection},this.getState=function(a){return this.bgTokenizer.getState(a)},this.getTokens=function(a){return this.bgTokenizer.getTokens(a)},this.getTokenAt=function(a,b){var c=this.bgTokenizer.getTokens(a),d,e=0;if(b==null)f=c.length-1,e=this.getLine(a).length;else for(var f=0;f<c.length;f++){e+=c[f].value.length;if(e>=b)break}return d=c[f],d?(d.index=f,d.start=e-d.value.length,d):null},this.highlight=function(a){if(!this.$searchHighlight){var b=new n(null,"ace_selected_word","text");this.$searchHighlight=this.addDynamicMarker(b)}this.$searchHighlight.setRegexp(a)},this.setUndoManager=function(a){this.$undoManager=a,this.$deltas=[],this.$deltasDoc=[],this.$deltasFold=[],this.$informUndoManager&&this.$informUndoManager.cancel();if(a){var b=this;this.$syncInformUndoManager=function(){b.$informUndoManager.cancel(),b.$deltasFold.length&&(b.$deltas.push({group:"fold",deltas:b.$deltasFold}),b.$deltasFold=[]),b.$deltasDoc.length&&(b.$deltas.push({group:"doc",deltas:b.$deltasDoc}),b.$deltasDoc=[]),b.$deltas.length>0&&a.execute({action:"aceupdate",args:[b.$deltas,b]}),b.$deltas=[]},this.$informUndoManager=f.deferredCall(this.$syncInformUndoManager)}},this.$defaultUndoManager={undo:function(){},redo:function(){},reset:function(){}},this.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},this.getTabString=function(){return this.getUseSoftTabs()?f.stringRepeat(" ",this.getTabSize()):" "},this.$useSoftTabs=!0,this.setUseSoftTabs=function(a){if(this.$useSoftTabs===a)return;this.$useSoftTabs=a},this.getUseSoftTabs=function(){return this.$useSoftTabs},this.$tabSize=4,this.setTabSize=function(a){if(isNaN(a)||this.$tabSize===a)return;this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=a,this._emit("changeTabSize")},this.getTabSize=function(){return this.$tabSize},this.isTabStop=function(a){return this.$useSoftTabs&&a.column%this.$tabSize==0},this.$overwrite=!1,this.setOverwrite=function(a){if(this.$overwrite==a)return;this.$overwrite=a,this._emit("changeOverwrite")},this.getOverwrite=function(){return this.$overwrite},this.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},this.addGutterDecoration=function(a,b){this.$decorations[a]||(this.$decorations[a]=""),this.$decorations[a]+=" "+b,this._emit("changeBreakpoint",{})},this.removeGutterDecoration=function(a,b){this.$decorations[a]=(this.$decorations[a]||"").replace(" "+b,""),this._emit("changeBreakpoint",{})},this.getBreakpoints=function(){return this.$breakpoints},this.setBreakpoints=function(a){this.$breakpoints=[];for(var b=0;b<a.length;b++)this.$breakpoints[a[b]]="ace_breakpoint";this._emit("changeBreakpoint",{})},this.clearBreakpoints=function(){this.$breakpoints=[],this._emit("changeBreakpoint",{})},this.setBreakpoint=function(a,b){b===undefined&&(b="ace_breakpoint"),b?this.$breakpoints[a]=b:delete this.$breakpoints[a],this._emit("changeBreakpoint",{})},this.clearBreakpoint=function(a){delete this.$breakpoints[a],this._emit("changeBreakpoint",{})},this.addMarker=function(a,b,c,d){var e=this.$markerId++,f={range:a,type:c||"line",renderer:typeof c=="function"?c:null,clazz:b,inFront:!!d,id:e};return d?(this.$frontMarkers[e]=f,this._emit("changeFrontMarker")):(this.$backMarkers[e]=f,this._emit("changeBackMarker")),e},this.addDynamicMarker=function(a,b){if(!a.update)return;var c=this.$markerId++;return a.id=c,a.inFront=!!b,b?(this.$frontMarkers[c]=a,this._emit("changeFrontMarker")):(this.$backMarkers[c]=a,this._emit("changeBackMarker")),a},this.removeMarker=function(a){var b=this.$frontMarkers[a]||this.$backMarkers[a];if(!b)return;var c=b.inFront?this.$frontMarkers:this.$backMarkers;b&&(delete c[a],this._emit(b.inFront?"changeFrontMarker":"changeBackMarker"))},this.getMarkers=function(a){return a?this.$frontMarkers:this.$backMarkers},this.setAnnotations=function(a){this.$annotations={};for(var b=0;b<a.length;b++){var c=a[b],d=c.row;this.$annotations[d]?this.$annotations[d].push(c):this.$annotations[d]=[c]}this._emit("changeAnnotation",{})},this.getAnnotations=function(){return this.$annotations||{}},this.clearAnnotations=function(){this.$annotations={},this._emit("changeAnnotation",{})},this.$detectNewLine=function(a){var b=a.match(/^.*?(\r?\n)/m);b?this.$autoNewLine=b[1]:this.$autoNewLine="\n"},this.getWordRange=function(a,b){var c=this.getLine(a),d=!1;b>0&&(d=!!c.charAt(b-1).match(this.tokenRe)),d||(d=!!c.charAt(b).match(this.tokenRe));if(d)var e=this.tokenRe;else if(/^\s+$/.test(c.slice(b-1,b+1)))var e=/\s/;else var e=this.nonTokenRe;var f=b;if(f>0){do f--;while(f>=0&&c.charAt(f).match(e));f++}var g=b;while(g<c.length&&c.charAt(g).match(e))g++;return new k(a,f,a,g)},this.getAWordRange=function(a,b){var c=this.getWordRange(a,b),d=this.getLine(c.end.row);while(d.charAt(c.end.column).match(/[ \t]/))c.end.column+=1;return c},this.setNewLineMode=function(a){this.doc.setNewLineMode(a)},this.getNewLineMode=function(){return this.doc.getNewLineMode()},this.$useWorker=!0,this.setUseWorker=function(a){if(this.$useWorker==a)return;this.$useWorker=a,this.$stopWorker(),a&&this.$startWorker()},this.getUseWorker=function(){return this.$useWorker},this.onReloadTokenizer=function(a){var b=a.data;this.bgTokenizer.start(b.first),this._emit("tokenizerUpdate",a)},this.$modes={},this._loadMode=function(b,c){function i(a){if(e.$modes[b])return c(e.$modes[b]);e.$modes[b]=new a.Mode,e.$modes[b].$id=b,e._emit("loadmode",{name:b,mode:e.$modes[b]}),c(e.$modes[b])}function k(a,b){if(!d.get("packaged"))return b();g.loadScript(d.moduleUrl(a,"mode"),b)}this.$modes["null"]||(this.$modes["null"]=this.$modes["ace/mode/text"]=new j);if(this.$modes[b])return c(this.$modes[b]);var e=this,f;try{f=a(b)}catch(h){}if(f&&f.Mode)return i(f);this.$mode||this.$setModePlaceholder(),k(b,function(){a([b],i)})},this.$setModePlaceholder=function(){this.$mode=this.$modes["null"];var a=this.$mode.getTokenizer();if(!this.bgTokenizer){this.bgTokenizer=new m(a);var b=this;this.bgTokenizer.addEventListener("update",function(a){b._emit("tokenizerUpdate",a)})}else this.bgTokenizer.setTokenizer(a);this.bgTokenizer.setDocument(this.getDocument()),this.tokenRe=this.$mode.tokenRe,this.nonTokenRe=this.$mode.nonTokenRe},this.$mode=null,this.$modeId=null,this.setMode=function(a){a=a||"null";if(typeof a=="string"){if(this.$modeId==a)return;this.$modeId=a;var b=this;this._loadMode(a,function(c){if(b.$modeId!==a)return;b.setMode(c)});return}if(this.$mode===a)return;this.$mode=a,this.$modeId=a.$id,this.$stopWorker(),this.$useWorker&&this.$startWorker();var c=a.getTokenizer();if(c.addEventListener!==undefined){var d=this.onReloadTokenizer.bind(this);c.addEventListener("update",d)}if(!this.bgTokenizer){this.bgTokenizer=new m(c);var b=this;this.bgTokenizer.addEventListener("update",function(a){b._emit("tokenizerUpdate",a)})}else this.bgTokenizer.setTokenizer(c);this.bgTokenizer.setDocument(this.getDocument()),this.bgTokenizer.start(0),this.tokenRe=a.tokenRe,this.nonTokenRe=a.nonTokenRe,this.$setFolding(a.foldingRules),this._emit("changeMode")},this.$stopWorker=function(){this.$worker&&this.$worker.terminate(),this.$worker=null},this.$startWorker=function(){if(typeof Worker!="undefined"&&!a.noWorker)try{this.$worker=this.$mode.createWorker(this)}catch(b){console.log("Could not load worker"),console.log(b),this.$worker=null}else this.$worker=null},this.getMode=function(){return this.$mode},this.$scrollTop=0,this.setScrollTop=function(a){a=Math.round(Math.max(0,a));if(this.$scrollTop===a)return;this.$scrollTop=a,this._emit("changeScrollTop",a)},this.getScrollTop=function(){return this.$scrollTop},this.$scrollLeft=0,this.setScrollLeft=function(a){a=Math.round(Math.max(0,a));if(this.$scrollLeft===a)return;this.$scrollLeft=a,this._emit("changeScrollLeft",a)},this.getScrollLeft=function(){return this.$scrollLeft},this.getScreenWidth=function(){return this.$computeWidth(),this.screenWidth},this.$computeWidth=function(a){if(this.$modified||a){this.$modified=!1;if(this.$useWrapMode)return this.screenWidth=this.$wrapLimit;var b=this.doc.getAllLines(),c=this.$rowLengthCache,d=0,e=0,f=this.$foldData[e],g=f?f.start.row:Infinity,h=b.length;for(var i=0;i<h;i++){if(i>g){i=f.end.row+1;if(i>=h)break;f=this.$foldData[e++],g=f?f.start.row:Infinity}c[i]==null&&(c[i]=this.$getStringScreenWidth(b[i])[0]),c[i]>d&&(d=c[i])}this.screenWidth=d}},this.getLine=function(a){return this.doc.getLine(a)},this.getLines=function(a,b){return this.doc.getLines(a,b)},this.getLength=function(){return this.doc.getLength()},this.getTextRange=function(a){return this.doc.getTextRange(a||this.selection.getRange())},this.insert=function(a,b){return this.doc.insert(a,b)},this.remove=function(a){return this.doc.remove(a)},this.undoChanges=function(a,b){if(!a.length)return;this.$fromUndo=!0;var c=null;for(var d=a.length-1;d!=-1;d--){var e=a[d];e.group=="doc"?(this.doc.revertDeltas(e.deltas),c=this.$getUndoSelection(e.deltas,!0,c)):e.deltas.forEach(function(a){this.addFolds(a.folds)},this)}return this.$fromUndo=!1,c&&this.$undoSelect&&!b&&this.selection.setSelectionRange(c),c},this.redoChanges=function(a,b){if(!a.length)return;this.$fromUndo=!0;var c=null;for(var d=0;d<a.length;d++){var e=a[d];e.group=="doc"&&(this.doc.applyDeltas(e.deltas),c=this.$getUndoSelection(e.deltas,!1,c))}return this.$fromUndo=!1,c&&this.$undoSelect&&!b&&this.selection.setSelectionRange(c),c},this.setUndoSelect=function(a){this.$undoSelect=a},this.$getUndoSelection=function(a,b,c){function d(a){var c=a.action=="insertText"||a.action=="insertLines";return b?!c:c}var e=a[0],f,g,h=!1;d(e)?(f=e.range.clone(),h=!0):(f=k.fromPoints(e.range.start,e.range.start),h=!1);for(var i=1;i<a.length;i++)e=a[i],d(e)?(g=e.range.start,f.compare(g.row,g.column)==-1&&f.setStart(e.range.start),g=e.range.end,f.compare(g.row,g.column)==1&&f.setEnd(e.range.end),h=!0):(g=e.range.start,f.compare(g.row,g.column)==-1&&(f=k.fromPoints(e.range.start,e.range.start)),h=!1);if(c!=null){var j=c.compareRange(f);j==1?f.setStart(c.start):j==-1&&f.setEnd(c.end)}return f},this.replace=function(a,b){return this.doc.replace(a,b)},this.moveText=function(a,b){var c=this.getTextRange(a);this.remove(a);var d=b.row,e=b.column;!a.isMultiLine()&&a.start.row==d&&a.end.column<e&&(e-=c.length);if(a.isMultiLine()&&a.end.row<d){var f=this.doc.$split(c);d-=f.length-1}var g=d+a.end.row-a.start.row,h=a.isMultiLine()?a.end.column:e+a.end.column-a.start.column,i=new k(d,e,g,h);return this.insert(i.start,c),i},this.indentRows=function(a,b,c){c=c.replace(/\t/g,this.getTabString());for(var d=a;d<=b;d++)this.insert({row:d,column:0},c)},this.outdentRows=function(a){var b=a.collapseRows(),c=new k(0,0,0,0),d=this.getTabSize();for(var e=b.start.row;e<=b.end.row;++e){var f=this.getLine(e);c.start.row=e,c.end.row=e;for(var g=0;g<d;++g)if(f.charAt(g)!=" ")break;g<d&&f.charAt(g)==" "?(c.start.column=g,c.end.column=g+1):(c.start.column=0,c.end.column=g),this.remove(c)}},this.moveLinesUp=function(a,b){if(a<=0)return 0;var c=this.doc.removeLines(a,b);return this.doc.insertLines(a-1,c),-1},this.moveLinesDown=function(a,b){if(b>=this.doc.getLength()-1)return 0;var c=this.doc.removeLines(a,b);return this.doc.insertLines(a+1,c),1},this.duplicateLines=function(a,b){var a=this.$clipRowToDocument(a),b=this.$clipRowToDocument(b),c=this.getLines(a,b);this.doc.insertLines(a,c);var d=b-a+1;return d},this.$clipRowToDocument=function(a){return Math.max(0,Math.min(a,this.doc.getLength()-1))},this.$clipColumnToRow=function(a,b){return b<0?0:Math.min(this.doc.getLine(a).length,b)},this.$clipPositionToDocument=function(a,b){b=Math.max(0,b);if(a<0)a=0,b=0;else{var c=this.doc.getLength();a>=c?(a=c-1,b=this.doc.getLine(c-1).length):b=Math.min(this.doc.getLine(a).length,b)}return{row:a,column:b}},this.$clipRangeToDocument=function(a){a.start.row<0?(a.start.row=0,a.start.column=0):a.start.column=this.$clipColumnToRow(a.start.row,a.start.column);var b=this.doc.getLength()-1;return a.end.row>b?(a.end.row=b,a.end.column=this.doc.getLine(b).length):a.end.column=this.$clipColumnToRow(a.end.row,a.end.column),a},this.$wrapLimit=80,this.$useWrapMode=!1,this.$wrapLimitRange={min:null,max:null},this.setUseWrapMode=function(a){if(a!=this.$useWrapMode){this.$useWrapMode=a,this.$modified=!0,this.$resetRowCache(0);if(a){var b=this.getLength();this.$wrapData=[];for(var c=0;c<b;c++)this.$wrapData.push([]);this.$updateWrapData(0,b-1)}this._emit("changeWrapMode")}},this.getUseWrapMode=function(){return this.$useWrapMode},this.setWrapLimitRange=function(a,b){if(this.$wrapLimitRange.min!==a||this.$wrapLimitRange.max!==b)this.$wrapLimitRange.min=a,this.$wrapLimitRange.max=b,this.$modified=!0,this._emit("changeWrapMode")},this.adjustWrapLimit=function(a){var b=this.$constrainWrapLimit(a);return b!=this.$wrapLimit&&b>0?(this.$wrapLimit=b,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._emit("changeWrapLimit")),!0):!1},this.$constrainWrapLimit=function(a){var b=this.$wrapLimitRange.min;b&&(a=Math.max(b,a));var c=this.$wrapLimitRange.max;return c&&(a=Math.min(c,a)),Math.max(1,a)},this.getWrapLimit=function(){return this.$wrapLimit},this.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},this.$updateInternalDataOnChange=function(a){var b=this.$useWrapMode,c,d=a.data.action,e=a.data.range.start.row,f=a.data.range.end.row,g=a.data.range.start,h=a.data.range.end,i=null;d.indexOf("Lines")!=-1?(d=="insertLines"?f=e+a.data.lines.length:f=e,c=a.data.lines?a.data.lines.length:f-e):c=f-e;if(c!=0)if(d.indexOf("remove")!=-1){this[b?"$wrapData":"$rowLengthCache"].splice(e,c);var j=this.$foldData;i=this.getFoldsInRange(a.data.range),this.removeFolds(i);var k=this.getFoldLine(h.row),l=0;if(k){k.addRemoveChars(h.row,h.column,g.column-h.column),k.shiftRow(-c);var m=this.getFoldLine(e);m&&m!==k&&(m.merge(k),k=m),l=j.indexOf(k)+1}for(l;l<j.length;l++){var k=j[l];k.start.row>=h.row&&k.shiftRow(-c)}f=e}else{var n;if(b){n=[e,0];for(var o=0;o<c;o++)n.push([]);this.$wrapData.splice.apply(this.$wrapData,n)}else n=Array(c),n.unshift(e,0),this.$rowLengthCache.splice.apply(this.$rowLengthCache,n);var j=this.$foldData,k=this.getFoldLine(e),l=0;if(k){var p=k.range.compareInside(g.row,g.column);p==0?(k=k.split(g.row,g.column),k.shiftRow(c),k.addRemoveChars(f,0,h.column-g.column)):p==-1&&(k.addRemoveChars(e,0,h.column-g.column),k.shiftRow(c)),l=j.indexOf(k)+1}for(l;l<j.length;l++){var k=j[l];k.start.row>=e&&k.shiftRow(c)}}else{c=Math.abs(a.data.range.start.column-a.data.range.end.column),d.indexOf("remove")!=-1&&(i=this.getFoldsInRange(a.data.range),this.removeFolds(i),c=-c);var k=this.getFoldLine(e);k&&k.addRemoveChars(e,g.column,c)}return b&&this.$wrapData.length!=this.doc.getLength()&&console.error("doc.getLength() and $wrapData.length have to be the same!"),b?this.$updateWrapData(e,f):this.$updateRowLengthCache(e,f),i},this.$updateRowLengthCache=function(a,b,c){this.$rowLengthCache[a]=null,this.$rowLengthCache[b]=null},this.$updateWrapData=function(a,b){var c=this.doc.getAllLines(),d=this.getTabSize(),e=this.$wrapData,g=this.$wrapLimit,h,j,k=a;b=Math.min(b,c.length-1);while(k<=b){j=this.getFoldLine(k,j);if(!j)h=this.$getDisplayTokens(f.stringTrimRight(c[k])),e[k]=this.$computeWrapSplits(h,g,d),k++;else{h=[],j.walk(function(a,b,d,e){var f;if(a){f=this.$getDisplayTokens(a,h.length),f[0]=i;for(var g=1;g<f.length;g++)f[g]=l}else f=this.$getDisplayTokens(c[b].substring(e,d),h.length);h=h.concat(f)}.bind(this),j.end.row,c[j.end.row].length+1);while(h.length!=0&&h[h.length-1]>=p)h.pop();e[j.start.row]=this.$computeWrapSplits(h,g,d),k=j.end.row+1}}};var b=1,c=2,i=3,l=4,o=9,p=10,q=11,r=12;this.$computeWrapSplits=function(a,b){function g(b){var d=a.slice(e,b),g=d.length;d.join("").replace(/12/g,function(){g-=1}).replace(/2/g,function(){g-=1}),f+=g,c.push(f),e=b}if(a.length==0)return[];var c=[],d=a.length,e=0,f=0;while(d-e>b){var h=e+b;if(a[h]>=p){while(a[h]>=p)h++;g(h);continue}if(a[h]==i||a[h]==l){for(h;h!=e-1;h--)if(a[h]==i)break;if(h>e){g(h);continue}h=e+b;for(h;h<a.length;h++)if(a[h]!=l)break;if(h==a.length)break;g(h);continue}var j=Math.max(h-10,e-1);while(h>j&&a[h]<i)h--;while(h>j&&a[h]==o)h--;if(h>j){g(++h);continue}h=e+b,g(h)}return c},this.$getDisplayTokens=function(a,d){var e=[],f;d=d||0;for(var g=0;g<a.length;g++){var h=a.charCodeAt(g);if(h==9){f=this.getScreenTabSize(e.length+d),e.push(q);for(var i=1;i<f;i++)e.push(r)}else h==32?e.push(p):h>39&&h<48||h>57&&h<64?e.push(o):h>=4352&&s(h)?e.push(b,c):e.push(b)}return e},this.$getStringScreenWidth=function(a,b,c){if(b==0)return[0,0];b==null&&(b=Infinity),c=c||0;var d,e;for(e=0;e<a.length;e++){d=a.charCodeAt(e),d==9?c+=this.getScreenTabSize(c):d>=4352&&s(d)?c+=2:c+=1;if(c>b)break}return[c,e]},this.getRowLength=function(a){return!this.$useWrapMode||!this.$wrapData[a]?1:this.$wrapData[a].length+1},this.getScreenLastRowColumn=function(a){var b=this.screenToDocumentPosition(a,Number.MAX_VALUE);return this.documentToScreenColumn(b.row,b.column)},this.getDocumentLastRowColumn=function(a,b){var c=this.documentToScreenRow(a,b);return this.getScreenLastRowColumn(c)},this.getDocumentLastRowColumnPosition=function(a,b){var c=this.documentToScreenRow(a,b);return this.screenToDocumentPosition(c,Number.MAX_VALUE/10)},this.getRowSplitData=function(a){return this.$useWrapMode?this.$wrapData[a]:undefined},this.getScreenTabSize=function(a){return this.$tabSize-a%this.$tabSize},this.screenToDocumentRow=function(a,b){return this.screenToDocumentPosition(a,b).row},this.screenToDocumentColumn=function(a,b){return this.screenToDocumentPosition(a,b).column},this.screenToDocumentPosition=function(a,b){if(a<0)return{row:0,column:0};var c,d=0,e=0,f,g=0,h=0,i=this.$screenRowCache,j=this.$getRowCacheIndex(i,a);if(0<j&&j<i.length)var g=i[j],d=this.$docRowCache[j],k=a>g||a==g&&j==i.length-1;else var k=j!=0||!i.length;var l=this.getLength()-1,m=this.getNextFoldLine(d),n=m?m.start.row:Infinity;while(g<=a){h=this.getRowLength(d);if(g+h-1>=a||d>=l)break;g+=h,d++,d>n&&(d=m.end.row+1,m=this.getNextFoldLine(d,m),n=m?m.start.row:Infinity),k&&(this.$docRowCache.push(d),this.$screenRowCache.push(g))}if(m&&m.start.row<=d)c=this.getFoldDisplayLine(m),d=m.start.row;else{if(g+h<=a||d>l)return{row:l,column:this.getLine(l).length};c=this.getLine(d),m=null}if(this.$useWrapMode){var o=this.$wrapData[d];o&&(f=o[a-g],a>g&&o.length&&(e=o[a-g-1]||o[o.length-1],c=c.substring(e)))}return e+=this.$getStringScreenWidth(c,b)[1],this.$useWrapMode&&e>=f&&(e=f-1),m?m.idxToPosition(e):{row:d,column:e}},this.documentToScreenPosition=function(a,b){if(typeof b=="undefined")var c=this.$clipPositionToDocument(a.row,a.column);else c=this.$clipPositionToDocument(a,b);a=c.row,b=c.column;var d=0,e=null,f=null;f=this.getFoldAt(a,b,1),f&&(a=f.start.row,b=f.start.column);var g,h=0,i=this.$docRowCache,j=this.$getRowCacheIndex(i,a);if(0<j&&j<i.length)var h=i[j],d=this.$screenRowCache[j],k=a>h||a==h&&j==i.length-1;else var k=j!=0||!i.length;var l=this.getNextFoldLine(h),m=l?l.start.row:Infinity;while(h<a){if(h>=m){g=l.end.row+1;if(g>a)break;l=this.getNextFoldLine(g,l),m=l?l.start.row:Infinity}else g=h+1;d+=this.getRowLength(h),h=g,k&&(this.$docRowCache.push(h),this.$screenRowCache.push(d))}var n="";l&&h>=m?(n=this.getFoldDisplayLine(l,a,b),e=l.start.row):(n=this.getLine(a).substring(0,b),e=a);if(this.$useWrapMode){var o=this.$wrapData[e],p=0;while(n.length>=o[p])d++,p++;n=n.substring(o[p-1]||0,n.length)}return{row:d,column:this.$getStringScreenWidth(n)[0]}},this.documentToScreenColumn=function(a,b){return this.documentToScreenPosition(a,b).column},this.documentToScreenRow=function(a,b){return this.documentToScreenPosition(a,b).row},this.getScreenLength=function(){var a=0,b=null;if(!this.$useWrapMode){a=this.getLength();var c=this.$foldData;for(var d=0;d<c.length;d++)b=c[d],a-=b.end.row-b.start.row}else{var e=this.$wrapData.length,f=0,d=0,b=this.$foldData[d++],g=b?b.start.row:Infinity;while(f<e)a+=this.$wrapData[f].length+1,f++,f>g&&(f=b.end.row+1,b=this.$foldData[d++],g=b?b.start.row:Infinity)}return a}}).call(o.prototype),a("./edit_session/folding").Folding.call(o.prototype),a("./edit_session/bracket_match").BracketMatch.call(o.prototype),b.EditSession=o}),define("ace/config",["require","exports","module","ace/lib/lang"],function(a,b,c){function g(a){return a.replace(/-(.)/g,function(a,b){return b.toUpperCase()})}"no use strict";var d=a("./lib/lang"),e=function(){return this}(),f={packaged:!1,workerPath:"",modePath:"",themePath:"",suffix:".js",$moduleUrls:{}};b.get=function(a){if(!f.hasOwnProperty(a))throw new Error("Unknown config key: "+a);return f[a]},b.set=function(a,b){if(!f.hasOwnProperty(a))throw new Error("Unknown config key: "+a);f[a]=b},b.all=function(){return d.copyObject(f)},b.moduleUrl=function(a,b){if(f.$moduleUrls[a])return f.$moduleUrls[a];var c=a.split("/");b=b||c[c.length-2]||"";var d=c[c.length-1].replace(b,"").replace(/(^[\-_])|([\-_]$)/,"");return!d&&c.length>1&&(d=c[c.length-2]),this.get(b+"Path")+"/"+b+"-"+d+this.get("suffix")},b.setModuleUrl=function(a,b){return f.$moduleUrls[a]=b},b.init=function(){f.packaged=a.packaged||c.packaged||e.define&&define.packaged;if(!e.document)return"";var d={},h="",i=document.getElementsByTagName("script");for(var j=0;j<i.length;j++){var k=i[j],l=k.src||k.getAttribute("src");if(!l)continue;var m=k.attributes;for(var n=0,o=m.length;n<o;n++){var p=m[n];p.name.indexOf("data-ace-")===0&&(d[g(p.name.replace(/^data-ace-/,""))]=p.value)}var q=l.match(/^(.*)\/ace(\-\w+)?\.js(\?|$)/);q&&(h=q[1])}h&&(d.base=d.base||h,d.packaged=!0),d.workerPath=d.workerPath||d.base,d.modePath=d.modePath||d.base,d.themePath=d.themePath||d.base,delete d.base;for(var r in d)typeof d[r]!="undefined"&&b.set(r,d[r])}}),define("ace/lib/net",["require","exports","module","ace/lib/useragent"],function(a,b,c){var d=a("./useragent");b.get=function(a,c){var d=b.createXhr();d.open("GET",a,!0),d.onreadystatechange=function(a){d.readyState===4&&c(d.responseText)},d.send(null)};var e=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"];b.createXhr=function(){var a,b,c;if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;for(b=0;b<3;b++){c=e[b];try{a=new ActiveXObject(c)}catch(d){}if(a){e=[c];break}}if(!a)throw new Error("createXhr(): XMLHttpRequest not available");return a},b.loadScript=function(a,b){var c=document.getElementsByTagName("head")[0],e=document.createElement("script");e.src=a,c.appendChild(e),d.isOldIE?e.onreadystatechange=function(){this.readyState=="loaded"&&b()}:e.onload=b}}),define("ace/lib/event_emitter",["require","exports","module"],function(a,b,c){var d={};d._emit=d._dispatchEvent=function(a,b){this._eventRegistry=this._eventRegistry||{},this._defaultHandlers=this._defaultHandlers||{};var c=this._eventRegistry[a]||[],d=this._defaultHandlers[a];if(!c.length&&!d)return;if(typeof b!="object"||!b)b={};b.type||(b.type=a),b.stopPropagation||(b.stopPropagation=function(){this.propagationStopped=!0}),b.preventDefault||(b.preventDefault=function(){this.defaultPrevented=!0});for(var e=0;e<c.length;e++){c[e](b);if(b.propagationStopped)break}if(d&&!b.defaultPrevented)return d(b)},d.setDefaultHandler=function(a,b){this._defaultHandlers=this._defaultHandlers||{};if(this._defaultHandlers[a])throw new Error("The default handler for '"+a+"' is already set");this._defaultHandlers[a]=b},d.on=d.addEventListener=function(a,b){this._eventRegistry=this._eventRegistry||{};var c=this._eventRegistry[a];c||(c=this._eventRegistry[a]=[]),c.indexOf(b)==-1&&c.push(b)},d.removeListener=d.removeEventListener=function(a,b){this._eventRegistry=this._eventRegistry||{};var c=this._eventRegistry[a];if(!c)return;var d=c.indexOf(b);d!==-1&&c.splice(d,1)},d.removeAllListeners=function(a){this._eventRegistry&&(this._eventRegistry[a]=[])},b.EventEmitter=d}),define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],function(a,b,c){var d=a("./lib/oop"),e=a("./lib/lang"),f=a("./lib/event_emitter").EventEmitter,g=a("./range").Range,h=function(a){this.session=a,this.doc=a.getDocument(),this.clearSelection(),this.lead=this.selectionLead=this.doc.createAnchor(0,0),this.anchor=this.selectionAnchor=this.doc.createAnchor(0,0);var b=this;this.lead.on("change",function(a){b._emit("changeCursor"),b.$isEmpty||b._emit("changeSelection"),!b.$keepDesiredColumnOnChange&&a.old.column!=a.value.column&&(b.$desiredColumn=null)}),this.selectionAnchor.on("change",function(){b.$isEmpty||b._emit("changeSelection")})};(function(){d.implement(this,f),this.isEmpty=function(){return this.$isEmpty||this.anchor.row==this.lead.row&&this.anchor.column==this.lead.column},this.isMultiLine=function(){return this.isEmpty()?!1:this.getRange().isMultiLine()},this.getCursor=function(){return this.lead.getPosition()},this.setSelectionAnchor=function(a,b){this.anchor.setPosition(a,b),this.$isEmpty&&(this.$isEmpty=!1,this._emit("changeSelection"))},this.getSelectionAnchor=function(){return this.$isEmpty?this.getSelectionLead():this.anchor.getPosition()},this.getSelectionLead=function(){return this.lead.getPosition()},this.shiftSelection=function(a){if(this.$isEmpty){this.moveCursorTo(this.lead.row,this.lead.column+a);return}var b=this.getSelectionAnchor(),c=this.getSelectionLead(),d=this.isBackwards();(!d||b.column!==0)&&this.setSelectionAnchor(b.row,b.column+a),(d||c.column!==0)&&this.$moveSelection(function(){this.moveCursorTo(c.row,c.column+a)})},this.isBackwards=function(){var a=this.anchor,b=this.lead;return a.row>b.row||a.row==b.row&&a.column>b.column},this.getRange=function(){var a=this.anchor,b=this.lead;return this.isEmpty()?g.fromPoints(b,b):this.isBackwards()?g.fromPoints(b,a):g.fromPoints(a,b)},this.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit("changeSelection"))},this.selectAll=function(){var a=this.doc.getLength()-1;this.setSelectionAnchor(0,0),this.moveCursorTo(a,this.doc.getLine(a).length)},this.setRange=this.setSelectionRange=function(a,b){b?(this.setSelectionAnchor(a.end.row,a.end.column),this.selectTo(a.start.row,a.start.column)):(this.setSelectionAnchor(a.start.row,a.start.column),this.selectTo(a.end.row,a.end.column)),this.$desiredColumn=null},this.$moveSelection=function(a){var b=this.lead;this.$isEmpty&&this.setSelectionAnchor(b.row,b.column),a.call(this)},this.selectTo=function(a,b){this.$moveSelection(function(){this.moveCursorTo(a,b)})},this.selectToPosition=function(a){this.$moveSelection(function(){this.moveCursorToPosition(a)})},this.selectUp=function(){this.$moveSelection(this.moveCursorUp)},this.selectDown=function(){this.$moveSelection(this.moveCursorDown)},this.selectRight=function(){this.$moveSelection(this.moveCursorRight)},this.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},this.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},this.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},this.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},this.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},this.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},this.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},this.getWordRange=function(a,b){if(typeof b=="undefined"){var c=a||this.lead;a=c.row,b=c.column}return this.session.getWordRange(a,b)},this.selectWord=function(){this.setSelectionRange(this.getWordRange())},this.selectAWord=function(){var a=this.getCursor(),b=this.session.getAWordRange(a.row,a.column);this.setSelectionRange(b)},this.getLineRange=function(a,b){var c=typeof a=="number"?a:this.lead.row,d,e=this.session.getFoldLine(c);return e?(c=e.start.row,d=e.end.row):d=c,b?new g(c,0,d,this.session.getLine(d).length):new g(c,0,d+1,0)},this.selectLine=function(){this.setSelectionRange(this.getLineRange())},this.moveCursorUp=function(){this.moveCursorBy(-1,0)},this.moveCursorDown=function(){this.moveCursorBy(1,0)},this.moveCursorLeft=function(){var a=this.lead.getPosition(),b;if(b=this.session.getFoldAt(a.row,a.column,-1))this.moveCursorTo(b.start.row,b.start.column);else if(a.column==0)a.row>0&&this.moveCursorTo(a.row-1,this.doc.getLine(a.row-1).length);else{var c=this.session.getTabSize();this.session.isTabStop(a)&&this.doc.getLine(a.row).slice(a.column-c,a.column).split(" ").length-1==c?this.moveCursorBy(0,-c):this.moveCursorBy(0,-1)}},this.moveCursorRight=function(){var a=this.lead.getPosition(),b;if(b=this.session.getFoldAt(a.row,a.column,1))this.moveCursorTo(b.end.row,b.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row<this.doc.getLength()-1&&this.moveCursorTo(this.lead.row+1,0);else{var c=this.session.getTabSize(),a=this.lead;this.session.isTabStop(a)&&this.doc.getLine(a.row).slice(a.column,a.column+c).split(" ").length-1==c?this.moveCursorBy(0,c):this.moveCursorBy(0,1)}},this.moveCursorLineStart=function(){var a=this.lead.row,b=this.lead.column,c=this.session.documentToScreenRow(a,b),d=this.session.screenToDocumentPosition(c,0),e=this.session.getDisplayLine(a,null,d.row,d.column),f=e.match(/^\s*/);f[0].length==b?this.moveCursorTo(d.row,d.column):this.moveCursorTo(d.row,d.column+f[0].length)},this.moveCursorLineEnd=function(){var a=this.lead,b=this.session.getDocumentLastRowColumnPosition(a.row,a.column);if(this.lead.column==b.column){var c=this.session.getLine(b.row);if(b.column==c.length){var d=c.search(/\s+$/);d>0&&(b.column=d)}}this.moveCursorTo(b.row,b.column)},this.moveCursorFileEnd=function(){var a=this.doc.getLength()-1,b=this.doc.getLine(a).length;this.moveCursorTo(a,b)},this.moveCursorFileStart=function(){this.moveCursorTo(0,0)},this.moveCursorLongWordRight=function(){var a=this.lead.row,b=this.lead.column,c=this.doc.getLine(a),d=c.substring(b),e;this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var f=this.session.getFoldAt(a,b,1);if(f){this.moveCursorTo(f.end.row,f.end.column);return}if(e=this.session.nonTokenRe.exec(d))b+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,d=c.substring(b);if(b>=c.length){this.moveCursorTo(a,c.length),this.moveCursorRight(),a<this.doc.getLength()-1&&this.moveCursorWordRight();return}if(e=this.session.tokenRe.exec(d))b+=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0;this.moveCursorTo(a,b)},this.moveCursorLongWordLeft=function(){var a=this.lead.row,b=this.lead.column,c;if(c=this.session.getFoldAt(a,b,-1)){this.moveCursorTo(c.start.row,c.start.column);return}var d=this.session.getFoldStringAt(a,b,-1);d==null&&(d=this.doc.getLine(a).substring(0,b));var f=e.stringReverse(d),g;this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;if(g=this.session.nonTokenRe.exec(f))b-=this.session.nonTokenRe.lastIndex,f=f.slice(this.session.nonTokenRe.lastIndex),this.session.nonTokenRe.lastIndex=0;if(b<=0){this.moveCursorTo(a,0),this.moveCursorLeft(),a>0&&this.moveCursorWordLeft();return}if(g=this.session.tokenRe.exec(f))b-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0;this.moveCursorTo(a,b)},this.$shortWordEndIndex=function(a){var b,c=0,d,e=/\s/,f=this.session.tokenRe;f.lastIndex=0;if(b=this.session.tokenRe.exec(a))c=this.session.tokenRe.lastIndex;else{while((d=a[c])&&e.test(d))c++;if(c<=1){f.lastIndex=0;while((d=a[c])&&!f.test(d)){f.lastIndex=0,c++;if(e.test(d)){if(c>2){c--;break}while((d=a[c])&&e.test(d))c++;if(c>2)break}}}}return f.lastIndex=0,c},this.moveCursorShortWordRight=function(){var a=this.lead.row,b=this.lead.column,c=this.doc.getLine(a),d=c.substring(b),e=this.session.getFoldAt(a,b,1);if(e)return this.moveCursorTo(e.end.row,e.end.column);if(b==c.length){var f=this.doc.getLength();do a++,d=this.doc.getLine(a);while(a<f&&/^\s*$/.test(d));/^\s+/.test(d)||(d=""),b=0}var g=this.$shortWordEndIndex(d);this.moveCursorTo(a,b+g)},this.moveCursorShortWordLeft=function(){var a=this.lead.row,b=this.lead.column,c;if(c=this.session.getFoldAt(a,b,-1))return this.moveCursorTo(c.start.row,c.start.column);var d=this.session.getLine(a).substring(0,b);if(b==0){do a--,d=this.doc.getLine(a);while(a>0&&/^\s*$/.test(d));b=d.length,/\s+$/.test(d)||(d="")}var f=e.stringReverse(d),g=this.$shortWordEndIndex(f);return this.moveCursorTo(a,b-g)},this.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},this.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},this.moveCursorBy=function(a,b){var c=this.session.documentToScreenPosition(this.lead.row,this.lead.column);b===0&&(this.$desiredColumn?c.column=this.$desiredColumn:this.$desiredColumn=c.column);var d=this.session.screenToDocumentPosition(c.row+a,c.column);this.moveCursorTo(d.row,d.column+b,b===0)},this.moveCursorToPosition=function(a){this.moveCursorTo(a.row,a.column)},this.moveCursorTo=function(a,b,c){var d=this.session.getFoldAt(a,b,1);d&&(a=d.start.row,b=d.start.column),this.$keepDesiredColumnOnChange=!0,this.lead.setPosition(a,b),this.$keepDesiredColumnOnChange=!1,c||(this.$desiredColumn=null)},this.moveCursorToScreen=function(a,b,c){var d=this.session.screenToDocumentPosition(a,b);this.moveCursorTo(d.row,d.column,c)},this.detach=function(){this.lead.detach(),this.anchor.detach(),this.session=this.doc=null},this.fromOrientedRange=function(a){this.setSelectionRange(a,a.cursor==a.start),this.$desiredColumn=a.desiredColumn||this.$desiredColumn},this.toOrientedRange=function(a){var b=this.getRange();return a?(a.start.column=b.start.column,a.start.row=b.start.row,a.end.column=b.end.column,a.end.row=b.end.row):a=b,a.cursor=this.isBackwards()?a.start:a.end,a.desiredColumn=this.$desiredColumn,a}}).call(h.prototype),b.Selection=h}),define("ace/range",["require","exports","module"],function(a,b,c){var d=function(a,b,c,d){this.start={row:a,column:b},this.end={row:c,column:d}};(function(){this.isEqual=function(a){return this.start.row==a.start.row&&this.end.row==a.end.row&&this.start.column==a.start.column&&this.end.column==a.end.column},this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(a,b){return this.compare(a,b)==0},this.compareRange=function(a){var b,c=a.end,d=a.start;return b=this.compare(c.row,c.column),b==1?(b=this.compare(d.row,d.column),b==1?2:b==0?1:0):b==-1?-2:(b=this.compare(d.row,d.column),b==-1?-1:b==1?42:0)},this.comparePoint=function(a){return this.compare(a.row,a.column)},this.containsRange=function(a){return this.comparePoint(a.start)==0&&this.comparePoint(a.end)==0},this.intersects=function(a){var b=this.compareRange(a);return b==-1||b==0||b==1},this.isEnd=function(a,b){return this.end.row==a&&this.end.column==b},this.isStart=function(a,b){return this.start.row==a&&this.start.column==b},this.setStart=function(a,b){typeof a=="object"?(this.start.column=a.column,this.start.row=a.row):(this.start.row=a,this.start.column=b)},this.setEnd=function(a,b){typeof a=="object"?(this.end.column=a.column,this.end.row=a.row):(this.end.row=a,this.end.column=b)},this.inside=function(a,b){return this.compare(a,b)==0?this.isEnd(a,b)||this.isStart(a,b)?!1:!0:!1},this.insideStart=function(a,b){return this.compare(a,b)==0?this.isEnd(a,b)?!1:!0:!1},this.insideEnd=function(a,b){return this.compare(a,b)==0?this.isStart(a,b)?!1:!0:!1},this.compare=function(a,b){return!this.isMultiLine()&&a===this.start.row?b<this.start.column?-1:b>this.end.column?1:0:a<this.start.row?-1:a>this.end.row?1:this.start.row===a?b>=this.start.column?0:-1:this.end.row===a?b<=this.end.column?0:1:0},this.compareStart=function(a,b){return this.start.row==a&&this.start.column==b?-1:this.compare(a,b)},this.compareEnd=function(a,b){return this.end.row==a&&this.end.column==b?1:this.compare(a,b)},this.compareInside=function(a,b){return this.end.row==a&&this.end.column==b?1:this.start.row==a&&this.start.column==b?-1:this.compare(a,b)},this.clipRows=function(a,b){if(this.end.row>b)var c={row:b+1,column:0};if(this.start.row>b)var e={row:b+1,column:0};if(this.start.row<a)var e={row:a,column:0};if(this.end.row<a)var c={row:a,column:0};return d.fromPoints(e||this.start,c||this.end)},this.extend=function(a,b){var c=this.compare(a,b);if(c==0)return this;if(c==-1)var e={row:a,column:b};else var f={row:a,column:b};return d.fromPoints(e||this.start,f||this.end)},this.isEmpty=function(){return this.start.row==this.end.row&&this.start.column==this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return d.fromPoints(this.start,this.end)},this.collapseRows=function(){return this.end.column==0?new d(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new d(this.start.row,0,this.end.row,0)},this.toScreenRange=function(a){var b=a.documentToScreenPosition(this.start),c=a.documentToScreenPosition(this.end);return new d(b.row,b.column,c.row,c.column)}}).call(d.prototype),d.fromPoints=function(a,b){return new d(a.row,a.column,b.row,b.column)},b.Range=d}),define("ace/mode/text",["require","exports","module","ace/tokenizer","ace/mode/text_highlight_rules","ace/mode/behaviour","ace/unicode"],function(a,b,c){var d=a("../tokenizer").Tokenizer,e=a("./text_highlight_rules").TextHighlightRules,f=a("./behaviour").Behaviour,g=a("../unicode"),h=function(){this.$tokenizer=new d((new e).getRules()),this.$behaviour=new f};(function(){this.tokenRe=new RegExp("^["+g.packages.L+g.packages.Mn+g.packages.Mc+g.packages.Nd+g.packages.Pc+"\\$_]+","g"),this.nonTokenRe=new RegExp("^(?:[^"+g.packages.L+g.packages.Mn+g.packages.Mc+g.packages.Nd+g.packages.Pc+"\\$_]|s])+","g"),this.getTokenizer=function(){return this.$tokenizer},this.toggleCommentLines=function(a,b,c,d){},this.getNextLineIndent=function(a,b,c){return""},this.checkOutdent=function(a,b,c){return!1},this.autoOutdent=function(a,b,c){},this.$getIndent=function(a){var b=a.match(/^(\s+)/);return b?b[1]:""},this.createWorker=function(a){return null},this.createModeDelegates=function(a){if(!this.$embeds)return;this.$modes={};for(var b=0;b<this.$embeds.length;b++)a[this.$embeds[b]]&&(this.$modes[this.$embeds[b]]=new a[this.$embeds[b]]);var c=["toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction"];for(var b=0;b<c.length;b++)(function(a){var d=c[b],e=a[d];a[c[b]]=function(){return this.$delegator(d,arguments,e)}})(this)},this.$delegator=function(a,b,c){var d=b[0];for(var e=0;e<this.$embeds.length;e++){if(!this.$modes[this.$embeds[e]])continue;var f=d.split(this.$embeds[e]);if(!f[0]&&f[1]){b[0]=f[1];var g=this.$modes[this.$embeds[e]];return g[a].apply(g,b)}}var h=c.apply(this,b);return c?h:undefined},this.transformAction=function(a,b,c,d,e){if(this.$behaviour){var f=this.$behaviour.getBehaviours();for(var g in f)if(f[g][b]){var h=f[g][b].apply(this,arguments);if(h)return h}}}}).call(h.prototype),b.Mode=h}),define("ace/tokenizer",["require","exports","module"],function(a,b,c){var d=function(a,b){b=b?"g"+b:"g",this.rules=a,this.regExps={},this.matchMappings={};for(var c in this.rules){var d=this.rules[c],e=d,f=[],g=0,h=this.matchMappings[c]={};for(var i=0;i<e.length;i++){e[i].regex instanceof RegExp&&(e[i].regex=e[i].regex.toString().slice(1,-1));var j=(new RegExp("(?:("+e[i].regex+")|(.))")).exec("a").length-2,k=e[i].regex.replace(/\\([0-9]+)/g,function(a,b){return"\\"+(parseInt(b,10)+g+1)});if(j>1&&e[i].token.length!==j-1)throw new Error("For "+e[i].regex+" the matching groups and length of the token array don't match (rule #"+i+" of state "+c+")");h[g]={rule:i,len:j},g+=j,f.push(k)}this.regExps[c]=new RegExp("(?:("+f.join(")|(")+")|(.))",b)}};(function(){this.getLineTokens=function(a,b){var c=b||"start",d=this.rules[c],e=this.matchMappings[c],f=this.regExps[c];f.lastIndex=0;var g,h=[],i=0,j={type:null,value:""};while(g=f.exec(a)){var k="text",l=null,m=[g[0]];for(var n=0;n<g.length-2;n++){if(g[n+1]===undefined)continue;l=d[e[n].rule],e[n].len>1&&(m=g.slice(n+2,n+1+e[n].len)),typeof l.token=="function"?k=l.token.apply(this,m):k=l.token;if(l.next){c=l.next,d=this.rules[c],e=this.matchMappings[c],i=f.lastIndex,f=this.regExps[c];if(f===undefined)throw new Error("You indicated a state of "+l.next+" to go to, but it doesn't exist!");f.lastIndex=i}break}if(m[0]){typeof k=="string"&&(m=[m.join("")],k=[k]);for(var n=0;n<m.length;n++){if(!m[n])continue;(!l||l.merge||k[n]==="text")&&j.type===k[n]?j.value+=m[n]:(j.type&&h.push(j),j={type:k[n],value:m[n]})}}if(i==a.length)break;i=f.lastIndex}return j.type&&h.push(j),{tokens:h,state:c}}}).call(d.prototype),b.Tokenizer=d}),define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/lang"],function(a,b,c){var d=a("../lib/lang"),e=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{token:"text",regex:".+"}]}};(function(){this.addRules=function(a,b){for(var c in a){var d=a[c];for(var e=0;e<d.length;e++){var f=d[e];f.next&&(f.next=b+f.next)}this.$rules[b+c]=d}},this.getRules=function(){return this.$rules},this.embedRules=function(a,b,c,e){var f=(new a).getRules();if(e)for(var g=0;g<e.length;g++)e[g]=b+e[g];else{e=[];for(var h in f)e.push(b+h)}this.addRules(f,b);for(var g=0;g<e.length;g++)Array.prototype.unshift.apply(this.$rules[e[g]],d.deepCopy(c));this.$embeds||(this.$embeds=[]),this.$embeds.push(b)},this.getEmbeds=function(){return this.$embeds},this.createKeywordMapper=function(a,b,c,d){var e=Object.create(null);return Object.keys(a).forEach(function(b){var c=a[b].split(d||"|");for(var f=c.length;f--;)e[c[f]]=b}),a=null,c?function(a){return e[a.toLowerCase()]||b}:function(a){return e[a]||b}}}).call(e.prototype),b.TextHighlightRules=e}),define("ace/mode/behaviour",["require","exports","module"],function(a,b,c){var d=function(){this.$behaviours={}};(function(){this.add=function(a,b,c){switch(undefined){case this.$behaviours:this.$behaviours={};case this.$behaviours[a]:this.$behaviours[a]={}}this.$behaviours[a][b]=c},this.addBehaviours=function(a){for(var b in a)for(var c in a[b])this.add(b,c,a[b][c])},this.remove=function(a){this.$behaviours&&this.$behaviours[a]&&delete this.$behaviours[a]},this.inherit=function(a,b){if(typeof a=="function")var c=(new a).getBehaviours(b);else var c=a.getBehaviours(b);this.addBehaviours(c)},this.getBehaviours=function(a){if(!a)return this.$behaviours;var b={};for(var c=0;c<a.length;c++)this.$behaviours[a[c]]&&(b[a[c]]=this.$behaviours[a[c]]);return b}}).call(d.prototype),b.Behaviour=d}),define("ace/unicode",["require","exports","module"],function(a,b,c){function d(a){var c=/\w{4}/g;for(var d in a)b.packages[d]=a[d].replace(c,"\\u$&")}b.packages={},d({L:"0041-005A0061-007A00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D03860388-038A038C038E-03A103A3-03F503F7-0481048A-05250531-055605590561-058705D0-05EA05F0-05F20621-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280904-0939093D09500958-0961097109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510D0-10FA10FC1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209421022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2D00-2D252D30-2D652D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A65FA662-A66EA67F-A697A6A0-A6E5A717-A71FA722-A788A78BA78CA7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC",Ll:"0061-007A00AA00B500BA00DF-00F600F8-00FF01010103010501070109010B010D010F01110113011501170119011B011D011F01210123012501270129012B012D012F01310133013501370138013A013C013E014001420144014601480149014B014D014F01510153015501570159015B015D015F01610163016501670169016B016D016F0171017301750177017A017C017E-0180018301850188018C018D019201950199-019B019E01A101A301A501A801AA01AB01AD01B001B401B601B901BA01BD-01BF01C601C901CC01CE01D001D201D401D601D801DA01DC01DD01DF01E101E301E501E701E901EB01ED01EF01F001F301F501F901FB01FD01FF02010203020502070209020B020D020F02110213021502170219021B021D021F02210223022502270229022B022D022F02310233-0239023C023F0240024202470249024B024D024F-02930295-02AF037103730377037B-037D039003AC-03CE03D003D103D5-03D703D903DB03DD03DF03E103E303E503E703E903EB03ED03EF-03F303F503F803FB03FC0430-045F04610463046504670469046B046D046F04710473047504770479047B047D047F0481048B048D048F04910493049504970499049B049D049F04A104A304A504A704A904AB04AD04AF04B104B304B504B704B904BB04BD04BF04C204C404C604C804CA04CC04CE04CF04D104D304D504D704D904DB04DD04DF04E104E304E504E704E904EB04ED04EF04F104F304F504F704F904FB04FD04FF05010503050505070509050B050D050F05110513051505170519051B051D051F0521052305250561-05871D00-1D2B1D62-1D771D79-1D9A1E011E031E051E071E091E0B1E0D1E0F1E111E131E151E171E191E1B1E1D1E1F1E211E231E251E271E291E2B1E2D1E2F1E311E331E351E371E391E3B1E3D1E3F1E411E431E451E471E491E4B1E4D1E4F1E511E531E551E571E591E5B1E5D1E5F1E611E631E651E671E691E6B1E6D1E6F1E711E731E751E771E791E7B1E7D1E7F1E811E831E851E871E891E8B1E8D1E8F1E911E931E95-1E9D1E9F1EA11EA31EA51EA71EA91EAB1EAD1EAF1EB11EB31EB51EB71EB91EBB1EBD1EBF1EC11EC31EC51EC71EC91ECB1ECD1ECF1ED11ED31ED51ED71ED91EDB1EDD1EDF1EE11EE31EE51EE71EE91EEB1EED1EEF1EF11EF31EF51EF71EF91EFB1EFD1EFF-1F071F10-1F151F20-1F271F30-1F371F40-1F451F50-1F571F60-1F671F70-1F7D1F80-1F871F90-1F971FA0-1FA71FB0-1FB41FB61FB71FBE1FC2-1FC41FC61FC71FD0-1FD31FD61FD71FE0-1FE71FF2-1FF41FF61FF7210A210E210F2113212F21342139213C213D2146-2149214E21842C30-2C5E2C612C652C662C682C6A2C6C2C712C732C742C76-2C7C2C812C832C852C872C892C8B2C8D2C8F2C912C932C952C972C992C9B2C9D2C9F2CA12CA32CA52CA72CA92CAB2CAD2CAF2CB12CB32CB52CB72CB92CBB2CBD2CBF2CC12CC32CC52CC72CC92CCB2CCD2CCF2CD12CD32CD52CD72CD92CDB2CDD2CDF2CE12CE32CE42CEC2CEE2D00-2D25A641A643A645A647A649A64BA64DA64FA651A653A655A657A659A65BA65DA65FA663A665A667A669A66BA66DA681A683A685A687A689A68BA68DA68FA691A693A695A697A723A725A727A729A72BA72DA72F-A731A733A735A737A739A73BA73DA73FA741A743A745A747A749A74BA74DA74FA751A753A755A757A759A75BA75DA75FA761A763A765A767A769A76BA76DA76FA771-A778A77AA77CA77FA781A783A785A787A78CFB00-FB06FB13-FB17FF41-FF5A",Lu:"0041-005A00C0-00D600D8-00DE01000102010401060108010A010C010E01100112011401160118011A011C011E01200122012401260128012A012C012E01300132013401360139013B013D013F0141014301450147014A014C014E01500152015401560158015A015C015E01600162016401660168016A016C016E017001720174017601780179017B017D018101820184018601870189-018B018E-0191019301940196-0198019C019D019F01A001A201A401A601A701A901AC01AE01AF01B1-01B301B501B701B801BC01C401C701CA01CD01CF01D101D301D501D701D901DB01DE01E001E201E401E601E801EA01EC01EE01F101F401F6-01F801FA01FC01FE02000202020402060208020A020C020E02100212021402160218021A021C021E02200222022402260228022A022C022E02300232023A023B023D023E02410243-02460248024A024C024E03700372037603860388-038A038C038E038F0391-03A103A3-03AB03CF03D2-03D403D803DA03DC03DE03E003E203E403E603E803EA03EC03EE03F403F703F903FA03FD-042F04600462046404660468046A046C046E04700472047404760478047A047C047E0480048A048C048E04900492049404960498049A049C049E04A004A204A404A604A804AA04AC04AE04B004B204B404B604B804BA04BC04BE04C004C104C304C504C704C904CB04CD04D004D204D404D604D804DA04DC04DE04E004E204E404E604E804EA04EC04EE04F004F204F404F604F804FA04FC04FE05000502050405060508050A050C050E05100512051405160518051A051C051E0520052205240531-055610A0-10C51E001E021E041E061E081E0A1E0C1E0E1E101E121E141E161E181E1A1E1C1E1E1E201E221E241E261E281E2A1E2C1E2E1E301E321E341E361E381E3A1E3C1E3E1E401E421E441E461E481E4A1E4C1E4E1E501E521E541E561E581E5A1E5C1E5E1E601E621E641E661E681E6A1E6C1E6E1E701E721E741E761E781E7A1E7C1E7E1E801E821E841E861E881E8A1E8C1E8E1E901E921E941E9E1EA01EA21EA41EA61EA81EAA1EAC1EAE1EB01EB21EB41EB61EB81EBA1EBC1EBE1EC01EC21EC41EC61EC81ECA1ECC1ECE1ED01ED21ED41ED61ED81EDA1EDC1EDE1EE01EE21EE41EE61EE81EEA1EEC1EEE1EF01EF21EF41EF61EF81EFA1EFC1EFE1F08-1F0F1F18-1F1D1F28-1F2F1F38-1F3F1F48-1F4D1F591F5B1F5D1F5F1F68-1F6F1FB8-1FBB1FC8-1FCB1FD8-1FDB1FE8-1FEC1FF8-1FFB21022107210B-210D2110-211221152119-211D212421262128212A-212D2130-2133213E213F214521832C00-2C2E2C602C62-2C642C672C692C6B2C6D-2C702C722C752C7E-2C802C822C842C862C882C8A2C8C2C8E2C902C922C942C962C982C9A2C9C2C9E2CA02CA22CA42CA62CA82CAA2CAC2CAE2CB02CB22CB42CB62CB82CBA2CBC2CBE2CC02CC22CC42CC62CC82CCA2CCC2CCE2CD02CD22CD42CD62CD82CDA2CDC2CDE2CE02CE22CEB2CEDA640A642A644A646A648A64AA64CA64EA650A652A654A656A658A65AA65CA65EA662A664A666A668A66AA66CA680A682A684A686A688A68AA68CA68EA690A692A694A696A722A724A726A728A72AA72CA72EA732A734A736A738A73AA73CA73EA740A742A744A746A748A74AA74CA74EA750A752A754A756A758A75AA75CA75EA760A762A764A766A768A76AA76CA76EA779A77BA77DA77EA780A782A784A786A78BFF21-FF3A",Lt:"01C501C801CB01F21F88-1F8F1F98-1F9F1FA8-1FAF1FBC1FCC1FFC",Lm:"02B0-02C102C6-02D102E0-02E402EC02EE0374037A0559064006E506E607F407F507FA081A0824082809710E460EC610FC17D718431AA71C78-1C7D1D2C-1D611D781D9B-1DBF2071207F2090-20942C7D2D6F2E2F30053031-3035303B309D309E30FC-30FEA015A4F8-A4FDA60CA67FA717-A71FA770A788A9CFAA70AADDFF70FF9EFF9F",Lo:"01BB01C0-01C3029405D0-05EA05F0-05F20621-063F0641-064A066E066F0671-06D306D506EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA0800-08150904-0939093D09500958-096109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E450E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10D0-10FA1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317DC1820-18421844-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C771CE9-1CEC1CEE-1CF12135-21382D30-2D652D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE3006303C3041-3096309F30A1-30FA30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A014A016-A48CA4D0-A4F7A500-A60BA610-A61FA62AA62BA66EA6A0-A6E5A7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2AA00-AA28AA40-AA42AA44-AA4BAA60-AA6FAA71-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADBAADCABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF66-FF6FFF71-FF9DFFA0-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC",M:"0300-036F0483-04890591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DE-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0903093C093E-094E0951-0955096209630981-098309BC09BE-09C409C709C809CB-09CD09D709E209E30A01-0A030A3C0A3E-0A420A470A480A4B-0A4D0A510A700A710A750A81-0A830ABC0ABE-0AC50AC7-0AC90ACB-0ACD0AE20AE30B01-0B030B3C0B3E-0B440B470B480B4B-0B4D0B560B570B620B630B820BBE-0BC20BC6-0BC80BCA-0BCD0BD70C01-0C030C3E-0C440C46-0C480C4A-0C4D0C550C560C620C630C820C830CBC0CBE-0CC40CC6-0CC80CCA-0CCD0CD50CD60CE20CE30D020D030D3E-0D440D46-0D480D4A-0D4D0D570D620D630D820D830DCA0DCF-0DD40DD60DD8-0DDF0DF20DF30E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F3E0F3F0F71-0F840F860F870F90-0F970F99-0FBC0FC6102B-103E1056-1059105E-10601062-10641067-106D1071-10741082-108D108F109A-109D135F1712-17141732-1734175217531772177317B6-17D317DD180B-180D18A91920-192B1930-193B19B0-19C019C819C91A17-1A1B1A55-1A5E1A60-1A7C1A7F1B00-1B041B34-1B441B6B-1B731B80-1B821BA1-1BAA1C24-1C371CD0-1CD21CD4-1CE81CED1CF21DC0-1DE61DFD-1DFF20D0-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66F-A672A67CA67DA6F0A6F1A802A806A80BA823-A827A880A881A8B4-A8C4A8E0-A8F1A926-A92DA947-A953A980-A983A9B3-A9C0AA29-AA36AA43AA4CAA4DAA7BAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE3-ABEAABECABEDFB1EFE00-FE0FFE20-FE26",Mn:"0300-036F0483-04870591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DF-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0902093C0941-0948094D0951-095509620963098109BC09C1-09C409CD09E209E30A010A020A3C0A410A420A470A480A4B-0A4D0A510A700A710A750A810A820ABC0AC1-0AC50AC70AC80ACD0AE20AE30B010B3C0B3F0B41-0B440B4D0B560B620B630B820BC00BCD0C3E-0C400C46-0C480C4A-0C4D0C550C560C620C630CBC0CBF0CC60CCC0CCD0CE20CE30D41-0D440D4D0D620D630DCA0DD2-0DD40DD60E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F71-0F7E0F80-0F840F860F870F90-0F970F99-0FBC0FC6102D-10301032-10371039103A103D103E10581059105E-10601071-1074108210851086108D109D135F1712-17141732-1734175217531772177317B7-17BD17C617C9-17D317DD180B-180D18A91920-19221927192819321939-193B1A171A181A561A58-1A5E1A601A621A65-1A6C1A73-1A7C1A7F1B00-1B031B341B36-1B3A1B3C1B421B6B-1B731B801B811BA2-1BA51BA81BA91C2C-1C331C361C371CD0-1CD21CD4-1CE01CE2-1CE81CED1DC0-1DE61DFD-1DFF20D0-20DC20E120E5-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66FA67CA67DA6F0A6F1A802A806A80BA825A826A8C4A8E0-A8F1A926-A92DA947-A951A980-A982A9B3A9B6-A9B9A9BCAA29-AA2EAA31AA32AA35AA36AA43AA4CAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE5ABE8ABEDFB1EFE00-FE0FFE20-FE26",Mc:"0903093E-09400949-094C094E0982098309BE-09C009C709C809CB09CC09D70A030A3E-0A400A830ABE-0AC00AC90ACB0ACC0B020B030B3E0B400B470B480B4B0B4C0B570BBE0BBF0BC10BC20BC6-0BC80BCA-0BCC0BD70C01-0C030C41-0C440C820C830CBE0CC0-0CC40CC70CC80CCA0CCB0CD50CD60D020D030D3E-0D400D46-0D480D4A-0D4C0D570D820D830DCF-0DD10DD8-0DDF0DF20DF30F3E0F3F0F7F102B102C10311038103B103C105610571062-10641067-106D108310841087-108C108F109A-109C17B617BE-17C517C717C81923-19261929-192B193019311933-193819B0-19C019C819C91A19-1A1B1A551A571A611A631A641A6D-1A721B041B351B3B1B3D-1B411B431B441B821BA11BA61BA71BAA1C24-1C2B1C341C351CE11CF2A823A824A827A880A881A8B4-A8C3A952A953A983A9B4A9B5A9BAA9BBA9BD-A9C0AA2FAA30AA33AA34AA4DAA7BABE3ABE4ABE6ABE7ABE9ABEAABEC",Me:"0488048906DE20DD-20E020E2-20E4A670-A672",N:"0030-003900B200B300B900BC-00BE0660-066906F0-06F907C0-07C90966-096F09E6-09EF09F4-09F90A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BF20C66-0C6F0C78-0C7E0CE6-0CEF0D66-0D750E50-0E590ED0-0ED90F20-0F331040-10491090-10991369-137C16EE-16F017E0-17E917F0-17F91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C5920702074-20792080-20892150-21822185-21892460-249B24EA-24FF2776-27932CFD30073021-30293038-303A3192-31953220-32293251-325F3280-328932B1-32BFA620-A629A6E6-A6EFA830-A835A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19",Nd:"0030-00390660-066906F0-06F907C0-07C90966-096F09E6-09EF0A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BEF0C66-0C6F0CE6-0CEF0D66-0D6F0E50-0E590ED0-0ED90F20-0F291040-10491090-109917E0-17E91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C59A620-A629A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19",Nl:"16EE-16F02160-21822185-218830073021-30293038-303AA6E6-A6EF",No:"00B200B300B900BC-00BE09F4-09F90BF0-0BF20C78-0C7E0D70-0D750F2A-0F331369-137C17F0-17F920702074-20792080-20892150-215F21892460-249B24EA-24FF2776-27932CFD3192-31953220-32293251-325F3280-328932B1-32BFA830-A835",P:"0021-00230025-002A002C-002F003A003B003F0040005B-005D005F007B007D00A100AB00B700BB00BF037E0387055A-055F0589058A05BE05C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F3A-0F3D0F850FD0-0FD4104A-104F10FB1361-13681400166D166E169B169C16EB-16ED1735173617D4-17D617D8-17DA1800-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD32010-20272030-20432045-20512053-205E207D207E208D208E2329232A2768-277527C527C627E6-27EF2983-299829D8-29DB29FC29FD2CF9-2CFC2CFE2CFF2E00-2E2E2E302E313001-30033008-30113014-301F3030303D30A030FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFD3EFD3FFE10-FE19FE30-FE52FE54-FE61FE63FE68FE6AFE6BFF01-FF03FF05-FF0AFF0C-FF0FFF1AFF1BFF1FFF20FF3B-FF3DFF3FFF5BFF5DFF5F-FF65",Pd:"002D058A05BE140018062010-20152E172E1A301C303030A0FE31FE32FE58FE63FF0D",Ps:"0028005B007B0F3A0F3C169B201A201E2045207D208D23292768276A276C276E27702772277427C527E627E827EA27EC27EE2983298529872989298B298D298F299129932995299729D829DA29FC2E222E242E262E283008300A300C300E3010301430163018301A301DFD3EFE17FE35FE37FE39FE3BFE3DFE3FFE41FE43FE47FE59FE5BFE5DFF08FF3BFF5BFF5FFF62",Pe:"0029005D007D0F3B0F3D169C2046207E208E232A2769276B276D276F27712773277527C627E727E927EB27ED27EF298429862988298A298C298E2990299229942996299829D929DB29FD2E232E252E272E293009300B300D300F3011301530173019301B301E301FFD3FFE18FE36FE38FE3AFE3CFE3EFE40FE42FE44FE48FE5AFE5CFE5EFF09FF3DFF5DFF60FF63",Pi:"00AB2018201B201C201F20392E022E042E092E0C2E1C2E20",Pf:"00BB2019201D203A2E032E052E0A2E0D2E1D2E21",Pc:"005F203F20402054FE33FE34FE4D-FE4FFF3F",Po:"0021-00230025-0027002A002C002E002F003A003B003F0040005C00A100B700BF037E0387055A-055F058905C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F850FD0-0FD4104A-104F10FB1361-1368166D166E16EB-16ED1735173617D4-17D617D8-17DA1800-18051807-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD3201620172020-20272030-2038203B-203E2041-20432047-205120532055-205E2CF9-2CFC2CFE2CFF2E002E012E06-2E082E0B2E0E-2E162E182E192E1B2E1E2E1F2E2A-2E2E2E302E313001-3003303D30FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFE10-FE16FE19FE30FE45FE46FE49-FE4CFE50-FE52FE54-FE57FE5F-FE61FE68FE6AFE6BFF01-FF03FF05-FF07FF0AFF0CFF0EFF0FFF1AFF1BFF1FFF20FF3CFF61FF64FF65",S:"0024002B003C-003E005E0060007C007E00A2-00A900AC00AE-00B100B400B600B800D700F702C2-02C502D2-02DF02E5-02EB02ED02EF-02FF03750384038503F604820606-0608060B060E060F06E906FD06FE07F609F209F309FA09FB0AF10B700BF3-0BFA0C7F0CF10CF20D790E3F0F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-139917DB194019E0-19FF1B61-1B6A1B74-1B7C1FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE20442052207A-207C208A-208C20A0-20B8210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B2140-2144214A-214D214F2190-2328232B-23E82400-24262440-244A249C-24E92500-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE27C0-27C427C7-27CA27CC27D0-27E527F0-29822999-29D729DC-29FB29FE-2B4C2B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F309B309C319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A700-A716A720A721A789A78AA828-A82BA836-A839AA77-AA79FB29FDFCFDFDFE62FE64-FE66FE69FF04FF0BFF1C-FF1EFF3EFF40FF5CFF5EFFE0-FFE6FFE8-FFEEFFFCFFFD",Sm:"002B003C-003E007C007E00AC00B100D700F703F60606-060820442052207A-207C208A-208C2140-2144214B2190-2194219A219B21A021A321A621AE21CE21CF21D221D421F4-22FF2308-230B23202321237C239B-23B323DC-23E125B725C125F8-25FF266F27C0-27C427C7-27CA27CC27D0-27E527F0-27FF2900-29822999-29D729DC-29FB29FE-2AFF2B30-2B442B47-2B4CFB29FE62FE64-FE66FF0BFF1C-FF1EFF5CFF5EFFE2FFE9-FFEC",Sc:"002400A2-00A5060B09F209F309FB0AF10BF90E3F17DB20A0-20B8A838FDFCFE69FF04FFE0FFE1FFE5FFE6",Sk:"005E006000A800AF00B400B802C2-02C502D2-02DF02E5-02EB02ED02EF-02FF0375038403851FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE309B309CA700-A716A720A721A789A78AFF3EFF40FFE3",So:"00A600A700A900AE00B000B60482060E060F06E906FD06FE07F609FA0B700BF3-0BF80BFA0C7F0CF10CF20D790F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-1399194019E0-19FF1B61-1B6A1B74-1B7C210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B214A214C214D214F2195-2199219C-219F21A121A221A421A521A7-21AD21AF-21CD21D021D121D321D5-21F32300-2307230C-231F2322-2328232B-237B237D-239A23B4-23DB23E2-23E82400-24262440-244A249C-24E92500-25B625B8-25C025C2-25F72600-266E2670-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE2800-28FF2B00-2B2F2B452B462B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A828-A82BA836A837A839AA77-AA79FDFDFFE4FFE8FFEDFFEEFFFCFFFD",Z:"002000A01680180E2000-200A20282029202F205F3000",Zs:"002000A01680180E2000-200A202F205F3000",Zl:"2028",Zp:"2029",C:"0000-001F007F-009F00AD03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-0605061C061D0620065F06DD070E070F074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17B417B517DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF200B-200F202A-202E2060-206F20722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-F8FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFD-FF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFFBFFFEFFFF",Cc:"0000-001F007F-009F",Cf:"00AD0600-060306DD070F17B417B5200B-200F202A-202E2060-2064206A-206FFEFFFFF9-FFFB",Co:"E000-F8FF",Cs:"D800-DFFF",Cn:"03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-05FF06040605061C061D0620065F070E074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF2065-206920722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-D7FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFDFEFEFF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFF8FFFEFFFF"})}),define("ace/document",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/range","ace/anchor"],function(a,b,c){var d=a("./lib/oop"),e=a("./lib/event_emitter").EventEmitter,f=a("./range").Range,g=a("./anchor").Anchor,h=function(a){this.$lines=[],a.length==0?this.$lines=[""]:Array.isArray(a)?this.insertLines(0,a):this.insert({row:0,column:0},a)};(function(){d.implement(this,e),this.setValue=function(a){var b=this.getLength();this.remove(new f(0,0,b,this.getLine(b-1).length)),this.insert({row:0,column:0},a)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(a,b){return new g(this,a,b)},"aaa".split(/a/).length==0?this.$split=function(a){return a.replace(/\r\n|\r/g,"\n").split("\n")}:this.$split=function(a){return a.split(/\r\n|\r|\n/)},this.$detectNewLine=function(a){var b=a.match(/^.*?(\r\n|\r|\n)/m);b?this.$autoNewLine=b[1]:this.$autoNewLine="\n"},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";case"auto":return this.$autoNewLine}},this.$autoNewLine="\n",this.$newLineMode="auto",this.setNewLineMode=function(a){if(this.$newLineMode===a)return;this.$newLineMode=a},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(a){return a=="\r\n"||a=="\r"||a=="\n"},this.getLine=function(a){return this.$lines[a]||""},this.getLines=function(a,b){return this.$lines.slice(a,b+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(a){if(a.start.row==a.end.row)return this.$lines[a.start.row].substring(a.start.column,a.end.column);var b=this.getLines(a.start.row+1,a.end.row-1);return b.unshift((this.$lines[a.start.row]||"").substring(a.start.column)),b.push((this.$lines[a.end.row]||"").substring(0,a.end.column)),b.join(this.getNewLineCharacter())},this.$clipPosition=function(a){var b=this.getLength();return a.row>=b&&(a.row=Math.max(0,b-1),a.column=this.getLine(b-1).length),a},this.insert=function(a,b){if(!b||b.length===0)return a;a=this.$clipPosition(a),this.getLength()<=1&&this.$detectNewLine(b);var c=this.$split(b),d=c.splice(0,1)[0],e=c.length==0?null:c.splice(c.length-1,1)[0];return a=this.insertInLine(a,d),e!==null&&(a=this.insertNewLine(a),a=this.insertLines(a.row,c),a=this.insertInLine(a,e||"")),a},this.insertLines=function(a,b){if(b.length==0)return{row:a,column:0};if(b.length>65535){var c=this.insertLines(a,b.slice(65535));b=b.slice(0,65535)}var d=[a,0];d.push.apply(d,b),this.$lines.splice.apply(this.$lines,d);var e=new f(a,0,a+b.length,0),g={action:"insertLines",range:e,lines:b};return this._emit("change",{data:g}),c||e.end},this.insertNewLine=function(a){a=this.$clipPosition(a);var b=this.$lines[a.row]||"";this.$lines[a.row]=b.substring(0,a.column),this.$lines.splice(a.row+1,0,b.substring(a.column,b.length));var c={row:a.row+1,column:0},d={action:"insertText",range:f.fromPoints(a,c),text:this.getNewLineCharacter()};return this._emit("change",{data:d}),c},this.insertInLine=function(a,b){if(b.length==0)return a;var c=this.$lines[a.row]||"";this.$lines[a.row]=c.substring(0,a.column)+b+c.substring(a.column);var d={row:a.row,column:a.column+b.length},e={action:"insertText",range:f.fromPoints(a,d),text:b};return this._emit("change",{data:e}),d},this.remove=function(a){a.start=this.$clipPosition(a.start),a.end=this.$clipPosition(a.end);if(a.isEmpty())return a.start;var b=a.start.row,c=a.end.row;if(a.isMultiLine()){var d=a.start.column==0?b:b+1,e=c-1;a.end.column>0&&this.removeInLine(c,0,a.end.column),e>=d&&this.removeLines(d,e),d!=b&&(this.removeInLine(b,a.start.column,this.getLine(b).length),this.removeNewLine(a.start.row))}else this.removeInLine(b,a.start.column,a.end.column);return a.start},this.removeInLine=function(a,b,c){if(b==c)return;var d=new f(a,b,a,c),e=this.getLine(a),g=e.substring(b,c),h=e.substring(0,b)+e.substring(c,e.length);this.$lines.splice(a,1,h);var i={action:"removeText",range:d,text:g};return this._emit("change",{data:i}),d.start},this.removeLines=function(a,b){var c=new f(a,0,b+1,0),d=this.$lines.splice(a,b-a+1),e={action:"removeLines",range:c,nl:this.getNewLineCharacter(),lines:d};return this._emit("change",{data:e}),d},this.removeNewLine=function(a){var b=this.getLine(a),c=this.getLine(a+1),d=new f(a,b.length,a+1,0),e=b+c;this.$lines.splice(a,2,e);var g={action:"removeText",range:d,text:this.getNewLineCharacter()};this._emit("change",{data:g})},this.replace=function(a,b){if(b.length==0&&a.isEmpty())return a.start;if(b==this.getTextRange(a))return a.end;this.remove(a);if(b)var c=this.insert(a.start,b);else c=a.start;return c},this.applyDeltas=function(a){for(var b=0;b<a.length;b++){var c=a[b],d=f.fromPoints(c.range.start,c.range.end);c.action=="insertLines"?this.insertLines(d.start.row,c.lines):c.action=="insertText"?this.insert(d.start,c.text):c.action=="removeLines"?this.removeLines(d.start.row,d.end.row-1):c.action=="removeText"&&this.remove(d)}},this.revertDeltas=function(a){for(var b=a.length-1;b>=0;b--){var c=a[b],d=f.fromPoints(c.range.start,c.range.end);c.action=="insertLines"?this.removeLines(d.start.row,d.end.row-1):c.action=="insertText"?this.remove(d):c.action=="removeLines"?this.insertLines(d.start.row,c.lines):c.action=="removeText"&&this.insert(d.start,c.text)}}}).call(h.prototype),b.Document=h}),define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(a,b,c){var d=a("./lib/oop"),e=a("./lib/event_emitter").EventEmitter,f=b.Anchor=function(a,b,c){this.document=a,typeof c=="undefined"?this.setPosition(b.row,b.column):this.setPosition(b,c),this.$onChange=this.onChange.bind(this),a.on("change",this.$onChange)};(function(){d.implement(this,e),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.onChange=function(a){var b=a.data,c=b.range;if(c.start.row==c.end.row&&c.start.row!=this.row)return;if(c.start.row>this.row)return;if(c.start.row==this.row&&c.start.column>this.column)return;var d=this.row,e=this.column;b.action==="insertText"?c.start.row===d&&c.start.column<=e?c.start.row===c.end.row?e+=c.end.column-c.start.column:(e-=c.start.column,d+=c.end.row-c.start.row):c.start.row!==c.end.row&&c.start.row<d&&(d+=c.end.row-c.start.row):b.action==="insertLines"?c.start.row<=d&&(d+=c.end.row-c.start.row):b.action=="removeText"?c.start.row==d&&c.start.column<e?c.end.column>=e?e=c.start.column:e=Math.max(0,e-(c.end.column-c.start.column)):c.start.row!==c.end.row&&c.start.row<d?(c.end.row==d&&(e=Math.max(0,e-c.end.column)+c.start.column),d-=c.end.row-c.start.row):c.end.row==d&&(d-=c.end.row-c.start.row,e=Math.max(0,e-c.end.column)+c.start.column):b.action=="removeLines"&&c.start.row<=d&&(c.end.row<=d?d-=c.end.row-c.start.row:(d=c.start.row,e=0)),this.setPosition(d,e,!0)},this.setPosition=function(a,b,c){var d;c?d={row:a,column:b}:d=this.$clipPositionToDocument(a,b);if(this.row==d.row&&this.column==d.column)return;var e={row:this.row,column:this.column};this.row=d.row,this.column=d.column,this._emit("change",{old:e,value:d})},this.detach=function(){this.document.removeEventListener("change",this.$onChange)},this.$clipPositionToDocument=function(a,b){var c={};return a>=this.document.getLength()?(c.row=Math.max(0,this.document.getLength()-1),c.column=this.document.getLine(c.row).length):a<0?(c.row=0,c.column=0):(c.row=a,c.column=Math.min(this.document.getLine(c.row).length,Math.max(0,b))),b<0&&(c.column=0),c}}).call(f.prototype)}),define("ace/background_tokenizer",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(a,b,c){var d=a("./lib/oop"),e=a("./lib/event_emitter").EventEmitter,f=5e3,g=function(a,b){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.tokenizer=a;var c=this;this.$worker=function(){if(!c.running)return;var a=new Date,b=c.currentLine,d=c.doc,e=0,f=d.getLength();while(c.currentLine<f){c.$tokenizeRow(c.currentLine);while(c.lines[c.currentLine])c.currentLine++;e++;if(e%5==0&&new Date-a>20){c.fireUpdateEvent(b,c.currentLine-1),c.running=setTimeout(c.$worker,20);return}}c.running=!1,c.fireUpdateEvent(b,f-1)}};(function(){d.implement(this,e),this.setTokenizer=function(a){this.tokenizer=a,this.lines=[],this.states=[],this.start(0)},this.setDocument=function(a){this.doc=a,this.lines=[],this.states=[],this.stop()},this.fireUpdateEvent=function(a,b){var c={first:a,last:b};this._emit("update",{data:c})},this.start=function(a){this.currentLine=Math.min(a||0,this.currentLine,this.doc.getLength()),this.lines.splice(this.currentLine,this.lines.length),this.states.splice(this.currentLine,this.states.length),this.stop(),this.running=setTimeout(this.$worker,700)},this.$updateOnChange=function(a){var b=a.range,c=b.start.row,d=b.end.row-c;if(d===0)this.lines[c]=null;else if(a.action=="removeText"||a.action=="removeLines")this.lines.splice(c,d+1,null),this.states.splice(c,d+1,null);else{var e=Array(d+1);e.unshift(c,1),this.lines.splice.apply(this.lines,e),this.states.splice.apply(this.states,e)}this.currentLine=Math.min(c,this.currentLine,this.doc.getLength()),this.stop(),this.running=setTimeout(this.$worker,700)},this.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},this.getTokens=function(a){return this.lines[a]||this.$tokenizeRow(a)},this.getState=function(a){return this.currentLine==a&&this.$tokenizeRow(a),this.states[a]||"start"},this.$tokenizeRow=function(a){var b=this.doc.getLine(a),c=this.states[a-1];if(b.length>f){var d={value:b.substr(f),type:"text"};b=b.slice(0,f)}var e=this.tokenizer.getLineTokens(b,c);return d&&(e.tokens.push(d),e.state="start"),this.states[a]!==e.state?(this.states[a]=e.state,this.lines[a+1]=null,this.currentLine>a+1&&(this.currentLine=a+1)):this.currentLine==a&&(this.currentLine=a+1),this.lines[a]=e.tokens}}).call(g.prototype),b.BackgroundTokenizer=g}),define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(a,b,c){var d=a("./lib/lang"),e=a("./lib/oop"),f=a("./range").Range,g=function(a,b,c){this.setRegexp(a),this.clazz=b,this.type=c||"text"};(function(){this.setRegexp=function(a){if(this.regExp+""==a+"")return;this.regExp=a,this.cache=[]},this.update=function(a,b,c,e){if(!this.regExp)return;var g=e.firstRow,h=e.lastRow;for(var i=g;i<=h;i++){var j=this.cache[i];j==null&&(j=d.getMatchOffsets(c.getLine(i),this.regExp),j=j.map(function(a){return new f(i,a.offset,i,a.offset+a.length)}),this.cache[i]=j.length?j:"");for(var k=j.length;k--;)b.drawSingleLineMarker(a,j[k].toScreenRange(c),this.clazz,e,null,this.type)}}}).call(g.prototype),b.SearchHighlight=g}),define("ace/edit_session/folding",["require","exports","module","ace/range","ace/edit_session/fold_line","ace/edit_session/fold","ace/token_iterator"],function(a,b,c){function h(){this.getFoldAt=function(a,b,c){var d=this.getFoldLine(a);if(!d)return null;var e=d.folds;for(var f=0;f<e.length;f++){var g=e[f];if(g.range.contains(a,b)){if(c==1&&g.range.isEnd(a,b))continue;if(c==-1&&g.range.isStart(a,b))continue;return g}}},this.getFoldsInRange=function(a){a=a.clone();var b=a.start,c=a.end,d=this.$foldData,e=[];b.column+=1,c.column-=1;for(var f=0;f<d.length;f++){var g=d[f].range.compareRange(a);if(g==2)continue;if(g==-2)break;var h=d[f].folds;for(var i=0;i<h.length;i++){var j=h[i];g=j.range.compareRange(a);if(g==-2)break;if(g==2)continue;if(g==42)break;e.push(j)}}return e},this.getAllFolds=function(){function c(b){a.push(b);if(!b.subFolds)return;for(var d=0;d<b.subFolds.length;d++)c(b.subFolds[d])}var a=[],b=this.$foldData;for(var d=0;d<b.length;d++)for(var e=0;e<b[d].folds.length;e++)c(b[d].folds[e]);return a},this.getFoldStringAt=function(a,b,c,d){d=d||this.getFoldLine(a);if(!d)return null;var e={end:{column:0}},f,g;for(var h=0;h<d.folds.length;h++){g=d.folds[h];var i=g.range.compareEnd(a,b);if(i==-1){f=this.getLine(g.start.row).substring(e.end.column,g.start.column);break}if(i===0)return null;e=g}return f||(f=this.getLine(g.start.row).substring(e.end.column)),c==-1?f.substring(0,b-e.end.column):c==1?f.substring(b-e.end.column):f},this.getFoldLine=function(a,b){var c=this.$foldData,d=0;b&&(d=c.indexOf(b)),d==-1&&(d=0);for(d;d<c.length;d++){var e=c[d];if(e.start.row<=a&&e.end.row>=a)return e;if(e.end.row>a)return null}return null},this.getNextFoldLine=function(a,b){var c=this.$foldData,d=0;b&&(d=c.indexOf(b)),d==-1&&(d=0);for(d;d<c.length;d++){var e=c[d];if(e.end.row>=a)return e}return null},this.getFoldedRowCount=function(a,b){var c=this.$foldData,d=b-a+1;for(var e=0;e<c.length;e++){var f=c[e],g=f.end.row,h=f.start.row;if(g>=b){h<b&&(h>=a?d-=b-h:d=0);break}g>=a&&(h>=a?d-=g-h:d-=g-a+1)}return d},this.$addFoldLine=function(a){return this.$foldData.push(a),this.$foldData.sort(function(a,b){return a.start.row-b.start.row}),a},this.addFold=function(a,b){var c=this.$foldData,d=!1,g;a instanceof f?g=a:g=new f(b,a),this.$clipRangeToDocument(g.range);var h=g.start.row,i=g.start.column,j=g.end.row,k=g.end.column;if(g.placeholder.length<2)throw"Placeholder has to be at least 2 characters";if(h==j&&k-i<2)throw"The range has to be at least 2 characters width";var l=this.getFoldAt(h,i,1),m=this.getFoldAt(j,k,-1);if(l&&m==l)return l.addSubFold(g);if(l&&!l.range.isStart(h,i)||m&&!m.range.isEnd(j,k))throw"A fold can't intersect already existing fold"+g.range+l.range;var n=this.getFoldsInRange(g.range);n.length>0&&(this.removeFolds(n),g.subFolds=n);for(var o=0;o<c.length;o++){var p=c[o];if(j==p.start.row){p.addFold(g),d=!0;break}if(h==p.end.row){p.addFold(g),d=!0;if(!g.sameRow){var q=c[o+1];if(q&&q.start.row==j){p.merge(q);break}}break}if(j<=p.start.row)break}return d||(p=this.$addFoldLine(new e(this.$foldData,g))),this.$useWrapMode?this.$updateWrapData(p.start.row,p.start.row):this.$updateRowLengthCache(p.start.row,p.start.row),this.$modified=!0,this._emit("changeFold",{data:g}),g},this.addFolds=function(a){a.forEach(function(a){this.addFold(a)},this)},this.removeFold=function(a){var b=a.foldLine,c=b.start.row,d=b.end.row,e=this.$foldData,f=b.folds;if(f.length==1)e.splice(e.indexOf(b),1);else if(b.range.isEnd(a.end.row,a.end.column))f.pop(),b.end.row=f[f.length-1].end.row,b.end.column=f[f.length-1].end.column;else if(b.range.isStart(a.start.row,a.start.column))f.shift(),b.start.row=f[0].start.row,b.start.column=f[0].start.column;else if(a.sameRow)f.splice(f.indexOf(a),1);else{var g=b.split(a.start.row,a.start.column);f=g.folds,f.shift(),g.start.row=f[0].start.row,g.start.column=f[0].start.column}this.$useWrapMode?this.$updateWrapData(c,d):this.$updateRowLengthCache(c,d),this.$modified=!0,this._emit("changeFold",{data:a})},this.removeFolds=function(a){var b=[];for(var c=0;c<a.length;c++)b.push(a[c]);b.forEach(function(a){this.removeFold(a)},this),this.$modified=!0},this.expandFold=function(a){this.removeFold(a),a.subFolds.forEach(function(a){this.addFold(a)},this),a.subFolds=[]},this.expandFolds=function(a){a.forEach(function(a){this.expandFold(a)},this)},this.unfold=function(a,b){var c,e;a==null?c=new d(0,0,this.getLength(),0):typeof a=="number"?c=new d(a,0,a,this.getLine(a).length):"row"in a?c=d.fromPoints(a,a):c=a,e=this.getFoldsInRange(c);if(b)this.removeFolds(e);else while(e.length)this.expandFolds(e),e=this.getFoldsInRange(c)},this.isRowFolded=function(a,b){return!!this.getFoldLine(a,b)},this.getRowFoldEnd=function(a,b){var c=this.getFoldLine(a,b);return c?c.end.row:a},this.getFoldDisplayLine=function(a,b,c,d,e){d==null&&(d=a.start.row,e=0),b==null&&(b=a.end.row,c=this.getLine(b).length);var f=this.doc,g="";return a.walk(function(a,b,c,h){if(b<d)return;if(b==d){if(c<e)return;h=Math.max(e,h)}a?g+=a:g+=f.getLine(b).substring(h,c)}.bind(this),b,c),g},this.getDisplayLine=function(a,b,c,d){var e=this.getFoldLine(a);if(!e){var f;return f=this.doc.getLine(a),f.substring(d||0,b||f.length)}return this.getFoldDisplayLine(e,a,b,c,d)},this.$cloneFoldData=function(){var a=[];return a=this.$foldData.map(function(b){var c=b.folds.map(function(a){return a.clone()});return new e(a,c)}),a},this.toggleFold=function(a){var b=this.selection,c=b.getRange(),d,e;if(c.isEmpty()){var f=c.start;d=this.getFoldAt(f.row,f.column);if(d){this.expandFold(d);return}(e=this.findMatchingBracket(f))?c.comparePoint(e)==1?c.end=e:(c.start=e,c.start.column++,c.end.column--):(e=this.findMatchingBracket({row:f.row,column:f.column+1}))?(c.comparePoint(e)==1?c.end=e:c.start=e,c.start.column++):c=this.getCommentFoldRange(f.row,f.column)||c}else{var g=this.getFoldsInRange(c);if(a&&g.length){this.expandFolds(g);return}g.length==1&&(d=g[0])}d||(d=this.getFoldAt(c.start.row,c.start.column));if(d&&d.range.toString()==c.toString()){this.expandFold(d);return}var h="...";if(!c.isMultiLine()){h=this.getTextRange(c);if(h.length<4)return;h=h.trim().substring(0,2)+".."}this.addFold(h,c)},this.getCommentFoldRange=function(a,b){var c=new g(this,a,b),e=c.getCurrentToken();if(e&&/^comment|string/.test(e.type)){var f=new d,h=new RegExp(e.type.replace(/\..*/,"\\."));do e=c.stepBackward();while(e&&h.test(e.type));c.stepForward(),f.start.row=c.getCurrentTokenRow(),f.start.column=c.getCurrentTokenColumn()+2,c=new g(this,a,b);do e=c.stepForward();while(e&&h.test(e.type));return e=c.stepBackward(),f.end.row=c.getCurrentTokenRow(),f.end.column=c.getCurrentTokenColumn()+e.value.length,f}},this.foldAll=function(a,b){var c=this.foldWidgets;b=b||this.getLength();for(var d=a||0;d<b;d++){c[d]==null&&(c[d]=this.getFoldWidget(d));if(c[d]!="start")continue;var e=this.getFoldWidgetRange(d);if(e&&e.end.row<b)try{this.addFold("...",e)}catch(f){}}},this.$foldStyles={manual:1,markbegin:1,markbeginend:1},this.$foldStyle="markbegin",this.setFoldStyle=function(a){if(!this.$foldStyles[a])throw new Error("invalid fold style: "+a+"["+Object.keys(this.$foldStyles).join(", ")+"]");if(this.$foldStyle==a)return;this.$foldStyle=a,a=="manual"&&this.unfold();var b=this.$foldMode;this.$setFolding(null),this.$setFolding(b)},this.$setFolding=function(a){if(this.$foldMode==a)return;this.$foldMode=a,this.removeListener("change",this.$updateFoldWidgets),this._emit("changeAnnotation");if(!a||this.$foldStyle=="manual"){this.foldWidgets=null;return}this.foldWidgets=[],this.getFoldWidget=a.getFoldWidget.bind(a,this,this.$foldStyle),this.getFoldWidgetRange=a.getFoldWidgetRange.bind(a,this,this.$foldStyle),this.$updateFoldWidgets=this.updateFoldWidgets.bind(this),this.on("change",this.$updateFoldWidgets)},this.onFoldWidgetClick=function(a,b){var c=this.getFoldWidget(a),d=this.getLine(a),e=b.shiftKey,f=e||b.ctrlKey||b.altKey||b.metaKey,g;c=="end"?g=this.getFoldAt(a,0,-1):g=this.getFoldAt(a,d.length,1);if(g){f?this.removeFold(g):this.expandFold(g);return}var h=this.getFoldWidgetRange(a);if(h){if(!h.isMultiLine()){g=this.getFoldAt(h.start.row,h.start.column,1);if(g&&h.isEqual(g.range)){this.removeFold(g);return}}e||this.addFold("...",h),f&&this.foldAll(h.start.row+1,h.end.row)}else f&&this.foldAll(a+1,this.getLength()),(b.target||b.srcElement).className+=" invalid"},this.updateFoldWidgets=function(a){var b=a.data,c=b.range,d=c.start.row,e=c.end.row-d;if(e===0)this.foldWidgets[d]=null;else if(b.action=="removeText"||b.action=="removeLines")this.foldWidgets.splice(d,e+1,null);else{var f=Array(e+1);f.unshift(d,1),this.foldWidgets.splice.apply(this.foldWidgets,f)}}}var d=a("../range").Range,e=a("./fold_line").FoldLine,f=a("./fold").Fold,g=a("../token_iterator").TokenIterator;b.Folding=h}),define("ace/edit_session/fold_line",["require","exports","module","ace/range"],function(a,b,c){function e(a,b){this.foldData=a,Array.isArray(b)?this.folds=b:b=this.folds=[b];var c=b[b.length-1];this.range=new d(b[0].start.row,b[0].start.column,c.end.row,c.end.column),this.start=this.range.start,this.end=this.range.end,this.folds.forEach(function(a){a.setFoldLine(this)},this)}var d=a("../range").Range;(function(){this.shiftRow=function(a){this.start.row+=a,this.end.row+=a,this.folds.forEach(function(b){b.start.row+=a,b.end.row+=a})},this.addFold=function(a){if(a.sameRow){if(a.start.row<this.startRow||a.endRow>this.endRow)throw"Can't add a fold to this FoldLine as it has no connection";this.folds.push(a),this.folds.sort(function(a,b){return-a.range.compareEnd(b.start.row,b.start.column)}),this.range.compareEnd(a.start.row,a.start.column)>0?(this.end.row=a.end.row,this.end.column=a.end.column):this.range.compareStart(a.end.row,a.end.column)<0&&(this.start.row=a.start.row,this.start.column=a.start.column)}else if(a.start.row==this.end.row)this.folds.push(a),this.end.row=a.end.row,this.end.column=a.end.column;else{if(a.end.row!=this.start.row)throw"Trying to add fold to FoldRow that doesn't have a matching row";this.folds.unshift(a),this.start.row=a.start.row,this.start.column=a.start.column}a.foldLine=this},this.containsRow=function(a){return a>=this.start.row&&a<=this.end.row},this.walk=function(a,b,c){var d=0,e=this.folds,f,g,h,i=!0;b==null&&(b=this.end.row,c=this.end.column);for(var j=0;j<e.length;j++){f=e[j],g=f.range.compareStart(b,c);if(g==-1){a(null,b,c,d,i);return}h=a(null,f.start.row,f.start.column,d,i),h=!h&&a(f.placeholder,f.start.row,f.start.column,d);if(h||g==0)return;i=!f.sameRow,d=f.end.column}a(null,b,c,d,i)},this.getNextFoldTo=function(a,b){var c,d;for(var e=0;e<this.folds.length;e++){c=this.folds[e],d=c.range.compareEnd(a,b);if(d==-1)return{fold:c,kind:"after"};if(d==0)return{fold:c,kind:"inside"}}return null},this.addRemoveChars=function(a,b,c){var d=this.getNextFoldTo(a,b),e,f;if(d){e=d.fold;if(d.kind=="inside"&&e.start.column!=b&&e.start.row!=a)window.console&&window.console.log(a,b,e);else if(e.start.row==a){f=this.folds;var g=f.indexOf(e);g==0&&(this.start.column+=c);for(g;g<f.length;g++){e=f[g],e.start.column+=c;if(!e.sameRow)return;e.end.column+=c}this.end.column+=c}}},this.split=function(a,b){var c=this.getNextFoldTo(a,b).fold,d=this.folds,f=this.foldData;if(!c)return null;var g=d.indexOf(c),h=d[g-1];this.end.row=h.end.row,this.end.column=h.end.column,d=d.splice(g,d.length-g);var i=new e(f,d);return f.splice(f.indexOf(this)+1,0,i),i},this.merge=function(a){var b=a.folds;for(var c=0;c<b.length;c++)this.addFold(b[c]);var d=this.foldData;d.splice(d.indexOf(a),1)},this.toString=function(){var a=[this.range.toString()+": ["];return this.folds.forEach(function(b){a.push(" "+b.toString())}),a.push("]"),a.join("\n")},this.idxToPosition=function(a){var b=0,c;for(var d=0;d<this.folds.length;d++){var c=this.folds[d];a-=c.start.column-b;if(a<0)return{row:c.start.row,column:c.start.column+a};a-=c.placeholder.length;if(a<0)return c.start;b=c.end.column}return{row:this.end.row,column:this.end.column+a}}}).call(e.prototype),b.FoldLine=e}),define("ace/edit_session/fold",["require","exports","module"],function(a,b,c){var d=b.Fold=function(a,b){this.foldLine=null,this.placeholder=b,this.range=a,this.start=a.start,this.end=a.end,this.sameRow=a.start.row==a.end.row,this.subFolds=[]};(function(){this.toString=function(){return'"'+this.placeholder+'" '+this.range.toString()},this.setFoldLine=function(a){this.foldLine=a,this.subFolds.forEach(function(b){b.setFoldLine(a)})},this.clone=function(){var a=this.range.clone(),b=new d(a,this.placeholder);return this.subFolds.forEach(function(a){b.subFolds.push(a.clone())}),b},this.addSubFold=function(a){if(this.range.isEqual(a))return this;if(!this.range.containsRange(a))throw"A fold can't intersect already existing fold"+a.range+this.range;var b=a.range.start.row,c=a.range.start.column;for(var d=0,e=-1;d<this.subFolds.length;d++){e=this.subFolds[d].range.compare(b,c);if(e!=1)break}var f=this.subFolds[d];if(e==0)return f.addSubFold(a);var b=a.range.end.row,c=a.range.end.column;for(var g=d,e=-1;g<this.subFolds.length;g++){e=this.subFolds[g].range.compare(b,c);if(e!=1)break}var h=this.subFolds[g];if(e==0)throw"A fold can't intersect already existing fold"+a.range+this.range;var i=this.subFolds.splice(d,g-d,a);return a.setFoldLine(this.foldLine),a}}).call(d.prototype)}),define("ace/token_iterator",["require","exports","module"],function(a,b,c){var d=function(a,b,c){this.$session=a,this.$row=b,this.$rowTokens=a.getTokens(b);var d=a.getTokenAt(b,c);this.$tokenIndex=d?d.index:-1};(function(){this.stepBackward=function(){this.$tokenIndex-=1;while(this.$tokenIndex<0){this.$row-=1;if(this.$row<0)return this.$row=0,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=this.$rowTokens.length-1}return this.$rowTokens[this.$tokenIndex]},this.stepForward=function(){var a=this.$session.getLength();this.$tokenIndex+=1;while(this.$tokenIndex>=this.$rowTokens.length){this.$row+=1;if(this.$row>=a)return this.$row=a-1,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=0}return this.$rowTokens[this.$tokenIndex]},this.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},this.getCurrentTokenRow=function(){return this.$row},this.getCurrentTokenColumn=function(){var a=this.$rowTokens,b=this.$tokenIndex,c=a[b].start;if(c!==undefined)return c;c=0;while(b>0)b-=1,c+=a[b].value.length;return c}}).call(d.prototype),b.TokenIterator=d}),define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(a,b,c){function f(){this.findMatchingBracket=function(a){if(a.column==0)return null;var b=this.getLine(a.row).charAt(a.column-1);if(b=="")return null;var c=b.match(/([\(\[\{])|([\)\]\}])/);return c?c[1]?this.$findClosingBracket(c[1],a):this.$findOpeningBracket(c[2],a):null},this.getBracketRange=function(a){var b=this.getLine(a.row),c=!0,d,f=b.charAt(a.column-1),g=f&&f.match(/([\(\[\{])|([\)\]\}])/);g||(f=b.charAt(a.column),a={row:a.row,column:a.column+1},g=f&&f.match(/([\(\[\{])|([\)\]\}])/),c=!1);if(!g)return null;if(g[1]){var h=this.$findClosingBracket(g[1],a);if(!h)return null;d=e.fromPoints(a,h),c||(d.end.column++,d.start.column--),d.cursor=d.end}else{var h=this.$findOpeningBracket(g[2],a);if(!h)return null;d=e.fromPoints(h,a),c||(d.start.column++,d.end.column--),d.cursor=d.start}return d},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{"},this.$findOpeningBracket=function(a,b,c){var e=this.$brackets[a],f=1,g=new d(this,b.row,b.column),h=g.getCurrentToken();h||(h=g.stepForward());if(!h)return;c||(c=new RegExp("(\\.?"+h.type.replace(".","\\.").replace("rparen",".paren")+")+"));var i=b.column-g.getCurrentTokenColumn()-2,j=h.value;for(;;){while(i>=0){var k=j.charAt(i);if(k==e){f-=1;if(f==0)return{row:g.getCurrentTokenRow(),column:i+g.getCurrentTokenColumn()}}else k==a&&(f+=1);i-=1}do h=g.stepBackward();while(h&&!c.test(h.type));if(h==null)break;j=h.value,i=j.length-1}return null},this.$findClosingBracket=function(a,b,c){var e=this.$brackets[a],f=1,g=new d(this,b.row,b.column),h=g.getCurrentToken();h||(h=g.stepForward());if(!h)return;c||(c=new RegExp("(\\.?"+h.type.replace(".","\\.").replace("lparen",".paren")+")+"));var i=b.column-g.getCurrentTokenColumn();for(;;){var j=h.value,k=j.length;while(i<k){var l=j.charAt(i);if(l==e){f-=1;if(f==0)return{row:g.getCurrentTokenRow(),column:i+g.getCurrentTokenColumn()}}else l==a&&(f+=1);i+=1}do h=g.stepForward();while(h&&!c.test(h.type));if(h==null)break;i=0}return null}}var d=a("../token_iterator").TokenIterator,e=a("../range").Range;b.BracketMatch=f}),define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(a,b,c){var d=a("./lib/lang"),e=a("./lib/oop"),f=a("./range").Range,g=function(){this.$options={}};(function(){this.set=function(a){return e.mixin(this.$options,a),this},this.getOptions=function(){return d.copyObject(this.$options)},this.setOptions=function(a){this.$options=a},this.find=function(a){var b=this.$matchIterator(a,this.$options);if(!b)return!1;var c=null;return b.forEach(function(a,b,d){if(!a.start){var e=a.offset+(d||0);c=new f(b,e,b,e+a.length)}else c=a;return!0}),c},this.findAll=function(a){var b=this.$options;if(!b.needle)return[];this.$assembleRegExp(b);var c=b.range,e=c?a.getLines(c.start.row,c.end.row):a.doc.getAllLines(),g=[],h=b.re;if(b.$isMultiLine){var i=h.length,j=e.length-i;for(var k=h.offset||0;k<=j;k++){for(var l=0;l<i;l++)if(e[k+l].search(h[l])==-1)break;var m=e[k],n=e[k+i-1],o=m.match(h[0])[0].length,p=n.match(h[i-1])[0].length;g.push(new f(k,m.length-o,k+i-1,p))}}else for(var q=0;q<e.length;q++){var r=d.getMatchOffsets(e[q],h);for(var l=0;l<r.length;l++){var s=r[l];g.push(new f(q,s.offset,q,s.offset+s.length))}}if(c){var t=c.start.column,u=c.start.column,q=0,l=g.length-1;while(q<l&&g[q].start.column<t&&g[q].start.row==c.start.row)q++;while(q<l&&g[l].end.column>u&&g[l].end.row==c.end.row)l--;return g.slice(q,l+1)}return g},this.replace=function(a,b){var c=this.$options,d=this.$assembleRegExp(c);if(c.$isMultiLine)return b;if(!d)return;var e=d.exec(a);if(!e||e[0].length!=a.length)return null;b=a.replace(d,b);if(c.preserveCase){b=b.split("");for(var f=Math.min(a.length,a.length);f--;){var g=a[f];g&&g.toLowerCase()!=g?b[f]=b[f].toUpperCase():b[f]=b[f].toLowerCase()}b=b.join("")}return b},this.$matchIterator=function(a,b){var c=this.$assembleRegExp(b);if(!c)return!1;var e=this,g,h=b.backwards;if(b.$isMultiLine)var i=c.length,j=function(b,d,e){var h=b.search(c[0]);if(h==-1)return;for(var j=1;j<i;j++){b=a.getLine(d+j);if(b.search(c[j])==-1)return}var k=b.match(c[i-1])[0].length,l=new f(d,h,d+i-1,k);c.offset==1?(l.start.row--,l.start.column=Number.MAX_VALUE):e&&(l.start.column+=e);if(g(l))return!0};else if(h)var j=function(a,b,e){var f=d.getMatchOffsets(a,c);for(var h=f.length-1;h>=0;h--)if(g(f[h],b,e))return!0};else var j=function(a,b,e){var f=d.getMatchOffsets(a,c);for(var h=0;h<f.length;h++)if(g(f[h],b,e))return!0};return{forEach:function(c){g=c,e.$lineIterator(a,b).forEach(j)}}},this.$assembleRegExp=function(a){if(a.needle instanceof RegExp)return a.re=a.needle;var b=a.needle;if(!a.needle)return a.re=!1;a.regExp||(b=d.escapeRegExp(b)),a.wholeWord&&(b="\\b"+b+"\\b");var c=a.caseSensitive?"g":"gi";a.$isMultiLine=/[\n\r]/.test(b);if(a.$isMultiLine)return a.re=this.$assembleMultilineRegExp(b,c);try{var e=new RegExp(b,c)}catch(f){e=!1}return a.re=e},this.$assembleMultilineRegExp=function(a,b){var c=a.replace(/\r\n|\r|\n/g,"$\n^").split("\n"),d=[];for(var e=0;e<c.length;e++)try{d.push(new RegExp(c[e],b))}catch(f){return!1}return c[0]==""?(d.shift(),d.offset=1):d.offset=0,d},this.$lineIterator=function(a,b){var c=b.backwards==1,d=b.skipCurrent!=0,e=b.range,f=b.start;f||(f=e?e[c?"end":"start"]:a.selection.getRange()),f.start&&(f=f[d!=c?"end":"start"]);var g=e?e.start.row:0,h=e?e.end.row:a.getLength()-1,i=c?function(c){var d=f.row,e=a.getLine(d).substring(0,f.column);if(c(e,d))return;for(d--;d>=g;d--)if(c(a.getLine(d),d))return;if(b.wrap==0)return;for(d=h,g=f.row;d>=g;d--)if(c(a.getLine(d),d))return}:function(c){var d=f.row,e=a.getLine(d).substr(f.column);if(c(e,d,f.column))return;for(d+=1;d<=h;d++)if(c(a.getLine(d),d))return;if(b.wrap==0)return;for(d=g,h=f.row;d<=h;d++)if(c(a.getLine(d),d))return};return{forEach:i}}}).call(g.prototype),b.Search=g}),define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(a,b,c){var d=a("../lib/oop"),e=a("../keyboard/hash_handler").HashHandler,f=a("../lib/event_emitter").EventEmitter,g=function(a,b){this.platform=a,this.commands=this.byName={},this.commmandKeyBinding={},this.addCommands(b),this.setDefaultHandler("exec",function(a){return a.command.exec(a.editor,a.args||{})})};d.inherits(g,e),function(){d.implement(this,f),this.exec=function(a,b,c){typeof a=="string"&&(a=this.commands[a]);if(!a)return!1;if(b&&b.$readOnly&&!a.readOnly)return!1;var d=this._emit("exec",{editor:b,command:a,args:c});return d===!1?!1:!0},this.toggleRecording=function(a){if(this.$inReplay)return;return a&&a._emit("changeStatus"),this.recording?(this.macro.pop(),this.removeEventListener("exec",this.$addCommandToMacro),this.macro.length||(this.macro=this.oldMacro),this.recording=!1):(this.$addCommandToMacro||(this.$addCommandToMacro=function(a){this.macro.push([a.command,a.args])}.bind(this)),this.oldMacro=this.macro,this.macro=[],this.on("exec",this.$addCommandToMacro),this.recording=!0)},this.replay=function(a){if(this.$inReplay||!this.macro)return;if(this.recording)return this.toggleRecording(a);try{this.$inReplay=!0,this.macro.forEach(function(b){typeof b=="string"?this.exec(b,a):this.exec(b[0],a,b[1])},this)}finally{this.$inReplay=!1}},this.trimMacro=function(a){return a.map(function(a){return typeof a[0]!="string"&&(a[0]=a[0].name),a[1]||(a=a[0]),a})}}.call(g.prototype),b.CommandManager=g}),define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys"],function(a,b,c){function e(a,b){this.platform=b,this.commands={},this.commmandKeyBinding={},this.addCommands(a)}var d=a("../lib/keys");(function(){this.addCommand=function(a){this.commands[a.name]&&this.removeCommand(a),this.commands[a.name]=a,a.bindKey&&this._buildKeyHash(a)},this.removeCommand=function(a){var b=typeof a=="string"?a:a.name;a=this.commands[b],delete this.commands[b];var c=this.commmandKeyBinding;for(var d in c)for(var e in c[d])c[d][e]==a&&delete c[d][e]},this.bindKey=function(a,b){if(!a)return;if(typeof b=="function"){this.addCommand({exec:b,bindKey:a,name:a});return}var c=this.commmandKeyBinding;a.split("|").forEach(function(a){var d=this.parseKeys(a,b),e=d.hashId;(c[e]||(c[e]={}))[d.key]=b},this)},this.addCommands=function(a){a&&Object.keys(a).forEach(function(b){var c=a[b];if(typeof c=="string")return this.bindKey(c,b);typeof c=="function"&&(c={exec:c}),c.name||(c.name=b),this.addCommand(c)},this)},this.removeCommands=function(a){Object.keys(a).forEach(function(b){this.removeCommand(a[b])},this)},this.bindKeys=function(a){Object.keys(a).forEach(function(b){this.bindKey(b,a[b])},this)},this._buildKeyHash=function(a){var b=a.bindKey;if(!b)return;var c=typeof b=="string"?b:b[this.platform];this.bindKey(c,a)},this.parseKeys=function(a){var b=a.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(a){return a}),c=b.pop(),e=d[c];if(d.FUNCTION_KEYS[e])c=d.FUNCTION_KEYS[e].toLowerCase();else{if(!b.length)return{key:c,hashId:-1};if(b.length==1&&b[0]=="shift")return{key:c.toUpperCase(),hashId:-1}}var f=0;for(var g=b.length;g--;){var h=d.KEY_MODS[b[g]];if(h==null)throw"invalid modifier "+b[g]+" in "+a;f|=h}return{key:c,hashId:f}},this.findKeyCommand=function(b,c){var d=this.commmandKeyBinding;return d[b]&&d[b][c]},this.handleKeyboard=function(a,b,c,d){return{command:this.findKeyCommand(b,c)}}}).call(e.prototype),b.HashHandler=e}),define("ace/commands/default_commands",["require","exports","module","ace/lib/lang"],function(a,b,c){function e(a,b){return{win:a,mac:b}}var d=a("../lib/lang");b.commands=[{name:"selectall",bindKey:e("Ctrl-A","Command-A"),exec:function(a){a.selectAll()},readOnly:!0},{name:"centerselection",bindKey:e(null,"Ctrl-L"),exec:function(a){a.centerSelection()},readOnly:!0},{name:"gotoline",bindKey:e("Ctrl-L","Command-L"),exec:function(a){var b=parseInt(prompt("Enter line number:"),10);isNaN(b)||a.gotoLine(b)},readOnly:!0},{name:"fold",bindKey:e("Alt-L|Ctrl-F1","Command-Alt-L|Command-F1"),exec:function(a){a.session.toggleFold(!1)},readOnly:!0},{name:"unfold",bindKey:e("Alt-Shift-L|Ctrl-Shift-F1","Command-Alt-Shift-L|Command-Shift-F1"),exec:function(a){a.session.toggleFold(!0)},readOnly:!0},{name:"foldall",bindKey:e("Alt-0","Command-Option-0"),exec:function(a){a.session.foldAll()},readOnly:!0},{name:"unfoldall",bindKey:e("Alt-Shift-0","Command-Option-Shift-0"),exec:function(a){a.session.unfold()},readOnly:!0},{name:"findnext",bindKey:e("Ctrl-K","Command-G"),exec:function(a){a.findNext()},readOnly:!0},{name:"findprevious",bindKey:e("Ctrl-Shift-K","Command-Shift-G"),exec:function(a){a.findPrevious()},readOnly:!0},{name:"find",bindKey:e("Ctrl-F","Command-F"),exec:function(a){var b=prompt("Find:",a.getCopyText());a.find(b)},readOnly:!0},{name:"overwrite",bindKey:"Insert",exec:function(a){a.toggleOverwrite()},readOnly:!0},{name:"selecttostart",bindKey:e("Ctrl-Shift-Home","Command-Shift-Up"),exec:function(a){a.getSelection().selectFileStart()},multiSelectAction:"forEach",readOnly:!0},{name:"gotostart",bindKey:e("Ctrl-Home","Command-Home|Command-Up"),exec:function(a){a.navigateFileStart()},multiSelectAction:"forEach",readOnly:!0},{name:"selectup",bindKey:e("Shift-Up","Shift-Up"),exec:function(a){a.getSelection().selectUp()},multiSelectAction:"forEach",readOnly:!0},{name:"golineup",bindKey:e("Up","Up|Ctrl-P"),exec:function(a,b){a.navigateUp(b.times)},multiSelectAction:"forEach",readOnly:!0},{name:"selecttoend",bindKey:e("Ctrl-Shift-End","Command-Shift-Down"),exec:function(a){a.getSelection().selectFileEnd()},multiSelectAction:"forEach",readOnly:!0},{name:"gotoend",bindKey:e("Ctrl-End","Command-End|Command-Down"),exec:function(a){a.navigateFileEnd()},multiSelectAction:"forEach",readOnly:!0},{name:"selectdown",bindKey:e("Shift-Down","Shift-Down"),exec:function(a){a.getSelection().selectDown()},multiSelectAction:"forEach",readOnly:!0},{name:"golinedown",bindKey:e("Down","Down|Ctrl-N"),exec:function(a,b){a.navigateDown(b.times)},multiSelectAction:"forEach",readOnly:!0},{name:"selectwordleft",bindKey:e("Ctrl-Shift-Left","Option-Shift-Left"),exec:function(a){a.getSelection().selectWordLeft()},multiSelectAction:"forEach",readOnly:!0},{name:"gotowordleft",bindKey:e("Ctrl-Left","Option-Left"),exec:function(a){a.navigateWordLeft()},multiSelectAction:"forEach",readOnly:!0},{name:"selecttolinestart",bindKey:e("Alt-Shift-Left","Command-Shift-Left"),exec:function(a){a.getSelection().selectLineStart()},multiSelectAction:"forEach",readOnly:!0},{name:"gotolinestart",bindKey:e("Alt-Left|Home","Command-Left|Home|Ctrl-A"),exec:function(a){a.navigateLineStart()},multiSelectAction:"forEach",readOnly:!0},{name:"selectleft",bindKey:e("Shift-Left","Shift-Left"),exec:function(a){a.getSelection().selectLeft()},multiSelectAction:"forEach",readOnly:!0},{name:"gotoleft",bindKey:e("Left","Left|Ctrl-B"),exec:function(a,b){a.navigateLeft(b.times)},multiSelectAction:"forEach",readOnly:!0},{name:"selectwordright",bindKey:e("Ctrl-Shift-Right","Option-Shift-Right"),exec:function(a){a.getSelection().selectWordRight()},multiSelectAction:"forEach",readOnly:!0},{name:"gotowordright",bindKey:e("Ctrl-Right","Option-Right"),exec:function(a){a.navigateWordRight()},multiSelectAction:"forEach",readOnly:!0},{name:"selecttolineend",bindKey:e("Alt-Shift-Right","Command-Shift-Right"),exec:function(a){a.getSelection().selectLineEnd()},multiSelectAction:"forEach",readOnly:!0},{name:"gotolineend",bindKey:e("Alt-Right|End","Command-Right|End|Ctrl-E"),exec:function(a){a.navigateLineEnd()},multiSelectAction:"forEach",readOnly:!0},{name:"selectright",bindKey:e("Shift-Right","Shift-Right"),exec:function(a){a.getSelection().selectRight()},multiSelectAction:"forEach",readOnly:!0},{name:"gotoright",bindKey:e("Right","Right|Ctrl-F"),exec:function(a,b){a.navigateRight(b.times)},multiSelectAction:"forEach",readOnly:!0},{name:"selectpagedown",bindKey:"Shift-PageDown",exec:function(a){a.selectPageDown()},readOnly:!0},{name:"pagedown",bindKey:e(null,"Option-PageDown"),exec:function(a){a.scrollPageDown()},readOnly:!0},{name:"gotopagedown",bindKey:e("PageDown","PageDown|Ctrl-V"),exec:function(a){a.gotoPageDown()},readOnly:!0},{name:"selectpageup",bindKey:"Shift-PageUp",exec:function(a){a.selectPageUp()},readOnly:!0},{name:"pageup",bindKey:e(null,"Option-PageUp"),exec:function(a){a.scrollPageUp()},readOnly:!0},{name:"gotopageup",bindKey:"PageUp",exec:function(a){a.gotoPageUp()},readOnly:!0},{name:"scrollup",bindKey:e("Ctrl-Up",null),exec:function(a){a.renderer.scrollBy(0,-2*a.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",bindKey:e("Ctrl-Down",null),exec:function(a){a.renderer.scrollBy(0,2*a.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"selectlinestart",bindKey:"Shift-Home",exec:function(a){a.getSelection().selectLineStart()},multiSelectAction:"forEach",readOnly:!0},{name:"selectlineend",bindKey:"Shift-End",exec:function(a){a.getSelection().selectLineEnd()},multiSelectAction:"forEach",readOnly:!0},{name:"togglerecording",bindKey:e("Ctrl-Alt-E","Command-Option-E"),exec:function(a){a.commands.toggleRecording(a)},readOnly:!0},{name:"replaymacro",bindKey:e("Ctrl-Shift-E","Command-Shift-E"),exec:function(a){a.commands.replay(a)},readOnly:!0},{name:"jumptomatching",bindKey:e("Ctrl-P","Ctrl-Shift-P"),exec:function(a){a.jumpToMatching()},multiSelectAction:"forEach",readOnly:!0},{name:"selecttomatching",bindKey:e("Ctrl-Shift-P",null),exec:function(a){a.jumpToMatching(!0)},readOnly:!0},{name:"cut",exec:function(a){var b=a.getSelectionRange();a._emit("cut",b),a.selection.isEmpty()||(a.session.remove(b),a.clearSelection())},multiSelectAction:"forEach"},{name:"removeline",bindKey:e("Ctrl-D","Command-D"),exec:function(a){a.removeLines()},multiSelectAction:"forEach"},{name:"duplicateSelection",bindKey:e("Ctrl-Shift-D","Command-Shift-D"),exec:function(a){a.duplicateSelection()},multiSelectAction:"forEach"},{name:"togglecomment",bindKey:e("Ctrl-/","Command-/"),exec:function(a){a.toggleCommentLines()},multiSelectAction:"forEach"},{name:"replace",bindKey:e("Ctrl-R","Command-Option-F"),exec:function(a){var b=prompt("Find:",a.getCopyText());if(!b)return;var c=prompt("Replacement:");if(!c)return;a.replace(c,{needle:b})}},{name:"replaceall",bindKey:e("Ctrl-Shift-R","Command-Shift-Option-F"),exec:function(a){var b=prompt("Find:");if(!b)return;var c=prompt("Replacement:");if(!c)return;a.replaceAll(c,{needle:b})}},{name:"undo",bindKey:e("Ctrl-Z","Command-Z"),exec:function(a){a.undo()}},{name:"redo",bindKey:e("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(a){a.redo()}},{name:"copylinesup",bindKey:e("Alt-Shift-Up","Command-Option-Up"),exec:function(a){a.copyLinesUp()}},{name:"movelinesup",bindKey:e("Alt-Up","Option-Up"),exec:function(a){a.moveLinesUp()}},{name:"copylinesdown",bindKey:e("Alt-Shift-Down","Command-Option-Down"),exec:function(a){a.copyLinesDown()}},{name:"movelinesdown",bindKey:e("Alt-Down","Option-Down"),exec:function(a){a.moveLinesDown()}},{name:"del",bindKey:e("Delete","Delete|Ctrl-D"),exec:function(a){a.remove("right")},multiSelectAction:"forEach"},{name:"backspace",bindKey:e("Command-Backspace|Option-Backspace|Shift-Backspace|Backspace","Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H"),exec:function(a){a.remove("left")},multiSelectAction:"forEach"},{name:"removetolinestart",bindKey:e("Alt-Backspace","Command-Backspace"),exec:function(a){a.removeToLineStart()},multiSelectAction:"forEach"},{name:"removetolineend",bindKey:e("Alt-Delete","Ctrl-K"),exec:function(a){a.removeToLineEnd()},multiSelectAction:"forEach"},{name:"removewordleft",bindKey:e("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(a){a.removeWordLeft()},multiSelectAction:"forEach"},{name:"removewordright",bindKey:e("Ctrl-Delete","Alt-Delete"),exec:function(a){a.removeWordRight()},multiSelectAction:"forEach"},{name:"outdent",bindKey:e("Shift-Tab","Shift-Tab"),exec:function(a){a.blockOutdent()},multiSelectAction:"forEach"},{name:"indent",bindKey:e("Tab","Tab"),exec:function(a){a.indent()},multiSelectAction:"forEach"},{name:"insertstring",exec:function(a,b){a.insert(b)},multiSelectAction:"forEach"},{name:"inserttext",exec:function(a,b){a.insert(d.stringRepeat(b.text||"",b.times||1))},multiSelectAction:"forEach"},{name:"splitline",bindKey:e(null,"Ctrl-O"),exec:function(a){a.splitLine()},multiSelectAction:"forEach"},{name:"transposeletters",bindKey:e("Ctrl-T","Ctrl-T"),exec:function(a){a.transposeLetters()},multiSelectAction:function(a){a.transposeSelections(1)}},{name:"touppercase",bindKey:e("Ctrl-U","Ctrl-U"),exec:function(a){a.toUpperCase()},multiSelectAction:"forEach"},{name:"tolowercase",bindKey:e("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(a){a.toLowerCase()},multiSelectAction:"forEach"}]}),define("ace/undomanager",["require","exports","module"],function(a,b,c){var d=function(){this.reset()};(function(){this.execute=function(a){var b=a.args[0];this.$doc=a.args[1],this.$undoStack.push(b),this.$redoStack=[]},this.undo=function(a){var b=this.$undoStack.pop(),c=null;return b&&(c=this.$doc.undoChanges(b,a),this.$redoStack.push(b)),c},this.redo=function(a){var b=this.$redoStack.pop(),c=null;return b&&(c=this.$doc.redoChanges(b,a),this.$undoStack.push(b)),c},this.reset=function(){this.$undoStack=[],this.$redoStack=[]},this.hasUndo=function(){return this.$undoStack.length>0},this.hasRedo=function(){return this.$redoStack.length>0}}).call(d.prototype),b.UndoManager=d}),define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/useragent","ace/config","ace/lib/net","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/renderloop","ace/lib/event_emitter","text!ace/css/editor.css"],function(a,b,c){var d=a("./lib/oop"),e=a("./lib/dom"),f=a("./lib/event"),g=a("./lib/useragent"),h=a("./config"),i=a("./lib/net"),j=a("./layer/gutter").Gutter,k=a("./layer/marker").Marker,l=a("./layer/text").Text,m=a("./layer/cursor").Cursor,n=a("./scrollbar").ScrollBar,o=a("./renderloop").RenderLoop,p=a("./lib/event_emitter").EventEmitter,q=a("text!./css/editor.css");e.importCssString(q,"ace_editor");var r=function(a,b){var c=this;this.container=a,this.$keepTextAreaAtCursor=!g.isIE,e.addCssClass(a,"ace_editor"),this.setTheme(b),this.$gutter=e.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.scroller=e.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=e.createElement("div"),this.content.className="ace_content",this.scroller.appendChild(this.content),this.setHighlightGutterLine(!0),this.$gutterLayer=new j(this.$gutter),this.$gutterLayer.on("changeGutterWidth",this.onResize.bind(this,!0)),this.$markerBack=new k(this.content);var d=this.$textLayer=new l(this.content);this.canvas=d.element,this.$markerFront=new k(this.content),this.characterWidth=d.getCharacterWidth(),this.lineHeight=d.getLineHeight(),this.$cursorLayer=new m(this.content),this.$cursorPadding=8,this.$horizScroll=!1,this.$horizScrollAlwaysVisible=!1,this.$animatedScroll=!1,this.scrollBar=new n(a),this.scrollBar.addEventListener("scroll",function(a){c.$inScrollAnimation||c.session.setScrollTop(a.data)}),this.scrollTop=0,this.scrollLeft=0,f.addListener(this.scroller,"scroll",function(){var a=c.scroller.scrollLeft;c.scrollLeft=a,c.session.setScrollLeft(a)}),this.cursorPos={row:0,column:0},this.$textLayer.addEventListener("changeCharacterSize",function(){c.characterWidth=d.getCharacterWidth(),c.lineHeight=d.getLineHeight(),c.$updatePrintMargin(),c.onResize(!0),c.$loop.schedule(c.CHANGE_FULL)}),this.$size={width:0,height:0,scrollerHeight:0,scrollerWidth:0},this.layerConfig={width:1,padding:0,firstRow:0,firstRowScreen:0,lastRow:0,lineHeight:1,characterWidth:1,minHeight:1,maxHeight:1,offset:0,height:1},this.$loop=new o(this.$renderChanges.bind(this),this.container.ownerDocument.defaultView),this.$loop.schedule(this.CHANGE_FULL),this.setPadding(4),this.$updatePrintMargin()};(function(){this.showGutter=!0,this.CHANGE_CURSOR=1,this.CHANGE_MARKER=2,this.CHANGE_GUTTER=4,this.CHANGE_SCROLL=8,this.CHANGE_LINES=16,this.CHANGE_TEXT=32,this.CHANGE_SIZE=64,this.CHANGE_MARKER_BACK=128,this.CHANGE_MARKER_FRONT=256,this.CHANGE_FULL=512,this.CHANGE_H_SCROLL=1024,d.implement(this,p),this.setSession=function(a){this.session=a,this.scroller.className="ace_scroller",this.$cursorLayer.setSession(a),this.$markerBack.setSession(a),this.$markerFront.setSession(a),this.$gutterLayer.setSession(a),this.$textLayer.setSession(a),this.$loop.schedule(this.CHANGE_FULL)},this.updateLines=function(a,b){b===undefined&&(b=Infinity),this.$changedLines?(this.$changedLines.firstRow>a&&(this.$changedLines.firstRow=a),this.$changedLines.lastRow<b&&(this.$changedLines.lastRow=b)):this.$changedLines={firstRow:a,lastRow:b},this.$loop.schedule(this.CHANGE_LINES)},this.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},this.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},this.updateFull=function(a){a?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},this.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},this.onResize=function(a,b,c,d){var f=this.CHANGE_SIZE,g=this.$size;if(this.resizing>2)return;this.resizing>1?this.resizing++:this.resizing=a?1:0,d||(d=e.getInnerHeight(this.container));if(a||g.height!=d)g.height=d,this.scroller.style.height=d+"px",g.scrollerHeight=this.scroller.clientHeight,this.scrollBar.setHeight(g.scrollerHeight),this.session&&(this.session.setScrollTop(this.getScrollTop()),f|=this.CHANGE_FULL);c||(c=e.getInnerWidth(this.container));if(a||this.resizing>1||g.width!=c){g.width=c;var b=this.showGutter?this.$gutter.offsetWidth:0;this.scroller.style.left=b+"px",g.scrollerWidth=Math.max(0,c-b-this.scrollBar.getWidth()),this.scroller.style.right=this.scrollBar.getWidth()+"px";if(this.session.getUseWrapMode()&&this.adjustWrapLimit()||a)f|=this.CHANGE_FULL}a?this.$renderChanges(f,!0):this.$loop.schedule(f),a&&delete this.resizing},this.adjustWrapLimit=function(){var a=this.$size.scrollerWidth-this.$padding*2,b=Math.floor(a/this.characterWidth);return this.session.adjustWrapLimit(b)},this.setAnimatedScroll=function(a){this.$animatedScroll=a},this.getAnimatedScroll=function(){return this.$animatedScroll},this.setShowInvisibles=function(a){this.$textLayer.setShowInvisibles(a)&&this.$loop.schedule(this.CHANGE_TEXT)},this.getShowInvisibles=function(){return this.$textLayer.showInvisibles},this.getDisplayIndentGuides=function(){return this.$textLayer.displayIndentGuides},this.setDisplayIndentGuides=function(a){this.$textLayer.setDisplayIndentGuides(a)&&this.$loop.schedule(this.CHANGE_TEXT)},this.$showPrintMargin=!0,this.setShowPrintMargin=function(a){this.$showPrintMargin=a,this.$updatePrintMargin()},this.getShowPrintMargin=function(){return this.$showPrintMargin},this.$printMarginColumn=80,this.setPrintMarginColumn=function(a){this.$printMarginColumn=a,this.$updatePrintMargin()},this.getPrintMarginColumn=function(){return this.$printMarginColumn},this.getShowGutter=function(){return this.showGutter},this.setShowGutter=function(a){if(this.showGutter===a)return;this.$gutter.style.display=a?"block":"none",this.showGutter=a,this.onResize(!0)},this.getFadeFoldWidgets=function(){return e.hasCssClass(this.$gutter,"ace_fade-fold-widgets")},this.setFadeFoldWidgets=function(a){a?e.addCssClass(this.$gutter,"ace_fade-fold-widgets"):e.removeCssClass(this.$gutter,"ace_fade-fold-widgets")},this.$highlightGutterLine=!1,this.setHighlightGutterLine=function(a){if(this.$highlightGutterLine==a)return;this.$highlightGutterLine=a;if(!this.$gutterLineHighlight){this.$gutterLineHighlight=e.createElement("div"),this.$gutterLineHighlight.className="ace_gutter_active_line",this.$gutter.appendChild(this.$gutterLineHighlight);return}this.$gutterLineHighlight.style.display=a?"":"none",this.$cursorLayer.$pixelPos&&this.$updateGutterLineHighlight()},this.getHighlightGutterLine=function(){return this.$highlightGutterLine},this.$updateGutterLineHighlight=function(){this.$gutterLineHighlight.style.top=this.$cursorLayer.$pixelPos.top-this.layerConfig.offset+"px",this.$gutterLineHighlight.style.height=this.layerConfig.lineHeight+"px"},this.$updatePrintMargin=function(){var a;if(!this.$showPrintMargin&&!this.$printMarginEl)return;this.$printMarginEl||(a=e.createElement("div"),a.className="ace_print_margin_layer",this.$printMarginEl=e.createElement("div"),this.$printMarginEl.className="ace_print_margin",a.appendChild(this.$printMarginEl),this.content.insertBefore(a,this.$textLayer.element));var b=this.$printMarginEl.style;b.left=this.characterWidth*this.$printMarginColumn+this.$padding+"px",b.visibility=this.$showPrintMargin?"visible":"hidden"},this.getContainerElement=function(){return this.container},this.getMouseEventTarget=function(){return this.content},this.getTextAreaContainer=function(){return this.container},this.$moveTextAreaToCursor=function(){if(!this.$keepTextAreaAtCursor)return;var a=this.$cursorLayer.$pixelPos.top,b=this.$cursorLayer.$pixelPos.left;a-=this.layerConfig.offset;if(a<0||a>this.layerConfig.height-this.lineHeight)return;var c=this.characterWidth;this.$composition&&(c+=this.textarea.scrollWidth),b-=this.scrollLeft,b>this.$size.scrollerWidth-c&&(b=this.$size.scrollerWidth-c),this.showGutter&&(b+=this.$gutterLayer.gutterWidth),this.textarea.style.height=this.lineHeight+"px",this.textarea.style.width=c+"px",this.textarea.style.left=b+"px",this.textarea.style.top=a-1+"px"},this.getFirstVisibleRow=function(){return this.layerConfig.firstRow},this.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+(this.layerConfig.offset===0?0:1)},this.getLastFullyVisibleRow=function(){var a=Math.floor((this.layerConfig.height+this.layerConfig.offset)/this.layerConfig.lineHeight);return this.layerConfig.firstRow-1+a},this.getLastVisibleRow=function(){return this.layerConfig.lastRow},this.$padding=null,this.setPadding=function(a){this.$padding=a,this.$textLayer.setPadding(a),this.$cursorLayer.setPadding(a),this.$markerFront.setPadding(a),this.$markerBack.setPadding(a),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},this.getHScrollBarAlwaysVisible=function(){return this.$horizScrollAlwaysVisible},this.setHScrollBarAlwaysVisible=function(a){this.$horizScrollAlwaysVisible!=a&&(this.$horizScrollAlwaysVisible=a,(!this.$horizScrollAlwaysVisible||!this.$horizScroll)&&this.$loop.schedule(this.CHANGE_SCROLL))},this.$updateScrollBar=function(){this.scrollBar.setInnerHeight(this.layerConfig.maxHeight),this.scrollBar.setScrollTop(this.scrollTop)},this.$renderChanges=function(a,b){if(!b&&(!a||!this.session||!this.container.offsetWidth))return;(a&this.CHANGE_FULL||a&this.CHANGE_SIZE||a&this.CHANGE_TEXT||a&this.CHANGE_LINES||a&this.CHANGE_SCROLL)&&this.$computeLayerConfig();if(a&this.CHANGE_H_SCROLL){this.scroller.scrollLeft=this.scrollLeft;var c=this.scroller.scrollLeft;this.scrollLeft=c,this.session.setScrollLeft(c),this.scroller.className=this.scrollLeft==0?"ace_scroller":"ace_scroller horscroll"}if(a&this.CHANGE_FULL){this.$textLayer.checkForSizeChanges(),this.$updateScrollBar(),this.$textLayer.update(this.layerConfig),this.showGutter&&this.$gutterLayer.update(this.layerConfig),this.$markerBack.update(this.layerConfig),this.$markerFront.update(this.layerConfig),this.$cursorLayer.update(this.layerConfig),this.$moveTextAreaToCursor(),this.$highlightGutterLine&&this.$updateGutterLineHighlight();return}if(a&this.CHANGE_SCROLL){this.$updateScrollBar(),a&this.CHANGE_TEXT||a&this.CHANGE_LINES?this.$textLayer.update(this.layerConfig):this.$textLayer.scrollLines(this.layerConfig),this.showGutter&&this.$gutterLayer.update(this.layerConfig),this.$markerBack.update(this.layerConfig),this.$markerFront.update(this.layerConfig),this.$cursorLayer.update(this.layerConfig),this.$moveTextAreaToCursor(),this.$highlightGutterLine&&this.$updateGutterLineHighlight();return}a&this.CHANGE_TEXT?(this.$textLayer.update(this.layerConfig),this.showGutter&&this.$gutterLayer.update(this.layerConfig)):a&this.CHANGE_LINES?(this.$updateLines()||a&this.CHANGE_GUTTER&&this.showGutter)&&this.$gutterLayer.update(this.layerConfig):(a&this.CHANGE_TEXT||a&this.CHANGE_GUTTER)&&this.showGutter&&this.$gutterLayer.update(this.layerConfig),a&this.CHANGE_CURSOR&&(this.$cursorLayer.update(this.layerConfig),this.$moveTextAreaToCursor(),this.$highlightGutterLine&&this.$updateGutterLineHighlight()),a&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(this.layerConfig),a&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(this.layerConfig),a&this.CHANGE_SIZE&&this.$updateScrollBar()},this.$computeLayerConfig=function(){var a=this.session,b=this.scrollTop%this.lineHeight,c=this.$size.scrollerHeight+this.lineHeight,d=this.$getLongestLine(),e=this.$horizScrollAlwaysVisible||this.$size.scrollerWidth-d<0,f=this.$horizScroll!==e;this.$horizScroll=e,f&&(this.scroller.style.overflowX=e?"scroll":"hidden",e||this.session.setScrollLeft(0));var g=this.session.getScreenLength()*this.lineHeight;this.session.setScrollTop(Math.max(0,Math.min(this.scrollTop,g-this.$size.scrollerHeight)));var h=Math.ceil(c/this.lineHeight)-1,i=Math.max(0,Math.round((this.scrollTop-b)/this.lineHeight)),j=i+h,k,l,m=this.lineHeight;i=a.screenToDocumentRow(i,0);var n=a.getFoldLine(i);n&&(i=n.start.row),k=a.documentToScreenRow(i,0),l=a.getRowLength(i)*m,j=Math.min(a.screenToDocumentRow(j,0),a.getLength()-1),c=this.$size.scrollerHeight+a.getRowLength(j)*m+l,b=this.scrollTop-k*m,this.layerConfig={width:d,padding:this.$padding,firstRow:i,firstRowScreen:k,lastRow:j,lineHeight:m,characterWidth:this.characterWidth,minHeight:c,maxHeight:g,offset:b,height:this.$size.scrollerHeight},this.$gutterLayer.element.style.marginTop=-b+"px",this.content.style.marginTop=-b+"px",this.content.style.width=d+2*this.$padding+"px",this.content.style.height=c+"px",f&&this.onResize(!0)},this.$updateLines=function(){var a=this.$changedLines.firstRow,b=this.$changedLines.lastRow;this.$changedLines=null;var c=this.layerConfig;if(a>c.lastRow+1)return;if(b<c.firstRow)return;if(b===Infinity){this.showGutter&&this.$gutterLayer.update(c),this.$textLayer.update(c);return}return this.$textLayer.updateLines(c,a,b),!0},this.$getLongestLine=function(){var a=this.session.getScreenWidth();return this.$textLayer.showInvisibles&&(a+=1),Math.max(this.$size.scrollerWidth-2*this.$padding,Math.round(a*this.characterWidth))},this.updateFrontMarkers=function(){this.$markerFront.setMarkers(this.session.getMarkers(!0)),this.$loop.schedule(this.CHANGE_MARKER_FRONT)},this.updateBackMarkers=function(){this.$markerBack.setMarkers(this.session.getMarkers()),this.$loop.schedule(this.CHANGE_MARKER_BACK)},this.addGutterDecoration=function(a,b){this.$gutterLayer.addGutterDecoration(a,b)},this.removeGutterDecoration=function(a,b){this.$gutterLayer.removeGutterDecoration(a,b)},this.updateBreakpoints=function(a){this.$loop.schedule(this.CHANGE_GUTTER)},this.setAnnotations=function(a){this.$gutterLayer.setAnnotations(a),this.$loop.schedule(this.CHANGE_GUTTER)},this.updateCursor=function(){this.$loop.schedule(this.CHANGE_CURSOR)},this.hideCursor=function(){this.$cursorLayer.hideCursor()},this.showCursor=function(){this.$cursorLayer.showCursor()},this.scrollSelectionIntoView=function(a,b,c){this.scrollCursorIntoView(a,c),this.scrollCursorIntoView(b,c)},this.scrollCursorIntoView=function(a,b){if(this.$size.scrollerHeight===0)return;var c=this.$cursorLayer.getPixelPosition(a),d=c.left,e=c.top;this.scrollTop>e?(b&&(e-=b*this.$size.scrollerHeight),this.session.setScrollTop(e)):this.scrollTop+this.$size.scrollerHeight<e+this.lineHeight&&(b&&(e+=b*this.$size.scrollerHeight),this.session.setScrollTop(e+this.lineHeight-this.$size.scrollerHeight));var f=this.scrollLeft;f>d?(d<this.$padding+2*this.layerConfig.characterWidth&&(d=0),this.session.setScrollLeft(d)):f+this.$size.scrollerWidth<d+this.characterWidth&&this.session.setScrollLeft(Math.round(d+this.characterWidth-this.$size.scrollerWidth))},this.getScrollTop=function(){return this.session.getScrollTop()},this.getScrollLeft=function(){return this.session.getScrollLeft()},this.getScrollTopRow=function(){return this.scrollTop/this.lineHeight},this.getScrollBottomRow=function(){return Math.max(0,Math.floor((this.scrollTop+this.$size.scrollerHeight)/this.lineHeight)-1)},this.scrollToRow=function(a){this.session.setScrollTop(a*this.lineHeight)},this.alignCursor=function(a,b){typeof a=="number"&&(a={row:a,column:0});var c=this.$cursorLayer.getPixelPosition(a),d=this.$size.scrollerHeight-this.lineHeight,e=c.top-d*(b||0);return this.session.setScrollTop(e),e},this.STEPS=8,this.$calcSteps=function(a,b){var c=0,d=this.STEPS,e=[],f=function(a,b,c){return c*(Math.pow(a-1,3)+1)+b};for(c=0;c<d;++c)e.push(f(c/this.STEPS,a,b-a));return e},this.scrollToLine=function(a,b,c,d){var e=this.$cursorLayer.getPixelPosition({row:a,column:0}),f=e.top;b&&(f-=this.$size.scrollerHeight/2);var g=this.scrollTop;this.session.setScrollTop(f),c!==!1&&this.animateScrolling(g,d)},this.animateScrolling=function(a,b){var c=this.scrollTop;if(this.$animatedScroll&&Math.abs(a-c)<1e5){var d=this,e=d.$calcSteps(a,c);this.$inScrollAnimation=!0,clearInterval(this.$timer),d.session.setScrollTop(e.shift()),this.$timer=setInterval(function(){e.length?(d.session.setScrollTop(e.shift()),d.session.$scrollTop=c):c!=null?(d.session.$scrollTop=-1,d.session.setScrollTop(c),c=null):(d.$timer=clearInterval(d.$timer),d.$inScrollAnimation=!1,b&&b())},10)}},this.scrollToY=function(a){this.scrollTop!==a&&(this.$loop.schedule(this.CHANGE_SCROLL),this.scrollTop=a)},this.scrollToX=function(a){a<0&&(a=0),this.scrollLeft!==a&&(this.scrollLeft=a),this.$loop.schedule(this.CHANGE_H_SCROLL)},this.scrollBy=function(a,b){b&&this.session.setScrollTop(this.session.getScrollTop()+b),a&&this.session.setScrollLeft(this.session.getScrollLeft()+a)},this.isScrollableBy=function(a,b){if(b<0&&this.session.getScrollTop()>0)return!0;if(b>0&&this.session.getScrollTop()+this.$size.scrollerHeight<this.layerConfig.maxHeight)return!0},this.pixelToScreenCoordinates=function(a,b){var c=this.scroller.getBoundingClientRect(),d=(a+this.scrollLeft-c.left-this.$padding)/this.characterWidth,e=Math.floor((b+this.scrollTop-c.top)/this.lineHeight),f=Math.round(d);return{row:e,column:f,side:d-f>0?1:-1}},this.screenToTextCoordinates=function(a,b){var c=this.scroller.getBoundingClientRect(),d=Math.round((a+this.scrollLeft-c.left-this.$padding)/this.characterWidth),e=Math.floor((b+this.scrollTop-c.top)/this.lineHeight);return this.session.screenToDocumentPosition(e,Math.max(d,0))},this.textToScreenCoordinates=function(a,b){var c=this.scroller.getBoundingClientRect(),d=this.session.documentToScreenPosition(a,b),e=this.$padding+Math.round(d.column*this.characterWidth),f=d.row*this.lineHeight;return{pageX:c.left+e-this.scrollLeft,pageY:c.top+f-this.scrollTop}},this.visualizeFocus=function(){e.addCssClass(this.container,"ace_focus")},this.visualizeBlur=function(){e.removeCssClass(this.container,"ace_focus")},this.showComposition=function(a){this.$composition||(this.$composition={keepTextAreaAtCursor:this.$keepTextAreaAtCursor,cssText:this.textarea.style.cssText}),this.$keepTextAreaAtCursor=!0,e.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor()},this.setCompositionText=function(a){this.$moveTextAreaToCursor()},this.hideComposition=function(){if(!this.$composition)return;e.removeCssClass(this.textarea,"ace_composition"),this.$keepTextAreaAtCursor=this.$composition.keepTextAreaAtCursor,this.textarea.style.cssText=this.$composition.cssText,this.$composition=null},this._loadTheme=function(a,b){if(!h.get("packaged"))return b();i.loadScript(h.moduleUrl(a,"theme"),b)},this.setTheme=function(b){function h(a){e.importCssString(a.cssText,a.cssClass,c.container.ownerDocument),c.$theme&&e.removeCssClass(c.container,c.$theme),c.$theme=a?a.cssClass:null,c.$theme&&e.addCssClass(c.container,c.$theme),a&&a.isDark?e.addCssClass(c.container,"ace_dark"):e.removeCssClass(c.container,"ace_dark"),c.$size&&(c.$size.width=0,c.onResize())}var c=this;this.$themeValue=b;if(!b||typeof b=="string"){var d=b||"ace/theme/textmate",f;try{f=a(d)}catch(g){}if(f)return h(f);c._loadTheme(d,function(){a([d],function(a){if(c.$themeValue!==b)return;h(a)})})}else h(b)},this.getTheme=function(){return this.$themeValue},this.setStyle=function(b){e.addCssClass(this.container,b)},this.unsetStyle=function(b){e.removeCssClass(this.container,b)},this.destroy=function(){this.$textLayer.destroy(),this.$cursorLayer.destroy()}}).call(r.prototype),b.VirtualRenderer=r}),define("ace/layer/gutter",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter"],function(a,b,c){var d=a("../lib/dom"),e=a("../lib/oop"),f=a("../lib/event_emitter").EventEmitter,g=function(a){this.element=d.createElement("div"),this.element.className="ace_layer ace_gutter-layer",a.appendChild(this.element),this.setShowFoldWidgets(this.$showFoldWidgets),this.gutterWidth=0,this.$annotations=[]};(function(){e.implement(this,f),this.setSession=function(a){this.session=a},this.addGutterDecoration=function(a,b){window.console&&console.warn&&console.warn("deprecated use session.addGutterDecoration"),this.session.addGutterDecoration(a,b)},this.removeGutterDecoration=function(a,b){window.console&&console.warn&&console.warn("deprecated use session.removeGutterDecoration"),this.session.removeGutterDecoration(a,b)},this.setAnnotations=function(a){this.$annotations=[];for(var b in a)if(a.hasOwnProperty(b)){var c=a[b];if(!c)continue;var d=this.$annotations[b]={text:[]};for(var e=0;e<c.length;e++){var f=c[e],g=f.text.replace(/"/g,""").replace(/'/g,"’").replace(/</,"<");d.text.indexOf(g)===-1&&d.text.push(g);var h=f.type;h=="error"?d.className=" ace_error":h=="warning"&&d.className!=" ace_error"?d.className=" ace_warning":h=="info"&&!d.className&&(d.className=" ace_info")}}},this.update=function(a){var b={className:""},c=[],e=a.firstRow,f=a.lastRow,g=this.session.getNextFoldLine(e),h=g?g.start.row:Infinity,i=this.$showFoldWidgets&&this.session.foldWidgets,j=this.session.$breakpoints,k=this.session.$decorations,l=0;for(;;){e>h&&(e=g.end.row+1,g=this.session.getNextFoldLine(e,g),h=g?g.start.row:Infinity);if(e>f)break;var m=this.$annotations[e]||b;c.push("<div class='ace_gutter-cell ",j[e]||"",k[e]||"",m.className,"' style='height:",this.session.getRowLength(e)*a.lineHeight,"px;'>",l=e+1);if(i){var n=i[e];n==null&&(n=i[e]=this.session.getFoldWidget(e)),n&&c.push("<span class='ace_fold-widget ",n,n=="start"&&e==h&&e<g.end.row?" closed":" open","' style='height:",a.lineHeight,"px","'></span>")}c.push("</div>"),e++}this.element=d.setInnerHtml(this.element,c.join("")),this.element.style.height=a.minHeight+"px",this.session.$useWrapMode&&(l=this.session.getLength());var o=(""+l).length*a.characterWidth,p=this.$padding||this.$computePadding();o+=p.left+p.right,o!==this.gutterWidth&&(this.gutterWidth=o,this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._emit("changeGutterWidth",o))},this.$showFoldWidgets=!0,this.setShowFoldWidgets=function(a){a?d.addCssClass(this.element,"ace_folding-enabled"):d.removeCssClass(this.element,"ace_folding-enabled"),this.$showFoldWidgets=a,this.$padding=null},this.getShowFoldWidgets=function(){return this.$showFoldWidgets},this.$computePadding=function(){if(!this.element.firstChild)return{left:0,right:0};var a=d.computedStyle(this.element.firstChild);return this.$padding={},this.$padding.left=parseInt(a.paddingLeft)+1,this.$padding.right=parseInt(a.paddingRight),this.$padding},this.getRegion=function(a){var b=this.$padding||this.$computePadding(),c=this.element.getBoundingClientRect();if(a.x<b.left+c.left)return"markers";if(this.$showFoldWidgets&&a.x>c.right-b.right)return"foldWidgets"}}).call(g.prototype),b.Gutter=g}),define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(a,b,c){var d=a("../range").Range,e=a("../lib/dom"),f=function(a){this.element=e.createElement("div"),this.element.className="ace_layer ace_marker-layer",a.appendChild(this.element)};(function(){this.$padding=0,this.setPadding=function(a){this.$padding=a},this.setSession=function(a){this.session=a},this.setMarkers=function(a){this.markers=a},this.update=function(a){var a=a||this.config;if(!a)return;this.config=a;var b=[];for(var c in this.markers){var d=this.markers[c];if(!d.range){d.update(b,this,this.session,a);continue}var f=d.range.clipRows(a.firstRow,a.lastRow);if(f.isEmpty())continue;f=f.toScreenRange(this.session);if(d.renderer){var g=this.$getTop(f.start.row,a),h=Math.round(this.$padding+f.start.column*a.characterWidth);d.renderer(b,f,h,g,a)}else f.isMultiLine()?d.type=="text"?this.drawTextMarker(b,f,d.clazz,a):this.drawMultiLineMarker(b,f,d.clazz,a,d.type):this.drawSingleLineMarker(b,f,d.clazz+" start",a,null,d.type)}this.element=e.setInnerHtml(this.element,b.join(""))},this.$getTop=function(a,b){return(a-b.firstRowScreen)*b.lineHeight},this.drawTextMarker=function(a,b,c,e){var f=b.start.row,g=new d(f,b.start.column,f,this.session.getScreenLastRowColumn(f));this.drawSingleLineMarker(a,g,c+" start",e,1,"text"),f=b.end.row,g=new d(f,0,f,b.end.column),this.drawSingleLineMarker(a,g,c,e,0,"text");for(f=b.start.row+1;f<b.end.row;f++)g.start.row=f,g.end.row=f,g.end.column=this.session.getScreenLastRowColumn(f),this.drawSingleLineMarker(a,g,c,e,1,"text")},this.drawMultiLineMarker=function(a,b,c,d,e){var f=e==="background"?0:this.$padding,g=d.lineHeight,h=this.$getTop(b.start.row,d),i=Math.round(f+b.start.column*d.characterWidth);a.push("<div class='",c," start' style='","height:",g,"px;","right:0;","top:",h,"px;","left:",i,"px;'></div>"),h=this.$getTop(b.end.row,d);var j=Math.round(b.end.column*d.characterWidth);a.push("<div class='",c,"' style='","height:",g,"px;","width:",j,"px;","top:",h,"px;","left:",f,"px;'></div>"),g=(b.end.row-b.start.row-1)*d.lineHeight;if(g<0)return;h=this.$getTop(b.start.row+1,d),a.push("<div class='",c,"' style='","height:",g,"px;","right:0;","top:",h,"px;","left:",f,"px;'></div>")},this.drawSingleLineMarker=function(a,b,c,d,e,f){var g=f==="background"?0:this.$padding,h=d.lineHeight;if(f==="background")var i=d.width;else i=Math.round((b.end.column+(e||0)-b.start.column)*d.characterWidth);var j=this.$getTop(b.start.row,d),k=Math.round(g+b.start.column*d.characterWidth);a.push("<div class='",c,"' style='","height:",h,"px;","width:",i,"px;","top:",j,"px;","left:",k,"px;'></div>")}}).call(f.prototype),b.Marker=f}),define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/lib/event_emitter"],function(a,b,c){var d=a("../lib/oop"),e=a("../lib/dom"),f=a("../lib/lang"),g=a("../lib/useragent"),h=a("../lib/event_emitter").EventEmitter,i=function(a){this.element=e.createElement("div"),this.element.className="ace_layer ace_text-layer",a.appendChild(this.element),this.$characterSize=this.$measureSizes()||{width:0,height:0},this.$pollSizeChanges()};(function(){d.implement(this,h),this.EOF_CHAR="¶",this.EOL_CHAR="¬",this.TAB_CHAR="→",this.SPACE_CHAR="·",this.$padding=0,this.setPadding=function(a){this.$padding=a,this.element.style.padding="0 "+a+"px"},this.getLineHeight=function(){return this.$characterSize.height||1},this.getCharacterWidth=function(){return this.$characterSize.width||1},this.checkForSizeChanges=function(){var a=this.$measureSizes();a&&(this.$characterSize.width!==a.width||this.$characterSize.height!==a.height)&&(this.$characterSize=a,this._emit("changeCharacterSize",{data:a}))},this.$pollSizeChanges=function(){var a=this;this.$pollSizeChangesTimer=setInterval(function(){a.checkForSizeChanges()},500)},this.$fontStyles={fontFamily:1,fontSize:1,fontWeight:1,fontStyle:1,lineHeight:1},this.$measureSizes=g.isIE||g.isOldGecko?function(){var a=1e3;if(!this.$measureNode){var b=this.$measureNode=e.createElement("div"),c=b.style;c.width=c.height="auto",c.left=c.top=-a*40+"px",c.visibility="hidden",c.position="fixed",c.overflow="visible",c.whiteSpace="nowrap",b.innerHTML=f.stringRepeat("Xy",a);if(this.element.ownerDocument.body)this.element.ownerDocument.body.appendChild(b);else{var d=this.element.parentNode;while(!e.hasCssClass(d,"ace_editor"))d=d.parentNode;d.appendChild(b)}}if(!this.element.offsetWidth)return null;var c=this.$measureNode.style,g=e.computedStyle(this.element);for(var h in this.$fontStyles)c[h]=g[h];var i={height:this.$measureNode.offsetHeight,width:this.$measureNode.offsetWidth/(a*2)};return i.width==0||i.height==0?null:i}:function(){if(!this.$measureNode){var a=this.$measureNode=e.createElement("div"),b=a.style;b.width=b.height="auto",b.left=b.top="-100px",b.visibility="hidden",b.position="fixed",b.overflow="visible",b.whiteSpace="nowrap",a.innerHTML="X";var c=this.element.parentNode;while(c&&!e.hasCssClass(c,"ace_editor"))c=c.parentNode;if(!c)return this.$measureNode=null;c.appendChild(a)}var d=this.$measureNode.getBoundingClientRect(),f={height:d.height,width:d.width};return f.width==0||f.height==0?null:f},this.setSession=function(a){this.session=a,this.$computeTabString()},this.showInvisibles=!1,this.setShowInvisibles=function(a){return this.showInvisibles==a?!1:(this.showInvisibles=a,this.$computeTabString(),!0)},this.displayIndentGuides=!0,this.setDisplayIndentGuides=function(a){return this.displayIndentGuides==a?!1:(this.displayIndentGuides=a,this.$computeTabString(),!0)},this.$tabStrings=[],this.onChangeTabSize=this.$computeTabString=function(){var a=this.session.getTabSize();this.tabSize=a;var b=this.$tabStrings=[0];for(var c=1;c<a+1;c++)this.showInvisibles?b.push("<span class='ace_invisible'>"+this.TAB_CHAR+Array(c).join(" ")+"</span>"):b.push((new Array(c+1)).join(" "));if(this.displayIndentGuides){this.$indentGuideRe=/\s\S| \t|\t |\s$/;var d="ace_indent-guide",e=Array(this.tabSize+1).join(" "),f=e;this.showInvisibles&&(d+=" ace_invisible",f=this.TAB_CHAR+e.substr(6)),this.$tabStrings[" "]="<span class='"+d+"'>"+e+"</span>",this.$tabStrings[" "]="<span class='"+d+"'>"+f+"</span>"}},this.updateLines=function(a,b,c){(this.config.lastRow!=a.lastRow||this.config.firstRow!=a.firstRow)&&this.scrollLines(a),this.config=a;var d=Math.max(b,a.firstRow),f=Math.min(c,a.lastRow),g=this.element.childNodes,h=0;for(var i=a.firstRow;i<d;i++){var j=this.session.getFoldLine(i);if(j){if(j.containsRow(d)){d=j.start.row;break}i=j.end.row}h++}var i=d,j=this.session.getNextFoldLine(i),k=j?j.start.row:Infinity;for(;;){i>k&&(i=j.end.row+1,j=this.session.getNextFoldLine(i,j),k=j?j.start.row:Infinity);if(i>f)break;var l=g[h++];if(l){var m=[];this.$renderLine(m,i,!this.$useLineGroups(),i==k?j:!1),e.setInnerHtml(l,m.join(""))}i++}},this.scrollLines=function(a){var b=this.config;this.config=a;if(!b||b.lastRow<a.firstRow)return this.update(a);if(a.lastRow<b.firstRow)return this.update(a);var c=this.element;if(b.firstRow<a.firstRow)for(var d=this.session.getFoldedRowCount(b.firstRow,a.firstRow-1);d>0;d--)c.removeChild(c.firstChild);if(b.lastRow>a.lastRow)for(var d=this.session.getFoldedRowCount(a.lastRow+1,b.lastRow);d>0;d--)c.removeChild(c.lastChild);if(a.firstRow<b.firstRow){var e=this.$renderLinesFragment(a,a.firstRow,b.firstRow-1);c.firstChild?c.insertBefore(e,c.firstChild):c.appendChild(e)}if(a.lastRow>b.lastRow){var e=this.$renderLinesFragment(a,b.lastRow+1,a.lastRow);c.appendChild(e)}},this.$renderLinesFragment=function(a,b,c){var d=this.element.ownerDocument.createDocumentFragment(),f=b,g=this.session.getNextFoldLine(f),h=g?g.start.row:Infinity;for(;;){f>h&&(f=g.end.row+1,g=this.session.getNextFoldLine(f,g),h=g?g.start.row:Infinity);if(f>c)break;var i=e.createElement("div"),j=[];this.$renderLine(j,f,!1,f==h?g:!1),i.innerHTML=j.join("");if(this.$useLineGroups())i.className="ace_line_group",d.appendChild(i);else{var k=i.childNodes;while(k.length)d.appendChild(k[0])}f++}return d},this.update=function(a){this.config=a;var b=[],c=a.firstRow,d=a.lastRow,f=c,g=this.session.getNextFoldLine(f),h=g?g.start.row:Infinity;for(;;){f>h&&(f=g.end.row+1,g=this.session.getNextFoldLine(f,g),h=g?g.start.row:Infinity);if(f>d)break;this.$useLineGroups()&&b.push("<div class='ace_line_group'>"),this.$renderLine(b,f,!1,f==h?g:!1),this.$useLineGroups()&&b.push("</div>"),f++}this.element=e.setInnerHtml(this.element,b.join(""))},this.$textToken={text:!0,rparen:!0,lparen:!0},this.$renderToken=function(a,b,c,d){var e=this,f=/\t|&|<|( +)|([\x00-\x1f\x80-\xa0\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\u3000\uFEFF])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]/g,g=function(a,c,d,f,g){if(c)return(new Array(a.length+1)).join(" ");if(a=="&")return"&";if(a=="<")return"<";if(a==" "){var h=e.session.getScreenTabSize(b+f);return b+=h-1,e.$tabStrings[h]}if(a==" "){var i=e.showInvisibles?"ace_cjk ace_invisible":"ace_cjk",j=e.showInvisibles?e.SPACE_CHAR:"";return b+=1,"<span class='"+i+"' style='width:"+e.config.characterWidth*2+"px'>"+j+"</span>"}return d?"<span class='ace_invisible ace_invalid'>"+e.SPACE_CHAR+"</span>":(b+=1,"<span class='ace_cjk' style='width:"+e.config.characterWidth*2+"px'>"+a+"</span>")},h=d.replace(f,g);if(!this.$textToken[c.type]){var i="ace_"+c.type.replace(/\./g," ace_"),j="";c.type=="fold"&&(j=" style='width:"+c.value.length*this.config.characterWidth+"px;' "),a.push("<span class='",i,"'",j,">",h,"</span>")}else a.push(h);return b+d.length},this.renderIndentGuide=function(a,b){var c=b.search(this.$indentGuideRe);return c<=0?b:b[0]==" "?(c-=c%this.tabSize,a.push(Array(c/this.tabSize+1).join(this.$tabStrings[" "])),b.substr(c)):b[0]==" "?(a.push(Array(c+1).join(this.$tabStrings[" "])),b.substr(c)):b},this.$renderWrappedLine=function(a,b,c,d){var e=0,f=0,g=c[0],h=0;for(var i=0;i<b.length;i++){var j=b[i],k=j.value;if(i==0&&this.displayIndentGuides){e=k.length,k=this.renderIndentGuide(a,k);if(!k)continue;e-=k.length}if(e+k.length<g)h=this.$renderToken(a,h,j,k),e+=k.length;else{while(e+k.length>=g)h=this.$renderToken(a,h,j,k.substring(0,g-e)),k=k.substring(g-e),e=g,d||a.push("</div>","<div class='ace_line' style='height:",this.config.lineHeight,"px'>"),f++,h=0,g=c[f]||Number.MAX_VALUE;k.length!=0&&(e+=k.length,h=this.$renderToken(a,h,j,k))}}},this.$renderSimpleLine=function(a,b){var c=0,d=b[0],e=d.value;this.displayIndentGuides&&(e=this.renderIndentGuide(a,e)),e&&(c=this.$renderToken(a,c,d,e));for(var f=1;f<b.length;f++)d=b[f],e=d.value,c=this.$renderToken(a,c,d,e)},this.$renderLine=function(a,b,c,d){!d&&d!=0&&(d=this.session.getFoldLine(b));if(d)var e=this.$getFoldLineTokens(b,d);else var e=this.session.getTokens(b);c||a.push("<div class='ace_line' style='height:",this.config.lineHeight,"px'>");if(e.length){var f=this.session.getRowSplitData(b);f&&f.length?this.$renderWrappedLine(a,e,f,c):this.$renderSimpleLine(a,e)}this.showInvisibles&&(d&&(b=d.end.row),a.push("<span class='ace_invisible'>",b==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,"</span>")),c||a.push("</div>")},this.$getFoldLineTokens=function(a,b){function e(a,b,c){var e=0,f=0;while(f+a[e].value.length<b){f+=a[e].value.length,e++;if(e==a.length)return}if(f!=b){var g=a[e].value.substring(b-f);g.length>c-b&&(g=g.substring(0,c-b)),d.push({type:a[e].type,value:g}),f=b+g.length,e+=1}while(f<c&&e<a.length){var g=a[e].value;g.length+f>c?d.push({type:a[e].type,value:g.substring(0,c-f)}):d.push(a[e]),f+=g.length,e+=1}}var c=this.session,d=[],f=c.getTokens(a);return b.walk(function(a,b,g,h,i){a?d.push({type:"fold",value:a}):(i&&(f=c.getTokens(b)),f.length&&e(f,h,g))},b.end.row,this.session.getLine(b.end.row).length),d},this.$useLineGroups=function(){return this.session.getUseWrapMode()},this.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$measureNode&&this.$measureNode.parentNode.removeChild(this.$measureNode),delete this.$measureNode}}).call(i.prototype),b.Text=i}),define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(a,b,c){var d=a("../lib/dom"),e=function(a){this.element=d.createElement("div"),this.element.className="ace_layer ace_cursor-layer",a.appendChild(this.element),this.isVisible=!1,this.isBlinking=!0,this.cursors=[],this.cursor=this.addCursor()};(function(){this.$padding=0,this.setPadding=function(a){this.$padding=a},this.setSession=function(a){this.session=a},this.setBlinking=function(a){this.isBlinking=a,a&&this.restartTimer()},this.addCursor=function(){var a=d.createElement("div"),b="ace_cursor";return this.isVisible||(b+=" ace_hidden"),this.overwrite&&(b+=" ace_overwrite"),a.className=b,this.element.appendChild(a),this.cursors.push(a),a},this.removeCursor=function(){if(this.cursors.length>1){var a=this.cursors.pop();return a.parentNode.removeChild(a),a}},this.hideCursor=function(){this.isVisible=!1;for(var a=this.cursors.length;a--;)d.addCssClass(this.cursors[a],"ace_hidden");clearInterval(this.blinkId)},this.showCursor=function(){this.isVisible=!0;for(var a=this.cursors.length;a--;)d.removeCssClass(this.cursors[a],"ace_hidden");this.element.style.visibility="",this.restartTimer()},this.restartTimer=function(){clearInterval(this.blinkId);if(!this.isBlinking)return;if(!this.isVisible)return;var a=this.cursors.length==1?this.cursor:this.element;this.blinkId=setInterval(function(){a.style.visibility="hidden",setTimeout(function(){a.style.visibility=""},400)},1e3)},this.getPixelPosition=function(a,b){if(!this.config||!this.session)return{left:0,top:0};a||(a=this.session.selection.getCursor());var c=this.session.documentToScreenPosition(a),d=Math.round(this.$padding+c.column*this.config.characterWidth),e=(c.row-(b?this.config.firstRowScreen:0))*this.config.lineHeight;return{left:d,top:e}},this.update=function(a){this.config=a;if(this.session.selectionMarkerCount>0){var b=this.session.$selectionMarkers,c=0,d,e=0;for(var c=b.length;c--;){d=b[c];var f=this.getPixelPosition(d.cursor,!0);if((f.top>a.height+a.offset||f.top<-a.offset)&&c>1)continue;var g=(this.cursors[e++]||this.addCursor()).style;g.left=f.left+"px",g.top=f.top+"px",g.width=a.characterWidth+"px",g.height=a.lineHeight+"px"}if(e>1)while(this.cursors.length>e)this.removeCursor()}else{var f=this.getPixelPosition(null,!0),g=this.cursor.style;g.left=f.left+"px",g.top=f.top+"px",g.width=a.characterWidth+"px",g.height=a.lineHeight+"px";while(this.cursors.length>1)this.removeCursor()}var h=this.session.getOverwrite();h!=this.overwrite&&this.$setOverite(h),this.$pixelPos=f,this.restartTimer()},this.$setOverite=function(a){this.overwrite=a;for(var b=this.cursors.length;b--;)a?d.addCssClass(this.cursors[b],"ace_overwrite"):d.removeCssClass(this.cursors[b],"ace_overwrite")},this.destroy=function(){clearInterval(this.blinkId)}}).call(e.prototype),b.Cursor=e}),define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(a,b,c){var d=a("./lib/oop"),e=a("./lib/dom"),f=a("./lib/event"),g=a("./lib/event_emitter").EventEmitter,h=function(a){this.element=e.createElement("div"),this.element.className="ace_sb",this.inner=e.createElement("div"),this.element.appendChild(this.inner),a.appendChild(this.element),this.width=e.scrollbarWidth(a.ownerDocument),this.element.style.width=(this.width||15)+5+"px",f.addListener(this.element,"scroll",this.onScroll.bind(this))};(function(){d.implement(this,g),this.onScroll=function(){this._emit("scroll",{data:this.element.scrollTop})},this.getWidth=function(){return this.width},this.setHeight=function(a){this.element.style.height=a+"px"},this.setInnerHeight=function(a){this.inner.style.height=a+"px"},this.setScrollTop=function(a){this.element.scrollTop=a}}).call(h.prototype),b.ScrollBar=h}),define("ace/renderloop",["require","exports","module","ace/lib/event"],function(a,b,c){var d=a("./lib/event"),e=function(a,b){this.onRender=a,this.pending=!1,this.changes=0,this.window=b||window};(function(){this.schedule=function(a){this.changes=this.changes|a;if(!this.pending){this.pending=!0;var b=this;d.nextTick(function(){b.pending=!1;var a;while(a=b.changes)b.changes=0,b.onRender(a)},this.window)}}}).call(e.prototype),b.RenderLoop=e}),define("text!ace/css/editor.css",[],".ace_editor {\n position: absolute;\n overflow: hidden;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Droid Sans Mono', 'Consolas', monospace;\n font-size: 12px;\n}\n\n.ace_scroller {\n position: absolute;\n overflow: hidden;\n}\n\n.ace_content {\n position: absolute;\n box-sizing: border-box;\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n cursor: text;\n}\n\n.ace_gutter {\n position: absolute;\n overflow : hidden;\n height: 100%;\n width: auto;\n cursor: default;\n z-index: 4;\n}\n\n.ace_gutter_active_line {\n position: absolute;\n left: 0;\n right: 0;\n}\n\n.ace_scroller.horscroll {\n box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;\n}\n\n.ace_gutter-cell {\n padding-left: 19px;\n padding-right: 6px;\n background-repeat: no-repeat;\n}\n\n.ace_gutter-cell.ace_error {\n background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUM2OEZDQTQ4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUM2OEZDQTU4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQzY4RkNBMjhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQzY4RkNBMzhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PkgXxbAAAAJbSURBVHjapFNNaBNBFH4zs5vdZLP5sQmNpT82QY209heh1ioWisaDRcSKF0WKJ0GQnrzrxasHsR6EnlrwD0TagxJabaVEpFYxLWlLSS822tr87m66ccfd2GKyVhA6MMybgfe97/vmPUQphd0sZjto9XIn9OOsvlu2nkqRzVU+6vvlzPf8W6bk8dxQ0NPbxAALgCgg2JkaQuhzQau/El0zbmUA7U0Es8v2CiYmKQJHGO1QICCLoqilMhkmurDAyapKgqItezi/USRdJqEYY4D5jCy03ht2yMkkvL91jTTX10qzyyu2hruPRN7jgbH+EOsXcMLgYiThEgAMhABW85oqy1DXdRIdvP1AHJ2acQXvDIrVHcdQNrEKNYSVMSZGMjEzIIAwDXIo+6G/FxcGnzkC3T2oMhLjre49sBB+RRcHLqdafK6sYdE/GGBwU1VpFNj0aN8pJbe+BkZyevUrvLl6Xmm0W9IuTc0DxrDNAJd5oEvI/KRsNC3bQyNjPO9yQ1YHcfj2QvfQc/5TUhJTBc2iM0U7AWDQtc1nJHvD/cfO2s7jaGkiTEfa/Ep8coLu7zmNmh8+dc5lZDuUeFAGUNA/OY6JVaypQ0vjr7XYjUvJM37vt+j1vuTK5DgVfVUoTjVe+y3/LxMxY2GgU+CSLy4cpfsYorRXuXIOi0Vt40h67uZFTdIo6nLaZcwUJWAzwNS0tBnqqKzQDnjdG/iPyZxo46HaKUpbvYkj8qYRTZsBhge+JHhZyh0x9b95JqjVJkT084kZIPwu/mPWqPgfQ5jXh2+92Ay7HedfAgwA6KDWafb4w3cAAAAASUVORK5CYII=\");\n background-repeat: no-repeat;\n background-position: 2px center;\n}\n\n.ace_gutter-cell.ace_warning {\n background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUM2OEZDQTg4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUM2OEZDQTk4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQzY4RkNBNjhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQzY4RkNBNzhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pgd7PfIAAAGmSURBVHjaYvr//z8DJZiJgUIANoCRkREb9gLiSVAaQx4OQM7AAkwd7XU2/v++/rOttdYGEB9dASEvOMydGKfH8Gv/p4XTkvRBfLxeQAP+1cUhXopyvzhP7P/IoSj7g7Mw09cNKO6J1QQ0L4gICPIv/veg/8W+JdFvQNLHVsW9/nmn9zk7B+cCkDwhL7gt6knSZnx9/LuCEOcvkIAMP+cvto9nfqyZmmUAksfnBUtbM60gX/3/kgyv3/xSFOL5DZT+L8vP+Yfh5cvfPvp/xUHyQHXGyAYwgpwBjZYFT3Y1OEl/OfCH4ffv3wzc4iwMvNIsDJ+f/mH4+vIPAxsb631WW0Yln6ZpQLXdMK/DXGDflh+sIv37EivD5x//Gb7+YWT4y86sl7BCCkSD+Z++/1dkvsFRl+HnD1Rvje4F8whjMXmGj58YGf5zsDMwcnAwfPvKcml62DsQDeaDxN+/Y0qwlpEHqrdB94IRNIDUgfgfKJChGK4OikEW3gTiXUB950ASLFAF54AC94A0G9QAfOnmF9DCDzABFqS08IHYDIScdijOjQABBgC+/9awBH96jwAAAABJRU5ErkJggg==\");\n background-position: 2px center;\n}\n\n.ace_gutter-cell.ace_info {\n background-image: url(\"data:image/gif;base64,R0lGODlhEAAQAMQAAAAAAEFBQVJSUl5eXmRkZGtra39/f4WFhYmJiZGRkaampry8vMPDw8zMzNXV1dzc3OTk5Orq6vDw8P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABQALAAAAAAQABAAAAUuICWOZGmeaBml5XGwFCQSBGyXRSAwtqQIiRuiwIM5BoYVbEFIyGCQoeJGrVptIQA7\");\n background-position: 2px center;\n}\n.ace_dark .ace_gutter-cell.ace_info {\n background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpGRTk5MTVGREIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpGRTk5MTVGRUIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkZFOTkxNUZCQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkZFOTkxNUZDQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+SIDkjAAAAJ1JREFUeNpi/P//PwMlgImBQkB7A6qrq/+DMC55FkIGKCoq4pVnpFkgTp069f/+/fv/r1u37r+tre1/kg0A+ptn9uzZYLaRkRHpLvjw4cNXWVlZhufPnzOcO3eOdAO0tbVPAjHDmzdvGA4fPsxIsgGSkpJmv379Ynj37h2DjIyMCMkG3LhxQ/T27dsMampqDHZ2dq/pH41DxwCAAAMAFdc68dUsFZgAAAAASUVORK5CYII=\");\n}\n\n.ace_editor .ace_sb {\n position: absolute;\n overflow-x: hidden;\n overflow-y: scroll;\n right: 0;\n}\n\n.ace_editor .ace_sb div {\n position: absolute;\n width: 1px;\n left: 0;\n}\n\n.ace_editor .ace_print_margin_layer {\n z-index: 0;\n position: absolute;\n overflow: hidden;\n margin: 0;\n left: 0;\n height: 100%;\n width: 100%;\n}\n\n.ace_editor .ace_print_margin {\n position: absolute;\n height: 100%;\n}\n\n.ace_editor > textarea {\n position: absolute;\n z-index: 0;\n width: 0.5em;\n height: 1em;\n opacity: 0;\n background: transparent;\n appearance: none;\n -moz-appearance: none;\n border: none;\n resize: none;\n outline: none;\n overflow: hidden;\n}\n\n.ace_editor > textarea.ace_composition {\n background: #fff;\n color: #000;\n z-index: 1000;\n opacity: 1;\n border: solid lightgray 1px;\n margin: -1px\n}\n\n.ace_layer {\n z-index: 1;\n position: absolute;\n overflow: hidden;\n white-space: nowrap;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n /* setting pointer-events: auto; on node under the mouse, which changes\n during scroll, will break mouse wheel scrolling in Safari */\n pointer-events: none;\n}\n\n.ace_gutter .ace_layer {\n position: relative;\n width: auto;\n text-align: right;\n pointer-events: auto;\n}\n\n.ace_text-layer {\n color: black;\n font: inherit !important;\n}\n\n.ace_cjk {\n display: inline-block;\n text-align: center;\n}\n\n.ace_cursor-layer {\n z-index: 4;\n}\n\n.ace_cursor {\n z-index: 4;\n position: absolute;\n}\n\n.ace_cursor.ace_hidden {\n opacity: 0.2;\n}\n\n.ace_editor.multiselect .ace_cursor {\n border-left-width: 1px;\n}\n\n.ace_line {\n white-space: nowrap;\n}\n\n.ace_marker-layer .ace_step {\n position: absolute;\n z-index: 3;\n}\n\n.ace_marker-layer .ace_selection {\n position: absolute;\n z-index: 5;\n}\n\n.ace_marker-layer .ace_bracket {\n position: absolute;\n z-index: 6;\n}\n\n.ace_marker-layer .ace_active_line {\n position: absolute;\n z-index: 2;\n}\n\n.ace_marker-layer .ace_selected_word {\n position: absolute;\n z-index: 4;\n box-sizing: border-box;\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n}\n\n.ace_line .ace_fold {\n box-sizing: border-box;\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n\n display: inline-block;\n height: 11px;\n margin-top: -2px;\n vertical-align: middle;\n\n background-image:\n url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%11%00%00%00%09%08%06%00%00%00%D4%E8%C7%0C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%B5IDAT(%15%A5%91%3D%0E%02!%10%85ac%E1%05%D6%CE%D6%C6%CE%D2%E8%ED%CD%DE%C0%C6%D6N.%E0V%F8%3D%9Ca%891XH%C2%BE%D9y%3F%90!%E6%9C%C3%BFk%E5%011%C6-%F5%C8N%04%DF%BD%FF%89%DFt%83DN%60%3E%F3%AB%A0%DE%1A%5Dg%BE%10Q%97%1B%40%9C%A8o%10%8F%5E%828%B4%1B%60%87%F6%02%26%85%1Ch%1E%C1%2B%5Bk%FF%86%EE%B7j%09%9A%DA%9B%ACe%A3%F9%EC%DA!9%B4%D5%A6%81%86%86%98%CC%3C%5B%40%FA%81%B3%E9%CB%23%94%C16Azo%05%D4%E1%C1%95a%3B%8A'%A0%E8%CC%17%22%85%1D%BA%00%A2%FA%DC%0A%94%D1%D1%8D%8B%3A%84%17B%C7%60%1A%25Z%FC%8D%00%00%00%00IEND%AEB%60%82\"),\n url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%007%08%06%00%00%00%C4%DD%80C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%3AIDAT8%11c%FC%FF%FF%7F%18%03%1A%60%01%F2%3F%A0%891%80%04%FF%11-%F8%17%9BJ%E2%05%B1ZD%81v%26t%E7%80%F8%A3%82h%A12%1A%20%A3%01%02%0F%01%BA%25%06%00%19%C0%0D%AEF%D5%3ES%00%00%00%00IEND%AEB%60%82\");\n background-repeat: no-repeat, repeat-x;\n background-position: center center, top left;\n color: transparent;\n\n border: 1px solid black;\n -moz-border-radius: 2px;\n -webkit-border-radius: 2px;\n border-radius: 2px;\n\n cursor: pointer;\n pointer-events: auto;\n}\n\n.ace_dark .ace_fold {\n}\n\n.ace_fold:hover{\n background-image:\n url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%11%00%00%00%09%08%06%00%00%00%D4%E8%C7%0C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%B5IDAT(%15%A5%91%3D%0E%02!%10%85ac%E1%05%D6%CE%D6%C6%CE%D2%E8%ED%CD%DE%C0%C6%D6N.%E0V%F8%3D%9Ca%891XH%C2%BE%D9y%3F%90!%E6%9C%C3%BFk%E5%011%C6-%F5%C8N%04%DF%BD%FF%89%DFt%83DN%60%3E%F3%AB%A0%DE%1A%5Dg%BE%10Q%97%1B%40%9C%A8o%10%8F%5E%828%B4%1B%60%87%F6%02%26%85%1Ch%1E%C1%2B%5Bk%FF%86%EE%B7j%09%9A%DA%9B%ACe%A3%F9%EC%DA!9%B4%D5%A6%81%86%86%98%CC%3C%5B%40%FA%81%B3%E9%CB%23%94%C16Azo%05%D4%E1%C1%95a%3B%8A'%A0%E8%CC%17%22%85%1D%BA%00%A2%FA%DC%0A%94%D1%D1%8D%8B%3A%84%17B%C7%60%1A%25Z%FC%8D%00%00%00%00IEND%AEB%60%82\"),\n url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%007%08%06%00%00%00%C4%DD%80C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%003IDAT8%11c%FC%FF%FF%7F%3E%03%1A%60%01%F2%3F%A3%891%80%04%FFQ%26%F8w%C0%B43%A1%DB%0C%E2%8F%0A%A2%85%CAh%80%8C%06%08%3C%04%E8%96%18%00%A3S%0D%CD%CF%D8%C1%9D%00%00%00%00IEND%AEB%60%82\");\n background-repeat: no-repeat, repeat-x;\n background-position: center center, top left;\n}\n\n.ace_dragging .ace_content {\n cursor: move;\n}\n\n.ace_gutter_tooltip {\n background-color: #FFFFD5;\n border: 1px solid gray;\n box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);\n color: black;\n display: inline-block;\n padding: 4px;\n position: absolute;\n z-index: 300;\n box-sizing: border-box;\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n cursor: default;\n}\n\n.ace_folding-enabled > .ace_gutter-cell {\n padding-right: 13px;\n}\n\n.ace_fold-widget {\n box-sizing: border-box;\n -moz-box-sizing: border-box;\n -webkit-box-sizing: border-box;\n\n margin: 0 -12px 0 1px;\n display: inline-block;\n width: 11px;\n vertical-align: top;\n\n background-image: url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAe%8A%B1%0D%000%0C%C2%F2%2CK%96%BC%D0%8F9%81%88H%E9%D0%0E%96%C0%10%92%3E%02%80%5E%82%E4%A9*-%EEsw%C8%CC%11%EE%96w%D8%DC%E9*Eh%0C%151(%00%00%00%00IEND%AEB%60%82\");\n background-repeat: no-repeat;\n background-position: center;\n\n border-radius: 3px;\n \n border: 1px solid transparent;\n}\n\n.ace_fold-widget.end {\n background-image: url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAm%C7%C1%09%000%08C%D1%8C%ECE%C8E(%8E%EC%02)%1EZJ%F1%C1'%04%07I%E1%E5%EE%CAL%F5%A2%99%99%22%E2%D6%1FU%B5%FE0%D9x%A7%26Wz5%0E%D5%00%00%00%00IEND%AEB%60%82\");\n}\n\n.ace_fold-widget.closed {\n background-image: url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%03%00%00%00%06%08%06%00%00%00%06%E5%24%0C%00%00%009IDATx%DA5%CA%C1%09%000%08%03%C0%AC*(%3E%04%C1%0D%BA%B1%23%A4Uh%E0%20%81%C0%CC%F8%82%81%AA%A2%AArGfr%88%08%11%11%1C%DD%7D%E0%EE%5B%F6%F6%CB%B8%05Q%2F%E9tai%D9%00%00%00%00IEND%AEB%60%82\");\n}\n\n.ace_fold-widget:hover {\n border: 1px solid rgba(0, 0, 0, 0.3);\n background-color: rgba(255, 255, 255, 0.2);\n -moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\n -webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\n}\n\n.ace_fold-widget:active {\n border: 1px solid rgba(0, 0, 0, 0.4);\n background-color: rgba(0, 0, 0, 0.05);\n -moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\n -webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\n}\n/**\n * Dark version for fold widgets\n */\n.ace_dark .ace_fold-widget {\n background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC\");\n}\n.ace_dark .ace_fold-widget.end {\n background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==\");\n}\n.ace_dark .ace_fold-widget.closed {\n background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==\");\n}\n.ace_dark .ace_fold-widget:hover {\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\n background-color: rgba(255, 255, 255, 0.1);\n}\n.ace_dark .ace_fold-widget:active {\n -moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\n -webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\n}\n \n \n \n.ace_fold-widget.invalid {\n background-color: #FFB4B4;\n border-color: #DE5555;\n}\n\n.ace_fade-fold-widgets .ace_fold-widget {\n -moz-transition: opacity 0.4s ease 0.05s;\n -webkit-transition: opacity 0.4s ease 0.05s;\n -o-transition: opacity 0.4s ease 0.05s;\n -ms-transition: opacity 0.4s ease 0.05s;\n transition: opacity 0.4s ease 0.05s;\n opacity: 0;\n}\n\n.ace_fade-fold-widgets:hover .ace_fold-widget {\n -moz-transition: opacity 0.05s ease 0.05s;\n -webkit-transition: opacity 0.05s ease 0.05s;\n -o-transition: opacity 0.05s ease 0.05s;\n -ms-transition: opacity 0.05s ease 0.05s;\n transition: opacity 0.05s ease 0.05s;\n opacity:1;\n}\n\n.ace_underline {\n text-decoration: underline;\n}\n\n.ace_bold {\n font-weight: bold;\n}\n\n.ace_italic {\n font-style: italic;\n}\n"),define("ace/multi_select",["require","exports","module","ace/range_list","ace/range","ace/selection","ace/mouse/multi_select_handler","ace/lib/event","ace/lib/lang","ace/commands/multi_select_commands","ace/search","ace/edit_session","ace/editor"],function(a,b,c){function m(a,b,c){return l.$options.wrap=!0,l.$options.needle=b,l.$options.backwards=c==-1,l.find(a)}function p(a,b){return a.row==b.row&&a.column==b.column}function q(a){a.$onAddRange=a.$onAddRange.bind(a),a.$onRemoveRange=a.$onRemoveRange.bind(a),a.$onMultiSelect=a.$onMultiSelect.bind(a),a.$onSingleSelect=a.$onSingleSelect.bind(a),b.onSessionChange.call(a,a),a.on("changeSession",b.onSessionChange.bind(a)),a.on("mousedown",g),a.commands.addCommands(j.defaultCommands),r(a)}function r(a){function e(){c&&(d.style.cursor="",c=!1)}var b=a.textInput.getElement(),c=!1,d=a.renderer.content;h.addListener(b,"keydown",function(a){a.keyCode==18&&!(a.ctrlKey||a.shiftKey||a.metaKey)?c||(d.style.cursor="crosshair",c=!0):c&&(d.style.cursor="")}),h.addListener(b,"keyup",e),h.addListener(b,"blur",e)}var d=a("./range_list").RangeList,e=a("./range").Range,f=a("./selection").Selection,g=a("./mouse/multi_select_handler").onMouseDown,h=a("./lib/event"),i=a("./lib/lang"),j=a("./commands/multi_select_commands");b.commands=j.defaultCommands.concat(j.multiSelectCommands);var k=a("./search").Search,l=new k,n=a("./edit_session").EditSession;(function(){this.getSelectionMarkers=function(){return this.$selectionMarkers}}).call(n.prototype),function(){this.ranges=null,this.rangeList=null,this.addRange=function(a,b){if(!a)return;if(!this.inMultiSelectMode&&this.rangeCount==0){var c=this.toOrientedRange();if(a.intersects(c))return b||this.fromOrientedRange(a);this.rangeList.add(c),this.$onAddRange(c)}a.cursor||(a.cursor=a.end);var d=this.rangeList.add(a);return this.$onAddRange(a),d.length&&this.$onRemoveRange(d),this.rangeCount>1&&!this.inMultiSelectMode&&(this._emit("multiSelect"),this.inMultiSelectMode=!0,this.session.$undoSelect=!1,this.rangeList.attach(this.session)),b||this.fromOrientedRange(a)},this.toSingleRange=function(a){a=a||this.ranges[0];var b=this.rangeList.removeAll();b.length&&this.$onRemoveRange(b),a&&this.fromOrientedRange(a)},this.substractPoint=function(a){var b=this.rangeList.substractPoint(a);if(b)return this.$onRemoveRange(b),b[0]},this.mergeOverlappingRanges=function(){var a=this.rangeList.merge();a.length?this.$onRemoveRange(a):this.ranges[0]&&this.fromOrientedRange(this.ranges[0])},this.$onAddRange=function(a){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(a),this._emit("addRange",{range:a})},this.$onRemoveRange=function(a){this.rangeCount=this.rangeList.ranges.length;if(this.rangeCount==1&&this.inMultiSelectMode){var b=this.rangeList.ranges.pop();a.push(b),this.rangeCount=0}for(var c=a.length;c--;){var d=this.ranges.indexOf(a[c]);this.ranges.splice(d,1)}this._emit("removeRange",{ranges:a}),this.rangeCount==0&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._emit("singleSelect"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),b=b||this.ranges[0],b&&!b.isEqual(this.getRange())&&this.fromOrientedRange(b)},this.$initRangeList=function(){if(this.rangeList)return;this.rangeList=new d,this.ranges=[],this.rangeCount=0},this.getAllRanges=function(){return this.rangeList.ranges.concat()},this.splitIntoLines=function(){if(this.rangeCount>1){var a=this.rangeList.ranges,b=a[a.length-1],c=e.fromPoints(a[0].start,b.end);this.toSingleRange(),this.setSelectionRange(c,b.cursor==b.start)}else{var c=this.getRange(),d=this.isBackwards(),f=c.start.row,g=c.end.row;if(f==g){if(d)var h=c.end,i=c.start;else var h=c.start,i=c.end;this.addRange(e.fromPoints(i,i)),this.addRange(e.fromPoints(h,h));return}var j=[],k=this.getLineRange(f,!0);k.start.column=c.start.column,j.push(k);for(var l=f+1;l<g;l++)j.push(this.getLineRange(l,!0));k=this.getLineRange(g,!0),k.end.column=c.end.column,j.push(k),j.forEach(this.addRange,this)}},this.toggleBlockSelection=function(){if(this.rangeCount>1){var a=this.rangeList.ranges,b=a[a.length-1],c=e.fromPoints(a[0].start,b.end);this.toSingleRange(),this.setSelectionRange(c,b.cursor==b.start)}else{var d=this.session.documentToScreenPosition(this.selectionLead),f=this.session.documentToScreenPosition(this.selectionAnchor),g=this.rectangularRangeBlock(d,f);g.forEach(this.addRange,this)}},this.rectangularRangeBlock=function(a,b,c){var d=[],f=a.column<b.column;if(f)var g=a.column,h=b.column;else var g=b.column,h=a.column;var i=a.row<b.row;if(i)var j=a.row,k=b.row;else var j=b.row,k=a.row;g<0&&(g=0),j<0&&(j=0),j==k&&(c=!0);for(var l=j;l<=k;l++){var m=e.fromPoints(this.session.screenToDocumentPosition(l,g),this.session.screenToDocumentPosition(l,h));if(m.isEmpty()){if(n&&p(m.end,n))break;var n=m.end}m.cursor=f?m.start:m.end,d.push(m)}i&&d.reverse();if(!c){var o=d.length-1;while(d[o].isEmpty()&&o>0)o--;if(o>0){var q=0;while(d[q].isEmpty())q++}for(var r=o;r>=q;r--)d[r].isEmpty()&&d.splice(r,1)}return d}}.call(f.prototype);var o=a("./editor").Editor;(function(){this.updateSelectionMarkers=function(){this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.addSelectionMarker=function(a){a.cursor||(a.cursor=a.end);var b=this.getSelectionStyle();return a.marker=this.session.addMarker(a,"ace_selection",b),this.session.$selectionMarkers.push(a),this.session.selectionMarkerCount=this.session.$selectionMarkers.length,a},this.removeSelectionMarker=function(a){if(!a.marker)return;this.session.removeMarker(a.marker);var b=this.session.$selectionMarkers.indexOf(a);b!=-1&&this.session.$selectionMarkers.splice(b,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length},this.removeSelectionMarkers=function(a){var b=this.session.$selectionMarkers;for(var c=a.length;c--;){var d=a[c];if(!d.marker)continue;this.session.removeMarker(d.marker);var e=b.indexOf(d);e!=-1&&b.splice(e,1)}this.session.selectionMarkerCount=b.length},this.$onAddRange=function(a){this.addSelectionMarker(a.range),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onRemoveRange=function(a){this.removeSelectionMarkers(a.ranges),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelect=function(a){if(this.inMultiSelectMode)return;this.inMultiSelectMode=!0,this.setStyle("multiselect"),this.keyBinding.addKeyboardHandler(j.keyboardHandler),this.commands.on("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onSingleSelect=function(a){if(this.session.multiSelect.inVirtualMode)return;this.inMultiSelectMode=!1,this.unsetStyle("multiselect"),this.keyBinding.removeKeyboardHandler(j.keyboardHandler),this.commands.removeEventListener("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelectExec=function(a){var b=a.command,c=a.editor;if(!c.multiSelect)return;b.multiSelectAction?b.multiSelectAction=="forEach"?c.forEachSelection(b,a.args):b.multiSelectAction=="single"?(c.exitMultiSelectMode(),b.exec(c,a.args||{})):b.multiSelectAction(c,a.args||{}):(b.exec(c,a.args||{}),c.multiSelect.addRange(c.multiSelect.toOrientedRange()),c.multiSelect.mergeOverlappingRanges()),a.preventDefault()},this.forEachSelection=function(a,b){if(this.inVirtualSelectionMode)return;var c=this.session,d=this.selection,e=d.rangeList,g=d._eventRegistry;d._eventRegistry={};var h=new f(c);this.inVirtualSelectionMode=!0;for(var i=e.ranges.length;i--;)h.fromOrientedRange(e.ranges[i]),this.selection=c.selection=h,a.exec(this,b||{}),h.toOrientedRange(e.ranges[i]);h.detach(),this.selection=c.selection=d,this.inVirtualSelectionMode=!1,d._eventRegistry=g,d.mergeOverlappingRanges(),this.onCursorChange(),this.onSelectionChange()},this.exitMultiSelectMode=function(){if(this.inVirtualSelectionMode)return;this.multiSelect.toSingleRange()},this.getCopyText=function(){var a="";if(this.inMultiSelectMode){var b=this.multiSelect.rangeList.ranges;a=[];for(var c=0;c<b.length;c++)a.push(this.session.getTextRange(b[c]));a=a.join(this.session.getDocument().getNewLineCharacter())}else this.selection.isEmpty()||(a=this.session.getTextRange(this.getSelectionRange()));return a},this.onPaste=function(a){if(this.$readOnly)return;this._emit("paste",a);if(!this.inMultiSelectMode)return this.insert(a);var b=a.split(/\r\n|\r|\n/),c=this.selection.rangeList.ranges;if(b.length>c.length||b.length<=2||!b[1])return this.commands.exec("insertstring",this,a);for(var d=c.length;d--;){var e=c[d];e.isEmpty()||this.session.remove(e),this.session.insert(e.start,b[d])}},this.findAll=function(a,b,c){b=b||{},b.needle=a||b.needle,this.$search.set(b);var d=this.$search.findAll(this.session);if(!d.length)return 0;this.$blockScrolling+=1;var e=this.multiSelect;c||e.toSingleRange(d[0]);for(var f=d.length;f--;)e.addRange(d[f],!0);return this.$blockScrolling-=1,d.length},this.selectMoreLines=function(a,b){var c=this.selection.toOrientedRange(),d=c.cursor==c.end,f=this.session.documentToScreenPosition(c.cursor);this.selection.$desiredColumn&&(f.column=this.selection.$desiredColumn);var g=this.session.screenToDocumentPosition(f.row+a,f.column);if(!c.isEmpty())var h=this.session.documentToScreenPosition(d?c.end:c.start),i=this.session.screenToDocumentPosition(h.row+a,h.column);else var i=g;if(d){var j=e.fromPoints(g,i);j.cursor=j.start}else{var j=e.fromPoints(i,g);j.cursor=j.end}j.desiredColumn=f.column;if(!this.selection.inMultiSelectMode)this.selection.addRange(c);else if(b)var k=c.cursor;this.selection.addRange(j),k&&this.selection.substractPoint(k)},this.transposeSelections=function(a){var b=this.session,c=b.multiSelect,d=c.ranges;for(var e=d.length;e--;){var f=d[e];if(f.isEmpty()){var g=b.getWordRange(f.start.row,f.start.column);f.start.row=g.start.row,f.start.column=g.start.column,f.end.row=g.end.row,f.end.column=g.end.column}}c.mergeOverlappingRanges();var h=[];for(var e=d.length;e--;){var f=d[e];h.unshift(b.getTextRange(f))}a<0?h.unshift(h.pop()):h.push(h.shift());for(var e=d.length;e--;){var f=d[e],g=f.clone();b.replace(f,h[e]),f.start.row=g.start.row,f.start.column=g.start.column}},this.selectMore=function(a,b){var c=this.session,d=c.multiSelect,e=d.toOrientedRange();if(e.isEmpty()){var e=c.getWordRange(e.start.row,e.start.column);e.cursor=e.end,this.multiSelect.addRange(e)}var f=c.getTextRange(e),g=m(c,f,a);g&&(g.cursor=a==-1?g.start:g.end,this.multiSelect.addRange(g)),b&&this.multiSelect.substractPoint(e.cursor)},this.alignCursors=function(){var a=this.session,b=a.multiSelect,c=b.ranges;if(!c.length){var d=this.selection.getRange(),f=d.start.row,g=d.end.row,h=this.session.doc.removeLines(f,g);h=this.$reAlignText(h),this.session.doc.insertLines(f,h),d.start.column=0,d.end.column=h[h.length-1].length,this.selection.setRange(d)}else{var j=-1,k=c.filter(function(a){if(a.cursor.row==j)return!0;j=a.cursor.row});b.$onRemoveRange(k);var l=0,m=Infinity,n=c.map(function(b){var c=b.cursor,d=a.getLine(c.row),e=d.substr(c.column).search(/\S/g);return e==-1&&(e=0),c.column>l&&(l=c.column),e<m&&(m=e),e});c.forEach(function(b,c){var d=b.cursor,f=l-d.column,g=n[c]-m;f>g?a.insert(d,i.stringRepeat(" ",f-g)):a.remove(new e(d.row,d.column,d.row,d.column-f+g)),b.start.column=b.end.column=l,b.start.row=b.end.row=d.row,b.cursor=b.end}),b.fromOrientedRange(c[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}},this.$reAlignText=function(a){function g(a,b){return Array(a+1).join(b)}function h(a){return a[2]?g(d," ")+a[2]+g(e-a[2].length+f," ")+a[4].replace(/^([=:])\s+/,"$1 "):a[0]}function i(a){return a[2]?g(d+e-a[2].length," ")+a[2]+g(f," ")+a[4].replace(/^([=:])\s+/,"$1 "):a[0]}function j(a){return a[2]?g(d," ")+a[2]+g(f," ")+a[4].replace(/^([=:])\s+/,"$1 "):a[0]}var b=!0,c=!0,d,e,f;return a.map(function(a){var g=a.match(/(\s*)(.*?)(\s*)([=:].*)/);return g?d==null?(d=g[1].length,e=g[2].length,f=g[3].length,g):(d+e+f!=g[1].length+g[2].length+g[3].length&&(c=!1),d!=g[1].length&&(b=!1),d>g[1].length&&(d=g[1].length),e<g[2].length&&(e=g[2].length),f>g[3].length&&(f=g[3].length),g):[a]}).map(b?c?i:h:j)}}).call(o.prototype),b.onSessionChange=function(a){var b=a.session;b.multiSelect||(b.$selectionMarkers=[],b.selection.$initRangeList(),b.multiSelect=b.selection),this.multiSelect=b.multiSelect;var c=a.oldSession;c&&(c.multiSelect&&c.multiSelect.editor==this&&(c.multiSelect.editor=null),b.multiSelect.removeEventListener("addRange",this.$onAddRange),b.multiSelect.removeEventListener("removeRange",this.$onRemoveRange),b.multiSelect.removeEventListener("multiSelect",this.$onMultiSelect),b.multiSelect.removeEventListener("singleSelect",this.$onSingleSelect)),b.multiSelect.on("addRange",this.$onAddRange),b.multiSelect.on("removeRange",this.$onRemoveRange),b.multiSelect.on("multiSelect",this.$onMultiSelect),b.multiSelect.on("singleSelect",this.$onSingleSelect),this.inMultiSelectMode!=b.selection.inMultiSelectMode&&(b.selection.inMultiSelectMode?this.$onMultiSelect():this.$onSingleSelect())},b.MultiSelect=q}),define("ace/range_list",["require","exports","module"],function(a,b,c){var d=function(){this.ranges=[]};(function(){this.comparePoints=function(a,b){return a.row-b.row||a.column-b.column},this.pointIndex=function(a,b){var c=this.ranges;for(var d=b||0;d<c.length;d++){var e=c[d],f=this.comparePoints(a,e.end);if(f>0)continue;return f==0?d:(f=this.comparePoints(a,e.start),f>=0?d:-d-1)}return-d-1},this.add=function(a){var b=this.pointIndex(a.start);b<0&&(b=-b-1);var c=this.pointIndex(a.end,b);return c<0?c=-c-1:c++,this.ranges.splice(b,c-b,a)},this.addList=function(a){var b=[];for(var c=a.length;c--;)b.push.call(b,this.add(a[c]));return b},this.substractPoint=function(a){var b=this.pointIndex(a);if(b>=0)return this.ranges.splice(b,1)},this.merge=function(){var a=[],b=this.ranges,c=b[0],d;for(var e=1;e<b.length;e++){d=c,c=b[e];var f=this.comparePoints(d.end,c.start);if(f<0)continue;if(f==0&&!d.isEmpty()&&!c.isEmpty())continue;this.comparePoints(d.end,c.end)<0&&(d.end.row=c.end.row,d.end.column=c.end.column),b.splice(e,1),a.push(c),c=d,e--}return a},this.contains=function(a,b){return this.pointIndex({row:a,column:b})>=0},this.containsPoint=function(a){return this.pointIndex(a)>=0},this.rangeAtPoint=function(a){var b=this.pointIndex(a);if(b>=0)return this.ranges[b]},this.clipRows=function(a,b){var c=this.ranges;if(c[0].start.row>b||c[c.length-1].start.row<a)return[];var d=this.pointIndex({row:a,column:0});d<0&&(d=-d-1);var e=this.pointIndex({row:b,column:0},d);e<0&&(e=-e-1);var f=[];for(var g=d;g<e;g++)f.push(c[g]);return f},this.removeAll=function(){return this.ranges.splice(0,this.ranges.length)},this.attach=function(a){this.session&&this.detach(),this.session=a,this.onChange=this.$onChange.bind(this),this.session.on("change",this.onChange)},this.detach=function(){if(!this.session)return;this.session.removeListener("change",this.onChange),this.session=null},this.$onChange=function(a){var b=a.data.range;if(a.data.action[0]=="i")var c=b.start,d=b.end;else var d=b.start,c=b.end;var e=c.row,f=d.row,g=f-e,h=-c.column+d.column,i=this.ranges;for(var j=0,k=i.length;j<k;j++){var l=i[j];if(l.end.row<e)continue;if(l.start.row>e)break;l.start.row==e&&l.start.column>=c.column&&(l.start.column+=h,l.start.row+=g),l.end.row==e&&l.end.column>=c.column&&(l.end.column+=h,l.end.row+=g)}if(g!=0&&j<k)for(;j<k;j++){var l=i[j];l.start.row+=g,l.end.row+=g}}}).call(d.prototype),b.RangeList=d}),define("ace/mouse/multi_select_handler",["require","exports","module","ace/lib/event"],function(a,b,c){function e(a,b){return a.row==b.row&&a.column==b.column}function f(a){var b=a.domEvent,c=b.altKey,f=b.shiftKey,g=a.getAccelKey(),h=a.getButton();if(a.editor.inMultiSelectMode&&h==2){a.editor.textInput.onContextMenu(a.domEvent);return}if(!g&&!c){h==0&&a.editor.inMultiSelectMode&&a.editor.exitMultiSelectMode();return}var i=a.editor,j=i.selection,k=i.inMultiSelectMode,l=a.getDocumentPosition(),m=j.getCursor(),n=a.inSelection()||j.isEmpty()&&e(l,m),o=a.x,p=a.y,q=function(a){o=a.clientX,p=a.clientY},r=function(){var a=i.renderer.pixelToScreenCoordinates(o,p),b=s.screenToDocumentPosition(a.row,a.column);if(e(u,a)&&e(b,j.selectionLead))return;u=a,i.selection.moveCursorToPosition(b),i.selection.clearSelection(),i.renderer.scrollCursorIntoView(),i.removeSelectionMarkers(x),x=j.rectangularRangeBlock(u,t),x.forEach(i.addSelectionMarker,i),i.updateSelectionMarkers()},s=i.session,t=i.renderer.pixelToScreenCoordinates(o,p),u=t;if(g&&!f&&!c&&h==0){if(!k&&n)return;if(!k){var v=j.toOrientedRange();i.addSelectionMarker(v)}var w=j.rangeList.rangeAtPoint(l);d.capture(i.container,function(){},function(){var a=j.toOrientedRange();w&&a.isEmpty()&&e(w.cursor,a.cursor)?j.substractPoint(a.cursor):(v&&(i.removeSelectionMarker(v),j.addRange(v)),j.addRange(a))})}else if(!f&&c&&h==0){a.stop(),k&&!g?j.toSingleRange():!k&&g&&j.addRange(),j.moveCursorToPosition(l),j.clearSelection();var x=[],y=function(a){clearInterval(A),i.removeSelectionMarkers(x);for(var b=0;b<x.length;b++)j.addRange(x[b])},z=r;d.capture(i.container,q,y);var A=setInterval(function(){z()},20);return a.preventDefault()}}var d=a("../lib/event");b.onMouseDown=f}),define("ace/commands/multi_select_commands",["require","exports","module","ace/keyboard/hash_handler"],function(a,b,c){b.defaultCommands=[{name:"addCursorAbove",exec:function(a){a.selectMoreLines(-1)},bindKey:{win:"Ctrl-Alt-Up",mac:"Ctrl-Alt-Up"},readonly:!0},{name:"addCursorBelow",exec:function(a){a.selectMoreLines(1)},bindKey:{win:"Ctrl-Alt-Down",mac:"Ctrl-Alt-Down"},readonly:!0},{name:"addCursorAboveSkipCurrent",exec:function(a){a.selectMoreLines(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Up",mac:"Ctrl-Alt-Shift-Up"},readonly:!0},{name:"addCursorBelowSkipCurrent",exec:function(a){a.selectMoreLines(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Down",mac:"Ctrl-Alt-Shift-Down"},readonly:!0},{name:"selectMoreBefore",exec:function(a){a.selectMore(-1)},bindKey:{win:"Ctrl-Alt-Left",mac:"Ctrl-Alt-Left"},readonly:!0},{name:"selectMoreAfter",exec:function(a){a.selectMore(1)},bindKey:{win:"Ctrl-Alt-Right",mac:"Ctrl-Alt-Right"},readonly:!0},{name:"selectNextBefore",exec:function(a){a.selectMore(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Left",mac:"Ctrl-Alt-Shift-Left"},readonly:!0},{name:"selectNextAfter",exec:function(a){a.selectMore(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Right",mac:"Ctrl-Alt-Shift-Right"},readonly:!0},{name:"splitIntoLines",exec:function(a){a.multiSelect.splitIntoLines()},bindKey:{win:"Ctrl-Alt-L",mac:"Ctrl-Alt-L"},readonly:!0},{name:"alignCursors",exec:function(a){a.alignCursors()},bindKey:{win:"Ctrl-Alt-A",mac:"Ctrl-Alt-A"}}],b.multiSelectCommands=[{name:"singleSelection",bindKey:"esc",exec:function(a){a.exitMultiSelectMode()},readonly:!0,isAvailable:function(a){return a&&a.inMultiSelectMode}}];var d=a("../keyboard/hash_handler").HashHandler;b.keyboardHandler=new d(b.multiSelectCommands)}),define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/config"],function(a,b,c){var d=a("../lib/oop"),e=a("../lib/event_emitter").EventEmitter,f=a("../config"),g=function(b,c,d){this.changeListener=this.changeListener.bind(this);if(f.get("packaged"))this.$worker=new Worker(f.moduleUrl(c,"worker"));else{var e;typeof a.supports!="undefined"&&a.supports.indexOf("ucjs2-pinf-0")>=0?e=a.nameToUrl("ace/worker/worker_sourcemint"):(a.nameToUrl&&!a.toUrl&&(a.toUrl=a.nameToUrl),e=this.$normalizePath(a.toUrl("ace/worker/worker",null,"_"))),this.$worker=new Worker(e);var g={};for(var h=0;h<b.length;h++){var i=b[h],j=this.$normalizePath(a.toUrl(i,null,"_").replace(/.js(\?.*)?$/,""));g[i]=j}}this.$worker.postMessage({init:!0,tlns:g,module:c,classname:d}),this.callbackId=1,this.callbacks={};var k=this;this.$worker.onerror=function(a){throw window.console&&console.log&&console.log(a),a},this.$worker.onmessage=function(a){var b=a.data;switch(b.type){case"log":window.console&&console.log&&console.log(b.data);break;case"event":k._emit(b.name,{data:b.data});break;case"call":var c=k.callbacks[b.id];c&&(c(b.data),delete k.callbacks[b.id])}}};(function(){d.implement(this,e),this.$normalizePath=function(a){return location.host?(a=a.replace(/^[a-z]+:\/\/[^\/]+/,""),a=location.protocol+"//"+location.host+(a.charAt(0)=="/"?"":location.pathname.replace(/\/[^\/]*$/,""))+"/"+a.replace(/^[\/]+/,""),a):a},this.terminate=function(){this._emit("terminate",{}),this.$worker.terminate(),this.$worker=null,this.$doc.removeEventListener("change",this.changeListener),this.$doc=null},this.send=function(a,b){this.$worker.postMessage({command:a,args:b})},this.call=function(a,b,c){if(c){var d=this.callbackId++;this.callbacks[d]=c,b.push(d)}this.send(a,b)},this.emit=function(a,b){try{this.$worker.postMessage({event:a,data:{data:b.data}})}catch(c){}},this.attachToDocument=function(a){this.$doc&&this.terminate(),this.$doc=a,this.call("setValue",[a.getValue()]),a.on("change",this.changeListener)},this.changeListener=function(a){a.range={start:a.data.range.start,end:a.data.range.end},this.emit("change",a)}}).call(g.prototype),b.WorkerClient=g}),define("ace/keyboard/state_handler",["require","exports","module"],function(a,b,c){function e(a){this.keymapping=this.$buildKeymappingRegex(a)}var d=!1;e.prototype={$buildKeymappingRegex:function(a){for(var b in a)this.$buildBindingsRegex(a[b]);return a},$buildBindingsRegex:function(a){a.forEach(function(a){a.key?a.key=new RegExp("^"+a.key+"$"):Array.isArray(a.regex)?("key"in a||(a.key=new RegExp("^"+a.regex[1]+"$")),a.regex=new RegExp(a.regex.join("")+"$")):a.regex&&(a.regex=new RegExp(a.regex+"$"))})},$composeBuffer:function(a,b,c,d){if(a.state==null||a.buffer==null)a.state="start",a.buffer="";var e=[];b&1&&e.push("ctrl"),b&8&&e.push("command"),b&2&&e.push("option"),b&4&&e.push("shift"),c&&e.push(c);var f=e.join("-"),g=a.buffer+f;b!=2&&(a.buffer=g);var h={bufferToUse:g,symbolicName:f};return d&&(h.keyIdentifier=d.keyIdentifier),h},$find:function(a,b,c,e,f,g){var h={};return this.keymapping[a.state].some(function(i){var j;if(i.key&&!i.key.test(c))return!1;if(i.regex&&!(j=i.regex.exec(b)))return!1;if(i.match&&!i.match(b,e,f,c,g))return!1;if(i.disallowMatches)for(var k=0;k<i.disallowMatches.length;k++)if(!!j[i.disallowMatches[k]])return!1;if(i.exec){h.command=i.exec;if(i.params){var l;h.args={},i.params.forEach(function(a){a.match!=null&&j!=null?l=j[a.match]||a.defaultValue:l=a.defaultValue,a.type==="number"&&(l=parseInt(l)),h.args[a.name]=l})}a.buffer=""}return i.then&&(a.state=i.then,a.buffer=""),h.command==null&&(h.command="null"),d&&console.log("KeyboardStateMapper#find",i),!0}),h.command?h:(a.buffer="",!1)},handleKeyboard:function(a,b,c,e,f){b==-1&&(b=0);if(b==0||c!=""&&c!=String.fromCharCode(0)){var g=this.$composeBuffer(a,b,c,f),h=g.bufferToUse,i=g.symbolicName,j=g.keyIdentifier;return g=this.$find(a,h,i,b,c,j),d&&console.log("KeyboardStateMapper#match",h,i,g),g}return null}},b.matchCharacterOnly=function(a,b,c,d){return b==0?!0:b==4&&c.length==1?!0:!1},b.StateHandler=e}),define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(a,b,c){var d=a("./range").Range,e=a("./lib/event_emitter").EventEmitter,f=a("./lib/oop"),g=function(a,b,c,d,e,f){var g=this;this.length=b,this.session=a,this.doc=a.getDocument(),this.mainClass=e,this.othersClass=f,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate),this.$others=d,this.$onCursorChange=function(){setTimeout(function(){g.onCursorChange()})},this.$pos=c;var h=a.getUndoManager().$undoStack||a.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=h.length,this.setup(),a.selection.on("changeCursor",this.$onCursorChange)};(function(){f.implement(this,e),this.setup=function(){var a=this,b=this.doc,c=this.session,e=this.$pos;this.pos=b.createAnchor(e.row,e.column),this.markerId=c.addMarker(new d(e.row,e.column,e.row,e.column+this.length),this.mainClass,null,!1),this.pos.on("change",function(b){c.removeMarker(a.markerId),a.markerId=c.addMarker(new d(b.value.row,b.value.column,b.value.row,b.value.column+a.length),a.mainClass,null,!1)}),this.others=[],this.$others.forEach(function(c){var d=b.createAnchor(c.row,c.column);a.others.push(d)}),c.setUndoSelect(!1)},this.showOtherMarkers=function(){if(this.othersActive)return;var a=this.session,b=this;this.othersActive=!0,this.others.forEach(function(c){c.markerId=a.addMarker(new d(c.row,c.column,c.row,c.column+b.length),b.othersClass,null,!1),c.on("change",function(e){a.removeMarker(c.markerId),c.markerId=a.addMarker(new d(e.value.row,e.value.column,e.value.row,e.value.column+b.length),b.othersClass,null,!1)})})},this.hideOtherMarkers=function(){if(!this.othersActive)return;this.othersActive=!1;for(var a=0;a<this.others.length;a++)this.session.removeMarker(this.others[a].markerId)},this.onUpdate=function(a){var b=a.data,c=b.range;if(c.start.row!==c.end.row)return;if(c.start.row!==this.pos.row)return;if(this.$updating)return;this.$updating=!0;var e=b.action==="insertText"?c.end.column-c.start.column:c.start.column-c.end.column;if(c.start.column>=this.pos.column&&c.start.column<=this.pos.column+this.length+1){var f=c.start.column-this.pos.column;this.length+=e;if(!this.session.$fromUndo){if(b.action==="insertText")for(var g=this.others.length-1;g>=0;g--){var h=this.others[g],i={row:h.row,column:h.column+f};h.row===c.start.row&&c.start.column<h.column&&(i.column+=e),this.doc.insert(i,b.text)}else if(b.action==="removeText")for(var g=this.others.length-1;g>=0;g--){var h=this.others[g],i={row:h.row,column:h.column+f};h.row===c.start.row&&c.start.column<h.column&&(i.column+=e),this.doc.remove(new d(i.row,i.column,i.row,i.column-e))}c.start.column===this.pos.column&&b.action==="insertText"?setTimeout(function(){this.pos.setPosition(this.pos.row,this.pos.column-e);for(var a=0;a<this.others.length;a++){var b=this.others[a],d={row:b.row,column:b.column-e};b.row===c.start.row&&c.start.column<b.column&&(d.column+=e),b.setPosition(d.row,d.column)}}.bind(this),0):c.start.column===this.pos.column&&b.action==="removeText"&&setTimeout(function(){for(var a=0;a<this.others.length;a++){var b=this.others[a];b.row===c.start.row&&c.start.column<b.column&&b.setPosition(b.row,b.column-e)}}.bind(this),0)}this.pos._emit("change",{value:this.pos});for(var g=0;g<this.others.length;g++)this.others[g]._emit("change",{value:this.others[g]})}this.$updating=!1},this.onCursorChange=function(a){if(this.$updating)return;var b=this.session.selection.getCursor();b.row===this.pos.row&&b.column>=this.pos.column&&b.column<=this.pos.column+this.length?(this.showOtherMarkers(),this._emit("cursorEnter",a)):(this.hideOtherMarkers(),this._emit("cursorLeave",a))},this.detach=function(){this.session.removeMarker(this.markerId),this.hideOtherMarkers(),this.doc.removeEventListener("change",this.$onUpdate),this.session.selection.removeEventListener("changeCursor",this.$onCursorChange),this.pos.detach();for(var a=0;a<this.others.length;a++)this.others[a].detach();this.session.setUndoSelect(!0)},this.cancel=function(){if(this.$undoStackDepth===-1)throw Error("Canceling placeholders only supported with undo manager attached to session.");var a=this.session.getUndoManager(),b=(a.$undoStack||a.$undostack).length-this.$undoStackDepth;for(var c=0;c<b;c++)a.undo(!0)}}).call(g.prototype),b.PlaceHolder=g}),define("ace/theme/textmate",["require","exports","module","text!ace/theme/textmate.css","ace/lib/dom"],function(a,b,c){b.isDark=!1,b.cssClass="ace-tm",b.cssText=a("text!./textmate.css");var d=a("../lib/dom");d.importCssString(b.cssText,b.cssClass)}),define("text!ace/theme/textmate.css",[],'.ace-tm .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-tm .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-tm .ace_gutter {\n background: #f0f0f0;\n color: #333;\n}\n\n.ace-tm .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-tm .ace_fold {\n background-color: #6B72E6;\n}\n\n.ace-tm .ace_scroller {\n background-color: #FFFFFF;\n}\n\n.ace-tm .ace_cursor {\n border-left: 2px solid black;\n}\n\n.ace-tm .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid black;\n}\n \n.ace-tm .ace_line .ace_invisible {\n color: rgb(191, 191, 191);\n}\n\n.ace-tm .ace_line .ace_storage,\n.ace-tm .ace_line .ace_keyword {\n color: blue;\n}\n\n.ace-tm .ace_line .ace_constant {\n color: rgb(197, 6, 11);\n}\n\n.ace-tm .ace_line .ace_constant.ace_buildin {\n color: rgb(88, 72, 246);\n}\n\n.ace-tm .ace_line .ace_constant.ace_language {\n color: rgb(88, 92, 246);\n}\n\n.ace-tm .ace_line .ace_constant.ace_library {\n color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_line .ace_invalid {\n background-color: rgba(255, 0, 0, 0.1);\n color: red;\n}\n\n.ace-tm .ace_line .ace_support.ace_function {\n color: rgb(60, 76, 114);\n}\n\n.ace-tm .ace_line .ace_support.ace_constant {\n color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_line .ace_support.ace_type,\n.ace-tm .ace_line .ace_support.ace_class {\n color: rgb(109, 121, 222);\n}\n\n.ace-tm .ace_line .ace_keyword.ace_operator {\n color: rgb(104, 118, 135);\n}\n\n.ace-tm .ace_line .ace_string {\n color: rgb(3, 106, 7);\n}\n\n.ace-tm .ace_line .ace_comment {\n color: rgb(76, 136, 107);\n}\n\n.ace-tm .ace_line .ace_comment.ace_doc {\n color: rgb(0, 102, 255);\n}\n\n.ace-tm .ace_line .ace_comment.ace_doc.ace_tag {\n color: rgb(128, 159, 191);\n}\n\n.ace-tm .ace_line .ace_constant.ace_numeric {\n color: rgb(0, 0, 205);\n}\n\n.ace-tm .ace_line .ace_variable {\n color: rgb(49, 132, 149);\n}\n\n.ace-tm .ace_line .ace_xml_pe {\n color: rgb(104, 104, 91);\n}\n\n.ace-tm .ace_entity.ace_name.ace_function {\n color: #0000A2;\n}\n\n\n.ace-tm .ace_markup.ace_heading {\n color: rgb(12, 7, 255);\n}\n\n.ace-tm .ace_markup.ace_list {\n color:rgb(185, 6, 144);\n}\n\n.ace-tm .ace_meta.ace_tag {\n color:rgb(0, 22, 142);\n}\n\n.ace-tm .ace_string.ace_regex {\n color: rgb(255, 0, 0)\n}\n\n.ace-tm .ace_marker-layer .ace_selection {\n background: rgb(181, 213, 255);\n}\n.ace-tm.multiselect .ace_selection.start {\n box-shadow: 0 0 3px 0px white;\n border-radius: 2px;\n}\n.ace-tm .ace_marker-layer .ace_step {\n background: rgb(252, 255, 0);\n}\n\n.ace-tm .ace_marker-layer .ace_stack {\n background: rgb(164, 229, 101);\n}\n\n.ace-tm .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgb(192, 192, 192);\n}\n\n.ace-tm .ace_marker-layer .ace_active_line {\n background: rgba(0, 0, 0, 0.07);\n}\n\n.ace-tm .ace_gutter_active_line {\n background-color : #dcdcdc;\n}\n\n.ace-tm .ace_marker-layer .ace_selected_word {\n background: rgb(250, 250, 255);\n border: 1px solid rgb(200, 200, 250);\n}\n\n.ace-tm .ace_indent-guide {\n background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;\n}\n');
|
2 |
-
(function() {
|
3 |
-
window.require(["ace/ace"], function(a) {
|
4 |
-
a && a.config.init();
|
5 |
-
if (!window.ace)
|
6 |
-
window.ace = {};
|
7 |
-
for (var key in a) if (a.hasOwnProperty(key))
|
8 |
-
ace[key] = a[key];
|
9 |
-
});
|
10 |
-
})();
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/vendor/ace/mode-css.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/folding/cstyle"],function(a,b,c){var d=a("../lib/oop"),e=a("./text").Mode,f=a("../tokenizer").Tokenizer,g=a("./css_highlight_rules").CssHighlightRules,h=a("./matching_brace_outdent").MatchingBraceOutdent,i=a("../worker/worker_client").WorkerClient,j=a("./folding/cstyle").FoldMode,k=function(){this.$tokenizer=new f((new g).getRules(),"i"),this.$outdent=new h,this.foldingRules=new j};d.inherits(k,e),function(){this.foldingRules="cStyle",this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a).tokens;if(e.length&&e[e.length-1].type=="comment")return d;var f=b.match(/^.*\{\s*$/);return f&&(d+=c),d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)},this.createWorker=function(a){var b=new i(["ace"],"ace/mode/css_worker","Worker");return b.attachToDocument(a.getDocument()),b.on("csslint",function(b){var c=[];b.data.forEach(function(a){c.push({row:a.line-1,column:a.col-1,text:a.message,type:a.type,lint:a})}),a.setAnnotations(c)}),b}}.call(k.prototype),b.Mode=k}),define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("../lib/oop"),e=a("../lib/lang"),f=a("./text_highlight_rules").TextHighlightRules,g=function(){var a=this.createKeywordMapper({"support.type":"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index","support.function":"rgb|rgba|url|attr|counter|counters","support.constant":"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero","support.constant.color":"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow","support.constant.fonts":"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"},"text",!0),b="\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))",c="(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b",d="(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b",f=[{token:"comment",merge:!0,regex:"\\/\\*",next:"ruleset_comment"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:["constant.numeric","keyword"],regex:"("+b+")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"},{token:["constant.numeric"],regex:"([0-9]+)"},{token:"constant.numeric",regex:"#[a-f0-9]{6}"},{token:"constant.numeric",regex:"#[a-f0-9]{3}"},{token:["punctuation","entity.other.attribute-name.pseudo-element.css"],regex:c},{token:["punctuation","entity.other.attribute-name.pseudo-class.css"],regex:d},{token:a,regex:"\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"}],g=e.copyArray(f);g.unshift({token:"paren.rparen",regex:"\\}",next:"start"});var h=e.copyArray(f);h.unshift({token:"paren.rparen",regex:"\\}",next:"media"});var i=[{token:"comment",merge:!0,regex:".+"}],j=e.copyArray(i);j.unshift({token:"comment",regex:".*?\\*\\/",next:"start"});var k=e.copyArray(i);k.unshift({token:"comment",regex:".*?\\*\\/",next:"media"});var l=e.copyArray(i);l.unshift({token:"comment",regex:".*?\\*\\/",next:"ruleset"}),this.$rules={start:[{token:"comment",merge:!0,regex:"\\/\\*",next:"comment"},{token:"paren.lparen",regex:"\\{",next:"ruleset"},{token:"string",regex:"@.*?{",next:"media"},{token:"keyword",regex:"#[a-z0-9-_]+"},{token:"variable",regex:"\\.[a-z0-9-_]+"},{token:"string",regex:":[a-z0-9-_]+"},{token:"constant",regex:"[a-z0-9-_]+"}],media:[{token:"comment",merge:!0,regex:"\\/\\*",next:"media_comment"},{token:"paren.lparen",regex:"\\{",next:"media_ruleset"},{token:"string",regex:"\\}",next:"start"},{token:"keyword",regex:"#[a-z0-9-_]+"},{token:"variable",regex:"\\.[a-z0-9-_]+"},{token:"string",regex:":[a-z0-9-_]+"},{token:"constant",regex:"[a-z0-9-_]+"}],comment:j,ruleset:g,ruleset_comment:l,media_ruleset:h,media_comment:k}};d.inherits(g,f),b.CssHighlightRules=g}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(a,b,c){var d=a("../range").Range,e=function(){};(function(){this.checkOutdent=function(a,b){return/^\s+$/.test(a)?/^\s*\}/.test(b):!1},this.autoOutdent=function(a,b){var c=a.getLine(b),e=c.match(/^(\s*\})/);if(!e)return 0;var f=e[1].length,g=a.findMatchingBracket({row:b,column:f});if(!g||g.row==b)return 0;var h=this.$getIndent(a.getLine(g.row));a.replace(new d(b,0,b,f-1),h)},this.$getIndent=function(a){var b=a.match(/^(\s+)/);return b?b[1]:""}}).call(e.prototype),b.MatchingBraceOutdent=e}),define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(a,b,c){var d=a("../../lib/oop"),e=a("../../range").Range,f=a("./fold_mode").FoldMode,g=b.FoldMode=function(){};d.inherits(g,f),function(){this.foldingStartMarker=/(\{|\[)[^\}\]]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/,this.getFoldWidgetRange=function(a,b,c){var d=a.getLine(c),f=d.match(this.foldingStartMarker);if(f){var g=f.index;if(f[1])return this.openingBracketBlock(a,f[1],c,g);var h=a.getCommentFoldRange(c,g+f[0].length);return h.end.column-=2,h}if(b!=="markbeginend")return;var f=d.match(this.foldingStopMarker);if(f){var g=f.index+f[0].length;if(f[2]){var h=a.getCommentFoldRange(c,g);return h.end.column-=2,h}var i={row:c,column:g},j=a.$findOpeningBracket(f[1],i);if(!j)return;return j.column++,i.column--,e.fromPoints(j,i)}}}.call(g.prototype)}),define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"],function(a,b,c){var d=a("../../range").Range,e=b.FoldMode=function(){};(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(a,b,c){var d=a.getLine(c);return this.foldingStartMarker.test(d)?"start":b=="markbeginend"&&this.foldingStopMarker&&this.foldingStopMarker.test(d)?"end":""},this.getFoldWidgetRange=function(a,b,c){return null},this.indentationBlock=function(a,b,c){var e=/\S/,f=a.getLine(b),g=f.search(e);if(g==-1)return;var h=c||f.length,i=a.getLength(),j=b,k=b;while(++b<i){var l=a.getLine(b).search(e);if(l==-1)continue;if(l<=g)break;k=b}if(k>j){var m=a.getLine(k).length;return new d(j,h,k,m)}},this.openingBracketBlock=function(a,b,c,e,f){var g={row:c,column:e+1},h=a.$findClosingBracket(b,g,f);if(!h)return;var i=a.foldWidgets[h.row];return i==null&&(i=this.getFoldWidget(a,h.row)),i=="start"&&h.row>g.row&&(h.row--,h.column=a.getLine(h.row).length),d.fromPoints(g,h)}}).call(e.prototype)})
|
|
assets/vendor/ace/mode/css/csslint.js
DELETED
@@ -1,9628 +0,0 @@
|
|
1 |
-
define(function(require, exports, module) {
|
2 |
-
/*!
|
3 |
-
CSSLint
|
4 |
-
Copyright (c) 2014 Nicole Sullivan and Nicholas C. Zakas. All rights reserved.
|
5 |
-
|
6 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 |
-
of this software and associated documentation files (the 'Software'), to deal
|
8 |
-
in the Software without restriction, including without limitation the rights
|
9 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 |
-
copies of the Software, and to permit persons to whom the Software is
|
11 |
-
furnished to do so, subject to the following conditions:
|
12 |
-
|
13 |
-
The above copyright notice and this permission notice shall be included in
|
14 |
-
all copies or substantial portions of the Software.
|
15 |
-
|
16 |
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 |
-
THE SOFTWARE.
|
23 |
-
|
24 |
-
*/
|
25 |
-
/* Build: v0.10.0 22-July-2014 01:17:52 */
|
26 |
-
/*!
|
27 |
-
Parser-Lib
|
28 |
-
Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.
|
29 |
-
|
30 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
31 |
-
of this software and associated documentation files (the "Software"), to deal
|
32 |
-
in the Software without restriction, including without limitation the rights
|
33 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
34 |
-
copies of the Software, and to permit persons to whom the Software is
|
35 |
-
furnished to do so, subject to the following conditions:
|
36 |
-
|
37 |
-
The above copyright notice and this permission notice shall be included in
|
38 |
-
all copies or substantial portions of the Software.
|
39 |
-
|
40 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
41 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
42 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
43 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
44 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
45 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
46 |
-
THE SOFTWARE.
|
47 |
-
|
48 |
-
*/
|
49 |
-
/* Version v0.2.5, Build time: 7-May-2014 03:37:38 */
|
50 |
-
var parserlib = {};
|
51 |
-
(function(){
|
52 |
-
|
53 |
-
/**
|
54 |
-
* A generic base to inherit from for any object
|
55 |
-
* that needs event handling.
|
56 |
-
* @class EventTarget
|
57 |
-
* @constructor
|
58 |
-
*/
|
59 |
-
function EventTarget(){
|
60 |
-
|
61 |
-
/**
|
62 |
-
* The array of listeners for various events.
|
63 |
-
* @type Object
|
64 |
-
* @property _listeners
|
65 |
-
* @private
|
66 |
-
*/
|
67 |
-
this._listeners = {};
|
68 |
-
}
|
69 |
-
|
70 |
-
EventTarget.prototype = {
|
71 |
-
|
72 |
-
//restore constructor
|
73 |
-
constructor: EventTarget,
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Adds a listener for a given event type.
|
77 |
-
* @param {String} type The type of event to add a listener for.
|
78 |
-
* @param {Function} listener The function to call when the event occurs.
|
79 |
-
* @return {void}
|
80 |
-
* @method addListener
|
81 |
-
*/
|
82 |
-
addListener: function(type, listener){
|
83 |
-
if (!this._listeners[type]){
|
84 |
-
this._listeners[type] = [];
|
85 |
-
}
|
86 |
-
|
87 |
-
this._listeners[type].push(listener);
|
88 |
-
},
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Fires an event based on the passed-in object.
|
92 |
-
* @param {Object|String} event An object with at least a 'type' attribute
|
93 |
-
* or a string indicating the event name.
|
94 |
-
* @return {void}
|
95 |
-
* @method fire
|
96 |
-
*/
|
97 |
-
fire: function(event){
|
98 |
-
if (typeof event == "string"){
|
99 |
-
event = { type: event };
|
100 |
-
}
|
101 |
-
if (typeof event.target != "undefined"){
|
102 |
-
event.target = this;
|
103 |
-
}
|
104 |
-
|
105 |
-
if (typeof event.type == "undefined"){
|
106 |
-
throw new Error("Event object missing 'type' property.");
|
107 |
-
}
|
108 |
-
|
109 |
-
if (this._listeners[event.type]){
|
110 |
-
|
111 |
-
//create a copy of the array and use that so listeners can't chane
|
112 |
-
var listeners = this._listeners[event.type].concat();
|
113 |
-
for (var i=0, len=listeners.length; i < len; i++){
|
114 |
-
listeners[i].call(this, event);
|
115 |
-
}
|
116 |
-
}
|
117 |
-
},
|
118 |
-
|
119 |
-
/**
|
120 |
-
* Removes a listener for a given event type.
|
121 |
-
* @param {String} type The type of event to remove a listener from.
|
122 |
-
* @param {Function} listener The function to remove from the event.
|
123 |
-
* @return {void}
|
124 |
-
* @method removeListener
|
125 |
-
*/
|
126 |
-
removeListener: function(type, listener){
|
127 |
-
if (this._listeners[type]){
|
128 |
-
var listeners = this._listeners[type];
|
129 |
-
for (var i=0, len=listeners.length; i < len; i++){
|
130 |
-
if (listeners[i] === listener){
|
131 |
-
listeners.splice(i, 1);
|
132 |
-
break;
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
|
137 |
-
}
|
138 |
-
}
|
139 |
-
};
|
140 |
-
/**
|
141 |
-
* Convenient way to read through strings.
|
142 |
-
* @namespace parserlib.util
|
143 |
-
* @class StringReader
|
144 |
-
* @constructor
|
145 |
-
* @param {String} text The text to read.
|
146 |
-
*/
|
147 |
-
function StringReader(text){
|
148 |
-
|
149 |
-
/**
|
150 |
-
* The input text with line endings normalized.
|
151 |
-
* @property _input
|
152 |
-
* @type String
|
153 |
-
* @private
|
154 |
-
*/
|
155 |
-
this._input = text.replace(/\n\r?/g, "\n");
|
156 |
-
|
157 |
-
|
158 |
-
/**
|
159 |
-
* The row for the character to be read next.
|
160 |
-
* @property _line
|
161 |
-
* @type int
|
162 |
-
* @private
|
163 |
-
*/
|
164 |
-
this._line = 1;
|
165 |
-
|
166 |
-
|
167 |
-
/**
|
168 |
-
* The column for the character to be read next.
|
169 |
-
* @property _col
|
170 |
-
* @type int
|
171 |
-
* @private
|
172 |
-
*/
|
173 |
-
this._col = 1;
|
174 |
-
|
175 |
-
/**
|
176 |
-
* The index of the character in the input to be read next.
|
177 |
-
* @property _cursor
|
178 |
-
* @type int
|
179 |
-
* @private
|
180 |
-
*/
|
181 |
-
this._cursor = 0;
|
182 |
-
}
|
183 |
-
|
184 |
-
StringReader.prototype = {
|
185 |
-
|
186 |
-
//restore constructor
|
187 |
-
constructor: StringReader,
|
188 |
-
|
189 |
-
//-------------------------------------------------------------------------
|
190 |
-
// Position info
|
191 |
-
//-------------------------------------------------------------------------
|
192 |
-
|
193 |
-
/**
|
194 |
-
* Returns the column of the character to be read next.
|
195 |
-
* @return {int} The column of the character to be read next.
|
196 |
-
* @method getCol
|
197 |
-
*/
|
198 |
-
getCol: function(){
|
199 |
-
return this._col;
|
200 |
-
},
|
201 |
-
|
202 |
-
/**
|
203 |
-
* Returns the row of the character to be read next.
|
204 |
-
* @return {int} The row of the character to be read next.
|
205 |
-
* @method getLine
|
206 |
-
*/
|
207 |
-
getLine: function(){
|
208 |
-
return this._line ;
|
209 |
-
},
|
210 |
-
|
211 |
-
/**
|
212 |
-
* Determines if you're at the end of the input.
|
213 |
-
* @return {Boolean} True if there's no more input, false otherwise.
|
214 |
-
* @method eof
|
215 |
-
*/
|
216 |
-
eof: function(){
|
217 |
-
return (this._cursor == this._input.length);
|
218 |
-
},
|
219 |
-
|
220 |
-
//-------------------------------------------------------------------------
|
221 |
-
// Basic reading
|
222 |
-
//-------------------------------------------------------------------------
|
223 |
-
|
224 |
-
/**
|
225 |
-
* Reads the next character without advancing the cursor.
|
226 |
-
* @param {int} count How many characters to look ahead (default is 1).
|
227 |
-
* @return {String} The next character or null if there is no next character.
|
228 |
-
* @method peek
|
229 |
-
*/
|
230 |
-
peek: function(count){
|
231 |
-
var c = null;
|
232 |
-
count = (typeof count == "undefined" ? 1 : count);
|
233 |
-
|
234 |
-
//if we're not at the end of the input...
|
235 |
-
if (this._cursor < this._input.length){
|
236 |
-
|
237 |
-
//get character and increment cursor and column
|
238 |
-
c = this._input.charAt(this._cursor + count - 1);
|
239 |
-
}
|
240 |
-
|
241 |
-
return c;
|
242 |
-
},
|
243 |
-
|
244 |
-
/**
|
245 |
-
* Reads the next character from the input and adjusts the row and column
|
246 |
-
* accordingly.
|
247 |
-
* @return {String} The next character or null if there is no next character.
|
248 |
-
* @method read
|
249 |
-
*/
|
250 |
-
read: function(){
|
251 |
-
var c = null;
|
252 |
-
|
253 |
-
//if we're not at the end of the input...
|
254 |
-
if (this._cursor < this._input.length){
|
255 |
-
|
256 |
-
//if the last character was a newline, increment row count
|
257 |
-
//and reset column count
|
258 |
-
if (this._input.charAt(this._cursor) == "\n"){
|
259 |
-
this._line++;
|
260 |
-
this._col=1;
|
261 |
-
} else {
|
262 |
-
this._col++;
|
263 |
-
}
|
264 |
-
|
265 |
-
//get character and increment cursor and column
|
266 |
-
c = this._input.charAt(this._cursor++);
|
267 |
-
}
|
268 |
-
|
269 |
-
return c;
|
270 |
-
},
|
271 |
-
|
272 |
-
//-------------------------------------------------------------------------
|
273 |
-
// Misc
|
274 |
-
//-------------------------------------------------------------------------
|
275 |
-
|
276 |
-
/**
|
277 |
-
* Saves the current location so it can be returned to later.
|
278 |
-
* @method mark
|
279 |
-
* @return {void}
|
280 |
-
*/
|
281 |
-
mark: function(){
|
282 |
-
this._bookmark = {
|
283 |
-
cursor: this._cursor,
|
284 |
-
line: this._line,
|
285 |
-
col: this._col
|
286 |
-
};
|
287 |
-
},
|
288 |
-
|
289 |
-
reset: function(){
|
290 |
-
if (this._bookmark){
|
291 |
-
this._cursor = this._bookmark.cursor;
|
292 |
-
this._line = this._bookmark.line;
|
293 |
-
this._col = this._bookmark.col;
|
294 |
-
delete this._bookmark;
|
295 |
-
}
|
296 |
-
},
|
297 |
-
|
298 |
-
//-------------------------------------------------------------------------
|
299 |
-
// Advanced reading
|
300 |
-
//-------------------------------------------------------------------------
|
301 |
-
|
302 |
-
/**
|
303 |
-
* Reads up to and including the given string. Throws an error if that
|
304 |
-
* string is not found.
|
305 |
-
* @param {String} pattern The string to read.
|
306 |
-
* @return {String} The string when it is found.
|
307 |
-
* @throws Error when the string pattern is not found.
|
308 |
-
* @method readTo
|
309 |
-
*/
|
310 |
-
readTo: function(pattern){
|
311 |
-
|
312 |
-
var buffer = "",
|
313 |
-
c;
|
314 |
-
|
315 |
-
/*
|
316 |
-
* First, buffer must be the same length as the pattern.
|
317 |
-
* Then, buffer must end with the pattern or else reach the
|
318 |
-
* end of the input.
|
319 |
-
*/
|
320 |
-
while (buffer.length < pattern.length || buffer.lastIndexOf(pattern) != buffer.length - pattern.length){
|
321 |
-
c = this.read();
|
322 |
-
if (c){
|
323 |
-
buffer += c;
|
324 |
-
} else {
|
325 |
-
throw new Error("Expected \"" + pattern + "\" at line " + this._line + ", col " + this._col + ".");
|
326 |
-
}
|
327 |
-
}
|
328 |
-
|
329 |
-
return buffer;
|
330 |
-
|
331 |
-
},
|
332 |
-
|
333 |
-
/**
|
334 |
-
* Reads characters while each character causes the given
|
335 |
-
* filter function to return true. The function is passed
|
336 |
-
* in each character and either returns true to continue
|
337 |
-
* reading or false to stop.
|
338 |
-
* @param {Function} filter The function to read on each character.
|
339 |
-
* @return {String} The string made up of all characters that passed the
|
340 |
-
* filter check.
|
341 |
-
* @method readWhile
|
342 |
-
*/
|
343 |
-
readWhile: function(filter){
|
344 |
-
|
345 |
-
var buffer = "",
|
346 |
-
c = this.read();
|
347 |
-
|
348 |
-
while(c !== null && filter(c)){
|
349 |
-
buffer += c;
|
350 |
-
c = this.read();
|
351 |
-
}
|
352 |
-
|
353 |
-
return buffer;
|
354 |
-
|
355 |
-
},
|
356 |
-
|
357 |
-
/**
|
358 |
-
* Reads characters that match either text or a regular expression and
|
359 |
-
* returns those characters. If a match is found, the row and column
|
360 |
-
* are adjusted; if no match is found, the reader's state is unchanged.
|
361 |
-
* reading or false to stop.
|
362 |
-
* @param {String|RegExp} matchter If a string, then the literal string
|
363 |
-
* value is searched for. If a regular expression, then any string
|
364 |
-
* matching the pattern is search for.
|
365 |
-
* @return {String} The string made up of all characters that matched or
|
366 |
-
* null if there was no match.
|
367 |
-
* @method readMatch
|
368 |
-
*/
|
369 |
-
readMatch: function(matcher){
|
370 |
-
|
371 |
-
var source = this._input.substring(this._cursor),
|
372 |
-
value = null;
|
373 |
-
|
374 |
-
//if it's a string, just do a straight match
|
375 |
-
if (typeof matcher == "string"){
|
376 |
-
if (source.indexOf(matcher) === 0){
|
377 |
-
value = this.readCount(matcher.length);
|
378 |
-
}
|
379 |
-
} else if (matcher instanceof RegExp){
|
380 |
-
if (matcher.test(source)){
|
381 |
-
value = this.readCount(RegExp.lastMatch.length);
|
382 |
-
}
|
383 |
-
}
|
384 |
-
|
385 |
-
return value;
|
386 |
-
},
|
387 |
-
|
388 |
-
|
389 |
-
/**
|
390 |
-
* Reads a given number of characters. If the end of the input is reached,
|
391 |
-
* it reads only the remaining characters and does not throw an error.
|
392 |
-
* @param {int} count The number of characters to read.
|
393 |
-
* @return {String} The string made up the read characters.
|
394 |
-
* @method readCount
|
395 |
-
*/
|
396 |
-
readCount: function(count){
|
397 |
-
var buffer = "";
|
398 |
-
|
399 |
-
while(count--){
|
400 |
-
buffer += this.read();
|
401 |
-
}
|
402 |
-
|
403 |
-
return buffer;
|
404 |
-
}
|
405 |
-
|
406 |
-
};
|
407 |
-
/**
|
408 |
-
* Type to use when a syntax error occurs.
|
409 |
-
* @class SyntaxError
|
410 |
-
* @namespace parserlib.util
|
411 |
-
* @constructor
|
412 |
-
* @param {String} message The error message.
|
413 |
-
* @param {int} line The line at which the error occurred.
|
414 |
-
* @param {int} col The column at which the error occurred.
|
415 |
-
*/
|
416 |
-
function SyntaxError(message, line, col){
|
417 |
-
|
418 |
-
/**
|
419 |
-
* The column at which the error occurred.
|
420 |
-
* @type int
|
421 |
-
* @property col
|
422 |
-
*/
|
423 |
-
this.col = col;
|
424 |
-
|
425 |
-
/**
|
426 |
-
* The line at which the error occurred.
|
427 |
-
* @type int
|
428 |
-
* @property line
|
429 |
-
*/
|
430 |
-
this.line = line;
|
431 |
-
|
432 |
-
/**
|
433 |
-
* The text representation of the unit.
|
434 |
-
* @type String
|
435 |
-
* @property text
|
436 |
-
*/
|
437 |
-
this.message = message;
|
438 |
-
|
439 |
-
}
|
440 |
-
|
441 |
-
//inherit from Error
|
442 |
-
SyntaxError.prototype = new Error();
|
443 |
-
/**
|
444 |
-
* Base type to represent a single syntactic unit.
|
445 |
-
* @class SyntaxUnit
|
446 |
-
* @namespace parserlib.util
|
447 |
-
* @constructor
|
448 |
-
* @param {String} text The text of the unit.
|
449 |
-
* @param {int} line The line of text on which the unit resides.
|
450 |
-
* @param {int} col The column of text on which the unit resides.
|
451 |
-
*/
|
452 |
-
function SyntaxUnit(text, line, col, type){
|
453 |
-
|
454 |
-
|
455 |
-
/**
|
456 |
-
* The column of text on which the unit resides.
|
457 |
-
* @type int
|
458 |
-
* @property col
|
459 |
-
*/
|
460 |
-
this.col = col;
|
461 |
-
|
462 |
-
/**
|
463 |
-
* The line of text on which the unit resides.
|
464 |
-
* @type int
|
465 |
-
* @property line
|
466 |
-
*/
|
467 |
-
this.line = line;
|
468 |
-
|
469 |
-
/**
|
470 |
-
* The text representation of the unit.
|
471 |
-
* @type String
|
472 |
-
* @property text
|
473 |
-
*/
|
474 |
-
this.text = text;
|
475 |
-
|
476 |
-
/**
|
477 |
-
* The type of syntax unit.
|
478 |
-
* @type int
|
479 |
-
* @property type
|
480 |
-
*/
|
481 |
-
this.type = type;
|
482 |
-
}
|
483 |
-
|
484 |
-
/**
|
485 |
-
* Create a new syntax unit based solely on the given token.
|
486 |
-
* Convenience method for creating a new syntax unit when
|
487 |
-
* it represents a single token instead of multiple.
|
488 |
-
* @param {Object} token The token object to represent.
|
489 |
-
* @return {parserlib.util.SyntaxUnit} The object representing the token.
|
490 |
-
* @static
|
491 |
-
* @method fromToken
|
492 |
-
*/
|
493 |
-
SyntaxUnit.fromToken = function(token){
|
494 |
-
return new SyntaxUnit(token.value, token.startLine, token.startCol);
|
495 |
-
};
|
496 |
-
|
497 |
-
SyntaxUnit.prototype = {
|
498 |
-
|
499 |
-
//restore constructor
|
500 |
-
constructor: SyntaxUnit,
|
501 |
-
|
502 |
-
/**
|
503 |
-
* Returns the text representation of the unit.
|
504 |
-
* @return {String} The text representation of the unit.
|
505 |
-
* @method valueOf
|
506 |
-
*/
|
507 |
-
valueOf: function(){
|
508 |
-
return this.text;
|
509 |
-
},
|
510 |
-
|
511 |
-
/**
|
512 |
-
* Returns the text representation of the unit.
|
513 |
-
* @return {String} The text representation of the unit.
|
514 |
-
* @method toString
|
515 |
-
*/
|
516 |
-
toString: function(){
|
517 |
-
return this.text;
|
518 |
-
}
|
519 |
-
|
520 |
-
};
|
521 |
-
/*global StringReader, SyntaxError*/
|
522 |
-
|
523 |
-
/**
|
524 |
-
* Generic TokenStream providing base functionality.
|
525 |
-
* @class TokenStreamBase
|
526 |
-
* @namespace parserlib.util
|
527 |
-
* @constructor
|
528 |
-
* @param {String|StringReader} input The text to tokenize or a reader from
|
529 |
-
* which to read the input.
|
530 |
-
*/
|
531 |
-
function TokenStreamBase(input, tokenData){
|
532 |
-
|
533 |
-
/**
|
534 |
-
* The string reader for easy access to the text.
|
535 |
-
* @type StringReader
|
536 |
-
* @property _reader
|
537 |
-
* @private
|
538 |
-
*/
|
539 |
-
this._reader = input ? new StringReader(input.toString()) : null;
|
540 |
-
|
541 |
-
/**
|
542 |
-
* Token object for the last consumed token.
|
543 |
-
* @type Token
|
544 |
-
* @property _token
|
545 |
-
* @private
|
546 |
-
*/
|
547 |
-
this._token = null;
|
548 |
-
|
549 |
-
/**
|
550 |
-
* The array of token information.
|
551 |
-
* @type Array
|
552 |
-
* @property _tokenData
|
553 |
-
* @private
|
554 |
-
*/
|
555 |
-
this._tokenData = tokenData;
|
556 |
-
|
557 |
-
/**
|
558 |
-
* Lookahead token buffer.
|
559 |
-
* @type Array
|
560 |
-
* @property _lt
|
561 |
-
* @private
|
562 |
-
*/
|
563 |
-
this._lt = [];
|
564 |
-
|
565 |
-
/**
|
566 |
-
* Lookahead token buffer index.
|
567 |
-
* @type int
|
568 |
-
* @property _ltIndex
|
569 |
-
* @private
|
570 |
-
*/
|
571 |
-
this._ltIndex = 0;
|
572 |
-
|
573 |
-
this._ltIndexCache = [];
|
574 |
-
}
|
575 |
-
|
576 |
-
/**
|
577 |
-
* Accepts an array of token information and outputs
|
578 |
-
* an array of token data containing key-value mappings
|
579 |
-
* and matching functions that the TokenStream needs.
|
580 |
-
* @param {Array} tokens An array of token descriptors.
|
581 |
-
* @return {Array} An array of processed token data.
|
582 |
-
* @method createTokenData
|
583 |
-
* @static
|
584 |
-
*/
|
585 |
-
TokenStreamBase.createTokenData = function(tokens){
|
586 |
-
|
587 |
-
var nameMap = [],
|
588 |
-
typeMap = {},
|
589 |
-
tokenData = tokens.concat([]),
|
590 |
-
i = 0,
|
591 |
-
len = tokenData.length+1;
|
592 |
-
|
593 |
-
tokenData.UNKNOWN = -1;
|
594 |
-
tokenData.unshift({name:"EOF"});
|
595 |
-
|
596 |
-
for (; i < len; i++){
|
597 |
-
nameMap.push(tokenData[i].name);
|
598 |
-
tokenData[tokenData[i].name] = i;
|
599 |
-
if (tokenData[i].text){
|
600 |
-
typeMap[tokenData[i].text] = i;
|
601 |
-
}
|
602 |
-
}
|
603 |
-
|
604 |
-
tokenData.name = function(tt){
|
605 |
-
return nameMap[tt];
|
606 |
-
};
|
607 |
-
|
608 |
-
tokenData.type = function(c){
|
609 |
-
return typeMap[c];
|
610 |
-
};
|
611 |
-
|
612 |
-
return tokenData;
|
613 |
-
};
|
614 |
-
|
615 |
-
TokenStreamBase.prototype = {
|
616 |
-
|
617 |
-
//restore constructor
|
618 |
-
constructor: TokenStreamBase,
|
619 |
-
|
620 |
-
//-------------------------------------------------------------------------
|
621 |
-
// Matching methods
|
622 |
-
//-------------------------------------------------------------------------
|
623 |
-
|
624 |
-
/**
|
625 |
-
* Determines if the next token matches the given token type.
|
626 |
-
* If so, that token is consumed; if not, the token is placed
|
627 |
-
* back onto the token stream. You can pass in any number of
|
628 |
-
* token types and this will return true if any of the token
|
629 |
-
* types is found.
|
630 |
-
* @param {int|int[]} tokenTypes Either a single token type or an array of
|
631 |
-
* token types that the next token might be. If an array is passed,
|
632 |
-
* it's assumed that the token can be any of these.
|
633 |
-
* @param {variant} channel (Optional) The channel to read from. If not
|
634 |
-
* provided, reads from the default (unnamed) channel.
|
635 |
-
* @return {Boolean} True if the token type matches, false if not.
|
636 |
-
* @method match
|
637 |
-
*/
|
638 |
-
match: function(tokenTypes, channel){
|
639 |
-
|
640 |
-
//always convert to an array, makes things easier
|
641 |
-
if (!(tokenTypes instanceof Array)){
|
642 |
-
tokenTypes = [tokenTypes];
|
643 |
-
}
|
644 |
-
|
645 |
-
var tt = this.get(channel),
|
646 |
-
i = 0,
|
647 |
-
len = tokenTypes.length;
|
648 |
-
|
649 |
-
while(i < len){
|
650 |
-
if (tt == tokenTypes[i++]){
|
651 |
-
return true;
|
652 |
-
}
|
653 |
-
}
|
654 |
-
|
655 |
-
//no match found, put the token back
|
656 |
-
this.unget();
|
657 |
-
return false;
|
658 |
-
},
|
659 |
-
|
660 |
-
/**
|
661 |
-
* Determines if the next token matches the given token type.
|
662 |
-
* If so, that token is consumed; if not, an error is thrown.
|
663 |
-
* @param {int|int[]} tokenTypes Either a single token type or an array of
|
664 |
-
* token types that the next token should be. If an array is passed,
|
665 |
-
* it's assumed that the token must be one of these.
|
666 |
-
* @param {variant} channel (Optional) The channel to read from. If not
|
667 |
-
* provided, reads from the default (unnamed) channel.
|
668 |
-
* @return {void}
|
669 |
-
* @method mustMatch
|
670 |
-
*/
|
671 |
-
mustMatch: function(tokenTypes, channel){
|
672 |
-
|
673 |
-
var token;
|
674 |
-
|
675 |
-
//always convert to an array, makes things easier
|
676 |
-
if (!(tokenTypes instanceof Array)){
|
677 |
-
tokenTypes = [tokenTypes];
|
678 |
-
}
|
679 |
-
|
680 |
-
if (!this.match.apply(this, arguments)){
|
681 |
-
token = this.LT(1);
|
682 |
-
throw new SyntaxError("Expected " + this._tokenData[tokenTypes[0]].name +
|
683 |
-
" at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol);
|
684 |
-
}
|
685 |
-
},
|
686 |
-
|
687 |
-
//-------------------------------------------------------------------------
|
688 |
-
// Consuming methods
|
689 |
-
//-------------------------------------------------------------------------
|
690 |
-
|
691 |
-
/**
|
692 |
-
* Keeps reading from the token stream until either one of the specified
|
693 |
-
* token types is found or until the end of the input is reached.
|
694 |
-
* @param {int|int[]} tokenTypes Either a single token type or an array of
|
695 |
-
* token types that the next token should be. If an array is passed,
|
696 |
-
* it's assumed that the token must be one of these.
|
697 |
-
* @param {variant} channel (Optional) The channel to read from. If not
|
698 |
-
* provided, reads from the default (unnamed) channel.
|
699 |
-
* @return {void}
|
700 |
-
* @method advance
|
701 |
-
*/
|
702 |
-
advance: function(tokenTypes, channel){
|
703 |
-
|
704 |
-
while(this.LA(0) !== 0 && !this.match(tokenTypes, channel)){
|
705 |
-
this.get();
|
706 |
-
}
|
707 |
-
|
708 |
-
return this.LA(0);
|
709 |
-
},
|
710 |
-
|
711 |
-
/**
|
712 |
-
* Consumes the next token from the token stream.
|
713 |
-
* @return {int} The token type of the token that was just consumed.
|
714 |
-
* @method get
|
715 |
-
*/
|
716 |
-
get: function(channel){
|
717 |
-
|
718 |
-
var tokenInfo = this._tokenData,
|
719 |
-
reader = this._reader,
|
720 |
-
value,
|
721 |
-
i =0,
|
722 |
-
len = tokenInfo.length,
|
723 |
-
found = false,
|
724 |
-
token,
|
725 |
-
info;
|
726 |
-
|
727 |
-
//check the lookahead buffer first
|
728 |
-
if (this._lt.length && this._ltIndex >= 0 && this._ltIndex < this._lt.length){
|
729 |
-
|
730 |
-
i++;
|
731 |
-
this._token = this._lt[this._ltIndex++];
|
732 |
-
info = tokenInfo[this._token.type];
|
733 |
-
|
734 |
-
//obey channels logic
|
735 |
-
while((info.channel !== undefined && channel !== info.channel) &&
|
736 |
-
this._ltIndex < this._lt.length){
|
737 |
-
this._token = this._lt[this._ltIndex++];
|
738 |
-
info = tokenInfo[this._token.type];
|
739 |
-
i++;
|
740 |
-
}
|
741 |
-
|
742 |
-
//here be dragons
|
743 |
-
if ((info.channel === undefined || channel === info.channel) &&
|
744 |
-
this._ltIndex <= this._lt.length){
|
745 |
-
this._ltIndexCache.push(i);
|
746 |
-
return this._token.type;
|
747 |
-
}
|
748 |
-
}
|
749 |
-
|
750 |
-
//call token retriever method
|
751 |
-
token = this._getToken();
|
752 |
-
|
753 |
-
//if it should be hidden, don't save a token
|
754 |
-
if (token.type > -1 && !tokenInfo[token.type].hide){
|
755 |
-
|
756 |
-
//apply token channel
|
757 |
-
token.channel = tokenInfo[token.type].channel;
|
758 |
-
|
759 |
-
//save for later
|
760 |
-
this._token = token;
|
761 |
-
this._lt.push(token);
|
762 |
-
|
763 |
-
//save space that will be moved (must be done before array is truncated)
|
764 |
-
this._ltIndexCache.push(this._lt.length - this._ltIndex + i);
|
765 |
-
|
766 |
-
//keep the buffer under 5 items
|
767 |
-
if (this._lt.length > 5){
|
768 |
-
this._lt.shift();
|
769 |
-
}
|
770 |
-
|
771 |
-
//also keep the shift buffer under 5 items
|
772 |
-
if (this._ltIndexCache.length > 5){
|
773 |
-
this._ltIndexCache.shift();
|
774 |
-
}
|
775 |
-
|
776 |
-
//update lookahead index
|
777 |
-
this._ltIndex = this._lt.length;
|
778 |
-
}
|
779 |
-
|
780 |
-
/*
|
781 |
-
* Skip to the next token if:
|
782 |
-
* 1. The token type is marked as hidden.
|
783 |
-
* 2. The token type has a channel specified and it isn't the current channel.
|
784 |
-
*/
|
785 |
-
info = tokenInfo[token.type];
|
786 |
-
if (info &&
|
787 |
-
(info.hide ||
|
788 |
-
(info.channel !== undefined && channel !== info.channel))){
|
789 |
-
return this.get(channel);
|
790 |
-
} else {
|
791 |
-
//return just the type
|
792 |
-
return token.type;
|
793 |
-
}
|
794 |
-
},
|
795 |
-
|
796 |
-
/**
|
797 |
-
* Looks ahead a certain number of tokens and returns the token type at
|
798 |
-
* that position. This will throw an error if you lookahead past the
|
799 |
-
* end of input, past the size of the lookahead buffer, or back past
|
800 |
-
* the first token in the lookahead buffer.
|
801 |
-
* @param {int} The index of the token type to retrieve. 0 for the
|
802 |
-
* current token, 1 for the next, -1 for the previous, etc.
|
803 |
-
* @return {int} The token type of the token in the given position.
|
804 |
-
* @method LA
|
805 |
-
*/
|
806 |
-
LA: function(index){
|
807 |
-
var total = index,
|
808 |
-
tt;
|
809 |
-
if (index > 0){
|
810 |
-
//TODO: Store 5 somewhere
|
811 |
-
if (index > 5){
|
812 |
-
throw new Error("Too much lookahead.");
|
813 |
-
}
|
814 |
-
|
815 |
-
//get all those tokens
|
816 |
-
while(total){
|
817 |
-
tt = this.get();
|
818 |
-
total--;
|
819 |
-
}
|
820 |
-
|
821 |
-
//unget all those tokens
|
822 |
-
while(total < index){
|
823 |
-
this.unget();
|
824 |
-
total++;
|
825 |
-
}
|
826 |
-
} else if (index < 0){
|
827 |
-
|
828 |
-
if(this._lt[this._ltIndex+index]){
|
829 |
-
tt = this._lt[this._ltIndex+index].type;
|
830 |
-
} else {
|
831 |
-
throw new Error("Too much lookbehind.");
|
832 |
-
}
|
833 |
-
|
834 |
-
} else {
|
835 |
-
tt = this._token.type;
|
836 |
-
}
|
837 |
-
|
838 |
-
return tt;
|
839 |
-
|
840 |
-
},
|
841 |
-
|
842 |
-
/**
|
843 |
-
* Looks ahead a certain number of tokens and returns the token at
|
844 |
-
* that position. This will throw an error if you lookahead past the
|
845 |
-
* end of input, past the size of the lookahead buffer, or back past
|
846 |
-
* the first token in the lookahead buffer.
|
847 |
-
* @param {int} The index of the token type to retrieve. 0 for the
|
848 |
-
* current token, 1 for the next, -1 for the previous, etc.
|
849 |
-
* @return {Object} The token of the token in the given position.
|
850 |
-
* @method LA
|
851 |
-
*/
|
852 |
-
LT: function(index){
|
853 |
-
|
854 |
-
//lookahead first to prime the token buffer
|
855 |
-
this.LA(index);
|
856 |
-
|
857 |
-
//now find the token, subtract one because _ltIndex is already at the next index
|
858 |
-
return this._lt[this._ltIndex+index-1];
|
859 |
-
},
|
860 |
-
|
861 |
-
/**
|
862 |
-
* Returns the token type for the next token in the stream without
|
863 |
-
* consuming it.
|
864 |
-
* @return {int} The token type of the next token in the stream.
|
865 |
-
* @method peek
|
866 |
-
*/
|
867 |
-
peek: function(){
|
868 |
-
return this.LA(1);
|
869 |
-
},
|
870 |
-
|
871 |
-
/**
|
872 |
-
* Returns the actual token object for the last consumed token.
|
873 |
-
* @return {Token} The token object for the last consumed token.
|
874 |
-
* @method token
|
875 |
-
*/
|
876 |
-
token: function(){
|
877 |
-
return this._token;
|
878 |
-
},
|
879 |
-
|
880 |
-
/**
|
881 |
-
* Returns the name of the token for the given token type.
|
882 |
-
* @param {int} tokenType The type of token to get the name of.
|
883 |
-
* @return {String} The name of the token or "UNKNOWN_TOKEN" for any
|
884 |
-
* invalid token type.
|
885 |
-
* @method tokenName
|
886 |
-
*/
|
887 |
-
tokenName: function(tokenType){
|
888 |
-
if (tokenType < 0 || tokenType > this._tokenData.length){
|
889 |
-
return "UNKNOWN_TOKEN";
|
890 |
-
} else {
|
891 |
-
return this._tokenData[tokenType].name;
|
892 |
-
}
|
893 |
-
},
|
894 |
-
|
895 |
-
/**
|
896 |
-
* Returns the token type value for the given token name.
|
897 |
-
* @param {String} tokenName The name of the token whose value should be returned.
|
898 |
-
* @return {int} The token type value for the given token name or -1
|
899 |
-
* for an unknown token.
|
900 |
-
* @method tokenName
|
901 |
-
*/
|
902 |
-
tokenType: function(tokenName){
|
903 |
-
return this._tokenData[tokenName] || -1;
|
904 |
-
},
|
905 |
-
|
906 |
-
/**
|
907 |
-
* Returns the last consumed token to the token stream.
|
908 |
-
* @method unget
|
909 |
-
*/
|
910 |
-
unget: function(){
|
911 |
-
//if (this._ltIndex > -1){
|
912 |
-
if (this._ltIndexCache.length){
|
913 |
-
this._ltIndex -= this._ltIndexCache.pop();//--;
|
914 |
-
this._token = this._lt[this._ltIndex - 1];
|
915 |
-
} else {
|
916 |
-
throw new Error("Too much lookahead.");
|
917 |
-
}
|
918 |
-
}
|
919 |
-
|
920 |
-
};
|
921 |
-
|
922 |
-
|
923 |
-
parserlib.util = {
|
924 |
-
StringReader: StringReader,
|
925 |
-
SyntaxError : SyntaxError,
|
926 |
-
SyntaxUnit : SyntaxUnit,
|
927 |
-
EventTarget : EventTarget,
|
928 |
-
TokenStreamBase : TokenStreamBase
|
929 |
-
};
|
930 |
-
})();
|
931 |
-
/*
|
932 |
-
Parser-Lib
|
933 |
-
Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.
|
934 |
-
|
935 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
936 |
-
of this software and associated documentation files (the "Software"), to deal
|
937 |
-
in the Software without restriction, including without limitation the rights
|
938 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
939 |
-
copies of the Software, and to permit persons to whom the Software is
|
940 |
-
furnished to do so, subject to the following conditions:
|
941 |
-
|
942 |
-
The above copyright notice and this permission notice shall be included in
|
943 |
-
all copies or substantial portions of the Software.
|
944 |
-
|
945 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
946 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
947 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
948 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
949 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
950 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
951 |
-
THE SOFTWARE.
|
952 |
-
|
953 |
-
*/
|
954 |
-
/* Version v0.2.5, Build time: 7-May-2014 03:37:38 */
|
955 |
-
(function(){
|
956 |
-
var EventTarget = parserlib.util.EventTarget,
|
957 |
-
TokenStreamBase = parserlib.util.TokenStreamBase,
|
958 |
-
StringReader = parserlib.util.StringReader,
|
959 |
-
SyntaxError = parserlib.util.SyntaxError,
|
960 |
-
SyntaxUnit = parserlib.util.SyntaxUnit;
|
961 |
-
|
962 |
-
var Colors = {
|
963 |
-
aliceblue :"#f0f8ff",
|
964 |
-
antiquewhite :"#faebd7",
|
965 |
-
aqua :"#00ffff",
|
966 |
-
aquamarine :"#7fffd4",
|
967 |
-
azure :"#f0ffff",
|
968 |
-
beige :"#f5f5dc",
|
969 |
-
bisque :"#ffe4c4",
|
970 |
-
black :"#000000",
|
971 |
-
blanchedalmond :"#ffebcd",
|
972 |
-
blue :"#0000ff",
|
973 |
-
blueviolet :"#8a2be2",
|
974 |
-
brown :"#a52a2a",
|
975 |
-
burlywood :"#deb887",
|
976 |
-
cadetblue :"#5f9ea0",
|
977 |
-
chartreuse :"#7fff00",
|
978 |
-
chocolate :"#d2691e",
|
979 |
-
coral :"#ff7f50",
|
980 |
-
cornflowerblue :"#6495ed",
|
981 |
-
cornsilk :"#fff8dc",
|
982 |
-
crimson :"#dc143c",
|
983 |
-
cyan :"#00ffff",
|
984 |
-
darkblue :"#00008b",
|
985 |
-
darkcyan :"#008b8b",
|
986 |
-
darkgoldenrod :"#b8860b",
|
987 |
-
darkgray :"#a9a9a9",
|
988 |
-
darkgrey :"#a9a9a9",
|
989 |
-
darkgreen :"#006400",
|
990 |
-
darkkhaki :"#bdb76b",
|
991 |
-
darkmagenta :"#8b008b",
|
992 |
-
darkolivegreen :"#556b2f",
|
993 |
-
darkorange :"#ff8c00",
|
994 |
-
darkorchid :"#9932cc",
|
995 |
-
darkred :"#8b0000",
|
996 |
-
darksalmon :"#e9967a",
|
997 |
-
darkseagreen :"#8fbc8f",
|
998 |
-
darkslateblue :"#483d8b",
|
999 |
-
darkslategray :"#2f4f4f",
|
1000 |
-
darkslategrey :"#2f4f4f",
|
1001 |
-
darkturquoise :"#00ced1",
|
1002 |
-
darkviolet :"#9400d3",
|
1003 |
-
deeppink :"#ff1493",
|
1004 |
-
deepskyblue :"#00bfff",
|
1005 |
-
dimgray :"#696969",
|
1006 |
-
dimgrey :"#696969",
|
1007 |
-
dodgerblue :"#1e90ff",
|
1008 |
-
firebrick :"#b22222",
|
1009 |
-
floralwhite :"#fffaf0",
|
1010 |
-
forestgreen :"#228b22",
|
1011 |
-
fuchsia :"#ff00ff",
|
1012 |
-
gainsboro :"#dcdcdc",
|
1013 |
-
ghostwhite :"#f8f8ff",
|
1014 |
-
gold :"#ffd700",
|
1015 |
-
goldenrod :"#daa520",
|
1016 |
-
gray :"#808080",
|
1017 |
-
grey :"#808080",
|
1018 |
-
green :"#008000",
|
1019 |
-
greenyellow :"#adff2f",
|
1020 |
-
honeydew :"#f0fff0",
|
1021 |
-
hotpink :"#ff69b4",
|
1022 |
-
indianred :"#cd5c5c",
|
1023 |
-
indigo :"#4b0082",
|
1024 |
-
ivory :"#fffff0",
|
1025 |
-
khaki :"#f0e68c",
|
1026 |
-
lavender :"#e6e6fa",
|
1027 |
-
lavenderblush :"#fff0f5",
|
1028 |
-
lawngreen :"#7cfc00",
|
1029 |
-
lemonchiffon :"#fffacd",
|
1030 |
-
lightblue :"#add8e6",
|
1031 |
-
lightcoral :"#f08080",
|
1032 |
-
lightcyan :"#e0ffff",
|
1033 |
-
lightgoldenrodyellow :"#fafad2",
|
1034 |
-
lightgray :"#d3d3d3",
|
1035 |
-
lightgrey :"#d3d3d3",
|
1036 |
-
lightgreen :"#90ee90",
|
1037 |
-
lightpink :"#ffb6c1",
|
1038 |
-
lightsalmon :"#ffa07a",
|
1039 |
-
lightseagreen :"#20b2aa",
|
1040 |
-
lightskyblue :"#87cefa",
|
1041 |
-
lightslategray :"#778899",
|
1042 |
-
lightslategrey :"#778899",
|
1043 |
-
lightsteelblue :"#b0c4de",
|
1044 |
-
lightyellow :"#ffffe0",
|
1045 |
-
lime :"#00ff00",
|
1046 |
-
limegreen :"#32cd32",
|
1047 |
-
linen :"#faf0e6",
|
1048 |
-
magenta :"#ff00ff",
|
1049 |
-
maroon :"#800000",
|
1050 |
-
mediumaquamarine:"#66cdaa",
|
1051 |
-
mediumblue :"#0000cd",
|
1052 |
-
mediumorchid :"#ba55d3",
|
1053 |
-
mediumpurple :"#9370d8",
|
1054 |
-
mediumseagreen :"#3cb371",
|
1055 |
-
mediumslateblue :"#7b68ee",
|
1056 |
-
mediumspringgreen :"#00fa9a",
|
1057 |
-
mediumturquoise :"#48d1cc",
|
1058 |
-
mediumvioletred :"#c71585",
|
1059 |
-
midnightblue :"#191970",
|
1060 |
-
mintcream :"#f5fffa",
|
1061 |
-
mistyrose :"#ffe4e1",
|
1062 |
-
moccasin :"#ffe4b5",
|
1063 |
-
navajowhite :"#ffdead",
|
1064 |
-
navy :"#000080",
|
1065 |
-
oldlace :"#fdf5e6",
|
1066 |
-
olive :"#808000",
|
1067 |
-
olivedrab :"#6b8e23",
|
1068 |
-
orange :"#ffa500",
|
1069 |
-
orangered :"#ff4500",
|
1070 |
-
orchid :"#da70d6",
|
1071 |
-
palegoldenrod :"#eee8aa",
|
1072 |
-
palegreen :"#98fb98",
|
1073 |
-
paleturquoise :"#afeeee",
|
1074 |
-
palevioletred :"#d87093",
|
1075 |
-
papayawhip :"#ffefd5",
|
1076 |
-
peachpuff :"#ffdab9",
|
1077 |
-
peru :"#cd853f",
|
1078 |
-
pink :"#ffc0cb",
|
1079 |
-
plum :"#dda0dd",
|
1080 |
-
powderblue :"#b0e0e6",
|
1081 |
-
purple :"#800080",
|
1082 |
-
red :"#ff0000",
|
1083 |
-
rosybrown :"#bc8f8f",
|
1084 |
-
royalblue :"#4169e1",
|
1085 |
-
saddlebrown :"#8b4513",
|
1086 |
-
salmon :"#fa8072",
|
1087 |
-
sandybrown :"#f4a460",
|
1088 |
-
seagreen :"#2e8b57",
|
1089 |
-
seashell :"#fff5ee",
|
1090 |
-
sienna :"#a0522d",
|
1091 |
-
silver :"#c0c0c0",
|
1092 |
-
skyblue :"#87ceeb",
|
1093 |
-
slateblue :"#6a5acd",
|
1094 |
-
slategray :"#708090",
|
1095 |
-
slategrey :"#708090",
|
1096 |
-
snow :"#fffafa",
|
1097 |
-
springgreen :"#00ff7f",
|
1098 |
-
steelblue :"#4682b4",
|
1099 |
-
tan :"#d2b48c",
|
1100 |
-
teal :"#008080",
|
1101 |
-
thistle :"#d8bfd8",
|
1102 |
-
tomato :"#ff6347",
|
1103 |
-
turquoise :"#40e0d0",
|
1104 |
-
violet :"#ee82ee",
|
1105 |
-
wheat :"#f5deb3",
|
1106 |
-
white :"#ffffff",
|
1107 |
-
whitesmoke :"#f5f5f5",
|
1108 |
-
yellow :"#ffff00",
|
1109 |
-
yellowgreen :"#9acd32",
|
1110 |
-
//CSS2 system colors http://www.w3.org/TR/css3-color/#css2-system
|
1111 |
-
activeBorder :"Active window border.",
|
1112 |
-
activecaption :"Active window caption.",
|
1113 |
-
appworkspace :"Background color of multiple document interface.",
|
1114 |
-
background :"Desktop background.",
|
1115 |
-
buttonface :"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.",
|
1116 |
-
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.",
|
1117 |
-
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.",
|
1118 |
-
buttontext :"Text on push buttons.",
|
1119 |
-
captiontext :"Text in caption, size box, and scrollbar arrow box.",
|
1120 |
-
graytext :"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.",
|
1121 |
-
greytext :"Greyed (disabled) text. This color is set to #000 if the current display driver does not support a solid grey color.",
|
1122 |
-
highlight :"Item(s) selected in a control.",
|
1123 |
-
highlighttext :"Text of item(s) selected in a control.",
|
1124 |
-
inactiveborder :"Inactive window border.",
|
1125 |
-
inactivecaption :"Inactive window caption.",
|
1126 |
-
inactivecaptiontext :"Color of text in an inactive caption.",
|
1127 |
-
infobackground :"Background color for tooltip controls.",
|
1128 |
-
infotext :"Text color for tooltip controls.",
|
1129 |
-
menu :"Menu background.",
|
1130 |
-
menutext :"Text in menus.",
|
1131 |
-
scrollbar :"Scroll bar gray area.",
|
1132 |
-
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.",
|
1133 |
-
threedface :"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
|
1134 |
-
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.",
|
1135 |
-
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.",
|
1136 |
-
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.",
|
1137 |
-
window :"Window background.",
|
1138 |
-
windowframe :"Window frame.",
|
1139 |
-
windowtext :"Text in windows."
|
1140 |
-
};
|
1141 |
-
/*global SyntaxUnit, Parser*/
|
1142 |
-
/**
|
1143 |
-
* Represents a selector combinator (whitespace, +, >).
|
1144 |
-
* @namespace parserlib.css
|
1145 |
-
* @class Combinator
|
1146 |
-
* @extends parserlib.util.SyntaxUnit
|
1147 |
-
* @constructor
|
1148 |
-
* @param {String} text The text representation of the unit.
|
1149 |
-
* @param {int} line The line of text on which the unit resides.
|
1150 |
-
* @param {int} col The column of text on which the unit resides.
|
1151 |
-
*/
|
1152 |
-
function Combinator(text, line, col){
|
1153 |
-
|
1154 |
-
SyntaxUnit.call(this, text, line, col, Parser.COMBINATOR_TYPE);
|
1155 |
-
|
1156 |
-
/**
|
1157 |
-
* The type of modifier.
|
1158 |
-
* @type String
|
1159 |
-
* @property type
|
1160 |
-
*/
|
1161 |
-
this.type = "unknown";
|
1162 |
-
|
1163 |
-
//pretty simple
|
1164 |
-
if (/^\s+$/.test(text)){
|
1165 |
-
this.type = "descendant";
|
1166 |
-
} else if (text == ">"){
|
1167 |
-
this.type = "child";
|
1168 |
-
} else if (text == "+"){
|
1169 |
-
this.type = "adjacent-sibling";
|
1170 |
-
} else if (text == "~"){
|
1171 |
-
this.type = "sibling";
|
1172 |
-
}
|
1173 |
-
|
1174 |
-
}
|
1175 |
-
|
1176 |
-
Combinator.prototype = new SyntaxUnit();
|
1177 |
-
Combinator.prototype.constructor = Combinator;
|
1178 |
-
|
1179 |
-
/*global SyntaxUnit, Parser*/
|
1180 |
-
/**
|
1181 |
-
* Represents a media feature, such as max-width:500.
|
1182 |
-
* @namespace parserlib.css
|
1183 |
-
* @class MediaFeature
|
1184 |
-
* @extends parserlib.util.SyntaxUnit
|
1185 |
-
* @constructor
|
1186 |
-
* @param {SyntaxUnit} name The name of the feature.
|
1187 |
-
* @param {SyntaxUnit} value The value of the feature or null if none.
|
1188 |
-
*/
|
1189 |
-
function MediaFeature(name, value){
|
1190 |
-
|
1191 |
-
SyntaxUnit.call(this, "(" + name + (value !== null ? ":" + value : "") + ")", name.startLine, name.startCol, Parser.MEDIA_FEATURE_TYPE);
|
1192 |
-
|
1193 |
-
/**
|
1194 |
-
* The name of the media feature
|
1195 |
-
* @type String
|
1196 |
-
* @property name
|
1197 |
-
*/
|
1198 |
-
this.name = name;
|
1199 |
-
|
1200 |
-
/**
|
1201 |
-
* The value for the feature or null if there is none.
|
1202 |
-
* @type SyntaxUnit
|
1203 |
-
* @property value
|
1204 |
-
*/
|
1205 |
-
this.value = value;
|
1206 |
-
}
|
1207 |
-
|
1208 |
-
MediaFeature.prototype = new SyntaxUnit();
|
1209 |
-
MediaFeature.prototype.constructor = MediaFeature;
|
1210 |
-
|
1211 |
-
/*global SyntaxUnit, Parser*/
|
1212 |
-
/**
|
1213 |
-
* Represents an individual media query.
|
1214 |
-
* @namespace parserlib.css
|
1215 |
-
* @class MediaQuery
|
1216 |
-
* @extends parserlib.util.SyntaxUnit
|
1217 |
-
* @constructor
|
1218 |
-
* @param {String} modifier The modifier "not" or "only" (or null).
|
1219 |
-
* @param {String} mediaType The type of media (i.e., "print").
|
1220 |
-
* @param {Array} parts Array of selectors parts making up this selector.
|
1221 |
-
* @param {int} line The line of text on which the unit resides.
|
1222 |
-
* @param {int} col The column of text on which the unit resides.
|
1223 |
-
*/
|
1224 |
-
function MediaQuery(modifier, mediaType, features, line, col){
|
1225 |
-
|
1226 |
-
SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE);
|
1227 |
-
|
1228 |
-
/**
|
1229 |
-
* The media modifier ("not" or "only")
|
1230 |
-
* @type String
|
1231 |
-
* @property modifier
|
1232 |
-
*/
|
1233 |
-
this.modifier = modifier;
|
1234 |
-
|
1235 |
-
/**
|
1236 |
-
* The mediaType (i.e., "print")
|
1237 |
-
* @type String
|
1238 |
-
* @property mediaType
|
1239 |
-
*/
|
1240 |
-
this.mediaType = mediaType;
|
1241 |
-
|
1242 |
-
/**
|
1243 |
-
* The parts that make up the selector.
|
1244 |
-
* @type Array
|
1245 |
-
* @property features
|
1246 |
-
*/
|
1247 |
-
this.features = features;
|
1248 |
-
|
1249 |
-
}
|
1250 |
-
|
1251 |
-
MediaQuery.prototype = new SyntaxUnit();
|
1252 |
-
MediaQuery.prototype.constructor = MediaQuery;
|
1253 |
-
|
1254 |
-
/*global Tokens, TokenStream, SyntaxError, Properties, Validation, ValidationError, SyntaxUnit,
|
1255 |
-
PropertyValue, PropertyValuePart, SelectorPart, SelectorSubPart, Selector,
|
1256 |
-
PropertyName, Combinator, MediaFeature, MediaQuery, EventTarget */
|
1257 |
-
|
1258 |
-
/**
|
1259 |
-
* A CSS3 parser.
|
1260 |
-
* @namespace parserlib.css
|
1261 |
-
* @class Parser
|
1262 |
-
* @constructor
|
1263 |
-
* @param {Object} options (Optional) Various options for the parser:
|
1264 |
-
* starHack (true|false) to allow IE6 star hack as valid,
|
1265 |
-
* underscoreHack (true|false) to interpret leading underscores
|
1266 |
-
* as IE6-7 targeting for known properties, ieFilters (true|false)
|
1267 |
-
* to indicate that IE < 8 filters should be accepted and not throw
|
1268 |
-
* syntax errors.
|
1269 |
-
*/
|
1270 |
-
function Parser(options){
|
1271 |
-
|
1272 |
-
//inherit event functionality
|
1273 |
-
EventTarget.call(this);
|
1274 |
-
|
1275 |
-
|
1276 |
-
this.options = options || {};
|
1277 |
-
|
1278 |
-
this._tokenStream = null;
|
1279 |
-
}
|
1280 |
-
|
1281 |
-
//Static constants
|
1282 |
-
Parser.DEFAULT_TYPE = 0;
|
1283 |
-
Parser.COMBINATOR_TYPE = 1;
|
1284 |
-
Parser.MEDIA_FEATURE_TYPE = 2;
|
1285 |
-
Parser.MEDIA_QUERY_TYPE = 3;
|
1286 |
-
Parser.PROPERTY_NAME_TYPE = 4;
|
1287 |
-
Parser.PROPERTY_VALUE_TYPE = 5;
|
1288 |
-
Parser.PROPERTY_VALUE_PART_TYPE = 6;
|
1289 |
-
Parser.SELECTOR_TYPE = 7;
|
1290 |
-
Parser.SELECTOR_PART_TYPE = 8;
|
1291 |
-
Parser.SELECTOR_SUB_PART_TYPE = 9;
|
1292 |
-
|
1293 |
-
Parser.prototype = function(){
|
1294 |
-
|
1295 |
-
var proto = new EventTarget(), //new prototype
|
1296 |
-
prop,
|
1297 |
-
additions = {
|
1298 |
-
|
1299 |
-
//restore constructor
|
1300 |
-
constructor: Parser,
|
1301 |
-
|
1302 |
-
//instance constants - yuck
|
1303 |
-
DEFAULT_TYPE : 0,
|
1304 |
-
COMBINATOR_TYPE : 1,
|
1305 |
-
MEDIA_FEATURE_TYPE : 2,
|
1306 |
-
MEDIA_QUERY_TYPE : 3,
|
1307 |
-
PROPERTY_NAME_TYPE : 4,
|
1308 |
-
PROPERTY_VALUE_TYPE : 5,
|
1309 |
-
PROPERTY_VALUE_PART_TYPE : 6,
|
1310 |
-
SELECTOR_TYPE : 7,
|
1311 |
-
SELECTOR_PART_TYPE : 8,
|
1312 |
-
SELECTOR_SUB_PART_TYPE : 9,
|
1313 |
-
|
1314 |
-
//-----------------------------------------------------------------
|
1315 |
-
// Grammar
|
1316 |
-
//-----------------------------------------------------------------
|
1317 |
-
|
1318 |
-
_stylesheet: function(){
|
1319 |
-
|
1320 |
-
/*
|
1321 |
-
* stylesheet
|
1322 |
-
* : [ CHARSET_SYM S* STRING S* ';' ]?
|
1323 |
-
* [S|CDO|CDC]* [ import [S|CDO|CDC]* ]*
|
1324 |
-
* [ namespace [S|CDO|CDC]* ]*
|
1325 |
-
* [ [ ruleset | media | page | font_face | keyframes ] [S|CDO|CDC]* ]*
|
1326 |
-
* ;
|
1327 |
-
*/
|
1328 |
-
|
1329 |
-
var tokenStream = this._tokenStream,
|
1330 |
-
charset = null,
|
1331 |
-
count,
|
1332 |
-
token,
|
1333 |
-
tt;
|
1334 |
-
|
1335 |
-
this.fire("startstylesheet");
|
1336 |
-
|
1337 |
-
//try to read character set
|
1338 |
-
this._charset();
|
1339 |
-
|
1340 |
-
this._skipCruft();
|
1341 |
-
|
1342 |
-
//try to read imports - may be more than one
|
1343 |
-
while (tokenStream.peek() == Tokens.IMPORT_SYM){
|
1344 |
-
this._import();
|
1345 |
-
this._skipCruft();
|
1346 |
-
}
|
1347 |
-
|
1348 |
-
//try to read namespaces - may be more than one
|
1349 |
-
while (tokenStream.peek() == Tokens.NAMESPACE_SYM){
|
1350 |
-
this._namespace();
|
1351 |
-
this._skipCruft();
|
1352 |
-
}
|
1353 |
-
|
1354 |
-
//get the next token
|
1355 |
-
tt = tokenStream.peek();
|
1356 |
-
|
1357 |
-
//try to read the rest
|
1358 |
-
while(tt > Tokens.EOF){
|
1359 |
-
|
1360 |
-
try {
|
1361 |
-
|
1362 |
-
switch(tt){
|
1363 |
-
case Tokens.MEDIA_SYM:
|
1364 |
-
this._media();
|
1365 |
-
this._skipCruft();
|
1366 |
-
break;
|
1367 |
-
case Tokens.PAGE_SYM:
|
1368 |
-
this._page();
|
1369 |
-
this._skipCruft();
|
1370 |
-
break;
|
1371 |
-
case Tokens.FONT_FACE_SYM:
|
1372 |
-
this._font_face();
|
1373 |
-
this._skipCruft();
|
1374 |
-
break;
|
1375 |
-
case Tokens.KEYFRAMES_SYM:
|
1376 |
-
this._keyframes();
|
1377 |
-
this._skipCruft();
|
1378 |
-
break;
|
1379 |
-
case Tokens.VIEWPORT_SYM:
|
1380 |
-
this._viewport();
|
1381 |
-
this._skipCruft();
|
1382 |
-
break;
|
1383 |
-
case Tokens.UNKNOWN_SYM: //unknown @ rule
|
1384 |
-
tokenStream.get();
|
1385 |
-
if (!this.options.strict){
|
1386 |
-
|
1387 |
-
//fire error event
|
1388 |
-
this.fire({
|
1389 |
-
type: "error",
|
1390 |
-
error: null,
|
1391 |
-
message: "Unknown @ rule: " + tokenStream.LT(0).value + ".",
|
1392 |
-
line: tokenStream.LT(0).startLine,
|
1393 |
-
col: tokenStream.LT(0).startCol
|
1394 |
-
});
|
1395 |
-
|
1396 |
-
//skip braces
|
1397 |
-
count=0;
|
1398 |
-
while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) == Tokens.LBRACE){
|
1399 |
-
count++; //keep track of nesting depth
|
1400 |
-
}
|
1401 |
-
|
1402 |
-
while(count){
|
1403 |
-
tokenStream.advance([Tokens.RBRACE]);
|
1404 |
-
count--;
|
1405 |
-
}
|
1406 |
-
|
1407 |
-
} else {
|
1408 |
-
//not a syntax error, rethrow it
|
1409 |
-
throw new SyntaxError("Unknown @ rule.", tokenStream.LT(0).startLine, tokenStream.LT(0).startCol);
|
1410 |
-
}
|
1411 |
-
break;
|
1412 |
-
case Tokens.S:
|
1413 |
-
this._readWhitespace();
|
1414 |
-
break;
|
1415 |
-
default:
|
1416 |
-
if(!this._ruleset()){
|
1417 |
-
|
1418 |
-
//error handling for known issues
|
1419 |
-
switch(tt){
|
1420 |
-
case Tokens.CHARSET_SYM:
|
1421 |
-
token = tokenStream.LT(1);
|
1422 |
-
this._charset(false);
|
1423 |
-
throw new SyntaxError("@charset not allowed here.", token.startLine, token.startCol);
|
1424 |
-
case Tokens.IMPORT_SYM:
|
1425 |
-
token = tokenStream.LT(1);
|
1426 |
-
this._import(false);
|
1427 |
-
throw new SyntaxError("@import not allowed here.", token.startLine, token.startCol);
|
1428 |
-
case Tokens.NAMESPACE_SYM:
|
1429 |
-
token = tokenStream.LT(1);
|
1430 |
-
this._namespace(false);
|
1431 |
-
throw new SyntaxError("@namespace not allowed here.", token.startLine, token.startCol);
|
1432 |
-
default:
|
1433 |
-
tokenStream.get(); //get the last token
|
1434 |
-
this._unexpectedToken(tokenStream.token());
|
1435 |
-
}
|
1436 |
-
|
1437 |
-
}
|
1438 |
-
}
|
1439 |
-
} catch(ex) {
|
1440 |
-
if (ex instanceof SyntaxError && !this.options.strict){
|
1441 |
-
this.fire({
|
1442 |
-
type: "error",
|
1443 |
-
error: ex,
|
1444 |
-
message: ex.message,
|
1445 |
-
line: ex.line,
|
1446 |
-
col: ex.col
|
1447 |
-
});
|
1448 |
-
} else {
|
1449 |
-
throw ex;
|
1450 |
-
}
|
1451 |
-
}
|
1452 |
-
|
1453 |
-
tt = tokenStream.peek();
|
1454 |
-
}
|
1455 |
-
|
1456 |
-
if (tt != Tokens.EOF){
|
1457 |
-
this._unexpectedToken(tokenStream.token());
|
1458 |
-
}
|
1459 |
-
|
1460 |
-
this.fire("endstylesheet");
|
1461 |
-
},
|
1462 |
-
|
1463 |
-
_charset: function(emit){
|
1464 |
-
var tokenStream = this._tokenStream,
|
1465 |
-
charset,
|
1466 |
-
token,
|
1467 |
-
line,
|
1468 |
-
col;
|
1469 |
-
|
1470 |
-
if (tokenStream.match(Tokens.CHARSET_SYM)){
|
1471 |
-
line = tokenStream.token().startLine;
|
1472 |
-
col = tokenStream.token().startCol;
|
1473 |
-
|
1474 |
-
this._readWhitespace();
|
1475 |
-
tokenStream.mustMatch(Tokens.STRING);
|
1476 |
-
|
1477 |
-
token = tokenStream.token();
|
1478 |
-
charset = token.value;
|
1479 |
-
|
1480 |
-
this._readWhitespace();
|
1481 |
-
tokenStream.mustMatch(Tokens.SEMICOLON);
|
1482 |
-
|
1483 |
-
if (emit !== false){
|
1484 |
-
this.fire({
|
1485 |
-
type: "charset",
|
1486 |
-
charset:charset,
|
1487 |
-
line: line,
|
1488 |
-
col: col
|
1489 |
-
});
|
1490 |
-
}
|
1491 |
-
}
|
1492 |
-
},
|
1493 |
-
|
1494 |
-
_import: function(emit){
|
1495 |
-
/*
|
1496 |
-
* import
|
1497 |
-
* : IMPORT_SYM S*
|
1498 |
-
* [STRING|URI] S* media_query_list? ';' S*
|
1499 |
-
*/
|
1500 |
-
|
1501 |
-
var tokenStream = this._tokenStream,
|
1502 |
-
tt,
|
1503 |
-
uri,
|
1504 |
-
importToken,
|
1505 |
-
mediaList = [];
|
1506 |
-
|
1507 |
-
//read import symbol
|
1508 |
-
tokenStream.mustMatch(Tokens.IMPORT_SYM);
|
1509 |
-
importToken = tokenStream.token();
|
1510 |
-
this._readWhitespace();
|
1511 |
-
|
1512 |
-
tokenStream.mustMatch([Tokens.STRING, Tokens.URI]);
|
1513 |
-
|
1514 |
-
//grab the URI value
|
1515 |
-
uri = tokenStream.token().value.replace(/^(?:url\()?["']?([^"']+?)["']?\)?$/, "$1");
|
1516 |
-
|
1517 |
-
this._readWhitespace();
|
1518 |
-
|
1519 |
-
mediaList = this._media_query_list();
|
1520 |
-
|
1521 |
-
//must end with a semicolon
|
1522 |
-
tokenStream.mustMatch(Tokens.SEMICOLON);
|
1523 |
-
this._readWhitespace();
|
1524 |
-
|
1525 |
-
if (emit !== false){
|
1526 |
-
this.fire({
|
1527 |
-
type: "import",
|
1528 |
-
uri: uri,
|
1529 |
-
media: mediaList,
|
1530 |
-
line: importToken.startLine,
|
1531 |
-
col: importToken.startCol
|
1532 |
-
});
|
1533 |
-
}
|
1534 |
-
|
1535 |
-
},
|
1536 |
-
|
1537 |
-
_namespace: function(emit){
|
1538 |
-
/*
|
1539 |
-
* namespace
|
1540 |
-
* : NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S*
|
1541 |
-
*/
|
1542 |
-
|
1543 |
-
var tokenStream = this._tokenStream,
|
1544 |
-
line,
|
1545 |
-
col,
|
1546 |
-
prefix,
|
1547 |
-
uri;
|
1548 |
-
|
1549 |
-
//read import symbol
|
1550 |
-
tokenStream.mustMatch(Tokens.NAMESPACE_SYM);
|
1551 |
-
line = tokenStream.token().startLine;
|
1552 |
-
col = tokenStream.token().startCol;
|
1553 |
-
this._readWhitespace();
|
1554 |
-
|
1555 |
-
//it's a namespace prefix - no _namespace_prefix() method because it's just an IDENT
|
1556 |
-
if (tokenStream.match(Tokens.IDENT)){
|
1557 |
-
prefix = tokenStream.token().value;
|
1558 |
-
this._readWhitespace();
|
1559 |
-
}
|
1560 |
-
|
1561 |
-
tokenStream.mustMatch([Tokens.STRING, Tokens.URI]);
|
1562 |
-
/*if (!tokenStream.match(Tokens.STRING)){
|
1563 |
-
tokenStream.mustMatch(Tokens.URI);
|
1564 |
-
}*/
|
1565 |
-
|
1566 |
-
//grab the URI value
|
1567 |
-
uri = tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/, "$1");
|
1568 |
-
|
1569 |
-
this._readWhitespace();
|
1570 |
-
|
1571 |
-
//must end with a semicolon
|
1572 |
-
tokenStream.mustMatch(Tokens.SEMICOLON);
|
1573 |
-
this._readWhitespace();
|
1574 |
-
|
1575 |
-
if (emit !== false){
|
1576 |
-
this.fire({
|
1577 |
-
type: "namespace",
|
1578 |
-
prefix: prefix,
|
1579 |
-
uri: uri,
|
1580 |
-
line: line,
|
1581 |
-
col: col
|
1582 |
-
});
|
1583 |
-
}
|
1584 |
-
|
1585 |
-
},
|
1586 |
-
|
1587 |
-
_media: function(){
|
1588 |
-
/*
|
1589 |
-
* media
|
1590 |
-
* : MEDIA_SYM S* media_query_list S* '{' S* ruleset* '}' S*
|
1591 |
-
* ;
|
1592 |
-
*/
|
1593 |
-
var tokenStream = this._tokenStream,
|
1594 |
-
line,
|
1595 |
-
col,
|
1596 |
-
mediaList;// = [];
|
1597 |
-
|
1598 |
-
//look for @media
|
1599 |
-
tokenStream.mustMatch(Tokens.MEDIA_SYM);
|
1600 |
-
line = tokenStream.token().startLine;
|
1601 |
-
col = tokenStream.token().startCol;
|
1602 |
-
|
1603 |
-
this._readWhitespace();
|
1604 |
-
|
1605 |
-
mediaList = this._media_query_list();
|
1606 |
-
|
1607 |
-
tokenStream.mustMatch(Tokens.LBRACE);
|
1608 |
-
this._readWhitespace();
|
1609 |
-
|
1610 |
-
this.fire({
|
1611 |
-
type: "startmedia",
|
1612 |
-
media: mediaList,
|
1613 |
-
line: line,
|
1614 |
-
col: col
|
1615 |
-
});
|
1616 |
-
|
1617 |
-
while(true) {
|
1618 |
-
if (tokenStream.peek() == Tokens.PAGE_SYM){
|
1619 |
-
this._page();
|
1620 |
-
} else if (tokenStream.peek() == Tokens.FONT_FACE_SYM){
|
1621 |
-
this._font_face();
|
1622 |
-
} else if (tokenStream.peek() == Tokens.VIEWPORT_SYM){
|
1623 |
-
this._viewport();
|
1624 |
-
} else if (!this._ruleset()){
|
1625 |
-
break;
|
1626 |
-
}
|
1627 |
-
}
|
1628 |
-
|
1629 |
-
tokenStream.mustMatch(Tokens.RBRACE);
|
1630 |
-
this._readWhitespace();
|
1631 |
-
|
1632 |
-
this.fire({
|
1633 |
-
type: "endmedia",
|
1634 |
-
media: mediaList,
|
1635 |
-
line: line,
|
1636 |
-
col: col
|
1637 |
-
});
|
1638 |
-
},
|
1639 |
-
|
1640 |
-
|
1641 |
-
//CSS3 Media Queries
|
1642 |
-
_media_query_list: function(){
|
1643 |
-
/*
|
1644 |
-
* media_query_list
|
1645 |
-
* : S* [media_query [ ',' S* media_query ]* ]?
|
1646 |
-
* ;
|
1647 |
-
*/
|
1648 |
-
var tokenStream = this._tokenStream,
|
1649 |
-
mediaList = [];
|
1650 |
-
|
1651 |
-
|
1652 |
-
this._readWhitespace();
|
1653 |
-
|
1654 |
-
if (tokenStream.peek() == Tokens.IDENT || tokenStream.peek() == Tokens.LPAREN){
|
1655 |
-
mediaList.push(this._media_query());
|
1656 |
-
}
|
1657 |
-
|
1658 |
-
while(tokenStream.match(Tokens.COMMA)){
|
1659 |
-
this._readWhitespace();
|
1660 |
-
mediaList.push(this._media_query());
|
1661 |
-
}
|
1662 |
-
|
1663 |
-
return mediaList;
|
1664 |
-
},
|
1665 |
-
|
1666 |
-
/*
|
1667 |
-
* Note: "expression" in the grammar maps to the _media_expression
|
1668 |
-
* method.
|
1669 |
-
|
1670 |
-
*/
|
1671 |
-
_media_query: function(){
|
1672 |
-
/*
|
1673 |
-
* media_query
|
1674 |
-
* : [ONLY | NOT]? S* media_type S* [ AND S* expression ]*
|
1675 |
-
* | expression [ AND S* expression ]*
|
1676 |
-
* ;
|
1677 |
-
*/
|
1678 |
-
var tokenStream = this._tokenStream,
|
1679 |
-
type = null,
|
1680 |
-
ident = null,
|
1681 |
-
token = null,
|
1682 |
-
expressions = [];
|
1683 |
-
|
1684 |
-
if (tokenStream.match(Tokens.IDENT)){
|
1685 |
-
ident = tokenStream.token().value.toLowerCase();
|
1686 |
-
|
1687 |
-
//since there's no custom tokens for these, need to manually check
|
1688 |
-
if (ident != "only" && ident != "not"){
|
1689 |
-
tokenStream.unget();
|
1690 |
-
ident = null;
|
1691 |
-
} else {
|
1692 |
-
token = tokenStream.token();
|
1693 |
-
}
|
1694 |
-
}
|
1695 |
-
|
1696 |
-
this._readWhitespace();
|
1697 |
-
|
1698 |
-
if (tokenStream.peek() == Tokens.IDENT){
|
1699 |
-
type = this._media_type();
|
1700 |
-
if (token === null){
|
1701 |
-
token = tokenStream.token();
|
1702 |
-
}
|
1703 |
-
} else if (tokenStream.peek() == Tokens.LPAREN){
|
1704 |
-
if (token === null){
|
1705 |
-
token = tokenStream.LT(1);
|
1706 |
-
}
|
1707 |
-
expressions.push(this._media_expression());
|
1708 |
-
}
|
1709 |
-
|
1710 |
-
if (type === null && expressions.length === 0){
|
1711 |
-
return null;
|
1712 |
-
} else {
|
1713 |
-
this._readWhitespace();
|
1714 |
-
while (tokenStream.match(Tokens.IDENT)){
|
1715 |
-
if (tokenStream.token().value.toLowerCase() != "and"){
|
1716 |
-
this._unexpectedToken(tokenStream.token());
|
1717 |
-
}
|
1718 |
-
|
1719 |
-
this._readWhitespace();
|
1720 |
-
expressions.push(this._media_expression());
|
1721 |
-
}
|
1722 |
-
}
|
1723 |
-
|
1724 |
-
return new MediaQuery(ident, type, expressions, token.startLine, token.startCol);
|
1725 |
-
},
|
1726 |
-
|
1727 |
-
//CSS3 Media Queries
|
1728 |
-
_media_type: function(){
|
1729 |
-
/*
|
1730 |
-
* media_type
|
1731 |
-
* : IDENT
|
1732 |
-
* ;
|
1733 |
-
*/
|
1734 |
-
return this._media_feature();
|
1735 |
-
},
|
1736 |
-
|
1737 |
-
/**
|
1738 |
-
* Note: in CSS3 Media Queries, this is called "expression".
|
1739 |
-
* Renamed here to avoid conflict with CSS3 Selectors
|
1740 |
-
* definition of "expression". Also note that "expr" in the
|
1741 |
-
* grammar now maps to "expression" from CSS3 selectors.
|
1742 |
-
* @method _media_expression
|
1743 |
-
* @private
|
1744 |
-
*/
|
1745 |
-
_media_expression: function(){
|
1746 |
-
/*
|
1747 |
-
* expression
|
1748 |
-
* : '(' S* media_feature S* [ ':' S* expr ]? ')' S*
|
1749 |
-
* ;
|
1750 |
-
*/
|
1751 |
-
var tokenStream = this._tokenStream,
|
1752 |
-
feature = null,
|
1753 |
-
token,
|
1754 |
-
expression = null;
|
1755 |
-
|
1756 |
-
tokenStream.mustMatch(Tokens.LPAREN);
|
1757 |
-
|
1758 |
-
feature = this._media_feature();
|
1759 |
-
this._readWhitespace();
|
1760 |
-
|
1761 |
-
if (tokenStream.match(Tokens.COLON)){
|
1762 |
-
this._readWhitespace();
|
1763 |
-
token = tokenStream.LT(1);
|
1764 |
-
expression = this._expression();
|
1765 |
-
}
|
1766 |
-
|
1767 |
-
tokenStream.mustMatch(Tokens.RPAREN);
|
1768 |
-
this._readWhitespace();
|
1769 |
-
|
1770 |
-
return new MediaFeature(feature, (expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null));
|
1771 |
-
},
|
1772 |
-
|
1773 |
-
//CSS3 Media Queries
|
1774 |
-
_media_feature: function(){
|
1775 |
-
/*
|
1776 |
-
* media_feature
|
1777 |
-
* : IDENT
|
1778 |
-
* ;
|
1779 |
-
*/
|
1780 |
-
var tokenStream = this._tokenStream;
|
1781 |
-
|
1782 |
-
tokenStream.mustMatch(Tokens.IDENT);
|
1783 |
-
|
1784 |
-
return SyntaxUnit.fromToken(tokenStream.token());
|
1785 |
-
},
|
1786 |
-
|
1787 |
-
//CSS3 Paged Media
|
1788 |
-
_page: function(){
|
1789 |
-
/*
|
1790 |
-
* page:
|
1791 |
-
* PAGE_SYM S* IDENT? pseudo_page? S*
|
1792 |
-
* '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S*
|
1793 |
-
* ;
|
1794 |
-
*/
|
1795 |
-
var tokenStream = this._tokenStream,
|
1796 |
-
line,
|
1797 |
-
col,
|
1798 |
-
identifier = null,
|
1799 |
-
pseudoPage = null;
|
1800 |
-
|
1801 |
-
//look for @page
|
1802 |
-
tokenStream.mustMatch(Tokens.PAGE_SYM);
|
1803 |
-
line = tokenStream.token().startLine;
|
1804 |
-
col = tokenStream.token().startCol;
|
1805 |
-
|
1806 |
-
this._readWhitespace();
|
1807 |
-
|
1808 |
-
if (tokenStream.match(Tokens.IDENT)){
|
1809 |
-
identifier = tokenStream.token().value;
|
1810 |
-
|
1811 |
-
//The value 'auto' may not be used as a page name and MUST be treated as a syntax error.
|
1812 |
-
if (identifier.toLowerCase() === "auto"){
|
1813 |
-
this._unexpectedToken(tokenStream.token());
|
1814 |
-
}
|
1815 |
-
}
|
1816 |
-
|
1817 |
-
//see if there's a colon upcoming
|
1818 |
-
if (tokenStream.peek() == Tokens.COLON){
|
1819 |
-
pseudoPage = this._pseudo_page();
|
1820 |
-
}
|
1821 |
-
|
1822 |
-
this._readWhitespace();
|
1823 |
-
|
1824 |
-
this.fire({
|
1825 |
-
type: "startpage",
|
1826 |
-
id: identifier,
|
1827 |
-
pseudo: pseudoPage,
|
1828 |
-
line: line,
|
1829 |
-
col: col
|
1830 |
-
});
|
1831 |
-
|
1832 |
-
this._readDeclarations(true, true);
|
1833 |
-
|
1834 |
-
this.fire({
|
1835 |
-
type: "endpage",
|
1836 |
-
id: identifier,
|
1837 |
-
pseudo: pseudoPage,
|
1838 |
-
line: line,
|
1839 |
-
col: col
|
1840 |
-
});
|
1841 |
-
|
1842 |
-
},
|
1843 |
-
|
1844 |
-
//CSS3 Paged Media
|
1845 |
-
_margin: function(){
|
1846 |
-
/*
|
1847 |
-
* margin :
|
1848 |
-
* margin_sym S* '{' declaration [ ';' S* declaration? ]* '}' S*
|
1849 |
-
* ;
|
1850 |
-
*/
|
1851 |
-
var tokenStream = this._tokenStream,
|
1852 |
-
line,
|
1853 |
-
col,
|
1854 |
-
marginSym = this._margin_sym();
|
1855 |
-
|
1856 |
-
if (marginSym){
|
1857 |
-
line = tokenStream.token().startLine;
|
1858 |
-
col = tokenStream.token().startCol;
|
1859 |
-
|
1860 |
-
this.fire({
|
1861 |
-
type: "startpagemargin",
|
1862 |
-
margin: marginSym,
|
1863 |
-
line: line,
|
1864 |
-
col: col
|
1865 |
-
});
|
1866 |
-
|
1867 |
-
this._readDeclarations(true);
|
1868 |
-
|
1869 |
-
this.fire({
|
1870 |
-
type: "endpagemargin",
|
1871 |
-
margin: marginSym,
|
1872 |
-
line: line,
|
1873 |
-
col: col
|
1874 |
-
});
|
1875 |
-
return true;
|
1876 |
-
} else {
|
1877 |
-
return false;
|
1878 |
-
}
|
1879 |
-
},
|
1880 |
-
|
1881 |
-
//CSS3 Paged Media
|
1882 |
-
_margin_sym: function(){
|
1883 |
-
|
1884 |
-
/*
|
1885 |
-
* margin_sym :
|
1886 |
-
* TOPLEFTCORNER_SYM |
|
1887 |
-
* TOPLEFT_SYM |
|
1888 |
-
* TOPCENTER_SYM |
|
1889 |
-
* TOPRIGHT_SYM |
|
1890 |
-
* TOPRIGHTCORNER_SYM |
|
1891 |
-
* BOTTOMLEFTCORNER_SYM |
|
1892 |
-
* BOTTOMLEFT_SYM |
|
1893 |
-
* BOTTOMCENTER_SYM |
|
1894 |
-
* BOTTOMRIGHT_SYM |
|
1895 |
-
* BOTTOMRIGHTCORNER_SYM |
|
1896 |
-
* LEFTTOP_SYM |
|
1897 |
-
* LEFTMIDDLE_SYM |
|
1898 |
-
* LEFTBOTTOM_SYM |
|
1899 |
-
* RIGHTTOP_SYM |
|
1900 |
-
* RIGHTMIDDLE_SYM |
|
1901 |
-
* RIGHTBOTTOM_SYM
|
1902 |
-
* ;
|
1903 |
-
*/
|
1904 |
-
|
1905 |
-
var tokenStream = this._tokenStream;
|
1906 |
-
|
1907 |
-
if(tokenStream.match([Tokens.TOPLEFTCORNER_SYM, Tokens.TOPLEFT_SYM,
|
1908 |
-
Tokens.TOPCENTER_SYM, Tokens.TOPRIGHT_SYM, Tokens.TOPRIGHTCORNER_SYM,
|
1909 |
-
Tokens.BOTTOMLEFTCORNER_SYM, Tokens.BOTTOMLEFT_SYM,
|
1910 |
-
Tokens.BOTTOMCENTER_SYM, Tokens.BOTTOMRIGHT_SYM,
|
1911 |
-
Tokens.BOTTOMRIGHTCORNER_SYM, Tokens.LEFTTOP_SYM,
|
1912 |
-
Tokens.LEFTMIDDLE_SYM, Tokens.LEFTBOTTOM_SYM, Tokens.RIGHTTOP_SYM,
|
1913 |
-
Tokens.RIGHTMIDDLE_SYM, Tokens.RIGHTBOTTOM_SYM]))
|
1914 |
-
{
|
1915 |
-
return SyntaxUnit.fromToken(tokenStream.token());
|
1916 |
-
} else {
|
1917 |
-
return null;
|
1918 |
-
}
|
1919 |
-
|
1920 |
-
},
|
1921 |
-
|
1922 |
-
_pseudo_page: function(){
|
1923 |
-
/*
|
1924 |
-
* pseudo_page
|
1925 |
-
* : ':' IDENT
|
1926 |
-
* ;
|
1927 |
-
*/
|
1928 |
-
|
1929 |
-
var tokenStream = this._tokenStream;
|
1930 |
-
|
1931 |
-
tokenStream.mustMatch(Tokens.COLON);
|
1932 |
-
tokenStream.mustMatch(Tokens.IDENT);
|
1933 |
-
|
1934 |
-
//TODO: CSS3 Paged Media says only "left", "center", and "right" are allowed
|
1935 |
-
|
1936 |
-
return tokenStream.token().value;
|
1937 |
-
},
|
1938 |
-
|
1939 |
-
_font_face: function(){
|
1940 |
-
/*
|
1941 |
-
* font_face
|
1942 |
-
* : FONT_FACE_SYM S*
|
1943 |
-
* '{' S* declaration [ ';' S* declaration ]* '}' S*
|
1944 |
-
* ;
|
1945 |
-
*/
|
1946 |
-
var tokenStream = this._tokenStream,
|
1947 |
-
line,
|
1948 |
-
col;
|
1949 |
-
|
1950 |
-
//look for @page
|
1951 |
-
tokenStream.mustMatch(Tokens.FONT_FACE_SYM);
|
1952 |
-
line = tokenStream.token().startLine;
|
1953 |
-
col = tokenStream.token().startCol;
|
1954 |
-
|
1955 |
-
this._readWhitespace();
|
1956 |
-
|
1957 |
-
this.fire({
|
1958 |
-
type: "startfontface",
|
1959 |
-
line: line,
|
1960 |
-
col: col
|
1961 |
-
});
|
1962 |
-
|
1963 |
-
this._readDeclarations(true);
|
1964 |
-
|
1965 |
-
this.fire({
|
1966 |
-
type: "endfontface",
|
1967 |
-
line: line,
|
1968 |
-
col: col
|
1969 |
-
});
|
1970 |
-
},
|
1971 |
-
|
1972 |
-
_viewport: function(){
|
1973 |
-
/*
|
1974 |
-
* viewport
|
1975 |
-
* : VIEWPORT_SYM S*
|
1976 |
-
* '{' S* declaration? [ ';' S* declaration? ]* '}' S*
|
1977 |
-
* ;
|
1978 |
-
*/
|
1979 |
-
var tokenStream = this._tokenStream,
|
1980 |
-
line,
|
1981 |
-
col;
|
1982 |
-
|
1983 |
-
tokenStream.mustMatch(Tokens.VIEWPORT_SYM);
|
1984 |
-
line = tokenStream.token().startLine;
|
1985 |
-
col = tokenStream.token().startCol;
|
1986 |
-
|
1987 |
-
this._readWhitespace();
|
1988 |
-
|
1989 |
-
this.fire({
|
1990 |
-
type: "startviewport",
|
1991 |
-
line: line,
|
1992 |
-
col: col
|
1993 |
-
});
|
1994 |
-
|
1995 |
-
this._readDeclarations(true);
|
1996 |
-
|
1997 |
-
this.fire({
|
1998 |
-
type: "endviewport",
|
1999 |
-
line: line,
|
2000 |
-
col: col
|
2001 |
-
});
|
2002 |
-
|
2003 |
-
},
|
2004 |
-
|
2005 |
-
_operator: function(inFunction){
|
2006 |
-
|
2007 |
-
/*
|
2008 |
-
* operator (outside function)
|
2009 |
-
* : '/' S* | ',' S* | /( empty )/
|
2010 |
-
* operator (inside function)
|
2011 |
-
* : '/' S* | '+' S* | '*' S* | '-' S* /( empty )/
|
2012 |
-
* ;
|
2013 |
-
*/
|
2014 |
-
|
2015 |
-
var tokenStream = this._tokenStream,
|
2016 |
-
token = null;
|
2017 |
-
|
2018 |
-
if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) ||
|
2019 |
-
(inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS]))){
|
2020 |
-
token = tokenStream.token();
|
2021 |
-
this._readWhitespace();
|
2022 |
-
}
|
2023 |
-
return token ? PropertyValuePart.fromToken(token) : null;
|
2024 |
-
|
2025 |
-
},
|
2026 |
-
|
2027 |
-
_combinator: function(){
|
2028 |
-
|
2029 |
-
/*
|
2030 |
-
* combinator
|
2031 |
-
* : PLUS S* | GREATER S* | TILDE S* | S+
|
2032 |
-
* ;
|
2033 |
-
*/
|
2034 |
-
|
2035 |
-
var tokenStream = this._tokenStream,
|
2036 |
-
value = null,
|
2037 |
-
token;
|
2038 |
-
|
2039 |
-
if(tokenStream.match([Tokens.PLUS, Tokens.GREATER, Tokens.TILDE])){
|
2040 |
-
token = tokenStream.token();
|
2041 |
-
value = new Combinator(token.value, token.startLine, token.startCol);
|
2042 |
-
this._readWhitespace();
|
2043 |
-
}
|
2044 |
-
|
2045 |
-
return value;
|
2046 |
-
},
|
2047 |
-
|
2048 |
-
_unary_operator: function(){
|
2049 |
-
|
2050 |
-
/*
|
2051 |
-
* unary_operator
|
2052 |
-
* : '-' | '+'
|
2053 |
-
* ;
|
2054 |
-
*/
|
2055 |
-
|
2056 |
-
var tokenStream = this._tokenStream;
|
2057 |
-
|
2058 |
-
if (tokenStream.match([Tokens.MINUS, Tokens.PLUS])){
|
2059 |
-
return tokenStream.token().value;
|
2060 |
-
} else {
|
2061 |
-
return null;
|
2062 |
-
}
|
2063 |
-
},
|
2064 |
-
|
2065 |
-
_property: function(){
|
2066 |
-
|
2067 |
-
/*
|
2068 |
-
* property
|
2069 |
-
* : IDENT S*
|
2070 |
-
* ;
|
2071 |
-
*/
|
2072 |
-
|
2073 |
-
var tokenStream = this._tokenStream,
|
2074 |
-
value = null,
|
2075 |
-
hack = null,
|
2076 |
-
tokenValue,
|
2077 |
-
token,
|
2078 |
-
line,
|
2079 |
-
col;
|
2080 |
-
|
2081 |
-
//check for star hack - throws error if not allowed
|
2082 |
-
if (tokenStream.peek() == Tokens.STAR && this.options.starHack){
|
2083 |
-
tokenStream.get();
|
2084 |
-
token = tokenStream.token();
|
2085 |
-
hack = token.value;
|
2086 |
-
line = token.startLine;
|
2087 |
-
col = token.startCol;
|
2088 |
-
}
|
2089 |
-
|
2090 |
-
if(tokenStream.match(Tokens.IDENT)){
|
2091 |
-
token = tokenStream.token();
|
2092 |
-
tokenValue = token.value;
|
2093 |
-
|
2094 |
-
//check for underscore hack - no error if not allowed because it's valid CSS syntax
|
2095 |
-
if (tokenValue.charAt(0) == "_" && this.options.underscoreHack){
|
2096 |
-
hack = "_";
|
2097 |
-
tokenValue = tokenValue.substring(1);
|
2098 |
-
}
|
2099 |
-
|
2100 |
-
value = new PropertyName(tokenValue, hack, (line||token.startLine), (col||token.startCol));
|
2101 |
-
this._readWhitespace();
|
2102 |
-
}
|
2103 |
-
|
2104 |
-
return value;
|
2105 |
-
},
|
2106 |
-
|
2107 |
-
//Augmented with CSS3 Selectors
|
2108 |
-
_ruleset: function(){
|
2109 |
-
/*
|
2110 |
-
* ruleset
|
2111 |
-
* : selectors_group
|
2112 |
-
* '{' S* declaration? [ ';' S* declaration? ]* '}' S*
|
2113 |
-
* ;
|
2114 |
-
*/
|
2115 |
-
|
2116 |
-
var tokenStream = this._tokenStream,
|
2117 |
-
tt,
|
2118 |
-
selectors;
|
2119 |
-
|
2120 |
-
|
2121 |
-
/*
|
2122 |
-
* Error Recovery: If even a single selector fails to parse,
|
2123 |
-
* then the entire ruleset should be thrown away.
|
2124 |
-
*/
|
2125 |
-
try {
|
2126 |
-
selectors = this._selectors_group();
|
2127 |
-
} catch (ex){
|
2128 |
-
if (ex instanceof SyntaxError && !this.options.strict){
|
2129 |
-
|
2130 |
-
//fire error event
|
2131 |
-
this.fire({
|
2132 |
-
type: "error",
|
2133 |
-
error: ex,
|
2134 |
-
message: ex.message,
|
2135 |
-
line: ex.line,
|
2136 |
-
col: ex.col
|
2137 |
-
});
|
2138 |
-
|
2139 |
-
//skip over everything until closing brace
|
2140 |
-
tt = tokenStream.advance([Tokens.RBRACE]);
|
2141 |
-
if (tt == Tokens.RBRACE){
|
2142 |
-
//if there's a right brace, the rule is finished so don't do anything
|
2143 |
-
} else {
|
2144 |
-
//otherwise, rethrow the error because it wasn't handled properly
|
2145 |
-
throw ex;
|
2146 |
-
}
|
2147 |
-
|
2148 |
-
} else {
|
2149 |
-
//not a syntax error, rethrow it
|
2150 |
-
throw ex;
|
2151 |
-
}
|
2152 |
-
|
2153 |
-
//trigger parser to continue
|
2154 |
-
return true;
|
2155 |
-
}
|
2156 |
-
|
2157 |
-
//if it got here, all selectors parsed
|
2158 |
-
if (selectors){
|
2159 |
-
|
2160 |
-
this.fire({
|
2161 |
-
type: "startrule",
|
2162 |
-
selectors: selectors,
|
2163 |
-
line: selectors[0].line,
|
2164 |
-
col: selectors[0].col
|
2165 |
-
});
|
2166 |
-
|
2167 |
-
this._readDeclarations(true);
|
2168 |
-
|
2169 |
-
this.fire({
|
2170 |
-
type: "endrule",
|
2171 |
-
selectors: selectors,
|
2172 |
-
line: selectors[0].line,
|
2173 |
-
col: selectors[0].col
|
2174 |
-
});
|
2175 |
-
|
2176 |
-
}
|
2177 |
-
|
2178 |
-
return selectors;
|
2179 |
-
|
2180 |
-
},
|
2181 |
-
|
2182 |
-
//CSS3 Selectors
|
2183 |
-
_selectors_group: function(){
|
2184 |
-
|
2185 |
-
/*
|
2186 |
-
* selectors_group
|
2187 |
-
* : selector [ COMMA S* selector ]*
|
2188 |
-
* ;
|
2189 |
-
*/
|
2190 |
-
var tokenStream = this._tokenStream,
|
2191 |
-
selectors = [],
|
2192 |
-
selector;
|
2193 |
-
|
2194 |
-
selector = this._selector();
|
2195 |
-
if (selector !== null){
|
2196 |
-
|
2197 |
-
selectors.push(selector);
|
2198 |
-
while(tokenStream.match(Tokens.COMMA)){
|
2199 |
-
this._readWhitespace();
|
2200 |
-
selector = this._selector();
|
2201 |
-
if (selector !== null){
|
2202 |
-
selectors.push(selector);
|
2203 |
-
} else {
|
2204 |
-
this._unexpectedToken(tokenStream.LT(1));
|
2205 |
-
}
|
2206 |
-
}
|
2207 |
-
}
|
2208 |
-
|
2209 |
-
return selectors.length ? selectors : null;
|
2210 |
-
},
|
2211 |
-
|
2212 |
-
//CSS3 Selectors
|
2213 |
-
_selector: function(){
|
2214 |
-
/*
|
2215 |
-
* selector
|
2216 |
-
* : simple_selector_sequence [ combinator simple_selector_sequence ]*
|
2217 |
-
* ;
|
2218 |
-
*/
|
2219 |
-
|
2220 |
-
var tokenStream = this._tokenStream,
|
2221 |
-
selector = [],
|
2222 |
-
nextSelector = null,
|
2223 |
-
combinator = null,
|
2224 |
-
ws = null;
|
2225 |
-
|
2226 |
-
//if there's no simple selector, then there's no selector
|
2227 |
-
nextSelector = this._simple_selector_sequence();
|
2228 |
-
if (nextSelector === null){
|
2229 |
-
return null;
|
2230 |
-
}
|
2231 |
-
|
2232 |
-
selector.push(nextSelector);
|
2233 |
-
|
2234 |
-
do {
|
2235 |
-
|
2236 |
-
//look for a combinator
|
2237 |
-
combinator = this._combinator();
|
2238 |
-
|
2239 |
-
if (combinator !== null){
|
2240 |
-
selector.push(combinator);
|
2241 |
-
nextSelector = this._simple_selector_sequence();
|
2242 |
-
|
2243 |
-
//there must be a next selector
|
2244 |
-
if (nextSelector === null){
|
2245 |
-
this._unexpectedToken(tokenStream.LT(1));
|
2246 |
-
} else {
|
2247 |
-
|
2248 |
-
//nextSelector is an instance of SelectorPart
|
2249 |
-
selector.push(nextSelector);
|
2250 |
-
}
|
2251 |
-
} else {
|
2252 |
-
|
2253 |
-
//if there's not whitespace, we're done
|
2254 |
-
if (this._readWhitespace()){
|
2255 |
-
|
2256 |
-
//add whitespace separator
|
2257 |
-
ws = new Combinator(tokenStream.token().value, tokenStream.token().startLine, tokenStream.token().startCol);
|
2258 |
-
|
2259 |
-
//combinator is not required
|
2260 |
-
combinator = this._combinator();
|
2261 |
-
|
2262 |
-
//selector is required if there's a combinator
|
2263 |
-
nextSelector = this._simple_selector_sequence();
|
2264 |
-
if (nextSelector === null){
|
2265 |
-
if (combinator !== null){
|
2266 |
-
this._unexpectedToken(tokenStream.LT(1));
|
2267 |
-
}
|
2268 |
-
} else {
|
2269 |
-
|
2270 |
-
if (combinator !== null){
|
2271 |
-
selector.push(combinator);
|
2272 |
-
} else {
|
2273 |
-
selector.push(ws);
|
2274 |
-
}
|
2275 |
-
|
2276 |
-
selector.push(nextSelector);
|
2277 |
-
}
|
2278 |
-
} else {
|
2279 |
-
break;
|
2280 |
-
}
|
2281 |
-
|
2282 |
-
}
|
2283 |
-
} while(true);
|
2284 |
-
|
2285 |
-
return new Selector(selector, selector[0].line, selector[0].col);
|
2286 |
-
},
|
2287 |
-
|
2288 |
-
//CSS3 Selectors
|
2289 |
-
_simple_selector_sequence: function(){
|
2290 |
-
/*
|
2291 |
-
* simple_selector_sequence
|
2292 |
-
* : [ type_selector | universal ]
|
2293 |
-
* [ HASH | class | attrib | pseudo | negation ]*
|
2294 |
-
* | [ HASH | class | attrib | pseudo | negation ]+
|
2295 |
-
* ;
|
2296 |
-
*/
|
2297 |
-
|
2298 |
-
var tokenStream = this._tokenStream,
|
2299 |
-
|
2300 |
-
//parts of a simple selector
|
2301 |
-
elementName = null,
|
2302 |
-
modifiers = [],
|
2303 |
-
|
2304 |
-
//complete selector text
|
2305 |
-
selectorText= "",
|
2306 |
-
|
2307 |
-
//the different parts after the element name to search for
|
2308 |
-
components = [
|
2309 |
-
//HASH
|
2310 |
-
function(){
|
2311 |
-
return tokenStream.match(Tokens.HASH) ?
|
2312 |
-
new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) :
|
2313 |
-
null;
|
2314 |
-
},
|
2315 |
-
this._class,
|
2316 |
-
this._attrib,
|
2317 |
-
this._pseudo,
|
2318 |
-
this._negation
|
2319 |
-
],
|
2320 |
-
i = 0,
|
2321 |
-
len = components.length,
|
2322 |
-
component = null,
|
2323 |
-
found = false,
|
2324 |
-
line,
|
2325 |
-
col;
|
2326 |
-
|
2327 |
-
|
2328 |
-
//get starting line and column for the selector
|
2329 |
-
line = tokenStream.LT(1).startLine;
|
2330 |
-
col = tokenStream.LT(1).startCol;
|
2331 |
-
|
2332 |
-
elementName = this._type_selector();
|
2333 |
-
if (!elementName){
|
2334 |
-
elementName = this._universal();
|
2335 |
-
}
|
2336 |
-
|
2337 |
-
if (elementName !== null){
|
2338 |
-
selectorText += elementName;
|
2339 |
-
}
|
2340 |
-
|
2341 |
-
while(true){
|
2342 |
-
|
2343 |
-
//whitespace means we're done
|
2344 |
-
if (tokenStream.peek() === Tokens.S){
|
2345 |
-
break;
|
2346 |
-
}
|
2347 |
-
|
2348 |
-
//check for each component
|
2349 |
-
while(i < len && component === null){
|
2350 |
-
component = components[i++].call(this);
|
2351 |
-
}
|
2352 |
-
|
2353 |
-
if (component === null){
|
2354 |
-
|
2355 |
-
//we don't have a selector
|
2356 |
-
if (selectorText === ""){
|
2357 |
-
return null;
|
2358 |
-
} else {
|
2359 |
-
break;
|
2360 |
-
}
|
2361 |
-
} else {
|
2362 |
-
i = 0;
|
2363 |
-
modifiers.push(component);
|
2364 |
-
selectorText += component.toString();
|
2365 |
-
component = null;
|
2366 |
-
}
|
2367 |
-
}
|
2368 |
-
|
2369 |
-
|
2370 |
-
return selectorText !== "" ?
|
2371 |
-
new SelectorPart(elementName, modifiers, selectorText, line, col) :
|
2372 |
-
null;
|
2373 |
-
},
|
2374 |
-
|
2375 |
-
//CSS3 Selectors
|
2376 |
-
_type_selector: function(){
|
2377 |
-
/*
|
2378 |
-
* type_selector
|
2379 |
-
* : [ namespace_prefix ]? element_name
|
2380 |
-
* ;
|
2381 |
-
*/
|
2382 |
-
|
2383 |
-
var tokenStream = this._tokenStream,
|
2384 |
-
ns = this._namespace_prefix(),
|
2385 |
-
elementName = this._element_name();
|
2386 |
-
|
2387 |
-
if (!elementName){
|
2388 |
-
/*
|
2389 |
-
* Need to back out the namespace that was read due to both
|
2390 |
-
* type_selector and universal reading namespace_prefix
|
2391 |
-
* first. Kind of hacky, but only way I can figure out
|
2392 |
-
* right now how to not change the grammar.
|
2393 |
-
*/
|
2394 |
-
if (ns){
|
2395 |
-
tokenStream.unget();
|
2396 |
-
if (ns.length > 1){
|
2397 |
-
tokenStream.unget();
|
2398 |
-
}
|
2399 |
-
}
|
2400 |
-
|
2401 |
-
return null;
|
2402 |
-
} else {
|
2403 |
-
if (ns){
|
2404 |
-
elementName.text = ns + elementName.text;
|
2405 |
-
elementName.col -= ns.length;
|
2406 |
-
}
|
2407 |
-
return elementName;
|
2408 |
-
}
|
2409 |
-
},
|
2410 |
-
|
2411 |
-
//CSS3 Selectors
|
2412 |
-
_class: function(){
|
2413 |
-
/*
|
2414 |
-
* class
|
2415 |
-
* : '.' IDENT
|
2416 |
-
* ;
|
2417 |
-
*/
|
2418 |
-
|
2419 |
-
var tokenStream = this._tokenStream,
|
2420 |
-
token;
|
2421 |
-
|
2422 |
-
if (tokenStream.match(Tokens.DOT)){
|
2423 |
-
tokenStream.mustMatch(Tokens.IDENT);
|
2424 |
-
token = tokenStream.token();
|
2425 |
-
return new SelectorSubPart("." + token.value, "class", token.startLine, token.startCol - 1);
|
2426 |
-
} else {
|
2427 |
-
return null;
|
2428 |
-
}
|
2429 |
-
|
2430 |
-
},
|
2431 |
-
|
2432 |
-
//CSS3 Selectors
|
2433 |
-
_element_name: function(){
|
2434 |
-
/*
|
2435 |
-
* element_name
|
2436 |
-
* : IDENT
|
2437 |
-
* ;
|
2438 |
-
*/
|
2439 |
-
|
2440 |
-
var tokenStream = this._tokenStream,
|
2441 |
-
token;
|
2442 |
-
|
2443 |
-
if (tokenStream.match(Tokens.IDENT)){
|
2444 |
-
token = tokenStream.token();
|
2445 |
-
return new SelectorSubPart(token.value, "elementName", token.startLine, token.startCol);
|
2446 |
-
|
2447 |
-
} else {
|
2448 |
-
return null;
|
2449 |
-
}
|
2450 |
-
},
|
2451 |
-
|
2452 |
-
//CSS3 Selectors
|
2453 |
-
_namespace_prefix: function(){
|
2454 |
-
/*
|
2455 |
-
* namespace_prefix
|
2456 |
-
* : [ IDENT | '*' ]? '|'
|
2457 |
-
* ;
|
2458 |
-
*/
|
2459 |
-
var tokenStream = this._tokenStream,
|
2460 |
-
value = "";
|
2461 |
-
|
2462 |
-
//verify that this is a namespace prefix
|
2463 |
-
if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE){
|
2464 |
-
|
2465 |
-
if(tokenStream.match([Tokens.IDENT, Tokens.STAR])){
|
2466 |
-
value += tokenStream.token().value;
|
2467 |
-
}
|
2468 |
-
|
2469 |
-
tokenStream.mustMatch(Tokens.PIPE);
|
2470 |
-
value += "|";
|
2471 |
-
|
2472 |
-
}
|
2473 |
-
|
2474 |
-
return value.length ? value : null;
|
2475 |
-
},
|
2476 |
-
|
2477 |
-
//CSS3 Selectors
|
2478 |
-
_universal: function(){
|
2479 |
-
/*
|
2480 |
-
* universal
|
2481 |
-
* : [ namespace_prefix ]? '*'
|
2482 |
-
* ;
|
2483 |
-
*/
|
2484 |
-
var tokenStream = this._tokenStream,
|
2485 |
-
value = "",
|
2486 |
-
ns;
|
2487 |
-
|
2488 |
-
ns = this._namespace_prefix();
|
2489 |
-
if(ns){
|
2490 |
-
value += ns;
|
2491 |
-
}
|
2492 |
-
|
2493 |
-
if(tokenStream.match(Tokens.STAR)){
|
2494 |
-
value += "*";
|
2495 |
-
}
|
2496 |
-
|
2497 |
-
return value.length ? value : null;
|
2498 |
-
|
2499 |
-
},
|
2500 |
-
|
2501 |
-
//CSS3 Selectors
|
2502 |
-
_attrib: function(){
|
2503 |
-
/*
|
2504 |
-
* attrib
|
2505 |
-
* : '[' S* [ namespace_prefix ]? IDENT S*
|
2506 |
-
* [ [ PREFIXMATCH |
|
2507 |
-
* SUFFIXMATCH |
|
2508 |
-
* SUBSTRINGMATCH |
|
2509 |
-
* '=' |
|
2510 |
-
* INCLUDES |
|
2511 |
-
* DASHMATCH ] S* [ IDENT | STRING ] S*
|
2512 |
-
* ]? ']'
|
2513 |
-
* ;
|
2514 |
-
*/
|
2515 |
-
|
2516 |
-
var tokenStream = this._tokenStream,
|
2517 |
-
value = null,
|
2518 |
-
ns,
|
2519 |
-
token;
|
2520 |
-
|
2521 |
-
if (tokenStream.match(Tokens.LBRACKET)){
|
2522 |
-
token = tokenStream.token();
|
2523 |
-
value = token.value;
|
2524 |
-
value += this._readWhitespace();
|
2525 |
-
|
2526 |
-
ns = this._namespace_prefix();
|
2527 |
-
|
2528 |
-
if (ns){
|
2529 |
-
value += ns;
|
2530 |
-
}
|
2531 |
-
|
2532 |
-
tokenStream.mustMatch(Tokens.IDENT);
|
2533 |
-
value += tokenStream.token().value;
|
2534 |
-
value += this._readWhitespace();
|
2535 |
-
|
2536 |
-
if(tokenStream.match([Tokens.PREFIXMATCH, Tokens.SUFFIXMATCH, Tokens.SUBSTRINGMATCH,
|
2537 |
-
Tokens.EQUALS, Tokens.INCLUDES, Tokens.DASHMATCH])){
|
2538 |
-
|
2539 |
-
value += tokenStream.token().value;
|
2540 |
-
value += this._readWhitespace();
|
2541 |
-
|
2542 |
-
tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]);
|
2543 |
-
value += tokenStream.token().value;
|
2544 |
-
value += this._readWhitespace();
|
2545 |
-
}
|
2546 |
-
|
2547 |
-
tokenStream.mustMatch(Tokens.RBRACKET);
|
2548 |
-
|
2549 |
-
return new SelectorSubPart(value + "]", "attribute", token.startLine, token.startCol);
|
2550 |
-
} else {
|
2551 |
-
return null;
|
2552 |
-
}
|
2553 |
-
},
|
2554 |
-
|
2555 |
-
//CSS3 Selectors
|
2556 |
-
_pseudo: function(){
|
2557 |
-
|
2558 |
-
/*
|
2559 |
-
* pseudo
|
2560 |
-
* : ':' ':'? [ IDENT | functional_pseudo ]
|
2561 |
-
* ;
|
2562 |
-
*/
|
2563 |
-
|
2564 |
-
var tokenStream = this._tokenStream,
|
2565 |
-
pseudo = null,
|
2566 |
-
colons = ":",
|
2567 |
-
line,
|
2568 |
-
col;
|
2569 |
-
|
2570 |
-
if (tokenStream.match(Tokens.COLON)){
|
2571 |
-
|
2572 |
-
if (tokenStream.match(Tokens.COLON)){
|
2573 |
-
colons += ":";
|
2574 |
-
}
|
2575 |
-
|
2576 |
-
if (tokenStream.match(Tokens.IDENT)){
|
2577 |
-
pseudo = tokenStream.token().value;
|
2578 |
-
line = tokenStream.token().startLine;
|
2579 |
-
col = tokenStream.token().startCol - colons.length;
|
2580 |
-
} else if (tokenStream.peek() == Tokens.FUNCTION){
|
2581 |
-
line = tokenStream.LT(1).startLine;
|
2582 |
-
col = tokenStream.LT(1).startCol - colons.length;
|
2583 |
-
pseudo = this._functional_pseudo();
|
2584 |
-
}
|
2585 |
-
|
2586 |
-
if (pseudo){
|
2587 |
-
pseudo = new SelectorSubPart(colons + pseudo, "pseudo", line, col);
|
2588 |
-
}
|
2589 |
-
}
|
2590 |
-
|
2591 |
-
return pseudo;
|
2592 |
-
},
|
2593 |
-
|
2594 |
-
//CSS3 Selectors
|
2595 |
-
_functional_pseudo: function(){
|
2596 |
-
/*
|
2597 |
-
* functional_pseudo
|
2598 |
-
* : FUNCTION S* expression ')'
|
2599 |
-
* ;
|
2600 |
-
*/
|
2601 |
-
|
2602 |
-
var tokenStream = this._tokenStream,
|
2603 |
-
value = null;
|
2604 |
-
|
2605 |
-
if(tokenStream.match(Tokens.FUNCTION)){
|
2606 |
-
value = tokenStream.token().value;
|
2607 |
-
value += this._readWhitespace();
|
2608 |
-
value += this._expression();
|
2609 |
-
tokenStream.mustMatch(Tokens.RPAREN);
|
2610 |
-
value += ")";
|
2611 |
-
}
|
2612 |
-
|
2613 |
-
return value;
|
2614 |
-
},
|
2615 |
-
|
2616 |
-
//CSS3 Selectors
|
2617 |
-
_expression: function(){
|
2618 |
-
/*
|
2619 |
-
* expression
|
2620 |
-
* : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
|
2621 |
-
* ;
|
2622 |
-
*/
|
2623 |
-
|
2624 |
-
var tokenStream = this._tokenStream,
|
2625 |
-
value = "";
|
2626 |
-
|
2627 |
-
while(tokenStream.match([Tokens.PLUS, Tokens.MINUS, Tokens.DIMENSION,
|
2628 |
-
Tokens.NUMBER, Tokens.STRING, Tokens.IDENT, Tokens.LENGTH,
|
2629 |
-
Tokens.FREQ, Tokens.ANGLE, Tokens.TIME,
|
2630 |
-
Tokens.RESOLUTION, Tokens.SLASH])){
|
2631 |
-
|
2632 |
-
value += tokenStream.token().value;
|
2633 |
-
value += this._readWhitespace();
|
2634 |
-
}
|
2635 |
-
|
2636 |
-
return value.length ? value : null;
|
2637 |
-
|
2638 |
-
},
|
2639 |
-
|
2640 |
-
//CSS3 Selectors
|
2641 |
-
_negation: function(){
|
2642 |
-
/*
|
2643 |
-
* negation
|
2644 |
-
* : NOT S* negation_arg S* ')'
|
2645 |
-
* ;
|
2646 |
-
*/
|
2647 |
-
|
2648 |
-
var tokenStream = this._tokenStream,
|
2649 |
-
line,
|
2650 |
-
col,
|
2651 |
-
value = "",
|
2652 |
-
arg,
|
2653 |
-
subpart = null;
|
2654 |
-
|
2655 |
-
if (tokenStream.match(Tokens.NOT)){
|
2656 |
-
value = tokenStream.token().value;
|
2657 |
-
line = tokenStream.token().startLine;
|
2658 |
-
col = tokenStream.token().startCol;
|
2659 |
-
value += this._readWhitespace();
|
2660 |
-
arg = this._negation_arg();
|
2661 |
-
value += arg;
|
2662 |
-
value += this._readWhitespace();
|
2663 |
-
tokenStream.match(Tokens.RPAREN);
|
2664 |
-
value += tokenStream.token().value;
|
2665 |
-
|
2666 |
-
subpart = new SelectorSubPart(value, "not", line, col);
|
2667 |
-
subpart.args.push(arg);
|
2668 |
-
}
|
2669 |
-
|
2670 |
-
return subpart;
|
2671 |
-
},
|
2672 |
-
|
2673 |
-
//CSS3 Selectors
|
2674 |
-
_negation_arg: function(){
|
2675 |
-
/*
|
2676 |
-
* negation_arg
|
2677 |
-
* : type_selector | universal | HASH | class | attrib | pseudo
|
2678 |
-
* ;
|
2679 |
-
*/
|
2680 |
-
|
2681 |
-
var tokenStream = this._tokenStream,
|
2682 |
-
args = [
|
2683 |
-
this._type_selector,
|
2684 |
-
this._universal,
|
2685 |
-
function(){
|
2686 |
-
return tokenStream.match(Tokens.HASH) ?
|
2687 |
-
new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) :
|
2688 |
-
null;
|
2689 |
-
},
|
2690 |
-
this._class,
|
2691 |
-
this._attrib,
|
2692 |
-
this._pseudo
|
2693 |
-
],
|
2694 |
-
arg = null,
|
2695 |
-
i = 0,
|
2696 |
-
len = args.length,
|
2697 |
-
elementName,
|
2698 |
-
line,
|
2699 |
-
col,
|
2700 |
-
part;
|
2701 |
-
|
2702 |
-
line = tokenStream.LT(1).startLine;
|
2703 |
-
col = tokenStream.LT(1).startCol;
|
2704 |
-
|
2705 |
-
while(i < len && arg === null){
|
2706 |
-
|
2707 |
-
arg = args[i].call(this);
|
2708 |
-
i++;
|
2709 |
-
}
|
2710 |
-
|
2711 |
-
//must be a negation arg
|
2712 |
-
if (arg === null){
|
2713 |
-
this._unexpectedToken(tokenStream.LT(1));
|
2714 |
-
}
|
2715 |
-
|
2716 |
-
//it's an element name
|
2717 |
-
if (arg.type == "elementName"){
|
2718 |
-
part = new SelectorPart(arg, [], arg.toString(), line, col);
|
2719 |
-
} else {
|
2720 |
-
part = new SelectorPart(null, [arg], arg.toString(), line, col);
|
2721 |
-
}
|
2722 |
-
|
2723 |
-
return part;
|
2724 |
-
},
|
2725 |
-
|
2726 |
-
_declaration: function(){
|
2727 |
-
|
2728 |
-
/*
|
2729 |
-
* declaration
|
2730 |
-
* : property ':' S* expr prio?
|
2731 |
-
* | /( empty )/
|
2732 |
-
* ;
|
2733 |
-
*/
|
2734 |
-
|
2735 |
-
var tokenStream = this._tokenStream,
|
2736 |
-
property = null,
|
2737 |
-
expr = null,
|
2738 |
-
prio = null,
|
2739 |
-
error = null,
|
2740 |
-
invalid = null,
|
2741 |
-
propertyName= "";
|
2742 |
-
|
2743 |
-
property = this._property();
|
2744 |
-
if (property !== null){
|
2745 |
-
|
2746 |
-
tokenStream.mustMatch(Tokens.COLON);
|
2747 |
-
this._readWhitespace();
|
2748 |
-
|
2749 |
-
expr = this._expr();
|
2750 |
-
|
2751 |
-
//if there's no parts for the value, it's an error
|
2752 |
-
if (!expr || expr.length === 0){
|
2753 |
-
this._unexpectedToken(tokenStream.LT(1));
|
2754 |
-
}
|
2755 |
-
|
2756 |
-
prio = this._prio();
|
2757 |
-
|
2758 |
-
/*
|
2759 |
-
* If hacks should be allowed, then only check the root
|
2760 |
-
* property. If hacks should not be allowed, treat
|
2761 |
-
* _property or *property as invalid properties.
|
2762 |
-
*/
|
2763 |
-
propertyName = property.toString();
|
2764 |
-
if (this.options.starHack && property.hack == "*" ||
|
2765 |
-
this.options.underscoreHack && property.hack == "_") {
|
2766 |
-
|
2767 |
-
propertyName = property.text;
|
2768 |
-
}
|
2769 |
-
|
2770 |
-
try {
|
2771 |
-
this._validateProperty(propertyName, expr);
|
2772 |
-
} catch (ex) {
|
2773 |
-
invalid = ex;
|
2774 |
-
}
|
2775 |
-
|
2776 |
-
this.fire({
|
2777 |
-
type: "property",
|
2778 |
-
property: property,
|
2779 |
-
value: expr,
|
2780 |
-
important: prio,
|
2781 |
-
line: property.line,
|
2782 |
-
col: property.col,
|
2783 |
-
invalid: invalid
|
2784 |
-
});
|
2785 |
-
|
2786 |
-
return true;
|
2787 |
-
} else {
|
2788 |
-
return false;
|
2789 |
-
}
|
2790 |
-
},
|
2791 |
-
|
2792 |
-
_prio: function(){
|
2793 |
-
/*
|
2794 |
-
* prio
|
2795 |
-
* : IMPORTANT_SYM S*
|
2796 |
-
* ;
|
2797 |
-
*/
|
2798 |
-
|
2799 |
-
var tokenStream = this._tokenStream,
|
2800 |
-
result = tokenStream.match(Tokens.IMPORTANT_SYM);
|
2801 |
-
|
2802 |
-
this._readWhitespace();
|
2803 |
-
return result;
|
2804 |
-
},
|
2805 |
-
|
2806 |
-
_expr: function(inFunction){
|
2807 |
-
/*
|
2808 |
-
* expr
|
2809 |
-
* : term [ operator term ]*
|
2810 |
-
* ;
|
2811 |
-
*/
|
2812 |
-
|
2813 |
-
var tokenStream = this._tokenStream,
|
2814 |
-
values = [],
|
2815 |
-
//valueParts = [],
|
2816 |
-
value = null,
|
2817 |
-
operator = null;
|
2818 |
-
|
2819 |
-
value = this._term(inFunction);
|
2820 |
-
if (value !== null){
|
2821 |
-
|
2822 |
-
values.push(value);
|
2823 |
-
|
2824 |
-
do {
|
2825 |
-
operator = this._operator(inFunction);
|
2826 |
-
|
2827 |
-
//if there's an operator, keep building up the value parts
|
2828 |
-
if (operator){
|
2829 |
-
values.push(operator);
|
2830 |
-
} /*else {
|
2831 |
-
//if there's not an operator, you have a full value
|
2832 |
-
values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col));
|
2833 |
-
valueParts = [];
|
2834 |
-
}*/
|
2835 |
-
|
2836 |
-
value = this._term(inFunction);
|
2837 |
-
|
2838 |
-
if (value === null){
|
2839 |
-
break;
|
2840 |
-
} else {
|
2841 |
-
values.push(value);
|
2842 |
-
}
|
2843 |
-
} while(true);
|
2844 |
-
}
|
2845 |
-
|
2846 |
-
//cleanup
|
2847 |
-
/*if (valueParts.length){
|
2848 |
-
values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col));
|
2849 |
-
}*/
|
2850 |
-
|
2851 |
-
return values.length > 0 ? new PropertyValue(values, values[0].line, values[0].col) : null;
|
2852 |
-
},
|
2853 |
-
|
2854 |
-
_term: function(inFunction){
|
2855 |
-
|
2856 |
-
/*
|
2857 |
-
* term
|
2858 |
-
* : unary_operator?
|
2859 |
-
* [ NUMBER S* | PERCENTAGE S* | LENGTH S* | ANGLE S* |
|
2860 |
-
* TIME S* | FREQ S* | function | ie_function ]
|
2861 |
-
* | STRING S* | IDENT S* | URI S* | UNICODERANGE S* | hexcolor
|
2862 |
-
* ;
|
2863 |
-
*/
|
2864 |
-
|
2865 |
-
var tokenStream = this._tokenStream,
|
2866 |
-
unary = null,
|
2867 |
-
value = null,
|
2868 |
-
endChar = null,
|
2869 |
-
token,
|
2870 |
-
line,
|
2871 |
-
col;
|
2872 |
-
|
2873 |
-
//returns the operator or null
|
2874 |
-
unary = this._unary_operator();
|
2875 |
-
if (unary !== null){
|
2876 |
-
line = tokenStream.token().startLine;
|
2877 |
-
col = tokenStream.token().startCol;
|
2878 |
-
}
|
2879 |
-
|
2880 |
-
//exception for IE filters
|
2881 |
-
if (tokenStream.peek() == Tokens.IE_FUNCTION && this.options.ieFilters){
|
2882 |
-
|
2883 |
-
value = this._ie_function();
|
2884 |
-
if (unary === null){
|
2885 |
-
line = tokenStream.token().startLine;
|
2886 |
-
col = tokenStream.token().startCol;
|
2887 |
-
}
|
2888 |
-
|
2889 |
-
//see if it's a simple block
|
2890 |
-
} else if (inFunction && tokenStream.match([Tokens.LPAREN, Tokens.LBRACE, Tokens.LBRACKET])){
|
2891 |
-
|
2892 |
-
token = tokenStream.token();
|
2893 |
-
endChar = token.endChar;
|
2894 |
-
value = token.value + this._expr(inFunction).text;
|
2895 |
-
if (unary === null){
|
2896 |
-
line = tokenStream.token().startLine;
|
2897 |
-
col = tokenStream.token().startCol;
|
2898 |
-
}
|
2899 |
-
tokenStream.mustMatch(Tokens.type(endChar));
|
2900 |
-
value += endChar;
|
2901 |
-
this._readWhitespace();
|
2902 |
-
|
2903 |
-
//see if there's a simple match
|
2904 |
-
} else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH,
|
2905 |
-
Tokens.ANGLE, Tokens.TIME,
|
2906 |
-
Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])){
|
2907 |
-
|
2908 |
-
value = tokenStream.token().value;
|
2909 |
-
if (unary === null){
|
2910 |
-
line = tokenStream.token().startLine;
|
2911 |
-
col = tokenStream.token().startCol;
|
2912 |
-
}
|
2913 |
-
this._readWhitespace();
|
2914 |
-
} else {
|
2915 |
-
|
2916 |
-
//see if it's a color
|
2917 |
-
token = this._hexcolor();
|
2918 |
-
if (token === null){
|
2919 |
-
|
2920 |
-
//if there's no unary, get the start of the next token for line/col info
|
2921 |
-
if (unary === null){
|
2922 |
-
line = tokenStream.LT(1).startLine;
|
2923 |
-
col = tokenStream.LT(1).startCol;
|
2924 |
-
}
|
2925 |
-
|
2926 |
-
//has to be a function
|
2927 |
-
if (value === null){
|
2928 |
-
|
2929 |
-
/*
|
2930 |
-
* This checks for alpha(opacity=0) style of IE
|
2931 |
-
* functions. IE_FUNCTION only presents progid: style.
|
2932 |
-
*/
|
2933 |
-
if (tokenStream.LA(3) == Tokens.EQUALS && this.options.ieFilters){
|
2934 |
-
value = this._ie_function();
|
2935 |
-
} else {
|
2936 |
-
value = this._function();
|
2937 |
-
}
|
2938 |
-
}
|
2939 |
-
|
2940 |
-
/*if (value === null){
|
2941 |
-
return null;
|
2942 |
-
//throw new Error("Expected identifier at line " + tokenStream.token().startLine + ", character " + tokenStream.token().startCol + ".");
|
2943 |
-
}*/
|
2944 |
-
|
2945 |
-
} else {
|
2946 |
-
value = token.value;
|
2947 |
-
if (unary === null){
|
2948 |
-
line = token.startLine;
|
2949 |
-
col = token.startCol;
|
2950 |
-
}
|
2951 |
-
}
|
2952 |
-
|
2953 |
-
}
|
2954 |
-
|
2955 |
-
return value !== null ?
|
2956 |
-
new PropertyValuePart(unary !== null ? unary + value : value, line, col) :
|
2957 |
-
null;
|
2958 |
-
|
2959 |
-
},
|
2960 |
-
|
2961 |
-
_function: function(){
|
2962 |
-
|
2963 |
-
/*
|
2964 |
-
* function
|
2965 |
-
* : FUNCTION S* expr ')' S*
|
2966 |
-
* ;
|
2967 |
-
*/
|
2968 |
-
|
2969 |
-
var tokenStream = this._tokenStream,
|
2970 |
-
functionText = null,
|
2971 |
-
expr = null,
|
2972 |
-
lt;
|
2973 |
-
|
2974 |
-
if (tokenStream.match(Tokens.FUNCTION)){
|
2975 |
-
functionText = tokenStream.token().value;
|
2976 |
-
this._readWhitespace();
|
2977 |
-
expr = this._expr(true);
|
2978 |
-
functionText += expr;
|
2979 |
-
|
2980 |
-
//START: Horrible hack in case it's an IE filter
|
2981 |
-
if (this.options.ieFilters && tokenStream.peek() == Tokens.EQUALS){
|
2982 |
-
do {
|
2983 |
-
|
2984 |
-
if (this._readWhitespace()){
|
2985 |
-
functionText += tokenStream.token().value;
|
2986 |
-
}
|
2987 |
-
|
2988 |
-
//might be second time in the loop
|
2989 |
-
if (tokenStream.LA(0) == Tokens.COMMA){
|
2990 |
-
functionText += tokenStream.token().value;
|
2991 |
-
}
|
2992 |
-
|
2993 |
-
tokenStream.match(Tokens.IDENT);
|
2994 |
-
functionText += tokenStream.token().value;
|
2995 |
-
|
2996 |
-
tokenStream.match(Tokens.EQUALS);
|
2997 |
-
functionText += tokenStream.token().value;
|
2998 |
-
|
2999 |
-
//functionText += this._term();
|
3000 |
-
lt = tokenStream.peek();
|
3001 |
-
while(lt != Tokens.COMMA && lt != Tokens.S && lt != Tokens.RPAREN){
|
3002 |
-
tokenStream.get();
|
3003 |
-
functionText += tokenStream.token().value;
|
3004 |
-
lt = tokenStream.peek();
|
3005 |
-
}
|
3006 |
-
} while(tokenStream.match([Tokens.COMMA, Tokens.S]));
|
3007 |
-
}
|
3008 |
-
|
3009 |
-
//END: Horrible Hack
|
3010 |
-
|
3011 |
-
tokenStream.match(Tokens.RPAREN);
|
3012 |
-
functionText += ")";
|
3013 |
-
this._readWhitespace();
|
3014 |
-
}
|
3015 |
-
|
3016 |
-
return functionText;
|
3017 |
-
},
|
3018 |
-
|
3019 |
-
_ie_function: function(){
|
3020 |
-
|
3021 |
-
/* (My own extension)
|
3022 |
-
* ie_function
|
3023 |
-
* : IE_FUNCTION S* IDENT '=' term [S* ','? IDENT '=' term]+ ')' S*
|
3024 |
-
* ;
|
3025 |
-
*/
|
3026 |
-
|
3027 |
-
var tokenStream = this._tokenStream,
|
3028 |
-
functionText = null,
|
3029 |
-
expr = null,
|
3030 |
-
lt;
|
3031 |
-
|
3032 |
-
//IE function can begin like a regular function, too
|
3033 |
-
if (tokenStream.match([Tokens.IE_FUNCTION, Tokens.FUNCTION])){
|
3034 |
-
functionText = tokenStream.token().value;
|
3035 |
-
|
3036 |
-
do {
|
3037 |
-
|
3038 |
-
if (this._readWhitespace()){
|
3039 |
-
functionText += tokenStream.token().value;
|
3040 |
-
}
|
3041 |
-
|
3042 |
-
//might be second time in the loop
|
3043 |
-
if (tokenStream.LA(0) == Tokens.COMMA){
|
3044 |
-
functionText += tokenStream.token().value;
|
3045 |
-
}
|
3046 |
-
|
3047 |
-
tokenStream.match(Tokens.IDENT);
|
3048 |
-
functionText += tokenStream.token().value;
|
3049 |
-
|
3050 |
-
tokenStream.match(Tokens.EQUALS);
|
3051 |
-
functionText += tokenStream.token().value;
|
3052 |
-
|
3053 |
-
//functionText += this._term();
|
3054 |
-
lt = tokenStream.peek();
|
3055 |
-
while(lt != Tokens.COMMA && lt != Tokens.S && lt != Tokens.RPAREN){
|
3056 |
-
tokenStream.get();
|
3057 |
-
functionText += tokenStream.token().value;
|
3058 |
-
lt = tokenStream.peek();
|
3059 |
-
}
|
3060 |
-
} while(tokenStream.match([Tokens.COMMA, Tokens.S]));
|
3061 |
-
|
3062 |
-
tokenStream.match(Tokens.RPAREN);
|
3063 |
-
functionText += ")";
|
3064 |
-
this._readWhitespace();
|
3065 |
-
}
|
3066 |
-
|
3067 |
-
return functionText;
|
3068 |
-
},
|
3069 |
-
|
3070 |
-
_hexcolor: function(){
|
3071 |
-
/*
|
3072 |
-
* There is a constraint on the color that it must
|
3073 |
-
* have either 3 or 6 hex-digits (i.e., [0-9a-fA-F])
|
3074 |
-
* after the "#"; e.g., "#000" is OK, but "#abcd" is not.
|
3075 |
-
*
|
3076 |
-
* hexcolor
|
3077 |
-
* : HASH S*
|
3078 |
-
* ;
|
3079 |
-
*/
|
3080 |
-
|
3081 |
-
var tokenStream = this._tokenStream,
|
3082 |
-
token = null,
|
3083 |
-
color;
|
3084 |
-
|
3085 |
-
if(tokenStream.match(Tokens.HASH)){
|
3086 |
-
|
3087 |
-
//need to do some validation here
|
3088 |
-
|
3089 |
-
token = tokenStream.token();
|
3090 |
-
color = token.value;
|
3091 |
-
if (!/#[a-f0-9]{3,6}/i.test(color)){
|
3092 |
-
throw new SyntaxError("Expected a hex color but found '" + color + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol);
|
3093 |
-
}
|
3094 |
-
this._readWhitespace();
|
3095 |
-
}
|
3096 |
-
|
3097 |
-
return token;
|
3098 |
-
},
|
3099 |
-
|
3100 |
-
//-----------------------------------------------------------------
|
3101 |
-
// Animations methods
|
3102 |
-
//-----------------------------------------------------------------
|
3103 |
-
|
3104 |
-
_keyframes: function(){
|
3105 |
-
|
3106 |
-
/*
|
3107 |
-
* keyframes:
|
3108 |
-
* : KEYFRAMES_SYM S* keyframe_name S* '{' S* keyframe_rule* '}' {
|
3109 |
-
* ;
|
3110 |
-
*/
|
3111 |
-
var tokenStream = this._tokenStream,
|
3112 |
-
token,
|
3113 |
-
tt,
|
3114 |
-
name,
|
3115 |
-
prefix = "";
|
3116 |
-
|
3117 |
-
tokenStream.mustMatch(Tokens.KEYFRAMES_SYM);
|
3118 |
-
token = tokenStream.token();
|
3119 |
-
if (/^@\-([^\-]+)\-/.test(token.value)) {
|
3120 |
-
prefix = RegExp.$1;
|
3121 |
-
}
|
3122 |
-
|
3123 |
-
this._readWhitespace();
|
3124 |
-
name = this._keyframe_name();
|
3125 |
-
|
3126 |
-
this._readWhitespace();
|
3127 |
-
tokenStream.mustMatch(Tokens.LBRACE);
|
3128 |
-
|
3129 |
-
this.fire({
|
3130 |
-
type: "startkeyframes",
|
3131 |
-
name: name,
|
3132 |
-
prefix: prefix,
|
3133 |
-
line: token.startLine,
|
3134 |
-
col: token.startCol
|
3135 |
-
});
|
3136 |
-
|
3137 |
-
this._readWhitespace();
|
3138 |
-
tt = tokenStream.peek();
|
3139 |
-
|
3140 |
-
//check for key
|
3141 |
-
while(tt == Tokens.IDENT || tt == Tokens.PERCENTAGE) {
|
3142 |
-
this._keyframe_rule();
|
3143 |
-
this._readWhitespace();
|
3144 |
-
tt = tokenStream.peek();
|
3145 |
-
}
|
3146 |
-
|
3147 |
-
this.fire({
|
3148 |
-
type: "endkeyframes",
|
3149 |
-
name: name,
|
3150 |
-
prefix: prefix,
|
3151 |
-
line: token.startLine,
|
3152 |
-
col: token.startCol
|
3153 |
-
});
|
3154 |
-
|
3155 |
-
this._readWhitespace();
|
3156 |
-
tokenStream.mustMatch(Tokens.RBRACE);
|
3157 |
-
|
3158 |
-
},
|
3159 |
-
|
3160 |
-
_keyframe_name: function(){
|
3161 |
-
|
3162 |
-
/*
|
3163 |
-
* keyframe_name:
|
3164 |
-
* : IDENT
|
3165 |
-
* | STRING
|
3166 |
-
* ;
|
3167 |
-
*/
|
3168 |
-
var tokenStream = this._tokenStream,
|
3169 |
-
token;
|
3170 |
-
|
3171 |
-
tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]);
|
3172 |
-
return SyntaxUnit.fromToken(tokenStream.token());
|
3173 |
-
},
|
3174 |
-
|
3175 |
-
_keyframe_rule: function(){
|
3176 |
-
|
3177 |
-
/*
|
3178 |
-
* keyframe_rule:
|
3179 |
-
* : key_list S*
|
3180 |
-
* '{' S* declaration [ ';' S* declaration ]* '}' S*
|
3181 |
-
* ;
|
3182 |
-
*/
|
3183 |
-
var tokenStream = this._tokenStream,
|
3184 |
-
token,
|
3185 |
-
keyList = this._key_list();
|
3186 |
-
|
3187 |
-
this.fire({
|
3188 |
-
type: "startkeyframerule",
|
3189 |
-
keys: keyList,
|
3190 |
-
line: keyList[0].line,
|
3191 |
-
col: keyList[0].col
|
3192 |
-
});
|
3193 |
-
|
3194 |
-
this._readDeclarations(true);
|
3195 |
-
|
3196 |
-
this.fire({
|
3197 |
-
type: "endkeyframerule",
|
3198 |
-
keys: keyList,
|
3199 |
-
line: keyList[0].line,
|
3200 |
-
col: keyList[0].col
|
3201 |
-
});
|
3202 |
-
|
3203 |
-
},
|
3204 |
-
|
3205 |
-
_key_list: function(){
|
3206 |
-
|
3207 |
-
/*
|
3208 |
-
* key_list:
|
3209 |
-
* : key [ S* ',' S* key]*
|
3210 |
-
* ;
|
3211 |
-
*/
|
3212 |
-
var tokenStream = this._tokenStream,
|
3213 |
-
token,
|
3214 |
-
key,
|
3215 |
-
keyList = [];
|
3216 |
-
|
3217 |
-
//must be least one key
|
3218 |
-
keyList.push(this._key());
|
3219 |
-
|
3220 |
-
this._readWhitespace();
|
3221 |
-
|
3222 |
-
while(tokenStream.match(Tokens.COMMA)){
|
3223 |
-
this._readWhitespace();
|
3224 |
-
keyList.push(this._key());
|
3225 |
-
this._readWhitespace();
|
3226 |
-
}
|
3227 |
-
|
3228 |
-
return keyList;
|
3229 |
-
},
|
3230 |
-
|
3231 |
-
_key: function(){
|
3232 |
-
/*
|
3233 |
-
* There is a restriction that IDENT can be only "from" or "to".
|
3234 |
-
*
|
3235 |
-
* key
|
3236 |
-
* : PERCENTAGE
|
3237 |
-
* | IDENT
|
3238 |
-
* ;
|
3239 |
-
*/
|
3240 |
-
|
3241 |
-
var tokenStream = this._tokenStream,
|
3242 |
-
token;
|
3243 |
-
|
3244 |
-
if (tokenStream.match(Tokens.PERCENTAGE)){
|
3245 |
-
return SyntaxUnit.fromToken(tokenStream.token());
|
3246 |
-
} else if (tokenStream.match(Tokens.IDENT)){
|
3247 |
-
token = tokenStream.token();
|
3248 |
-
|
3249 |
-
if (/from|to/i.test(token.value)){
|
3250 |
-
return SyntaxUnit.fromToken(token);
|
3251 |
-
}
|
3252 |
-
|
3253 |
-
tokenStream.unget();
|
3254 |
-
}
|
3255 |
-
|
3256 |
-
//if it gets here, there wasn't a valid token, so time to explode
|
3257 |
-
this._unexpectedToken(tokenStream.LT(1));
|
3258 |
-
},
|
3259 |
-
|
3260 |
-
//-----------------------------------------------------------------
|
3261 |
-
// Helper methods
|
3262 |
-
//-----------------------------------------------------------------
|
3263 |
-
|
3264 |
-
/**
|
3265 |
-
* Not part of CSS grammar, but useful for skipping over
|
3266 |
-
* combination of white space and HTML-style comments.
|
3267 |
-
* @return {void}
|
3268 |
-
* @method _skipCruft
|
3269 |
-
* @private
|
3270 |
-
*/
|
3271 |
-
_skipCruft: function(){
|
3272 |
-
while(this._tokenStream.match([Tokens.S, Tokens.CDO, Tokens.CDC])){
|
3273 |
-
//noop
|
3274 |
-
}
|
3275 |
-
},
|
3276 |
-
|
3277 |
-
/**
|
3278 |
-
* Not part of CSS grammar, but this pattern occurs frequently
|
3279 |
-
* in the official CSS grammar. Split out here to eliminate
|
3280 |
-
* duplicate code.
|
3281 |
-
* @param {Boolean} checkStart Indicates if the rule should check
|
3282 |
-
* for the left brace at the beginning.
|
3283 |
-
* @param {Boolean} readMargins Indicates if the rule should check
|
3284 |
-
* for margin patterns.
|
3285 |
-
* @return {void}
|
3286 |
-
* @method _readDeclarations
|
3287 |
-
* @private
|
3288 |
-
*/
|
3289 |
-
_readDeclarations: function(checkStart, readMargins){
|
3290 |
-
/*
|
3291 |
-
* Reads the pattern
|
3292 |
-
* S* '{' S* declaration [ ';' S* declaration ]* '}' S*
|
3293 |
-
* or
|
3294 |
-
* S* '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S*
|
3295 |
-
* Note that this is how it is described in CSS3 Paged Media, but is actually incorrect.
|
3296 |
-
* A semicolon is only necessary following a declaration is there's another declaration
|
3297 |
-
* or margin afterwards.
|
3298 |
-
*/
|
3299 |
-
var tokenStream = this._tokenStream,
|
3300 |
-
tt;
|
3301 |
-
|
3302 |
-
|
3303 |
-
this._readWhitespace();
|
3304 |
-
|
3305 |
-
if (checkStart){
|
3306 |
-
tokenStream.mustMatch(Tokens.LBRACE);
|
3307 |
-
}
|
3308 |
-
|
3309 |
-
this._readWhitespace();
|
3310 |
-
|
3311 |
-
try {
|
3312 |
-
|
3313 |
-
while(true){
|
3314 |
-
|
3315 |
-
if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){
|
3316 |
-
//noop
|
3317 |
-
} else if (this._declaration()){
|
3318 |
-
if (!tokenStream.match(Tokens.SEMICOLON)){
|
3319 |
-
break;
|
3320 |
-
}
|
3321 |
-
} else {
|
3322 |
-
break;
|
3323 |
-
}
|
3324 |
-
|
3325 |
-
//if ((!this._margin() && !this._declaration()) || !tokenStream.match(Tokens.SEMICOLON)){
|
3326 |
-
// break;
|
3327 |
-
//}
|
3328 |
-
this._readWhitespace();
|
3329 |
-
}
|
3330 |
-
|
3331 |
-
tokenStream.mustMatch(Tokens.RBRACE);
|
3332 |
-
this._readWhitespace();
|
3333 |
-
|
3334 |
-
} catch (ex) {
|
3335 |
-
if (ex instanceof SyntaxError && !this.options.strict){
|
3336 |
-
|
3337 |
-
//fire error event
|
3338 |
-
this.fire({
|
3339 |
-
type: "error",
|
3340 |
-
error: ex,
|
3341 |
-
message: ex.message,
|
3342 |
-
line: ex.line,
|
3343 |
-
col: ex.col
|
3344 |
-
});
|
3345 |
-
|
3346 |
-
//see if there's another declaration
|
3347 |
-
tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]);
|
3348 |
-
if (tt == Tokens.SEMICOLON){
|
3349 |
-
//if there's a semicolon, then there might be another declaration
|
3350 |
-
this._readDeclarations(false, readMargins);
|
3351 |
-
} else if (tt != Tokens.RBRACE){
|
3352 |
-
//if there's a right brace, the rule is finished so don't do anything
|
3353 |
-
//otherwise, rethrow the error because it wasn't handled properly
|
3354 |
-
throw ex;
|
3355 |
-
}
|
3356 |
-
|
3357 |
-
} else {
|
3358 |
-
//not a syntax error, rethrow it
|
3359 |
-
throw ex;
|
3360 |
-
}
|
3361 |
-
}
|
3362 |
-
|
3363 |
-
},
|
3364 |
-
|
3365 |
-
/**
|
3366 |
-
* In some cases, you can end up with two white space tokens in a
|
3367 |
-
* row. Instead of making a change in every function that looks for
|
3368 |
-
* white space, this function is used to match as much white space
|
3369 |
-
* as necessary.
|
3370 |
-
* @method _readWhitespace
|
3371 |
-
* @return {String} The white space if found, empty string if not.
|
3372 |
-
* @private
|
3373 |
-
*/
|
3374 |
-
_readWhitespace: function(){
|
3375 |
-
|
3376 |
-
var tokenStream = this._tokenStream,
|
3377 |
-
ws = "";
|
3378 |
-
|
3379 |
-
while(tokenStream.match(Tokens.S)){
|
3380 |
-
ws += tokenStream.token().value;
|
3381 |
-
}
|
3382 |
-
|
3383 |
-
return ws;
|
3384 |
-
},
|
3385 |
-
|
3386 |
-
|
3387 |
-
/**
|
3388 |
-
* Throws an error when an unexpected token is found.
|
3389 |
-
* @param {Object} token The token that was found.
|
3390 |
-
* @method _unexpectedToken
|
3391 |
-
* @return {void}
|
3392 |
-
* @private
|
3393 |
-
*/
|
3394 |
-
_unexpectedToken: function(token){
|
3395 |
-
throw new SyntaxError("Unexpected token '" + token.value + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol);
|
3396 |
-
},
|
3397 |
-
|
3398 |
-
/**
|
3399 |
-
* Helper method used for parsing subparts of a style sheet.
|
3400 |
-
* @return {void}
|
3401 |
-
* @method _verifyEnd
|
3402 |
-
* @private
|
3403 |
-
*/
|
3404 |
-
_verifyEnd: function(){
|
3405 |
-
if (this._tokenStream.LA(1) != Tokens.EOF){
|
3406 |
-
this._unexpectedToken(this._tokenStream.LT(1));
|
3407 |
-
}
|
3408 |
-
},
|
3409 |
-
|
3410 |
-
//-----------------------------------------------------------------
|
3411 |
-
// Validation methods
|
3412 |
-
//-----------------------------------------------------------------
|
3413 |
-
_validateProperty: function(property, value){
|
3414 |
-
Validation.validate(property, value);
|
3415 |
-
},
|
3416 |
-
|
3417 |
-
//-----------------------------------------------------------------
|
3418 |
-
// Parsing methods
|
3419 |
-
//-----------------------------------------------------------------
|
3420 |
-
|
3421 |
-
parse: function(input){
|
3422 |
-
this._tokenStream = new TokenStream(input, Tokens);
|
3423 |
-
this._stylesheet();
|
3424 |
-
},
|
3425 |
-
|
3426 |
-
parseStyleSheet: function(input){
|
3427 |
-
//just passthrough
|
3428 |
-
return this.parse(input);
|
3429 |
-
},
|
3430 |
-
|
3431 |
-
parseMediaQuery: function(input){
|
3432 |
-
this._tokenStream = new TokenStream(input, Tokens);
|
3433 |
-
var result = this._media_query();
|
3434 |
-
|
3435 |
-
//if there's anything more, then it's an invalid selector
|
3436 |
-
this._verifyEnd();
|
3437 |
-
|
3438 |
-
//otherwise return result
|
3439 |
-
return result;
|
3440 |
-
},
|
3441 |
-
|
3442 |
-
/**
|
3443 |
-
* Parses a property value (everything after the semicolon).
|
3444 |
-
* @return {parserlib.css.PropertyValue} The property value.
|
3445 |
-
* @throws parserlib.util.SyntaxError If an unexpected token is found.
|
3446 |
-
* @method parserPropertyValue
|
3447 |
-
*/
|
3448 |
-
parsePropertyValue: function(input){
|
3449 |
-
|
3450 |
-
this._tokenStream = new TokenStream(input, Tokens);
|
3451 |
-
this._readWhitespace();
|
3452 |
-
|
3453 |
-
var result = this._expr();
|
3454 |
-
|
3455 |
-
//okay to have a trailing white space
|
3456 |
-
this._readWhitespace();
|
3457 |
-
|
3458 |
-
//if there's anything more, then it's an invalid selector
|
3459 |
-
this._verifyEnd();
|
3460 |
-
|
3461 |
-
//otherwise return result
|
3462 |
-
return result;
|
3463 |
-
},
|
3464 |
-
|
3465 |
-
/**
|
3466 |
-
* Parses a complete CSS rule, including selectors and
|
3467 |
-
* properties.
|
3468 |
-
* @param {String} input The text to parser.
|
3469 |
-
* @return {Boolean} True if the parse completed successfully, false if not.
|
3470 |
-
* @method parseRule
|
3471 |
-
*/
|
3472 |
-
parseRule: function(input){
|
3473 |
-
this._tokenStream = new TokenStream(input, Tokens);
|
3474 |
-
|
3475 |
-
//skip any leading white space
|
3476 |
-
this._readWhitespace();
|
3477 |
-
|
3478 |
-
var result = this._ruleset();
|
3479 |
-
|
3480 |
-
//skip any trailing white space
|
3481 |
-
this._readWhitespace();
|
3482 |
-
|
3483 |
-
//if there's anything more, then it's an invalid selector
|
3484 |
-
this._verifyEnd();
|
3485 |
-
|
3486 |
-
//otherwise return result
|
3487 |
-
return result;
|
3488 |
-
},
|
3489 |
-
|
3490 |
-
/**
|
3491 |
-
* Parses a single CSS selector (no comma)
|
3492 |
-
* @param {String} input The text to parse as a CSS selector.
|
3493 |
-
* @return {Selector} An object representing the selector.
|
3494 |
-
* @throws parserlib.util.SyntaxError If an unexpected token is found.
|
3495 |
-
* @method parseSelector
|
3496 |
-
*/
|
3497 |
-
parseSelector: function(input){
|
3498 |
-
|
3499 |
-
this._tokenStream = new TokenStream(input, Tokens);
|
3500 |
-
|
3501 |
-
//skip any leading white space
|
3502 |
-
this._readWhitespace();
|
3503 |
-
|
3504 |
-
var result = this._selector();
|
3505 |
-
|
3506 |
-
//skip any trailing white space
|
3507 |
-
this._readWhitespace();
|
3508 |
-
|
3509 |
-
//if there's anything more, then it's an invalid selector
|
3510 |
-
this._verifyEnd();
|
3511 |
-
|
3512 |
-
//otherwise return result
|
3513 |
-
return result;
|
3514 |
-
},
|
3515 |
-
|
3516 |
-
/**
|
3517 |
-
* Parses an HTML style attribute: a set of CSS declarations
|
3518 |
-
* separated by semicolons.
|
3519 |
-
* @param {String} input The text to parse as a style attribute
|
3520 |
-
* @return {void}
|
3521 |
-
* @method parseStyleAttribute
|
3522 |
-
*/
|
3523 |
-
parseStyleAttribute: function(input){
|
3524 |
-
input += "}"; // for error recovery in _readDeclarations()
|
3525 |
-
this._tokenStream = new TokenStream(input, Tokens);
|
3526 |
-
this._readDeclarations();
|
3527 |
-
}
|
3528 |
-
};
|
3529 |
-
|
3530 |
-
//copy over onto prototype
|
3531 |
-
for (prop in additions){
|
3532 |
-
if (additions.hasOwnProperty(prop)){
|
3533 |
-
proto[prop] = additions[prop];
|
3534 |
-
}
|
3535 |
-
}
|
3536 |
-
|
3537 |
-
return proto;
|
3538 |
-
}();
|
3539 |
-
|
3540 |
-
|
3541 |
-
/*
|
3542 |
-
nth
|
3543 |
-
: S* [ ['-'|'+']? INTEGER? {N} [ S* ['-'|'+'] S* INTEGER ]? |
|
3544 |
-
['-'|'+']? INTEGER | {O}{D}{D} | {E}{V}{E}{N} ] S*
|
3545 |
-
;
|
3546 |
-
*/
|
3547 |
-
/*global Validation, ValidationTypes, ValidationError*/
|
3548 |
-
var Properties = {
|
3549 |
-
|
3550 |
-
//A
|
3551 |
-
"align-items" : "flex-start | flex-end | center | baseline | stretch",
|
3552 |
-
"align-content" : "flex-start | flex-end | center | space-between | space-around | stretch",
|
3553 |
-
"align-self" : "auto | flex-start | flex-end | center | baseline | stretch",
|
3554 |
-
"-webkit-align-items" : "flex-start | flex-end | center | baseline | stretch",
|
3555 |
-
"-webkit-align-content" : "flex-start | flex-end | center | space-between | space-around | stretch",
|
3556 |
-
"-webkit-align-self" : "auto | flex-start | flex-end | center | baseline | stretch",
|
3557 |
-
"alignment-adjust" : "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | <percentage> | <length>",
|
3558 |
-
"alignment-baseline" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical",
|
3559 |
-
"animation" : 1,
|
3560 |
-
"animation-delay" : { multi: "<time>", comma: true },
|
3561 |
-
"animation-direction" : { multi: "normal | alternate", comma: true },
|
3562 |
-
"animation-duration" : { multi: "<time>", comma: true },
|
3563 |
-
"animation-fill-mode" : { multi: "none | forwards | backwards | both", comma: true },
|
3564 |
-
"animation-iteration-count" : { multi: "<number> | infinite", comma: true },
|
3565 |
-
"animation-name" : { multi: "none | <ident>", comma: true },
|
3566 |
-
"animation-play-state" : { multi: "running | paused", comma: true },
|
3567 |
-
"animation-timing-function" : 1,
|
3568 |
-
|
3569 |
-
//vendor prefixed
|
3570 |
-
"-moz-animation-delay" : { multi: "<time>", comma: true },
|
3571 |
-
"-moz-animation-direction" : { multi: "normal | alternate", comma: true },
|
3572 |
-
"-moz-animation-duration" : { multi: "<time>", comma: true },
|
3573 |
-
"-moz-animation-iteration-count" : { multi: "<number> | infinite", comma: true },
|
3574 |
-
"-moz-animation-name" : { multi: "none | <ident>", comma: true },
|
3575 |
-
"-moz-animation-play-state" : { multi: "running | paused", comma: true },
|
3576 |
-
|
3577 |
-
"-ms-animation-delay" : { multi: "<time>", comma: true },
|
3578 |
-
"-ms-animation-direction" : { multi: "normal | alternate", comma: true },
|
3579 |
-
"-ms-animation-duration" : { multi: "<time>", comma: true },
|
3580 |
-
"-ms-animation-iteration-count" : { multi: "<number> | infinite", comma: true },
|
3581 |
-
"-ms-animation-name" : { multi: "none | <ident>", comma: true },
|
3582 |
-
"-ms-animation-play-state" : { multi: "running | paused", comma: true },
|
3583 |
-
|
3584 |
-
"-webkit-animation-delay" : { multi: "<time>", comma: true },
|
3585 |
-
"-webkit-animation-direction" : { multi: "normal | alternate", comma: true },
|
3586 |
-
"-webkit-animation-duration" : { multi: "<time>", comma: true },
|
3587 |
-
"-webkit-animation-fill-mode" : { multi: "none | forwards | backwards | both", comma: true },
|
3588 |
-
"-webkit-animation-iteration-count" : { multi: "<number> | infinite", comma: true },
|
3589 |
-
"-webkit-animation-name" : { multi: "none | <ident>", comma: true },
|
3590 |
-
"-webkit-animation-play-state" : { multi: "running | paused", comma: true },
|
3591 |
-
|
3592 |
-
"-o-animation-delay" : { multi: "<time>", comma: true },
|
3593 |
-
"-o-animation-direction" : { multi: "normal | alternate", comma: true },
|
3594 |
-
"-o-animation-duration" : { multi: "<time>", comma: true },
|
3595 |
-
"-o-animation-iteration-count" : { multi: "<number> | infinite", comma: true },
|
3596 |
-
"-o-animation-name" : { multi: "none | <ident>", comma: true },
|
3597 |
-
"-o-animation-play-state" : { multi: "running | paused", comma: true },
|
3598 |
-
|
3599 |
-
"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",
|
3600 |
-
"azimuth" : function (expression) {
|
3601 |
-
var simple = "<angle> | leftwards | rightwards | inherit",
|
3602 |
-
direction = "left-side | far-left | left | center-left | center | center-right | right | far-right | right-side",
|
3603 |
-
behind = false,
|
3604 |
-
valid = false,
|
3605 |
-
part;
|
3606 |
-
|
3607 |
-
if (!ValidationTypes.isAny(expression, simple)) {
|
3608 |
-
if (ValidationTypes.isAny(expression, "behind")) {
|
3609 |
-
behind = true;
|
3610 |
-
valid = true;
|
3611 |
-
}
|
3612 |
-
|
3613 |
-
if (ValidationTypes.isAny(expression, direction)) {
|
3614 |
-
valid = true;
|
3615 |
-
if (!behind) {
|
3616 |
-
ValidationTypes.isAny(expression, "behind");
|
3617 |
-
}
|
3618 |
-
}
|
3619 |
-
}
|
3620 |
-
|
3621 |
-
if (expression.hasNext()) {
|
3622 |
-
part = expression.next();
|
3623 |
-
if (valid) {
|
3624 |
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
3625 |
-
} else {
|
3626 |
-
throw new ValidationError("Expected (<'azimuth'>) but found '" + part + "'.", part.line, part.col);
|
3627 |
-
}
|
3628 |
-
}
|
3629 |
-
},
|
3630 |
-
|
3631 |
-
//B
|
3632 |
-
"backface-visibility" : "visible | hidden",
|
3633 |
-
"background" : 1,
|
3634 |
-
"background-attachment" : { multi: "<attachment>", comma: true },
|
3635 |
-
"background-clip" : { multi: "<box>", comma: true },
|
3636 |
-
"background-color" : "<color> | inherit",
|
3637 |
-
"background-image" : { multi: "<bg-image>", comma: true },
|
3638 |
-
"background-origin" : { multi: "<box>", comma: true },
|
3639 |
-
"background-position" : { multi: "<bg-position>", comma: true },
|
3640 |
-
"background-repeat" : { multi: "<repeat-style>" },
|
3641 |
-
"background-size" : { multi: "<bg-size>", comma: true },
|
3642 |
-
"baseline-shift" : "baseline | sub | super | <percentage> | <length>",
|
3643 |
-
"behavior" : 1,
|
3644 |
-
"binding" : 1,
|
3645 |
-
"bleed" : "<length>",
|
3646 |
-
"bookmark-label" : "<content> | <attr> | <string>",
|
3647 |
-
"bookmark-level" : "none | <integer>",
|
3648 |
-
"bookmark-state" : "open | closed",
|
3649 |
-
"bookmark-target" : "none | <uri> | <attr>",
|
3650 |
-
"border" : "<border-width> || <border-style> || <color>",
|
3651 |
-
"border-bottom" : "<border-width> || <border-style> || <color>",
|
3652 |
-
"border-bottom-color" : "<color> | inherit",
|
3653 |
-
"border-bottom-left-radius" : "<x-one-radius>",
|
3654 |
-
"border-bottom-right-radius" : "<x-one-radius>",
|
3655 |
-
"border-bottom-style" : "<border-style>",
|
3656 |
-
"border-bottom-width" : "<border-width>",
|
3657 |
-
"border-collapse" : "collapse | separate | inherit",
|
3658 |
-
"border-color" : { multi: "<color> | inherit", max: 4 },
|
3659 |
-
"border-image" : 1,
|
3660 |
-
"border-image-outset" : { multi: "<length> | <number>", max: 4 },
|
3661 |
-
"border-image-repeat" : { multi: "stretch | repeat | round", max: 2 },
|
3662 |
-
"border-image-slice" : function(expression) {
|
3663 |
-
|
3664 |
-
var valid = false,
|
3665 |
-
numeric = "<number> | <percentage>",
|
3666 |
-
fill = false,
|
3667 |
-
count = 0,
|
3668 |
-
max = 4,
|
3669 |
-
part;
|
3670 |
-
|
3671 |
-
if (ValidationTypes.isAny(expression, "fill")) {
|
3672 |
-
fill = true;
|
3673 |
-
valid = true;
|
3674 |
-
}
|
3675 |
-
|
3676 |
-
while (expression.hasNext() && count < max) {
|
3677 |
-
valid = ValidationTypes.isAny(expression, numeric);
|
3678 |
-
if (!valid) {
|
3679 |
-
break;
|
3680 |
-
}
|
3681 |
-
count++;
|
3682 |
-
}
|
3683 |
-
|
3684 |
-
|
3685 |
-
if (!fill) {
|
3686 |
-
ValidationTypes.isAny(expression, "fill");
|
3687 |
-
} else {
|
3688 |
-
valid = true;
|
3689 |
-
}
|
3690 |
-
|
3691 |
-
if (expression.hasNext()) {
|
3692 |
-
part = expression.next();
|
3693 |
-
if (valid) {
|
3694 |
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
3695 |
-
} else {
|
3696 |
-
throw new ValidationError("Expected ([<number> | <percentage>]{1,4} && fill?) but found '" + part + "'.", part.line, part.col);
|
3697 |
-
}
|
3698 |
-
}
|
3699 |
-
},
|
3700 |
-
"border-image-source" : "<image> | none",
|
3701 |
-
"border-image-width" : { multi: "<length> | <percentage> | <number> | auto", max: 4 },
|
3702 |
-
"border-left" : "<border-width> || <border-style> || <color>",
|
3703 |
-
"border-left-color" : "<color> | inherit",
|
3704 |
-
"border-left-style" : "<border-style>",
|
3705 |
-
"border-left-width" : "<border-width>",
|
3706 |
-
"border-radius" : function(expression) {
|
3707 |
-
|
3708 |
-
var valid = false,
|
3709 |
-
simple = "<length> | <percentage> | inherit",
|
3710 |
-
slash = false,
|
3711 |
-
fill = false,
|
3712 |
-
count = 0,
|
3713 |
-
max = 8,
|
3714 |
-
part;
|
3715 |
-
|
3716 |
-
while (expression.hasNext() && count < max) {
|
3717 |
-
valid = ValidationTypes.isAny(expression, simple);
|
3718 |
-
if (!valid) {
|
3719 |
-
|
3720 |
-
if (expression.peek() == "/" && count > 0 && !slash) {
|
3721 |
-
slash = true;
|
3722 |
-
max = count + 5;
|
3723 |
-
expression.next();
|
3724 |
-
} else {
|
3725 |
-
break;
|
3726 |
-
}
|
3727 |
-
}
|
3728 |
-
count++;
|
3729 |
-
}
|
3730 |
-
|
3731 |
-
if (expression.hasNext()) {
|
3732 |
-
part = expression.next();
|
3733 |
-
if (valid) {
|
3734 |
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
3735 |
-
} else {
|
3736 |
-
throw new ValidationError("Expected (<'border-radius'>) but found '" + part + "'.", part.line, part.col);
|
3737 |
-
}
|
3738 |
-
}
|
3739 |
-
},
|
3740 |
-
"border-right" : "<border-width> || <border-style> || <color>",
|
3741 |
-
"border-right-color" : "<color> | inherit",
|
3742 |
-
"border-right-style" : "<border-style>",
|
3743 |
-
"border-right-width" : "<border-width>",
|
3744 |
-
"border-spacing" : { multi: "<length> | inherit", max: 2 },
|
3745 |
-
"border-style" : { multi: "<border-style>", max: 4 },
|
3746 |
-
"border-top" : "<border-width> || <border-style> || <color>",
|
3747 |
-
"border-top-color" : "<color> | inherit",
|
3748 |
-
"border-top-left-radius" : "<x-one-radius>",
|
3749 |
-
"border-top-right-radius" : "<x-one-radius>",
|
3750 |
-
"border-top-style" : "<border-style>",
|
3751 |
-
"border-top-width" : "<border-width>",
|
3752 |
-
"border-width" : { multi: "<border-width>", max: 4 },
|
3753 |
-
"bottom" : "<margin-width> | inherit",
|
3754 |
-
"-moz-box-align" : "start | end | center | baseline | stretch",
|
3755 |
-
"-moz-box-decoration-break" : "slice |clone",
|
3756 |
-
"-moz-box-direction" : "normal | reverse | inherit",
|
3757 |
-
"-moz-box-flex" : "<number>",
|
3758 |
-
"-moz-box-flex-group" : "<integer>",
|
3759 |
-
"-moz-box-lines" : "single | multiple",
|
3760 |
-
"-moz-box-ordinal-group" : "<integer>",
|
3761 |
-
"-moz-box-orient" : "horizontal | vertical | inline-axis | block-axis | inherit",
|
3762 |
-
"-moz-box-pack" : "start | end | center | justify",
|
3763 |
-
"-webkit-box-align" : "start | end | center | baseline | stretch",
|
3764 |
-
"-webkit-box-decoration-break" : "slice |clone",
|
3765 |
-
"-webkit-box-direction" : "normal | reverse | inherit",
|
3766 |
-
"-webkit-box-flex" : "<number>",
|
3767 |
-
"-webkit-box-flex-group" : "<integer>",
|
3768 |
-
"-webkit-box-lines" : "single | multiple",
|
3769 |
-
"-webkit-box-ordinal-group" : "<integer>",
|
3770 |
-
"-webkit-box-orient" : "horizontal | vertical | inline-axis | block-axis | inherit",
|
3771 |
-
"-webkit-box-pack" : "start | end | center | justify",
|
3772 |
-
"box-shadow" : function (expression) {
|
3773 |
-
var result = false,
|
3774 |
-
part;
|
3775 |
-
|
3776 |
-
if (!ValidationTypes.isAny(expression, "none")) {
|
3777 |
-
Validation.multiProperty("<shadow>", expression, true, Infinity);
|
3778 |
-
} else {
|
3779 |
-
if (expression.hasNext()) {
|
3780 |
-
part = expression.next();
|
3781 |
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
3782 |
-
}
|
3783 |
-
}
|
3784 |
-
},
|
3785 |
-
"box-sizing" : "content-box | border-box | inherit",
|
3786 |
-
"break-after" : "auto | always | avoid | left | right | page | column | avoid-page | avoid-column",
|
3787 |
-
"break-before" : "auto | always | avoid | left | right | page | column | avoid-page | avoid-column",
|
3788 |
-
"break-inside" : "auto | avoid | avoid-page | avoid-column",
|
3789 |
-
|
3790 |
-
//C
|
3791 |
-
"caption-side" : "top | bottom | inherit",
|
3792 |
-
"clear" : "none | right | left | both | inherit",
|
3793 |
-
"clip" : 1,
|
3794 |
-
"color" : "<color> | inherit",
|
3795 |
-
"color-profile" : 1,
|
3796 |
-
"column-count" : "<integer> | auto", //http://www.w3.org/TR/css3-multicol/
|
3797 |
-
"column-fill" : "auto | balance",
|
3798 |
-
"column-gap" : "<length> | normal",
|
3799 |
-
"column-rule" : "<border-width> || <border-style> || <color>",
|
3800 |
-
"column-rule-color" : "<color>",
|
3801 |
-
"column-rule-style" : "<border-style>",
|
3802 |
-
"column-rule-width" : "<border-width>",
|
3803 |
-
"column-span" : "none | all",
|
3804 |
-
"column-width" : "<length> | auto",
|
3805 |
-
"columns" : 1,
|
3806 |
-
"content" : 1,
|
3807 |
-
"counter-increment" : 1,
|
3808 |
-
"counter-reset" : 1,
|
3809 |
-
"crop" : "<shape> | auto",
|
3810 |
-
"cue" : "cue-after | cue-before | inherit",
|
3811 |
-
"cue-after" : 1,
|
3812 |
-
"cue-before" : 1,
|
3813 |
-
"cursor" : 1,
|
3814 |
-
|
3815 |
-
//D
|
3816 |
-
"direction" : "ltr | rtl | inherit",
|
3817 |
-
"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 | 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 | -ms-flexbox | -ms-inline-flexbox | flex | -webkit-flex | inline-flex | -webkit-inline-flex",
|
3818 |
-
"dominant-baseline" : 1,
|
3819 |
-
"drop-initial-after-adjust" : "central | middle | after-edge | text-after-edge | ideographic | alphabetic | mathematical | <percentage> | <length>",
|
3820 |
-
"drop-initial-after-align" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical",
|
3821 |
-
"drop-initial-before-adjust" : "before-edge | text-before-edge | central | middle | hanging | mathematical | <percentage> | <length>",
|
3822 |
-
"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",
|
3823 |
-
"drop-initial-size" : "auto | line | <length> | <percentage>",
|
3824 |
-
"drop-initial-value" : "initial | <integer>",
|
3825 |
-
|
3826 |
-
//E
|
3827 |
-
"elevation" : "<angle> | below | level | above | higher | lower | inherit",
|
3828 |
-
"empty-cells" : "show | hide | inherit",
|
3829 |
-
|
3830 |
-
//F
|
3831 |
-
"filter" : 1,
|
3832 |
-
"fit" : "fill | hidden | meet | slice",
|
3833 |
-
"fit-position" : 1,
|
3834 |
-
"flex" : "<flex>",
|
3835 |
-
"flex-basis" : "<width>",
|
3836 |
-
"flex-direction" : "row | row-reverse | column | column-reverse",
|
3837 |
-
"flex-flow" : "<flex-direction> || <flex-wrap>",
|
3838 |
-
"flex-grow" : "<number>",
|
3839 |
-
"flex-shrink" : "<number>",
|
3840 |
-
"flex-wrap" : "nowrap | wrap | wrap-reverse",
|
3841 |
-
"-webkit-flex" : "<flex>",
|
3842 |
-
"-webkit-flex-basis" : "<width>",
|
3843 |
-
"-webkit-flex-direction" : "row | row-reverse | column | column-reverse",
|
3844 |
-
"-webkit-flex-flow" : "<flex-direction> || <flex-wrap>",
|
3845 |
-
"-webkit-flex-grow" : "<number>",
|
3846 |
-
"-webkit-flex-shrink" : "<number>",
|
3847 |
-
"-webkit-flex-wrap" : "nowrap | wrap | wrap-reverse",
|
3848 |
-
"-ms-flex" : "<flex>",
|
3849 |
-
"-ms-flex-align" : "start | end | center | stretch | baseline",
|
3850 |
-
"-ms-flex-direction" : "row | row-reverse | column | column-reverse | inherit",
|
3851 |
-
"-ms-flex-order" : "<number>",
|
3852 |
-
"-ms-flex-pack" : "start | end | center | justify",
|
3853 |
-
"-ms-flex-wrap" : "nowrap | wrap | wrap-reverse",
|
3854 |
-
"float" : "left | right | none | inherit",
|
3855 |
-
"float-offset" : 1,
|
3856 |
-
"font" : 1,
|
3857 |
-
"font-family" : 1,
|
3858 |
-
"font-size" : "<absolute-size> | <relative-size> | <length> | <percentage> | inherit",
|
3859 |
-
"font-size-adjust" : "<number> | none | inherit",
|
3860 |
-
"font-stretch" : "normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | inherit",
|
3861 |
-
"font-style" : "normal | italic | oblique | inherit",
|
3862 |
-
"font-variant" : "normal | small-caps | inherit",
|
3863 |
-
"font-weight" : "normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit",
|
3864 |
-
|
3865 |
-
//G
|
3866 |
-
"grid-cell-stacking" : "columns | rows | layer",
|
3867 |
-
"grid-column" : 1,
|
3868 |
-
"grid-columns" : 1,
|
3869 |
-
"grid-column-align" : "start | end | center | stretch",
|
3870 |
-
"grid-column-sizing" : 1,
|
3871 |
-
"grid-column-span" : "<integer>",
|
3872 |
-
"grid-flow" : "none | rows | columns",
|
3873 |
-
"grid-layer" : "<integer>",
|
3874 |
-
"grid-row" : 1,
|
3875 |
-
"grid-rows" : 1,
|
3876 |
-
"grid-row-align" : "start | end | center | stretch",
|
3877 |
-
"grid-row-span" : "<integer>",
|
3878 |
-
"grid-row-sizing" : 1,
|
3879 |
-
|
3880 |
-
//H
|
3881 |
-
"hanging-punctuation" : 1,
|
3882 |
-
"height" : "<margin-width> | <content-sizing> | inherit",
|
3883 |
-
"hyphenate-after" : "<integer> | auto",
|
3884 |
-
"hyphenate-before" : "<integer> | auto",
|
3885 |
-
"hyphenate-character" : "<string> | auto",
|
3886 |
-
"hyphenate-lines" : "no-limit | <integer>",
|
3887 |
-
"hyphenate-resource" : 1,
|
3888 |
-
"hyphens" : "none | manual | auto",
|
3889 |
-
|
3890 |
-
//I
|
3891 |
-
"icon" : 1,
|
3892 |
-
"image-orientation" : "angle | auto",
|
3893 |
-
"image-rendering" : 1,
|
3894 |
-
"image-resolution" : 1,
|
3895 |
-
"inline-box-align" : "initial | last | <integer>",
|
3896 |
-
|
3897 |
-
//J
|
3898 |
-
"justify-content" : "flex-start | flex-end | center | space-between | space-around",
|
3899 |
-
"-webkit-justify-content" : "flex-start | flex-end | center | space-between | space-around",
|
3900 |
-
|
3901 |
-
//L
|
3902 |
-
"left" : "<margin-width> | inherit",
|
3903 |
-
"letter-spacing" : "<length> | normal | inherit",
|
3904 |
-
"line-height" : "<number> | <length> | <percentage> | normal | inherit",
|
3905 |
-
"line-break" : "auto | loose | normal | strict",
|
3906 |
-
"line-stacking" : 1,
|
3907 |
-
"line-stacking-ruby" : "exclude-ruby | include-ruby",
|
3908 |
-
"line-stacking-shift" : "consider-shifts | disregard-shifts",
|
3909 |
-
"line-stacking-strategy" : "inline-line-height | block-line-height | max-height | grid-height",
|
3910 |
-
"list-style" : 1,
|
3911 |
-
"list-style-image" : "<uri> | none | inherit",
|
3912 |
-
"list-style-position" : "inside | outside | inherit",
|
3913 |
-
"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",
|
3914 |
-
|
3915 |
-
//M
|
3916 |
-
"margin" : { multi: "<margin-width> | inherit", max: 4 },
|
3917 |
-
"margin-bottom" : "<margin-width> | inherit",
|
3918 |
-
"margin-left" : "<margin-width> | inherit",
|
3919 |
-
"margin-right" : "<margin-width> | inherit",
|
3920 |
-
"margin-top" : "<margin-width> | inherit",
|
3921 |
-
"mark" : 1,
|
3922 |
-
"mark-after" : 1,
|
3923 |
-
"mark-before" : 1,
|
3924 |
-
"marks" : 1,
|
3925 |
-
"marquee-direction" : 1,
|
3926 |
-
"marquee-play-count" : 1,
|
3927 |
-
"marquee-speed" : 1,
|
3928 |
-
"marquee-style" : 1,
|
3929 |
-
"max-height" : "<length> | <percentage> | <content-sizing> | none | inherit",
|
3930 |
-
"max-width" : "<length> | <percentage> | <content-sizing> | none | inherit",
|
3931 |
-
"min-height" : "<length> | <percentage> | <content-sizing> | contain-floats | -moz-contain-floats | -webkit-contain-floats | inherit",
|
3932 |
-
"min-width" : "<length> | <percentage> | <content-sizing> | contain-floats | -moz-contain-floats | -webkit-contain-floats | inherit",
|
3933 |
-
"move-to" : 1,
|
3934 |
-
|
3935 |
-
//N
|
3936 |
-
"nav-down" : 1,
|
3937 |
-
"nav-index" : 1,
|
3938 |
-
"nav-left" : 1,
|
3939 |
-
"nav-right" : 1,
|
3940 |
-
"nav-up" : 1,
|
3941 |
-
|
3942 |
-
//O
|
3943 |
-
"opacity" : "<number> | inherit",
|
3944 |
-
"order" : "<integer>",
|
3945 |
-
"-webkit-order" : "<integer>",
|
3946 |
-
"orphans" : "<integer> | inherit",
|
3947 |
-
"outline" : 1,
|
3948 |
-
"outline-color" : "<color> | invert | inherit",
|
3949 |
-
"outline-offset" : 1,
|
3950 |
-
"outline-style" : "<border-style> | inherit",
|
3951 |
-
"outline-width" : "<border-width> | inherit",
|
3952 |
-
"overflow" : "visible | hidden | scroll | auto | inherit",
|
3953 |
-
"overflow-style" : 1,
|
3954 |
-
"overflow-wrap" : "normal | break-word",
|
3955 |
-
"overflow-x" : 1,
|
3956 |
-
"overflow-y" : 1,
|
3957 |
-
|
3958 |
-
//P
|
3959 |
-
"padding" : { multi: "<padding-width> | inherit", max: 4 },
|
3960 |
-
"padding-bottom" : "<padding-width> | inherit",
|
3961 |
-
"padding-left" : "<padding-width> | inherit",
|
3962 |
-
"padding-right" : "<padding-width> | inherit",
|
3963 |
-
"padding-top" : "<padding-width> | inherit",
|
3964 |
-
"page" : 1,
|
3965 |
-
"page-break-after" : "auto | always | avoid | left | right | inherit",
|
3966 |
-
"page-break-before" : "auto | always | avoid | left | right | inherit",
|
3967 |
-
"page-break-inside" : "auto | avoid | inherit",
|
3968 |
-
"page-policy" : 1,
|
3969 |
-
"pause" : 1,
|
3970 |
-
"pause-after" : 1,
|
3971 |
-
"pause-before" : 1,
|
3972 |
-
"perspective" : 1,
|
3973 |
-
"perspective-origin" : 1,
|
3974 |
-
"phonemes" : 1,
|
3975 |
-
"pitch" : 1,
|
3976 |
-
"pitch-range" : 1,
|
3977 |
-
"play-during" : 1,
|
3978 |
-
"pointer-events" : "auto | none | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | inherit",
|
3979 |
-
"position" : "static | relative | absolute | fixed | inherit",
|
3980 |
-
"presentation-level" : 1,
|
3981 |
-
"punctuation-trim" : 1,
|
3982 |
-
|
3983 |
-
//Q
|
3984 |
-
"quotes" : 1,
|
3985 |
-
|
3986 |
-
//R
|
3987 |
-
"rendering-intent" : 1,
|
3988 |
-
"resize" : 1,
|
3989 |
-
"rest" : 1,
|
3990 |
-
"rest-after" : 1,
|
3991 |
-
"rest-before" : 1,
|
3992 |
-
"richness" : 1,
|
3993 |
-
"right" : "<margin-width> | inherit",
|
3994 |
-
"rotation" : 1,
|
3995 |
-
"rotation-point" : 1,
|
3996 |
-
"ruby-align" : 1,
|
3997 |
-
"ruby-overhang" : 1,
|
3998 |
-
"ruby-position" : 1,
|
3999 |
-
"ruby-span" : 1,
|
4000 |
-
|
4001 |
-
//S
|
4002 |
-
"size" : 1,
|
4003 |
-
"speak" : "normal | none | spell-out | inherit",
|
4004 |
-
"speak-header" : "once | always | inherit",
|
4005 |
-
"speak-numeral" : "digits | continuous | inherit",
|
4006 |
-
"speak-punctuation" : "code | none | inherit",
|
4007 |
-
"speech-rate" : 1,
|
4008 |
-
"src" : 1,
|
4009 |
-
"stress" : 1,
|
4010 |
-
"string-set" : 1,
|
4011 |
-
|
4012 |
-
"table-layout" : "auto | fixed | inherit",
|
4013 |
-
"tab-size" : "<integer> | <length>",
|
4014 |
-
"target" : 1,
|
4015 |
-
"target-name" : 1,
|
4016 |
-
"target-new" : 1,
|
4017 |
-
"target-position" : 1,
|
4018 |
-
"text-align" : "left | right | center | justify | inherit" ,
|
4019 |
-
"text-align-last" : 1,
|
4020 |
-
"text-decoration" : 1,
|
4021 |
-
"text-emphasis" : 1,
|
4022 |
-
"text-height" : 1,
|
4023 |
-
"text-indent" : "<length> | <percentage> | inherit",
|
4024 |
-
"text-justify" : "auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida",
|
4025 |
-
"text-outline" : 1,
|
4026 |
-
"text-overflow" : 1,
|
4027 |
-
"text-rendering" : "auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit",
|
4028 |
-
"text-shadow" : 1,
|
4029 |
-
"text-transform" : "capitalize | uppercase | lowercase | none | inherit",
|
4030 |
-
"text-wrap" : "normal | none | avoid",
|
4031 |
-
"top" : "<margin-width> | inherit",
|
4032 |
-
"-ms-touch-action" : "auto | none | pan-x | pan-y",
|
4033 |
-
"touch-action" : "auto | none | pan-x | pan-y",
|
4034 |
-
"transform" : 1,
|
4035 |
-
"transform-origin" : 1,
|
4036 |
-
"transform-style" : 1,
|
4037 |
-
"transition" : 1,
|
4038 |
-
"transition-delay" : 1,
|
4039 |
-
"transition-duration" : 1,
|
4040 |
-
"transition-property" : 1,
|
4041 |
-
"transition-timing-function" : 1,
|
4042 |
-
|
4043 |
-
//U
|
4044 |
-
"unicode-bidi" : "normal | embed | isolate | bidi-override | isolate-override | plaintext | inherit",
|
4045 |
-
"user-modify" : "read-only | read-write | write-only | inherit",
|
4046 |
-
"user-select" : "none | text | toggle | element | elements | all | inherit",
|
4047 |
-
|
4048 |
-
//V
|
4049 |
-
"vertical-align" : "auto | use-script | baseline | sub | super | top | text-top | central | middle | bottom | text-bottom | <percentage> | <length>",
|
4050 |
-
"visibility" : "visible | hidden | collapse | inherit",
|
4051 |
-
"voice-balance" : 1,
|
4052 |
-
"voice-duration" : 1,
|
4053 |
-
"voice-family" : 1,
|
4054 |
-
"voice-pitch" : 1,
|
4055 |
-
"voice-pitch-range" : 1,
|
4056 |
-
"voice-rate" : 1,
|
4057 |
-
"voice-stress" : 1,
|
4058 |
-
"voice-volume" : 1,
|
4059 |
-
"volume" : 1,
|
4060 |
-
|
4061 |
-
//W
|
4062 |
-
"white-space" : "normal | pre | nowrap | pre-wrap | pre-line | inherit | -pre-wrap | -o-pre-wrap | -moz-pre-wrap | -hp-pre-wrap", //http://perishablepress.com/wrapping-content/
|
4063 |
-
"white-space-collapse" : 1,
|
4064 |
-
"widows" : "<integer> | inherit",
|
4065 |
-
"width" : "<length> | <percentage> | <content-sizing> | auto | inherit",
|
4066 |
-
"word-break" : "normal | keep-all | break-all",
|
4067 |
-
"word-spacing" : "<length> | normal | inherit",
|
4068 |
-
"word-wrap" : "normal | break-word",
|
4069 |
-
"writing-mode" : "horizontal-tb | vertical-rl | vertical-lr | lr-tb | rl-tb | tb-rl | bt-rl | tb-lr | bt-lr | lr-bt | rl-bt | lr | rl | tb | inherit",
|
4070 |
-
|
4071 |
-
//Z
|
4072 |
-
"z-index" : "<integer> | auto | inherit",
|
4073 |
-
"zoom" : "<number> | <percentage> | normal"
|
4074 |
-
};
|
4075 |
-
/*global SyntaxUnit, Parser*/
|
4076 |
-
/**
|
4077 |
-
* Represents a selector combinator (whitespace, +, >).
|
4078 |
-
* @namespace parserlib.css
|
4079 |
-
* @class PropertyName
|
4080 |
-
* @extends parserlib.util.SyntaxUnit
|
4081 |
-
* @constructor
|
4082 |
-
* @param {String} text The text representation of the unit.
|
4083 |
-
* @param {String} hack The type of IE hack applied ("*", "_", or null).
|
4084 |
-
* @param {int} line The line of text on which the unit resides.
|
4085 |
-
* @param {int} col The column of text on which the unit resides.
|
4086 |
-
*/
|
4087 |
-
function PropertyName(text, hack, line, col){
|
4088 |
-
|
4089 |
-
SyntaxUnit.call(this, text, line, col, Parser.PROPERTY_NAME_TYPE);
|
4090 |
-
|
4091 |
-
/**
|
4092 |
-
* The type of IE hack applied ("*", "_", or null).
|
4093 |
-
* @type String
|
4094 |
-
* @property hack
|
4095 |
-
*/
|
4096 |
-
this.hack = hack;
|
4097 |
-
|
4098 |
-
}
|
4099 |
-
|
4100 |
-
PropertyName.prototype = new SyntaxUnit();
|
4101 |
-
PropertyName.prototype.constructor = PropertyName;
|
4102 |
-
PropertyName.prototype.toString = function(){
|
4103 |
-
return (this.hack ? this.hack : "") + this.text;
|
4104 |
-
};
|
4105 |
-
/*global SyntaxUnit, Parser*/
|
4106 |
-
/**
|
4107 |
-
* Represents a single part of a CSS property value, meaning that it represents
|
4108 |
-
* just everything single part between ":" and ";". If there are multiple values
|
4109 |
-
* separated by commas, this type represents just one of the values.
|
4110 |
-
* @param {String[]} parts An array of value parts making up this value.
|
4111 |
-
* @param {int} line The line of text on which the unit resides.
|
4112 |
-
* @param {int} col The column of text on which the unit resides.
|
4113 |
-
* @namespace parserlib.css
|
4114 |
-
* @class PropertyValue
|
4115 |
-
* @extends parserlib.util.SyntaxUnit
|
4116 |
-
* @constructor
|
4117 |
-
*/
|
4118 |
-
function PropertyValue(parts, line, col){
|
4119 |
-
|
4120 |
-
SyntaxUnit.call(this, parts.join(" "), line, col, Parser.PROPERTY_VALUE_TYPE);
|
4121 |
-
|
4122 |
-
/**
|
4123 |
-
* The parts that make up the selector.
|
4124 |
-
* @type Array
|
4125 |
-
* @property parts
|
4126 |
-
*/
|
4127 |
-
this.parts = parts;
|
4128 |
-
|
4129 |
-
}
|
4130 |
-
|
4131 |
-
PropertyValue.prototype = new SyntaxUnit();
|
4132 |
-
PropertyValue.prototype.constructor = PropertyValue;
|
4133 |
-
|
4134 |
-
/*global SyntaxUnit, Parser*/
|
4135 |
-
/**
|
4136 |
-
* A utility class that allows for easy iteration over the various parts of a
|
4137 |
-
* property value.
|
4138 |
-
* @param {parserlib.css.PropertyValue} value The property value to iterate over.
|
4139 |
-
* @namespace parserlib.css
|
4140 |
-
* @class PropertyValueIterator
|
4141 |
-
* @constructor
|
4142 |
-
*/
|
4143 |
-
function PropertyValueIterator(value){
|
4144 |
-
|
4145 |
-
/**
|
4146 |
-
* Iterator value
|
4147 |
-
* @type int
|
4148 |
-
* @property _i
|
4149 |
-
* @private
|
4150 |
-
*/
|
4151 |
-
this._i = 0;
|
4152 |
-
|
4153 |
-
/**
|
4154 |
-
* The parts that make up the value.
|
4155 |
-
* @type Array
|
4156 |
-
* @property _parts
|
4157 |
-
* @private
|
4158 |
-
*/
|
4159 |
-
this._parts = value.parts;
|
4160 |
-
|
4161 |
-
/**
|
4162 |
-
* Keeps track of bookmarks along the way.
|
4163 |
-
* @type Array
|
4164 |
-
* @property _marks
|
4165 |
-
* @private
|
4166 |
-
*/
|
4167 |
-
this._marks = [];
|
4168 |
-
|
4169 |
-
/**
|
4170 |
-
* Holds the original property value.
|
4171 |
-
* @type parserlib.css.PropertyValue
|
4172 |
-
* @property value
|
4173 |
-
*/
|
4174 |
-
this.value = value;
|
4175 |
-
|
4176 |
-
}
|
4177 |
-
|
4178 |
-
/**
|
4179 |
-
* Returns the total number of parts in the value.
|
4180 |
-
* @return {int} The total number of parts in the value.
|
4181 |
-
* @method count
|
4182 |
-
*/
|
4183 |
-
PropertyValueIterator.prototype.count = function(){
|
4184 |
-
return this._parts.length;
|
4185 |
-
};
|
4186 |
-
|
4187 |
-
/**
|
4188 |
-
* Indicates if the iterator is positioned at the first item.
|
4189 |
-
* @return {Boolean} True if positioned at first item, false if not.
|
4190 |
-
* @method isFirst
|
4191 |
-
*/
|
4192 |
-
PropertyValueIterator.prototype.isFirst = function(){
|
4193 |
-
return this._i === 0;
|
4194 |
-
};
|
4195 |
-
|
4196 |
-
/**
|
4197 |
-
* Indicates if there are more parts of the property value.
|
4198 |
-
* @return {Boolean} True if there are more parts, false if not.
|
4199 |
-
* @method hasNext
|
4200 |
-
*/
|
4201 |
-
PropertyValueIterator.prototype.hasNext = function(){
|
4202 |
-
return (this._i < this._parts.length);
|
4203 |
-
};
|
4204 |
-
|
4205 |
-
/**
|
4206 |
-
* Marks the current spot in the iteration so it can be restored to
|
4207 |
-
* later on.
|
4208 |
-
* @return {void}
|
4209 |
-
* @method mark
|
4210 |
-
*/
|
4211 |
-
PropertyValueIterator.prototype.mark = function(){
|
4212 |
-
this._marks.push(this._i);
|
4213 |
-
};
|
4214 |
-
|
4215 |
-
/**
|
4216 |
-
* Returns the next part of the property value or null if there is no next
|
4217 |
-
* part. Does not move the internal counter forward.
|
4218 |
-
* @return {parserlib.css.PropertyValuePart} The next part of the property value or null if there is no next
|
4219 |
-
* part.
|
4220 |
-
* @method peek
|
4221 |
-
*/
|
4222 |
-
PropertyValueIterator.prototype.peek = function(count){
|
4223 |
-
return this.hasNext() ? this._parts[this._i + (count || 0)] : null;
|
4224 |
-
};
|
4225 |
-
|
4226 |
-
/**
|
4227 |
-
* Returns the next part of the property value or null if there is no next
|
4228 |
-
* part.
|
4229 |
-
* @return {parserlib.css.PropertyValuePart} The next part of the property value or null if there is no next
|
4230 |
-
* part.
|
4231 |
-
* @method next
|
4232 |
-
*/
|
4233 |
-
PropertyValueIterator.prototype.next = function(){
|
4234 |
-
return this.hasNext() ? this._parts[this._i++] : null;
|
4235 |
-
};
|
4236 |
-
|
4237 |
-
/**
|
4238 |
-
* Returns the previous part of the property value or null if there is no
|
4239 |
-
* previous part.
|
4240 |
-
* @return {parserlib.css.PropertyValuePart} The previous part of the
|
4241 |
-
* property value or null if there is no next part.
|
4242 |
-
* @method previous
|
4243 |
-
*/
|
4244 |
-
PropertyValueIterator.prototype.previous = function(){
|
4245 |
-
return this._i > 0 ? this._parts[--this._i] : null;
|
4246 |
-
};
|
4247 |
-
|
4248 |
-
/**
|
4249 |
-
* Restores the last saved bookmark.
|
4250 |
-
* @return {void}
|
4251 |
-
* @method restore
|
4252 |
-
*/
|
4253 |
-
PropertyValueIterator.prototype.restore = function(){
|
4254 |
-
if (this._marks.length){
|
4255 |
-
this._i = this._marks.pop();
|
4256 |
-
}
|
4257 |
-
};
|
4258 |
-
|
4259 |
-
/*global SyntaxUnit, Parser, Colors*/
|
4260 |
-
/**
|
4261 |
-
* Represents a single part of a CSS property value, meaning that it represents
|
4262 |
-
* just one part of the data between ":" and ";".
|
4263 |
-
* @param {String} text The text representation of the unit.
|
4264 |
-
* @param {int} line The line of text on which the unit resides.
|
4265 |
-
* @param {int} col The column of text on which the unit resides.
|
4266 |
-
* @namespace parserlib.css
|
4267 |
-
* @class PropertyValuePart
|
4268 |
-
* @extends parserlib.util.SyntaxUnit
|
4269 |
-
* @constructor
|
4270 |
-
*/
|
4271 |
-
function PropertyValuePart(text, line, col){
|
4272 |
-
|
4273 |
-
SyntaxUnit.call(this, text, line, col, Parser.PROPERTY_VALUE_PART_TYPE);
|
4274 |
-
|
4275 |
-
/**
|
4276 |
-
* Indicates the type of value unit.
|
4277 |
-
* @type String
|
4278 |
-
* @property type
|
4279 |
-
*/
|
4280 |
-
this.type = "unknown";
|
4281 |
-
|
4282 |
-
//figure out what type of data it is
|
4283 |
-
|
4284 |
-
var temp;
|
4285 |
-
|
4286 |
-
//it is a measurement?
|
4287 |
-
if (/^([+\-]?[\d\.]+)([a-z]+)$/i.test(text)){ //dimension
|
4288 |
-
this.type = "dimension";
|
4289 |
-
this.value = +RegExp.$1;
|
4290 |
-
this.units = RegExp.$2;
|
4291 |
-
|
4292 |
-
//try to narrow down
|
4293 |
-
switch(this.units.toLowerCase()){
|
4294 |
-
|
4295 |
-
case "em":
|
4296 |
-
case "rem":
|
4297 |
-
case "ex":
|
4298 |
-
case "px":
|
4299 |
-
case "cm":
|
4300 |
-
case "mm":
|
4301 |
-
case "in":
|
4302 |
-
case "pt":
|
4303 |
-
case "pc":
|
4304 |
-
case "ch":
|
4305 |
-
case "vh":
|
4306 |
-
case "vw":
|
4307 |
-
case "vmax":
|
4308 |
-
case "vmin":
|
4309 |
-
this.type = "length";
|
4310 |
-
break;
|
4311 |
-
|
4312 |
-
case "deg":
|
4313 |
-
case "rad":
|
4314 |
-
case "grad":
|
4315 |
-
this.type = "angle";
|
4316 |
-
break;
|
4317 |
-
|
4318 |
-
case "ms":
|
4319 |
-
case "s":
|
4320 |
-
this.type = "time";
|
4321 |
-
break;
|
4322 |
-
|
4323 |
-
case "hz":
|
4324 |
-
case "khz":
|
4325 |
-
this.type = "frequency";
|
4326 |
-
break;
|
4327 |
-
|
4328 |
-
case "dpi":
|
4329 |
-
case "dpcm":
|
4330 |
-
this.type = "resolution";
|
4331 |
-
break;
|
4332 |
-
|
4333 |
-
//default
|
4334 |
-
|
4335 |
-
}
|
4336 |
-
|
4337 |
-
} else if (/^([+\-]?[\d\.]+)%$/i.test(text)){ //percentage
|
4338 |
-
this.type = "percentage";
|
4339 |
-
this.value = +RegExp.$1;
|
4340 |
-
} else if (/^([+\-]?\d+)$/i.test(text)){ //integer
|
4341 |
-
this.type = "integer";
|
4342 |
-
this.value = +RegExp.$1;
|
4343 |
-
} else if (/^([+\-]?[\d\.]+)$/i.test(text)){ //number
|
4344 |
-
this.type = "number";
|
4345 |
-
this.value = +RegExp.$1;
|
4346 |
-
|
4347 |
-
} else if (/^#([a-f0-9]{3,6})/i.test(text)){ //hexcolor
|
4348 |
-
this.type = "color";
|
4349 |
-
temp = RegExp.$1;
|
4350 |
-
if (temp.length == 3){
|
4351 |
-
this.red = parseInt(temp.charAt(0)+temp.charAt(0),16);
|
4352 |
-
this.green = parseInt(temp.charAt(1)+temp.charAt(1),16);
|
4353 |
-
this.blue = parseInt(temp.charAt(2)+temp.charAt(2),16);
|
4354 |
-
} else {
|
4355 |
-
this.red = parseInt(temp.substring(0,2),16);
|
4356 |
-
this.green = parseInt(temp.substring(2,4),16);
|
4357 |
-
this.blue = parseInt(temp.substring(4,6),16);
|
4358 |
-
}
|
4359 |
-
} else if (/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i.test(text)){ //rgb() color with absolute numbers
|
4360 |
-
this.type = "color";
|
4361 |
-
this.red = +RegExp.$1;
|
4362 |
-
this.green = +RegExp.$2;
|
4363 |
-
this.blue = +RegExp.$3;
|
4364 |
-
} else if (/^rgb\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)/i.test(text)){ //rgb() color with percentages
|
4365 |
-
this.type = "color";
|
4366 |
-
this.red = +RegExp.$1 * 255 / 100;
|
4367 |
-
this.green = +RegExp.$2 * 255 / 100;
|
4368 |
-
this.blue = +RegExp.$3 * 255 / 100;
|
4369 |
-
} else if (/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d\.]+)\s*\)/i.test(text)){ //rgba() color with absolute numbers
|
4370 |
-
this.type = "color";
|
4371 |
-
this.red = +RegExp.$1;
|
4372 |
-
this.green = +RegExp.$2;
|
4373 |
-
this.blue = +RegExp.$3;
|
4374 |
-
this.alpha = +RegExp.$4;
|
4375 |
-
} else if (/^rgba\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d\.]+)\s*\)/i.test(text)){ //rgba() color with percentages
|
4376 |
-
this.type = "color";
|
4377 |
-
this.red = +RegExp.$1 * 255 / 100;
|
4378 |
-
this.green = +RegExp.$2 * 255 / 100;
|
4379 |
-
this.blue = +RegExp.$3 * 255 / 100;
|
4380 |
-
this.alpha = +RegExp.$4;
|
4381 |
-
} else if (/^hsl\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)/i.test(text)){ //hsl()
|
4382 |
-
this.type = "color";
|
4383 |
-
this.hue = +RegExp.$1;
|
4384 |
-
this.saturation = +RegExp.$2 / 100;
|
4385 |
-
this.lightness = +RegExp.$3 / 100;
|
4386 |
-
} else if (/^hsla\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d\.]+)\s*\)/i.test(text)){ //hsla() color with percentages
|
4387 |
-
this.type = "color";
|
4388 |
-
this.hue = +RegExp.$1;
|
4389 |
-
this.saturation = +RegExp.$2 / 100;
|
4390 |
-
this.lightness = +RegExp.$3 / 100;
|
4391 |
-
this.alpha = +RegExp.$4;
|
4392 |
-
} else if (/^url\(["']?([^\)"']+)["']?\)/i.test(text)){ //URI
|
4393 |
-
this.type = "uri";
|
4394 |
-
this.uri = RegExp.$1;
|
4395 |
-
} else if (/^([^\(]+)\(/i.test(text)){
|
4396 |
-
this.type = "function";
|
4397 |
-
this.name = RegExp.$1;
|
4398 |
-
this.value = text;
|
4399 |
-
} else if (/^["'][^"']*["']/.test(text)){ //string
|
4400 |
-
this.type = "string";
|
4401 |
-
this.value = eval(text);
|
4402 |
-
} else if (Colors[text.toLowerCase()]){ //named color
|
4403 |
-
this.type = "color";
|
4404 |
-
temp = Colors[text.toLowerCase()].substring(1);
|
4405 |
-
this.red = parseInt(temp.substring(0,2),16);
|
4406 |
-
this.green = parseInt(temp.substring(2,4),16);
|
4407 |
-
this.blue = parseInt(temp.substring(4,6),16);
|
4408 |
-
} else if (/^[\,\/]$/.test(text)){
|
4409 |
-
this.type = "operator";
|
4410 |
-
this.value = text;
|
4411 |
-
} else if (/^[a-z\-_\u0080-\uFFFF][a-z0-9\-_\u0080-\uFFFF]*$/i.test(text)){
|
4412 |
-
this.type = "identifier";
|
4413 |
-
this.value = text;
|
4414 |
-
}
|
4415 |
-
|
4416 |
-
}
|
4417 |
-
|
4418 |
-
PropertyValuePart.prototype = new SyntaxUnit();
|
4419 |
-
PropertyValuePart.prototype.constructor = PropertyValuePart;
|
4420 |
-
|
4421 |
-
/**
|
4422 |
-
* Create a new syntax unit based solely on the given token.
|
4423 |
-
* Convenience method for creating a new syntax unit when
|
4424 |
-
* it represents a single token instead of multiple.
|
4425 |
-
* @param {Object} token The token object to represent.
|
4426 |
-
* @return {parserlib.css.PropertyValuePart} The object representing the token.
|
4427 |
-
* @static
|
4428 |
-
* @method fromToken
|
4429 |
-
*/
|
4430 |
-
PropertyValuePart.fromToken = function(token){
|
4431 |
-
return new PropertyValuePart(token.value, token.startLine, token.startCol);
|
4432 |
-
};
|
4433 |
-
var Pseudos = {
|
4434 |
-
":first-letter": 1,
|
4435 |
-
":first-line": 1,
|
4436 |
-
":before": 1,
|
4437 |
-
":after": 1
|
4438 |
-
};
|
4439 |
-
|
4440 |
-
Pseudos.ELEMENT = 1;
|
4441 |
-
Pseudos.CLASS = 2;
|
4442 |
-
|
4443 |
-
Pseudos.isElement = function(pseudo){
|
4444 |
-
return pseudo.indexOf("::") === 0 || Pseudos[pseudo.toLowerCase()] == Pseudos.ELEMENT;
|
4445 |
-
};
|
4446 |
-
/*global SyntaxUnit, Parser, Specificity*/
|
4447 |
-
/**
|
4448 |
-
* Represents an entire single selector, including all parts but not
|
4449 |
-
* including multiple selectors (those separated by commas).
|
4450 |
-
* @namespace parserlib.css
|
4451 |
-
* @class Selector
|
4452 |
-
* @extends parserlib.util.SyntaxUnit
|
4453 |
-
* @constructor
|
4454 |
-
* @param {Array} parts Array of selectors parts making up this selector.
|
4455 |
-
* @param {int} line The line of text on which the unit resides.
|
4456 |
-
* @param {int} col The column of text on which the unit resides.
|
4457 |
-
*/
|
4458 |
-
function Selector(parts, line, col){
|
4459 |
-
|
4460 |
-
SyntaxUnit.call(this, parts.join(" "), line, col, Parser.SELECTOR_TYPE);
|
4461 |
-
|
4462 |
-
/**
|
4463 |
-
* The parts that make up the selector.
|
4464 |
-
* @type Array
|
4465 |
-
* @property parts
|
4466 |
-
*/
|
4467 |
-
this.parts = parts;
|
4468 |
-
|
4469 |
-
/**
|
4470 |
-
* The specificity of the selector.
|
4471 |
-
* @type parserlib.css.Specificity
|
4472 |
-
* @property specificity
|
4473 |
-
*/
|
4474 |
-
this.specificity = Specificity.calculate(this);
|
4475 |
-
|
4476 |
-
}
|
4477 |
-
|
4478 |
-
Selector.prototype = new SyntaxUnit();
|
4479 |
-
Selector.prototype.constructor = Selector;
|
4480 |
-
|
4481 |
-
/*global SyntaxUnit, Parser*/
|
4482 |
-
/**
|
4483 |
-
* Represents a single part of a selector string, meaning a single set of
|
4484 |
-
* element name and modifiers. This does not include combinators such as
|
4485 |
-
* spaces, +, >, etc.
|
4486 |
-
* @namespace parserlib.css
|
4487 |
-
* @class SelectorPart
|
4488 |
-
* @extends parserlib.util.SyntaxUnit
|
4489 |
-
* @constructor
|
4490 |
-
* @param {String} elementName The element name in the selector or null
|
4491 |
-
* if there is no element name.
|
4492 |
-
* @param {Array} modifiers Array of individual modifiers for the element.
|
4493 |
-
* May be empty if there are none.
|
4494 |
-
* @param {String} text The text representation of the unit.
|
4495 |
-
* @param {int} line The line of text on which the unit resides.
|
4496 |
-
* @param {int} col The column of text on which the unit resides.
|
4497 |
-
*/
|
4498 |
-
function SelectorPart(elementName, modifiers, text, line, col){
|
4499 |
-
|
4500 |
-
SyntaxUnit.call(this, text, line, col, Parser.SELECTOR_PART_TYPE);
|
4501 |
-
|
4502 |
-
/**
|
4503 |
-
* The tag name of the element to which this part
|
4504 |
-
* of the selector affects.
|
4505 |
-
* @type String
|
4506 |
-
* @property elementName
|
4507 |
-
*/
|
4508 |
-
this.elementName = elementName;
|
4509 |
-
|
4510 |
-
/**
|
4511 |
-
* The parts that come after the element name, such as class names, IDs,
|
4512 |
-
* pseudo classes/elements, etc.
|
4513 |
-
* @type Array
|
4514 |
-
* @property modifiers
|
4515 |
-
*/
|
4516 |
-
this.modifiers = modifiers;
|
4517 |
-
|
4518 |
-
}
|
4519 |
-
|
4520 |
-
SelectorPart.prototype = new SyntaxUnit();
|
4521 |
-
SelectorPart.prototype.constructor = SelectorPart;
|
4522 |
-
|
4523 |
-
/*global SyntaxUnit, Parser*/
|
4524 |
-
/**
|
4525 |
-
* Represents a selector modifier string, meaning a class name, element name,
|
4526 |
-
* element ID, pseudo rule, etc.
|
4527 |
-
* @namespace parserlib.css
|
4528 |
-
* @class SelectorSubPart
|
4529 |
-
* @extends parserlib.util.SyntaxUnit
|
4530 |
-
* @constructor
|
4531 |
-
* @param {String} text The text representation of the unit.
|
4532 |
-
* @param {String} type The type of selector modifier.
|
4533 |
-
* @param {int} line The line of text on which the unit resides.
|
4534 |
-
* @param {int} col The column of text on which the unit resides.
|
4535 |
-
*/
|
4536 |
-
function SelectorSubPart(text, type, line, col){
|
4537 |
-
|
4538 |
-
SyntaxUnit.call(this, text, line, col, Parser.SELECTOR_SUB_PART_TYPE);
|
4539 |
-
|
4540 |
-
/**
|
4541 |
-
* The type of modifier.
|
4542 |
-
* @type String
|
4543 |
-
* @property type
|
4544 |
-
*/
|
4545 |
-
this.type = type;
|
4546 |
-
|
4547 |
-
/**
|
4548 |
-
* Some subparts have arguments, this represents them.
|
4549 |
-
* @type Array
|
4550 |
-
* @property args
|
4551 |
-
*/
|
4552 |
-
this.args = [];
|
4553 |
-
|
4554 |
-
}
|
4555 |
-
|
4556 |
-
SelectorSubPart.prototype = new SyntaxUnit();
|
4557 |
-
SelectorSubPart.prototype.constructor = SelectorSubPart;
|
4558 |
-
|
4559 |
-
/*global Pseudos, SelectorPart*/
|
4560 |
-
/**
|
4561 |
-
* Represents a selector's specificity.
|
4562 |
-
* @namespace parserlib.css
|
4563 |
-
* @class Specificity
|
4564 |
-
* @constructor
|
4565 |
-
* @param {int} a Should be 1 for inline styles, zero for stylesheet styles
|
4566 |
-
* @param {int} b Number of ID selectors
|
4567 |
-
* @param {int} c Number of classes and pseudo classes
|
4568 |
-
* @param {int} d Number of element names and pseudo elements
|
4569 |
-
*/
|
4570 |
-
function Specificity(a, b, c, d){
|
4571 |
-
this.a = a;
|
4572 |
-
this.b = b;
|
4573 |
-
this.c = c;
|
4574 |
-
this.d = d;
|
4575 |
-
}
|
4576 |
-
|
4577 |
-
Specificity.prototype = {
|
4578 |
-
constructor: Specificity,
|
4579 |
-
|
4580 |
-
/**
|
4581 |
-
* Compare this specificity to another.
|
4582 |
-
* @param {Specificity} other The other specificity to compare to.
|
4583 |
-
* @return {int} -1 if the other specificity is larger, 1 if smaller, 0 if equal.
|
4584 |
-
* @method compare
|
4585 |
-
*/
|
4586 |
-
compare: function(other){
|
4587 |
-
var comps = ["a", "b", "c", "d"],
|
4588 |
-
i, len;
|
4589 |
-
|
4590 |
-
for (i=0, len=comps.length; i < len; i++){
|
4591 |
-
if (this[comps[i]] < other[comps[i]]){
|
4592 |
-
return -1;
|
4593 |
-
} else if (this[comps[i]] > other[comps[i]]){
|
4594 |
-
return 1;
|
4595 |
-
}
|
4596 |
-
}
|
4597 |
-
|
4598 |
-
return 0;
|
4599 |
-
},
|
4600 |
-
|
4601 |
-
/**
|
4602 |
-
* Creates a numeric value for the specificity.
|
4603 |
-
* @return {int} The numeric value for the specificity.
|
4604 |
-
* @method valueOf
|
4605 |
-
*/
|
4606 |
-
valueOf: function(){
|
4607 |
-
return (this.a * 1000) + (this.b * 100) + (this.c * 10) + this.d;
|
4608 |
-
},
|
4609 |
-
|
4610 |
-
/**
|
4611 |
-
* Returns a string representation for specificity.
|
4612 |
-
* @return {String} The string representation of specificity.
|
4613 |
-
* @method toString
|
4614 |
-
*/
|
4615 |
-
toString: function(){
|
4616 |
-
return this.a + "," + this.b + "," + this.c + "," + this.d;
|
4617 |
-
}
|
4618 |
-
|
4619 |
-
};
|
4620 |
-
|
4621 |
-
/**
|
4622 |
-
* Calculates the specificity of the given selector.
|
4623 |
-
* @param {parserlib.css.Selector} The selector to calculate specificity for.
|
4624 |
-
* @return {parserlib.css.Specificity} The specificity of the selector.
|
4625 |
-
* @static
|
4626 |
-
* @method calculate
|
4627 |
-
*/
|
4628 |
-
Specificity.calculate = function(selector){
|
4629 |
-
|
4630 |
-
var i, len,
|
4631 |
-
part,
|
4632 |
-
b=0, c=0, d=0;
|
4633 |
-
|
4634 |
-
function updateValues(part){
|
4635 |
-
|
4636 |
-
var i, j, len, num,
|
4637 |
-
elementName = part.elementName ? part.elementName.text : "",
|
4638 |
-
modifier;
|
4639 |
-
|
4640 |
-
if (elementName && elementName.charAt(elementName.length-1) != "*") {
|
4641 |
-
d++;
|
4642 |
-
}
|
4643 |
-
|
4644 |
-
for (i=0, len=part.modifiers.length; i < len; i++){
|
4645 |
-
modifier = part.modifiers[i];
|
4646 |
-
switch(modifier.type){
|
4647 |
-
case "class":
|
4648 |
-
case "attribute":
|
4649 |
-
c++;
|
4650 |
-
break;
|
4651 |
-
|
4652 |
-
case "id":
|
4653 |
-
b++;
|
4654 |
-
break;
|
4655 |
-
|
4656 |
-
case "pseudo":
|
4657 |
-
if (Pseudos.isElement(modifier.text)){
|
4658 |
-
d++;
|
4659 |
-
} else {
|
4660 |
-
c++;
|
4661 |
-
}
|
4662 |
-
break;
|
4663 |
-
|
4664 |
-
case "not":
|
4665 |
-
for (j=0, num=modifier.args.length; j < num; j++){
|
4666 |
-
updateValues(modifier.args[j]);
|
4667 |
-
}
|
4668 |
-
}
|
4669 |
-
}
|
4670 |
-
}
|
4671 |
-
|
4672 |
-
for (i=0, len=selector.parts.length; i < len; i++){
|
4673 |
-
part = selector.parts[i];
|
4674 |
-
|
4675 |
-
if (part instanceof SelectorPart){
|
4676 |
-
updateValues(part);
|
4677 |
-
}
|
4678 |
-
}
|
4679 |
-
|
4680 |
-
return new Specificity(0, b, c, d);
|
4681 |
-
};
|
4682 |
-
/*global Tokens, TokenStreamBase*/
|
4683 |
-
|
4684 |
-
var h = /^[0-9a-fA-F]$/,
|
4685 |
-
nonascii = /^[\u0080-\uFFFF]$/,
|
4686 |
-
nl = /\n|\r\n|\r|\f/;
|
4687 |
-
|
4688 |
-
//-----------------------------------------------------------------------------
|
4689 |
-
// Helper functions
|
4690 |
-
//-----------------------------------------------------------------------------
|
4691 |
-
|
4692 |
-
|
4693 |
-
function isHexDigit(c){
|
4694 |
-
return c !== null && h.test(c);
|
4695 |
-
}
|
4696 |
-
|
4697 |
-
function isDigit(c){
|
4698 |
-
return c !== null && /\d/.test(c);
|
4699 |
-
}
|
4700 |
-
|
4701 |
-
function isWhitespace(c){
|
4702 |
-
return c !== null && /\s/.test(c);
|
4703 |
-
}
|
4704 |
-
|
4705 |
-
function isNewLine(c){
|
4706 |
-
return c !== null && nl.test(c);
|
4707 |
-
}
|
4708 |
-
|
4709 |
-
function isNameStart(c){
|
4710 |
-
return c !== null && (/[a-z_\u0080-\uFFFF\\]/i.test(c));
|
4711 |
-
}
|
4712 |
-
|
4713 |
-
function isNameChar(c){
|
4714 |
-
return c !== null && (isNameStart(c) || /[0-9\-\\]/.test(c));
|
4715 |
-
}
|
4716 |
-
|
4717 |
-
function isIdentStart(c){
|
4718 |
-
return c !== null && (isNameStart(c) || /\-\\/.test(c));
|
4719 |
-
}
|
4720 |
-
|
4721 |
-
function mix(receiver, supplier){
|
4722 |
-
for (var prop in supplier){
|
4723 |
-
if (supplier.hasOwnProperty(prop)){
|
4724 |
-
receiver[prop] = supplier[prop];
|
4725 |
-
}
|
4726 |
-
}
|
4727 |
-
return receiver;
|
4728 |
-
}
|
4729 |
-
|
4730 |
-
//-----------------------------------------------------------------------------
|
4731 |
-
// CSS Token Stream
|
4732 |
-
//-----------------------------------------------------------------------------
|
4733 |
-
|
4734 |
-
|
4735 |
-
/**
|
4736 |
-
* A token stream that produces CSS tokens.
|
4737 |
-
* @param {String|Reader} input The source of text to tokenize.
|
4738 |
-
* @constructor
|
4739 |
-
* @class TokenStream
|
4740 |
-
* @namespace parserlib.css
|
4741 |
-
*/
|
4742 |
-
function TokenStream(input){
|
4743 |
-
TokenStreamBase.call(this, input, Tokens);
|
4744 |
-
}
|
4745 |
-
|
4746 |
-
TokenStream.prototype = mix(new TokenStreamBase(), {
|
4747 |
-
|
4748 |
-
/**
|
4749 |
-
* Overrides the TokenStreamBase method of the same name
|
4750 |
-
* to produce CSS tokens.
|
4751 |
-
* @param {variant} channel The name of the channel to use
|
4752 |
-
* for the next token.
|
4753 |
-
* @return {Object} A token object representing the next token.
|
4754 |
-
* @method _getToken
|
4755 |
-
* @private
|
4756 |
-
*/
|
4757 |
-
_getToken: function(channel){
|
4758 |
-
|
4759 |
-
var c,
|
4760 |
-
reader = this._reader,
|
4761 |
-
token = null,
|
4762 |
-
startLine = reader.getLine(),
|
4763 |
-
startCol = reader.getCol();
|
4764 |
-
|
4765 |
-
c = reader.read();
|
4766 |
-
|
4767 |
-
|
4768 |
-
while(c){
|
4769 |
-
switch(c){
|
4770 |
-
|
4771 |
-
/*
|
4772 |
-
* Potential tokens:
|
4773 |
-
* - COMMENT
|
4774 |
-
* - SLASH
|
4775 |
-
* - CHAR
|
4776 |
-
*/
|
4777 |
-
case "/":
|
4778 |
-
|
4779 |
-
if(reader.peek() == "*"){
|
4780 |
-
token = this.commentToken(c, startLine, startCol);
|
4781 |
-
} else {
|
4782 |
-
token = this.charToken(c, startLine, startCol);
|
4783 |
-
}
|
4784 |
-
break;
|
4785 |
-
|
4786 |
-
/*
|
4787 |
-
* Potential tokens:
|
4788 |
-
* - DASHMATCH
|
4789 |
-
* - INCLUDES
|
4790 |
-
* - PREFIXMATCH
|
4791 |
-
* - SUFFIXMATCH
|
4792 |
-
* - SUBSTRINGMATCH
|
4793 |
-
* - CHAR
|
4794 |
-
*/
|
4795 |
-
case "|":
|
4796 |
-
case "~":
|
4797 |
-
case "^":
|
4798 |
-
case "$":
|
4799 |
-
case "*":
|
4800 |
-
if(reader.peek() == "="){
|
4801 |
-
token = this.comparisonToken(c, startLine, startCol);
|
4802 |
-
} else {
|
4803 |
-
token = this.charToken(c, startLine, startCol);
|
4804 |
-
}
|
4805 |
-
break;
|
4806 |
-
|
4807 |
-
/*
|
4808 |
-
* Potential tokens:
|
4809 |
-
* - STRING
|
4810 |
-
* - INVALID
|
4811 |
-
*/
|
4812 |
-
case "\"":
|
4813 |
-
case "'":
|
4814 |
-
token = this.stringToken(c, startLine, startCol);
|
4815 |
-
break;
|
4816 |
-
|
4817 |
-
/*
|
4818 |
-
* Potential tokens:
|
4819 |
-
* - HASH
|
4820 |
-
* - CHAR
|
4821 |
-
*/
|
4822 |
-
case "#":
|
4823 |
-
if (isNameChar(reader.peek())){
|
4824 |
-
token = this.hashToken(c, startLine, startCol);
|
4825 |
-
} else {
|
4826 |
-
token = this.charToken(c, startLine, startCol);
|
4827 |
-
}
|
4828 |
-
break;
|
4829 |
-
|
4830 |
-
/*
|
4831 |
-
* Potential tokens:
|
4832 |
-
* - DOT
|
4833 |
-
* - NUMBER
|
4834 |
-
* - DIMENSION
|
4835 |
-
* - PERCENTAGE
|
4836 |
-
*/
|
4837 |
-
case ".":
|
4838 |
-
if (isDigit(reader.peek())){
|
4839 |
-
token = this.numberToken(c, startLine, startCol);
|
4840 |
-
} else {
|
4841 |
-
token = this.charToken(c, startLine, startCol);
|
4842 |
-
}
|
4843 |
-
break;
|
4844 |
-
|
4845 |
-
/*
|
4846 |
-
* Potential tokens:
|
4847 |
-
* - CDC
|
4848 |
-
* - MINUS
|
4849 |
-
* - NUMBER
|
4850 |
-
* - DIMENSION
|
4851 |
-
* - PERCENTAGE
|
4852 |
-
*/
|
4853 |
-
case "-":
|
4854 |
-
if (reader.peek() == "-"){ //could be closing HTML-style comment
|
4855 |
-
token = this.htmlCommentEndToken(c, startLine, startCol);
|
4856 |
-
} else if (isNameStart(reader.peek())){
|
4857 |
-
token = this.identOrFunctionToken(c, startLine, startCol);
|
4858 |
-
} else {
|
4859 |
-
token = this.charToken(c, startLine, startCol);
|
4860 |
-
}
|
4861 |
-
break;
|
4862 |
-
|
4863 |
-
/*
|
4864 |
-
* Potential tokens:
|
4865 |
-
* - IMPORTANT_SYM
|
4866 |
-
* - CHAR
|
4867 |
-
*/
|
4868 |
-
case "!":
|
4869 |
-
token = this.importantToken(c, startLine, startCol);
|
4870 |
-
break;
|
4871 |
-
|
4872 |
-
/*
|
4873 |
-
* Any at-keyword or CHAR
|
4874 |
-
*/
|
4875 |
-
case "@":
|
4876 |
-
token = this.atRuleToken(c, startLine, startCol);
|
4877 |
-
break;
|
4878 |
-
|
4879 |
-
/*
|
4880 |
-
* Potential tokens:
|
4881 |
-
* - NOT
|
4882 |
-
* - CHAR
|
4883 |
-
*/
|
4884 |
-
case ":":
|
4885 |
-
token = this.notToken(c, startLine, startCol);
|
4886 |
-
break;
|
4887 |
-
|
4888 |
-
/*
|
4889 |
-
* Potential tokens:
|
4890 |
-
* - CDO
|
4891 |
-
* - CHAR
|
4892 |
-
*/
|
4893 |
-
case "<":
|
4894 |
-
token = this.htmlCommentStartToken(c, startLine, startCol);
|
4895 |
-
break;
|
4896 |
-
|
4897 |
-
/*
|
4898 |
-
* Potential tokens:
|
4899 |
-
* - UNICODE_RANGE
|
4900 |
-
* - URL
|
4901 |
-
* - CHAR
|
4902 |
-
*/
|
4903 |
-
case "U":
|
4904 |
-
case "u":
|
4905 |
-
if (reader.peek() == "+"){
|
4906 |
-
token = this.unicodeRangeToken(c, startLine, startCol);
|
4907 |
-
break;
|
4908 |
-
}
|
4909 |
-
/* falls through */
|
4910 |
-
default:
|
4911 |
-
|
4912 |
-
/*
|
4913 |
-
* Potential tokens:
|
4914 |
-
* - NUMBER
|
4915 |
-
* - DIMENSION
|
4916 |
-
* - LENGTH
|
4917 |
-
* - FREQ
|
4918 |
-
* - TIME
|
4919 |
-
* - EMS
|
4920 |
-
* - EXS
|
4921 |
-
* - ANGLE
|
4922 |
-
*/
|
4923 |
-
if (isDigit(c)){
|
4924 |
-
token = this.numberToken(c, startLine, startCol);
|
4925 |
-
} else
|
4926 |
-
|
4927 |
-
/*
|
4928 |
-
* Potential tokens:
|
4929 |
-
* - S
|
4930 |
-
*/
|
4931 |
-
if (isWhitespace(c)){
|
4932 |
-
token = this.whitespaceToken(c, startLine, startCol);
|
4933 |
-
} else
|
4934 |
-
|
4935 |
-
/*
|
4936 |
-
* Potential tokens:
|
4937 |
-
* - IDENT
|
4938 |
-
*/
|
4939 |
-
if (isIdentStart(c)){
|
4940 |
-
token = this.identOrFunctionToken(c, startLine, startCol);
|
4941 |
-
} else
|
4942 |
-
|
4943 |
-
/*
|
4944 |
-
* Potential tokens:
|
4945 |
-
* - CHAR
|
4946 |
-
* - PLUS
|
4947 |
-
*/
|
4948 |
-
{
|
4949 |
-
token = this.charToken(c, startLine, startCol);
|
4950 |
-
}
|
4951 |
-
|
4952 |
-
|
4953 |
-
|
4954 |
-
|
4955 |
-
|
4956 |
-
|
4957 |
-
}
|
4958 |
-
|
4959 |
-
//make sure this token is wanted
|
4960 |
-
//TODO: check channel
|
4961 |
-
break;
|
4962 |
-
}
|
4963 |
-
|
4964 |
-
if (!token && c === null){
|
4965 |
-
token = this.createToken(Tokens.EOF,null,startLine,startCol);
|
4966 |
-
}
|
4967 |
-
|
4968 |
-
return token;
|
4969 |
-
},
|
4970 |
-
|
4971 |
-
//-------------------------------------------------------------------------
|
4972 |
-
// Methods to create tokens
|
4973 |
-
//-------------------------------------------------------------------------
|
4974 |
-
|
4975 |
-
/**
|
4976 |
-
* Produces a token based on available data and the current
|
4977 |
-
* reader position information. This method is called by other
|
4978 |
-
* private methods to create tokens and is never called directly.
|
4979 |
-
* @param {int} tt The token type.
|
4980 |
-
* @param {String} value The text value of the token.
|
4981 |
-
* @param {int} startLine The beginning line for the character.
|
4982 |
-
* @param {int} startCol The beginning column for the character.
|
4983 |
-
* @param {Object} options (Optional) Specifies a channel property
|
4984 |
-
* to indicate that a different channel should be scanned
|
4985 |
-
* and/or a hide property indicating that the token should
|
4986 |
-
* be hidden.
|
4987 |
-
* @return {Object} A token object.
|
4988 |
-
* @method createToken
|
4989 |
-
*/
|
4990 |
-
createToken: function(tt, value, startLine, startCol, options){
|
4991 |
-
var reader = this._reader;
|
4992 |
-
options = options || {};
|
4993 |
-
|
4994 |
-
return {
|
4995 |
-
value: value,
|
4996 |
-
type: tt,
|
4997 |
-
channel: options.channel,
|
4998 |
-
endChar: options.endChar,
|
4999 |
-
hide: options.hide || false,
|
5000 |
-
startLine: startLine,
|
5001 |
-
startCol: startCol,
|
5002 |
-
endLine: reader.getLine(),
|
5003 |
-
endCol: reader.getCol()
|
5004 |
-
};
|
5005 |
-
},
|
5006 |
-
|
5007 |
-
//-------------------------------------------------------------------------
|
5008 |
-
// Methods to create specific tokens
|
5009 |
-
//-------------------------------------------------------------------------
|
5010 |
-
|
5011 |
-
/**
|
5012 |
-
* Produces a token for any at-rule. If the at-rule is unknown, then
|
5013 |
-
* the token is for a single "@" character.
|
5014 |
-
* @param {String} first The first character for the token.
|
5015 |
-
* @param {int} startLine The beginning line for the character.
|
5016 |
-
* @param {int} startCol The beginning column for the character.
|
5017 |
-
* @return {Object} A token object.
|
5018 |
-
* @method atRuleToken
|
5019 |
-
*/
|
5020 |
-
atRuleToken: function(first, startLine, startCol){
|
5021 |
-
var rule = first,
|
5022 |
-
reader = this._reader,
|
5023 |
-
tt = Tokens.CHAR,
|
5024 |
-
valid = false,
|
5025 |
-
ident,
|
5026 |
-
c;
|
5027 |
-
|
5028 |
-
/*
|
5029 |
-
* First, mark where we are. There are only four @ rules,
|
5030 |
-
* so anything else is really just an invalid token.
|
5031 |
-
* Basically, if this doesn't match one of the known @
|
5032 |
-
* rules, just return '@' as an unknown token and allow
|
5033 |
-
* parsing to continue after that point.
|
5034 |
-
*/
|
5035 |
-
reader.mark();
|
5036 |
-
|
5037 |
-
//try to find the at-keyword
|
5038 |
-
ident = this.readName();
|
5039 |
-
rule = first + ident;
|
5040 |
-
tt = Tokens.type(rule.toLowerCase());
|
5041 |
-
|
5042 |
-
//if it's not valid, use the first character only and reset the reader
|
5043 |
-
if (tt == Tokens.CHAR || tt == Tokens.UNKNOWN){
|
5044 |
-
if (rule.length > 1){
|
5045 |
-
tt = Tokens.UNKNOWN_SYM;
|
5046 |
-
} else {
|
5047 |
-
tt = Tokens.CHAR;
|
5048 |
-
rule = first;
|
5049 |
-
reader.reset();
|
5050 |
-
}
|
5051 |
-
}
|
5052 |
-
|
5053 |
-
return this.createToken(tt, rule, startLine, startCol);
|
5054 |
-
},
|
5055 |
-
|
5056 |
-
/**
|
5057 |
-
* Produces a character token based on the given character
|
5058 |
-
* and location in the stream. If there's a special (non-standard)
|
5059 |
-
* token name, this is used; otherwise CHAR is used.
|
5060 |
-
* @param {String} c The character for the token.
|
5061 |
-
* @param {int} startLine The beginning line for the character.
|
5062 |
-
* @param {int} startCol The beginning column for the character.
|
5063 |
-
* @return {Object} A token object.
|
5064 |
-
* @method charToken
|
5065 |
-
*/
|
5066 |
-
charToken: function(c, startLine, startCol){
|
5067 |
-
var tt = Tokens.type(c);
|
5068 |
-
var opts = {};
|
5069 |
-
|
5070 |
-
if (tt == -1){
|
5071 |
-
tt = Tokens.CHAR;
|
5072 |
-
} else {
|
5073 |
-
opts.endChar = Tokens[tt].endChar;
|
5074 |
-
}
|
5075 |
-
|
5076 |
-
return this.createToken(tt, c, startLine, startCol, opts);
|
5077 |
-
},
|
5078 |
-
|
5079 |
-
/**
|
5080 |
-
* Produces a character token based on the given character
|
5081 |
-
* and location in the stream. If there's a special (non-standard)
|
5082 |
-
* token name, this is used; otherwise CHAR is used.
|
5083 |
-
* @param {String} first The first character for the token.
|
5084 |
-
* @param {int} startLine The beginning line for the character.
|
5085 |
-
* @param {int} startCol The beginning column for the character.
|
5086 |
-
* @return {Object} A token object.
|
5087 |
-
* @method commentToken
|
5088 |
-
*/
|
5089 |
-
commentToken: function(first, startLine, startCol){
|
5090 |
-
var reader = this._reader,
|
5091 |
-
comment = this.readComment(first);
|
5092 |
-
|
5093 |
-
return this.createToken(Tokens.COMMENT, comment, startLine, startCol);
|
5094 |
-
},
|
5095 |
-
|
5096 |
-
/**
|
5097 |
-
* Produces a comparison token based on the given character
|
5098 |
-
* and location in the stream. The next character must be
|
5099 |
-
* read and is already known to be an equals sign.
|
5100 |
-
* @param {String} c The character for the token.
|
5101 |
-
* @param {int} startLine The beginning line for the character.
|
5102 |
-
* @param {int} startCol The beginning column for the character.
|
5103 |
-
* @return {Object} A token object.
|
5104 |
-
* @method comparisonToken
|
5105 |
-
*/
|
5106 |
-
comparisonToken: function(c, startLine, startCol){
|
5107 |
-
var reader = this._reader,
|
5108 |
-
comparison = c + reader.read(),
|
5109 |
-
tt = Tokens.type(comparison) || Tokens.CHAR;
|
5110 |
-
|
5111 |
-
return this.createToken(tt, comparison, startLine, startCol);
|
5112 |
-
},
|
5113 |
-
|
5114 |
-
/**
|
5115 |
-
* Produces a hash token based on the specified information. The
|
5116 |
-
* first character provided is the pound sign (#) and then this
|
5117 |
-
* method reads a name afterward.
|
5118 |
-
* @param {String} first The first character (#) in the hash name.
|
5119 |
-
* @param {int} startLine The beginning line for the character.
|
5120 |
-
* @param {int} startCol The beginning column for the character.
|
5121 |
-
* @return {Object} A token object.
|
5122 |
-
* @method hashToken
|
5123 |
-
*/
|
5124 |
-
hashToken: function(first, startLine, startCol){
|
5125 |
-
var reader = this._reader,
|
5126 |
-
name = this.readName(first);
|
5127 |
-
|
5128 |
-
return this.createToken(Tokens.HASH, name, startLine, startCol);
|
5129 |
-
},
|
5130 |
-
|
5131 |
-
/**
|
5132 |
-
* Produces a CDO or CHAR token based on the specified information. The
|
5133 |
-
* first character is provided and the rest is read by the function to determine
|
5134 |
-
* the correct token to create.
|
5135 |
-
* @param {String} first The first character in the token.
|
5136 |
-
* @param {int} startLine The beginning line for the character.
|
5137 |
-
* @param {int} startCol The beginning column for the character.
|
5138 |
-
* @return {Object} A token object.
|
5139 |
-
* @method htmlCommentStartToken
|
5140 |
-
*/
|
5141 |
-
htmlCommentStartToken: function(first, startLine, startCol){
|
5142 |
-
var reader = this._reader,
|
5143 |
-
text = first;
|
5144 |
-
|
5145 |
-
reader.mark();
|
5146 |
-
text += reader.readCount(3);
|
5147 |
-
|
5148 |
-
if (text == "<!--"){
|
5149 |
-
return this.createToken(Tokens.CDO, text, startLine, startCol);
|
5150 |
-
} else {
|
5151 |
-
reader.reset();
|
5152 |
-
return this.charToken(first, startLine, startCol);
|
5153 |
-
}
|
5154 |
-
},
|
5155 |
-
|
5156 |
-
/**
|
5157 |
-
* Produces a CDC or CHAR token based on the specified information. The
|
5158 |
-
* first character is provided and the rest is read by the function to determine
|
5159 |
-
* the correct token to create.
|
5160 |
-
* @param {String} first The first character in the token.
|
5161 |
-
* @param {int} startLine The beginning line for the character.
|
5162 |
-
* @param {int} startCol The beginning column for the character.
|
5163 |
-
* @return {Object} A token object.
|
5164 |
-
* @method htmlCommentEndToken
|
5165 |
-
*/
|
5166 |
-
htmlCommentEndToken: function(first, startLine, startCol){
|
5167 |
-
var reader = this._reader,
|
5168 |
-
text = first;
|
5169 |
-
|
5170 |
-
reader.mark();
|
5171 |
-
text += reader.readCount(2);
|
5172 |
-
|
5173 |
-
if (text == "-->"){
|
5174 |
-
return this.createToken(Tokens.CDC, text, startLine, startCol);
|
5175 |
-
} else {
|
5176 |
-
reader.reset();
|
5177 |
-
return this.charToken(first, startLine, startCol);
|
5178 |
-
}
|
5179 |
-
},
|
5180 |
-
|
5181 |
-
/**
|
5182 |
-
* Produces an IDENT or FUNCTION token based on the specified information. The
|
5183 |
-
* first character is provided and the rest is read by the function to determine
|
5184 |
-
* the correct token to create.
|
5185 |
-
* @param {String} first The first character in the identifier.
|
5186 |
-
* @param {int} startLine The beginning line for the character.
|
5187 |
-
* @param {int} startCol The beginning column for the character.
|
5188 |
-
* @return {Object} A token object.
|
5189 |
-
* @method identOrFunctionToken
|
5190 |
-
*/
|
5191 |
-
identOrFunctionToken: function(first, startLine, startCol){
|
5192 |
-
var reader = this._reader,
|
5193 |
-
ident = this.readName(first),
|
5194 |
-
tt = Tokens.IDENT;
|
5195 |
-
|
5196 |
-
//if there's a left paren immediately after, it's a URI or function
|
5197 |
-
if (reader.peek() == "("){
|
5198 |
-
ident += reader.read();
|
5199 |
-
if (ident.toLowerCase() == "url("){
|
5200 |
-
tt = Tokens.URI;
|
5201 |
-
ident = this.readURI(ident);
|
5202 |
-
|
5203 |
-
//didn't find a valid URL or there's no closing paren
|
5204 |
-
if (ident.toLowerCase() == "url("){
|
5205 |
-
tt = Tokens.FUNCTION;
|
5206 |
-
}
|
5207 |
-
} else {
|
5208 |
-
tt = Tokens.FUNCTION;
|
5209 |
-
}
|
5210 |
-
} else if (reader.peek() == ":"){ //might be an IE function
|
5211 |
-
|
5212 |
-
//IE-specific functions always being with progid:
|
5213 |
-
if (ident.toLowerCase() == "progid"){
|
5214 |
-
ident += reader.readTo("(");
|
5215 |
-
tt = Tokens.IE_FUNCTION;
|
5216 |
-
}
|
5217 |
-
}
|
5218 |
-
|
5219 |
-
return this.createToken(tt, ident, startLine, startCol);
|
5220 |
-
},
|
5221 |
-
|
5222 |
-
/**
|
5223 |
-
* Produces an IMPORTANT_SYM or CHAR token based on the specified information. The
|
5224 |
-
* first character is provided and the rest is read by the function to determine
|
5225 |
-
* the correct token to create.
|
5226 |
-
* @param {String} first The first character in the token.
|
5227 |
-
* @param {int} startLine The beginning line for the character.
|
5228 |
-
* @param {int} startCol The beginning column for the character.
|
5229 |
-
* @return {Object} A token object.
|
5230 |
-
* @method importantToken
|
5231 |
-
*/
|
5232 |
-
importantToken: function(first, startLine, startCol){
|
5233 |
-
var reader = this._reader,
|
5234 |
-
important = first,
|
5235 |
-
tt = Tokens.CHAR,
|
5236 |
-
temp,
|
5237 |
-
c;
|
5238 |
-
|
5239 |
-
reader.mark();
|
5240 |
-
c = reader.read();
|
5241 |
-
|
5242 |
-
while(c){
|
5243 |
-
|
5244 |
-
//there can be a comment in here
|
5245 |
-
if (c == "/"){
|
5246 |
-
|
5247 |
-
//if the next character isn't a star, then this isn't a valid !important token
|
5248 |
-
if (reader.peek() != "*"){
|
5249 |
-
break;
|
5250 |
-
} else {
|
5251 |
-
temp = this.readComment(c);
|
5252 |
-
if (temp === ""){ //broken!
|
5253 |
-
break;
|
5254 |
-
}
|
5255 |
-
}
|
5256 |
-
} else if (isWhitespace(c)){
|
5257 |
-
important += c + this.readWhitespace();
|
5258 |
-
} else if (/i/i.test(c)){
|
5259 |
-
temp = reader.readCount(8);
|
5260 |
-
if (/mportant/i.test(temp)){
|
5261 |
-
important += c + temp;
|
5262 |
-
tt = Tokens.IMPORTANT_SYM;
|
5263 |
-
|
5264 |
-
}
|
5265 |
-
break; //we're done
|
5266 |
-
} else {
|
5267 |
-
break;
|
5268 |
-
}
|
5269 |
-
|
5270 |
-
c = reader.read();
|
5271 |
-
}
|
5272 |
-
|
5273 |
-
if (tt == Tokens.CHAR){
|
5274 |
-
reader.reset();
|
5275 |
-
return this.charToken(first, startLine, startCol);
|
5276 |
-
} else {
|
5277 |
-
return this.createToken(tt, important, startLine, startCol);
|
5278 |
-
}
|
5279 |
-
|
5280 |
-
|
5281 |
-
},
|
5282 |
-
|
5283 |
-
/**
|
5284 |
-
* Produces a NOT or CHAR token based on the specified information. The
|
5285 |
-
* first character is provided and the rest is read by the function to determine
|
5286 |
-
* the correct token to create.
|
5287 |
-
* @param {String} first The first character in the token.
|
5288 |
-
* @param {int} startLine The beginning line for the character.
|
5289 |
-
* @param {int} startCol The beginning column for the character.
|
5290 |
-
* @return {Object} A token object.
|
5291 |
-
* @method notToken
|
5292 |
-
*/
|
5293 |
-
notToken: function(first, startLine, startCol){
|
5294 |
-
var reader = this._reader,
|
5295 |
-
text = first;
|
5296 |
-
|
5297 |
-
reader.mark();
|
5298 |
-
text += reader.readCount(4);
|
5299 |
-
|
5300 |
-
if (text.toLowerCase() == ":not("){
|
5301 |
-
return this.createToken(Tokens.NOT, text, startLine, startCol);
|
5302 |
-
} else {
|
5303 |
-
reader.reset();
|
5304 |
-
return this.charToken(first, startLine, startCol);
|
5305 |
-
}
|
5306 |
-
},
|
5307 |
-
|
5308 |
-
/**
|
5309 |
-
* Produces a number token based on the given character
|
5310 |
-
* and location in the stream. This may return a token of
|
5311 |
-
* NUMBER, EMS, EXS, LENGTH, ANGLE, TIME, FREQ, DIMENSION,
|
5312 |
-
* or PERCENTAGE.
|
5313 |
-
* @param {String} first The first character for the token.
|
5314 |
-
* @param {int} startLine The beginning line for the character.
|
5315 |
-
* @param {int} startCol The beginning column for the character.
|
5316 |
-
* @return {Object} A token object.
|
5317 |
-
* @method numberToken
|
5318 |
-
*/
|
5319 |
-
numberToken: function(first, startLine, startCol){
|
5320 |
-
var reader = this._reader,
|
5321 |
-
value = this.readNumber(first),
|
5322 |
-
ident,
|
5323 |
-
tt = Tokens.NUMBER,
|
5324 |
-
c = reader.peek();
|
5325 |
-
|
5326 |
-
if (isIdentStart(c)){
|
5327 |
-
ident = this.readName(reader.read());
|
5328 |
-
value += ident;
|
5329 |
-
|
5330 |
-
if (/^em$|^ex$|^px$|^gd$|^rem$|^vw$|^vh$|^vmax$|^vmin$|^ch$|^cm$|^mm$|^in$|^pt$|^pc$/i.test(ident)){
|
5331 |
-
tt = Tokens.LENGTH;
|
5332 |
-
} else if (/^deg|^rad$|^grad$/i.test(ident)){
|
5333 |
-
tt = Tokens.ANGLE;
|
5334 |
-
} else if (/^ms$|^s$/i.test(ident)){
|
5335 |
-
tt = Tokens.TIME;
|
5336 |
-
} else if (/^hz$|^khz$/i.test(ident)){
|
5337 |
-
tt = Tokens.FREQ;
|
5338 |
-
} else if (/^dpi$|^dpcm$/i.test(ident)){
|
5339 |
-
tt = Tokens.RESOLUTION;
|
5340 |
-
} else {
|
5341 |
-
tt = Tokens.DIMENSION;
|
5342 |
-
}
|
5343 |
-
|
5344 |
-
} else if (c == "%"){
|
5345 |
-
value += reader.read();
|
5346 |
-
tt = Tokens.PERCENTAGE;
|
5347 |
-
}
|
5348 |
-
|
5349 |
-
return this.createToken(tt, value, startLine, startCol);
|
5350 |
-
},
|
5351 |
-
|
5352 |
-
/**
|
5353 |
-
* Produces a string token based on the given character
|
5354 |
-
* and location in the stream. Since strings may be indicated
|
5355 |
-
* by single or double quotes, a failure to match starting
|
5356 |
-
* and ending quotes results in an INVALID token being generated.
|
5357 |
-
* The first character in the string is passed in and then
|
5358 |
-
* the rest are read up to and including the final quotation mark.
|
5359 |
-
* @param {String} first The first character in the string.
|
5360 |
-
* @param {int} startLine The beginning line for the character.
|
5361 |
-
* @param {int} startCol The beginning column for the character.
|
5362 |
-
* @return {Object} A token object.
|
5363 |
-
* @method stringToken
|
5364 |
-
*/
|
5365 |
-
stringToken: function(first, startLine, startCol){
|
5366 |
-
var delim = first,
|
5367 |
-
string = first,
|
5368 |
-
reader = this._reader,
|
5369 |
-
prev = first,
|
5370 |
-
tt = Tokens.STRING,
|
5371 |
-
c = reader.read();
|
5372 |
-
|
5373 |
-
while(c){
|
5374 |
-
string += c;
|
5375 |
-
|
5376 |
-
//if the delimiter is found with an escapement, we're done.
|
5377 |
-
if (c == delim && prev != "\\"){
|
5378 |
-
break;
|
5379 |
-
}
|
5380 |
-
|
5381 |
-
//if there's a newline without an escapement, it's an invalid string
|
5382 |
-
if (isNewLine(reader.peek()) && c != "\\"){
|
5383 |
-
tt = Tokens.INVALID;
|
5384 |
-
break;
|
5385 |
-
}
|
5386 |
-
|
5387 |
-
//save previous and get next
|
5388 |
-
prev = c;
|
5389 |
-
c = reader.read();
|
5390 |
-
}
|
5391 |
-
|
5392 |
-
//if c is null, that means we're out of input and the string was never closed
|
5393 |
-
if (c === null){
|
5394 |
-
tt = Tokens.INVALID;
|
5395 |
-
}
|
5396 |
-
|
5397 |
-
return this.createToken(tt, string, startLine, startCol);
|
5398 |
-
},
|
5399 |
-
|
5400 |
-
unicodeRangeToken: function(first, startLine, startCol){
|
5401 |
-
var reader = this._reader,
|
5402 |
-
value = first,
|
5403 |
-
temp,
|
5404 |
-
tt = Tokens.CHAR;
|
5405 |
-
|
5406 |
-
//then it should be a unicode range
|
5407 |
-
if (reader.peek() == "+"){
|
5408 |
-
reader.mark();
|
5409 |
-
value += reader.read();
|
5410 |
-
value += this.readUnicodeRangePart(true);
|
5411 |
-
|
5412 |
-
//ensure there's an actual unicode range here
|
5413 |
-
if (value.length == 2){
|
5414 |
-
reader.reset();
|
5415 |
-
} else {
|
5416 |
-
|
5417 |
-
tt = Tokens.UNICODE_RANGE;
|
5418 |
-
|
5419 |
-
//if there's a ? in the first part, there can't be a second part
|
5420 |
-
if (value.indexOf("?") == -1){
|
5421 |
-
|
5422 |
-
if (reader.peek() == "-"){
|
5423 |
-
reader.mark();
|
5424 |
-
temp = reader.read();
|
5425 |
-
temp += this.readUnicodeRangePart(false);
|
5426 |
-
|
5427 |
-
//if there's not another value, back up and just take the first
|
5428 |
-
if (temp.length == 1){
|
5429 |
-
reader.reset();
|
5430 |
-
} else {
|
5431 |
-
value += temp;
|
5432 |
-
}
|
5433 |
-
}
|
5434 |
-
|
5435 |
-
}
|
5436 |
-
}
|
5437 |
-
}
|
5438 |
-
|
5439 |
-
return this.createToken(tt, value, startLine, startCol);
|
5440 |
-
},
|
5441 |
-
|
5442 |
-
/**
|
5443 |
-
* Produces a S token based on the specified information. Since whitespace
|
5444 |
-
* may have multiple characters, this consumes all whitespace characters
|
5445 |
-
* into a single token.
|
5446 |
-
* @param {String} first The first character in the token.
|
5447 |
-
* @param {int} startLine The beginning line for the character.
|
5448 |
-
* @param {int} startCol The beginning column for the character.
|
5449 |
-
* @return {Object} A token object.
|
5450 |
-
* @method whitespaceToken
|
5451 |
-
*/
|
5452 |
-
whitespaceToken: function(first, startLine, startCol){
|
5453 |
-
var reader = this._reader,
|
5454 |
-
value = first + this.readWhitespace();
|
5455 |
-
return this.createToken(Tokens.S, value, startLine, startCol);
|
5456 |
-
},
|
5457 |
-
|
5458 |
-
|
5459 |
-
|
5460 |
-
|
5461 |
-
//-------------------------------------------------------------------------
|
5462 |
-
// Methods to read values from the string stream
|
5463 |
-
//-------------------------------------------------------------------------
|
5464 |
-
|
5465 |
-
readUnicodeRangePart: function(allowQuestionMark){
|
5466 |
-
var reader = this._reader,
|
5467 |
-
part = "",
|
5468 |
-
c = reader.peek();
|
5469 |
-
|
5470 |
-
//first read hex digits
|
5471 |
-
while(isHexDigit(c) && part.length < 6){
|
5472 |
-
reader.read();
|
5473 |
-
part += c;
|
5474 |
-
c = reader.peek();
|
5475 |
-
}
|
5476 |
-
|
5477 |
-
//then read question marks if allowed
|
5478 |
-
if (allowQuestionMark){
|
5479 |
-
while(c == "?" && part.length < 6){
|
5480 |
-
reader.read();
|
5481 |
-
part += c;
|
5482 |
-
c = reader.peek();
|
5483 |
-
}
|
5484 |
-
}
|
5485 |
-
|
5486 |
-
//there can't be any other characters after this point
|
5487 |
-
|
5488 |
-
return part;
|
5489 |
-
},
|
5490 |
-
|
5491 |
-
readWhitespace: function(){
|
5492 |
-
var reader = this._reader,
|
5493 |
-
whitespace = "",
|
5494 |
-
c = reader.peek();
|
5495 |
-
|
5496 |
-
while(isWhitespace(c)){
|
5497 |
-
reader.read();
|
5498 |
-
whitespace += c;
|
5499 |
-
c = reader.peek();
|
5500 |
-
}
|
5501 |
-
|
5502 |
-
return whitespace;
|
5503 |
-
},
|
5504 |
-
readNumber: function(first){
|
5505 |
-
var reader = this._reader,
|
5506 |
-
number = first,
|
5507 |
-
hasDot = (first == "."),
|
5508 |
-
c = reader.peek();
|
5509 |
-
|
5510 |
-
|
5511 |
-
while(c){
|
5512 |
-
if (isDigit(c)){
|
5513 |
-
number += reader.read();
|
5514 |
-
} else if (c == "."){
|
5515 |
-
if (hasDot){
|
5516 |
-
break;
|
5517 |
-
} else {
|
5518 |
-
hasDot = true;
|
5519 |
-
number += reader.read();
|
5520 |
-
}
|
5521 |
-
} else {
|
5522 |
-
break;
|
5523 |
-
}
|
5524 |
-
|
5525 |
-
c = reader.peek();
|
5526 |
-
}
|
5527 |
-
|
5528 |
-
return number;
|
5529 |
-
},
|
5530 |
-
readString: function(){
|
5531 |
-
var reader = this._reader,
|
5532 |
-
delim = reader.read(),
|
5533 |
-
string = delim,
|
5534 |
-
prev = delim,
|
5535 |
-
c = reader.peek();
|
5536 |
-
|
5537 |
-
while(c){
|
5538 |
-
c = reader.read();
|
5539 |
-
string += c;
|
5540 |
-
|
5541 |
-
//if the delimiter is found with an escapement, we're done.
|
5542 |
-
if (c == delim && prev != "\\"){
|
5543 |
-
break;
|
5544 |
-
}
|
5545 |
-
|
5546 |
-
//if there's a newline without an escapement, it's an invalid string
|
5547 |
-
if (isNewLine(reader.peek()) && c != "\\"){
|
5548 |
-
string = "";
|
5549 |
-
break;
|
5550 |
-
}
|
5551 |
-
|
5552 |
-
//save previous and get next
|
5553 |
-
prev = c;
|
5554 |
-
c = reader.peek();
|
5555 |
-
}
|
5556 |
-
|
5557 |
-
//if c is null, that means we're out of input and the string was never closed
|
5558 |
-
if (c === null){
|
5559 |
-
string = "";
|
5560 |
-
}
|
5561 |
-
|
5562 |
-
return string;
|
5563 |
-
},
|
5564 |
-
readURI: function(first){
|
5565 |
-
var reader = this._reader,
|
5566 |
-
uri = first,
|
5567 |
-
inner = "",
|
5568 |
-
c = reader.peek();
|
5569 |
-
|
5570 |
-
reader.mark();
|
5571 |
-
|
5572 |
-
//skip whitespace before
|
5573 |
-
while(c && isWhitespace(c)){
|
5574 |
-
reader.read();
|
5575 |
-
c = reader.peek();
|
5576 |
-
}
|
5577 |
-
|
5578 |
-
//it's a string
|
5579 |
-
if (c == "'" || c == "\""){
|
5580 |
-
inner = this.readString();
|
5581 |
-
} else {
|
5582 |
-
inner = this.readURL();
|
5583 |
-
}
|
5584 |
-
|
5585 |
-
c = reader.peek();
|
5586 |
-
|
5587 |
-
//skip whitespace after
|
5588 |
-
while(c && isWhitespace(c)){
|
5589 |
-
reader.read();
|
5590 |
-
c = reader.peek();
|
5591 |
-
}
|
5592 |
-
|
5593 |
-
//if there was no inner value or the next character isn't closing paren, it's not a URI
|
5594 |
-
if (inner === "" || c != ")"){
|
5595 |
-
uri = first;
|
5596 |
-
reader.reset();
|
5597 |
-
} else {
|
5598 |
-
uri += inner + reader.read();
|
5599 |
-
}
|
5600 |
-
|
5601 |
-
return uri;
|
5602 |
-
},
|
5603 |
-
readURL: function(){
|
5604 |
-
var reader = this._reader,
|
5605 |
-
url = "",
|
5606 |
-
c = reader.peek();
|
5607 |
-
|
5608 |
-
//TODO: Check for escape and nonascii
|
5609 |
-
while (/^[!#$%&\\*-~]$/.test(c)){
|
5610 |
-
url += reader.read();
|
5611 |
-
c = reader.peek();
|
5612 |
-
}
|
5613 |
-
|
5614 |
-
return url;
|
5615 |
-
|
5616 |
-
},
|
5617 |
-
readName: function(first){
|
5618 |
-
var reader = this._reader,
|
5619 |
-
ident = first || "",
|
5620 |
-
c = reader.peek();
|
5621 |
-
|
5622 |
-
while(true){
|
5623 |
-
if (c == "\\"){
|
5624 |
-
ident += this.readEscape(reader.read());
|
5625 |
-
c = reader.peek();
|
5626 |
-
} else if(c && isNameChar(c)){
|
5627 |
-
ident += reader.read();
|
5628 |
-
c = reader.peek();
|
5629 |
-
} else {
|
5630 |
-
break;
|
5631 |
-
}
|
5632 |
-
}
|
5633 |
-
|
5634 |
-
return ident;
|
5635 |
-
},
|
5636 |
-
|
5637 |
-
readEscape: function(first){
|
5638 |
-
var reader = this._reader,
|
5639 |
-
cssEscape = first || "",
|
5640 |
-
i = 0,
|
5641 |
-
c = reader.peek();
|
5642 |
-
|
5643 |
-
if (isHexDigit(c)){
|
5644 |
-
do {
|
5645 |
-
cssEscape += reader.read();
|
5646 |
-
c = reader.peek();
|
5647 |
-
} while(c && isHexDigit(c) && ++i < 6);
|
5648 |
-
}
|
5649 |
-
|
5650 |
-
if (cssEscape.length == 3 && /\s/.test(c) ||
|
5651 |
-
cssEscape.length == 7 || cssEscape.length == 1){
|
5652 |
-
reader.read();
|
5653 |
-
} else {
|
5654 |
-
c = "";
|
5655 |
-
}
|
5656 |
-
|
5657 |
-
return cssEscape + c;
|
5658 |
-
},
|
5659 |
-
|
5660 |
-
readComment: function(first){
|
5661 |
-
var reader = this._reader,
|
5662 |
-
comment = first || "",
|
5663 |
-
c = reader.read();
|
5664 |
-
|
5665 |
-
if (c == "*"){
|
5666 |
-
while(c){
|
5667 |
-
comment += c;
|
5668 |
-
|
5669 |
-
//look for end of comment
|
5670 |
-
if (comment.length > 2 && c == "*" && reader.peek() == "/"){
|
5671 |
-
comment += reader.read();
|
5672 |
-
break;
|
5673 |
-
}
|
5674 |
-
|
5675 |
-
c = reader.read();
|
5676 |
-
}
|
5677 |
-
|
5678 |
-
return comment;
|
5679 |
-
} else {
|
5680 |
-
return "";
|
5681 |
-
}
|
5682 |
-
|
5683 |
-
}
|
5684 |
-
});
|
5685 |
-
|
5686 |
-
var Tokens = [
|
5687 |
-
|
5688 |
-
/*
|
5689 |
-
* The following token names are defined in CSS3 Grammar: http://www.w3.org/TR/css3-syntax/#lexical
|
5690 |
-
*/
|
5691 |
-
|
5692 |
-
//HTML-style comments
|
5693 |
-
{ name: "CDO"},
|
5694 |
-
{ name: "CDC"},
|
5695 |
-
|
5696 |
-
//ignorables
|
5697 |
-
{ name: "S", whitespace: true/*, channel: "ws"*/},
|
5698 |
-
{ name: "COMMENT", comment: true, hide: true, channel: "comment" },
|
5699 |
-
|
5700 |
-
//attribute equality
|
5701 |
-
{ name: "INCLUDES", text: "~="},
|
5702 |
-
{ name: "DASHMATCH", text: "|="},
|
5703 |
-
{ name: "PREFIXMATCH", text: "^="},
|
5704 |
-
{ name: "SUFFIXMATCH", text: "$="},
|
5705 |
-
{ name: "SUBSTRINGMATCH", text: "*="},
|
5706 |
-
|
5707 |
-
//identifier types
|
5708 |
-
{ name: "STRING"},
|
5709 |
-
{ name: "IDENT"},
|
5710 |
-
{ name: "HASH"},
|
5711 |
-
|
5712 |
-
//at-keywords
|
5713 |
-
{ name: "IMPORT_SYM", text: "@import"},
|
5714 |
-
{ name: "PAGE_SYM", text: "@page"},
|
5715 |
-
{ name: "MEDIA_SYM", text: "@media"},
|
5716 |
-
{ name: "FONT_FACE_SYM", text: "@font-face"},
|
5717 |
-
{ name: "CHARSET_SYM", text: "@charset"},
|
5718 |
-
{ name: "NAMESPACE_SYM", text: "@namespace"},
|
5719 |
-
{ name: "VIEWPORT_SYM", text: ["@viewport", "@-ms-viewport"]},
|
5720 |
-
{ name: "UNKNOWN_SYM" },
|
5721 |
-
//{ name: "ATKEYWORD"},
|
5722 |
-
|
5723 |
-
//CSS3 animations
|
5724 |
-
{ name: "KEYFRAMES_SYM", text: [ "@keyframes", "@-webkit-keyframes", "@-moz-keyframes", "@-o-keyframes" ] },
|
5725 |
-
|
5726 |
-
//important symbol
|
5727 |
-
{ name: "IMPORTANT_SYM"},
|
5728 |
-
|
5729 |
-
//measurements
|
5730 |
-
{ name: "LENGTH"},
|
5731 |
-
{ name: "ANGLE"},
|
5732 |
-
{ name: "TIME"},
|
5733 |
-
{ name: "FREQ"},
|
5734 |
-
{ name: "DIMENSION"},
|
5735 |
-
{ name: "PERCENTAGE"},
|
5736 |
-
{ name: "NUMBER"},
|
5737 |
-
|
5738 |
-
//functions
|
5739 |
-
{ name: "URI"},
|
5740 |
-
{ name: "FUNCTION"},
|
5741 |
-
|
5742 |
-
//Unicode ranges
|
5743 |
-
{ name: "UNICODE_RANGE"},
|
5744 |
-
|
5745 |
-
/*
|
5746 |
-
* The following token names are defined in CSS3 Selectors: http://www.w3.org/TR/css3-selectors/#selector-syntax
|
5747 |
-
*/
|
5748 |
-
|
5749 |
-
//invalid string
|
5750 |
-
{ name: "INVALID"},
|
5751 |
-
|
5752 |
-
//combinators
|
5753 |
-
{ name: "PLUS", text: "+" },
|
5754 |
-
{ name: "GREATER", text: ">"},
|
5755 |
-
{ name: "COMMA", text: ","},
|
5756 |
-
{ name: "TILDE", text: "~"},
|
5757 |
-
|
5758 |
-
//modifier
|
5759 |
-
{ name: "NOT"},
|
5760 |
-
|
5761 |
-
/*
|
5762 |
-
* Defined in CSS3 Paged Media
|
5763 |
-
*/
|
5764 |
-
{ name: "TOPLEFTCORNER_SYM", text: "@top-left-corner"},
|
5765 |
-
{ name: "TOPLEFT_SYM", text: "@top-left"},
|
5766 |
-
{ name: "TOPCENTER_SYM", text: "@top-center"},
|
5767 |
-
{ name: "TOPRIGHT_SYM", text: "@top-right"},
|
5768 |
-
{ name: "TOPRIGHTCORNER_SYM", text: "@top-right-corner"},
|
5769 |
-
{ name: "BOTTOMLEFTCORNER_SYM", text: "@bottom-left-corner"},
|
5770 |
-
{ name: "BOTTOMLEFT_SYM", text: "@bottom-left"},
|
5771 |
-
{ name: "BOTTOMCENTER_SYM", text: "@bottom-center"},
|
5772 |
-
{ name: "BOTTOMRIGHT_SYM", text: "@bottom-right"},
|
5773 |
-
{ name: "BOTTOMRIGHTCORNER_SYM", text: "@bottom-right-corner"},
|
5774 |
-
{ name: "LEFTTOP_SYM", text: "@left-top"},
|
5775 |
-
{ name: "LEFTMIDDLE_SYM", text: "@left-middle"},
|
5776 |
-
{ name: "LEFTBOTTOM_SYM", text: "@left-bottom"},
|
5777 |
-
{ name: "RIGHTTOP_SYM", text: "@right-top"},
|
5778 |
-
{ name: "RIGHTMIDDLE_SYM", text: "@right-middle"},
|
5779 |
-
{ name: "RIGHTBOTTOM_SYM", text: "@right-bottom"},
|
5780 |
-
|
5781 |
-
/*
|
5782 |
-
* The following token names are defined in CSS3 Media Queries: http://www.w3.org/TR/css3-mediaqueries/#syntax
|
5783 |
-
*/
|
5784 |
-
/*{ name: "MEDIA_ONLY", state: "media"},
|
5785 |
-
{ name: "MEDIA_NOT", state: "media"},
|
5786 |
-
{ name: "MEDIA_AND", state: "media"},*/
|
5787 |
-
{ name: "RESOLUTION", state: "media"},
|
5788 |
-
|
5789 |
-
/*
|
5790 |
-
* The following token names are not defined in any CSS specification but are used by the lexer.
|
5791 |
-
*/
|
5792 |
-
|
5793 |
-
//not a real token, but useful for stupid IE filters
|
5794 |
-
{ name: "IE_FUNCTION" },
|
5795 |
-
|
5796 |
-
//part of CSS3 grammar but not the Flex code
|
5797 |
-
{ name: "CHAR" },
|
5798 |
-
|
5799 |
-
//TODO: Needed?
|
5800 |
-
//Not defined as tokens, but might as well be
|
5801 |
-
{
|
5802 |
-
name: "PIPE",
|
5803 |
-
text: "|"
|
5804 |
-
},
|
5805 |
-
{
|
5806 |
-
name: "SLASH",
|
5807 |
-
text: "/"
|
5808 |
-
},
|
5809 |
-
{
|
5810 |
-
name: "MINUS",
|
5811 |
-
text: "-"
|
5812 |
-
},
|
5813 |
-
{
|
5814 |
-
name: "STAR",
|
5815 |
-
text: "*"
|
5816 |
-
},
|
5817 |
-
|
5818 |
-
{
|
5819 |
-
name: "LBRACE",
|
5820 |
-
endChar: "}",
|
5821 |
-
text: "{"
|
5822 |
-
},
|
5823 |
-
{
|
5824 |
-
name: "RBRACE",
|
5825 |
-
text: "}"
|
5826 |
-
},
|
5827 |
-
{
|
5828 |
-
name: "LBRACKET",
|
5829 |
-
endChar: "]",
|
5830 |
-
text: "["
|
5831 |
-
},
|
5832 |
-
{
|
5833 |
-
name: "RBRACKET",
|
5834 |
-
text: "]"
|
5835 |
-
},
|
5836 |
-
{
|
5837 |
-
name: "EQUALS",
|
5838 |
-
text: "="
|
5839 |
-
},
|
5840 |
-
{
|
5841 |
-
name: "COLON",
|
5842 |
-
text: ":"
|
5843 |
-
},
|
5844 |
-
{
|
5845 |
-
name: "SEMICOLON",
|
5846 |
-
text: ";"
|
5847 |
-
},
|
5848 |
-
|
5849 |
-
{
|
5850 |
-
name: "LPAREN",
|
5851 |
-
endChar: ")",
|
5852 |
-
text: "("
|
5853 |
-
},
|
5854 |
-
{
|
5855 |
-
name: "RPAREN",
|
5856 |
-
text: ")"
|
5857 |
-
},
|
5858 |
-
{
|
5859 |
-
name: "DOT",
|
5860 |
-
text: "."
|
5861 |
-
}
|
5862 |
-
];
|
5863 |
-
|
5864 |
-
(function(){
|
5865 |
-
|
5866 |
-
var nameMap = [],
|
5867 |
-
typeMap = {};
|
5868 |
-
|
5869 |
-
Tokens.UNKNOWN = -1;
|
5870 |
-
Tokens.unshift({name:"EOF"});
|
5871 |
-
for (var i=0, len = Tokens.length; i < len; i++){
|
5872 |
-
nameMap.push(Tokens[i].name);
|
5873 |
-
Tokens[Tokens[i].name] = i;
|
5874 |
-
if (Tokens[i].text){
|
5875 |
-
if (Tokens[i].text instanceof Array){
|
5876 |
-
for (var j=0; j < Tokens[i].text.length; j++){
|
5877 |
-
typeMap[Tokens[i].text[j]] = i;
|
5878 |
-
}
|
5879 |
-
} else {
|
5880 |
-
typeMap[Tokens[i].text] = i;
|
5881 |
-
}
|
5882 |
-
}
|
5883 |
-
}
|
5884 |
-
|
5885 |
-
Tokens.name = function(tt){
|
5886 |
-
return nameMap[tt];
|
5887 |
-
};
|
5888 |
-
|
5889 |
-
Tokens.type = function(c){
|
5890 |
-
return typeMap[c] || -1;
|
5891 |
-
};
|
5892 |
-
|
5893 |
-
})();
|
5894 |
-
|
5895 |
-
|
5896 |
-
|
5897 |
-
//This file will likely change a lot! Very experimental!
|
5898 |
-
/*global Properties, ValidationTypes, ValidationError, PropertyValueIterator */
|
5899 |
-
var Validation = {
|
5900 |
-
|
5901 |
-
validate: function(property, value){
|
5902 |
-
|
5903 |
-
//normalize name
|
5904 |
-
var name = property.toString().toLowerCase(),
|
5905 |
-
parts = value.parts,
|
5906 |
-
expression = new PropertyValueIterator(value),
|
5907 |
-
spec = Properties[name],
|
5908 |
-
part,
|
5909 |
-
valid,
|
5910 |
-
j, count,
|
5911 |
-
msg,
|
5912 |
-
types,
|
5913 |
-
last,
|
5914 |
-
literals,
|
5915 |
-
max, multi, group;
|
5916 |
-
|
5917 |
-
if (!spec) {
|
5918 |
-
if (name.indexOf("-") !== 0){ //vendor prefixed are ok
|
5919 |
-
throw new ValidationError("Unknown property '" + property + "'.", property.line, property.col);
|
5920 |
-
}
|
5921 |
-
} else if (typeof spec != "number"){
|
5922 |
-
|
5923 |
-
//initialization
|
5924 |
-
if (typeof spec == "string"){
|
5925 |
-
if (spec.indexOf("||") > -1) {
|
5926 |
-
this.groupProperty(spec, expression);
|
5927 |
-
} else {
|
5928 |
-
this.singleProperty(spec, expression, 1);
|
5929 |
-
}
|
5930 |
-
|
5931 |
-
} else if (spec.multi) {
|
5932 |
-
this.multiProperty(spec.multi, expression, spec.comma, spec.max || Infinity);
|
5933 |
-
} else if (typeof spec == "function") {
|
5934 |
-
spec(expression);
|
5935 |
-
}
|
5936 |
-
|
5937 |
-
}
|
5938 |
-
|
5939 |
-
},
|
5940 |
-
|
5941 |
-
singleProperty: function(types, expression, max, partial) {
|
5942 |
-
|
5943 |
-
var result = false,
|
5944 |
-
value = expression.value,
|
5945 |
-
count = 0,
|
5946 |
-
part;
|
5947 |
-
|
5948 |
-
while (expression.hasNext() && count < max) {
|
5949 |
-
result = ValidationTypes.isAny(expression, types);
|
5950 |
-
if (!result) {
|
5951 |
-
break;
|
5952 |
-
}
|
5953 |
-
count++;
|
5954 |
-
}
|
5955 |
-
|
5956 |
-
if (!result) {
|
5957 |
-
if (expression.hasNext() && !expression.isFirst()) {
|
5958 |
-
part = expression.peek();
|
5959 |
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
5960 |
-
} else {
|
5961 |
-
throw new ValidationError("Expected (" + types + ") but found '" + value + "'.", value.line, value.col);
|
5962 |
-
}
|
5963 |
-
} else if (expression.hasNext()) {
|
5964 |
-
part = expression.next();
|
5965 |
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
5966 |
-
}
|
5967 |
-
|
5968 |
-
},
|
5969 |
-
|
5970 |
-
multiProperty: function (types, expression, comma, max) {
|
5971 |
-
|
5972 |
-
var result = false,
|
5973 |
-
value = expression.value,
|
5974 |
-
count = 0,
|
5975 |
-
sep = false,
|
5976 |
-
part;
|
5977 |
-
|
5978 |
-
while(expression.hasNext() && !result && count < max) {
|
5979 |
-
if (ValidationTypes.isAny(expression, types)) {
|
5980 |
-
count++;
|
5981 |
-
if (!expression.hasNext()) {
|
5982 |
-
result = true;
|
5983 |
-
|
5984 |
-
} else if (comma) {
|
5985 |
-
if (expression.peek() == ",") {
|
5986 |
-
part = expression.next();
|
5987 |
-
} else {
|
5988 |
-
break;
|
5989 |
-
}
|
5990 |
-
}
|
5991 |
-
} else {
|
5992 |
-
break;
|
5993 |
-
|
5994 |
-
}
|
5995 |
-
}
|
5996 |
-
|
5997 |
-
if (!result) {
|
5998 |
-
if (expression.hasNext() && !expression.isFirst()) {
|
5999 |
-
part = expression.peek();
|
6000 |
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
6001 |
-
} else {
|
6002 |
-
part = expression.previous();
|
6003 |
-
if (comma && part == ",") {
|
6004 |
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
6005 |
-
} else {
|
6006 |
-
throw new ValidationError("Expected (" + types + ") but found '" + value + "'.", value.line, value.col);
|
6007 |
-
}
|
6008 |
-
}
|
6009 |
-
|
6010 |
-
} else if (expression.hasNext()) {
|
6011 |
-
part = expression.next();
|
6012 |
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
6013 |
-
}
|
6014 |
-
|
6015 |
-
},
|
6016 |
-
|
6017 |
-
groupProperty: function (types, expression, comma) {
|
6018 |
-
|
6019 |
-
var result = false,
|
6020 |
-
value = expression.value,
|
6021 |
-
typeCount = types.split("||").length,
|
6022 |
-
groups = { count: 0 },
|
6023 |
-
partial = false,
|
6024 |
-
name,
|
6025 |
-
part;
|
6026 |
-
|
6027 |
-
while(expression.hasNext() && !result) {
|
6028 |
-
name = ValidationTypes.isAnyOfGroup(expression, types);
|
6029 |
-
if (name) {
|
6030 |
-
|
6031 |
-
//no dupes
|
6032 |
-
if (groups[name]) {
|
6033 |
-
break;
|
6034 |
-
} else {
|
6035 |
-
groups[name] = 1;
|
6036 |
-
groups.count++;
|
6037 |
-
partial = true;
|
6038 |
-
|
6039 |
-
if (groups.count == typeCount || !expression.hasNext()) {
|
6040 |
-
result = true;
|
6041 |
-
}
|
6042 |
-
}
|
6043 |
-
} else {
|
6044 |
-
break;
|
6045 |
-
}
|
6046 |
-
}
|
6047 |
-
|
6048 |
-
if (!result) {
|
6049 |
-
if (partial && expression.hasNext()) {
|
6050 |
-
part = expression.peek();
|
6051 |
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
6052 |
-
} else {
|
6053 |
-
throw new ValidationError("Expected (" + types + ") but found '" + value + "'.", value.line, value.col);
|
6054 |
-
}
|
6055 |
-
} else if (expression.hasNext()) {
|
6056 |
-
part = expression.next();
|
6057 |
-
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
|
6058 |
-
}
|
6059 |
-
}
|
6060 |
-
|
6061 |
-
|
6062 |
-
|
6063 |
-
};
|
6064 |
-
/**
|
6065 |
-
* Type to use when a validation error occurs.
|
6066 |
-
* @class ValidationError
|
6067 |
-
* @namespace parserlib.util
|
6068 |
-
* @constructor
|
6069 |
-
* @param {String} message The error message.
|
6070 |
-
* @param {int} line The line at which the error occurred.
|
6071 |
-
* @param {int} col The column at which the error occurred.
|
6072 |
-
*/
|
6073 |
-
function ValidationError(message, line, col){
|
6074 |
-
|
6075 |
-
/**
|
6076 |
-
* The column at which the error occurred.
|
6077 |
-
* @type int
|
6078 |
-
* @property col
|
6079 |
-
*/
|
6080 |
-
this.col = col;
|
6081 |
-
|
6082 |
-
/**
|
6083 |
-
* The line at which the error occurred.
|
6084 |
-
* @type int
|
6085 |
-
* @property line
|
6086 |
-
*/
|
6087 |
-
this.line = line;
|
6088 |
-
|
6089 |
-
/**
|
6090 |
-
* The text representation of the unit.
|
6091 |
-
* @type String
|
6092 |
-
* @property text
|
6093 |
-
*/
|
6094 |
-
this.message = message;
|
6095 |
-
|
6096 |
-
}
|
6097 |
-
|
6098 |
-
//inherit from Error
|
6099 |
-
ValidationError.prototype = new Error();
|
6100 |
-
//This file will likely change a lot! Very experimental!
|
6101 |
-
/*global Properties, Validation, ValidationError, PropertyValueIterator, console*/
|
6102 |
-
var ValidationTypes = {
|
6103 |
-
|
6104 |
-
isLiteral: function (part, literals) {
|
6105 |
-
var text = part.text.toString().toLowerCase(),
|
6106 |
-
args = literals.split(" | "),
|
6107 |
-
i, len, found = false;
|
6108 |
-
|
6109 |
-
for (i=0,len=args.length; i < len && !found; i++){
|
6110 |
-
if (text == args[i].toLowerCase()){
|
6111 |
-
found = true;
|
6112 |
-
}
|
6113 |
-
}
|
6114 |
-
|
6115 |
-
return found;
|
6116 |
-
},
|
6117 |
-
|
6118 |
-
isSimple: function(type) {
|
6119 |
-
return !!this.simple[type];
|
6120 |
-
},
|
6121 |
-
|
6122 |
-
isComplex: function(type) {
|
6123 |
-
return !!this.complex[type];
|
6124 |
-
},
|
6125 |
-
|
6126 |
-
/**
|
6127 |
-
* Determines if the next part(s) of the given expression
|
6128 |
-
* are any of the given types.
|
6129 |
-
*/
|
6130 |
-
isAny: function (expression, types) {
|
6131 |
-
var args = types.split(" | "),
|
6132 |
-
i, len, found = false;
|
6133 |
-
|
6134 |
-
for (i=0,len=args.length; i < len && !found && expression.hasNext(); i++){
|
6135 |
-
found = this.isType(expression, args[i]);
|
6136 |
-
}
|
6137 |
-
|
6138 |
-
return found;
|
6139 |
-
},
|
6140 |
-
|
6141 |
-
/**
|
6142 |
-
* Determines if the next part(s) of the given expression
|
6143 |
-
* are one of a group.
|
6144 |
-
*/
|
6145 |
-
isAnyOfGroup: function(expression, types) {
|
6146 |
-
var args = types.split(" || "),
|
6147 |
-
i, len, found = false;
|
6148 |
-
|
6149 |
-
for (i=0,len=args.length; i < len && !found; i++){
|
6150 |
-
found = this.isType(expression, args[i]);
|
6151 |
-
}
|
6152 |
-
|
6153 |
-
return found ? args[i-1] : false;
|
6154 |
-
},
|
6155 |
-
|
6156 |
-
/**
|
6157 |
-
* Determines if the next part(s) of the given expression
|
6158 |
-
* are of a given type.
|
6159 |
-
*/
|
6160 |
-
isType: function (expression, type) {
|
6161 |
-
var part = expression.peek(),
|
6162 |
-
result = false;
|
6163 |
-
|
6164 |
-
if (type.charAt(0) != "<") {
|
6165 |
-
result = this.isLiteral(part, type);
|
6166 |
-
if (result) {
|
6167 |
-
expression.next();
|
6168 |
-
}
|
6169 |
-
} else if (this.simple[type]) {
|
6170 |
-
result = this.simple[type](part);
|
6171 |
-
if (result) {
|
6172 |
-
expression.next();
|
6173 |
-
}
|
6174 |
-
} else {
|
6175 |
-
result = this.complex[type](expression);
|
6176 |
-
}
|
6177 |
-
|
6178 |
-
return result;
|
6179 |
-
},
|
6180 |
-
|
6181 |
-
|
6182 |
-
|
6183 |
-
simple: {
|
6184 |
-
|
6185 |
-
"<absolute-size>": function(part){
|
6186 |
-
return ValidationTypes.isLiteral(part, "xx-small | x-small | small | medium | large | x-large | xx-large");
|
6187 |
-
},
|
6188 |
-
|
6189 |
-
"<attachment>": function(part){
|
6190 |
-
return ValidationTypes.isLiteral(part, "scroll | fixed | local");
|
6191 |
-
},
|
6192 |
-
|
6193 |
-
"<attr>": function(part){
|
6194 |
-
return part.type == "function" && part.name == "attr";
|
6195 |
-
},
|
6196 |
-
|
6197 |
-
"<bg-image>": function(part){
|
6198 |
-
return this["<image>"](part) || this["<gradient>"](part) || part == "none";
|
6199 |
-
},
|
6200 |
-
|
6201 |
-
"<gradient>": function(part) {
|
6202 |
-
return part.type == "function" && /^(?:\-(?:ms|moz|o|webkit)\-)?(?:repeating\-)?(?:radial\-|linear\-)?gradient/i.test(part);
|
6203 |
-
},
|
6204 |
-
|
6205 |
-
"<box>": function(part){
|
6206 |
-
return ValidationTypes.isLiteral(part, "padding-box | border-box | content-box");
|
6207 |
-
},
|
6208 |
-
|
6209 |
-
"<content>": function(part){
|
6210 |
-
return part.type == "function" && part.name == "content";
|
6211 |
-
},
|
6212 |
-
|
6213 |
-
"<relative-size>": function(part){
|
6214 |
-
return ValidationTypes.isLiteral(part, "smaller | larger");
|
6215 |
-
},
|
6216 |
-
|
6217 |
-
//any identifier
|
6218 |
-
"<ident>": function(part){
|
6219 |
-
return part.type == "identifier";
|
6220 |
-
},
|
6221 |
-
|
6222 |
-
"<length>": function(part){
|
6223 |
-
if (part.type == "function" && /^(?:\-(?:ms|moz|o|webkit)\-)?calc/i.test(part)){
|
6224 |
-
return true;
|
6225 |
-
}else{
|
6226 |
-
return part.type == "length" || part.type == "number" || part.type == "integer" || part == "0";
|
6227 |
-
}
|
6228 |
-
},
|
6229 |
-
|
6230 |
-
"<color>": function(part){
|
6231 |
-
return part.type == "color" || part == "transparent";
|
6232 |
-
},
|
6233 |
-
|
6234 |
-
"<number>": function(part){
|
6235 |
-
return part.type == "number" || this["<integer>"](part);
|
6236 |
-
},
|
6237 |
-
|
6238 |
-
"<integer>": function(part){
|
6239 |
-
return part.type == "integer";
|
6240 |
-
},
|
6241 |
-
|
6242 |
-
"<line>": function(part){
|
6243 |
-
return part.type == "integer";
|
6244 |
-
},
|
6245 |
-
|
6246 |
-
"<angle>": function(part){
|
6247 |
-
return part.type == "angle";
|
6248 |
-
},
|
6249 |
-
|
6250 |
-
"<uri>": function(part){
|
6251 |
-
return part.type == "uri";
|
6252 |
-
},
|
6253 |
-
|
6254 |
-
"<image>": function(part){
|
6255 |
-
return this["<uri>"](part);
|
6256 |
-
},
|
6257 |
-
|
6258 |
-
"<percentage>": function(part){
|
6259 |
-
return part.type == "percentage" || part == "0";
|
6260 |
-
},
|
6261 |
-
|
6262 |
-
"<border-width>": function(part){
|
6263 |
-
return this["<length>"](part) || ValidationTypes.isLiteral(part, "thin | medium | thick");
|
6264 |
-
},
|
6265 |
-
|
6266 |
-
"<border-style>": function(part){
|
6267 |
-
return ValidationTypes.isLiteral(part, "none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset");
|
6268 |
-
},
|
6269 |
-
|
6270 |
-
"<content-sizing>": function(part){ // http://www.w3.org/TR/css3-sizing/#width-height-keywords
|
6271 |
-
return ValidationTypes.isLiteral(part, "fill-available | -moz-available | -webkit-fill-available | max-content | -moz-max-content | -webkit-max-content | min-content | -moz-min-content | -webkit-min-content | fit-content | -moz-fit-content | -webkit-fit-content");
|
6272 |
-
},
|
6273 |
-
|
6274 |
-
"<margin-width>": function(part){
|
6275 |
-
return this["<length>"](part) || this["<percentage>"](part) || ValidationTypes.isLiteral(part, "auto");
|
6276 |
-
},
|
6277 |
-
|
6278 |
-
"<padding-width>": function(part){
|
6279 |
-
return this["<length>"](part) || this["<percentage>"](part);
|
6280 |
-
},
|
6281 |
-
|
6282 |
-
"<shape>": function(part){
|
6283 |
-
return part.type == "function" && (part.name == "rect" || part.name == "inset-rect");
|
6284 |
-
},
|
6285 |
-
|
6286 |
-
"<time>": function(part) {
|
6287 |
-
return part.type == "time";
|
6288 |
-
},
|
6289 |
-
|
6290 |
-
"<flex-grow>": function(part){
|
6291 |
-
return this["<number>"](part);
|
6292 |
-
},
|
6293 |
-
|
6294 |
-
"<flex-shrink>": function(part){
|
6295 |
-
return this["<number>"](part);
|
6296 |
-
},
|
6297 |
-
|
6298 |
-
"<width>": function(part){
|
6299 |
-
return this["<margin-width>"](part);
|
6300 |
-
},
|
6301 |
-
|
6302 |
-
"<flex-basis>": function(part){
|
6303 |
-
return this["<width>"](part);
|
6304 |
-
},
|
6305 |
-
|
6306 |
-
"<flex-direction>": function(part){
|
6307 |
-
return ValidationTypes.isLiteral(part, "row | row-reverse | column | column-reverse");
|
6308 |
-
},
|
6309 |
-
|
6310 |
-
"<flex-wrap>": function(part){
|
6311 |
-
return ValidationTypes.isLiteral(part, "nowrap | wrap | wrap-reverse");
|
6312 |
-
}
|
6313 |
-
},
|
6314 |
-
|
6315 |
-
complex: {
|
6316 |
-
|
6317 |
-
"<bg-position>": function(expression){
|
6318 |
-
var types = this,
|
6319 |
-
result = false,
|
6320 |
-
numeric = "<percentage> | <length>",
|
6321 |
-
xDir = "left | right",
|
6322 |
-
yDir = "top | bottom",
|
6323 |
-
count = 0,
|
6324 |
-
hasNext = function() {
|
6325 |
-
return expression.hasNext() && expression.peek() != ",";
|
6326 |
-
};
|
6327 |
-
|
6328 |
-
while (expression.peek(count) && expression.peek(count) != ",") {
|
6329 |
-
count++;
|
6330 |
-
}
|
6331 |
-
|
6332 |
-
/*
|
6333 |
-
<position> = [
|
6334 |
-
[ left | center | right | top | bottom | <percentage> | <length> ]
|
6335 |
-
|
|
6336 |
-
[ left | center | right | <percentage> | <length> ]
|
6337 |
-
[ top | center | bottom | <percentage> | <length> ]
|
6338 |
-
|
|
6339 |
-
[ center | [ left | right ] [ <percentage> | <length> ]? ] &&
|
6340 |
-
[ center | [ top | bottom ] [ <percentage> | <length> ]? ]
|
6341 |
-
]
|
6342 |
-
*/
|
6343 |
-
|
6344 |
-
if (count < 3) {
|
6345 |
-
if (ValidationTypes.isAny(expression, xDir + " | center | " + numeric)) {
|
6346 |
-
result = true;
|
6347 |
-
ValidationTypes.isAny(expression, yDir + " | center | " + numeric);
|
6348 |
-
} else if (ValidationTypes.isAny(expression, yDir)) {
|
6349 |
-
result = true;
|
6350 |
-
ValidationTypes.isAny(expression, xDir + " | center");
|
6351 |
-
}
|
6352 |
-
} else {
|
6353 |
-
if (ValidationTypes.isAny(expression, xDir)) {
|
6354 |
-
if (ValidationTypes.isAny(expression, yDir)) {
|
6355 |
-
result = true;
|
6356 |
-
ValidationTypes.isAny(expression, numeric);
|
6357 |
-
} else if (ValidationTypes.isAny(expression, numeric)) {
|
6358 |
-
if (ValidationTypes.isAny(expression, yDir)) {
|
6359 |
-
result = true;
|
6360 |
-
ValidationTypes.isAny(expression, numeric);
|
6361 |
-
} else if (ValidationTypes.isAny(expression, "center")) {
|
6362 |
-
result = true;
|
6363 |
-
}
|
6364 |
-
}
|
6365 |
-
} else if (ValidationTypes.isAny(expression, yDir)) {
|
6366 |
-
if (ValidationTypes.isAny(expression, xDir)) {
|
6367 |
-
result = true;
|
6368 |
-
ValidationTypes.isAny(expression, numeric);
|
6369 |
-
} else if (ValidationTypes.isAny(expression, numeric)) {
|
6370 |
-
if (ValidationTypes.isAny(expression, xDir)) {
|
6371 |
-
result = true;
|
6372 |
-
ValidationTypes.isAny(expression, numeric);
|
6373 |
-
} else if (ValidationTypes.isAny(expression, "center")) {
|
6374 |
-
result = true;
|
6375 |
-
}
|
6376 |
-
}
|
6377 |
-
} else if (ValidationTypes.isAny(expression, "center")) {
|
6378 |
-
if (ValidationTypes.isAny(expression, xDir + " | " + yDir)) {
|
6379 |
-
result = true;
|
6380 |
-
ValidationTypes.isAny(expression, numeric);
|
6381 |
-
}
|
6382 |
-
}
|
6383 |
-
}
|
6384 |
-
|
6385 |
-
return result;
|
6386 |
-
},
|
6387 |
-
|
6388 |
-
"<bg-size>": function(expression){
|
6389 |
-
//<bg-size> = [ <length> | <percentage> | auto ]{1,2} | cover | contain
|
6390 |
-
var types = this,
|
6391 |
-
result = false,
|
6392 |
-
numeric = "<percentage> | <length> | auto",
|
6393 |
-
part,
|
6394 |
-
i, len;
|
6395 |
-
|
6396 |
-
if (ValidationTypes.isAny(expression, "cover | contain")) {
|
6397 |
-
result = true;
|
6398 |
-
} else if (ValidationTypes.isAny(expression, numeric)) {
|
6399 |
-
result = true;
|
6400 |
-
ValidationTypes.isAny(expression, numeric);
|
6401 |
-
}
|
6402 |
-
|
6403 |
-
return result;
|
6404 |
-
},
|
6405 |
-
|
6406 |
-
"<repeat-style>": function(expression){
|
6407 |
-
//repeat-x | repeat-y | [repeat | space | round | no-repeat]{1,2}
|
6408 |
-
var result = false,
|
6409 |
-
values = "repeat | space | round | no-repeat",
|
6410 |
-
part;
|
6411 |
-
|
6412 |
-
if (expression.hasNext()){
|
6413 |
-
part = expression.next();
|
6414 |
-
|
6415 |
-
if (ValidationTypes.isLiteral(part, "repeat-x | repeat-y")) {
|
6416 |
-
result = true;
|
6417 |
-
} else if (ValidationTypes.isLiteral(part, values)) {
|
6418 |
-
result = true;
|
6419 |
-
|
6420 |
-
if (expression.hasNext() && ValidationTypes.isLiteral(expression.peek(), values)) {
|
6421 |
-
expression.next();
|
6422 |
-
}
|
6423 |
-
}
|
6424 |
-
}
|
6425 |
-
|
6426 |
-
return result;
|
6427 |
-
|
6428 |
-
},
|
6429 |
-
|
6430 |
-
"<shadow>": function(expression) {
|
6431 |
-
//inset? && [ <length>{2,4} && <color>? ]
|
6432 |
-
var result = false,
|
6433 |
-
count = 0,
|
6434 |
-
inset = false,
|
6435 |
-
color = false,
|
6436 |
-
part;
|
6437 |
-
|
6438 |
-
if (expression.hasNext()) {
|
6439 |
-
|
6440 |
-
if (ValidationTypes.isAny(expression, "inset")){
|
6441 |
-
inset = true;
|
6442 |
-
}
|
6443 |
-
|
6444 |
-
if (ValidationTypes.isAny(expression, "<color>")) {
|
6445 |
-
color = true;
|
6446 |
-
}
|
6447 |
-
|
6448 |
-
while (ValidationTypes.isAny(expression, "<length>") && count < 4) {
|
6449 |
-
count++;
|
6450 |
-
}
|
6451 |
-
|
6452 |
-
|
6453 |
-
if (expression.hasNext()) {
|
6454 |
-
if (!color) {
|
6455 |
-
ValidationTypes.isAny(expression, "<color>");
|
6456 |
-
}
|
6457 |
-
|
6458 |
-
if (!inset) {
|
6459 |
-
ValidationTypes.isAny(expression, "inset");
|
6460 |
-
}
|
6461 |
-
|
6462 |
-
}
|
6463 |
-
|
6464 |
-
result = (count >= 2 && count <= 4);
|
6465 |
-
|
6466 |
-
}
|
6467 |
-
|
6468 |
-
return result;
|
6469 |
-
},
|
6470 |
-
|
6471 |
-
"<x-one-radius>": function(expression) {
|
6472 |
-
//[ <length> | <percentage> ] [ <length> | <percentage> ]?
|
6473 |
-
var result = false,
|
6474 |
-
simple = "<length> | <percentage> | inherit";
|
6475 |
-
|
6476 |
-
if (ValidationTypes.isAny(expression, simple)){
|
6477 |
-
result = true;
|
6478 |
-
ValidationTypes.isAny(expression, simple);
|
6479 |
-
}
|
6480 |
-
|
6481 |
-
return result;
|
6482 |
-
},
|
6483 |
-
|
6484 |
-
"<flex>": function(expression) {
|
6485 |
-
// http://www.w3.org/TR/2014/WD-css-flexbox-1-20140325/#flex-property
|
6486 |
-
// none | [ <flex-grow> <flex-shrink>? || <flex-basis> ]
|
6487 |
-
// Valid syntaxes, according to https://developer.mozilla.org/en-US/docs/Web/CSS/flex#Syntax
|
6488 |
-
// * none
|
6489 |
-
// * <flex-grow>
|
6490 |
-
// * <flex-basis>
|
6491 |
-
// * <flex-grow> <flex-basis>
|
6492 |
-
// * <flex-grow> <flex-shrink>
|
6493 |
-
// * <flex-grow> <flex-shrink> <flex-basis>
|
6494 |
-
// * inherit
|
6495 |
-
var part,
|
6496 |
-
result = false;
|
6497 |
-
if (ValidationTypes.isAny(expression, "none | inherit")) {
|
6498 |
-
result = true;
|
6499 |
-
} else {
|
6500 |
-
if (ValidationTypes.isType(expression, "<flex-grow>")) {
|
6501 |
-
if (expression.peek()) {
|
6502 |
-
if (ValidationTypes.isType(expression, "<flex-shrink>")) {
|
6503 |
-
if (expression.peek()) {
|
6504 |
-
result = ValidationTypes.isType(expression, "<flex-basis>");
|
6505 |
-
} else {
|
6506 |
-
result = true;
|
6507 |
-
}
|
6508 |
-
} else if (ValidationTypes.isType(expression, "<flex-basis>")) {
|
6509 |
-
result = expression.peek() === null;
|
6510 |
-
}
|
6511 |
-
} else {
|
6512 |
-
result = true;
|
6513 |
-
}
|
6514 |
-
} else if (ValidationTypes.isType(expression, "<flex-basis>")) {
|
6515 |
-
result = true;
|
6516 |
-
}
|
6517 |
-
}
|
6518 |
-
|
6519 |
-
if (!result) {
|
6520 |
-
// Generate a more verbose error than "Expected <flex>..."
|
6521 |
-
part = expression.peek();
|
6522 |
-
throw new ValidationError("Expected (none | [ <flex-grow> <flex-shrink>? || <flex-basis> ]) but found '" + expression.value.text + "'.", part.line, part.col);
|
6523 |
-
}
|
6524 |
-
|
6525 |
-
return result;
|
6526 |
-
}
|
6527 |
-
}
|
6528 |
-
};
|
6529 |
-
|
6530 |
-
parserlib.css = {
|
6531 |
-
Colors :Colors,
|
6532 |
-
Combinator :Combinator,
|
6533 |
-
Parser :Parser,
|
6534 |
-
PropertyName :PropertyName,
|
6535 |
-
PropertyValue :PropertyValue,
|
6536 |
-
PropertyValuePart :PropertyValuePart,
|
6537 |
-
MediaFeature :MediaFeature,
|
6538 |
-
MediaQuery :MediaQuery,
|
6539 |
-
Selector :Selector,
|
6540 |
-
SelectorPart :SelectorPart,
|
6541 |
-
SelectorSubPart :SelectorSubPart,
|
6542 |
-
Specificity :Specificity,
|
6543 |
-
TokenStream :TokenStream,
|
6544 |
-
Tokens :Tokens,
|
6545 |
-
ValidationError :ValidationError
|
6546 |
-
};
|
6547 |
-
})();
|
6548 |
-
|
6549 |
-
(function(){
|
6550 |
-
for(var prop in parserlib){
|
6551 |
-
exports[prop] = parserlib[prop];
|
6552 |
-
}
|
6553 |
-
})();
|
6554 |
-
|
6555 |
-
|
6556 |
-
function objectToString(o) {
|
6557 |
-
return Object.prototype.toString.call(o);
|
6558 |
-
}
|
6559 |
-
|
6560 |
-
// shim for Node's 'util' package
|
6561 |
-
// DO NOT REMOVE THIS! It is required for compatibility with EnderJS (http://enderjs.com/).
|
6562 |
-
var util = {
|
6563 |
-
isArray: function (ar) {
|
6564 |
-
return Array.isArray(ar) || (typeof ar === 'object' && objectToString(ar) === '[object Array]');
|
6565 |
-
},
|
6566 |
-
isDate: function (d) {
|
6567 |
-
return typeof d === 'object' && objectToString(d) === '[object Date]';
|
6568 |
-
},
|
6569 |
-
isRegExp: function (re) {
|
6570 |
-
return typeof re === 'object' && objectToString(re) === '[object RegExp]';
|
6571 |
-
},
|
6572 |
-
getRegExpFlags: function (re) {
|
6573 |
-
var flags = '';
|
6574 |
-
re.global && (flags += 'g');
|
6575 |
-
re.ignoreCase && (flags += 'i');
|
6576 |
-
re.multiline && (flags += 'm');
|
6577 |
-
return flags;
|
6578 |
-
}
|
6579 |
-
};
|
6580 |
-
|
6581 |
-
|
6582 |
-
if (typeof module === 'object')
|
6583 |
-
module.exports = clone;
|
6584 |
-
|
6585 |
-
/**
|
6586 |
-
* Clones (copies) an Object using deep copying.
|
6587 |
-
*
|
6588 |
-
* This function supports circular references by default, but if you are certain
|
6589 |
-
* there are no circular references in your object, you can save some CPU time
|
6590 |
-
* by calling clone(obj, false).
|
6591 |
-
*
|
6592 |
-
* Caution: if `circular` is false and `parent` contains circular references,
|
6593 |
-
* your program may enter an infinite loop and crash.
|
6594 |
-
*
|
6595 |
-
* @param `parent` - the object to be cloned
|
6596 |
-
* @param `circular` - set to true if the object to be cloned may contain
|
6597 |
-
* circular references. (optional - true by default)
|
6598 |
-
* @param `depth` - set to a number if the object is only to be cloned to
|
6599 |
-
* a particular depth. (optional - defaults to Infinity)
|
6600 |
-
* @param `prototype` - sets the prototype to be used when cloning an object.
|
6601 |
-
* (optional - defaults to parent prototype).
|
6602 |
-
*/
|
6603 |
-
|
6604 |
-
function clone(parent, circular, depth, prototype) {
|
6605 |
-
// maintain two arrays for circular references, where corresponding parents
|
6606 |
-
// and children have the same index
|
6607 |
-
var allParents = [];
|
6608 |
-
var allChildren = [];
|
6609 |
-
|
6610 |
-
var useBuffer = typeof Buffer != 'undefined';
|
6611 |
-
|
6612 |
-
if (typeof circular == 'undefined')
|
6613 |
-
circular = true;
|
6614 |
-
|
6615 |
-
if (typeof depth == 'undefined')
|
6616 |
-
depth = Infinity;
|
6617 |
-
|
6618 |
-
// recurse this function so we don't reset allParents and allChildren
|
6619 |
-
function _clone(parent, depth) {
|
6620 |
-
// cloning null always returns null
|
6621 |
-
if (parent === null)
|
6622 |
-
return null;
|
6623 |
-
|
6624 |
-
if (depth == 0)
|
6625 |
-
return parent;
|
6626 |
-
|
6627 |
-
var child;
|
6628 |
-
if (typeof parent != 'object') {
|
6629 |
-
return parent;
|
6630 |
-
}
|
6631 |
-
|
6632 |
-
if (util.isArray(parent)) {
|
6633 |
-
child = [];
|
6634 |
-
} else if (util.isRegExp(parent)) {
|
6635 |
-
child = new RegExp(parent.source, util.getRegExpFlags(parent));
|
6636 |
-
if (parent.lastIndex) child.lastIndex = parent.lastIndex;
|
6637 |
-
} else if (util.isDate(parent)) {
|
6638 |
-
child = new Date(parent.getTime());
|
6639 |
-
} else if (useBuffer && Buffer.isBuffer(parent)) {
|
6640 |
-
child = new Buffer(parent.length);
|
6641 |
-
parent.copy(child);
|
6642 |
-
return child;
|
6643 |
-
} else {
|
6644 |
-
if (typeof prototype == 'undefined') child = Object.create(Object.getPrototypeOf(parent));
|
6645 |
-
else child = Object.create(prototype);
|
6646 |
-
}
|
6647 |
-
|
6648 |
-
if (circular) {
|
6649 |
-
var index = allParents.indexOf(parent);
|
6650 |
-
|
6651 |
-
if (index != -1) {
|
6652 |
-
return allChildren[index];
|
6653 |
-
}
|
6654 |
-
allParents.push(parent);
|
6655 |
-
allChildren.push(child);
|
6656 |
-
}
|
6657 |
-
|
6658 |
-
for (var i in parent) {
|
6659 |
-
child[i] = _clone(parent[i], depth - 1);
|
6660 |
-
}
|
6661 |
-
|
6662 |
-
return child;
|
6663 |
-
}
|
6664 |
-
|
6665 |
-
return _clone(parent, depth);
|
6666 |
-
}
|
6667 |
-
|
6668 |
-
/**
|
6669 |
-
* Simple flat clone using prototype, accepts only objects, usefull for property
|
6670 |
-
* override on FLAT configuration object (no nested props).
|
6671 |
-
*
|
6672 |
-
* USE WITH CAUTION! This may not behave as you wish if you do not know how this
|
6673 |
-
* works.
|
6674 |
-
*/
|
6675 |
-
clone.clonePrototype = function(parent) {
|
6676 |
-
if (parent === null)
|
6677 |
-
return null;
|
6678 |
-
|
6679 |
-
var c = function () {};
|
6680 |
-
c.prototype = parent;
|
6681 |
-
return new c();
|
6682 |
-
};
|
6683 |
-
|
6684 |
-
/**
|
6685 |
-
* Main CSSLint object.
|
6686 |
-
* @class CSSLint
|
6687 |
-
* @static
|
6688 |
-
* @extends parserlib.util.EventTarget
|
6689 |
-
*/
|
6690 |
-
|
6691 |
-
/* global parserlib, clone, Reporter */
|
6692 |
-
/* exported CSSLint */
|
6693 |
-
|
6694 |
-
var CSSLint = (function(){
|
6695 |
-
|
6696 |
-
var rules = [],
|
6697 |
-
formatters = [],
|
6698 |
-
embeddedRuleset = /\/\*csslint([^\*]*)\*\//,
|
6699 |
-
api = new parserlib.util.EventTarget();
|
6700 |
-
|
6701 |
-
api.version = "@VERSION@";
|
6702 |
-
|
6703 |
-
//-------------------------------------------------------------------------
|
6704 |
-
// Rule Management
|
6705 |
-
//-------------------------------------------------------------------------
|
6706 |
-
|
6707 |
-
/**
|
6708 |
-
* Adds a new rule to the engine.
|
6709 |
-
* @param {Object} rule The rule to add.
|
6710 |
-
* @method addRule
|
6711 |
-
*/
|
6712 |
-
api.addRule = function(rule){
|
6713 |
-
rules.push(rule);
|
6714 |
-
rules[rule.id] = rule;
|
6715 |
-
};
|
6716 |
-
|
6717 |
-
/**
|
6718 |
-
* Clears all rule from the engine.
|
6719 |
-
* @method clearRules
|
6720 |
-
*/
|
6721 |
-
api.clearRules = function(){
|
6722 |
-
rules = [];
|
6723 |
-
};
|
6724 |
-
|
6725 |
-
/**
|
6726 |
-
* Returns the rule objects.
|
6727 |
-
* @return An array of rule objects.
|
6728 |
-
* @method getRules
|
6729 |
-
*/
|
6730 |
-
api.getRules = function(){
|
6731 |
-
return [].concat(rules).sort(function(a,b){
|
6732 |
-
return a.id > b.id ? 1 : 0;
|
6733 |
-
});
|
6734 |
-
};
|
6735 |
-
|
6736 |
-
/**
|
6737 |
-
* Returns a ruleset configuration object with all current rules.
|
6738 |
-
* @return A ruleset object.
|
6739 |
-
* @method getRuleset
|
6740 |
-
*/
|
6741 |
-
api.getRuleset = function() {
|
6742 |
-
var ruleset = {},
|
6743 |
-
i = 0,
|
6744 |
-
len = rules.length;
|
6745 |
-
|
6746 |
-
while (i < len){
|
6747 |
-
ruleset[rules[i++].id] = 1; //by default, everything is a warning
|
6748 |
-
}
|
6749 |
-
|
6750 |
-
return ruleset;
|
6751 |
-
};
|
6752 |
-
|
6753 |
-
/**
|
6754 |
-
* Returns a ruleset object based on embedded rules.
|
6755 |
-
* @param {String} text A string of css containing embedded rules.
|
6756 |
-
* @param {Object} ruleset A ruleset object to modify.
|
6757 |
-
* @return {Object} A ruleset object.
|
6758 |
-
* @method getEmbeddedRuleset
|
6759 |
-
*/
|
6760 |
-
function applyEmbeddedRuleset(text, ruleset){
|
6761 |
-
var valueMap,
|
6762 |
-
embedded = text && text.match(embeddedRuleset),
|
6763 |
-
rules = embedded && embedded[1];
|
6764 |
-
|
6765 |
-
if (rules) {
|
6766 |
-
valueMap = {
|
6767 |
-
"true": 2, // true is error
|
6768 |
-
"": 1, // blank is warning
|
6769 |
-
"false": 0, // false is ignore
|
6770 |
-
|
6771 |
-
"2": 2, // explicit error
|
6772 |
-
"1": 1, // explicit warning
|
6773 |
-
"0": 0 // explicit ignore
|
6774 |
-
};
|
6775 |
-
|
6776 |
-
rules.toLowerCase().split(",").forEach(function(rule){
|
6777 |
-
var pair = rule.split(":"),
|
6778 |
-
property = pair[0] || "",
|
6779 |
-
value = pair[1] || "";
|
6780 |
-
|
6781 |
-
ruleset[property.trim()] = valueMap[value.trim()];
|
6782 |
-
});
|
6783 |
-
}
|
6784 |
-
|
6785 |
-
return ruleset;
|
6786 |
-
}
|
6787 |
-
|
6788 |
-
//-------------------------------------------------------------------------
|
6789 |
-
// Formatters
|
6790 |
-
//-------------------------------------------------------------------------
|
6791 |
-
|
6792 |
-
/**
|
6793 |
-
* Adds a new formatter to the engine.
|
6794 |
-
* @param {Object} formatter The formatter to add.
|
6795 |
-
* @method addFormatter
|
6796 |
-
*/
|
6797 |
-
api.addFormatter = function(formatter) {
|
6798 |
-
// formatters.push(formatter);
|
6799 |
-
formatters[formatter.id] = formatter;
|
6800 |
-
};
|
6801 |
-
|
6802 |
-
/**
|
6803 |
-
* Retrieves a formatter for use.
|
6804 |
-
* @param {String} formatId The name of the format to retrieve.
|
6805 |
-
* @return {Object} The formatter or undefined.
|
6806 |
-
* @method getFormatter
|
6807 |
-
*/
|
6808 |
-
api.getFormatter = function(formatId){
|
6809 |
-
return formatters[formatId];
|
6810 |
-
};
|
6811 |
-
|
6812 |
-
/**
|
6813 |
-
* Formats the results in a particular format for a single file.
|
6814 |
-
* @param {Object} result The results returned from CSSLint.verify().
|
6815 |
-
* @param {String} filename The filename for which the results apply.
|
6816 |
-
* @param {String} formatId The name of the formatter to use.
|
6817 |
-
* @param {Object} options (Optional) for special output handling.
|
6818 |
-
* @return {String} A formatted string for the results.
|
6819 |
-
* @method format
|
6820 |
-
*/
|
6821 |
-
api.format = function(results, filename, formatId, options) {
|
6822 |
-
var formatter = this.getFormatter(formatId),
|
6823 |
-
result = null;
|
6824 |
-
|
6825 |
-
if (formatter){
|
6826 |
-
result = formatter.startFormat();
|
6827 |
-
result += formatter.formatResults(results, filename, options || {});
|
6828 |
-
result += formatter.endFormat();
|
6829 |
-
}
|
6830 |
-
|
6831 |
-
return result;
|
6832 |
-
};
|
6833 |
-
|
6834 |
-
/**
|
6835 |
-
* Indicates if the given format is supported.
|
6836 |
-
* @param {String} formatId The ID of the format to check.
|
6837 |
-
* @return {Boolean} True if the format exists, false if not.
|
6838 |
-
* @method hasFormat
|
6839 |
-
*/
|
6840 |
-
api.hasFormat = function(formatId){
|
6841 |
-
return formatters.hasOwnProperty(formatId);
|
6842 |
-
};
|
6843 |
-
|
6844 |
-
//-------------------------------------------------------------------------
|
6845 |
-
// Verification
|
6846 |
-
//-------------------------------------------------------------------------
|
6847 |
-
|
6848 |
-
/**
|
6849 |
-
* Starts the verification process for the given CSS text.
|
6850 |
-
* @param {String} text The CSS text to verify.
|
6851 |
-
* @param {Object} ruleset (Optional) List of rules to apply. If null, then
|
6852 |
-
* all rules are used. If a rule has a value of 1 then it's a warning,
|
6853 |
-
* a value of 2 means it's an error.
|
6854 |
-
* @return {Object} Results of the verification.
|
6855 |
-
* @method verify
|
6856 |
-
*/
|
6857 |
-
api.verify = function(text, ruleset){
|
6858 |
-
|
6859 |
-
var i = 0,
|
6860 |
-
reporter,
|
6861 |
-
lines,
|
6862 |
-
report,
|
6863 |
-
parser = new parserlib.css.Parser({ starHack: true, ieFilters: true,
|
6864 |
-
underscoreHack: true, strict: false });
|
6865 |
-
|
6866 |
-
// normalize line endings
|
6867 |
-
lines = text.replace(/\n\r?/g, "$split$").split("$split$");
|
6868 |
-
|
6869 |
-
if (!ruleset){
|
6870 |
-
ruleset = this.getRuleset();
|
6871 |
-
}
|
6872 |
-
|
6873 |
-
if (embeddedRuleset.test(text)){
|
6874 |
-
//defensively copy so that caller's version does not get modified
|
6875 |
-
ruleset = clone(ruleset);
|
6876 |
-
ruleset = applyEmbeddedRuleset(text, ruleset);
|
6877 |
-
}
|
6878 |
-
|
6879 |
-
reporter = new Reporter(lines, ruleset);
|
6880 |
-
|
6881 |
-
ruleset.errors = 2; //always report parsing errors as errors
|
6882 |
-
for (i in ruleset){
|
6883 |
-
if(ruleset.hasOwnProperty(i) && ruleset[i]){
|
6884 |
-
if (rules[i]){
|
6885 |
-
rules[i].init(parser, reporter);
|
6886 |
-
}
|
6887 |
-
}
|
6888 |
-
}
|
6889 |
-
|
6890 |
-
|
6891 |
-
//capture most horrible error type
|
6892 |
-
try {
|
6893 |
-
parser.parse(text);
|
6894 |
-
} catch (ex) {
|
6895 |
-
reporter.error("Fatal error, cannot continue: " + ex.message, ex.line, ex.col, {});
|
6896 |
-
}
|
6897 |
-
|
6898 |
-
report = {
|
6899 |
-
messages : reporter.messages,
|
6900 |
-
stats : reporter.stats,
|
6901 |
-
ruleset : reporter.ruleset
|
6902 |
-
};
|
6903 |
-
|
6904 |
-
//sort by line numbers, rollups at the bottom
|
6905 |
-
report.messages.sort(function (a, b){
|
6906 |
-
if (a.rollup && !b.rollup){
|
6907 |
-
return 1;
|
6908 |
-
} else if (!a.rollup && b.rollup){
|
6909 |
-
return -1;
|
6910 |
-
} else {
|
6911 |
-
return a.line - b.line;
|
6912 |
-
}
|
6913 |
-
});
|
6914 |
-
|
6915 |
-
return report;
|
6916 |
-
};
|
6917 |
-
|
6918 |
-
//-------------------------------------------------------------------------
|
6919 |
-
// Publish the API
|
6920 |
-
//-------------------------------------------------------------------------
|
6921 |
-
|
6922 |
-
return api;
|
6923 |
-
|
6924 |
-
})();
|
6925 |
-
|
6926 |
-
/**
|
6927 |
-
* An instance of Report is used to report results of the
|
6928 |
-
* verification back to the main API.
|
6929 |
-
* @class Reporter
|
6930 |
-
* @constructor
|
6931 |
-
* @param {String[]} lines The text lines of the source.
|
6932 |
-
* @param {Object} ruleset The set of rules to work with, including if
|
6933 |
-
* they are errors or warnings.
|
6934 |
-
*/
|
6935 |
-
function Reporter(lines, ruleset){
|
6936 |
-
|
6937 |
-
/**
|
6938 |
-
* List of messages being reported.
|
6939 |
-
* @property messages
|
6940 |
-
* @type String[]
|
6941 |
-
*/
|
6942 |
-
this.messages = [];
|
6943 |
-
|
6944 |
-
/**
|
6945 |
-
* List of statistics being reported.
|
6946 |
-
* @property stats
|
6947 |
-
* @type String[]
|
6948 |
-
*/
|
6949 |
-
this.stats = [];
|
6950 |
-
|
6951 |
-
/**
|
6952 |
-
* Lines of code being reported on. Used to provide contextual information
|
6953 |
-
* for messages.
|
6954 |
-
* @property lines
|
6955 |
-
* @type String[]
|
6956 |
-
*/
|
6957 |
-
this.lines = lines;
|
6958 |
-
|
6959 |
-
/**
|
6960 |
-
* Information about the rules. Used to determine whether an issue is an
|
6961 |
-
* error or warning.
|
6962 |
-
* @property ruleset
|
6963 |
-
* @type Object
|
6964 |
-
*/
|
6965 |
-
this.ruleset = ruleset;
|
6966 |
-
}
|
6967 |
-
|
6968 |
-
Reporter.prototype = {
|
6969 |
-
|
6970 |
-
//restore constructor
|
6971 |
-
constructor: Reporter,
|
6972 |
-
|
6973 |
-
/**
|
6974 |
-
* Report an error.
|
6975 |
-
* @param {String} message The message to store.
|
6976 |
-
* @param {int} line The line number.
|
6977 |
-
* @param {int} col The column number.
|
6978 |
-
* @param {Object} rule The rule this message relates to.
|
6979 |
-
* @method error
|
6980 |
-
*/
|
6981 |
-
error: function(message, line, col, rule){
|
6982 |
-
this.messages.push({
|
6983 |
-
type : "error",
|
6984 |
-
line : line,
|
6985 |
-
col : col,
|
6986 |
-
message : message,
|
6987 |
-
evidence: this.lines[line-1],
|
6988 |
-
rule : rule || {}
|
6989 |
-
});
|
6990 |
-
},
|
6991 |
-
|
6992 |
-
/**
|
6993 |
-
* Report an warning.
|
6994 |
-
* @param {String} message The message to store.
|
6995 |
-
* @param {int} line The line number.
|
6996 |
-
* @param {int} col The column number.
|
6997 |
-
* @param {Object} rule The rule this message relates to.
|
6998 |
-
* @method warn
|
6999 |
-
* @deprecated Use report instead.
|
7000 |
-
*/
|
7001 |
-
warn: function(message, line, col, rule){
|
7002 |
-
this.report(message, line, col, rule);
|
7003 |
-
},
|
7004 |
-
|
7005 |
-
/**
|
7006 |
-
* Report an issue.
|
7007 |
-
* @param {String} message The message to store.
|
7008 |
-
* @param {int} line The line number.
|
7009 |
-
* @param {int} col The column number.
|
7010 |
-
* @param {Object} rule The rule this message relates to.
|
7011 |
-
* @method report
|
7012 |
-
*/
|
7013 |
-
report: function(message, line, col, rule){
|
7014 |
-
this.messages.push({
|
7015 |
-
type : this.ruleset[rule.id] === 2 ? "error" : "warning",
|
7016 |
-
line : line,
|
7017 |
-
col : col,
|
7018 |
-
message : message,
|
7019 |
-
evidence: this.lines[line-1],
|
7020 |
-
rule : rule
|
7021 |
-
});
|
7022 |
-
},
|
7023 |
-
|
7024 |
-
/**
|
7025 |
-
* Report some informational text.
|
7026 |
-
* @param {String} message The message to store.
|
7027 |
-
* @param {int} line The line number.
|
7028 |
-
* @param {int} col The column number.
|
7029 |
-
* @param {Object} rule The rule this message relates to.
|
7030 |
-
* @method info
|
7031 |
-
*/
|
7032 |
-
info: function(message, line, col, rule){
|
7033 |
-
this.messages.push({
|
7034 |
-
type : "info",
|
7035 |
-
line : line,
|
7036 |
-
col : col,
|
7037 |
-
message : message,
|
7038 |
-
evidence: this.lines[line-1],
|
7039 |
-
rule : rule
|
7040 |
-
});
|
7041 |
-
},
|
7042 |
-
|
7043 |
-
/**
|
7044 |
-
* Report some rollup error information.
|
7045 |
-
* @param {String} message The message to store.
|
7046 |
-
* @param {Object} rule The rule this message relates to.
|
7047 |
-
* @method rollupError
|
7048 |
-
*/
|
7049 |
-
rollupError: function(message, rule){
|
7050 |
-
this.messages.push({
|
7051 |
-
type : "error",
|
7052 |
-
rollup : true,
|
7053 |
-
message : message,
|
7054 |
-
rule : rule
|
7055 |
-
});
|
7056 |
-
},
|
7057 |
-
|
7058 |
-
/**
|
7059 |
-
* Report some rollup warning information.
|
7060 |
-
* @param {String} message The message to store.
|
7061 |
-
* @param {Object} rule The rule this message relates to.
|
7062 |
-
* @method rollupWarn
|
7063 |
-
*/
|
7064 |
-
rollupWarn: function(message, rule){
|
7065 |
-
this.messages.push({
|
7066 |
-
type : "warning",
|
7067 |
-
rollup : true,
|
7068 |
-
message : message,
|
7069 |
-
rule : rule
|
7070 |
-
});
|
7071 |
-
},
|
7072 |
-
|
7073 |
-
/**
|
7074 |
-
* Report a statistic.
|
7075 |
-
* @param {String} name The name of the stat to store.
|
7076 |
-
* @param {Variant} value The value of the stat.
|
7077 |
-
* @method stat
|
7078 |
-
*/
|
7079 |
-
stat: function(name, value){
|
7080 |
-
this.stats[name] = value;
|
7081 |
-
}
|
7082 |
-
};
|
7083 |
-
|
7084 |
-
//expose for testing purposes
|
7085 |
-
CSSLint._Reporter = Reporter;
|
7086 |
-
|
7087 |
-
/*
|
7088 |
-
* Utility functions that make life easier.
|
7089 |
-
*/
|
7090 |
-
CSSLint.Util = {
|
7091 |
-
/*
|
7092 |
-
* Adds all properties from supplier onto receiver,
|
7093 |
-
* overwriting if the same name already exists on
|
7094 |
-
* reciever.
|
7095 |
-
* @param {Object} The object to receive the properties.
|
7096 |
-
* @param {Object} The object to provide the properties.
|
7097 |
-
* @return {Object} The receiver
|
7098 |
-
*/
|
7099 |
-
mix: function(receiver, supplier){
|
7100 |
-
var prop;
|
7101 |
-
|
7102 |
-
for (prop in supplier){
|
7103 |
-
if (supplier.hasOwnProperty(prop)){
|
7104 |
-
receiver[prop] = supplier[prop];
|
7105 |
-
}
|
7106 |
-
}
|
7107 |
-
|
7108 |
-
return prop;
|
7109 |
-
},
|
7110 |
-
|
7111 |
-
/*
|
7112 |
-
* Polyfill for array indexOf() method.
|
7113 |
-
* @param {Array} values The array to search.
|
7114 |
-
* @param {Variant} value The value to search for.
|
7115 |
-
* @return {int} The index of the value if found, -1 if not.
|
7116 |
-
*/
|
7117 |
-
indexOf: function(values, value){
|
7118 |
-
if (values.indexOf){
|
7119 |
-
return values.indexOf(value);
|
7120 |
-
} else {
|
7121 |
-
for (var i=0, len=values.length; i < len; i++){
|
7122 |
-
if (values[i] === value){
|
7123 |
-
return i;
|
7124 |
-
}
|
7125 |
-
}
|
7126 |
-
return -1;
|
7127 |
-
}
|
7128 |
-
},
|
7129 |
-
|
7130 |
-
/*
|
7131 |
-
* Polyfill for array forEach() method.
|
7132 |
-
* @param {Array} values The array to operate on.
|
7133 |
-
* @param {Function} func The function to call on each item.
|
7134 |
-
* @return {void}
|
7135 |
-
*/
|
7136 |
-
forEach: function(values, func) {
|
7137 |
-
if (values.forEach){
|
7138 |
-
return values.forEach(func);
|
7139 |
-
} else {
|
7140 |
-
for (var i=0, len=values.length; i < len; i++){
|
7141 |
-
func(values[i], i, values);
|
7142 |
-
}
|
7143 |
-
}
|
7144 |
-
}
|
7145 |
-
};
|
7146 |
-
|
7147 |
-
/*
|
7148 |
-
* Rule: Don't use adjoining classes (.foo.bar).
|
7149 |
-
*/
|
7150 |
-
|
7151 |
-
CSSLint.addRule({
|
7152 |
-
|
7153 |
-
//rule information
|
7154 |
-
id: "adjoining-classes",
|
7155 |
-
name: "Disallow adjoining classes",
|
7156 |
-
desc: "Don't use adjoining classes.",
|
7157 |
-
browsers: "IE6",
|
7158 |
-
|
7159 |
-
//initialization
|
7160 |
-
init: function(parser, reporter){
|
7161 |
-
var rule = this;
|
7162 |
-
parser.addListener("startrule", function(event){
|
7163 |
-
var selectors = event.selectors,
|
7164 |
-
selector,
|
7165 |
-
part,
|
7166 |
-
modifier,
|
7167 |
-
classCount,
|
7168 |
-
i, j, k;
|
7169 |
-
|
7170 |
-
for (i=0; i < selectors.length; i++){
|
7171 |
-
selector = selectors[i];
|
7172 |
-
for (j=0; j < selector.parts.length; j++){
|
7173 |
-
part = selector.parts[j];
|
7174 |
-
if (part.type === parser.SELECTOR_PART_TYPE){
|
7175 |
-
classCount = 0;
|
7176 |
-
for (k=0; k < part.modifiers.length; k++){
|
7177 |
-
modifier = part.modifiers[k];
|
7178 |
-
if (modifier.type === "class"){
|
7179 |
-
classCount++;
|
7180 |
-
}
|
7181 |
-
if (classCount > 1){
|
7182 |
-
reporter.report("Don't use adjoining classes.", part.line, part.col, rule);
|
7183 |
-
}
|
7184 |
-
}
|
7185 |
-
}
|
7186 |
-
}
|
7187 |
-
}
|
7188 |
-
});
|
7189 |
-
}
|
7190 |
-
|
7191 |
-
});
|
7192 |
-
|
7193 |
-
/*
|
7194 |
-
* Rule: Don't use width or height when using padding or border.
|
7195 |
-
*/
|
7196 |
-
CSSLint.addRule({
|
7197 |
-
|
7198 |
-
//rule information
|
7199 |
-
id: "box-model",
|
7200 |
-
name: "Beware of broken box size",
|
7201 |
-
desc: "Don't use width or height when using padding or border.",
|
7202 |
-
browsers: "All",
|
7203 |
-
|
7204 |
-
//initialization
|
7205 |
-
init: function(parser, reporter){
|
7206 |
-
var rule = this,
|
7207 |
-
widthProperties = {
|
7208 |
-
border: 1,
|
7209 |
-
"border-left": 1,
|
7210 |
-
"border-right": 1,
|
7211 |
-
padding: 1,
|
7212 |
-
"padding-left": 1,
|
7213 |
-
"padding-right": 1
|
7214 |
-
},
|
7215 |
-
heightProperties = {
|
7216 |
-
border: 1,
|
7217 |
-
"border-bottom": 1,
|
7218 |
-
"border-top": 1,
|
7219 |
-
padding: 1,
|
7220 |
-
"padding-bottom": 1,
|
7221 |
-
"padding-top": 1
|
7222 |
-
},
|
7223 |
-
properties,
|
7224 |
-
boxSizing = false;
|
7225 |
-
|
7226 |
-
function startRule(){
|
7227 |
-
properties = {};
|
7228 |
-
boxSizing = false;
|
7229 |
-
}
|
7230 |
-
|
7231 |
-
function endRule(){
|
7232 |
-
var prop, value;
|
7233 |
-
|
7234 |
-
if (!boxSizing) {
|
7235 |
-
if (properties.height){
|
7236 |
-
for (prop in heightProperties){
|
7237 |
-
if (heightProperties.hasOwnProperty(prop) && properties[prop]){
|
7238 |
-
value = properties[prop].value;
|
7239 |
-
//special case for padding
|
7240 |
-
if (!(prop === "padding" && value.parts.length === 2 && value.parts[0].value === 0)){
|
7241 |
-
reporter.report("Using height with " + prop + " can sometimes make elements larger than you expect.", properties[prop].line, properties[prop].col, rule);
|
7242 |
-
}
|
7243 |
-
}
|
7244 |
-
}
|
7245 |
-
}
|
7246 |
-
|
7247 |
-
if (properties.width){
|
7248 |
-
for (prop in widthProperties){
|
7249 |
-
if (widthProperties.hasOwnProperty(prop) && properties[prop]){
|
7250 |
-
value = properties[prop].value;
|
7251 |
-
|
7252 |
-
if (!(prop === "padding" && value.parts.length === 2 && value.parts[1].value === 0)){
|
7253 |
-
reporter.report("Using width with " + prop + " can sometimes make elements larger than you expect.", properties[prop].line, properties[prop].col, rule);
|
7254 |
-
}
|
7255 |
-
}
|
7256 |
-
}
|
7257 |
-
}
|
7258 |
-
}
|
7259 |
-
}
|
7260 |
-
|
7261 |
-
parser.addListener("startrule", startRule);
|
7262 |
-
parser.addListener("startfontface", startRule);
|
7263 |
-
parser.addListener("startpage", startRule);
|
7264 |
-
parser.addListener("startpagemargin", startRule);
|
7265 |
-
parser.addListener("startkeyframerule", startRule);
|
7266 |
-
|
7267 |
-
parser.addListener("property", function(event){
|
7268 |
-
var name = event.property.text.toLowerCase();
|
7269 |
-
|
7270 |
-
if (heightProperties[name] || widthProperties[name]){
|
7271 |
-
if (!/^0\S*$/.test(event.value) && !(name === "border" && event.value.toString() === "none")){
|
7272 |
-
properties[name] = { line: event.property.line, col: event.property.col, value: event.value };
|
7273 |
-
}
|
7274 |
-
} else {
|
7275 |
-
if (/^(width|height)/i.test(name) && /^(length|percentage)/.test(event.value.parts[0].type)){
|
7276 |
-
properties[name] = 1;
|
7277 |
-
} else if (name === "box-sizing") {
|
7278 |
-
boxSizing = true;
|
7279 |
-
}
|
7280 |
-
}
|
7281 |
-
|
7282 |
-
});
|
7283 |
-
|
7284 |
-
parser.addListener("endrule", endRule);
|
7285 |
-
parser.addListener("endfontface", endRule);
|
7286 |
-
parser.addListener("endpage", endRule);
|
7287 |
-
parser.addListener("endpagemargin", endRule);
|
7288 |
-
parser.addListener("endkeyframerule", endRule);
|
7289 |
-
}
|
7290 |
-
|
7291 |
-
});
|
7292 |
-
|
7293 |
-
/*
|
7294 |
-
* Rule: box-sizing doesn't work in IE6 and IE7.
|
7295 |
-
*/
|
7296 |
-
|
7297 |
-
CSSLint.addRule({
|
7298 |
-
|
7299 |
-
//rule information
|
7300 |
-
id: "box-sizing",
|
7301 |
-
name: "Disallow use of box-sizing",
|
7302 |
-
desc: "The box-sizing properties isn't supported in IE6 and IE7.",
|
7303 |
-
browsers: "IE6, IE7",
|
7304 |
-
tags: ["Compatibility"],
|
7305 |
-
|
7306 |
-
//initialization
|
7307 |
-
init: function(parser, reporter){
|
7308 |
-
var rule = this;
|
7309 |
-
|
7310 |
-
parser.addListener("property", function(event){
|
7311 |
-
var name = event.property.text.toLowerCase();
|
7312 |
-
|
7313 |
-
if (name === "box-sizing"){
|
7314 |
-
reporter.report("The box-sizing property isn't supported in IE6 and IE7.", event.line, event.col, rule);
|
7315 |
-
}
|
7316 |
-
});
|
7317 |
-
}
|
7318 |
-
|
7319 |
-
});
|
7320 |
-
|
7321 |
-
/*
|
7322 |
-
* Rule: Use the bulletproof @font-face syntax to avoid 404's in old IE
|
7323 |
-
* (http://www.fontspring.com/blog/the-new-bulletproof-font-face-syntax)
|
7324 |
-
*/
|
7325 |
-
|
7326 |
-
CSSLint.addRule({
|
7327 |
-
|
7328 |
-
//rule information
|
7329 |
-
id: "bulletproof-font-face",
|
7330 |
-
name: "Use the bulletproof @font-face syntax",
|
7331 |
-
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).",
|
7332 |
-
browsers: "All",
|
7333 |
-
|
7334 |
-
//initialization
|
7335 |
-
init: function(parser, reporter){
|
7336 |
-
var rule = this,
|
7337 |
-
fontFaceRule = false,
|
7338 |
-
firstSrc = true,
|
7339 |
-
ruleFailed = false,
|
7340 |
-
line, col;
|
7341 |
-
|
7342 |
-
// Mark the start of a @font-face declaration so we only test properties inside it
|
7343 |
-
parser.addListener("startfontface", function(){
|
7344 |
-
fontFaceRule = true;
|
7345 |
-
});
|
7346 |
-
|
7347 |
-
parser.addListener("property", function(event){
|
7348 |
-
// If we aren't inside an @font-face declaration then just return
|
7349 |
-
if (!fontFaceRule) {
|
7350 |
-
return;
|
7351 |
-
}
|
7352 |
-
|
7353 |
-
var propertyName = event.property.toString().toLowerCase(),
|
7354 |
-
value = event.value.toString();
|
7355 |
-
|
7356 |
-
// Set the line and col numbers for use in the endfontface listener
|
7357 |
-
line = event.line;
|
7358 |
-
col = event.col;
|
7359 |
-
|
7360 |
-
// This is the property that we care about, we can ignore the rest
|
7361 |
-
if (propertyName === "src") {
|
7362 |
-
var regex = /^\s?url\(['"].+\.eot\?.*['"]\)\s*format\(['"]embedded-opentype['"]\).*$/i;
|
7363 |
-
|
7364 |
-
// We need to handle the advanced syntax with two src properties
|
7365 |
-
if (!value.match(regex) && firstSrc) {
|
7366 |
-
ruleFailed = true;
|
7367 |
-
firstSrc = false;
|
7368 |
-
} else if (value.match(regex) && !firstSrc) {
|
7369 |
-
ruleFailed = false;
|
7370 |
-
}
|
7371 |
-
}
|
7372 |
-
|
7373 |
-
|
7374 |
-
});
|
7375 |
-
|
7376 |
-
// Back to normal rules that we don't need to test
|
7377 |
-
parser.addListener("endfontface", function(){
|
7378 |
-
fontFaceRule = false;
|
7379 |
-
|
7380 |
-
if (ruleFailed) {
|
7381 |
-
reporter.report("@font-face declaration doesn't follow the fontspring bulletproof syntax.", line, col, rule);
|
7382 |
-
}
|
7383 |
-
});
|
7384 |
-
}
|
7385 |
-
});
|
7386 |
-
|
7387 |
-
/*
|
7388 |
-
* Rule: Include all compatible vendor prefixes to reach a wider
|
7389 |
-
* range of users.
|
7390 |
-
*/
|
7391 |
-
|
7392 |
-
CSSLint.addRule({
|
7393 |
-
|
7394 |
-
//rule information
|
7395 |
-
id: "compatible-vendor-prefixes",
|
7396 |
-
name: "Require compatible vendor prefixes",
|
7397 |
-
desc: "Include all compatible vendor prefixes to reach a wider range of users.",
|
7398 |
-
browsers: "All",
|
7399 |
-
|
7400 |
-
//initialization
|
7401 |
-
init: function (parser, reporter) {
|
7402 |
-
var rule = this,
|
7403 |
-
compatiblePrefixes,
|
7404 |
-
properties,
|
7405 |
-
prop,
|
7406 |
-
variations,
|
7407 |
-
prefixed,
|
7408 |
-
i,
|
7409 |
-
len,
|
7410 |
-
inKeyFrame = false,
|
7411 |
-
arrayPush = Array.prototype.push,
|
7412 |
-
applyTo = [];
|
7413 |
-
|
7414 |
-
// See http://peter.sh/experiments/vendor-prefixed-css-property-overview/ for details
|
7415 |
-
compatiblePrefixes = {
|
7416 |
-
"animation" : "webkit moz",
|
7417 |
-
"animation-delay" : "webkit moz",
|
7418 |
-
"animation-direction" : "webkit moz",
|
7419 |
-
"animation-duration" : "webkit moz",
|
7420 |
-
"animation-fill-mode" : "webkit moz",
|
7421 |
-
"animation-iteration-count" : "webkit moz",
|
7422 |
-
"animation-name" : "webkit moz",
|
7423 |
-
"animation-play-state" : "webkit moz",
|
7424 |
-
"animation-timing-function" : "webkit moz",
|
7425 |
-
"appearance" : "webkit moz",
|
7426 |
-
"border-end" : "webkit moz",
|
7427 |
-
"border-end-color" : "webkit moz",
|
7428 |
-
"border-end-style" : "webkit moz",
|
7429 |
-
"border-end-width" : "webkit moz",
|
7430 |
-
"border-image" : "webkit moz o",
|
7431 |
-
"border-radius" : "webkit",
|
7432 |
-
"border-start" : "webkit moz",
|
7433 |
-
"border-start-color" : "webkit moz",
|
7434 |
-
"border-start-style" : "webkit moz",
|
7435 |
-
"border-start-width" : "webkit moz",
|
7436 |
-
"box-align" : "webkit moz ms",
|
7437 |
-
"box-direction" : "webkit moz ms",
|
7438 |
-
"box-flex" : "webkit moz ms",
|
7439 |
-
"box-lines" : "webkit ms",
|
7440 |
-
"box-ordinal-group" : "webkit moz ms",
|
7441 |
-
"box-orient" : "webkit moz ms",
|
7442 |
-
"box-pack" : "webkit moz ms",
|
7443 |
-
"box-sizing" : "webkit moz",
|
7444 |
-
"box-shadow" : "webkit moz",
|
7445 |
-
"column-count" : "webkit moz ms",
|
7446 |
-
"column-gap" : "webkit moz ms",
|
7447 |
-
"column-rule" : "webkit moz ms",
|
7448 |
-
"column-rule-color" : "webkit moz ms",
|
7449 |
-
"column-rule-style" : "webkit moz ms",
|
7450 |
-
"column-rule-width" : "webkit moz ms",
|
7451 |
-
"column-width" : "webkit moz ms",
|
7452 |
-
"hyphens" : "epub moz",
|
7453 |
-
"line-break" : "webkit ms",
|
7454 |
-
"margin-end" : "webkit moz",
|
7455 |
-
"margin-start" : "webkit moz",
|
7456 |
-
"marquee-speed" : "webkit wap",
|
7457 |
-
"marquee-style" : "webkit wap",
|
7458 |
-
"padding-end" : "webkit moz",
|
7459 |
-
"padding-start" : "webkit moz",
|
7460 |
-
"tab-size" : "moz o",
|
7461 |
-
"text-size-adjust" : "webkit ms",
|
7462 |
-
"transform" : "webkit moz ms o",
|
7463 |
-
"transform-origin" : "webkit moz ms o",
|
7464 |
-
"transition" : "webkit moz o",
|
7465 |
-
"transition-delay" : "webkit moz o",
|
7466 |
-
"transition-duration" : "webkit moz o",
|
7467 |
-
"transition-property" : "webkit moz o",
|
7468 |
-
"transition-timing-function" : "webkit moz o",
|
7469 |
-
"user-modify" : "webkit moz",
|
7470 |
-
"user-select" : "webkit moz ms",
|
7471 |
-
"word-break" : "epub ms",
|
7472 |
-
"writing-mode" : "epub ms"
|
7473 |
-
};
|
7474 |
-
|
7475 |
-
|
7476 |
-
for (prop in compatiblePrefixes) {
|
7477 |
-
if (compatiblePrefixes.hasOwnProperty(prop)) {
|
7478 |
-
variations = [];
|
7479 |
-
prefixed = compatiblePrefixes[prop].split(" ");
|
7480 |
-
for (i = 0, len = prefixed.length; i < len; i++) {
|
7481 |
-
variations.push("-" + prefixed[i] + "-" + prop);
|
7482 |
-
}
|
7483 |
-
compatiblePrefixes[prop] = variations;
|
7484 |
-
arrayPush.apply(applyTo, variations);
|
7485 |
-
}
|
7486 |
-
}
|
7487 |
-
|
7488 |
-
parser.addListener("startrule", function () {
|
7489 |
-
properties = [];
|
7490 |
-
});
|
7491 |
-
|
7492 |
-
parser.addListener("startkeyframes", function (event) {
|
7493 |
-
inKeyFrame = event.prefix || true;
|
7494 |
-
});
|
7495 |
-
|
7496 |
-
parser.addListener("endkeyframes", function () {
|
7497 |
-
inKeyFrame = false;
|
7498 |
-
});
|
7499 |
-
|
7500 |
-
parser.addListener("property", function (event) {
|
7501 |
-
var name = event.property;
|
7502 |
-
if (CSSLint.Util.indexOf(applyTo, name.text) > -1) {
|
7503 |
-
|
7504 |
-
// e.g., -moz-transform is okay to be alone in @-moz-keyframes
|
7505 |
-
if (!inKeyFrame || typeof inKeyFrame !== "string" ||
|
7506 |
-
name.text.indexOf("-" + inKeyFrame + "-") !== 0) {
|
7507 |
-
properties.push(name);
|
7508 |
-
}
|
7509 |
-
}
|
7510 |
-
});
|
7511 |
-
|
7512 |
-
parser.addListener("endrule", function () {
|
7513 |
-
if (!properties.length) {
|
7514 |
-
return;
|
7515 |
-
}
|
7516 |
-
|
7517 |
-
var propertyGroups = {},
|
7518 |
-
i,
|
7519 |
-
len,
|
7520 |
-
name,
|
7521 |
-
prop,
|
7522 |
-
variations,
|
7523 |
-
value,
|
7524 |
-
full,
|
7525 |
-
actual,
|
7526 |
-
item,
|
7527 |
-
propertiesSpecified;
|
7528 |
-
|
7529 |
-
for (i = 0, len = properties.length; i < len; i++) {
|
7530 |
-
name = properties[i];
|
7531 |
-
|
7532 |
-
for (prop in compatiblePrefixes) {
|
7533 |
-
if (compatiblePrefixes.hasOwnProperty(prop)) {
|
7534 |
-
variations = compatiblePrefixes[prop];
|
7535 |
-
if (CSSLint.Util.indexOf(variations, name.text) > -1) {
|
7536 |
-
if (!propertyGroups[prop]) {
|
7537 |
-
propertyGroups[prop] = {
|
7538 |
-
full : variations.slice(0),
|
7539 |
-
actual : [],
|
7540 |
-
actualNodes: []
|
7541 |
-
};
|
7542 |
-
}
|
7543 |
-
if (CSSLint.Util.indexOf(propertyGroups[prop].actual, name.text) === -1) {
|
7544 |
-
propertyGroups[prop].actual.push(name.text);
|
7545 |
-
propertyGroups[prop].actualNodes.push(name);
|
7546 |
-
}
|
7547 |
-
}
|
7548 |
-
}
|
7549 |
-
}
|
7550 |
-
}
|
7551 |
-
|
7552 |
-
for (prop in propertyGroups) {
|
7553 |
-
if (propertyGroups.hasOwnProperty(prop)) {
|
7554 |
-
value = propertyGroups[prop];
|
7555 |
-
full = value.full;
|
7556 |
-
actual = value.actual;
|
7557 |
-
|
7558 |
-
if (full.length > actual.length) {
|
7559 |
-
for (i = 0, len = full.length; i < len; i++) {
|
7560 |
-
item = full[i];
|
7561 |
-
if (CSSLint.Util.indexOf(actual, item) === -1) {
|
7562 |
-
propertiesSpecified = (actual.length === 1) ? actual[0] : (actual.length === 2) ? actual.join(" and ") : actual.join(", ");
|
7563 |
-
reporter.report("The property " + item + " is compatible with " + propertiesSpecified + " and should be included as well.", value.actualNodes[0].line, value.actualNodes[0].col, rule);
|
7564 |
-
}
|
7565 |
-
}
|
7566 |
-
|
7567 |
-
}
|
7568 |
-
}
|
7569 |
-
}
|
7570 |
-
});
|
7571 |
-
}
|
7572 |
-
});
|
7573 |
-
|
7574 |
-
/*
|
7575 |
-
* Rule: Certain properties don't play well with certain display values.
|
7576 |
-
* - float should not be used with inline-block
|
7577 |
-
* - height, width, margin-top, margin-bottom, float should not be used with inline
|
7578 |
-
* - vertical-align should not be used with block
|
7579 |
-
* - margin, float should not be used with table-*
|
7580 |
-
*/
|
7581 |
-
|
7582 |
-
CSSLint.addRule({
|
7583 |
-
|
7584 |
-
//rule information
|
7585 |
-
id: "display-property-grouping",
|
7586 |
-
name: "Require properties appropriate for display",
|
7587 |
-
desc: "Certain properties shouldn't be used with certain display property values.",
|
7588 |
-
browsers: "All",
|
7589 |
-
|
7590 |
-
//initialization
|
7591 |
-
init: function(parser, reporter){
|
7592 |
-
var rule = this;
|
7593 |
-
|
7594 |
-
var propertiesToCheck = {
|
7595 |
-
display: 1,
|
7596 |
-
"float": "none",
|
7597 |
-
height: 1,
|
7598 |
-
width: 1,
|
7599 |
-
margin: 1,
|
7600 |
-
"margin-left": 1,
|
7601 |
-
"margin-right": 1,
|
7602 |
-
"margin-bottom": 1,
|
7603 |
-
"margin-top": 1,
|
7604 |
-
padding: 1,
|
7605 |
-
"padding-left": 1,
|
7606 |
-
"padding-right": 1,
|
7607 |
-
"padding-bottom": 1,
|
7608 |
-
"padding-top": 1,
|
7609 |
-
"vertical-align": 1
|
7610 |
-
},
|
7611 |
-
properties;
|
7612 |
-
|
7613 |
-
function reportProperty(name, display, msg){
|
7614 |
-
if (properties[name]){
|
7615 |
-
if (typeof propertiesToCheck[name] !== "string" || properties[name].value.toLowerCase() !== propertiesToCheck[name]){
|
7616 |
-
reporter.report(msg || name + " can't be used with display: " + display + ".", properties[name].line, properties[name].col, rule);
|
7617 |
-
}
|
7618 |
-
}
|
7619 |
-
}
|
7620 |
-
|
7621 |
-
function startRule(){
|
7622 |
-
properties = {};
|
7623 |
-
}
|
7624 |
-
|
7625 |
-
function endRule(){
|
7626 |
-
|
7627 |
-
var display = properties.display ? properties.display.value : null;
|
7628 |
-
if (display){
|
7629 |
-
switch(display){
|
7630 |
-
|
7631 |
-
case "inline":
|
7632 |
-
//height, width, margin-top, margin-bottom, float should not be used with inline
|
7633 |
-
reportProperty("height", display);
|
7634 |
-
reportProperty("width", display);
|
7635 |
-
reportProperty("margin", display);
|
7636 |
-
reportProperty("margin-top", display);
|
7637 |
-
reportProperty("margin-bottom", display);
|
7638 |
-
reportProperty("float", display, "display:inline has no effect on floated elements (but may be used to fix the IE6 double-margin bug).");
|
7639 |
-
break;
|
7640 |
-
|
7641 |
-
case "block":
|
7642 |
-
//vertical-align should not be used with block
|
7643 |
-
reportProperty("vertical-align", display);
|
7644 |
-
break;
|
7645 |
-
|
7646 |
-
case "inline-block":
|
7647 |
-
//float should not be used with inline-block
|
7648 |
-
reportProperty("float", display);
|
7649 |
-
break;
|
7650 |
-
|
7651 |
-
default:
|
7652 |
-
//margin, float should not be used with table
|
7653 |
-
if (display.indexOf("table-") === 0){
|
7654 |
-
reportProperty("margin", display);
|
7655 |
-
reportProperty("margin-left", display);
|
7656 |
-
reportProperty("margin-right", display);
|
7657 |
-
reportProperty("margin-top", display);
|
7658 |
-
reportProperty("margin-bottom", display);
|
7659 |
-
reportProperty("float", display);
|
7660 |
-
}
|
7661 |
-
|
7662 |
-
//otherwise do nothing
|
7663 |
-
}
|
7664 |
-
}
|
7665 |
-
|
7666 |
-
}
|
7667 |
-
|
7668 |
-
parser.addListener("startrule", startRule);
|
7669 |
-
parser.addListener("startfontface", startRule);
|
7670 |
-
parser.addListener("startkeyframerule", startRule);
|
7671 |
-
parser.addListener("startpagemargin", startRule);
|
7672 |
-
parser.addListener("startpage", startRule);
|
7673 |
-
|
7674 |
-
parser.addListener("property", function(event){
|
7675 |
-
var name = event.property.text.toLowerCase();
|
7676 |
-
|
7677 |
-
if (propertiesToCheck[name]){
|
7678 |
-
properties[name] = { value: event.value.text, line: event.property.line, col: event.property.col };
|
7679 |
-
}
|
7680 |
-
});
|
7681 |
-
|
7682 |
-
parser.addListener("endrule", endRule);
|
7683 |
-
parser.addListener("endfontface", endRule);
|
7684 |
-
parser.addListener("endkeyframerule", endRule);
|
7685 |
-
parser.addListener("endpagemargin", endRule);
|
7686 |
-
parser.addListener("endpage", endRule);
|
7687 |
-
|
7688 |
-
}
|
7689 |
-
|
7690 |
-
});
|
7691 |
-
|
7692 |
-
/*
|
7693 |
-
* Rule: Disallow duplicate background-images (using url).
|
7694 |
-
*/
|
7695 |
-
|
7696 |
-
CSSLint.addRule({
|
7697 |
-
|
7698 |
-
//rule information
|
7699 |
-
id: "duplicate-background-images",
|
7700 |
-
name: "Disallow duplicate background images",
|
7701 |
-
desc: "Every background-image should be unique. Use a common class for e.g. sprites.",
|
7702 |
-
browsers: "All",
|
7703 |
-
|
7704 |
-
//initialization
|
7705 |
-
init: function(parser, reporter){
|
7706 |
-
var rule = this,
|
7707 |
-
stack = {};
|
7708 |
-
|
7709 |
-
parser.addListener("property", function(event){
|
7710 |
-
var name = event.property.text,
|
7711 |
-
value = event.value,
|
7712 |
-
i, len;
|
7713 |
-
|
7714 |
-
if (name.match(/background/i)) {
|
7715 |
-
for (i=0, len=value.parts.length; i < len; i++) {
|
7716 |
-
if (value.parts[i].type === "uri") {
|
7717 |
-
if (typeof stack[value.parts[i].uri] === "undefined") {
|
7718 |
-
stack[value.parts[i].uri] = event;
|
7719 |
-
}
|
7720 |
-
else {
|
7721 |
-
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);
|
7722 |
-
}
|
7723 |
-
}
|
7724 |
-
}
|
7725 |
-
}
|
7726 |
-
});
|
7727 |
-
}
|
7728 |
-
});
|
7729 |
-
|
7730 |
-
/*
|
7731 |
-
* Rule: Duplicate properties must appear one after the other. If an already-defined
|
7732 |
-
* property appears somewhere else in the rule, then it's likely an error.
|
7733 |
-
*/
|
7734 |
-
|
7735 |
-
CSSLint.addRule({
|
7736 |
-
|
7737 |
-
//rule information
|
7738 |
-
id: "duplicate-properties",
|
7739 |
-
name: "Disallow duplicate properties",
|
7740 |
-
desc: "Duplicate properties must appear one after the other.",
|
7741 |
-
browsers: "All",
|
7742 |
-
|
7743 |
-
//initialization
|
7744 |
-
init: function(parser, reporter){
|
7745 |
-
var rule = this,
|
7746 |
-
properties,
|
7747 |
-
lastProperty;
|
7748 |
-
|
7749 |
-
function startRule(){
|
7750 |
-
properties = {};
|
7751 |
-
}
|
7752 |
-
|
7753 |
-
parser.addListener("startrule", startRule);
|
7754 |
-
parser.addListener("startfontface", startRule);
|
7755 |
-
parser.addListener("startpage", startRule);
|
7756 |
-
parser.addListener("startpagemargin", startRule);
|
7757 |
-
parser.addListener("startkeyframerule", startRule);
|
7758 |
-
|
7759 |
-
parser.addListener("property", function(event){
|
7760 |
-
var property = event.property,
|
7761 |
-
name = property.text.toLowerCase();
|
7762 |
-
|
7763 |
-
if (properties[name] && (lastProperty !== name || properties[name] === event.value.text)){
|
7764 |
-
reporter.report("Duplicate property '" + event.property + "' found.", event.line, event.col, rule);
|
7765 |
-
}
|
7766 |
-
|
7767 |
-
properties[name] = event.value.text;
|
7768 |
-
lastProperty = name;
|
7769 |
-
|
7770 |
-
});
|
7771 |
-
|
7772 |
-
|
7773 |
-
}
|
7774 |
-
|
7775 |
-
});
|
7776 |
-
|
7777 |
-
/*
|
7778 |
-
* Rule: Style rules without any properties defined should be removed.
|
7779 |
-
*/
|
7780 |
-
|
7781 |
-
CSSLint.addRule({
|
7782 |
-
|
7783 |
-
//rule information
|
7784 |
-
id: "empty-rules",
|
7785 |
-
name: "Disallow empty rules",
|
7786 |
-
desc: "Rules without any properties specified should be removed.",
|
7787 |
-
browsers: "All",
|
7788 |
-
|
7789 |
-
//initialization
|
7790 |
-
init: function(parser, reporter){
|
7791 |
-
var rule = this,
|
7792 |
-
count = 0;
|
7793 |
-
|
7794 |
-
parser.addListener("startrule", function(){
|
7795 |
-
count=0;
|
7796 |
-
});
|
7797 |
-
|
7798 |
-
parser.addListener("property", function(){
|
7799 |
-
count++;
|
7800 |
-
});
|
7801 |
-
|
7802 |
-
parser.addListener("endrule", function(event){
|
7803 |
-
var selectors = event.selectors;
|
7804 |
-
if (count === 0){
|
7805 |
-
reporter.report("Rule is empty.", selectors[0].line, selectors[0].col, rule);
|
7806 |
-
}
|
7807 |
-
});
|
7808 |
-
}
|
7809 |
-
|
7810 |
-
});
|
7811 |
-
|
7812 |
-
/*
|
7813 |
-
* Rule: There should be no syntax errors. (Duh.)
|
7814 |
-
*/
|
7815 |
-
|
7816 |
-
CSSLint.addRule({
|
7817 |
-
|
7818 |
-
//rule information
|
7819 |
-
id: "errors",
|
7820 |
-
name: "Parsing Errors",
|
7821 |
-
desc: "This rule looks for recoverable syntax errors.",
|
7822 |
-
browsers: "All",
|
7823 |
-
|
7824 |
-
//initialization
|
7825 |
-
init: function(parser, reporter){
|
7826 |
-
var rule = this;
|
7827 |
-
|
7828 |
-
parser.addListener("error", function(event){
|
7829 |
-
reporter.error(event.message, event.line, event.col, rule);
|
7830 |
-
});
|
7831 |
-
|
7832 |
-
}
|
7833 |
-
|
7834 |
-
});
|
7835 |
-
|
7836 |
-
CSSLint.addRule({
|
7837 |
-
|
7838 |
-
//rule information
|
7839 |
-
id: "fallback-colors",
|
7840 |
-
name: "Require fallback colors",
|
7841 |
-
desc: "For older browsers that don't support RGBA, HSL, or HSLA, provide a fallback color.",
|
7842 |
-
browsers: "IE6,IE7,IE8",
|
7843 |
-
|
7844 |
-
//initialization
|
7845 |
-
init: function(parser, reporter){
|
7846 |
-
var rule = this,
|
7847 |
-
lastProperty,
|
7848 |
-
propertiesToCheck = {
|
7849 |
-
color: 1,
|
7850 |
-
background: 1,
|
7851 |
-
"border-color": 1,
|
7852 |
-
"border-top-color": 1,
|
7853 |
-
"border-right-color": 1,
|
7854 |
-
"border-bottom-color": 1,
|
7855 |
-
"border-left-color": 1,
|
7856 |
-
border: 1,
|
7857 |
-
"border-top": 1,
|
7858 |
-
"border-right": 1,
|
7859 |
-
"border-bottom": 1,
|
7860 |
-
"border-left": 1,
|
7861 |
-
"background-color": 1
|
7862 |
-
},
|
7863 |
-
properties;
|
7864 |
-
|
7865 |
-
function startRule(){
|
7866 |
-
properties = {};
|
7867 |
-
lastProperty = null;
|
7868 |
-
}
|
7869 |
-
|
7870 |
-
parser.addListener("startrule", startRule);
|
7871 |
-
parser.addListener("startfontface", startRule);
|
7872 |
-
parser.addListener("startpage", startRule);
|
7873 |
-
parser.addListener("startpagemargin", startRule);
|
7874 |
-
parser.addListener("startkeyframerule", startRule);
|
7875 |
-
|
7876 |
-
parser.addListener("property", function(event){
|
7877 |
-
var property = event.property,
|
7878 |
-
name = property.text.toLowerCase(),
|
7879 |
-
parts = event.value.parts,
|
7880 |
-
i = 0,
|
7881 |
-
colorType = "",
|
7882 |
-
len = parts.length;
|
7883 |
-
|
7884 |
-
if(propertiesToCheck[name]){
|
7885 |
-
while(i < len){
|
7886 |
-
if (parts[i].type === "color"){
|
7887 |
-
if ("alpha" in parts[i] || "hue" in parts[i]){
|
7888 |
-
|
7889 |
-
if (/([^\)]+)\(/.test(parts[i])){
|
7890 |
-
colorType = RegExp.$1.toUpperCase();
|
7891 |
-
}
|
7892 |
-
|
7893 |
-
if (!lastProperty || (lastProperty.property.text.toLowerCase() !== name || lastProperty.colorType !== "compat")){
|
7894 |
-
reporter.report("Fallback " + name + " (hex or RGB) should precede " + colorType + " " + name + ".", event.line, event.col, rule);
|
7895 |
-
}
|
7896 |
-
} else {
|
7897 |
-
event.colorType = "compat";
|
7898 |
-
}
|
7899 |
-
}
|
7900 |
-
|
7901 |
-
i++;
|
7902 |
-
}
|
7903 |
-
}
|
7904 |
-
|
7905 |
-
lastProperty = event;
|
7906 |
-
});
|
7907 |
-
|
7908 |
-
}
|
7909 |
-
|
7910 |
-
});
|
7911 |
-
|
7912 |
-
/*
|
7913 |
-
* Rule: You shouldn't use more than 10 floats. If you do, there's probably
|
7914 |
-
* room for some abstraction.
|
7915 |
-
*/
|
7916 |
-
|
7917 |
-
CSSLint.addRule({
|
7918 |
-
|
7919 |
-
//rule information
|
7920 |
-
id: "floats",
|
7921 |
-
name: "Disallow too many floats",
|
7922 |
-
desc: "This rule tests if the float property is used too many times",
|
7923 |
-
browsers: "All",
|
7924 |
-
|
7925 |
-
//initialization
|
7926 |
-
init: function(parser, reporter){
|
7927 |
-
var rule = this;
|
7928 |
-
var count = 0;
|
7929 |
-
|
7930 |
-
//count how many times "float" is used
|
7931 |
-
parser.addListener("property", function(event){
|
7932 |
-
if (event.property.text.toLowerCase() === "float" &&
|
7933 |
-
event.value.text.toLowerCase() !== "none"){
|
7934 |
-
count++;
|
7935 |
-
}
|
7936 |
-
});
|
7937 |
-
|
7938 |
-
//report the results
|
7939 |
-
parser.addListener("endstylesheet", function(){
|
7940 |
-
reporter.stat("floats", count);
|
7941 |
-
if (count >= 10){
|
7942 |
-
reporter.rollupWarn("Too many floats (" + count + "), you're probably using them for layout. Consider using a grid system instead.", rule);
|
7943 |
-
}
|
7944 |
-
});
|
7945 |
-
}
|
7946 |
-
|
7947 |
-
});
|
7948 |
-
|
7949 |
-
/*
|
7950 |
-
* Rule: Avoid too many @font-face declarations in the same stylesheet.
|
7951 |
-
*/
|
7952 |
-
|
7953 |
-
CSSLint.addRule({
|
7954 |
-
|
7955 |
-
//rule information
|
7956 |
-
id: "font-faces",
|
7957 |
-
name: "Don't use too many web fonts",
|
7958 |
-
desc: "Too many different web fonts in the same stylesheet.",
|
7959 |
-
browsers: "All",
|
7960 |
-
|
7961 |
-
//initialization
|
7962 |
-
init: function(parser, reporter){
|
7963 |
-
var rule = this,
|
7964 |
-
count = 0;
|
7965 |
-
|
7966 |
-
|
7967 |
-
parser.addListener("startfontface", function(){
|
7968 |
-
count++;
|
7969 |
-
});
|
7970 |
-
|
7971 |
-
parser.addListener("endstylesheet", function(){
|
7972 |
-
if (count > 5){
|
7973 |
-
reporter.rollupWarn("Too many @font-face declarations (" + count + ").", rule);
|
7974 |
-
}
|
7975 |
-
});
|
7976 |
-
}
|
7977 |
-
|
7978 |
-
});
|
7979 |
-
|
7980 |
-
/*
|
7981 |
-
* Rule: You shouldn't need more than 9 font-size declarations.
|
7982 |
-
*/
|
7983 |
-
|
7984 |
-
CSSLint.addRule({
|
7985 |
-
|
7986 |
-
//rule information
|
7987 |
-
id: "font-sizes",
|
7988 |
-
name: "Disallow too many font sizes",
|
7989 |
-
desc: "Checks the number of font-size declarations.",
|
7990 |
-
browsers: "All",
|
7991 |
-
|
7992 |
-
//initialization
|
7993 |
-
init: function(parser, reporter){
|
7994 |
-
var rule = this,
|
7995 |
-
count = 0;
|
7996 |
-
|
7997 |
-
//check for use of "font-size"
|
7998 |
-
parser.addListener("property", function(event){
|
7999 |
-
if (event.property.toString() === "font-size"){
|
8000 |
-
count++;
|
8001 |
-
}
|
8002 |
-
});
|
8003 |
-
|
8004 |
-
//report the results
|
8005 |
-
parser.addListener("endstylesheet", function(){
|
8006 |
-
reporter.stat("font-sizes", count);
|
8007 |
-
if (count >= 10){
|
8008 |
-
reporter.rollupWarn("Too many font-size declarations (" + count + "), abstraction needed.", rule);
|
8009 |
-
}
|
8010 |
-
});
|
8011 |
-
}
|
8012 |
-
|
8013 |
-
});
|
8014 |
-
|
8015 |
-
/*
|
8016 |
-
* Rule: When using a vendor-prefixed gradient, make sure to use them all.
|
8017 |
-
*/
|
8018 |
-
|
8019 |
-
CSSLint.addRule({
|
8020 |
-
|
8021 |
-
//rule information
|
8022 |
-
id: "gradients",
|
8023 |
-
name: "Require all gradient definitions",
|
8024 |
-
desc: "When using a vendor-prefixed gradient, make sure to use them all.",
|
8025 |
-
browsers: "All",
|
8026 |
-
|
8027 |
-
//initialization
|
8028 |
-
init: function(parser, reporter){
|
8029 |
-
var rule = this,
|
8030 |
-
gradients;
|
8031 |
-
|
8032 |
-
parser.addListener("startrule", function(){
|
8033 |
-
gradients = {
|
8034 |
-
moz: 0,
|
8035 |
-
webkit: 0,
|
8036 |
-
oldWebkit: 0,
|
8037 |
-
o: 0
|
8038 |
-
};
|
8039 |
-
});
|
8040 |
-
|
8041 |
-
parser.addListener("property", function(event){
|
8042 |
-
|
8043 |
-
if (/\-(moz|o|webkit)(?:\-(?:linear|radial))\-gradient/i.test(event.value)){
|
8044 |
-
gradients[RegExp.$1] = 1;
|
8045 |
-
} else if (/\-webkit\-gradient/i.test(event.value)){
|
8046 |
-
gradients.oldWebkit = 1;
|
8047 |
-
}
|
8048 |
-
|
8049 |
-
});
|
8050 |
-
|
8051 |
-
parser.addListener("endrule", function(event){
|
8052 |
-
var missing = [];
|
8053 |
-
|
8054 |
-
if (!gradients.moz){
|
8055 |
-
missing.push("Firefox 3.6+");
|
8056 |
-
}
|
8057 |
-
|
8058 |
-
if (!gradients.webkit){
|
8059 |
-
missing.push("Webkit (Safari 5+, Chrome)");
|
8060 |
-
}
|
8061 |
-
|
8062 |
-
if (!gradients.oldWebkit){
|
8063 |
-
missing.push("Old Webkit (Safari 4+, Chrome)");
|
8064 |
-
}
|
8065 |
-
|
8066 |
-
if (!gradients.o){
|
8067 |
-
missing.push("Opera 11.1+");
|
8068 |
-
}
|
8069 |
-
|
8070 |
-
if (missing.length && missing.length < 4){
|
8071 |
-
reporter.report("Missing vendor-prefixed CSS gradients for " + missing.join(", ") + ".", event.selectors[0].line, event.selectors[0].col, rule);
|
8072 |
-
}
|
8073 |
-
|
8074 |
-
});
|
8075 |
-
|
8076 |
-
}
|
8077 |
-
|
8078 |
-
});
|
8079 |
-
|
8080 |
-
/*
|
8081 |
-
* Rule: Don't use IDs for selectors.
|
8082 |
-
*/
|
8083 |
-
|
8084 |
-
CSSLint.addRule({
|
8085 |
-
|
8086 |
-
//rule information
|
8087 |
-
id: "ids",
|
8088 |
-
name: "Disallow IDs in selectors",
|
8089 |
-
desc: "Selectors should not contain IDs.",
|
8090 |
-
browsers: "All",
|
8091 |
-
|
8092 |
-
//initialization
|
8093 |
-
init: function(parser, reporter){
|
8094 |
-
var rule = this;
|
8095 |
-
parser.addListener("startrule", function(event){
|
8096 |
-
var selectors = event.selectors,
|
8097 |
-
selector,
|
8098 |
-
part,
|
8099 |
-
modifier,
|
8100 |
-
idCount,
|
8101 |
-
i, j, k;
|
8102 |
-
|
8103 |
-
for (i=0; i < selectors.length; i++){
|
8104 |
-
selector = selectors[i];
|
8105 |
-
idCount = 0;
|
8106 |
-
|
8107 |
-
for (j=0; j < selector.parts.length; j++){
|
8108 |
-
part = selector.parts[j];
|
8109 |
-
if (part.type === parser.SELECTOR_PART_TYPE){
|
8110 |
-
for (k=0; k < part.modifiers.length; k++){
|
8111 |
-
modifier = part.modifiers[k];
|
8112 |
-
if (modifier.type === "id"){
|
8113 |
-
idCount++;
|
8114 |
-
}
|
8115 |
-
}
|
8116 |
-
}
|
8117 |
-
}
|
8118 |
-
|
8119 |
-
if (idCount === 1){
|
8120 |
-
reporter.report("Don't use IDs in selectors.", selector.line, selector.col, rule);
|
8121 |
-
} else if (idCount > 1){
|
8122 |
-
reporter.report(idCount + " IDs in the selector, really?", selector.line, selector.col, rule);
|
8123 |
-
}
|
8124 |
-
}
|
8125 |
-
|
8126 |
-
});
|
8127 |
-
}
|
8128 |
-
|
8129 |
-
});
|
8130 |
-
|
8131 |
-
/*
|
8132 |
-
* Rule: Don't use @import, use <link> instead.
|
8133 |
-
*/
|
8134 |
-
|
8135 |
-
CSSLint.addRule({
|
8136 |
-
|
8137 |
-
//rule information
|
8138 |
-
id: "import",
|
8139 |
-
name: "Disallow @import",
|
8140 |
-
desc: "Don't use @import, use <link> instead.",
|
8141 |
-
browsers: "All",
|
8142 |
-
|
8143 |
-
//initialization
|
8144 |
-
init: function(parser, reporter){
|
8145 |
-
var rule = this;
|
8146 |
-
|
8147 |
-
parser.addListener("import", function(event){
|
8148 |
-
reporter.report("@import prevents parallel downloads, use <link> instead.", event.line, event.col, rule);
|
8149 |
-
});
|
8150 |
-
|
8151 |
-
}
|
8152 |
-
|
8153 |
-
});
|
8154 |
-
|
8155 |
-
/*
|
8156 |
-
* Rule: Make sure !important is not overused, this could lead to specificity
|
8157 |
-
* war. Display a warning on !important declarations, an error if it's
|
8158 |
-
* used more at least 10 times.
|
8159 |
-
*/
|
8160 |
-
|
8161 |
-
CSSLint.addRule({
|
8162 |
-
|
8163 |
-
//rule information
|
8164 |
-
id: "important",
|
8165 |
-
name: "Disallow !important",
|
8166 |
-
desc: "Be careful when using !important declaration",
|
8167 |
-
browsers: "All",
|
8168 |
-
|
8169 |
-
//initialization
|
8170 |
-
init: function(parser, reporter){
|
8171 |
-
var rule = this,
|
8172 |
-
count = 0;
|
8173 |
-
|
8174 |
-
//warn that important is used and increment the declaration counter
|
8175 |
-
parser.addListener("property", function(event){
|
8176 |
-
if (event.important === true){
|
8177 |
-
count++;
|
8178 |
-
reporter.report("Use of !important", event.line, event.col, rule);
|
8179 |
-
}
|
8180 |
-
});
|
8181 |
-
|
8182 |
-
//if there are more than 10, show an error
|
8183 |
-
parser.addListener("endstylesheet", function(){
|
8184 |
-
reporter.stat("important", count);
|
8185 |
-
if (count >= 10){
|
8186 |
-
reporter.rollupWarn("Too many !important declarations (" + count + "), try to use less than 10 to avoid specificity issues.", rule);
|
8187 |
-
}
|
8188 |
-
});
|
8189 |
-
}
|
8190 |
-
|
8191 |
-
});
|
8192 |
-
|
8193 |
-
/*
|
8194 |
-
* Rule: Properties should be known (listed in CSS3 specification) or
|
8195 |
-
* be a vendor-prefixed property.
|
8196 |
-
*/
|
8197 |
-
|
8198 |
-
CSSLint.addRule({
|
8199 |
-
|
8200 |
-
//rule information
|
8201 |
-
id: "known-properties",
|
8202 |
-
name: "Require use of known properties",
|
8203 |
-
desc: "Properties should be known (listed in CSS3 specification) or be a vendor-prefixed property.",
|
8204 |
-
browsers: "All",
|
8205 |
-
|
8206 |
-
//initialization
|
8207 |
-
init: function(parser, reporter){
|
8208 |
-
var rule = this;
|
8209 |
-
|
8210 |
-
parser.addListener("property", function(event){
|
8211 |
-
|
8212 |
-
// the check is handled entirely by the parser-lib (https://github.com/nzakas/parser-lib)
|
8213 |
-
if (event.invalid) {
|
8214 |
-
reporter.report(event.invalid.message, event.line, event.col, rule);
|
8215 |
-
}
|
8216 |
-
|
8217 |
-
});
|
8218 |
-
}
|
8219 |
-
|
8220 |
-
});
|
8221 |
-
|
8222 |
-
/*
|
8223 |
-
* Rule: All properties should be in alphabetical order..
|
8224 |
-
*/
|
8225 |
-
/*global CSSLint*/
|
8226 |
-
CSSLint.addRule({
|
8227 |
-
|
8228 |
-
//rule information
|
8229 |
-
id: "order-alphabetical",
|
8230 |
-
name: "Alphabetical order",
|
8231 |
-
desc: "Assure properties are in alphabetical order",
|
8232 |
-
browsers: "All",
|
8233 |
-
|
8234 |
-
//initialization
|
8235 |
-
init: function(parser, reporter){
|
8236 |
-
var rule = this,
|
8237 |
-
properties;
|
8238 |
-
|
8239 |
-
var startRule = function () {
|
8240 |
-
properties = [];
|
8241 |
-
};
|
8242 |
-
|
8243 |
-
parser.addListener("startrule", startRule);
|
8244 |
-
parser.addListener("startfontface", startRule);
|
8245 |
-
parser.addListener("startpage", startRule);
|
8246 |
-
parser.addListener("startpagemargin", startRule);
|
8247 |
-
parser.addListener("startkeyframerule", startRule);
|
8248 |
-
|
8249 |
-
parser.addListener("property", function(event){
|
8250 |
-
var name = event.property.text,
|
8251 |
-
lowerCasePrefixLessName = name.toLowerCase().replace(/^-.*?-/, "");
|
8252 |
-
|
8253 |
-
properties.push(lowerCasePrefixLessName);
|
8254 |
-
});
|
8255 |
-
|
8256 |
-
parser.addListener("endrule", function(event){
|
8257 |
-
var currentProperties = properties.join(","),
|
8258 |
-
expectedProperties = properties.sort().join(",");
|
8259 |
-
|
8260 |
-
if (currentProperties !== expectedProperties){
|
8261 |
-
reporter.report("Rule doesn't have all its properties in alphabetical ordered.", event.line, event.col, rule);
|
8262 |
-
}
|
8263 |
-
});
|
8264 |
-
}
|
8265 |
-
|
8266 |
-
});
|
8267 |
-
|
8268 |
-
/*
|
8269 |
-
* Rule: outline: none or outline: 0 should only be used in a :focus rule
|
8270 |
-
* and only if there are other properties in the same rule.
|
8271 |
-
*/
|
8272 |
-
|
8273 |
-
CSSLint.addRule({
|
8274 |
-
|
8275 |
-
//rule information
|
8276 |
-
id: "outline-none",
|
8277 |
-
name: "Disallow outline: none",
|
8278 |
-
desc: "Use of outline: none or outline: 0 should be limited to :focus rules.",
|
8279 |
-
browsers: "All",
|
8280 |
-
tags: ["Accessibility"],
|
8281 |
-
|
8282 |
-
//initialization
|
8283 |
-
init: function(parser, reporter){
|
8284 |
-
var rule = this,
|
8285 |
-
lastRule;
|
8286 |
-
|
8287 |
-
function startRule(event){
|
8288 |
-
if (event.selectors){
|
8289 |
-
lastRule = {
|
8290 |
-
line: event.line,
|
8291 |
-
col: event.col,
|
8292 |
-
selectors: event.selectors,
|
8293 |
-
propCount: 0,
|
8294 |
-
outline: false
|
8295 |
-
};
|
8296 |
-
} else {
|
8297 |
-
lastRule = null;
|
8298 |
-
}
|
8299 |
-
}
|
8300 |
-
|
8301 |
-
function endRule(){
|
8302 |
-
if (lastRule){
|
8303 |
-
if (lastRule.outline){
|
8304 |
-
if (lastRule.selectors.toString().toLowerCase().indexOf(":focus") === -1){
|
8305 |
-
reporter.report("Outlines should only be modified using :focus.", lastRule.line, lastRule.col, rule);
|
8306 |
-
} else if (lastRule.propCount === 1) {
|
8307 |
-
reporter.report("Outlines shouldn't be hidden unless other visual changes are made.", lastRule.line, lastRule.col, rule);
|
8308 |
-
}
|
8309 |
-
}
|
8310 |
-
}
|
8311 |
-
}
|
8312 |
-
|
8313 |
-
parser.addListener("startrule", startRule);
|
8314 |
-
parser.addListener("startfontface", startRule);
|
8315 |
-
parser.addListener("startpage", startRule);
|
8316 |
-
parser.addListener("startpagemargin", startRule);
|
8317 |
-
parser.addListener("startkeyframerule", startRule);
|
8318 |
-
|
8319 |
-
parser.addListener("property", function(event){
|
8320 |
-
var name = event.property.text.toLowerCase(),
|
8321 |
-
value = event.value;
|
8322 |
-
|
8323 |
-
if (lastRule){
|
8324 |
-
lastRule.propCount++;
|
8325 |
-
if (name === "outline" && (value.toString() === "none" || value.toString() === "0")){
|
8326 |
-
lastRule.outline = true;
|
8327 |
-
}
|
8328 |
-
}
|
8329 |
-
|
8330 |
-
});
|
8331 |
-
|
8332 |
-
parser.addListener("endrule", endRule);
|
8333 |
-
parser.addListener("endfontface", endRule);
|
8334 |
-
parser.addListener("endpage", endRule);
|
8335 |
-
parser.addListener("endpagemargin", endRule);
|
8336 |
-
parser.addListener("endkeyframerule", endRule);
|
8337 |
-
|
8338 |
-
}
|
8339 |
-
|
8340 |
-
});
|
8341 |
-
|
8342 |
-
/*
|
8343 |
-
* Rule: Don't use classes or IDs with elements (a.foo or a#foo).
|
8344 |
-
*/
|
8345 |
-
|
8346 |
-
CSSLint.addRule({
|
8347 |
-
|
8348 |
-
//rule information
|
8349 |
-
id: "overqualified-elements",
|
8350 |
-
name: "Disallow overqualified elements",
|
8351 |
-
desc: "Don't use classes or IDs with elements (a.foo or a#foo).",
|
8352 |
-
browsers: "All",
|
8353 |
-
|
8354 |
-
//initialization
|
8355 |
-
init: function(parser, reporter){
|
8356 |
-
var rule = this,
|
8357 |
-
classes = {};
|
8358 |
-
|
8359 |
-
parser.addListener("startrule", function(event){
|
8360 |
-
var selectors = event.selectors,
|
8361 |
-
selector,
|
8362 |
-
part,
|
8363 |
-
modifier,
|
8364 |
-
i, j, k;
|
8365 |
-
|
8366 |
-
for (i=0; i < selectors.length; i++){
|
8367 |
-
selector = selectors[i];
|
8368 |
-
|
8369 |
-
for (j=0; j < selector.parts.length; j++){
|
8370 |
-
part = selector.parts[j];
|
8371 |
-
if (part.type === parser.SELECTOR_PART_TYPE){
|
8372 |
-
for (k=0; k < part.modifiers.length; k++){
|
8373 |
-
modifier = part.modifiers[k];
|
8374 |
-
if (part.elementName && modifier.type === "id"){
|
8375 |
-
reporter.report("Element (" + part + ") is overqualified, just use " + modifier + " without element name.", part.line, part.col, rule);
|
8376 |
-
} else if (modifier.type === "class"){
|
8377 |
-
|
8378 |
-
if (!classes[modifier]){
|
8379 |
-
classes[modifier] = [];
|
8380 |
-
}
|
8381 |
-
classes[modifier].push({ modifier: modifier, part: part });
|
8382 |
-
}
|
8383 |
-
}
|
8384 |
-
}
|
8385 |
-
}
|
8386 |
-
}
|
8387 |
-
});
|
8388 |
-
|
8389 |
-
parser.addListener("endstylesheet", function(){
|
8390 |
-
|
8391 |
-
var prop;
|
8392 |
-
for (prop in classes){
|
8393 |
-
if (classes.hasOwnProperty(prop)){
|
8394 |
-
|
8395 |
-
//one use means that this is overqualified
|
8396 |
-
if (classes[prop].length === 1 && classes[prop][0].part.elementName){
|
8397 |
-
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);
|
8398 |
-
}
|
8399 |
-
}
|
8400 |
-
}
|
8401 |
-
});
|
8402 |
-
}
|
8403 |
-
|
8404 |
-
});
|
8405 |
-
|
8406 |
-
/*
|
8407 |
-
* Rule: Headings (h1-h6) should not be qualified (namespaced).
|
8408 |
-
*/
|
8409 |
-
|
8410 |
-
CSSLint.addRule({
|
8411 |
-
|
8412 |
-
//rule information
|
8413 |
-
id: "qualified-headings",
|
8414 |
-
name: "Disallow qualified headings",
|
8415 |
-
desc: "Headings should not be qualified (namespaced).",
|
8416 |
-
browsers: "All",
|
8417 |
-
|
8418 |
-
//initialization
|
8419 |
-
init: function(parser, reporter){
|
8420 |
-
var rule = this;
|
8421 |
-
|
8422 |
-
parser.addListener("startrule", function(event){
|
8423 |
-
var selectors = event.selectors,
|
8424 |
-
selector,
|
8425 |
-
part,
|
8426 |
-
i, j;
|
8427 |
-
|
8428 |
-
for (i=0; i < selectors.length; i++){
|
8429 |
-
selector = selectors[i];
|
8430 |
-
|
8431 |
-
for (j=0; j < selector.parts.length; j++){
|
8432 |
-
part = selector.parts[j];
|
8433 |
-
if (part.type === parser.SELECTOR_PART_TYPE){
|
8434 |
-
if (part.elementName && /h[1-6]/.test(part.elementName.toString()) && j > 0){
|
8435 |
-
reporter.report("Heading (" + part.elementName + ") should not be qualified.", part.line, part.col, rule);
|
8436 |
-
}
|
8437 |
-
}
|
8438 |
-
}
|
8439 |
-
}
|
8440 |
-
});
|
8441 |
-
}
|
8442 |
-
|
8443 |
-
});
|
8444 |
-
|
8445 |
-
/*
|
8446 |
-
* Rule: Selectors that look like regular expressions are slow and should be avoided.
|
8447 |
-
*/
|
8448 |
-
|
8449 |
-
CSSLint.addRule({
|
8450 |
-
|
8451 |
-
//rule information
|
8452 |
-
id: "regex-selectors",
|
8453 |
-
name: "Disallow selectors that look like regexs",
|
8454 |
-
desc: "Selectors that look like regular expressions are slow and should be avoided.",
|
8455 |
-
browsers: "All",
|
8456 |
-
|
8457 |
-
//initialization
|
8458 |
-
init: function(parser, reporter){
|
8459 |
-
var rule = this;
|
8460 |
-
|
8461 |
-
parser.addListener("startrule", function(event){
|
8462 |
-
var selectors = event.selectors,
|
8463 |
-
selector,
|
8464 |
-
part,
|
8465 |
-
modifier,
|
8466 |
-
i, j, k;
|
8467 |
-
|
8468 |
-
for (i=0; i < selectors.length; i++){
|
8469 |
-
selector = selectors[i];
|
8470 |
-
for (j=0; j < selector.parts.length; j++){
|
8471 |
-
part = selector.parts[j];
|
8472 |
-
if (part.type === parser.SELECTOR_PART_TYPE){
|
8473 |
-
for (k=0; k < part.modifiers.length; k++){
|
8474 |
-
modifier = part.modifiers[k];
|
8475 |
-
if (modifier.type === "attribute"){
|
8476 |
-
if (/([\~\|\^\$\*]=)/.test(modifier)){
|
8477 |
-
reporter.report("Attribute selectors with " + RegExp.$1 + " are slow!", modifier.line, modifier.col, rule);
|
8478 |
-
}
|
8479 |
-
}
|
8480 |
-
|
8481 |
-
}
|
8482 |
-
}
|
8483 |
-
}
|
8484 |
-
}
|
8485 |
-
});
|
8486 |
-
}
|
8487 |
-
|
8488 |
-
});
|
8489 |
-
|
8490 |
-
/*
|
8491 |
-
* Rule: Total number of rules should not exceed x.
|
8492 |
-
*/
|
8493 |
-
|
8494 |
-
CSSLint.addRule({
|
8495 |
-
|
8496 |
-
//rule information
|
8497 |
-
id: "rules-count",
|
8498 |
-
name: "Rules Count",
|
8499 |
-
desc: "Track how many rules there are.",
|
8500 |
-
browsers: "All",
|
8501 |
-
|
8502 |
-
//initialization
|
8503 |
-
init: function(parser, reporter){
|
8504 |
-
var count = 0;
|
8505 |
-
|
8506 |
-
//count each rule
|
8507 |
-
parser.addListener("startrule", function(){
|
8508 |
-
count++;
|
8509 |
-
});
|
8510 |
-
|
8511 |
-
parser.addListener("endstylesheet", function(){
|
8512 |
-
reporter.stat("rule-count", count);
|
8513 |
-
});
|
8514 |
-
}
|
8515 |
-
|
8516 |
-
});
|
8517 |
-
|
8518 |
-
/*
|
8519 |
-
* Rule: Warn people with approaching the IE 4095 limit
|
8520 |
-
*/
|
8521 |
-
|
8522 |
-
CSSLint.addRule({
|
8523 |
-
|
8524 |
-
//rule information
|
8525 |
-
id: "selector-max-approaching",
|
8526 |
-
name: "Warn when approaching the 4095 selector limit for IE",
|
8527 |
-
desc: "Will warn when selector count is >= 3800 selectors.",
|
8528 |
-
browsers: "IE",
|
8529 |
-
|
8530 |
-
//initialization
|
8531 |
-
init: function(parser, reporter) {
|
8532 |
-
var rule = this, count = 0;
|
8533 |
-
|
8534 |
-
parser.addListener("startrule", function(event) {
|
8535 |
-
count += event.selectors.length;
|
8536 |
-
});
|
8537 |
-
|
8538 |
-
parser.addListener("endstylesheet", function() {
|
8539 |
-
if (count >= 3800) {
|
8540 |
-
reporter.report("You have " + count + " selectors. Internet Explorer supports a maximum of 4095 selectors per stylesheet. Consider refactoring.",0,0,rule);
|
8541 |
-
}
|
8542 |
-
});
|
8543 |
-
}
|
8544 |
-
|
8545 |
-
});
|
8546 |
-
|
8547 |
-
/*
|
8548 |
-
* Rule: Warn people past the IE 4095 limit
|
8549 |
-
*/
|
8550 |
-
|
8551 |
-
CSSLint.addRule({
|
8552 |
-
|
8553 |
-
//rule information
|
8554 |
-
id: "selector-max",
|
8555 |
-
name: "Error when past the 4095 selector limit for IE",
|
8556 |
-
desc: "Will error when selector count is > 4095.",
|
8557 |
-
browsers: "IE",
|
8558 |
-
|
8559 |
-
//initialization
|
8560 |
-
init: function(parser, reporter){
|
8561 |
-
var rule = this, count = 0;
|
8562 |
-
|
8563 |
-
parser.addListener("startrule", function(event) {
|
8564 |
-
count += event.selectors.length;
|
8565 |
-
});
|
8566 |
-
|
8567 |
-
parser.addListener("endstylesheet", function() {
|
8568 |
-
if (count > 4095) {
|
8569 |
-
reporter.report("You have " + count + " selectors. Internet Explorer supports a maximum of 4095 selectors per stylesheet. Consider refactoring.",0,0,rule);
|
8570 |
-
}
|
8571 |
-
});
|
8572 |
-
}
|
8573 |
-
|
8574 |
-
});
|
8575 |
-
|
8576 |
-
/*
|
8577 |
-
* Rule: Avoid new-line characters in selectors.
|
8578 |
-
*/
|
8579 |
-
|
8580 |
-
CSSLint.addRule({
|
8581 |
-
|
8582 |
-
//rule information
|
8583 |
-
id: "selector-newline",
|
8584 |
-
name: "Disallow new-line characters in selectors",
|
8585 |
-
desc: "New-line characters in selectors are usually a forgotten comma and not a descendant combinator.",
|
8586 |
-
browsers: "All",
|
8587 |
-
|
8588 |
-
//initialization
|
8589 |
-
init: function(parser, reporter) {
|
8590 |
-
var rule = this;
|
8591 |
-
|
8592 |
-
function startRule(event) {
|
8593 |
-
var i, len, selector, p, n, pLen, part, part2, type, currentLine, nextLine,
|
8594 |
-
selectors = event.selectors;
|
8595 |
-
|
8596 |
-
for (i = 0, len = selectors.length; i < len; i++) {
|
8597 |
-
selector = selectors[i];
|
8598 |
-
for (p = 0, pLen = selector.parts.length; p < pLen; p++) {
|
8599 |
-
for (n = p + 1; n < pLen; n++) {
|
8600 |
-
part = selector.parts[p];
|
8601 |
-
part2 = selector.parts[n];
|
8602 |
-
type = part.type;
|
8603 |
-
currentLine = part.line;
|
8604 |
-
nextLine = part2.line;
|
8605 |
-
|
8606 |
-
if (type === "descendant" && nextLine > currentLine) {
|
8607 |
-
reporter.report("newline character found in selector (forgot a comma?)", currentLine, selectors[i].parts[0].col, rule);
|
8608 |
-
}
|
8609 |
-
}
|
8610 |
-
}
|
8611 |
-
|
8612 |
-
}
|
8613 |
-
}
|
8614 |
-
|
8615 |
-
parser.addListener("startrule", startRule);
|
8616 |
-
|
8617 |
-
}
|
8618 |
-
});
|
8619 |
-
|
8620 |
-
/*
|
8621 |
-
* Rule: Use shorthand properties where possible.
|
8622 |
-
*
|
8623 |
-
*/
|
8624 |
-
|
8625 |
-
CSSLint.addRule({
|
8626 |
-
|
8627 |
-
//rule information
|
8628 |
-
id: "shorthand",
|
8629 |
-
name: "Require shorthand properties",
|
8630 |
-
desc: "Use shorthand properties where possible.",
|
8631 |
-
browsers: "All",
|
8632 |
-
|
8633 |
-
//initialization
|
8634 |
-
init: function(parser, reporter){
|
8635 |
-
var rule = this,
|
8636 |
-
prop, i, len,
|
8637 |
-
propertiesToCheck = {},
|
8638 |
-
properties,
|
8639 |
-
mapping = {
|
8640 |
-
"margin": [
|
8641 |
-
"margin-top",
|
8642 |
-
"margin-bottom",
|
8643 |
-
"margin-left",
|
8644 |
-
"margin-right"
|
8645 |
-
],
|
8646 |
-
"padding": [
|
8647 |
-
"padding-top",
|
8648 |
-
"padding-bottom",
|
8649 |
-
"padding-left",
|
8650 |
-
"padding-right"
|
8651 |
-
]
|
8652 |
-
};
|
8653 |
-
|
8654 |
-
//initialize propertiesToCheck
|
8655 |
-
for (prop in mapping){
|
8656 |
-
if (mapping.hasOwnProperty(prop)){
|
8657 |
-
for (i=0, len=mapping[prop].length; i < len; i++){
|
8658 |
-
propertiesToCheck[mapping[prop][i]] = prop;
|
8659 |
-
}
|
8660 |
-
}
|
8661 |
-
}
|
8662 |
-
|
8663 |
-
function startRule(){
|
8664 |
-
properties = {};
|
8665 |
-
}
|
8666 |
-
|
8667 |
-
//event handler for end of rules
|
8668 |
-
function endRule(event){
|
8669 |
-
|
8670 |
-
var prop, i, len, total;
|
8671 |
-
|
8672 |
-
//check which properties this rule has
|
8673 |
-
for (prop in mapping){
|
8674 |
-
if (mapping.hasOwnProperty(prop)){
|
8675 |
-
total=0;
|
8676 |
-
|
8677 |
-
for (i=0, len=mapping[prop].length; i < len; i++){
|
8678 |
-
total += properties[mapping[prop][i]] ? 1 : 0;
|
8679 |
-
}
|
8680 |
-
|
8681 |
-
if (total === mapping[prop].length){
|
8682 |
-
reporter.report("The properties " + mapping[prop].join(", ") + " can be replaced by " + prop + ".", event.line, event.col, rule);
|
8683 |
-
}
|
8684 |
-
}
|
8685 |
-
}
|
8686 |
-
}
|
8687 |
-
|
8688 |
-
parser.addListener("startrule", startRule);
|
8689 |
-
parser.addListener("startfontface", startRule);
|
8690 |
-
|
8691 |
-
//check for use of "font-size"
|
8692 |
-
parser.addListener("property", function(event){
|
8693 |
-
var name = event.property.toString().toLowerCase();
|
8694 |
-
|
8695 |
-
if (propertiesToCheck[name]){
|
8696 |
-
properties[name] = 1;
|
8697 |
-
}
|
8698 |
-
});
|
8699 |
-
|
8700 |
-
parser.addListener("endrule", endRule);
|
8701 |
-
parser.addListener("endfontface", endRule);
|
8702 |
-
|
8703 |
-
}
|
8704 |
-
|
8705 |
-
});
|
8706 |
-
|
8707 |
-
/*
|
8708 |
-
* Rule: Don't use properties with a star prefix.
|
8709 |
-
*
|
8710 |
-
*/
|
8711 |
-
|
8712 |
-
CSSLint.addRule({
|
8713 |
-
|
8714 |
-
//rule information
|
8715 |
-
id: "star-property-hack",
|
8716 |
-
name: "Disallow properties with a star prefix",
|
8717 |
-
desc: "Checks for the star property hack (targets IE6/7)",
|
8718 |
-
browsers: "All",
|
8719 |
-
|
8720 |
-
//initialization
|
8721 |
-
init: function(parser, reporter){
|
8722 |
-
var rule = this;
|
8723 |
-
|
8724 |
-
//check if property name starts with "*"
|
8725 |
-
parser.addListener("property", function(event){
|
8726 |
-
var property = event.property;
|
8727 |
-
|
8728 |
-
if (property.hack === "*") {
|
8729 |
-
reporter.report("Property with star prefix found.", event.property.line, event.property.col, rule);
|
8730 |
-
}
|
8731 |
-
});
|
8732 |
-
}
|
8733 |
-
});
|
8734 |
-
|
8735 |
-
/*
|
8736 |
-
* Rule: Don't use text-indent for image replacement if you need to support rtl.
|
8737 |
-
*
|
8738 |
-
*/
|
8739 |
-
|
8740 |
-
CSSLint.addRule({
|
8741 |
-
|
8742 |
-
//rule information
|
8743 |
-
id: "text-indent",
|
8744 |
-
name: "Disallow negative text-indent",
|
8745 |
-
desc: "Checks for text indent less than -99px",
|
8746 |
-
browsers: "All",
|
8747 |
-
|
8748 |
-
//initialization
|
8749 |
-
init: function(parser, reporter){
|
8750 |
-
var rule = this,
|
8751 |
-
textIndent,
|
8752 |
-
direction;
|
8753 |
-
|
8754 |
-
|
8755 |
-
function startRule(){
|
8756 |
-
textIndent = false;
|
8757 |
-
direction = "inherit";
|
8758 |
-
}
|
8759 |
-
|
8760 |
-
//event handler for end of rules
|
8761 |
-
function endRule(){
|
8762 |
-
if (textIndent && direction !== "ltr"){
|
8763 |
-
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);
|
8764 |
-
}
|
8765 |
-
}
|
8766 |
-
|
8767 |
-
parser.addListener("startrule", startRule);
|
8768 |
-
parser.addListener("startfontface", startRule);
|
8769 |
-
|
8770 |
-
//check for use of "font-size"
|
8771 |
-
parser.addListener("property", function(event){
|
8772 |
-
var name = event.property.toString().toLowerCase(),
|
8773 |
-
value = event.value;
|
8774 |
-
|
8775 |
-
if (name === "text-indent" && value.parts[0].value < -99){
|
8776 |
-
textIndent = event.property;
|
8777 |
-
} else if (name === "direction" && value.toString() === "ltr"){
|
8778 |
-
direction = "ltr";
|
8779 |
-
}
|
8780 |
-
});
|
8781 |
-
|
8782 |
-
parser.addListener("endrule", endRule);
|
8783 |
-
parser.addListener("endfontface", endRule);
|
8784 |
-
|
8785 |
-
}
|
8786 |
-
|
8787 |
-
});
|
8788 |
-
|
8789 |
-
/*
|
8790 |
-
* Rule: Don't use properties with a underscore prefix.
|
8791 |
-
*
|
8792 |
-
*/
|
8793 |
-
|
8794 |
-
CSSLint.addRule({
|
8795 |
-
|
8796 |
-
//rule information
|
8797 |
-
id: "underscore-property-hack",
|
8798 |
-
name: "Disallow properties with an underscore prefix",
|
8799 |
-
desc: "Checks for the underscore property hack (targets IE6)",
|
8800 |
-
browsers: "All",
|
8801 |
-
|
8802 |
-
//initialization
|
8803 |
-
init: function(parser, reporter){
|
8804 |
-
var rule = this;
|
8805 |
-
|
8806 |
-
//check if property name starts with "_"
|
8807 |
-
parser.addListener("property", function(event){
|
8808 |
-
var property = event.property;
|
8809 |
-
|
8810 |
-
if (property.hack === "_") {
|
8811 |
-
reporter.report("Property with underscore prefix found.", event.property.line, event.property.col, rule);
|
8812 |
-
}
|
8813 |
-
});
|
8814 |
-
}
|
8815 |
-
});
|
8816 |
-
|
8817 |
-
/*
|
8818 |
-
* Rule: Headings (h1-h6) should be defined only once.
|
8819 |
-
*/
|
8820 |
-
|
8821 |
-
CSSLint.addRule({
|
8822 |
-
|
8823 |
-
//rule information
|
8824 |
-
id: "unique-headings",
|
8825 |
-
name: "Headings should only be defined once",
|
8826 |
-
desc: "Headings should be defined only once.",
|
8827 |
-
browsers: "All",
|
8828 |
-
|
8829 |
-
//initialization
|
8830 |
-
init: function(parser, reporter){
|
8831 |
-
var rule = this;
|
8832 |
-
|
8833 |
-
var headings = {
|
8834 |
-
h1: 0,
|
8835 |
-
h2: 0,
|
8836 |
-
h3: 0,
|
8837 |
-
h4: 0,
|
8838 |
-
h5: 0,
|
8839 |
-
h6: 0
|
8840 |
-
};
|
8841 |
-
|
8842 |
-
parser.addListener("startrule", function(event){
|
8843 |
-
var selectors = event.selectors,
|
8844 |
-
selector,
|
8845 |
-
part,
|
8846 |
-
pseudo,
|
8847 |
-
i, j;
|
8848 |
-
|
8849 |
-
for (i=0; i < selectors.length; i++){
|
8850 |
-
selector = selectors[i];
|
8851 |
-
part = selector.parts[selector.parts.length-1];
|
8852 |
-
|
8853 |
-
if (part.elementName && /(h[1-6])/i.test(part.elementName.toString())){
|
8854 |
-
|
8855 |
-
for (j=0; j < part.modifiers.length; j++){
|
8856 |
-
if (part.modifiers[j].type === "pseudo"){
|
8857 |
-
pseudo = true;
|
8858 |
-
break;
|
8859 |
-
}
|
8860 |
-
}
|
8861 |
-
|
8862 |
-
if (!pseudo){
|
8863 |
-
headings[RegExp.$1]++;
|
8864 |
-
if (headings[RegExp.$1] > 1) {
|
8865 |
-
reporter.report("Heading (" + part.elementName + ") has already been defined.", part.line, part.col, rule);
|
8866 |
-
}
|
8867 |
-
}
|
8868 |
-
}
|
8869 |
-
}
|
8870 |
-
});
|
8871 |
-
|
8872 |
-
parser.addListener("endstylesheet", function(){
|
8873 |
-
var prop,
|
8874 |
-
messages = [];
|
8875 |
-
|
8876 |
-
for (prop in headings){
|
8877 |
-
if (headings.hasOwnProperty(prop)){
|
8878 |
-
if (headings[prop] > 1){
|
8879 |
-
messages.push(headings[prop] + " " + prop + "s");
|
8880 |
-
}
|
8881 |
-
}
|
8882 |
-
}
|
8883 |
-
|
8884 |
-
if (messages.length){
|
8885 |
-
reporter.rollupWarn("You have " + messages.join(", ") + " defined in this stylesheet.", rule);
|
8886 |
-
}
|
8887 |
-
});
|
8888 |
-
}
|
8889 |
-
|
8890 |
-
});
|
8891 |
-
|
8892 |
-
/*
|
8893 |
-
* Rule: Don't use universal selector because it's slow.
|
8894 |
-
*/
|
8895 |
-
|
8896 |
-
CSSLint.addRule({
|
8897 |
-
|
8898 |
-
//rule information
|
8899 |
-
id: "universal-selector",
|
8900 |
-
name: "Disallow universal selector",
|
8901 |
-
desc: "The universal selector (*) is known to be slow.",
|
8902 |
-
browsers: "All",
|
8903 |
-
|
8904 |
-
//initialization
|
8905 |
-
init: function(parser, reporter){
|
8906 |
-
var rule = this;
|
8907 |
-
|
8908 |
-
parser.addListener("startrule", function(event){
|
8909 |
-
var selectors = event.selectors,
|
8910 |
-
selector,
|
8911 |
-
part,
|
8912 |
-
i;
|
8913 |
-
|
8914 |
-
for (i=0; i < selectors.length; i++){
|
8915 |
-
selector = selectors[i];
|
8916 |
-
|
8917 |
-
part = selector.parts[selector.parts.length-1];
|
8918 |
-
if (part.elementName === "*"){
|
8919 |
-
reporter.report(rule.desc, part.line, part.col, rule);
|
8920 |
-
}
|
8921 |
-
}
|
8922 |
-
});
|
8923 |
-
}
|
8924 |
-
|
8925 |
-
});
|
8926 |
-
|
8927 |
-
/*
|
8928 |
-
* Rule: Don't use unqualified attribute selectors because they're just like universal selectors.
|
8929 |
-
*/
|
8930 |
-
|
8931 |
-
CSSLint.addRule({
|
8932 |
-
|
8933 |
-
//rule information
|
8934 |
-
id: "unqualified-attributes",
|
8935 |
-
name: "Disallow unqualified attribute selectors",
|
8936 |
-
desc: "Unqualified attribute selectors are known to be slow.",
|
8937 |
-
browsers: "All",
|
8938 |
-
|
8939 |
-
//initialization
|
8940 |
-
init: function(parser, reporter){
|
8941 |
-
var rule = this;
|
8942 |
-
|
8943 |
-
parser.addListener("startrule", function(event){
|
8944 |
-
|
8945 |
-
var selectors = event.selectors,
|
8946 |
-
selector,
|
8947 |
-
part,
|
8948 |
-
modifier,
|
8949 |
-
i, k;
|
8950 |
-
|
8951 |
-
for (i=0; i < selectors.length; i++){
|
8952 |
-
selector = selectors[i];
|
8953 |
-
|
8954 |
-
part = selector.parts[selector.parts.length-1];
|
8955 |
-
if (part.type === parser.SELECTOR_PART_TYPE){
|
8956 |
-
for (k=0; k < part.modifiers.length; k++){
|
8957 |
-
modifier = part.modifiers[k];
|
8958 |
-
if (modifier.type === "attribute" && (!part.elementName || part.elementName === "*")){
|
8959 |
-
reporter.report(rule.desc, part.line, part.col, rule);
|
8960 |
-
}
|
8961 |
-
}
|
8962 |
-
}
|
8963 |
-
|
8964 |
-
}
|
8965 |
-
});
|
8966 |
-
}
|
8967 |
-
|
8968 |
-
});
|
8969 |
-
|
8970 |
-
/*
|
8971 |
-
* Rule: When using a vendor-prefixed property, make sure to
|
8972 |
-
* include the standard one.
|
8973 |
-
*/
|
8974 |
-
|
8975 |
-
CSSLint.addRule({
|
8976 |
-
|
8977 |
-
//rule information
|
8978 |
-
id: "vendor-prefix",
|
8979 |
-
name: "Require standard property with vendor prefix",
|
8980 |
-
desc: "When using a vendor-prefixed property, make sure to include the standard one.",
|
8981 |
-
browsers: "All",
|
8982 |
-
|
8983 |
-
//initialization
|
8984 |
-
init: function(parser, reporter){
|
8985 |
-
var rule = this,
|
8986 |
-
properties,
|
8987 |
-
num,
|
8988 |
-
propertiesToCheck = {
|
8989 |
-
"-webkit-border-radius": "border-radius",
|
8990 |
-
"-webkit-border-top-left-radius": "border-top-left-radius",
|
8991 |
-
"-webkit-border-top-right-radius": "border-top-right-radius",
|
8992 |
-
"-webkit-border-bottom-left-radius": "border-bottom-left-radius",
|
8993 |
-
"-webkit-border-bottom-right-radius": "border-bottom-right-radius",
|
8994 |
-
|
8995 |
-
"-o-border-radius": "border-radius",
|
8996 |
-
"-o-border-top-left-radius": "border-top-left-radius",
|
8997 |
-
"-o-border-top-right-radius": "border-top-right-radius",
|
8998 |
-
"-o-border-bottom-left-radius": "border-bottom-left-radius",
|
8999 |
-
"-o-border-bottom-right-radius": "border-bottom-right-radius",
|
9000 |
-
|
9001 |
-
"-moz-border-radius": "border-radius",
|
9002 |
-
"-moz-border-radius-topleft": "border-top-left-radius",
|
9003 |
-
"-moz-border-radius-topright": "border-top-right-radius",
|
9004 |
-
"-moz-border-radius-bottomleft": "border-bottom-left-radius",
|
9005 |
-
"-moz-border-radius-bottomright": "border-bottom-right-radius",
|
9006 |
-
|
9007 |
-
"-moz-column-count": "column-count",
|
9008 |
-
"-webkit-column-count": "column-count",
|
9009 |
-
|
9010 |
-
"-moz-column-gap": "column-gap",
|
9011 |
-
"-webkit-column-gap": "column-gap",
|
9012 |
-
|
9013 |
-
"-moz-column-rule": "column-rule",
|
9014 |
-
"-webkit-column-rule": "column-rule",
|
9015 |
-
|
9016 |
-
"-moz-column-rule-style": "column-rule-style",
|
9017 |
-
"-webkit-column-rule-style": "column-rule-style",
|
9018 |
-
|
9019 |
-
"-moz-column-rule-color": "column-rule-color",
|
9020 |
-
"-webkit-column-rule-color": "column-rule-color",
|
9021 |
-
|
9022 |
-
"-moz-column-rule-width": "column-rule-width",
|
9023 |
-
"-webkit-column-rule-width": "column-rule-width",
|
9024 |
-
|
9025 |
-
"-moz-column-width": "column-width",
|
9026 |
-
"-webkit-column-width": "column-width",
|
9027 |
-
|
9028 |
-
"-webkit-column-span": "column-span",
|
9029 |
-
"-webkit-columns": "columns",
|
9030 |
-
|
9031 |
-
"-moz-box-shadow": "box-shadow",
|
9032 |
-
"-webkit-box-shadow": "box-shadow",
|
9033 |
-
|
9034 |
-
"-moz-transform" : "transform",
|
9035 |
-
"-webkit-transform" : "transform",
|
9036 |
-
"-o-transform" : "transform",
|
9037 |
-
"-ms-transform" : "transform",
|
9038 |
-
|
9039 |
-
"-moz-transform-origin" : "transform-origin",
|
9040 |
-
"-webkit-transform-origin" : "transform-origin",
|
9041 |
-
"-o-transform-origin" : "transform-origin",
|
9042 |
-
"-ms-transform-origin" : "transform-origin",
|
9043 |
-
|
9044 |
-
"-moz-box-sizing" : "box-sizing",
|
9045 |
-
"-webkit-box-sizing" : "box-sizing"
|
9046 |
-
};
|
9047 |
-
|
9048 |
-
//event handler for beginning of rules
|
9049 |
-
function startRule(){
|
9050 |
-
properties = {};
|
9051 |
-
num = 1;
|
9052 |
-
}
|
9053 |
-
|
9054 |
-
//event handler for end of rules
|
9055 |
-
function endRule(){
|
9056 |
-
var prop,
|
9057 |
-
i,
|
9058 |
-
len,
|
9059 |
-
needed,
|
9060 |
-
actual,
|
9061 |
-
needsStandard = [];
|
9062 |
-
|
9063 |
-
for (prop in properties){
|
9064 |
-
if (propertiesToCheck[prop]){
|
9065 |
-
needsStandard.push({ actual: prop, needed: propertiesToCheck[prop]});
|
9066 |
-
}
|
9067 |
-
}
|
9068 |
-
|
9069 |
-
for (i=0, len=needsStandard.length; i < len; i++){
|
9070 |
-
needed = needsStandard[i].needed;
|
9071 |
-
actual = needsStandard[i].actual;
|
9072 |
-
|
9073 |
-
if (!properties[needed]){
|
9074 |
-
reporter.report("Missing standard property '" + needed + "' to go along with '" + actual + "'.", properties[actual][0].name.line, properties[actual][0].name.col, rule);
|
9075 |
-
} else {
|
9076 |
-
//make sure standard property is last
|
9077 |
-
if (properties[needed][0].pos < properties[actual][0].pos){
|
9078 |
-
reporter.report("Standard property '" + needed + "' should come after vendor-prefixed property '" + actual + "'.", properties[actual][0].name.line, properties[actual][0].name.col, rule);
|
9079 |
-
}
|
9080 |
-
}
|
9081 |
-
}
|
9082 |
-
|
9083 |
-
}
|
9084 |
-
|
9085 |
-
parser.addListener("startrule", startRule);
|
9086 |
-
parser.addListener("startfontface", startRule);
|
9087 |
-
parser.addListener("startpage", startRule);
|
9088 |
-
parser.addListener("startpagemargin", startRule);
|
9089 |
-
parser.addListener("startkeyframerule", startRule);
|
9090 |
-
|
9091 |
-
parser.addListener("property", function(event){
|
9092 |
-
var name = event.property.text.toLowerCase();
|
9093 |
-
|
9094 |
-
if (!properties[name]){
|
9095 |
-
properties[name] = [];
|
9096 |
-
}
|
9097 |
-
|
9098 |
-
properties[name].push({ name: event.property, value : event.value, pos:num++ });
|
9099 |
-
});
|
9100 |
-
|
9101 |
-
parser.addListener("endrule", endRule);
|
9102 |
-
parser.addListener("endfontface", endRule);
|
9103 |
-
parser.addListener("endpage", endRule);
|
9104 |
-
parser.addListener("endpagemargin", endRule);
|
9105 |
-
parser.addListener("endkeyframerule", endRule);
|
9106 |
-
}
|
9107 |
-
|
9108 |
-
});
|
9109 |
-
|
9110 |
-
/*
|
9111 |
-
* Rule: You don't need to specify units when a value is 0.
|
9112 |
-
*/
|
9113 |
-
|
9114 |
-
CSSLint.addRule({
|
9115 |
-
|
9116 |
-
//rule information
|
9117 |
-
id: "zero-units",
|
9118 |
-
name: "Disallow units for 0 values",
|
9119 |
-
desc: "You don't need to specify units when a value is 0.",
|
9120 |
-
browsers: "All",
|
9121 |
-
|
9122 |
-
//initialization
|
9123 |
-
init: function(parser, reporter){
|
9124 |
-
var rule = this;
|
9125 |
-
|
9126 |
-
//count how many times "float" is used
|
9127 |
-
parser.addListener("property", function(event){
|
9128 |
-
var parts = event.value.parts,
|
9129 |
-
i = 0,
|
9130 |
-
len = parts.length;
|
9131 |
-
|
9132 |
-
while(i < len){
|
9133 |
-
if ((parts[i].units || parts[i].type === "percentage") && parts[i].value === 0 && parts[i].type !== "time"){
|
9134 |
-
reporter.report("Values of 0 shouldn't have units specified.", parts[i].line, parts[i].col, rule);
|
9135 |
-
}
|
9136 |
-
i++;
|
9137 |
-
}
|
9138 |
-
|
9139 |
-
});
|
9140 |
-
|
9141 |
-
}
|
9142 |
-
|
9143 |
-
});
|
9144 |
-
|
9145 |
-
(function() {
|
9146 |
-
|
9147 |
-
/**
|
9148 |
-
* Replace special characters before write to output.
|
9149 |
-
*
|
9150 |
-
* Rules:
|
9151 |
-
* - single quotes is the escape sequence for double-quotes
|
9152 |
-
* - & is the escape sequence for &
|
9153 |
-
* - < is the escape sequence for <
|
9154 |
-
* - > is the escape sequence for >
|
9155 |
-
*
|
9156 |
-
* @param {String} message to escape
|
9157 |
-
* @return escaped message as {String}
|
9158 |
-
*/
|
9159 |
-
var xmlEscape = function(str) {
|
9160 |
-
if (!str || str.constructor !== String) {
|
9161 |
-
return "";
|
9162 |
-
}
|
9163 |
-
|
9164 |
-
return str.replace(/[\"&><]/g, function(match) {
|
9165 |
-
switch (match) {
|
9166 |
-
case "\"":
|
9167 |
-
return """;
|
9168 |
-
case "&":
|
9169 |
-
return "&";
|
9170 |
-
case "<":
|
9171 |
-
return "<";
|
9172 |
-
case ">":
|
9173 |
-
return ">";
|
9174 |
-
}
|
9175 |
-
});
|
9176 |
-
};
|
9177 |
-
|
9178 |
-
CSSLint.addFormatter({
|
9179 |
-
//format information
|
9180 |
-
id: "checkstyle-xml",
|
9181 |
-
name: "Checkstyle XML format",
|
9182 |
-
|
9183 |
-
/**
|
9184 |
-
* Return opening root XML tag.
|
9185 |
-
* @return {String} to prepend before all results
|
9186 |
-
*/
|
9187 |
-
startFormat: function(){
|
9188 |
-
return "<?xml version=\"1.0\" encoding=\"utf-8\"?><checkstyle>";
|
9189 |
-
},
|
9190 |
-
|
9191 |
-
/**
|
9192 |
-
* Return closing root XML tag.
|
9193 |
-
* @return {String} to append after all results
|
9194 |
-
*/
|
9195 |
-
endFormat: function(){
|
9196 |
-
return "</checkstyle>";
|
9197 |
-
},
|
9198 |
-
|
9199 |
-
/**
|
9200 |
-
* Returns message when there is a file read error.
|
9201 |
-
* @param {String} filename The name of the file that caused the error.
|
9202 |
-
* @param {String} message The error message
|
9203 |
-
* @return {String} The error message.
|
9204 |
-
*/
|
9205 |
-
readError: function(filename, message) {
|
9206 |
-
return "<file name=\"" + xmlEscape(filename) + "\"><error line=\"0\" column=\"0\" severty=\"error\" message=\"" + xmlEscape(message) + "\"></error></file>";
|
9207 |
-
},
|
9208 |
-
|
9209 |
-
/**
|
9210 |
-
* Given CSS Lint results for a file, return output for this format.
|
9211 |
-
* @param results {Object} with error and warning messages
|
9212 |
-
* @param filename {String} relative file path
|
9213 |
-
* @param options {Object} (UNUSED for now) specifies special handling of output
|
9214 |
-
* @return {String} output for results
|
9215 |
-
*/
|
9216 |
-
formatResults: function(results, filename/*, options*/) {
|
9217 |
-
var messages = results.messages,
|
9218 |
-
output = [];
|
9219 |
-
|
9220 |
-
/**
|
9221 |
-
* Generate a source string for a rule.
|
9222 |
-
* Checkstyle source strings usually resemble Java class names e.g
|
9223 |
-
* net.csslint.SomeRuleName
|
9224 |
-
* @param {Object} rule
|
9225 |
-
* @return rule source as {String}
|
9226 |
-
*/
|
9227 |
-
var generateSource = function(rule) {
|
9228 |
-
if (!rule || !("name" in rule)) {
|
9229 |
-
return "";
|
9230 |
-
}
|
9231 |
-
return "net.csslint." + rule.name.replace(/\s/g,"");
|
9232 |
-
};
|
9233 |
-
|
9234 |
-
|
9235 |
-
|
9236 |
-
if (messages.length > 0) {
|
9237 |
-
output.push("<file name=\""+filename+"\">");
|
9238 |
-
CSSLint.Util.forEach(messages, function (message) {
|
9239 |
-
//ignore rollups for now
|
9240 |
-
if (!message.rollup) {
|
9241 |
-
output.push("<error line=\"" + message.line + "\" column=\"" + message.col + "\" severity=\"" + message.type + "\"" +
|
9242 |
-
" message=\"" + xmlEscape(message.message) + "\" source=\"" + generateSource(message.rule) +"\"/>");
|
9243 |
-
}
|
9244 |
-
});
|
9245 |
-
output.push("</file>");
|
9246 |
-
}
|
9247 |
-
|
9248 |
-
return output.join("");
|
9249 |
-
}
|
9250 |
-
});
|
9251 |
-
|
9252 |
-
}());
|
9253 |
-
|
9254 |
-
CSSLint.addFormatter({
|
9255 |
-
//format information
|
9256 |
-
id: "compact",
|
9257 |
-
name: "Compact, 'porcelain' format",
|
9258 |
-
|
9259 |
-
/**
|
9260 |
-
* Return content to be printed before all file results.
|
9261 |
-
* @return {String} to prepend before all results
|
9262 |
-
*/
|
9263 |
-
startFormat: function() {
|
9264 |
-
return "";
|
9265 |
-
},
|
9266 |
-
|
9267 |
-
/**
|
9268 |
-
* Return content to be printed after all file results.
|
9269 |
-
* @return {String} to append after all results
|
9270 |
-
*/
|
9271 |
-
endFormat: function() {
|
9272 |
-
return "";
|
9273 |
-
},
|
9274 |
-
|
9275 |
-
/**
|
9276 |
-
* Given CSS Lint results for a file, return output for this format.
|
9277 |
-
* @param results {Object} with error and warning messages
|
9278 |
-
* @param filename {String} relative file path
|
9279 |
-
* @param options {Object} (Optional) specifies special handling of output
|
9280 |
-
* @return {String} output for results
|
9281 |
-
*/
|
9282 |
-
formatResults: function(results, filename, options) {
|
9283 |
-
var messages = results.messages,
|
9284 |
-
output = "";
|
9285 |
-
options = options || {};
|
9286 |
-
|
9287 |
-
/**
|
9288 |
-
* Capitalize and return given string.
|
9289 |
-
* @param str {String} to capitalize
|
9290 |
-
* @return {String} capitalized
|
9291 |
-
*/
|
9292 |
-
var capitalize = function(str) {
|
9293 |
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
9294 |
-
};
|
9295 |
-
|
9296 |
-
if (messages.length === 0) {
|
9297 |
-
return options.quiet ? "" : filename + ": Lint Free!";
|
9298 |
-
}
|
9299 |
-
|
9300 |
-
CSSLint.Util.forEach(messages, function(message) {
|
9301 |
-
if (message.rollup) {
|
9302 |
-
output += filename + ": " + capitalize(message.type) + " - " + message.message + "\n";
|
9303 |
-
} else {
|
9304 |
-
output += filename + ": " + "line " + message.line +
|
9305 |
-
", col " + message.col + ", " + capitalize(message.type) + " - " + message.message + " (" + message.rule.id + ")\n";
|
9306 |
-
}
|
9307 |
-
});
|
9308 |
-
|
9309 |
-
return output;
|
9310 |
-
}
|
9311 |
-
});
|
9312 |
-
|
9313 |
-
CSSLint.addFormatter({
|
9314 |
-
//format information
|
9315 |
-
id: "csslint-xml",
|
9316 |
-
name: "CSSLint XML format",
|
9317 |
-
|
9318 |
-
/**
|
9319 |
-
* Return opening root XML tag.
|
9320 |
-
* @return {String} to prepend before all results
|
9321 |
-
*/
|
9322 |
-
startFormat: function(){
|
9323 |
-
return "<?xml version=\"1.0\" encoding=\"utf-8\"?><csslint>";
|
9324 |
-
},
|
9325 |
-
|
9326 |
-
/**
|
9327 |
-
* Return closing root XML tag.
|
9328 |
-
* @return {String} to append after all results
|
9329 |
-
*/
|
9330 |
-
endFormat: function(){
|
9331 |
-
return "</csslint>";
|
9332 |
-
},
|
9333 |
-
|
9334 |
-
/**
|
9335 |
-
* Given CSS Lint results for a file, return output for this format.
|
9336 |
-
* @param results {Object} with error and warning messages
|
9337 |
-
* @param filename {String} relative file path
|
9338 |
-
* @param options {Object} (UNUSED for now) specifies special handling of output
|
9339 |
-
* @return {String} output for results
|
9340 |
-
*/
|
9341 |
-
formatResults: function(results, filename/*, options*/) {
|
9342 |
-
var messages = results.messages,
|
9343 |
-
output = [];
|
9344 |
-
|
9345 |
-
/**
|
9346 |
-
* Replace special characters before write to output.
|
9347 |
-
*
|
9348 |
-
* Rules:
|
9349 |
-
* - single quotes is the escape sequence for double-quotes
|
9350 |
-
* - & is the escape sequence for &
|
9351 |
-
* - < is the escape sequence for <
|
9352 |
-
* - > is the escape sequence for >
|
9353 |
-
*
|
9354 |
-
* @param {String} message to escape
|
9355 |
-
* @return escaped message as {String}
|
9356 |
-
*/
|
9357 |
-
var escapeSpecialCharacters = function(str) {
|
9358 |
-
if (!str || str.constructor !== String) {
|
9359 |
-
return "";
|
9360 |
-
}
|
9361 |
-
return str.replace(/\"/g, "'").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
9362 |
-
};
|
9363 |
-
|
9364 |
-
if (messages.length > 0) {
|
9365 |
-
output.push("<file name=\""+filename+"\">");
|
9366 |
-
CSSLint.Util.forEach(messages, function (message) {
|
9367 |
-
if (message.rollup) {
|
9368 |
-
output.push("<issue severity=\"" + message.type + "\" reason=\"" + escapeSpecialCharacters(message.message) + "\" evidence=\"" + escapeSpecialCharacters(message.evidence) + "\"/>");
|
9369 |
-
} else {
|
9370 |
-
output.push("<issue line=\"" + message.line + "\" char=\"" + message.col + "\" severity=\"" + message.type + "\"" +
|
9371 |
-
" reason=\"" + escapeSpecialCharacters(message.message) + "\" evidence=\"" + escapeSpecialCharacters(message.evidence) + "\"/>");
|
9372 |
-
}
|
9373 |
-
});
|
9374 |
-
output.push("</file>");
|
9375 |
-
}
|
9376 |
-
|
9377 |
-
return output.join("");
|
9378 |
-
}
|
9379 |
-
});
|
9380 |
-
|
9381 |
-
CSSLint.addFormatter({
|
9382 |
-
//format information
|
9383 |
-
id: "junit-xml",
|
9384 |
-
name: "JUNIT XML format",
|
9385 |
-
|
9386 |
-
/**
|
9387 |
-
* Return opening root XML tag.
|
9388 |
-
* @return {String} to prepend before all results
|
9389 |
-
*/
|
9390 |
-
startFormat: function(){
|
9391 |
-
return "<?xml version=\"1.0\" encoding=\"utf-8\"?><testsuites>";
|
9392 |
-
},
|
9393 |
-
|
9394 |
-
/**
|
9395 |
-
* Return closing root XML tag.
|
9396 |
-
* @return {String} to append after all results
|
9397 |
-
*/
|
9398 |
-
endFormat: function() {
|
9399 |
-
return "</testsuites>";
|
9400 |
-
},
|
9401 |
-
|
9402 |
-
/**
|
9403 |
-
* Given CSS Lint results for a file, return output for this format.
|
9404 |
-
* @param results {Object} with error and warning messages
|
9405 |
-
* @param filename {String} relative file path
|
9406 |
-
* @param options {Object} (UNUSED for now) specifies special handling of output
|
9407 |
-
* @return {String} output for results
|
9408 |
-
*/
|
9409 |
-
formatResults: function(results, filename/*, options*/) {
|
9410 |
-
|
9411 |
-
var messages = results.messages,
|
9412 |
-
output = [],
|
9413 |
-
tests = {
|
9414 |
-
"error": 0,
|
9415 |
-
"failure": 0
|
9416 |
-
};
|
9417 |
-
|
9418 |
-
/**
|
9419 |
-
* Generate a source string for a rule.
|
9420 |
-
* JUNIT source strings usually resemble Java class names e.g
|
9421 |
-
* net.csslint.SomeRuleName
|
9422 |
-
* @param {Object} rule
|
9423 |
-
* @return rule source as {String}
|
9424 |
-
*/
|
9425 |
-
var generateSource = function(rule) {
|
9426 |
-
if (!rule || !("name" in rule)) {
|
9427 |
-
return "";
|
9428 |
-
}
|
9429 |
-
return "net.csslint." + rule.name.replace(/\s/g,"");
|
9430 |
-
};
|
9431 |
-
|
9432 |
-
/**
|
9433 |
-
* Replace special characters before write to output.
|
9434 |
-
*
|
9435 |
-
* Rules:
|
9436 |
-
* - single quotes is the escape sequence for double-quotes
|
9437 |
-
* - < is the escape sequence for <
|
9438 |
-
* - > is the escape sequence for >
|
9439 |
-
*
|
9440 |
-
* @param {String} message to escape
|
9441 |
-
* @return escaped message as {String}
|
9442 |
-
*/
|
9443 |
-
var escapeSpecialCharacters = function(str) {
|
9444 |
-
|
9445 |
-
if (!str || str.constructor !== String) {
|
9446 |
-
return "";
|
9447 |
-
}
|
9448 |
-
|
9449 |
-
return str.replace(/\"/g, "'").replace(/</g, "<").replace(/>/g, ">");
|
9450 |
-
|
9451 |
-
};
|
9452 |
-
|
9453 |
-
if (messages.length > 0) {
|
9454 |
-
|
9455 |
-
messages.forEach(function (message) {
|
9456 |
-
|
9457 |
-
// since junit has no warning class
|
9458 |
-
// all issues as errors
|
9459 |
-
var type = message.type === "warning" ? "error" : message.type;
|
9460 |
-
|
9461 |
-
//ignore rollups for now
|
9462 |
-
if (!message.rollup) {
|
9463 |
-
|
9464 |
-
// build the test case seperately, once joined
|
9465 |
-
// we'll add it to a custom array filtered by type
|
9466 |
-
output.push("<testcase time=\"0\" name=\"" + generateSource(message.rule) + "\">");
|
9467 |
-
output.push("<" + type + " message=\"" + escapeSpecialCharacters(message.message) + "\"><![CDATA[" + message.line + ":" + message.col + ":" + escapeSpecialCharacters(message.evidence) + "]]></" + type + ">");
|
9468 |
-
output.push("</testcase>");
|
9469 |
-
|
9470 |
-
tests[type] += 1;
|
9471 |
-
|
9472 |
-
}
|
9473 |
-
|
9474 |
-
});
|
9475 |
-
|
9476 |
-
output.unshift("<testsuite time=\"0\" tests=\"" + messages.length + "\" skipped=\"0\" errors=\"" + tests.error + "\" failures=\"" + tests.failure + "\" package=\"net.csslint\" name=\"" + filename + "\">");
|
9477 |
-
output.push("</testsuite>");
|
9478 |
-
|
9479 |
-
}
|
9480 |
-
|
9481 |
-
return output.join("");
|
9482 |
-
|
9483 |
-
}
|
9484 |
-
});
|
9485 |
-
|
9486 |
-
CSSLint.addFormatter({
|
9487 |
-
//format information
|
9488 |
-
id: "lint-xml",
|
9489 |
-
name: "Lint XML format",
|
9490 |
-
|
9491 |
-
/**
|
9492 |
-
* Return opening root XML tag.
|
9493 |
-
* @return {String} to prepend before all results
|
9494 |
-
*/
|
9495 |
-
startFormat: function(){
|
9496 |
-
return "<?xml version=\"1.0\" encoding=\"utf-8\"?><lint>";
|
9497 |
-
},
|
9498 |
-
|
9499 |
-
/**
|
9500 |
-
* Return closing root XML tag.
|
9501 |
-
* @return {String} to append after all results
|
9502 |
-
*/
|
9503 |
-
endFormat: function(){
|
9504 |
-
return "</lint>";
|
9505 |
-
},
|
9506 |
-
|
9507 |
-
/**
|
9508 |
-
* Given CSS Lint results for a file, return output for this format.
|
9509 |
-
* @param results {Object} with error and warning messages
|
9510 |
-
* @param filename {String} relative file path
|
9511 |
-
* @param options {Object} (UNUSED for now) specifies special handling of output
|
9512 |
-
* @return {String} output for results
|
9513 |
-
*/
|
9514 |
-
formatResults: function(results, filename/*, options*/) {
|
9515 |
-
var messages = results.messages,
|
9516 |
-
output = [];
|
9517 |
-
|
9518 |
-
/**
|
9519 |
-
* Replace special characters before write to output.
|
9520 |
-
*
|
9521 |
-
* Rules:
|
9522 |
-
* - single quotes is the escape sequence for double-quotes
|
9523 |
-
* - & is the escape sequence for &
|
9524 |
-
* - < is the escape sequence for <
|
9525 |
-
* - > is the escape sequence for >
|
9526 |
-
*
|
9527 |
-
* @param {String} message to escape
|
9528 |
-
* @return escaped message as {String}
|
9529 |
-
*/
|
9530 |
-
var escapeSpecialCharacters = function(str) {
|
9531 |
-
if (!str || str.constructor !== String) {
|
9532 |
-
return "";
|
9533 |
-
}
|
9534 |
-
return str.replace(/\"/g, "'").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
9535 |
-
};
|
9536 |
-
|
9537 |
-
if (messages.length > 0) {
|
9538 |
-
|
9539 |
-
output.push("<file name=\""+filename+"\">");
|
9540 |
-
CSSLint.Util.forEach(messages, function (message) {
|
9541 |
-
if (message.rollup) {
|
9542 |
-
output.push("<issue severity=\"" + message.type + "\" reason=\"" + escapeSpecialCharacters(message.message) + "\" evidence=\"" + escapeSpecialCharacters(message.evidence) + "\"/>");
|
9543 |
-
} else {
|
9544 |
-
output.push("<issue line=\"" + message.line + "\" char=\"" + message.col + "\" severity=\"" + message.type + "\"" +
|
9545 |
-
" reason=\"" + escapeSpecialCharacters(message.message) + "\" evidence=\"" + escapeSpecialCharacters(message.evidence) + "\"/>");
|
9546 |
-
}
|
9547 |
-
});
|
9548 |
-
output.push("</file>");
|
9549 |
-
}
|
9550 |
-
|
9551 |
-
return output.join("");
|
9552 |
-
}
|
9553 |
-
});
|
9554 |
-
|
9555 |
-
CSSLint.addFormatter({
|
9556 |
-
//format information
|
9557 |
-
id: "text",
|
9558 |
-
name: "Plain Text",
|
9559 |
-
|
9560 |
-
/**
|
9561 |
-
* Return content to be printed before all file results.
|
9562 |
-
* @return {String} to prepend before all results
|
9563 |
-
*/
|
9564 |
-
startFormat: function() {
|
9565 |
-
return "";
|
9566 |
-
},
|
9567 |
-
|
9568 |
-
/**
|
9569 |
-
* Return content to be printed after all file results.
|
9570 |
-
* @return {String} to append after all results
|
9571 |
-
*/
|
9572 |
-
endFormat: function() {
|
9573 |
-
return "";
|
9574 |
-
},
|
9575 |
-
|
9576 |
-
/**
|
9577 |
-
* Given CSS Lint results for a file, return output for this format.
|
9578 |
-
* @param results {Object} with error and warning messages
|
9579 |
-
* @param filename {String} relative file path
|
9580 |
-
* @param options {Object} (Optional) specifies special handling of output
|
9581 |
-
* @return {String} output for results
|
9582 |
-
*/
|
9583 |
-
formatResults: function(results, filename, options) {
|
9584 |
-
var messages = results.messages,
|
9585 |
-
output = "";
|
9586 |
-
options = options || {};
|
9587 |
-
|
9588 |
-
if (messages.length === 0) {
|
9589 |
-
return options.quiet ? "" : "\n\ncsslint: No errors in " + filename + ".";
|
9590 |
-
}
|
9591 |
-
|
9592 |
-
output = "\n\ncsslint: There ";
|
9593 |
-
if (messages.length === 1) {
|
9594 |
-
output += "is 1 problem";
|
9595 |
-
} else {
|
9596 |
-
output += "are " + messages.length + " problems";
|
9597 |
-
}
|
9598 |
-
output += " in " + filename + ".";
|
9599 |
-
|
9600 |
-
var pos = filename.lastIndexOf("/"),
|
9601 |
-
shortFilename = filename;
|
9602 |
-
|
9603 |
-
if (pos === -1){
|
9604 |
-
pos = filename.lastIndexOf("\\");
|
9605 |
-
}
|
9606 |
-
if (pos > -1){
|
9607 |
-
shortFilename = filename.substring(pos+1);
|
9608 |
-
}
|
9609 |
-
|
9610 |
-
CSSLint.Util.forEach(messages, function (message, i) {
|
9611 |
-
output = output + "\n\n" + shortFilename;
|
9612 |
-
if (message.rollup) {
|
9613 |
-
output += "\n" + (i+1) + ": " + message.type;
|
9614 |
-
output += "\n" + message.message;
|
9615 |
-
} else {
|
9616 |
-
output += "\n" + (i+1) + ": " + message.type + " at line " + message.line + ", col " + message.col;
|
9617 |
-
output += "\n" + message.message;
|
9618 |
-
output += "\n" + message.evidence;
|
9619 |
-
}
|
9620 |
-
});
|
9621 |
-
|
9622 |
-
return output;
|
9623 |
-
}
|
9624 |
-
});
|
9625 |
-
|
9626 |
-
module.exports.CSSLint = CSSLint;
|
9627 |
-
|
9628 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/vendor/ace/worker-css.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
function initBaseUrls(a){require.tlns=a}function initSender(){var a=require(null,"ace/lib/event_emitter").EventEmitter,b=require(null,"ace/lib/oop"),c=function(){};return function(){b.implement(this,a),this.callback=function(a,b){postMessage({type:"call",id:b,data:a})},this.emit=function(a,b){postMessage({type:"event",name:a,data:b})}}.call(c.prototype),new c}"no use strict";var console={log:function(a){postMessage({type:"log",data:arguments.join(" ")})}},window={console:console},normalizeModule=function(a,b){if(b.indexOf("!")!==-1){var c=b.split("!");return normalizeModule(a,c[0])+"!"+normalizeModule(a,c[1])}if(b.charAt(0)=="."){var d=a.split("/").slice(0,-1).join("/"),b=d+"/"+b;while(b.indexOf(".")!==-1&&e!=b)var e=b,b=b.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}return b},require=function(a,b){if(!b.charAt)throw new Error("worker.js require() accepts only (parentId, id) as arguments");var b=normalizeModule(a,b),c=require.modules[b];if(c)return c.initialized||(c.initialized=!0,c.exports=c.factory().exports),c.exports;var d=b.split("/");d[0]=require.tlns[d[0]]||d[0];var e=d.join("/")+".js";return require.id=b,importScripts(e),require(a,b)};require.modules={},require.tlns={};var define=function(a,b,c){arguments.length==2?(c=b,typeof a!="string"&&(b=a,a=require.id)):arguments.length==1&&(c=a,a=require.id);if(a.indexOf("text!")===0)return;var d=function(b,c){return require(a,b,c)};require.modules[a]={factory:function(){var a={exports:{}},b=c(d,a.exports,a);return b&&(a.exports=b),a}}},main,sender;onmessage=function(a){var b=a.data;if(b.command)main[b.command].apply(main,b.args);else if(b.init){initBaseUrls(b.tlns),require(null,"ace/lib/fixoldbrowsers"),sender=initSender();var c=require(null,b.module)[b.classname];main=new c(sender)}else b.event&&sender&&sender._emit(b.event,b.data)},define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/regexp","ace/lib/es5-shim"],function(a,b,c){a("./regexp"),a("./es5-shim")}),define("ace/lib/regexp",["require","exports","module"],function(a,b,c){function g(a){return(a.global?"g":"")+(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.extended?"x":"")+(a.sticky?"y":"")}function h(a,b,c){if(Array.prototype.indexOf)return a.indexOf(b,c);for(var d=c||0;d<a.length;d++)if(a[d]===b)return d;return-1}var d={exec:RegExp.prototype.exec,test:RegExp.prototype.test,match:String.prototype.match,replace:String.prototype.replace,split:String.prototype.split},e=d.exec.call(/()??/,"")[1]===undefined,f=function(){var a=/^/g;return d.test.call(a,""),!a.lastIndex}();if(f&&e)return;RegExp.prototype.exec=function(a){var b=d.exec.apply(this,arguments),c,i;if(typeof a=="string"&&b){!e&&b.length>1&&h(b,"")>-1&&(i=RegExp(this.source,d.replace.call(g(this),"g","")),d.replace.call(a.slice(b.index),i,function(){for(var a=1;a<arguments.length-2;a++)arguments[a]===undefined&&(b[a]=undefined)}));if(this._xregexp&&this._xregexp.captureNames)for(var j=1;j<b.length;j++)c=this._xregexp.captureNames[j-1],c&&(b[c]=b[j]);!f&&this.global&&!b[0].length&&this.lastIndex>b.index&&this.lastIndex--}return b},f||(RegExp.prototype.test=function(a){var b=d.exec.call(this,a);return b&&this.global&&!b[0].length&&this.lastIndex>b.index&&this.lastIndex--,!!b})}),define("ace/lib/es5-shim",["require","exports","module"],function(a,b,c){function p(a){try{return Object.defineProperty(a,"sentinel",{}),"sentinel"in a}catch(b){}}Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=g.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,h=c.apply(f,d.concat(g.call(arguments)));return h!==null&&Object(h)===h?h:f}return c.apply(b,d.concat(g.call(arguments)))};return e});var d=Function.prototype.call,e=Array.prototype,f=Object.prototype,g=e.slice,h=d.bind(f.toString),i=d.bind(f.hasOwnProperty),j,k,l,m,n;if(n=i(f,"__defineGetter__"))j=d.bind(f.__defineGetter__),k=d.bind(f.__defineSetter__),l=d.bind(f.__lookupGetter__),m=d.bind(f.__lookupSetter__);Array.isArray||(Array.isArray=function(b){return h(b)=="[object Array]"}),Array.prototype.forEach||(Array.prototype.forEach=function(b){var c=G(this),d=arguments[1],e=0,f=c.length>>>0;if(h(b)!="[object Function]")throw new TypeError;while(e<f)e in c&&b.call(d,c[e],e,c),e++}),Array.prototype.map||(Array.prototype.map=function(b){var c=G(this),d=c.length>>>0,e=Array(d),f=arguments[1];if(h(b)!="[object Function]")throw new TypeError;for(var g=0;g<d;g++)g in c&&(e[g]=b.call(f,c[g],g,c));return e}),Array.prototype.filter||(Array.prototype.filter=function(b){var c=G(this),d=c.length>>>0,e=[],f=arguments[1];if(h(b)!="[object Function]")throw new TypeError;for(var g=0;g<d;g++)g in c&&b.call(f,c[g],g,c)&&e.push(c[g]);return e}),Array.prototype.every||(Array.prototype.every=function(b){var c=G(this),d=c.length>>>0,e=arguments[1];if(h(b)!="[object Function]")throw new TypeError;for(var f=0;f<d;f++)if(f in c&&!b.call(e,c[f],f,c))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(b){var c=G(this),d=c.length>>>0,e=arguments[1];if(h(b)!="[object Function]")throw new TypeError;for(var f=0;f<d;f++)if(f in c&&b.call(e,c[f],f,c))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(b){var c=G(this),d=c.length>>>0;if(h(b)!="[object Function]")throw new TypeError;if(!d&&arguments.length==1)throw new TypeError;var e=0,f;if(arguments.length>=2)f=arguments[1];else do{if(e in c){f=c[e++];break}if(++e>=d)throw new TypeError}while(!0);for(;e<d;e++)e in c&&(f=b.call(void 0,f,c[e],e,c));return f}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(b){var c=G(this),d=c.length>>>0;if(h(b)!="[object Function]")throw new TypeError;if(!d&&arguments.length==1)throw new TypeError;var e,f=d-1;if(arguments.length>=2)e=arguments[1];else do{if(f in c){e=c[f--];break}if(--f<0)throw new TypeError}while(!0);do f in this&&(e=b.call(void 0,e,c[f],f,c));while(f--);return e}),Array.prototype.indexOf||(Array.prototype.indexOf=function(b){var c=G(this),d=c.length>>>0;if(!d)return-1;var e=0;arguments.length>1&&(e=E(arguments[1])),e=e>=0?e:Math.max(0,d+e);for(;e<d;e++)if(e in c&&c[e]===b)return e;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(b){var c=G(this),d=c.length>>>0;if(!d)return-1;var e=d-1;arguments.length>1&&(e=Math.min(e,E(arguments[1]))),e=e>=0?e:d-Math.abs(e);for(;e>=0;e--)if(e in c&&b===c[e])return e;return-1}),Object.getPrototypeOf||(Object.getPrototypeOf=function(b){return b.__proto__||(b.constructor?b.constructor.prototype:f)});if(!Object.getOwnPropertyDescriptor){var o="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(b,c){if(typeof b!="object"&&typeof b!="function"||b===null)throw new TypeError(o+b);if(!i(b,c))return;var d,e,g;d={enumerable:!0,configurable:!0};if(n){var h=b.__proto__;b.__proto__=f;var e=l(b,c),g=m(b,c);b.__proto__=h;if(e||g)return e&&(d.get=e),g&&(d.set=g),d}return d.value=b[c],d}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(b){return Object.keys(b)}),Object.create||(Object.create=function(b,c){var d;if(b===null)d={__proto__:null};else{if(typeof b!="object")throw new TypeError("typeof prototype["+typeof b+"] != 'object'");var e=function(){};e.prototype=b,d=new e,d.__proto__=b}return c!==void 0&&Object.defineProperties(d,c),d});if(Object.defineProperty){var q=p({}),r=typeof document=="undefined"||p(document.createElement("div"));if(!q||!r)var s=Object.defineProperty}if(!Object.defineProperty||s){var t="Property description must be an object: ",u="Object.defineProperty called on non-object: ",v="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(b,c,d){if(typeof b!="object"&&typeof b!="function"||b===null)throw new TypeError(u+b);if(typeof d!="object"&&typeof d!="function"||d===null)throw new TypeError(t+d);if(s)try{return s.call(Object,b,c,d)}catch(e){}if(i(d,"value"))if(n&&(l(b,c)||m(b,c))){var g=b.__proto__;b.__proto__=f,delete b[c],b[c]=d.value,b.__proto__=g}else b[c]=d.value;else{if(!n)throw new TypeError(v);i(d,"get")&&j(b,c,d.get),i(d,"set")&&k(b,c,d.set)}return b}}Object.defineProperties||(Object.defineProperties=function(b,c){for(var d in c)i(c,d)&&Object.defineProperty(b,d,c[d]);return b}),Object.seal||(Object.seal=function(b){return b}),Object.freeze||(Object.freeze=function(b){return b});try{Object.freeze(function(){})}catch(w){Object.freeze=function(b){return function(c){return typeof c=="function"?c:b(c)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(b){return b}),Object.isSealed||(Object.isSealed=function(b){return!1}),Object.isFrozen||(Object.isFrozen=function(b){return!1}),Object.isExtensible||(Object.isExtensible=function(b){if(Object(b)===b)throw new TypeError;var c="";while(i(b,c))c+="?";b[c]=!0;var d=i(b,c);return delete b[c],d});if(!Object.keys){var x=!0,y=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],z=y.length;for(var A in{toString:null})x=!1;Object.keys=function H(a){if(typeof a!="object"&&typeof a!="function"||a===null)throw new TypeError("Object.keys called on a non-object");var H=[];for(var b in a)i(a,b)&&H.push(b);if(x)for(var c=0,d=z;c<d;c++){var e=y[c];i(a,e)&&H.push(e)}return H}}if(!Date.prototype.toISOString||(new Date(-621987552e5)).toISOString().indexOf("-000001")===-1)Date.prototype.toISOString=function(){var b,c,d,e;if(!isFinite(this))throw new RangeError;b=[this.getUTCMonth()+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()],e=this.getUTCFullYear(),e=(e<0?"-":e>9999?"+":"")+("00000"+Math.abs(e)).slice(0<=e&&e<=9999?-4:-6),c=b.length;while(c--)d=b[c],d<10&&(b[c]="0"+d);return e+"-"+b.slice(0,2).join("-")+"T"+b.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"};Date.now||(Date.now=function(){return(new Date).getTime()}),Date.prototype.toJSON||(Date.prototype.toJSON=function(b){if(typeof this.toISOString!="function")throw new TypeError;return this.toISOString()}),Date.parse("+275760-09-13T00:00:00.000Z")!==864e13&&(Date=function(a){var b=function e(b,c,d,f,g,h,i){var j=arguments.length;if(this instanceof a){var k=j==1&&String(b)===b?new a(e.parse(b)):j>=7?new a(b,c,d,f,g,h,i):j>=6?new a(b,c,d,f,g,h):j>=5?new a(b,c,d,f,g):j>=4?new a(b,c,d,f):j>=3?new a(b,c,d):j>=2?new a(b,c):j>=1?new a(b):new a;return k.constructor=e,k}return a.apply(this,arguments)},c=new RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d{3}))?)?(?:Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$");for(var d in a)b[d]=a[d];return b.now=a.now,b.UTC=a.UTC,b.prototype=a.prototype,b.prototype.constructor=b,b.parse=function(d){var e=c.exec(d);if(e){e.shift();for(var f=1;f<7;f++)e[f]=+(e[f]||(f<3?1:0)),f==1&&e[f]--;var g=+e.pop(),h=+e.pop(),i=e.pop(),j=0;if(i){if(h>23||g>59)return NaN;j=(h*60+g)*6e4*(i=="+"?-1:1)}var k=+e[0];return 0<=k&&k<=99?(e[0]=k+400,a.UTC.apply(this,e)+j-126227808e5):a.UTC.apply(this,e)+j}return a.parse.apply(this,arguments)},b}(Date));var B=" \n\f\r \u2028\u2029";if(!String.prototype.trim||B.trim()){B="["+B+"]";var C=new RegExp("^"+B+B+"*"),D=new RegExp(B+B+"*$");String.prototype.trim=function(){return String(this).replace(C,"").replace(D,"")}}var E=function(a){return a=+a,a!==a?a=0:a!==0&&a!==1/0&&a!==-Infinity&&(a=(a>0||-1)*Math.floor(Math.abs(a))),a},F="a"[0]!="a",G=function(a){if(a==null)throw new TypeError;return F&&typeof a=="string"&&a?a.split(""):Object(a)}}),define("ace/lib/event_emitter",["require","exports","module"],function(a,b,c){var d={};d._emit=d._dispatchEvent=function(a,b){this._eventRegistry=this._eventRegistry||{},this._defaultHandlers=this._defaultHandlers||{};var c=this._eventRegistry[a]||[],d=this._defaultHandlers[a];if(!c.length&&!d)return;if(typeof b!="object"||!b)b={};b.type||(b.type=a),b.stopPropagation||(b.stopPropagation=function(){this.propagationStopped=!0}),b.preventDefault||(b.preventDefault=function(){this.defaultPrevented=!0});for(var e=0;e<c.length;e++){c[e](b);if(b.propagationStopped)break}if(d&&!b.defaultPrevented)return d(b)},d.setDefaultHandler=function(a,b){this._defaultHandlers=this._defaultHandlers||{};if(this._defaultHandlers[a])throw new Error("The default handler for '"+a+"' is already set");this._defaultHandlers[a]=b},d.on=d.addEventListener=function(a,b){this._eventRegistry=this._eventRegistry||{};var c=this._eventRegistry[a];c||(c=this._eventRegistry[a]=[]),c.indexOf(b)==-1&&c.push(b)},d.removeListener=d.removeEventListener=function(a,b){this._eventRegistry=this._eventRegistry||{};var c=this._eventRegistry[a];if(!c)return;var d=c.indexOf(b);d!==-1&&c.splice(d,1)},d.removeAllListeners=function(a){this._eventRegistry&&(this._eventRegistry[a]=[])},b.EventEmitter=d}),define("ace/lib/oop",["require","exports","module"],function(a,b,c){b.inherits=function(){var a=function(){};return function(b,c){a.prototype=c.prototype,b.super_=c.prototype,b.prototype=new a,b.prototype.constructor=b}}(),b.mixin=function(a,b){for(var c in b)a[c]=b[c]},b.implement=function(a,c){b.mixin(a,c)}}),define("ace/mode/css_worker",["require","exports","module","ace/lib/oop","ace/worker/mirror","ace/mode/css/csslint"],function(a,b,c){var d=a("../lib/oop"),e=a("../worker/mirror").Mirror,f=a("./css/csslint").CSSLint,g=b.Worker=function(a){e.call(this,a),this.setTimeout(200)};d.inherits(g,e),function(){this.onUpdate=function(){var a=this.doc.getValue(),b=f.verify(a);this.sender.emit("csslint",b.messages.map(function(a){return delete a.rule,a}))}}.call(g.prototype)}),define("ace/worker/mirror",["require","exports","module","ace/document","ace/lib/lang"],function(a,b,c){var d=a("../document").Document,e=a("../lib/lang"),f=b.Mirror=function(a){this.sender=a;var b=this.doc=new d(""),c=this.deferredUpdate=e.deferredCall(this.onUpdate.bind(this)),f=this;a.on("change",function(a){b.applyDeltas([a.data]),c.schedule(f.$timeout)})};(function(){this.$timeout=500,this.setTimeout=function(a){this.$timeout=a},this.setValue=function(a){this.doc.setValue(a),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(a){this.sender.callback(this.doc.getValue(),a)},this.onUpdate=function(){}}).call(f.prototype)}),define("ace/document",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/range","ace/anchor"],function(a,b,c){var d=a("./lib/oop"),e=a("./lib/event_emitter").EventEmitter,f=a("./range").Range,g=a("./anchor").Anchor,h=function(a){this.$lines=[],a.length==0?this.$lines=[""]:Array.isArray(a)?this.insertLines(0,a):this.insert({row:0,column:0},a)};(function(){d.implement(this,e),this.setValue=function(a){var b=this.getLength();this.remove(new f(0,0,b,this.getLine(b-1).length)),this.insert({row:0,column:0},a)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(a,b){return new g(this,a,b)},"aaa".split(/a/).length==0?this.$split=function(a){return a.replace(/\r\n|\r/g,"\n").split("\n")}:this.$split=function(a){return a.split(/\r\n|\r|\n/)},this.$detectNewLine=function(a){var b=a.match(/^.*?(\r\n|\r|\n)/m);b?this.$autoNewLine=b[1]:this.$autoNewLine="\n"},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";case"auto":return this.$autoNewLine}},this.$autoNewLine="\n",this.$newLineMode="auto",this.setNewLineMode=function(a){if(this.$newLineMode===a)return;this.$newLineMode=a},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(a){return a=="\r\n"||a=="\r"||a=="\n"},this.getLine=function(a){return this.$lines[a]||""},this.getLines=function(a,b){return this.$lines.slice(a,b+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(a){if(a.start.row==a.end.row)return this.$lines[a.start.row].substring(a.start.column,a.end.column);var b=this.getLines(a.start.row+1,a.end.row-1);return b.unshift((this.$lines[a.start.row]||"").substring(a.start.column)),b.push((this.$lines[a.end.row]||"").substring(0,a.end.column)),b.join(this.getNewLineCharacter())},this.$clipPosition=function(a){var b=this.getLength();return a.row>=b&&(a.row=Math.max(0,b-1),a.column=this.getLine(b-1).length),a},this.insert=function(a,b){if(!b||b.length===0)return a;a=this.$clipPosition(a),this.getLength()<=1&&this.$detectNewLine(b);var c=this.$split(b),d=c.splice(0,1)[0],e=c.length==0?null:c.splice(c.length-1,1)[0];return a=this.insertInLine(a,d),e!==null&&(a=this.insertNewLine(a),a=this.insertLines(a.row,c),a=this.insertInLine(a,e||"")),a},this.insertLines=function(a,b){if(b.length==0)return{row:a,column:0};if(b.length>65535){var c=this.insertLines(a,b.slice(65535));b=b.slice(0,65535)}var d=[a,0];d.push.apply(d,b),this.$lines.splice.apply(this.$lines,d);var e=new f(a,0,a+b.length,0),g={action:"insertLines",range:e,lines:b};return this._emit("change",{data:g}),c||e.end},this.insertNewLine=function(a){a=this.$clipPosition(a);var b=this.$lines[a.row]||"";this.$lines[a.row]=b.substring(0,a.column),this.$lines.splice(a.row+1,0,b.substring(a.column,b.length));var c={row:a.row+1,column:0},d={action:"insertText",range:f.fromPoints(a,c),text:this.getNewLineCharacter()};return this._emit("change",{data:d}),c},this.insertInLine=function(a,b){if(b.length==0)return a;var c=this.$lines[a.row]||"";this.$lines[a.row]=c.substring(0,a.column)+b+c.substring(a.column);var d={row:a.row,column:a.column+b.length},e={action:"insertText",range:f.fromPoints(a,d),text:b};return this._emit("change",{data:e}),d},this.remove=function(a){a.start=this.$clipPosition(a.start),a.end=this.$clipPosition(a.end);if(a.isEmpty())return a.start;var b=a.start.row,c=a.end.row;if(a.isMultiLine()){var d=a.start.column==0?b:b+1,e=c-1;a.end.column>0&&this.removeInLine(c,0,a.end.column),e>=d&&this.removeLines(d,e),d!=b&&(this.removeInLine(b,a.start.column,this.getLine(b).length),this.removeNewLine(a.start.row))}else this.removeInLine(b,a.start.column,a.end.column);return a.start},this.removeInLine=function(a,b,c){if(b==c)return;var d=new f(a,b,a,c),e=this.getLine(a),g=e.substring(b,c),h=e.substring(0,b)+e.substring(c,e.length);this.$lines.splice(a,1,h);var i={action:"removeText",range:d,text:g};return this._emit("change",{data:i}),d.start},this.removeLines=function(a,b){var c=new f(a,0,b+1,0),d=this.$lines.splice(a,b-a+1),e={action:"removeLines",range:c,nl:this.getNewLineCharacter(),lines:d};return this._emit("change",{data:e}),d},this.removeNewLine=function(a){var b=this.getLine(a),c=this.getLine(a+1),d=new f(a,b.length,a+1,0),e=b+c;this.$lines.splice(a,2,e);var g={action:"removeText",range:d,text:this.getNewLineCharacter()};this._emit("change",{data:g})},this.replace=function(a,b){if(b.length==0&&a.isEmpty())return a.start;if(b==this.getTextRange(a))return a.end;this.remove(a);if(b)var c=this.insert(a.start,b);else c=a.start;return c},this.applyDeltas=function(a){for(var b=0;b<a.length;b++){var c=a[b],d=f.fromPoints(c.range.start,c.range.end);c.action=="insertLines"?this.insertLines(d.start.row,c.lines):c.action=="insertText"?this.insert(d.start,c.text):c.action=="removeLines"?this.removeLines(d.start.row,d.end.row-1):c.action=="removeText"&&this.remove(d)}},this.revertDeltas=function(a){for(var b=a.length-1;b>=0;b--){var c=a[b],d=f.fromPoints(c.range.start,c.range.end);c.action=="insertLines"?this.removeLines(d.start.row,d.end.row-1):c.action=="insertText"?this.remove(d):c.action=="removeLines"?this.insertLines(d.start.row,c.lines):c.action=="removeText"&&this.insert(d.start,c.text)}}}).call(h.prototype),b.Document=h}),define("ace/range",["require","exports","module"],function(a,b,c){var d=function(a,b,c,d){this.start={row:a,column:b},this.end={row:c,column:d}};(function(){this.isEqual=function(a){return this.start.row==a.start.row&&this.end.row==a.end.row&&this.start.column==a.start.column&&this.end.column==a.end.column},this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(a,b){return this.compare(a,b)==0},this.compareRange=function(a){var b,c=a.end,d=a.start;return b=this.compare(c.row,c.column),b==1?(b=this.compare(d.row,d.column),b==1?2:b==0?1:0):b==-1?-2:(b=this.compare(d.row,d.column),b==-1?-1:b==1?42:0)},this.comparePoint=function(a){return this.compare(a.row,a.column)},this.containsRange=function(a){return this.comparePoint(a.start)==0&&this.comparePoint(a.end)==0},this.intersects=function(a){var b=this.compareRange(a);return b==-1||b==0||b==1},this.isEnd=function(a,b){return this.end.row==a&&this.end.column==b},this.isStart=function(a,b){return this.start.row==a&&this.start.column==b},this.setStart=function(a,b){typeof a=="object"?(this.start.column=a.column,this.start.row=a.row):(this.start.row=a,this.start.column=b)},this.setEnd=function(a,b){typeof a=="object"?(this.end.column=a.column,this.end.row=a.row):(this.end.row=a,this.end.column=b)},this.inside=function(a,b){return this.compare(a,b)==0?this.isEnd(a,b)||this.isStart(a,b)?!1:!0:!1},this.insideStart=function(a,b){return this.compare(a,b)==0?this.isEnd(a,b)?!1:!0:!1},this.insideEnd=function(a,b){return this.compare(a,b)==0?this.isStart(a,b)?!1:!0:!1},this.compare=function(a,b){return!this.isMultiLine()&&a===this.start.row?b<this.start.column?-1:b>this.end.column?1:0:a<this.start.row?-1:a>this.end.row?1:this.start.row===a?b>=this.start.column?0:-1:this.end.row===a?b<=this.end.column?0:1:0},this.compareStart=function(a,b){return this.start.row==a&&this.start.column==b?-1:this.compare(a,b)},this.compareEnd=function(a,b){return this.end.row==a&&this.end.column==b?1:this.compare(a,b)},this.compareInside=function(a,b){return this.end.row==a&&this.end.column==b?1:this.start.row==a&&this.start.column==b?-1:this.compare(a,b)},this.clipRows=function(a,b){if(this.end.row>b)var c={row:b+1,column:0};if(this.start.row>b)var e={row:b+1,column:0};if(this.start.row<a)var e={row:a,column:0};if(this.end.row<a)var c={row:a,column:0};return d.fromPoints(e||this.start,c||this.end)},this.extend=function(a,b){var c=this.compare(a,b);if(c==0)return this;if(c==-1)var e={row:a,column:b};else var f={row:a,column:b};return d.fromPoints(e||this.start,f||this.end)},this.isEmpty=function(){return this.start.row==this.end.row&&this.start.column==this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return d.fromPoints(this.start,this.end)},this.collapseRows=function(){return this.end.column==0?new d(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new d(this.start.row,0,this.end.row,0)},this.toScreenRange=function(a){var b=a.documentToScreenPosition(this.start),c=a.documentToScreenPosition(this.end);return new d(b.row,b.column,c.row,c.column)}}).call(d.prototype),d.fromPoints=function(a,b){return new d(a.row,a.column,b.row,b.column)},b.Range=d}),define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(a,b,c){var d=a("./lib/oop"),e=a("./lib/event_emitter").EventEmitter,f=b.Anchor=function(a,b,c){this.document=a,typeof c=="undefined"?this.setPosition(b.row,b.column):this.setPosition(b,c),this.$onChange=this.onChange.bind(this),a.on("change",this.$onChange)};(function(){d.implement(this,e),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.onChange=function(a){var b=a.data,c=b.range;if(c.start.row==c.end.row&&c.start.row!=this.row)return;if(c.start.row>this.row)return;if(c.start.row==this.row&&c.start.column>this.column)return;var d=this.row,e=this.column;b.action==="insertText"?c.start.row===d&&c.start.column<=e?c.start.row===c.end.row?e+=c.end.column-c.start.column:(e-=c.start.column,d+=c.end.row-c.start.row):c.start.row!==c.end.row&&c.start.row<d&&(d+=c.end.row-c.start.row):b.action==="insertLines"?c.start.row<=d&&(d+=c.end.row-c.start.row):b.action=="removeText"?c.start.row==d&&c.start.column<e?c.end.column>=e?e=c.start.column:e=Math.max(0,e-(c.end.column-c.start.column)):c.start.row!==c.end.row&&c.start.row<d?(c.end.row==d&&(e=Math.max(0,e-c.end.column)+c.start.column),d-=c.end.row-c.start.row):c.end.row==d&&(d-=c.end.row-c.start.row,e=Math.max(0,e-c.end.column)+c.start.column):b.action=="removeLines"&&c.start.row<=d&&(c.end.row<=d?d-=c.end.row-c.start.row:(d=c.start.row,e=0)),this.setPosition(d,e,!0)},this.setPosition=function(a,b,c){var d;c?d={row:a,column:b}:d=this.$clipPositionToDocument(a,b);if(this.row==d.row&&this.column==d.column)return;var e={row:this.row,column:this.column};this.row=d.row,this.column=d.column,this._emit("change",{old:e,value:d})},this.detach=function(){this.document.removeEventListener("change",this.$onChange)},this.$clipPositionToDocument=function(a,b){var c={};return a>=this.document.getLength()?(c.row=Math.max(0,this.document.getLength()-1),c.column=this.document.getLine(c.row).length):a<0?(c.row=0,c.column=0):(c.row=a,c.column=Math.min(this.document.getLine(c.row).length,Math.max(0,b))),b<0&&(c.column=0),c}}).call(f.prototype)}),define("ace/lib/lang",["require","exports","module"],function(a,b,c){b.stringReverse=function(a){return a.split("").reverse().join("")},b.stringRepeat=function(a,b){return(new Array(b+1)).join(a)};var d=/^\s\s*/,e=/\s\s*$/;b.stringTrimLeft=function(a){return a.replace(d,"")},b.stringTrimRight=function(a){return a.replace(e,"")},b.copyObject=function(a){var b={};for(var c in a)b[c]=a[c];return b},b.copyArray=function(a){var b=[];for(var c=0,d=a.length;c<d;c++)a[c]&&typeof a[c]=="object"?b[c]=this.copyObject(a[c]):b[c]=a[c];return b},b.deepCopy=function(a){if(typeof a!="object")return a;var b=a.constructor();for(var c in a)typeof a[c]=="object"?b[c]=this.deepCopy(a[c]):b[c]=a[c];return b},b.arrayToMap=function(a){var b={};for(var c=0;c<a.length;c++)b[a[c]]=1;return b},b.createMap=function(a){var b=Object.create(null);for(var c in a)b[c]=a[c];return b},b.arrayRemove=function(a,b){for(var c=0;c<=a.length;c++)b===a[c]&&a.splice(c,1)},b.escapeRegExp=function(a){return a.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},b.getMatchOffsets=function(a,b){var c=[];return a.replace(b,function(a){c.push({offset:arguments[arguments.length-2],length:a.length})}),c},b.deferredCall=function(a){var b=null,c=function(){b=null,a()},d=function(a){return d.cancel(),b=setTimeout(c,a||0),d};return d.schedule=d,d.call=function(){return this.cancel(),a(),d},d.cancel=function(){return clearTimeout(b),b=null,d},d}}),define("ace/mode/css/csslint",["require","exports","module"],function(require,exports,module){function Reporter(a,b){this.messages=[],this.stats=[],this.lines=a,this.ruleset=b}var parserlib={};(function(){function a(){this._listeners={}}function b(a){this._input=a.replace(/\n\r?/g,"\n"),this._line=1,this._col=1,this._cursor=0}function c(a,b,c){this.col=c,this.line=b,this.message=a}function d(a,b,c,d){this.col=c,this.line=b,this.text=a,this.type=d}function e(a,c){this._reader=a?new b(a.toString()):null,this._token=null,this._tokenData=c,this._lt=[],this._ltIndex=0,this._ltIndexCache=[]}a.prototype={constructor:a,addListener:function(a,b){this._listeners[a]||(this._listeners[a]=[]),this._listeners[a].push(b)},fire:function(a){typeof a=="string"&&(a={type:a}),typeof a.target!="undefined"&&(a.target=this);if(typeof a.type=="undefined")throw new Error("Event object missing 'type' property.");if(this._listeners[a.type]){var b=this._listeners[a.type].concat();for(var c=0,d=b.length;c<d;c++)b[c].call(this,a)}},removeListener:function(a,b){if(this._listeners[a]){var c=this._listeners[a];for(var d=0,e=c.length;d<e;d++)if(c[d]===b){c.splice(d,1);break}}}},b.prototype={constructor:b,getCol:function(){return this._col},getLine:function(){return this._line},eof:function(){return this._cursor==this._input.length},peek:function(a){var b=null;return a=typeof a=="undefined"?1:a,this._cursor<this._input.length&&(b=this._input.charAt(this._cursor+a-1)),b},read:function(){var a=null;return this._cursor<this._input.length&&(this._input.charAt(this._cursor)=="\n"?(this._line++,this._col=1):this._col++,a=this._input.charAt(this._cursor++)),a},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(a){var b="",c;while(b.length<a.length||b.lastIndexOf(a)!=b.length-a.length){c=this.read();if(!c)throw new Error('Expected "'+a+'" at line '+this._line+", col "+this._col+".");b+=c}return b},readWhile:function(a){var b="",c=this.read();while(c!==null&&a(c))b+=c,c=this.read();return b},readMatch:function(a){var b=this._input.substring(this._cursor),c=null;return typeof a=="string"?b.indexOf(a)===0&&(c=this.readCount(a.length)):a instanceof RegExp&&a.test(b)&&(c=this.readCount(RegExp.lastMatch.length)),c},readCount:function(a){var b="";while(a--)b+=this.read();return b}},c.prototype=new Error,d.fromToken=function(a){return new d(a.value,a.startLine,a.startCol)},d.prototype={constructor:d,valueOf:function(){return this.toString()},toString:function(){return this.text}},e.createTokenData=function(a){var b=[],c={},d=a.concat([]),e=0,f=d.length+1;d.UNKNOWN=-1,d.unshift({name:"EOF"});for(;e<f;e++)b.push(d[e].name),d[d[e].name]=e,d[e].text&&(c[d[e].text]=e);return d.name=function(a){return b[a]},d.type=function(a){return c[a]},d},e.prototype={constructor:e,match:function(a,b){a instanceof Array||(a=[a]);var c=this.get(b),d=0,e=a.length;while(d<e)if(c==a[d++])return!0;return this.unget(),!1},mustMatch:function(a,b){var d;a instanceof Array||(a=[a]);if(!this.match.apply(this,arguments))throw d=this.LT(1),new c("Expected "+this._tokenData[a[0]].name+" at line "+d.startLine+", col "+d.startCol+".",d.startLine,d.startCol)},advance:function(a,b){while(this.LA(0)!==0&&!this.match(a,b))this.get();return this.LA(0)},get:function(a){var b=this._tokenData,c=this._reader,d,e=0,f=b.length,g=!1,h,i;if(this._lt.length&&this._ltIndex>=0&&this._ltIndex<this._lt.length){e++,this._token=this._lt[this._ltIndex++],i=b[this._token.type];while(i.channel!==undefined&&a!==i.channel&&this._ltIndex<this._lt.length)this._token=this._lt[this._ltIndex++],i=b[this._token.type],e++;if((i.channel===undefined||a===i.channel)&&this._ltIndex<=this._lt.length)return this._ltIndexCache.push(e),this._token.type}return h=this._getToken(),h.type>-1&&!b[h.type].hide&&(h.channel=b[h.type].channel,this._token=h,this._lt.push(h),this._ltIndexCache.push(this._lt.length-this._ltIndex+e),this._lt.length>5&&this._lt.shift(),this._ltIndexCache.length>5&&this._ltIndexCache.shift(),this._ltIndex=this._lt.length),i=b[h.type],i&&(i.hide||i.channel!==undefined&&a!==i.channel)?this.get(a):h.type},LA:function(a){var b=a,c;if(a>0){if(a>5)throw new Error("Too much lookahead.");while(b)c=this.get(),b--;while(b<a)this.unget(),b++}else if(a<0){if(!this._lt[this._ltIndex+a])throw new Error("Too much lookbehind.");c=this._lt[this._ltIndex+a].type}else c=this._token.type;return c},LT:function(a){return this.LA(a),this._lt[this._ltIndex+a-1]},peek:function(){return this.LA(1)},token:function(){return this._token},tokenName:function(a){return a<0||a>this._tokenData.length?"UNKNOWN_TOKEN":this._tokenData[a].name},tokenType:function(a){return this._tokenData[a]||-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:b,SyntaxError:c,SyntaxUnit:d,EventTarget:a,TokenStreamBase:e}})(),function(){function Combinator(a,b,c){SyntaxUnit.call(this,a,b,c,Parser.COMBINATOR_TYPE),this.type="unknown",/^\s+$/.test(a)?this.type="descendant":a==">"?this.type="child":a=="+"?this.type="adjacent-sibling":a=="~"&&(this.type="sibling")}function MediaFeature(a,b){SyntaxUnit.call(this,"("+a+(b!==null?":"+b:"")+")",a.startLine,a.startCol,Parser.MEDIA_FEATURE_TYPE),this.name=a,this.value=b}function MediaQuery(a,b,c,d,e){SyntaxUnit.call(this,(a?a+" ":"")+(b?b+" ":"")+c.join(" and "),d,e,Parser.MEDIA_QUERY_TYPE),this.modifier=a,this.mediaType=b,this.features=c}function Parser(a){EventTarget.call(this),this.options=a||{},this._tokenStream=null}function PropertyName(a,b,c,d){SyntaxUnit.call(this,a,c,d,Parser.PROPERTY_NAME_TYPE),this.hack=b}function PropertyValue(a,b,c){SyntaxUnit.call(this,a.join(" "),b,c,Parser.PROPERTY_VALUE_TYPE),this.parts=a}function PropertyValueIterator(a){this._i=0,this._parts=a.parts,this._marks=[],this.value=a}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":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,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)):(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=+RegExp.$1*255/100,this.green=+RegExp.$2*255/100,this.blue=+RegExp.$3*255/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=+RegExp.$1*255/100,this.green=+RegExp.$2*255/100,this.blue=+RegExp.$3*255/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(a,b,c){SyntaxUnit.call(this,a.join(" "),b,c,Parser.SELECTOR_TYPE),this.parts=a,this.specificity=Specificity.calculate(this)}function SelectorPart(a,b,c,d,e){SyntaxUnit.call(this,c,d,e,Parser.SELECTOR_PART_TYPE),this.elementName=a,this.modifiers=b}function SelectorSubPart(a,b,c,d){SyntaxUnit.call(this,a,c,d,Parser.SELECTOR_SUB_PART_TYPE),this.type=b,this.args=[]}function Specificity(a,b,c,d){this.a=a,this.b=b,this.c=c,this.d=d}function isHexDigit(a){return a!==null&&h.test(a)}function isDigit(a){return a!==null&&/\d/.test(a)}function isWhitespace(a){return a!==null&&/\s/.test(a)}function isNewLine(a){return a!==null&&nl.test(a)}function isNameStart(a){return a!==null&&/[a-z_\u0080-\uFFFF\\]/i.test(a)}function isNameChar(a){return a!==null&&(isNameStart(a)||/[0-9\-\\]/.test(a))}function isIdentStart(a){return a!==null&&(isNameStart(a)||/\-\\/.test(a))}function mix(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function TokenStream(a){TokenStreamBase.call(this,a,Tokens)}function ValidationError(a,b,c){this.col=c,this.line=b,this.message=a}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"};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 a=new EventTarget,b,c={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 a=this._tokenStream,b=null,c,d,e;this.fire("startstylesheet"),this._charset(),this._skipCruft();while(a.peek()==Tokens.IMPORT_SYM)this._import(),this._skipCruft();while(a.peek()==Tokens.NAMESPACE_SYM)this._namespace(),this._skipCruft();e=a.peek();while(e>Tokens.EOF){try{switch(e){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.UNKNOWN_SYM:a.get();if(!!this.options.strict)throw new SyntaxError("Unknown @ rule.",a.LT(0).startLine,a.LT(0).startCol);this.fire({type:"error",error:null,message:"Unknown @ rule: "+a.LT(0).value+".",line:a.LT(0).startLine,col:a.LT(0).startCol}),c=0;while(a.advance([Tokens.LBRACE,Tokens.RBRACE])==Tokens.LBRACE)c++;while(c)a.advance([Tokens.RBRACE]),c--;break;case Tokens.S:this._readWhitespace();break;default:if(!this._ruleset())switch(e){case Tokens.CHARSET_SYM:throw d=a.LT(1),this._charset(!1),new SyntaxError("@charset not allowed here.",d.startLine,d.startCol);case Tokens.IMPORT_SYM:throw d=a.LT(1),this._import(!1),new SyntaxError("@import not allowed here.",d.startLine,d.startCol);case Tokens.NAMESPACE_SYM:throw d=a.LT(1),this._namespace(!1),new SyntaxError("@namespace not allowed here.",d.startLine,d.startCol);default:a.get(),this._unexpectedToken(a.token())}}}catch(f){if(!(f instanceof SyntaxError&&!this.options.strict))throw f;this.fire({type:"error",error:f,message:f.message,line:f.line,col:f.col})}e=a.peek()}e!=Tokens.EOF&&this._unexpectedToken(a.token()),this.fire("endstylesheet")},_charset:function(a){var b=this._tokenStream,c,d,e,f;b.match(Tokens.CHARSET_SYM)&&(e=b.token().startLine,f=b.token().startCol,this._readWhitespace(),b.mustMatch(Tokens.STRING),d=b.token(),c=d.value,this._readWhitespace(),b.mustMatch(Tokens.SEMICOLON),a!==!1&&this.fire({type:"charset",charset:c,line:e,col:f}))},_import:function(a){var b=this._tokenStream,c,d,e,f=[];b.mustMatch(Tokens.IMPORT_SYM),e=b.token(),this._readWhitespace(),b.mustMatch([Tokens.STRING,Tokens.URI]),d=b.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/,"$1"),this._readWhitespace(),f=this._media_query_list(),b.mustMatch(Tokens.SEMICOLON),this._readWhitespace(),a!==!1&&this.fire({type:"import",uri:d,media:f,line:e.startLine,col:e.startCol})},_namespace:function(a){var b=this._tokenStream,c,d,e,f;b.mustMatch(Tokens.NAMESPACE_SYM),c=b.token().startLine,d=b.token().startCol,this._readWhitespace(),b.match(Tokens.IDENT)&&(e=b.token().value,this._readWhitespace()),b.mustMatch([Tokens.STRING,Tokens.URI]),f=b.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/,"$1"),this._readWhitespace(),b.mustMatch(Tokens.SEMICOLON),this._readWhitespace(),a!==!1&&this.fire({type:"namespace",prefix:e,uri:f,line:c,col:d})},_media:function(){var a=this._tokenStream,b,c,d;a.mustMatch(Tokens.MEDIA_SYM),b=a.token().startLine,c=a.token().startCol,this._readWhitespace(),d=this._media_query_list(),a.mustMatch(Tokens.LBRACE),this._readWhitespace(),this.fire({type:"startmedia",media:d,line:b,col:c});for(;;)if(a.peek()==Tokens.PAGE_SYM)this._page();else if(!this._ruleset())break;a.mustMatch(Tokens.RBRACE),this._readWhitespace(),this.fire({type:"endmedia",media:d,line:b,col:c})},_media_query_list:function(){var a=this._tokenStream,b=[];this._readWhitespace(),(a.peek()==Tokens.IDENT||a.peek()==Tokens.LPAREN)&&b.push(this._media_query());while(a.match(Tokens.COMMA))this._readWhitespace(),b.push(this._media_query());return b},_media_query:function(){var a=this._tokenStream,b=null,c=null,d=null,e=[];a.match(Tokens.IDENT)&&(c=a.token().value.toLowerCase(),c!="only"&&c!="not"?(a.unget(),c=null):d=a.token()),this._readWhitespace(),a.peek()==Tokens.IDENT?(b=this._media_type(),d===null&&(d=a.token())):a.peek()==Tokens.LPAREN&&(d===null&&(d=a.LT(1)),e.push(this._media_expression()));if(b===null&&e.length===0)return null;this._readWhitespace();while(a.match(Tokens.IDENT))a.token().value.toLowerCase()!="and"&&this._unexpectedToken(a.token()),this._readWhitespace(),e.push(this._media_expression());return new MediaQuery(c,b,e,d.startLine,d.startCol)},_media_type:function(){return this._media_feature()},_media_expression:function(){var a=this._tokenStream,b=null,c,d=null;return a.mustMatch(Tokens.LPAREN),b=this._media_feature(),this._readWhitespace(),a.match(Tokens.COLON)&&(this._readWhitespace(),c=a.LT(1),d=this._expression()),a.mustMatch(Tokens.RPAREN),this._readWhitespace(),new MediaFeature(b,d?new SyntaxUnit(d,c.startLine,c.startCol):null)},_media_feature:function(){var a=this._tokenStream;return a.mustMatch(Tokens.IDENT),SyntaxUnit.fromToken(a.token())},_page:function(){var a=this._tokenStream,b,c,d=null,e=null;a.mustMatch(Tokens.PAGE_SYM),b=a.token().startLine,c=a.token().startCol,this._readWhitespace(),a.match(Tokens.IDENT)&&(d=a.token().value,d.toLowerCase()==="auto"&&this._unexpectedToken(a.token())),a.peek()==Tokens.COLON&&(e=this._pseudo_page()),this._readWhitespace(),this.fire({type:"startpage",id:d,pseudo:e,line:b,col:c}),this._readDeclarations(!0,!0),this.fire({type:"endpage",id:d,pseudo:e,line:b,col:c})},_margin:function(){var a=this._tokenStream,b,c,d=this._margin_sym();return d?(b=a.token().startLine,c=a.token().startCol,this.fire({type:"startpagemargin",margin:d,line:b,col:c}),this._readDeclarations(!0),this.fire({type:"endpagemargin",margin:d,line:b,col:c}),!0):!1},_margin_sym:function(){var a=this._tokenStream;return a.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(a.token()):null},_pseudo_page:function(){var a=this._tokenStream;return a.mustMatch(Tokens.COLON),a.mustMatch(Tokens.IDENT),a.token().value},_font_face:function(){var a=this._tokenStream,b,c;a.mustMatch(Tokens.FONT_FACE_SYM),b=a.token().startLine,c=a.token().startCol,this._readWhitespace(),this.fire({type:"startfontface",line:b,col:c}),this._readDeclarations(!0),this.fire({type:"endfontface",line:b,col:c})},_operator:function(){var a=this._tokenStream,b=null;return a.match([Tokens.SLASH,Tokens.COMMA])&&(b=a.token(),this._readWhitespace()),b?PropertyValuePart.fromToken(b):null},_combinator:function(){var a=this._tokenStream,b=null,c;return a.match([Tokens.PLUS,Tokens.GREATER,Tokens.TILDE])&&(c=a.token(),b=new Combinator(c.value,c.startLine,c.startCol),this._readWhitespace()),b},_unary_operator:function(){var a=this._tokenStream;return a.match([Tokens.MINUS,Tokens.PLUS])?a.token().value:null},_property:function(){var a=this._tokenStream,b=null,c=null,d,e,f,g;return a.peek()==Tokens.STAR&&this.options.starHack&&(a.get(),e=a.token(),c=e.value,f=e.startLine,g=e.startCol),a.match(Tokens.IDENT)&&(e=a.token(),d=e.value,d.charAt(0)=="_"&&this.options.underscoreHack&&(c="_",d=d.substring(1)),b=new PropertyName(d,c,f||e.startLine,g||e.startCol),this._readWhitespace()),b},_ruleset:function(){var a=this._tokenStream,b,c;try{c=this._selectors_group()}catch(d){if(d instanceof SyntaxError&&!this.options.strict){this.fire({type:"error",error:d,message:d.message,line:d.line,col:d.col}),b=a.advance([Tokens.RBRACE]);if(b!=Tokens.RBRACE)throw d;return!0}throw d}return c&&(this.fire({type:"startrule",selectors:c,line:c[0].line,col:c[0].col}),this._readDeclarations(!0),this.fire({type:"endrule",selectors:c,line:c[0].line,col:c[0].col})),c},_selectors_group:function(){var a=this._tokenStream,b=[],c;c=this._selector();if(c!==null){b.push(c);while(a.match(Tokens.COMMA))this._readWhitespace(),c=this._selector(),c!==null?b.push(c):this._unexpectedToken(a.LT(1))}return b.length?b:null},_selector:function(){var a=this._tokenStream,b=[],c=null,d=null,e=null;c=this._simple_selector_sequence();if(c===null)return null;b.push(c);do{d=this._combinator();if(d!==null)b.push(d),c=this._simple_selector_sequence(),c===null?this._unexpectedToken(this.LT(1)):b.push(c);else{if(!this._readWhitespace())break;e=new Combinator(a.token().value,a.token().startLine,a.token().startCol),d=this._combinator(),c=this._simple_selector_sequence(),c===null?d!==null&&this._unexpectedToken(a.LT(1)):(d!==null?b.push(d):b.push(e),b.push(c))}}while(!0);return new Selector(b,b[0].line,b[0].col)},_simple_selector_sequence:function(){var a=this._tokenStream,b=null,c=[],d="",e=[function(){return a.match(Tokens.HASH)?new SelectorSubPart(a.token().value,"id",a.token().startLine,a.token().startCol):null},this._class,this._attrib,this._pseudo,this._negation],f=0,g=e.length,h=null,i=!1,j,k;j=a.LT(1).startLine,k=a.LT(1).startCol,b=this._type_selector(),b||(b=this._universal()),b!==null&&(d+=b);for(;;){if(a.peek()===Tokens.S)break;while(f<g&&h===null)h=e[f++].call(this);if(h===null){if(d==="")return null;break}f=0,c.push(h),d+=h.toString(),h=null}return d!==""?new SelectorPart(b,c,d,j,k):null},_type_selector:function(){var a=this._tokenStream,b=this._namespace_prefix(),c=this._element_name();return c?(b&&(c.text=b+c.text,c.col-=b.length),c):(b&&(a.unget(),b.length>1&&a.unget()),null)},_class:function(){var a=this._tokenStream,b;return a.match(Tokens.DOT)?(a.mustMatch(Tokens.IDENT),b=a.token(),new SelectorSubPart("."+b.value,"class",b.startLine,b.startCol-1)):null},_element_name:function(){var a=this._tokenStream,b;return a.match(Tokens.IDENT)?(b=a.token(),new SelectorSubPart(b.value,"elementName",b.startLine,b.startCol)):null},_namespace_prefix:function(){var a=this._tokenStream,b="";if(a.LA(1)===Tokens.PIPE||a.LA(2)===Tokens.PIPE)a.match([Tokens.IDENT,Tokens.STAR])&&(b+=a.token().value),a.mustMatch(Tokens.PIPE),b+="|";return b.length?b:null},_universal:function(){var a=this._tokenStream,b="",c;return c=this._namespace_prefix(),c&&(b+=c),a.match(Tokens.STAR)&&(b+="*"),b.length?b:null},_attrib:function(){var a=this._tokenStream,b=null,c,d;return a.match(Tokens.LBRACKET)?(d=a.token(),b=d.value,b+=this._readWhitespace(),c=this._namespace_prefix(),c&&(b+=c),a.mustMatch(Tokens.IDENT),b+=a.token().value,b+=this._readWhitespace(),a.match([Tokens.PREFIXMATCH,Tokens.SUFFIXMATCH,Tokens.SUBSTRINGMATCH,Tokens.EQUALS,Tokens.INCLUDES,Tokens.DASHMATCH])&&(b+=a.token().value,b+=this._readWhitespace(),a.mustMatch([Tokens.IDENT,Tokens.STRING]),b+=a.token().value,b+=this._readWhitespace()),a.mustMatch(Tokens.RBRACKET),new SelectorSubPart(b+"]","attribute",d.startLine,d.startCol)):null},_pseudo:function(){var a=this._tokenStream,b=null,c=":",d,e;return a.match(Tokens.COLON)&&(a.match(Tokens.COLON)&&(c+=":"),a.match(Tokens.IDENT)?(b=a.token().value,d=a.token().startLine,e=a.token().startCol-c.length):a.peek()==Tokens.FUNCTION&&(d=a.LT(1).startLine,e=a.LT(1).startCol-c.length,b=this._functional_pseudo()),b&&(b=new SelectorSubPart(c+b,"pseudo",d,e))),b},_functional_pseudo:function(){var a=this._tokenStream,b=null;return a.match(Tokens.FUNCTION)&&(b=a.token().value,b+=this._readWhitespace(),b+=this._expression(),a.mustMatch(Tokens.RPAREN),b+=")"),b},_expression:function(){var a=this._tokenStream,b="";while(a.match([Tokens.PLUS,Tokens.MINUS,Tokens.DIMENSION,Tokens.NUMBER,Tokens.STRING,Tokens.IDENT,Tokens.LENGTH,Tokens.FREQ,Tokens.ANGLE,Tokens.TIME,Tokens.RESOLUTION]))b+=a.token().value,b+=this._readWhitespace();return b.length?b:null},_negation:function(){var a=this._tokenStream,b,c,d="",e,f=null;return a.match(Tokens.NOT)&&(d=a.token().value,b=a.token().startLine,c=a.token().startCol,d+=this._readWhitespace(),e=this._negation_arg(),d+=e,d+=this._readWhitespace(),a.match(Tokens.RPAREN),d+=a.token().value,f=new SelectorSubPart(d,"not",b,c),f.args.push(e)),f},_negation_arg:function(){var a=this._tokenStream,b=[this._type_selector,this._universal,function(){return a.match(Tokens.HASH)?new SelectorSubPart(a.token().value,"id",a.token().startLine,a.token().startCol):null},this._class,this._attrib,this._pseudo],c=null,d=0,e=b.length,f,g,h,i;g=a.LT(1).startLine,h=a.LT(1).startCol;while(d<e&&c===null)c=b[d].call(this),d++;return c===null&&this._unexpectedToken(a.LT(1)),c.type=="elementName"?i=new SelectorPart(c,[],c.toString(),g,h):i=new SelectorPart(null,[c],c.toString(),g,h),i},_declaration:function(){var a=this._tokenStream,b=null,c=null,d=null,e=null,f=null;b=this._property();if(b!==null){a.mustMatch(Tokens.COLON),this._readWhitespace(),c=this._expr(),(!c||c.length===0)&&this._unexpectedToken(a.LT(1)),d=this._prio();try{this._validateProperty(b,c)}catch(g){f=g}return this.fire({type:"property",property:b,value:c,important:d,line:b.line,col:b.col,invalid:f}),!0}return!1},_prio:function(){var a=this._tokenStream,b=a.match(Tokens.IMPORTANT_SYM);return this._readWhitespace(),b},_expr:function(){var a=this._tokenStream,b=[],c=null,d=null;c=this._term();if(c!==null){b.push(c);do{d=this._operator(),d&&b.push(d),c=this._term();if(c===null)break;b.push(c)}while(!0)}return b.length>0?new PropertyValue(b,b[0].line,b[0].col):null},_term:function(){var a=this._tokenStream,b=null,c=null,d,e,f;return b=this._unary_operator(),b!==null&&(e=a.token().startLine,f=a.token().startCol),a.peek()==Tokens.IE_FUNCTION&&this.options.ieFilters?(c=this._ie_function(),b===null&&(e=a.token().startLine,f=a.token().startCol)):a.match([Tokens.NUMBER,Tokens.PERCENTAGE,Tokens.LENGTH,Tokens.ANGLE,Tokens.TIME,Tokens.FREQ,Tokens.STRING,Tokens.IDENT,Tokens.URI,Tokens.UNICODE_RANGE])?(c=a.token().value,b===null&&(e=a.token().startLine,f=a.token().startCol),this._readWhitespace()):(d=this._hexcolor(),d===null?(b===null&&(e=a.LT(1).startLine,f=a.LT(1).startCol),c===null&&(a.LA(3)==Tokens.EQUALS&&this.options.ieFilters?c=this._ie_function():c=this._function())):(c=d.value,b===null&&(e=d.startLine,f=d.startCol))),c!==null?new PropertyValuePart(b!==null?b+c:c,e,f):null},_function:function(){var a=this._tokenStream,b=null,c=null,d;if(a.match(Tokens.FUNCTION)){b=a.token().value,this._readWhitespace(),c=this._expr(),b+=c;if(this.options.ieFilters&&a.peek()==Tokens.EQUALS)do{this._readWhitespace()&&(b+=a.token().value),a.LA(0)==Tokens.COMMA&&(b+=a.token().value),a.match(Tokens.IDENT),b+=a.token().value,a.match(Tokens.EQUALS),b+=a.token().value,d=a.peek();while(d!=Tokens.COMMA&&d!=Tokens.S&&d!=Tokens.RPAREN)a.get(),b+=a.token().value,d=a.peek()}while(a.match([Tokens.COMMA,Tokens.S]));a.match(Tokens.RPAREN),b+=")",this._readWhitespace()}return b},_ie_function:function(){var a=this._tokenStream,b=null,c=null,d;if(a.match([Tokens.IE_FUNCTION,Tokens.FUNCTION])){b=a.token().value;do{this._readWhitespace()&&(b+=a.token().value),a.LA(0)==Tokens.COMMA&&(b+=a.token().value),a.match(Tokens.IDENT),b+=a.token().value,a.match(Tokens.EQUALS),b+=a.token().value,d=a.peek();while(d!=Tokens.COMMA&&d!=Tokens.S&&d!=Tokens.RPAREN)a.get(),b+=a.token().value,d=a.peek()}while(a.match([Tokens.COMMA,Tokens.S]));a.match(Tokens.RPAREN),b+=")",this._readWhitespace()}return b},_hexcolor:function(){var a=this._tokenStream,b=null,c;if(a.match(Tokens.HASH)){b=a.token(),c=b.value;if(!/#[a-f0-9]{3,6}/i.test(c))throw new SyntaxError("Expected a hex color but found '"+c+"' at line "+b.startLine+", col "+b.startCol+".",b.startLine,b.startCol);this._readWhitespace()}return b},_keyframes:function(){var a=this._tokenStream,b,c,d;a.mustMatch(Tokens.KEYFRAMES_SYM),this._readWhitespace(),d=this._keyframe_name(),this._readWhitespace(),a.mustMatch(Tokens.LBRACE),this.fire({type:"startkeyframes",name:d,line:d.line,col:d.col}),this._readWhitespace(),c=a.peek();while(c==Tokens.IDENT||c==Tokens.PERCENTAGE)this._keyframe_rule(),this._readWhitespace(),c=a.peek();this.fire({type:"endkeyframes",name:d,line:d.line,col:d.col}),this._readWhitespace(),a.mustMatch(Tokens.RBRACE)},_keyframe_name:function(){var a=this._tokenStream,b;return a.mustMatch([Tokens.IDENT,Tokens.STRING]),SyntaxUnit.fromToken(a.token())},_keyframe_rule:function(){var a=this._tokenStream,b,c=this._key_list();this.fire({type:"startkeyframerule",keys:c,line:c[0].line,col:c[0].col}),this._readDeclarations(!0),this.fire({type:"endkeyframerule",keys:c,line:c[0].line,col:c[0].col})},_key_list:function(){var a=this._tokenStream,b,c,d=[];d.push(this._key()),this._readWhitespace();while(a.match(Tokens.COMMA))this._readWhitespace(),d.push(this._key()),this._readWhitespace();return d},_key:function(){var a=this._tokenStream,b;if(a.match(Tokens.PERCENTAGE))return SyntaxUnit.fromToken(a.token());if(a.match(Tokens.IDENT)){b=a.token();if(/from|to/i.test(b.value))return SyntaxUnit.fromToken(b);a.unget()}this._unexpectedToken(a.LT(1))},_skipCruft:function(){while(this._tokenStream.match([Tokens.S,Tokens.CDO,Tokens.CDC]));},_readDeclarations:function(a,b){var c=this._tokenStream,d;this._readWhitespace(),a&&c.mustMatch(Tokens.LBRACE),this._readWhitespace();try{for(;;){if(!(c.match(Tokens.SEMICOLON)||b&&this._margin())){if(!this._declaration())break;if(!c.match(Tokens.SEMICOLON))break}this._readWhitespace()}c.mustMatch(Tokens.RBRACE),this._readWhitespace()}catch(e){if(!(e instanceof SyntaxError&&!this.options.strict))throw e;this.fire({type:"error",error:e,message:e.message,line:e.line,col:e.col}),d=c.advance([Tokens.SEMICOLON,Tokens.RBRACE]);if(d==Tokens.SEMICOLON)this._readDeclarations(!1,b);else if(d!=Tokens.RBRACE)throw e}},_readWhitespace:function(){var a=this._tokenStream,b="";while(a.match(Tokens.S))b+=a.token().value;return b},_unexpectedToken:function(a){throw new SyntaxError("Unexpected token '"+a.value+"' at line "+a.startLine+", col "+a.startCol+".",a.startLine,a.startCol)},_verifyEnd:function(){this._tokenStream.LA(1)!=Tokens.EOF&&this._unexpectedToken(this._tokenStream.LT(1))},_validateProperty:function(a,b){Validation.validate(a,b)},parse:function(a){this._tokenStream=new TokenStream(a,Tokens),this._stylesheet()},parseStyleSheet:function(a){return this.parse(a)},parseMediaQuery:function(a){this._tokenStream=new TokenStream(a,Tokens);var b=this._media_query();return this._verifyEnd(),b},parsePropertyValue:function(a){this._tokenStream=new TokenStream(a,Tokens),this._readWhitespace();var b=this._expr();return this._readWhitespace(),this._verifyEnd(),b},parseRule:function(a){this._tokenStream=new TokenStream(a,Tokens),this._readWhitespace();var b=this._ruleset();return this._readWhitespace(),this._verifyEnd(),b},parseSelector:function(a){this._tokenStream=new TokenStream(a,Tokens),this._readWhitespace();var b=this._selector();return this._readWhitespace(),this._verifyEnd(),b},parseStyleAttribute:function(a){a+="}",this._tokenStream=new TokenStream(a,Tokens),this._readDeclarations()}};for(b in c)c.hasOwnProperty(b)&&(a[b]=c[b]);return a}();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 | inherit",azimuth:function(a){var b="<angle> | leftwards | rightwards | inherit",c="left-side | far-left | left | center-left | center | center-right | right | far-right | right-side",d=!1,e=!1,f;ValidationTypes.isAny(a,b)||(ValidationTypes.isAny(a,"behind")&&(d=!0,e=!0),ValidationTypes.isAny(a,c)&&(e=!0,d||ValidationTypes.isAny(a,"behind")));if(a.hasNext())throw f=a.next(),e?new ValidationError("Expected end of value but found '"+f+"'.",f.line,f.col):new ValidationError("Expected (<'azimuth'>) but found '"+f+"'.",f.line,f.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>",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>","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(a){var b=!1,c="<number> | <percentage>",d=!1,e=0,f=4,g;ValidationTypes.isAny(a,"fill")&&(d=!0,b=!0);while(a.hasNext()&&e<f){b=ValidationTypes.isAny(a,c);if(!b)break;e++}d?b=!0:ValidationTypes.isAny(a,"fill");if(a.hasNext())throw g=a.next(),b?new ValidationError("Expected end of value but found '"+g+"'.",g.line,g.col):new ValidationError("Expected ([<number> | <percentage>]{1,4} && fill?) but found '"+g+"'.",g.line,g.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(a){var b=!1,c="<length> | <percentage>",d=!1,e=!1,f=0,g=8,h;while(a.hasNext()&&f<g){b=ValidationTypes.isAny(a,c);if(!b){if(!(a.peek()=="/"&&f>1&&!d))break;d=!0,g=f+5,a.next()}f++}if(a.hasNext())throw h=a.next(),b?new ValidationError("Expected end of value but found '"+h+"'.",h.line,h.col):new ValidationError("Expected (<'border-radius'>) but found '"+h+"'.",h.line,h.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(a){var b=!1,c;if(!ValidationTypes.isAny(a,"none"))Validation.multiProperty("<shadow>",a,!0,Infinity);else if(a.hasNext())throw c=a.next(),new ValidationError("Expected end of value but found '"+c+"'.",c.line,c.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","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,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-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":"<percentage> | <length> | baseline | sub | super | top | text-top | middle | bottom | text-bottom | inherit",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","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 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(a){return this.hasNext()?this._parts[this._i+(a||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(a){return new PropertyValuePart(a.value,a.startLine,a.startCol)};var Pseudos={":first-letter":1,":first-line":1,":before":1,":after":1};Pseudos.ELEMENT=1,Pseudos.CLASS=2,Pseudos.isElement=function(a){return a.indexOf("::")===0||Pseudos[a.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(a){var b=["a","b","c","d"],c,d;for(c=0,d=b.length;c<d;c++){if(this[b[c]]<a[b[c]])return-1;if(this[b[c]]>a[b[c]])return 1}return 0},valueOf:function(){return this.a*1e3+this.b*100+this.c*10+this.d},toString:function(){return this.a+","+this.b+","+this.c+","+this.d}},Specificity.calculate=function(a){function h(a){var b,c,d,i,j=a.elementName?a.elementName.text:"",k;j&&j.charAt(j.length-1)!="*"&&g++;for(b=0,d=a.modifiers.length;b<d;b++){k=a.modifiers[b];switch(k.type){case"class":case"attribute":f++;break;case"id":e++;break;case"pseudo":Pseudos.isElement(k.text)?g++:f++;break;case"not":for(c=0,i=k.args.length;c<i;c++)h(k.args[c])}}}var b,c,d,e=0,f=0,g=0;for(b=0,c=a.parts.length;b<c;b++)d=a.parts[b],d instanceof SelectorPart&&h(d);return new Specificity(0,e,f,g)};var h=/^[0-9a-fA-F]$/,nonascii=/^[\u0080-\uFFFF]$/,nl=/\n|\r\n|\r|\f/;TokenStream.prototype=mix(new TokenStreamBase,{_getToken:function(a){var b,c=this._reader,d=null,e=c.getLine(),f=c.getCol();b=c.read();while(b){switch(b){case"/":c.peek()=="*"?d=this.commentToken(b,e,f):d=this.charToken(b,e,f);break;case"|":case"~":case"^":case"$":case"*":c.peek()=="="?d=this.comparisonToken(b,e,f):d=this.charToken(b,e,f);break;case'"':case"'":d=this.stringToken(b,e,f);break;case"#":isNameChar(c.peek())?d=this.hashToken(b,e,f):d=this.charToken(b,e,f);break;case".":isDigit(c.peek())?d=this.numberToken(b,e,f):d=this.charToken(b,e,f);break;case"-":c.peek()=="-"?d=this.htmlCommentEndToken(b,e,f):isNameStart(c.peek())?d=this.identOrFunctionToken(b,e,f):d=this.charToken(b,e,f);break;case"!":d=this.importantToken(b,e,f);break;case"@":d=this.atRuleToken(b,e,f);break;case":":d=this.notToken(b,e,f);break;case"<":d=this.htmlCommentStartToken(b,e,f);break;case"U":case"u":if(c.peek()=="+"){d=this.unicodeRangeToken(b,e,f);break};default:isDigit(b)?d=this.numberToken(b,e,f):isWhitespace(b)?d=this.whitespaceToken(b,e,f):isIdentStart(b)?d=this.identOrFunctionToken(b,e,f):d=this.charToken(b,e,f)}break}return!d&&b===null&&(d=this.createToken(Tokens.EOF,null,e,f)),d},createToken:function(a,b,c,d,e){var f=this._reader;return e=e||{},{value:b,type:a,channel:e.channel,hide:e.hide||!1,startLine:c,startCol:d,endLine:f.getLine(),endCol:f.getCol()}},atRuleToken:function(a,b,c){var d=a,e=this._reader,f=Tokens.CHAR,g=!1,h,i;e.mark(),h=this.readName(),d=a+h,f=Tokens.type(d.toLowerCase());if(f==Tokens.CHAR||f==Tokens.UNKNOWN)d.length>1?f=Tokens.UNKNOWN_SYM:(f=Tokens.CHAR,d=a,e.reset());return this.createToken(f,d,b,c)},charToken:function(a,b,c){var d=Tokens.type(a);return d==-1&&(d=Tokens.CHAR),this.createToken(d,a,b,c)},commentToken:function(a,b,c){var d=this._reader,e=this.readComment(a);return this.createToken(Tokens.COMMENT,e,b,c)},comparisonToken:function(a,b,c){var d=this._reader,e=a+d.read(),f=Tokens.type(e)||Tokens.CHAR;return this.createToken(f,e,b,c)},hashToken:function(a,b,c){var d=this._reader,e=this.readName(a);return this.createToken(Tokens.HASH,e,b,c)},htmlCommentStartToken:function(a,b,c){var d=this._reader,e=a;return d.mark(),e+=d.readCount(3),e=="<!--"?this.createToken(Tokens.CDO,e,b,c):(d.reset(),this.charToken(a,b,c))},htmlCommentEndToken:function(a,b,c){var d=this._reader,e=a;return d.mark(),e+=d.readCount(2),e=="-->"?this.createToken(Tokens.CDC,e,b,c):(d.reset(),this.charToken(a,b,c))},identOrFunctionToken:function(a,b,c){var d=this._reader,e=this.readName(a),f=Tokens.IDENT;return d.peek()=="("?(e+=d.read(),e.toLowerCase()=="url("?(f=Tokens.URI,e=this.readURI(e),e.toLowerCase()=="url("&&(f=Tokens.FUNCTION)):f=Tokens.FUNCTION):d.peek()==":"&&e.toLowerCase()=="progid"&&(e+=d.readTo("("),f=Tokens.IE_FUNCTION),this.createToken(f,e,b,c)},importantToken:function(a,b,c){var d=this._reader,e=a,f=Tokens.CHAR,g,h;d.mark(),h=d.read();while(h){if(h=="/"){if(d.peek()!="*")break;g=this.readComment(h);if(g==="")break}else{if(!isWhitespace(h)){if(/i/i.test(h)){g=d.readCount(8),/mportant/i.test(g)&&(e+=h+g,f=Tokens.IMPORTANT_SYM);break}break}e+=h+this.readWhitespace()}h=d.read()}return f==Tokens.CHAR?(d.reset(),this.charToken(a,b,c)):this.createToken(f,e,b,c)},notToken:function(a,b,c){var d=this._reader,e=a;return d.mark(),e+=d.readCount(4),e.toLowerCase()==":not("?this.createToken(Tokens.NOT,e,b,c):(d.reset(),this.charToken(a,b,c))},numberToken:function(a,b,c){var d=this._reader,e=this.readNumber(a),f,g=Tokens.NUMBER,h=d.peek();return isIdentStart(h)?(f=this.readName(d.read()),e+=f,/^em$|^ex$|^px$|^gd$|^rem$|^vw$|^vh$|^vm$|^ch$|^cm$|^mm$|^in$|^pt$|^pc$/i.test(f)?g=Tokens.LENGTH:/^deg|^rad$|^grad$/i.test(f)?g=Tokens.ANGLE:/^ms$|^s$/i.test(f)?g=Tokens.TIME:/^hz$|^khz$/i.test(f)?g=Tokens.FREQ:/^dpi$|^dpcm$/i.test(f)?g=Tokens.RESOLUTION:g=Tokens.DIMENSION):h=="%"&&(e+=d.read(),g=Tokens.PERCENTAGE),this.createToken(g,e,b,c)},stringToken:function(a,b,c){var d=a,e=a,f=this._reader,g=a,h=Tokens.STRING,i=f.read();while(i){e+=i;if(i==d&&g!="\\")break;if(isNewLine(f.peek())&&i!="\\"){h=Tokens.INVALID;break}g=i,i=f.read()}return i===null&&(h=Tokens.INVALID),this.createToken(h,e,b,c)},unicodeRangeToken:function(a,b,c){var d=this._reader,e=a,f,g=Tokens.CHAR;return d.peek()=="+"&&(d.mark(),e+=d.read(),e+=this.readUnicodeRangePart(!0),e.length==2?d.reset():(g=Tokens.UNICODE_RANGE,e.indexOf("?")==-1&&d.peek()=="-"&&(d.mark(),f=d.read(),f+=this.readUnicodeRangePart(!1),f.length==1?d.reset():e+=f))),this.createToken(g,e,b,c)},whitespaceToken:function(a,b,c){var d=this._reader,e=a+this.readWhitespace();return this.createToken(Tokens.S,e,b,c)},readUnicodeRangePart:function(a){var b=this._reader,c="",d=b.peek();while(isHexDigit(d)&&c.length<6)b.read(),c+=d,d=b.peek();if(a)while(d=="?"&&c.length<6)b.read(),c+=d,d=b.peek();return c},readWhitespace:function(){var a=this._reader,b="",c=a.peek();while(isWhitespace(c))a.read(),b+=c,c=a.peek();return b},readNumber:function(a){var b=this._reader,c=a,d=a==".",e=b.peek();while(e){if(isDigit(e))c+=b.read();else{if(e!=".")break;if(d)break;d=!0,c+=b.read()}e=b.peek()}return c},readString:function(){var a=this._reader,b=a.read(),c=b,d=b,e=a.peek();while(e){e=a.read(),c+=e;if(e==b&&d!="\\")break;if(isNewLine(a.peek())&&e!="\\"){c="";break}d=e,e=a.peek()}return e===null&&(c=""),c},readURI:function(a){var b=this._reader,c=a,d="",e=b.peek();b.mark();while(e&&isWhitespace(e))b.read(),e=b.peek();e=="'"||e=='"'?d=this.readString():d=this.readURL(),e=b.peek();while(e&&isWhitespace(e))b.read(),e=b.peek();return d===""||e!=")"?(c=a,b.reset()):c+=d+b.read(),c},readURL:function(){var a=this._reader,b="",c=a.peek();while(/^[!#$%&\\*-~]$/.test(c))b+=a.read(),c=a.peek();return b},readName:function(a){var b=this._reader,c=a||"",d=b.peek();for(;;)if(d=="\\")c+=this.readEscape(b.read()),d=b.peek();else{if(!d||!isNameChar(d))break;c+=b.read(),d=b.peek()}return c},readEscape:function(a){var b=this._reader,c=a||"",d=0,e=b.peek();if(isHexDigit(e))do c+=b.read(),e=b.peek();while(e&&isHexDigit(e)&&++d<6);return c.length==3&&/\s/.test(e)||c.length==7||c.length==1?b.read():e="",c+e},readComment:function(a){var b=this._reader,c=a||"",d=b.read();if(d=="*"){while(d){c+=d;if(c.length>2&&d=="*"&&b.peek()=="/"){c+=b.read();break}d=b.read()}return c}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:"UNKNOWN_SYM"},{name:"KEYFRAMES_SYM",text:["@keyframes","@-webkit-keyframes","@-moz-keyframes","@-ms-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 a=[],b={};Tokens.UNKNOWN=-1,Tokens.unshift({name:"EOF"});for(var c=0,d=Tokens.length;c<d;c++){a.push(Tokens[c].name),Tokens[Tokens[c].name]=c;if(Tokens[c].text)if(Tokens[c].text instanceof Array)for(var e=0;e<Tokens[c].text.length;e++)b[Tokens[c].text[e]]=c;else b[Tokens[c].text]=c}Tokens.name=function(b){return a[b]},Tokens.type=function(a){return b[a]||-1}})();var Validation={validate:function(a,b){var c=a.toString().toLowerCase(),d=b.parts,e=new PropertyValueIterator(b),f=Properties[c],g,h,i,j,k,l,m,n,o,p,q;if(!f){if(c.indexOf("-")!==0)throw new ValidationError("Unknown property '"+a+"'.",a.line,a.col)}else typeof f!="number"&&(typeof f=="string"?f.indexOf("||")>-1?this.groupProperty(f,e):this.singleProperty(f,e,1):f.multi?this.multiProperty(f.multi,e,f.comma,f.max||Infinity):typeof f=="function"&&f(e))},singleProperty:function(a,b,c,d){var e=!1,f=b.value,g=0,h;while(b.hasNext()&&g<c){e=ValidationTypes.isAny(b,a);if(!e)break;g++}if(!e)throw b.hasNext()&&!b.isFirst()?(h=b.peek(),new ValidationError("Expected end of value but found '"+h+"'.",h.line,h.col)):new ValidationError("Expected ("+a+") but found '"+f+"'.",f.line,f.col);if(b.hasNext())throw h=b.next(),new ValidationError("Expected end of value but found '"+h+"'.",h.line,h.col)},multiProperty:function(a,b,c,d){var e=!1,f=b.value,g=0,h=!1,i;while(b.hasNext()&&!e&&g<d){if(!ValidationTypes.isAny(b,a))break;g++;if(!b.hasNext())e=!0;else if(c){if(b.peek()!=",")break;i=b.next()}}if(!e)throw b.hasNext()&&!b.isFirst()?(i=b.peek(),new ValidationError("Expected end of value but found '"+i+"'.",i.line,i.col)):(i=b.previous(),c&&i==","?new ValidationError("Expected end of value but found '"+i+"'.",i.line,i.col):new ValidationError("Expected ("+a+") but found '"+f+"'.",f.line,f.col));if(b.hasNext())throw i=b.next(),new ValidationError("Expected end of value but found '"+i+"'.",i.line,i.col)},groupProperty:function(a,b,c){var d=!1,e=b.value,f=a.split("||").length,g={count:0},h=!1,i,j;while(b.hasNext()&&!d){i=ValidationTypes.isAnyOfGroup(b,a);if(!i)break;if(g[i])break;g[i]=1,g.count++,h=!0;if(g.count==f||!b.hasNext())d=!0}if(!d)throw h&&b.hasNext()?(j=b.peek(),new ValidationError("Expected end of value but found '"+j+"'.",j.line,j.col)):new ValidationError("Expected ("+a+") but found '"+e+"'.",e.line,e.col);if(b.hasNext())throw j=b.next(),new ValidationError("Expected end of value but found '"+j+"'.",j.line,j.col)}};ValidationError.prototype=new Error;var ValidationTypes={isLiteral:function(a,b){var c=a.text.toString().toLowerCase(),d=b.split(" | "),e,f,g=!1;for(e=0,f=d.length;e<f&&!g;e++)c==d[e]&&(g=!0);return g},isSimple:function(a){return!!this.simple[a]},isComplex:function(a){return!!this.complex[a]},isAny:function(a,b){var c=b.split(" | "),d,e,f=!1;for(d=0,e=c.length;d<e&&!f&&a.hasNext();d++)f=this.isType(a,c[d]);return f},isAnyOfGroup:function(a,b){var c=b.split(" || "),d,e,f=!1;for(d=0,e=c.length;d<e&&!f;d++)f=this.isType(a,c[d]);return f?c[d-1]:!1},isType:function(a,b){var c=a.peek(),d=!1;return b.charAt(0)!="<"?(d=this.isLiteral(c,b),d&&a.next()):this.simple[b]?(d=this.simple[b](c),d&&a.next()):d=this.complex[b](a),d},simple:{"<absolute-size>":function(a){return ValidationTypes.isLiteral(a,"xx-small | x-small | small | medium | large | x-large | xx-large")},"<attachment>":function(a){return ValidationTypes.isLiteral(a,"scroll | fixed | local")},"<attr>":function(a){return a.type=="function"&&a.name=="attr"},"<bg-image>":function(a){return this["<image>"](a)||this["<gradient>"](a)||a=="none"},"<gradient>":function(a){return a.type=="function"&&/^(?:\-(?:ms|moz|o|webkit)\-)?(?:repeating\-)?(?:radial|linear)\-gradient/i.test(a)},"<box>":function(a){return ValidationTypes.isLiteral(a,"padding-box | border-box | content-box")},"<content>":function(a){return a.type=="function"&&a.name=="content"},"<relative-size>":function(a){return ValidationTypes.isLiteral(a,"smaller | larger")},"<ident>":function(a){return a.type=="identifier"},"<length>":function(a){return a.type=="length"||a.type=="number"||a.type=="integer"||a=="0"},"<color>":function(a){return a.type=="color"||a=="transparent"},"<number>":function(a){return a.type=="number"||this["<integer>"](a)},"<integer>":function(a){return a.type=="integer"},"<line>":function(a){return a.type=="integer"},"<angle>":function(a){return a.type=="angle"},"<uri>":function(a){return a.type=="uri"},"<image>":function(a){return this["<uri>"](a)},"<percentage>":function(a){return a.type=="percentage"||a=="0"},"<border-width>":function(a){return this["<length>"](a)||ValidationTypes.isLiteral(a,"thin | medium | thick")},"<border-style>":function(a){return ValidationTypes.isLiteral(a,"none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset")},"<margin-width>":function(a){return this["<length>"](a)||this["<percentage>"](a)||ValidationTypes.isLiteral(a,"auto")},"<padding-width>":function(a){return this["<length>"](a)||this["<percentage>"](a)},"<shape>":function(a){return a.type=="function"&&(a.name=="rect"||a.name=="inset-rect")},"<time>":function(a){return a.type=="time"}},complex:{"<bg-position>":function(a){var b=this,c=!1,d="<percentage> | <length>",e="left | center | right",f="top | center | bottom",g,h,i;return ValidationTypes.isAny(a,"top | bottom")?c=!0:ValidationTypes.isAny(a,d)?a.hasNext()&&(c=ValidationTypes.isAny(a,d+" | "+f)):ValidationTypes.isAny(a,e)&&a.hasNext()&&(ValidationTypes.isAny(a,f)?(c=!0,ValidationTypes.isAny(a,d)):ValidationTypes.isAny(a,d)&&(ValidationTypes.isAny(a,f)&&ValidationTypes.isAny(a,d),c=!0)),c},"<bg-size>":function(a){var b=this,c=!1,d="<percentage> | <length> | auto",e,f,g;return ValidationTypes.isAny(a,"cover | contain")?c=!0:ValidationTypes.isAny(a,d)&&(c=!0,ValidationTypes.isAny(a,d)),c},"<repeat-style>":function(a){var b=!1,c="repeat | space | round | no-repeat",d;return a.hasNext()&&(d=a.next(),ValidationTypes.isLiteral(d,"repeat-x | repeat-y")?b=!0:ValidationTypes.isLiteral(d,c)&&(b=!0,a.hasNext()&&ValidationTypes.isLiteral(a.peek(),c)&&a.next())),b},"<shadow>":function(a){var b=!1,c=0,d=!1,e=!1,f;if(a.hasNext()){ValidationTypes.isAny(a,"inset")&&(d=!0),ValidationTypes.isAny(a,"<color>")&&(e=!0);while(ValidationTypes.isAny(a,"<length>")&&c<4)c++;a.hasNext()&&(e||ValidationTypes.isAny(a,"<color>"),d||ValidationTypes.isAny(a,"inset")),b=c>=2&&c<=4}return b},"<x-one-radius>":function(a){var b=!1,c=0,d="<length> | <percentage>",e;return ValidationTypes.isAny(a,d)&&(b=!0,ValidationTypes.isAny(a,d)),b}}};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}}();var CSSLint=function(){var a=[],b=[],c=new parserlib.util.EventTarget;return c.version="0.9.7",c.addRule=function(b){a.push(b),a[b.id]=b},c.clearRules=function(){a=[]},c.getRules=function(){return[].concat(a).sort(function(a,b){return a.id>b.id?1:0})},c.addFormatter=function(a){b[a.id]=a},c.getFormatter=function(a){return b[a]},c.format=function(a,b,c,d){var e=this.getFormatter(c),f=null;return e&&(f=e.startFormat(),f+=e.formatResults(a,b,d||{}),f+=e.endFormat()),f},c.hasFormat=function(a){return b.hasOwnProperty(a)},c.verify=function(b,c){var d=0,e=a.length,f,g,h,i=new parserlib.css.Parser({starHack:!0,ieFilters:!0,underscoreHack:!0,strict:!1});g=b.replace(/\n\r?/g,"$split$").split("$split$");if(!c){c={};while(d<e)c[a[d++].id]=1}f=new Reporter(g,c),c.errors=2;for(d in c)c.hasOwnProperty(d)&&a[d]&&a[d].init(i,f);try{i.parse(b)}catch(j){f.error("Fatal error, cannot continue: "+j.message,j.line,j.col,{})}return h={messages:f.messages,stats:f.stats},h.messages.sort(function(a,b){return a.rollup&&!b.rollup?1:!a.rollup&&b.rollup?-1:a.line-b.line}),h},c}();Reporter.prototype={constructor:Reporter,error:function(a,b,c,d){this.messages.push({type:"error",line:b,col:c,message:a,evidence:this.lines[b-1],rule:d||{}})},warn:function(a,b,c,d){this.report(a,b,c,d)},report:function(a,b,c,d){this.messages.push({type:this.ruleset[d.id]==2?"error":"warning",line:b,col:c,message:a,evidence:this.lines[b-1],rule:d})},info:function(a,b,c,d){this.messages.push({type:"info",line:b,col:c,message:a,evidence:this.lines[b-1],rule:d})},rollupError:function(a,b){this.messages.push({type:"error",rollup:!0,message:a,rule:b})},rollupWarn:function(a,b){this.messages.push({type:"warning",rollup:!0,message:a,rule:b})},stat:function(a,b){this.stats[a]=b}},CSSLint._Reporter=Reporter,CSSLint.Util={mix:function(a,b){var c;for(c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return c},indexOf:function(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},forEach:function(a,b){if(a.forEach)return a.forEach(b);for(var c=0,d=a.length;c<d;c++)b(a[c],c,a)}},CSSLint.addRule({id:"adjoining-classes",name:"Disallow adjoining classes",desc:"Don't use adjoining classes.",browsers:"IE6",init:function(a,b){var c=this;a.addListener("startrule",function(d){var e=d.selectors,f,g,h,i,j,k,l;for(j=0;j<e.length;j++){f=e[j];for(k=0;k<f.parts.length;k++){g=f.parts[k];if(g.type==a.SELECTOR_PART_TYPE){i=0;for(l=0;l<g.modifiers.length;l++)h=g.modifiers[l],h.type=="class"&&i++,i>1&&b.report("Don't use adjoining classes.",g.line,g.col,c)}}}})}}),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(a,b){function g(){f={}}function h(){var a;if(f.height)for(a in e)e.hasOwnProperty(a)&&f[a]&&(a!="padding"||f[a].value.parts.length!==2||f[a].value.parts[0].value!==0)&&b.report("Using height with "+a+" can sometimes make elements larger than you expect.",f[a].line,f[a].col,c);if(f.width)for(a in d)d.hasOwnProperty(a)&&f[a]&&(a!="padding"||f[a].value.parts.length!==2||f[a].value.parts[1].value!==0)&&b.report("Using width with "+a+" can sometimes make elements larger than you expect.",f[a].line,f[a].col,c)}var c=this,d={border:1,"border-left":1,"border-right":1,padding:1,"padding-left":1,"padding-right":1},e={border:1,"border-bottom":1,"border-top":1,padding:1,"padding-bottom":1,"padding-top":1},f;a.addListener("startrule",g),a.addListener("startfontface",g),a.addListener("startpage",g),a.addListener("startpagemargin",g),a.addListener("startkeyframerule",g),a.addListener("property",function(a){var b=a.property.text.toLowerCase();if(e[b]||d[b])!/^0\S*$/.test(a.value)&&(b!="border"||a.value!="none")&&(f[b]={line:a.property.line,col:a.property.col,value:a.value});else if(b=="width"||b=="height")f[b]=1}),a.addListener("endrule",h),a.addListener("endfontface",h),a.addListener("endpage",h),a.addListener("endpagemargin",h),a.addListener("endkeyframerule",h)}}),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(a,b){var c=this;a.addListener("property",function(a){var d=a.property.text.toLowerCase();d=="box-sizing"&&b.report("The box-sizing property isn't supported in IE6 and IE7.",a.line,a.col,c)})}}),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(a,b){var c=this,d,e,f,g,h,i,j,k=Array.prototype.push,l=[];d={animation:"webkit moz ms","animation-delay":"webkit moz ms","animation-direction":"webkit moz ms","animation-duration":"webkit moz ms","animation-fill-mode":"webkit moz ms","animation-iteration-count":"webkit moz ms","animation-name":"webkit moz ms","animation-play-state":"webkit moz ms","animation-timing-function":"webkit moz ms",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 moz","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 ms","transition-delay":"webkit moz o ms","transition-duration":"webkit moz o ms","transition-property":"webkit moz o ms","transition-timing-function":"webkit moz o ms","user-modify":"webkit moz","user-select":"webkit moz ms","word-break":"epub ms","writing-mode":"epub ms"};for(f in d)if(d.hasOwnProperty(f)){g=[],h=d[f].split(" ");for(i=0,j=h.length;i<j;i++)g.push("-"+h[i]+"-"+f);d[f]=g,k.apply(l,g)}a.addListener("startrule",function(){e=[]}),a.addListener("property",function(a){var b=a.property;CSSLint.Util.indexOf(l,b.text)>-1&&e.push(b)}),a.addListener("endrule",function(a){if(!e.length)return;var f={},g,h,i,j,k,l,m,n,o,p;for(g=0,h=e.length;g<h;g++){i=e[g];for(j in d)d.hasOwnProperty(j)&&(k=d[j],CSSLint.Util.indexOf(k,i.text)>-1&&(f[j]||(f[j]={full:k.slice(0),actual:[],actualNodes:[]}),CSSLint.Util.indexOf(f[j].actual,i.text)===-1&&(f[j].actual.push(i.text),f[j].actualNodes.push(i))))}for(j in f)if(f.hasOwnProperty(j)){l=f[j],m=l.full,n=l.actual;if(m.length>n.length)for(g=0,h=m.length;g<h;g++)o=m[g],CSSLint.Util.indexOf(n,o)===-1&&(p=n.length===1?n[0]:n.length==2?n.join(" and "):n.join(", "),b.report("The property "+o+" is compatible with "+p+" and should be included as well.",l.actualNodes[0].line,l.actualNodes[0].col,c))}})}}),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(a,b){function f(a,f,g){e[a]&&(typeof d[a]!="string"||e[a].value.toLowerCase()!=d[a])&&b.report(g||a+" can't be used with display: "+f+".",e[a].line,e[a].col,c)}function g(){e={}}function h(){var a=e.display?e.display.value:null;if(a)switch(a){case"inline":f("height",a),f("width",a),f("margin",a),f("margin-top",a),f("margin-bottom",a),f("float",a,"display:inline has no effect on floated elements (but may be used to fix the IE6 double-margin bug).");break;case"block":f("vertical-align",a);break;case"inline-block":f("float",a);break;default:a.indexOf("table-")===0&&(f("margin",a),f("margin-left",a),f("margin-right",a),f("margin-top",a),f("margin-bottom",a),f("float",a))}}var c=this,d={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;a.addListener("startrule",g),a.addListener("startfontface",g),a.addListener("startkeyframerule",g),a.addListener("startpagemargin",g),a.addListener("startpage",g),a.addListener("property",function(a){var b=a.property.text.toLowerCase();d[b]&&(e[b]={value:a.value.text,line:a.property.line,col:a.property.col})}),a.addListener("endrule",h),a.addListener("endfontface",h),a.addListener("endkeyframerule",h),a.addListener("endpagemargin",h),a.addListener("endpage",h)}}),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(a,b){var c=this,d={};a.addListener("property",function(a){var e=a.property.text,f=a.value,g,h;if(e.match(/background/i))for(g=0,h=f.parts.length;g<h;g++)f.parts[g].type=="uri"&&(typeof d[f.parts[g].uri]=="undefined"?d[f.parts[g].uri]=a:b.report("Background image '"+f.parts[g].uri+"' was used multiple times, first declared at line "+d[f.parts[g].uri].line+", col "+d[f.parts[g].uri].col+".",a.line,a.col,c))})}}),CSSLint.addRule({id:"duplicate-properties",name:"Disallow duplicate properties",desc:"Duplicate properties must appear one after the other.",browsers:"All",init:function(a,b){function f(a){d={}}var c=this,d,e;a.addListener("startrule",f),a.addListener("startfontface",f),a.addListener("startpage",f),a.addListener("startpagemargin",f),a.addListener("startkeyframerule",f),a.addListener("property",function(a){var f=a.property,g=f.text.toLowerCase();d[g]&&(e!=g||d[g]==a.value.text)&&b.report("Duplicate property '"+a.property+"' found.",a.line,a.col,c),d[g]=a.value.text,e=g})}}),CSSLint.addRule({id:"empty-rules",name:"Disallow empty rules",desc:"Rules without any properties specified should be removed.",browsers:"All",init:function(a,b){var c=this,d=0;a.addListener("startrule",function(){d=0}),a.addListener("property",function(){d++}),a.addListener("endrule",function(a){var e=a.selectors;d===0&&b.report("Rule is empty.",e[0].line,e[0].col,c)})}}),CSSLint.addRule({id:"errors",name:"Parsing Errors",desc:"This rule looks for recoverable syntax errors.",browsers:"All",init:function(a,b){var c=this;a.addListener("error",function(a){b.error(a.message,a.line,a.col,c)})}}),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(a,b){function g(a){f={},d=null}var c=this,d,e={color:1,background:1,"background-color":1},f;a.addListener("startrule",g),a.addListener("startfontface",g),a.addListener("startpage",g),a.addListener("startpagemargin",g),a.addListener("startkeyframerule",g),a.addListener("property",function(a){var f=a.property,g=f.text.toLowerCase(),h=a.value.parts,i=0,j="",k=h.length;if(e[g])while(i<k)h[i].type=="color"&&("alpha"in h[i]||"hue"in h[i]?(/([^\)]+)\(/.test(h[i])&&(j=RegExp.$1.toUpperCase()),(!d||d.property.text.toLowerCase()!=g||d.colorType!="compat")&&b.report("Fallback "+g+" (hex or RGB) should precede "+j+" "+g+".",a.line,a.col,c)):a.colorType="compat"),i++;d=a})}}),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(a,b){var c=this,d=0;a.addListener("property",function(a){a.property.text.toLowerCase()=="float"&&a.value.text.toLowerCase()!="none"&&d++}),a.addListener("endstylesheet",function(){b.stat("floats",d),d>=10&&b.rollupWarn("Too many floats ("+d+"), you're probably using them for layout. Consider using a grid system instead.",c)})}}),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(a,b){var c=this,d=0;a.addListener("startfontface",function(){d++}),a.addListener("endstylesheet",function(){d>5&&b.rollupWarn("Too many @font-face declarations ("+d+").",c)})}}),CSSLint.addRule({id:"font-sizes",name:"Disallow too many font sizes",desc:"Checks the number of font-size declarations.",browsers:"All",init:function(a,b){var c=this,d=0;a.addListener("property",function(a){a.property=="font-size"&&d++}),a.addListener("endstylesheet",function(){b.stat("font-sizes",d),d>=10&&b.rollupWarn("Too many font-size declarations ("+d+"), abstraction needed.",c)})}}),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(a,b){var c=this,d;a.addListener("startrule",function(){d={moz:0,webkit:0,oldWebkit:0,ms:0,o:0}}),a.addListener("property",function(a){/\-(moz|ms|o|webkit)(?:\-(?:linear|radial))\-gradient/i.test(a.value)?d[RegExp.$1]=1:/\-webkit\-gradient/i.test(a.value)&&(d.oldWebkit=1)}),a.addListener("endrule",function(a){var e=[];d.moz||e.push("Firefox 3.6+"),d.webkit||e.push("Webkit (Safari 5+, Chrome)"),d.oldWebkit||e.push("Old Webkit (Safari 4+, Chrome)"),d.ms||e.push("Internet Explorer 10+"),d.o||e.push("Opera 11.1+"),e.length&&e.length<5&&b.report("Missing vendor-prefixed CSS gradients for "+e.join(", ")+".",a.selectors[0].line,a.selectors[0].col,c)})}}),CSSLint.addRule({id:"ids",name:"Disallow IDs in selectors",desc:"Selectors should not contain IDs.",browsers:"All",init:function(a,b){var c=this;a.addListener("startrule",function(d){var e=d.selectors,f,g,h,i,j,k,l;for(j=0;j<e.length;j++){f=e[j],i=0;for(k=0;k<f.parts.length;k++){g=f.parts[k];if(g.type==a.SELECTOR_PART_TYPE)for(l=0;l<g.modifiers.length;l++)h=g.modifiers[l],h.type=="id"&&i++}i==1?b.report("Don't use IDs in selectors.",f.line,f.col,c):i>1&&b.report(i+" IDs in the selector, really?",f.line,f.col,c)}})}}),CSSLint.addRule({id:"import",name:"Disallow @import",desc:"Don't use @import, use <link> instead.",browsers:"All",init:function(a,b){var c=this;a.addListener("import",function(a){b.report("@import prevents parallel downloads, use <link> instead.",a.line,a.col,c)})}}),CSSLint.addRule({id:"important",name:"Disallow !important",desc:"Be careful when using !important declaration",browsers:"All",init:function(a,b){var c=this,d=0;a.addListener("property",function(a){a.important===!0&&(d++,b.report("Use of !important",a.line,a.col,c))}),a.addListener("endstylesheet",function(){b.stat("important",d),d>=10&&b.rollupWarn("Too many !important declarations ("+d+"), try to use less than 10 to avoid specifity issues.",c)})}}),CSSLint.addRule({id:"known-properties",name:"Require use of known properties",desc:"Properties should be known (listed in CSS specification) or be a vendor-prefixed property.",browsers:"All",init:function(a,b){var c=this,d={"alignment-adjust":1,"alignment-baseline":1,animation:1,"animation-delay":1,"animation-direction":1,"animation-duration":1,"animation-fill-mode":1,"animation-iteration-count":1,"animation-name":1,"animation-play-state":1,"animation-timing-function":1,appearance:1,azimuth:1,"backface-visibility":1,background:1,"background-attachment":1,"background-break":1,"background-clip":1,"background-color":1,"background-image":1,"background-origin":1,"background-position":1,"background-repeat":1,"background-size":1,"baseline-shift":1,binding:1,bleed:1,"bookmark-label":1,"bookmark-level":1,"bookmark-state":1,"bookmark-target":1,border:1,"border-bottom":1,"border-bottom-color":1,"border-bottom-left-radius":1,"border-bottom-right-radius":1,"border-bottom-style":1,"border-bottom-width":1,"border-collapse":1,"border-color":1,"border-image":1,"border-image-outset":1,"border-image-repeat":1,"border-image-slice":1,"border-image-source":1,"border-image-width":1,"border-left":1,"border-left-color":1,"border-left-style":1,"border-left-width":1,"border-radius":1,"border-right":1,"border-right-color":1,"border-right-style":1,"border-right-width":1,"border-spacing":1,"border-style":1,"border-top":1,"border-top-color":1,"border-top-left-radius":1,"border-top-right-radius":1,"border-top-style":1,"border-top-width":1,"border-width":1,bottom:1,"box-align":1,"box-decoration-break":1,"box-direction":1,"box-flex":1,"box-flex-group":1,"box-lines":1,"box-ordinal-group":1,"box-orient":1,"box-pack":1,"box-shadow":1,"box-sizing":1,"break-after":1,"break-before":1,"break-inside":1,"caption-side":1,clear:1,clip:1,color:1,"color-profile":1,"column-count":1,"column-fill":1,"column-gap":1,"column-rule":1,"column-rule-color":1,"column-rule-style":1,"column-rule-width":1,"column-span":1,"column-width":1,columns:1,content:1,"counter-increment":1,"counter-reset":1,crop:1,cue:1,"cue-after":1,"cue-before":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"drop-initial-after-adjust":1,"drop-initial-after-align":1,"drop-initial-before-adjust":1,"drop-initial-before-align":1,"drop-initial-size":1,"drop-initial-value":1,elevation:1,"empty-cells":1,fit:1,"fit-position":1,"float":1,"float-offset":1,font:1,"font-family":1,"font-size":1,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"grid-columns":1,"grid-rows":1,"hanging-punctuation":1,height:1,"hyphenate-after":1,"hyphenate-before":1,"hyphenate-character":1,"hyphenate-lines":1,"hyphenate-resource":1,hyphens:1,icon:1,"image-orientation":1,"image-rendering":1,"image-resolution":1,"inline-box-align":1,left:1,"letter-spacing":1,"line-height":1,"line-stacking":1,"line-stacking-ruby":1,"line-stacking-shift":1,"line-stacking-strategy":1,"list-style":1,"list-style-image":1,"list-style-position":1,"list-style-type":1,margin:1,"margin-bottom":1,"margin-left":1,"margin-right":1,"margin-top":1,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":1,"max-width":1,"min-height":1,"min-width":1,"move-to":1,"nav-down":1,"nav-index":1,"nav-left":1,"nav-right":1,"nav-up":1,opacity:1,orphans:1,outline:1,"outline-color":1,"outline-offset":1,"outline-style":1,"outline-width":1,overflow:1,"overflow-style":1,"overflow-x":1,"overflow-y":1,padding:1,"padding-bottom":1,"padding-left":1,"padding-right":1,"padding-top":1,page:1,"page-break-after":1,"page-break-before":1,"page-break-inside":1,"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,position:1,"presentation-level":1,"punctuation-trim":1,quotes:1,"rendering-intent":1,resize:1,rest:1,"rest-after":1,"rest-before":1,richness:1,right:1,rotation:1,"rotation-point":1,"ruby-align":1,"ruby-overhang":1,"ruby-position":1,"ruby-span":1,size:1,speak:1,"speak-header":1,"speak-numeral":1,"speak-punctuation":1,"speech-rate":1,stress:1,"string-set":1,"table-layout":1,target:1,"target-name":1,"target-new":1,"target-position":1,"text-align":1,"text-align-last":1,"text-decoration":1,"text-emphasis":1,"text-height":1,"text-indent":1,"text-justify":1,"text-outline":1,"text-shadow":1,"text-transform":1,"text-wrap":1,top:1,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":1,"user-modify":1,"user-select":1,"vertical-align":1,visibility:1,"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":1,"white-space-collapse":1,widows:1,width:1,"word-break":1,"word-spacing":1,"word-wrap":1,"z-index":1,filter:1,zoom:1,src:1};a.addListener("property",function(a){var d=a.property.text.toLowerCase();a.invalid&&b.report(a.invalid.message,a.line,a.col,c)})}}),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(a,b){function e(a){a.selectors?d={line:a.line,col:a.col,selectors:a.selectors,propCount:0,outline:!1}:d=null}function f(a){d&&d.outline&&(d.selectors.toString().toLowerCase().indexOf(":focus")==-1?b.report("Outlines should only be modified using :focus.",d.line,d.col,c):d.propCount==1&&b.report("Outlines shouldn't be hidden unless other visual changes are made.",d.line,d.col,c))}var c=this,d;a.addListener("startrule",e),a.addListener("startfontface",e),a.addListener("startpage",e),a.addListener("startpagemargin",e),a.addListener("startkeyframerule",e),a.addListener("property",function(a){var b=a.property.text.toLowerCase(),c=a.value;d&&(d.propCount++,b=="outline"&&(c=="none"||c=="0")&&(d.outline=!0))}),a.addListener("endrule",f),a.addListener("endfontface",f),a.addListener("endpage",f),a.addListener("endpagemargin",f),a.addListener("endkeyframerule",f)}}),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(a,b){var c=this,d={};a.addListener("startrule",function(e){var f=e.selectors,g,h,i,j,k,l;for(j=0;j<f.length;j++){g=f[j];for(k=0;k<g.parts.length;k++){h=g.parts[k];if(h.type==a.SELECTOR_PART_TYPE)for(l=0;l<h.modifiers.length;l++)i=h.modifiers[l],h.elementName&&i.type=="id"?b.report("Element ("+h+") is overqualified, just use "+i+" without element name.",h.line,h.col,c):i.type=="class"&&(d[i]||(d[i]=[]),d[i].push({modifier:i,part:h}))}}}),a.addListener("endstylesheet",function(){var a;for(a in d)d.hasOwnProperty(a)&&d[a].length==1&&d[a][0].part.elementName&&b.report("Element ("+d[a][0].part+") is overqualified, just use "+d[a][0].modifier+" without element name.",d[a][0].part.line,d[a][0].part.col,c)})}}),CSSLint.addRule({id:"qualified-headings",name:"Disallow qualified headings",desc:"Headings should not be qualified (namespaced).",browsers:"All",init:function(a,b){var c=this;a.addListener("startrule",function(d){var e=d.selectors,f,g,h,i;for(h=0;h<e.length;h++){f=e[h];for(i=0;i<f.parts.length;i++)g=f.parts[i],g.type==a.SELECTOR_PART_TYPE&&g.elementName&&/h[1-6]/.test(g.elementName.toString())&&i>0&&b.report("Heading ("+g.elementName+") should not be qualified.",g.line,g.col,c)}})}}),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(a,b){var c=this;a.addListener("startrule",function(d){var e=d.selectors,f,g,h,i,j,k;for(i=0;i<e.length;i++){f=e[i];for(j=0;j<f.parts.length;j++){g=f.parts[j];if(g.type==a.SELECTOR_PART_TYPE)for(k=0;k<g.modifiers.length;k++)h=g.modifiers[k],h.type=="attribute"&&/([\~\|\^\$\*]=)/.test(h)&&b.report("Attribute selectors with "+RegExp.$1+" are slow!",h.line,h.col,c)}}})}}),CSSLint.addRule({id:"rules-count",name:"Rules Count",desc:"Track how many rules there are.",browsers:"All",init:function(a,b){var c=this,d=0;a.addListener("startrule",function(){d++}),a.addListener("endstylesheet",function(){b.stat("rule-count",d)})}}),CSSLint.addRule({id:"shorthand",name:"Require shorthand properties",desc:"Use shorthand properties where possible.",browsers:"All",init:function(a,b){function j(a){h={}}function k(a){var d,e,f,g;for(d in i)if(i.hasOwnProperty(d)){g=0;for(e=0,f=i[d].length;e<f;e++)g+=h[i[d][e]]?1:0;g==i[d].length&&b.report("The properties "+i[d].join(", ")+" can be replaced by "+d+".",a.line,a.col,c)}}var c=this,d,e,f,g={},h,i={margin:["margin-top","margin-bottom","margin-left","margin-right"],padding:["padding-top","padding-bottom","padding-left","padding-right"]};for(d in i)if(i.hasOwnProperty(d))for(e=0,f=i[d].length;e<f;e++)g[i[d][e]]=d;a.addListener("startrule",j),a.addListener("startfontface",j),a.addListener("property",function(a){var b=a.property.toString().toLowerCase(),c=a.value.parts[0].value;g[b]&&(h[b]=1)}),a.addListener("endrule",k),a.addListener("endfontface",k)}}),CSSLint.addRule({id:"text-indent",name:"Disallow negative text-indent",desc:"Checks for text indent less than -99px",browsers:"All",init:function(a,b){function e(a){d=!1}function f(a){d&&b.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.",d.line,d.col,c)}var c=this,d=!1;a.addListener("startrule",e),a.addListener("startfontface",e),a.addListener("property",function(a){var b=a.property.toString().toLowerCase(),c=a.value;b=="text-indent"&&c.parts[0].value<-99?d=a.property:b=="direction"&&c=="ltr"&&(d=!1)}),a.addListener("endrule",f),a.addListener("endfontface",f)}}),CSSLint.addRule({id:"unique-headings",name:"Headings should only be defined once",desc:"Headings should be defined only once.",browsers:"All",init:function(a,b){var c=this,d={h1:0,h2:0,h3:0,h4:0,h5:0,h6:0};a.addListener("startrule",function(a){var e=a.selectors,f,g,h,i,j;for(i=0;i<e.length;i++){f=e[i],g=f.parts[f.parts.length-1];if(g.elementName&&/(h[1-6])/i.test(g.elementName.toString())){for(j=0;j<g.modifiers.length;j++)if(g.modifiers[j].type=="pseudo"){h=!0;break}h||(d[RegExp.$1]++,d[RegExp.$1]>1&&b.report("Heading ("+g.elementName+") has already been defined.",g.line,g.col,c))}}}),a.addListener("endstylesheet",function(a){var e,f=[];for(e in d)d.hasOwnProperty(e)&&d[e]>1&&f.push(d[e]+" "+e+"s");f.length&&b.rollupWarn("You have "+f.join(", ")+" defined in this stylesheet.",c)})}}),CSSLint.addRule({id:"universal-selector",name:"Disallow universal selector",desc:"The universal selector (*) is known to be slow.",browsers:"All",init:function(a,b){var c=this;a.addListener("startrule",function(a){var d=a.selectors,e,f,g,h,i,j;for(h=0;h<d.length;h++)e=d[h],f=e.parts[e.parts.length-1],f.elementName=="*"&&b.report(c.desc,f.line,f.col,c)})}}),CSSLint.addRule({id:"unqualified-attributes",name:"Disallow unqualified attribute selectors",desc:"Unqualified attribute selectors are known to be slow.",browsers:"All",init:function(a,b){var c=this;a.addListener("startrule",function(d){var e=d.selectors,f,g,h,i,j,k;for(i=0;i<e.length;i++){f=e[i],g=f.parts[f.parts.length-1];if(g.type==a.SELECTOR_PART_TYPE)for(k=0;k<g.modifiers.length;k++)h=g.modifiers[k],h.type=="attribute"&&(!g.elementName||g.elementName=="*")&&b.report(c.desc,g.line,g.col,c)}})}}),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(a,b){function g(){d={},e=1}function h(a){var e,g,h,i,j,k,l=[];for(e in d)f[e]&&l.push({actual:e,needed:f[e]});for(g=0,h=l.length;g<h;g++)j=l[g].needed,k=l[g].actual,d[j]?d[j][0].pos<d[k][0].pos&&b.report("Standard property '"+j+"' should come after vendor-prefixed property '"+k+"'.",d[k][0].name.line,d[k][0].name.col,c):b.report("Missing standard property '"+j+"' to go along with '"+k+"'.",d[k][0].name.line,d[k][0].name.col,c)}var c=this,d,e,f={"-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"};a.addListener("startrule",g),a.addListener("startfontface",g),a.addListener("startpage",g),a.addListener("startpagemargin",g),a.addListener("startkeyframerule",g),a.addListener("property",function(a){var b=a.property.text.toLowerCase();d[b]||(d[b]=[]),d[b].push({name:a.property,value:a.value,pos:e++})}),a.addListener("endrule",h),a.addListener("endfontface",h),a.addListener("endpage",h),a.addListener("endpagemargin",h),a.addListener("endkeyframerule",h)}}),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(a,b){var c=this;a.addListener("property",function(a){var d=a.value.parts,e=0,f=d.length;while(e<f)(d[e].units||d[e].type=="percentage")&&d[e].value===0&&d[e].type!="time"&&b.report("Values of 0 shouldn't have units specified.",d[e].line,d[e].col,c),e++})}}),CSSLint.addFormatter({id:"checkstyle-xml",name:"Checkstyle XML format",startFormat:function(){return'<?xml version="1.0" encoding="utf-8"?><checkstyle>'},endFormat:function(){return"</checkstyle>"},formatResults:function(a,b,c){var d=a.messages,e=[],f=function(a){return!!a&&"name"in a?"net.csslint."+a.name.replace(/\s/g,""):""},g=function(a){return!a||a.constructor!==String?"":a.replace(/\"/g,"'").replace(/</g,"<").replace(/>/g,">")};return d.length>0&&(e.push('<file name="'+b+'">'),CSSLint.Util.forEach(d,function(a,b){a.rollup||e.push('<error line="'+a.line+'" column="'+a.col+'" severity="'+a.type+'"'+' message="'+g(a.message)+'" source="'+f(a.rule)+'"/>')}),e.push("</file>")),e.join("")}}),CSSLint.addFormatter({id:"compact",name:"Compact, 'porcelain' format",startFormat:function(){return""},endFormat:function(){return""},formatResults:function(a,b,c){var d=a.messages,e="";c=c||{};var f=function(a){return a.charAt(0).toUpperCase()+a.slice(1)};return d.length===0?c.quiet?"":b+": Lint Free!":(CSSLint.Util.forEach(d,function(a,c){a.rollup?e+=b+": "+f(a.type)+" - "+a.message+"\n":e+=b+": "+"line "+a.line+", col "+a.col+", "+f(a.type)+" - "+a.message+"\n"}),e)}}),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(a,b,c){var d=a.messages,e=[],f=function(a){return!a||a.constructor!==String?"":a.replace(/\"/g,"'").replace(/</g,"<").replace(/>/g,">")};return d.length>0&&(e.push('<file name="'+b+'">'),CSSLint.Util.forEach(d,function(a,b){a.rollup?e.push('<issue severity="'+a.type+'" reason="'+f(a.message)+'" evidence="'+f(a.evidence)+'"/>'):e.push('<issue line="'+a.line+'" char="'+a.col+'" severity="'+a.type+'"'+' reason="'+f(a.message)+'" evidence="'+f(a.evidence)+'"/>')}),e.push("</file>")),e.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(a,b,c){var d=a.messages,e=[],f=function(a){return!a||a.constructor!==String?"":a.replace(/\"/g,"'").replace(/</g,"<").replace(/>/g,">")};return d.length>0&&(e.push('<file name="'+b+'">'),CSSLint.Util.forEach(d,function(a,b){a.rollup?e.push('<issue severity="'+a.type+'" reason="'+f(a.message)+'" evidence="'+f(a.evidence)+'"/>'):e.push('<issue line="'+a.line+'" char="'+a.col+'" severity="'+a.type+'"'+' reason="'+f(a.message)+'" evidence="'+f(a.evidence)+'"/>')}),e.push("</file>")),e.join("")}}),CSSLint.addFormatter({id:"text",name:"Plain Text",startFormat:function(){return""},endFormat:function(){return""},formatResults:function(a,b,c){var d=a.messages,e="";c=c||{};if(d.length===0)return c.quiet?"":"\n\ncsslint: No errors in "+b+".";e="\n\ncsslint: There are "+d.length+" problems in "+b+".";var f=b.lastIndexOf("/"),g=b;return f===-1&&(f=b.lastIndexOf("\\")),f>-1&&(g=b.substring(f+1)),CSSLint.Util.forEach(d,function(a,b){e=e+"\n\n"+g,a.rollup?(e+="\n"+(b+1)+": "+a.type,e+="\n"+a.message):(e+="\n"+(b+1)+": "+a.type+" at line "+a.line+", col "+a.col,e+="\n"+a.message,e+="\n"+a.evidence)}),e}}),exports.CSSLint=CSSLint})
|
|
lib/classes/rtTPGFrontEnd.php
CHANGED
@@ -1,32 +1,31 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
if(!class_exists('rtTPGFrontEnd')):
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
add_action('wp_footer', array($this, 'tpg_custom_css'));
|
10 |
-
add_action( 'wp_enqueue_scripts', array($this, 'rt_tpg_enqueue_styles' ));
|
11 |
|
12 |
-
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
32 |
endif;
|
1 |
<?php
|
2 |
|
3 |
+
if ( ! class_exists( 'rtTPGFrontEnd' ) ):
|
4 |
|
5 |
+
class rtTPGFrontEnd {
|
6 |
+
function __construct() {
|
7 |
+
add_action( 'wp_footer', array( $this, 'tpg_custom_css' ) );
|
8 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'rt_tpg_enqueue_styles' ) );
|
|
|
|
|
9 |
|
10 |
+
}
|
11 |
|
12 |
+
function rt_tpg_enqueue_styles() {
|
13 |
+
wp_enqueue_style( 'rt-tpg' );
|
14 |
+
global $rtTPG;
|
15 |
+
$settings = get_option( $rtTPG->options['settings'] );
|
16 |
+
$css = isset( $settings['custom_css'] ) ? trim( $settings['custom_css'] ) : null;
|
17 |
+
if ( $css ) {
|
18 |
+
wp_add_inline_style( 'rt-tpg', $css );
|
19 |
+
}
|
20 |
+
$scriptBefore = isset( $settings['script_before_item_load'] ) ? stripslashes( $settings['script_before_item_load'] ) : null;
|
21 |
+
$scriptAfter = isset( $settings['script_after_item_load'] ) ? stripslashes( $settings['script_after_item_load'] ) : null;
|
22 |
+
$scriptLoaded = isset( $settings['custom_script_loaded'] ) ? stripslashes( $settings['custom_script_loaded'] ) : null;
|
23 |
+
$script = "(function($){
|
24 |
+
$('.rt-tpg-container').on('tpg_item_before_load', function(){{$scriptBefore}});
|
25 |
+
$('.rt-tpg-container').on('tpg_item_after_load', function(){{$scriptAfter}});
|
26 |
+
$('.rt-tpg-container').on('tpg_loaded', function(){{$scriptLoaded}});
|
27 |
+
})(jQuery);";
|
28 |
+
wp_add_inline_script( 'rt-tpg', $script );
|
29 |
+
}
|
30 |
+
}
|
31 |
endif;
|
lib/classes/rtTPGHelper.php
CHANGED
@@ -84,7 +84,7 @@ if ( ! class_exists( 'rtTPGHelper' ) ):
|
|
84 |
|
85 |
function rt_get_users() {
|
86 |
$users = array();
|
87 |
-
$u = get_users();
|
88 |
if ( ! empty( $u ) ) {
|
89 |
foreach ( $u as $user ) {
|
90 |
$users[ $user->ID ] = $user->display_name;
|
84 |
|
85 |
function rt_get_users() {
|
86 |
$users = array();
|
87 |
+
$u = get_users(apply_filters( 'tpg_author_arg', array() ));
|
88 |
if ( ! empty( $u ) ) {
|
89 |
foreach ( $u as $user ) {
|
90 |
$users[ $user->ID ] = $user->display_name;
|
lib/classes/rtTPGHook.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! class_exists( 'rtTPGHook' ) ):
|
3 |
+
class rtTPGHook {
|
4 |
+
|
5 |
+
function __construct() {
|
6 |
+
add_filter( 'tpg_author_arg', array( $this, 'filter_author_args' ), 10 );
|
7 |
+
}
|
8 |
+
|
9 |
+
function filter_author_args( $args ) {
|
10 |
+
$defaults = array( 'role__in' => array( 'administrator', 'editor', 'author' ) );
|
11 |
+
|
12 |
+
return wp_parse_args( $args, $defaults );
|
13 |
+
}
|
14 |
+
|
15 |
+
}
|
16 |
+
|
17 |
+
endif;
|
lib/classes/rtTPGInit.php
CHANGED
@@ -74,28 +74,16 @@ if ( ! class_exists( 'rtTPGInit' ) ):
|
|
74 |
'footer' => true
|
75 |
);
|
76 |
$scripts[] = array(
|
77 |
-
'handle' => 'rt-tpg
|
78 |
'src' => $rtTPG->assetsUrl . "js/rttpg.js",
|
79 |
'deps' => array( 'jquery' ),
|
80 |
'footer' => true
|
81 |
);
|
82 |
// register acf styles
|
83 |
$styles['rt-fontawsome'] = $rtTPG->assetsUrl . 'vendor/font-awesome/css/font-awesome.min.css';
|
84 |
-
$styles['rt-tpg
|
85 |
|
86 |
if ( is_admin() ) {
|
87 |
-
$scripts[] = array(
|
88 |
-
'handle' => 'ace_code_highlighter_js',
|
89 |
-
'src' => $rtTPG->assetsUrl . "vendor/ace/ace.js",
|
90 |
-
'deps' => null,
|
91 |
-
'footer' => true
|
92 |
-
);
|
93 |
-
$scripts[] = array(
|
94 |
-
'handle' => 'ace_mode_js',
|
95 |
-
'src' => $rtTPG->assetsUrl . "vendor/ace/mode-css.js",
|
96 |
-
'deps' => array( 'ace_code_highlighter_js' ),
|
97 |
-
'footer' => true
|
98 |
-
);
|
99 |
|
100 |
$scripts[] = array(
|
101 |
'handle' => 'rt-select2-js',
|
@@ -187,8 +175,6 @@ if ( ! class_exists( 'rtTPGInit' ) ):
|
|
187 |
|
188 |
wp_enqueue_script( array(
|
189 |
'jquery',
|
190 |
-
'ace_code_highlighter_js',
|
191 |
-
'ace_mode_js',
|
192 |
'rt-select2-js',
|
193 |
'rt-tpg-admin',
|
194 |
) );
|
74 |
'footer' => true
|
75 |
);
|
76 |
$scripts[] = array(
|
77 |
+
'handle' => 'rt-tpg',
|
78 |
'src' => $rtTPG->assetsUrl . "js/rttpg.js",
|
79 |
'deps' => array( 'jquery' ),
|
80 |
'footer' => true
|
81 |
);
|
82 |
// register acf styles
|
83 |
$styles['rt-fontawsome'] = $rtTPG->assetsUrl . 'vendor/font-awesome/css/font-awesome.min.css';
|
84 |
+
$styles['rt-tpg'] = $rtTPG->assetsUrl . 'css/thepostgrid.css';
|
85 |
|
86 |
if ( is_admin() ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
$scripts[] = array(
|
89 |
'handle' => 'rt-select2-js',
|
175 |
|
176 |
wp_enqueue_script( array(
|
177 |
'jquery',
|
|
|
|
|
178 |
'rt-select2-js',
|
179 |
'rt-tpg-admin',
|
180 |
) );
|
lib/classes/rtTPGOptions.php
CHANGED
@@ -4,8 +4,7 @@ if ( ! class_exists( 'rtTPGOptions' ) ):
|
|
4 |
|
5 |
class rtTPGOptions {
|
6 |
|
7 |
-
function rtPostTypes()
|
8 |
-
{
|
9 |
$post_types = get_post_types(
|
10 |
array(
|
11 |
'_builtin' => true
|
@@ -19,16 +18,14 @@ if ( ! class_exists( 'rtTPGOptions' ) ):
|
|
19 |
return $post_types;
|
20 |
}
|
21 |
|
22 |
-
function rtPostOrders()
|
23 |
-
{
|
24 |
return array(
|
25 |
"ASC" => "Ascending",
|
26 |
"DESC" => "Descending",
|
27 |
);
|
28 |
}
|
29 |
|
30 |
-
function rtTermOperators()
|
31 |
-
{
|
32 |
return array(
|
33 |
'IN' => "IN — show posts which associate with one or more of selected terms",
|
34 |
'NOT IN' => "NOT IN — show posts which do not associate with any of selected terms",
|
@@ -36,16 +33,14 @@ if ( ! class_exists( 'rtTPGOptions' ) ):
|
|
36 |
);
|
37 |
}
|
38 |
|
39 |
-
function rtTermRelations()
|
40 |
-
{
|
41 |
return array(
|
42 |
'AND' => "AND — show posts which match all settings",
|
43 |
'OR' => "OR — show posts which match one or more settings",
|
44 |
);
|
45 |
}
|
46 |
|
47 |
-
function rtPostOrderBy()
|
48 |
-
{
|
49 |
return array(
|
50 |
"ID" => "ID",
|
51 |
"title" => "Title",
|
@@ -55,24 +50,47 @@ if ( ! class_exists( 'rtTPGOptions' ) ):
|
|
55 |
);
|
56 |
}
|
57 |
|
58 |
-
function rtTPGSettingFields()
|
59 |
-
{
|
60 |
global $rtTPG;
|
61 |
$settings = get_option( $rtTPG->options['settings'] );
|
62 |
|
63 |
return array(
|
64 |
-
'custom_css'
|
65 |
-
'type'
|
66 |
-
'name'
|
67 |
-
'label'
|
68 |
-
'
|
69 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
)
|
71 |
);
|
72 |
}
|
73 |
|
74 |
-
function rtTPGCommonFilterFields()
|
75 |
-
{
|
76 |
return array(
|
77 |
'post__in' => array(
|
78 |
"name" => "post__in",
|
@@ -101,8 +119,7 @@ if ( ! class_exists( 'rtTPGOptions' ) ):
|
|
101 |
);
|
102 |
}
|
103 |
|
104 |
-
function rtTPGPostType()
|
105 |
-
{
|
106 |
return array(
|
107 |
"name" => "tpg_post_type",
|
108 |
"label" => "Post Type",
|
@@ -113,8 +130,7 @@ if ( ! class_exists( 'rtTPGOptions' ) ):
|
|
113 |
);
|
114 |
}
|
115 |
|
116 |
-
function rtTPAdvanceFilters()
|
117 |
-
{
|
118 |
return array(
|
119 |
'type' => "checkbox",
|
120 |
'name' => "post_filter",
|
@@ -132,8 +148,7 @@ if ( ! class_exists( 'rtTPGOptions' ) ):
|
|
132 |
);
|
133 |
}
|
134 |
|
135 |
-
function rtTPGPostStatus()
|
136 |
-
{
|
137 |
return array(
|
138 |
'publish' => 'Publish',
|
139 |
'pending' => 'Pending',
|
@@ -146,8 +161,7 @@ if ( ! class_exists( 'rtTPGOptions' ) ):
|
|
146 |
);
|
147 |
}
|
148 |
|
149 |
-
function rtTPGLayoutSettingFields()
|
150 |
-
{
|
151 |
global $rtTPG;
|
152 |
|
153 |
return array(
|
@@ -172,7 +186,7 @@ if ( ! class_exists( 'rtTPGOptions' ) ):
|
|
172 |
'type' => 'select',
|
173 |
"name" => "tgp_layout2_image_column",
|
174 |
"id" => "tgp_layout2_image_column",
|
175 |
-
'label' => __( 'Image column', 'the-post-grid
|
176 |
'class' => 'rt-select2',
|
177 |
'holderClass' => "holder-layout2-image-column tpg-hidden",
|
178 |
'default' => 4,
|
@@ -281,16 +295,14 @@ if ( ! class_exists( 'rtTPGOptions' ) ):
|
|
281 |
);
|
282 |
}
|
283 |
|
284 |
-
function get_excerpt_type()
|
285 |
-
{
|
286 |
return array(
|
287 |
'character' => "Character",
|
288 |
'word' => "Word"
|
289 |
);
|
290 |
}
|
291 |
|
292 |
-
function rtTPGStyleFields()
|
293 |
-
{
|
294 |
|
295 |
return array(
|
296 |
'parent_class' => array(
|
@@ -347,8 +359,7 @@ if ( ! class_exists( 'rtTPGOptions' ) ):
|
|
347 |
|
348 |
}
|
349 |
|
350 |
-
function getTitleTags()
|
351 |
-
{
|
352 |
return array(
|
353 |
'h2' => "H2",
|
354 |
'h3' => "H3",
|
@@ -356,8 +367,7 @@ if ( ! class_exists( 'rtTPGOptions' ) ):
|
|
356 |
);
|
357 |
}
|
358 |
|
359 |
-
function itemFields()
|
360 |
-
{
|
361 |
return array(
|
362 |
"type" => "checkbox",
|
363 |
"name" => "item_fields",
|
@@ -370,16 +380,14 @@ if ( ! class_exists( 'rtTPGOptions' ) ):
|
|
370 |
);
|
371 |
}
|
372 |
|
373 |
-
function rtMediaSource()
|
374 |
-
{
|
375 |
return array(
|
376 |
"feature_image" => __( "Feature Image", 'the-post-grid' ),
|
377 |
"first_image" => __( "First Image from content", 'the-post-grid' )
|
378 |
);
|
379 |
}
|
380 |
|
381 |
-
function rtTPGColumns()
|
382 |
-
{
|
383 |
return array(
|
384 |
1 => "Column 1",
|
385 |
2 => "Column 2",
|
@@ -390,18 +398,18 @@ if ( ! class_exists( 'rtTPGOptions' ) ):
|
|
390 |
);
|
391 |
}
|
392 |
|
393 |
-
function rtTPGLayouts()
|
394 |
-
|
395 |
-
return array(
|
396 |
'layout1' => "Layout 1",
|
397 |
'layout2' => "Layout 2",
|
398 |
'layout3' => "Layout 3",
|
399 |
'isotope1' => "Isotope Layout"
|
400 |
);
|
|
|
|
|
401 |
}
|
402 |
|
403 |
-
function rtTPGItemFields()
|
404 |
-
{
|
405 |
return array(
|
406 |
'title' => __( "Title", 'the-post-grid' ),
|
407 |
'excerpt' => __( "Excerpt", 'the-post-grid' ),
|
4 |
|
5 |
class rtTPGOptions {
|
6 |
|
7 |
+
function rtPostTypes() {
|
|
|
8 |
$post_types = get_post_types(
|
9 |
array(
|
10 |
'_builtin' => true
|
18 |
return $post_types;
|
19 |
}
|
20 |
|
21 |
+
function rtPostOrders() {
|
|
|
22 |
return array(
|
23 |
"ASC" => "Ascending",
|
24 |
"DESC" => "Descending",
|
25 |
);
|
26 |
}
|
27 |
|
28 |
+
function rtTermOperators() {
|
|
|
29 |
return array(
|
30 |
'IN' => "IN — show posts which associate with one or more of selected terms",
|
31 |
'NOT IN' => "NOT IN — show posts which do not associate with any of selected terms",
|
33 |
);
|
34 |
}
|
35 |
|
36 |
+
function rtTermRelations() {
|
|
|
37 |
return array(
|
38 |
'AND' => "AND — show posts which match all settings",
|
39 |
'OR' => "OR — show posts which match one or more settings",
|
40 |
);
|
41 |
}
|
42 |
|
43 |
+
function rtPostOrderBy() {
|
|
|
44 |
return array(
|
45 |
"ID" => "ID",
|
46 |
"title" => "Title",
|
50 |
);
|
51 |
}
|
52 |
|
53 |
+
function rtTPGSettingFields() {
|
|
|
54 |
global $rtTPG;
|
55 |
$settings = get_option( $rtTPG->options['settings'] );
|
56 |
|
57 |
return array(
|
58 |
+
'custom_css' => array(
|
59 |
+
'type' => 'textarea',
|
60 |
+
'name' => 'custom_css',
|
61 |
+
'label' => 'Custom Css',
|
62 |
+
'holderClass' => 'rt-script-wrapper full',
|
63 |
+
'id' => 'custom-css',
|
64 |
+
'value' => isset( $settings['custom_css'] ) ? stripslashes( $settings['custom_css'] ) : null,
|
65 |
+
),
|
66 |
+
"script_before_item_load" => array(
|
67 |
+
'name' => 'script_before_item_load',
|
68 |
+
"label" => __( "Script before item load", 'the-post-grid' ),
|
69 |
+
'type' => 'textarea',
|
70 |
+
'holderClass' => 'rt-script-wrapper full',
|
71 |
+
'id' => 'script-before-item-load',
|
72 |
+
'value' => isset( $settings['script_before_item_load'] ) ? stripslashes( $settings['script_before_item_load'] ) : null
|
73 |
+
),
|
74 |
+
"script_after_item_load" => array(
|
75 |
+
'name' => 'script_after_item_load',
|
76 |
+
"label" => __( "Script After item load", 'the-post-grid' ),
|
77 |
+
'type' => 'textarea',
|
78 |
+
'holderClass' => 'rt-script-wrapper full',
|
79 |
+
'id' => 'script-after-item-load',
|
80 |
+
'value' => isset( $settings['script_after_item_load'] ) ? stripslashes( $settings['script_after_item_load'] ) : null
|
81 |
+
),
|
82 |
+
"script_loaded" => array(
|
83 |
+
'name' => 'script_loaded',
|
84 |
+
"label" => __( "After Loaded Script", 'the-post-grid' ),
|
85 |
+
'type' => 'textarea',
|
86 |
+
'holderClass' => 'rt-script-wrapper full',
|
87 |
+
'id' => 'script-loaded',
|
88 |
+
'value' => isset( $settings['script_loaded'] ) ? stripslashes( $settings['script_loaded'] ) : null
|
89 |
)
|
90 |
);
|
91 |
}
|
92 |
|
93 |
+
function rtTPGCommonFilterFields() {
|
|
|
94 |
return array(
|
95 |
'post__in' => array(
|
96 |
"name" => "post__in",
|
119 |
);
|
120 |
}
|
121 |
|
122 |
+
function rtTPGPostType() {
|
|
|
123 |
return array(
|
124 |
"name" => "tpg_post_type",
|
125 |
"label" => "Post Type",
|
130 |
);
|
131 |
}
|
132 |
|
133 |
+
function rtTPAdvanceFilters() {
|
|
|
134 |
return array(
|
135 |
'type' => "checkbox",
|
136 |
'name' => "post_filter",
|
148 |
);
|
149 |
}
|
150 |
|
151 |
+
function rtTPGPostStatus() {
|
|
|
152 |
return array(
|
153 |
'publish' => 'Publish',
|
154 |
'pending' => 'Pending',
|
161 |
);
|
162 |
}
|
163 |
|
164 |
+
function rtTPGLayoutSettingFields() {
|
|
|
165 |
global $rtTPG;
|
166 |
|
167 |
return array(
|
186 |
'type' => 'select',
|
187 |
"name" => "tgp_layout2_image_column",
|
188 |
"id" => "tgp_layout2_image_column",
|
189 |
+
'label' => __( 'Image column', 'the-post-grid' ),
|
190 |
'class' => 'rt-select2',
|
191 |
'holderClass' => "holder-layout2-image-column tpg-hidden",
|
192 |
'default' => 4,
|
295 |
);
|
296 |
}
|
297 |
|
298 |
+
function get_excerpt_type() {
|
|
|
299 |
return array(
|
300 |
'character' => "Character",
|
301 |
'word' => "Word"
|
302 |
);
|
303 |
}
|
304 |
|
305 |
+
function rtTPGStyleFields() {
|
|
|
306 |
|
307 |
return array(
|
308 |
'parent_class' => array(
|
359 |
|
360 |
}
|
361 |
|
362 |
+
function getTitleTags() {
|
|
|
363 |
return array(
|
364 |
'h2' => "H2",
|
365 |
'h3' => "H3",
|
367 |
);
|
368 |
}
|
369 |
|
370 |
+
function itemFields() {
|
|
|
371 |
return array(
|
372 |
"type" => "checkbox",
|
373 |
"name" => "item_fields",
|
380 |
);
|
381 |
}
|
382 |
|
383 |
+
function rtMediaSource() {
|
|
|
384 |
return array(
|
385 |
"feature_image" => __( "Feature Image", 'the-post-grid' ),
|
386 |
"first_image" => __( "First Image from content", 'the-post-grid' )
|
387 |
);
|
388 |
}
|
389 |
|
390 |
+
function rtTPGColumns() {
|
|
|
391 |
return array(
|
392 |
1 => "Column 1",
|
393 |
2 => "Column 2",
|
398 |
);
|
399 |
}
|
400 |
|
401 |
+
function rtTPGLayouts() {
|
402 |
+
$layouts = array(
|
|
|
403 |
'layout1' => "Layout 1",
|
404 |
'layout2' => "Layout 2",
|
405 |
'layout3' => "Layout 3",
|
406 |
'isotope1' => "Isotope Layout"
|
407 |
);
|
408 |
+
|
409 |
+
return apply_filters( 'tpg_layouts', $layouts );
|
410 |
}
|
411 |
|
412 |
+
function rtTPGItemFields() {
|
|
|
413 |
return array(
|
414 |
'title' => __( "Title", 'the-post-grid' ),
|
415 |
'excerpt' => __( "Excerpt", 'the-post-grid' ),
|
lib/classes/rtTPGShortCode.php
CHANGED
@@ -30,9 +30,9 @@ if ( ! class_exists( 'rtTPGShortCode' ) ):
|
|
30 |
wp_enqueue_style( 'rt-fontawsome' );
|
31 |
wp_enqueue_script( 'rt-image-load-js' );
|
32 |
wp_enqueue_script( 'rt-actual-height-js' );
|
33 |
-
wp_enqueue_script( 'rt-tpg
|
34 |
$nonce = wp_create_nonce( $rtTPG->nonceText() );
|
35 |
-
wp_localize_script( 'rt-tpg
|
36 |
array(
|
37 |
'nonceID' => $rtTPG->nonceId(),
|
38 |
'nonce' => $nonce,
|
30 |
wp_enqueue_style( 'rt-fontawsome' );
|
31 |
wp_enqueue_script( 'rt-image-load-js' );
|
32 |
wp_enqueue_script( 'rt-actual-height-js' );
|
33 |
+
wp_enqueue_script( 'rt-tpg' );
|
34 |
$nonce = wp_create_nonce( $rtTPG->nonceText() );
|
35 |
+
wp_localize_script( 'rt-tpg', 'rttpg',
|
36 |
array(
|
37 |
'nonceID' => $rtTPG->nonceId(),
|
38 |
'nonce' => $nonce,
|
the-post-grid.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin URI: http://demo.radiustheme.com/wordpress/plugins/the-post-grid/
|
5 |
* Description: Fast & Easy way to display WordPress post in Grid, List & Isotope view ( filter by category, tag, author..) without a single line of coding.
|
6 |
* Author: RadiusTheme
|
7 |
-
* Version: 2.2.
|
8 |
* Text Domain: the-post-grid
|
9 |
* Domain Path: /languages
|
10 |
* Author URI: https://radiustheme.com/
|
4 |
* Plugin URI: http://demo.radiustheme.com/wordpress/plugins/the-post-grid/
|
5 |
* Description: Fast & Easy way to display WordPress post in Grid, List & Isotope view ( filter by category, tag, author..) without a single line of coding.
|
6 |
* Author: RadiusTheme
|
7 |
+
* Version: 2.2.71
|
8 |
* Text Domain: the-post-grid
|
9 |
* Domain Path: /languages
|
10 |
* Author URI: https://radiustheme.com/
|