fay (empty) → 0.1.0.0
raw patch · 84 files changed
+3851/−0 lines, 84 filesdep +HUnitdep +basedep +blaze-htmlsetup-changed
Dependencies added: HUnit, base, blaze-html, blaze-markup, bytestring, directory, filepath, haskell-src-exts, json, language-javascript, mtl, process, time
Files
- LICENSE +30/−0
- Setup.hs +2/−0
- docs/beautify.js +1321/−0
- docs/highlight.pack.js +1/−0
- docs/home.css +79/−0
- docs/home.js +26/−0
- docs/jquery.js +4/−0
- docs/snippets/conditions.hs +9/−0
- docs/snippets/data.hs +11/−0
- docs/snippets/declarations.hs +5/−0
- docs/snippets/dom.hs +14/−0
- docs/snippets/enums.hs +18/−0
- docs/snippets/ffi.hs +5/−0
- docs/snippets/functions.hs +3/−0
- docs/snippets/lists.hs +9/−0
- docs/snippets/patterns.hs +5/−0
- examples/alert.hs +13/−0
- examples/console.hs +12/−0
- examples/dom.hs +22/−0
- fay.cabal +104/−0
- hs/stdlib.hs +13/−0
- js/runtime.js +340/−0
- src/Control/Monad/IO.hs +6/−0
- src/Docs.hs +209/−0
- src/Language/Fay.hs +669/−0
- src/Language/Fay/Compiler.hs +56/−0
- src/Language/Fay/FFI.hs +69/−0
- src/Language/Fay/Prelude.hs +57/−0
- src/Language/Fay/Print.hs +175/−0
- src/Language/Fay/Stdlib.hs +152/−0
- src/Language/Fay/Types.hs +113/−0
- src/Main.hs +20/−0
- src/Tests.hs +47/−0
- src/Text/Blaze/Extra.hs +35/−0
- tests/1.hs +0/−0
- tests/10 +1/−0
- tests/10.hs +12/−0
- tests/11 +1/−0
- tests/11.hs +10/−0
- tests/12 +1/−0
- tests/12.hs +15/−0
- tests/13 +1/−0
- tests/13.hs +7/−0
- tests/14 +1/−0
- tests/14.hs +7/−0
- tests/15 +1/−0
- tests/15.hs +6/−0
- tests/16 +1/−0
- tests/16.hs +7/−0
- tests/17 +1/−0
- tests/17.hs +8/−0
- tests/18 +1/−0
- tests/18.hs +10/−0
- tests/19 +1/−0
- tests/19.hs +11/−0
- tests/2 +0/−0
- tests/2.hs +1/−0
- tests/20 +2/−0
- tests/20.hs +4/−0
- tests/21 +2/−0
- tests/21.hs +4/−0
- tests/22 +1/−0
- tests/22.hs +6/−0
- tests/23 +1/−0
- tests/23.hs +6/−0
- tests/24 +1/−0
- tests/24.hs +8/−0
- tests/25.hs +4/−0
- tests/26 +1/−0
- tests/26.hs +4/−0
- tests/3 +1/−0
- tests/3.hs +4/−0
- tests/4 +1/−0
- tests/4.hs +5/−0
- tests/5 +1/−0
- tests/5.hs +4/−0
- tests/6 +1/−0
- tests/6.hs +5/−0
- tests/7 +1/−0
- tests/7.hs +4/−0
- tests/8 +1/−0
- tests/8.hs +10/−0
- tests/9 +1/−0
- tests/9.hs +10/−0
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2012, Chris Done++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Chris Done nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ docs/beautify.js view
@@ -0,0 +1,1321 @@+/*jslint onevar: false, plusplus: false */+/*jshint curly:true, eqeqeq:true, laxbreak:true, noempty:false */+/*++ JS Beautifier+---------------+++ Written by Einar Lielmanis, <einar@jsbeautifier.org>+ http://jsbeautifier.org/++ Originally converted to javascript by Vital, <vital76@gmail.com>+ "End braces on own line" added by Chris J. Shull, <chrisjshull@gmail.com>++ You are free to use this in any way you want, in case you find this useful or working for you.++ Usage:+ js_beautify(js_source_text);+ js_beautify(js_source_text, options);++ The options are:+ indent_size (default 4) - indentation size,+ indent_char (default space) - character to indent with,+ preserve_newlines (default true) - whether existing line breaks should be preserved,+ preserve_max_newlines (default unlimited) - maximum number of line breaks to be preserved in one chunk,++ jslint_happy (default false) - if true, then jslint-stricter mode is enforced.++ jslint_happy !jslint_happy+ ---------------------------------+ function () function()++ brace_style (default "collapse") - "collapse" | "expand" | "end-expand" | "expand-strict"+ put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line.++ expand-strict: put brace on own line even in such cases:++ var a =+ {+ a: 5,+ b: 6+ }+ This mode may break your scripts - e.g "return { a: 1 }" will be broken into two lines, so beware.++ space_before_conditional (default true) - should the space before conditional statement be added, "if(true)" vs "if (true)",++ unescape_strings (default false) - should printable characters in strings encoded in \xNN notation be unescaped, "example" vs "\x65\x78\x61\x6d\x70\x6c\x65"++ e.g++ js_beautify(js_source_text, {+ 'indent_size': 1,+ 'indent_char': '\t'+ });+++*/++++function js_beautify(js_source_text, options) {++ var input, output, token_text, last_type, last_text, last_last_text, last_word, flags, flag_store, indent_string;+ var whitespace, wordchar, punct, parser_pos, line_starters, digits;+ var prefix, token_type, do_block_just_closed;+ var wanted_newline, just_added_newline, n_newlines;+ var preindent_string = '';+++ // Some interpreters have unexpected results with foo = baz || bar;+ options = options ? options : {};++ var opt_brace_style;++ // compatibility+ if (options.space_after_anon_function !== undefined && options.jslint_happy === undefined) {+ options.jslint_happy = options.space_after_anon_function;+ }+ if (options.braces_on_own_line !== undefined) { //graceful handling of deprecated option+ opt_brace_style = options.braces_on_own_line ? "expand" : "collapse";+ }+ opt_brace_style = options.brace_style ? options.brace_style : (opt_brace_style ? opt_brace_style : "collapse");+++ var opt_indent_size = options.indent_size ? options.indent_size : 4;+ var opt_indent_char = options.indent_char ? options.indent_char : ' ';+ var opt_preserve_newlines = typeof options.preserve_newlines === 'undefined' ? true : options.preserve_newlines;+ var opt_max_preserve_newlines = typeof options.max_preserve_newlines === 'undefined' ? false : options.max_preserve_newlines;+ var opt_jslint_happy = options.jslint_happy === 'undefined' ? false : options.jslint_happy;+ var opt_keep_array_indentation = typeof options.keep_array_indentation === 'undefined' ? false : options.keep_array_indentation;+ var opt_space_before_conditional = typeof options.space_before_conditional === 'undefined' ? true : options.space_before_conditional;+ var opt_indent_case = typeof options.indent_case === 'undefined' ? false : options.indent_case;+ var opt_unescape_strings = typeof options.unescape_strings === 'undefined' ? false : options.unescape_strings;++ just_added_newline = false;++ // cache the source's length.+ var input_length = js_source_text.length;++ function trim_output(eat_newlines) {+ eat_newlines = typeof eat_newlines === 'undefined' ? false : eat_newlines;+ while (output.length && (output[output.length - 1] === ' '+ || output[output.length - 1] === indent_string+ || output[output.length - 1] === preindent_string+ || (eat_newlines && (output[output.length - 1] === '\n' || output[output.length - 1] === '\r')))) {+ output.pop();+ }+ }++ function trim(s) {+ return s.replace(/^\s\s*|\s\s*$/, '');+ }++ // we could use just string.split, but+ // IE doesn't like returning empty strings+ function split_newlines(s) {+ //return s.split(/\x0d\x0a|\x0a/);++ s = s.replace(/\x0d/g, '');+ var out = [],+ idx = s.indexOf("\n");+ while (idx !== -1) {+ out.push(s.substring(0, idx));+ s = s.substring(idx + 1);+ idx = s.indexOf("\n");+ }+ if (s.length) {+ out.push(s);+ }+ return out;+ }++ function force_newline() {+ var old_keep_array_indentation = opt_keep_array_indentation;+ opt_keep_array_indentation = false;+ print_newline();+ opt_keep_array_indentation = old_keep_array_indentation;+ }++ function print_newline(ignore_repeated) {++ flags.eat_next_space = false;+ if (opt_keep_array_indentation && is_array(flags.mode)) {+ return;+ }++ ignore_repeated = typeof ignore_repeated === 'undefined' ? true : ignore_repeated;++ flags.if_line = false;+ trim_output();++ if (!output.length) {+ return; // no newline on start of file+ }++ if (output[output.length - 1] !== "\n" || !ignore_repeated) {+ just_added_newline = true;+ output.push("\n");+ }+ if (preindent_string) {+ output.push(preindent_string);+ }+ for (var i = 0; i < flags.indentation_level; i += 1) {+ output.push(indent_string);+ }+ if (flags.var_line && flags.var_line_reindented) {+ output.push(indent_string); // skip space-stuffing, if indenting with a tab+ }+ if (flags.case_body) {+ output.push(indent_string);+ }+ }++++ function print_single_space() {++ if (last_type === 'TK_COMMENT') {+ return print_newline();+ }+ if (flags.eat_next_space) {+ flags.eat_next_space = false;+ return;+ }+ var last_output = ' ';+ if (output.length) {+ last_output = output[output.length - 1];+ }+ if (last_output !== ' ' && last_output !== '\n' && last_output !== indent_string) { // prevent occassional duplicate space+ output.push(' ');+ }+ }+++ function print_token() {+ just_added_newline = false;+ flags.eat_next_space = false;+ output.push(token_text);+ }++ function indent() {+ flags.indentation_level += 1;+ }+++ function remove_indent() {+ if (output.length && output[output.length - 1] === indent_string) {+ output.pop();+ }+ }++ function set_mode(mode) {+ if (flags) {+ flag_store.push(flags);+ }+ flags = {+ previous_mode: flags ? flags.mode : 'BLOCK',+ mode: mode,+ var_line: false,+ var_line_tainted: false,+ var_line_reindented: false,+ in_html_comment: false,+ if_line: false,+ in_case_statement: false, // switch(..){ INSIDE HERE }+ in_case: false, // we're on the exact line with "case 0:"+ case_body: false, // the indented case-action block+ eat_next_space: false,+ indentation_baseline: -1,+ indentation_level: (flags ? flags.indentation_level + (flags.case_body ? 1 : 0) + ((flags.var_line && flags.var_line_reindented) ? 1 : 0) : 0),+ ternary_depth: 0+ };+ }++ function is_array(mode) {+ return mode === '[EXPRESSION]' || mode === '[INDENTED-EXPRESSION]';+ }++ function is_expression(mode) {+ return in_array(mode, ['[EXPRESSION]', '(EXPRESSION)', '(FOR-EXPRESSION)', '(COND-EXPRESSION)']);+ }++ function restore_mode() {+ do_block_just_closed = flags.mode === 'DO_BLOCK';+ if (flag_store.length > 0) {+ var mode = flags.mode;+ flags = flag_store.pop();+ flags.previous_mode = mode;+ }+ }++ function all_lines_start_with(lines, c) {+ for (var i = 0; i < lines.length; i++) {+ var line = trim(lines[i]);+ if (line.charAt(0) !== c) {+ return false;+ }+ }+ return true;+ }++ function is_special_word(word) {+ return in_array(word, ['case', 'return', 'do', 'if', 'throw', 'else']);+ }++ function in_array(what, arr) {+ for (var i = 0; i < arr.length; i += 1) {+ if (arr[i] === what) {+ return true;+ }+ }+ return false;+ }++ function look_up(exclude) {+ var local_pos = parser_pos;+ var c = input.charAt(local_pos);+ while (in_array(c, whitespace) && c !== exclude) {+ local_pos++;+ if (local_pos >= input_length) {+ return 0;+ }+ c = input.charAt(local_pos);+ }+ return c;+ }++ function get_next_token() {+ var i;+ var resulting_string;++ n_newlines = 0;++ if (parser_pos >= input_length) {+ return ['', 'TK_EOF'];+ }++ wanted_newline = false;++ var c = input.charAt(parser_pos);+ parser_pos += 1;+++ var keep_whitespace = opt_keep_array_indentation && is_array(flags.mode);++ if (keep_whitespace) {++ //+ // slight mess to allow nice preservation of array indentation and reindent that correctly+ // first time when we get to the arrays:+ // var a = [+ // ....'something'+ // we make note of whitespace_count = 4 into flags.indentation_baseline+ // so we know that 4 whitespaces in original source match indent_level of reindented source+ //+ // and afterwards, when we get to+ // 'something,+ // .......'something else'+ // we know that this should be indented to indent_level + (7 - indentation_baseline) spaces+ //+ var whitespace_count = 0;++ while (in_array(c, whitespace)) {++ if (c === "\n") {+ trim_output();+ output.push("\n");+ just_added_newline = true;+ whitespace_count = 0;+ } else {+ if (c === '\t') {+ whitespace_count += 4;+ } else if (c === '\r') {+ // nothing+ } else {+ whitespace_count += 1;+ }+ }++ if (parser_pos >= input_length) {+ return ['', 'TK_EOF'];+ }++ c = input.charAt(parser_pos);+ parser_pos += 1;++ }+ if (flags.indentation_baseline === -1) {+ flags.indentation_baseline = whitespace_count;+ }++ if (just_added_newline) {+ for (i = 0; i < flags.indentation_level + 1; i += 1) {+ output.push(indent_string);+ }+ if (flags.indentation_baseline !== -1) {+ for (i = 0; i < whitespace_count - flags.indentation_baseline; i++) {+ output.push(' ');+ }+ }+ }++ } else {+ while (in_array(c, whitespace)) {++ if (c === "\n") {+ n_newlines += ((opt_max_preserve_newlines) ? (n_newlines <= opt_max_preserve_newlines) ? 1 : 0 : 1);+ }+++ if (parser_pos >= input_length) {+ return ['', 'TK_EOF'];+ }++ c = input.charAt(parser_pos);+ parser_pos += 1;++ }++ if (opt_preserve_newlines) {+ if (n_newlines > 1) {+ for (i = 0; i < n_newlines; i += 1) {+ print_newline(i === 0);+ just_added_newline = true;+ }+ }+ }+ wanted_newline = n_newlines > 0;+ }+++ if (in_array(c, wordchar)) {+ if (parser_pos < input_length) {+ while (in_array(input.charAt(parser_pos), wordchar)) {+ c += input.charAt(parser_pos);+ parser_pos += 1;+ if (parser_pos === input_length) {+ break;+ }+ }+ }++ // small and surprisingly unugly hack for 1E-10 representation+ if (parser_pos !== input_length && c.match(/^[0-9]+[Ee]$/) && (input.charAt(parser_pos) === '-' || input.charAt(parser_pos) === '+')) {++ var sign = input.charAt(parser_pos);+ parser_pos += 1;++ var t = get_next_token(parser_pos);+ c += sign + t[0];+ return [c, 'TK_WORD'];+ }++ if (c === 'in') { // hack for 'in' operator+ return [c, 'TK_OPERATOR'];+ }+ if (wanted_newline && last_type !== 'TK_OPERATOR'+ && last_type !== 'TK_EQUALS'+ && !flags.if_line && (opt_preserve_newlines || last_text !== 'var')) {+ print_newline();+ }+ return [c, 'TK_WORD'];+ }++ if (c === '(' || c === '[') {+ return [c, 'TK_START_EXPR'];+ }++ if (c === ')' || c === ']') {+ return [c, 'TK_END_EXPR'];+ }++ if (c === '{') {+ return [c, 'TK_START_BLOCK'];+ }++ if (c === '}') {+ return [c, 'TK_END_BLOCK'];+ }++ if (c === ';') {+ return [c, 'TK_SEMICOLON'];+ }++ if (c === '/') {+ var comment = '';+ // peek for comment /* ... */+ var inline_comment = true;+ if (input.charAt(parser_pos) === '*') {+ parser_pos += 1;+ if (parser_pos < input_length) {+ while (parser_pos < input_length &&+ ! (input.charAt(parser_pos) === '*' && input.charAt(parser_pos + 1) && input.charAt(parser_pos + 1) === '/')) {+ c = input.charAt(parser_pos);+ comment += c;+ if (c === "\n" || c === "\r") {+ inline_comment = false;+ }+ parser_pos += 1;+ if (parser_pos >= input_length) {+ break;+ }+ }+ }+ parser_pos += 2;+ if (inline_comment && n_newlines === 0) {+ return ['/*' + comment + '*/', 'TK_INLINE_COMMENT'];+ } else {+ return ['/*' + comment + '*/', 'TK_BLOCK_COMMENT'];+ }+ }+ // peek for comment // ...+ if (input.charAt(parser_pos) === '/') {+ comment = c;+ while (input.charAt(parser_pos) !== '\r' && input.charAt(parser_pos) !== '\n') {+ comment += input.charAt(parser_pos);+ parser_pos += 1;+ if (parser_pos >= input_length) {+ break;+ }+ }+ if (wanted_newline) {+ print_newline();+ }+ return [comment, 'TK_COMMENT'];+ }++ }++ if (c === "'" || // string+ c === '"' || // string+ (c === '/' &&+ ((last_type === 'TK_WORD' && is_special_word(last_text)) ||+ (last_text === ')' && in_array(flags.previous_mode, ['(COND-EXPRESSION)', '(FOR-EXPRESSION)'])) ||+ (last_type === 'TK_COMMA' || last_type === 'TK_COMMENT' || last_type === 'TK_START_EXPR' || last_type === 'TK_START_BLOCK' || last_type === 'TK_END_BLOCK' || last_type === 'TK_OPERATOR' || last_type === 'TK_EQUALS' || last_type === 'TK_EOF' || last_type === 'TK_SEMICOLON')))) { // regexp+ var sep = c;+ var esc = false;+ var esc1 = 0;+ var esc2 = 0;+ resulting_string = c;++ if (parser_pos < input_length) {+ if (sep === '/') {+ //+ // handle regexp separately...+ //+ var in_char_class = false;+ while (esc || in_char_class || input.charAt(parser_pos) !== sep) {+ resulting_string += input.charAt(parser_pos);+ if (!esc) {+ esc = input.charAt(parser_pos) === '\\';+ if (input.charAt(parser_pos) === '[') {+ in_char_class = true;+ } else if (input.charAt(parser_pos) === ']') {+ in_char_class = false;+ }+ } else {+ esc = false;+ }+ parser_pos += 1;+ if (parser_pos >= input_length) {+ // incomplete string/rexp when end-of-file reached.+ // bail out with what had been received so far.+ return [resulting_string, 'TK_STRING'];+ }+ }++ } else {+ //+ // and handle string also separately+ //+ while (esc || input.charAt(parser_pos) !== sep) {+ resulting_string += input.charAt(parser_pos);+ if (esc1 && esc1 >= esc2) {+ esc1 = parseInt(resulting_string.substr(-esc2), 16);+ if (esc1 && esc1 >= 0x20 && esc1 <= 0x7e) {+ esc1 = String.fromCharCode(esc1);+ resulting_string = resulting_string.substr(0, resulting_string.length - esc2 - 2) + (((esc1 === sep) || (esc1 === '\\')) ? '\\' : '') + esc1;+ }+ esc1 = 0;+ }+ if (esc1) {+ esc1++;+ } else if (!esc) {+ esc = input.charAt(parser_pos) === '\\';+ } else {+ esc = false;+ if (opt_unescape_strings) {+ if (input.charAt(parser_pos) === 'x') {+ esc1++;+ esc2 = 2;+ } else if (input.charAt(parser_pos) === 'u') {+ esc1++;+ esc2 = 4;+ }+ }+ }+ parser_pos += 1;+ if (parser_pos >= input_length) {+ // incomplete string/rexp when end-of-file reached.+ // bail out with what had been received so far.+ return [resulting_string, 'TK_STRING'];+ }+ }+ }++++ }++ parser_pos += 1;++ resulting_string += sep;++ if (sep === '/') {+ // regexps may have modifiers /regexp/MOD , so fetch those, too+ while (parser_pos < input_length && in_array(input.charAt(parser_pos), wordchar)) {+ resulting_string += input.charAt(parser_pos);+ parser_pos += 1;+ }+ }+ return [resulting_string, 'TK_STRING'];+ }++ if (c === '#') {+++ if (output.length === 0 && input.charAt(parser_pos) === '!') {+ // shebang+ resulting_string = c;+ while (parser_pos < input_length && c !== '\n') {+ c = input.charAt(parser_pos);+ resulting_string += c;+ parser_pos += 1;+ }+ output.push(trim(resulting_string) + '\n');+ print_newline();+ return get_next_token();+ }++++ // Spidermonkey-specific sharp variables for circular references+ // https://developer.mozilla.org/En/Sharp_variables_in_JavaScript+ // http://mxr.mozilla.org/mozilla-central/source/js/src/jsscan.cpp around line 1935+ var sharp = '#';+ if (parser_pos < input_length && in_array(input.charAt(parser_pos), digits)) {+ do {+ c = input.charAt(parser_pos);+ sharp += c;+ parser_pos += 1;+ } while (parser_pos < input_length && c !== '#' && c !== '=');+ if (c === '#') {+ //+ } else if (input.charAt(parser_pos) === '[' && input.charAt(parser_pos + 1) === ']') {+ sharp += '[]';+ parser_pos += 2;+ } else if (input.charAt(parser_pos) === '{' && input.charAt(parser_pos + 1) === '}') {+ sharp += '{}';+ parser_pos += 2;+ }+ return [sharp, 'TK_WORD'];+ }+ }++ if (c === '<' && input.substring(parser_pos - 1, parser_pos + 3) === '<!--') {+ parser_pos += 3;+ c = '<!--';+ while (input.charAt(parser_pos) !== '\n' && parser_pos < input_length) {+ c += input.charAt(parser_pos);+ parser_pos++;+ }+ flags.in_html_comment = true;+ return [c, 'TK_COMMENT'];+ }++ if (c === '-' && flags.in_html_comment && input.substring(parser_pos - 1, parser_pos + 2) === '-->') {+ flags.in_html_comment = false;+ parser_pos += 2;+ if (wanted_newline) {+ print_newline();+ }+ return ['-->', 'TK_COMMENT'];+ }++ if (in_array(c, punct)) {+ while (parser_pos < input_length && in_array(c + input.charAt(parser_pos), punct)) {+ c += input.charAt(parser_pos);+ parser_pos += 1;+ if (parser_pos >= input_length) {+ break;+ }+ }++ if (c === ',') {+ return [c, 'TK_COMMA'];+ } else if (c === '=') {+ return [c, 'TK_EQUALS'];+ } else {+ return [c, 'TK_OPERATOR'];+ }+ }++ return [c, 'TK_UNKNOWN'];+ }++ //----------------------------------+ indent_string = '';+ while (opt_indent_size > 0) {+ indent_string += opt_indent_char;+ opt_indent_size -= 1;+ }++ while (js_source_text && (js_source_text.charAt(0) === ' ' || js_source_text.charAt(0) === '\t')) {+ preindent_string += js_source_text.charAt(0);+ js_source_text = js_source_text.substring(1);+ }+ input = js_source_text;++ last_word = ''; // last 'TK_WORD' passed+ last_type = 'TK_START_EXPR'; // last token type+ last_text = ''; // last token text+ last_last_text = ''; // pre-last token text+ output = [];++ do_block_just_closed = false;++ whitespace = "\n\r\t ".split('');+ wordchar = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$'.split('');+ digits = '0123456789'.split('');++ punct = '+ - * / % & ++ -- = += -= *= /= %= == === != !== > < >= <= >> << >>> >>>= >>= <<= && &= | || ! !! , : ? ^ ^= |= ::';+ punct += ' <%= <% %> <?= <? ?>'; // try to be a good boy and try not to break the markup language identifiers+ punct = punct.split(' ');++ // words which should always start on new line.+ line_starters = 'continue,try,throw,return,var,if,switch,case,default,for,while,break,function'.split(',');++ // states showing if we are currently in expression (i.e. "if" case) - 'EXPRESSION', or in usual block (like, procedure), 'BLOCK'.+ // some formatting depends on that.+ flag_store = [];+ set_mode('BLOCK');++ parser_pos = 0;+ while (true) {+ var t = get_next_token(parser_pos);+ token_text = t[0];+ token_type = t[1];+ if (token_type === 'TK_EOF') {+ break;+ }++ switch (token_type) {++ case 'TK_START_EXPR':++ if (token_text === '[') {++ if (last_type === 'TK_WORD' || last_text === ')') {+ // this is array index specifier, break immediately+ // a[x], fn()[x]+ if (in_array(last_text, line_starters)) {+ print_single_space();+ }+ set_mode('(EXPRESSION)');+ print_token();+ break;+ }++ if (flags.mode === '[EXPRESSION]' || flags.mode === '[INDENTED-EXPRESSION]') {+ if (last_last_text === ']' && last_text === ',') {+ // ], [ goes to new line+ if (flags.mode === '[EXPRESSION]') {+ flags.mode = '[INDENTED-EXPRESSION]';+ if (!opt_keep_array_indentation) {+ indent();+ }+ }+ set_mode('[EXPRESSION]');+ if (!opt_keep_array_indentation) {+ print_newline();+ }+ } else if (last_text === '[') {+ if (flags.mode === '[EXPRESSION]') {+ flags.mode = '[INDENTED-EXPRESSION]';+ if (!opt_keep_array_indentation) {+ indent();+ }+ }+ set_mode('[EXPRESSION]');++ if (!opt_keep_array_indentation) {+ print_newline();+ }+ } else {+ set_mode('[EXPRESSION]');+ }+ } else {+ set_mode('[EXPRESSION]');+ }++++ } else {+ if (last_word === 'for') {+ set_mode('(FOR-EXPRESSION)');+ } else if (in_array(last_word, ['if', 'while'])) {+ set_mode('(COND-EXPRESSION)');+ } else {+ set_mode('(EXPRESSION)');+ }+ }++ if (last_text === ';' || last_type === 'TK_START_BLOCK') {+ print_newline();+ } else if (last_type === 'TK_END_EXPR' || last_type === 'TK_START_EXPR' || last_type === 'TK_END_BLOCK' || last_text === '.') {+ if (wanted_newline) {+ print_newline();+ }+ // do nothing on (( and )( and ][ and ]( and .(+ } else if (last_type !== 'TK_WORD' && last_type !== 'TK_OPERATOR') {+ print_single_space();+ } else if (last_word === 'function' || last_word === 'typeof') {+ // function() vs function ()+ if (opt_jslint_happy) {+ print_single_space();+ }+ } else if (in_array(last_text, line_starters) || last_text === 'catch') {+ if (opt_space_before_conditional) {+ print_single_space();+ }+ }+ print_token();++ break;++ case 'TK_END_EXPR':+ if (token_text === ']') {+ if (opt_keep_array_indentation) {+ if (last_text === '}') {+ // trim_output();+ // print_newline(true);+ remove_indent();+ print_token();+ restore_mode();+ break;+ }+ } else {+ if (flags.mode === '[INDENTED-EXPRESSION]') {+ if (last_text === ']') {+ restore_mode();+ print_newline();+ print_token();+ break;+ }+ }+ }+ }+ restore_mode();+ print_token();+ break;++ case 'TK_START_BLOCK':++ if (last_word === 'do') {+ set_mode('DO_BLOCK');+ } else {+ set_mode('BLOCK');+ }+ if (opt_brace_style === "expand" || opt_brace_style === "expand-strict") {+ var empty_braces = false;+ if (opt_brace_style === "expand-strict") {+ empty_braces = (look_up() === '}');+ if (!empty_braces) {+ print_newline(true);+ }+ } else {+ if (last_type !== 'TK_OPERATOR') {+ if (last_text === '=' || (is_special_word(last_text) && last_text !== 'else')) {+ print_single_space();+ } else {+ print_newline(true);+ }+ }+ }+ print_token();+ if (!empty_braces) {+ indent();+ }+ } else {+ if (last_type !== 'TK_OPERATOR' && last_type !== 'TK_START_EXPR') {+ if (last_type === 'TK_START_BLOCK') {+ print_newline();+ } else {+ print_single_space();+ }+ } else {+ // if TK_OPERATOR or TK_START_EXPR+ if (is_array(flags.previous_mode) && last_text === ',') {+ if (last_last_text === '}') {+ // }, { in array context+ print_single_space();+ } else {+ print_newline(); // [a, b, c, {+ }+ }+ }+ indent();+ print_token();+ }++ break;++ case 'TK_END_BLOCK':+ restore_mode();+ if (opt_brace_style === "expand" || opt_brace_style === "expand-strict") {+ if (last_text !== '{') {+ print_newline();+ }+ print_token();+ } else {+ if (last_type === 'TK_START_BLOCK') {+ // nothing+ if (just_added_newline) {+ remove_indent();+ } else {+ // {}+ trim_output();+ }+ } else {+ if (is_array(flags.mode) && opt_keep_array_indentation) {+ // we REALLY need a newline here, but newliner would skip that+ opt_keep_array_indentation = false;+ print_newline();+ opt_keep_array_indentation = true;++ } else {+ print_newline();+ }+ }+ print_token();+ }+ break;++ case 'TK_WORD':++ // no, it's not you. even I have problems understanding how this works+ // and what does what.+ if (do_block_just_closed) {+ // do {} ## while ()+ print_single_space();+ print_token();+ print_single_space();+ do_block_just_closed = false;+ break;+ }++ prefix = 'NONE';++ if (token_text === 'function') {+ if (flags.var_line && last_type !== 'TK_EQUALS' ) {+ flags.var_line_reindented = true;+ }+ if ((just_added_newline || last_text === ';') && last_text !== '{'+ && last_type !== 'TK_BLOCK_COMMENT' && last_type !== 'TK_COMMENT') {+ // make sure there is a nice clean space of at least one blank line+ // before a new function definition+ n_newlines = just_added_newline ? n_newlines : 0;+ if (!opt_preserve_newlines) {+ n_newlines = 1;+ }++ for (var i = 0; i < 2 - n_newlines; i++) {+ print_newline(false);+ }+ }+ if (last_type === 'TK_WORD') {+ if (last_text === 'get' || last_text === 'set' || last_text === 'new' || last_text === 'return') {+ print_single_space();+ } else {+ print_newline();+ }+ } else if (last_type === 'TK_OPERATOR' || last_text === '=') {+ // foo = function+ print_single_space();+ } else if (is_expression(flags.mode)) {+ // print nothing+ } else {+ print_newline();+ }++ print_token();+ last_word = token_text;+ break;+ }++ if (token_text === 'case' || (token_text === 'default' && flags.in_case_statement)) {+ if (last_text === ':' || flags.case_body) {+ // switch cases following one another+ remove_indent();+ } else {+ // case statement starts in the same line where switch+ if (!opt_indent_case) {+ flags.indentation_level--;+ }+ print_newline();+ if (!opt_indent_case) {+ flags.indentation_level++;+ }+ }+ print_token();+ flags.in_case = true;+ flags.in_case_statement = true;+ flags.case_body = false;+ break;+ }++ if (last_type === 'TK_END_BLOCK') {++ if (!in_array(token_text.toLowerCase(), ['else', 'catch', 'finally'])) {+ prefix = 'NEWLINE';+ } else {+ if (opt_brace_style === "expand" || opt_brace_style === "end-expand" || opt_brace_style === "expand-strict") {+ prefix = 'NEWLINE';+ } else {+ prefix = 'SPACE';+ print_single_space();+ }+ }+ } else if (last_type === 'TK_SEMICOLON' && (flags.mode === 'BLOCK' || flags.mode === 'DO_BLOCK')) {+ prefix = 'NEWLINE';+ } else if (last_type === 'TK_SEMICOLON' && is_expression(flags.mode)) {+ prefix = 'SPACE';+ } else if (last_type === 'TK_STRING') {+ prefix = 'NEWLINE';+ } else if (last_type === 'TK_WORD') {+ if (last_text === 'else') {+ // eat newlines between ...else *** some_op...+ // won't preserve extra newlines in this place (if any), but don't care that much+ trim_output(true);+ }+ prefix = 'SPACE';+ } else if (last_type === 'TK_START_BLOCK') {+ prefix = 'NEWLINE';+ } else if (last_type === 'TK_END_EXPR') {+ print_single_space();+ prefix = 'NEWLINE';+ }++ if (in_array(token_text, line_starters) && last_text !== ')') {+ if (last_text === 'else') {+ prefix = 'SPACE';+ } else {+ prefix = 'NEWLINE';+ }++ }++ if (flags.if_line && last_type === 'TK_END_EXPR') {+ flags.if_line = false;+ }+ if (in_array(token_text.toLowerCase(), ['else', 'catch', 'finally'])) {+ if (last_type !== 'TK_END_BLOCK' || opt_brace_style === "expand" || opt_brace_style === "end-expand" || opt_brace_style === "expand-strict") {+ print_newline();+ } else {+ trim_output(true);+ print_single_space();+ }+ } else if (prefix === 'NEWLINE') {+ if (is_special_word(last_text)) {+ // no newline between 'return nnn'+ print_single_space();+ } else if (last_type !== 'TK_END_EXPR') {+ if ((last_type !== 'TK_START_EXPR' || token_text !== 'var') && last_text !== ':') {+ // no need to force newline on 'var': for (var x = 0...)+ if (token_text === 'if' && last_word === 'else' && last_text !== '{') {+ // no newline for } else if {+ print_single_space();+ } else {+ flags.var_line = false;+ flags.var_line_reindented = false;+ print_newline();+ }+ }+ } else if (in_array(token_text, line_starters) && last_text !== ')') {+ flags.var_line = false;+ flags.var_line_reindented = false;+ print_newline();+ }+ } else if (is_array(flags.mode) && last_text === ',' && last_last_text === '}') {+ print_newline(); // }, in lists get a newline treatment+ } else if (prefix === 'SPACE') {+ print_single_space();+ }+ print_token();+ last_word = token_text;++ if (token_text === 'var') {+ flags.var_line = true;+ flags.var_line_reindented = false;+ flags.var_line_tainted = false;+ }++ if (token_text === 'if') {+ flags.if_line = true;+ }+ if (token_text === 'else') {+ flags.if_line = false;+ }++ break;++ case 'TK_SEMICOLON':++ print_token();+ flags.var_line = false;+ flags.var_line_reindented = false;+ if (flags.mode === 'OBJECT') {+ // OBJECT mode is weird and doesn't get reset too well.+ flags.mode = 'BLOCK';+ }+ break;++ case 'TK_STRING':++ if (last_type === 'TK_END_EXPR' && in_array(flags.previous_mode, ['(COND-EXPRESSION)', '(FOR-EXPRESSION)'])) {+ print_single_space();+ } else if (last_type === 'TK_COMMENT' || last_type === 'TK_STRING' || last_type === 'TK_START_BLOCK' || last_type === 'TK_END_BLOCK' || last_type === 'TK_SEMICOLON') {+ print_newline();+ } else if (last_type === 'TK_WORD') {+ print_single_space();+ }+ print_token();+ break;++ case 'TK_EQUALS':+ if (flags.var_line) {+ // just got an '=' in a var-line, different formatting/line-breaking, etc will now be done+ flags.var_line_tainted = true;+ }+ print_single_space();+ print_token();+ print_single_space();+ break;++ case 'TK_COMMA':+ if (flags.var_line) {+ if (is_expression(flags.mode) || last_type === 'TK_END_BLOCK' ) {+ // do not break on comma, for(var a = 1, b = 2)+ flags.var_line_tainted = false;+ }+ if (flags.var_line_tainted) {+ print_token();+ flags.var_line_reindented = true;+ flags.var_line_tainted = false;+ print_newline();+ break;+ } else {+ flags.var_line_tainted = false;+ }++ print_token();+ print_single_space();+ break;+ }++ if (last_type === 'TK_COMMENT') {+ print_newline();+ }++ if (last_type === 'TK_END_BLOCK' && flags.mode !== "(EXPRESSION)") {+ print_token();+ if (flags.mode === 'OBJECT' && last_text === '}') {+ print_newline();+ } else {+ print_single_space();+ }+ } else {+ if (flags.mode === 'OBJECT') {+ print_token();+ print_newline();+ } else {+ // EXPR or DO_BLOCK+ print_token();+ print_single_space();+ }+ }+ break;+++ case 'TK_OPERATOR':++ var space_before = true;+ var space_after = true;++ if (is_special_word(last_text)) {+ // "return" had a special handling in TK_WORD. Now we need to return the favor+ print_single_space();+ print_token();+ break;+ }++ // hack for actionscript's import .*;+ if (token_text === '*' && last_type === 'TK_UNKNOWN' && !last_last_text.match(/^\d+$/)) {+ print_token();+ break;+ }++ if (token_text === ':' && flags.in_case) {+ if (opt_indent_case) {+ flags.case_body = true;+ }+ print_token(); // colon really asks for separate treatment+ print_newline();+ flags.in_case = false;+ break;+ }++ if (token_text === '::') {+ // no spaces around exotic namespacing syntax operator+ print_token();+ break;+ }++ if (in_array(token_text, ['--', '++', '!']) || (in_array(token_text, ['-', '+']) && (in_array(last_type, ['TK_START_BLOCK', 'TK_START_EXPR', 'TK_EQUALS', 'TK_OPERATOR']) || in_array(last_text, line_starters)))) {+ // unary operators (and binary +/- pretending to be unary) special cases++ space_before = false;+ space_after = false;++ if (last_text === ';' && is_expression(flags.mode)) {+ // for (;; ++i)+ // ^^^+ space_before = true;+ }+ if (last_type === 'TK_WORD' && in_array(last_text, line_starters)) {+ space_before = true;+ }++ if (flags.mode === 'BLOCK' && (last_text === '{' || last_text === ';')) {+ // { foo; --i }+ // foo(); --bar;+ print_newline();+ }+ } else if (token_text === '.') {+ // decimal digits or object.property+ space_before = false;++ } else if (token_text === ':') {+ if (flags.ternary_depth === 0) {+ if (flags.mode === 'BLOCK') {+ flags.mode = 'OBJECT';+ }+ space_before = false;+ } else {+ flags.ternary_depth -= 1;+ }+ } else if (token_text === '?') {+ flags.ternary_depth += 1;+ }+ if (space_before) {+ print_single_space();+ }++ print_token();++ if (space_after) {+ print_single_space();+ }++ break;++ case 'TK_BLOCK_COMMENT':++ var lines = split_newlines(token_text);+ var j; // iterator for this case++ if (all_lines_start_with(lines.slice(1), '*')) {+ // javadoc: reformat and reindent+ print_newline();+ output.push(lines[0]);+ for (j = 1; j < lines.length; j++) {+ print_newline();+ output.push(' ');+ output.push(trim(lines[j]));+ }++ } else {++ // simple block comment: leave intact+ if (lines.length > 1) {+ // multiline comment block starts with a new line+ print_newline();+ } else {+ // single-line /* comment */ stays where it is+ if (last_type === 'TK_END_BLOCK') {+ print_newline();+ } else {+ print_single_space();+ }++ }++ for (j = 0; j < lines.length; j++) {+ output.push(lines[j]);+ output.push("\n");+ }++ }+ if (look_up('\n') !== '\n') {+ print_newline();+ }+ break;++ case 'TK_INLINE_COMMENT':+ print_single_space();+ print_token();+ if (is_expression(flags.mode)) {+ print_single_space();+ } else {+ force_newline();+ }+ break;++ case 'TK_COMMENT':++ if (last_text === ',' && !wanted_newline) {+ trim_output(true);+ }+ if (last_type !== 'TK_COMMENT') {+ if (wanted_newline) {+ print_newline();+ } else {+ print_single_space();+ }+ }+ print_token();+ break;++ case 'TK_UNKNOWN':+ if (is_special_word(last_text)) {+ print_single_space();+ }+ print_token();+ break;+ }++ last_last_text = last_text;+ last_type = token_type;+ last_text = token_text;+ }++ var sweet_code = preindent_string + output.join('').replace(/[\r\n ]+$/, '');+ return sweet_code;++}++// Add support for CommonJS. Just put this file somewhere on your require.paths+// and you will be able to `var js_beautify = require("beautify").js_beautify`.+if (typeof exports !== "undefined") {+ exports.js_beautify = js_beautify;+}
+ docs/highlight.pack.js view
@@ -0,0 +1,1 @@+var hljs=new function(){function l(o){return o.replace(/&/gm,"&").replace(/</gm,"<")}function c(q,p,o){return RegExp(p,"m"+(q.cI?"i":"")+(o?"g":""))}function i(q){for(var o=0;o<q.childNodes.length;o++){var p=q.childNodes[o];if(p.nodeName=="CODE"){return p}if(!(p.nodeType==3&&p.nodeValue.match(/\s+/))){break}}}function g(s,r){var q="";for(var p=0;p<s.childNodes.length;p++){if(s.childNodes[p].nodeType==3){var o=s.childNodes[p].nodeValue;if(r){o=o.replace(/\n/g,"")}q+=o}else{if(s.childNodes[p].nodeName=="BR"){q+="\n"}else{q+=g(s.childNodes[p])}}}if(/MSIE [678]/.test(navigator.userAgent)){q=q.replace(/\r/g,"\n")}return q}function a(r){var p=r.className.split(/\s+/);p=p.concat(r.parentNode.className.split(/\s+/));for(var o=0;o<p.length;o++){var q=p[o].replace(/^language-/,"");if(d[q]||q=="no-highlight"){return q}}}function b(o){var p=[];(function(r,s){for(var q=0;q<r.childNodes.length;q++){if(r.childNodes[q].nodeType==3){s+=r.childNodes[q].nodeValue.length}else{if(r.childNodes[q].nodeName=="BR"){s+=1}else{p.push({event:"start",offset:s,node:r.childNodes[q]});s=arguments.callee(r.childNodes[q],s);p.push({event:"stop",offset:s,node:r.childNodes[q]})}}}return s})(o,0);return p}function k(x,y,w){var q=0;var v="";var s=[];function t(){if(x.length&&y.length){if(x[0].offset!=y[0].offset){return(x[0].offset<y[0].offset)?x:y}else{return y[0].event=="start"?x:y}}else{return x.length?x:y}}function r(B){var C="<"+B.nodeName.toLowerCase();for(var z=0;z<B.attributes.length;z++){var A=B.attributes[z];C+=" "+A.nodeName.toLowerCase();if(A.nodeValue!=undefined){C+='="'+l(A.nodeValue)+'"'}}return C+">"}while(x.length||y.length){var u=t().splice(0,1)[0];v+=l(w.substr(q,u.offset-q));q=u.offset;if(u.event=="start"){v+=r(u.node);s.push(u.node)}else{if(u.event=="stop"){var p=s.length;do{p--;var o=s[p];v+=("</"+o.nodeName.toLowerCase()+">")}while(o!=u.node);s.splice(p,1);while(p<s.length){v+=r(s[p]);p++}}}}v+=w.substr(q);return v}function f(I,C){function y(r,L){for(var K=0;K<L.c.length;K++){if(L.c[K].bR.test(r)){return L.c[K]}}}function v(K,r){if(B[K].e&&B[K].eR.test(r)){return 1}if(B[K].eW){var L=v(K-1,r);return L?L+1:0}return 0}function w(r,K){return K.iR&&K.iR.test(r)}function z(N,M){var L=[];for(var K=0;K<N.c.length;K++){L.push(N.c[K].b)}var r=B.length-1;do{if(B[r].e){L.push(B[r].e)}r--}while(B[r+1].eW);if(N.i){L.push(N.i)}return c(M,"("+L.join("|")+")",true)}function q(L,K){var M=B[B.length-1];if(!M.t){M.t=z(M,G)}M.t.lastIndex=K;var r=M.t.exec(L);if(r){return[L.substr(K,r.index-K),r[0],false]}else{return[L.substr(K),"",true]}}function o(N,r){var K=G.cI?r[0].toLowerCase():r[0];for(var M in N.kG){if(!N.kG.hasOwnProperty(M)){continue}var L=N.kG[M].hasOwnProperty(K);if(L){return[M,L]}}return false}function E(L,N){if(!N.k){return l(L)}var M="";var O=0;N.lR.lastIndex=0;var K=N.lR.exec(L);while(K){M+=l(L.substr(O,K.index-O));var r=o(N,K);if(r){s+=r[1];M+='<span class="'+r[0]+'">'+l(K[0])+"</span>"}else{M+=l(K[0])}O=N.lR.lastIndex;K=N.lR.exec(L)}M+=l(L.substr(O,L.length-O));return M}function J(r,L){if(L.sL&&d[L.sL]){var K=f(L.sL,r);s+=K.keyword_count;return K.value}else{return E(r,L)}}function H(L,r){var K=L.cN?'<span class="'+L.cN+'">':"";if(L.rB){p+=K;L.buffer=""}else{if(L.eB){p+=l(r)+K;L.buffer=""}else{p+=K;L.buffer=r}}B.push(L);A+=L.r}function D(N,K,P){var Q=B[B.length-1];if(P){p+=J(Q.buffer+N,Q);return false}var L=y(K,Q);if(L){p+=J(Q.buffer+N,Q);H(L,K);return L.rB}var r=v(B.length-1,K);if(r){var M=Q.cN?"</span>":"";if(Q.rE){p+=J(Q.buffer+N,Q)+M}else{if(Q.eE){p+=J(Q.buffer+N,Q)+M+l(K)}else{p+=J(Q.buffer+N+K,Q)+M}}while(r>1){M=B[B.length-2].cN?"</span>":"";p+=M;r--;B.length--}var O=B[B.length-1];B.length--;B[B.length-1].buffer="";if(O.starts){H(O.starts,"")}return Q.rE}if(w(K,Q)){throw"Illegal"}}var G=d[I];var B=[G.dM];var A=0;var s=0;var p="";try{var u=0;G.dM.buffer="";do{var x=q(C,u);var t=D(x[0],x[1],x[2]);u+=x[0].length;if(!t){u+=x[1].length}}while(!x[2]);if(B.length>1){throw"Illegal"}return{language:I,r:A,keyword_count:s,value:p}}catch(F){if(F=="Illegal"){return{language:null,r:0,keyword_count:0,value:l(C)}}else{throw F}}}function h(){function o(t,s,u){if(t.compiled){return}if(!u){t.bR=c(s,t.b?t.b:"\\B|\\b");if(!t.e&&!t.eW){t.e="\\B|\\b"}if(t.e){t.eR=c(s,t.e)}}if(t.i){t.iR=c(s,t.i)}if(t.r==undefined){t.r=1}if(t.k){t.lR=c(s,t.l||hljs.IR,true)}for(var r in t.k){if(!t.k.hasOwnProperty(r)){continue}if(t.k[r] instanceof Object){t.kG=t.k}else{t.kG={keyword:t.k}}break}if(!t.c){t.c=[]}t.compiled=true;for(var q=0;q<t.c.length;q++){o(t.c[q],s,false)}if(t.starts){o(t.starts,s,false)}}for(var p in d){if(!d.hasOwnProperty(p)){continue}o(d[p].dM,d[p],true)}}function e(){if(e.called){return}e.called=true;h()}function n(t,y,p){e();var A=g(t,p);var r=a(t);if(r=="no-highlight"){return}if(r){var w=f(r,A)}else{var w={language:"",keyword_count:0,r:0,value:l(A)};var x=w;for(var z in d){if(!d.hasOwnProperty(z)){continue}var u=f(z,A);if(u.keyword_count+u.r>x.keyword_count+x.r){x=u}if(u.keyword_count+u.r>w.keyword_count+w.r){x=w;w=u}}}var s=t.className;if(!s.match(w.language)){s=s?(s+" "+w.language):w.language}var o=b(t);if(o.length){var q=document.createElement("pre");q.innerHTML=w.value;w.value=k(o,b(q),A)}if(y){w.value=w.value.replace(/^((<[^>]+>|\t)+)/gm,function(B,E,D,C){return E.replace(/\t/g,y)})}if(p){w.value=w.value.replace(/\n/g,"<br>")}if(/MSIE [678]/.test(navigator.userAgent)&&t.tagName=="CODE"&&t.parentNode.tagName=="PRE"){var q=t.parentNode;var v=document.createElement("div");v.innerHTML="<pre><code>"+w.value+"</code></pre>";t=v.firstChild.firstChild;v.firstChild.cN=q.cN;q.parentNode.replaceChild(v.firstChild,q)}else{t.innerHTML=w.value}t.className=s;t.dataset={};t.dataset.result={language:w.language,kw:w.keyword_count,re:w.r};if(x&&x.language){t.dataset.second_best={language:x.language,kw:x.keyword_count,re:x.r}}}function j(){if(j.called){return}j.called=true;e();var q=document.getElementsByTagName("pre");for(var o=0;o<q.length;o++){var p=i(q[o]);if(p){n(p,hljs.tabReplace)}}}function m(){var o=arguments;var p=function(){j.apply(null,o)};if(window.addEventListener){window.addEventListener("DOMContentLoaded",p,false);window.addEventListener("load",p,false)}else{if(window.attachEvent){window.attachEvent("onload",p)}else{window.onload=p}}}var d={};this.LANGUAGES=d;this.initHighlightingOnLoad=m;this.highlightBlock=n;this.initHighlighting=j;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="\\b(0x[A-Za-z0-9]+|\\d+(\\.\\d+)?)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\.",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.inherit=function(o,r){var q={};for(var p in o){q[p]=o[p]}if(r){for(var p in r){q[p]=r[p]}}return q}}();hljs.LANGUAGES.bash=function(){var d={"true":1,"false":1};var b={cN:"variable",b:"\\$([a-zA-Z0-9_]+)\\b"};var a={cN:"variable",b:"\\$\\{(([^}])|(\\\\}))+\\}",c:[hljs.CNM]};var c={cN:"string",b:'"',e:'"',i:"\\n",c:[hljs.BE,b,a],r:0};var e={cN:"test_condition",b:"",e:"",c:[c,b,a,hljs.CNM],k:{literal:d},r:0};return{dM:{k:{keyword:{"if":1,then:1,"else":1,fi:1,"for":1,"break":1,"continue":1,"while":1,"in":1,"do":1,done:1,echo:1,exit:1,"return":1,set:1,declare:1},literal:d},c:[{cN:"shebang",b:"(#!\\/bin\\/bash)|(#!\\/bin\\/sh)",r:10},hljs.HCM,{cN:"comment",b:"\\/\\/",e:"$",i:"."},hljs.CNM,c,b,a,hljs.inherit(e,{b:"\\[ ",e:" \\]",r:0}),hljs.inherit(e,{b:"\\[\\[ ",e:" \\]\\]"})]}}}();hljs.LANGUAGES.erlang=function(){var g="[a-z'][a-zA-Z0-9_']*";var l="("+g+":"+g+"|"+g+")";var d={keyword:{after:1,and:1,andalso:10,band:1,begin:1,bnot:1,bor:1,bsl:1,bzr:1,bxor:1,"case":1,"catch":1,cond:1,div:1,end:1,fun:1,let:1,not:1,of:1,orelse:10,query:1,receive:1,rem:1,"try":1,when:1,xor:1},literal:{"false":1,"true":1}};var j={cN:"comment",b:"%",e:"$",r:0};var c={b:"fun\\s+"+g+"/\\d+"};var m={b:l+"\\(",e:"\\)",rB:true,r:0,c:[{cN:"function_name",b:l,r:0},{b:"\\(",e:"\\)",eW:true,rE:true,r:0}]};var f={cN:"tuple",b:"{",e:"}",r:0};var a={cN:"variable",b:"\\b_([A-Z][A-Za-z0-9_]*)?",r:0};var k={cN:"variable",b:"[A-Z][a-zA-Z0-9_]*",r:0};var h={b:"#",e:"}",i:".",r:0,rB:true,c:[{cN:"record_name",b:"#"+hljs.UIR,r:0},{b:"{",eW:true,r:0}]};var i={k:d,b:"(fun|receive|if|try|case)",e:"end"};i.c=[j,c,hljs.inherit(hljs.ASM,{cN:""}),i,m,hljs.QSM,hljs.CNM,f,a,k,h];var b=[j,c,i,m,hljs.QSM,hljs.CNM,f,a,k,h];m.c[1].c=b;f.c=b;h.c[1].c=b;var e={cN:"params",b:"\\(",e:"\\)",eW:true,c:b};return{dM:{k:d,i:"(</|\\*=|\\+=|-=|/=|/\\*|\\*/|\\(\\*|\\*\\))",c:[{cN:"function",b:"^"+g+"\\(",e:";|\\.",rB:true,c:[e,{cN:"title",b:g},{k:d,b:"->",eW:true,c:b}]},j,{cN:"pp",b:"^-",e:"\\.",r:0,eE:true,rB:true,l:"-"+hljs.IR,k:{"-module":1,"-record":1,"-undef":1,"-export":1,"-ifdef":1,"-ifndef":1,"-author":1,"-copyright":1,"-doc":1,"-vsn":1,"-import":1,"-include":1,"-include_lib":1,"-compile":1,"-define":1,"-else":1,"-endif":1,"-file":1,"-behaviour":1,"-behavior":1},c:[e]},hljs.CNM,hljs.QSM,h,a,k,f]}}}();hljs.LANGUAGES.cs={dM:{k:{"abstract":1,as:1,base:1,bool:1,"break":1,"byte":1,"case":1,"catch":1,"char":1,checked:1,"class":1,"const":1,"continue":1,decimal:1,"default":1,delegate:1,"do":1,"do":1,"double":1,"else":1,"enum":1,event:1,explicit:1,extern:1,"false":1,"finally":1,fixed:1,"float":1,"for":1,foreach:1,"goto":1,"if":1,implicit:1,"in":1,"int":1,"interface":1,internal:1,is:1,lock:1,"long":1,namespace:1,"new":1,"null":1,object:1,operator:1,out:1,override:1,params:1,"private":1,"protected":1,"public":1,readonly:1,ref:1,"return":1,sbyte:1,sealed:1,"short":1,sizeof:1,stackalloc:1,"static":1,string:1,struct:1,"switch":1,"this":1,"throw":1,"true":1,"try":1,"typeof":1,uint:1,ulong:1,unchecked:1,unsafe:1,ushort:1,using:1,virtual:1,"volatile":1,"void":1,"while":1,ascending:1,descending:1,from:1,get:1,group:1,into:1,join:1,let:1,orderby:1,partial:1,select:1,set:1,value:1,"var":1,where:1,yield:1},c:[{cN:"comment",b:"///",e:"$",rB:true,c:[{cN:"xmlDocTag",b:"///|<!--|-->"},{cN:"xmlDocTag",b:"</?",e:">"}]},hljs.CLCM,hljs.CBLCLM,{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},hljs.ASM,hljs.QSM,hljs.CNM]}};hljs.LANGUAGES.ruby=function(){var g="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?";var a="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var n={keyword:{and:1,"false":1,then:1,defined:1,module:1,"in":1,"return":1,redo:1,"if":1,BEGIN:1,retry:1,end:1,"for":1,"true":1,self:1,when:1,next:1,until:1,"do":1,begin:1,unless:1,END:1,rescue:1,nil:1,"else":1,"break":1,undef:1,not:1,"super":1,"class":1,"case":1,require:1,yield:1,alias:1,"while":1,ensure:1,elsif:1,or:1,def:1},keymethods:{__id__:1,__send__:1,abort:1,abs:1,"all?":1,allocate:1,ancestors:1,"any?":1,arity:1,assoc:1,at:1,at_exit:1,autoload:1,"autoload?":1,"between?":1,binding:1,binmode:1,"block_given?":1,call:1,callcc:1,caller:1,capitalize:1,"capitalize!":1,casecmp:1,"catch":1,ceil:1,center:1,chomp:1,"chomp!":1,chop:1,"chop!":1,chr:1,"class":1,class_eval:1,"class_variable_defined?":1,class_variables:1,clear:1,clone:1,close:1,close_read:1,close_write:1,"closed?":1,coerce:1,collect:1,"collect!":1,compact:1,"compact!":1,concat:1,"const_defined?":1,const_get:1,const_missing:1,const_set:1,constants:1,count:1,crypt:1,"default":1,default_proc:1,"delete":1,"delete!":1,delete_at:1,delete_if:1,detect:1,display:1,div:1,divmod:1,downcase:1,"downcase!":1,downto:1,dump:1,dup:1,each:1,each_byte:1,each_index:1,each_key:1,each_line:1,each_pair:1,each_value:1,each_with_index:1,"empty?":1,entries:1,eof:1,"eof?":1,"eql?":1,"equal?":1,"eval":1,exec:1,exit:1,"exit!":1,extend:1,fail:1,fcntl:1,fetch:1,fileno:1,fill:1,find:1,find_all:1,first:1,flatten:1,"flatten!":1,floor:1,flush:1,for_fd:1,foreach:1,fork:1,format:1,freeze:1,"frozen?":1,fsync:1,getc:1,gets:1,global_variables:1,grep:1,gsub:1,"gsub!":1,"has_key?":1,"has_value?":1,hash:1,hex:1,id:1,include:1,"include?":1,included_modules:1,index:1,indexes:1,indices:1,induced_from:1,inject:1,insert:1,inspect:1,instance_eval:1,instance_method:1,instance_methods:1,"instance_of?":1,"instance_variable_defined?":1,instance_variable_get:1,instance_variable_set:1,instance_variables:1,"integer?":1,intern:1,invert:1,ioctl:1,"is_a?":1,isatty:1,"iterator?":1,join:1,"key?":1,keys:1,"kind_of?":1,lambda:1,last:1,length:1,lineno:1,ljust:1,load:1,local_variables:1,loop:1,lstrip:1,"lstrip!":1,map:1,"map!":1,match:1,max:1,"member?":1,merge:1,"merge!":1,method:1,"method_defined?":1,method_missing:1,methods:1,min:1,module_eval:1,modulo:1,name:1,nesting:1,"new":1,next:1,"next!":1,"nil?":1,nitems:1,"nonzero?":1,object_id:1,oct:1,open:1,pack:1,partition:1,pid:1,pipe:1,pop:1,popen:1,pos:1,prec:1,prec_f:1,prec_i:1,print:1,printf:1,private_class_method:1,private_instance_methods:1,"private_method_defined?":1,private_methods:1,proc:1,protected_instance_methods:1,"protected_method_defined?":1,protected_methods:1,public_class_method:1,public_instance_methods:1,"public_method_defined?":1,public_methods:1,push:1,putc:1,puts:1,quo:1,raise:1,rand:1,rassoc:1,read:1,read_nonblock:1,readchar:1,readline:1,readlines:1,readpartial:1,rehash:1,reject:1,"reject!":1,remainder:1,reopen:1,replace:1,require:1,"respond_to?":1,reverse:1,"reverse!":1,reverse_each:1,rewind:1,rindex:1,rjust:1,round:1,rstrip:1,"rstrip!":1,scan:1,seek:1,select:1,send:1,set_trace_func:1,shift:1,singleton_method_added:1,singleton_methods:1,size:1,sleep:1,slice:1,"slice!":1,sort:1,"sort!":1,sort_by:1,split:1,sprintf:1,squeeze:1,"squeeze!":1,srand:1,stat:1,step:1,store:1,strip:1,"strip!":1,sub:1,"sub!":1,succ:1,"succ!":1,sum:1,superclass:1,swapcase:1,"swapcase!":1,sync:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,taint:1,"tainted?":1,tell:1,test:1,"throw":1,times:1,to_a:1,to_ary:1,to_f:1,to_hash:1,to_i:1,to_int:1,to_io:1,to_proc:1,to_s:1,to_str:1,to_sym:1,tr:1,"tr!":1,tr_s:1,"tr_s!":1,trace_var:1,transpose:1,trap:1,truncate:1,"tty?":1,type:1,ungetc:1,uniq:1,"uniq!":1,unpack:1,unshift:1,untaint:1,untrace_var:1,upcase:1,"upcase!":1,update:1,upto:1,"value?":1,values:1,values_at:1,warn:1,write:1,write_nonblock:1,"zero?":1,zip:1}};var h={cN:"yardoctag",b:"@[A-Za-z]+"};var d={cN:"comment",b:"#",e:"$",c:[h]};var c={cN:"comment",b:"^\\=begin",e:"^\\=end",c:[h],r:10};var b={cN:"comment",b:"^__END__",e:"\\n$"};var u={cN:"subst",b:"#\\{",e:"}",l:g,k:n};var p=[hljs.BE,u];var s={cN:"string",b:"'",e:"'",c:p,r:0};var r={cN:"string",b:'"',e:'"',c:p,r:0};var q={cN:"string",b:"%[qw]?\\(",e:"\\)",c:p,r:10};var o={cN:"string",b:"%[qw]?\\[",e:"\\]",c:p,r:10};var m={cN:"string",b:"%[qw]?{",e:"}",c:p,r:10};var l={cN:"string",b:"%[qw]?<",e:">",c:p,r:10};var k={cN:"string",b:"%[qw]?/",e:"/",c:p,r:10};var j={cN:"string",b:"%[qw]?%",e:"%",c:p,r:10};var i={cN:"string",b:"%[qw]?-",e:"-",c:p,r:10};var t={cN:"string",b:"%[qw]?\\|",e:"\\|",c:p,r:10};var e={cN:"function",b:"\\bdef\\s+",e:" |$|;",l:g,k:n,c:[{cN:"title",b:a,l:g,k:n},{cN:"params",b:"\\(",e:"\\)",l:g,k:n},d,c,b]};var f={cN:"identifier",b:g,l:g,k:n,r:0};var v=[d,c,b,s,r,q,o,m,l,k,j,i,t,{cN:"class",b:"\\b(class|module)\\b",e:"$|;",k:{"class":1,module:1},c:[{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",r:0},{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+hljs.IR+"::)?"+hljs.IR}]},d,c,b]},e,{cN:"constant",b:"(::)?([A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:[s,r,q,o,m,l,k,j,i,t,f],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"number",b:"\\?\\w"},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},f,{b:"("+hljs.RSR+")\\s*",c:[d,c,b,{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:[hljs.BE]}],r:0}];u.c=v;e.c[1].c=v;return{dM:{l:g,k:n,c:v}}}();hljs.LANGUAGES.diff={cI:true,dM:{c:[{cN:"chunk",b:"^\\@\\@ +\\-\\d+,\\d+ +\\+\\d+,\\d+ +\\@\\@$",r:10},{cN:"chunk",b:"^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$",r:10},{cN:"chunk",b:"^\\-\\-\\- +\\d+,\\d+ +\\-\\-\\-\\-$",r:10},{cN:"header",b:"Index: ",e:"$"},{cN:"header",b:"=====",e:"=====$"},{cN:"header",b:"^\\-\\-\\-",e:"$"},{cN:"header",b:"^\\*{3} ",e:"$"},{cN:"header",b:"^\\+\\+\\+",e:"$"},{cN:"header",b:"\\*{5}",e:"\\*{5}$"},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"change",b:"^\\!",e:"$"}]}};hljs.LANGUAGES.javascript={dM:{k:{keyword:{"in":1,"if":1,"for":1,"while":1,"finally":1,"var":1,"new":1,"function":1,"do":1,"return":1,"void":1,"else":1,"break":1,"catch":1,"instanceof":1,"with":1,"throw":1,"case":1,"default":1,"try":1,"this":1,"switch":1,"continue":1,"typeof":1,"delete":1},literal:{"true":1,"false":1,"null":1}},c:[hljs.ASM,hljs.QSM,hljs.CLCM,hljs.CBLCLM,hljs.CNM,{b:"("+hljs.RSR+"|case|return|throw)\\s*",k:{"return":1,"throw":1,"case":1},c:[hljs.CLCM,hljs.CBLCLM,{cN:"regexp",b:"/.*?[^\\\\/]/[gim]*"}],r:0},{cN:"function",b:"\\bfunction\\b",e:"{",k:{"function":1},c:[{cN:"title",b:"[A-Za-z$_][0-9A-Za-z$_]*"},{cN:"params",b:"\\(",e:"\\)",c:[hljs.ASM,hljs.QSM,hljs.CLCM,hljs.CBLCLM]}]}]}};hljs.LANGUAGES.lua=function(){var b="\\[=*\\[";var e="\\]=*\\]";var a={b:b,e:e};a.c=[a];var d={cN:"comment",b:"--(?!"+b+")",e:"$"};var c={cN:"comment",b:"--"+b,e:e,c:[a],r:10};return{dM:{l:hljs.UIR,k:{keyword:{and:1,"break":1,"do":1,"else":1,elseif:1,end:1,"false":1,"for":1,"if":1,"in":1,local:1,nil:1,not:1,or:1,repeat:1,"return":1,then:1,"true":1,until:1,"while":1},built_in:{_G:1,_VERSION:1,assert:1,collectgarbage:1,dofile:1,error:1,getfenv:1,getmetatable:1,ipairs:1,load:1,loadfile:1,loadstring:1,module:1,next:1,pairs:1,pcall:1,print:1,rawequal:1,rawget:1,rawset:1,require:1,select:1,setfenv:1,setmetatable:1,tonumber:1,tostring:1,type:1,unpack:1,xpcall:1,coroutine:1,debug:1,io:1,math:1,os:1,"package":1,string:1,table:1}},c:[d,c,{cN:"function",b:"\\bfunction\\b",e:"\\)",k:{"function":1},c:[{cN:"title",b:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"},{cN:"params",b:"\\(",eW:true,c:[d,c]},d,c]},hljs.CNM,hljs.ASM,hljs.QSM,{cN:"string",b:b,e:e,c:[a],r:10}]}}}();hljs.LANGUAGES.css=function(){var a={cN:"function",b:hljs.IR+"\\(",e:"\\)",c:[{eW:true,eE:true,c:[hljs.NM,hljs.ASM,hljs.QSM]}]};return{cI:true,dM:{i:"[=/|']",c:[hljs.CBLCLM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@font-face",l:"[a-z-]+",k:{"font-face":1}},{cN:"at_rule",b:"@",e:"[{;]",eE:true,k:{"import":1,page:1,media:1,charset:1},c:[a,hljs.ASM,hljs.QSM,hljs.NM]},{cN:"tag",b:hljs.IR,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[hljs.CBLCLM,{cN:"rule",b:"[^\\s]",rB:true,e:";",eW:true,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[a,hljs.NM,hljs.QSM,hljs.ASM,hljs.CBLCLM,{cN:"hexcolor",b:"\\#[0-9A-F]+"},{cN:"important",b:"!important"}]}}]}]}]}}}();hljs.LANGUAGES.xml=function(){var b="[A-Za-z0-9\\._:-]+";var a={eW:true,c:[{cN:"attribute",b:b,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,dM:{c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"<!DOCTYPE",e:">",r:10},{cN:"comment",b:"<!--",e:"-->",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"<style",e:">",k:{title:{style:1}},c:[a],starts:{cN:"css",e:"</style>",rE:true,sL:"css"}},{cN:"tag",b:"<script",e:">",k:{title:{script:1}},c:[a],starts:{cN:"javascript",e:"<\/script>",rE:true,sL:"javascript"}},{cN:"vbscript",b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"title",b:"[^ />]+"},a]}]}}}();hljs.LANGUAGES.lisp=function(){var m="[a-zA-Z_\\-\\+\\*\\/\\<\\=\\>\\&\\#][a-zA-Z0-9_\\-\\+\\*\\/\\<\\=\\>\\&\\#]*";var n="(\\-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s)(\\+|\\-)?\\d+)?";var c={cN:"literal",b:"\\b(t{1}|nil)\\b"};var o={cN:"number",b:n};var p={cN:"number",b:"#b[0-1]+(/[0-1]+)?"};var q={cN:"number",b:"#o[0-7]+(/[0-7]+)?"};var a={cN:"number",b:"#x[0-9a-f]+(/[0-9a-f]+)?"};var b={cN:"number",b:"#c\\("+n+" +"+n,e:"\\)"};var e={cN:"string",b:'"',e:'"',c:[hljs.BE],r:0};var l={cN:"comment",b:";",e:"$"};var d={cN:"variable",b:"\\*",e:"\\*"};var k={cN:"keyword",b:"[:&]"+m};var i={b:"\\(",e:"\\)"};i.c=[i,c,o,p,q,a,b,e];var g={cN:"quoted",b:"['`]\\(",e:"\\)",c:[o,p,q,a,b,e,d,k,i]};var f={cN:"quoted",b:"\\(quote ",e:"\\)",k:{title:{quote:1}},c:[o,p,q,a,b,e,d,k,i]};var j={cN:"list",b:"\\(",e:"\\)"};var h={cN:"body",eW:true,eE:true};j.c=[{cN:"title",b:m},h];h.c=[g,f,j,c,o,p,q,a,b,e,l,d,k];return{cI:true,dM:{i:"[^\\s]",c:[c,o,p,q,a,b,e,l,g,f,j]}}}();hljs.LANGUAGES.java={dM:{k:{"false":1,"synchronized":1,"int":1,"abstract":1,"float":1,"private":1,"char":1,"interface":1,"boolean":1,"static":1,"null":1,"if":1,"const":1,"for":1,"true":1,"while":1,"long":1,"throw":1,strictfp:1,"finally":1,"protected":1,"extends":1,"import":1,"native":1,"final":1,"implements":1,"return":1,"void":1,"enum":1,"else":1,"break":1,"transient":1,"new":1,"catch":1,"instanceof":1,"byte":1,"super":1,"class":1,"volatile":1,"case":1,assert:1,"short":1,"package":1,"default":1,"double":1,"public":1,"try":1,"this":1,"switch":1,"continue":1,"throws":1},c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",c:[{cN:"javadoctag",b:"@[A-Za-z]+"}],r:10},hljs.CLCM,hljs.CBLCLM,hljs.ASM,hljs.QSM,{cN:"class",b:"(class |interface )",e:"{",k:{"class":1,"interface":1},i:":",c:[{b:"(implements|extends)",k:{"extends":1,"implements":1},r:10},{cN:"title",b:hljs.UIR}]},hljs.CNM,{cN:"annotation",b:"@[A-Za-z]+"}]}};hljs.LANGUAGES.php={cI:true,dM:{k:{and:1,include_once:1,list:1,"abstract":1,global:1,"private":1,echo:1,"interface":1,as:1,"static":1,endswitch:1,array:1,"null":1,"if":1,endwhile:1,or:1,"const":1,"for":1,endforeach:1,self:1,"var":1,"while":1,isset:1,"public":1,"protected":1,exit:1,foreach:1,"throw":1,elseif:1,"extends":1,include:1,__FILE__:1,empty:1,require_once:1,"function":1,"do":1,xor:1,"return":1,"implements":1,parent:1,clone:1,use:1,__CLASS__:1,__LINE__:1,"else":1,"break":1,print:1,"eval":1,"new":1,"catch":1,__METHOD__:1,"class":1,"case":1,exception:1,php_user_filter:1,"default":1,die:1,require:1,__FUNCTION__:1,enddeclare:1,"final":1,"try":1,"this":1,"switch":1,"continue":1,endfor:1,endif:1,declare:1,unset:1,"true":1,"false":1,namespace:1},c:[hljs.CLCM,hljs.HCM,{cN:"comment",b:"/\\*",e:"\\*/",c:[{cN:"phpdoc",b:"\\s@[A-Za-z]+",r:10}]},hljs.CNM,hljs.inherit(hljs.ASM,{i:null}),hljs.inherit(hljs.QSM,{i:null}),{cN:"variable",b:"\\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"},{cN:"preprocessor",b:"<\\?php",r:10},{cN:"preprocessor",b:"\\?>"}]}};hljs.LANGUAGES.haskell=function(){var a={cN:"label",b:"\\b[A-Z][\\w\\']*",r:0};var b={cN:"container",b:"\\(",e:"\\)",c:[{cN:"label",b:"\\b[A-Z][\\w\\(\\)\\.\\']*"},{cN:"title",b:"[_a-z][\\w\\']*"}]};return{dM:{k:{keyword:{let:1,"in":1,"if":1,then:1,"else":1,"case":1,of:1,where:1,"do":1,module:1,"import":1,hiding:1,qualified:1,type:1,data:1,newtype:1,deriving:1,"class":1,instance:1,"null":1,not:1,as:1},built_in:{Bool:1,True:1,False:1,Int:1,Char:1,Maybe:1,Nothing:1,String:1}},c:[{cN:"comment",b:"--",e:"$"},{cN:"comment",b:"{-",e:"-}"},hljs.ASM,hljs.QSM,{cN:"import",b:"\\bimport",e:"$",k:{"import":1,qualified:1,as:1,hiding:1},c:[b]},{cN:"module",b:"\\bmodule",e:"where",k:{module:1,where:1},c:[b]},{cN:"class",b:"\\b(class|instance|data|(new)?type)",e:"(where|$)",k:{"class":1,where:1,instance:1,data:1,type:1,newtype:1,deriving:1},c:[a]},hljs.CNM,{cN:"shebang",b:"#!\\/usr\\/bin\\/env runhaskell",e:"$"},a,{cN:"title",b:"^[_a-z][\\w\\']*"}]}}}();hljs.LANGUAGES.python=function(){var c={cN:"string",b:"u?r?'''",e:"'''",r:10};var b={cN:"string",b:'u?r?"""',e:'"""',r:10};var a={cN:"string",b:"(u|r|ur)'",e:"'",c:[hljs.BE],r:10};var f={cN:"string",b:'(u|r|ur)"',e:'"',c:[hljs.BE],r:10};var d={cN:"title",b:hljs.UIR};var e={cN:"params",b:"\\(",e:"\\)",c:[c,b,a,f,hljs.ASM,hljs.QSM]};return{dM:{k:{keyword:{and:1,elif:1,is:1,global:1,as:1,"in":1,"if":1,from:1,raise:1,"for":1,except:1,"finally":1,print:1,"import":1,pass:1,"return":1,exec:1,"else":1,"break":1,not:1,"with":1,"class":1,assert:1,yield:1,"try":1,"while":1,"continue":1,del:1,or:1,def:1,lambda:1,nonlocal:10},built_in:{None:1,True:1,False:1,Ellipsis:1,NotImplemented:1}},i:"(</|->|\\?)",c:[hljs.HCM,c,b,a,f,hljs.ASM,hljs.QSM,{cN:"function",b:"\\bdef ",e:":",i:"$",k:{def:1},c:[d,e],r:10},{cN:"class",b:"\\bclass ",e:":",i:"[${]",k:{"class":1},c:[d,e],r:10},hljs.CNM,{cN:"decorator",b:"@",e:"$"}]}}}();hljs.LANGUAGES.smalltalk=function(){var b="[a-z][a-zA-Z0-9_]*";var c={cN:"char",b:"\\$.{1}"};var a={cN:"symbol",b:"#"+hljs.UIR};return{dM:{k:{self:1,"super":1,nil:1,"true":1,"false":1,thisContext:1},c:[{cN:"comment",b:'"',e:'"',r:0},hljs.ASM,{cN:"class",b:"\\b[A-Z][A-Za-z0-9_]*",r:0},{cN:"method",b:b+":"},hljs.CNM,a,c,{cN:"localvars",b:"\\|\\s*(("+b+")\\s*)+\\|"},{cN:"array",b:"\\#\\(",e:"\\)",c:[hljs.ASM,c,hljs.CNM,a]}]}}}();hljs.LANGUAGES.tex=function(){var c={cN:"command",b:"\\\\[a-zA-Zа-яА-я]+[\\*]?",r:10};var b={cN:"command",b:"\\\\[^a-zA-Zа-яА-я0-9]",r:0};var a={cN:"special",b:"[{}\\[\\]\\&#~]",r:0};return{dM:{c:[{b:"\\\\[a-zA-Zа-яА-я]+[\\*]? *= *-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?",rB:true,c:[c,b,{cN:"number",b:" *=",e:"-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?",eB:true}],r:10},c,b,a,{cN:"formula",b:"\\$\\$",e:"\\$\\$",c:[c,b,a],r:0},{cN:"formula",b:"\\$",e:"\\$",c:[c,b,a],r:0},{cN:"comment",b:"%",e:"$",r:0}]}}}();hljs.LANGUAGES.sql={cI:true,dM:{i:"[^\\s]",c:[{cN:"operator",b:"(begin|start|commit|rollback|savepoint|lock|alter|create|drop|rename|call|delete|do|handler|insert|load|replace|select|truncate|update|set|show|pragma)\\b",e:";|$",k:{keyword:{all:1,partial:1,global:1,month:1,current_timestamp:1,using:1,go:1,revoke:1,smallint:1,indicator:1,"end-exec":1,disconnect:1,zone:1,"with":1,character:1,assertion:1,to:1,add:1,current_user:1,usage:1,input:1,local:1,alter:1,match:1,collate:1,real:1,then:1,rollback:1,get:1,read:1,timestamp:1,session_user:1,not:1,integer:1,bit:1,unique:1,day:1,minute:1,desc:1,insert:1,execute:1,like:1,ilike:2,level:1,decimal:1,drop:1,"continue":1,isolation:1,found:1,where:1,constraints:1,domain:1,right:1,national:1,some:1,module:1,transaction:1,relative:1,second:1,connect:1,escape:1,close:1,system_user:1,"for":1,deferred:1,section:1,cast:1,current:1,sqlstate:1,allocate:1,intersect:1,deallocate:1,numeric:1,"public":1,preserve:1,full:1,"goto":1,initially:1,asc:1,no:1,key:1,output:1,collation:1,group:1,by:1,union:1,session:1,both:1,last:1,language:1,constraint:1,column:1,of:1,space:1,foreign:1,deferrable:1,prior:1,connection:1,unknown:1,action:1,commit:1,view:1,or:1,first:1,into:1,"float":1,year:1,primary:1,cascaded:1,except:1,restrict:1,set:1,references:1,names:1,table:1,outer:1,open:1,select:1,size:1,are:1,rows:1,from:1,prepare:1,distinct:1,leading:1,create:1,only:1,next:1,inner:1,authorization:1,schema:1,corresponding:1,option:1,declare:1,precision:1,immediate:1,"else":1,timezone_minute:1,external:1,varying:1,translation:1,"true":1,"case":1,exception:1,join:1,hour:1,"default":1,"double":1,scroll:1,value:1,cursor:1,descriptor:1,values:1,dec:1,fetch:1,procedure:1,"delete":1,and:1,"false":1,"int":1,is:1,describe:1,"char":1,as:1,at:1,"in":1,varchar:1,"null":1,trailing:1,any:1,absolute:1,current_time:1,end:1,grant:1,privileges:1,when:1,cross:1,check:1,write:1,current_date:1,pad:1,begin:1,temporary:1,exec:1,time:1,update:1,catalog:1,user:1,sql:1,date:1,on:1,identity:1,timezone_hour:1,natural:1,whenever:1,interval:1,work:1,order:1,cascade:1,diagnostics:1,nchar:1,having:1,left:1,call:1,"do":1,handler:1,load:1,replace:1,truncate:1,start:1,lock:1,show:1,pragma:1},aggregate:{count:1,sum:1,min:1,max:1,avg:1}},c:[{cN:"string",b:"'",e:"'",c:[hljs.BE,{b:"''"}],r:0},{cN:"string",b:'"',e:'"',c:[hljs.BE,{b:'""'}],r:0},{cN:"string",b:"`",e:"`",c:[hljs.BE]},hljs.CNM,{b:"\\n"}]},hljs.CBLCLM,{cN:"comment",b:"--",e:"$"}]}};hljs.LANGUAGES.ini={cI:true,dM:{i:"[^\\s]",c:[{cN:"comment",b:";",e:"$"},{cN:"title",b:"^\\[",e:"\\]"},{cN:"setting",b:"^[a-z0-9_\\[\\]]+[ \\t]*=[ \\t]*",e:"$",c:[{cN:"value",eW:true,k:{on:1,off:1,"true":1,"false":1,yes:1,no:1},c:[hljs.QSM,hljs.NM]}]}]}};hljs.LANGUAGES.perl=function(){var c={getpwent:1,getservent:1,quotemeta:1,msgrcv:1,scalar:1,kill:1,dbmclose:1,undef:1,lc:1,ma:1,syswrite:1,tr:1,send:1,umask:1,sysopen:1,shmwrite:1,vec:1,qx:1,utime:1,local:1,oct:1,semctl:1,localtime:1,readpipe:1,"do":1,"return":1,format:1,read:1,sprintf:1,dbmopen:1,pop:1,getpgrp:1,not:1,getpwnam:1,rewinddir:1,qq:1,fileno:1,qw:1,endprotoent:1,wait:1,sethostent:1,bless:1,s:1,opendir:1,"continue":1,each:1,sleep:1,endgrent:1,shutdown:1,dump:1,chomp:1,connect:1,getsockname:1,die:1,socketpair:1,close:1,flock:1,exists:1,index:1,shmget:1,sub:1,"for":1,endpwent:1,redo:1,lstat:1,msgctl:1,setpgrp:1,abs:1,exit:1,select:1,print:1,ref:1,gethostbyaddr:1,unshift:1,fcntl:1,syscall:1,"goto":1,getnetbyaddr:1,join:1,gmtime:1,symlink:1,semget:1,splice:1,x:1,getpeername:1,recv:1,log:1,setsockopt:1,cos:1,last:1,reverse:1,gethostbyname:1,getgrnam:1,study:1,formline:1,endhostent:1,times:1,chop:1,length:1,gethostent:1,getnetent:1,pack:1,getprotoent:1,getservbyname:1,rand:1,mkdir:1,pos:1,chmod:1,y:1,substr:1,endnetent:1,printf:1,next:1,open:1,msgsnd:1,readdir:1,use:1,unlink:1,getsockopt:1,getpriority:1,rindex:1,wantarray:1,hex:1,system:1,getservbyport:1,endservent:1,"int":1,chr:1,untie:1,rmdir:1,prototype:1,tell:1,listen:1,fork:1,shmread:1,ucfirst:1,setprotoent:1,"else":1,sysseek:1,link:1,getgrgid:1,shmctl:1,waitpid:1,unpack:1,getnetbyname:1,reset:1,chdir:1,grep:1,split:1,require:1,caller:1,lcfirst:1,until:1,warn:1,"while":1,values:1,shift:1,telldir:1,getpwuid:1,my:1,getprotobynumber:1,"delete":1,and:1,sort:1,uc:1,defined:1,srand:1,accept:1,"package":1,seekdir:1,getprotobyname:1,semop:1,our:1,rename:1,seek:1,"if":1,q:1,chroot:1,sysread:1,setpwent:1,no:1,crypt:1,getc:1,chown:1,sqrt:1,write:1,setnetent:1,setpriority:1,foreach:1,tie:1,sin:1,msgget:1,map:1,stat:1,getlogin:1,unless:1,elsif:1,truncate:1,exec:1,keys:1,glob:1,tied:1,closedir:1,ioctl:1,socket:1,readlink:1,"eval":1,xor:1,readline:1,binmode:1,setservent:1,eof:1,ord:1,bind:1,alarm:1,pipe:1,atan2:1,getgrent:1,exp:1,time:1,push:1,setgrent:1,gt:1,lt:1,or:1,ne:1,m:1};var d={cN:"subst",b:"[$@]\\{",e:"}",k:c,r:10};var b={cN:"variable",b:"\\$\\d"};var a={cN:"variable",b:"[\\$\\%\\@\\*](\\^\\w\\b|#\\w+(\\:\\:\\w+)*|[^\\s\\w{]|{\\w+}|\\w+(\\:\\:\\w*)*)"};var f=[hljs.BE,d,b,a];var e=[hljs.HCM,{cN:"comment",b:"^(__END__|__DATA__)",e:"\\n$",r:5},{cN:"string",b:"q[qwxr]?\\s*\\(",e:"\\)",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\[",e:"\\]",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\{",e:"\\}",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\|",e:"\\|",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\<",e:"\\>",c:f,r:5},{cN:"string",b:"qw\\s+q",e:"q",c:f,r:5},{cN:"string",b:"'",e:"'",c:[hljs.BE],r:0},{cN:"string",b:'"',e:'"',c:f,r:0},{cN:"string",b:"`",e:"`",c:[hljs.BE]},{cN:"string",b:"{\\w+}",r:0},{cN:"string",b:"-?\\w+\\s*\\=\\>",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[hljs.BE],r:0},{cN:"sub",b:"\\bsub\\b",e:"(\\s*\\(.*?\\))?[;{]",k:{sub:1},r:5},b,a,{cN:"operator",b:"-\\w\\b",r:0},{cN:"pod",b:"\\=\\w",e:"\\=cut"}];d.c=e;return{dM:{k:c,c:e}}}();hljs.LANGUAGES.scala=function(){var a={cN:"annotation",b:"@[A-Za-z]+"};var b={cN:"string",b:'u?r?"""',e:'"""',r:10};return{dM:{k:{type:1,yield:1,lazy:1,override:1,def:1,"with":1,val:1,"var":1,"false":1,"true":1,sealed:1,"abstract":1,"private":1,trait:1,object:1,"null":1,"if":1,"for":1,"while":1,"throw":1,"finally":1,"protected":1,"extends":1,"import":1,"final":1,"return":1,"else":1,"break":1,"new":1,"catch":1,"super":1,"class":1,"case":1,"package":1,"default":1,"try":1,"this":1,match:1,"continue":1,"throws":1},c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",c:[{cN:"javadoctag",b:"@[A-Za-z]+"}],r:10},hljs.CLCM,hljs.CBLCLM,hljs.ASM,hljs.QSM,b,{cN:"class",b:"((case )?class |object |trait )",e:"({|$)",i:":",k:{"case":1,"class":1,trait:1,object:1},c:[{b:"(extends|with)",k:{"extends":1,"with":1},r:10},{cN:"title",b:hljs.UIR},{cN:"params",b:"\\(",e:"\\)",c:[hljs.ASM,hljs.QSM,b,a]}]},hljs.CNM,a]}}}();hljs.LANGUAGES.cmake={cI:true,dM:{k:{add_custom_command:2,add_custom_target:2,add_definitions:2,add_dependencies:2,add_executable:2,add_library:2,add_subdirectory:2,add_executable:2,add_library:2,add_subdirectory:2,add_test:2,aux_source_directory:2,"break":1,build_command:2,cmake_minimum_required:3,cmake_policy:3,configure_file:1,create_test_sourcelist:1,define_property:1,"else":1,elseif:1,enable_language:2,enable_testing:2,endforeach:1,endfunction:1,endif:1,endmacro:1,endwhile:1,execute_process:2,"export":1,find_file:1,find_library:2,find_package:2,find_path:1,find_program:1,fltk_wrap_ui:2,foreach:1,"function":1,get_cmake_property:3,get_directory_property:1,get_filename_component:1,get_property:1,get_source_file_property:1,get_target_property:1,get_test_property:1,"if":1,include:1,include_directories:2,include_external_msproject:1,include_regular_expression:2,install:1,link_directories:1,load_cache:1,load_command:1,macro:1,mark_as_advanced:1,message:1,option:1,output_required_files:1,project:1,qt_wrap_cpp:2,qt_wrap_ui:2,remove_definitions:2,"return":1,separate_arguments:1,set:1,set_directory_properties:1,set_property:1,set_source_files_properties:1,set_target_properties:1,set_tests_properties:1,site_name:1,source_group:1,string:1,target_link_libraries:2,try_compile:2,try_run:2,unset:1,variable_watch:2,"while":1,build_name:1,exec_program:1,export_library_dependencies:1,install_files:1,install_programs:1,install_targets:1,link_libraries:1,make_directory:1,remove:1,subdir_depends:1,subdirs:1,use_mangled_mesa:1,utility_source:1,variable_requires:1,write_file:1},c:[{cN:"envvar",b:"\\${",e:"}"},hljs.HCM,hljs.QSM,hljs.NM]}};hljs.LANGUAGES.objectivec=function(){var a={keyword:{"false":1,"int":1,"float":1,"while":1,"private":1,"char":1,"catch":1,"export":1,sizeof:2,typedef:2,"const":1,struct:1,"for":1,union:1,unsigned:1,"long":1,"volatile":2,"static":1,"protected":1,bool:1,mutable:1,"if":1,"public":1,"do":1,"return":1,"goto":1,"void":2,"enum":1,"else":1,"break":1,extern:1,"true":1,"class":1,asm:1,"case":1,"short":1,"default":1,"double":1,"throw":1,register:1,explicit:1,signed:1,typename:1,"try":1,"this":1,"switch":1,"continue":1,wchar_t:1,inline:1,readonly:1,assign:1,property:1,protocol:10,self:1,"synchronized":1,end:1,synthesize:50,id:1,optional:1,required:1,implementation:10,nonatomic:1,"interface":1,"super":1,unichar:1,"finally":2,dynamic:2,nil:1},built_in:{YES:5,NO:5,NULL:1,IBOutlet:50,IBAction:50,NSString:50,NSDictionary:50,CGRect:50,CGPoint:50,NSRange:50,release:1,retain:1,autorelease:50,UIButton:50,UILabel:50,UITextView:50,UIWebView:50,MKMapView:50,UISegmentedControl:50,NSObject:50,UITableViewDelegate:50,UITableViewDataSource:50,NSThread:50,UIActivityIndicator:50,UITabbar:50,UIToolBar:50,UIBarButtonItem:50,UIImageView:50,NSAutoreleasePool:50,UITableView:50,BOOL:1,NSInteger:20,CGFloat:20,NSException:50,NSLog:50,NSMutableString:50,NSMutableArray:50,NSMutableDictionary:50,NSURL:50}};return{dM:{k:a,i:"</",c:[hljs.CLCM,hljs.CBLCLM,hljs.CNM,hljs.QSM,{cN:"string",b:"'",e:"[^\\\\]'",i:"[^\\\\][^']"},{cN:"preprocessor",b:"#import",e:"$",c:[{cN:"title",b:'"',e:'"'},{cN:"title",b:"<",e:">"}]},{cN:"preprocessor",b:"#",e:"$"},{cN:"class",b:"interface|class|protocol|implementation",e:"({|$)",k:{"interface":1,"class":1,protocol:5,implementation:5},c:[{cN:"id",b:hljs.UIR}]}]}}}();hljs.LANGUAGES.nginx=function(){var c={cN:"variable",b:"\\$\\d+"};var b={cN:"variable",b:"\\${",e:"}"};var a={cN:"variable",b:"[\\$\\@]"+hljs.UIR};return{dM:{c:[hljs.HCM,{b:hljs.UIR,e:";|{",rE:true,k:{accept_mutex:1,accept_mutex_delay:1,access_log:1,add_after_body:1,add_before_body:1,add_header:1,addition_types:1,alias:1,allow:1,ancient_browser:1,ancient_browser:1,ancient_browser_value:1,ancient_browser_value:1,auth_basic:1,auth_basic_user_file:1,autoindex:1,autoindex_exact_size:1,autoindex_localtime:1,"break":1,charset:1,charset:1,charset_map:1,charset_map:1,charset_types:1,charset_types:1,client_body_buffer_size:1,client_body_in_file_only:1,client_body_in_single_buffer:1,client_body_temp_path:1,client_body_timeout:1,client_header_buffer_size:1,client_header_timeout:1,client_max_body_size:1,connection_pool_size:1,connections:1,create_full_put_path:1,daemon:1,dav_access:1,dav_methods:1,debug_connection:1,debug_points:1,default_type:1,deny:1,directio:1,directio_alignment:1,echo:1,echo_after_body:1,echo_before_body:1,echo_blocking_sleep:1,echo_duplicate:1,echo_end:1,echo_exec:1,echo_flush:1,echo_foreach_split:1,echo_location:1,echo_location_async:1,echo_read_request_body:1,echo_request_body:1,echo_reset_timer:1,echo_sleep:1,echo_subrequest:1,echo_subrequest_async:1,empty_gif:1,empty_gif:1,env:1,error_log:1,error_log:1,error_page:1,events:1,expires:1,fastcgi_bind:1,fastcgi_buffer_size:1,fastcgi_buffers:1,fastcgi_busy_buffers_size:1,fastcgi_cache:1,fastcgi_cache_key:1,fastcgi_cache_methods:1,fastcgi_cache_min_uses:1,fastcgi_cache_path:1,fastcgi_cache_use_stale:1,fastcgi_cache_valid:1,fastcgi_catch_stderr:1,fastcgi_connect_timeout:1,fastcgi_hide_header:1,fastcgi_ignore_client_abort:1,fastcgi_ignore_headers:1,fastcgi_index:1,fastcgi_intercept_errors:1,fastcgi_max_temp_file_size:1,fastcgi_next_upstream:1,fastcgi_param:1,fastcgi_pass:1,fastcgi_pass_header:1,fastcgi_pass_request_body:1,fastcgi_pass_request_headers:1,fastcgi_read_timeout:1,fastcgi_send_lowat:1,fastcgi_send_timeout:1,fastcgi_split_path_info:1,fastcgi_store:1,fastcgi_store_access:1,fastcgi_temp_file_write_size:1,fastcgi_temp_path:1,fastcgi_upstream_fail_timeout:1,fastcgi_upstream_max_fails:1,flv:1,geo:1,geo:1,geoip_city:1,geoip_country:1,gzip:1,gzip_buffers:1,gzip_comp_level:1,gzip_disable:1,gzip_hash:1,gzip_http_version:1,gzip_min_length:1,gzip_no_buffer:1,gzip_proxied:1,gzip_static:1,gzip_types:1,gzip_vary:1,gzip_window:1,http:1,"if":1,if_modified_since:1,ignore_invalid_headers:1,image_filter:1,image_filter_buffer:1,image_filter_jpeg_quality:1,image_filter_transparency:1,include:1,index:1,internal:1,ip_hash:1,js:1,js_load:1,js_require:1,js_utf8:1,keepalive_requests:1,keepalive_timeout:1,kqueue_changes:1,kqueue_events:1,large_client_header_buffers:1,limit_conn:1,limit_conn_log_level:1,limit_except:1,limit_rate:1,limit_rate_after:1,limit_req:1,limit_req_log_level:1,limit_req_zone:1,limit_zone:1,lingering_time:1,lingering_timeout:1,listen:1,location:1,lock_file:1,log_format:1,log_not_found:1,log_subrequest:1,map:1,map_hash_bucket_size:1,map_hash_max_size:1,master_process:1,memcached_bind:1,memcached_buffer_size:1,memcached_connect_timeout:1,memcached_next_upstream:1,memcached_pass:1,memcached_read_timeout:1,memcached_send_timeout:1,memcached_upstream_fail_timeout:1,memcached_upstream_max_fails:1,merge_slashes:1,min_delete_depth:1,modern_browser:1,modern_browser:1,modern_browser_value:1,modern_browser_value:1,more_clear_headers:1,more_clear_input_headers:1,more_set_headers:1,more_set_input_headers:1,msie_padding:1,msie_refresh:1,multi_accept:1,open_file_cache:1,open_file_cache_errors:1,open_file_cache_events:1,open_file_cache_min_uses:1,open_file_cache_retest:1,open_file_cache_valid:1,open_log_file_cache:1,optimize_server_names:1,output_buffers:1,override_charset:1,override_charset:1,perl:1,perl_modules:1,perl_require:1,perl_set:1,pid:1,port_in_redirect:1,post_action:1,postpone_gzipping:1,postpone_output:1,proxy_bind:1,proxy_buffer_size:1,proxy_buffering:1,proxy_buffers:1,proxy_busy_buffers_size:1,proxy_cache:1,proxy_cache_key:1,proxy_cache_methods:1,proxy_cache_min_uses:1,proxy_cache_path:1,proxy_cache_use_stale:1,proxy_cache_valid:1,proxy_connect_timeout:1,proxy_headers_hash_bucket_size:1,proxy_headers_hash_max_size:1,proxy_hide_header:1,proxy_ignore_client_abort:1,proxy_ignore_headers:1,proxy_intercept_errors:1,proxy_max_temp_file_size:1,proxy_method:1,proxy_next_upstream:1,proxy_pass:1,proxy_pass_header:1,proxy_pass_request_body:1,proxy_pass_request_headers:1,proxy_read_timeout:1,proxy_redirect:1,proxy_send_lowat:1,proxy_send_timeout:1,proxy_set_body:1,proxy_set_header:1,proxy_store:1,proxy_store_access:1,proxy_temp_file_write_size:1,proxy_temp_path:1,proxy_upstream_fail_timeout:1,proxy_upstream_max_fails:1,push_authorized_channels_only:1,push_channel_group:1,push_max_channel_id_length:1,push_max_channel_subscribers:1,push_max_message_buffer_length:1,push_max_reserved_memory:1,push_message_buffer_length:1,push_message_timeout:1,push_min_message_buffer_length:1,push_min_message_recipients:1,push_publisher:1,push_store_messages:1,push_subscriber:1,push_subscriber_concurrency:1,random_index:1,read_ahead:1,real_ip_header:1,recursive_error_pages:1,request_pool_size:1,reset_timedout_connection:1,resolver:1,resolver_timeout:1,"return":1,rewrite:1,rewrite_log:1,root:1,satisfy:1,satisfy_any:1,send_lowat:1,send_timeout:1,sendfile:1,sendfile_max_chunk:1,server:1,server:1,server_name:1,server_name_in_redirect:1,server_names_hash_bucket_size:1,server_names_hash_max_size:1,server_tokens:1,set:1,set_real_ip_from:1,source_charset:1,source_charset:1,ssi:1,ssi_ignore_recycled_buffers:1,ssi_min_file_chunk:1,ssi_silent_errors:1,ssi_types:1,ssi_value_length:1,ssl:1,ssl_certificate:1,ssl_certificate_key:1,ssl_ciphers:1,ssl_client_certificate:1,ssl_crl:1,ssl_dhparam:1,ssl_prefer_server_ciphers:1,ssl_protocols:1,ssl_session_cache:1,ssl_session_timeout:1,ssl_verify_client:1,ssl_verify_depth:1,sub_filter:1,sub_filter_once:1,sub_filter_types:1,tcp_nodelay:1,tcp_nopush:1,timer_resolution:1,try_files:1,types:1,types_hash_bucket_size:1,types_hash_max_size:1,underscores_in_headers:1,uninitialized_variable_warn:1,upstream:1,use:1,user:1,userid:1,userid:1,userid_domain:1,userid_domain:1,userid_expires:1,userid_expires:1,userid_mark:1,userid_name:1,userid_name:1,userid_p3p:1,userid_p3p:1,userid_path:1,userid_path:1,userid_service:1,userid_service:1,valid_referers:1,variables_hash_bucket_size:1,variables_hash_max_size:1,worker_connections:1,worker_cpu_affinity:1,worker_priority:1,worker_processes:1,worker_rlimit_core:1,worker_rlimit_nofile:1,worker_rlimit_sigpending:1,working_directory:1,xml_entities:1,xslt_stylesheet:1,xslt_types:1},r:0,c:[hljs.HCM,{b:"\\s",e:"[;{]",rB:true,rE:true,l:"[a-z/]+",k:{built_in:{on:1,off:1,yes:1,no:1,"true":1,"false":1,none:1,blocked:1,debug:1,info:1,notice:1,warn:1,error:1,crit:1,select:1,permanent:1,redirect:1,kqueue:1,rtsig:1,epoll:1,poll:1,"/dev/poll":1}},r:0,c:[hljs.HCM,{cN:"string",b:'"',e:'"',c:[hljs.BE,c,b,a],r:0},{cN:"string",b:"'",e:"'",c:[hljs.BE,c,b,a],r:0},{cN:"string",b:"([a-z]+):/",e:"[;\\s]",rE:true},{cN:"regexp",b:"\\s\\^",e:"\\s|{|;",rE:true,c:[hljs.BE,c,b,a]},{cN:"regexp",b:"~\\*?\\s+",e:"\\s|{|;",rE:true,c:[hljs.BE,c,b,a]},{cN:"regexp",b:"\\*(\\.[a-z\\-]+)+",c:[hljs.BE,c,b,a]},{cN:"regexp",b:"([a-z\\-]+\\.)+\\*",c:[hljs.BE,c,b,a]},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b"},{cN:"number",b:"\\s\\d+[kKmMgGdshdwy]*\\b",r:0},c,b,a]}]}]}}}();hljs.LANGUAGES.erlang_repl={dM:{k:{special_functions:{spawn:10,spawn_link:10,self:2},reserved:{after:1,and:1,andalso:5,band:1,begin:1,bnot:1,bor:1,bsl:1,bsr:1,bxor:1,"case":1,"catch":0,cond:1,div:1,end:1,fun:0,"if":0,let:1,not:0,of:1,or:1,orelse:5,query:1,receive:0,rem:1,"try":0,when:1,xor:1}},c:[{cN:"input_number",b:"^[0-9]+> ",r:10},{cN:"comment",b:"%",e:"$"},hljs.NM,hljs.ASM,hljs.QSM,{cN:"constant",b:"\\?(::)?([A-Z]\\w*(::)?)+"},{cN:"arrow",b:"->"},{cN:"ok",b:"ok"},{cN:"exclamation_mark",b:"!"},{cN:"function_or_atom",b:"(\\b[a-z'][a-zA-Z0-9_']*:[a-z'][a-zA-Z0-9_']*)|(\\b[a-z'][a-zA-Z0-9_']*)",r:0},{cN:"variable",b:"[A-Z][a-zA-Z0-9_']*",r:0}]}};hljs.LANGUAGES.django=function(){function c(f,e){return(e==undefined||(!f.cN&&e.cN=="tag")||f.cN=="value")}function d(j,e){var h={};for(var g in j){if(g!="contains"){h[g]=j[g]}var k=[];for(var f=0;j.c&&f<j.c.length;f++){k.push(d(j.c[f],j))}if(c(j,e)){k=b.concat(k)}if(k.length){h.c=k}}return h}var a={cN:"filter",b:"\\|[A-Za-z]+\\:?",eE:true,k:{truncatewords:1,removetags:1,linebreaksbr:1,yesno:1,get_digit:1,timesince:1,random:1,striptags:1,filesizeformat:1,escape:1,linebreaks:1,length_is:1,ljust:1,rjust:1,cut:1,urlize:1,fix_ampersands:1,title:1,floatformat:1,capfirst:1,pprint:1,divisibleby:1,add:1,make_list:1,unordered_list:1,urlencode:1,timeuntil:1,urlizetrunc:1,wordcount:1,stringformat:1,linenumbers:1,slice:1,date:1,dictsort:1,dictsortreversed:1,default_if_none:1,pluralize:1,lower:1,join:1,center:1,"default":1,truncatewords_html:1,upper:1,length:1,phone2numeric:1,wordwrap:1,time:1,addslashes:1,slugify:1,first:1},c:[{cN:"argument",b:'"',e:'"'}]};var b=[{cN:"template_comment",b:"{%\\s*comment\\s*%}",e:"{%\\s*endcomment\\s*%}"},{cN:"template_comment",b:"{#",e:"#}"},{cN:"template_tag",b:"{%",e:"%}",k:{comment:1,endcomment:1,load:1,templatetag:1,ifchanged:1,endifchanged:1,"if":1,endif:1,firstof:1,"for":1,endfor:1,"in":1,ifnotequal:1,endifnotequal:1,widthratio:1,"extends":1,include:1,spaceless:1,endspaceless:1,regroup:1,by:1,as:1,ifequal:1,endifequal:1,ssi:1,now:1,"with":1,cycle:1,url:1,filter:1,endfilter:1,debug:1,block:1,endblock:1,"else":1},c:[a]},{cN:"variable",b:"{{",e:"}}",c:[a]}];return{cI:true,dM:d(hljs.LANGUAGES.xml.dM)}}();hljs.LANGUAGES.delphi=function(){var a={and:1,safecall:1,cdecl:1,then:1,string:1,exports:1,library:1,not:1,pascal:1,set:1,virtual:1,file:1,"in":1,array:1,label:1,packed:1,"end.":1,index:1,"while":1,"const":1,raise:1,"for":1,to:1,implementation:1,"with":1,except:1,overload:1,destructor:1,downto:1,"finally":1,program:1,exit:1,unit:1,inherited:1,override:1,"if":1,type:1,until:1,"function":1,"do":1,begin:1,repeat:1,"goto":1,nil:1,far:1,initialization:1,object:1,"else":1,"var":1,uses:1,external:1,resourcestring:1,"interface":1,end:1,finalization:1,"class":1,asm:1,mod:1,"case":1,on:1,shr:1,shl:1,of:1,register:1,xorwrite:1,threadvar:1,"try":1,record:1,near:1,stored:1,constructor:1,stdcall:1,inline:1,div:1,out:1,or:1,procedure:1};var c={safecall:1,stdcall:1,pascal:1,stored:1,"const":1,implementation:1,finalization:1,except:1,to:1,"finally":1,program:1,inherited:1,override:1,then:1,exports:1,string:1,read:1,not:1,mod:1,shr:1,"try":1,div:1,shl:1,set:1,library:1,message:1,packed:1,index:1,"for":1,near:1,overload:1,label:1,downto:1,exit:1,"public":1,"goto":1,"interface":1,asm:1,on:1,of:1,constructor:1,or:1,"private":1,array:1,unit:1,raise:1,destructor:1,"var":1,type:1,until:1,"function":1,"else":1,external:1,"with":1,"case":1,"default":1,record:1,"while":1,"protected":1,property:1,procedure:1,published:1,and:1,cdecl:1,"do":1,threadvar:1,file:1,"in":1,"if":1,end:1,virtual:1,write:1,far:1,out:1,begin:1,repeat:1,nil:1,initialization:1,object:1,uses:1,resourcestring:1,"class":1,register:1,xorwrite:1,inline:1,"static":1};var f={cN:"comment",b:"{",e:"}",r:0};var e={cN:"comment",b:"\\(\\*",e:"\\*\\)",r:10};var d={cN:"string",b:"'",e:"'",c:[{b:"''"}],r:0};var b={cN:"string",b:"(#\\d+)+"};var g={cN:"function",b:"(procedure|constructor|destructor|function)\\b",e:"[:;]",k:{"function":1,constructor:10,destructor:10,procedure:10},c:[{cN:"title",b:hljs.IR},{cN:"params",b:"\\(",e:"\\)",k:a,c:[d,b]},f,e]};return{cI:true,dM:{k:a,i:'("|\\$[G-Zg-z]|\\/\\*|</)',c:[f,e,hljs.CLCM,d,b,hljs.NM,g,{cN:"class",b:"=\\bclass\\b",e:"end;",k:c,c:[d,b,f,e,g]}]},m:[]}}();hljs.LANGUAGES.vbscript={cI:true,dM:{k:{keyword:{call:1,"class":1,"const":1,dim:1,"do":1,loop:1,erase:1,execute:1,executeglobal:1,exit:1,"for":1,each:1,next:1,"function":1,"if":1,then:1,"else":1,on:1,error:1,option:1,explicit:1,"new":1,"private":1,property:1,let:1,get:1,"public":1,randomize:1,redim:1,rem:1,select:1,"case":1,set:1,stop:1,sub:1,"while":1,wend:1,"with":1,end:1,to:1,elseif:1,is:1,or:1,xor:1,and:1,not:1,class_initialize:1,class_terminate:1,"default":1,preserve:1,"in":1,me:1,byval:1,byref:1,step:1,resume:1,"goto":1},built_in:{lcase:1,month:1,vartype:1,instrrev:1,ubound:1,setlocale:1,getobject:1,rgb:1,getref:1,string:1,weekdayname:1,rnd:1,dateadd:1,monthname:1,now:1,day:1,minute:1,isarray:1,cbool:1,round:1,formatcurrency:1,conversions:1,csng:1,timevalue:1,second:1,year:1,space:1,abs:1,clng:1,timeserial:1,fixs:1,len:1,asc:1,isempty:1,maths:1,dateserial:1,atn:1,timer:1,isobject:1,filter:1,weekday:1,datevalue:1,ccur:1,isdate:1,instr:1,datediff:1,formatdatetime:1,replace:1,isnull:1,right:1,sgn:1,array:1,snumeric:1,log:1,cdbl:1,hex:1,chr:1,lbound:1,msgbox:1,ucase:1,getlocale:1,cos:1,cdate:1,cbyte:1,rtrim:1,join:1,hour:1,oct:1,typename:1,trim:1,strcomp:1,"int":1,createobject:1,loadpicture:1,tan:1,formatnumber:1,mid:1,scriptenginebuildversion:1,scriptengine:1,split:1,scriptengineminorversion:1,cint:1,sin:1,datepart:1,ltrim:1,sqr:1,scriptenginemajorversion:1,time:1,derived:1,"eval":1,date:1,formatpercent:1,exp:1,inputbox:1,left:1,ascw:1,chrw:1,regexp:1,server:1,response:1,request:1,cstr:1,err:1},literal:{"true":1,"false":1,"null":1,nothing:1,empty:1}},c:[{cN:"string",b:'"',e:'"',i:"\\n",c:[{b:'""'}],r:0},{cN:"comment",b:"'",e:"$"},hljs.CNM]}};hljs.LANGUAGES.apache=function(){var b={cN:"number",b:"[\\$%]\\d+"};var a={cN:"cbracket",b:"[\\$%]\\{",e:"\\}"};a.c=[a,b];return{cI:true,dM:{k:{keyword:{acceptfilter:1,acceptmutex:1,acceptpathinfo:1,accessfilename:1,action:1,addalt:1,addaltbyencoding:1,addaltbytype:1,addcharset:1,adddefaultcharset:1,adddescription:1,addencoding:1,addhandler:1,addicon:1,addiconbyencoding:1,addiconbytype:1,addinputfilter:1,addlanguage:1,addmoduleinfo:1,addoutputfilter:1,addoutputfilterbytype:1,addtype:1,alias:1,aliasmatch:1,allow:1,allowconnect:1,allowencodedslashes:1,allowoverride:1,anonymous:1,anonymous_logemail:1,anonymous_mustgiveemail:1,anonymous_nouserid:1,anonymous_verifyemail:1,authbasicauthoritative:1,authbasicprovider:1,authdbduserpwquery:1,authdbduserrealmquery:1,authdbmgroupfile:1,authdbmtype:1,authdbmuserfile:1,authdefaultauthoritative:1,authdigestalgorithm:1,authdigestdomain:1,authdigestnccheck:1,authdigestnonceformat:1,authdigestnoncelifetime:1,authdigestprovider:1,authdigestqop:1,authdigestshmemsize:1,authgroupfile:1,authldapbinddn:1,authldapbindpassword:1,authldapcharsetconfig:1,authldapcomparednonserver:1,authldapdereferencealiases:1,authldapgroupattribute:1,authldapgroupattributeisdn:1,authldapremoteuserattribute:1,authldapremoteuserisdn:1,authldapurl:1,authname:1,authnprovideralias:1,authtype:1,authuserfile:1,authzdbmauthoritative:1,authzdbmtype:1,authzdefaultauthoritative:1,authzgroupfileauthoritative:1,authzldapauthoritative:1,authzownerauthoritative:1,authzuserauthoritative:1,balancermember:1,browsermatch:1,browsermatchnocase:1,bufferedlogs:1,cachedefaultexpire:1,cachedirlength:1,cachedirlevels:1,cachedisable:1,cacheenable:1,cachefile:1,cacheignorecachecontrol:1,cacheignoreheaders:1,cacheignorenolastmod:1,cacheignorequerystring:1,cachelastmodifiedfactor:1,cachemaxexpire:1,cachemaxfilesize:1,cacheminfilesize:1,cachenegotiateddocs:1,cacheroot:1,cachestorenostore:1,cachestoreprivate:1,cgimapextension:1,charsetdefault:1,charsetoptions:1,charsetsourceenc:1,checkcaseonly:1,checkspelling:1,chrootdir:1,contentdigest:1,cookiedomain:1,cookieexpires:1,cookielog:1,cookiename:1,cookiestyle:1,cookietracking:1,coredumpdirectory:1,customlog:1,dav:1,davdepthinfinity:1,davgenericlockdb:1,davlockdb:1,davmintimeout:1,dbdexptime:1,dbdkeep:1,dbdmax:1,dbdmin:1,dbdparams:1,dbdpersist:1,dbdpreparesql:1,dbdriver:1,defaulticon:1,defaultlanguage:1,defaulttype:1,deflatebuffersize:1,deflatecompressionlevel:1,deflatefilternote:1,deflatememlevel:1,deflatewindowsize:1,deny:1,directoryindex:1,directorymatch:1,directoryslash:1,documentroot:1,dumpioinput:1,dumpiologlevel:1,dumpiooutput:1,enableexceptionhook:1,enablemmap:1,enablesendfile:1,errordocument:1,errorlog:1,example:1,expiresactive:1,expiresbytype:1,expiresdefault:1,extendedstatus:1,extfilterdefine:1,extfilteroptions:1,fileetag:1,filterchain:1,filterdeclare:1,filterprotocol:1,filterprovider:1,filtertrace:1,forcelanguagepriority:1,forcetype:1,forensiclog:1,gracefulshutdowntimeout:1,group:1,header:1,headername:1,hostnamelookups:1,identitycheck:1,identitychecktimeout:1,imapbase:1,imapdefault:1,imapmenu:1,include:1,indexheadinsert:1,indexignore:1,indexoptions:1,indexorderdefault:1,indexstylesheet:1,isapiappendlogtoerrors:1,isapiappendlogtoquery:1,isapicachefile:1,isapifakeasync:1,isapilognotsupported:1,isapireadaheadbuffer:1,keepalive:1,keepalivetimeout:1,languagepriority:1,ldapcacheentries:1,ldapcachettl:1,ldapconnectiontimeout:1,ldapopcacheentries:1,ldapopcachettl:1,ldapsharedcachefile:1,ldapsharedcachesize:1,ldaptrustedclientcert:1,ldaptrustedglobalcert:1,ldaptrustedmode:1,ldapverifyservercert:1,limitinternalrecursion:1,limitrequestbody:1,limitrequestfields:1,limitrequestfieldsize:1,limitrequestline:1,limitxmlrequestbody:1,listen:1,listenbacklog:1,loadfile:1,loadmodule:1,lockfile:1,logformat:1,loglevel:1,maxclients:1,maxkeepaliverequests:1,maxmemfree:1,maxrequestsperchild:1,maxrequestsperthread:1,maxspareservers:1,maxsparethreads:1,maxthreads:1,mcachemaxobjectcount:1,mcachemaxobjectsize:1,mcachemaxstreamingbuffer:1,mcacheminobjectsize:1,mcacheremovalalgorithm:1,mcachesize:1,metadir:1,metafiles:1,metasuffix:1,mimemagicfile:1,minspareservers:1,minsparethreads:1,mmapfile:1,mod_gzip_on:1,mod_gzip_add_header_count:1,mod_gzip_keep_workfiles:1,mod_gzip_dechunk:1,mod_gzip_min_http:1,mod_gzip_minimum_file_size:1,mod_gzip_maximum_file_size:1,mod_gzip_maximum_inmem_size:1,mod_gzip_temp_dir:1,mod_gzip_item_include:1,mod_gzip_item_exclude:1,mod_gzip_command_version:1,mod_gzip_can_negotiate:1,mod_gzip_handle_methods:1,mod_gzip_static_suffix:1,mod_gzip_send_vary:1,mod_gzip_update_static:1,modmimeusepathinfo:1,multiviewsmatch:1,namevirtualhost:1,noproxy:1,nwssltrustedcerts:1,nwsslupgradeable:1,options:1,order:1,passenv:1,pidfile:1,protocolecho:1,proxybadheader:1,proxyblock:1,proxydomain:1,proxyerroroverride:1,proxyftpdircharset:1,proxyiobuffersize:1,proxymaxforwards:1,proxypass:1,proxypassinterpolateenv:1,proxypassmatch:1,proxypassreverse:1,proxypassreversecookiedomain:1,proxypassreversecookiepath:1,proxypreservehost:1,proxyreceivebuffersize:1,proxyremote:1,proxyremotematch:1,proxyrequests:1,proxyset:1,proxystatus:1,proxytimeout:1,proxyvia:1,readmename:1,receivebuffersize:1,redirect:1,redirectmatch:1,redirectpermanent:1,redirecttemp:1,removecharset:1,removeencoding:1,removehandler:1,removeinputfilter:1,removelanguage:1,removeoutputfilter:1,removetype:1,requestheader:1,require:2,rewritebase:1,rewritecond:10,rewriteengine:1,rewritelock:1,rewritelog:1,rewriteloglevel:1,rewritemap:1,rewriteoptions:1,rewriterule:10,rlimitcpu:1,rlimitmem:1,rlimitnproc:1,satisfy:1,scoreboardfile:1,script:1,scriptalias:1,scriptaliasmatch:1,scriptinterpretersource:1,scriptlog:1,scriptlogbuffer:1,scriptloglength:1,scriptsock:1,securelisten:1,seerequesttail:1,sendbuffersize:1,serveradmin:1,serveralias:1,serverlimit:1,servername:1,serverpath:1,serverroot:1,serversignature:1,servertokens:1,setenv:1,setenvif:1,setenvifnocase:1,sethandler:1,setinputfilter:1,setoutputfilter:1,ssienableaccess:1,ssiendtag:1,ssierrormsg:1,ssistarttag:1,ssitimeformat:1,ssiundefinedecho:1,sslcacertificatefile:1,sslcacertificatepath:1,sslcadnrequestfile:1,sslcadnrequestpath:1,sslcarevocationfile:1,sslcarevocationpath:1,sslcertificatechainfile:1,sslcertificatefile:1,sslcertificatekeyfile:1,sslciphersuite:1,sslcryptodevice:1,sslengine:1,sslhonorciperorder:1,sslmutex:1,ssloptions:1,sslpassphrasedialog:1,sslprotocol:1,sslproxycacertificatefile:1,sslproxycacertificatepath:1,sslproxycarevocationfile:1,sslproxycarevocationpath:1,sslproxyciphersuite:1,sslproxyengine:1,sslproxymachinecertificatefile:1,sslproxymachinecertificatepath:1,sslproxyprotocol:1,sslproxyverify:1,sslproxyverifydepth:1,sslrandomseed:1,sslrequire:1,sslrequiressl:1,sslsessioncache:1,sslsessioncachetimeout:1,sslusername:1,sslverifyclient:1,sslverifydepth:1,startservers:1,startthreads:1,substitute:1,suexecusergroup:1,threadlimit:1,threadsperchild:1,threadstacksize:1,timeout:1,traceenable:1,transferlog:1,typesconfig:1,unsetenv:1,usecanonicalname:1,usecanonicalphysicalport:1,user:1,userdir:1,virtualdocumentroot:1,virtualdocumentrootip:1,virtualscriptalias:1,virtualscriptaliasip:1,win32disableacceptex:1,xbithack:1},literal:{on:1,off:1}},c:[hljs.HCM,{cN:"sqbracket",b:"\\s\\[",e:"\\]$"},a,b,{cN:"tag",b:"</?",e:">"},hljs.QSM]}}}();hljs.LANGUAGES.cpp=function(){var b={keyword:{"false":1,"int":1,"float":1,"while":1,"private":1,"char":1,"catch":1,"export":1,virtual:1,operator:2,sizeof:2,dynamic_cast:2,typedef:2,const_cast:2,"const":1,struct:1,"for":1,static_cast:2,union:1,namespace:1,unsigned:1,"long":1,"throw":1,"volatile":2,"static":1,"protected":1,bool:1,template:1,mutable:1,"if":1,"public":1,friend:2,"do":1,"return":1,"goto":1,auto:1,"void":2,"enum":1,"else":1,"break":1,"new":1,extern:1,using:1,"true":1,"class":1,asm:1,"case":1,typeid:1,"short":1,reinterpret_cast:2,"default":1,"double":1,register:1,explicit:1,signed:1,typename:1,"try":1,"this":1,"switch":1,"continue":1,wchar_t:1,inline:1,"delete":1,alignof:1,char16_t:1,char32_t:1,constexpr:1,decltype:1,noexcept:1,nullptr:1,static_assert:1,thread_local:1},built_in:{std:1,string:1,cin:1,cout:1,cerr:1,clog:1,stringstream:1,istringstream:1,ostringstream:1,auto_ptr:1,deque:1,list:1,queue:1,stack:1,vector:1,map:1,set:1,bitset:1,multiset:1,multimap:1,unordered_set:1,unordered_map:1,unordered_multiset:1,unordered_multimap:1,array:1,shared_ptr:1}};var a={cN:"stl_container",b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:b.built_in,r:10};a.c=[a];return{dM:{k:b,i:"</",c:[hljs.CLCM,hljs.CBLCLM,hljs.QSM,{cN:"string",b:"'",e:"[^\\\\]'",i:"[^\\\\][^']"},hljs.CNM,{cN:"preprocessor",b:"#",e:"$"},a]}}}();hljs.LANGUAGES.go=function(){var a={keyword:{"break":1,"default":1,func:1,"interface":1,select:1,"case":1,map:1,struct:1,chan:1,"else":1,"goto":1,"package":1,"switch":1,"const":1,fallthrough:1,"if":1,range:1,type:1,"continue":1,"for":1,"import":1,"return":1,"var":1,go:1,defer:1},constant:{"true":1,"false":1,iota:1,nil:1},typename:{bool:1,"byte":1,complex64:1,complex128:1,float32:1,float64:1,int8:1,int16:1,int32:1,int64:1,string:1,uint8:1,uint16:1,uint32:1,uint64:1,"int":1,uint:1,uintptr:1},built_in:{append:1,cap:1,close:1,complex:1,copy:1,imag:1,len:1,make:1,"new":1,panic:1,print:1,println:1,real:1,recover:1}};return{dM:{k:a,i:"</",c:[hljs.CLCM,hljs.CBLCLM,hljs.QSM,{cN:"string",b:"'",e:"[^\\\\]'"},{cN:"string",b:"`",e:"[^\\\\]`"},{cN:"number",b:"[^a-zA-Z_0-9](\\-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s)(\\+|\\-)?\\d+)?"},hljs.CNM]}}}();
+ docs/home.css view
@@ -0,0 +1,79 @@+/* Standard elements */+body {+ font-family: sans-serif;+ color: #666;+ margin-bottom: 0;+ padding-bottom: 0;+}+a {+ color: #F40095;+ text-decoration: none+}+a:hover {+ text-decoration: underline;+}+li + li {+ margin-top: 0.5em;+}+/* Page layout */+.wrap {+ margin: auto;+ width: 40em;+}+/* Header */+h1 {+ font-size: 2em;+ margin-bottom:0;+ padding-bottom:0;+ color: #F40095+}+h2 {+ color: #850095;+ padding-bottom: 0em;+ margin-bottom: 0;+}+h3 {+ color: #948091;+ font-style: italic;+}+.subheadline {+ font-size: 20px;+ margin-bottom: 1em;+ font-style: italic;+}++/* Syntax highlighting */+.example { }+.example pre { margin-top:0 }+.example pre .diff { color:#555 }+.example pre code .title { color:#333 }+.example pre code .string { color:#366354 }+.example pre code .built_in { color:#397460 }+.example pre code .preprocessor { color:#4F4371 }+.example pre code .comment { color:#555 }+.example pre code .command { color:#397460 }+.example pre code .special { color:#333 }+.example pre code .formula { color:#4F4371 }+.example pre code .keyword { color:#397460 }+.example pre code .number { color:#4F4371 }+.example pre code .header { color:#555 }+.example pre code .addition { background-color:#FDD;color:#695B5B }+.example pre code .deletion { background-color:#DFD;color:#000 }+.example pre { margin:0 }+.example table { border-spacing: 20px; }+.example { vertical-align: top; padding: 1em; box-shadow: 0px 0px 20px #ccc; border-radius: 5px; }+.example .lang { font-size: small; margin-bottom: 1em; color: #999 }+.example .tab-title { cursor: pointer; }+.example .tab-title-current em { font-weight: bold; color: #555; font-style: normal }+.example .tab-title { display: inline-block; margin-right: 1em; }+.example pre { overflow: auto }++.footer {+ margin-top: 5em;+ font-size: 0.9em;+ background: #eee;+ padding: 1em;+ border-top-left-radius: 1em;+ border-top-right-radius: 1em;+}+p code { background: #eee; padding: 0.1em 0.2em; }
+ docs/home.js view
@@ -0,0 +1,26 @@+$(document).ready(function(){+ $('.language-javascript').each(function(){+ $(this).text(js_beautify($(this).text(),+ { indent_size: 2}));+ });+ hljs.tabReplace = ' ';+ hljs.initHighlightingOnLoad();+ $('.example').each(function(){+ var example = $(this);+ var tabs = $('<div></div>');+ example.children('.lang').each(function(){+ var title = $(this).clone().click(function(){+ example.find('.pre').hide();+ pre.show();+ tabs.children().removeClass('tab-title-current');+ title.addClass('tab-title-current');+ });+ title.addClass('tab-title');+ var pre = $(this).next();+ tabs.append(title);+ }).remove();+ example.prepend(tabs);+ example.find('.pre').hide().first().show();+ tabs.children().first().addClass('tab-title-current');+ });+});
+ docs/jquery.js view
@@ -0,0 +1,4 @@+/*! jQuery v1.7.2 jquery.com | jquery.org/license */+(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"<!doctype html>":"")+"<html><body>"),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function ca(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function b_(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bD.test(a)?d(a,e):b_(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&f.type(b)==="object")for(var e in b)b_(a+"["+e+"]",b[e],c,d);else d(a,b)}function b$(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bZ(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bS,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bZ(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bZ(a,c,d,e,"*",g));return l}function bY(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bO),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bB(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?1:0,g=4;if(d>0){if(c!=="border")for(;e<g;e+=2)c||(d-=parseFloat(f.css(a,"padding"+bx[e]))||0),c==="margin"?d+=parseFloat(f.css(a,c+bx[e]))||0:d-=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0;return d+"px"}d=by(a,b);if(d<0||d==null)d=a.style[b];if(bt.test(d))return d;d=parseFloat(d)||0;if(c)for(;e<g;e+=2)d+=parseFloat(f.css(a,"padding"+bx[e]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+bx[e]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+bx[e]))||0);return d+"px"}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;b.nodeType===1&&(b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?b.outerHTML=a.outerHTML:c!=="input"||a.type!=="checkbox"&&a.type!=="radio"?c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text):(a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value)),b.removeAttribute(f.expando),b.removeAttribute("_submit_attached"),b.removeAttribute("_change_attached"))}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c,i[c][d])}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h,i){var j,k=d==null,l=0,m=a.length;if(d&&typeof d=="object"){for(l in d)e.access(a,c,l,d[l],1,h,f);g=1}else if(f!==b){j=i===b&&e.isFunction(f),k&&(j?(j=c,c=function(a,b,c){return j.call(e(a),c)}):(c.call(a,f),c=null));if(c)for(;l<m;l++)c(a[l],d,j?f.call(a[l],l,c(a[l],d)):f,i);g=1}return g?a:k?c.call(a):m?c(a[0],d):h},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m,n=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?n(g):h==="function"&&(!a.unique||!p.has(g))&&c.push(g)},o=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,j=!0,m=k||0,k=0,l=c.length;for(;c&&m<l;m++)if(c[m].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}j=!1,c&&(a.once?e===!0?p.disable():c=[]:d&&d.length&&(e=d.shift(),p.fireWith(e[0],e[1])))},p={add:function(){if(c){var a=c.length;n(arguments),j?l=c.length:e&&e!==!0&&(k=a,o(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){j&&f<=l&&(l--,f<=m&&m--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&p.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(j?a.once||d.push([b,c]):(!a.once||!e)&&o(b,c));return this},fire:function(){p.fireWith(this,arguments);return this},fired:function(){return!!i}};return p};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p=c.createElement("div"),q=c.documentElement;p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="<div "+n+"display:block;'><div style='"+t+"0;display:block;overflow:hidden;'></div></div>"+"<table "+n+"' cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="<table><tr><td style='"+t+"0;display:none'></td><td>t</td></tr></table>",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="<div style='width:5px;'></div>",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h,i,j=this[0],k=0,m=null;if(a===b){if(this.length){m=f.data(j);if(j.nodeType===1&&!f._data(j,"parsedAttrs")){g=j.attributes;for(i=g.length;k<i;k++)h=g[k].name,h.indexOf("data-")===0&&(h=f.camelCase(h.substring(5)),l(j,h,m[h]));f._data(j,"parsedAttrs",!0)}}return m}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!";return f.access(this,function(c){if(c===b){m=this.triggerHandler("getData"+e,[d[0]]),m===b&&j&&(m=f.data(j,a),m=l(j,a,m));return m===b&&d[1]?this.data(d[0]):m}d[1]=c,this.each(function(){var b=f(this);b.triggerHandler("setData"+e,d),f.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length<d)return f.queue(this[0],a);return c===b?this:this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise(c)}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,f.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i<g;i++)e=d[i],e&&(c=f.propFix[e]||e,h=u.test(e),h||f.attr(a,e,""),a.removeAttribute(v?e:c),h&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0,coords:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(+a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:g&&G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=f.event.special[c.type]||{},j=[],k,l,m,n,o,p,q,r,s,t,u;g[0]=c,c.delegateTarget=this;if(!i.preDispatch||i.preDispatch.call(this,c)!==!1){if(e&&(!c.button||c.type!=="click")){n=f(this),n.context=this.ownerDocument||this;for(m=c.target;m!=this;m=m.parentNode||this)if(m.disabled!==!0){p={},r=[],n[0]=m;for(k=0;k<e;k++)s=d[k],t=s.selector,p[t]===b&&(p[t]=s.quick?H(m,s.quick):n.is(t)),p[t]&&r.push(s);r.length&&j.push({elem:m,matches:r})}}d.length>e&&j.push({elem:this,matches:d.slice(e)});for(k=0;k<j.length&&!c.isPropagationStopped();k++){q=j[k],c.currentTarget=q.elem;for(l=0;l<q.matches.length&&!c.isImmediatePropagationStopped();l++){s=q.matches[l];if(h||!c.namespace&&!s.namespace||c.namespace_re&&c.namespace_re.test(s.namespace))c.data=s.data,c.handleObj=s,o=((f.event.special[s.origType]||{}).handle||s.handler).apply(q.elem,g),o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()))}}i.postDispatch&&i.postDispatch.call(this,c);return c.result}},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),d._submit_attached=!0)})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9||d===11){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.globalPOS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")[\\s/>]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f+.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(f.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(g){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,function(a,b){b.src?f.ajax({type:"GET",global:!1,url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1></$2>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]==="<table>"&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i<u;i++)bn(l[i]);else bn(l);l.nodeType?j.push(l):j=f.merge(j,l)}if(d){g=function(a){return!a.type||be.test(a.type)};for(k=0;j[k];k++){h=j[k];if(e&&f.nodeName(h,"script")&&(!h.type||be.test(h.type)))e.push(h.parentNode?h.parentNode.removeChild(h):h);else{if(h.nodeType===1){var v=f.grep(h.getElementsByTagName("script"),g);j.splice.apply(j,[k+1,0].concat(v))}d.appendChild(h)}}}return j},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bp=/alpha\([^)]*\)/i,bq=/opacity=([^)]*)/,br=/([A-Z]|^ms)/g,bs=/^[\-+]?(?:\d*\.)?\d+$/i,bt=/^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,bu=/^([\-+])=([\-+.\de]+)/,bv=/^margin/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Top","Right","Bottom","Left"],by,bz,bA;f.fn.css=function(a,c){return f.access(this,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)},a,c,arguments.length>1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),(e===""&&f.css(d,"display")==="none"||!f.contains(d.ownerDocument.documentElement,d))&&f._data(d,"olddisplay",cu(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(ct("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(ct("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o,p,q;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]);if((k=f.cssHooks[g])&&"expand"in k){l=k.expand(a[g]),delete a[g];for(i in l)i in a||(a[i]=l[i])}}for(g in a){h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cu(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cm.test(h)?(q=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),q?(f._data(this,"toggle"+i,q==="show"?"hide":"show"),j[q]()):j[h]()):(m=cn.exec(h),n=j.cur(),m?(o=parseFloat(m[2]),p=m[3]||(f.cssNumber[i]?"":"px"),p!=="px"&&(f.style(this,i,(o||1)+p),n=(o||1)/j.cur()*n,f.style(this,i,n+p)),m[1]&&(o=(m[1]==="-="?-1:1)*o+n),j.custom(n,o,p)):j.custom(n,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:ct("show",1),slideUp:ct("hide",1),slideToggle:ct("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a){return a},swing:function(a){return-Math.cos(a*Math.PI)/2+.5}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cq||cr(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){f._data(e.elem,"fxshow"+e.prop)===b&&(e.options.hide?f._data(e.elem,"fxshow"+e.prop,e.start):e.options.show&&f._data(e.elem,"fxshow"+e.prop,e.end))},h()&&f.timers.push(h)&&!co&&(co=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cq||cr(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(co),co=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(cp.concat.apply([],cp),function(a,b){b.indexOf("margin")&&(f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)})}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cv,cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?cv=function(a,b,c,d){try{d=a.getBoundingClientRect()}catch(e){}if(!d||!f.contains(c,a))return d?{top:d.top,left:d.left}:{top:0,left:0};var g=b.body,h=cy(b),i=c.clientTop||g.clientTop||0,j=c.clientLeft||g.clientLeft||0,k=h.pageYOffset||f.support.boxModel&&c.scrollTop||g.scrollTop,l=h.pageXOffset||f.support.boxModel&&c.scrollLeft||g.scrollLeft,m=d.top+k-i,n=d.left+l-j;return{top:m,left:n}}:cv=function(a,b,c){var d,e=a.offsetParent,g=a,h=b.body,i=b.defaultView,j=i?i.getComputedStyle(a,null):a.currentStyle,k=a.offsetTop,l=a.offsetLeft;while((a=a.parentNode)&&a!==h&&a!==c){if(f.support.fixedPosition&&j.position==="fixed")break;d=i?i.getComputedStyle(a,null):a.currentStyle,k-=a.scrollTop,l-=a.scrollLeft,a===e&&(k+=a.offsetTop,l+=a.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(a.nodeName))&&(k+=parseFloat(d.borderTopWidth)||0,l+=parseFloat(d.borderLeftWidth)||0),g=e,e=a.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&d.overflow!=="visible"&&(k+=parseFloat(d.borderTopWidth)||0,l+=parseFloat(d.borderLeftWidth)||0),j=d}if(j.position==="relative"||j.position==="static")k+=h.offsetTop,l+=h.offsetLeft;f.support.fixedPosition&&j.position==="fixed"&&(k+=Math.max(c.scrollTop,h.scrollTop),l+=Math.max(c.scrollLeft,h.scrollLeft));return{top:k,left:l}},f.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){f.offset.setOffset(this,a,b)});var c=this[0],d=c&&c.ownerDocument;if(!d)return null;if(c===d.body)return f.offset.bodyOffset(c);return cv(c,d,d.documentElement)},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo(d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,g="offset"+a;f.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,"padding")):this[c]():null},f.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?"margin":"border")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window);
+ docs/snippets/conditions.hs view
@@ -0,0 +1,9 @@+number1 = if opposite then x else 6++number2 = if opposite+ then x+ else 6++number3 = case opposite of+ True -> x+ _ -> 6
+ docs/snippets/data.hs view
@@ -0,0 +1,11 @@+data Math = Math+ { root :: Double -> Double+ , square :: Double -> Double+ , cube :: Double -> Double+ }++math = Math sqrt+ (\x -> x * x)+ (\x -> x * square math x)++rootroot = root math (root math 5)
+ docs/snippets/declarations.hs view
@@ -0,0 +1,5 @@+number = 42++opposite = True++letbinding = let x = 42 in x
+ docs/snippets/dom.hs view
@@ -0,0 +1,14 @@+main = do+ result <- documentGetElements "body"+ print result++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""++data Element+instance Foreign Element++documentGetElements :: String -> Fay [Element]+documentGetElements =+ foreignFay "document.getElementsByTagName"+ "array"
+ docs/snippets/enums.hs view
@@ -0,0 +1,18 @@+data Role = CEO+ | Manager+ | Developer+ | Marketing++data Customer = Customer+ { cid :: Double+ , address :: String+ , role :: Role+ }++monthlySalary :: Customer -> Double+monthlySalary customer =+ case role customer of+ CEO -> 1000000+ Manager -> 100000+ Marketing -> 1000+ Developer -> 1
+ docs/snippets/ffi.hs view
@@ -0,0 +1,5 @@+print :: Foreign a => a -> Fay ()+print = foreignFay "window.console.log" ""++alert :: Foreign a => a -> Fay ()+alert = foreignFay "window.alert" ""
+ docs/snippets/functions.hs view
@@ -0,0 +1,3 @@+square x = x * x++add = \x -> x + x
+ docs/snippets/lists.hs view
@@ -0,0 +1,9 @@+list1 = [1,2,3,4,5]++list2 = [1..5]++list3 = [1..]++one = head list1++squared = map square list1
+ docs/snippets/patterns.hs view
@@ -0,0 +1,5 @@+race (winner,runners) = print (winner,runners)++first (x:xs) = x++getSquare (Math _ square _) = square
+ examples/alert.hs view
@@ -0,0 +1,13 @@+{-# LANGUAGE NoImplicitPrelude #-}++module Main where++import Language.Fay.FFI+import Language.Fay.Prelude++main :: IO ()+main = alert "Hello, World!"++-- | Alert using window.alert.+alert :: Foreign a => a -> Fay ()+alert = foreignFay "window.alert" ""
+ examples/console.hs view
@@ -0,0 +1,12 @@+{-# LANGUAGE NoImplicitPrelude #-}++module Main where++import Language.Fay.FFI+import Language.Fay.Prelude++main = print "Hello, World!"++-- | Print using console.log.+print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""
+ examples/dom.hs view
@@ -0,0 +1,22 @@+{-# LANGUAGE EmptyDataDecls #-}+{-# LANGUAGE NoImplicitPrelude #-}++module Main where++import Language.Fay.FFI+import Language.Fay.Prelude++main = do+ result <- documentGetElements "body"+ print result++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""++data Element+instance Foreign Element++documentGetElements :: String -> Fay [Element]+documentGetElements =+ foreignFay "document.getElementsByTagName"+ "array"
+ fay.cabal view
@@ -0,0 +1,104 @@+name: fay+version: 0.1.0.0+synopsis: A compiler for Fay, a Haskell subset that compiles to JavaScript.+description: Fay is a strict subset of Haskell which can be compiled (type-checked) + with GHC, and compiled to JavaScript.+homepage: http://chrisdone.com/fay+license: BSD3+license-file: LICENSE+author: Chris Done+maintainer: chrisdone@gmail.com+copyright: 2012 Chris Done+category: Development+build-type: Simple+cabal-version: >=1.8+data-files: js/runtime.js+ hs/stdlib.hs+ src/Language/Fay/Stdlib.hs+extra-source-files: examples/alert.hs examples/alert.hs examples/console.hs examples/dom.hs+ -- Test cases+ tests/10 tests/10.hs tests/11 tests/11.hs tests/12 tests/12.hs tests/13+ tests/13.hs tests/14 tests/14.hs tests/15 tests/15.hs tests/16 tests/16.hs+ tests/17 tests/17.hs tests/18 tests/18.hs tests/19 tests/19.hs tests/1.hs+ tests/2 tests/20 tests/20.hs tests/21 tests/21.hs tests/22 tests/22.hs+ tests/23 tests/23.hs tests/24 tests/24.hs tests/25.hs tests/26 tests/26.hs+ tests/2.hs tests/3 tests/3.hs tests/4 tests/4.hs tests/5 tests/5.hs tests/6+ tests/6.hs tests/7 tests/7.hs tests/8 tests/8.hs tests/9 tests/9.hs+ -- Documentation files+ docs/beautify.js docs/highlight.pack.js docs/home.css docs/home.js docs/jquery.js+ -- Documentation snippets+ docs/snippets/conditions.hs+ docs/snippets/data.hs+ docs/snippets/declarations.hs+ docs/snippets/dom.hs+ docs/snippets/enums.hs+ docs/snippets/ffi.hs+ docs/snippets/functions.hs+ docs/snippets/lists.hs+ docs/snippets/patterns.hs++library+ hs-source-dirs: src+ exposed-modules: Language.Fay, Language.Fay.Types, Language.Fay.FFI, Language.Fay.Prelude+ other-modules: Language.Fay.Print, Control.Monad.IO, Language.Fay.Stdlib+ ghc-options: -O2+ build-depends: base >= 4 && < 5,+ mtl,+ language-javascript,+ haskell-src-exts,+ json,++ -- Requirements for the executables which+ -- `cabal-dev ghci' needs.+ HUnit,+ process,+ filepath,+ directory,+ blaze-html,+ blaze-markup,+ bytestring,+ time++executable fay+ hs-source-dirs: src+ ghc-options: -O2+ main-is: Main.hs+ build-depends: base >= 4 && < 5,+ mtl,+ language-javascript,+ haskell-src-exts,+ json++executable fay-tests+ hs-source-dirs: src+ ghc-options: -O2+ main-is: Tests.hs+ other-modules: Language.Fay.Compiler+ build-depends: base >= 4 && < 5,+ mtl,+ language-javascript,+ haskell-src-exts,+ json,+ HUnit,+ process,+ filepath,+ directory++executable fay-docs+ hs-source-dirs: src+ ghc-options: -O2+ main-is: Docs.hs+ other-modules: Text.Blaze.Extra+ build-depends: base >= 4 && < 5,+ mtl,+ language-javascript,+ haskell-src-exts,+ json,+ HUnit,+ process,+ filepath,+ directory,+ blaze-html,+ blaze-markup,+ bytestring,+ time
+ hs/stdlib.hs view
@@ -0,0 +1,13 @@+data ArgType+ = DateType+ | FunctionType+ | JsType+ | StringType+ | DoubleType+ | ListType+ | BoolType+ | UnknownType++data Maybe a+ = Just a+ | Nothing
+ js/runtime.js view
@@ -0,0 +1,340 @@+var True = true;+var False = false;++/*******************************************************************************+* Thunks.+*/++// Force a thunk (if it is a thunk) until WHNF.+var _ = function(thunkish,nocache){+ while (thunkish instanceof $) {+ thunkish = thunkish.force(nocache);+ }+ return thunkish;+};++// Thunk object.+function $(value){+ this.forced = false;+ this.value = value;+};++// Force the thunk.+$.prototype.force = function(nocache){+ return nocache+ ? this.value()+ : this.forced+ ? this.value+ : (this.forced = true, this.value = this.value());+};++/*******************************************************************************+* Constructors.+*/++// A constructor.+function Fay$$Constructor(){+ this.name = arguments[0];+ this.fields = Array.prototype.slice.call(arguments,1);+}++// Eval in the context of the Haskell bindings.+function Fay$$eval(str){+ return eval(str);+}++/*******************************************************************************+* Monad.+*/++function Fay$$Monad(value){+ this.value = value;+}++// >>+var Fay$$then = function(a){+ return function(b){+ return new $(function(){+ _(a,true);+ return b;+ });+ };+};++// >>=+var Fay$$bind = function(m){+ return function(f){+ return new $(function(){+ var monad = _(m,true);+ return f(monad.value);+ });+ };+};++var Fay$$unit = null;++// return+var Fay$$return = function(a){+ return new Fay$$Monad(a);+};++/*******************************************************************************+* FFI.+*/++// Serialize a Fay object to JS.+function Fay$$serialize(type,obj){+ type = _(type);+ if(type) type = type[0].name;+ if(type == "JsType"){+ return function(){+ return _(obj,true).value;+ };+ } else {+ obj = _(obj);+ if(type == "StringType" ||+ (obj instanceof Fay$$Cons && typeof obj.car == 'string')){+ var str = "";+ while(obj instanceof Fay$$Cons) {+ str += obj.car;+ obj = _(obj.cdr);+ }+ return str; + } else if(type == "FunctionType" || typeof obj == 'function'){+ return function(){+ var out = obj;+ for (var len = arguments.length, i = 0; i < len; i++){+ if(typeof out != 'function') {+ throw "Wrong number of arguments for callback: " + arguments.toString();+ }+ out = out(arguments[i]);+ }+ return _(out,true);+ }; + } else if(type == "ListType" || (obj instanceof Fay$$Cons)){+ var arr = [];+ while(obj instanceof Fay$$Cons) {+ arr.push(Fay$$serialize(null,obj.car));+ obj = _(obj.cdr);+ }+ return arr; + } // else if(type == "BoolType || obj == _(True) || obj == _(False)) {+ // return obj == _(True);+ // } + else {+ return obj;+ } + }+}++// Encode a value to a Show representation+function Fay$$encodeShow(x){+ if (x instanceof $) x = _(x);+ if (x instanceof Array) {+ if (x.length == 0) {+ return "[]";+ } else {+ if (x[0] instanceof Fay$$Constructor) {+ if(x[0].fields.length > 0) {+ var args = x.slice(1);+ var fieldNames = x[0].fields;+ return "(" + x[0].name + " { " + args.map(function(x,i){+ return fieldNames[i] + ' = ' + Fay$$encodeShow(x);+ }).join(", ") + " })";+ } else {+ var args = x.slice(1);+ return "(" + [x[0].name].concat(args.map(Fay$$encodeShow)).join(" ") + ")";+ }+ } else {+ return "[" + x.map(Fay$$encodeShow).join(",") + "]";+ }+ }+ } else if (typeof x == 'string') {+ return JSON.stringify(x);+ } else if(x instanceof Fay$$Cons) {+ return Fay$$encodeShow(Fay$$serialize(ListType,x));+ } else if(x == null) {+ return '[]';+ } else {+ return x.toString();+ }+}++// Unserialize an object from JS to Fay.+function Fay$$unserialize(typ,obj){+ if(typ == 'string' || typ == 'array')+ return Fay$$list(obj);+ else if(typ == 'bool')+ return obj? True : False;+ else if(typ == 'data') {+ alert('Time to unserialize a data record!');+ }+ else return obj;+}++/*******************************************************************************+* Lists.+*/++// Cons object.+function Fay$$Cons(car,cdr){+ this.car = car;+ this.cdr = cdr;+};++// Make a list.+function Fay$$list(xs){+ var out = null;+ for(var i=xs.length-1; i>=0;i--)+ out = new Fay$$Cons(xs[i],out);+ return out;+};++// Built-in list cons.+var Fay$$cons = function(x){+ return function(y){+ return new Fay$$Cons(x,y);+ };+};++// List index.+function Fay$$index(index){+ return function(list){+ for(var i = 0; i < index; i++) {+ list = _(list).cdr;+ }+ return list.car;+ };+}++/*******************************************************************************+* Numbers.+*/++// Built-in ×.+var Fay$$mult = function(x){+ return function(y){+ return _(x) * _(y);+ };+};++// Built-in +.+var Fay$$add = function(x){+ return function(y){ + return _(x) + _(y);+ };+};++// Built-in -.+var Fay$$sub = function(x){+ return function(y){+ return _(x) - _(y);+ };+};++// Built-in /.+var Fay$$div = function(x){+ return function(y){+ return _(x) / _(y);+ };+};++/*******************************************************************************+* Booleans.+*/++// Are two values equal?+function Fay$$equal(lit1,lit2){+ // Simple case+ lit1 = _(lit1);+ lit2 = _(lit2);+ if(lit1 == lit2) {+ return true;+ }+ // General case+ if(lit1 instanceof Array) {+ if(lit1.length!=lit2.length) return false;+ for(var len = lit1.length, i = 0; i < len; i++) {+ if(!Fay$$equal(lit1[i],lit2[i]))+ return false;+ }+ return true;+ } else if (lit1 instanceof Fay$$Cons) {+ while(lit1 instanceof Fay$$Cons && lit2 instanceof Fay$$Cons && Fay$$equal(lit1.car,lit2.car))+ lit1 = lit1.cdr, lit2 = lit2.cdr;+ return (lit1 == null && lit2 == null);+ } else return false;+}++// Built-in ==.+var Fay$$eq = function(x){+ return function(y){+ return Fay$$equal(x,y);+ };+};++// Built-in /=.+var Fay$$neq = function(x){+ return function(y){+ return !(Fay$$equal(x,y));+ };+};++// Built-in >.+var Fay$$gt = function(x){+ return function(y){+ return _(x) > _(y);+ };+};++// Built-in <.+var Fay$$lt = function(x){+ return function(y){+ return _(x) < _(y);+ };+};++// Built-in &&.+var Fay$$and = function(x){+ return function(y){+ return _(x) && _(y);+ };+};++// Built-in ||.+var Fay$$or = function(x){+ return function(y){+ return _(x) || _(y);+ };+};++/*******************************************************************************+* Mutable references.+*/++// Make a new mutable reference.+function Fay$$Ref(x){+ this.value = x;+}++// Write to the ref.+function Fay$$writeRef(ref,x){+ ref.value = x;+}++// Get the value from the ref.+function Fay$$readRef(ref,x){+ return ref.value;+}++/*******************************************************************************+* Dates.+*/+function Fay$$date(str){+ return window.Date.parse(str);+};++/*******************************************************************************+* Application code.+*/+
+ src/Control/Monad/IO.hs view
@@ -0,0 +1,6 @@+module Control.Monad.IO where++import Control.Monad.Trans++io :: MonadIO m => IO a -> m a+io = liftIO
+ src/Docs.hs view
@@ -0,0 +1,209 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE CPP #-}+{-# OPTIONS -fno-warn-missing-signatures -fno-warn-unused-do-bind #-}++-- | Generate documentation for Fay.++module Main where++import Language.Fay++import Control.Exception+import Control.Monad+import qualified Data.ByteString.Lazy as L+import Data.Char+import Data.List (isSuffixOf,sort)+import Data.Time+import Prelude hiding (head,div)+import System.Directory+import System.FilePath+import Text.Blaze.Extra+import Text.Blaze.Html5 as H hiding (contents,map)+import Text.Blaze.Html5.Attributes as A hiding (title)+import Text.Blaze.Renderer.Utf8 (renderMarkup)++-- | Main entry point.+main :: IO ()+main = do+ let file = "docs" </> "home.html"+ generate >>= L.writeFile file+ putStrLn $ "Documentation file written to " ++ file+ +generate = do+ sources <- mapM readFile examples+ javascripts <- mapM compile examples+ now <- getCurrentTime+ return $ renderMarkup $ page now (zip3 (map titlize examples) sources javascripts)+ + where compile file = do+ contents <- readFile file+ putStrLn $ "Compiling " ++ file ++ " ..."+ result <- compileViaStr compileModule contents+ case result of+ Right javascript -> return javascript+ Left err -> throw err+ titlize = takeWhile (/='.') . upperize . takeFileName+ where upperize (x:xs) = toUpper x : xs+ upperize xs = xs+ examples = map (("docs" </> "snippets") </>)+ (map (++".hs")+ (words "declarations conditions functions lists data enums patterns ffi dom"))++page now examples = do+ docType+ html $ do+ head $ thehead+ body $ thebody now examples++thehead = do+ title $ "The Fay Programming Language — A Haskell subset"+ meta ! httpEquiv "Content-Type" ! content "charset=utf-8"+ link ! rel "stylesheet" ! type_ "text/css" ! href "home.css"+ script ! src "highlight.pack.js" $ return ()+ script ! src "jquery.js" $ return ()+ script ! src "beautify.js" $ return ()+ script ! src "home.js" $ return ()++thebody now examples = do+ div !. "wrap" $ do+ theheading+ theintro+ thesetup+ thejsproblem+ thecomparisons+ theexamples examples+ thereference+ thefooter now+++theheading = do+ h1 "Fay programming language"+ div !. "subheadline" $ "A strict subset of Haskell that compiles to JavaScript"++theexamples examples = do+ a ! name "examples" $ return ()+ h2 "Examples"+ p $ do "The following examples are generated from the "+ code "examples"+ " directory in the Fay project distribution. "+ "The Fay tab of each example shows the original Fay code, and the "+ " JavaScript tab shows the actual generated output of the compiler "+ " use to generate this document."+ p $ do "Because Fay is lazy, it creates thunks and forces them on a regular basis. "+ "Thus, the symbol "; code "$"; " means “thunk”, and the symbol "; code "_"+ " means “force”."+ forM_ examples $ \(file,fay,javascript) -> do+ h3 $ toHtml file+ div !. "example" $ do+ div !. "lang" $ em "Fay"+ pre !. "pre" $+ code !. "language-haskell" $+ toHtml fay+ div !. "lang" $ em "JavaScript"+ pre !. "pre" $+ code !. "language-javascript" $+ toHtml javascript++thefooter now =+ div !. "footer" $ do+ "© 2012 Chris Done. "+ "Document generated on "+ toHtml (show now)+ " with sexy Haskell. See "+ code $ toHtml (takeFileName __FILE__)+ " for the source of this document generator."++theintro = do+ h2 "Introduction"+ p "Fay is a small programming language which has the following properties:"+ ul $ do+ li $ do "A strict syntactic and semantic subset of "+ a ! href "http://haskell.org/" $ "Haskell"+ li $ "Statically typed"+ li $ "Lazy"+ li $ "Pure by default"+ li $ "Compiles to JavaScript"+ li $ "Has fundamental data types (Double, String, etc.) based upon what JS can support"+ li $ "Has a trivial foreign function interface to JavaScript"+ p $ do "Because Fay is intended to be small and simple, it relies on GHC, the Haskell compiler, "+ "for static checking. So the workflow when working with Fay is: "+ pre $ do+ "$ ghc hello.hs\n"+ "$ fay hello.hs"+ p $ do "The "; code "ghc"; " call will compile the Fay (really, Haskell) code and run the type system, "+ "and the call to "; code "fay"+ " will actually generate JavaScript code under "; code "hello.js"; "."+ p $ a ! href "#examples" $ "Go to examples »"++thejsproblem = do+ h2 "The JavaScript Problem"+ p "The JavaScript problem is two-fold and can be described thus:"+ ul $ do+ li $ do strong "JavaScript sucks:"+ " The depths to which JavaScript sucks is well-documented and well-understood. Its main faults are: its lack of module system, weak-typing, verbose function syntax, late binding, which has led to the creation of various static analysis tools to alleviate this language flaw, but with limited success (there is even a static type checker), finicky equality/automatic conversion, this behaviour, and lack of static types."+ li $ do strong "We need JavaScript:"+ " Using it for what it is good for, i.e. providing a platform for browser development, but not using the language per se, is therefore desirable, and many are working to achieve this, in varying forms. There are various ways to do it, but we ought to opt for compiling an existing language, Haskell, to JavaScript, because we do not have time to learn or teach other people a new language, garner a new library set and a new type checker and all that Haskell implementations provide."+ p $ a ! href "http://www.haskell.org/haskellwiki/The_JavaScript_Problem" $ + "See here for more elaboration »"++thecomparisons = do+ h2 "Comparisons to other methods"+ h3 "CoffeeScript"+ p $ do "CoffeeScript is a syntactic layer above JavaScript that does not change semantics. "+ "It adds some additional syntactic constructs, but makes no fundamental changes, "+ "you are still essentially working in JavaScript, but with more convenient "+ "syntactic features."+ p $ do "Fay on the other hand is a different language to JavaScript entirely, with a "+ "different semantics. It is lazy, it has partial application and currying, "+ "pattern matching for all data types, all expressions are pure and only "+ "statements in the Fay monad can be impure."+ h3 "Roy and Elm"+ p $ do "Roy is an approach to bring functional programming to JavaScript, it has lots of "+ "interesting features but it has different syntax and type-system semantics "+ "to Haskell."+ p $ do "Elm, equally, is an approach to bringing functional programming to the web, "+ "and is less generic than Roy, as it specifically focuses on web programming. It, too, "+ "borrows from Haskell and looks a bit like it, but is (consciously) different in "+ "syntax and semantics."+ p $ do "Both of these languages are very interesting and promising approaches. What Fay offers "+ "is to keep the existing compiler, GHC, for its battle-tested type checking and "+ " code analysis, and to use existing parsers for Haskell to support a subset of its "+ "syntax. This way, one does not have to replace the tooling infrastructure and workflow "+ "that one is used to. With the exception of actions in the Fay monad, pure functions "+ "can be type checked and ran within GHCi."+ p $ do "Additionally, because all Fay code "; em "is"; " Haskell code, certain modules "+ "can be shared between the ‘native’ Haskell and ‘web’ Haskell, most interestingly "+ "the types module of your project. This enables two things:"+ ul $ do+ li "The enforced (by GHC) coherence of client-side and server-side data types."+ li $ do "The transparent serializing and deserializing of data types between these "+ "two entities (i.e. over AJAX)."++thesetup = do+ h2 "Installation"+ p $ do "The Fay compiler is written in Haskell, so you will need "+ a ! href "http://hackage.haskell.org/platform/" $ "the Haskell platform"+ " installed (or at least Cabal)."+ h3 "Cabal install from Hackage"+ p "To install, run:"+ pre $ code "$ cabal install fay"+ h3 "From Github"+ p "If you want to hack on the compiler, you can download the Git repo: "+ pre $ code "$ git clone git://github.com/chrisdone/fay.git"+ p "And then install from the directory: "+ pre $ code "$ cabal install"+ h3 "Running"+ p "To check that everything is okay, run the tests:"+ pre $ code "$ fay-tests"+ p "To compile a Fay program, run:"+ pre $ code "$ fay -autorun foo.hs"+ p $ do "The "; code "-autorun"; " flag will make sure that the "; code "main"; " function is called."+ p "You can also install this via cabal-dev, but be sure to run the commands from the cabal-dev bin dir: "+ pre $ code "$ cabal-dev install\n$ cabal-dev/bin/fay -autorun foo.hs"++thereference = do+ h2 "Language Reference"+ p $ do "To be written. There is a great deal of syntax not yet supported, which I will document. "+ "For now it is best to simply try and see if you get an “Unsupported X” compile error or not. "+ "It will not accept things that it doesn't support, apart from class and instance declarations, "+ "which it ignores entirely. Inspect the compiler source if you are unsure, it is rather simple."
+ src/Language/Fay.hs view
@@ -0,0 +1,669 @@+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TypeSynonymInstances #-}+{-# LANGUAGE ViewPatterns #-}+{-# OPTIONS -fno-warn-orphans #-}+{-# OPTIONS -fno-warn-name-shadowing #-}++-- | The Haskell→Javascript compiler.++module Language.Fay+ (compile,compileViaStr,compileModule)+ where++import Language.Fay.Print ()+import Language.Fay.Types++import Control.Applicative+import Control.Monad.Error+import Control.Monad.IO+import Data.List+import Data.String+import Language.Haskell.Exts++--------------------------------------------------------------------------------+-- Top level entry points++-- | Compile something that compiles to something else.+compile :: CompilesTo from to => from -> IO (Either CompileError to)+compile = runCompile . compileTo++-- | Run the compiler.+runCompile :: Compile a -> IO (Either CompileError a)+runCompile m = runErrorT m++-- | Compile a Haskell source string to a JavaScript source string.+compileViaStr :: (Show from,Show to,CompilesTo from to)+ => (from -> Compile to)+ -> String+ -> IO (Either CompileError String)+compileViaStr with from =+ runCompile (parseResult (throwError . uncurry ParseError)+ (fmap printJS . with)+ (parse from))++compileFromStr with from =+ parseResult (throwError . uncurry ParseError)+ (with)+ (parse from)++--------------------------------------------------------------------------------+-- Compilers++-- | Compile Haskell module.+compileModule :: Module -> Compile [JsStmt]+compileModule (Module _ modulename pragmas Nothing exports imports decls) = do+ imported <- fmap concat (mapM compileImport imports)+ current <- compileDecls decls+ return (imported ++ current)+compileModule mod = throwError (UnsupportedModuleSyntax mod)++instance CompilesTo Module [JsStmt] where compileTo = compileModule++-- | Compile the given import.+compileImport :: ImportDecl -> Compile [JsStmt]+compileImport (ImportDecl _ (ModuleName name) _ _ _ _ _)+ | isPrefixOf "Language.Fay." name || name == "Prelude" = return []+compileImport (ImportDecl _ (ModuleName name) False _ Nothing Nothing Nothing) = do+ contents <- io (readFile (replace '.' '/' name ++ ".hs"))+ compileFromStr compileModule contents+ where replace c r = map (\x -> if x == c then r else x)+compileImport i =+ error $ "Import syntax not supported. " +++ "The compiler writer was too lazy to support that.\n" +++ "It was: " ++ show i++-- | Compile Haskell declaration.+compileDecls :: [Decl] -> Compile [JsStmt]+compileDecls decls = do+ case decls of+ [] -> return []+ (TypeSig _ _ sig:bind@PatBind{}:decls) -> appendM (compilePatBind (Just sig) bind)+ (compileDecls decls)+ (decl:decls) -> appendM (compileDecl decl)+ (compileDecls decls)++ where appendM m n = do x <- m+ xs <- n+ return (x ++ xs)++compileDecl :: Decl -> Compile [JsStmt]+compileDecl decl =+ case decl of+ pat@PatBind{} -> compilePatBind Nothing pat+ FunBind matches -> compileFunCase matches+ DataDecl _ DataType _ _ _ constructors _ -> compileDataDecl decl constructors+ -- Just ignore type aliases and signatures.+ TypeDecl{} -> return []+ TypeSig{} -> return []+ InfixDecl{} -> return []+ ClassDecl{} -> return []+ InstDecl{} -> return [] -- FIXME: Ignore.+ _ -> throwError (UnsupportedDeclaration decl)++compilePatBind :: Maybe Type -> Decl -> ErrorT CompileError IO [JsStmt]+compilePatBind sig pat =+ case pat of+ PatBind _ (PVar ident) Nothing (UnGuardedRhs rhs) (BDecls []) ->+ case ffiExp rhs of+ Just detail@(binding,_,_) ->+ case sig of+ Nothing -> compileNormalPatBind ident rhs+ Just sig -> case () of+ () | func binding -> compileFFIFunc sig ident detail+ | method binding -> compileFFIMethod sig ident detail+ | otherwise -> throwError (FfiNeedsTypeSig pat)+ _ -> compileNormalPatBind ident rhs+ _ -> throwError (UnsupportedDeclaration pat)++ where func = flip elem ["foreignFay","foreignPure"]+ method = flip elem ["foreignMethodFay","foreignMethod"]+ ffiExp (App (App (Var (UnQual (Ident ident)))+ (Lit (String name)))+ (Lit (String typ)))+ = Just (ident,name,typ)+ ffiExp _ = Nothing++compileNormalPatBind :: Name -> Exp -> Compile [JsStmt]+compileNormalPatBind ident rhs = do+ body <- compileExp rhs+ return [JsVar (UnQual ident) (thunk body)]++compileFFIFunc :: Type -> Name -> (String,String,String) -> Compile [JsStmt]+compileFFIFunc sig ident detail@(_,name,_) = do+ let args = zipWith const uniqueNames [1..typeArity sig]+ compileFFI sig ident detail (JsRawName name) args args++compileFFIMethod :: Type -> Name -> (String,String,String) -> Compile [JsStmt]+compileFFIMethod sig ident detail@(_,name,_) = do+ let args = zipWith const uniqueNames [1..typeArity sig]+ jsargs = drop 1 args+ obj = head args+ compileFFI sig ident detail (JsGetProp (force (JsName obj)) (fromString name)) args jsargs++-- | Compile an FFI call.+compileFFI :: Type+ -> Name+ -> (String,String,String)+ -> JsExp+ -> [JsName]+ -> [JsName]+ -> Compile [JsStmt]+compileFFI sig ident (binding,_,typ) exp params args = do+ return [JsVar (UnQual ident)+ (foldr (\name inner -> JsFun [name] [] (Just inner))+ (thunk+ (maybeMonad+ (unserialize typ+ (JsApp exp+ (map (\(typ,name) -> serialize typ (JsName name))+ (zip types args))))))+ params)]++ where (maybeMonad,types) | binding == "foreignFay" = (monad,funcTypes)+ | binding == "foreignMethodFay" = (monad,drop 1 funcTypes)+ | binding == "foreignMethod" = (id,drop 1 funcTypes)+ | otherwise = (id,funcTypes)+ funcTypes = functionTypeArgs sig++-- | These are the data types that are serializable directly to native+-- JS data types. Strings, floating points and arrays. The others are:+-- actiosn in the JS monad, which are thunks that shouldn't be forced+-- when serialized but wrapped up as JS zero-arg functions, and+-- unknown types can't be converted but should at least be forced.+data ArgType = FunctionType | JsType | StringType | DoubleType | ListType | BoolType | UnknownType+ deriving (Show,Eq)++-- | Serialize a value to native JS, if possible.+serialize :: ArgType -> JsExp -> JsExp+serialize typ exp =+ JsApp (JsName (hjIdent "serialize"))+ [JsName (fromString (show typ)),exp]++-- | Get arg types of a function type.+functionTypeArgs :: Type -> [ArgType]+functionTypeArgs t =+ case t of+ TyForall _ _ i -> functionTypeArgs i+ TyFun a b -> argType a : functionTypeArgs b+ TyParen st -> functionTypeArgs st+ _ -> []++ where argType t =+ case t of+ TyApp (TyCon "Fay") _ -> JsType+ TyCon "String" -> StringType+ TyCon "Double" -> DoubleType+ TyCon "Bool" -> BoolType+ TyFun{} -> FunctionType+ TyList _ -> ListType+ _ -> UnknownType++-- | Get the arity of a type.+typeArity :: Type -> Integer+typeArity t =+ case t of+ TyForall _ _ i -> typeArity i+ TyFun _ b -> 1 + typeArity b+ TyParen st -> typeArity st+ _ -> 0++compileDataDecl :: Decl -> [QualConDecl] -> Compile [JsStmt]+compileDataDecl decl constructors = do+ fmap concat $+ forM constructors $ \(QualConDecl _ _ _ condecl) ->+ case condecl of+ ConDecl (UnQual -> name) types -> fmap return (makeDataCons name types [])+ RecDecl (UnQual -> name) fields -> do+ cons <- makeDataCons name (map snd fields) (map fst fields)+ funs <- makeAccessors (zip [1..] (map fst fields))+ return (cons : funs)+ _ -> throwError (UnsupportedDeclaration decl)++ where makeDataCons name types fields = do+ let slots = (map (fromString . ("slot"++) . show . fst)+ (zip [1 :: Integer ..] types))+ return $+ JsVar name+ (foldr (\slot inner -> JsFun [slot] [] (Just inner))+ (thunk (JsList ((JsNew (hjIdent "Constructor")+ (JsLit (JsStr (qname name)) :+ concat (map (map (JsLit . JsStr . unname)) fields)))+ : map JsName slots)))+ slots)+ makeAccessors fields = do+ fmap concat $+ forM fields $ \(i,field) ->+ forM field $ \name ->+ return (JsVar (UnQual name)+ (JsFun ["x"]+ []+ (Just (thunk (JsIndex i (force (JsName "x")))))))++qname (UnQual (Ident str)) = str+qname _ = error "qname: Expected unqualified ident."++unname (Ident str) = str++-- | Compile a function which pattern matches (causing a case analysis).+compileFunCase :: [Match] -> Compile [JsStmt]+compileFunCase [] = return []+compileFunCase matches@(Match _ name argslen _ _ _:_) = do+ pats <- fmap optimizePatConditions $ forM matches $ \(Match _ _ pats _ rhs _) -> do+ exp <- compileRhs rhs+ foldM (\inner (arg,pat) -> do+ compilePat (JsName arg) pat inner)+ [JsEarlyReturn exp]+ (zip args pats)+ return [JsVar (UnQual name)+ (foldr (\arg inner -> JsFun [arg] [] (Just inner))+ (stmtsThunk (concat pats ++ basecase))+ args)]+ where args = zipWith const uniqueNames argslen+ basecase = if any isWildCardMatch matches+ then []+ else [throw ("unhandled case in " ++ show name)+ (JsList (map JsName args))]+ isWildCardMatch (Match _ _ pats _ _ _) = all isWildCardPat pats++-- | Compile a right-hand-side expression.+compileRhs :: Rhs -> Compile JsExp+compileRhs (UnGuardedRhs exp) = compileExp exp+compileRhs rhs = throwError (UnsupportedRhs rhs)++-- | Compile a pattern match binding.+compileFunMatch :: Match -> Compile [JsStmt]+compileFunMatch match =+ case match of+ (Match _ name args Nothing (UnGuardedRhs rhs) _) -> do+ body <- compileExp rhs+ args <- mapM patToArg args+ return [JsVar (UnQual name)+ (foldr (\arg inner -> JsFun [arg] [] (Just inner))+ (thunk body)+ args)]+ match -> throwError (UnsupportedMatchSyntax match)++ where patToArg (PVar name) = return (UnQual name)+ patToArg _ = throwError (UnsupportedMatchSyntax match)++instance CompilesTo Decl [JsStmt] where compileTo = compileDecl++-- | Compile Haskell expression.+compileExp :: Exp -> Compile JsExp+compileExp exp =+ case exp of+ Paren exp -> compileExp exp+ Var (UnQual (Ident "return")) -> return (JsName (hjIdent "return"))+ Var qname -> return (JsName qname)+ Lit lit -> compileLit lit+ App exp1 exp2 -> compileApp exp1 exp2+ InfixApp exp1 op exp2 -> compileInfixApp exp1 op exp2+ Let (BDecls decls) exp -> compileLet decls exp+ List [] -> return JsNull+ List xs -> compileList xs+ Tuple xs -> compileList xs+ If cond conseq alt -> compileIf cond conseq alt+ Case exp alts -> compileCase exp alts+ Con (UnQual (Ident "True")) -> return (JsName "true")+ Con (UnQual (Ident "False")) -> return (JsName "false")+ Con exp -> return (JsName exp)+ Do stmts -> compileDoBlock stmts+ Lambda _ pats exp -> compileLambda pats exp+ EnumFrom i -> do e <- compileExp i+ return (JsApp (JsName "enumFrom") [e])+ EnumFromTo i i' -> do f <- compileExp i+ t <- compileExp i'+ return (JsApp (JsName "enumFromTo") [f,t])+ ExpTypeSig _ e _ -> compileExp e++ exp -> throwError (UnsupportedExpression exp)++instance CompilesTo Exp JsExp where compileTo = compileExp++compileApp :: Exp -> Exp -> Compile JsExp+compileApp exp1 exp2 = fmap optimizeApp $+ JsApp <$> (forceFlatName <$> compileExp exp1)+ <*> fmap return (compileExp exp2)+ where forceFlatName name = JsApp (JsName "_") [name]++optimizeApp :: JsExp -> JsExp+optimizeApp exp =+ case exp of+ exp -> exp+ + where name JsName{} = True+ name _ = False++compileInfixApp :: Exp -> QOp -> Exp -> Compile JsExp+compileInfixApp exp1 op exp2 =+ case getOp op of+ UnQual (Symbol symbol)+ | symbol `elem` words "* + - / < > || &&" -> do+ e1 <- compileExp exp1+ e2 <- compileExp exp2+ return (JsInfix symbol (force e1) (force e2)) + _ -> do+ var <- resolveOpToVar op+ compileExp (App (App var exp1) exp2)++ where getOp (QVarOp op) = op+ getOp (QConOp op) = op+ +compileList :: [Exp] -> Compile JsExp+compileList xs = do+ exps <- mapM compileExp xs+ return (JsApp (JsName (hjIdent "list")) [JsList exps])++compileIf :: Exp -> Exp -> Exp -> Compile JsExp+compileIf cond conseq alt =+ JsTernaryIf <$> fmap force (compileExp cond)+ <*> compileExp conseq+ <*> compileExp alt++compileLambda :: [Pat] -> Exp -> Compile JsExp+compileLambda pats exp = do+ exp <- compileExp exp+ stmts <- foldM (\inner (param,pat) -> do+ stmts <- compilePat (JsName param) pat inner+ return [JsEarlyReturn (JsFun [param] (stmts ++ [unhandledcase param | not allfree]) Nothing)])+ [JsEarlyReturn exp]+ (reverse (zip uniqueNames pats))+ case stmts of+ [JsEarlyReturn fun@JsFun{}] -> return fun+ _ -> error "Unexpected statements in compileLambda"+-- return (JsApp (JsFun [] (stmts) Nothing) [])++ where unhandledcase = throw "unhandled case" . JsName+ allfree = all isWildCardPat pats++compileCase :: Exp -> [Alt] -> Compile JsExp+compileCase exp alts = do+ exp <- compileExp exp+ pats <- fmap optimizePatConditions $ mapM (compilePatAlt (JsName (tmpName exp))) alts+ return $+ (JsApp (JsFun [tmpName exp]+ (concat pats)+ (if any isWildCardAlt alts+ then Nothing+ else Just (throwExp "unhandled case" (JsName (tmpName exp)))))+ [exp])++compileDoBlock :: [Stmt] -> Compile JsExp+compileDoBlock stmts = do+ doblock <- foldM compileStmt Nothing (reverse stmts)+ maybe (throwError EmptyDoBlock) compileExp doblock++compileStmt :: Maybe Exp -> Stmt -> Compile (Maybe Exp)+compileStmt inner stmt =+ case inner of+ Nothing -> initStmt+ Just inner -> subsequentStmt inner++ where initStmt =+ case stmt of+ Qualifier exp -> return (Just exp)+ LetStmt{} -> throwError LetUnsupported+ _ -> throwError InvalidDoBlock++ subsequentStmt inner =+ case stmt of+ Generator loc pat exp -> compileGenerator loc pat inner exp+ Qualifier exp -> return (Just (InfixApp exp+ (QVarOp (UnQual (Symbol ">>")))+ inner))+ LetStmt{} -> throwError LetUnsupported+ RecStmt{} -> throwError RecursiveDoUnsupported++ compileGenerator srcloc pat inner exp = do+ let body = (Lambda srcloc [pat] inner)+ return (Just (InfixApp exp+ (QVarOp (UnQual (Symbol ">>=")))+ body))++-- | Compile the given pattern against the given expression.+compilePatAlt :: JsExp -> Alt -> Compile [JsStmt]+compilePatAlt exp (Alt _ pat rhs _) = do+ alt <- compileGuardedAlt rhs+ compilePat exp pat [JsEarlyReturn alt]++-- | Compile the given pattern against the given expression.+compilePat :: JsExp -> Pat -> [JsStmt] -> Compile [JsStmt]+compilePat exp pat body = do+ case pat of+ PVar name -> return ([JsVar (UnQual name) exp] ++ body)+ PApp cons pats -> compilePApp cons pats exp body+ PLit literal -> compilePLit exp literal body+ PParen pat -> compilePat exp pat body+ PWildCard -> return body+ pat@PInfixApp{} -> compileInfixPat exp pat body+ PList pats -> compilePList pats body exp+ PTuple pats -> compilePList pats body exp+ pat -> throwError (UnsupportedPattern pat)++compilePLit :: JsExp -> Literal -> [JsStmt] -> Compile [JsStmt]+compilePLit exp literal body = do+ lit <- compileLit literal+ return [JsIf (JsApp (JsName (hjIdent "equal"))+ [exp,lit])+ body+ []]++compilePApp :: QName -> [Pat] -> JsExp -> [JsStmt] -> Compile [JsStmt]+compilePApp cons pats exp body = do+ let forcedExp = force exp+ substmts <- foldM (\body (i,pat) -> compilePat (JsIndex i forcedExp) pat body)+ body+ (reverse (zip [1..] pats))+ let constructor = JsIndex 0 forcedExp+ compareConstructorNames+ -- Special-casing on the booleans.+ | cons == "True" = JsEq forcedExp (JsLit (JsBool True))+ | cons == "False" = JsEq forcedExp (JsLit (JsBool False))+ -- Everything else, generic:+ | otherwise =+ JsEq (JsGetProp constructor "name")+ (JsLit (JsStr (qname cons)))+ return [JsIf compareConstructorNames+ substmts+ []]++compilePList :: [Pat] -> [JsStmt] -> JsExp -> Compile [JsStmt]+compilePList [] body exp =+ return [JsIf (JsEq (force exp) JsNull) body []]+compilePList pats body exp = do+ let forcedExp = force exp+ substmts <- foldM (\body (i,pat) -> compilePat (JsApp (JsApp (JsName (hjIdent "index"))+ [JsLit (JsInt i)])+ [forcedExp])+ pat body)+ body+ (reverse (zip [0..] pats))+ return substmts++compileInfixPat :: JsExp -> Pat -> [JsStmt] -> Compile [JsStmt]+compileInfixPat exp pat@(PInfixApp left (Special cons) right) body =+ case cons of+ Cons -> do+ let forcedExp = JsName (tmpName exp)+ x = (JsGetProp forcedExp "car")+ xs = (JsGetProp forcedExp "cdr")+ rightMatch <- compilePat xs right body+ leftMatch <- compilePat x left rightMatch+ return [JsVar (tmpName exp) (force exp)+ ,JsIf (JsInstanceOf forcedExp (hjIdent "Cons"))+ leftMatch+ []]+ _ -> throwError (UnsupportedPattern pat)+compileInfixPat _ pat _ = throwError (UnsupportedPattern pat)++-- | Compile a guarded alt.+compileGuardedAlt :: GuardedAlts -> Compile JsExp+compileGuardedAlt alt =+ case alt of+ UnGuardedAlt exp -> compileExp exp+ alt -> throwError (UnsupportedGuardedAlts alt)++-- | Compile a let expression.+compileLet :: [Decl] -> Exp -> Compile JsExp+compileLet decls exp = do+ body <- compileExp exp+ binds <- mapM compileLetDecl decls+ return (JsApp (JsFun [] (concat binds) (Just body)) [])++-- | Compile let declaration.+compileLetDecl :: Decl -> Compile [JsStmt]+compileLetDecl decl =+ case decl of+ decl@PatBind{} -> compileDecls [decl]+ decl@FunBind{} -> compileDecls [decl]+ _ -> throwError (UnsupportedLetBinding decl)++-- | Compile Haskell literal.+compileLit :: Literal -> Compile JsExp+compileLit lit =+ case lit of+ Char ch -> return (JsLit (JsChar ch))+ Int integer -> return (JsLit (JsInt (fromIntegral integer))) -- FIXME:+ Frac rational -> return (JsLit (JsFloating (fromRational rational)))+ -- TODO: Use real JS strings instead of array, probably it will+ -- lead to the same result.+ String string -> return (JsApp (JsName (hjIdent "list"))+ [JsLit (JsStr string)])+ lit -> throwError (UnsupportedLiteral lit)++--------------------------------------------------------------------------------+-- Compilation utilities++-- | Generate unique names.+uniqueNames :: [JsParam]+uniqueNames = map (fromString . ("$_" ++))+ $ map return "abcxyz" +++ zipWith (:) (cycle "v")+ (map show [1 :: Integer ..])++thenm :: JsExp -> JsExp -> JsExp+thenm e inner =+ JsApp (JsApp (JsName (hjIdent "then"))+ [e])+ [inner]++-- | Optimize pattern matching conditions by merging conditions in common.+optimizePatConditions :: [[JsStmt]] -> [[JsStmt]]+optimizePatConditions = concat . map merge . groupBy sameIf where+ sameIf [JsIf cond1 _ _] [JsIf cond2 _ _] = cond1 == cond2+ sameIf _ _ = False+ merge xs@([JsIf cond _ _]:_) =+ [[JsIf cond (concat (optimizePatConditions (map getIfConsequent xs))) []]]+ merge noifs = noifs+ getIfConsequent [JsIf _ cons _] = cons+ getIfConsequent other = other++-- | Throw a JS exception.+throw :: String -> JsExp -> JsStmt+throw msg exp = JsThrow (JsList [JsLit (JsStr msg),exp])++-- | Throw a JS exception (in an expression).+throwExp :: String -> JsExp -> JsExp+throwExp msg exp = JsThrowExp (JsList [JsLit (JsStr msg),exp])++-- | Is an alt a wildcard?+isWildCardAlt :: Alt -> Bool+isWildCardAlt (Alt _ pat _ _) = isWildCardPat pat++-- | Is a pattern a wildcard?+isWildCardPat :: Pat -> Bool+isWildCardPat PWildCard{} = True+isWildCardPat PVar{} = True+isWildCardPat _ = False++-- | A temporary name for testing conditions and such.+tmpName :: JsExp -> JsName+tmpName exp =+ fromString $+ case exp of+ JsName (qname -> x) -> "$_" ++ x+ _ -> ":tmp"++-- | Wrap an expression in a thunk.+thunk :: JsExp -> JsExp+-- thunk exp = JsNew (hjIdent "Thunk") [JsFun [] [] (Just exp)]+thunk exp =+ case exp of+ -- JS constants don't need to be in thunks, they're already strict.+ JsLit{} -> exp+ JsName "true" -> exp+ JsName "false" -> exp+ -- Functions (e.g. lets) used for introducing a new lexical scope+ -- aren't necessary inside a thunk. This is a simple aesthetic+ -- optimization.+ JsApp fun@JsFun{} [] -> JsNew ":thunk" [fun]+ -- Otherwise make a regular thunk.+ _ -> JsNew ":thunk" [JsFun [] [] (Just exp)]++-- | Wrap an expression in a thunk.+monad :: JsExp -> JsExp+monad exp = JsNew (hjIdent "Monad") [exp]++-- | Wrap an expression in a thunk.+stmtsThunk :: [JsStmt] -> JsExp+stmtsThunk stmts = JsNew ":thunk" [JsFun [] stmts Nothing]++unserialize :: String -> JsExp -> JsExp+unserialize typ exp =+ JsApp (JsName (hjIdent "unserialize")) [JsLit (JsStr typ),exp]++-- | Force an expression in a thunk.+force :: JsExp -> JsExp+force exp =+ JsApp (JsName "_") [exp]++-- | Force an expression in a thunk.+monadValue :: JsExp -> JsExp+monadValue exp =+ JsGetProp (forceNoMemoize exp) "value"++-- | Force an expression in a thunk.+forceNoMemoize :: JsExp -> JsExp+forceNoMemoize exp =+ JsApp (JsName (hjIdent "force")) [exp,JsLit (JsBool True)]++-- | Resolve operators to only built-in (for now) functions.+resolveOpToVar :: QOp -> Compile Exp+resolveOpToVar op =+ case getOp op of+ UnQual (Symbol symbol)+ | symbol == "*" -> return (Var (hjIdent "mult"))+ | symbol == "+" -> return (Var (hjIdent "add"))+ | symbol == "-" -> return (Var (hjIdent "sub"))+ | symbol == "/" -> return (Var (hjIdent "div"))+ | symbol == "==" -> return (Var (hjIdent "eq"))+ | symbol == "/=" -> return (Var (hjIdent "neq"))+ | symbol == ">" -> return (Var (hjIdent "gt"))+ | symbol == "<" -> return (Var (hjIdent "lt"))+ | symbol == "&&" -> return (Var (hjIdent "and"))+ | symbol == "||" -> return (Var (hjIdent "or"))+ | symbol == ">>=" -> return (Var (hjIdent "bind"))+ | symbol == ">>" -> return (Var (hjIdent "then"))+ | otherwise -> return (Var (fromString symbol))+ Special Cons -> return (Var (hjIdent "cons"))+ _ -> throwError (UnsupportedOperator op)++ where getOp (QVarOp op) = op+ getOp (QConOp op) = op++-- | Make an identifier from the built-in HJ module.+hjIdent :: String -> QName+hjIdent = Qual (ModuleName "Fay") . Ident++--------------------------------------------------------------------------------+-- Utilities++-- | Parse result.+parseResult :: ((SrcLoc,String) -> b) -> (a -> b) -> ParseResult a -> b+parseResult fail ok result =+ case result of+ ParseOk a -> ok a+ ParseFailed srcloc msg -> fail (srcloc,msg)
+ src/Language/Fay/Compiler.hs view
@@ -0,0 +1,56 @@+{-# LANGUAGE ViewPatterns #-}+module Language.Fay.Compiler where++import Language.Fay+import Language.Fay.Types+import Paths_fay++import Control.Exception (throw)++-- | Compile file program to…+compileFromTo :: Bool -> FilePath -> FilePath -> IO ()+compileFromTo autorun filein fileout = do+ runtime <- getDataFileName "js/runtime.js"+ stdlibpath <- getDataFileName "hs/stdlib.hs"+ stdlibpathprelude <- getDataFileName "src/Language/Fay/Stdlib.hs"+ raw <- readFile runtime+ stdlib <- readFile stdlibpath+ stdlibprelude <- readFile stdlibpathprelude+ hscode <- readFile filein+ result <- compileProgram autorun raw compileModule (hscode ++ "\n" ++ stdlib ++ "\n" ++ strip stdlibprelude)+ case result of+ Right out -> writeFile fileout out+ Left err -> throw err+ + where strip = unlines . dropWhile (/="-- START") . lines++-- | Compile the given module to a runnable program.+compileProgram :: (Show from,Show to,CompilesTo from to)+ => Bool -> String -> (from -> Compile to) -> String+ -> IO (Either CompileError String)+compileProgram autorun raw with hscode = do+ result <- compileViaStr with hscode+ case result of+ Left err -> return (Left err)+ Right jscode -> return (Right (unlines ["var Fay = function(){"+ ,raw+ ,jscode+ ,"return {"+ ," force:_,"+ ," thunk:$,"+ ," list:Fay$$list,"+ ," encodeShow:Fay$$encodeShow,"+ ," main:main,"+ ," eval:Fay$$eval"+ ," };"+ ,"};"+ ,if autorun+ then ";\nvar fay = new Fay();fay.force(fay.main);"+ else ""+ ]))++-- | Convert a Haskell filename to a JS filename.+toJsName :: String -> String+toJsName x = case reverse x of+ ('s':'h':'.': (reverse -> file)) -> file ++ ".js"+ _ -> x
+ src/Language/Fay/FFI.hs view
@@ -0,0 +1,69 @@+{-# LANGUAGE EmptyDataDecls #-}+{-# LANGUAGE TypeSynonymInstances #-}+{-# LANGUAGE NoImplicitPrelude #-}++module Language.Fay.FFI where++import Language.Fay.Types (Fay)+import Prelude (Bool,String,Double,Char,error)++data JsPtr a++-- | Contains allowed foreign function types.+class Foreign a++-- | Unit is OK.+instance Foreign ()++-- | All numbers in JS are double.+instance Foreign Double++-- | Characters are OK.+instance Foreign Char++-- | Bools are OK.+instance Foreign Bool++-- | Lists → arrays are OK.+instance Foreign a => Foreign [a]++-- | Pointers to arbitrary objects are OK.+instance Foreign (JsPtr a)++-- | JS values are foreignable.+instance Foreign a => Foreign (Fay a)++-- | Functions are foreignable.+instance (Foreign a,Foreign b) => Foreign (a -> b)++-- | Declare a foreign action.+foreignFay+ :: Foreign a+ => String -- ^ The foreign function name.+ -> String -- ^ JS return type.+ -> a -- ^ Bottom.+foreignFay = error "Language.Fay.FFI.foreignFay: Used foreign function not in a JS engine context."++-- | Declare a foreign function.+foreignPure+ :: Foreign a+ => String -- ^ The foreign function name.+ -> String -- ^ JS return type.+ -> a -- ^ Bottom.+foreignPure = error "Language.Fay.FFI.foreign: Used foreign function not in a JS engine context."++-- | Declare a foreign action.+foreignMethodFay+ :: Foreign a+ => String -- ^ The foreign function name.+ -> String -- ^ JS return type.+ -> a -- ^ Bottom.+foreignMethodFay = error "Language.Fay.FFI.foreignMethodFay: Used foreign function not in a JS engine context."++-- | Declare a foreign function.+foreignMethod+ :: Foreign a+ => String -- ^ The foreign function name.+ -> String -- ^ JS return type.+ -> a -- ^ Bottom.+foreignMethod = error "Language.Fay.FFI.foreignMethod: Used foreign function not in a JS engine context."
+ src/Language/Fay/Prelude.hs view
@@ -0,0 +1,57 @@+{-# LANGUAGE GeneralizedNewtypeDeriving #-}++module Language.Fay.Prelude+ (Fay+ ,Char+ ,String+ ,Integer+ ,Double+ ,Bool(..)+ ,Show(show)+ ,Read+ ,Maybe(..)+ ,read+ ,fromInteger+ ,fromRational+ ,(>>)+ ,(>>=)+ ,(==)+ ,(/=)+ ,(+)+ ,(*)+ ,(-)+ ,(>)+ ,(<)+ ,(||)+ ,(&&)+ ,fail+ ,return+ ,module Language.Fay.Stdlib)+ where++import Language.Fay.Types (Fay)+import Language.Fay.Stdlib++import Prelude ((>),(<),(==),(||),(&&),Maybe(..),Double,Ord,Integer,error,String,(+),Bool(..),Char,Show(..)+ ,Read(..),read,(/=),(*),(-))+import GHC.Real (Ratio)++-- | Just to satisfy GHC.+fromInteger :: Integer -> Double+fromInteger = error "Language.Fay.Prelude.fromInteger: Used fromInteger outside JS."++-- | Just to satisfy GHC.+fromRational :: Ratio Integer -> Double+fromRational = error "Language.Fay.Prelude.fromRational Used fromRational outside JS."++(>>) :: Fay a -> Fay b -> Fay b+(>>) = error "Language.Fay.Prelude.(>>): Used (>>) outside JS."++(>>=) :: Fay a -> (a -> Fay b) -> Fay b+(>>=) = error "Language.Fay.Prelude.(>>=): Used (>>=) outside JS."++fail :: String -> Fay a+fail = error "Language.Fay.Prelude.fail: Used fail outside JS."++return :: a -> Fay a+return = error "Language.Fay.Prelude.return: Used return outside JS."
+ src/Language/Fay/Print.hs view
@@ -0,0 +1,175 @@+{-# OPTIONS -fno-warn-orphans #-}+{-# LANGUAGE TypeSynonymInstances #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ViewPatterns #-}++-- | Simple code (non-pretty) printing.+--+-- No clever printing is done here. If you want pretty printing, use a+-- JS pretty printer. The output should be passed directly to a JS+-- compressor, anyway.+--+-- Special constructors and symbols in Haskell are encoded to+-- JavaScript appropriately.++module Language.Fay.Print where++import Language.Fay.Types++import Data.List+import Data.String+import Language.Haskell.Exts.Syntax+import Prelude hiding (exp)+import Text.JSON++--------------------------------------------------------------------------------+-- Printing++-- | Print literals. These need some special encoding for+-- JS-format literals. Could use the Text.JSON library.+instance Printable JsLit where+ printJS (JsChar char) = encode [char] -- FIXME:+ printJS (JsStr str) = encode str -- FIXME:+ printJS (JsInt int) = show int -- FIXME:+ printJS (JsFloating rat) = show rat -- FIXME:+ printJS (JsBool b) = if b then "true" else "false"++-- | Print (and properly encode to JS) a qualified name.+instance Printable QName where+ printJS qname =+ case qname of+ Qual moduleName name -> printJS moduleName ++ "$$" ++ printJS name+ UnQual name -> printJS name+ Special con -> printJS con++-- | Print special constructors (tuples, list, etc.)+instance Printable SpecialCon where+ printJS specialCon =+ case specialCon of+ UnitCon -> printJS (Qual "Fay" (Ident "unit"))+ ListCon -> printJS (Qual "Fay" (Ident "emptyList"))+ FunCon -> printJS (Qual "Fay" (Ident "funCon"))+ TupleCon boxed n -> printJS (Qual "Fay"+ (Ident (if boxed == Boxed+ then "boxed"+ else "unboxed" +++ "TupleOf" ++ show n)))+ Cons -> printJS (Qual "Fay" (Ident "cons"))+ UnboxedSingleCon -> printJS (Qual "Fay" (Ident "unboxedSingleCon"))++-- | Print module name.+instance Printable ModuleName where+ printJS (ModuleName moduleName) =+ jsEncodeName moduleName++-- | Print (and properly encode) a name.+instance Printable Name where+ printJS name =+ case name of+ Ident ident -> jsEncodeName ident+ Symbol sym -> jsEncodeName sym++-- | Print a list of statements.+instance Printable [JsStmt] where+ printJS = concat . map (printJS)++-- | Print a single statement.+instance Printable JsStmt where+ printJS (JsVar name expr) =+ (unwords ["var",printJS name,"=",printJS expr ++ ";"])+ printJS (JsIf exp thens elses) =+ concat+ [("if (" ++ printJS exp ++ ") {")+ ,printJS thens] +++ if (length elses > 0)+ then concat ["} else {"+ ,printJS elses ++ "}"]+ else "}"+ printJS (JsEarlyReturn exp) =+ ("return " ++ printJS exp ++ ";")+ printJS (JsThrow exp) =+ ("throw " ++ printJS exp ++ ";")++-- | Print an expression.+instance Printable JsExp where+ printJS (JsRawName name) = name+ printJS (JsThrowExp exp) =+ "(function(){ throw (" ++ printJS exp ++ "); })()"+ printJS (JsFun params stmts ret) =+ concat ["function("+ ,intercalate "," (map (printJS) params)+ ,"){"+ ,printJS stmts+ ] +++ case ret of+ Just ret' ->+ concat ["return "+ ,printJS ret'+ ,";"+ ,"}"]+ Nothing -> "}"+ printJS JsNull = "null"+ printJS (JsSequence exprs) =+ intercalate "," (map (printJS) exprs)+ printJS (JsName name) = printJS name+ printJS (JsApp op args) = + printJS (if isFunc op then JsParen op else op) +++ "(" ++ + intercalate "," (map (printJS) args) +++ ")"+ where isFunc JsFun{..} = True; isFunc _ = False+ printJS (JsLit lit) = printJS lit+ printJS (JsParen exp) = "(" ++ printJS exp ++ ")"+ printJS (JsTernaryIf cond conseq alt) =+ concat [printJS cond ++ " ? "+ , (printJS conseq) ++ " : "+ , (printJS alt)]+ printJS (JsList exps) =+ "[" ++ + intercalate "," (map (printJS) exps) +++ "]"+ printJS (JsNew name args) =+ "new " ++ printJS (JsApp (JsName name) args)+ printJS (JsInstanceOf exp classname) =+ printJS exp ++ " instanceof " ++ printJS classname+ printJS (JsIndex i exp) = + "(" ++ printJS exp ++ ")[" ++ show i ++ "]"+ printJS (JsEq exp1 exp2) =+ printJS exp1 ++ " == " ++ printJS exp2+ printJS (JsGetProp exp prop) =+ printJS exp ++ "." ++ printJS prop+ printJS (JsInfix op x y) =+ printJS x ++ " " ++ op ++ " " ++ printJS y++--------------------------------------------------------------------------------+-- Utilities++-- | Encode a Haskell name to JavaScript.+jsEncodeName :: String -> String+-- Special symbols:+jsEncodeName ":tmp" = "$tmp"+jsEncodeName ":thunk" = "$"+-- Used keywords:+jsEncodeName "null" = "_null"+-- Anything else.+jsEncodeName name =+ if isPrefixOf "$_" name+ then name+ else concat . map encode $ name+ + where+ encode c | elem c allowed = [c]+ | otherwise = escapeChar c+ allowed = ['a'..'z'] ++ ['A'..'Z'] ++ ['0'..'9'] ++ "_"+ escapeChar c = "$" ++ charId c ++ "$"+ charId c = show (fromEnum c)++-- | Helpful for writing qualified symbols (Fay.*). +instance IsString ModuleName where+ fromString = ModuleName++-- | Helpful for writing variable names.+instance IsString JsName where+ fromString = UnQual . Ident
+ src/Language/Fay/Stdlib.hs view
@@ -0,0 +1,152 @@+module Language.Fay.Stdlib+ (($)+ ,snd+ ,fst+ ,find+ ,any+ ,filter+ ,not+ ,null+ ,map+ ,nub+ ,elem+ ,Ordering(..)+ ,sort+ ,compare+ ,sortBy+ ,insertBy+ ,enumFrom+ ,zipWith+ ,zip+ ,flip+ ,maybe+ ,(.)+ ,(++)+ ,concat+ ,foldr+ ,foldl+ ,lookup+ ,intersperse+ ,prependToAll+ ,intercalate+ ,forM_)+ where++import Prelude (Maybe(..),(==),(>>),return,(+),(<),(>),Bool(..),Ord,(||))++-- START++snd (_,x) = x+fst (x,_) = x++find p (x:xs) = if p x then Just x else find p xs+find p [] = Nothing++any p (x:xs) = if p x then True else any p xs+any p [] = False++filter p (x:xs) = if p x then x : filter p xs else filter p xs+filter _ [] = []++not p = if p then False else True++null [] = True+null _ = False++map :: (a -> b) -> [a] -> [b]+map _ [] = []+map f (x:xs) = f x : map f xs++nub ls = nub' ls []++nub' [] _ = []+nub' (x:xs) ls =+ if elem x ls+ then nub' xs ls+ else x : nub' xs (x : ls)++elem x (y:ys) = x == y || elem x ys+elem _ [] = False++data Ordering = GT | LT | EQ++sort :: (Ord a) => [a] -> [a]+sort = sortBy compare++compare x y =+ if x > y+ then GT+ else if x < y+ then LT+ else EQ++sortBy cmp = foldr (insertBy cmp) []++insertBy :: (a -> a -> Ordering) -> a -> [a] -> [a]+insertBy _ x [] = [x]+insertBy cmp x ys =+ case ys of+ y:ys' -> + case cmp x y of+ GT -> y : insertBy cmp x ys'+ _ -> x : ys++when p m = if p then m >> return () else return ()++enumFrom i = i : enumFrom (i + 1)++enumFromTo i n = if i == n then [] else i : enumFromTo (i + 1) n++zipWith :: (a->b->c) -> [a]->[b]->[c]+zipWith f (a:as) (b:bs) = f a b : zipWith f as bs+zipWith _ _ _ = []++zip :: [a] -> [b] -> [(a,b)]+zip (a:as) (b:bs) = (a,b) : zip as bs+zip _ _ = []++flip f x y = f y x++maybe m f Nothing = m+maybe m f (Just x) = f x++(f . g) x = f (g x)++x ++ y = conc x y+infixr 5 ++++f $ x = f x+infixr 0 $++-- | Append two lists.+conc :: [a] -> [a] -> [a]+conc (x:xs) ys = x : conc xs ys+conc [] ys = ys++concat = foldr conc []++foldr f z [] = z+foldr f z (x:xs) = f x (foldr f z xs)++foldl f z [] = z+foldl f z (x:xs) = foldl f (f z x) xs++lookup _key [] = Nothing+lookup key ((x,y):xys) =+ if key == x+ then Just y+ else lookup key xys++intersperse :: a -> [a] -> [a]+intersperse _ [] = []+intersperse sep (x:xs) = x : prependToAll sep xs++prependToAll :: a -> [a] -> [a]+prependToAll _ [] = []+prependToAll sep (x:xs) = sep : x : prependToAll sep xs++intercalate :: [a] -> [[a]] -> [a]+intercalate xs xss = concat (intersperse xs xss)++forM_ (x:xs) m = m x >> forM_ xs m+forM_ [] _ = return ()
+ src/Language/Fay/Types.hs view
@@ -0,0 +1,113 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE FunctionalDependencies #-}+{-# LANGUAGE MultiParamTypeClasses #-}++-- | All Fay types and instances.++module Language.Fay.Types+ (JsStmt(..)+ ,JsExp(..)+ ,JsLit(..)+ ,JsParam+ ,JsName+ ,CompileError(..)+ ,Compile+ ,CompilesTo(..)+ ,Printable(..)+ ,Fay)+ where++import Control.Exception+import Control.Monad.Error (Error,ErrorT)+import Control.Monad.Identity (Identity)+import Data.Data+import Language.Haskell.Exts++--------------------------------------------------------------------------------+-- Compiler types++-- | Convenience/doc type.+type Compile = ErrorT CompileError IO++-- | Convenience type for function parameters.+type JsParam = JsName++-- | To be used to force name sanitization eventually.+type JsName = QName -- FIXME: Force sanitization at this point.++-- | Just a convenience class to generalize the parsing/printing of+-- various types of syntax.+class (Parseable from,Printable to) => CompilesTo from to | from -> to where+ compileTo :: from -> Compile to++-- | Print some value.+class Printable a where+ printJS :: a -> String++-- | Error type.+data CompileError+ = ParseError SrcLoc String+ | UnsupportedDeclaration Decl+ | UnsupportedMatchSyntax Match+ | UnsupportedExpression Exp+ | UnsupportedLiteral Literal+ | UnsupportedLetBinding Decl+ | UnsupportedOperator QOp+ | UnsupportedPattern Pat+ | UnsupportedRhs Rhs+ | UnsupportedGuardedAlts GuardedAlts+ | EmptyDoBlock+ | UnsupportedModuleSyntax Module+ | LetUnsupported+ | InvalidDoBlock+ | RecursiveDoUnsupported+ | FfiNeedsTypeSig Decl+ deriving (Show,Eq,Data,Typeable)+instance Error CompileError+instance Exception CompileError++-- | The JavaScript FFI interfacing monad.+newtype Fay a = Fay (Identity a)+ deriving Monad++--------------------------------------------------------------------------------+-- JS AST types++-- | Statement type.+data JsStmt+ = JsVar JsName JsExp+ | JsIf JsExp [JsStmt] [JsStmt]+ | JsEarlyReturn JsExp+ | JsThrow JsExp+ deriving (Show,Eq)+ +-- | Expression type.+data JsExp+ = JsName JsName+ | JsRawName String+ | JsFun [JsParam] [JsStmt] (Maybe JsExp)+ | JsLit JsLit+ | JsApp JsExp [JsExp]+ | JsTernaryIf JsExp JsExp JsExp+ | JsNull+ | JsSequence [JsExp]+ | JsParen JsExp+ | JsGetProp JsExp JsName+ | JsList [JsExp]+ | JsNew JsName [JsExp]+ | JsThrowExp JsExp+ | JsInstanceOf JsExp JsName+ | JsIndex Int JsExp+ | JsEq JsExp JsExp+ | JsInfix String JsExp JsExp -- Used to optimize *, /, +, etc+ deriving (Show,Eq)++-- | Literal value type.+data JsLit+ = JsChar Char+ | JsStr String+ | JsInt Int+ | JsFloating Double+ | JsBool Bool+ deriving (Show,Eq)
+ src/Main.hs view
@@ -0,0 +1,20 @@+{-# LANGUAGE ViewPatterns #-}++-- | Main compiler executable.++module Main where++import Language.Fay.Compiler++import Control.Monad+import Data.List+import System.Environment++-- | Main entry point.+main :: IO ()+main = do+ args <- getArgs+ let files = filter (not . isPrefixOf "-") args+ opts = map (drop 1) $ filter (isPrefixOf "-") args+ forM_ files $ \file -> do+ compileFromTo (elem "autorun" opts) file (toJsName file)
+ src/Tests.hs view
@@ -0,0 +1,47 @@+module Main where++import Language.Fay.Compiler++import Data.List+import System.Directory+import System.Exit+import System.FilePath+import System.IO+import System.Process+import Test.HUnit++-- | Main test runner.+main :: IO ()+main = runUnitTests >>= print++-- | Run the case-by-case unit tests.+runUnitTests :: IO Counts+runUnitTests = do+ files <- fmap (map ("tests" </>) . sort . filter dotHs) $ getDirectoryContents "tests"+ runTestTT (makeTests files)+ + where dotHs = isSuffixOf ".hs"+ makeTests files =+ TestList $ flip map files $ \file -> TestLabel file $ TestCase $ do+ let root = (reverse . drop 1 . dropWhile (/='.') . reverse) file+ out = toJsName file+ outExists <- doesFileExist root+ compileFromTo True file out+ result <- runJavaScriptFile out+ if outExists+ then do output <- readFile root+ assertEqual file output (either show id result)+ else assertEqual file True (either (const True) (const False) result)++-- | Run a JS file.+runJavaScriptFile :: String -> IO (Either String String)+runJavaScriptFile file = readAllFromProcess "node" file++-- | Read all stuff from a process.+readAllFromProcess :: FilePath -> String -> IO (Either String String)+readAllFromProcess program file = do+ (_,out,err,pid) <- runInteractiveProcess program [file] Nothing Nothing+ code <- waitForProcess pid+ case code of+ ExitSuccess -> fmap Right (hGetContents out)+ ExitFailure _ -> fmap Left (hGetContents err)
+ src/Text/Blaze/Extra.hs view
@@ -0,0 +1,35 @@+{-# OPTIONS -fno-warn-orphans #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE OverloadedStrings #-}+{-# OPTIONS -fno-warn-name-shadowing -fno-warn-unused-do-bind #-}++module Text.Blaze.Extra where++import Control.Monad+import Data.Monoid+import Text.Blaze.Html5 as H hiding (map)+import Text.Blaze.Html5.Attributes as A+import Text.Blaze.Internal (Attributable)++(!.) :: (Attributable h) => h -> AttributeValue -> h+elem !. className = elem ! class_ className++(!#) :: (Attributable h) => h -> AttributeValue -> h+elem !# idName = elem ! A.id idName++linesToHtml :: String -> Html+linesToHtml str = forM_ (lines str) $ \line -> do toHtml line; br++htmlIntercalate :: Html -> [Html] -> Html+htmlIntercalate _ [x] = x+htmlIntercalate sep (x:xs) = do x; sep; htmlIntercalate sep xs+htmlIntercalate _ [] = mempty++htmlCommasAnd :: [Html] -> Html+htmlCommasAnd [x] = x+htmlCommasAnd [x,y] = do x; " and "; y+htmlCommasAnd (x:xs) = do x; ", "; htmlCommasAnd xs+htmlCommasAnd [] = mempty++htmlCommas :: [Html] -> Html+htmlCommas = htmlIntercalate ", "
+ tests/1.hs view
+ tests/10 view
@@ -0,0 +1,1 @@+Hello, World!
+ tests/10.hs view
@@ -0,0 +1,12 @@+main = print (concat ["Hello, ","World!"])++concat = foldr append []++foldr f z [] = z+foldr f z (x:xs) = f x (foldr f z xs)++append (x:xs) ys = x : append xs ys+append [] ys = ys++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""
+ tests/11 view
@@ -0,0 +1,1 @@+[ 1, 2, 3, 4, 5 ]
+ tests/11.hs view
@@ -0,0 +1,10 @@+main = print (take 5 (let ns = 1 : map (\x -> x + 1) ns in ns))++take 0 _ = []+take n (x:xs) = x : take (n - 1) xs++map f [] = []+map f (x:xs) = f x : map f xs++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""
+ tests/12 view
@@ -0,0 +1,1 @@+[1,61.5,3782.25,232608.375,14305415.0625]
+ tests/12.hs view
@@ -0,0 +1,15 @@+main = print (show (take 5 (let ns = 1 : map (foo 123) ns in ns)))++show :: Foreign a => a -> String+show = foreignPure "JSON.stringify" ""++foo x y = x * y / 2++take 0 _ = []+take n (x:xs) = x : take (n - 1) xs++map f [] = []+map f (x:xs) = f x : map f xs++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""
+ tests/13 view
@@ -0,0 +1,1 @@+Hello!
+ tests/13.hs view
@@ -0,0 +1,7 @@+main = print (case True of+ True -> "Hello!"+ False -> "Ney!")++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""+
+ tests/14 view
@@ -0,0 +1,1 @@+Ney!
+ tests/14.hs view
@@ -0,0 +1,7 @@+main = print (case False of+ True -> "Hello!"+ False -> "Ney!")++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""+
+ tests/15 view
@@ -0,0 +1,1 @@+Ney!
+ tests/15.hs view
@@ -0,0 +1,6 @@+main = print (case False of+ True -> "Hello!"+ _ -> "Ney!")++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""
+ tests/16 view
@@ -0,0 +1,1 @@+Hello!
+ tests/16.hs view
@@ -0,0 +1,7 @@+data Person = Person String String Int++main = print (case Person "Chris" "Done" 13 of+ Person "Chris" "Done" 13 -> "Hello!")++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""
+ tests/17 view
@@ -0,0 +1,1 @@+World!
+ tests/17.hs view
@@ -0,0 +1,8 @@+data Person = Person String String Int++main = print (case Person "Chris" "Done" 14 of+ Person "Chris" "Done" 13 -> "Hello!"+ _ -> "World!")++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""
+ tests/18 view
@@ -0,0 +1,1 @@+Hello!
+ tests/18.hs view
@@ -0,0 +1,10 @@+data Person = Person String String Int++main = print (case Person "Chris" "Done" 14 of+ Person "Chris" "Done" 13 -> "Foo!"+ Person "Chris" "Barf" 14 -> "Bar!"+ Person "Chris" "Done" 14 -> "Hello!"+ _ -> "World!")++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""
+ tests/19 view
@@ -0,0 +1,1 @@+Hello!
+ tests/19.hs view
@@ -0,0 +1,11 @@+data Person = Person String String Int++main = print (foo (Person "Chris" "Done" 14))++foo (Person "Chris" "Done" 13) = "Foo!"+foo (Person "Chris" "Barf" 14) = "Bar!"+foo (Person "Chris" "Done" 14) = "Hello!"+foo _ = "World!"++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""
+ tests/2 view
+ tests/2.hs view
@@ -0,0 +1,1 @@+main = return ()
+ tests/20 view
@@ -0,0 +1,2 @@+Hello,+World!
+ tests/20.hs view
@@ -0,0 +1,4 @@+main = print "Hello," >> print "World!"++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""
+ tests/21 view
@@ -0,0 +1,2 @@+Hello,+World!
+ tests/21.hs view
@@ -0,0 +1,4 @@+main = do print "Hello,"; print "World!"++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""
+ tests/22 view
@@ -0,0 +1,1 @@+Hello, World!
+ tests/22.hs view
@@ -0,0 +1,6 @@+main = do+ x <- return "Hello, World!" >>= return+ print x++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""
+ tests/23 view
@@ -0,0 +1,1 @@+OK.
+ tests/23.hs view
@@ -0,0 +1,6 @@+main = do+ [1,2] <- return [1,2]+ print "OK."++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""
+ tests/24 view
@@ -0,0 +1,1 @@+OK.
+ tests/24.hs view
@@ -0,0 +1,8 @@+main = print (case [1,2,3,4,5] of+ [1,2,3,4,6] -> "6!"+ [1,2,4,2,4] -> "a!"+ [1,2,3,4,5] -> "OK."+ _ -> "Broken.")++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""
+ tests/25.hs view
@@ -0,0 +1,4 @@+main = print ((\a 'a' -> "OK.") 0 'b')++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""
+ tests/26 view
@@ -0,0 +1,1 @@+7.5
+ tests/26.hs view
@@ -0,0 +1,4 @@+main = print (5 * 3 / 2)++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""
+ tests/3 view
@@ -0,0 +1,1 @@+1
+ tests/3.hs view
@@ -0,0 +1,4 @@+main = print 1++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""
+ tests/4 view
@@ -0,0 +1,1 @@+Hello, World!
+ tests/4.hs view
@@ -0,0 +1,5 @@+main = print "Hello, World!"++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""+
+ tests/5 view
@@ -0,0 +1,1 @@+4
+ tests/5.hs view
@@ -0,0 +1,4 @@+main = print (2 * 4 / 2)++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""
+ tests/6 view
@@ -0,0 +1,1 @@+14
+ tests/6.hs view
@@ -0,0 +1,5 @@+main = print (10 + (2 * (4 / 2)))++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""+
+ tests/7 view
@@ -0,0 +1,1 @@+true
+ tests/7.hs view
@@ -0,0 +1,4 @@+main = print True++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""
+ tests/8 view
@@ -0,0 +1,1 @@+123
+ tests/8.hs view
@@ -0,0 +1,10 @@+data Bool = True | False++main = print (head (fix (\xs -> 123 : xs)))++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""++head (x:xs) = x++fix f = let x = f x in x
+ tests/9 view
@@ -0,0 +1,1 @@+123
+ tests/9.hs view
@@ -0,0 +1,10 @@+main = print (head (tail (fix (\xs -> 123 : xs))))++print :: Foreign a => a -> Fay ()+print = foreignFay "console.log" ""++head (x:xs) = x++fix f = let x = f x in x++tail (_:xs) = xs