diff --git a/.gitignore b/.gitignore index b9518c52..54ebf2d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.swp .DS_Store -*.js -lib/**/*.js +lib/* +test/*.js +test/**/*.js diff --git a/Cakefile b/Cakefile index 5ffe7cd4..29574d83 100644 --- a/Cakefile +++ b/Cakefile @@ -9,10 +9,14 @@ task 'build', 'Build the .js files', (options) -> # console.log options # options.watch ||= no # exec "coffee --compile #{if options.watch then '--watch' else ''} --output lib/ src/", (err, stdout, stderr) -> - exec "coffee --compile --output lib/ src/", (err, stdout, stderr) -> + exec "coffee --compile --bare --output lib/ src/", (err, stdout, stderr) -> throw err if err console.log stdout + stderr +lib = [ + 'thirdparty/microevent.js/microevent.js' +] + client = [ 'types/text' 'client/opstream' @@ -26,6 +30,7 @@ e = (str, callback) -> callback() if callback? task 'webclient', 'Assemble the web client into one file', -> - clientfiles = ("src/#{c}.coffee" for c in client).join(' ') + clientfiles = ("src/#{c}.coffee" for c in client).join ' ' e "coffee -cj #{clientfiles}", -> - e 'mv concatenation.js webclient.js' + e "cat #{lib.join ' '} concatenation.js >share.js", -> + e 'rm concatenation.js' diff --git a/bin/exampleserver b/bin/exampleserver new file mode 100755 index 00000000..505dc010 --- /dev/null +++ b/bin/exampleserver @@ -0,0 +1,37 @@ +#!/usr/bin/env coffee + +connect = require 'connect' +sharejs = require '../lib/server' +sys = require 'sys' +fs = require 'fs' +renderer = require '../examples/_static' +wiki = require '../examples/_wiki' + +server = connect( + connect.logger(), + connect.static(__dirname + '/../examples'), + connect.router (app) -> + app.get '/share.js', (req, res) -> + clientsrc = fs.readFileSync __dirname + '/../share.js', 'utf8' + res.setHeader 'content-type', 'application/javascript' + res.end clientsrc + + app.get '/static/:docName', (req, res, next) -> + docName = req.params.docName + renderer docName, server.model, res, next + + app.get '/wiki/:docName', (req, res, next) -> + docName = "wiki:#{req.params.docName}" + wiki docName, server.model, res, next + +) + +# Maybe... don't use the real config here? +config = fs.readFileSync require.resolve('./sharejs.json'), 'utf8' +options = JSON.parse config + +# Attach the sharejs REST and Socket.io interfaces to the server +sharejs.attach server, options + +server.listen 8000 +sys.puts 'Server running at http://127.0.0.1:8000/' diff --git a/bin/sharejs b/bin/sharejs new file mode 100755 index 00000000..c585507a --- /dev/null +++ b/bin/sharejs @@ -0,0 +1,18 @@ +#!/usr/bin/env node + +var connect = require('connect'), + sharejs = require('../lib/server'), + sys = require('sys'), + fs = require('fs'), + server; + +server = connect(connect.logger()); + +config = fs.readFileSync(require.resolve('./sharejs.json'), 'utf8'); +options = JSON.parse(config); + +// Attach the sharejs REST and Socket.io interfaces to the server +sharejs.attach(server, options); + +server.listen(8000); +sys.puts('Server running at http://127.0.0.1:8000/'); diff --git a/bin/sharejs.json b/bin/sharejs.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/bin/sharejs.json @@ -0,0 +1 @@ +{} diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 00000000..e53d30c2 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,50 @@ +This is a bunch of little demo apps using Share.js. + +Launch the example sharejs server with + + % bin/exampleserver + + +readonly +-------- + +Two little demos of live viewers for sharejs documents. + +Browse to http://localhost:8000/readonly/html.html +and http://localhost:8000/readonly/markdown.html + +### html + +Dynamically update html content as a document changes + +### markdown + +Dynamically render markdown as a document is edited. + + +ace +--- + +The ace editor live editing a sharejs document. + +Browse to http://localhost:8000/ace/ + + +staticrender +------------ + +This directory has a little mustache template rendering engine to do server-side rendering of documents. + +Access the rendered documents at http://localhost:8000/static/DOCNAME + +Eg: http://localhost:8000/static/html + +Some of the logic to wire this demo up is in `bin/exampleserver`. You should have a read. + +The documents are rendered statically on the server, so they don't update when as you edit them. You could obviously mix in the code from the html demo to make this also re-render as the document changes. + + +wiki +---- + +A more complicated demo showing a wiki. diff --git a/examples/_static/README.md b/examples/_static/README.md new file mode 100644 index 00000000..49c8679d --- /dev/null +++ b/examples/_static/README.md @@ -0,0 +1,8 @@ +This is a simple static renderer which uses mustache to render out an HTML page +from the document named on the URL path. + +Access this demo by browsing to: +/static/DOCNAME +from your server. + +(Eg, try /static/html) diff --git a/examples/_static/index.coffee b/examples/_static/index.coffee new file mode 100644 index 00000000..675d3829 --- /dev/null +++ b/examples/_static/index.coffee @@ -0,0 +1,20 @@ +# This statically renders the document. + +fs = require 'fs' +Mustache = try + require 'mustache' +catch e + {to_html: -> "
% npm install mustache
to use this demo."} + +template = fs.readFileSync "#{__dirname}/template.html.mu", 'utf8' + +module.exports = (docName, model, res, next) -> + model.getSnapshot docName, (data) -> + if data.v == 0 + # The document does not exist + next() + else + html = Mustache.to_html template, {content:data.snapshot, docName} + res.writeHead 200, {'content-type': 'text/html'} + res.end html + diff --git a/examples/_static/template.html.mu b/examples/_static/template.html.mu new file mode 100644 index 00000000..2d066f11 --- /dev/null +++ b/examples/_static/template.html.mu @@ -0,0 +1,11 @@ + + + {{docName}} + + + +
+
{{{content}}}
+
+ + diff --git a/examples/_wiki/index.coffee b/examples/_wiki/index.coffee new file mode 100644 index 00000000..7d3262b8 --- /dev/null +++ b/examples/_wiki/index.coffee @@ -0,0 +1,42 @@ +# This statically renders the wiki. + +fs = require 'fs' +Mustache = try + require 'mustache' +catch e + {to_html: -> "
% npm install mustache
to use this demo."} + +showdown = new (require('../lib/markdown/showdown').converter)() + +template = fs.readFileSync "#{__dirname}/wiki.html.mu", 'utf8' + +defaultContent = ''' +# Wowsers + +This wiki page is currently empty. + +You can put some content in it with the editor on the right. As you do so, the document will update live on the left, and live for everyone else editing at the same time as you. Isn't that cool? + +The text on the left is being rendered with markdown, so you can do all the usual markdown stuff like: + +- Bullet + - Points + +[links](http://google.com) + +[Go back to the main page](Main) +''' + +module.exports = (docName, model, res) -> + model.getSnapshot docName, (data) -> + if data.v == 0 + model.applyOp docName, {op:{type:'text'}, v:0} + model.applyOp docName, {op:[{i:defaultContent, p:0}], v:1} + + content = data.snapshot || '' + markdown = showdown.makeHtml content + console.log markdown + html = Mustache.to_html template, {content, markdown, docName} + res.writeHead 200, {'content-type': 'text/html'} + res.end html + diff --git a/examples/_wiki/wiki.html.mu b/examples/_wiki/wiki.html.mu new file mode 100644 index 00000000..c38f6ea5 --- /dev/null +++ b/examples/_wiki/wiki.html.mu @@ -0,0 +1,81 @@ + + + + + + + +
+
{{{markdown}}}
+
+
{{{content}}}
+ + + + + + + + + diff --git a/examples/ace.html b/examples/ace/index.html similarity index 55% rename from examples/ace.html rename to examples/ace/index.html index 604afaca..8716c7a6 100644 --- a/examples/ace.html +++ b/examples/ace/index.html @@ -17,31 +17,30 @@ -
Loading...
- - +
Connecting...
+ + - - + + + + + + + + diff --git a/examples/lib/ace/keybinding-emacs.js b/examples/lib/ace/keybinding-emacs.js new file mode 100644 index 00000000..12030e2f --- /dev/null +++ b/examples/lib/ace/keybinding-emacs.js @@ -0,0 +1 @@ +define("ace/keyboard/keybinding/emacs",["require","exports","module","ace/keyboard/state_handler"],function(a,b,c){var d=a("ace/keyboard/state_handler").StateHandler,e=a("ace/keyboard/state_handler").matchCharacterOnly,f={start:[{key:"ctrl-x",then:"c-x"},{regex:["(?:command-([0-9]*))*","(down|ctrl-n)"],exec:"golinedown",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(right|ctrl-f)"],exec:"gotoright",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(up|ctrl-p)"],exec:"golineup",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(left|ctrl-b)"],exec:"gotoleft",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{comment:"This binding matches all printable characters except numbers as long as they are no numbers and print them n times.",regex:["(?:command-([0-9]*))","([^0-9]+)*"],match:e,exec:"inserttext",params:[{name:"times",match:1,type:"number",defaultValue:"1"},{name:"text",match:2}]},{comment:"This binding matches numbers as long as there is no meta_number in the buffer.",regex:["(command-[0-9]*)*","([0-9]+)"],match:e,disallowMatches:[1],exec:"inserttext",params:[{name:"text",match:2,type:"text"}]},{regex:["command-([0-9]*)","(command-[0-9]|[0-9])"],comment:"Stops execution if the regex /meta_[0-9]+/ matches to avoid resetting the buffer."}],"c-x":[{key:"ctrl-g",then:"start"},{key:"ctrl-s",exec:"save",then:"start"}]};b.Emacs=new d(f)}),define("ace/keyboard/state_handler",["require","exports","module"],function(a,b,c){function e(a){this.keymapping=this.$buildKeymappingRegex(a)}var d=!1;e.prototype={$buildKeymappingRegex:function(a){for(state in a)this.$buildBindingsRegex(a[state]);return a},$buildBindingsRegex:function(a){a.forEach(function(a){a.key?a.key=new RegExp("^"+a.key+"$"):Array.isArray(a.regex)?(a.key=new RegExp("^"+a.regex[1]+"$"),a.regex=new RegExp(a.regex.join("")+"$")):a.regex&&(a.regex=new RegExp(a.regex+"$"))})},$composeBuffer:function(a,b,c){if(a.state==null||a.buffer==null)a.state="start",a.buffer="";var d=[];b&1&&d.push("ctrl"),b&8&&d.push("command"),b&2&&d.push("option"),b&4&&d.push("shift"),c&&d.push(c);var e=d.join("-"),f=a.buffer+e;b!=2&&(a.buffer=f);return{bufferToUse:f,symbolicName:e}},$find:function(a,b,c,e,f){var g={};this.keymapping[a.state].some(function(h){var i;if(h.key&&!h.key.test(c))return!1;if(h.regex&&!(i=h.regex.exec(b)))return!1;if(h.match&&!h.match(b,e,f,c))return!1;if(h.disallowMatches)for(var j=0;j"},{token:"keyword",regex:"(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)"},{token:function(a){return a=="this"?"variable.language":b.hasOwnProperty(a)?"keyword":c.hasOwnProperty(a)?"constant.language":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",regex:".+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+"}]},this.addRules(a.getRules(),"doc-"),this.$rules["doc-start"][0].next="start"};d.inherits(h,g),b.c_cppHighlightRules=h}),define("ace/mode/doc_comment_highlight_rules",["require","exports","module","pilot/oop","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"comment.doc",regex:"\\*\\/",next:"start"},{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},{token:"comment.doc",regex:"s+"},{token:"comment.doc",regex:"TODO"},{token:"comment.doc",regex:"[^@\\*]+"},{token:"comment.doc",regex:"."}]}};d.inherits(f,e),function(){this.getStartRule=function(a){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:a}}}.call(f.prototype),b.DocCommentHighlightRules=f}) \ No newline at end of file diff --git a/examples/lib/ace/mode-coffee.js b/examples/lib/ace/mode-coffee.js new file mode 100644 index 00000000..865ebd79 --- /dev/null +++ b/examples/lib/ace/mode-coffee.js @@ -0,0 +1 @@ +define("ace/mode/coffee",["require","exports","module","ace/tokenizer","ace/mode/coffee_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/text","pilot/oop"],function(a,b,c){function j(){this.$tokenizer=new d((new e).getRules()),this.$outdent=new f}var d=a("ace/tokenizer").Tokenizer,e=a("ace/mode/coffee_highlight_rules").CoffeeHighlightRules,f=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,g=a("ace/range").Range,h=a("ace/mode/text").Mode,i=a("pilot/oop");i.inherits(j,h);var k=j.prototype,l=/(?:[({[=:]|[-=]>|\b(?:else|switch|try|catch(?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$/,m=/^(\s*)#/,n=/^\s*###(?!#)/,o=/^\s*/;k.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a).tokens;(!e.length||e[e.length-1].type!=="comment")&&a==="start"&&l.test(b)&&(d+=c);return d},k.toggleCommentLines=function(a,b,c,d){console.log("toggle");var e=new g(0,0,0,0);for(var f=c;f<=d;++f){var h=b.getLine(f);if(n.test(h))continue;m.test(h)?h=h.replace(m,"$1"):h=h.replace(o,"$&#"),e.end.row=e.start.row=f,e.end.column=h.length+1,b.replace(e,h)}},k.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},k.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)},b.Mode=j}),define("ace/mode/coffee_highlight_rules",["require","exports","module","pilot/oop","ace/mode/text_highlight_rules"],function(a,b,c){function d(){var a="[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*",b="(?![$\\w]|\\s*:)",c={token:"string",regex:".+"};this.$rules={start:[{token:"identifier",regex:"(?:@|(?:\\.|::)\\s*)"+a},{token:"keyword",regex:"(?:t(?:h(?:is|row|en)|ry|ypeof)|s(?:uper|witch)|return|b(?:reak|y)|c(?:ontinue|atch|lass)|i(?:n(?:stanceof)?|s(?:nt)?|f)|e(?:lse|xtends)|f(?:or (?:own)?|inally|unction)|wh(?:ile|en)|n(?:ew|ot?)|d(?:e(?:lete|bugger)|o)|loop|o(?:ff?|[rn])|un(?:less|til)|and|yes)"+b},{token:"constant.language",regex:"(?:true|false|null|undefined)"+b},{token:"invalid.illegal",regex:"(?:c(?:ase|onst)|default|function|v(?:ar|oid)|with|e(?:num|xport)|i(?:mplements|nterface)|let|p(?:ackage|r(?:ivate|otected)|ublic)|static|yield|__(?:hasProp|extends|slice|bind|indexOf))"+b},{token:"language.support.class",regex:"(?:Array|Boolean|Date|Function|Number|Object|R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|TypeError|URIError)"+b},{token:"language.support.function",regex:"(?:Math|JSON|is(?:NaN|Finite)|parse(?:Int|Float)|encodeURI(?:Component)?|decodeURI(?:Component)?)"+b},{token:"identifier",regex:a},{token:"constant.numeric",regex:"(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)"},{token:"string",regex:"'''",next:"qdoc"},{token:"string",regex:'"""',next:"qqdoc"},{token:"string",regex:"'",next:"qstring"},{token:"string",regex:'"',next:"qqstring"},{token:"string",regex:"`",next:"js"},{token:"string.regex",regex:"///",next:"heregex"},{token:"string.regex",regex:"/(?!\\s)[^[/\\n\\\\]*(?: (?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[/\\n\\\\]*)*/[imgy]{0,4}(?!\\w)"},{token:"comment",regex:"###(?!#)",next:"comment"},{token:"comment",regex:"#.*"},{token:"lparen",regex:"[({[]"},{token:"rparen",regex:"[\\]})]"},{token:"keyword.operator",regex:"\\S+"},{token:"text",regex:"\\s+"}],qdoc:[{token:"string",regex:".*?'''",next:"start"},c],qqdoc:[{token:"string",regex:'.*?"""',next:"start"},c],qstring:[{token:"string",regex:"[^\\\\']*(?:\\\\.[^\\\\']*)*'",next:"start"},c],qqstring:[{token:"string",regex:'[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',next:"start"},c],js:[{token:"string",regex:"[^\\\\`]*(?:\\\\.[^\\\\`]*)*`",next:"start"},c],heregex:[{token:"string.regex",regex:".*?///[imgy]{0,4}",next:"start"},{token:"comment.regex",regex:"\\s+(?:#.*)?"},{token:"string.regex",regex:"\\S+"}],comment:[{token:"comment",regex:".*?###",next:"start"},{token:"comment",regex:".+"}]}}a("pilot/oop").inherits(d,a("ace/mode/text_highlight_rules").TextHighlightRules),b.CoffeeHighlightRules=d}) \ No newline at end of file diff --git a/examples/lib/ace/mode-csharp.js b/examples/lib/ace/mode-csharp.js new file mode 100644 index 00000000..32a65590 --- /dev/null +++ b/examples/lib/ace/mode-csharp.js @@ -0,0 +1 @@ +define("ace/mode/csharp",["require","exports","module","pilot/oop","ace/mode/text","ace/tokenizer","ace/mode/csharp_highlight_rules","ace/mode/matching_brace_outdent"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/csharp_highlight_rules").CSharpHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(i,e),function(){this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)},this.createWorker=function(a){return null}}.call(i.prototype),b.Mode=i}),define("ace/mode/csharp_highlight_rules",["require","exports","module","pilot/oop","pilot/lang","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules,g=a("ace/mode/text_highlight_rules").TextHighlightRules,h=function(){var a=new f,b=e.arrayToMap("abstract|event|new|struct|as|explicit|null|switch|base|extern|object|this|bool|false|operator|throw|break|finally|out|true|byte|fixed|override|try|case|float|params|typeof|catch|for|private|uint|char|foreach|protected|ulong|checked|goto|public|unchecked|class|if|readonly|unsafe|const|implicit|ref|ushort|continue|in|return|using|decimal|int|sbyte|virtual|default|interface|sealed|volatile|delegate|internal|short|void|do|is|sizeof|while|double|lock|stackalloc|else|long|static|enum|namespace|string|var|dynamic".split("|")),c=e.arrayToMap("null|true|false".split("|"));this.$rules={start:[{token:"comment",regex:"\\/\\/.*$"},a.getStartRule("doc-start"),{token:"comment",regex:"\\/\\*",next:"comment"},{token:"comment",regex:"\\/\\*\\*",next:"comment"},{token:"string.regexp",regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:function(a){return a=="this"?"variable.language":b.hasOwnProperty(a)?"keyword":c.hasOwnProperty(a)?"constant.language":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",regex:".+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+"}]},this.addRules(a.getRules(),"doc-"),this.$rules["doc-start"][0].next="start"};d.inherits(h,g),b.CSharpHighlightRules=h}),define("ace/mode/doc_comment_highlight_rules",["require","exports","module","pilot/oop","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"comment.doc",regex:"\\*\\/",next:"start"},{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},{token:"comment.doc",regex:"s+"},{token:"comment.doc",regex:"TODO"},{token:"comment.doc",regex:"[^@\\*]+"},{token:"comment.doc",regex:"."}]}};d.inherits(f,e),function(){this.getStartRule=function(a){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:a}}}.call(f.prototype),b.DocCommentHighlightRules=f}) \ No newline at end of file diff --git a/examples/lib/ace/mode-css.js b/examples/lib/ace/mode-css.js new file mode 100644 index 00000000..fcf1359b --- /dev/null +++ b/examples/lib/ace/mode-css.js @@ -0,0 +1 @@ +define("ace/mode/css",["require","exports","module","pilot/oop","ace/mode/text","ace/tokenizer","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/css_highlight_rules").CssHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(i,e),function(){this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a).tokens;if(e.length&&e[e.length-1].type=="comment")return d;var f=b.match(/^.*\{\s*$/);f&&(d+=c);return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(i.prototype),b.Mode=i}),define("ace/mode/css_highlight_rules",["require","exports","module","pilot/oop","pilot/lang","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){function g(a){var b=[],c=a.split("");for(var d=0;d=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"comment",regex:"^#!.*$"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",regex:".+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+"}]},this.addRules(a.getRules(),"doc-"),this.$rules["doc-start"][0].next="start"};d.inherits(h,g),b.JavaScriptHighlightRules=h}),define("ace/mode/doc_comment_highlight_rules",["require","exports","module","pilot/oop","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"comment.doc",regex:"\\*\\/",next:"start"},{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},{token:"comment.doc",regex:"s+"},{token:"comment.doc",regex:"TODO"},{token:"comment.doc",regex:"[^@\\*]+"},{token:"comment.doc",regex:"."}]}};d.inherits(f,e),function(){this.getStartRule=function(a){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:a}}}.call(f.prototype),b.DocCommentHighlightRules=f}),define("ace/worker/worker_client",["require","exports","module","pilot/oop","pilot/event_emitter"],function(a,b,c){var d=a("pilot/oop"),e=a("pilot/event_emitter").EventEmitter,f=function(b,c,d,e){this.callbacks=[];if(a.packaged)var f=this.$guessBasePath(),g=this.$worker=new Worker(f+c);else{var h=a.nameToUrl("ace/worker/worker",null,"_"),g=this.$worker=new Worker(h),i={};for(var j=0;j"},{token:"comment",regex:"<\\!--",next:"comment"},{token:"text",regex:"<(?=s*script)",next:"script"},{token:"text",regex:"<(?=s*style)",next:"css"},{token:"text",regex:"<\\/?",next:"tag"},{token:"text",regex:"\\s+"},{token:"text",regex:"[^<]+"}],script:[{token:"text",regex:">",next:"js-start"},{token:"keyword",regex:"[-_a-zA-Z0-9:]+"},{token:"text",regex:"\\s+"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"}],css:[{token:"text",regex:">",next:"css-start"},{token:"keyword",regex:"[-_a-zA-Z0-9:]+"},{token:"text",regex:"\\s+"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"}],tag:[{token:"text",regex:">",next:"start"},{token:"keyword",regex:"[-_a-zA-Z0-9:]+"},{token:"text",regex:"\\s+"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"}],cdata:[{token:"text",regex:"\\]\\]>",next:"start"},{token:"text",regex:"\\s+"},{token:"text",regex:".+"}],comment:[{token:"comment",regex:".*?-->",next:"start"},{token:"comment",regex:".+"}]};var a=(new f).getRules();this.addRules(a,"js-"),this.$rules["js-start"].unshift({token:"comment",regex:"\\/\\/.*(?=<\\/script>)",next:"tag"},{token:"text",regex:"<\\/(?=script)",next:"tag"});var b=(new e).getRules();this.addRules(b,"css-"),this.$rules["css-start"].unshift({token:"text",regex:"<\\/(?=style)",next:"tag"})};d.inherits(h,g),b.HtmlHighlightRules=h}) \ No newline at end of file diff --git a/examples/lib/ace/mode-java.js b/examples/lib/ace/mode-java.js new file mode 100644 index 00000000..89345744 --- /dev/null +++ b/examples/lib/ace/mode-java.js @@ -0,0 +1 @@ +define("ace/mode/java",["require","exports","module","pilot/oop","ace/mode/javascript","ace/tokenizer","ace/mode/java_highlight_rules","ace/mode/matching_brace_outdent"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/javascript").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/java_highlight_rules").JavaHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(i,e),function(){this.createWorker=function(a){return null}}.call(i.prototype),b.Mode=i}),define("ace/mode/javascript",["require","exports","module","pilot/oop","ace/mode/text","ace/tokenizer","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/worker/worker_client"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=a("ace/worker/worker_client").WorkerClient,k=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(k,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)\/\//;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"//")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}else if(a=="doc-start"){if(g=="start")return"";var h=b.match(/^\s*(\/?)\*/);h&&(h[1]&&(d+=" "),d+="* ")}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)},this.createWorker=function(a){var b=a.getDocument(),c=new j(["ace","pilot"],"worker-javascript.js","ace/mode/javascript_worker","JavaScriptWorker");c.call("setValue",[b.getValue()]),b.on("change",function(a){a.range={start:a.data.range.start,end:a.data.range.end},c.emit("change",a)}),c.on("jslint",function(b){var c=[];for(var d=0;d=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"comment",regex:"^#!.*$"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",regex:".+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+"}]},this.addRules(a.getRules(),"doc-"),this.$rules["doc-start"][0].next="start"};d.inherits(h,g),b.JavaScriptHighlightRules=h}),define("ace/mode/doc_comment_highlight_rules",["require","exports","module","pilot/oop","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"comment.doc",regex:"\\*\\/",next:"start"},{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},{token:"comment.doc",regex:"s+"},{token:"comment.doc",regex:"TODO"},{token:"comment.doc",regex:"[^@\\*]+"},{token:"comment.doc",regex:"."}]}};d.inherits(f,e),function(){this.getStartRule=function(a){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:a}}}.call(f.prototype),b.DocCommentHighlightRules=f}),define("ace/worker/worker_client",["require","exports","module","pilot/oop","pilot/event_emitter"],function(a,b,c){var d=a("pilot/oop"),e=a("pilot/event_emitter").EventEmitter,f=function(b,c,d,e){this.callbacks=[];if(a.packaged)var f=this.$guessBasePath(),g=this.$worker=new Worker(f+c);else{var h=a.nameToUrl("ace/worker/worker",null,"_"),g=this.$worker=new Worker(h),i={};for(var j=0;j=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",regex:".+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+"}]},this.addRules(a.getRules(),"doc-"),this.$rules["doc-start"][0].next="start"};d.inherits(h,g),b.JavaHighlightRules=h}) \ No newline at end of file diff --git a/examples/lib/ace/mode-javascript.js b/examples/lib/ace/mode-javascript.js new file mode 100644 index 00000000..60bf2e9b --- /dev/null +++ b/examples/lib/ace/mode-javascript.js @@ -0,0 +1 @@ +define("ace/mode/javascript",["require","exports","module","pilot/oop","ace/mode/text","ace/tokenizer","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/worker/worker_client"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=a("ace/worker/worker_client").WorkerClient,k=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(k,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)\/\//;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"//")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}else if(a=="doc-start"){if(g=="start")return"";var h=b.match(/^\s*(\/?)\*/);h&&(h[1]&&(d+=" "),d+="* ")}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)},this.createWorker=function(a){var b=a.getDocument(),c=new j(["ace","pilot"],"worker-javascript.js","ace/mode/javascript_worker","JavaScriptWorker");c.call("setValue",[b.getValue()]),b.on("change",function(a){a.range={start:a.data.range.start,end:a.data.range.end},c.emit("change",a)}),c.on("jslint",function(b){var c=[];for(var d=0;d=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"comment",regex:"^#!.*$"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",regex:".+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+"}]},this.addRules(a.getRules(),"doc-"),this.$rules["doc-start"][0].next="start"};d.inherits(h,g),b.JavaScriptHighlightRules=h}),define("ace/mode/doc_comment_highlight_rules",["require","exports","module","pilot/oop","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"comment.doc",regex:"\\*\\/",next:"start"},{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},{token:"comment.doc",regex:"s+"},{token:"comment.doc",regex:"TODO"},{token:"comment.doc",regex:"[^@\\*]+"},{token:"comment.doc",regex:"."}]}};d.inherits(f,e),function(){this.getStartRule=function(a){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:a}}}.call(f.prototype),b.DocCommentHighlightRules=f}),define("ace/worker/worker_client",["require","exports","module","pilot/oop","pilot/event_emitter"],function(a,b,c){var d=a("pilot/oop"),e=a("pilot/event_emitter").EventEmitter,f=function(b,c,d,e){this.callbacks=[];if(a.packaged)var f=this.$guessBasePath(),g=this.$worker=new Worker(f+c);else{var h=a.nameToUrl("ace/worker/worker",null,"_"),g=this.$worker=new Worker(h),i={};for(var j=0;j>=|<<=|<=>|&&=|=>|!~|\\^=|&=|\\|=|\\.=|x=|%=|\\/=|\\*=|\\-=|\\+=|=~|\\*\\*|\\-\\-|\\.\\.|\\|\\||&&|\\+\\+|\\->|!=|==|>=|<=|>>|<<|,|=|\\?\\:|\\^|\\||x|%|\\/|\\*|<|&|\\\\|~|!|>|\\.|\\-|\\+|\\-C|\\-b|\\-S|\\-u|\\-t|\\-p|\\-l|\\-d|\\-f|\\-g|\\-s|\\-z|\\-k|\\-e|\\-O|\\-T|\\-B|\\-M|\\-A|\\-X|\\-W|\\-c|\\-R|\\-o|\\-x|\\-w|\\-r|\\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+"}]}};d.inherits(g,f),b.PerlHighlightRules=g}) \ No newline at end of file diff --git a/examples/lib/ace/mode-php.js b/examples/lib/ace/mode-php.js new file mode 100644 index 00000000..46e077e9 --- /dev/null +++ b/examples/lib/ace/mode-php.js @@ -0,0 +1 @@ +define("ace/mode/php",["require","exports","module","pilot/oop","ace/mode/text","ace/tokenizer","ace/mode/php_highlight_rules","ace/mode/matching_brace_outdent","ace/range"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/php_highlight_rules").PhpHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[\:]\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/php_highlight_rules",["require","exports","module","pilot/oop","pilot/lang","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules,g=a("ace/mode/text_highlight_rules").TextHighlightRules,h=function(){var a=new f,b=e.arrayToMap("abs|acos|acosh|addcslashes|addslashes|aggregate|aggregate_info|aggregate_methods|aggregate_methods_by_list|aggregate_methods_by_regexp|aggregate_properties|aggregate_properties_by_list|aggregate_properties_by_regexp|aggregation_info|apache_child_terminate|apache_get_modules|apache_get_version|apache_getenv|apache_lookup_uri|apache_note|apache_request_headers|apache_response_headers|apache_setenv|array|array_change_key_case|array_chunk|array_combine|array_count_values|array_diff|array_diff_assoc|array_diff_uassoc|array_fill|array_filter|array_flip|array_intersect|array_intersect_assoc|array_key_exists|array_keys|array_map|array_merge|array_merge_recursive|array_multisort|array_pad|array_pop|array_push|array_rand|array_reduce|array_reverse|array_search|array_shift|array_slice|array_splice|array_sum|array_udiff|array_udiff_assoc|array_udiff_uassoc|array_unique|array_unshift|array_values|array_walk|arsort|ascii2ebcdic|asin|asinh|asort|aspell_check|aspell_check_raw|aspell_new|aspell_suggest|assert|assert_options|atan|atan2|atanh|base64_decode|base64_encode|base_convert|basename|bcadd|bccomp|bcdiv|bcmod|bcmul|bcpow|bcpowmod|bcscale|bcsqrt|bcsub|bin2hex|bind_textdomain_codeset|bindec|bindtextdomain|bzclose|bzcompress|bzdecompress|bzerrno|bzerror|bzerrstr|bzflush|bzopen|bzread|bzwrite|cal_days_in_month|cal_from_jd|cal_info|cal_to_jd|call_user_func|call_user_func_array|call_user_method|call_user_method_array|ccvs_add|ccvs_auth|ccvs_command|ccvs_count|ccvs_delete|ccvs_done|ccvs_init|ccvs_lookup|ccvs_new|ccvs_report|ccvs_return|ccvs_reverse|ccvs_sale|ccvs_status|ccvs_textvalue|ccvs_void|ceil|chdir|checkdate|checkdnsrr|chgrp|chmod|chop|chown|chr|chroot|chunk_split|class_exists|clearstatcache|closedir|closelog|com|com_addref|com_get|com_invoke|com_isenum|com_load|com_load_typelib|com_propget|com_propput|com_propset|com_release|com_set|compact|connection_aborted|connection_status|connection_timeout|constant|convert_cyr_string|copy|cos|cosh|count|count_chars|cpdf_add_annotation|cpdf_add_outline|cpdf_arc|cpdf_begin_text|cpdf_circle|cpdf_clip|cpdf_close|cpdf_closepath|cpdf_closepath_fill_stroke|cpdf_closepath_stroke|cpdf_continue_text|cpdf_curveto|cpdf_end_text|cpdf_fill|cpdf_fill_stroke|cpdf_finalize|cpdf_finalize_page|cpdf_global_set_document_limits|cpdf_import_jpeg|cpdf_lineto|cpdf_moveto|cpdf_newpath|cpdf_open|cpdf_output_buffer|cpdf_page_init|cpdf_place_inline_image|cpdf_rect|cpdf_restore|cpdf_rlineto|cpdf_rmoveto|cpdf_rotate|cpdf_rotate_text|cpdf_save|cpdf_save_to_file|cpdf_scale|cpdf_set_action_url|cpdf_set_char_spacing|cpdf_set_creator|cpdf_set_current_page|cpdf_set_font|cpdf_set_font_directories|cpdf_set_font_map_file|cpdf_set_horiz_scaling|cpdf_set_keywords|cpdf_set_leading|cpdf_set_page_animation|cpdf_set_subject|cpdf_set_text_matrix|cpdf_set_text_pos|cpdf_set_text_rendering|cpdf_set_text_rise|cpdf_set_title|cpdf_set_viewer_preferences|cpdf_set_word_spacing|cpdf_setdash|cpdf_setflat|cpdf_setgray|cpdf_setgray_fill|cpdf_setgray_stroke|cpdf_setlinecap|cpdf_setlinejoin|cpdf_setlinewidth|cpdf_setmiterlimit|cpdf_setrgbcolor|cpdf_setrgbcolor_fill|cpdf_setrgbcolor_stroke|cpdf_show|cpdf_show_xy|cpdf_stringwidth|cpdf_stroke|cpdf_text|cpdf_translate|crack_check|crack_closedict|crack_getlastmessage|crack_opendict|crc32|create_function|crypt|ctype_alnum|ctype_alpha|ctype_cntrl|ctype_digit|ctype_graph|ctype_lower|ctype_print|ctype_punct|ctype_space|ctype_upper|ctype_xdigit|curl_close|curl_errno|curl_error|curl_exec|curl_getinfo|curl_init|curl_multi_add_handle|curl_multi_close|curl_multi_exec|curl_multi_getcontent|curl_multi_info_read|curl_multi_init|curl_multi_remove_handle|curl_multi_select|curl_setopt|curl_version|current|cybercash_base64_decode|cybercash_base64_encode|cybercash_decr|cybercash_encr|cyrus_authenticate|cyrus_bind|cyrus_close|cyrus_connect|cyrus_query|cyrus_unbind|date|dba_close|dba_delete|dba_exists|dba_fetch|dba_firstkey|dba_handlers|dba_insert|dba_key_split|dba_list|dba_nextkey|dba_open|dba_optimize|dba_popen|dba_replace|dba_sync|dbase_add_record|dbase_close|dbase_create|dbase_delete_record|dbase_get_header_info|dbase_get_record|dbase_get_record_with_names|dbase_numfields|dbase_numrecords|dbase_open|dbase_pack|dbase_replace_record|dblist|dbmclose|dbmdelete|dbmexists|dbmfetch|dbmfirstkey|dbminsert|dbmnextkey|dbmopen|dbmreplace|dbplus_add|dbplus_aql|dbplus_chdir|dbplus_close|dbplus_curr|dbplus_errcode|dbplus_errno|dbplus_find|dbplus_first|dbplus_flush|dbplus_freealllocks|dbplus_freelock|dbplus_freerlocks|dbplus_getlock|dbplus_getunique|dbplus_info|dbplus_last|dbplus_lockrel|dbplus_next|dbplus_open|dbplus_prev|dbplus_rchperm|dbplus_rcreate|dbplus_rcrtexact|dbplus_rcrtlike|dbplus_resolve|dbplus_restorepos|dbplus_rkeys|dbplus_ropen|dbplus_rquery|dbplus_rrename|dbplus_rsecindex|dbplus_runlink|dbplus_rzap|dbplus_savepos|dbplus_setindex|dbplus_setindexbynumber|dbplus_sql|dbplus_tcl|dbplus_tremove|dbplus_undo|dbplus_undoprepare|dbplus_unlockrel|dbplus_unselect|dbplus_update|dbplus_xlockrel|dbplus_xunlockrel|dbx_close|dbx_compare|dbx_connect|dbx_error|dbx_escape_string|dbx_fetch_row|dbx_query|dbx_sort|dcgettext|dcngettext|deaggregate|debug_backtrace|debug_print_backtrace|debugger_off|debugger_on|decbin|dechex|decoct|define|define_syslog_variables|defined|deg2rad|delete|dgettext|die|dio_close|dio_fcntl|dio_open|dio_read|dio_seek|dio_stat|dio_tcsetattr|dio_truncate|dio_write|dir|dirname|disk_free_space|disk_total_space|diskfreespace|dl|dngettext|dns_check_record|dns_get_mx|dns_get_record|domxml_new_doc|domxml_open_file|domxml_open_mem|domxml_version|domxml_xmltree|domxml_xslt_stylesheet|domxml_xslt_stylesheet_doc|domxml_xslt_stylesheet_file|dotnet_load|doubleval|each|easter_date|easter_days|ebcdic2ascii|echo|empty|end|ereg|ereg_replace|eregi|eregi_replace|error_log|error_reporting|escapeshellarg|escapeshellcmd|eval|exec|exif_imagetype|exif_read_data|exif_thumbnail|exit|exp|explode|expm1|extension_loaded|extract|ezmlm_hash|fam_cancel_monitor|fam_close|fam_monitor_collection|fam_monitor_directory|fam_monitor_file|fam_next_event|fam_open|fam_pending|fam_resume_monitor|fam_suspend_monitor|fbsql_affected_rows|fbsql_autocommit|fbsql_blob_size|fbsql_change_user|fbsql_clob_size|fbsql_close|fbsql_commit|fbsql_connect|fbsql_create_blob|fbsql_create_clob|fbsql_create_db|fbsql_data_seek|fbsql_database|fbsql_database_password|fbsql_db_query|fbsql_db_status|fbsql_drop_db|fbsql_errno|fbsql_error|fbsql_fetch_array|fbsql_fetch_assoc|fbsql_fetch_field|fbsql_fetch_lengths|fbsql_fetch_object|fbsql_fetch_row|fbsql_field_flags|fbsql_field_len|fbsql_field_name|fbsql_field_seek|fbsql_field_table|fbsql_field_type|fbsql_free_result|fbsql_get_autostart_info|fbsql_hostname|fbsql_insert_id|fbsql_list_dbs|fbsql_list_fields|fbsql_list_tables|fbsql_next_result|fbsql_num_fields|fbsql_num_rows|fbsql_password|fbsql_pconnect|fbsql_query|fbsql_read_blob|fbsql_read_clob|fbsql_result|fbsql_rollback|fbsql_select_db|fbsql_set_lob_mode|fbsql_set_password|fbsql_set_transaction|fbsql_start_db|fbsql_stop_db|fbsql_tablename|fbsql_username|fbsql_warnings|fclose|fdf_add_doc_javascript|fdf_add_template|fdf_close|fdf_create|fdf_enum_values|fdf_errno|fdf_error|fdf_get_ap|fdf_get_attachment|fdf_get_encoding|fdf_get_file|fdf_get_flags|fdf_get_opt|fdf_get_status|fdf_get_value|fdf_get_version|fdf_header|fdf_next_field_name|fdf_open|fdf_open_string|fdf_remove_item|fdf_save|fdf_save_string|fdf_set_ap|fdf_set_encoding|fdf_set_file|fdf_set_flags|fdf_set_javascript_action|fdf_set_opt|fdf_set_status|fdf_set_submit_form_action|fdf_set_target_frame|fdf_set_value|fdf_set_version|feof|fflush|fgetc|fgetcsv|fgets|fgetss|file|file_exists|file_get_contents|file_put_contents|fileatime|filectime|filegroup|fileinode|filemtime|fileowner|fileperms|filepro|filepro_fieldcount|filepro_fieldname|filepro_fieldtype|filepro_fieldwidth|filepro_retrieve|filepro_rowcount|filesize|filetype|floatval|flock|floor|flush|fmod|fnmatch|fopen|fpassthru|fprintf|fputs|fread|frenchtojd|fribidi_log2vis|fscanf|fseek|fsockopen|fstat|ftell|ftok|ftp_alloc|ftp_cdup|ftp_chdir|ftp_chmod|ftp_close|ftp_connect|ftp_delete|ftp_exec|ftp_fget|ftp_fput|ftp_get|ftp_get_option|ftp_login|ftp_mdtm|ftp_mkdir|ftp_nb_continue|ftp_nb_fget|ftp_nb_fput|ftp_nb_get|ftp_nb_put|ftp_nlist|ftp_pasv|ftp_put|ftp_pwd|ftp_quit|ftp_raw|ftp_rawlist|ftp_rename|ftp_rmdir|ftp_set_option|ftp_site|ftp_size|ftp_ssl_connect|ftp_systype|ftruncate|func_get_arg|func_get_args|func_num_args|function_exists|fwrite|gd_info|get_browser|get_cfg_var|get_class|get_class_methods|get_class_vars|get_current_user|get_declared_classes|get_declared_interfaces|get_defined_constants|get_defined_functions|get_defined_vars|get_extension_funcs|get_headers|get_html_translation_table|get_include_path|get_included_files|get_loaded_extensions|get_magic_quotes_gpc|get_magic_quotes_runtime|get_meta_tags|get_object_vars|get_parent_class|get_required_files|get_resource_type|getallheaders|getcwd|getdate|getenv|gethostbyaddr|gethostbyname|gethostbynamel|getimagesize|getlastmod|getmxrr|getmygid|getmyinode|getmypid|getmyuid|getopt|getprotobyname|getprotobynumber|getrandmax|getrusage|getservbyname|getservbyport|gettext|gettimeofday|gettype|glob|gmdate|gmmktime|gmp_abs|gmp_add|gmp_and|gmp_clrbit|gmp_cmp|gmp_com|gmp_div|gmp_div_q|gmp_div_qr|gmp_div_r|gmp_divexact|gmp_fact|gmp_gcd|gmp_gcdext|gmp_hamdist|gmp_init|gmp_intval|gmp_invert|gmp_jacobi|gmp_legendre|gmp_mod|gmp_mul|gmp_neg|gmp_or|gmp_perfect_square|gmp_popcount|gmp_pow|gmp_powm|gmp_prob_prime|gmp_random|gmp_scan0|gmp_scan1|gmp_setbit|gmp_sign|gmp_sqrt|gmp_sqrtrem|gmp_strval|gmp_sub|gmp_xor|gmstrftime|gregoriantojd|gzclose|gzcompress|gzdeflate|gzencode|gzeof|gzfile|gzgetc|gzgets|gzgetss|gzinflate|gzopen|gzpassthru|gzputs|gzread|gzrewind|gzseek|gztell|gzuncompress|gzwrite|header|headers_list|headers_sent|hebrev|hebrevc|hexdec|highlight_file|highlight_string|html_entity_decode|htmlentities|htmlspecialchars|http_build_query|hw_api_attribute|hw_api_content|hw_api_object|hw_array2objrec|hw_changeobject|hw_children|hw_childrenobj|hw_close|hw_connect|hw_connection_info|hw_cp|hw_deleteobject|hw_docbyanchor|hw_docbyanchorobj|hw_document_attributes|hw_document_bodytag|hw_document_content|hw_document_setcontent|hw_document_size|hw_dummy|hw_edittext|hw_error|hw_errormsg|hw_free_document|hw_getanchors|hw_getanchorsobj|hw_getandlock|hw_getchildcoll|hw_getchildcollobj|hw_getchilddoccoll|hw_getchilddoccollobj|hw_getobject|hw_getobjectbyquery|hw_getobjectbyquerycoll|hw_getobjectbyquerycollobj|hw_getobjectbyqueryobj|hw_getparents|hw_getparentsobj|hw_getrellink|hw_getremote|hw_getremotechildren|hw_getsrcbydestobj|hw_gettext|hw_getusername|hw_identify|hw_incollections|hw_info|hw_inscoll|hw_insdoc|hw_insertanchors|hw_insertdocument|hw_insertobject|hw_mapid|hw_modifyobject|hw_mv|hw_new_document|hw_objrec2array|hw_output_document|hw_pconnect|hw_pipedocument|hw_root|hw_setlinkroot|hw_stat|hw_unlock|hw_who|hwapi_hgcsp|hypot|ibase_add_user|ibase_affected_rows|ibase_backup|ibase_blob_add|ibase_blob_cancel|ibase_blob_close|ibase_blob_create|ibase_blob_echo|ibase_blob_get|ibase_blob_import|ibase_blob_info|ibase_blob_open|ibase_close|ibase_commit|ibase_commit_ret|ibase_connect|ibase_db_info|ibase_delete_user|ibase_drop_db|ibase_errcode|ibase_errmsg|ibase_execute|ibase_fetch_assoc|ibase_fetch_object|ibase_fetch_row|ibase_field_info|ibase_free_event_handler|ibase_free_query|ibase_free_result|ibase_gen_id|ibase_maintain_db|ibase_modify_user|ibase_name_result|ibase_num_fields|ibase_num_params|ibase_param_info|ibase_pconnect|ibase_prepare|ibase_query|ibase_restore|ibase_rollback|ibase_rollback_ret|ibase_server_info|ibase_service_attach|ibase_service_detach|ibase_set_event_handler|ibase_timefmt|ibase_trans|ibase_wait_event|iconv|iconv_get_encoding|iconv_mime_decode|iconv_mime_decode_headers|iconv_mime_encode|iconv_set_encoding|iconv_strlen|iconv_strpos|iconv_strrpos|iconv_substr|idate|ifx_affected_rows|ifx_blobinfile_mode|ifx_byteasvarchar|ifx_close|ifx_connect|ifx_copy_blob|ifx_create_blob|ifx_create_char|ifx_do|ifx_error|ifx_errormsg|ifx_fetch_row|ifx_fieldproperties|ifx_fieldtypes|ifx_free_blob|ifx_free_char|ifx_free_result|ifx_get_blob|ifx_get_char|ifx_getsqlca|ifx_htmltbl_result|ifx_nullformat|ifx_num_fields|ifx_num_rows|ifx_pconnect|ifx_prepare|ifx_query|ifx_textasvarchar|ifx_update_blob|ifx_update_char|ifxus_close_slob|ifxus_create_slob|ifxus_free_slob|ifxus_open_slob|ifxus_read_slob|ifxus_seek_slob|ifxus_tell_slob|ifxus_write_slob|ignore_user_abort|image2wbmp|image_type_to_mime_type|imagealphablending|imageantialias|imagearc|imagechar|imagecharup|imagecolorallocate|imagecolorallocatealpha|imagecolorat|imagecolorclosest|imagecolorclosestalpha|imagecolorclosesthwb|imagecolordeallocate|imagecolorexact|imagecolorexactalpha|imagecolormatch|imagecolorresolve|imagecolorresolvealpha|imagecolorset|imagecolorsforindex|imagecolorstotal|imagecolortransparent|imagecopy|imagecopymerge|imagecopymergegray|imagecopyresampled|imagecopyresized|imagecreate|imagecreatefromgd|imagecreatefromgd2|imagecreatefromgd2part|imagecreatefromgif|imagecreatefromjpeg|imagecreatefrompng|imagecreatefromstring|imagecreatefromwbmp|imagecreatefromxbm|imagecreatefromxpm|imagecreatetruecolor|imagedashedline|imagedestroy|imageellipse|imagefill|imagefilledarc|imagefilledellipse|imagefilledpolygon|imagefilledrectangle|imagefilltoborder|imagefilter|imagefontheight|imagefontwidth|imageftbbox|imagefttext|imagegammacorrect|imagegd|imagegd2|imagegif|imageinterlace|imageistruecolor|imagejpeg|imagelayereffect|imageline|imageloadfont|imagepalettecopy|imagepng|imagepolygon|imagepsbbox|imagepscopyfont|imagepsencodefont|imagepsextendfont|imagepsfreefont|imagepsloadfont|imagepsslantfont|imagepstext|imagerectangle|imagerotate|imagesavealpha|imagesetbrush|imagesetpixel|imagesetstyle|imagesetthickness|imagesettile|imagestring|imagestringup|imagesx|imagesy|imagetruecolortopalette|imagettfbbox|imagettftext|imagetypes|imagewbmp|imagexbm|imap_8bit|imap_alerts|imap_append|imap_base64|imap_binary|imap_body|imap_bodystruct|imap_check|imap_clearflag_full|imap_close|imap_createmailbox|imap_delete|imap_deletemailbox|imap_errors|imap_expunge|imap_fetch_overview|imap_fetchbody|imap_fetchheader|imap_fetchstructure|imap_get_quota|imap_get_quotaroot|imap_getacl|imap_getmailboxes|imap_getsubscribed|imap_header|imap_headerinfo|imap_headers|imap_last_error|imap_list|imap_listmailbox|imap_listscan|imap_listsubscribed|imap_lsub|imap_mail|imap_mail_compose|imap_mail_copy|imap_mail_move|imap_mailboxmsginfo|imap_mime_header_decode|imap_msgno|imap_num_msg|imap_num_recent|imap_open|imap_ping|imap_qprint|imap_renamemailbox|imap_reopen|imap_rfc822_parse_adrlist|imap_rfc822_parse_headers|imap_rfc822_write_address|imap_scanmailbox|imap_search|imap_set_quota|imap_setacl|imap_setflag_full|imap_sort|imap_status|imap_subscribe|imap_thread|imap_timeout|imap_uid|imap_undelete|imap_unsubscribe|imap_utf7_decode|imap_utf7_encode|imap_utf8|implode|import_request_variables|in_array|ingres_autocommit|ingres_close|ingres_commit|ingres_connect|ingres_fetch_array|ingres_fetch_object|ingres_fetch_row|ingres_field_length|ingres_field_name|ingres_field_nullable|ingres_field_precision|ingres_field_scale|ingres_field_type|ingres_num_fields|ingres_num_rows|ingres_pconnect|ingres_query|ingres_rollback|ini_alter|ini_get|ini_get_all|ini_restore|ini_set|intval|ip2long|iptcembed|iptcparse|ircg_channel_mode|ircg_disconnect|ircg_fetch_error_msg|ircg_get_username|ircg_html_encode|ircg_ignore_add|ircg_ignore_del|ircg_invite|ircg_is_conn_alive|ircg_join|ircg_kick|ircg_list|ircg_lookup_format_messages|ircg_lusers|ircg_msg|ircg_nick|ircg_nickname_escape|ircg_nickname_unescape|ircg_notice|ircg_oper|ircg_part|ircg_pconnect|ircg_register_format_messages|ircg_set_current|ircg_set_file|ircg_set_on_die|ircg_topic|ircg_who|ircg_whois|is_a|is_array|is_bool|is_callable|is_dir|is_double|is_executable|is_file|is_finite|is_float|is_infinite|is_int|is_integer|is_link|is_long|is_nan|is_null|is_numeric|is_object|is_readable|is_real|is_resource|is_scalar|is_soap_fault|is_string|is_subclass_of|is_uploaded_file|is_writable|is_writeable|isset|java_last_exception_clear|java_last_exception_get|jddayofweek|jdmonthname|jdtofrench|jdtogregorian|jdtojewish|jdtojulian|jdtounix|jewishtojd|join|jpeg2wbmp|juliantojd|key|krsort|ksort|lcg_value|ldap_8859_to_t61|ldap_add|ldap_bind|ldap_close|ldap_compare|ldap_connect|ldap_count_entries|ldap_delete|ldap_dn2ufn|ldap_err2str|ldap_errno|ldap_error|ldap_explode_dn|ldap_first_attribute|ldap_first_entry|ldap_first_reference|ldap_free_result|ldap_get_attributes|ldap_get_dn|ldap_get_entries|ldap_get_option|ldap_get_values|ldap_get_values_len|ldap_list|ldap_mod_add|ldap_mod_del|ldap_mod_replace|ldap_modify|ldap_next_attribute|ldap_next_entry|ldap_next_reference|ldap_parse_reference|ldap_parse_result|ldap_read|ldap_rename|ldap_search|ldap_set_option|ldap_set_rebind_proc|ldap_sort|ldap_start_tls|ldap_t61_to_8859|ldap_unbind|levenshtein|link|linkinfo|list|localeconv|localtime|log|log10|log1p|long2ip|lstat|ltrim|lzf_compress|lzf_decompress|lzf_optimized_for|mail|mailparse_determine_best_xfer_encoding|mailparse_msg_create|mailparse_msg_extract_part|mailparse_msg_extract_part_file|mailparse_msg_free|mailparse_msg_get_part|mailparse_msg_get_part_data|mailparse_msg_get_structure|mailparse_msg_parse|mailparse_msg_parse_file|mailparse_rfc822_parse_addresses|mailparse_stream_encode|mailparse_uudecode_all|main|max|mb_convert_case|mb_convert_encoding|mb_convert_kana|mb_convert_variables|mb_decode_mimeheader|mb_decode_numericentity|mb_detect_encoding|mb_detect_order|mb_encode_mimeheader|mb_encode_numericentity|mb_ereg|mb_ereg_match|mb_ereg_replace|mb_ereg_search|mb_ereg_search_getpos|mb_ereg_search_getregs|mb_ereg_search_init|mb_ereg_search_pos|mb_ereg_search_regs|mb_ereg_search_setpos|mb_eregi|mb_eregi_replace|mb_get_info|mb_http_input|mb_http_output|mb_internal_encoding|mb_language|mb_output_handler|mb_parse_str|mb_preferred_mime_name|mb_regex_encoding|mb_regex_set_options|mb_send_mail|mb_split|mb_strcut|mb_strimwidth|mb_strlen|mb_strpos|mb_strrpos|mb_strtolower|mb_strtoupper|mb_strwidth|mb_substitute_character|mb_substr|mb_substr_count|mcal_append_event|mcal_close|mcal_create_calendar|mcal_date_compare|mcal_date_valid|mcal_day_of_week|mcal_day_of_year|mcal_days_in_month|mcal_delete_calendar|mcal_delete_event|mcal_event_add_attribute|mcal_event_init|mcal_event_set_alarm|mcal_event_set_category|mcal_event_set_class|mcal_event_set_description|mcal_event_set_end|mcal_event_set_recur_daily|mcal_event_set_recur_monthly_mday|mcal_event_set_recur_monthly_wday|mcal_event_set_recur_none|mcal_event_set_recur_weekly|mcal_event_set_recur_yearly|mcal_event_set_start|mcal_event_set_title|mcal_expunge|mcal_fetch_current_stream_event|mcal_fetch_event|mcal_is_leap_year|mcal_list_alarms|mcal_list_events|mcal_next_recurrence|mcal_open|mcal_popen|mcal_rename_calendar|mcal_reopen|mcal_snooze|mcal_store_event|mcal_time_valid|mcal_week_of_year|mcrypt_cbc|mcrypt_cfb|mcrypt_create_iv|mcrypt_decrypt|mcrypt_ecb|mcrypt_enc_get_algorithms_name|mcrypt_enc_get_block_size|mcrypt_enc_get_iv_size|mcrypt_enc_get_key_size|mcrypt_enc_get_modes_name|mcrypt_enc_get_supported_key_sizes|mcrypt_enc_is_block_algorithm|mcrypt_enc_is_block_algorithm_mode|mcrypt_enc_is_block_mode|mcrypt_enc_self_test|mcrypt_encrypt|mcrypt_generic|mcrypt_generic_deinit|mcrypt_generic_end|mcrypt_generic_init|mcrypt_get_block_size|mcrypt_get_cipher_name|mcrypt_get_iv_size|mcrypt_get_key_size|mcrypt_list_algorithms|mcrypt_list_modes|mcrypt_module_close|mcrypt_module_get_algo_block_size|mcrypt_module_get_algo_key_size|mcrypt_module_get_supported_key_sizes|mcrypt_module_is_block_algorithm|mcrypt_module_is_block_algorithm_mode|mcrypt_module_is_block_mode|mcrypt_module_open|mcrypt_module_self_test|mcrypt_ofb|mcve_adduser|mcve_adduserarg|mcve_bt|mcve_checkstatus|mcve_chkpwd|mcve_chngpwd|mcve_completeauthorizations|mcve_connect|mcve_connectionerror|mcve_deleteresponse|mcve_deletetrans|mcve_deleteusersetup|mcve_deluser|mcve_destroyconn|mcve_destroyengine|mcve_disableuser|mcve_edituser|mcve_enableuser|mcve_force|mcve_getcell|mcve_getcellbynum|mcve_getcommadelimited|mcve_getheader|mcve_getuserarg|mcve_getuserparam|mcve_gft|mcve_gl|mcve_gut|mcve_initconn|mcve_initengine|mcve_initusersetup|mcve_iscommadelimited|mcve_liststats|mcve_listusers|mcve_maxconntimeout|mcve_monitor|mcve_numcolumns|mcve_numrows|mcve_override|mcve_parsecommadelimited|mcve_ping|mcve_preauth|mcve_preauthcompletion|mcve_qc|mcve_responseparam|mcve_return|mcve_returncode|mcve_returnstatus|mcve_sale|mcve_setblocking|mcve_setdropfile|mcve_setip|mcve_setssl|mcve_setssl_files|mcve_settimeout|mcve_settle|mcve_text_avs|mcve_text_code|mcve_text_cv|mcve_transactionauth|mcve_transactionavs|mcve_transactionbatch|mcve_transactioncv|mcve_transactionid|mcve_transactionitem|mcve_transactionssent|mcve_transactiontext|mcve_transinqueue|mcve_transnew|mcve_transparam|mcve_transsend|mcve_ub|mcve_uwait|mcve_verifyconnection|mcve_verifysslcert|mcve_void|md5|md5_file|mdecrypt_generic|memory_get_usage|metaphone|method_exists|mhash|mhash_count|mhash_get_block_size|mhash_get_hash_name|mhash_keygen_s2k|microtime|mime_content_type|min|ming_setcubicthreshold|ming_setscale|ming_useswfversion|mkdir|mktime|money_format|move_uploaded_file|msession_connect|msession_count|msession_create|msession_destroy|msession_disconnect|msession_find|msession_get|msession_get_array|msession_getdata|msession_inc|msession_list|msession_listvar|msession_lock|msession_plugin|msession_randstr|msession_set|msession_set_array|msession_setdata|msession_timeout|msession_uniq|msession_unlock|msg_get_queue|msg_receive|msg_remove_queue|msg_send|msg_set_queue|msg_stat_queue|msql|msql|msql_affected_rows|msql_close|msql_connect|msql_create_db|msql_createdb|msql_data_seek|msql_dbname|msql_drop_db|msql_error|msql_fetch_array|msql_fetch_field|msql_fetch_object|msql_fetch_row|msql_field_flags|msql_field_len|msql_field_name|msql_field_seek|msql_field_table|msql_field_type|msql_fieldflags|msql_fieldlen|msql_fieldname|msql_fieldtable|msql_fieldtype|msql_free_result|msql_list_dbs|msql_list_fields|msql_list_tables|msql_num_fields|msql_num_rows|msql_numfields|msql_numrows|msql_pconnect|msql_query|msql_regcase|msql_result|msql_select_db|msql_tablename|mssql_bind|mssql_close|mssql_connect|mssql_data_seek|mssql_execute|mssql_fetch_array|mssql_fetch_assoc|mssql_fetch_batch|mssql_fetch_field|mssql_fetch_object|mssql_fetch_row|mssql_field_length|mssql_field_name|mssql_field_seek|mssql_field_type|mssql_free_result|mssql_free_statement|mssql_get_last_message|mssql_guid_string|mssql_init|mssql_min_error_severity|mssql_min_message_severity|mssql_next_result|mssql_num_fields|mssql_num_rows|mssql_pconnect|mssql_query|mssql_result|mssql_rows_affected|mssql_select_db|mt_getrandmax|mt_rand|mt_srand|muscat_close|muscat_get|muscat_give|muscat_setup|muscat_setup_net|mysql_affected_rows|mysql_change_user|mysql_client_encoding|mysql_close|mysql_connect|mysql_create_db|mysql_data_seek|mysql_db_name|mysql_db_query|mysql_drop_db|mysql_errno|mysql_error|mysql_escape_string|mysql_fetch_array|mysql_fetch_assoc|mysql_fetch_field|mysql_fetch_lengths|mysql_fetch_object|mysql_fetch_row|mysql_field_flags|mysql_field_len|mysql_field_name|mysql_field_seek|mysql_field_table|mysql_field_type|mysql_free_result|mysql_get_client_info|mysql_get_host_info|mysql_get_proto_info|mysql_get_server_info|mysql_info|mysql_insert_id|mysql_list_dbs|mysql_list_fields|mysql_list_processes|mysql_list_tables|mysql_num_fields|mysql_num_rows|mysql_pconnect|mysql_ping|mysql_query|mysql_real_escape_string|mysql_result|mysql_select_db|mysql_stat|mysql_tablename|mysql_thread_id|mysql_unbuffered_query|mysqli_affected_rows|mysqli_autocommit|mysqli_bind_param|mysqli_bind_result|mysqli_change_user|mysqli_character_set_name|mysqli_client_encoding|mysqli_close|mysqli_commit|mysqli_connect|mysqli_connect_errno|mysqli_connect_error|mysqli_data_seek|mysqli_debug|mysqli_disable_reads_from_master|mysqli_disable_rpl_parse|mysqli_dump_debug_info|mysqli_embedded_connect|mysqli_enable_reads_from_master|mysqli_enable_rpl_parse|mysqli_errno|mysqli_error|mysqli_escape_string|mysqli_execute|mysqli_fetch|mysqli_fetch_array|mysqli_fetch_assoc|mysqli_fetch_field|mysqli_fetch_field_direct|mysqli_fetch_fields|mysqli_fetch_lengths|mysqli_fetch_object|mysqli_fetch_row|mysqli_field_count|mysqli_field_seek|mysqli_field_tell|mysqli_free_result|mysqli_get_client_info|mysqli_get_client_version|mysqli_get_host_info|mysqli_get_metadata|mysqli_get_proto_info|mysqli_get_server_info|mysqli_get_server_version|mysqli_info|mysqli_init|mysqli_insert_id|mysqli_kill|mysqli_master_query|mysqli_more_results|mysqli_multi_query|mysqli_next_result|mysqli_num_fields|mysqli_num_rows|mysqli_options|mysqli_param_count|mysqli_ping|mysqli_prepare|mysqli_query|mysqli_real_connect|mysqli_real_escape_string|mysqli_real_query|mysqli_report|mysqli_rollback|mysqli_rpl_parse_enabled|mysqli_rpl_probe|mysqli_rpl_query_type|mysqli_select_db|mysqli_send_long_data|mysqli_send_query|mysqli_server_end|mysqli_server_init|mysqli_set_opt|mysqli_sqlstate|mysqli_ssl_set|mysqli_stat|mysqli_stmt_init|mysqli_stmt_affected_rows|mysqli_stmt_bind_param|mysqli_stmt_bind_result|mysqli_stmt_close|mysqli_stmt_data_seek|mysqli_stmt_errno|mysqli_stmt_error|mysqli_stmt_execute|mysqli_stmt_fetch|mysqli_stmt_free_result|mysqli_stmt_num_rows|mysqli_stmt_param_count|mysqli_stmt_prepare|mysqli_stmt_result_metadata|mysqli_stmt_send_long_data|mysqli_stmt_sqlstate|mysqli_stmt_store_result|mysqli_store_result|mysqli_thread_id|mysqli_thread_safe|mysqli_use_result|mysqli_warning_count|natcasesort|natsort|ncurses_addch|ncurses_addchnstr|ncurses_addchstr|ncurses_addnstr|ncurses_addstr|ncurses_assume_default_colors|ncurses_attroff|ncurses_attron|ncurses_attrset|ncurses_baudrate|ncurses_beep|ncurses_bkgd|ncurses_bkgdset|ncurses_border|ncurses_bottom_panel|ncurses_can_change_color|ncurses_cbreak|ncurses_clear|ncurses_clrtobot|ncurses_clrtoeol|ncurses_color_content|ncurses_color_set|ncurses_curs_set|ncurses_def_prog_mode|ncurses_def_shell_mode|ncurses_define_key|ncurses_del_panel|ncurses_delay_output|ncurses_delch|ncurses_deleteln|ncurses_delwin|ncurses_doupdate|ncurses_echo|ncurses_echochar|ncurses_end|ncurses_erase|ncurses_erasechar|ncurses_filter|ncurses_flash|ncurses_flushinp|ncurses_getch|ncurses_getmaxyx|ncurses_getmouse|ncurses_getyx|ncurses_halfdelay|ncurses_has_colors|ncurses_has_ic|ncurses_has_il|ncurses_has_key|ncurses_hide_panel|ncurses_hline|ncurses_inch|ncurses_init|ncurses_init_color|ncurses_init_pair|ncurses_insch|ncurses_insdelln|ncurses_insertln|ncurses_insstr|ncurses_instr|ncurses_isendwin|ncurses_keyok|ncurses_keypad|ncurses_killchar|ncurses_longname|ncurses_meta|ncurses_mouse_trafo|ncurses_mouseinterval|ncurses_mousemask|ncurses_move|ncurses_move_panel|ncurses_mvaddch|ncurses_mvaddchnstr|ncurses_mvaddchstr|ncurses_mvaddnstr|ncurses_mvaddstr|ncurses_mvcur|ncurses_mvdelch|ncurses_mvgetch|ncurses_mvhline|ncurses_mvinch|ncurses_mvvline|ncurses_mvwaddstr|ncurses_napms|ncurses_new_panel|ncurses_newpad|ncurses_newwin|ncurses_nl|ncurses_nocbreak|ncurses_noecho|ncurses_nonl|ncurses_noqiflush|ncurses_noraw|ncurses_pair_content|ncurses_panel_above|ncurses_panel_below|ncurses_panel_window|ncurses_pnoutrefresh|ncurses_prefresh|ncurses_putp|ncurses_qiflush|ncurses_raw|ncurses_refresh|ncurses_replace_panel|ncurses_reset_prog_mode|ncurses_reset_shell_mode|ncurses_resetty|ncurses_savetty|ncurses_scr_dump|ncurses_scr_init|ncurses_scr_restore|ncurses_scr_set|ncurses_scrl|ncurses_show_panel|ncurses_slk_attr|ncurses_slk_attroff|ncurses_slk_attron|ncurses_slk_attrset|ncurses_slk_clear|ncurses_slk_color|ncurses_slk_init|ncurses_slk_noutrefresh|ncurses_slk_refresh|ncurses_slk_restore|ncurses_slk_set|ncurses_slk_touch|ncurses_standend|ncurses_standout|ncurses_start_color|ncurses_termattrs|ncurses_termname|ncurses_timeout|ncurses_top_panel|ncurses_typeahead|ncurses_ungetch|ncurses_ungetmouse|ncurses_update_panels|ncurses_use_default_colors|ncurses_use_env|ncurses_use_extended_names|ncurses_vidattr|ncurses_vline|ncurses_waddch|ncurses_waddstr|ncurses_wattroff|ncurses_wattron|ncurses_wattrset|ncurses_wborder|ncurses_wclear|ncurses_wcolor_set|ncurses_werase|ncurses_wgetch|ncurses_whline|ncurses_wmouse_trafo|ncurses_wmove|ncurses_wnoutrefresh|ncurses_wrefresh|ncurses_wstandend|ncurses_wstandout|ncurses_wvline|next|ngettext|nl2br|nl_langinfo|notes_body|notes_copy_db|notes_create_db|notes_create_note|notes_drop_db|notes_find_note|notes_header_info|notes_list_msgs|notes_mark_read|notes_mark_unread|notes_nav_create|notes_search|notes_unread|notes_version|nsapi_request_headers|nsapi_response_headers|nsapi_virtual|number_format|ob_clean|ob_end_clean|ob_end_flush|ob_flush|ob_get_clean|ob_get_contents|ob_get_flush|ob_get_length|ob_get_level|ob_get_status|ob_gzhandler|ob_iconv_handler|ob_implicit_flush|ob_list_handlers|ob_start|ob_tidyhandler|oci_bind_by_name|oci_cancel|oci_close|oci_commit|oci_connect|oci_define_by_name|oci_error|oci_execute|oci_fetch|oci_fetch_all|oci_fetch_array|oci_fetch_assoc|oci_fetch_object|oci_fetch_row|oci_field_is_null|oci_field_name|oci_field_precision|oci_field_scale|oci_field_size|oci_field_type|oci_field_type_raw|oci_free_statement|oci_internal_debug|oci_lob_copy|oci_lob_is_equal|oci_new_collection|oci_new_connect|oci_new_cursor|oci_new_descriptor|oci_num_fields|oci_num_rows|oci_parse|oci_password_change|oci_pconnect|oci_result|oci_rollback|oci_server_version|oci_set_prefetch|oci_statement_type|ocibindbyname|ocicancel|ocicloselob|ocicollappend|ocicollassign|ocicollassignelem|ocicollgetelem|ocicollmax|ocicollsize|ocicolltrim|ocicolumnisnull|ocicolumnname|ocicolumnprecision|ocicolumnscale|ocicolumnsize|ocicolumntype|ocicolumntyperaw|ocicommit|ocidefinebyname|ocierror|ociexecute|ocifetch|ocifetchinto|ocifetchstatement|ocifreecollection|ocifreecursor|ocifreedesc|ocifreestatement|ociinternaldebug|ociloadlob|ocilogoff|ocilogon|ocinewcollection|ocinewcursor|ocinewdescriptor|ocinlogon|ocinumcols|ociparse|ociplogon|ociresult|ocirollback|ocirowcount|ocisavelob|ocisavelobfile|ociserverversion|ocisetprefetch|ocistatementtype|ociwritelobtofile|ociwritetemporarylob|octdec|odbc_autocommit|odbc_binmode|odbc_close|odbc_close_all|odbc_columnprivileges|odbc_columns|odbc_commit|odbc_connect|odbc_cursor|odbc_data_source|odbc_do|odbc_error|odbc_errormsg|odbc_exec|odbc_execute|odbc_fetch_array|odbc_fetch_into|odbc_fetch_object|odbc_fetch_row|odbc_field_len|odbc_field_name|odbc_field_num|odbc_field_precision|odbc_field_scale|odbc_field_type|odbc_foreignkeys|odbc_free_result|odbc_gettypeinfo|odbc_longreadlen|odbc_next_result|odbc_num_fields|odbc_num_rows|odbc_pconnect|odbc_prepare|odbc_primarykeys|odbc_procedurecolumns|odbc_procedures|odbc_result|odbc_result_all|odbc_rollback|odbc_setoption|odbc_specialcolumns|odbc_statistics|odbc_tableprivileges|odbc_tables|opendir|openlog|openssl_csr_export|openssl_csr_export_to_file|openssl_csr_new|openssl_csr_sign|openssl_error_string|openssl_free_key|openssl_get_privatekey|openssl_get_publickey|openssl_open|openssl_pkcs7_decrypt|openssl_pkcs7_encrypt|openssl_pkcs7_sign|openssl_pkcs7_verify|openssl_pkey_export|openssl_pkey_export_to_file|openssl_pkey_get_private|openssl_pkey_get_public|openssl_pkey_new|openssl_private_decrypt|openssl_private_encrypt|openssl_public_decrypt|openssl_public_encrypt|openssl_seal|openssl_sign|openssl_verify|openssl_x509_check_private_key|openssl_x509_checkpurpose|openssl_x509_export|openssl_x509_export_to_file|openssl_x509_free|openssl_x509_parse|openssl_x509_read|ora_bind|ora_close|ora_columnname|ora_columnsize|ora_columntype|ora_commit|ora_commitoff|ora_commiton|ora_do|ora_error|ora_errorcode|ora_exec|ora_fetch|ora_fetch_into|ora_getcolumn|ora_logoff|ora_logon|ora_numcols|ora_numrows|ora_open|ora_parse|ora_plogon|ora_rollback|ord|output_add_rewrite_var|output_reset_rewrite_vars|overload|ovrimos_close|ovrimos_commit|ovrimos_connect|ovrimos_cursor|ovrimos_exec|ovrimos_execute|ovrimos_fetch_into|ovrimos_fetch_row|ovrimos_field_len|ovrimos_field_name|ovrimos_field_num|ovrimos_field_type|ovrimos_free_result|ovrimos_longreadlen|ovrimos_num_fields|ovrimos_num_rows|ovrimos_prepare|ovrimos_result|ovrimos_result_all|ovrimos_rollback|pack|parse_ini_file|parse_str|parse_url|passthru|pathinfo|pclose|pcntl_alarm|pcntl_exec|pcntl_fork|pcntl_getpriority|pcntl_setpriority|pcntl_signal|pcntl_wait|pcntl_waitpid|pcntl_wexitstatus|pcntl_wifexited|pcntl_wifsignaled|pcntl_wifstopped|pcntl_wstopsig|pcntl_wtermsig|pdf_add_annotation|pdf_add_bookmark|pdf_add_launchlink|pdf_add_locallink|pdf_add_note|pdf_add_outline|pdf_add_pdflink|pdf_add_thumbnail|pdf_add_weblink|pdf_arc|pdf_arcn|pdf_attach_file|pdf_begin_page|pdf_begin_pattern|pdf_begin_template|pdf_circle|pdf_clip|pdf_close|pdf_close_image|pdf_close_pdi|pdf_close_pdi_page|pdf_closepath|pdf_closepath_fill_stroke|pdf_closepath_stroke|pdf_concat|pdf_continue_text|pdf_curveto|pdf_delete|pdf_end_page|pdf_end_pattern|pdf_end_template|pdf_endpath|pdf_fill|pdf_fill_stroke|pdf_findfont|pdf_get_buffer|pdf_get_font|pdf_get_fontname|pdf_get_fontsize|pdf_get_image_height|pdf_get_image_width|pdf_get_majorversion|pdf_get_minorversion|pdf_get_parameter|pdf_get_pdi_parameter|pdf_get_pdi_value|pdf_get_value|pdf_initgraphics|pdf_lineto|pdf_makespotcolor|pdf_moveto|pdf_new|pdf_open|pdf_open_ccitt|pdf_open_file|pdf_open_gif|pdf_open_image|pdf_open_image_file|pdf_open_jpeg|pdf_open_memory_image|pdf_open_pdi|pdf_open_pdi_page|pdf_open_png|pdf_open_tiff|pdf_place_image|pdf_place_pdi_page|pdf_rect|pdf_restore|pdf_rotate|pdf_save|pdf_scale|pdf_set_border_color|pdf_set_border_dash|pdf_set_border_style|pdf_set_char_spacing|pdf_set_duration|pdf_set_font|pdf_set_horiz_scaling|pdf_set_info|pdf_set_info_author|pdf_set_info_creator|pdf_set_info_keywords|pdf_set_info_subject|pdf_set_info_title|pdf_set_leading|pdf_set_parameter|pdf_set_text_matrix|pdf_set_text_pos|pdf_set_text_rendering|pdf_set_text_rise|pdf_set_value|pdf_set_word_spacing|pdf_setcolor|pdf_setdash|pdf_setflat|pdf_setfont|pdf_setgray|pdf_setgray_fill|pdf_setgray_stroke|pdf_setlinecap|pdf_setlinejoin|pdf_setlinewidth|pdf_setmatrix|pdf_setmiterlimit|pdf_setpolydash|pdf_setrgbcolor|pdf_setrgbcolor_fill|pdf_setrgbcolor_stroke|pdf_show|pdf_show_boxed|pdf_show_xy|pdf_skew|pdf_stringwidth|pdf_stroke|pdf_translate|pfpro_cleanup|pfpro_init|pfpro_process|pfpro_process_raw|pfpro_version|pfsockopen|pg_affected_rows|pg_cancel_query|pg_client_encoding|pg_close|pg_connect|pg_connection_busy|pg_connection_reset|pg_connection_status|pg_convert|pg_copy_from|pg_copy_to|pg_dbname|pg_delete|pg_end_copy|pg_escape_bytea|pg_escape_string|pg_fetch_all|pg_fetch_array|pg_fetch_assoc|pg_fetch_object|pg_fetch_result|pg_fetch_row|pg_field_is_null|pg_field_name|pg_field_num|pg_field_prtlen|pg_field_size|pg_field_type|pg_free_result|pg_get_notify|pg_get_pid|pg_get_result|pg_host|pg_insert|pg_last_error|pg_last_notice|pg_last_oid|pg_lo_close|pg_lo_create|pg_lo_export|pg_lo_import|pg_lo_open|pg_lo_read|pg_lo_read_all|pg_lo_seek|pg_lo_tell|pg_lo_unlink|pg_lo_write|pg_meta_data|pg_num_fields|pg_num_rows|pg_options|pg_pconnect|pg_ping|pg_port|pg_put_line|pg_query|pg_result_error|pg_result_seek|pg_result_status|pg_select|pg_send_query|pg_set_client_encoding|pg_trace|pg_tty|pg_unescape_bytea|pg_untrace|pg_update|php_ini_scanned_files|php_logo_guid|php_sapi_name|php_uname|phpcredits|phpinfo|phpversion|pi|png2wbmp|popen|pos|posix_ctermid|posix_get_last_error|posix_getcwd|posix_getegid|posix_geteuid|posix_getgid|posix_getgrgid|posix_getgrnam|posix_getgroups|posix_getlogin|posix_getpgid|posix_getpgrp|posix_getpid|posix_getppid|posix_getpwnam|posix_getpwuid|posix_getrlimit|posix_getsid|posix_getuid|posix_isatty|posix_kill|posix_mkfifo|posix_setegid|posix_seteuid|posix_setgid|posix_setpgid|posix_setsid|posix_setuid|posix_strerror|posix_times|posix_ttyname|posix_uname|pow|preg_grep|preg_match|preg_match_all|preg_quote|preg_replace|preg_replace_callback|preg_split|prev|print|print_r|printer_abort|printer_close|printer_create_brush|printer_create_dc|printer_create_font|printer_create_pen|printer_delete_brush|printer_delete_dc|printer_delete_font|printer_delete_pen|printer_draw_bmp|printer_draw_chord|printer_draw_elipse|printer_draw_line|printer_draw_pie|printer_draw_rectangle|printer_draw_roundrect|printer_draw_text|printer_end_doc|printer_end_page|printer_get_option|printer_list|printer_logical_fontheight|printer_open|printer_select_brush|printer_select_font|printer_select_pen|printer_set_option|printer_start_doc|printer_start_page|printer_write|printf|proc_close|proc_get_status|proc_nice|proc_open|proc_terminate|pspell_add_to_personal|pspell_add_to_session|pspell_check|pspell_clear_session|pspell_config_create|pspell_config_ignore|pspell_config_mode|pspell_config_personal|pspell_config_repl|pspell_config_runtogether|pspell_config_save_repl|pspell_new|pspell_new_config|pspell_new_personal|pspell_save_wordlist|pspell_store_replacement|pspell_suggest|putenv|qdom_error|qdom_tree|quoted_printable_decode|quotemeta|rad2deg|rand|range|rawurldecode|rawurlencode|read_exif_data|readdir|readfile|readgzfile|readline|readline_add_history|readline_clear_history|readline_completion_function|readline_info|readline_list_history|readline_read_history|readline_write_history|readlink|realpath|recode|recode_file|recode_string|register_shutdown_function|register_tick_function|rename|reset|restore_error_handler|restore_include_path|rewind|rewinddir|rmdir|round|rsort|rtrim|scandir|sem_acquire|sem_get|sem_release|sem_remove|serialize|sesam_affected_rows|sesam_commit|sesam_connect|sesam_diagnostic|sesam_disconnect|sesam_errormsg|sesam_execimm|sesam_fetch_array|sesam_fetch_result|sesam_fetch_row|sesam_field_array|sesam_field_name|sesam_free_result|sesam_num_fields|sesam_query|sesam_rollback|sesam_seek_row|sesam_settransaction|session_cache_expire|session_cache_limiter|session_commit|session_decode|session_destroy|session_encode|session_get_cookie_params|session_id|session_is_registered|session_module_name|session_name|session_regenerate_id|session_register|session_save_path|session_set_cookie_params|session_set_save_handler|session_start|session_unregister|session_unset|session_write_close|set_error_handler|set_file_buffer|set_include_path|set_magic_quotes_runtime|set_time_limit|setcookie|setlocale|setrawcookie|settype|sha1|sha1_file|shell_exec|shm_attach|shm_detach|shm_get_var|shm_put_var|shm_remove|shm_remove_var|shmop_close|shmop_delete|shmop_open|shmop_read|shmop_size|shmop_write|show_source|shuffle|similar_text|simplexml_import_dom|simplexml_load_file|simplexml_load_string|sin|sinh|sizeof|sleep|snmp_get_quick_print|snmp_set_quick_print|snmpget|snmprealwalk|snmpset|snmpwalk|snmpwalkoid|socket_accept|socket_bind|socket_clear_error|socket_close|socket_connect|socket_create|socket_create_listen|socket_create_pair|socket_get_option|socket_get_status|socket_getpeername|socket_getsockname|socket_iovec_add|socket_iovec_alloc|socket_iovec_delete|socket_iovec_fetch|socket_iovec_free|socket_iovec_set|socket_last_error|socket_listen|socket_read|socket_readv|socket_recv|socket_recvfrom|socket_recvmsg|socket_select|socket_send|socket_sendmsg|socket_sendto|socket_set_block|socket_set_blocking|socket_set_nonblock|socket_set_option|socket_set_timeout|socket_shutdown|socket_strerror|socket_write|socket_writev|sort|soundex|split|spliti|sprintf|sql_regcase|sqlite_array_query|sqlite_busy_timeout|sqlite_changes|sqlite_close|sqlite_column|sqlite_create_aggregate|sqlite_create_function|sqlite_current|sqlite_error_string|sqlite_escape_string|sqlite_fetch_array|sqlite_fetch_single|sqlite_fetch_string|sqlite_field_name|sqlite_has_more|sqlite_last_error|sqlite_last_insert_rowid|sqlite_libencoding|sqlite_libversion|sqlite_next|sqlite_num_fields|sqlite_num_rows|sqlite_open|sqlite_popen|sqlite_query|sqlite_rewind|sqlite_seek|sqlite_udf_decode_binary|sqlite_udf_encode_binary|sqlite_unbuffered_query|sqrt|srand|sscanf|stat|str_ireplace|str_pad|str_repeat|str_replace|str_rot13|str_shuffle|str_split|str_word_count|strcasecmp|strchr|strcmp|strcoll|strcspn|stream_context_create|stream_context_get_options|stream_context_set_option|stream_context_set_params|stream_copy_to_stream|stream_filter_append|stream_filter_prepend|stream_filter_register|stream_get_contents|stream_get_filters|stream_get_line|stream_get_meta_data|stream_get_transports|stream_get_wrappers|stream_register_wrapper|stream_select|stream_set_blocking|stream_set_timeout|stream_set_write_buffer|stream_socket_accept|stream_socket_client|stream_socket_get_name|stream_socket_recvfrom|stream_socket_sendto|stream_socket_server|stream_wrapper_register|strftime|strip_tags|stripcslashes|stripos|stripslashes|stristr|strlen|strnatcasecmp|strnatcmp|strncasecmp|strncmp|strpos|strrchr|strrev|strripos|strrpos|strspn|strstr|strtok|strtolower|strtotime|strtoupper|strtr|strval|substr|substr_compare|substr_count|substr_replace|swf_actiongeturl|swf_actiongotoframe|swf_actiongotolabel|swf_actionnextframe|swf_actionplay|swf_actionprevframe|swf_actionsettarget|swf_actionstop|swf_actiontogglequality|swf_actionwaitforframe|swf_addbuttonrecord|swf_addcolor|swf_closefile|swf_definebitmap|swf_definefont|swf_defineline|swf_definepoly|swf_definerect|swf_definetext|swf_endbutton|swf_enddoaction|swf_endshape|swf_endsymbol|swf_fontsize|swf_fontslant|swf_fonttracking|swf_getbitmapinfo|swf_getfontinfo|swf_getframe|swf_labelframe|swf_lookat|swf_modifyobject|swf_mulcolor|swf_nextid|swf_oncondition|swf_openfile|swf_ortho|swf_ortho2|swf_perspective|swf_placeobject|swf_polarview|swf_popmatrix|swf_posround|swf_pushmatrix|swf_removeobject|swf_rotate|swf_scale|swf_setfont|swf_setframe|swf_shapearc|swf_shapecurveto|swf_shapecurveto3|swf_shapefillbitmapclip|swf_shapefillbitmaptile|swf_shapefilloff|swf_shapefillsolid|swf_shapelinesolid|swf_shapelineto|swf_shapemoveto|swf_showframe|swf_startbutton|swf_startdoaction|swf_startshape|swf_startsymbol|swf_textwidth|swf_translate|swf_viewport|swfaction|swfbitmap|swfbutton|swfbutton_keypress|swfdisplayitem|swffill|swffont|swfgradient|swfmorph|swfmovie|swfshape|swfsprite|swftext|swftextfield|sybase_affected_rows|sybase_close|sybase_connect|sybase_data_seek|sybase_deadlock_retry_count|sybase_fetch_array|sybase_fetch_assoc|sybase_fetch_field|sybase_fetch_object|sybase_fetch_row|sybase_field_seek|sybase_free_result|sybase_get_last_message|sybase_min_client_severity|sybase_min_error_severity|sybase_min_message_severity|sybase_min_server_severity|sybase_num_fields|sybase_num_rows|sybase_pconnect|sybase_query|sybase_result|sybase_select_db|sybase_set_message_handler|sybase_unbuffered_query|symlink|syslog|system|tan|tanh|tcpwrap_check|tempnam|textdomain|tidy_access_count|tidy_clean_repair|tidy_config_count|tidy_diagnose|tidy_error_count|tidy_get_body|tidy_get_config|tidy_get_error_buffer|tidy_get_head|tidy_get_html|tidy_get_html_ver|tidy_get_output|tidy_get_release|tidy_get_root|tidy_get_status|tidy_getopt|tidy_is_xhtml|tidy_is_xml|tidy_load_config|tidy_parse_file|tidy_parse_string|tidy_repair_file|tidy_repair_string|tidy_reset_config|tidy_save_config|tidy_set_encoding|tidy_setopt|tidy_warning_count|time|tmpfile|token_get_all|token_name|touch|trigger_error|trim|uasort|ucfirst|ucwords|udm_add_search_limit|udm_alloc_agent|udm_alloc_agent_array|udm_api_version|udm_cat_list|udm_cat_path|udm_check_charset|udm_check_stored|udm_clear_search_limits|udm_close_stored|udm_crc32|udm_errno|udm_error|udm_find|udm_free_agent|udm_free_ispell_data|udm_free_res|udm_get_doc_count|udm_get_res_field|udm_get_res_param|udm_hash32|udm_load_ispell_data|udm_open_stored|udm_set_agent_param|uksort|umask|uniqid|unixtojd|unlink|unpack|unregister_tick_function|unserialize|unset|urldecode|urlencode|user_error|usleep|usort|utf8_decode|utf8_encode|var_dump|var_export|variant|version_compare|virtual|vpopmail_add_alias_domain|vpopmail_add_alias_domain_ex|vpopmail_add_domain|vpopmail_add_domain_ex|vpopmail_add_user|vpopmail_alias_add|vpopmail_alias_del|vpopmail_alias_del_domain|vpopmail_alias_get|vpopmail_alias_get_all|vpopmail_auth_user|vpopmail_del_domain|vpopmail_del_domain_ex|vpopmail_del_user|vpopmail_error|vpopmail_passwd|vpopmail_set_user_quota|vprintf|vsprintf|w32api_deftype|w32api_init_dtype|w32api_invoke_function|w32api_register_function|w32api_set_call_method|wddx_add_vars|wddx_deserialize|wddx_packet_end|wddx_packet_start|wddx_serialize_value|wddx_serialize_vars|wordwrap|xdiff_file_diff|xdiff_file_diff_binary|xdiff_file_merge3|xdiff_file_patch|xdiff_file_patch_binary|xdiff_string_diff|xdiff_string_diff_binary|xdiff_string_merge3|xdiff_string_patch|xdiff_string_patch_binary|xml_error_string|xml_get_current_byte_index|xml_get_current_column_number|xml_get_current_line_number|xml_get_error_code|xml_parse|xml_parse_into_struct|xml_parser_create|xml_parser_create_ns|xml_parser_free|xml_parser_get_option|xml_parser_set_option|xml_set_character_data_handler|xml_set_default_handler|xml_set_element_handler|xml_set_end_namespace_decl_handler|xml_set_external_entity_ref_handler|xml_set_notation_decl_handler|xml_set_object|xml_set_processing_instruction_handler|xml_set_start_namespace_decl_handler|xml_set_unparsed_entity_decl_handler|xmlrpc_decode|xmlrpc_decode_request|xmlrpc_encode|xmlrpc_encode_request|xmlrpc_get_type|xmlrpc_parse_method_descriptions|xmlrpc_server_add_introspection_data|xmlrpc_server_call_method|xmlrpc_server_create|xmlrpc_server_destroy|xmlrpc_server_register_introspection_callback|xmlrpc_server_register_method|xmlrpc_set_type|xpath_eval|xpath_eval_expression|xpath_new_context|xptr_eval|xptr_new_context|xsl_xsltprocessor_get_parameter|xsl_xsltprocessor_has_exslt_support|xsl_xsltprocessor_import_stylesheet|xsl_xsltprocessor_register_php_functions|xsl_xsltprocessor_remove_parameter|xsl_xsltprocessor_set_parameter|xsl_xsltprocessor_transform_to_doc|xsl_xsltprocessor_transform_to_uri|xsl_xsltprocessor_transform_to_xml|xslt_create|xslt_errno|xslt_error|xslt_free|xslt_process|xslt_set_base|xslt_set_encoding|xslt_set_error_handler|xslt_set_log|xslt_set_sax_handler|xslt_set_sax_handlers|xslt_set_scheme_handler|xslt_set_scheme_handlers|yaz_addinfo|yaz_ccl_conf|yaz_ccl_parse|yaz_close|yaz_connect|yaz_database|yaz_element|yaz_errno|yaz_error|yaz_es_result|yaz_get_option|yaz_hits|yaz_itemorder|yaz_present|yaz_range|yaz_record|yaz_scan|yaz_scan_result|yaz_schema|yaz_search|yaz_set_option|yaz_sort|yaz_syntax|yaz_wait|yp_all|yp_cat|yp_err_string|yp_errno|yp_first|yp_get_default_domain|yp_master|yp_match|yp_next|yp_order|zend_logo_guid|zend_version|zip_close|zip_entry_close|zip_entry_compressedsize|zip_entry_compressionmethod|zip_entry_filesize|zip_entry_name|zip_entry_open|zip_entry_read|zip_open|zip_read|zlib_get_coding_type".split("|")),c=e.arrayToMap("abstract|and|array|as|break|case|catch|cfunction|class|clone|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|final|for|foreach|function|include|include_once|global|goto|if|implements|interface|instanceof|namespace|new|old_function|or|private|protected|public|return|require|require_once|static|switch|throw|try|use|var|while|xor".split("|")),d=e.arrayToMap("true|false|null|__FILE__|__LINE__|__METHOD__|__FUNCTION__|__CLASS__".split("|")),g=e.arrayToMap("$GLOBALS|$_SERVER|$_GET|$_POST|$_FILES|$_REQUEST|$_SESSION|$_ENV|$_COOKIE|$php_errormsg|$HTTP_RAW_POST_DATA|$http_response_header|$argc|$argv".split("|")),h=e.arrayToMap([]);this.$rules={start:[{token:"support",regex:"<\\?(?:php|\\=)"},{token:"support",regex:"\\?>"},{token:"comment",regex:"\\/\\/.*$"},{token:"comment",regex:"#.*$"},a.getStartRule("doc-start"),{token:"comment",regex:"\\/\\*",next:"comment"},{token:"string.regexp",regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/][gimy]*\\s*(?=[).,;]|$)"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:'["].*\\\\$',next:"qqstring"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"string",regex:"['].*\\\\$",next:"qstring"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language",regex:"\\b(?:DEFAULT_INCLUDE_PATH|E_(?:ALL|CO(?:MPILE_(?:ERROR|WARNING)|RE_(?:ERROR|WARNING))|ERROR|NOTICE|PARSE|STRICT|USER_(?:ERROR|NOTICE|WARNING)|WARNING)|P(?:EAR_(?:EXTENSION_DIR|INSTALL_DIR)|HP_(?:BINDIR|CONFIG_FILE_(?:PATH|SCAN_DIR)|DATADIR|E(?:OL|XTENSION_DIR)|INT_(?:MAX|SIZE)|L(?:IBDIR|OCALSTATEDIR)|O(?:S|UTPUT_HANDLER_(?:CONT|END|START))|PREFIX|S(?:API|HLIB_SUFFIX|YSCONFDIR)|VERSION))|__COMPILER_HALT_OFFSET__)\\b"},{token:"constant.language",regex:"\\b(?:A(?:B(?:DAY_(?:1|2|3|4|5|6|7)|MON_(?:1(?:0|1|2|)|2|3|4|5|6|7|8|9))|LT_DIGITS|M_STR|SSERT_(?:ACTIVE|BAIL|CALLBACK|QUIET_EVAL|WARNING))|C(?:ASE_(?:LOWER|UPPER)|HAR_MAX|O(?:DESET|NNECTION_(?:ABORTED|NORMAL|TIMEOUT)|UNT_(?:NORMAL|RECURSIVE))|R(?:EDITS_(?:ALL|DOCS|FULLPAGE|G(?:ENERAL|ROUP)|MODULES|QA|SAPI)|NCYSTR|YPT_(?:BLOWFISH|EXT_DES|MD5|S(?:ALT_LENGTH|TD_DES)))|URRENCY_SYMBOL)|D(?:AY_(?:1|2|3|4|5|6|7)|ECIMAL_POINT|IRECTORY_SEPARATOR|_(?:FMT|T_FMT))|E(?:NT_(?:COMPAT|NOQUOTES|QUOTES)|RA(?:_(?:D_(?:FMT|T_FMT)|T_FMT|YEAR)|)|XTR_(?:IF_EXISTS|OVERWRITE|PREFIX_(?:ALL|I(?:F_EXISTS|NVALID)|SAME)|SKIP))|FRAC_DIGITS|GROUPING|HTML_(?:ENTITIES|SPECIALCHARS)|IN(?:FO_(?:ALL|C(?:ONFIGURATION|REDITS)|ENVIRONMENT|GENERAL|LICENSE|MODULES|VARIABLES)|I_(?:ALL|PERDIR|SYSTEM|USER)|T_(?:CURR_SYMBOL|FRAC_DIGITS))|L(?:C_(?:ALL|C(?:OLLATE|TYPE)|M(?:ESSAGES|ONETARY)|NUMERIC|TIME)|O(?:CK_(?:EX|NB|SH|UN)|G_(?:A(?:LERT|UTH(?:PRIV|))|C(?:ONS|R(?:IT|ON))|D(?:AEMON|EBUG)|E(?:MERG|RR)|INFO|KERN|L(?:OCAL(?:0|1|2|3|4|5|6|7)|PR)|MAIL|N(?:DELAY|EWS|O(?:TICE|WAIT))|ODELAY|P(?:ERROR|ID)|SYSLOG|U(?:SER|UCP)|WARNING)))|M(?:ON_(?:1(?:0|1|2|)|2|3|4|5|6|7|8|9|DECIMAL_POINT|GROUPING|THOUSANDS_SEP)|_(?:1_PI|2_(?:PI|SQRTPI)|E|L(?:N(?:10|2)|OG(?:10E|2E))|PI(?:_(?:2|4)|)|SQRT(?:1_2|2)))|N(?:EGATIVE_SIGN|O(?:EXPR|STR)|_(?:CS_PRECEDES|S(?:EP_BY_SPACE|IGN_POSN)))|P(?:ATH(?:INFO_(?:BASENAME|DIRNAME|EXTENSION)|_SEPARATOR)|M_STR|OSITIVE_SIGN|_(?:CS_PRECEDES|S(?:EP_BY_SPACE|IGN_POSN)))|RADIXCHAR|S(?:EEK_(?:CUR|END|SET)|ORT_(?:ASC|DESC|NUMERIC|REGULAR|STRING)|TR_PAD_(?:BOTH|LEFT|RIGHT))|T(?:HOUS(?:ANDS_SEP|EP)|_FMT(?:_AMPM|))|YES(?:EXPR|STR)|STD(?:IN|OUT|ERR))\\b"},{token:function(a){if(c.hasOwnProperty(a))return"keyword";if(d.hasOwnProperty(a))return"constant.language";if(g.hasOwnProperty(a))return"variable.language";if(h.hasOwnProperty(a))return"invalid.illegal";if(b.hasOwnProperty(a))return"support.function";if(a=="debugger")return"invalid.deprecated";if(a.match(/^(\$[a-zA-Z][a-zA-Z0-9_]*|self|parent)$/))return"variable";return"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",regex:".+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+"}]},this.addRules(a.getRules(),"doc-"),this.$rules["doc-start"][0].next="start"};d.inherits(h,g),b.PhpHighlightRules=h}),define("ace/mode/doc_comment_highlight_rules",["require","exports","module","pilot/oop","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"comment.doc",regex:"\\*\\/",next:"start"},{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},{token:"comment.doc",regex:"s+"},{token:"comment.doc",regex:"TODO"},{token:"comment.doc",regex:"[^@\\*]+"},{token:"comment.doc",regex:"."}]}};d.inherits(f,e),function(){this.getStartRule=function(a){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:a}}}.call(f.prototype),b.DocCommentHighlightRules=f}) \ No newline at end of file diff --git a/examples/lib/ace/mode-python.js b/examples/lib/ace/mode-python.js new file mode 100644 index 00000000..0c3edefa --- /dev/null +++ b/examples/lib/ace/mode-python.js @@ -0,0 +1 @@ +define("ace/mode/python",["require","exports","module","pilot/oop","ace/mode/text","ace/tokenizer","ace/mode/python_highlight_rules","ace/mode/matching_brace_outdent","ace/range"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/python_highlight_rules").PythonHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[\:]\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/python_highlight_rules",["require","exports","module","pilot/oop","pilot/lang","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield".split("|")),b=e.arrayToMap("True|False|None|NotImplemented|Ellipsis|__debug__".split("|")),c=e.arrayToMap("abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern".split("|")),d=e.arrayToMap("".split("|")),f="(?:r|u|ur|R|U|UR|Ur|uR)?",g="(?:(?:[1-9]\\d*)|(?:0))",h="(?:0[oO]?[0-7]+)",i="(?:0[xX][\\dA-Fa-f]+)",j="(?:0[bB][01]+)",k="(?:"+g+"|"+h+"|"+i+"|"+j+")",l="(?:[eE][+-]?\\d+)",m="(?:\\.\\d+)",n="(?:\\d+)",o="(?:(?:"+n+"?"+m+")|(?:"+n+"\\.))",p="(?:(?:"+o+"|"+n+")"+l+")",q="(?:"+p+"|"+o+")";this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string",regex:f+'"{3}(?:[^\\\\]|\\\\.)*?"{3}'},{token:"string",regex:f+'"{3}.*$',next:"qqstring"},{token:"string",regex:f+'"(?:[^\\\\]|\\\\.)*?"'},{token:"string",regex:f+"'{3}(?:[^\\\\]|\\\\.)*?'{3}"},{token:"string",regex:f+"'{3}.*$",next:"qstring"},{token:"string",regex:f+"'(?:[^\\\\]|\\\\.)*?'"},{token:"constant.numeric",regex:"(?:"+q+"|\\d+)[jJ]\\b"},{token:"constant.numeric",regex:q},{token:"constant.numeric",regex:k+"[lL]\\b"},{token:"constant.numeric",regex:k+"\\b"},{token:function(e){return a.hasOwnProperty(e)?"keyword":b.hasOwnProperty(e)?"constant.language":d.hasOwnProperty(e)?"invalid.illegal":c.hasOwnProperty(e)?"support.function":e=="debugger"?"invalid.deprecated":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"lparen",regex:"[\\[\\(\\{]"},{token:"rparen",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:'(?:[^\\\\]|\\\\.)*?"{3}',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:[^\\\\]|\\\\.)*?'{3}",next:"start"},{token:"string",regex:".+"}]}};d.inherits(g,f),b.PythonHighlightRules=g}) \ No newline at end of file diff --git a/examples/lib/ace/mode-ruby.js b/examples/lib/ace/mode-ruby.js new file mode 100644 index 00000000..d4b77f6d --- /dev/null +++ b/examples/lib/ace/mode-ruby.js @@ -0,0 +1 @@ +define("ace/mode/ruby",["require","exports","module","pilot/oop","ace/mode/text","ace/tokenizer","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/ruby_highlight_rules").RubyHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/ruby_highlight_rules",["require","exports","module","pilot/oop","pilot/lang","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("abort|Array|at_exit|autoload|binding|block_given?|callcc|caller|catch|chomp|chomp!|chop|chop!|eval|exec|exit|exit!fail|Float|fork|format|gets|global_variables|gsub|gsub!|Integer|lambda|load|local_variables|loop|open|p|print|printf|proc|putc|puts|raise|rand|readline|readlines|require|scan|select|set_trace_func|sleep|split|sprintf|srand|String|syscall|system|sub|sub!|test|throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan".split("|")),b=e.arrayToMap("alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|__FILE__|finally|for|if|in|__LINE__|module|next|not|or|redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield".split("|")),c=e.arrayToMap("true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING".split("|")),d=e.arrayToMap("$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE".split("|"));this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"comment",regex:"^=begin$",next:"comment"},{token:"string.regexp",regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:function(e){return e=="self"?"variable.language":b.hasOwnProperty(e)?"keyword":c.hasOwnProperty(e)?"constant.language":d.hasOwnProperty(e)?"variable.language":a.hasOwnProperty(e)?"support.function":e=="debugger"?"invalid.deprecated":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:"^=end$",next:"start"},{token:"comment",regex:".+"}]}};d.inherits(g,f),b.RubyHighlightRules=g}) \ No newline at end of file diff --git a/examples/lib/ace/mode-svg.js b/examples/lib/ace/mode-svg.js new file mode 100644 index 00000000..26f395b3 --- /dev/null +++ b/examples/lib/ace/mode-svg.js @@ -0,0 +1 @@ +define("ace/mode/svg",["require","exports","module","pilot/oop","ace/mode/text","ace/mode/javascript","ace/tokenizer","ace/mode/svg_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/mode/javascript").Mode,g=a("ace/tokenizer").Tokenizer,h=a("ace/mode/svg_highlight_rules").SvgHighlightRules,i=function(){this.$tokenizer=new g((new h).getRules()),this.$js=new f};d.inherits(i,e),function(){this.toggleCommentLines=function(a,b,c,d){this.$delegate("toggleCommentLines",arguments,function(){return 0})},this.getNextLineIndent=function(a,b,c){var d=this;return this.$delegate("getNextLineIndent",arguments,function(){return d.$getIndent(b)})},this.checkOutdent=function(a,b,c){return this.$delegate("checkOutdent",arguments,function(){return!1})},this.autoOutdent=function(a,b,c){this.$delegate("autoOutdent",arguments)},this.$delegate=function(a,b,c){var d=b[0],e=d.split("js-");if(!e[0]&&e[1]){b[0]=e[1];return this.$js[a].apply(this.$js,b)}return c?c():undefined}}.call(i.prototype),b.Mode=i}),define("ace/mode/javascript",["require","exports","module","pilot/oop","ace/mode/text","ace/tokenizer","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/worker/worker_client"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=a("ace/worker/worker_client").WorkerClient,k=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(k,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)\/\//;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"//")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}else if(a=="doc-start"){if(g=="start")return"";var h=b.match(/^\s*(\/?)\*/);h&&(h[1]&&(d+=" "),d+="* ")}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)},this.createWorker=function(a){var b=a.getDocument(),c=new j(["ace","pilot"],"worker-javascript.js","ace/mode/javascript_worker","JavaScriptWorker");c.call("setValue",[b.getValue()]),b.on("change",function(a){a.range={start:a.data.range.start,end:a.data.range.end},c.emit("change",a)}),c.on("jslint",function(b){var c=[];for(var d=0;d=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"comment",regex:"^#!.*$"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",regex:".+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+"}]},this.addRules(a.getRules(),"doc-"),this.$rules["doc-start"][0].next="start"};d.inherits(h,g),b.JavaScriptHighlightRules=h}),define("ace/mode/doc_comment_highlight_rules",["require","exports","module","pilot/oop","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"comment.doc",regex:"\\*\\/",next:"start"},{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},{token:"comment.doc",regex:"s+"},{token:"comment.doc",regex:"TODO"},{token:"comment.doc",regex:"[^@\\*]+"},{token:"comment.doc",regex:"."}]}};d.inherits(f,e),function(){this.getStartRule=function(a){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:a}}}.call(f.prototype),b.DocCommentHighlightRules=f}),define("ace/worker/worker_client",["require","exports","module","pilot/oop","pilot/event_emitter"],function(a,b,c){var d=a("pilot/oop"),e=a("pilot/event_emitter").EventEmitter,f=function(b,c,d,e){this.callbacks=[];if(a.packaged)var f=this.$guessBasePath(),g=this.$worker=new Worker(f+c);else{var h=a.nameToUrl("ace/worker/worker",null,"_"),g=this.$worker=new Worker(h),i={};for(var j=0;j",next:"js-start"},{token:"keyword",regex:"[-_a-zA-Z0-9:]+"},{token:"text",regex:"\\s+"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"}];var a=(new e).getRules();this.addRules(a,"js-"),this.$rules["js-start"].unshift({token:"comment",regex:"\\/\\/.*(?=<\\/script>)",next:"tag"},{token:"text",regex:"<\\/(?=script)",next:"tag"})};d.inherits(g,f),b.SvgHighlightRules=g}),define("ace/mode/xml_highlight_rules",["require","exports","module","pilot/oop","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"text",regex:"<\\!\\[CDATA\\[",next:"cdata"},{token:"xml_pe",regex:"<\\?.*?\\?>"},{token:"comment",regex:"<\\!--",next:"comment"},{token:"text",regex:"<\\/?",next:"tag"},{token:"text",regex:"\\s+"},{token:"text",regex:"[^<]+"}],tag:[{token:"text",regex:">",next:"start"},{token:"keyword",regex:"[-_a-zA-Z0-9:]+"},{token:"text",regex:"\\s+"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"}],cdata:[{token:"text",regex:"\\]\\]>",next:"start"},{token:"text",regex:"\\s+"},{token:"text",regex:"(?:[^\\]]|\\](?!\\]>))+"}],comment:[{token:"comment",regex:".*?-->",next:"start"},{token:"comment",regex:".+"}]}};d.inherits(f,e),b.XmlHighlightRules=f}) \ No newline at end of file diff --git a/examples/lib/ace/mode-xml.js b/examples/lib/ace/mode-xml.js new file mode 100644 index 00000000..f2ee6a25 --- /dev/null +++ b/examples/lib/ace/mode-xml.js @@ -0,0 +1 @@ +define("ace/mode/xml",["require","exports","module","pilot/oop","ace/mode/text","ace/tokenizer","ace/mode/xml_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/xml_highlight_rules").XmlHighlightRules,h=function(){this.$tokenizer=new f((new g).getRules())};d.inherits(h,e),function(){this.getNextLineIndent=function(a,b,c){return this.$getIndent(b)}}.call(h.prototype),b.Mode=h}),define("ace/mode/xml_highlight_rules",["require","exports","module","pilot/oop","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"text",regex:"<\\!\\[CDATA\\[",next:"cdata"},{token:"xml_pe",regex:"<\\?.*?\\?>"},{token:"comment",regex:"<\\!--",next:"comment"},{token:"text",regex:"<\\/?",next:"tag"},{token:"text",regex:"\\s+"},{token:"text",regex:"[^<]+"}],tag:[{token:"text",regex:">",next:"start"},{token:"keyword",regex:"[-_a-zA-Z0-9:]+"},{token:"text",regex:"\\s+"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"}],cdata:[{token:"text",regex:"\\]\\]>",next:"start"},{token:"text",regex:"\\s+"},{token:"text",regex:"(?:[^\\]]|\\](?!\\]>))+"}],comment:[{token:"comment",regex:".*?-->",next:"start"},{token:"comment",regex:".+"}]}};d.inherits(f,e),b.XmlHighlightRules=f}) \ No newline at end of file diff --git a/examples/lib/ace/theme-clouds.js b/examples/lib/ace/theme-clouds.js new file mode 100644 index 00000000..c14d3cbc --- /dev/null +++ b/examples/lib/ace/theme-clouds.js @@ -0,0 +1 @@ +define("ace/theme/clouds",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-clouds .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-clouds .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-clouds .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-clouds .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-clouds .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-clouds .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-clouds .ace_scroller {\n background-color: #FFFFFF;\n}\n\n.ace-clouds .ace_text-layer {\n cursor: text;\n color: #000000;\n}\n\n.ace-clouds .ace_cursor {\n border-left: 2px solid #000000;\n}\n\n.ace-clouds .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #000000;\n}\n \n.ace-clouds .ace_marker-layer .ace_selection {\n background: #BDD5FC;\n}\n\n.ace-clouds .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-clouds .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #BFBFBF;\n}\n\n.ace-clouds .ace_marker-layer .ace_active_line {\n background: #FFFBD1;\n}\n\n \n.ace-clouds .ace_invisible {\n color: #BFBFBF;\n}\n\n.ace-clouds .ace_keyword {\n color:#AF956F;\n}\n\n.ace-clouds .ace_keyword.ace_operator {\n color:#484848;\n}\n\n.ace-clouds .ace_constant {\n \n}\n\n.ace-clouds .ace_constant.ace_language {\n color:#39946A;\n}\n\n.ace-clouds .ace_constant.ace_library {\n \n}\n\n.ace-clouds .ace_constant.ace_numeric {\n color:#46A609;\n}\n\n.ace-clouds .ace_invalid {\n background-color:#FF002A;\n}\n\n.ace-clouds .ace_invalid.ace_illegal {\n \n}\n\n.ace-clouds .ace_invalid.ace_deprecated {\n \n}\n\n.ace-clouds .ace_support {\n \n}\n\n.ace-clouds .ace_support.ace_function {\n color:#C52727;\n}\n\n.ace-clouds .ace_function.ace_buildin {\n \n}\n\n.ace-clouds .ace_string {\n color:#5D90CD;\n}\n\n.ace-clouds .ace_string.ace_regexp {\n \n}\n\n.ace-clouds .ace_comment {\n color:#BCC8BA;\n}\n\n.ace-clouds .ace_comment.ace_doc {\n \n}\n\n.ace-clouds .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-clouds .ace_variable {\n \n}\n\n.ace-clouds .ace_variable.ace_language {\n \n}\n\n.ace-clouds .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-clouds"}) \ No newline at end of file diff --git a/examples/lib/ace/theme-clouds_midnight.js b/examples/lib/ace/theme-clouds_midnight.js new file mode 100644 index 00000000..52137fb2 --- /dev/null +++ b/examples/lib/ace/theme-clouds_midnight.js @@ -0,0 +1 @@ +define("ace/theme/clouds_midnight",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-clouds-midnight .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-clouds-midnight .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-clouds-midnight .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-clouds-midnight .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-clouds-midnight .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-clouds-midnight .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-clouds-midnight .ace_scroller {\n background-color: #191919;\n}\n\n.ace-clouds-midnight .ace_text-layer {\n cursor: text;\n color: #929292;\n}\n\n.ace-clouds-midnight .ace_cursor {\n border-left: 2px solid #7DA5DC;\n}\n\n.ace-clouds-midnight .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #7DA5DC;\n}\n \n.ace-clouds-midnight .ace_marker-layer .ace_selection {\n background: #000000;\n}\n\n.ace-clouds-midnight .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-clouds-midnight .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #BFBFBF;\n}\n\n.ace-clouds-midnight .ace_marker-layer .ace_active_line {\n background: rgba(215, 215, 215, 0.031);\n}\n\n \n.ace-clouds-midnight .ace_invisible {\n color: #BFBFBF;\n}\n\n.ace-clouds-midnight .ace_keyword {\n color:#927C5D;\n}\n\n.ace-clouds-midnight .ace_keyword.ace_operator {\n color:#4B4B4B;\n}\n\n.ace-clouds-midnight .ace_constant {\n \n}\n\n.ace-clouds-midnight .ace_constant.ace_language {\n color:#39946A;\n}\n\n.ace-clouds-midnight .ace_constant.ace_library {\n \n}\n\n.ace-clouds-midnight .ace_constant.ace_numeric {\n color:#46A609;\n}\n\n.ace-clouds-midnight .ace_invalid {\n color:#FFFFFF;\nbackground-color:#E92E2E;\n}\n\n.ace-clouds-midnight .ace_invalid.ace_illegal {\n \n}\n\n.ace-clouds-midnight .ace_invalid.ace_deprecated {\n \n}\n\n.ace-clouds-midnight .ace_support {\n \n}\n\n.ace-clouds-midnight .ace_support.ace_function {\n color:#E92E2E;\n}\n\n.ace-clouds-midnight .ace_function.ace_buildin {\n \n}\n\n.ace-clouds-midnight .ace_string {\n color:#5D90CD;\n}\n\n.ace-clouds-midnight .ace_string.ace_regexp {\n \n}\n\n.ace-clouds-midnight .ace_comment {\n color:#3C403B;\n}\n\n.ace-clouds-midnight .ace_comment.ace_doc {\n \n}\n\n.ace-clouds-midnight .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-clouds-midnight .ace_variable {\n \n}\n\n.ace-clouds-midnight .ace_variable.ace_language {\n \n}\n\n.ace-clouds-midnight .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-clouds-midnight"}) \ No newline at end of file diff --git a/examples/lib/ace/theme-cobalt.js b/examples/lib/ace/theme-cobalt.js new file mode 100644 index 00000000..51be7b23 --- /dev/null +++ b/examples/lib/ace/theme-cobalt.js @@ -0,0 +1 @@ +define("ace/theme/cobalt",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-cobalt .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-cobalt .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-cobalt .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-cobalt .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-cobalt .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-cobalt .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-cobalt .ace_scroller {\n background-color: #002240;\n}\n\n.ace-cobalt .ace_text-layer {\n cursor: text;\n color: #FFFFFF;\n}\n\n.ace-cobalt .ace_cursor {\n border-left: 2px solid #FFFFFF;\n}\n\n.ace-cobalt .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #FFFFFF;\n}\n \n.ace-cobalt .ace_marker-layer .ace_selection {\n background: rgba(179, 101, 57, 0.75);\n}\n\n.ace-cobalt .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-cobalt .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 255, 255, 0.15);\n}\n\n.ace-cobalt .ace_marker-layer .ace_active_line {\n background: rgba(0, 0, 0, 0.35);\n}\n\n \n.ace-cobalt .ace_invisible {\n color: rgba(255, 255, 255, 0.15);\n}\n\n.ace-cobalt .ace_keyword {\n color:#FF9D00;\n}\n\n.ace-cobalt .ace_keyword.ace_operator {\n \n}\n\n.ace-cobalt .ace_constant {\n color:#FF628C;\n}\n\n.ace-cobalt .ace_constant.ace_language {\n \n}\n\n.ace-cobalt .ace_constant.ace_library {\n \n}\n\n.ace-cobalt .ace_constant.ace_numeric {\n \n}\n\n.ace-cobalt .ace_invalid {\n color:#F8F8F8;\nbackground-color:#800F00;\n}\n\n.ace-cobalt .ace_invalid.ace_illegal {\n \n}\n\n.ace-cobalt .ace_invalid.ace_deprecated {\n \n}\n\n.ace-cobalt .ace_support {\n color:#80FFBB;\n}\n\n.ace-cobalt .ace_support.ace_function {\n color:#FFB054;\n}\n\n.ace-cobalt .ace_function.ace_buildin {\n \n}\n\n.ace-cobalt .ace_string {\n \n}\n\n.ace-cobalt .ace_string.ace_regexp {\n color:#80FFC2;\n}\n\n.ace-cobalt .ace_comment {\n font-style:italic;\ncolor:#0088FF;\n}\n\n.ace-cobalt .ace_comment.ace_doc {\n \n}\n\n.ace-cobalt .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-cobalt .ace_variable {\n color:#CCCCCC;\n}\n\n.ace-cobalt .ace_variable.ace_language {\n color:#FF80E1;\n}\n\n.ace-cobalt .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-cobalt"}) \ No newline at end of file diff --git a/examples/lib/ace/theme-dawn.js b/examples/lib/ace/theme-dawn.js new file mode 100644 index 00000000..3b98416e --- /dev/null +++ b/examples/lib/ace/theme-dawn.js @@ -0,0 +1 @@ +define("ace/theme/dawn",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-dawn .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-dawn .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-dawn .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-dawn .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-dawn .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-dawn .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-dawn .ace_scroller {\n background-color: #F9F9F9;\n}\n\n.ace-dawn .ace_text-layer {\n cursor: text;\n color: #080808;\n}\n\n.ace-dawn .ace_cursor {\n border-left: 2px solid #000000;\n}\n\n.ace-dawn .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #000000;\n}\n \n.ace-dawn .ace_marker-layer .ace_selection {\n background: rgba(39, 95, 255, 0.30);\n}\n\n.ace-dawn .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-dawn .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(75, 75, 126, 0.50);\n}\n\n.ace-dawn .ace_marker-layer .ace_active_line {\n background: rgba(36, 99, 180, 0.12);\n}\n\n \n.ace-dawn .ace_invisible {\n color: rgba(75, 75, 126, 0.50);\n}\n\n.ace-dawn .ace_keyword {\n color:#794938;\n}\n\n.ace-dawn .ace_keyword.ace_operator {\n \n}\n\n.ace-dawn .ace_constant {\n color:#811F24;\n}\n\n.ace-dawn .ace_constant.ace_language {\n \n}\n\n.ace-dawn .ace_constant.ace_library {\n \n}\n\n.ace-dawn .ace_constant.ace_numeric {\n \n}\n\n.ace-dawn .ace_invalid {\n \n}\n\n.ace-dawn .ace_invalid.ace_illegal {\n text-decoration:underline;\nfont-style:italic;\ncolor:#F8F8F8;\nbackground-color:#B52A1D;\n}\n\n.ace-dawn .ace_invalid.ace_deprecated {\n text-decoration:underline;\nfont-style:italic;\ncolor:#B52A1D;\n}\n\n.ace-dawn .ace_support {\n color:#691C97;\n}\n\n.ace-dawn .ace_support.ace_function {\n color:#693A17;\n}\n\n.ace-dawn .ace_function.ace_buildin {\n \n}\n\n.ace-dawn .ace_string {\n color:#0B6125;\n}\n\n.ace-dawn .ace_string.ace_regexp {\n color:#CF5628;\n}\n\n.ace-dawn .ace_comment {\n font-style:italic;\ncolor:#5A525F;\n}\n\n.ace-dawn .ace_comment.ace_doc {\n \n}\n\n.ace-dawn .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-dawn .ace_variable {\n color:#234A97;\n}\n\n.ace-dawn .ace_variable.ace_language {\n \n}\n\n.ace-dawn .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-dawn"}) \ No newline at end of file diff --git a/examples/lib/ace/theme-eclipse.js b/examples/lib/ace/theme-eclipse.js new file mode 100644 index 00000000..e74e173e --- /dev/null +++ b/examples/lib/ace/theme-eclipse.js @@ -0,0 +1 @@ +define("ace/theme/eclipse",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-eclipse .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-eclipse .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-eclipse .ace_gutter {\n width: 50px;\n background: rgb(227, 227, 227);\n border-right: 1px solid rgb(159, 159, 159);\t \n color: rgb(136, 136, 136);\n}\n\n.ace-eclipse .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-eclipse .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-eclipse .ace_text-layer {\n cursor: text;\n}\n\n.ace-eclipse .ace_cursor {\n border-left: 1px solid black;\n}\n\n.ace-eclipse .ace_line .ace_keyword, .ace-eclipse .ace_line .ace_variable {\n color: rgb(127, 0, 85);\n}\n\n.ace-eclipse .ace_line .ace_constant.ace_buildin {\n color: rgb(88, 72, 246);\n}\n\n.ace-eclipse .ace_line .ace_constant.ace_library {\n color: rgb(6, 150, 14);\n}\n\n.ace-eclipse .ace_line .ace_function {\n color: rgb(60, 76, 114);\n}\n\n.ace-eclipse .ace_line .ace_string {\n color: rgb(42, 0, 255);\n}\n\n.ace-eclipse .ace_line .ace_comment {\n color: rgb(63, 127, 95);\n}\n\n.ace-eclipse .ace_line .ace_comment.ace_doc {\n color: rgb(63, 95, 191);\n}\n\n.ace-eclipse .ace_line .ace_comment.ace_doc.ace_tag {\n color: rgb(127, 159, 191);\n}\n\n.ace-eclipse .ace_line .ace_constant.ace_numeric {\n}\n\n.ace-eclipse .ace_line .ace_tag {\n\tcolor: rgb(63, 127, 127);\n}\n\n.ace-eclipse .ace_line .ace_xml_pe {\n color: rgb(104, 104, 91);\n}\n\n.ace-eclipse .ace_marker-layer .ace_selection {\n background: rgb(181, 213, 255);\n}\n\n.ace-eclipse .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgb(192, 192, 192);\n}\n\n.ace-eclipse .ace_marker-layer .ace_active_line {\n background: rgb(232, 242, 254);\n}";d.importCssString(e),b.cssClass="ace-eclipse"}) \ No newline at end of file diff --git a/examples/lib/ace/theme-idle_fingers.js b/examples/lib/ace/theme-idle_fingers.js new file mode 100644 index 00000000..40c7b952 --- /dev/null +++ b/examples/lib/ace/theme-idle_fingers.js @@ -0,0 +1 @@ +define("ace/theme/idle_fingers",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-idle-fingers .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-idle-fingers .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-idle-fingers .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-idle-fingers .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-idle-fingers .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-idle-fingers .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-idle-fingers .ace_scroller {\n background-color: #323232;\n}\n\n.ace-idle-fingers .ace_text-layer {\n cursor: text;\n color: #FFFFFF;\n}\n\n.ace-idle-fingers .ace_cursor {\n border-left: 2px solid #91FF00;\n}\n\n.ace-idle-fingers .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #91FF00;\n}\n \n.ace-idle-fingers .ace_marker-layer .ace_selection {\n background: rgba(90, 100, 126, 0.88);\n}\n\n.ace-idle-fingers .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-idle-fingers .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #404040;\n}\n\n.ace-idle-fingers .ace_marker-layer .ace_active_line {\n background: #353637;\n}\n\n \n.ace-idle-fingers .ace_invisible {\n color: #404040;\n}\n\n.ace-idle-fingers .ace_keyword {\n color:#CC7833;\n}\n\n.ace-idle-fingers .ace_keyword.ace_operator {\n \n}\n\n.ace-idle-fingers .ace_constant {\n color:#6C99BB;\n}\n\n.ace-idle-fingers .ace_constant.ace_language {\n \n}\n\n.ace-idle-fingers .ace_constant.ace_library {\n \n}\n\n.ace-idle-fingers .ace_constant.ace_numeric {\n \n}\n\n.ace-idle-fingers .ace_invalid {\n color:#FFFFFF;\nbackground-color:#FF0000;\n}\n\n.ace-idle-fingers .ace_invalid.ace_illegal {\n \n}\n\n.ace-idle-fingers .ace_invalid.ace_deprecated {\n \n}\n\n.ace-idle-fingers .ace_support {\n \n}\n\n.ace-idle-fingers .ace_support.ace_function {\n color:#B83426;\n}\n\n.ace-idle-fingers .ace_function.ace_buildin {\n \n}\n\n.ace-idle-fingers .ace_string {\n color:#A5C261;\n}\n\n.ace-idle-fingers .ace_string.ace_regexp {\n color:#CCCC33;\n}\n\n.ace-idle-fingers .ace_comment {\n font-style:italic;\ncolor:#BC9458;\n}\n\n.ace-idle-fingers .ace_comment.ace_doc {\n \n}\n\n.ace-idle-fingers .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-idle-fingers .ace_variable {\n \n}\n\n.ace-idle-fingers .ace_variable.ace_language {\n \n}\n\n.ace-idle-fingers .ace_xml_pe {\n \n}\n\n.ace-idle-fingers .ace_collab.ace_user1 {\n color:#323232;\nbackground-color:#FFF980; \n}";d.importCssString(e),b.cssClass="ace-idle-fingers"}) \ No newline at end of file diff --git a/examples/lib/ace/theme-kr_theme.js b/examples/lib/ace/theme-kr_theme.js new file mode 100644 index 00000000..2fac8bac --- /dev/null +++ b/examples/lib/ace/theme-kr_theme.js @@ -0,0 +1 @@ +define("ace/theme/kr_theme",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-kr-theme .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-kr-theme .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-kr-theme .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-kr-theme .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-kr-theme .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-kr-theme .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-kr-theme .ace_scroller {\n background-color: #0B0A09;\n}\n\n.ace-kr-theme .ace_text-layer {\n cursor: text;\n color: #FCFFE0;\n}\n\n.ace-kr-theme .ace_cursor {\n border-left: 2px solid #FF9900;\n}\n\n.ace-kr-theme .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #FF9900;\n}\n \n.ace-kr-theme .ace_marker-layer .ace_selection {\n background: rgba(170, 0, 255, 0.45);\n}\n\n.ace-kr-theme .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-kr-theme .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 177, 111, 0.32);\n}\n\n.ace-kr-theme .ace_marker-layer .ace_active_line {\n background: #38403D;\n}\n\n \n.ace-kr-theme .ace_invisible {\n color: rgba(255, 177, 111, 0.32);\n}\n\n.ace-kr-theme .ace_keyword {\n color:#949C8B;\n}\n\n.ace-kr-theme .ace_keyword.ace_operator {\n \n}\n\n.ace-kr-theme .ace_constant {\n color:rgba(210, 117, 24, 0.76);\n}\n\n.ace-kr-theme .ace_constant.ace_language {\n \n}\n\n.ace-kr-theme .ace_constant.ace_library {\n \n}\n\n.ace-kr-theme .ace_constant.ace_numeric {\n \n}\n\n.ace-kr-theme .ace_invalid {\n color:#F8F8F8;\nbackground-color:#A41300;\n}\n\n.ace-kr-theme .ace_invalid.ace_illegal {\n \n}\n\n.ace-kr-theme .ace_invalid.ace_deprecated {\n \n}\n\n.ace-kr-theme .ace_support {\n color:#9FC28A;\n}\n\n.ace-kr-theme .ace_support.ace_function {\n color:#85873A;\n}\n\n.ace-kr-theme .ace_function.ace_buildin {\n \n}\n\n.ace-kr-theme .ace_string {\n \n}\n\n.ace-kr-theme .ace_string.ace_regexp {\n color:rgba(125, 255, 192, 0.65);\n}\n\n.ace-kr-theme .ace_comment {\n font-style:italic;\ncolor:#706D5B;\n}\n\n.ace-kr-theme .ace_comment.ace_doc {\n \n}\n\n.ace-kr-theme .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-kr-theme .ace_variable {\n color:#D1A796;\n}\n\n.ace-kr-theme .ace_variable.ace_language {\n color:#FF80E1;\n}\n\n.ace-kr-theme .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-kr-theme"}) \ No newline at end of file diff --git a/examples/lib/ace/theme-merbivore.js b/examples/lib/ace/theme-merbivore.js new file mode 100644 index 00000000..407e6f6c --- /dev/null +++ b/examples/lib/ace/theme-merbivore.js @@ -0,0 +1 @@ +define("ace/theme/merbivore",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-merbivore .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-merbivore .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-merbivore .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-merbivore .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-merbivore .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-merbivore .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-merbivore .ace_scroller {\n background-color: #161616;\n}\n\n.ace-merbivore .ace_text-layer {\n cursor: text;\n color: #E6E1DC;\n}\n\n.ace-merbivore .ace_cursor {\n border-left: 2px solid #FFFFFF;\n}\n\n.ace-merbivore .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #FFFFFF;\n}\n \n.ace-merbivore .ace_marker-layer .ace_selection {\n background: #454545;\n}\n\n.ace-merbivore .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-merbivore .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #FCE94F;\n}\n\n.ace-merbivore .ace_marker-layer .ace_active_line {\n background: #333435;\n}\n\n \n.ace-merbivore .ace_invisible {\n color: #404040;\n}\n\n.ace-merbivore .ace_keyword {\n color:#FC6F09;\n}\n\n.ace-merbivore .ace_keyword.ace_operator {\n \n}\n\n.ace-merbivore .ace_constant {\n color:#1EDAFB;\n}\n\n.ace-merbivore .ace_constant.ace_language {\n color:#FDC251;\n}\n\n.ace-merbivore .ace_constant.ace_library {\n color:#8DFF0A;\n}\n\n.ace-merbivore .ace_constant.ace_numeric {\n color:#58C554;\n}\n\n.ace-merbivore .ace_invalid {\n color:#FFFFFF;\n background-color:#990000;\n}\n\n.ace-merbivore .ace_invalid.ace_illegal {\n \n}\n\n.ace-merbivore .ace_invalid.ace_deprecated {\n color:#FFFFFF;\n background-color:#990000;\n}\n\n.ace-merbivore .ace_support {\n \n}\n\n.ace-merbivore .ace_support.ace_function {\n color:#FC6F09;\n}\n\n.ace-merbivore .ace_function.ace_buildin {\n \n}\n\n.ace-merbivore .ace_string {\n color:#8DFF0A;\n}\n\n.ace-merbivore .ace_string.ace_regexp {\n \n}\n\n.ace-merbivore .ace_comment {\n color:#AD2EA4;\n}\n\n.ace-merbivore .ace_comment.ace_doc {\n \n}\n\n.ace-merbivore .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-merbivore .ace_variable {\n \n}\n\n.ace-merbivore .ace_variable.ace_language {\n \n}\n\n.ace-merbivore .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-merbivore"}) \ No newline at end of file diff --git a/examples/lib/ace/theme-merbivore_soft.js b/examples/lib/ace/theme-merbivore_soft.js new file mode 100644 index 00000000..5be28c57 --- /dev/null +++ b/examples/lib/ace/theme-merbivore_soft.js @@ -0,0 +1 @@ +define("ace/theme/merbivore_soft",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-merbivore-soft .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-merbivore-soft .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-merbivore-soft .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-merbivore-soft .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-merbivore-soft .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-merbivore-soft .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-merbivore-soft .ace_scroller {\n background-color: #1C1C1C;\n}\n\n.ace-merbivore-soft .ace_text-layer {\n cursor: text;\n color: #E6E1DC;\n}\n\n.ace-merbivore-soft .ace_cursor {\n border-left: 2px solid #FFFFFF;\n}\n\n.ace-merbivore-soft .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #FFFFFF;\n}\n \n.ace-merbivore-soft .ace_marker-layer .ace_selection {\n background: #494949;\n}\n\n.ace-merbivore-soft .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-merbivore-soft .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #FCE94F;\n}\n\n.ace-merbivore-soft .ace_marker-layer .ace_active_line {\n background: #333435;\n}\n\n \n.ace-merbivore-soft .ace_invisible {\n color: #404040;\n}\n\n.ace-merbivore-soft .ace_keyword {\n color:#FC803A;\n}\n\n.ace-merbivore-soft .ace_keyword.ace_operator {\n \n}\n\n.ace-merbivore-soft .ace_constant {\n color:#68C1D8;\n}\n\n.ace-merbivore-soft .ace_constant.ace_language {\n color:#E1C582;\n}\n\n.ace-merbivore-soft .ace_constant.ace_library {\n color:#8EC65F;\n}\n\n.ace-merbivore-soft .ace_constant.ace_numeric {\n color:#7FC578;\n}\n\n.ace-merbivore-soft .ace_invalid {\n color:#FFFFFF;\n background-color:#FE3838;\n}\n\n.ace-merbivore-soft .ace_invalid.ace_illegal {\n \n}\n\n.ace-merbivore-soft .ace_invalid.ace_deprecated {\n color:#FFFFFF;\n background-color:#FE3838;\n}\n\n.ace-merbivore-soft .ace_support {\n \n}\n\n.ace-merbivore-soft .ace_support.ace_function {\n color:#FC803A;\n}\n\n.ace-merbivore-soft .ace_function.ace_buildin {\n \n}\n\n.ace-merbivore-soft .ace_string {\n color:#8EC65F;\n}\n\n.ace-merbivore-soft .ace_string.ace_regexp {\n \n}\n\n.ace-merbivore-soft .ace_comment {\n color:#AC4BB8;\n}\n\n.ace-merbivore-soft .ace_comment.ace_doc {\n \n}\n\n.ace-merbivore-soft .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-merbivore-soft .ace_variable {\n \n}\n\n.ace-merbivore-soft .ace_variable.ace_language {\n \n}\n\n.ace-merbivore-soft .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-merbivore-soft"}) \ No newline at end of file diff --git a/examples/lib/ace/theme-mono_industrial.js b/examples/lib/ace/theme-mono_industrial.js new file mode 100644 index 00000000..354de6bf --- /dev/null +++ b/examples/lib/ace/theme-mono_industrial.js @@ -0,0 +1 @@ +define("ace/theme/mono_industrial",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-mono-industrial .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-mono-industrial .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-mono-industrial .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-mono-industrial .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-mono-industrial .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-mono-industrial .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-mono-industrial .ace_scroller {\n background-color: #222C28;\n}\n\n.ace-mono-industrial .ace_text-layer {\n cursor: text;\n color: #FFFFFF;\n}\n\n.ace-mono-industrial .ace_cursor {\n border-left: 2px solid #FFFFFF;\n}\n\n.ace-mono-industrial .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #FFFFFF;\n}\n \n.ace-mono-industrial .ace_marker-layer .ace_selection {\n background: rgba(145, 153, 148, 0.40);\n}\n\n.ace-mono-industrial .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-mono-industrial .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(102, 108, 104, 0.50);\n}\n\n.ace-mono-industrial .ace_marker-layer .ace_active_line {\n background: rgba(12, 13, 12, 0.25);\n}\n\n \n.ace-mono-industrial .ace_invisible {\n color: rgba(102, 108, 104, 0.50);\n}\n\n.ace-mono-industrial .ace_keyword {\n color:#A39E64;\n}\n\n.ace-mono-industrial .ace_keyword.ace_operator {\n color:#A8B3AB;\n}\n\n.ace-mono-industrial .ace_constant {\n color:#E98800;\n}\n\n.ace-mono-industrial .ace_constant.ace_language {\n \n}\n\n.ace-mono-industrial .ace_constant.ace_library {\n \n}\n\n.ace-mono-industrial .ace_constant.ace_numeric {\n color:#E98800;\n}\n\n.ace-mono-industrial .ace_invalid {\n color:#FFFFFF;\nbackground-color:rgba(153, 0, 0, 0.68);\n}\n\n.ace-mono-industrial .ace_invalid.ace_illegal {\n \n}\n\n.ace-mono-industrial .ace_invalid.ace_deprecated {\n \n}\n\n.ace-mono-industrial .ace_support {\n \n}\n\n.ace-mono-industrial .ace_support.ace_function {\n color:#588E60;\n}\n\n.ace-mono-industrial .ace_function.ace_buildin {\n \n}\n\n.ace-mono-industrial .ace_string {\n \n}\n\n.ace-mono-industrial .ace_string.ace_regexp {\n \n}\n\n.ace-mono-industrial .ace_comment {\n color:#666C68;\nbackground-color:#151C19;\n}\n\n.ace-mono-industrial .ace_comment.ace_doc {\n \n}\n\n.ace-mono-industrial .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-mono-industrial .ace_variable {\n \n}\n\n.ace-mono-industrial .ace_variable.ace_language {\n color:#648BD2;\n}\n\n.ace-mono-industrial .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-mono-industrial"}) \ No newline at end of file diff --git a/examples/lib/ace/theme-monokai.js b/examples/lib/ace/theme-monokai.js new file mode 100644 index 00000000..398195fd --- /dev/null +++ b/examples/lib/ace/theme-monokai.js @@ -0,0 +1 @@ +define("ace/theme/monokai",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-monokai .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-monokai .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-monokai .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-monokai .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-monokai .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-monokai .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-monokai .ace_scroller {\n background-color: #272822;\n}\n\n.ace-monokai .ace_text-layer {\n cursor: text;\n color: #F8F8F2;\n}\n\n.ace-monokai .ace_cursor {\n border-left: 2px solid #F8F8F0;\n}\n\n.ace-monokai .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #F8F8F0;\n}\n \n.ace-monokai .ace_marker-layer .ace_selection {\n background: #49483E;\n}\n\n.ace-monokai .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-monokai .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #49483E;\n}\n\n.ace-monokai .ace_marker-layer .ace_active_line {\n background: #49483E;\n}\n\n \n.ace-monokai .ace_invisible {\n color: #49483E;\n}\n\n.ace-monokai .ace_keyword {\n color:#F92672;\n}\n\n.ace-monokai .ace_keyword.ace_operator {\n \n}\n\n.ace-monokai .ace_constant {\n \n}\n\n.ace-monokai .ace_constant.ace_language {\n color:#AE81FF;\n}\n\n.ace-monokai .ace_constant.ace_library {\n \n}\n\n.ace-monokai .ace_constant.ace_numeric {\n color:#AE81FF;\n}\n\n.ace-monokai .ace_invalid {\n color:#F8F8F0;\nbackground-color:#F92672;\n}\n\n.ace-monokai .ace_invalid.ace_illegal {\n \n}\n\n.ace-monokai .ace_invalid.ace_deprecated {\n color:#F8F8F0;\nbackground-color:#AE81FF;\n}\n\n.ace-monokai .ace_support {\n \n}\n\n.ace-monokai .ace_support.ace_function {\n color:#66D9EF;\n}\n\n.ace-monokai .ace_function.ace_buildin {\n \n}\n\n.ace-monokai .ace_string {\n color:#E6DB74;\n}\n\n.ace-monokai .ace_string.ace_regexp {\n \n}\n\n.ace-monokai .ace_comment {\n color:#75715E;\n}\n\n.ace-monokai .ace_comment.ace_doc {\n \n}\n\n.ace-monokai .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-monokai .ace_variable {\n \n}\n\n.ace-monokai .ace_variable.ace_language {\n \n}\n\n.ace-monokai .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-monokai"}) \ No newline at end of file diff --git a/examples/lib/ace/theme-pastel_on_dark.js b/examples/lib/ace/theme-pastel_on_dark.js new file mode 100644 index 00000000..79cdb107 --- /dev/null +++ b/examples/lib/ace/theme-pastel_on_dark.js @@ -0,0 +1 @@ +define("ace/theme/pastel_on_dark",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-pastel-on-dark .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-pastel-on-dark .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-pastel-on-dark .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-pastel-on-dark .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-pastel-on-dark .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-pastel-on-dark .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-pastel-on-dark .ace_scroller {\n background-color: #2c2828;\n}\n\n.ace-pastel-on-dark .ace_text-layer {\n cursor: text;\n color: #8f938f;\n}\n\n.ace-pastel-on-dark .ace_cursor {\n border-left: 2px solid #A7A7A7;\n}\n\n.ace-pastel-on-dark .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #A7A7A7;\n}\n \n.ace-pastel-on-dark .ace_marker-layer .ace_selection {\n background: rgba(221, 240, 255, 0.20);\n}\n\n.ace-pastel-on-dark .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-pastel-on-dark .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 255, 255, 0.25);\n}\n\n.ace-pastel-on-dark .ace_marker-layer .ace_active_line {\n background: rgba(255, 255, 255, 0.031);\n}\n\n \n.ace-pastel-on-dark .ace_invisible {\n color: rgba(255, 255, 255, 0.25);\n}\n\n.ace-pastel-on-dark .ace_keyword {\n color:#757ad8;\n}\n\n.ace-pastel-on-dark .ace_keyword.ace_operator {\n color:#797878;\n}\n\n.ace-pastel-on-dark .ace_constant {\n color:#4fb7c5;\n}\n\n.ace-pastel-on-dark .ace_constant.ace_language {\n \n}\n\n.ace-pastel-on-dark .ace_constant.ace_library {\n \n}\n\n.ace-pastel-on-dark .ace_constant.ace_numeric {\n \n}\n\n.ace-pastel-on-dark .ace_invalid {\n \n}\n\n.ace-pastel-on-dark .ace_invalid.ace_illegal {\n color:#F8F8F8;\nbackground-color:rgba(86, 45, 86, 0.75);\n}\n\n.ace-pastel-on-dark .ace_invalid.ace_deprecated {\n text-decoration:underline;\nfont-style:italic;\ncolor:#D2A8A1;\n}\n\n.ace-pastel-on-dark .ace_support {\n color:#9a9a9a;\n}\n\n.ace-pastel-on-dark .ace_support.ace_function {\n color:#aeb2f8;\n}\n\n.ace-pastel-on-dark .ace_function.ace_buildin {\n \n}\n\n.ace-pastel-on-dark .ace_string {\n color:#66a968;\n}\n\n.ace-pastel-on-dark .ace_string.ace_regexp {\n color:#E9C062;\n}\n\n.ace-pastel-on-dark .ace_comment {\n color:#656865;\n}\n\n.ace-pastel-on-dark .ace_comment.ace_doc {\n color:A6C6FF;\n}\n\n.ace-pastel-on-dark .ace_comment.ace_doc.ace_tag {\n color:A6C6FF;\n}\n\n.ace-pastel-on-dark .ace_variable {\n color:#bebf55;\n}\n\n.ace-pastel-on-dark .ace_variable.ace_language {\n color:#bebf55;\n}\n\n.ace-pastel-on-dark .ace_xml_pe {\n color:#494949;\n}";d.importCssString(e),b.cssClass="ace-pastel-on-dark"}) \ No newline at end of file diff --git a/examples/lib/ace/theme-twilight.js b/examples/lib/ace/theme-twilight.js new file mode 100644 index 00000000..40724628 --- /dev/null +++ b/examples/lib/ace/theme-twilight.js @@ -0,0 +1 @@ +define("ace/theme/twilight",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-twilight .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-twilight .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-twilight .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-twilight .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-twilight .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-twilight .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-twilight .ace_scroller {\n background-color: #141414;\n}\n\n.ace-twilight .ace_text-layer {\n cursor: text;\n color: #F8F8F8;\n}\n\n.ace-twilight .ace_cursor {\n border-left: 2px solid #A7A7A7;\n}\n\n.ace-twilight .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #A7A7A7;\n}\n \n.ace-twilight .ace_marker-layer .ace_selection {\n background: rgba(221, 240, 255, 0.20);\n}\n\n.ace-twilight .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-twilight .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 255, 255, 0.25);\n}\n\n.ace-twilight .ace_marker-layer .ace_active_line {\n background: rgba(255, 255, 255, 0.031);\n}\n\n \n.ace-twilight .ace_invisible {\n color: rgba(255, 255, 255, 0.25);\n}\n\n.ace-twilight .ace_keyword {\n color:#CDA869;\n}\n\n.ace-twilight .ace_keyword.ace_operator {\n \n}\n\n.ace-twilight .ace_constant {\n color:#CF6A4C;\n}\n\n.ace-twilight .ace_constant.ace_language {\n \n}\n\n.ace-twilight .ace_constant.ace_library {\n \n}\n\n.ace-twilight .ace_constant.ace_numeric {\n \n}\n\n.ace-twilight .ace_invalid {\n \n}\n\n.ace-twilight .ace_invalid.ace_illegal {\n color:#F8F8F8;\nbackground-color:rgba(86, 45, 86, 0.75);\n}\n\n.ace-twilight .ace_invalid.ace_deprecated {\n text-decoration:underline;\nfont-style:italic;\ncolor:#D2A8A1;\n}\n\n.ace-twilight .ace_support {\n color:#9B859D;\n}\n\n.ace-twilight .ace_support.ace_function {\n color:#DAD085;\n}\n\n.ace-twilight .ace_function.ace_buildin {\n \n}\n\n.ace-twilight .ace_string {\n color:#8F9D6A;\n}\n\n.ace-twilight .ace_string.ace_regexp {\n color:#E9C062;\n}\n\n.ace-twilight .ace_comment {\n font-style:italic;\ncolor:#5F5A60;\n}\n\n.ace-twilight .ace_comment.ace_doc {\n \n}\n\n.ace-twilight .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-twilight .ace_variable {\n color:#7587A6;\n}\n\n.ace-twilight .ace_variable.ace_language {\n \n}\n\n.ace-twilight .ace_xml_pe {\n color:#494949;\n}";d.importCssString(e),b.cssClass="ace-twilight"}) \ No newline at end of file diff --git a/examples/lib/ace/theme-vibrant_ink.js b/examples/lib/ace/theme-vibrant_ink.js new file mode 100644 index 00000000..ed6ae9e1 --- /dev/null +++ b/examples/lib/ace/theme-vibrant_ink.js @@ -0,0 +1 @@ +define("ace/theme/vibrant_ink",["require","exports","module"],function(a,b,c){var d=a("pilot/dom"),e=".ace-vibrant-ink .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-vibrant-ink .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-vibrant-ink .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-vibrant-ink .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-vibrant-ink .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-vibrant-ink .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-vibrant-ink .ace_scroller {\n background-color: #0F0F0F;\n}\n\n.ace-vibrant-ink .ace_text-layer {\n cursor: text;\n color: #FFFFFF;\n}\n\n.ace-vibrant-ink .ace_cursor {\n border-left: 2px solid #FFFFFF;\n}\n\n.ace-vibrant-ink .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #FFFFFF;\n}\n \n.ace-vibrant-ink .ace_marker-layer .ace_selection {\n background: #6699CC;\n}\n\n.ace-vibrant-ink .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-vibrant-ink .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #99CC99;\n}\n\n.ace-vibrant-ink .ace_marker-layer .ace_active_line {\n background: #333333;\n}\n\n \n.ace-vibrant-ink .ace_invisible {\n color: #404040;\n}\n\n.ace-vibrant-ink .ace_keyword {\n color:#FF6600;\n}\n\n.ace-vibrant-ink .ace_keyword.ace_operator {\n \n}\n\n.ace-vibrant-ink .ace_constant {\n \n}\n\n.ace-vibrant-ink .ace_constant.ace_language {\n color:#339999;\n}\n\n.ace-vibrant-ink .ace_constant.ace_library {\n \n}\n\n.ace-vibrant-ink .ace_constant.ace_numeric {\n color:#99CC99;\n}\n\n.ace-vibrant-ink .ace_invalid {\n color:#CCFF33;\n background-color:#000000;\n}\n\n.ace-vibrant-ink .ace_invalid.ace_illegal {\n \n}\n\n.ace-vibrant-ink .ace_invalid.ace_deprecated {\n color:#CCFF33;\n background-color:#000000;\n}\n\n.ace-vibrant-ink .ace_support {\n \n}\n\n.ace-vibrant-ink .ace_support.ace_function {\n color:#FFCC00;\n}\n\n.ace-vibrant-ink .ace_function.ace_buildin {\n \n}\n\n.ace-vibrant-ink .ace_string {\n color:#66FF00;\n}\n\n.ace-vibrant-ink .ace_string.ace_regexp {\n \n}\n\n.ace-vibrant-ink .ace_comment {\n color:#9933CC;\n}\n\n.ace-vibrant-ink .ace_comment.ace_doc {\n \n}\n\n.ace-vibrant-ink .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-vibrant-ink .ace_variable {\n \n}\n\n.ace-vibrant-ink .ace_variable.ace_language {\n \n}\n\n.ace-vibrant-ink .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-vibrant-ink"}) \ No newline at end of file diff --git a/examples/lib/ace/worker-javascript.js b/examples/lib/ace/worker-javascript.js new file mode 100644 index 00000000..81ddb963 --- /dev/null +++ b/examples/lib/ace/worker-javascript.js @@ -0,0 +1 @@ +function initSender(){var a=require("pilot/event_emitter").EventEmitter,b=require("pilot/oop"),c=function(){};(function(){b.implement(this,a),this.callback=function(a,b){postMessage({type:"call",id:b,data:a})},this.emit=function(a,b){postMessage({type:"event",name:a,data:b})}}).call(c.prototype);return new c}function initBaseUrls(a){require.tlns=a}var console={log:function(a){postMessage({type:"log",data:a})}},window={console:console},require=function(a){var b=require.modules[a];if(b){b.initialized||(b.exports=b.factory().exports,b.initialized=!0);return b.exports}var c=a.split("/");c[0]=require.tlns[c[0]]||c[0],path=c.join("/")+".js",require.id=a,importScripts(path);return require(a)};require.modules={},require.tlns={};var define=function(a,b,c){arguments.length==2?c=b:arguments.length==1&&(c=a,a=require.id);a.indexOf("text/")!==0&&(require.modules[a]={factory:function(){var a={exports:{}},b=c(require,a.exports,a);b&&(a.exports=exports);return a}})},main,sender;onmessage=function(a){var b=a.data;if(b.command)main[b.command].apply(main,b.args);else if(b.init){initBaseUrls(b.tlns),require("pilot/fixoldbrowsers"),sender=initSender();var c=require(b.module)[b.classname];main=new c(sender)}else b.event&&sender._dispatchEvent(b.event,b.data)},define("pilot/fixoldbrowsers",["require","exports","module"],function(a,b,c){var d=Object.prototype.hasOwnProperty;Array.isArray||(Array.isArray=function(a){return Object.prototype.toString.call(a)=="[object Array]"}),Array.prototype.forEach||(Array.prototype.forEach=function(a,b){var c=+this.length;for(var d=0;d=2)var d=arguments[1];else for(;;){if(c in this){d=this[c++];break}if(++c>=b)throw new TypeError}for(;c=2)var d=arguments[1];else for(;;){if(c in this){d=this[c--];break}if(--c<0)throw new TypeError}for(;c>=0;c--)c in this&&(d=a.call(null,d,this[c],c,this));return d}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){var b=this.length;if(!b)return-1;var c=arguments[1]||0;if(c>=b)return-1;c<0&&(c+=b);for(;c=0;c--){if(!d.call(this,c))continue;if(a===this[c])return c}return-1}),Object.getPrototypeOf||(Object.getPrototypeOf=function(a){return a.__proto__||a.constructor.prototype}),Object.getOwnPropertyDescriptor||(Object.getOwnPropertyDescriptor=function(a,b){if(typeof a!="object"&&typeof a!="function"||a===null)throw new TypeError("Object.getOwnPropertyDescriptor called on a non-object");return d.call(a,b)?{value:a[b],enumerable:!0,configurable:!0,writeable:!0}:undefined}),Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(a){return Object.keys(a)}),Object.create||(Object.create=function(a,b){var c;if(a===null)c={"__proto__":null};else{if(typeof a!="object")throw new TypeError("typeof prototype["+typeof a+"] != 'object'");var d=function(){};d.prototype=a,c=new d}typeof b!="undefined"&&Object.defineProperties(c,b);return c}),Object.defineProperty||(Object.defineProperty=function(a,b,c){if(typeof c=="object"&&a.__defineGetter__){if(d.call(c,"value")){!a.__lookupGetter__(b)&&!a.__lookupSetter__(b)&&(a[b]=c.value);if(d.call(c,"get")||d.call(c,"set"))throw new TypeError("Object doesn't support this action")}else typeof c.get=="function"&&a.__defineGetter__(b,c.get);typeof c.set=="function"&&a.__defineSetter__(b,c.set)}return a}),Object.defineProperties||(Object.defineProperties=function(a,b){for(var c in b)d.call(b,c)&&Object.defineProperty(a,c,b[c]);return a}),Object.seal||(Object.seal=function(a){return a}),Object.freeze||(Object.freeze=function(a){return a});try{Object.freeze(function(){})}catch(e){Object.freeze=function(a){return function(b){return typeof b=="function"?b:a(b)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(a){return a}),Object.isSealed||(Object.isSealed=function(a){return!1}),Object.isFrozen||(Object.isFrozen=function(a){return!1}),Object.isExtensible||(Object.isExtensible=function(a){return!0});if(!Object.keys){var f=!0,g=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],h=g.length;for(var i in{toString:null})f=!1;Object.keys=function(a){if(typeof a!="object"&&typeof a!="function"||a===null)throw new TypeError("Object.keys called on a non-object");var b=[];for(var c in a)d.call(a,c)&&b.push(c);if(f)for(var e=0,i=h;e=7?new a(c,d,e,f,g,h,i):j>=6?new a(c,d,e,f,g,h):j>=5?new a(c,d,e,f,g):j>=4?new a(c,d,e,f):j>=3?new a(c,d,e):j>=2?new a(c,d):j>=1?new a(c):new a;k.constructor=b;return k}return a.apply(this,arguments)},c=new RegExp("^(?:((?:[+-]\\d\\d)?\\d\\d\\d\\d)(?:-(\\d\\d)(?:-(\\d\\d))?)?)?(?:T(\\d\\d):(\\d\\d)(?::(\\d\\d)(?:\\.(\\d\\d\\d))?)?)?(?:Z|([+-])(\\d\\d):(\\d\\d))?$");for(var d in a)b[d]=a[d];b.now=a.now,b.UTC=a.UTC,b.prototype=a.prototype,b.prototype.constructor=b,b.parse=function(b){var d=c.exec(b);if(d){d.shift();var e=d[0]===undefined;for(var f=0;f<10;f++){if(f===7)continue;d[f]=+(d[f]||(f<3?1:0)),f===1&&d[f]--}if(e)return((d[3]*60+d[4])*60+d[5])*1e3+d[6];var g=(d[8]*60+d[9])*60*1e3;d[6]==="-"&&(g=-g);return a.UTC.apply(this,d.slice(0,7))+g}return a.parse.apply(this,arguments)};return b}(Date));var j=Array.prototype.slice;Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;if(typeof b.apply!="function"||typeof b.call!="function")return new TypeError;var c=j.call(arguments),d=function(){if(this instanceof d){var a=Object.create(b.prototype);b.apply(a,c.concat(j.call(arguments)));return a}return b.call.apply(b,c.concat(j.call(arguments)))};d.bound=b,d.boundTo=a,d.boundArgs=c,d.length=typeof b=="function"?Math.max(b.length-c.length,0):0;return d});if(!String.prototype.trim){var k=/^\s\s*/,l=/\s\s*$/;String.prototype.trim=function(){return String(this).replace(k,"").replace(l,"")}}b.globalsLoaded=!0}),define("pilot/event_emitter",["require","exports","module"],function(a,b,c){var d={};d._emit=d._dispatchEvent=function(a,b){this._eventRegistry=this._eventRegistry||{};var c=this._eventRegistry[a];if(!!c&&!!c.length){var b=b||{};b.type=a;for(var d=0;d=b&&(a.row=Math.max(0,b-1),a.column=this.getLine(b-1).length);return a},this.insert=function(a,b){if(b.length==0)return a;a=this.$clipPosition(a),this.getLength()<=1&&this.$detectNewLine(b);var c=this.$split(b),d=c.splice(0,1)[0],e=c.length==0?null:c.splice(c.length-1,1)[0];a=this.insertInLine(a,d),e!==null&&(a=this.insertNewLine(a),a=this.insertLines(a.row,c),a=this.insertInLine(a,e||""));return a},this.insertLines=function(a,b){if(b.length==0)return{row:a,column:0};var c=[a,0];c.push.apply(c,b),this.$lines.splice.apply(this.$lines,c);var d=new f(a,0,a+b.length,0),e={action:"insertLines",range:d,lines:b};this._dispatchEvent("change",{data:e});return d.end},this.insertNewLine=function(a){a=this.$clipPosition(a);var b=this.$lines[a.row]||"";this.$lines[a.row]=b.substring(0,a.column),this.$lines.splice(a.row+1,0,b.substring(a.column,b.length));var c={row:a.row+1,column:0},d={action:"insertText",range:f.fromPoints(a,c),text:this.getNewLineCharacter()};this._dispatchEvent("change",{data:d});return c},this.insertInLine=function(a,b){if(b.length==0)return a;var c=this.$lines[a.row]||"";this.$lines[a.row]=c.substring(0,a.column)+b+c.substring(a.column);var d={row:a.row,column:a.column+b.length},e={action:"insertText",range:f.fromPoints(a,d),text:b};this._dispatchEvent("change",{data:e});return d},this.remove=function(a){a.start=this.$clipPosition(a.start),a.end=this.$clipPosition(a.end);if(a.isEmpty())return a.start;var b=a.start.row,c=a.end.row;if(a.isMultiLine()){var d=a.start.column==0?b:b+1,e=c-1;a.end.column>0&&this.removeInLine(c,0,a.end.column),e>=d&&this.removeLines(d,e),d!=b&&(this.removeInLine(b,a.start.column,this.getLine(b).length),this.removeNewLine(a.start.row))}else this.removeInLine(b,a.start.column,a.end.column);return a.start},this.removeInLine=function(a,b,c){if(b!=c){var d=new f(a,b,a,c),e=this.getLine(a),g=e.substring(b,c),h=e.substring(0,b)+e.substring(c,e.length);this.$lines.splice(a,1,h);var i={action:"removeText",range:d,text:g};this._dispatchEvent("change",{data:i});return d.start}},this.removeLines=function(a,b){var c=new f(a,0,b+1,0),d=this.$lines.splice(a,b-a+1),e={action:"removeLines",range:c,nl:this.getNewLineCharacter(),lines:d};this._dispatchEvent("change",{data:e});return d},this.removeNewLine=function(a){var b=this.getLine(a),c=this.getLine(a+1),d=new f(a,b.length,a+1,0),e=b+c;this.$lines.splice(a,2,e);var g={action:"removeText",range:d,text:this.getNewLineCharacter()};this._dispatchEvent("change",{data:g})},this.replace=function(a,b){if(b.length==0&&a.isEmpty())return a.start;if(b==this.getTextRange(a))return a.end;this.remove(a);if(b)var c=this.insert(a.start,b);else c=a.start;return c},this.applyDeltas=function(a){for(var b=0;b=0;b--){var c=a[b],d=f.fromPoints(c.range.start,c.range.end);c.action=="insertLines"?this.removeLines(d.start.row,d.end.row-1):c.action=="insertText"?this.remove(d):c.action=="removeLines"?this.insertLines(d.start.row,c.lines):c.action=="removeText"&&this.insert(d.start,c.text)}}}).call(h.prototype),b.Document=h}),define("ace/range",["require","exports","module"],function(a,b,c){var d=function(a,b,c,d){this.start={row:a,column:b},this.end={row:c,column:d}};(function(){this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(a,b){return this.compare(a,b)==0},this.compare=function(a,b){if(!this.isMultiLine()&&a===this.start.row)return bthis.end.column?1:0;if(athis.end.row)return 1;if(this.start.row===a)return b>=this.start.column?0:-1;if(this.end.row===a)return b<=this.end.column?0:1;return 0},this.clipRows=function(a,b){if(this.end.row>b)var c={row:b+1,column:0};if(this.start.row>b)var e={row:b+1,column:0};if(this.start.rowthis.row)return;if(c.start.row==this.row&&c.start.column>this.column)return;var d=this.row,e=this.column;b.action==="insertText"?c.start.row===d&&c.start.column<=e?c.start.row===c.end.row?e+=c.end.column-c.start.column:(e-=c.start.column,d+=c.end.row-c.start.row):c.start.row!==c.end.row&&c.start.row=e?e=c.start.column:e=Math.max(0,e-(c.end.column-c.start.column)):c.start.row!==c.end.row&&c.start.row=this.document.getLength()?(c.row=Math.max(0,this.document.getLength()-1),c.column=this.document.getLine(c.row).length):a<0?(c.row=0,c.column=0):(c.row=a,c.column=Math.min(this.document.getLine(c.row).length,Math.max(0,b))),b<0&&(c.column=0);return c}}).call(f.prototype)}),define("pilot/lang",["require","exports","module"],function(a,b,c){b.stringReverse=function(a){return a.split("").reverse().join("")},b.stringRepeat=function(a,b){return Array(b+1).join(a)},b.copyObject=function(a){var b={};for(var c in a)b[c]=a[c];return b},b.arrayToMap=function(a){var b={};for(var c=0;c'.",f,d),c=g.empty,f.type=d;for(;;){if(K.id==="/"){bI("/"),K.id!==">"&&bA("Expected '{a}' and instead saw '{b}'.",K,">",K.value);break}if(K.id&&K.id.substr(0,1)===">")break;K.identifier||((K.id==="(end)"||K.id==="(error)")&&bC("Missing '>'.",K),bA("Bad identifier.")),N.white=!0,bN($,K),a=K.value,N.white=h,bI(),!N.cap&&a!==a.toLowerCase()&&bA("Attribute '{a}' not all lower case.",K,a),a=a.toLowerCase(),be="",bw(b,a)&&bA("Attribute '{a}' repeated.",K,a),a.slice(0,2)==="on"?(N.on||bA("Avoid HTML event handlers."),bd="scriptstring",bI("="),e=K.id,e!=='"'&&e!=="'"&&bC("Missing quote."),be=e,i=N.white,N.white=!1,bI(e),ck(),cl("on"),N.white=i,K.id!==e&&bC("Missing close quote on script attribute."),bd="html",be="",bI(e),g=!1):a==="style"?(bd="scriptstring",bI("="),e=K.id,e!=='"'&&e!=="'"&&bC("Missing quote."),bd="styleproperty",be=e,bI(e),cF(),bd="html",be="",bI(e),g=!1):K.id==="="?(bI("="),g=K.value,!K.identifier&&K.id!=='"'&&K.id!=="'"&&K.type!=="(string)"&&K.type!=="(number)"&&K.type!=="(color)"&&bA("Expected an attribute value and instead saw '{a}'.",$,a),bI()):g=!0,b[a]=g,cL(d,a,g)}cM(d,b),c||U.push(f),bd="outer",bI(">");break;case""&&bC("Missing '{a}'.",K,">"),bd="outer",bI(">");break;case""||K.id==="(end)")break;K.value.indexOf("--")>=0&&bC("Unexpected --."),K.value.indexOf("<")>=0&&bC("Unexpected <."),K.value.indexOf(">")>=0&&bC("Unexpected >.")}bd="outer",bI(">");break;case"(end)":return;default:K.id==="(end)"?bC("Missing '{a}'.",K,""):bI()}if(U&&U.length===0&&(N.adsafe||!N.fragment||K.id==="(end)"))break}K.id!=="(end)"&&bC("Unexpected material after the end.")}function cN(a){return""}function cM(d,e){var g,h=z[d],i;T=!1,h||bC("Unrecognized tag '<{a}>'.",K,d===d.toLowerCase()?d:d+" (capitalization error)");if(U.length>0){d==="html"&&bC("Too many tags.",$),i=h.parent;if(i)i.indexOf(" "+U[U.length-1].name+" ")<0&&bC("A '<{a}>' must be within '<{b}>'.",$,d,i);else if(!N.adsafe&&!N.fragment){g=U.length;do g<=0&&bC("A '<{a}>' must be within '<{b}>'.",$,d,"body"),g-=1;while(U[g].name!=="body")}}switch(d){case"div":N.adsafe&&U.length===1&&!a&&bA("ADSAFE violation: missing ID_.");break;case"script":bd="script",bI(">"),D=K.from,e.lang&&bA("lang is deprecated.",$),N.adsafe&&U.length!==1&&bA("ADsafe script placement violation.",$),e.src?(N.adsafe&&(!b||!f[e.src])&&bA("ADsafe unapproved script source.",$),e.type&&bA("type is unnecessary.",$)):(c&&bC("ADsafe script violation.",$),ck(),cl("script")),bd="html",bI(""),cJ(),bd="html",bI("=0&&bA("Unexpected character '{a}' in {b}.",$,d.charAt(f),c),A[e]=!0):c==="class"||c==="type"||c==="name"?(f=d.search(bs),f>=0&&bA("Unexpected character '{a}' in {b}.",$,d.charAt(f),c),A[e]=!0):c==="href"||c==="background"||c==="content"||c==="data"||c.indexOf("src")>=0||c.indexOf("url")>=0?(N.safe&&bp.test(d)&&bC("ADsafe URL violation."),_.push(d)):c==="for"?N.adsafe&&(a?d.slice(0,a.length)!==a?bA("ADsafe violation: An id must have a '{a}' prefix",K,a):/^[A-Z]+_[A-Z]+$/.test(d)||bA("ADSAFE violation: bad id."):bA("ADSAFE violation: bad id.")):c==="name"&&N.adsafe&&d.indexOf("_")>=0&&bA("ADsafe name violation.")}function cK(a){a!=="html"&&!N.fragment&&(a==="div"&&N.adsafe?bC("ADSAFE: Use the fragment option."):bC("Expected '{a}' and instead saw '{b}'.",$,"html",a)),N.adsafe&&(a==="html"&&bC("Currently, ADsafe does not operate on whole HTML documents. It operates on
fragments and .js files.",$),N.fragment?a!=="div"&&bC("ADsafe violation: Wrap the widget in a div.",$):bC("Use the fragment option.",$)),N.browser=!0,by()}function cJ(){var a;while(K.id==="@"){a=bH(),bI("@");if(K.identifier)switch(K.value){case"import":bI(),cB()||(bA("Expected '{a}' and instead saw '{b}'.",K,"url",K.value),bI()),bI(";");break;case"media":bI();for(;;){(!K.identifier||r[K.value]===!0)&&bC("Expected a CSS media type, and instead saw '{a}'.",K,K.id),bI();if(K.id!==",")break;bI(",")}bI("{"),cI(),bI("}");break;default:bA("Expected an at-rule, and instead saw @{a}.",K,K.value)}else bA("Expected an at-rule, and instead saw '{a}'.",K,K.value)}cI()}function cI(){while(K.id!=="":case"+":bI(),cG();break;case":":bI(":");switch(K.value){case"active":case"after":case"before":case"checked":case"disabled":case"empty":case"enabled":case"first-child":case"first-letter":case"first-line":case"first-of-type":case"focus":case"hover":case"last-child":case"last-of-type":case"link":case"only-of-type":case"root":case"target":case"visited":bI();break;case"lang":bI(),bI("("),K.identifier||bA("Expected a lang code, and instead saw :{a}.",K,K.value),bI(")");break;case"nth-child":case"nth-last-child":case"nth-last-of-type":case"nth-of-type":bI(),bI("("),cE(),bI(")");break;case"not":bI(),bI("("),K.id===":"&&bH(0).value==="not"&&bA("Nested not."),cG(),bI(")");break;default:bA("Expected a pseudo, and instead saw :{a}.",K,K.value)}break;case"#":bI("#"),K.identifier||bA("Expected an id, and instead saw #{a}.",K,K.value),bI();break;case"*":bI("*");break;case".":bI("."),K.identifier||bA("Expected a class, and instead saw #.{a}.",K,K.value),bI();break;case"[":bI("["),K.identifier||bA("Expected an attribute, and instead saw [{a}].",K,K.value),bI();if(K.id==="="||K.value==="~="||K.value==="$="||K.value==="|="||K.id==="*="||K.id==="^=")bI(),K.type!=="(string)"&&bA("Expected a string, and instead saw {a}.",K,K.value),bI();bI("]");break;default:bC("Expected a CSS selector, and instead saw {a}.",K,K.value)}}function cF(){var a;for(;;){if(K.id==="}"||K.id==="(end)"||be&&K.id===be)return;while(K.id===";")bA("Misplaced ';'."),bI(";");a=cC(),bI(":"),K.identifier&&K.value==="inherit"?bI():cD(a)||(bA("Unexpected token '{a}'.",K,K.value),bI()),K.id==="!"&&(bI("!"),bK(),K.identifier&&K.value==="important"?bI():bA("Expected '{a}' and instead saw '{b}'.",K,"important",K.value)),K.id==="}"||K.id===be?bA("Missing '{a}'.",K,";"):bI(";")}}function cE(){if(K.id==="(number)")bI(),K.value==="n"&&K.identifier&&(bK(),bI(),K.id==="+"&&(bK(),bI("+"),bK(),bI("(number)")));else{switch(K.value){case"odd":case"even":if(K.identifier){bI();return}}bA("Unexpected token '{a}'.",K,K.value)}}function cD(a){var b=0,c,d,e,f,g=0,h;switch(typeof a){case"function":return a();case"string":if(K.identifier&&K.value===a){bI();return!0}return!1}for(;;){if(b>=a.length)return!1;h=a[b],b+=1;if(h===!0)break;typeof h=="number"?(c=h,h=a[b],b+=1):c=1,e=!1;while(c>0)if(cD(h))e=!0,c-=1;else break;if(e)return!0}g=b,d=[];for(;;){f=!1;for(b=g;b=0&&bA("Bad url string."));b||bA("Missing url."),bI(),N.safe&&bp.test(b)&&bC("ADsafe URL violation."),_.push(b);return!0}return!1}function cA(){var a;if(K.identifier&&K.value==="rect"){bI(),bI("(");for(a=0;a<4;a+=1)if(!ct()){bA("Expected a number and instead saw '{a}'.",K,K.value);break}bI(")");return!0}return!1}function cz(){if(K.identifier&&K.value==="counter"){bI(),bI("("),bI(),K.id===","&&(bR(),K.type!=="(string)"&&bA("Expected a string and instead saw '{a}'.",K,K.value),bI()),bI(")");return!0}if(K.identifier&&K.value==="counters"){bI(),bI("("),K.identifier||bA("Expected a name and instead saw '{a}'.",K,K.value),bI(),K.id===","&&(bR(),K.type!=="(string)"&&bA("Expected a string and instead saw '{a}'.",K,K.value),bI()),K.id===","&&(bR(),K.type!=="(string)"&&bA("Expected a string and instead saw '{a}'.",K,K.value),bI()),bI(")");return!0}return!1}function cy(){while(K.id!==";"){!cp()&&!cr()&&bA("Expected a name and instead saw '{a}'.",K,K.value);if(K.id!==",")return!0;bR()}}function cx(){if(K.identifier&&K.value==="attr"){bI(),bI("("),K.identifier||bA("Expected a name and instead saw '{a}'.",K,K.value),bI(),bI(")");return!0}return!1}function cw(){if(!K.identifier)return ct();if(K.value==="auto"){bI();return!0}}function cv(){if(!K.identifier)return ct();switch(K.value){case"thin":case"medium":case"thick":bI();return!0}}function cu(){K.id==="-"&&(bI("-"),bK());if(K.type==="(number)"){bI(),K.type!=="(string)"&&q[K.value]===!0&&(bK(),bI());return!0}return!1}function ct(){K.id==="-"&&(bI("-"),bK(),bQ());if(K.type==="(number)"){bI(),K.type!=="(string)"&&q[K.value]===!0?(bK(),bI()):+$.value!==0&&bA("Expected a linear unit and instead saw '{a}'.",K,K.value);return!0}return!1}function cs(){var a,b,c;if(K.identifier){c=K.value;if(c==="rgb"||c==="rgba"){bI(),bI("(");for(a=0;a<3;a+=1)a&&bI(","),b=K.value,K.type!=="(number)"||b<0?(bA("Expected a positive number and instead saw '{a}'",K,b),bI()):(bI(),K.id==="%"?(bI("%"),b>100&&bA("Expected a percentage and instead saw '{a}'",$,b)):b>255&&bA("Expected a small number and instead saw '{a}'",$,b));c==="rgba"&&(bI(","),b=+K.value,(K.type!=="(number)"||b<0||b>1)&&bA("Expected a number between 0 and 1 and instead saw '{a}'",K,b),bI(),K.id==="%"&&(bA("Unexpected '%'."),bI("%"))),bI(")");return!0}if(n[K.value]===!0){bI();return!0}}else if(K.type==="(color)"){bI();return!0}return!1}function cr(){if(K.type==="(string)"){bI();return!0}}function cq(){K.id==="-"&&(bI("-"),bK(),bQ());if(K.type==="(number)"){bI("(number)");return!0}}function cp(){if(K.identifier){bI();return!0}}function co(a){var b=a.value,c=a.line,d=B[b];typeof d=="function"&&(d=!1),d?d[d.length-1]!==c&&d.push(c):(d=[c],B[b]=d)}function cn(a){J&&typeof J[a]!="boolean"&&bA("Unexpected /*member '{a}'.",$,a),typeof I[a]=="number"?I[a]+=1:I[a]=1}function cm(a,b){var c,d=C,e=D,f=X,g=S,h;C=a,S=Object.create(S),bN($,K),h=K;if(K.id==="{"){bI("{");if(K.id!=="}"||$.line!==K.line){D+=N.indent;while(!a&&K.from>D)D+=N.indent;!a&&!ck()&&!f&&N.strict&&v["(context)"]["(global)"]&&bA('Missing "use strict" statement.'),c=cl(),X=f,D-=N.indent,bP()}bI("}",h),D=e}else a?((!b||N.curly)&&bA("Expected '{a}' and instead saw '{b}'.",K,"{",K.value),M=!0,c=[cj()],M=!1):bC("Expected '{a}' and instead saw '{b}'.",K,"{",K.value);v["(verb)"]=null,S=g,C=d,a&&N.noempty&&(!c||c.length===0)&&bA("Empty block.");return c}function cl(c){var d=[],e,f;if(N.adsafe)switch(c){case"script":b||(K.value!=="ADSAFE"||bH(0).id!=="."||bH(1).value!=="id"&&bH(1).value!=="go")&&bC("ADsafe violation: Missing ADSAFE.id or ADSAFE.go.",K),K.value==="ADSAFE"&&bH(0).id==="."&&bH(1).value==="id"&&(b&&bC("ADsafe violation.",K),bI("ADSAFE"),bI("."),bI("id"),bI("("),K.value!==a&&bC("ADsafe violation: id does not match.",K),bI("(string)"),bI(")"),bI(";"),b=!0);break;case"lib":if(K.value==="ADSAFE"){bI("ADSAFE"),bI("."),bI("lib"),bI("("),bI("(string)"),bR(),e=bJ(0),e.id!=="function"&&bC("The second argument to lib must be a function.",e),f=e.funct["(params)"],f=f&&f.join(", "),f&&f!=="lib"&&bC("Expected '{a}' and instead saw '{b}'.",e,"(lib)","("+f+")"),bI(")"),bI(";");return d}bC("ADsafe lib violation.")}while(!K.reach&&K.id!=="(end)")K.id===";"?(bA("Unnecessary semicolon."),bI(";")):d.push(cj());return d}function ck(){if(K.value==="use strict"){X&&bA('Unnecessary "use strict".'),bI(),bI(";"),X=!0,N.newcap=!0,N.undef=!0;return!0}return!1}function cj(a){var b=D,c,d=S,e=K;if(e.id===";")bA("Unnecessary semicolon.",e),bI(";");else{e.identifier&&!e.reserved&&bH().id===":"&&(bI(),bI(":"),S=Object.create(d),bF(e.value,"label"),K.labelled||bA("Label '{a}' on {b} statement.",K,e.value,K.value),bo.test(e.value+":")&&bA("Label '{a}' looks like a javascript url.",e,e.value),K.label=e.value,e=K),a||bP(),c=bJ(0,!0),e.block||(!c||!c.exps?bA("Expected an assignment or function call and instead saw an expression.",$):N.nonew&&c.id==="("&&c.left.id==="new"&&bA("Do not use 'new' for side effects."),K.id!==";"?bB("Missing semicolon.",$.line,$.from+$.value.length):(bK($,K),bI(";"),bN($,K))),D=b,S=d;return c}}function ci(a){var b=0,c;if(K.id===";"&&!M)for(;;){c=bH(b);if(c.reach)return;if(c.id!=="(endline)"){if(c.id==="function"){bA("Inner functions should be listed at the top of the outer function.",c);break}bA("Unreachable '{a}' after '{b}'.",c,c.value,a);break}b+=1}}function ch(a){var b=cg(a);if(b)return b;$.id==="function"&&K.id==="("?bA("Missing name in function statement."):bC("Expected an identifier and instead saw '{a}'.",K,K.value)}function cg(a){if(K.identifier){bI(),N.safe&&h[$.value]?bA("ADsafe violation: '{a}'.",$,$.value):$.reserved&&!N.es5&&(!a||$.value!="undefined")&&bA("Expected an identifier and instead saw '{a}' (a reserved word).",$,$.id);return $.value}}function cf(a,b){var c=bS(a,150);c.led=function(a){N.plusplus?bA("Unexpected use of '{a}'.",this,this.id):(!a.identifier||a.reserved)&&a.id!=="."&&a.id!=="["&&bA("Bad operand.",this),this.left=a;return this};return c}function ce(a){bS(a,20).exps=!0;return b_(a,function(a,b){N.bitwise&&bA("Unexpected use of '{a}'.",b,b.id),bN(Q,$),bN($,K);if(a){if(a.id==="."||a.id==="["||a.identifier&&!a.reserved){bJ(19);return b}a===Y["function"]&&bA("Expected an identifier in an assignment, and instead saw a function invocation.",$);return b}bC("Bad assignment.",b)},20)}function cd(a,b,c){var d=bS(a,c);bW(d),d.led=typeof b=="function"?b:function(a){N.bitwise&&bA("Unexpected use of '{a}'.",this,this.id),this.left=a,this.right=bJ(c);return this};return d}function cc(a,b){bS(a,20).exps=!0;return b_(a,function(a,b){var c;b.left=a,O[a.value]===!1&&S[a.value]["(global)"]===!0?bA("Read only.",a):a["function"]&&bA("'{a}' is a function.",a,a.value);if(N.safe){c=a;do typeof O[c.value]=="boolean"&&bA("ADsafe violation.",c),c=c.left;while(c)}if(a){if(a.id==="."||a.id==="["){(!a.left||a.left.value==="arguments")&&bA("Bad assignment.",b),b.right=bJ(19);return b}if(a.identifier&&!a.reserved){v[a.value]==="exception"&&bA("Do not assign to the exception parameter.",a),b.right=bJ(19);return b}a===Y["function"]&&bA("Expected an identifier in an assignment and instead saw a function invocation.",$)}bC("Bad assignment.",b)},20)}function cb(a){return a&&(a.type==="(number)"&&+a.value===0||a.type==="(string)"&&a.value===""||a.type==="null"&&!N.boss||a.type==="true"||a.type==="false"||a.type==="undefined")}function ca(a,b){var c=bS(a,100);c.led=function(a){bO(Q,$),bN($,K);var c=bJ(100);a&&a.id==="NaN"||c&&c.id==="NaN"?bA("Use the isNaN function to compare with NaN.",this):b&&b.apply(this,[a,c]),a.id==="!"&&bA("Confusing use of '{a}'.",a,"!"),c.id==="!"&&bA("Confusing use of '{a}'.",a,"!"),this.left=a,this.right=c;return this};return c}function b_(a,b,c,d){var e=bS(a,c);bW(e),e.led=function(a){d||(bO(Q,$),bN($,K));if(typeof b=="function")return b(a,this);this.left=a,this.right=bJ(c);return this};return e}function b$(a,b){return bZ(a,function(){typeof b=="function"&&b(this);return this})}function bZ(a,b){var c=bY(a,b);c.identifier=c.reserved=!0;return c}function bY(a,b){var c=bT(a);c.type=a,c.nud=b;return c}function bX(a,b){var c=bS(a,150);bW(c),c.nud=typeof b=="function"?b:function(){this.right=bJ(150),this.arity="unary";if(this.id==="++"||this.id==="--")N.plusplus?bA("Unexpected use of '{a}'.",this,this.id):(!this.right.identifier||this.right.reserved)&&this.right.id!=="."&&this.right.id!=="["&&bA("Bad operand.",this);return this};return c}function bW(a){var b=a.id.charAt(0);if(b>="a"&&b<="z"||b>="A"&&b<="Z")a.identifier=a.reserved=!0;return a}function bV(a,b){var c=bU(a,b);c.block=!0;return c}function bU(a,b){var c=bT(a);c.identifier=c.reserved=!0,c.fud=b;return c}function bT(a){return bS(a,0)}function bS(a,b){var c=Y[a];if(!c||typeof c!="object")Y[a]=c={id:a,lbp:b,value:a};return c}function bR(){$.line!==K.line?N.laxbreak||bA("Bad line breaking before '{a}'.",$,K.id):$.character!==K.from&&N.white&&bA("Unexpected space after '{a}'.",K,$.value),bI(","),bN($,K)}function bQ(a){a=a||$,a.line!==K.line&&bA("Line breaking error '{a}'.",a,a.value)}function bP(a){var b;N.white&&K.id!=="(end)"&&(b=D+(a||0),K.from!==b&&bA("Expected '{a}' to have an indentation at {b} instead at {c}.",K,K.value,b,K.from))}function bO(a,b){a=a||$,b=b||K,!N.laxbreak&&a.line!==b.line?bA("Bad line breaking before '{a}'.",b,b.id):N.white&&(a=a||$,b=b||K,a.character===b.from&&bA("Missing space after '{a}'.",K,a.value))}function bN(a,b){N.white&&(a=a||$,b=b||K,a.line===b.line&&a.character===b.from&&bA("Missing space after '{a}'.",K,a.value))}function bM(a,b){a=a||$,b=b||K,N.white&&!a.comment&&a.line===b.line&&bK(a,b)}function bL(a,b){a=a||$,b=b||K,N.white&&(a.character!==b.from||a.line!==b.line)&&bA("Unexpected space before '{a}'.",b,b.value)}function bK(a,b){a=a||$,b=b||K,(N.white||bd==="styleproperty"||bd==="style")&&a.character!==b.from&&a.line===b.line&&bA("Unexpected space after '{a}'.",b,a.value)}function bJ(a,b){var c;K.id==="(end)"&&bC("Unexpected early end of program.",$),bI(),N.safe&&typeof O[$.value]=="boolean"&&K.id!=="("&&K.id!=="."&&bA("ADsafe violation.",$),b&&(e="anonymous",v["(verb)"]=$.value);if(b===!0&&$.fud)c=$.fud();else{if($.nud)c=$.nud();else{if(K.type==="(number)"&&$.id==="."){bA("A leading decimal point can be confused with a dot: '.{a}'.",$,K.value),bI();return $}bC("Expected an identifier and instead saw '{a}'.",$,$.id)}while(a=N.maxerr&&bz("Too many errors.",i,h);return j}function bz(a,b,c){throw{name:"JSHintError",line:b,character:c,message:a+" ("+Math.floor(b/G.length*100)+"% scanned)."}}function by(){N.safe||(N.couch&&bx(O,k),N.rhino&&bx(O,R),N.node&&bx(O,L),N.devel&&bx(O,t),N.browser&&bx(O,j),N.jquery&&bx(O,F),N.windows&&bx(O,bc),N.widget&&bx(O,bb))}function bx(a,b){var c;for(c in b)bw(b,c)&&(a[c]=b[c])}function bw(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function bv(){}"use strict";var a,b,c,e,f,g={"<":!0,"<=":!0,"==":!0,"===":!0,"!==":!0,"!=":!0,">":!0,">=":!0,"+":!0,"-":!0,"*":!0,"/":!0,"%":!0},h={arguments:!0,callee:!0,caller:!0,constructor:!0,eval:!0,prototype:!0,stack:!0,unwatch:!0,valueOf:!0,watch:!0},i={adsafe:!0,bitwise:!0,boss:!0,browser:!0,cap:!0,couch:!0,css:!0,curly:!0,debug:!0,devel:!0,eqeqeq:!0,es5:!0,evil:!0,forin:!0,fragment:!0,immed:!0,jquery:!0,laxbreak:!0,newcap:!0,noarg:!0,node:!0,noempty:!0,nonew:!0,nomen:!0,on:!0,onevar:!0,passfail:!0,plusplus:!0,regexp:!0,rhino:!0,undef:!0,safe:!0,windows:!0,strict:!0,sub:!0,white:!0,widget:!0},j={addEventListener:!1,applicationCache:!1,blur:!1,clearInterval:!1,clearTimeout:!1,close:!1,closed:!1,defaultStatus:!1,document:!1,event:!1,FileReader:!1,focus:!1,frames:!1,getComputedStyle:!1,history:!1,Image:!1,length:!1,localStorage:!1,location:!1,moveBy:!1,moveTo:!1,name:!1,navigator:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,openDatabase:!1,opener:!1,Option:!1,parent:!1,print:!1,removeEventListener:!1,resizeBy:!1,resizeTo:!1,screen:!1,scroll:!1,scrollBy:!1,scrollTo:!1,setInterval:!1,setTimeout:!1,status:!1,top:!1,WebSocket:!1,window:!1,Worker:!1,XMLHttpRequest:!1},k={require:!1,respond:!1,getRow:!1,emit:!1,send:!1,start:!1,sum:!1,log:!1,exports:!1,module:!1},l,m,n={aliceblue:!0,antiquewhite:!0,aqua:!0,aquamarine:!0,azure:!0,beige:!0,bisque:!0,black:!0,blanchedalmond:!0,blue:!0,blueviolet:!0,brown:!0,burlywood:!0,cadetblue:!0,chartreuse:!0,chocolate:!0,coral:!0,cornflowerblue:!0,cornsilk:!0,crimson:!0,cyan:!0,darkblue:!0,darkcyan:!0,darkgoldenrod:!0,darkgray:!0,darkgreen:!0,darkkhaki:!0,darkmagenta:!0,darkolivegreen:!0,darkorange:!0,darkorchid:!0,darkred:!0,darksalmon:!0,darkseagreen:!0,darkslateblue:!0,darkslategray:!0,darkturquoise:!0,darkviolet:!0,deeppink:!0,deepskyblue:!0,dimgray:!0,dodgerblue:!0,firebrick:!0,floralwhite:!0,forestgreen:!0,fuchsia:!0,gainsboro:!0,ghostwhite:!0,gold:!0,goldenrod:!0,gray:!0,green:!0,greenyellow:!0,honeydew:!0,hotpink:!0,indianred:!0,indigo:!0,ivory:!0,khaki:!0,lavender:!0,lavenderblush:!0,lawngreen:!0,lemonchiffon:!0,lightblue:!0,lightcoral:!0,lightcyan:!0,lightgoldenrodyellow:!0,lightgreen:!0,lightpink:!0,lightsalmon:!0,lightseagreen:!0,lightskyblue:!0,lightslategray:!0,lightsteelblue:!0,lightyellow:!0,lime:!0,limegreen:!0,linen:!0,magenta:!0,maroon:!0,mediumaquamarine:!0,mediumblue:!0,mediumorchid:!0,mediumpurple:!0,mediumseagreen:!0,mediumslateblue:!0,mediumspringgreen:!0,mediumturquoise:!0,mediumvioletred:!0,midnightblue:!0,mintcream:!0,mistyrose:!0,moccasin:!0,navajowhite:!0,navy:!0,oldlace:!0,olive:!0,olivedrab:!0,orange:!0,orangered:!0,orchid:!0,palegoldenrod:!0,palegreen:!0,paleturquoise:!0,palevioletred:!0,papayawhip:!0,peachpuff:!0,peru:!0,pink:!0,plum:!0,powderblue:!0,purple:!0,red:!0,rosybrown:!0,royalblue:!0,saddlebrown:!0,salmon:!0,sandybrown:!0,seagreen:!0,seashell:!0,sienna:!0,silver:!0,skyblue:!0,slateblue:!0,slategray:!0,snow:!0,springgreen:!0,steelblue:!0,tan:!0,teal:!0,thistle:!0,tomato:!0,turquoise:!0,violet:!0,wheat:!0,white:!0,whitesmoke:!0,yellow:!0,yellowgreen:!0,activeborder:!0,activecaption:!0,appworkspace:!0,background:!0,buttonface:!0,buttonhighlight:!0,buttonshadow:!0,buttontext:!0,captiontext:!0,graytext:!0,highlight:!0,highlighttext:!0,inactiveborder:!0,inactivecaption:!0,inactivecaptiontext:!0,infobackground:!0,infotext:!0,menu:!0,menutext:!0,scrollbar:!0,threeddarkshadow:!0,threedface:!0,threedhighlight:!0,threedlightshadow:!0,threedshadow:!0,window:!0,windowframe:!0,windowtext:!0},o,p,q={"%":!0,cm:!0,em:!0,ex:!0,"in":!0,mm:!0,pc:!0,pt:!0,px:!0},r,s,t={alert:!1,confirm:!1,console:!1,Debug:!1,opera:!1,prompt:!1},u={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"/":"\\/","\\":"\\\\"},v,w=["closure","exception","global","label","outer","unused","var"],x,y,z={a:{},abbr:{},acronym:{},address:{},applet:{},area:{empty:!0,parent:" map "},article:{},aside:{},audio:{},b:{},base:{empty:!0,parent:" head "},bdo:{},big:{},blockquote:{},body:{parent:" html noframes "},br:{empty:!0},button:{},canvas:{parent:" body p div th td "},caption:{parent:" table "},center:{},cite:{},code:{},col:{empty:!0,parent:" table colgroup "},colgroup:{parent:" table "},command:{parent:" menu "},datalist:{},dd:{parent:" dl "},del:{},details:{},dialog:{},dfn:{},dir:{},div:{},dl:{},dt:{parent:" dl "},em:{},embed:{},fieldset:{},figure:{},font:{},footer:{},form:{},frame:{empty:!0,parent:" frameset "},frameset:{parent:" html frameset "},h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},head:{parent:" html "},header:{},hgroup:{},hr:{empty:!0},"hta:application":{empty:!0,parent:" head "},html:{parent:"*"},i:{},iframe:{},img:{empty:!0},input:{empty:!0},ins:{},kbd:{},keygen:{},label:{},legend:{parent:" details fieldset figure "},li:{parent:" dir menu ol ul "},link:{empty:!0,parent:" head "},map:{},mark:{},menu:{},meta:{empty:!0,parent:" head noframes noscript "},meter:{},nav:{},noframes:{parent:" html body "},noscript:{parent:" body head noframes "},object:{},ol:{},optgroup:{parent:" select "},option:{parent:" optgroup select "},output:{},p:{},param:{empty:!0,parent:" applet object "},pre:{},progress:{},q:{},rp:{},rt:{},ruby:{},samp:{},script:{empty:!0,parent:" body div frame head iframe p pre span "},section:{},select:{},small:{},span:{},source:{},strong:{},style:{parent:" head ",empty:!0},sub:{},sup:{},table:{},tbody:{parent:" table "},td:{parent:" tr "},textarea:{},tfoot:{parent:" table "},th:{parent:" tr "},thead:{parent:" table "},time:{},title:{parent:" head "},tr:{parent:" table tbody thead tfoot "},tt:{},u:{},ul:{},"var":{},video:{}},A,B,C,D,E,F={$:!1,jQuery:!1},G,H,I,J,K,L={__filename:!1,__dirname:!1,Buffer:!1,GLOBAL:!1,global:!1,module:!1,process:!1,require:!1},M,N,O,P,Q,R={defineClass:!1,deserialize:!1,gc:!1,help:!1,load:!1,loadClass:!1,print:!1,quit:!1,readFile:!1,readUrl:!1,runCommand:!1,seal:!1,serialize:!1,spawn:!1,sync:!1,toint32:!1,version:!1},S,T,U,V={Array:!1,Boolean:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,eval:!1,EvalError:!1,Function:!1,hasOwnProperty:!1,isFinite:!1,isNaN:!1,JSON:!1,Math:!1,Number:!1,Object:!1,parseInt:!1,parseFloat:!1,RangeError:!1,ReferenceError:!1,RegExp:!1,String:!1,SyntaxError:!1,TypeError:!1,URIError:!1},W={E:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,MAX_VALUE:!0,MIN_VALUE:!0,NEGATIVE_INFINITY:!0,PI:!0,POSITIVE_INFINITY:!0,SQRT1_2:!0,SQRT2:!0},X,Y={},Z,$,_,ba,bb={alert:!0,animator:!0,appleScript:!0,beep:!0,bytesToUIString:!0,Canvas:!0,chooseColor:!0,chooseFile:!0,chooseFolder:!0,closeWidget:!0,COM:!0,convertPathToHFS:!0,convertPathToPlatform:!0,CustomAnimation:!0,escape:!0,FadeAnimation:!0,filesystem:!0,Flash:!0,focusWidget:!0,form:!0,FormField:!0,Frame:!0,HotKey:!0,Image:!0,include:!0,isApplicationRunning:!0,iTunes:!0,konfabulatorVersion:!0,log:!0,md5:!0,MenuItem:!0,MoveAnimation:!0,openURL:!0,play:!0,Point:!0,popupMenu:!0,preferenceGroups:!0,preferences:!0,print:!0,prompt:!0,random:!0,Rectangle:!0,reloadWidget:!0,ResizeAnimation:!0,resolvePath:!0,resumeUpdates:!0,RotateAnimation:!0,runCommand:!0,runCommandInBg:!0,saveAs:!0,savePreferences:!0,screen:!0,ScrollBar:!0,showWidgetPreferences:!0,sleep:!0,speak:!0,Style:!0,suppressUpdates:!0,system:!0,tellWidget:!0,Text:!0,TextArea:!0,Timer:!0,unescape:!0,updateNow:!0,URL:!0,Web:!0,widget:!0,Window:!0,XMLDOM:!0,XMLHttpRequest:!0,yahooCheckLogin:!0,yahooLogin:!0,yahooLogout:!0},bc={ActiveXObject:!1,CScript:!1,Debug:!1,Enumerator:!1,System:!1,VBArray:!1,WScript:!1},bd,be,bf=/@cc|<\/?|script|\]\s*\]|<\s*!|</i,bg=/[\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/,bh=/^\s*([(){}\[.,:;'"~\?\]#@]|==?=?|\/(\*(jshint|members?|global)?|=|\/)?|\*[\/=]?|\+(?:=|\++)?|-(?:=|-+)?|%=?|&[&=]?|\|[|=]?|>>?>?=?|<([\/=!]|\!(\[|--)?|<=?)?|\^=?|\!=?=?|[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+([xX][0-9a-fA-F]+|\.[0-9]*)?([eE][+\-]?[0-9]+)?)/,bi=/^\s*(['"=>\/&#]|<(?:\/|\!(?:--)?)?|[a-zA-Z][a-zA-Z0-9_\-:]*|[0-9]+|--)/,bj=/[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/,bk=/[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,bl=/[>&]|<[\/!]?|--/,bm=/\*\/|\/\*/,bn=/^([a-zA-Z_$][a-zA-Z0-9_$]*)$/,bo=/^(?:javascript|jscript|ecmascript|vbscript|mocha|livescript)\s*:/i,bp=/&|\+|\u00AD|\.\.|\/\*|%[^;]|base64|url|expression|data|mailto/i,bq=/^\s*([{:#%.=,>+\[\]@()"';]|\*=?|\$=|\|=|\^=|~=|[a-zA-Z_][a-zA-Z0-9_\-]*|[0-9]+|<\/|\/\*)/,br=/^\s*([@#!"'};:\-%.=,+\[\]()*_]|[a-zA-Z][a-zA-Z0-9._\-]*|\/\*?|\d+(?:\.\d+)?|<\/)/,bs=/[^a-zA-Z0-9+\-_\/ ]/,bt=/[\[\]\/\\"'*<>.&:(){}+=#]/,bu={outer:bi,html:bi,style:bq,styleproperty:br};typeof Array.isArray!="function"&&(Array.isArray=function(a){return Object.prototype.toString.apply(a)==="[object Array]"}),typeof Object.create!="function"&&(Object.create=function(a){bv.prototype=a;return new bv}),typeof Object.keys!="function"&&(Object.keys=function(a){var b=[],c;for(c in a)bw(a,c)&&b.push(c);return b}),typeof String.prototype.entityify!="function"&&(String.prototype.entityify=function(){return this.replace(/&/g,"&").replace(//g,">")}),typeof String.prototype.isAlpha!="function"&&(String.prototype.isAlpha=function(){return this>="a"&&this<="z￿"||this>="A"&&this<="Z￿"}),typeof String.prototype.isDigit!="function"&&(String.prototype.isDigit=function(){return this>="0"&&this<="9"}),typeof String.prototype.supplant!="function"&&(String.prototype.supplant=function(a){return this.replace(/\{([^{}]*)\}/g,function(b,c){var d=a[c];return typeof d=="string"||typeof d=="number"?d:b})}),typeof String.prototype.name!="function"&&(String.prototype.name=function(){if(bn.test(this))return this;if(bj.test(this))return'"'+this.replace(bk,function(a){var b=u[a];if(b)return b;return"\\u"+("0000"+a.charCodeAt().toString(16)).slice(-4)})+'"';return'"'+this+'"'});var bE=function bE(){function f(d,e){var f,g;d==="(color)"||d==="(range)"?g={type:d}:d==="(punctuator)"||d==="(identifier)"&&bw(Y,e)?g=Y[e]||Y["(error)"]:g=Y[d],g=Object.create(g),(d==="(string)"||d==="(range)")&&bo.test(e)&&bB("Script URL.",c,b),d==="(identifier)"&&(g.identifier=!0,e==="__iterator__"||e==="__proto__"?bD("Reserved name '{a}'.",c,b,e):N.nomen&&(e.charAt(0)==="_"||e.charAt(e.length-1)==="_")&&bB("Unexpected {a} in '{b}'.",c,b,"dangling '_'",e)),g.value=e,g.line=c,g.character=a,g.from=b,f=g.id,f!=="(endline)"&&(P=f&&("(,=:[!&|?{};".indexOf(f.charAt(f.length-1))>=0||f==="return"));return g}function e(){var b;if(c>=G.length)return!1;a=1,d=G[c],c+=1,b=d.search(/ \t/),b>=0&&bB("Mixed spaces and tabs.",c,b+1),d=d.replace(/\t/g,Z),b=d.search(bg),b>=0&&bB("Unsafe character.",c,b),N.maxlen&&N.maxlen=32&&e<=126&&e!==34&&e!==92&&e!==39&&bB("Unnecessary escapement.",c,a),a+=b,h=String.fromCharCode(e)}var h,i,j="";E&&g!=='"'&&bB("Strings must use doublequote.",c,a);if(be===g||bd==="scriptstring"&&!be)return f("(punctuator)",g);i=0;for(;;){while(i>=d.length)i=0,(bd!=="html"||!e())&&bD("Unclosed string.",c,b);h=d.charAt(i);if(h===g){a+=1,d=d.substr(i+1);return f("(string)",j,g)}if(h<" "){if(h==="\n"||h==="\r")break;bB("Control character in string: {a}.",c,a+i,d.slice(0,i))}else if(h===be)bB("Bad HTML string",c,a+i);else if(h==="<")N.safe&&bd==="html"?bB("ADsafe string violation.",c,a+i):d.charAt(i+1)==="/"&&(bd||N.safe)?bB("Expected '<\\/' and instead saw '0){a+=1,d=d.slice(m);break}if(!e())return f("(end)","")}q=r(bu[bd]||bh);if(!q){q="",h="";while(d&&d<"!")d=d.substr(1);if(d){if(bd==="html")return f("(error)",d.charAt(0));bD("Unexpected '{a}'.",c,a,d.substr(0,1))}}else{if(h.isAlpha()||h==="_"||h==="$")return f("(identifier)",q);if(h.isDigit()){bd!=="style"&&!isFinite(Number(q))&&bB("Bad number '{a}'.",c,a,q),bd!=="style"&&bd!=="styleproperty"&&d.substr(0,1).isAlpha()&&bB("Missing space after '{a}'.",c,a,q),h==="0"&&(j=q.substr(1,1),j.isDigit()?$.id!=="."&&bd!=="styleproperty"&&bB("Don't use extra leading zeros '{a}'.",c,a,q):E&&(j==="x"||j==="X")&&bB("Avoid 0x-. '{a}'.",c,a,q)),q.substr(q.length-1)==="."&&bB("A trailing decimal point can be confused with a dot '{a}'.",c,a,q);return f("(number)",q)}switch(q){case'"':case"'":return s(q);case"//":T||bd&&bd!=="script"?bB("Unexpected comment.",c,a):bd==="script"&&/<\s*\//i.test(d)?bB("Unexpected =0)break;e()?N.safe&&bf.test(d)&&bB("ADsafe comment violation.",c,a):bD("Unclosed comment.",c,a)}a+=m+2,d.substr(m,1)==="/"&&bD("Nested comment.",c,a),d=d.substr(m+2),$.comment=!0;break;case"/*members":case"/*member":case"/*jshint":case"/*global":case"*/":return{value:q,type:"special",line:c,character:a,from:b};case"":break;case"/":$.id==="/="&&bD("A regular expression literal can be confused with '/='.",c,b);if(P){k=0,i=0,n=0;for(;;){g=!0,h=d.charAt(n),n+=1;switch(h){case"":bD("Unclosed regular expression.",c,b);return;case"/":k>0&&bB("Unescaped '{a}'.",c,b+n,"/"),h=d.substr(0,n-1),p={g:!0,i:!0,m:!0};while(p[d.charAt(n)]===!0)p[d.charAt(n)]=!1,n+=1;a+=n,d=d.substr(n),p=d.charAt(0),(p==="/"||p==="*")&&bD("Confusing regular expression.",c,b);return f("(regexp)",h);case"\\":h=d.charAt(n),h<" "?bB("Unexpected control character in regular expression.",c,b+n):h==="<"&&bB("Unexpected escaped character '{a}' in regular expression.",c,b+n,h),n+=1;break;case"(":k+=1,g=!1;if(d.charAt(n)==="?"){n+=1;switch(d.charAt(n)){case":":case"=":case"!":n+=1;break;default:bB("Expected '{a}' and instead saw '{b}'.",c,b+n,":",d.charAt(n))}}else i+=1;break;case"|":g=!1;break;case")":k===0?bB("Unescaped '{a}'.",c,b+n,")"):k-=1;break;case" ":p=1;while(d.charAt(n)===" ")n+=1,p+=1;p>1&&bB("Spaces are hard to count. Use {{a}}.",c,b+n,p);break;case"[":h=d.charAt(n),h==="^"&&(n+=1,N.regexp?bB("Insecure '{a}'.",c,b+n,h):d.charAt(n)==="]"&&bD("Unescaped '{a}'.",c,b+n,"^")),p=!1,h==="]"&&(bB("Empty class.",c,b+n-1),p=!0);klass:do{h=d.charAt(n),n+=1;switch(h){case"[":case"^":bB("Unescaped '{a}'.",c,b+n,h),p=!0;break;case"-":p?p=!1:(bB("Unescaped '{a}'.",c,b+n,"-"),p=!0);break;case"]":p||bB("Unescaped '{a}'.",c,b+n-1,"-");break klass;case"\\":h=d.charAt(n),h<" "?bB("Unexpected control character in regular expression.",c,b+n):h==="<"&&bB("Unexpected escaped character '{a}' in regular expression.",c,b+n,h),n+=1,p=!0;break;case"/":bB("Unescaped '{a}'.",c,b+n-1,"/"),p=!0;break;case"<":bd==="script"&&(h=d.charAt(n),(h==="!"||h==="/")&&bB("HTML confusion in regular expression '<{a}'.",c,b+n,h)),p=!0;break;default:p=!0}}while(h);break;case".":N.regexp&&bB("Insecure '{a}'.",c,b+n,h);break;case"]":case"?":case"{":case"}":case"+":case"*":bB("Unescaped '{a}'.",c,b+n,h);break;case"<":bd==="script"&&(h=d.charAt(n),(h==="!"||h==="/")&&bB("HTML confusion in regular expression '<{a}'.",c,b+n,h))}if(g)switch(d.charAt(n)){case"?":case"+":case"*":n+=1,d.charAt(n)==="?"&&(n+=1);break;case"{":n+=1,h=d.charAt(n),(h<"0"||h>"9")&&bB("Expected a number and instead saw '{a}'.",c,b+n,h),n+=1,o=+h;for(;;){h=d.charAt(n);if(h<"0"||h>"9")break;n+=1,o=+h+o*10}l=o;if(h===","){n+=1,l=Infinity,h=d.charAt(n);if(h>="0"&&h<="9"){n+=1,l=+h;for(;;){h=d.charAt(n);if(h<"0"||h>"9")break;n+=1,l=+h+l*10}}}d.charAt(n)!=="}"?bB("Expected '{a}' and instead saw '{b}'.",c,b+n,"}",h):n+=1,d.charAt(n)==="?"&&(n+=1),o>l&&bB("'{a}' should not be greater than '{b}'.",c,b+n,o,l)}}h=d.substr(0,n-1),a+=n,d=d.substr(n);return f("(regexp)",h)}return f("(punctuator)",q);case".",c,a),a+=3,d=d.slice(m+3);break;case"#":if(bd==="html"||bd==="styleproperty"){for(;;){h=d.charAt(0);if((h<"0"||h>"9")&&(h<"a"||h>"f")&&(h<"A"||h>"F"))break;a+=1,d=d.substr(1),q+=h}q.length!==4&&q.length!==7&&bB("Bad hex color '{a}'.",c,b+n,q);return f("(color)",q)}return f("(punctuator)",q);default:if(bd==="outer"&&h==="&"){a+=1,d=d.substr(1);for(;;){h=d.charAt(0),a+=1,d=d.substr(1);if(h===";")break;h>="0"&&h<="9"||h>="a"&&h<="z"||h==="#"||bD("Bad entity",c,b+n,a)}break}return f("(punctuator)",q)}}}}}}();m=[cB,function(){for(;;)if(K.identifier)switch(K.value.toLowerCase()){case"url":cB();break;case"expression":bA("Unexpected expression '{a}'.",K,K.value),bI();break;default:bI()}else{if(K.id===";"||K.id==="!"||K.id==="(end)"||K.id==="}")return!0;bI()}}],o=["none","dashed","dotted","double","groove","hidden","inset","outset","ridge","solid"],p=["auto","always","avoid","left","right"],r={all:!0,braille:!0,embossed:!0,handheld:!0,print:!0,projection:!0,screen:!0,speech:!0,tty:!0,tv:!0},s=["auto","hidden","scroll","visible"],l={background:[!0,"background-attachment","background-color","background-image","background-position","background-repeat"],"background-attachment":["scroll","fixed"],"background-color":["transparent",cs],"background-image":["none",cB],"background-position":[2,[ct,"top","bottom","left","right","center"]],"background-repeat":["repeat","repeat-x","repeat-y","no-repeat"],border:[!0,"border-color","border-style","border-width"],"border-bottom":[!0,"border-bottom-color","border-bottom-style","border-bottom-width"],"border-bottom-color":cs,"border-bottom-style":o,"border-bottom-width":cv,"border-collapse":["collapse","separate"],"border-color":["transparent",4,cs],"border-left":[!0,"border-left-color","border-left-style","border-left-width"],"border-left-color":cs,"border-left-style":o,"border-left-width":cv,"border-right":[!0,"border-right-color","border-right-style","border-right-width"],"border-right-color":cs,"border-right-style":o,"border-right-width":cv,"border-spacing":[2,ct],"border-style":[4,o],"border-top":[!0,"border-top-color","border-top-style","border-top-width"],"border-top-color":cs,"border-top-style":o,"border-top-width":cv,"border-width":[4,cv],bottom:[ct,"auto"],"caption-side":["bottom","left","right","top"],clear:["both","left","none","right"],clip:[cA,"auto"],color:cs,content:["open-quote","close-quote","no-open-quote","no-close-quote",cr,cB,cz,cx],"counter-increment":[cp,"none"],"counter-reset":[cp,"none"],cursor:[cB,"auto","crosshair","default","e-resize","help","move","n-resize","ne-resize","nw-resize","pointer","s-resize","se-resize","sw-resize","w-resize","text","wait"],direction:["ltr","rtl"],display:["block","compact","inline","inline-block","inline-table","list-item","marker","none","run-in","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group"],"empty-cells":["show","hide"],"float":["left","none","right"],font:["caption","icon","menu","message-box","small-caption","status-bar",!0,"font-size","font-style","font-weight","font-family"],"font-family":cy,"font-size":["xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller",ct],"font-size-adjust":["none",cq],"font-stretch":["normal","wider","narrower","ultra-condensed","extra-condensed","condensed","semi-condensed","semi-expanded","expanded","extra-expanded"],"font-style":["normal","italic","oblique"],"font-variant":["normal","small-caps"],"font-weight":["normal","bold","bolder","lighter",cq],height:[ct,"auto"],left:[ct,"auto"],"letter-spacing":["normal",ct],"line-height":["normal",cu],"list-style":[!0,"list-style-image","list-style-position","list-style-type"],"list-style-image":["none",cB],"list-style-position":["inside","outside"],"list-style-type":["circle","disc","square","decimal","decimal-leading-zero","lower-roman","upper-roman","lower-greek","lower-alpha","lower-latin","upper-alpha","upper-latin","hebrew","katakana","hiragana-iroha","katakana-oroha","none"],margin:[4,cw],"margin-bottom":cw,"margin-left":cw,"margin-right":cw,"margin-top":cw,"marker-offset":[ct,"auto"],"max-height":[ct,"none"],"max-width":[ct,"none"],"min-height":ct,"min-width":ct,opacity:cq,outline:[!0,"outline-color","outline-style","outline-width"],"outline-color":["invert",cs],"outline-style":["dashed","dotted","double","groove","inset","none","outset","ridge","solid"],"outline-width":cv,overflow:s,"overflow-x":s,"overflow-y":s,padding:[4,ct],"padding-bottom":ct,"padding-left":ct,"padding-right":ct,"padding-top":ct,"page-break-after":p,"page-break-before":p,position:["absolute","fixed","relative","static"],quotes:[8,cr],right:[ct,"auto"],"table-layout":["auto","fixed"],"text-align":["center","justify","left","right"],"text-decoration":["none","underline","overline","line-through","blink"],"text-indent":ct,"text-shadow":["none",4,[cs,ct]],"text-transform":["capitalize","uppercase","lowercase","none"],top:[ct,"auto"],"unicode-bidi":["normal","embed","bidi-override"],"vertical-align":["baseline","bottom","sub","super","top","text-top","middle","text-bottom",ct],visibility:["visible","hidden","collapse"],"white-space":["normal","nowrap","pre","pre-line","pre-wrap","inherit"],width:[ct,"auto"],"word-spacing":["normal",ct],"word-wrap":["break-word","normal"],"z-index":["auto",cq]},bY("(number)",function(){return this}),bY("(string)",function(){return this}),Y["(identifier)"]={type:"(identifier)",lbp:0,identifier:!0,nud:function(){var a=this.value,b=S[a],c;typeof b=="function"?b=undefined:typeof b=="boolean"&&(c=v,v=x[0],bF(a,"var"),b=v,v=c);if(v===b)switch(v[a]){case"unused":v[a]="var";break;case"unction":v[a]="function",this["function"]=!0;break;case"function":this["function"]=!0;break;case"label":bA("'{a}' is a statement label.",$,a)}else if(v["(global)"])e!="typeof"&&e!="delete"&&N.undef&&typeof O[a]!="boolean"&&bA("'{a}' is not defined.",$,a),co($);else switch(v[a]){case"closure":case"function":case"var":case"unused":bA("'{a}' used out of scope.",$,a);break;case"label":bA("'{a}' is a statement label.",$,a);break;case"outer":case"global":break;default:if(b===!0)v[a]=!0;else if(b===null)bA("'{a}' is not allowed.",$,a),co($);else if(typeof b!="object")e!="typeof"&&e!="delete"&&N.undef?bA("'{a}' is not defined.",$,a):v[a]=!0,co($);else switch(b[a]){case"function":case"unction":this["function"]=!0,b[a]="closure",v[a]=b["(global)"]?"global":"outer";break;case"var":case"unused":b[a]="closure",v[a]=b["(global)"]?"global":"outer";break;case"closure":case"parameter":v[a]=b["(global)"]?"global":"outer";break;case"label":bA("'{a}' is a statement label.",$,a)}}return this},led:function(){bC("Expected an operator and instead saw '{a}'.",K,K.value)}},bY("(regexp)",function(){return this}),bT("(endline)"),bT("(begin)"),bT("(end)").reach=!0,bT(""),bT("(error)").reach=!0,bT("}").reach=!0,bT(")"),bT("]"),bT('"').reach=!0,bT("'").reach=!0,bT(";"),bT(":").reach=!0,bT(","),bT("#"),bT("@"),bZ("else"),bZ("case").reach=!0,bZ("catch"),bZ("default").reach=!0,bZ("finally"),b$("arguments",function(a){X&&v["(global)"]?bA("Strict violation.",a):N.safe&&bA("ADsafe violation.",a)}),b$("eval",function(a){N.safe&&bA("ADsafe violation.",a)}),b$("false"),b$("Infinity"),b$("NaN"),b$("null"),b$("this",function(a){X&&(v["(statement)"]&&v["(name)"].charAt(0)>"Z"||v["(global)"])?bA("Strict violation.",a):N.safe&&bA("ADsafe violation.",a)}),b$("true"),b$("undefined"),cc("=","assign",20),cc("+=","assignadd",20),cc("-=","assignsub",20),cc("*=","assignmult",20),cc("/=","assigndiv",20).nud=function(){bC("A regular expression literal can be confused with '/='.")},cc("%=","assignmod",20),ce("&=","assignbitand",20),ce("|=","assignbitor",20),ce("^=","assignbitxor",20),ce("<<=","assignshiftleft",20),ce(">>=","assignshiftright",20),ce(">>>=","assignshiftrightunsigned",20),b_("?",function(a,b){b.left=a,b.right=bJ(10),bI(":"),b["else"]=bJ(10);return b},30),b_("||","or",40),b_("&&","and",50),cd("|","bitor",70),cd("^","bitxor",80),cd("&","bitand",90),ca("==",function(a,b){N.eqeqeq?bA("Expected '{a}' and instead saw '{b}'.",this,"===","=="):cb(a)?bA("Use '{a}' to compare with '{b}'.",this,"===",a.value):cb(b)&&bA("Use '{a}' to compare with '{b}'.",this,"===",b.value);return this}),ca("==="),ca("!=",function(a,b){N.eqeqeq?bA("Expected '{a}' and instead saw '{b}'.",this,"!==","!="):cb(a)?bA("Use '{a}' to compare with '{b}'.",this,"!==",a.value):cb(b)&&bA("Use '{a}' to compare with '{b}'.",this,"!==",b.value);return this}),ca("!=="),ca("<"),ca(">"),ca("<="),ca(">="),cd("<<","shiftleft",120),cd(">>","shiftright",120),cd(">>>","shiftrightunsigned",120),b_("in","in",120),b_("instanceof","instanceof",120),b_("+",function(a,b){var c=bJ(130);if(a&&c&&a.id==="(string)"&&c.id==="(string)"){a.value+=c.value,a.character=c.character,bo.test(a.value)&&bA("JavaScript URL.",a);return a}b.left=a,b.right=c;return b},130),bX("+","num"),bX("+++",function(){bA("Confusing pluses."),this.right=bJ(150),this.arity="unary";return this}),b_("+++",function(a){bA("Confusing pluses."),this.left=a,this.right=bJ(130);return this},130),b_("-","sub",130),bX("-","neg"),bX("---",function(){bA("Confusing minuses."),this.right=bJ(150),this.arity="unary";return this}),b_("---",function(a){bA("Confusing minuses."),this.left=a,this.right=bJ(130);return this},130),b_("*","mult",140),b_("/","div",140),b_("%","mod",140),cf("++","postinc"),bX("++","preinc"),Y["++"].exps=!0,cf("--","postdec"),bX("--","predec"),Y["--"].exps=!0,bX("delete",function(){var a=bJ(0);(!a||a.id!=="."&&a.id!=="[")&&bA("Variables should not be deleted."),this.first=a;return this}).exps=!0,bX("~",function(){N.bitwise&&bA("Unexpected '{a}'.",this,"~"),bJ(150);return this}),bX("!",function(){this.right=bJ(150),this.arity="unary",g[this.right.id]===!0&&bA("Confusing use of '{a}'.",this,"!");return this}),bX("typeof","typeof"),bX("new",function(){var a=bJ(155),b;if(a&&a.id!=="function")if(a.identifier){a["new"]=!0;switch(a.value){case"Object":bA("Use the object literal notation {}.",$);break;case"Array":K.id!=="("?bA("Use the array literal notation [].",$):(bI("("),K.id===")"&&bA("Use the array literal notation [].",$),bI(")")),this.first=a;return this;case"Number":case"String":case"Boolean":case"Math":case"JSON":bA("Do not use {a} as a constructor.",$,a.value);break;case"Function":N.evil||bA("The Function constructor is eval.");break;case"Date":case"RegExp":break;default:a.id!=="function"&&(b=a.value.substr(0,1),N.newcap&&(b<"A"||b>"Z")&&bA("A constructor name should start with an uppercase letter.",$))}}else a.id!=="."&&a.id!=="["&&a.id!=="("&&bA("Bad constructor.",$);else bA("Weird construction. Delete 'new'.",this);bK($,K),K.id!=="("&&bA("Missing '()' invoking a constructor."),this.first=a;return this}),Y["new"].exps=!0,b_(".",function(d,e){bK(Q,$),bL();var f=ch();typeof f=="string"&&cn(f),e.left=d,e.right=f,N.noarg&&d&&d.value==="arguments"&&(f==="callee"||f==="caller")?bA("Avoid arguments.{a}.",d,f):!N.evil&&d&&d.value==="document"&&(f==="write"||f==="writeln")?bA("document.write can be a form of eval.",d):N.adsafe&&d&&d.value==="ADSAFE"&&(f==="id"||f==="lib"?bA("ADsafe violation.",e):f==="go"&&(bd!=="script"?bA("ADsafe violation.",e):(c||K.id!=="("||bH(0).id!=="(string)"||bH(0).value!==a||bH(1).id!==",")&&bC("ADsafe violation: go.",e),c=!0,b=!1));if(!!N.evil||f!=="eval"&&f!=="execScript"){if(N.safe)for(;;){h[f]===!0&&bA("ADsafe restricted word '{a}'.",$,f);if(typeof O[d.value]!="boolean"||K.id==="(")break;if(W[f]===!0){K.id==="."&&bA("ADsafe violation.",e);break}if(K.id!=="."){bA("ADsafe violation.",e);break}bI("."),$.left=e,$.right=f,e=$,f=ch(),typeof f=="string"&&cn(f)}}else bA("eval is evil.");return e},160,!0),b_("(",function(a,b){Q.id!=="}"&&Q.id!==")"&&bL(Q,$),bM(),N.immed&&!a.immed&&a.id==="function"&&bA("Wrap an immediate function invocation in parentheses to assist the reader in understanding that the expression is the result of a function, and not the function itself.");var c=0,d=[];a&&(a.type==="(identifier)"?a.value.match(/^[A-Z]([A-Z0-9_$]*[a-z][A-Za-z0-9_$]*)?$/)&&a.value!=="Number"&&a.value!=="String"&&a.value!=="Boolean"&&a.value!=="Date"&&(a.value==="Math"?bA("Math is not a function.",a):N.newcap&&bA("Missing 'new' prefix when invoking a constructor.",a)):a.id==="."&&N.safe&&a.left.value==="Math"&&a.right==="random"&&bA("ADsafe violation.",a));if(K.id!==")")for(;;){d[d.length]=bJ(10),c+=1;if(K.id!==",")break;bR()}bI(")"),bM(Q,$),typeof a=="object"&&(a.value==="parseInt"&&c===1&&bA("Missing radix parameter.",a),N.evil||(a.value==="eval"||a.value==="Function"||a.value==="execScript"?bA("eval is evil.",a):d[0]&&d[0].id==="(string)"&&(a.value==="setTimeout"||a.value==="setInterval")&&bA("Implied eval is evil. Pass a function instead of a string.",a)),!a.identifier&&a.id!=="."&&a.id!=="["&&a.id!=="("&&a.id!=="&&"&&a.id!=="||"&&a.id!=="?"&&bA("Bad invocation.",a)),b.left=a;return b},155,!0).exps=!0,bX("(",function(){bM(),K.id==="function"&&(K.immed=!0);var a=bJ(0);bI(")",this),bM(Q,$),N.immed&&a.id==="function"&&(K.id==="("?bA("Move the invocation into the parens that contain the function.",K):bA("Do not wrap function literals in parens unless they are to be immediately invoked.",this));return a}),b_("[",function(a,b){bL(Q,$),bM();var c=bJ(0),d;c&&c.type==="(string)"?(N.safe&&h[c.value]===!0?bA("ADsafe restricted word '{a}'.",b,c.value):!!N.evil||c.value!=="eval"&&c.value!=="execScript"?N.safe&&(c.value.charAt(0)==="_"||c.value.charAt(0)==="-")&&bA("ADsafe restricted subscript '{a}'.",b,c.value):bA("eval is evil.",b),cn(c.value),!N.sub&&bn.test(c.value)&&(d=Y[c.value],(!d||!d.reserved)&&bA("['{a}'] is better written in dot notation.",c,c.value))):(!c||c.type!=="(number)"||c.value<0)&&N.safe&&bA("ADsafe subscripting."),bI("]",b),bM(Q,$),b.left=a,b.right=c;return b},160,!0),bX("[",function(){var a=$.line!==K.line;this.first=[],a&&(D+=N.indent,K.from===D+N.indent&&(D+=N.indent));while(K.id!=="(end)"){while(K.id===",")bA("Extra comma."),bI(",");if(K.id==="]")break;a&&$.line!==K.line&&bP(),this.first.push(bJ(10));if(K.id!==",")break;bR();if(K.id==="]"&&!N.es5){bA("Extra comma.",$);break}}a&&(D-=N.indent,bP()),bI("]",this);return this},160),function(a){a.nud=function(){var a,b,c,d,e,f={},g;a=$.line!==K.line,a&&(D+=N.indent,K.from===D+N.indent&&(D+=N.indent));for(;;){if(K.id==="}")break;a&&bP();if(K.value==="get"&&bH().id!==":")bI("get"),N.es5||bC("get/set are ES5 features."),c=cP(),c||bC("Missing property name."),g=K,bK($,K),b=cR(c),v["(loopage)"]&&bA("Don't make functions within a loop.",g),e=b["(params)"],e&&bA("Unexpected parameter '{a}' in get {b} function.",g,e[0],c),bK($,K),bI(","),bP(),bI("set"),d=cP(),c!==d&&bC("Expected {a} and instead saw {b}.",$,c,d),g=K,bK($,K),b=cR(c),e=b["(params)"],(!e||e.length!==1||e[0]!=="value")&&bA("Expected (value) in set {a} function.",g,c);else{c=cP();if(typeof c!="string")break;bI(":"),bN($,K),bJ(10)}f[c]===!0&&bA("Duplicate member '{a}'.",K,c),f[c]=!0,cn(c);if(K.id===",")bR(),K.id===","?bA("Extra comma.",$):K.id==="}"&&!N.es5&&bA("Extra comma.",$);else break}a&&(D-=N.indent,bP()),bI("}",this);return this},a.fud=function(){bC("Expected to see a statement and instead saw a block.",$)}}(bT("{"));var cS=function cS(a){var b,c,d;v["(onevar)"]&&N.onevar?bA("Too many var statements."):v["(global)"]||(v["(onevar)"]=!0),this.first=[];for(;;){bN($,K),b=ch(),v["(global)"]&&O[b]===!1&&bA("Redefinition of '{a}'.",$,b),bF(b,"unused");if(a)break;c=$,this.first.push($),K.id==="="&&(bN($,K),bI("="),bN($,K),K.id==="undefined"&&bA("It is not necessary to initialize '{a}' to 'undefined'.",$,b),bH(0).id==="="&&K.identifier&&bC("Variable {a} was not declared correctly.",K,K.value),d=bJ(0),c.first=d);if(K.id!==",")break;bR()}return this};bU("var",cS).exps=!0,bV("function",function(){C&&bA("Function statements should not be placed in blocks. Use a function expression or move the statement to the top of the outer function.",$);var a=ch();bK($,K),bF(a,"unction"),cR(a,!0),K.id==="("&&K.line===$.line&&bC("Function statements are not invocable. Wrap the whole function invocation in parens.");return this}),bX("function",function(){var a=cg();a?bK($,K):bN($,K),cR(a),v["(loopage)"]&&bA("Don't make functions within a loop.");return this}),bV("if",function(){var a=K;bI("("),bN(this,a),bM(),bJ(20),K.id==="="&&(N.boss||bA("Expected a conditional expression and instead saw an assignment."),bI("="),bJ(20)),bI(")",a),bM(Q,$),cm(!0,!0),K.id==="else"&&(bN($,K),bI("else"),K.id==="if"||K.id==="switch"?cj(!0):cm(!0,!0));return this}),bV("try",function(){var a,b,c;N.adsafe&&bA("ADsafe try violation.",this),cm(!1),K.id==="catch"&&(bI("catch"),bN($,K),bI("("),c=S,S=Object.create(c),b=K.value,K.type!=="(identifier)"?bA("Expected an identifier and instead saw '{a}'.",K,b):bF(b,"exception"),bI(),bI(")"),cm(!1),a=!0,S=c);if(K.id==="finally")bI("finally"),cm(!1);else{a||bC("Expected '{a}' and instead saw '{b}'.",K,"catch",K.value);return this}}),bV("while",function(){var a=K;v["(breakage)"]+=1,v["(loopage)"]+=1,bI("("),bN(this,a),bM(),bJ(20),K.id==="="&&(N.boss||bA("Expected a conditional expression and instead saw an assignment."),bI("="),bJ(20)),bI(")",a),bM(Q,$),cm(!0,!0),v["(breakage)"]-=1,v["(loopage)"]-=1;return this}).labelled=!0,bZ("with"),bV("switch",function(){var a=K,b=!1;v["(breakage)"]+=1,bI("("),bN(this,a),bM(),this.condition=bJ(20),bI(")",a),bM(Q,$),bN($,K),a=K,bI("{"),bN($,K),D+=N.indent,this.cases=[];for(;;)switch(K.id){case"case":switch(v["(verb)"]){case"break":case"case":case"continue":case"return":case"switch":case"throw":break;default:bA("Expected a 'break' statement before 'case'.",$)}bP(-N.indent),bI("case"),this.cases.push(bJ(20)),b=!0,bI(":"),v["(verb)"]="case";break;case"default":switch(v["(verb)"]){case"break":case"continue":case"return":case"throw":break;default:bA("Expected a 'break' statement before 'default'.",$)}bP(-N.indent),bI("default"),b=!0,bI(":");break;case"}":D-=N.indent,bP(),bI("}",a),(this.cases.length===1||this.condition.id==="true"||this.condition.id==="false")&&bA("This 'switch' should be an 'if'.",this),v["(breakage)"]-=1,v["(verb)"]=undefined;return;case"(end)":bC("Missing '{a}'.",K,"}");return;default:if(b)switch($.id){case",":bC("Each value should have its own case label.");return;case":":cl();break;default:bC("Missing ':' on a case clause.",$)}else bC("Expected '{a}' and instead saw '{b}'.",K,"case",K.value)}}).labelled=!0,bU("debugger",function(){N.debug||bA("All 'debugger' statements should be removed.");return this}).exps=!0,function(){var a=bU("do",function(){v["(breakage)"]+=1,v["(loopage)"]+=1,this.first=cm(!0),bI("while");var a=K;bN($,a),bI("("),bM(),bJ(20),K.id==="="&&(N.boss||bA("Expected a conditional expression and instead saw an assignment."),bI("="),bJ(20)),bI(")",a),bM(Q,$),v["(breakage)"]-=1,v["(loopage)"]-=1;return this});a.labelled=!0,a.exps=!0}(),bV("for",function(){var a=N.forin,b,c=K;v["(breakage)"]+=1,v["(loopage)"]+=1,bI("("),bN(this,c),bM();if(bH(K.id==="var"?1:0).id==="in"){if(K.id==="var")bI("var"),cS(!0);else{switch(v[K.value]){case"unused":v[K.value]="var";break;case"var":break;default:bA("Bad for in variable '{a}'.",K,K.value)}bI()}bI("in"),bJ(20),bI(")",c),b=cm(!0,!0),!a&&(b.length>1||typeof b[0]!="object"||b[0].value!=="if")&&bA("The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.",this),v["(breakage)"]-=1,v["(loopage)"]-=1;return this}if(K.id!==";")if(K.id==="var")bI("var"),cS();else for(;;){bJ(0,"for");if(K.id!==",")break;bR()}bQ($),bI(";"),K.id!==";"&&(bJ(20),K.id==="="&&(N.boss||bA("Expected a conditional expression and instead saw an assignment."),bI("="),bJ(20))),bQ($),bI(";"),K.id===";"&&bC("Expected '{a}' and instead saw '{b}'.",K,")",";");if(K.id!==")")for(;;){bJ(0,"for");if(K.id!==",")break;bR()}bI(")",c),bM(Q,$),cm(!0,!0),v["(breakage)"]-=1,v["(loopage)"]-=1;return this}).labelled=!0,bU("break",function(){var a=K.value;v["(breakage)"]===0&&bA("Unexpected '{a}'.",K,this.value),bQ(this),K.id!==";"&&$.line===K.line&&(v[a]!=="label"?bA("'{a}' is not a statement label.",K,a):S[a]!==v&&bA("'{a}' is out of scope.",K,a),this.first=K,bI()),ci("break");return this}).exps=!0,bU("continue",function(){var a=K.value;v["(breakage)"]===0&&bA("Unexpected '{a}'.",K,this.value),bQ(this),K.id!==";"?$.line===K.line&&(v[a]!=="label"?bA("'{a}' is not a statement label.",K,a):S[a]!==v&&bA("'{a}' is out of scope.",K,a),this.first=K,bI()):v["(loopage)"]||bA("Unexpected '{a}'.",K,this.value),ci("continue");return this}).exps=!0,bU("return",function(){bQ(this),K.id==="(regexp)"&&bA("Wrap the /regexp/ literal in parens to disambiguate the slash operator."),K.id!==";"&&!K.reach&&(bN($,K),this.first=bJ(20)),ci("return");return this}).exps=!0,bU("throw",function(){bQ(this),bN($,K),this.first=bJ(20),ci("throw");return this}).exps=!0,bZ("void"),bZ("class"),bZ("const"),bZ("enum"),bZ("export"),bZ("extends"),bZ("import"),bZ("super"),bZ("let"),bZ("yield"),bZ("implements"),bZ("interface"),bZ("package"),bZ("private"),bZ("protected"),bZ("public"),bZ("static");var cU=function(e,g){var h,i,j;d.errors=[],O=Object.create(V);if(g){h=g.predef;if(h)if(Array.isArray(h))for(i=0;i",K.value),K.value==="use strict"&&(bA('Use the function form of "use strict".'),ck()),cl("lib")}bI("(end)")}catch(k){k&&d.errors.push({reason:k.message,line:k.line||K.line,character:k.character||K.from},null)}return d.errors.length===0};cU.data=function(){var a={functions:[]},b,c,d=[],e,f,g,h=[],i,j=[],k;cU.errors.length&&(a.errors=cU.errors),E&&(a.json=!0);for(i in B)bw(B,i)&&d.push({name:i,line:B[i]});d.length>0&&(a.implieds=d),_.length>0&&(a.urls=_),c=Object.keys(S),c.length>0&&(a.globals=c);for(f=1;f0&&(a.unused=j),h=[];for(i in I)if(typeof I[i]=="number"){a.member=I;break}return a},cU.report=function(a){function o(a,b){var c,d,e;if(b){m.push("
"+a+" "),b=b.sort();for(d=0;d")}}var b=cU.data(),c=[],d,e,f,g,h,i,j,k="",l,m=[],n;if(b.errors||b.implieds||b.unused){f=!0,m.push("
Error:");if(b.errors)for(h=0;hProblem"+(isFinite(d.line)?" at line "+d.line+" character "+d.character:"")+": "+d.reason.entityify()+"

"+(e&&(e.length>80?e.slice(0,77)+"...":e).entityify())+"

"));if(b.implieds){n=[];for(h=0;h"+b.implieds[h].name+" "+b.implieds[h].line+"";m.push("

Implied global: "+n.join(", ")+"

")}if(b.unused){n=[];for(h=0;h"+b.unused[h].name+" "+b.unused[h].line+" "+b.unused[h]["function"]+"";m.push("

Unused variable: "+n.join(", ")+"

")}b.json&&m.push("

JSON: bad.

"),m.push("
")}if(!a){m.push("
"),b.urls&&o("URLs
",b.urls,"
"),bd==="style"?m.push("

CSS.

"):b.json&&!f?m.push("

JSON: good.

"):b.globals?m.push("
Global "+b.globals.sort().join(", ")+"
"):m.push("
No new global variables introduced.
");for(h=0;h
"+g.line+"-"+g.last+" "+(g.name||"")+"("+(g.param?g.param.join(", "):"")+")
"),o("Unused",g.unused),o("Closure",g.closure),o("Variable",g["var"]),o("Exception",g.exception),o("Outer",g.outer),o("Global",g.global),o("Label",g.label);if(b.member){c=Object.keys(b.member);if(c.length){c=c.sort(),k="
/*members ",j=10;for(h=0;h72&&(m.push(k+"
"),k=" ",j=1),j+=l.length+2,b.member[i]===1&&(l=""+l+""),h*/
")}m.push("
")}}return m.join("")},cU.jshint=cU,cU.edition="2011-02-19";return cU}();typeof b=="object"&&b&&(b.JSHINT=d)}),define("ace/narcissus/jsparse",["require","exports","module","ace/narcissus/jslex","ace/narcissus/jsdefs"],function(require,exports,module){function parseStdin(a,b){for(;;)try{var c=new lexer.Tokenizer(a,"stdin",b.value),d=Script(c,!1);b.value=c.lineno;return d}catch(e){if(!c.unexpectedEOF)throw e;var f=readline();if(!f)throw e;a+="\n"+f}}function parse(a,b,c){var d=new lexer.Tokenizer(a,b,c),e=Script(d,!1);if(!d.done)throw d.newSyntaxError("Syntax error");return e}function PrimaryExpression(a,b){var c,d,e=a.get(!0);switch(e){case FUNCTION:c=FunctionDefinition(a,b,!1,EXPRESSED_FORM);break;case LEFT_BRACKET:c=new Node(a,{type:ARRAY_INIT});while((e=a.peek(!0))!==RIGHT_BRACKET){if(e===COMMA){a.get(),c.push(null);continue}c.push(AssignExpression(a,b));if(e!==COMMA&&!a.match(COMMA))break}c.children.length===1&&a.match(FOR)&&(d=new Node(a,{type:ARRAY_COMP,expression:c.children[0],tail:ComprehensionTail(a,b)}),c=d),a.mustMatch(RIGHT_BRACKET);break;case LEFT_CURLY:var f,g;c=new Node(a,{type:OBJECT_INIT});object_init:if(!a.match(RIGHT_CURLY)){do{e=a.get();if(a.token.value!=="get"&&a.token.value!=="set"||a.peek()!==IDENTIFIER){switch(e){case IDENTIFIER:case NUMBER:case STRING:f=new Node(a,{type:IDENTIFIER});break;case RIGHT_CURLY:if(b.ecma3OnlyMode)throw a.newSyntaxError("Illegal trailing ,");break object_init;default:if(a.token.value in definitions.keywords){f=new Node(a,{type:IDENTIFIER});break}throw a.newSyntaxError("Invalid property name")}if(a.match(COLON))d=new Node(a,{type:PROPERTY_INIT}),d.push(f),d.push(AssignExpression(a,b)),c.push(d);else{if(a.peek()!==COMMA&&a.peek()!==RIGHT_CURLY)throw a.newSyntaxError("missing : after property");c.push(f)}}else{if(b.ecma3OnlyMode)throw a.newSyntaxError("Illegal property accessor");c.push(FunctionDefinition(a,b,!0,EXPRESSED_FORM))}}while(a.match(COMMA));a.mustMatch(RIGHT_CURLY)}break;case LEFT_PAREN:c=ParenExpression(a,b),a.mustMatch(RIGHT_PAREN),c.parenthesized=!0;break;case LET:c=LetBlock(a,b,!1);break;case NULL:case THIS:case TRUE:case FALSE:case IDENTIFIER:case NUMBER:case STRING:case REGEXP:c=new Node(a);break;default:throw a.newSyntaxError("missing operand")}return c}function ArgumentList(a,b){var c,d;c=new Node(a,{type:LIST});if(a.match(RIGHT_PAREN,!0))return c;do{d=AssignExpression(a,b);if(d.type===YIELD&&!d.parenthesized&&a.peek()===COMMA)throw a.newSyntaxError("Yield expression must be parenthesized");if(a.match(FOR)){d=GeneratorExpression(a,b,d);if(c.children.length>1||a.peek(!0)===COMMA)throw a.newSyntaxError("Generator expression must be parenthesized")}c.push(d)}while(a.match(COMMA));a.mustMatch(RIGHT_PAREN);return c}function MemberExpression(a,b,c){var d,e,f,g;a.match(NEW)?(d=new Node(a),d.push(MemberExpression(a,b,!1)),a.match(LEFT_PAREN)&&(d.type=NEW_WITH_ARGS,d.push(ArgumentList(a,b)))):d=PrimaryExpression(a,b);while((g=a.get())!==END){switch(g){case DOT:e=new Node(a),e.push(d),a.mustMatch(IDENTIFIER),e.push(new Node(a));break;case LEFT_BRACKET:e=new Node(a,{type:INDEX}),e.push(d),e.push(Expression(a,b)),a.mustMatch(RIGHT_BRACKET);break;case LEFT_PAREN:if(c){e=new Node(a,{type:CALL}),e.push(d),e.push(ArgumentList(a,b));break};default:a.unget();return d}d=e}return d}function UnaryExpression(a,b){var c,d,e;switch(e=a.get(!0)){case DELETE:case VOID:case TYPEOF:case NOT:case BITWISE_NOT:case PLUS:case MINUS:e===PLUS?c=new Node(a,{type:UNARY_PLUS}):e===MINUS?c=new Node(a,{type:UNARY_MINUS}):c=new Node(a),c.push(UnaryExpression(a,b));break;case INCREMENT:case DECREMENT:c=new Node(a),c.push(MemberExpression(a,b,!0));break;default:a.unget(),c=MemberExpression(a,b,!0),a.tokens[a.tokenIndex+a.lookahead-1&3].lineno===a.lineno&&(a.match(INCREMENT)||a.match(DECREMENT))&&(d=new Node(a,{postfix:!0}),d.push(c),c=d)}return c}function MultiplyExpression(a,b){var c,d;c=UnaryExpression(a,b);while(a.match(MUL)||a.match(DIV)||a.match(MOD))d=new Node(a),d.push(c),d.push(UnaryExpression(a,b)),c=d;return c}function AddExpression(a,b){var c,d;c=MultiplyExpression(a,b);while(a.match(PLUS)||a.match(MINUS))d=new Node(a),d.push(c),d.push(MultiplyExpression(a,b)),c=d;return c}function ShiftExpression(a,b){var c,d;c=AddExpression(a,b);while(a.match(LSH)||a.match(RSH)||a.match(URSH))d=new Node(a),d.push(c),d.push(AddExpression(a,b)),c=d;return c}function RelationalExpression(a,b){var c,d,e=b.update({inForLoopInit:!1});c=ShiftExpression(a,e);while(a.match(LT)||a.match(LE)||a.match(GE)||a.match(GT)||!b.inForLoopInit&&a.match(IN)||a.match(INSTANCEOF))d=new Node(a),d.push(c),d.push(ShiftExpression(a,e)),c=d;return c}function EqualityExpression(a,b){var c,d;c=RelationalExpression(a,b);while(a.match(EQ)||a.match(NE)||a.match(STRICT_EQ)||a.match(STRICT_NE))d=new Node(a),d.push(c),d.push(RelationalExpression(a,b)),c=d;return c}function BitwiseAndExpression(a,b){var c,d;c=EqualityExpression(a,b);while(a.match(BITWISE_AND))d=new Node(a),d.push(c),d.push(EqualityExpression(a,b)),c=d;return c}function BitwiseXorExpression(a,b){var c,d;c=BitwiseAndExpression(a,b);while(a.match(BITWISE_XOR))d=new Node(a),d.push(c),d.push(BitwiseAndExpression(a,b)),c=d;return c}function BitwiseOrExpression(a,b){var c,d;c=BitwiseXorExpression(a,b);while(a.match(BITWISE_OR))d=new Node(a),d.push(c),d.push(BitwiseXorExpression(a,b)),c=d;return c}function AndExpression(a,b){var c,d;c=BitwiseOrExpression(a,b);while(a.match(AND))d=new Node(a),d.push(c),d.push(BitwiseOrExpression(a,b)),c=d;return c}function OrExpression(a,b){var c,d;c=AndExpression(a,b);while(a.match(OR))d=new Node(a),d.push(c),d.push(AndExpression(a,b)),c=d;return c}function ConditionalExpression(a,b){var c,d;c=OrExpression(a,b);if(a.match(HOOK)){d=c,c=new Node(a,{type:HOOK}),c.push(d),c.push(AssignExpression(a,b.update({inForLoopInit:!1})));if(!a.match(COLON))throw a.newSyntaxError("missing : after ?");c.push(AssignExpression(a,b))}return c}function AssignExpression(a,b){var c,d;if(a.match(YIELD,!0))return ReturnOrYield(a,b);c=new Node(a,{type:ASSIGN}),d=ConditionalExpression(a,b);if(!a.match(ASSIGN))return d;switch(d.type){case OBJECT_INIT:case ARRAY_INIT:d.destructuredNames=checkDestructuring(a,b,d);case IDENTIFIER:case DOT:case INDEX:case CALL:break;default:throw a.newSyntaxError("Bad left-hand side of assignment")}c.assignOp=a.token.assignOp,c.push(d),c.push(AssignExpression(a,b));return c}function Expression(a,b){var c,d;c=AssignExpression(a,b);if(a.match(COMMA)){d=new Node(a,{type:COMMA}),d.push(c),c=d;do{d=c.children[c.children.length-1];if(d.type===YIELD&&!d.parenthesized)throw a.newSyntaxError("Yield expression must be parenthesized");c.push(AssignExpression(a,b))}while(a.match(COMMA))}return c}function ParenExpression(a,b){var c=Expression(a,b.update({inForLoopInit:b.inForLoopInit&&a.token.type===LEFT_PAREN}));if(a.match(FOR)){if(c.type===YIELD&&!c.parenthesized)throw a.newSyntaxError("Yield expression must be parenthesized");if(c.type===COMMA&&!c.parenthesized)throw a.newSyntaxError("Generator expression must be parenthesized");c=GeneratorExpression(a,b,c)}return c}function HeadExpression(a,b){var c=MaybeLeftParen(a,b),d=ParenExpression(a,b);MaybeRightParen(a,c);if(c===END&&!d.parenthesized){var e=a.peek();if(e!==LEFT_CURLY&&!definitions.isStatementStartCode[e])throw a.newSyntaxError("Unparenthesized head followed by unbraced body")}return d}function ComprehensionTail(a,b){var c,d,e,f,g;c=new Node(a,{type:COMP_TAIL});do{d=new Node(a,{type:FOR_IN,isLoop:!0}),a.match(IDENTIFIER)&&(a.token.value==="each"?d.isEach=!0:a.unget()),g=MaybeLeftParen(a,b);switch(a.get()){case LEFT_BRACKET:case LEFT_CURLY:a.unget(),d.iterator=DestructuringExpression(a,b);break;case IDENTIFIER:d.iterator=f=new Node(a,{type:IDENTIFIER}),f.name=f.value,d.varDecl=e=new Node(a,{type:VAR}),e.push(f),b.parentScript.varDecls.push(f);break;default:throw a.newSyntaxError("missing identifier")}a.mustMatch(IN),d.object=Expression(a,b),MaybeRightParen(a,g),c.push(d)}while(a.match(FOR));a.match(IF)&&(c.guard=HeadExpression(a,b));return c}function GeneratorExpression(a,b,c){return new Node(a,{type:GENERATOR,expression:c,tail:ComprehensionTail(a,b)})}function DestructuringExpression(a,b,c){var d=PrimaryExpression(a,b);d.destructuredNames=checkDestructuring(a,b,d,c);return d}function checkDestructuring(a,b,c,d){if(c.type===ARRAY_COMP)throw a.newSyntaxError("Invalid array comprehension left-hand side");if(c.type===ARRAY_INIT||c.type===OBJECT_INIT){var e={},f,g,h,i,j,k=c.children;for(var l=0,m=k.length;l=0)throw a.newSyntaxError("More than one switch default");case CASE:f=new Node(a),j===DEFAULT?e.defaultIndex=e.cases.length:f.caseLabel=Expression(a,l,COLON);break;default:throw a.newSyntaxError("Invalid switch case")}a.mustMatch(COLON),f.statements=new Node(a,blockInit());while((j=a.peek(!0))!==CASE&&j!==DEFAULT&&j!==RIGHT_CURLY)f.statements.push(Statement(a,l));e.cases.push(f)}return e;case FOR:e=new Node(a,LOOP_INIT),a.match(IDENTIFIER)&&(a.token.value==="each"?e.isEach=!0:a.unget()),b.parenFreeMode||a.mustMatch(LEFT_PAREN),l=b.pushTarget(e).nest(NESTING_DEEP),m=b.update({inForLoopInit:!0}),(j=a.peek())!==SEMICOLON&&(j===VAR||j===CONST?(a.get(),f=Variables(a,m)):j===LET?(a.get(),a.peek()===LEFT_PAREN?f=LetBlock(a,m,!1):(m.parentBlock=e,e.varDecls=[],f=Variables(a,m))):f=Expression(a,m));if(f&&a.match(IN)){e.type=FOR_IN,e.object=Expression(a,m);if(f.type===VAR||f.type===LET){h=f.children;if(h.length!==1&&f.destructurings.length!==1)throw new SyntaxError("Invalid for..in left-hand side",a.filename,f.lineno);f.destructurings.length>0?e.iterator=f.destructurings[0]:e.iterator=h[0],e.varDecl=f}else{if(f.type===ARRAY_INIT||f.type===OBJECT_INIT)f.destructuredNames=checkDestructuring(a,m,f);e.iterator=f}}else{e.setup=f,a.mustMatch(SEMICOLON);if(e.isEach)throw a.newSyntaxError("Invalid for each..in loop");e.condition=a.peek()===SEMICOLON?null:Expression(a,m),a.mustMatch(SEMICOLON),k=a.peek(),e.update=(b.parenFreeMode?k===LEFT_CURLY||definitions.isStatementStartCode[k]:k===RIGHT_PAREN)?null:Expression(a,m)}b.parenFreeMode||a.mustMatch(RIGHT_PAREN),e.body=Statement(a,l);return e;case WHILE:e=new Node(a,{isLoop:!0}),e.condition=HeadExpression(a,b),e.body=Statement(a,b.pushTarget(e).nest(NESTING_DEEP));return e;case DO:e=new Node(a,{isLoop:!0}),e.body=Statement(a,b.pushTarget(e).nest(NESTING_DEEP)),a.mustMatch(WHILE),e.condition=HeadExpression(a,b);if(!b.ecmaStrictMode){a.match(SEMICOLON);return e}break;case BREAK:case CONTINUE:e=new Node(a),l=b.pushTarget(e),a.peekOnSameLine()===IDENTIFIER&&(a.get(),e.label=a.token.value),e.target=e.label?l.labeledTargets.find(function(a){return a.labels.has(e.label)}):l.defaultTarget;if(!e.target)throw a.newSyntaxError("Invalid "+(j===BREAK?"break":"continue"));if(!e.target.isLoop&&j===CONTINUE)throw a.newSyntaxError("Invalid continue");break;case TRY:e=new Node(a,{catchClauses:[]}),e.tryBlock=Block(a,b);while(a.match(CATCH)){f=new Node(a),g=MaybeLeftParen(a,b);switch(a.get()){case LEFT_BRACKET:case LEFT_CURLY:a.unget(),f.varName=DestructuringExpression(a,b,!0);break;case IDENTIFIER:f.varName=a.token.value;break;default:throw a.newSyntaxError("missing identifier in catch")}if(a.match(IF)){if(b.ecma3OnlyMode)throw a.newSyntaxError("Illegal catch guard");if(e.catchClauses.length&&!e.catchClauses.top().guard)throw a.newSyntaxError("Guarded catch after unguarded");f.guard=Expression(a,b)}MaybeRightParen(a,g),f.block=Block(a,b),e.catchClauses.push(f)}a.match(FINALLY)&&(e.finallyBlock=Block(a,b));if(!e.catchClauses.length&&!e.finallyBlock)throw a.newSyntaxError("Invalid try statement");return e;case CATCH:case FINALLY:throw a.newSyntaxError(definitions.tokens[j]+" without preceding try");case THROW:e=new Node(a),e.exception=Expression(a,b);break;case RETURN:e=ReturnOrYield(a,b);break;case WITH:e=new Node(a),e.object=HeadExpression(a,b),e.body=Statement(a,b.pushTarget(e).nest(NESTING_DEEP));return e;case VAR:case CONST:e=Variables(a,b);break;case LET:a.peek()===LEFT_PAREN?e=LetBlock(a,b,!0):e=Variables(a,b);break;case DEBUGGER:e=new Node(a);break;case NEWLINE:case SEMICOLON:e=new Node(a,{type:SEMICOLON}),e.expression=null;return e;default:if(j===IDENTIFIER){j=a.peek();if(j===COLON){d=a.token.value;if(b.allLabels.has(d))throw a.newSyntaxError("Duplicate label");a.get(),e=new Node(a,{type:LABEL,label:d}),e.statement=Statement(a,b.pushLabel(d).nest(NESTING_SHALLOW)),e.target=e.statement.type===LABEL?e.statement.target:e.statement;return e}}e=new Node(a,{type:SEMICOLON}),a.unget(),e.expression=Expression(a,b),e.end=e.expression.end}MagicalSemicolon(a);return e}function Block(a,b){a.mustMatch(LEFT_CURLY);var c=new Node(a,blockInit());Statements(a,b.update({parentBlock:c}).pushTarget(c),c),a.mustMatch(RIGHT_CURLY);return c}function Statements(a,b,c){try{while(!a.done&&a.peek(!0)!==RIGHT_CURLY)c.push(Statement(a,b))}catch(d){a.done&&(a.unexpectedEOF=!0);throw d}}function MaybeRightParen(a,b){b===LEFT_PAREN&&a.mustMatch(RIGHT_PAREN)}function MaybeLeftParen(a,b){if(b.parenFreeMode)return a.match(LEFT_PAREN)?LEFT_PAREN:END;return a.mustMatch(LEFT_PAREN).type}function scriptInit(){return{type:SCRIPT,funDecls:[],varDecls:[],modDecls:[],impDecls:[],expDecls:[],loadDeps:[],hasEmptyReturn:!1,hasReturnWithValue:!1,isGenerator:!1}}function blockInit(){return{type:BLOCK,varDecls:[]}}function tokenString(a){var b=definitions.tokens[a];return/^\W/.test(b)?definitions.opTypeNames[b]:b.toUpperCase()}function Node(a,b){var c=a.token;c?(this.type=c.type,this.value=c.value,this.lineno=c.lineno,this.start=c.start,this.end=c.end):this.lineno=a.lineno,this.tokenizer=a,this.children=[];for(var d in b)this[d]=b[d]}function Script(a,b){var c=new Node(a,scriptInit()),d=new StaticContext(c,c,b,!1,NESTING_TOP);Statements(a,d,c);return c}function StaticContext(a,b,c,d,e){this.parentScript=a,this.parentBlock=b,this.inFunction=c,this.inForLoopInit=d,this.nesting=e,this.allLabels=new Stack,this.currentLabels=new Stack,this.labeledTargets=new Stack,this.defaultTarget=null,definitions.options.ecma3OnlyMode&&(this.ecma3OnlyMode=!0),definitions.options.parenFreeMode&&(this.parenFreeMode=!0)}function pushDestructuringVarDecls(a,b){for(var c in a){var d=a[c];d.type===IDENTIFIER?b.varDecls.push(d):pushDestructuringVarDecls(d,b)}}var lexer=require("ace/narcissus/jslex"),definitions=require("ace/narcissus/jsdefs");const StringMap=definitions.StringMap,Stack=definitions.Stack;eval(definitions.consts);const NESTING_TOP=0,NESTING_SHALLOW=1,NESTING_DEEP=2;StaticContext.prototype={ecma3OnlyMode:!1,parenFreeMode:!1,update:function(a){var b={};for(var c in a)b[c]={value:a[c],writable:!0,enumerable:!0,configurable:!0};return Object.create(this,b)},pushLabel:function(a){return this.update({currentLabels:this.currentLabels.push(a),allLabels:this.allLabels.push(a)})},pushTarget:function(a){var b=a.isLoop||a.type===SWITCH;if(this.currentLabels.isEmpty())return b?this.update({defaultTarget:a}):this;a.labels=new StringMap,this.currentLabels.forEach(function(b){a.labels.set(b,!0)});return this.update({currentLabels:new Stack,labeledTargets:this.labeledTargets.push(a),defaultTarget:b?a:this.defaultTarget})},nest:function(a){var b=Math.max(this.nesting,a);return b!==this.nesting?this.update({nesting:b}):this}},definitions.defineProperty(Array.prototype,"top",function(){return this.length&&this[this.length-1]},!1,!1,!0);var Np=Node.prototype={};Np.constructor=Node,Np.toSource=Object.prototype.toSource,Np.push=function(a){a!==null&&(a.start=0)b+=c;return b},!1,!1,!0);const DECLARED_FORM=0,EXPRESSED_FORM=1,STATEMENT_FORM=2;exports.parse=parse,exports.parseStdin=parseStdin,exports.Node=Node,exports.DECLARED_FORM=DECLARED_FORM,exports.EXPRESSED_FORM=EXPRESSED_FORM,exports.STATEMENT_FORM=STATEMENT_FORM,exports.Tokenizer=lexer.Tokenizer,exports.FunctionDefinition=FunctionDefinition}),define("ace/narcissus/jslex",["require","exports","module","ace/narcissus/jsdefs"],function(require,exports,module){function Tokenizer(a,b,c){this.cursor=0,this.source=String(a),this.tokens=[],this.tokenIndex=0,this.lookahead=0,this.scanNewlines=!1,this.unexpectedEOF=!1,this.filename=b||"",this.lineno=c||1}var definitions=require("ace/narcissus/jsdefs");eval(definitions.consts);var opTokens={};for(var op in definitions.opTypeNames){if(op==="\n"||op===".")continue;var node=opTokens;for(var i=0;i"9")throw this.newSyntaxError("Missing exponent");do ch=a[this.cursor++];while(ch>="0"&&ch<="9");this.cursor--;return!0}return!1},lexZeroNumber:function(a){var b=this.token,c=this.source;b.type=NUMBER,a=c[this.cursor++];if(a==="."){do a=c[this.cursor++];while(a>="0"&&a<="9");this.cursor--,this.lexExponent(),b.value=parseFloat(b.start,this.cursor)}else if(a==="x"||a==="X"){do a=c[this.cursor++];while(a>="0"&&a<="9"||a>="a"&&a<="f"||a>="A"&&a<="F");this.cursor--,b.value=parseInt(c.substring(b.start,this.cursor))}else if(a>="0"&&a<="7"){do a=c[this.cursor++];while(a>="0"&&a<="7");this.cursor--,b.value=parseInt(c.substring(b.start,this.cursor))}else this.cursor--,this.lexExponent(),b.value=0},lexNumber:function(a){var b=this.token,c=this.source;b.type=NUMBER;var d=!1;do a=c[this.cursor++],a==="."&&!d&&(d=!0,a=c[this.cursor++]);while(a>="0"&&a<="9");this.cursor--;var e=this.lexExponent();d=d||e;var f=c.substring(b.start,this.cursor);b.value=d?parseFloat(f):parseInt(f)},lexDot:function(a){var b=this.token,c=this.source,d=c[this.cursor];if(d>="0"&&d<="9"){do a=c[this.cursor++];while(a>="0"&&a<="9");this.cursor--,this.lexExponent(),b.type=NUMBER,b.value=parseFloat(b.start,this.cursor)}else b.type=DOT,b.assignOp=null,b.value="."},lexString:function(ch){var token=this.token,input=this.source;token.type=STRING;var hasEscapes=!1,delim=ch;while((ch=input[this.cursor++])!==delim){if(this.cursor==input.length)throw this.newSyntaxError("Unterminated string literal");if(ch==="\\"){hasEscapes=!0;if(++this.cursor==input.length)throw this.newSyntaxError("Unterminated string literal")}}token.value=hasEscapes?eval(input.substring(token.start,this.cursor)):input.substring(token.start+1,this.cursor-1)},lexRegExp:function(ch){var token=this.token,input=this.source;token.type=REGEXP;do{ch=input[this.cursor++];if(ch==="\\")this.cursor++;else if(ch==="["){do{if(ch===undefined)throw this.newSyntaxError("Unterminated character class");ch==="\\"&&this.cursor++,ch=input[this.cursor++]}while(ch!=="]")}else if(ch===undefined)throw this.newSyntaxError("Unterminated regex")}while(ch!=="/");do ch=input[this.cursor++];while(ch>="a"&&ch<="z");this.cursor--,token.value=eval(input.substring(token.start,this.cursor))},lexOp:function(a){var b=this.token,c=this.source,d=opTokens[a],e=c[this.cursor];e in d&&(d=d[e],this.cursor++,e=c[this.cursor],e in d&&(d=d[e],this.cursor++,e=c[this.cursor]));var f=d.op;definitions.assignOps[f]&&c[this.cursor]==="="?(this.cursor++,b.type=ASSIGN,b.assignOp=definitions.tokenIds[definitions.opTypeNames[f]],f+="="):(b.type=definitions.tokenIds[definitions.opTypeNames[f]],b.assignOp=null),b.value=f},lexIdent:function(a){var b=this.token,c=this.source;do a=c[this.cursor++];while(a>="a"&&a<="z"||a>="A"&&a<="Z"||a>="0"&&a<="9"||a==="$"||a==="_");this.cursor--;var d=c.substring(b.start,this.cursor);b.type=definitions.keywords[d]||IDENTIFIER,b.value=d},get:function(a){var b;while(this.lookahead){--this.lookahead,this.tokenIndex=this.tokenIndex+1&3,b=this.tokens[this.tokenIndex];if(b.type!==NEWLINE||this.scanNewlines)return b.type}this.skip(),this.tokenIndex=this.tokenIndex+1&3,b=this.tokens[this.tokenIndex],b||(this.tokens[this.tokenIndex]=b={});var c=this.source;if(this.cursor===c.length)return b.type=END;b.start=this.cursor,b.lineno=this.lineno;var d=c[this.cursor++];if(d>="a"&&d<="z"||d>="A"&&d<="Z"||d==="$"||d==="_")this.lexIdent(d);else if(a&&d==="/")this.lexRegExp(d);else if(d in opTokens)this.lexOp(d);else if(d===".")this.lexDot(d);else if(d>="1"&&d<="9")this.lexNumber(d);else if(d==="0")this.lexZeroNumber(d);else if(d==='"'||d==="'")this.lexString(d);else if(this.scanNewlines&&d==="\n")b.type=NEWLINE,b.value="\n",this.lineno++;else throw this.newSyntaxError("Illegal token");b.end=this.cursor;return b.type},unget:function(){if(++this.lookahead===4)throw"PANIC: too much lookahead!";this.tokenIndex=this.tokenIndex-1&3},newSyntaxError:function(a){var b=new SyntaxError(a,this.filename,this.lineno);b.source=this.source,b.lineno=this.lineno,b.cursor=this.lookahead?this.tokens[this.tokenIndex+this.lookahead&3].start:this.cursor;return b}},exports.Tokenizer=Tokenizer}),define("ace/narcissus/jsdefs",["require","exports","module"],function(a,b,c){function y(a){this.elts=a||null}function x(){this.table=Object.create(null,{}),this.size=0}function v(){return undefined}function u(a){return{getOwnPropertyDescriptor:function(b){var c=Object.getOwnPropertyDescriptor(a,b);c.configurable=!0;return c},getPropertyDescriptor:function(b){var c=s(a,b);c.configurable=!0;return c},getOwnPropertyNames:function(){return Object.getOwnPropertyNames(a)},defineProperty:function(b,c){Object.defineProperty(a,b,c)},"delete":function(b){return delete a[b]},fix:function(){if(Object.isFrozen(a))return t(a);return undefined},has:function(b){return b in a},hasOwn:function(b){return({}).hasOwnProperty.call(a,b)},get:function(b,c){return a[c]},set:function(b,c,d){a[c]=d;return!0},enumerate:function(){var b=[];for(m in a)b.push(m);return b},keys:function(){return Object.keys(a)}}}function t(a){var b={};for(var c in Object.getOwnPropertyNames(a))b[c]=Object.getOwnPropertyDescriptor(a,c);return b}function s(a,b){while(a){if(({}).hasOwnProperty.call(a,b))return Object.getOwnPropertyDescriptor(a,b);a=Object.getPrototypeOf(a)}}function r(a){return typeof a=="function"&&a.toString().match(/\[native code\]/)}function q(a,b,c,d,e,f){Object.defineProperty(a,b,{value:c,writable:!e,configurable:!d,enumerable:!f})}function p(a,b,c,d,e){Object.defineProperty(a,b,{get:c,configurable:!d,enumerable:!e})}b.options={version:185},function(){b.hostGlobal=this}();var d=["END","\n",";",",","=","?",":","CONDITIONAL","||","&&","|","^","&","==","!=","===","!==","<","<=",">=",">","<<",">>",">>>","+","-","*","/","%","!","~","UNARY_PLUS","UNARY_MINUS","++","--",".","[","]","{","}","(",")","SCRIPT","BLOCK","LABEL","FOR_IN","CALL","NEW_WITH_ARGS","INDEX","ARRAY_INIT","OBJECT_INIT","PROPERTY_INIT","GETTER","SETTER","GROUP","LIST","LET_BLOCK","ARRAY_COMP","GENERATOR","COMP_TAIL","IDENTIFIER","NUMBER","STRING","REGEXP","break","case","catch","const","continue","debugger","default","delete","do","else","false","finally","for","function","if","in","instanceof","let","new","null","return","switch","this","throw","true","try","typeof","var","void","yield","while","with"],e=["break","const","continue","debugger","do","for","if","return","switch","throw","try","var","yield","while","with"],f={"\n":"NEWLINE",";":"SEMICOLON",",":"COMMA","?":"HOOK",":":"COLON","||":"OR","&&":"AND","|":"BITWISE_OR","^":"BITWISE_XOR","&":"BITWISE_AND","===":"STRICT_EQ","==":"EQ","=":"ASSIGN","!==":"STRICT_NE","!=":"NE","<<":"LSH","<=":"LE","<":"LT",">>>":"URSH",">>":"RSH",">=":"GE",">":"GT","++":"INCREMENT","--":"DECREMENT","+":"PLUS","-":"MINUS","*":"MUL","/":"DIV","%":"MOD","!":"NOT","~":"BITWISE_NOT",".":"DOT","[":"LEFT_BRACKET","]":"RIGHT_BRACKET","{":"LEFT_CURLY","}":"RIGHT_CURLY","(":"LEFT_PAREN",")":"RIGHT_PAREN"},g={"__proto__":null},h={},i="const ";for(var j=0,k=d.length;j0&&(i+=", ");var l=d[j],m;/^[a-z]/.test(l)?(m=l.toUpperCase(),g[l]=j):m=/^\W/.test(l)?f[l]:l,i+=m+" = "+j,h[m]=j,d[l]=j}i+=";";var n={"__proto__":null};for(j=0,k=e.length;j>",">>>","+","-","*","/","%"];for(j=0,k=o.length;j/g, ">\n").replace(//g, ">\n").replace(/ +// +// Redistributable under a BSD-style open source license. +// See license.txt for more information. +// +// The full source distribution is at: +// +// A A L +// T C A +// T K B +// +// +// + +// +// Wherever possible, Showdown is a straight, line-by-line port +// of the Perl version of Markdown. +// +// This is not a normal parser design; it's basically just a +// series of string substitutions. It's hard to read and +// maintain this way, but keeping Showdown close to the original +// design makes it easier to port new features. +// +// More importantly, Showdown behaves like markdown.pl in most +// edge cases. So web applications can do client-side preview +// in Javascript, and then build identical HTML on the server. +// +// This port needs the new RegExp functionality of ECMA 262, +// 3rd Edition (i.e. Javascript 1.5). Most modern web browsers +// should do fine. Even with the new regular expression features, +// We do a lot of work to emulate Perl's regex functionality. +// The tricky changes in this file mostly have the "attacklab:" +// label. Major or self-explanatory changes don't. +// +// Smart diff tools like Araxis Merge will be able to match up +// this file with markdown.pl in a useful way. A little tweaking +// helps: in a copy of markdown.pl, replace "#" with "//" and +// replace "$text" with "text". Be sure to ignore whitespace +// and line endings. +// + + +// +// Showdown usage: +// +// var text = "Markdown *rocks*."; +// +// var converter = new Showdown.converter(); +// var html = converter.makeHtml(text); +// +// alert(html); +// +// Note: move the sample code to the bottom of this +// file before uncommenting it. +// + + +// ************************************************** +// GitHub Flavored Markdown modifications by Tekkub +// http://github.github.com/github-flavored-markdown/ +// +// Modifications are tagged with "GFM" +// ************************************************** + +// ************************************************** +// Node.JS port by Isaac Z. Schlueter +// +// Modifications are tagged with "isaacs" +// ************************************************** + +// +// Showdown namespace +// +var Showdown = {}; + +// +// isaacs: export the Showdown object +// +if (typeof exports === "object") { + Showdown = exports; + // isaacs: expose top-level parse() method, like other to-html parsers. + Showdown.parse = function (md, gh) { + var converter = new Showdown.converter(); + return converter.makeHtml(md, gh); + }; +} + +// +// isaacs: Declare "GitHub" object in here, since Node modules +// execute in a closure or separate context, rather than right +// in the global scope. If in the browser, this does nothing. +// +var GitHub; + +// +// converter +// +// Wraps all "globals" so that the only thing +// exposed is makeHtml(). +// +Showdown.converter = function() { + +// +// Globals: +// + +// Global hashes, used by various utility routines +var g_urls; +var g_titles; +var g_html_blocks; + +// Used to track when we're inside an ordered or unordered list +// (see _ProcessListItems() for details): +var g_list_level = 0; + +// isaacs - Allow passing in the GitHub object as an argument. +this.makeHtml = function(text, gh) { + if (typeof gh !== "undefined") { + if (typeof gh === "string") gh = {nameWithOwner:gh}; + GitHub = gh; + } + +// +// Main function. The order in which other subs are called here is +// essential. Link and image substitutions need to happen before +// _EscapeSpecialCharsWithinTagAttributes(), so that any *'s or _'s in the +// and tags get encoded. +// + + // Clear the global hashes. If we don't clear these, you get conflicts + // from other articles when generating a page which contains more than + // one article (e.g. an index page that shows the N most recent + // articles): + g_urls = new Array(); + g_titles = new Array(); + g_html_blocks = new Array(); + + // attacklab: Replace ~ with ~T + // This lets us use tilde as an escape char to avoid md5 hashes + // The choice of character is arbitray; anything that isn't + // magic in Markdown will work. + text = text.replace(/~/g,"~T"); + + // attacklab: Replace $ with ~D + // RegExp interprets $ as a special character + // when it's in a replacement string + text = text.replace(/\$/g,"~D"); + + // Standardize line endings + text = text.replace(/\r\n/g,"\n"); // DOS to Unix + text = text.replace(/\r/g,"\n"); // Mac to Unix + + // Make sure text begins and ends with a couple of newlines: + text = "\n\n" + text + "\n\n"; + + // Convert all tabs to spaces. + text = _Detab(text); + + // Strip any lines consisting only of spaces and tabs. + // This makes subsequent regexen easier to write, because we can + // match consecutive blank lines with /\n+/ instead of something + // contorted like /[ \t]*\n+/ . + text = text.replace(/^[ \t]+$/mg,""); + + // Turn block-level HTML blocks into hash entries + text = _HashHTMLBlocks(text); + + // Strip link definitions, store in hashes. + text = _StripLinkDefinitions(text); + + text = _RunBlockGamut(text); + + text = _UnescapeSpecialChars(text); + + // attacklab: Restore dollar signs + text = text.replace(/~D/g,"$$"); + + // attacklab: Restore tildes + text = text.replace(/~T/g,"~"); + + // ** GFM ** Auto-link URLs and emails + text = text.replace(/https?\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!]/g, function(wholeMatch,matchIndex){ + var left = text.slice(0, matchIndex), right = text.slice(matchIndex) + if (left.match(/<[^>]+$/) && right.match(/^[^>]*>/)) {return wholeMatch} + return "" + wholeMatch + ""; + }); + text = text.replace(/[a-z0-9_\-+=.]+@[a-z0-9\-]+(\.[a-z0-9-]+)+/ig, function(wholeMatch){return "" + wholeMatch + "";}); + + // ** GFM ** Auto-link sha1 if GitHub.nameWithOwner is defined + text = text.replace(/[a-f0-9]{40}/ig, function(wholeMatch,matchIndex){ + if (typeof(GitHub) == "undefined" || typeof(GitHub.nameWithOwner) == "undefined") {return wholeMatch;} + var left = text.slice(0, matchIndex), right = text.slice(matchIndex) + if (left.match(/@$/) || (left.match(/<[^>]+$/) && right.match(/^[^>]*>/))) {return wholeMatch;} + return "" + wholeMatch.substring(0,7) + ""; + }); + + // ** GFM ** Auto-link user@sha1 if GitHub.nameWithOwner is defined + text = text.replace(/([a-z0-9_\-+=.]+)@([a-f0-9]{40})/ig, function(wholeMatch,username,sha,matchIndex){ + if (typeof(GitHub) == "undefined" || typeof(GitHub.nameWithOwner) == "undefined") {return wholeMatch;} + GitHub.repoName = GitHub.repoName || _GetRepoName() + var left = text.slice(0, matchIndex), right = text.slice(matchIndex) + if (left.match(/\/$/) || (left.match(/<[^>]+$/) && right.match(/^[^>]*>/))) {return wholeMatch;} + return "" + username + "@" + sha.substring(0,7) + ""; + }); + + // ** GFM ** Auto-link user/repo@sha1 + text = text.replace(/([a-z0-9_\-+=.]+\/[a-z0-9_\-+=.]+)@([a-f0-9]{40})/ig, function(wholeMatch,repo,sha){ + return "" + repo + "@" + sha.substring(0,7) + ""; + }); + + // ** GFM ** Auto-link #issue if GitHub.nameWithOwner is defined + text = text.replace(/#([0-9]+)/ig, function(wholeMatch,issue,matchIndex){ + if (typeof(GitHub) == "undefined" || typeof(GitHub.nameWithOwner) == "undefined") {return wholeMatch;} + var left = text.slice(0, matchIndex), right = text.slice(matchIndex) + if (left == "" || left.match(/[a-z0-9_\-+=.]$/) || (left.match(/<[^>]+$/) && right.match(/^[^>]*>/))) {return wholeMatch;} + return "" + wholeMatch + ""; + }); + + // ** GFM ** Auto-link user#issue if GitHub.nameWithOwner is defined + text = text.replace(/([a-z0-9_\-+=.]+)#([0-9]+)/ig, function(wholeMatch,username,issue,matchIndex){ + if (typeof(GitHub) == "undefined" || typeof(GitHub.nameWithOwner) == "undefined") {return wholeMatch;} + GitHub.repoName = GitHub.repoName || _GetRepoName() + var left = text.slice(0, matchIndex), right = text.slice(matchIndex) + if (left.match(/\/$/) || (left.match(/<[^>]+$/) && right.match(/^[^>]*>/))) {return wholeMatch;} + return "" + wholeMatch + ""; + }); + + // ** GFM ** Auto-link user/repo#issue + text = text.replace(/([a-z0-9_\-+=.]+\/[a-z0-9_\-+=.]+)#([0-9]+)/ig, function(wholeMatch,repo,issue){ + return "" + wholeMatch + ""; + }); + + return text; +} + + +var _GetRepoName = function() { + return GitHub.nameWithOwner.match(/^.+\/(.+)$/)[1] +} + +var _StripLinkDefinitions = function(text) { +// +// Strips link definitions from text, stores the URLs and titles in +// hash references. +// + + // Link defs are in the form: ^[id]: url "optional title" + + /* + var text = text.replace(/ + ^[ ]{0,3}\[(.+)\]: // id = $1 attacklab: g_tab_width - 1 + [ \t]* + \n? // maybe *one* newline + [ \t]* + ? // url = $2 + [ \t]* + \n? // maybe one newline + [ \t]* + (?: + (\n*) // any lines skipped = $3 attacklab: lookbehind removed + ["(] + (.+?) // title = $4 + [")] + [ \t]* + )? // title is optional + (?:\n+|$) + /gm, + function(){...}); + */ + var text = text.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|\Z)/gm, + function (wholeMatch,m1,m2,m3,m4) { + m1 = m1.toLowerCase(); + g_urls[m1] = _EncodeAmpsAndAngles(m2); // Link IDs are case-insensitive + if (m3) { + // Oops, found blank lines, so it's not a title. + // Put back the parenthetical statement we stole. + return m3+m4; + } else if (m4) { + g_titles[m1] = m4.replace(/"/g,"""); + } + + // Completely remove the definition from the text + return ""; + } + ); + + return text; +} + + +var _HashHTMLBlocks = function(text) { + // attacklab: Double up blank lines to reduce lookaround + text = text.replace(/\n/g,"\n\n"); + + // Hashify HTML blocks: + // We only want to do this for block-level HTML tags, such as headers, + // lists, and tables. That's because we still want to wrap

s around + // "paragraphs" that are wrapped in non-block-level tags, such as anchors, + // phrase emphasis, and spans. The list of tags we're looking for is + // hard-coded: + var block_tags_a = "p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del" + var block_tags_b = "p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math" + + // First, look for nested blocks, e.g.: + //

+ //
+ // tags for inner block must be indented. + //
+ //
+ // + // The outermost tags must start at the left margin for this to match, and + // the inner nested divs must be indented. + // We need to do this before the next, more liberal match, because the next + // match will start at the first `
` and stop at the first `
`. + + // attacklab: This regex can be expensive when it fails. + /* + var text = text.replace(/ + ( // save in $1 + ^ // start of line (with /m) + <($block_tags_a) // start tag = $2 + \b // word break + // attacklab: hack around khtml/pcre bug... + [^\r]*?\n // any number of lines, minimally matching + // the matching end tag + [ \t]* // trailing spaces/tabs + (?=\n+) // followed by a newline + ) // attacklab: there are sentinel newlines at end of document + /gm,function(){...}}; + */ + text = text.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,hashElement); + + // + // Now match more liberally, simply from `\n` to `\n` + // + + /* + var text = text.replace(/ + ( // save in $1 + ^ // start of line (with /m) + <($block_tags_b) // start tag = $2 + \b // word break + // attacklab: hack around khtml/pcre bug... + [^\r]*? // any number of lines, minimally matching + .* // the matching end tag + [ \t]* // trailing spaces/tabs + (?=\n+) // followed by a newline + ) // attacklab: there are sentinel newlines at end of document + /gm,function(){...}}; + */ + text = text.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm,hashElement); + + // Special case just for
. It was easier to make a special case than + // to make the other regex more complicated. + + /* + text = text.replace(/ + ( // save in $1 + \n\n // Starting after a blank line + [ ]{0,3} + (<(hr) // start tag = $2 + \b // word break + ([^<>])*? // + \/?>) // the matching end tag + [ \t]* + (?=\n{2,}) // followed by a blank line + ) + /g,hashElement); + */ + text = text.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,hashElement); + + // Special case for standalone HTML comments: + + /* + text = text.replace(/ + ( // save in $1 + \n\n // Starting after a blank line + [ ]{0,3} // attacklab: g_tab_width - 1 + + [ \t]* + (?=\n{2,}) // followed by a blank line + ) + /g,hashElement); + */ + text = text.replace(/(\n\n[ ]{0,3}[ \t]*(?=\n{2,}))/g,hashElement); + + // PHP and ASP-style processor instructions ( and <%...%>) + + /* + text = text.replace(/ + (?: + \n\n // Starting after a blank line + ) + ( // save in $1 + [ ]{0,3} // attacklab: g_tab_width - 1 + (?: + <([?%]) // $2 + [^\r]*? + \2> + ) + [ \t]* + (?=\n{2,}) // followed by a blank line + ) + /g,hashElement); + */ + text = text.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,hashElement); + + // attacklab: Undo double lines (see comment at top of this function) + text = text.replace(/\n\n/g,"\n"); + return text; +} + +var hashElement = function(wholeMatch,m1) { + var blockText = m1; + + // Undo double lines + blockText = blockText.replace(/\n\n/g,"\n"); + blockText = blockText.replace(/^\n/,""); + + // strip trailing blank lines + blockText = blockText.replace(/\n+$/g,""); + + // Replace the element text with a marker ("~KxK" where x is its key) + blockText = "\n\n~K" + (g_html_blocks.push(blockText)-1) + "K\n\n"; + + return blockText; +}; + +var _RunBlockGamut = function(text) { +// +// These are all the transformations that form block-level +// tags like paragraphs, headers, and list items. +// + text = _DoHeaders(text); + + // Do Horizontal Rules: + var key = hashBlock("
"); + text = text.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,key); + text = text.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,key); + text = text.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,key); + + text = _DoLists(text); + text = _DoCodeBlocks(text); + text = _DoBlockQuotes(text); + + // We already ran _HashHTMLBlocks() before, in Markdown(), but that + // was to escape raw HTML in the original Markdown source. This time, + // we're escaping the markup we've just created, so that we don't wrap + //

tags around block-level tags. + text = _HashHTMLBlocks(text); + text = _FormParagraphs(text); + + return text; +} + + +var _RunSpanGamut = function(text) { +// +// These are all the transformations that occur *within* block-level +// tags like paragraphs, headers, and list items. +// + + text = _DoCodeSpans(text); + text = _EscapeSpecialCharsWithinTagAttributes(text); + text = _EncodeBackslashEscapes(text); + + // Process anchor and image tags. Images must come first, + // because ![foo][f] looks like an anchor. + text = _DoImages(text); + text = _DoAnchors(text); + + // Make links out of things like `` + // Must come after _DoAnchors(), because you can use < and > + // delimiters in inline links like [this](). + text = _DoAutoLinks(text); + text = _EncodeAmpsAndAngles(text); + text = _DoItalicsAndBold(text); + + // Do hard breaks: + text = text.replace(/ +\n/g,"
\n"); + + return text; +} + +var _EscapeSpecialCharsWithinTagAttributes = function(text) { +// +// Within tags -- meaning between < and > -- encode [\ ` * _] so they +// don't conflict with their use in Markdown for code, italics and strong. +// + + // Build a regex to find HTML tags and comments. See Friedl's + // "Mastering Regular Expressions", 2nd Ed., pp. 200-201. + var regex = /(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|)/gi; + + text = text.replace(regex, function(wholeMatch) { + var tag = wholeMatch.replace(/(.)<\/?code>(?=.)/g,"$1`"); + tag = escapeCharacters(tag,"\\`*_"); + return tag; + }); + + return text; +} + +var _DoAnchors = function(text) { +// +// Turn Markdown link shortcuts into XHTML tags. +// + // + // First, handle reference-style links: [link text] [id] + // + + /* + text = text.replace(/ + ( // wrap whole match in $1 + \[ + ( + (?: + \[[^\]]*\] // allow brackets nested one level + | + [^\[] // or anything else + )* + ) + \] + + [ ]? // one optional space + (?:\n[ ]*)? // one optional newline followed by spaces + + \[ + (.*?) // id = $3 + \] + )()()()() // pad remaining backreferences + /g,_DoAnchors_callback); + */ + text = text.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,writeAnchorTag); + + // + // Next, inline-style links: [link text](url "optional title") + // + + /* + text = text.replace(/ + ( // wrap whole match in $1 + \[ + ( + (?: + \[[^\]]*\] // allow brackets nested one level + | + [^\[\]] // or anything else + ) + ) + \] + \( // literal paren + [ \t]* + () // no id, so leave $3 empty + ? // href = $4 + [ \t]* + ( // $5 + (['"]) // quote char = $6 + (.*?) // Title = $7 + \6 // matching quote + [ \t]* // ignore any spaces/tabs between closing quote and ) + )? // title is optional + \) + ) + /g,writeAnchorTag); + */ + text = text.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,writeAnchorTag); + + // + // Last, handle reference-style shortcuts: [link text] + // These must come last in case you've also got [link test][1] + // or [link test](/foo) + // + + /* + text = text.replace(/ + ( // wrap whole match in $1 + \[ + ([^\[\]]+) // link text = $2; can't contain '[' or ']' + \] + )()()()()() // pad rest of backreferences + /g, writeAnchorTag); + */ + text = text.replace(/(\[([^\[\]]+)\])()()()()()/g, writeAnchorTag); + + return text; +} + +var writeAnchorTag = function(wholeMatch,m1,m2,m3,m4,m5,m6,m7) { + if (m7 == undefined) m7 = ""; + var whole_match = m1; + var link_text = m2; + var link_id = m3.toLowerCase(); + var url = m4; + var title = m7; + + if (url == "") { + if (link_id == "") { + // lower-case and turn embedded newlines into spaces + link_id = link_text.toLowerCase().replace(/ ?\n/g," "); + } + url = "#"+link_id; + + if (g_urls[link_id] != undefined) { + url = g_urls[link_id]; + if (g_titles[link_id] != undefined) { + title = g_titles[link_id]; + } + } + else { + if (whole_match.search(/\(\s*\)$/m)>-1) { + // Special case for explicit empty url + url = ""; + } else { + return whole_match; + } + } + } + + url = escapeCharacters(url,"*_"); + var result = ""; + + return result; +} + + +var _DoImages = function(text) { +// +// Turn Markdown image shortcuts into tags. +// + + // + // First, handle reference-style labeled images: ![alt text][id] + // + + /* + text = text.replace(/ + ( // wrap whole match in $1 + !\[ + (.*?) // alt text = $2 + \] + + [ ]? // one optional space + (?:\n[ ]*)? // one optional newline followed by spaces + + \[ + (.*?) // id = $3 + \] + )()()()() // pad rest of backreferences + /g,writeImageTag); + */ + text = text.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,writeImageTag); + + // + // Next, handle inline images: ![alt text](url "optional title") + // Don't forget: encode * and _ + + /* + text = text.replace(/ + ( // wrap whole match in $1 + !\[ + (.*?) // alt text = $2 + \] + \s? // One optional whitespace character + \( // literal paren + [ \t]* + () // no id, so leave $3 empty + ? // src url = $4 + [ \t]* + ( // $5 + (['"]) // quote char = $6 + (.*?) // title = $7 + \6 // matching quote + [ \t]* + )? // title is optional + \) + ) + /g,writeImageTag); + */ + text = text.replace(/(!\[(.*?)\]\s?\([ \t]*()?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,writeImageTag); + + return text; +} + +var writeImageTag = function(wholeMatch,m1,m2,m3,m4,m5,m6,m7) { + var whole_match = m1; + var alt_text = m2; + var link_id = m3.toLowerCase(); + var url = m4; + var title = m7; + + if (!title) title = ""; + + if (url == "") { + if (link_id == "") { + // lower-case and turn embedded newlines into spaces + link_id = alt_text.toLowerCase().replace(/ ?\n/g," "); + } + url = "#"+link_id; + + if (g_urls[link_id] != undefined) { + url = g_urls[link_id]; + if (g_titles[link_id] != undefined) { + title = g_titles[link_id]; + } + } + else { + return whole_match; + } + } + + alt_text = alt_text.replace(/"/g,"""); + url = escapeCharacters(url,"*_"); + var result = "\""" + _RunSpanGamut(m1) + "");}); + + text = text.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm, + function(matchFound,m1){return hashBlock("

" + _RunSpanGamut(m1) + "

");}); + + // atx-style headers: + // # Header 1 + // ## Header 2 + // ## Header 2 with closing hashes ## + // ... + // ###### Header 6 + // + + /* + text = text.replace(/ + ^(\#{1,6}) // $1 = string of #'s + [ \t]* + (.+?) // $2 = Header text + [ \t]* + \#* // optional closing #'s (not counted) + \n+ + /gm, function() {...}); + */ + + text = text.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm, + function(wholeMatch,m1,m2) { + var h_level = m1.length; + return hashBlock("" + _RunSpanGamut(m2) + ""); + }); + + return text; +} + +// This declaration keeps Dojo compressor from outputting garbage: +var _ProcessListItems; + +var _DoLists = function(text) { +// +// Form HTML ordered (numbered) and unordered (bulleted) lists. +// + + // attacklab: add sentinel to hack around khtml/safari bug: + // http://bugs.webkit.org/show_bug.cgi?id=11231 + text += "~0"; + + // Re-usable pattern to match any entirel ul or ol list: + + /* + var whole_list = / + ( // $1 = whole list + ( // $2 + [ ]{0,3} // attacklab: g_tab_width - 1 + ([*+-]|\d+[.]) // $3 = first list item marker + [ \t]+ + ) + [^\r]+? + ( // $4 + ~0 // sentinel for workaround; should be $ + | + \n{2,} + (?=\S) + (?! // Negative lookahead for another list item marker + [ \t]* + (?:[*+-]|\d+[.])[ \t]+ + ) + ) + )/g + */ + var whole_list = /^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm; + + if (g_list_level) { + text = text.replace(whole_list,function(wholeMatch,m1,m2) { + var list = m1; + var list_type = (m2.search(/[*+-]/g)>-1) ? "ul" : "ol"; + + // Turn double returns into triple returns, so that we can make a + // paragraph for the last item in a list, if necessary: + list = list.replace(/\n{2,}/g,"\n\n\n");; + var result = _ProcessListItems(list); + + // Trim any trailing whitespace, to put the closing `` + // up on the preceding line, to get it past the current stupid + // HTML block parser. This is a hack to work around the terrible + // hack that is the HTML block parser. + result = result.replace(/\s+$/,""); + result = "<"+list_type+">" + result + "\n"; + return result; + }); + } else { + whole_list = /(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g; + text = text.replace(whole_list,function(wholeMatch,m1,m2,m3) { + var runup = m1; + var list = m2; + + var list_type = (m3.search(/[*+-]/g)>-1) ? "ul" : "ol"; + // Turn double returns into triple returns, so that we can make a + // paragraph for the last item in a list, if necessary: + var list = list.replace(/\n{2,}/g,"\n\n\n");; + var result = _ProcessListItems(list); + result = runup + "<"+list_type+">\n" + result + "\n"; + return result; + }); + } + + // attacklab: strip sentinel + text = text.replace(/~0/,""); + + return text; +} + +_ProcessListItems = function(list_str) { +// +// Process the contents of a single ordered or unordered list, splitting it +// into individual list items. +// + // The $g_list_level global keeps track of when we're inside a list. + // Each time we enter a list, we increment it; when we leave a list, + // we decrement. If it's zero, we're not in a list anymore. + // + // We do this because when we're not inside a list, we want to treat + // something like this: + // + // I recommend upgrading to version + // 8. Oops, now this line is treated + // as a sub-list. + // + // As a single paragraph, despite the fact that the second line starts + // with a digit-period-space sequence. + // + // Whereas when we're inside a list (or sub-list), that line will be + // treated as the start of a sub-list. What a kludge, huh? This is + // an aspect of Markdown's syntax that's hard to parse perfectly + // without resorting to mind-reading. Perhaps the solution is to + // change the syntax rules such that sub-lists must start with a + // starting cardinal number; e.g. "1." or "a.". + + g_list_level++; + + // trim trailing blank lines: + list_str = list_str.replace(/\n{2,}$/,"\n"); + + // attacklab: add sentinel to emulate \z + list_str += "~0"; + + /* + list_str = list_str.replace(/ + (\n)? // leading line = $1 + (^[ \t]*) // leading whitespace = $2 + ([*+-]|\d+[.]) [ \t]+ // list marker = $3 + ([^\r]+? // list item text = $4 + (\n{1,2})) + (?= \n* (~0 | \2 ([*+-]|\d+[.]) [ \t]+)) + /gm, function(){...}); + */ + list_str = list_str.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm, + function(wholeMatch,m1,m2,m3,m4){ + var item = m4; + var leading_line = m1; + var leading_space = m2; + + if (leading_line || (item.search(/\n{2,}/)>-1)) { + item = _RunBlockGamut(_Outdent(item)); + } + else { + // Recursion for sub-lists: + item = _DoLists(_Outdent(item)); + item = item.replace(/\n$/,""); // chomp(item) + item = _RunSpanGamut(item); + } + + return "
  • " + item + "
  • \n"; + } + ); + + // attacklab: strip sentinel + list_str = list_str.replace(/~0/g,""); + + g_list_level--; + return list_str; +} + + +var _DoCodeBlocks = function(text) { +// +// Process Markdown `
    ` blocks.
    +//
    +
    +	/*
    +		text = text.replace(text,
    +			/(?:\n\n|^)
    +			(								// $1 = the code block -- one or more lines, starting with a space/tab
    +				(?:
    +					(?:[ ]{4}|\t)			// Lines must start with a tab or a tab-width of spaces - attacklab: g_tab_width
    +					.*\n+
    +				)+
    +			)
    +			(\n*[ ]{0,3}[^ \t\n]|(?=~0))	// attacklab: g_tab_width
    +		/g,function(){...});
    +	*/
    +
    +	// attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
    +	text += "~0";
    +
    +	text = text.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,
    +		function(wholeMatch,m1,m2) {
    +			var codeblock = m1;
    +			var nextChar = m2;
    +
    +			codeblock = _EncodeCode( _Outdent(codeblock));
    +			codeblock = _Detab(codeblock);
    +			codeblock = codeblock.replace(/^\n+/g,""); // trim leading newlines
    +			codeblock = codeblock.replace(/\n+$/g,""); // trim trailing whitespace
    +
    +			codeblock = "
    " + codeblock + "\n
    "; + + return hashBlock(codeblock) + nextChar; + } + ); + + // attacklab: strip sentinel + text = text.replace(/~0/,""); + + return text; +} + +var hashBlock = function(text) { + text = text.replace(/(^\n+|\n+$)/g,""); + return "\n\n~K" + (g_html_blocks.push(text)-1) + "K\n\n"; +} + + +var _DoCodeSpans = function(text) { +// +// * Backtick quotes are used for spans. +// +// * You can use multiple backticks as the delimiters if you want to +// include literal backticks in the code span. So, this input: +// +// Just type ``foo `bar` baz`` at the prompt. +// +// Will translate to: +// +//

    Just type foo `bar` baz at the prompt.

    +// +// There's no arbitrary limit to the number of backticks you +// can use as delimters. If you need three consecutive backticks +// in your code, use four for delimiters, etc. +// +// * You can use spaces to get literal backticks at the edges: +// +// ... type `` `bar` `` ... +// +// Turns to: +// +// ... type `bar` ... +// + + /* + text = text.replace(/ + (^|[^\\]) // Character before opening ` can't be a backslash + (`+) // $2 = Opening run of ` + ( // $3 = The code block + [^\r]*? + [^`] // attacklab: work around lack of lookbehind + ) + \2 // Matching closer + (?!`) + /gm, function(){...}); + */ + + text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, + function(wholeMatch,m1,m2,m3,m4) { + var c = m3; + c = c.replace(/^([ \t]*)/g,""); // leading whitespace + c = c.replace(/[ \t]*$/g,""); // trailing whitespace + c = _EncodeCode(c); + return m1+""+c+""; + }); + + return text; +} + + +var _EncodeCode = function(text) { +// +// Encode/escape certain characters inside Markdown code runs. +// The point is that in code, these characters are literals, +// and lose their special Markdown meanings. +// + // Encode all ampersands; HTML entities are not + // entities within a Markdown code span. + text = text.replace(/&/g,"&"); + + // Do the angle bracket song and dance: + text = text.replace(//g,">"); + + // Now, escape characters that are magic in Markdown: + text = escapeCharacters(text,"\*_{}[]\\",false); + +// jj the line above breaks this: +//--- + +//* Item + +// 1. Subitem + +// special char: * +//--- + + return text; +} + + +var _DoItalicsAndBold = function(text) { + + // must go first: + text = text.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g, + "$2"); + + text = text.replace(/(\w)_(\w)/g, "$1~E95E$2") // ** GFM ** "~E95E" == escaped "_" + text = text.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g, + "$2"); + + return text; +} + + +var _DoBlockQuotes = function(text) { + + /* + text = text.replace(/ + ( // Wrap whole match in $1 + ( + ^[ \t]*>[ \t]? // '>' at the start of a line + .+\n // rest of the first line + (.+\n)* // subsequent consecutive lines + \n* // blanks + )+ + ) + /gm, function(){...}); + */ + + text = text.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm, + function(wholeMatch,m1) { + var bq = m1; + + // attacklab: hack around Konqueror 3.5.4 bug: + // "----------bug".replace(/^-/g,"") == "bug" + + bq = bq.replace(/^[ \t]*>[ \t]?/gm,"~0"); // trim one level of quoting + + // attacklab: clean up hack + bq = bq.replace(/~0/g,""); + + bq = bq.replace(/^[ \t]+$/gm,""); // trim whitespace-only lines + bq = _RunBlockGamut(bq); // recurse + + bq = bq.replace(/(^|\n)/g,"$1 "); + // These leading spaces screw with
     content, so we need to fix that:
    +			bq = bq.replace(
    +					/(\s*
    [^\r]+?<\/pre>)/gm,
    +				function(wholeMatch,m1) {
    +					var pre = m1;
    +					// attacklab: hack around Konqueror 3.5.4 bug:
    +					pre = pre.replace(/^  /mg,"~0");
    +					pre = pre.replace(/~0/g,"");
    +					return pre;
    +				});
    +
    +			return hashBlock("
    \n" + bq + "\n
    "); + }); + return text; +} + + +var _FormParagraphs = function(text) { +// +// Params: +// $text - string to process with html

    tags +// + + // Strip leading and trailing lines: + text = text.replace(/^\n+/g,""); + text = text.replace(/\n+$/g,""); + + var grafs = text.split(/\n{2,}/g); + var grafsOut = new Array(); + + // + // Wrap

    tags. + // + var end = grafs.length; + for (var i=0; i= 0) { + grafsOut.push(str); + } + else if (str.search(/\S/) >= 0) { + str = _RunSpanGamut(str); + str = str.replace(/\n/g,"
    "); // ** GFM ** + str = str.replace(/^([ \t]*)/g,"

    "); + str += "

    " + grafsOut.push(str); + } + + } + + // + // Unhashify HTML blocks + // + end = grafsOut.length; + for (var i=0; i= 0) { + var blockText = g_html_blocks[RegExp.$1]; + blockText = blockText.replace(/\$/g,"$$$$"); // Escape any dollar signs + grafsOut[i] = grafsOut[i].replace(/~K\d+K/,blockText); + } + } + + return grafsOut.join("\n\n"); +} + + +var _EncodeAmpsAndAngles = function(text) { +// Smart processing for ampersands and angle brackets that need to be encoded. + + // Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin: + // http://bumppo.net/projects/amputator/ + text = text.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&"); + + // Encode naked <'s + text = text.replace(/<(?![a-z\/?\$!])/gi,"<"); + + return text; +} + + +var _EncodeBackslashEscapes = function(text) { +// +// Parameter: String. +// Returns: The string, with after processing the following backslash +// escape sequences. +// + + // attacklab: The polite way to do this is with the new + // escapeCharacters() function: + // + // text = escapeCharacters(text,"\\",true); + // text = escapeCharacters(text,"`*_{}[]()>#+-.!",true); + // + // ...but we're sidestepping its use of the (slow) RegExp constructor + // as an optimization for Firefox. This function gets called a LOT. + + text = text.replace(/\\(\\)/g,escapeCharacters_callback); + text = text.replace(/\\([`*_{}\[\]()>#+-.!])/g,escapeCharacters_callback); + return text; +} + + +var _DoAutoLinks = function(text) { + + text = text.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,"
    $1"); + + // Email addresses: + + /* + text = text.replace(/ + < + (?:mailto:)? + ( + [-.\w]+ + \@ + [-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+ + ) + > + /gi, _DoAutoLinks_callback()); + */ + text = text.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi, + function(wholeMatch,m1) { + return _EncodeEmailAddress( _UnescapeSpecialChars(m1) ); + } + ); + + return text; +} + + +var _EncodeEmailAddress = function(addr) { +// +// Input: an email address, e.g. "foo@example.com" +// +// Output: the email address as a mailto link, with each character +// of the address encoded as either a decimal or hex entity, in +// the hopes of foiling most address harvesting spam bots. E.g.: +// +// foo +// @example.com +// +// Based on a filter by Matthew Wickline, posted to the BBEdit-Talk +// mailing list: +// + + // attacklab: why can't javascript speak hex? + function char2hex(ch) { + var hexDigits = '0123456789ABCDEF'; + var dec = ch.charCodeAt(0); + return(hexDigits.charAt(dec>>4) + hexDigits.charAt(dec&15)); + } + + var encode = [ + function(ch){return "&#"+ch.charCodeAt(0)+";";}, + function(ch){return "&#x"+char2hex(ch)+";";}, + function(ch){return ch;} + ]; + + addr = "mailto:" + addr; + + addr = addr.replace(/./g, function(ch) { + if (ch == "@") { + // this *must* be encoded. I insist. + ch = encode[Math.floor(Math.random()*2)](ch); + } else if (ch !=":") { + // leave ':' alone (to spot mailto: later) + var r = Math.random(); + // roughly 10% raw, 45% hex, 45% dec + ch = ( + r > .9 ? encode[2](ch) : + r > .45 ? encode[1](ch) : + encode[0](ch) + ); + } + return ch; + }); + + addr = "" + addr + ""; + addr = addr.replace(/">.+:/g,"\">"); // strip the mailto: from the visible part + + return addr; +} + + +var _UnescapeSpecialChars = function(text) { +// +// Swap back in all the special characters we've hidden. +// + text = text.replace(/~E(\d+)E/g, + function(wholeMatch,m1) { + var charCodeToReplace = parseInt(m1); + return String.fromCharCode(charCodeToReplace); + } + ); + return text; +} + + +var _Outdent = function(text) { +// +// Remove one level of line-leading tabs or spaces +// + + // attacklab: hack around Konqueror 3.5.4 bug: + // "----------bug".replace(/^-/g,"") == "bug" + + text = text.replace(/^(\t|[ ]{1,4})/gm,"~0"); // attacklab: g_tab_width + + // attacklab: clean up hack + text = text.replace(/~0/g,"") + + return text; +} + +var _Detab = function(text) { +// attacklab: Detab's completely rewritten for speed. +// In perl we could fix it by anchoring the regexp with \G. +// In javascript we're less fortunate. + + // expand first n-1 tabs + text = text.replace(/\t(?=\t)/g," "); // attacklab: g_tab_width + + // replace the nth with two sentinels + text = text.replace(/\t/g,"~A~B"); + + // use the sentinel to anchor our regex so it doesn't explode + text = text.replace(/~B(.+?)~A/g, + function(wholeMatch,m1,m2) { + var leadingText = m1; + var numSpaces = 4 - leadingText.length % 4; // attacklab: g_tab_width + + // there *must* be a better way to do this: + for (var i=0; i - - -

    - The 'hello' document. -

    -
    
    -		
    -		
    -		
    -	
    -
    diff --git a/examples/readonly/html.html b/examples/readonly/html.html
    new file mode 100644
    index 00000000..91a8d116
    --- /dev/null
    +++ b/examples/readonly/html.html
    @@ -0,0 +1,32 @@
    +
    +	
    +		
    +	
    +	
    +		
    +
    +
    + + + + + diff --git a/examples/readonly/markdown.html b/examples/readonly/markdown.html new file mode 100644 index 00000000..9750ab58 --- /dev/null +++ b/examples/readonly/markdown.html @@ -0,0 +1,40 @@ + + + + + +
    +
    +
    + + + + + + diff --git a/examples/style.css b/examples/style.css new file mode 100644 index 00000000..12b50344 --- /dev/null +++ b/examples/style.css @@ -0,0 +1,17 @@ +#container { + width: 44em; + margin: 0px auto; + line-height: 1.4em; +} + +.content p { + padding-left: 1em; +} + +.content h1, .content h2, .content h3, .content h4, .content h5, .content h6 { + margin-top: 2em; +} + +.content pre { + white-space: pre-wrap; +} diff --git a/package.json b/package.json index abd2b15b..86a639f9 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { - "name": "otdb", + "name": "sharejs", "version": "0.1.0", "description": "A database for concurrent document editing", "keywords": ["operational transformation", "ot", "concurrent", "collaborative", "database", "server"], "homepage": "", "author": "Joseph Gentle ", "main": "lib/server/main.js", - "bin": { "otdb": "server/main.js" }, + "bin": { "sharejs": "bin/sharejs" }, "dependencies": { "socket.io": ">= 0.6.0", "socket.io-node-client": "*", @@ -19,6 +19,6 @@ }], "repository": { "type": "git", - "url": "", - }, + "url": "http://github.com/josephg/sharejs.git" + } } diff --git a/scripts/apply.csv b/scripts/apply.csv new file mode 100644 index 00000000..3ad633c5 --- /dev/null +++ b/scripts/apply.csv @@ -0,0 +1,51 @@ +0,1299828805706,1 +1000,1299828805708,338 +2000,1299828805710,702 +3000,1299828805712,1094 +4000,1299828805715,1469 +5000,1299828805718,1878 +6000,1299828805722,2232 +7000,1299828805725,2717 +8000,1299828805730,3100 +9000,1299828805735,3510 +10000,1299828805740,3870 +11000,1299828805745,4256 +12000,1299828805751,4554 +13000,1299828805758,4947 +14000,1299828805764,5313 +15000,1299828805772,5776 +16000,1299828805780,6228 +17000,1299828805787,6547 +18000,1299828805796,6943 +19000,1299828805805,7350 +20000,1299828805814,7747 +21000,1299828805824,8141 +22000,1299828805835,8474 +23000,1299828805845,8895 +24000,1299828805857,9314 +25000,1299828805868,9688 +26000,1299828805880,10056 +27000,1299828805893,10440 +28000,1299828805905,10777 +29000,1299828805919,11174 +30000,1299828805932,11528 +31000,1299828805946,11920 +32000,1299828805960,12281 +33000,1299828805975,12704 +34000,1299828805991,13154 +35000,1299828806006,13419 +36000,1299828806023,13750 +37000,1299828806038,14119 +38000,1299828806055,14646 +39000,1299828806073,15041 +40000,1299828806091,15398 +41000,1299828806108,15729 +42000,1299828806128,15967 +43000,1299828806146,16484 +44000,1299828806166,16845 +45000,1299828806185,17249 +46000,1299828806206,17710 +47000,1299828806226,18165 +48000,1299828806247,18562 +49000,1299828806268,18946 +50000,1299828806291,19343 diff --git a/scripts/benchmark/benchmark.coffee b/scripts/benchmark/benchmark.coffee new file mode 100644 index 00000000..c21ea64d --- /dev/null +++ b/scripts/benchmark/benchmark.coffee @@ -0,0 +1,96 @@ +randomWord = require '../test/types/randomWord' +composableText = require '../lib/types/text' + +util = require 'util' +p = util.debug + +generator = (doc) -> + # Most edits are simply users typing or deleting text. + pos = Math.floor(Math.random() * (doc.length + 1)) + + size = if Math.random() < 0.1 then 'large' else 'small' + + if size == 'small' + # Randomly either delete a character + + # Its illegal to delete at the end of insert at the start. No-ops are very rare in practice. + action = if pos == doc.length + 'insert' + else if pos == 0 + 'delete' + else + # Slightly bias it toward inserts. Documents tend to grow more than shrink. + if Math.random() < 0.55 then 'insert' else 'delete' + + if action == 'insert' + # Insert a random character. + code = 97 + Math.floor(Math.random() * 26) + + {pos:pos, i:String.fromCharCode(code)} + else + char = doc[pos] + + {pos:pos, d:char} + else + # Do a chunky delete / insert. + op = {pos:pos} + op.d = doc[pos..(pos + Math.random() * 8)] if Math.random() < 0.45 && pos < doc.length + op.i = randomWord() + ' ' if Math.random() < 0.9 || !op.d? + delete op.i if op.i == '' + + op + +generatorOpToComposable = (doc, op) -> + cOp = [] + cOp.push(op.pos) + cOp.push {d:op.d} if op.d? + cOp.push {i:op.i} if op.i? + remainder = doc.length - op.pos + remainder -= op.d.length if op.d? + cOp.push remainder + + composableText.normalize cOp + + +genOps = (doc) -> + ops = [] + for x in [1..50000] + op = generator doc + cOp = generatorOpToComposable doc, op + # p "'#{doc}' + #{util.inspect cOp}" + newDoc = composableText.apply doc, cOp + #console.log "'#{doc}' -> '#{newDoc}' via #{util.inspect cOp}" + doc = newDoc + + ops.push cOp + + ops + +benchmark = (callback) -> + start = Date.now() + data = callback() + end = Date.now() + + [end - start, data] + +initial = '' +#initial = (randomWord() for x in [1..1000]).join(' ') +#p "Initial len=#{initial.length}" +ops = genOps initial +doc = null + +[total, times] = benchmark -> + doc = initial + times = [] + for op, i in ops + doc = composableText.apply(doc, op) + times.push [i, Date.now(), doc.length] if i % 1000 == 0 + + times.push [ops.length, Date.now(), doc.length] + + times + +#console.log "Applied #{ops.length} ops, final doc length #{doc.length} in #{total} ms. #{total / ops.length} ms per op, #{1000 * ops.length / total} ops/sec" + +console.log t.join(',') for t in times +#console.log util.inspect times diff --git a/scripts/cat.coffee b/scripts/cat.coffee new file mode 100644 index 00000000..58e1be95 --- /dev/null +++ b/scripts/cat.coffee @@ -0,0 +1,34 @@ +# A simple script to fetch a document from the server. + +Connection = require('../src/client').Connection + +getSocket = (hostname, port, docName) -> + c = new Connection(hostname, port) + c.get docName, (doc) -> + console.log (if typeof doc.snapshot == 'string' + doc.snapshot + else + JSON.stringify doc.snapshot) + + c.disconnect() + + +http = require 'http' + +getREST = (hostname, port, docName) -> + http.get {host: hostname, port: port, path: "/doc/#{docName}"}, (res) -> + message = [] + res.on 'data', (data) -> message.push data + res.on 'end', -> + message = message.join '' + doc = JSON.parse message + if typeof doc.snapshot == 'string' + console.log doc.snapshot + else + console.log JSON.stringify(doc.snapshot) + + +if process.argv.length < 3 + console.error "Usage: coffee cat.coffee DOCNAME" +else + getREST 'localhost', 8000, process.argv[2] diff --git a/scripts/stats.coffee b/scripts/stats.coffee new file mode 100644 index 00000000..84cb6a31 --- /dev/null +++ b/scripts/stats.coffee @@ -0,0 +1,100 @@ +redis = require 'redis' +text = require '../src/types/text' + +client = redis.createClient() + +debug = require('util').debug + +# Returns how many components of the op aren't skips +opComplexity = (op) -> + op.filter((c) -> typeof c != 'number').length + + +# Compose adjacent ops together into groups the size of window. +composeAdjacent = (data, window) -> + composedOps = [] + op = null + + console.log "\nSimulating lag of #{window}ms..." + + for opData in data +# console.log opData + if op == null or opData.meta.ts > (op.meta.ts + window) +# console.log op + composedOps.push op if op? + op = {op:opData.op, meta:{ts:opData.meta.ts}} + time = opData.meta.ts + else + op.op = text.compose op.op, opData.op + + composedOps.push(op) if op? + + console.log "#{data.length} ops composed into #{composedOps.length} ops (avg #{data.length / composedOps.length} ops/#{window}ms)" + + composedOps + +printStats = (data) -> + deletes = 0 + inserts = 0 + singleCharIns = 0 + singleCharDel = 0 + simpleOps = 0 + totalComplexity = 0 + total = 0 + + simpleComposed = 0 + + lastOp = null + + for opData in data + op = opData.op + + complexity = opComplexity(op) + simpleOps++ if complexity <= 1 + totalComplexity += complexity + + if lastOp? + composed = text.compose lastOp, op + # Basically, we want to figure out if there's no gap between the text. + simpleComposed++ if opComplexity(composed) <= 1 + +# pos = if op[0] == 'number' then op[0] else 0 + for c in op + if c.d? + deletes++ + singleCharDel++ if c.d.length == 1 + + if c.i? + inserts++ + singleCharIns++ if c.i.length == 1 + + lastOp = op + total++ + + console.log() + console.log "#{total} ops, with #{totalComplexity} inserts or deletes" + console.log "#{100 * inserts/total}% inserts" + console.log " of which #{100 * singleCharIns/inserts}% were only a single character" + console.log "#{100 * deletes/total}% deletes" + console.log " of which #{100 * singleCharDel/deletes}% were only a single character" + console.log "#{totalComplexity/total} avg complexity per op" + + simpleOpsPct = 100 * simpleOps/total + console.log "#{simpleOpsPct}% simpleOps, #{100 - simpleOpsPct}% complex ops" + console.log "#{100 * simpleComposed/(total - 1)}% op pairs are simple" + + + +client.lrange 'OTDB:ops:hello', 1, 12639, (err, values) -> + throw err if err? + + data = values.map (v) -> JSON.parse(v) + + printStats(data) + + console.log "\n\nComposed:\n" +# console.log c for c in composed + printStats composeAdjacent(data, window) for window in [500, 1000, 2000, 5000] + + process.exit(0) + diff --git a/scripts/talk.coffee b/scripts/talk.coffee new file mode 100644 index 00000000..8df0de0a --- /dev/null +++ b/scripts/talk.coffee @@ -0,0 +1,18 @@ +Connection = require('../src/client').Connection + +# This will add generateRandomOp to the type +require '../test/types/text' +types = require '../src/types' + +generate = -> + c = new Connection('localhost', 8000) + c.getOrCreate 'sarahtest', (doc) -> + apply = -> + [op, _] = types.text.generateRandomOp doc.snapshot + # console.log doc.snapshot + # console.log op + doc.submitOp op + + setInterval apply, 100 + +generate() for [1..10] diff --git a/share.js b/share.js new file mode 100644 index 00000000..d929bc16 --- /dev/null +++ b/share.js @@ -0,0 +1,658 @@ +/** + * MicroEvent - to make any js object an event emitter (server or browser) + * + * - pure javascript - server compatible, browser compatible + * - dont rely on the browser doms + * - super simple - you get it immediatly, no mistery, no magic involved + * + * - create a MicroEventDebug with goodies to debug + * - make it safer to use +*/ + +var MicroEvent = function(){}; +MicroEvent.prototype = { + subscribe : function(event, fct){ + this._events = this._events || {}; + this._events[event] = this._events[event] || []; + this._events[event].push(fct); + return this; + }, + unsubscribe : function(event, fct){ + this._events = this._events || {}; + if( event in this._events === false ) return this; + this._events[event].splice(this._events[event].indexOf(fct), 1); + return this; + }, + publish : function(event /* , args... */){ + this._events = this._events || {}; + if( event in this._events === false ) return this; + for(var i = 0; i < this._events[event].length; i++){ + this._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1)); + } + return this; + } +}; + +/** + * mixin will delegate all MicroEvent.js function in the destination object + * + * - require('MicroEvent').mixin(Foobar) will make Foobar able to use MicroEvent + * + * @param {Object} the object which will support MicroEvent +*/ +MicroEvent.mixin = function(destObject){ + var props = ['subscribe', 'unsubscribe', 'publish']; + for(var i = 0; i < props.length; i ++){ + destObject.prototype[props[i]] = MicroEvent.prototype[props[i]]; + } +}; + +// export in common js +if( typeof module !== "undefined" && ('exports' in module)){ + module.exports = MicroEvent; +} +(function() { + var Connection, Document, MicroEvent, OpStream, append, checkValidComponent, checkValidOp, compose, compress, i, inject, invertComponent, io, p, transformComponent, transformComponentX, transformPosition, transformX, types, _base; + var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; + typeof exports != "undefined" && exports !== null ? exports : exports = {}; + exports.name = 'text'; + exports.initialVersion = function() { + return ''; + }; + inject = function(s1, pos, s2) { + return s1.slice(0, pos) + s2 + s1.slice(pos); + }; + checkValidComponent = function(c) { + var d_type, i_type; + if (typeof c.p !== 'number') { + throw new Error('component missing position field'); + } + i_type = typeof c.i; + d_type = typeof c.d; + if (!((i_type === 'string') ^ (d_type === 'string'))) { + throw new Error('component needs an i or d field'); + } + if (!(c.p >= 0)) { + throw new Error('position cannot be negative'); + } + }; + checkValidOp = function(op) { + var c, _i, _len; + for (_i = 0, _len = op.length; _i < _len; _i++) { + c = op[_i]; + checkValidComponent(c); + } + return true; + }; + exports.apply = function(snapshot, op) { + var component, deleted, _i, _len; + checkValidOp(op); + for (_i = 0, _len = op.length; _i < _len; _i++) { + component = op[_i]; + if (component.i != null) { + snapshot = inject(snapshot, component.p, component.i); + } else { + deleted = snapshot.slice(component.p, component.p + component.d.length); + if (component.d !== deleted) { + throw new Error("Delete component '" + component.d + "' does not match deleted text '" + deleted + "'"); + } + snapshot = snapshot.slice(0, component.p) + snapshot.slice(component.p + component.d.length); + } + } + return snapshot; + }; + exports._append = append = function(newOp, c) { + var last, _ref, _ref2; + if (c.i === '' || c.d === '') { + return; + } + if (newOp.length === 0) { + return newOp.push(c); + } else { + last = newOp[newOp.length - 1]; + if ((last.i != null) && (c.i != null) && (last.p <= (_ref = c.p) && _ref <= (last.p + last.i.length))) { + return newOp[newOp.length - 1] = { + i: inject(last.i, c.p - last.p, c.i), + p: last.p + }; + } else if ((last.d != null) && (c.d != null) && (c.p <= (_ref2 = last.p) && _ref2 <= (c.p + c.d.length))) { + return newOp[newOp.length - 1] = { + d: inject(c.d, last.p - c.p, last.d), + p: c.p + }; + } else { + return newOp.push(c); + } + } + }; + exports.compose = compose = function(op1, op2) { + var c, newOp, _i, _len; + checkValidOp(op1); + checkValidOp(op2); + newOp = op1.slice(); + for (_i = 0, _len = op2.length; _i < _len; _i++) { + c = op2[_i]; + append(newOp, c); + } + checkValidOp(newOp); + return newOp; + }; + exports.compress = compress = function(op) { + return compose([], op); + }; + exports.normalize = compress; + transformPosition = function(pos, c, insertAfter) { + if (c.i != null) { + if (c.p < pos || (c.p === pos && insertAfter)) { + return pos + c.i.length; + } else { + return pos; + } + } else { + if (pos <= c.p) { + return pos; + } else if (pos <= c.p + c.d.length) { + return c.p; + } else { + return pos - c.d.length; + } + } + }; + exports.transformCursor = function(position, op, insertAfter) { + var c, _i, _len; + for (_i = 0, _len = op.length; _i < _len; _i++) { + c = op[_i]; + position = transformPosition(position, c, insertAfter); + } + return position; + }; + transformComponent = function(dest, c, otherC, type) { + var cIntersect, intersectEnd, intersectStart, newC, otherIntersect, s; + checkValidOp([c]); + checkValidOp([otherC]); + if (c.i != null) { + return append(dest, { + i: c.i, + p: transformPosition(c.p, otherC, type === 'server') + }); + } else { + if (otherC.i != null) { + s = c.d; + if (c.p < otherC.p) { + append(dest, { + d: s.slice(0, otherC.p - c.p), + p: c.p + }); + s = s.slice(otherC.p - c.p); + } + if (s !== '') { + return append(dest, { + d: s, + p: c.p + otherC.i.length + }); + } + } else { + if (c.p >= otherC.p + otherC.d.length) { + return append(dest, { + d: c.d, + p: c.p - otherC.d.length + }); + } else if (c.p + c.d.length <= otherC.p) { + return append(dest, c); + } else { + newC = { + d: '', + p: c.p + }; + if (c.p < otherC.p) { + newC.d = c.d.slice(0, otherC.p - c.p); + } + if (c.p + c.d.length > otherC.p + otherC.d.length) { + newC.d += c.d.slice(otherC.p + otherC.d.length - c.p); + } + intersectStart = Math.max(c.p, otherC.p); + intersectEnd = Math.min(c.p + c.d.length, otherC.p + otherC.d.length); + cIntersect = c.d.slice(intersectStart - c.p, intersectEnd - c.p); + otherIntersect = otherC.d.slice(intersectStart - otherC.p, intersectEnd - otherC.p); + if (cIntersect !== otherIntersect) { + throw new Error('Delete ops delete different text in the same region of the document'); + } + if (newC.d !== '') { + newC.p = transformPosition(newC.p, otherC); + return append(dest, newC); + } + } + } + } + }; + transformComponentX = function(server, client, destServer, destClient) { + transformComponent(destServer, server, client, 'server'); + return transformComponent(destClient, client, server, 'client'); + }; + exports.transformX = transformX = function(serverOp, clientOp) { + var c, c_, clientComponent, k, newClientOp, newServerOp, nextC, s, s_, _i, _j, _k, _l, _len, _len2, _len3, _len4, _ref, _ref2; + checkValidOp(serverOp); + checkValidOp(clientOp); + newClientOp = []; + for (_i = 0, _len = clientOp.length; _i < _len; _i++) { + clientComponent = clientOp[_i]; + newServerOp = []; + k = 0; + while (k < serverOp.length) { + nextC = []; + transformComponentX(serverOp[k], clientComponent, newServerOp, nextC); + k++; + if (nextC.length === 1) { + clientComponent = nextC[0]; + } else if (nextC.length === 0) { + _ref = serverOp.slice(k); + for (_j = 0, _len2 = _ref.length; _j < _len2; _j++) { + s = _ref[_j]; + append(newServerOp, s); + } + clientComponent = null; + break; + } else { + _ref2 = transformX(serverOp.slice(k), nextC), s_ = _ref2[0], c_ = _ref2[1]; + for (_k = 0, _len3 = s_.length; _k < _len3; _k++) { + s = s_[_k]; + append(newServerOp, s); + } + for (_l = 0, _len4 = c_.length; _l < _len4; _l++) { + c = c_[_l]; + append(newClientOp, c); + } + clientComponent = null; + break; + } + } + if (clientComponent != null) { + append(newClientOp, clientComponent); + } + serverOp = newServerOp; + } + return [serverOp, newClientOp]; + }; + exports.transform = function(op, otherOp, type) { + var client, server, _, _ref, _ref2; + if (!(type === 'server' || type === 'client')) { + throw new Error("type must be 'server' or 'client'"); + } + if (type === 'server') { + _ref = transformX(op, otherOp), server = _ref[0], _ = _ref[1]; + return server; + } else { + _ref2 = transformX(otherOp, op), _ = _ref2[0], client = _ref2[1]; + return client; + } + }; + invertComponent = function(c) { + if (c.i != null) { + return { + d: c.i, + p: c.p + }; + } else { + return { + i: c.d, + p: c.p + }; + } + }; + exports.invert = function(op) { + var c, _i, _len, _ref, _results; + _ref = op.slice().reverse(); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + c = _ref[_i]; + _results.push(invertComponent(c)); + } + return _results; + }; + if (typeof window != "undefined" && window !== null) { + window.sharejs || (window.sharejs = {}); + (_base = window.sharejs).types || (_base.types = {}); + window.sharejs.types.text = exports; + } + if (typeof window != "undefined" && window !== null) { + if (window.io == null) { + throw new Error('Must load socket.io before this library'); + } + io = window.io; + } else { + io = require('../../thirdparty/Socket.io-node-client').io; + } + p = function() {}; + OpStream = (function() { + function OpStream(hostname, port, path) { + var resource; + this.hostname = hostname; + this.port = port; + this.onMessage = __bind(this.onMessage, this);; + resource = path ? path + '/socket.io' : 'socket.io'; + this.socket = new io.Socket(this.hostname, { + port: this.port, + resource: resource + }); + this.socket.on('connect', this.onConnect); + this.socket.on('message', this.onMessage); + this.socket.connect(); + this.callbacks = {}; + this.lastReceivedDoc = null; + this.lastSentDoc = null; + } + OpStream.prototype.onConnect = function() { + return p('connected'); + }; + OpStream.prototype.on = function(docName, type, callback) { + var _base; + (_base = this.callbacks)[docName] || (_base[docName] = {}); + if (this.callbacks[docName][type] != null) { + throw new Error("Callback already exists for " + docName + ", " + type); + } + return this.callbacks[docName][type] = callback; + }; + OpStream.prototype.onMessage = function(data) { + var emit; + p('message'); + p(data); + if (data.doc != null) { + this.lastReceivedDoc = data.doc; + } else { + data.doc = this.lastReceivedDoc; + } + emit = __bind(function(type, clear) { + var callback, _ref; + p("emit " + data.doc + " " + type); + callback = (_ref = this.callbacks[data.doc]) != null ? _ref[type] : void 0; + if (callback != null) { + if (clear) { + this.callbacks[data.doc][type] = null; + } + return callback(data); + } + }, this); + if (data.snapshot !== void 0) { + return emit('snapshot', true); + } else if (data.follow != null) { + if (data.follow) { + return emit('follow', true); + } else { + return emit('unfollow', true); + } + } else if (data.v !== void 0) { + if (data.op != null) { + return emit('op', false); + } else { + return emit('localop', true); + } + } + }; + OpStream.prototype.send = function(msg) { + if (msg.doc === this.lastSentDoc) { + delete msg.doc; + } else { + this.lastSentDoc = msg.doc; + } + return this.socket.send(msg); + }; + OpStream.prototype.follow = function(docName, v, callback) { + var request; + p("follow " + docName); + request = { + doc: docName, + follow: true + }; + if (v != null) { + request.v = v; + } + this.send(request); + return this.on(docName, 'follow', callback); + }; + OpStream.prototype.get = function(docName, callback) { + p("get " + docName); + this.send({ + doc: docName, + snapshot: null + }); + return this.on(docName, 'snapshot', callback); + }; + OpStream.prototype.submit = function(docName, op, version, callback) { + p("submit"); + this.send({ + doc: docName, + v: version, + op: op + }); + return this.on(docName, 'localop', callback); + }; + OpStream.prototype.unfollow = function(docName, callback) { + p("unfollow " + docName); + this.send({ + doc: docName, + follow: false + }); + return this.on(docName, 'unfollow', callback); + }; + OpStream.prototype.disconnect = function() { + this.socket.disconnect(); + return this.socket = null; + }; + return OpStream; + })(); + if (typeof window != "undefined" && window !== null) { + window.sharejs || (window.sharejs = {}); + window.sharejs.OpStream = OpStream; + } else { + exports.OpStream = OpStream; + } + OpStream = (typeof window != "undefined" && window !== null ? window.sharejs.OpStream : void 0) || require('./opstream').OpStream; + types = (typeof window != "undefined" && window !== null ? window.sharejs.types : void 0) || require('../types'); + MicroEvent = (typeof window != "undefined" && window !== null ? window.MicroEvent : void 0) || require('../../thirdparty/microevent.js/microevent'); + exports || (exports = {}); + p = function() {}; + i = function() {}; + Document = (function() { + function Document(stream, name, version, type, snapshot) { + this.stream = stream; + this.name = name; + this.version = version; + this.type = type; + this.snapshot = snapshot; + this.onOpReceived = __bind(this.onOpReceived, this);; + this.tryFlushPendingOp = __bind(this.tryFlushPendingOp, this);; + if (this.type.compose == null) { + throw new Error('Handling types without compose() defined is not currently implemented'); + } + this.inflightOp = null; + this.inflightCallbacks = []; + this.pendingOp = null; + this.pendingCallbacks = []; + this.serverOps = {}; + this.listeners = []; + this.stream.follow(this.name, this.version, __bind(function(msg) { + if (msg.v !== this.version) { + throw new Error("Expected version " + this.version + " but got " + msg.v); + } + return this.stream.on(this.name, 'op', this.onOpReceived); + }, this)); + } + Document.prototype.tryFlushPendingOp = function() { + if (this.inflightOp === null && this.pendingOp !== null) { + this.inflightOp = this.pendingOp; + this.inflightCallbacks = this.pendingCallbacks; + this.pendingOp = null; + this.pendingCallbacks = []; + return this.stream.submit(this.name, this.inflightOp, this.version, __bind(function(response) { + var callback, _i, _j, _len, _len2, _ref, _ref2; + if (response.v === null) { + _ref = this.inflightCallbacks; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + callback = _ref[_i]; + callback(null); + } + this.inflightOp = null; + throw new Error(response.error); + } + if (response.v !== this.version) { + throw new Error('Invalid version from server'); + } + this.serverOps[this.version] = this.inflightOp; + this.version++; + _ref2 = this.inflightCallbacks; + for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { + callback = _ref2[_j]; + callback(this.inflightOp, null); + } + this.inflightOp = null; + return this.tryFlushPendingOp(); + }, this)); + } + }; + Document.prototype.onOpReceived = function(msg) { + var docOp, op, xf, _ref, _ref2; + if (msg.v < this.version) { + return; + } + if (msg.doc !== this.name) { + throw new Error("Expected docName " + this.name + " but got " + msg.doc); + } + if (msg.v !== this.version) { + throw new Error("Expected version " + this.version + " but got " + msg.v); + } + op = msg.op; + this.serverOps[this.version] = op; + xf = this.type.transformX || __bind(function(server, client) { + var client_, server_; + server_ = this.type.transform(server, client, 'server'); + client_ = this.type.transform(client, server, 'client'); + return [server_, client_]; + }, this); + docOp = op; + if (this.inflightOp !== null) { + _ref = xf(docOp, this.inflightOp), docOp = _ref[0], this.inflightOp = _ref[1]; + } + if (this.pendingOp !== null) { + _ref2 = xf(docOp, this.pendingOp), docOp = _ref2[0], this.pendingOp = _ref2[1]; + } + this.snapshot = this.type.apply(this.snapshot, docOp); + this.version++; + this.publish('remoteop', docOp); + return this.publish('change', docOp); + }; + Document.prototype.submitOp = function(op, v, callback) { + var realOp, _ref; + if (v == null) { + v = this.version; + } + if (typeof v === 'function') { + callback = v; + v = this.version; + } + if (((_ref = this.type) != null ? _ref.normalize : void 0) != null) { + op = this.type.normalize(op); + } + while (v < this.version) { + realOp = this.recentOps[v]; + if (!realOp) { + throw new Error('Op version too old'); + } + op = this.type.transform(op, realOp, 'client'); + v++; + } + this.snapshot = this.type.apply(this.snapshot, op); + if (this.pendingOp !== null) { + this.pendingOp = this.type.compose(this.pendingOp, op); + } else { + this.pendingOp = op; + } + if (callback != null) { + this.pendingCallbacks.push(callback); + } + this.publish('change', op); + return setTimeout(this.tryFlushPendingOp, 0); + }; + return Document; + })(); + MicroEvent.mixin(Document); + Connection = (function() { + Connection.prototype.makeDoc = function(name, version, type, snapshot) { + if (this.docs[name]) { + throw new Error("Document " + name + " already followed"); + } + return this.docs[name] = new Document(this.stream, name, version, type, snapshot); + }; + function Connection(hostname, port, basePath) { + this.stream = new OpStream(hostname, port, basePath); + this.docs = {}; + } + Connection.prototype.get = function(docName, callback) { + if (this.docs[docName] != null) { + return this.docs[docName]; + } + return this.stream.get(docName, __bind(function(response) { + var type; + if (response.snapshot === null) { + return callback(null); + } else { + type = types[response.type]; + return callback(this.makeDoc(response.doc, response.v, type, response.snapshot)); + } + }, this)); + }; + Connection.prototype.getOrCreate = function(docName, type, callback) { + var doc; + if (typeof type === 'function') { + callback = type; + type = 'text'; + } + if (typeof type === 'string') { + type = types[type]; + } + if (this.docs[docName] != null) { + doc = this.docs[docName]; + if (doc.type === type) { + callback(doc); + } else { + callback(doc, 'Document already exists with type ' + doc.type.name); + } + return; + } + return this.stream.get(docName, __bind(function(response) { + if (response.snapshot === null) { + return this.stream.submit(docName, { + type: type.name + }, 0, __bind(function(response) { + if (response.v != null) { + return callback(this.makeDoc(docName, 1, type, type.initialVersion())); + } else if (response.v === null && response.error === 'Type already set') { + return this.getOrCreate(docName, type, callback); + } else { + return callback(null, response.error); + } + }, this)); + } else if (response.type === type.name) { + return callback(this.makeDoc(docName, response.v, type, response.snapshot)); + } else { + return callback(null, "Document already exists with type " + response.type); + } + }, this)); + }; + Connection.prototype.create = function(type, prefix) { + throw new Error('Not implemented'); + }; + Connection.prototype.disconnect = function() { + if (this.stream != null) { + this.stream.disconnect(); + return this.stream = null; + } + }; + return Connection; + })(); + if (typeof window != "undefined" && window !== null) { + window.sharejs.Connection = Connection; + window.sharejs.Document = Document; + } else { + exports.Connection = Connection; + } +}).call(this); diff --git a/src/client/ace.coffee b/src/client/ace.coffee index 14107131..dad651e2 100644 --- a/src/client/ace.coffee +++ b/src/client/ace.coffee @@ -64,7 +64,7 @@ applyToDoc = (editorDoc, op) -> return -window.whatnot.Document::attach_ace = (editor) -> +window.sharejs.Document::attach_ace = (editor) -> doc = this editorDoc = editor.getSession().getDocument() editorDoc.setNewLineMode 'unix' @@ -90,7 +90,7 @@ window.whatnot.Document::attach_ace = (editor) -> check() - doc.onChanged (op) -> + doc.subscribe 'remoteop', (op) -> # console.log("Received", op); suppress = true applyToDoc editorDoc, op diff --git a/src/client/client.coffee b/src/client/client.coffee index ae609d34..dd29c7cd 100644 --- a/src/client/client.coffee +++ b/src/client/client.coffee @@ -1,13 +1,21 @@ # Abstraction over raw net stream, for use by a client. -OpStream = window?.whatnot.OpStream || require('./opstream').OpStream -types = window?.whatnot.types || require('../types') +OpStream = window?.sharejs.OpStream || require('./opstream').OpStream +types = window?.sharejs.types || require('../types') +MicroEvent = window?.MicroEvent || require '../../thirdparty/microevent.js/microevent' exports ||= {} p = -> #require('util').debug i = -> #require('util').inspect +# An open document. +# +# Documents are event emitters - use doc.subscribe(eventname, fn) to subscribe. +# +# Events: +# - remoteop (op) +# - changed (op) class Document # stream is a OpStream object. # name is the documents' docName. @@ -29,9 +37,19 @@ class Document # Listeners for the document changing @listeners = [] + @stream.on @name, 'op', @onOpReceived + + @createdLocally = no + + @follow() + + follow: (callback) -> @stream.follow @name, @version, (msg) => throw new Error("Expected version #{@version} but got #{msg.v}") unless msg.v == @version - @stream.on @name, 'op', @onOpReceived + callback() if callback? + + unfollow: (callback) -> + @stream.unfollow @name, callback # Internal - do not call directly. tryFlushPendingOp: => @@ -67,6 +85,12 @@ class Document # Called when an op is received from the server. onOpReceived: (msg) => # msg is {doc:, op:, v:} + + # There is a bug in socket.io (produced on firefox 3.6) which causes messages + # to be duplicated sometimes. + # We'll just silently drop subsequent messages. + return if msg.v < @version + throw new Error("Expected docName #{@name} but got #{msg.doc}") unless msg.doc == @name throw new Error("Expected version #{@version} but got #{msg.v}") unless msg.v == @version @@ -90,7 +114,8 @@ class Document @snapshot = @type.apply @snapshot, docOp @version++ - listener(docOp) for listener in @listeners + @publish 'remoteop', docOp + @publish 'change', docOp # Submit an op to the server. The op maybe held for a little while before being sent, as only one # op can be inflight at any time. @@ -117,16 +142,13 @@ class Document @pendingCallbacks.push callback if callback? + @publish 'change', op + # A timeout is used so if the user sends multiple ops at the same time, they'll be composed # together and sent together. setTimeout @tryFlushPendingOp, 0 - # Add an event listener to listen for remote ops. Listener will be passed one parameter; - # the op. - onChanged: (listener) -> - @listeners.push(listener) - - +MicroEvent.mixin Document class Connection makeDoc: (name, version, type, snapshot) -> @@ -163,9 +185,9 @@ class Connection if @docs[docName]? doc = @docs[docName] if doc.type == type - callback(doc) + callback doc else - callback(doc, 'Document already exists with type ' + doc.type.name) + callback doc, 'Document already exists with type ' + doc.type.name return @@ -173,23 +195,31 @@ class Connection if response.snapshot == null @stream.submit docName, {type: type.name}, 0, (response) => if response.v? - callback @makeDoc(docName, 1, type, type.initialVersion()) + doc = @makeDoc(docName, 1, type, type.initialVersion()) + doc.createdLocally = yes + callback doc else if response.v == null and response.error == 'Type already set' # Somebody else has created the document. Get the snapshot again.. @getOrCreate(docName, type, callback) else - callback(null, response.error) + callback null, response.error else if response.type == type.name callback @makeDoc(docName, response.v, type, response.snapshot) else callback null, "Document already exists with type #{response.type}" + # To be written. Create a new document with a random name. + # Prefix is an optional string to put on the front of the document name. + create: (type, prefix) -> + throw new Error('Not implemented') + disconnect: () -> if @stream? @stream.disconnect() @stream = null if window? - window.whatnot.Connection = Connection + window.sharejs.Connection = Connection + window.sharejs.Document = Document else exports.Connection = Connection diff --git a/src/client/main.coffee b/src/client/main.coffee deleted file mode 100644 index c41a1a6a..00000000 --- a/src/client/main.coffee +++ /dev/null @@ -1,7 +0,0 @@ -require ["types/builtin", "types/text", "client"], (builtin, text, client) -> - builtin.registerType text - console.log 'client: ', client - client.getOrCreate 'doc', builtin.types.text, (doc, error) -> - throw new Error(error) if error - console.log doc -# doc. diff --git a/src/client/opstream.coffee b/src/client/opstream.coffee index a26f4a24..ce053d35 100644 --- a/src/client/opstream.coffee +++ b/src/client/opstream.coffee @@ -5,11 +5,13 @@ if window? throw new Error 'Must load socket.io before this library' unless window.io? io = window.io else - io = require('Socket.io-node-client').io + io = require('../../thirdparty/Socket.io-node-client').io p = -> #(x) -> console.log x # Make 1 per server. +# +# Consider refactoring this to use microevent. class OpStream constructor: (@hostname, @port, path) -> resource = if path then path + '/socket.io' else 'socket.io' @@ -108,8 +110,8 @@ class OpStream #{follow: follow, connect: connect, get: get, submit: submit} if window? - window.whatnot ||= {} - window.whatnot.OpStream = OpStream + window.sharejs ||= {} + window.sharejs.OpStream = OpStream else exports.OpStream = OpStream diff --git a/src/server/index.coffee b/src/server/index.coffee index 4b818586..4b16c3dd 100644 --- a/src/server/index.coffee +++ b/src/server/index.coffee @@ -12,7 +12,7 @@ socketio = require './socketio' # # The model will be created based on options if it is not specified. module.exports = create = (options, model = createModel(options)) -> - attach(connect(), model, options) + attach(connect(), options, model) # Create an OT document model attached to a database. create.createModel = createModel = (options) -> @@ -29,7 +29,8 @@ create.createModel = createModel = (options) -> # defaults will be provided. # # Set options.rest == null or options.socketio == null to turn off that frontend. -create.attach = attach = (server, model = createModel(options), options) -> +create.attach = attach = (server, options, model = createModel(options)) -> + server.model = model server.use rest(model, options?.rest) if options?.rest != null socketio.attach(server, model, options?.socketio) if options?.socketio != null diff --git a/src/server/main.coffee b/src/server/main.coffee deleted file mode 100644 index c5c40c0f..00000000 --- a/src/server/main.coffee +++ /dev/null @@ -1,11 +0,0 @@ -sys = require 'sys' -sharejs = require './index' - -connect = require 'connect' - -server = connect(connect.logger()) -sharejs.attach(server) - -server.listen 8000 -sys.puts 'Server running at http://127.0.0.1:8000/' - diff --git a/src/types/text.coffee b/src/types/text.coffee index 1a27c89a..35258b4d 100644 --- a/src/types/text.coffee +++ b/src/types/text.coffee @@ -222,7 +222,7 @@ invertComponent = (c) -> exports.invert = (op) -> (invertComponent c for c in op.slice().reverse()) if window? - window.whatnot ||= {} - window.whatnot.types ||= {} - window.whatnot.types.text = exports + window.sharejs ||= {} + window.sharejs.types ||= {} + window.sharejs.types.text = exports diff --git a/test/client.coffee b/test/client.coffee index b5ae63fd..f53beb18 100644 --- a/test/client.coffee +++ b/test/client.coffee @@ -7,6 +7,8 @@ types = require '../src/types' client = require '../src/client' +makePassPart = require('./helpers').makePassPart + port = 8765 module.exports = testCase { @@ -135,7 +137,7 @@ module.exports = testCase { test.ifError error test.strictEqual doc.name, @name - doc.onChanged (op) -> + doc.subscribe 'remoteop', (op) -> test.deepEqual op, [{i:'hi', p:0}] test.expect 4 @@ -184,12 +186,59 @@ module.exports = testCase { test.done() doc.submitOp clientOp, onOpApplied - doc.onChanged (op) -> + doc.subscribe 'remoteop', (op) -> test.deepEqual op, serverTransformed onOpApplied() @model.applyOp @name, {v:1, op:serverOp}, (error, v) -> test.ifError error + + 'doc fires both remoteop and change messages when remote ops are received': (test) -> + passPart = makePassPart test, 2 + @c.getOrCreate @name, 'text', (doc, error) => + sentOp = [{i:'asdf', p:0}] + doc.subscribe 'change', (op) -> + test.deepEqual op, sentOp + passPart() + doc.subscribe 'remoteop', (op) -> + test.deepEqual op, sentOp + passPart() + + @model.applyOp @name, {v:1, op:sentOp}, (error, v) -> + test.ifError error + + 'doc only fires change ops from locally sent ops': (test) -> + passPart = makePassPart test, 2 + @c.getOrCreate @name, 'text', (doc, error) -> + sentOp = [{i:'asdf', p:0}] + doc.subscribe 'change', (op) -> + test.deepEqual op, sentOp + passPart() + doc.subscribe 'remoteop', (op) -> + throw new Error 'Should not have received remoteOp event' + + doc.submitOp sentOp, (error, v) -> + passPart() + + 'doc does not receive ops after unfollow called': (test) -> + @c.getOrCreate @name, 'text', (doc, error) => + doc.subscribe 'change', (op) -> + throw new Error 'Should not have received op when the doc was unfollowed' + + doc.unfollow => + @model.applyOp @name, {v:1, op:[{i:'asdf', p:0}]}, (error, v) => + test.done() + + 'created locally is set on new docs': (test) -> + @c.getOrCreate @name, 'text', (doc, error) => + test.strictEqual doc.createdLocally, true + test.done() + + 'created locally is not set on old docs': (test) -> + @model.applyOp @name, {v:0, op:{type:'text'}}, (error, v) => + @c.getOrCreate @name, 'text', (doc, error) => + test.strictEqual doc.createdLocally, false + test.done() } diff --git a/test/integration.coffee b/test/integration.coffee index d5f51e29..3c7b0e71 100644 --- a/test/integration.coffee +++ b/test/integration.coffee @@ -45,7 +45,7 @@ module.exports = testCase { [submittedOp, result] = @doc1.type.generateRandomOp @doc1.snapshot @doc1.submitOp submittedOp - @doc2.onChanged (op) => + @doc2.subscribe 'remoteop', (op) => test.deepEqual op, submittedOp test.strictEqual @doc2.snapshot, result test.strictEqual @doc2.version, 2 @@ -85,10 +85,10 @@ module.exports = testCase { inflight-- checkSync() - @doc1.onChanged (op) => + @doc1.subscribe 'remoteop', (op) => maxV = Math.max(maxV, @doc1.version) checkSync() - @doc2.onChanged (op) => + @doc2.subscribe 'remoteop', (op) => maxV = Math.max(maxV, @doc2.version) checkSync() diff --git a/test/socketio.coffee b/test/socketio.coffee index f1b82cef..3217a559 100644 --- a/test/socketio.coffee +++ b/test/socketio.coffee @@ -4,7 +4,7 @@ port = 8765 testCase = require('nodeunit').testCase assert = require 'assert' -clientio = require('Socket.io-node-client').io +clientio = require('../thirdparty/Socket.io-node-client/lib/io-client').io server = require '../src/server' @@ -40,13 +40,13 @@ module.exports = testCase { try @model = server.createModel options - @server = server.createServer options, @model + @server = server options, @model @server.listen port, => @name = 'testingdoc' # Make a new socket.io socket connected to the server's stream interface - @socket = new clientio.Socket 'localhost', {port: port, resource: '_stream/socket.io'} + @socket = new clientio.Socket 'localhost', {port: port, resource: 'socket.io'} @socket.connect() @socket.on 'connect', callback catch e diff --git a/tests.coffee b/tests.coffee index eddc30bd..3f9e2c47 100644 --- a/tests.coffee +++ b/tests.coffee @@ -15,11 +15,13 @@ modules = [ 'test/model.coffee' 'test/events.coffee' 'test/rest.coffee' + 'test/socketio.coffee' 'test/client-opstream.coffee' 'test/client.coffee' 'test/integration.coffee' +# 'test/server.coffee' ] diff --git a/thirdparty/Socket.io-node-client b/thirdparty/Socket.io-node-client new file mode 160000 index 00000000..566acae0 --- /dev/null +++ b/thirdparty/Socket.io-node-client @@ -0,0 +1 @@ +Subproject commit 566acae035f68b009662b0dbcb38585659110b5b diff --git a/thirdparty/microevent.js/MIT-LICENSE.txt b/thirdparty/microevent.js/MIT-LICENSE.txt new file mode 100644 index 00000000..6d325514 --- /dev/null +++ b/thirdparty/microevent.js/MIT-LICENSE.txt @@ -0,0 +1,20 @@ +Copyright (c) 2011 Jerome Etienne, http://jetienne.com + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/thirdparty/microevent.js/README.md b/thirdparty/microevent.js/README.md new file mode 100644 index 00000000..8c5b9efb --- /dev/null +++ b/thirdparty/microevent.js/README.md @@ -0,0 +1,66 @@ +# MicroEvent.js + +_MicroEvent.js_ is a event emitter library which provides the +[observer pattern](http://en.wikipedia.org/wiki/Observer_pattern) to javascript objects. +It works on node.js and browser. It is a single .js file containing +a 20 lines class +(only 321-bytes after minification+gzip). + +## How to Use It + +You need a single file [microevent.js](https://github.com/jeromeetienne/microevent.js/raw/master/microevent.js). +Include it in a webpage via the usual script tag. + + + +To include it in a nodejs code isnt much harder + + var MicroEvent = require('./microevent.js') + +Now suppose you got a class `Foobar`, and you wish it to support the observer partern. do + + MicroEvent.mixin(Foobar) + +That's it. The repository contains an [example in browser](https://github.com/jeromeetienne/microevent.js/blob/master/examples/example.html) +and an [example in nodejs](https://github.com/jeromeetienne/microevent.js/blob/master/examples/example.js). +Both use the same code in different contexts. Let me walk you thru it. + +## Example + +First we define the class which gonna use MicroEvent.js. This is a ticker, it is +publishing 'tick' event every second, and add the current date as parameter + + var Ticker = function(){ + var self = this; + setInterval(function(){ + self.publish('tick', new Date()); + }, 1000); + }; + +We mixin _MicroEvent_ into _Ticker_ and we are all set. + + MicroEvent.mixin(Ticker); + +Now lets actually use the _Ticker_ Class. First, create the object. + + var ticker = new Ticker(); + +and subscribe our _tick_ event with its data parameter + + ticker.subscribe('tick', function(date) { + console.log('notified date', date); + }); + +And you will see this output: + + notified date Tue, 22 Mar 2011 14:43:41 GMT + notified date Tue, 22 Mar 2011 14:43:42 GMT + ... + +## Conclusion + +MicroEvent.js is available on github here +under MIT license. +If you hit bugs, fill issues on github. +Feel free to fork, modify and have fun with it :) + diff --git a/thirdparty/microevent.js/examples/example.html b/thirdparty/microevent.js/examples/example.html new file mode 100644 index 00000000..f78fd032 --- /dev/null +++ b/thirdparty/microevent.js/examples/example.html @@ -0,0 +1,30 @@ + + + + + + + + \ No newline at end of file diff --git a/thirdparty/microevent.js/examples/example.js b/thirdparty/microevent.js/examples/example.js new file mode 100644 index 00000000..a92a6831 --- /dev/null +++ b/thirdparty/microevent.js/examples/example.js @@ -0,0 +1,27 @@ +// import microevent.js +var MicroEvent = require('../microevent-debug.js'); + +/** + * Ticker is a class periodically sending out dummy tick events +*/ +var Ticker = function( interval ){ + var self = this; + setInterval(function(){ + self.publish('tick', new Date()); + }, 1000); +}; +/** + * make Ticker support MicroEventjs +*/ +MicroEvent.mixin(Ticker); + +// create a ticker +var ticker = new Ticker(); +// subsribe the 'tick' event +ticker.subscribe('tick', function(date) { + // display to check + console.log('notified date', date); +}); + + + diff --git a/thirdparty/microevent.js/microevent-debug.js b/thirdparty/microevent.js/microevent-debug.js new file mode 100644 index 00000000..d1d51bf2 --- /dev/null +++ b/thirdparty/microevent.js/microevent-debug.js @@ -0,0 +1,50 @@ +/** + * MicroEvent.js debug + * + * # it is the same as MicroEvent.js but it adds checks to help you debug +*/ + +var MicroEvent = function(){}; +MicroEvent.prototype = { + subscribe : function(event, fct){ + this._events = this._events || {}; + this._events[event] = this._events[event] || []; + this._events[event].push(fct); + return this; + }, + unsubscribe : function(event, fct){ + console.assert(typeof fct === 'function'); + this._events = this._events || {}; + if( event in this._events === false ) return this; + console.assert(this._events[event].indexOf(fct) !== -1); + this._events[event].splice(this._events[event].indexOf(fct), 1); + return this; + }, + publish : function(event /* , args... */){ + this._events = this._events || {}; + if( event in this._events === false ) return this; + for(var i = 0; i < this._events[event].length; i++){ + this._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1)); + } + return this; + } +}; + +/** + * mixin will delegate all MicroEvent.js function in the destination object + * + * - require('MicroEvent').mixin(Foobar) will make Foobar able to use MicroEvent + * + * @param {Object} the object which will support MicroEvent +*/ +MicroEvent.mixin = function(destObject){ + var props = ['subscribe', 'unsubscribe', 'publish']; + for(var i = 0; i < props.length; i ++){ + destObject.prototype[props[i]] = MicroEvent.prototype[props[i]]; + } +}; + +// export in common js +if( typeof module !== "undefined" && ('exports' in module)){ + module.exports = MicroEvent; +} diff --git a/thirdparty/microevent.js/microevent.js b/thirdparty/microevent.js/microevent.js new file mode 100644 index 00000000..ffa2803e --- /dev/null +++ b/thirdparty/microevent.js/microevent.js @@ -0,0 +1,53 @@ +/** + * MicroEvent - to make any js object an event emitter (server or browser) + * + * - pure javascript - server compatible, browser compatible + * - dont rely on the browser doms + * - super simple - you get it immediatly, no mistery, no magic involved + * + * - create a MicroEventDebug with goodies to debug + * - make it safer to use +*/ + +var MicroEvent = function(){}; +MicroEvent.prototype = { + subscribe : function(event, fct){ + this._events = this._events || {}; + this._events[event] = this._events[event] || []; + this._events[event].push(fct); + return this; + }, + unsubscribe : function(event, fct){ + this._events = this._events || {}; + if( event in this._events === false ) return this; + this._events[event].splice(this._events[event].indexOf(fct), 1); + return this; + }, + publish : function(event /* , args... */){ + this._events = this._events || {}; + if( event in this._events === false ) return this; + for(var i = 0; i < this._events[event].length; i++){ + this._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1)); + } + return this; + } +}; + +/** + * mixin will delegate all MicroEvent.js function in the destination object + * + * - require('MicroEvent').mixin(Foobar) will make Foobar able to use MicroEvent + * + * @param {Object} the object which will support MicroEvent +*/ +MicroEvent.mixin = function(destObject){ + var props = ['subscribe', 'unsubscribe', 'publish']; + for(var i = 0; i < props.length; i ++){ + destObject.prototype[props[i]] = MicroEvent.prototype[props[i]]; + } +}; + +// export in common js +if( typeof module !== "undefined" && ('exports' in module)){ + module.exports = MicroEvent; +} diff --git a/thirdparty/microevent.js/tests/bad.js b/thirdparty/microevent.js/tests/bad.js new file mode 100644 index 00000000..be0f3c9b --- /dev/null +++ b/thirdparty/microevent.js/tests/bad.js @@ -0,0 +1,12 @@ +var MicroEvent = require('../microevent.js'); +var Foo = function() {}; +MicroEvent.mixin(Foo); +f = new Foo; +b = new Foo; +f.subscribe("blerg", function(val){ console.log("f got blerg", val); }); + +console.log("You should see 'f got blerg yes' and nothing more:"); +console.log(""); + +f.publish("blerg", "yes"); +b.publish("blerg", "no"); \ No newline at end of file