From 589eb748a4eedc08818ac0dd9142d25b22e500c9 Mon Sep 17 00:00:00 2001 From: Suresh Jayanty Date: Sat, 29 Sep 2012 12:53:10 -0700 Subject: [PATCH 1/6] * Added support for growl notifications * Added support for settings file * Ignoring .swp files created when some one uses vim to edit the dust files --- node_modules/.bin/dustc | 1 + node_modules/.bin/js-yaml | 1 + node_modules/.bin/watch-tree | 1 + node_modules/colors/MIT-LICENSE.txt | 22 + node_modules/colors/ReadMe.md | 77 + node_modules/colors/colors.js | 269 + node_modules/colors/example.html | 74 + node_modules/colors/example.js | 65 + node_modules/colors/package.json | 22 + node_modules/colors/test.js | 65 + node_modules/dustjs-linkedin/.coverignore | 1 + node_modules/dustjs-linkedin/.coverrc | 20 + node_modules/dustjs-linkedin/.npmignore | 5 + node_modules/dustjs-linkedin/.travis.yml | 10 + node_modules/dustjs-linkedin/LICENSE | 19 + node_modules/dustjs-linkedin/Makefile | 93 + node_modules/dustjs-linkedin/README.md | 7 + .../dustjs-linkedin/benchmark/index.html | 161 + .../dustjs-linkedin/benchmark/server.js | 33 + .../benchmark/suites/dust_suite.js | 111 + .../benchmark/suites/handlebars_suite.js | 101 + .../benchmark/suites/jquery_suite.js | 84 + .../benchmark/suites/mustache_suite.js | 97 + .../dustjs-linkedin/benchmark/uubench.js | 107 + node_modules/dustjs-linkedin/bin/dustc | 70 + .../dustjs-linkedin/dist/dust-core-1.0.0.js | 767 + .../dustjs-linkedin/dist/dust-full-1.0.0.js | 3681 ++++ node_modules/dustjs-linkedin/docs/about.md | 14 + node_modules/dustjs-linkedin/docs/api.md | 310 + node_modules/dustjs-linkedin/docs/build.js | 68 + node_modules/dustjs-linkedin/docs/index.css | 203 + .../dustjs-linkedin/docs/index.dust.html | 95 + node_modules/dustjs-linkedin/docs/index.js | 181 + .../dustjs-linkedin/docs/select.dust.html | 5 + node_modules/dustjs-linkedin/docs/syntax.md | 286 + node_modules/dustjs-linkedin/index.html | 1078 ++ node_modules/dustjs-linkedin/lib/compiler.js | 335 + .../dustjs-linkedin/lib/dust-helpers.js | 191 + node_modules/dustjs-linkedin/lib/dust.js | 584 + node_modules/dustjs-linkedin/lib/parser.js | 2579 +++ node_modules/dustjs-linkedin/lib/server.js | 18 + .../dustjs-linkedin/node_modules/.bin/cover | 1 + .../node_modules/.bin/jasmine-node | 1 + .../node_modules/.bin/uglifyjs | 1 + .../node_modules/cover/.npmignore | 7 + .../node_modules/cover/README.markdown | 96 + .../dustjs-linkedin/node_modules/cover/bar.js | 0 .../node_modules/cover/bin/.coverrc | 20 + .../node_modules/cover/bin/cover | 732 + .../cover/contrib/cli-table/README.md | 77 + .../cover/contrib/cli-table/index.js | 2 + .../contrib/cli-table/lib/cli-table/index.js | 205 + .../contrib/cli-table/lib/cli-table/utils.js | 95 + .../node_modules/cover/contrib/colors.js | 304 + .../node_modules/cover/contrib/commander.js | 1108 ++ .../node_modules/cover/contrib/escodegen.js | 843 + .../node_modules/cover/contrib/esprima.js | 3744 ++++ .../node_modules/cover/coverage_store.js | 18 + .../dustjs-linkedin/node_modules/cover/foo.js | 2 + .../node_modules/cover/index.js | 440 + .../node_modules/cover/instrument.js | 489 + .../cover/node_modules/.bin/which | 1 + .../cover/node_modules/cli-table/.npmignore | 1 + .../cover/node_modules/cli-table/History.md | 5 + .../cover/node_modules/cli-table/Makefile | 14 + .../cover/node_modules/cli-table/README.md | 82 + .../node_modules/cli-table/examples/revs.js | 41 + .../node_modules/cli-table/examples/table.js | 40 + .../cover/node_modules/cli-table/index.js | 2 + .../cli-table/lib/cli-table/index.js | 212 + .../cli-table/lib/cli-table/utils.js | 95 + .../node_modules/colors/MIT-LICENSE.txt | 20 + .../cli-table/node_modules/colors/ReadMe.md | 30 + .../cli-table/node_modules/colors/colors.js | 75 + .../cli-table/node_modules/colors/example.js | 6 + .../node_modules/colors/package.json | 19 + .../cover/node_modules/cli-table/package.json | 24 + .../node_modules/cli-table/test/common.js | 6 + .../node_modules/cli-table/test/index.test.js | 52 + .../underscore.string/README.markdown | 506 + .../node_modules/underscore.string/Rakefile | 16 + .../dist/underscore.string.min.js | 14 + .../lib/underscore.string.js | 480 + .../underscore.string/package.json | 72 + .../underscore.string/test/speed.js | 134 + .../underscore.string/test/strings.js | 358 + .../test/strings_standalone.js | 12 + .../underscore.string/test/test.html | 30 + .../test/test_standalone.html | 18 + .../test/test_underscore/arrays.js | 161 + .../test/test_underscore/chaining.js | 47 + .../test/test_underscore/collections.js | 241 + .../test/test_underscore/functions.js | 193 + .../test/test_underscore/objects.js | 533 + .../test/test_underscore/speed.js | 70 + .../test/test_underscore/temp.js | 27 + .../test/test_underscore/temp_tests.html | 19 + .../test/test_underscore/test.html | 43 + .../test/test_underscore/utility.js | 136 + .../test/test_underscore/vendor/jquery.js | 19 + .../test/test_underscore/vendor/jslitmus.js | 670 + .../test/test_underscore/vendor/qunit.css | 196 + .../test/test_underscore/vendor/qunit.js | 2360 +++ .../underscore.string/test/underscore.js | 962 + .../cover/node_modules/underscore/.npmignore | 3 + .../cover/node_modules/underscore/LICENSE | 22 + .../cover/node_modules/underscore/README | 19 + .../cover/node_modules/underscore/index.html | 1919 ++ .../cover/node_modules/underscore/index.js | 1 + .../node_modules/underscore/package.json | 26 + .../underscore/raw/underscore.psd | Bin 0 -> 215540 bytes .../node_modules/underscore/underscore-min.js | 31 + .../node_modules/underscore/underscore.js | 995 + .../cover/node_modules/which/LICENSE | 23 + .../cover/node_modules/which/README.md | 5 + .../cover/node_modules/which/bin/which | 14 + .../cover/node_modules/which/package.json | 26 + .../cover/node_modules/which/which.js | 104 + .../node_modules/cover/package.json | 44 + .../node_modules/cover/reporters/cli.js | 47 + .../node_modules/cover/reporters/html.js | 83 + .../node_modules/cover/reporters/json.js | 11 + .../node_modules/cover/reporters/plain.js | 48 + .../cover/resources/bootstrap.css | 2469 +++ .../cover/resources/jquery.min.js | 4 + .../cover/resources/jquery.tablesorter.min.js | 4 + .../node_modules/cover/resources/prettify.css | 1 + .../node_modules/cover/resources/prettify.js | 28 + .../node_modules/cover/templates/file.html | 195 + .../node_modules/cover/templates/index.html | 110 + .../cover/templates/instrumentation_header.js | 28 + .../node_modules/cover/test/format/index.js | 49 + .../cover/test/format/src/test1.js | 59 + .../cover/test/format/src/test2.js | 8 + .../node_modules/cover/test/index.js | 1 + .../node_modules/cover/test/interface.js | 50 + .../node_modules/cover/test/src/coverage.js | 79 + .../node_modules/cover/test/test.js | 6 + .../node_modules/cover/utils/console.js | 77 + .../node_modules/jasmine-node/.npmignore | 12 + .../node_modules/jasmine-node/.travis.yml | 6 + .../node_modules/jasmine-node/LICENSE | 22 + .../node_modules/jasmine-node/README.md | 83 + .../jasmine-node/bin/jasmine-node | 7 + .../lib/jasmine-node/async-callback.js | 54 + .../jasmine-node/lib/jasmine-node/autotest.js | 90 + .../jasmine-node/lib/jasmine-node/cli.js | 176 + .../jasmine-node/lib/jasmine-node/index.js | 148 + .../lib/jasmine-node/jasmine-2.0.0.rc1.js | 2479 +++ .../jasmine-node/lib/jasmine-node/reporter.js | 275 + .../lib/jasmine-node/requirejs-runner.js | 80 + .../lib/jasmine-node/requirejs-spec-loader.js | 48 + .../requirejs-wrapper-template.js | 65 + .../lib/jasmine-node/spec-collection.js | 35 + .../jasmine-node/node_modules/.bin/cake | 1 + .../jasmine-node/node_modules/.bin/coffee | 1 + .../jasmine-node/node_modules/.bin/r.js | 1 + .../node_modules/coffee-script/.npmignore | 11 + .../node_modules/coffee-script/CNAME | 1 + .../node_modules/coffee-script/LICENSE | 22 + .../node_modules/coffee-script/README | 51 + .../node_modules/coffee-script/Rakefile | 78 + .../node_modules/coffee-script/bin/cake | 7 + .../node_modules/coffee-script/bin/coffee | 7 + .../coffee-script/extras/jsl.conf | 44 + .../lib/coffee-script/browser.js | 92 + .../coffee-script/lib/coffee-script/cake.js | 111 + .../lib/coffee-script/coffee-script.js | 167 + .../lib/coffee-script/command.js | 500 + .../lib/coffee-script/grammar.js | 606 + .../lib/coffee-script/helpers.js | 77 + .../coffee-script/lib/coffee-script/index.js | 11 + .../coffee-script/lib/coffee-script/lexer.js | 788 + .../coffee-script/lib/coffee-script/nodes.js | 2986 +++ .../lib/coffee-script/optparse.js | 138 + .../coffee-script/lib/coffee-script/parser.js | 683 + .../coffee-script/lib/coffee-script/repl.js | 261 + .../lib/coffee-script/rewriter.js | 349 + .../coffee-script/lib/coffee-script/scope.js | 146 + .../node_modules/coffee-script/package.json | 45 + .../node_modules/jasmine-reporters/.npmignore | 2 + .../node_modules/jasmine-reporters/LICENSE | 21 + .../jasmine-reporters/README.markdown | 52 + .../jasmine-reporters/ext/env.rhino.1.2.js | 13989 ++++++++++++++ .../jasmine-reporters/ext/jasmine-html.js | 182 + .../jasmine-reporters/ext/jasmine.css | 166 + .../jasmine-reporters/ext/jasmine.js | 2421 +++ .../jasmine-reporters/ext/jline.jar | Bin 0 -> 46424 bytes .../node_modules/jasmine-reporters/ext/js.jar | Bin 0 -> 871260 bytes .../jasmine-reporters/package.json | 20 + .../src/jasmine.console_reporter.js | 142 + .../src/jasmine.junit_reporter.js | 200 + .../src/jasmine.teamcity_reporter.js | 139 + .../jasmine-reporters/src/load_reporters.js | 3 + .../test/JUnitXmlReporterSpec.js | 214 + .../test/console_reporter.html | 36 + .../jasmine-reporters/test/envjs.bootstrap.js | 14 + .../jasmine-reporters/test/envjs.runner.sh | 7 + .../test/junit_xml_reporter.html | 23 + .../test/phantomjs-testrunner.js | 183 + .../test/phantomjs.runner.sh | 36 + .../test/teamcity_reporter.html | 36 + .../node_modules/requirejs/README.md | 9 + .../node_modules/requirejs/bin/r.js | 15484 ++++++++++++++++ .../node_modules/requirejs/package.json | 31 + .../node_modules/requirejs/require.js | 2041 ++ .../node_modules/underscore/.npmignore | 3 + .../node_modules/underscore/CNAME | 1 + .../node_modules/underscore/CONTRIBUTING.md | 9 + .../node_modules/underscore/LICENSE | 22 + .../node_modules/underscore/README.md | 19 + .../node_modules/underscore/favicon.ico | Bin 0 -> 1406 bytes .../node_modules/underscore/index.html | 2343 +++ .../node_modules/underscore/index.js | 1 + .../node_modules/underscore/package.json | 26 + .../underscore/raw/underscore.psd | Bin 0 -> 215540 bytes .../node_modules/underscore/underscore-min.js | 5 + .../node_modules/underscore/underscore.js | 1186 ++ .../node_modules/walkdir/.jshintignore | 3 + .../node_modules/walkdir/.npmignore | 2 + .../node_modules/walkdir/.travis.yml | 3 + .../jasmine-node/node_modules/walkdir/license | 10 + .../node_modules/walkdir/package.json | 41 + .../node_modules/walkdir/readme.md | 160 + .../jasmine-node/node_modules/walkdir/test.sh | 19 + .../node_modules/walkdir/test/async.js | 62 + .../walkdir/test/comparison/find.js | 33 + .../walkdir/test/comparison/find.py | 26 + .../walkdir/test/comparison/finditsynctest.js | 15 + .../walkdir/test/comparison/findittest.js | 14 + .../walkdir/test/comparison/fstream.js | 24 + .../test/comparison/install_test_deps.sh | 1 + .../walkdir/test/comparison/lsr.js | 18 + .../walkdir/test/comparison/package.json | 10 + .../node_modules/walkdir/test/dir/foo/a/b/c/w | 0 .../node_modules/walkdir/test/dir/foo/a/b/z | 0 .../node_modules/walkdir/test/dir/foo/a/y | 0 .../node_modules/walkdir/test/dir/foo/x | 0 .../walkdir/test/dir/symlinks/dir1/file1 | 0 .../walkdir/test/dir/symlinks/dir2/file2 | 0 .../walkdir/test/dir/symlinks/file | 0 .../node_modules/walkdir/test/endearly.js | 19 + .../node_modules/walkdir/test/max_depth.js | 27 + .../node_modules/walkdir/test/no_recurse.js | 25 + .../walkdir/test/nofailemptydir.js | 34 + .../node_modules/walkdir/test/pauseresume.js | 36 + .../node_modules/walkdir/test/symlink.js | 37 + .../node_modules/walkdir/test/sync.js | 50 + .../node_modules/walkdir/walkdir.js | 230 + .../node_modules/jasmine-node/package.json | 49 + .../node_modules/jasmine-node/scripts/specs | 37 + .../spec-requirejs/requirejs.spec.js | 8 + .../spec-requirejs/requirejs.sut.js | 8 + .../jasmine-node/spec/AsyncSpec.coffee | 7 + .../jasmine-node/spec/CoffeeSpec.coffee | 4 + .../jasmine-node/spec/GrammarHelper.coffee | 22 + .../jasmine-node/spec/HelperSpec.coffee | 6 + .../jasmine-node/spec/SampleSpecs.js | 25 + .../jasmine-node/spec/TestSpec.js | 5 + .../jasmine-node/spec/async-callback_spec.js | 150 + .../jasmine-node/spec/helper_spec.js | 7 + .../jasmine-node/spec/nested.js/NestedSpec.js | 5 + .../jasmine-node/spec/nested/NestedSpec.js | 5 + .../spec/nested/uber-nested/UberNestedSpec.js | 11 + .../jasmine-node/spec/reporter_spec.js | 432 + .../jasmine-node/spec/sample_helper.js | 19 + .../node_modules/jasmine-node/specs.sh | 24 + .../node_modules/uglify-js/.npmignore | 6 + .../node_modules/uglify-js/README.html | 981 + .../node_modules/uglify-js/README.org | 578 + .../node_modules/uglify-js/bin/uglifyjs | 335 + .../node_modules/uglify-js/docstyle.css | 75 + .../uglify-js/lib/consolidator.js | 1220 ++ .../node_modules/uglify-js/lib/parse-js.js | 1368 ++ .../node_modules/uglify-js/lib/process.js | 2116 +++ .../uglify-js/lib/squeeze-more.js | 78 + .../node_modules/uglify-js/package.json | 27 + .../node_modules/uglify-js/test/beautify.js | 28 + .../uglify-js/test/testconsolidator.js | 1391 ++ .../node_modules/uglify-js/test/testparser.js | 409 + .../test/unit/compress/expected/1e21.js | 1 + .../test/unit/compress/expected/array1.js | 1 + .../test/unit/compress/expected/array2.js | 1 + .../test/unit/compress/expected/array3.js | 1 + .../test/unit/compress/expected/array4.js | 1 + .../test/unit/compress/expected/assignment.js | 1 + .../unit/compress/expected/concatstring.js | 1 + .../test/unit/compress/expected/const.js | 1 + .../unit/compress/expected/empty-blocks.js | 1 + .../unit/compress/expected/forstatement.js | 1 + .../test/unit/compress/expected/if-not.js | 1 + .../test/unit/compress/expected/if.js | 1 + .../test/unit/compress/expected/ifreturn.js | 1 + .../test/unit/compress/expected/ifreturn2.js | 1 + .../test/unit/compress/expected/infinite.js | 1 + .../test/unit/compress/expected/issue10.js | 1 + .../test/unit/compress/expected/issue11.js | 1 + .../test/unit/compress/expected/issue13.js | 1 + .../test/unit/compress/expected/issue14.js | 1 + .../test/unit/compress/expected/issue16.js | 1 + .../test/unit/compress/expected/issue17.js | 1 + .../test/unit/compress/expected/issue20.js | 1 + .../test/unit/compress/expected/issue21.js | 1 + .../test/unit/compress/expected/issue25.js | 1 + .../test/unit/compress/expected/issue27.js | 1 + .../test/unit/compress/expected/issue278.js | 1 + .../test/unit/compress/expected/issue28.js | 1 + .../test/unit/compress/expected/issue29.js | 1 + .../test/unit/compress/expected/issue30.js | 1 + .../test/unit/compress/expected/issue34.js | 1 + .../test/unit/compress/expected/issue349.js | 1 + .../test/unit/compress/expected/issue353.js | 1 + .../test/unit/compress/expected/issue372.js | 1 + .../test/unit/compress/expected/issue4.js | 1 + .../test/unit/compress/expected/issue48.js | 1 + .../test/unit/compress/expected/issue50.js | 1 + .../test/unit/compress/expected/issue53.js | 1 + .../test/unit/compress/expected/issue54.1.js | 1 + .../test/unit/compress/expected/issue68.js | 1 + .../test/unit/compress/expected/issue69.js | 1 + .../test/unit/compress/expected/issue9.js | 1 + .../unit/compress/expected/issues222_324.js | 1 + .../test/unit/compress/expected/mangle.js | 1 + .../unit/compress/expected/null_string.js | 1 + .../unit/compress/expected/strict-equals.js | 1 + .../test/unit/compress/expected/var.js | 1 + .../test/unit/compress/expected/whitespace.js | 1 + .../test/unit/compress/expected/with.js | 1 + .../uglify-js/test/unit/compress/test/1e21.js | 1 + .../test/unit/compress/test/array1.js | 3 + .../test/unit/compress/test/array2.js | 4 + .../test/unit/compress/test/array3.js | 4 + .../test/unit/compress/test/array4.js | 6 + .../test/unit/compress/test/assignment.js | 20 + .../test/unit/compress/test/concatstring.js | 3 + .../test/unit/compress/test/const.js | 5 + .../test/unit/compress/test/empty-blocks.js | 4 + .../test/unit/compress/test/forstatement.js | 10 + .../test/unit/compress/test/if-not.js | 1 + .../uglify-js/test/unit/compress/test/if.js | 6 + .../test/unit/compress/test/ifreturn.js | 9 + .../test/unit/compress/test/ifreturn2.js | 16 + .../test/unit/compress/test/infinite.js | 1 + .../test/unit/compress/test/issue10.js | 1 + .../test/unit/compress/test/issue11.js | 3 + .../test/unit/compress/test/issue13.js | 1 + .../test/unit/compress/test/issue14.js | 1 + .../test/unit/compress/test/issue16.js | 1 + .../test/unit/compress/test/issue17.js | 4 + .../test/unit/compress/test/issue20.js | 1 + .../test/unit/compress/test/issue21.js | 6 + .../test/unit/compress/test/issue25.js | 7 + .../test/unit/compress/test/issue27.js | 1 + .../test/unit/compress/test/issue278.js | 1 + .../test/unit/compress/test/issue28.js | 3 + .../test/unit/compress/test/issue29.js | 1 + .../test/unit/compress/test/issue30.js | 3 + .../test/unit/compress/test/issue34.js | 3 + .../test/unit/compress/test/issue349.js | 25 + .../test/unit/compress/test/issue353.js | 4 + .../test/unit/compress/test/issue372.js | 32 + .../test/unit/compress/test/issue4.js | 3 + .../test/unit/compress/test/issue48.js | 1 + .../test/unit/compress/test/issue50.js | 9 + .../test/unit/compress/test/issue53.js | 1 + .../test/unit/compress/test/issue54.1.js | 3 + .../test/unit/compress/test/issue68.js | 5 + .../test/unit/compress/test/issue69.js | 1 + .../test/unit/compress/test/issue9.js | 4 + .../test/unit/compress/test/issues222_324.js | 82 + .../test/unit/compress/test/mangle.js | 5 + .../test/unit/compress/test/null_string.js | 1 + .../test/unit/compress/test/strict-equals.js | 3 + .../uglify-js/test/unit/compress/test/var.js | 3 + .../test/unit/compress/test/whitespace.js | 21 + .../uglify-js/test/unit/compress/test/with.js | 2 + .../uglify-js/test/unit/scripts.js | 57 + .../node_modules/uglify-js/tmp/hoist.js | 33 + .../node_modules/uglify-js/tmp/instrument.js | 97 + .../node_modules/uglify-js/tmp/test.js | 30 + .../node_modules/uglify-js/uglify-js.js | 18 + node_modules/dustjs-linkedin/package.json | 50 + .../dustjs-linkedin/removeHelpers.patch | 0 node_modules/dustjs-linkedin/src/build.js | 19 + node_modules/dustjs-linkedin/src/dust.pegjs | 197 + node_modules/dustjs-linkedin/test/README.md | 66 + node_modules/dustjs-linkedin/test/core.js | 122 + .../test/dust_files/beautify.js | 1085 ++ .../dustjs-linkedin/test/dust_files/css | 255 + .../dustjs-linkedin/test/dust_files/ecma.js | 60 + .../dustjs-linkedin/test/dust_files/hijs.js | 93 + .../test/dust_files/images/background.png | Bin 0 -> 18808 bytes .../dust_files/images/background_header.jpg | Bin 0 -> 13349 bytes .../test/dust_files/images/logo-linkedin.png | Bin 0 -> 33643 bytes .../sprite_icons_alert_white_medium_v1.png | Bin 0 -> 3249 bytes .../test/dust_files/jquery.min.js | 154 + .../dustjs-linkedin/test/dust_files/jsdump.js | 163 + .../client/lib/jasmine-1.1.0/MIT.LICENSE | 20 + .../client/lib/jasmine-1.1.0/jasmine-html.js | 190 + .../client/lib/jasmine-1.1.0/jasmine.css | 166 + .../client/lib/jasmine-1.1.0/jasmine.js | 2476 +++ .../lib/jasmine-1.1.0/jasmine_favicon.png | Bin 0 -> 905 bytes .../test/jasmine-test/client/specRunner.html | 53 + .../test/jasmine-test/server/specRunner.js | 36 + .../test/jasmine-test/spec/grammarTests.js | 692 + .../test/jasmine-test/spec/renderTestSpec.js | 121 + node_modules/dustjs-linkedin/test/server.js | 35 + node_modules/dustjs-linkedin/test/test.html | 289 + node_modules/dustjs-linkedin/test/uutest.js | 104 + .../dustjs-linkedin/utils/minifier.js | 18 + .../dustjs-linkedin/vendor/beautify.js | 1085 ++ node_modules/dustjs-linkedin/vendor/ecma.js | 60 + node_modules/dustjs-linkedin/vendor/hijs.js | 93 + .../dustjs-linkedin/vendor/jquery.min.js | 154 + node_modules/dustjs-linkedin/vendor/jsdump.js | 163 + .../dustjs-linkedin/vendor/showdown.js | 1296 ++ node_modules/growl/History.md | 58 + node_modules/growl/Readme.md | 99 + node_modules/growl/lib/growl.js | 232 + node_modules/growl/package.json | 13 + node_modules/growl/test.js | 20 + node_modules/js-yaml/.jshintignore | 8 + node_modules/js-yaml/.jshintrc | 72 + node_modules/js-yaml/.ndocrc | 18 + node_modules/js-yaml/.npmignore | 8 + node_modules/js-yaml/.travis.yml | 6 + node_modules/js-yaml/HISTORY.md | 110 + node_modules/js-yaml/LICENSE | 21 + node_modules/js-yaml/Makefile | 115 + node_modules/js-yaml/README.md | 204 + node_modules/js-yaml/bin/js-yaml.js | 93 + node_modules/js-yaml/examples/single.js | 10 + node_modules/js-yaml/examples/single.yml | 197 + node_modules/js-yaml/index.js | 1 + node_modules/js-yaml/lib/js-yaml.js | 92 + node_modules/js-yaml/lib/js-yaml/common.js | 240 + node_modules/js-yaml/lib/js-yaml/composer.js | 209 + .../js-yaml/lib/js-yaml/constructor.js | 651 + node_modules/js-yaml/lib/js-yaml/errors.js | 160 + node_modules/js-yaml/lib/js-yaml/events.js | 122 + node_modules/js-yaml/lib/js-yaml/loader.js | 84 + node_modules/js-yaml/lib/js-yaml/nodes.js | 53 + node_modules/js-yaml/lib/js-yaml/parser.js | 757 + node_modules/js-yaml/lib/js-yaml/reader.js | 197 + node_modules/js-yaml/lib/js-yaml/resolver.js | 136 + node_modules/js-yaml/lib/js-yaml/scanner.js | 1887 ++ node_modules/js-yaml/lib/js-yaml/tokens.js | 171 + .../node_modules/argparse/.jshintignore | 4 + .../js-yaml/node_modules/argparse/.jshintrc | 72 + .../js-yaml/node_modules/argparse/.ndocrc | 18 + .../js-yaml/node_modules/argparse/.npmignore | 3 + .../js-yaml/node_modules/argparse/.travis.yml | 5 + .../js-yaml/node_modules/argparse/HISTORY.md | 45 + .../js-yaml/node_modules/argparse/LICENSE | 21 + .../js-yaml/node_modules/argparse/Makefile | 104 + .../js-yaml/node_modules/argparse/README.md | 236 + .../argparse/examples/arguments.js | 36 + .../node_modules/argparse/examples/choice.js | 22 + .../argparse/examples/constants.js | 59 + .../node_modules/argparse/examples/help.js | 13 + .../node_modules/argparse/examples/nargs.js | 31 + .../argparse/examples/prefix_chars.js | 23 + .../argparse/examples/sub_commands.js | 49 + .../js-yaml/node_modules/argparse/index.js | 1 + .../node_modules/argparse/lib/action.js | 149 + .../argparse/lib/action/append.js | 54 + .../argparse/lib/action/append/constant.js | 44 + .../node_modules/argparse/lib/action/count.js | 40 + .../node_modules/argparse/lib/action/help.js | 48 + .../node_modules/argparse/lib/action/store.js | 50 + .../argparse/lib/action/store/constant.js | 40 + .../argparse/lib/action/store/false.js | 27 + .../argparse/lib/action/store/true.js | 26 + .../argparse/lib/action/subparsers.js | 149 + .../argparse/lib/action/version.js | 50 + .../argparse/lib/action_container.js | 415 + .../node_modules/argparse/lib/argparse.js | 7 + .../argparse/lib/argument/error.js | 46 + .../argparse/lib/argument/group.js | 70 + .../argparse/lib/argument_parser.js | 1081 ++ .../node_modules/argparse/lib/const.js | 18 + .../argparse/lib/help/formatter.js | 800 + .../node_modules/argparse/lib/namespace.js | 81 + .../underscore.string/.travis.yml | 8 + .../node_modules/underscore.string/Gemfile | 5 + .../underscore.string/Gemfile.lock | 34 + .../underscore.string/README.markdown | 663 + .../node_modules/underscore.string/Rakefile | 27 + .../dist/underscore.string.min.js | 1 + .../lib/underscore.string.js | 519 + .../underscore.string/package.json | 74 + .../underscore.string/test/run-qunit.js | 44 + .../underscore.string/test/speed.js | 138 + .../underscore.string/test/strings.js | 409 + .../test/strings_standalone.js | 12 + .../underscore.string/test/test.html | 31 + .../test/test_standalone.html | 18 + .../test/test_underscore/arrays.js | 166 + .../test/test_underscore/chaining.js | 59 + .../test/test_underscore/collections.js | 270 + .../test/test_underscore/functions.js | 198 + .../test/test_underscore/objects.js | 535 + .../test/test_underscore/speed.js | 70 + .../test/test_underscore/temp.js | 27 + .../test/test_underscore/temp_tests.html | 19 + .../test/test_underscore/test.html | 43 + .../test/test_underscore/utility.js | 155 + .../test/test_underscore/vendor/jquery.js | 19 + .../test/test_underscore/vendor/jslitmus.js | 670 + .../test/test_underscore/vendor/qunit.css | 196 + .../test/test_underscore/vendor/qunit.js | 2360 +++ .../underscore.string/test/underscore.js | 999 + .../node_modules/underscore/.npmignore | 3 + .../argparse/node_modules/underscore/CNAME | 1 + .../argparse/node_modules/underscore/LICENSE | 22 + .../node_modules/underscore/README.md | 19 + .../node_modules/underscore/favicon.ico | Bin 0 -> 1406 bytes .../node_modules/underscore/index.html | 2109 +++ .../argparse/node_modules/underscore/index.js | 1 + .../node_modules/underscore/package.json | 28 + .../underscore/raw/underscore.psd | Bin 0 -> 215540 bytes .../node_modules/underscore/underscore-min.js | 32 + .../node_modules/underscore/underscore.js | 1059 ++ .../node_modules/argparse/package.json | 48 + .../node_modules/argparse/test/base.js | 100 + .../argparse/test/sub_commands.js | 80 + node_modules/js-yaml/package.json | 56 + .../js-yaml/support/pyyaml-src/__init__.py | 312 + .../js-yaml/support/pyyaml-src/composer.py | 139 + .../js-yaml/support/pyyaml-src/constructor.py | 686 + .../js-yaml/support/pyyaml-src/cyaml.py | 85 + .../js-yaml/support/pyyaml-src/dumper.py | 62 + .../js-yaml/support/pyyaml-src/emitter.py | 1137 ++ .../js-yaml/support/pyyaml-src/error.py | 75 + .../js-yaml/support/pyyaml-src/events.py | 86 + .../js-yaml/support/pyyaml-src/loader.py | 40 + .../js-yaml/support/pyyaml-src/nodes.py | 49 + .../js-yaml/support/pyyaml-src/parser.py | 589 + .../js-yaml/support/pyyaml-src/reader.py | 192 + .../js-yaml/support/pyyaml-src/representer.py | 374 + .../js-yaml/support/pyyaml-src/resolver.py | 224 + .../js-yaml/support/pyyaml-src/scanner.py | 1448 ++ .../js-yaml/support/pyyaml-src/serializer.py | 111 + .../js-yaml/support/pyyaml-src/tokens.py | 104 + node_modules/js-yaml/test/functional-test.js | 4 + .../js-yaml/test/functional/canonical.js | 294 + .../data/a-nasty-libyaml-bug.loader-error | 1 + .../js-yaml/test/functional/data/bool.data | 2 + .../js-yaml/test/functional/data/bool.detect | 1 + .../data/colon-in-flow-context.loader-error | 1 + .../test/functional/data/construct-map.code | 7 + .../test/functional/data/construct-map.data | 11 + ...nt-separator-in-quoted-scalar.loader-error | 11 + .../data/duplicate-anchor-1.loader-error | 3 + .../data/duplicate-anchor-2.loader-error | 1 + .../data/duplicate-tag-directive.loader-error | 3 + .../duplicate-yaml-directive.loader-error | 3 + ...scalar-in-simple-key-context-bug.canonical | 6 + ...lock-scalar-in-simple-key-context-bug.data | 4 + .../data/empty-document-bug.canonical | 1 + .../functional/data/empty-document-bug.data | 0 .../data/empty-documents.single-loader-error | 2 + .../data/empty-python-module.loader-error | 1 + .../data/empty-python-name.loader-error | 1 + .../data/expected-mapping.loader-error | 1 + .../data/expected-scalar.loader-error | 1 + .../data/expected-sequence.loader-error | 1 + .../explicit-document.single-loader-error | 4 + .../data/fetch-complex-value-bug.loader-error | 2 + .../js-yaml/test/functional/data/float.data | 6 + .../js-yaml/test/functional/data/float.detect | 1 + .../data/forbidden-entry.loader-error | 2 + .../data/forbidden-key.loader-error | 2 + .../data/forbidden-value.loader-error | 1 + .../test/functional/data/function.data | 1 + .../test/functional/data/function.detect | 1 + .../implicit-document.single-loader-error | 3 + .../js-yaml/test/functional/data/int.data | 6 + .../js-yaml/test/functional/data/int.detect | 1 + .../data/invalid-anchor-1.loader-error | 1 + .../data/invalid-anchor-2.loader-error | 8 + .../data/invalid-base64-data-2.loader-error | 2 + .../data/invalid-base64-data.loader-error | 2 + ...nvalid-block-scalar-indicator.loader-error | 2 + .../data/invalid-character.loader-error | Bin 0 -> 2209 bytes .../data/invalid-directive-line.loader-error | 2 + .../invalid-directive-name-1.loader-error | 2 + .../invalid-directive-name-2.loader-error | 2 + .../invalid-escape-character.loader-error | 1 + .../data/invalid-escape-numbers.loader-error | 1 + ...valid-indentation-indicator-1.loader-error | 2 + ...valid-indentation-indicator-2.loader-error | 2 + ...d-item-without-trailing-break.loader-error | 2 + .../data/invalid-merge-1.loader-error | 2 + .../data/invalid-merge-2.loader-error | 2 + .../data/invalid-omap-1.loader-error | 3 + .../data/invalid-omap-2.loader-error | 3 + .../data/invalid-omap-3.loader-error | 4 + .../data/invalid-pairs-1.loader-error | 3 + .../data/invalid-pairs-2.loader-error | 3 + .../data/invalid-pairs-3.loader-error | 4 + .../invalid-python-bytes-2-py3.loader-error | 2 + .../invalid-python-bytes-py3.loader-error | 2 + .../invalid-python-module-kind.loader-error | 1 + .../invalid-python-module-value.loader-error | 1 + .../data/invalid-python-module.loader-error | 1 + .../invalid-python-name-kind.loader-error | 1 + .../invalid-python-name-module-2.loader-error | 1 + .../invalid-python-name-module.loader-error | 1 + .../invalid-python-name-object.loader-error | 1 + .../invalid-python-name-value.loader-error | 1 + .../data/invalid-simple-key.loader-error | 3 + .../invalid-starting-character.loader-error | 1 + .../data/invalid-tag-1.loader-error | 1 + .../data/invalid-tag-2.loader-error | 1 + .../invalid-tag-directive-handle.loader-error | 2 + .../invalid-tag-directive-prefix.loader-error | 2 + .../data/invalid-tag-handle-1.loader-error | 2 + .../data/invalid-tag-handle-2.loader-error | 2 + .../data/invalid-uri-escapes-1.loader-error | 1 + .../data/invalid-uri-escapes-2.loader-error | 1 + .../data/invalid-uri-escapes-3.loader-error | 1 + .../functional/data/invalid-uri.loader-error | 1 + ...alid-yaml-directive-version-1.loader-error | 3 + ...alid-yaml-directive-version-2.loader-error | 2 + ...alid-yaml-directive-version-3.loader-error | 2 + ...alid-yaml-directive-version-4.loader-error | 2 + ...alid-yaml-directive-version-5.loader-error | 2 + ...alid-yaml-directive-version-6.loader-error | 2 + .../data/invalid-yaml-version.loader-error | 2 + .../js-yaml/test/functional/data/merge.data | 1 + .../js-yaml/test/functional/data/merge.detect | 1 + .../data/no-block-collection-end.loader-error | 3 + .../data/no-block-mapping-end-2.loader-error | 3 + .../data/no-block-mapping-end.loader-error | 1 + .../data/no-document-start.loader-error | 3 + .../data/no-flow-mapping-end.loader-error | 1 + .../data/no-flow-sequence-end.loader-error | 1 + .../functional/data/no-node-1.loader-error | 1 + .../functional/data/no-node-2.loader-error | 1 + .../js-yaml/test/functional/data/null.data | 3 + .../js-yaml/test/functional/data/null.detect | 1 + ...emove-possible-simple-key-bug.loader-error | 3 + .../data/scan-document-end-bug.canonical | 3 + .../data/scan-document-end-bug.data | 3 + .../data/scan-line-break-bug.canonical | 3 + .../functional/data/scan-line-break-bug.data | 3 + .../data/sloppy-indentation.canonical | 18 + .../functional/data/sloppy-indentation.data | 17 + .../test/functional/data/spec-02-01.data | 3 + .../test/functional/data/spec-02-01.structure | 1 + .../test/functional/data/spec-02-01.tokens | 1 + .../test/functional/data/spec-02-02.data | 3 + .../test/functional/data/spec-02-02.structure | 1 + .../test/functional/data/spec-02-02.tokens | 5 + .../test/functional/data/spec-02-03.data | 8 + .../test/functional/data/spec-02-03.structure | 1 + .../test/functional/data/spec-02-03.tokens | 4 + .../test/functional/data/spec-02-04.data | 8 + .../test/functional/data/spec-02-04.structure | 4 + .../test/functional/data/spec-02-04.tokens | 4 + .../test/functional/data/spec-02-05.data | 3 + .../test/functional/data/spec-02-05.structure | 5 + .../test/functional/data/spec-02-05.tokens | 5 + .../test/functional/data/spec-02-06.data | 5 + .../test/functional/data/spec-02-06.structure | 4 + .../test/functional/data/spec-02-06.tokens | 4 + .../test/functional/data/spec-02-07.data | 10 + .../test/functional/data/spec-02-07.structure | 4 + .../test/functional/data/spec-02-07.tokens | 12 + .../test/functional/data/spec-02-08.data | 10 + .../test/functional/data/spec-02-08.structure | 4 + .../test/functional/data/spec-02-08.tokens | 15 + .../test/functional/data/spec-02-09.data | 8 + .../test/functional/data/spec-02-09.structure | 1 + .../test/functional/data/spec-02-09.tokens | 5 + .../test/functional/data/spec-02-10.data | 8 + .../test/functional/data/spec-02-10.structure | 1 + .../test/functional/data/spec-02-10.tokens | 5 + .../test/functional/data/spec-02-11.data | 9 + .../test/functional/data/spec-02-11.structure | 4 + .../test/functional/data/spec-02-11.tokens | 6 + .../test/functional/data/spec-02-12.data | 8 + .../test/functional/data/spec-02-12.structure | 5 + .../test/functional/data/spec-02-12.tokens | 6 + .../test/functional/data/spec-02-13.data | 4 + .../test/functional/data/spec-02-13.structure | 1 + .../test/functional/data/spec-02-13.tokens | 1 + .../test/functional/data/spec-02-14.data | 4 + .../test/functional/data/spec-02-14.structure | 1 + .../test/functional/data/spec-02-14.tokens | 1 + .../test/functional/data/spec-02-15.data | 8 + .../test/functional/data/spec-02-15.structure | 1 + .../test/functional/data/spec-02-15.tokens | 1 + .../test/functional/data/spec-02-16.data | 7 + .../test/functional/data/spec-02-16.structure | 1 + .../test/functional/data/spec-02-16.tokens | 5 + .../test/functional/data/spec-02-17.data | 7 + .../test/functional/data/spec-02-17.structure | 1 + .../test/functional/data/spec-02-17.tokens | 8 + .../test/functional/data/spec-02-18.data | 6 + .../test/functional/data/spec-02-18.structure | 1 + .../test/functional/data/spec-02-18.tokens | 4 + .../test/functional/data/spec-02-19.data | 5 + .../test/functional/data/spec-02-19.structure | 1 + .../test/functional/data/spec-02-19.tokens | 7 + .../test/functional/data/spec-02-20.data | 6 + .../test/functional/data/spec-02-20.structure | 1 + .../test/functional/data/spec-02-20.tokens | 8 + .../test/functional/data/spec-02-21.data | 4 + .../test/functional/data/spec-02-21.structure | 1 + .../test/functional/data/spec-02-21.tokens | 6 + .../test/functional/data/spec-02-22.data | 4 + .../test/functional/data/spec-02-22.structure | 1 + .../test/functional/data/spec-02-22.tokens | 6 + .../test/functional/data/spec-02-23.data | 13 + .../test/functional/data/spec-02-23.structure | 1 + .../test/functional/data/spec-02-23.tokens | 6 + .../test/functional/data/spec-02-24.data | 14 + .../test/functional/data/spec-02-24.structure | 5 + .../test/functional/data/spec-02-24.tokens | 20 + .../test/functional/data/spec-02-25.data | 7 + .../test/functional/data/spec-02-25.structure | 1 + .../test/functional/data/spec-02-25.tokens | 6 + .../test/functional/data/spec-02-26.data | 7 + .../test/functional/data/spec-02-26.structure | 5 + .../test/functional/data/spec-02-26.tokens | 6 + .../test/functional/data/spec-02-27.data | 29 + .../test/functional/data/spec-02-27.structure | 17 + .../test/functional/data/spec-02-27.tokens | 20 + .../test/functional/data/spec-02-28.data | 26 + .../test/functional/data/spec-02-28.structure | 10 + .../test/functional/data/spec-02-28.tokens | 23 + .../test/functional/data/spec-05-03.canonical | 14 + .../test/functional/data/spec-05-03.data | 7 + .../test/functional/data/spec-05-04.canonical | 13 + .../test/functional/data/spec-05-04.data | 2 + .../test/functional/data/spec-05-06.canonical | 8 + .../test/functional/data/spec-05-06.data | 2 + .../test/functional/data/spec-05-07.canonical | 8 + .../test/functional/data/spec-05-07.data | 4 + .../test/functional/data/spec-05-08.canonical | 8 + .../test/functional/data/spec-05-08.data | 2 + .../test/functional/data/spec-05-09.canonical | 3 + .../test/functional/data/spec-05-09.data | 2 + .../test/functional/data/spec-05-11.canonical | 6 + .../test/functional/data/spec-05-11.data | 3 + .../test/functional/data/spec-05-13.canonical | 5 + .../test/functional/data/spec-05-13.data | 3 + .../test/functional/data/spec-05-14.canonical | 7 + .../test/functional/data/spec-05-14.data | 2 + .../test/functional/data/spec-06-01.canonical | 15 + .../test/functional/data/spec-06-01.data | 14 + .../test/functional/data/spec-06-03.canonical | 6 + .../test/functional/data/spec-06-03.data | 2 + .../test/functional/data/spec-06-04.canonical | 6 + .../test/functional/data/spec-06-04.data | 4 + .../test/functional/data/spec-06-05.canonical | 16 + .../test/functional/data/spec-06-05.data | 6 + .../test/functional/data/spec-06-06.canonical | 10 + .../test/functional/data/spec-06-06.data | 7 + .../test/functional/data/spec-06-07.canonical | 6 + .../test/functional/data/spec-06-07.data | 8 + .../test/functional/data/spec-06-08.canonical | 5 + .../test/functional/data/spec-06-08.data | 2 + .../test/functional/data/spec-07-01.canonical | 3 + .../test/functional/data/spec-07-01.data | 3 + .../test/functional/data/spec-07-02.canonical | 3 + .../test/functional/data/spec-07-02.data | 4 + .../test/functional/data/spec-07-04.canonical | 3 + .../test/functional/data/spec-07-04.data | 3 + .../test/functional/data/spec-07-06.canonical | 6 + .../test/functional/data/spec-07-06.data | 5 + .../functional/data/spec-07-07a.canonical | 3 + .../test/functional/data/spec-07-07a.data | 2 + .../functional/data/spec-07-07b.canonical | 3 + .../test/functional/data/spec-07-07b.data | 4 + .../test/functional/data/spec-07-08.canonical | 7 + .../test/functional/data/spec-07-08.data | 9 + .../test/functional/data/spec-07-09.canonical | 9 + .../test/functional/data/spec-07-09.data | 11 + .../test/functional/data/spec-07-10.canonical | 15 + .../test/functional/data/spec-07-10.data | 11 + .../functional/data/spec-07-12a.canonical | 6 + .../test/functional/data/spec-07-12a.data | 3 + .../functional/data/spec-07-12b.canonical | 3 + .../test/functional/data/spec-07-12b.data | 4 + .../test/functional/data/spec-07-13.canonical | 9 + .../test/functional/data/spec-07-13.data | 9 + .../test/functional/data/spec-08-01.canonical | 8 + .../test/functional/data/spec-08-01.data | 2 + .../test/functional/data/spec-08-02.canonical | 8 + .../test/functional/data/spec-08-02.data | 2 + .../test/functional/data/spec-08-03.canonical | 6 + .../test/functional/data/spec-08-03.data | 2 + .../test/functional/data/spec-08-05.canonical | 7 + .../test/functional/data/spec-08-05.data | 5 + .../test/functional/data/spec-08-07.canonical | 8 + .../test/functional/data/spec-08-07.data | 4 + .../test/functional/data/spec-08-08.canonical | 15 + .../test/functional/data/spec-08-08.data | 13 + .../test/functional/data/spec-08-09.canonical | 21 + .../test/functional/data/spec-08-09.data | 11 + .../test/functional/data/spec-08-10.canonical | 23 + .../test/functional/data/spec-08-10.data | 15 + .../test/functional/data/spec-08-11.canonical | 8 + .../test/functional/data/spec-08-11.data | 2 + .../test/functional/data/spec-08-12.canonical | 10 + .../test/functional/data/spec-08-12.data | 8 + .../test/functional/data/spec-08-13.canonical | 10 + .../test/functional/data/spec-08-13.data | 4 + .../test/functional/data/spec-08-14.canonical | 10 + .../test/functional/data/spec-08-14.data | 5 + .../test/functional/data/spec-08-15.canonical | 11 + .../test/functional/data/spec-08-15.data | 5 + .../test/functional/data/spec-09-01.canonical | 11 + .../test/functional/data/spec-09-01.data | 6 + .../test/functional/data/spec-09-02.canonical | 7 + .../test/functional/data/spec-09-02.data | 6 + .../test/functional/data/spec-09-03.canonical | 7 + .../test/functional/data/spec-09-03.data | 6 + .../test/functional/data/spec-09-04.canonical | 6 + .../test/functional/data/spec-09-04.data | 4 + .../test/functional/data/spec-09-05.canonical | 7 + .../test/functional/data/spec-09-05.data | 8 + .../test/functional/data/spec-09-06.canonical | 3 + .../test/functional/data/spec-09-06.data | 1 + .../test/functional/data/spec-09-07.canonical | 11 + .../test/functional/data/spec-09-07.data | 6 + .../test/functional/data/spec-09-08.canonical | 6 + .../test/functional/data/spec-09-08.data | 1 + .../test/functional/data/spec-09-09.canonical | 7 + .../test/functional/data/spec-09-09.data | 6 + .../test/functional/data/spec-09-10.canonical | 5 + .../test/functional/data/spec-09-10.data | 3 + .../test/functional/data/spec-09-11.canonical | 6 + .../test/functional/data/spec-09-11.data | 5 + .../test/functional/data/spec-09-12.canonical | 12 + .../test/functional/data/spec-09-12.data | 8 + .../test/functional/data/spec-09-13.canonical | 11 + .../test/functional/data/spec-09-13.data | 6 + .../test/functional/data/spec-09-15.canonical | 18 + .../test/functional/data/spec-09-15.data | 13 + .../test/functional/data/spec-09-16.canonical | 6 + .../test/functional/data/spec-09-16.data | 3 + .../test/functional/data/spec-09-17.canonical | 4 + .../test/functional/data/spec-09-17.data | 3 + .../test/functional/data/spec-09-18.canonical | 8 + .../test/functional/data/spec-09-18.data | 9 + .../test/functional/data/spec-09-19.canonical | 6 + .../test/functional/data/spec-09-19.data | 4 + .../test/functional/data/spec-09-20.canonical | 8 + .../test/functional/data/spec-09-20.data | 11 + .../test/functional/data/spec-09-22.canonical | 10 + .../test/functional/data/spec-09-22.data | 4 + .../test/functional/data/spec-09-23.canonical | 10 + .../test/functional/data/spec-09-23.data | 11 + .../test/functional/data/spec-09-24.canonical | 10 + .../test/functional/data/spec-09-24.data | 6 + .../test/functional/data/spec-09-25.canonical | 4 + .../test/functional/data/spec-09-25.data | 3 + .../test/functional/data/spec-09-26.canonical | 3 + .../test/functional/data/spec-09-26.data | 8 + .../test/functional/data/spec-09-27.canonical | 3 + .../test/functional/data/spec-09-27.data | 8 + .../test/functional/data/spec-09-28.canonical | 3 + .../test/functional/data/spec-09-28.data | 8 + .../test/functional/data/spec-09-29.canonical | 4 + .../test/functional/data/spec-09-29.data | 4 + .../test/functional/data/spec-09-30.canonical | 7 + .../test/functional/data/spec-09-30.data | 14 + .../test/functional/data/spec-09-31.canonical | 7 + .../test/functional/data/spec-09-31.data | 14 + .../test/functional/data/spec-09-32.canonical | 7 + .../test/functional/data/spec-09-32.data | 14 + .../test/functional/data/spec-09-33.canonical | 7 + .../test/functional/data/spec-09-33.data | 14 + .../test/functional/data/spec-10-01.canonical | 12 + .../test/functional/data/spec-10-01.data | 2 + .../test/functional/data/spec-10-02.canonical | 14 + .../test/functional/data/spec-10-02.data | 8 + .../test/functional/data/spec-10-03.canonical | 12 + .../test/functional/data/spec-10-03.data | 4 + .../test/functional/data/spec-10-04.canonical | 11 + .../test/functional/data/spec-10-04.data | 4 + .../test/functional/data/spec-10-05.canonical | 14 + .../test/functional/data/spec-10-05.data | 7 + .../test/functional/data/spec-10-06.canonical | 16 + .../test/functional/data/spec-10-06.data | 2 + .../test/functional/data/spec-10-07.canonical | 16 + .../test/functional/data/spec-10-07.data | 7 + .../test/functional/data/spec-10-09.canonical | 8 + .../test/functional/data/spec-10-09.data | 4 + .../test/functional/data/spec-10-10.canonical | 16 + .../test/functional/data/spec-10-10.data | 8 + .../test/functional/data/spec-10-11.canonical | 24 + .../test/functional/data/spec-10-11.data | 7 + .../test/functional/data/spec-10-12.canonical | 9 + .../test/functional/data/spec-10-12.data | 3 + .../test/functional/data/spec-10-13.canonical | 11 + .../test/functional/data/spec-10-13.data | 5 + .../test/functional/data/spec-10-14.canonical | 11 + .../test/functional/data/spec-10-14.data | 4 + .../test/functional/data/spec-10-15.canonical | 18 + .../test/functional/data/spec-10-15.data | 3 + .../js-yaml/test/functional/data/str.data | 1 + .../js-yaml/test/functional/data/str.detect | 1 + .../test/functional/data/timestamp.data | 5 + .../test/functional/data/timestamp.detect | 1 + .../data/unclosed-bracket.loader-error | 6 + .../data/unclosed-quoted-scalar.loader-error | 2 + .../data/undefined-anchor.loader-error | 3 + .../data/undefined-constructor.loader-error | 1 + .../data/undefined-tag-handle.loader-error | 1 + .../js-yaml/test/functional/data/value.data | 1 + .../js-yaml/test/functional/data/value.detect | 1 + .../js-yaml/test/functional/data/yaml.data | 3 + .../js-yaml/test/functional/data/yaml.detect | 1 + .../test/functional/functional-errors.js | 49 + .../test/functional/functional-resolver.js | 36 + .../test/functional/functional-structure.js | 81 + .../test/functional/functional-tokens.js | 84 + node_modules/js-yaml/test/helper.js | 85 + node_modules/js-yaml/test/issues-test.js | 4 + .../js-yaml/test/issues/data/issue-17.yml | 1 + .../js-yaml/test/issues/data/issue-19.yml | 3 + .../js-yaml/test/issues/data/issue-26.yml | 4 + .../js-yaml/test/issues/data/issue-33.yml | 1 + .../js-yaml/test/issues/data/issue-46.yml | 2 + .../js-yaml/test/issues/data/issue-8.yml | 1 + .../js-yaml/test/issues/data/issue-9.yml | 2 + node_modules/js-yaml/test/issues/issue-17.js | 16 + node_modules/js-yaml/test/issues/issue-19.js | 18 + node_modules/js-yaml/test/issues/issue-26.js | 16 + node_modules/js-yaml/test/issues/issue-33.js | 22 + node_modules/js-yaml/test/issues/issue-46.js | 30 + node_modules/js-yaml/test/issues/issue-8.js | 17 + node_modules/js-yaml/test/issues/issue-9.js | 20 + node_modules/watch-tree/.npmignore | 2 + node_modules/watch-tree/Cakefile | 18 + node_modules/watch-tree/README.md | 96 + node_modules/watch-tree/bin/watch-tree | 3 + node_modules/watch-tree/lib/command.js | 19 + .../watch-tree/lib/test/testing_util.js | 83 + node_modules/watch-tree/lib/test/tests.js | 87 + node_modules/watch-tree/lib/watch-tree.js | 9 + node_modules/watch-tree/lib/watchers/stat.js | 167 + .../watch-tree/node_modules/.bin/cake | 1 + .../watch-tree/node_modules/.bin/coffee | 1 + .../node_modules/.bin/node-async-test | 1 + .../watch-tree/node_modules/async/.gitmodules | 9 + .../watch-tree/node_modules/async/.npmignore | 4 + .../watch-tree/node_modules/async/LICENSE | 19 + .../watch-tree/node_modules/async/Makefile | 25 + .../watch-tree/node_modules/async/README.md | 1021 + .../watch-tree/node_modules/async/index.js | 3 + .../node_modules/async/lib/async.js | 692 + .../node_modules/async/package.json | 30 + .../node_modules/async_testing/.gitmodules | 3 + .../node_modules/async_testing/API.md | 90 + .../node_modules/async_testing/AUTHORS | 5 + .../node_modules/async_testing/LICENSE | 22 + .../node_modules/async_testing/README.md | 337 + .../async_testing/bin/node-async-test.js | 32 + .../async_testing/examples/test-suite.js | 40 + .../node_modules/async_testing/index.js | 2 + .../async_testing/lib/async_testing.js | 855 + .../async_testing/lib/console-runner.js | 309 + .../async_testing/lib/web-runner.js | 318 + .../lib/web-runner/public/client/.gitmodules | 3 + .../lib/web-runner/public/client/Makefile | 2 + .../lib/web-runner/public/client/README.md | 213 + .../lib/web-runner/public/client/lib/io.js | 23 + .../web-runner/public/client/lib/socket.js | 136 + .../web-runner/public/client/lib/transport.js | 143 + .../client/lib/transports/flashsocket.js | 65 + .../public/client/lib/transports/htmlfile.js | 71 + .../client/lib/transports/jsonp-polling.js | 116 + .../public/client/lib/transports/websocket.js | 60 + .../client/lib/transports/xhr-multipart.js | 36 + .../client/lib/transports/xhr-polling.js | 68 + .../public/client/lib/transports/xhr.js | 131 + .../lib/web-runner/public/client/lib/util.js | 54 + .../lib/vendor/web-socket-js/.npmignore | 1 + .../lib/vendor/web-socket-js/FABridge.js | 604 + .../lib/vendor/web-socket-js/README.txt | 109 + .../vendor/web-socket-js/WebSocketMain.swf | Bin 0 -> 180175 bytes .../web-socket-js/WebSocketMainInsecure.zip | Bin 0 -> 173076 bytes .../web-socket-js/flash-src/WebSocket.as | 459 + .../web-socket-js/flash-src/WebSocketMain.as | 94 + .../flash-src/WebSocketMainInsecure.as | 19 + .../flash-src/WebSocketStateEvent.as | 32 + .../flash-src/bridge/FABridge.as | 943 + .../vendor/web-socket-js/flash-src/build.sh | 10 + .../com/adobe/net/proxies/RFC2817Socket.as | 204 + .../flash-src/com/gsolo/encryption/MD5.as | 375 + .../flash-src/com/hurlant/crypto/Crypto.as | 287 + .../crypto/cert/MozillaRootCertificates.as | 3235 ++++ .../hurlant/crypto/cert/X509Certificate.as | 218 + .../crypto/cert/X509CertificateCollection.as | 57 + .../flash-src/com/hurlant/crypto/hash/HMAC.as | 82 + .../com/hurlant/crypto/hash/IHMAC.as | 27 + .../com/hurlant/crypto/hash/IHash.as | 21 + .../flash-src/com/hurlant/crypto/hash/MAC.as | 137 + .../flash-src/com/hurlant/crypto/hash/MD2.as | 124 + .../flash-src/com/hurlant/crypto/hash/MD5.as | 204 + .../flash-src/com/hurlant/crypto/hash/SHA1.as | 106 + .../com/hurlant/crypto/hash/SHA224.as | 28 + .../com/hurlant/crypto/hash/SHA256.as | 115 + .../com/hurlant/crypto/hash/SHABase.as | 71 + .../flash-src/com/hurlant/crypto/prng/ARC4.as | 90 + .../com/hurlant/crypto/prng/IPRNG.as | 20 + .../com/hurlant/crypto/prng/Random.as | 119 + .../com/hurlant/crypto/prng/TLSPRF.as | 142 + .../com/hurlant/crypto/rsa/RSAKey.as | 339 + .../com/hurlant/crypto/symmetric/AESKey.as | 2797 +++ .../hurlant/crypto/symmetric/BlowFishKey.as | 375 + .../com/hurlant/crypto/symmetric/CBCMode.as | 55 + .../com/hurlant/crypto/symmetric/CFB8Mode.as | 61 + .../com/hurlant/crypto/symmetric/CFBMode.as | 64 + .../com/hurlant/crypto/symmetric/CTRMode.as | 58 + .../com/hurlant/crypto/symmetric/DESKey.as | 365 + .../com/hurlant/crypto/symmetric/ECBMode.as | 86 + .../com/hurlant/crypto/symmetric/ICipher.as | 21 + .../com/hurlant/crypto/symmetric/IMode.as | 15 + .../com/hurlant/crypto/symmetric/IPad.as | 32 + .../hurlant/crypto/symmetric/IStreamCipher.as | 21 + .../hurlant/crypto/symmetric/ISymmetricKey.as | 35 + .../com/hurlant/crypto/symmetric/IVMode.as | 110 + .../com/hurlant/crypto/symmetric/NullPad.as | 34 + .../com/hurlant/crypto/symmetric/OFBMode.as | 52 + .../com/hurlant/crypto/symmetric/PKCS5.as | 44 + .../com/hurlant/crypto/symmetric/SSLPad.as | 44 + .../hurlant/crypto/symmetric/SimpleIVMode.as | 60 + .../com/hurlant/crypto/symmetric/TLSPad.as | 42 + .../hurlant/crypto/symmetric/TripleDESKey.as | 88 + .../com/hurlant/crypto/symmetric/XTeaKey.as | 94 + .../com/hurlant/crypto/symmetric/aeskey.pl | 29 + .../com/hurlant/crypto/symmetric/dump.txt | 2304 +++ .../com/hurlant/crypto/tests/AESKeyTest.as | 1220 ++ .../com/hurlant/crypto/tests/ARC4Test.as | 58 + .../hurlant/crypto/tests/BigIntegerTest.as | 39 + .../hurlant/crypto/tests/BlowFishKeyTest.as | 148 + .../com/hurlant/crypto/tests/CBCModeTest.as | 160 + .../com/hurlant/crypto/tests/CFB8ModeTest.as | 71 + .../com/hurlant/crypto/tests/CFBModeTest.as | 98 + .../com/hurlant/crypto/tests/CTRModeTest.as | 109 + .../com/hurlant/crypto/tests/DESKeyTest.as | 112 + .../com/hurlant/crypto/tests/ECBModeTest.as | 151 + .../com/hurlant/crypto/tests/HMACTest.as | 184 + .../com/hurlant/crypto/tests/ITestHarness.as | 20 + .../com/hurlant/crypto/tests/MD2Test.as | 56 + .../com/hurlant/crypto/tests/MD5Test.as | 58 + .../com/hurlant/crypto/tests/OFBModeTest.as | 101 + .../com/hurlant/crypto/tests/RSAKeyTest.as | 92 + .../com/hurlant/crypto/tests/SHA1Test.as | 198 + .../com/hurlant/crypto/tests/SHA224Test.as | 58 + .../com/hurlant/crypto/tests/SHA256Test.as | 60 + .../com/hurlant/crypto/tests/TLSPRFTest.as | 51 + .../com/hurlant/crypto/tests/TestCase.as | 42 + .../hurlant/crypto/tests/TripleDESKeyTest.as | 59 + .../com/hurlant/crypto/tests/XTeaKeyTest.as | 66 + .../com/hurlant/crypto/tls/BulkCiphers.as | 102 + .../com/hurlant/crypto/tls/CipherSuites.as | 117 + .../hurlant/crypto/tls/IConnectionState.as | 14 + .../hurlant/crypto/tls/ISecurityParameters.as | 29 + .../com/hurlant/crypto/tls/KeyExchanges.as | 24 + .../flash-src/com/hurlant/crypto/tls/MACs.as | 38 + .../hurlant/crypto/tls/SSLConnectionState.as | 171 + .../com/hurlant/crypto/tls/SSLEvent.as | 26 + .../crypto/tls/SSLSecurityParameters.as | 340 + .../com/hurlant/crypto/tls/TLSConfig.as | 70 + .../hurlant/crypto/tls/TLSConnectionState.as | 151 + .../com/hurlant/crypto/tls/TLSEngine.as | 895 + .../com/hurlant/crypto/tls/TLSError.as | 39 + .../com/hurlant/crypto/tls/TLSEvent.as | 27 + .../crypto/tls/TLSSecurityParameters.as | 197 + .../com/hurlant/crypto/tls/TLSSocket.as | 370 + .../com/hurlant/crypto/tls/TLSSocketEvent.as | 26 + .../com/hurlant/crypto/tls/TLSTest.as | 180 + .../com/hurlant/math/BarrettReduction.as | 90 + .../flash-src/com/hurlant/math/BigInteger.as | 1543 ++ .../com/hurlant/math/ClassicReduction.as | 35 + .../flash-src/com/hurlant/math/IReduction.as | 11 + .../com/hurlant/math/MontgomeryReduction.as | 85 + .../com/hurlant/math/NullReduction.as | 34 + .../flash-src/com/hurlant/math/bi_internal.as | 11 + .../flash-src/com/hurlant/util/ArrayUtil.as | 25 + .../flash-src/com/hurlant/util/Base64.as | 189 + .../flash-src/com/hurlant/util/Hex.as | 66 + .../flash-src/com/hurlant/util/Memory.as | 28 + .../com/hurlant/util/der/ByteString.as | 43 + .../flash-src/com/hurlant/util/der/DER.as | 210 + .../com/hurlant/util/der/IAsn1Type.as | 21 + .../flash-src/com/hurlant/util/der/Integer.as | 44 + .../flash-src/com/hurlant/util/der/OID.as | 35 + .../com/hurlant/util/der/ObjectIdentifier.as | 112 + .../flash-src/com/hurlant/util/der/PEM.as | 118 + .../com/hurlant/util/der/PrintableString.as | 49 + .../com/hurlant/util/der/Sequence.as | 90 + .../flash-src/com/hurlant/util/der/Set.as | 27 + .../flash-src/com/hurlant/util/der/Type.as | 94 + .../flash-src/com/hurlant/util/der/UTCTime.as | 60 + .../lib/vendor/web-socket-js/sample.html | 76 + .../lib/vendor/web-socket-js/swfobject.js | 4 + .../lib/vendor/web-socket-js/web_socket.js | 383 + .../lib/web-runner/public/client/socket.io.js | 1897 ++ .../lib/web-runner/public/error.png | Bin 0 -> 226 bytes .../lib/web-runner/public/failure.png | Bin 0 -> 227 bytes .../lib/web-runner/public/images.svg | 292 + .../lib/web-runner/public/index.html | 12 + .../lib/web-runner/public/main.js | 389 + .../lib/web-runner/public/running.gif | Bin 0 -> 1849 bytes .../lib/web-runner/public/style.css | 176 + .../lib/web-runner/public/success.png | Bin 0 -> 358 bytes .../lib/web-runner/worker-test-loader.js | 12 + .../lib/web-runner/worker-test-runner.js | 87 + .../node_modules/async_testing/package.json | 46 + .../async_testing/test/test-all_passing.js | 24 + .../test/test-async_assertions.js | 51 + .../test/test-custom_assertions.js | 24 + .../async_testing/test/test-errors.js | 14 + .../test/test-multiple_errors.js | 26 + .../test/test-sync_assertions.js | 39 + .../test/test-uncaught_exception_handlers.js | 123 + .../async_testing/test/test-wrap_tests.js | 80 + .../node_modules/coffee-script/.npmignore | 11 + .../node_modules/coffee-script/CNAME | 1 + .../node_modules/coffee-script/LICENSE | 22 + .../node_modules/coffee-script/README | 51 + .../node_modules/coffee-script/Rakefile | 78 + .../node_modules/coffee-script/bin/cake | 7 + .../node_modules/coffee-script/bin/coffee | 7 + .../coffee-script/extras/jsl.conf | 44 + .../lib/coffee-script/browser.js | 92 + .../coffee-script/lib/coffee-script/cake.js | 111 + .../lib/coffee-script/coffee-script.js | 167 + .../lib/coffee-script/command.js | 500 + .../lib/coffee-script/grammar.js | 606 + .../lib/coffee-script/helpers.js | 77 + .../coffee-script/lib/coffee-script/index.js | 11 + .../coffee-script/lib/coffee-script/lexer.js | 788 + .../coffee-script/lib/coffee-script/nodes.js | 2986 +++ .../lib/coffee-script/optparse.js | 138 + .../coffee-script/lib/coffee-script/parser.js | 683 + .../coffee-script/lib/coffee-script/repl.js | 261 + .../lib/coffee-script/rewriter.js | 349 + .../coffee-script/lib/coffee-script/scope.js | 146 + .../node_modules/coffee-script/package.json | 44 + .../node_modules/optimist/.travis.yml | 4 + .../watch-tree/node_modules/optimist/LICENSE | 21 + .../node_modules/optimist/README.markdown | 487 + .../node_modules/optimist/example/bool.js | 10 + .../optimist/example/boolean_double.js | 7 + .../optimist/example/boolean_single.js | 7 + .../optimist/example/default_hash.js | 8 + .../optimist/example/default_singles.js | 7 + .../node_modules/optimist/example/divide.js | 8 + .../optimist/example/line_count.js | 20 + .../optimist/example/line_count_options.js | 29 + .../optimist/example/line_count_wrap.js | 29 + .../node_modules/optimist/example/nonopt.js | 4 + .../node_modules/optimist/example/reflect.js | 2 + .../node_modules/optimist/example/short.js | 3 + .../node_modules/optimist/example/string.js | 11 + .../optimist/example/usage-options.js | 19 + .../node_modules/optimist/example/xup.js | 10 + .../watch-tree/node_modules/optimist/index.js | 475 + .../optimist/node_modules/wordwrap/.npmignore | 1 + .../node_modules/wordwrap/README.markdown | 70 + .../node_modules/wordwrap/example/center.js | 10 + .../node_modules/wordwrap/example/meat.js | 3 + .../optimist/node_modules/wordwrap/index.js | 76 + .../node_modules/wordwrap/package.json | 40 + .../node_modules/wordwrap/test/break.js | 30 + .../node_modules/wordwrap/test/idleness.txt | 63 + .../node_modules/wordwrap/test/wrap.js | 31 + .../node_modules/optimist/package.json | 46 + .../node_modules/optimist/test/_.js | 71 + .../node_modules/optimist/test/_/argv.js | 2 + .../node_modules/optimist/test/_/bin.js | 3 + .../node_modules/optimist/test/parse.js | 420 + .../node_modules/optimist/test/usage.js | 292 + .../node_modules/underscore/.npmignore | 3 + .../watch-tree/node_modules/underscore/CNAME | 1 + .../node_modules/underscore/CONTRIBUTING.md | 9 + .../node_modules/underscore/LICENSE | 22 + .../node_modules/underscore/README.md | 19 + .../node_modules/underscore/favicon.ico | Bin 0 -> 1406 bytes .../node_modules/underscore/index.html | 2343 +++ .../node_modules/underscore/index.js | 1 + .../node_modules/underscore/package.json | 25 + .../underscore/raw/underscore.psd | Bin 0 -> 215540 bytes .../node_modules/underscore/underscore-min.js | 5 + .../node_modules/underscore/underscore.js | 1186 ++ node_modules/watch-tree/package.json | 28 + node_modules/watch-tree/src/command.coffee | 22 + .../watch-tree/src/test/testing_util.coffee | 58 + node_modules/watch-tree/src/test/tests.coffee | 79 + node_modules/watch-tree/src/watch-tree.coffee | 17 + .../watch-tree/src/watchers/stat.coffee | 165 + node_modules/watch/LICENSE | 55 + node_modules/watch/main.js | 118 + node_modules/watch/package.json | 33 + node_modules/watch/readme.mkd | 71 + node_modules/watch/test/d/d/t | 0 node_modules/watch/test/d/t | 0 node_modules/watch/test/test_monitor.js | 31 + node_modules/watch/test/test_watchTree.js | 9 + package.json | 13 + 1210 files changed, 181905 insertions(+) create mode 120000 node_modules/.bin/dustc create mode 120000 node_modules/.bin/js-yaml create mode 120000 node_modules/.bin/watch-tree create mode 100644 node_modules/colors/MIT-LICENSE.txt create mode 100644 node_modules/colors/ReadMe.md create mode 100644 node_modules/colors/colors.js create mode 100644 node_modules/colors/example.html create mode 100644 node_modules/colors/example.js create mode 100644 node_modules/colors/package.json create mode 100644 node_modules/colors/test.js create mode 100644 node_modules/dustjs-linkedin/.coverignore create mode 100644 node_modules/dustjs-linkedin/.coverrc create mode 100644 node_modules/dustjs-linkedin/.npmignore create mode 100644 node_modules/dustjs-linkedin/.travis.yml create mode 100644 node_modules/dustjs-linkedin/LICENSE create mode 100644 node_modules/dustjs-linkedin/Makefile create mode 100644 node_modules/dustjs-linkedin/README.md create mode 100644 node_modules/dustjs-linkedin/benchmark/index.html create mode 100644 node_modules/dustjs-linkedin/benchmark/server.js create mode 100644 node_modules/dustjs-linkedin/benchmark/suites/dust_suite.js create mode 100644 node_modules/dustjs-linkedin/benchmark/suites/handlebars_suite.js create mode 100644 node_modules/dustjs-linkedin/benchmark/suites/jquery_suite.js create mode 100644 node_modules/dustjs-linkedin/benchmark/suites/mustache_suite.js create mode 100644 node_modules/dustjs-linkedin/benchmark/uubench.js create mode 100755 node_modules/dustjs-linkedin/bin/dustc create mode 100644 node_modules/dustjs-linkedin/dist/dust-core-1.0.0.js create mode 100644 node_modules/dustjs-linkedin/dist/dust-full-1.0.0.js create mode 100644 node_modules/dustjs-linkedin/docs/about.md create mode 100644 node_modules/dustjs-linkedin/docs/api.md create mode 100644 node_modules/dustjs-linkedin/docs/build.js create mode 100644 node_modules/dustjs-linkedin/docs/index.css create mode 100644 node_modules/dustjs-linkedin/docs/index.dust.html create mode 100644 node_modules/dustjs-linkedin/docs/index.js create mode 100644 node_modules/dustjs-linkedin/docs/select.dust.html create mode 100644 node_modules/dustjs-linkedin/docs/syntax.md create mode 100644 node_modules/dustjs-linkedin/index.html create mode 100644 node_modules/dustjs-linkedin/lib/compiler.js create mode 100644 node_modules/dustjs-linkedin/lib/dust-helpers.js create mode 100644 node_modules/dustjs-linkedin/lib/dust.js create mode 100644 node_modules/dustjs-linkedin/lib/parser.js create mode 100644 node_modules/dustjs-linkedin/lib/server.js create mode 120000 node_modules/dustjs-linkedin/node_modules/.bin/cover create mode 120000 node_modules/dustjs-linkedin/node_modules/.bin/jasmine-node create mode 120000 node_modules/dustjs-linkedin/node_modules/.bin/uglifyjs create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/.npmignore create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/README.markdown create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/bar.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/bin/.coverrc create mode 100755 node_modules/dustjs-linkedin/node_modules/cover/bin/cover create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/contrib/cli-table/README.md create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/contrib/cli-table/index.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/contrib/cli-table/lib/cli-table/index.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/contrib/cli-table/lib/cli-table/utils.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/contrib/colors.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/contrib/commander.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/contrib/escodegen.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/contrib/esprima.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/coverage_store.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/foo.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/index.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/instrument.js create mode 120000 node_modules/dustjs-linkedin/node_modules/cover/node_modules/.bin/which create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/.npmignore create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/History.md create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/Makefile create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/README.md create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/examples/revs.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/examples/table.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/index.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/lib/cli-table/index.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/lib/cli-table/utils.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/node_modules/colors/MIT-LICENSE.txt create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/node_modules/colors/ReadMe.md create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/node_modules/colors/colors.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/node_modules/colors/example.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/node_modules/colors/package.json create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/package.json create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/test/common.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/test/index.test.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/README.markdown create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/Rakefile create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/dist/underscore.string.min.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/lib/underscore.string.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/package.json create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/speed.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/strings.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/strings_standalone.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test.html create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_standalone.html create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/arrays.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/chaining.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/collections.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/functions.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/objects.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/speed.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/temp.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/temp_tests.html create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/test.html create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/utility.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/vendor/jquery.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/vendor/jslitmus.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/vendor/qunit.css create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/vendor/qunit.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/underscore.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/.npmignore create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/LICENSE create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/README create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/index.html create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/index.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/package.json create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/raw/underscore.psd create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/underscore-min.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/underscore.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/which/LICENSE create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/which/README.md create mode 100755 node_modules/dustjs-linkedin/node_modules/cover/node_modules/which/bin/which create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/which/package.json create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/node_modules/which/which.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/package.json create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/reporters/cli.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/reporters/html.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/reporters/json.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/reporters/plain.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/resources/bootstrap.css create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/resources/jquery.min.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/resources/jquery.tablesorter.min.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/resources/prettify.css create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/resources/prettify.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/templates/file.html create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/templates/index.html create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/templates/instrumentation_header.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/test/format/index.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/test/format/src/test1.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/test/format/src/test2.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/test/index.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/test/interface.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/test/src/coverage.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/test/test.js create mode 100644 node_modules/dustjs-linkedin/node_modules/cover/utils/console.js create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/.npmignore create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/.travis.yml create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/LICENSE create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/README.md create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/bin/jasmine-node create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/async-callback.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/autotest.js create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/cli.js create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/index.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/reporter.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/requirejs-runner.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/requirejs-spec-loader.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/requirejs-wrapper-template.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/spec-collection.js create mode 120000 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/.bin/cake create mode 120000 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/.bin/coffee create mode 120000 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/.bin/r.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/.npmignore create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/CNAME create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/LICENSE create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/README create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/Rakefile create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/bin/cake create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/bin/coffee create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/extras/jsl.conf create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/browser.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/cake.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/coffee-script.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/command.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/grammar.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/helpers.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/index.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/lexer.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/nodes.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/optparse.js create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/parser.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/repl.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/rewriter.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/scope.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/package.json create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/.npmignore create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/LICENSE create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/README.markdown create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/ext/env.rhino.1.2.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/ext/jasmine-html.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/ext/jasmine.css create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/ext/jasmine.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/ext/jline.jar create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/ext/js.jar create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/package.json create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/src/jasmine.console_reporter.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/src/jasmine.junit_reporter.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/src/jasmine.teamcity_reporter.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/src/load_reporters.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/test/JUnitXmlReporterSpec.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/test/console_reporter.html create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/test/envjs.bootstrap.js create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/test/envjs.runner.sh create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/test/junit_xml_reporter.html create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/test/phantomjs-testrunner.js create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/test/phantomjs.runner.sh create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/test/teamcity_reporter.html create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/requirejs/README.md create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/requirejs/bin/r.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/requirejs/package.json create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/requirejs/require.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/underscore/.npmignore create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/underscore/CNAME create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/underscore/CONTRIBUTING.md create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/underscore/LICENSE create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/underscore/README.md create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/underscore/favicon.ico create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/underscore/index.html create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/underscore/index.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/underscore/package.json create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/underscore/raw/underscore.psd create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/underscore/underscore-min.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/underscore/underscore.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/.jshintignore create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/.npmignore create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/.travis.yml create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/license create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/package.json create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/readme.md create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test.sh create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/async.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/comparison/find.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/comparison/find.py create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/comparison/finditsynctest.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/comparison/findittest.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/comparison/fstream.js create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/comparison/install_test_deps.sh create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/comparison/lsr.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/comparison/package.json create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/dir/foo/a/b/c/w create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/dir/foo/a/b/z create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/dir/foo/a/y create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/dir/foo/x create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/dir/symlinks/dir1/file1 create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/dir/symlinks/dir2/file2 create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/dir/symlinks/file create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/endearly.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/max_depth.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/no_recurse.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/nofailemptydir.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/pauseresume.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/symlink.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/test/sync.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/walkdir/walkdir.js create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/package.json create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/scripts/specs create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/spec-requirejs/requirejs.spec.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/spec-requirejs/requirejs.sut.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/spec/AsyncSpec.coffee create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/spec/CoffeeSpec.coffee create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/spec/GrammarHelper.coffee create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/spec/HelperSpec.coffee create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/spec/SampleSpecs.js create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/spec/TestSpec.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/spec/async-callback_spec.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/spec/helper_spec.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/spec/nested.js/NestedSpec.js create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/spec/nested/NestedSpec.js create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/spec/nested/uber-nested/UberNestedSpec.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/spec/reporter_spec.js create mode 100644 node_modules/dustjs-linkedin/node_modules/jasmine-node/spec/sample_helper.js create mode 100755 node_modules/dustjs-linkedin/node_modules/jasmine-node/specs.sh create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/.npmignore create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/README.html create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/README.org create mode 100755 node_modules/dustjs-linkedin/node_modules/uglify-js/bin/uglifyjs create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/docstyle.css create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/lib/consolidator.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/lib/parse-js.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/lib/process.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/lib/squeeze-more.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/package.json create mode 100755 node_modules/dustjs-linkedin/node_modules/uglify-js/test/beautify.js create mode 100755 node_modules/dustjs-linkedin/node_modules/uglify-js/test/testconsolidator.js create mode 100755 node_modules/dustjs-linkedin/node_modules/uglify-js/test/testparser.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/1e21.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/array1.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/array2.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/array3.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/array4.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/assignment.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/concatstring.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/const.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/empty-blocks.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/forstatement.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/if-not.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/if.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/ifreturn.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/ifreturn2.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/infinite.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue10.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue11.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue13.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue14.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue16.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue17.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue20.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue21.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue25.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue27.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue278.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue28.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue29.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue30.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue34.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue349.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue353.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue372.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue4.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue48.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue50.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue53.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue54.1.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue68.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue69.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issue9.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/issues222_324.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/mangle.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/null_string.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/strict-equals.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/var.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/whitespace.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/expected/with.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/1e21.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/array1.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/array2.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/array3.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/array4.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/assignment.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/concatstring.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/const.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/empty-blocks.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/forstatement.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/if-not.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/if.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/ifreturn.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/ifreturn2.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/infinite.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue10.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue11.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue13.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue14.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue16.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue17.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue20.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue21.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue25.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue27.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue278.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue28.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue29.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue30.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue34.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue349.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue353.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue372.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue4.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue48.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue50.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue53.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue54.1.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue68.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue69.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issue9.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/issues222_324.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/mangle.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/null_string.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/strict-equals.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/var.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/whitespace.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/compress/test/with.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/test/unit/scripts.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/tmp/hoist.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/tmp/instrument.js create mode 100755 node_modules/dustjs-linkedin/node_modules/uglify-js/tmp/test.js create mode 100644 node_modules/dustjs-linkedin/node_modules/uglify-js/uglify-js.js create mode 100644 node_modules/dustjs-linkedin/package.json create mode 100644 node_modules/dustjs-linkedin/removeHelpers.patch create mode 100644 node_modules/dustjs-linkedin/src/build.js create mode 100644 node_modules/dustjs-linkedin/src/dust.pegjs create mode 100644 node_modules/dustjs-linkedin/test/README.md create mode 100644 node_modules/dustjs-linkedin/test/core.js create mode 100644 node_modules/dustjs-linkedin/test/dust_files/beautify.js create mode 100644 node_modules/dustjs-linkedin/test/dust_files/css create mode 100644 node_modules/dustjs-linkedin/test/dust_files/ecma.js create mode 100644 node_modules/dustjs-linkedin/test/dust_files/hijs.js create mode 100644 node_modules/dustjs-linkedin/test/dust_files/images/background.png create mode 100644 node_modules/dustjs-linkedin/test/dust_files/images/background_header.jpg create mode 100644 node_modules/dustjs-linkedin/test/dust_files/images/logo-linkedin.png create mode 100644 node_modules/dustjs-linkedin/test/dust_files/images/sprite_icons_alert_white_medium_v1.png create mode 100644 node_modules/dustjs-linkedin/test/dust_files/jquery.min.js create mode 100644 node_modules/dustjs-linkedin/test/dust_files/jsdump.js create mode 100644 node_modules/dustjs-linkedin/test/jasmine-test/client/lib/jasmine-1.1.0/MIT.LICENSE create mode 100644 node_modules/dustjs-linkedin/test/jasmine-test/client/lib/jasmine-1.1.0/jasmine-html.js create mode 100644 node_modules/dustjs-linkedin/test/jasmine-test/client/lib/jasmine-1.1.0/jasmine.css create mode 100644 node_modules/dustjs-linkedin/test/jasmine-test/client/lib/jasmine-1.1.0/jasmine.js create mode 100644 node_modules/dustjs-linkedin/test/jasmine-test/client/lib/jasmine-1.1.0/jasmine_favicon.png create mode 100644 node_modules/dustjs-linkedin/test/jasmine-test/client/specRunner.html create mode 100644 node_modules/dustjs-linkedin/test/jasmine-test/server/specRunner.js create mode 100644 node_modules/dustjs-linkedin/test/jasmine-test/spec/grammarTests.js create mode 100644 node_modules/dustjs-linkedin/test/jasmine-test/spec/renderTestSpec.js create mode 100644 node_modules/dustjs-linkedin/test/server.js create mode 100644 node_modules/dustjs-linkedin/test/test.html create mode 100644 node_modules/dustjs-linkedin/test/uutest.js create mode 100644 node_modules/dustjs-linkedin/utils/minifier.js create mode 100644 node_modules/dustjs-linkedin/vendor/beautify.js create mode 100644 node_modules/dustjs-linkedin/vendor/ecma.js create mode 100644 node_modules/dustjs-linkedin/vendor/hijs.js create mode 100644 node_modules/dustjs-linkedin/vendor/jquery.min.js create mode 100644 node_modules/dustjs-linkedin/vendor/jsdump.js create mode 100644 node_modules/dustjs-linkedin/vendor/showdown.js create mode 100644 node_modules/growl/History.md create mode 100644 node_modules/growl/Readme.md create mode 100644 node_modules/growl/lib/growl.js create mode 100644 node_modules/growl/package.json create mode 100644 node_modules/growl/test.js create mode 100644 node_modules/js-yaml/.jshintignore create mode 100644 node_modules/js-yaml/.jshintrc create mode 100644 node_modules/js-yaml/.ndocrc create mode 100644 node_modules/js-yaml/.npmignore create mode 100644 node_modules/js-yaml/.travis.yml create mode 100644 node_modules/js-yaml/HISTORY.md create mode 100644 node_modules/js-yaml/LICENSE create mode 100644 node_modules/js-yaml/Makefile create mode 100644 node_modules/js-yaml/README.md create mode 100755 node_modules/js-yaml/bin/js-yaml.js create mode 100644 node_modules/js-yaml/examples/single.js create mode 100644 node_modules/js-yaml/examples/single.yml create mode 100644 node_modules/js-yaml/index.js create mode 100644 node_modules/js-yaml/lib/js-yaml.js create mode 100644 node_modules/js-yaml/lib/js-yaml/common.js create mode 100644 node_modules/js-yaml/lib/js-yaml/composer.js create mode 100644 node_modules/js-yaml/lib/js-yaml/constructor.js create mode 100644 node_modules/js-yaml/lib/js-yaml/errors.js create mode 100644 node_modules/js-yaml/lib/js-yaml/events.js create mode 100644 node_modules/js-yaml/lib/js-yaml/loader.js create mode 100644 node_modules/js-yaml/lib/js-yaml/nodes.js create mode 100644 node_modules/js-yaml/lib/js-yaml/parser.js create mode 100644 node_modules/js-yaml/lib/js-yaml/reader.js create mode 100644 node_modules/js-yaml/lib/js-yaml/resolver.js create mode 100644 node_modules/js-yaml/lib/js-yaml/scanner.js create mode 100644 node_modules/js-yaml/lib/js-yaml/tokens.js create mode 100644 node_modules/js-yaml/node_modules/argparse/.jshintignore create mode 100644 node_modules/js-yaml/node_modules/argparse/.jshintrc create mode 100644 node_modules/js-yaml/node_modules/argparse/.ndocrc create mode 100644 node_modules/js-yaml/node_modules/argparse/.npmignore create mode 100644 node_modules/js-yaml/node_modules/argparse/.travis.yml create mode 100644 node_modules/js-yaml/node_modules/argparse/HISTORY.md create mode 100644 node_modules/js-yaml/node_modules/argparse/LICENSE create mode 100644 node_modules/js-yaml/node_modules/argparse/Makefile create mode 100644 node_modules/js-yaml/node_modules/argparse/README.md create mode 100755 node_modules/js-yaml/node_modules/argparse/examples/arguments.js create mode 100755 node_modules/js-yaml/node_modules/argparse/examples/choice.js create mode 100755 node_modules/js-yaml/node_modules/argparse/examples/constants.js create mode 100755 node_modules/js-yaml/node_modules/argparse/examples/help.js create mode 100755 node_modules/js-yaml/node_modules/argparse/examples/nargs.js create mode 100755 node_modules/js-yaml/node_modules/argparse/examples/prefix_chars.js create mode 100755 node_modules/js-yaml/node_modules/argparse/examples/sub_commands.js create mode 100644 node_modules/js-yaml/node_modules/argparse/index.js create mode 100644 node_modules/js-yaml/node_modules/argparse/lib/action.js create mode 100644 node_modules/js-yaml/node_modules/argparse/lib/action/append.js create mode 100644 node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js create mode 100644 node_modules/js-yaml/node_modules/argparse/lib/action/count.js create mode 100644 node_modules/js-yaml/node_modules/argparse/lib/action/help.js create mode 100644 node_modules/js-yaml/node_modules/argparse/lib/action/store.js create mode 100644 node_modules/js-yaml/node_modules/argparse/lib/action/store/constant.js create mode 100644 node_modules/js-yaml/node_modules/argparse/lib/action/store/false.js create mode 100644 node_modules/js-yaml/node_modules/argparse/lib/action/store/true.js create mode 100644 node_modules/js-yaml/node_modules/argparse/lib/action/subparsers.js create mode 100644 node_modules/js-yaml/node_modules/argparse/lib/action/version.js create mode 100644 node_modules/js-yaml/node_modules/argparse/lib/action_container.js create mode 100644 node_modules/js-yaml/node_modules/argparse/lib/argparse.js create mode 100644 node_modules/js-yaml/node_modules/argparse/lib/argument/error.js create mode 100644 node_modules/js-yaml/node_modules/argparse/lib/argument/group.js create mode 100644 node_modules/js-yaml/node_modules/argparse/lib/argument_parser.js create mode 100644 node_modules/js-yaml/node_modules/argparse/lib/const.js create mode 100644 node_modules/js-yaml/node_modules/argparse/lib/help/formatter.js create mode 100644 node_modules/js-yaml/node_modules/argparse/lib/namespace.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/.travis.yml create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/Gemfile create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/Gemfile.lock create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/README.markdown create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/Rakefile create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/dist/underscore.string.min.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/lib/underscore.string.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/package.json create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/run-qunit.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/speed.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/strings.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/strings_standalone.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/test.html create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/test_standalone.html create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/test_underscore/arrays.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/test_underscore/chaining.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/test_underscore/collections.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/test_underscore/functions.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/test_underscore/objects.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/test_underscore/speed.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/test_underscore/temp.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/test_underscore/temp_tests.html create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/test_underscore/test.html create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/test_underscore/utility.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/test_underscore/vendor/jquery.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/test_underscore/vendor/jslitmus.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/test_underscore/vendor/qunit.css create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/test_underscore/vendor/qunit.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/test/underscore.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore/.npmignore create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore/CNAME create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore/LICENSE create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore/README.md create mode 100755 node_modules/js-yaml/node_modules/argparse/node_modules/underscore/favicon.ico create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore/index.html create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore/index.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore/package.json create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore/raw/underscore.psd create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore/underscore-min.js create mode 100644 node_modules/js-yaml/node_modules/argparse/node_modules/underscore/underscore.js create mode 100644 node_modules/js-yaml/node_modules/argparse/package.json create mode 100644 node_modules/js-yaml/node_modules/argparse/test/base.js create mode 100644 node_modules/js-yaml/node_modules/argparse/test/sub_commands.js create mode 100644 node_modules/js-yaml/package.json create mode 100644 node_modules/js-yaml/support/pyyaml-src/__init__.py create mode 100644 node_modules/js-yaml/support/pyyaml-src/composer.py create mode 100644 node_modules/js-yaml/support/pyyaml-src/constructor.py create mode 100644 node_modules/js-yaml/support/pyyaml-src/cyaml.py create mode 100644 node_modules/js-yaml/support/pyyaml-src/dumper.py create mode 100644 node_modules/js-yaml/support/pyyaml-src/emitter.py create mode 100644 node_modules/js-yaml/support/pyyaml-src/error.py create mode 100644 node_modules/js-yaml/support/pyyaml-src/events.py create mode 100644 node_modules/js-yaml/support/pyyaml-src/loader.py create mode 100644 node_modules/js-yaml/support/pyyaml-src/nodes.py create mode 100644 node_modules/js-yaml/support/pyyaml-src/parser.py create mode 100644 node_modules/js-yaml/support/pyyaml-src/reader.py create mode 100644 node_modules/js-yaml/support/pyyaml-src/representer.py create mode 100644 node_modules/js-yaml/support/pyyaml-src/resolver.py create mode 100644 node_modules/js-yaml/support/pyyaml-src/scanner.py create mode 100644 node_modules/js-yaml/support/pyyaml-src/serializer.py create mode 100644 node_modules/js-yaml/support/pyyaml-src/tokens.py create mode 100644 node_modules/js-yaml/test/functional-test.js create mode 100644 node_modules/js-yaml/test/functional/canonical.js create mode 100644 node_modules/js-yaml/test/functional/data/a-nasty-libyaml-bug.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/bool.data create mode 100644 node_modules/js-yaml/test/functional/data/bool.detect create mode 100644 node_modules/js-yaml/test/functional/data/colon-in-flow-context.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/construct-map.code create mode 100644 node_modules/js-yaml/test/functional/data/construct-map.data create mode 100644 node_modules/js-yaml/test/functional/data/document-separator-in-quoted-scalar.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/duplicate-anchor-1.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/duplicate-anchor-2.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/duplicate-tag-directive.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/duplicate-yaml-directive.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/emit-block-scalar-in-simple-key-context-bug.canonical create mode 100644 node_modules/js-yaml/test/functional/data/emit-block-scalar-in-simple-key-context-bug.data create mode 100644 node_modules/js-yaml/test/functional/data/empty-document-bug.canonical create mode 100644 node_modules/js-yaml/test/functional/data/empty-document-bug.data create mode 100644 node_modules/js-yaml/test/functional/data/empty-documents.single-loader-error create mode 100644 node_modules/js-yaml/test/functional/data/empty-python-module.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/empty-python-name.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/expected-mapping.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/expected-scalar.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/expected-sequence.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/explicit-document.single-loader-error create mode 100644 node_modules/js-yaml/test/functional/data/fetch-complex-value-bug.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/float.data create mode 100644 node_modules/js-yaml/test/functional/data/float.detect create mode 100644 node_modules/js-yaml/test/functional/data/forbidden-entry.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/forbidden-key.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/forbidden-value.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/function.data create mode 100644 node_modules/js-yaml/test/functional/data/function.detect create mode 100644 node_modules/js-yaml/test/functional/data/implicit-document.single-loader-error create mode 100644 node_modules/js-yaml/test/functional/data/int.data create mode 100644 node_modules/js-yaml/test/functional/data/int.detect create mode 100644 node_modules/js-yaml/test/functional/data/invalid-anchor-1.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-anchor-2.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-base64-data-2.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-base64-data.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-block-scalar-indicator.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-character.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-directive-line.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-directive-name-1.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-directive-name-2.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-escape-character.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-escape-numbers.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-indentation-indicator-1.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-indentation-indicator-2.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-item-without-trailing-break.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-merge-1.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-merge-2.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-omap-1.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-omap-2.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-omap-3.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-pairs-1.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-pairs-2.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-pairs-3.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-python-bytes-2-py3.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-python-bytes-py3.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-python-module-kind.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-python-module-value.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-python-module.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-python-name-kind.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-python-name-module-2.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-python-name-module.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-python-name-object.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-python-name-value.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-simple-key.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-starting-character.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-tag-1.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-tag-2.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-tag-directive-handle.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-tag-directive-prefix.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-tag-handle-1.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-tag-handle-2.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-uri-escapes-1.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-uri-escapes-2.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-uri-escapes-3.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-uri.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-yaml-directive-version-1.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-yaml-directive-version-2.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-yaml-directive-version-3.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-yaml-directive-version-4.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-yaml-directive-version-5.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-yaml-directive-version-6.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/invalid-yaml-version.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/merge.data create mode 100644 node_modules/js-yaml/test/functional/data/merge.detect create mode 100644 node_modules/js-yaml/test/functional/data/no-block-collection-end.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/no-block-mapping-end-2.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/no-block-mapping-end.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/no-document-start.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/no-flow-mapping-end.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/no-flow-sequence-end.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/no-node-1.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/no-node-2.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/null.data create mode 100644 node_modules/js-yaml/test/functional/data/null.detect create mode 100644 node_modules/js-yaml/test/functional/data/remove-possible-simple-key-bug.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/scan-document-end-bug.canonical create mode 100644 node_modules/js-yaml/test/functional/data/scan-document-end-bug.data create mode 100644 node_modules/js-yaml/test/functional/data/scan-line-break-bug.canonical create mode 100644 node_modules/js-yaml/test/functional/data/scan-line-break-bug.data create mode 100644 node_modules/js-yaml/test/functional/data/sloppy-indentation.canonical create mode 100644 node_modules/js-yaml/test/functional/data/sloppy-indentation.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-01.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-01.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-01.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-02.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-02.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-02.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-03.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-03.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-03.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-04.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-04.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-04.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-05.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-05.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-05.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-06.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-06.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-06.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-07.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-07.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-07.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-08.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-08.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-08.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-09.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-09.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-09.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-10.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-10.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-10.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-11.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-11.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-11.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-12.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-12.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-12.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-13.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-13.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-13.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-14.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-14.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-14.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-15.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-15.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-15.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-16.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-16.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-16.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-17.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-17.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-17.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-18.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-18.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-18.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-19.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-19.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-19.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-20.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-20.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-20.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-21.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-21.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-21.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-22.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-22.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-22.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-23.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-23.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-23.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-24.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-24.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-24.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-25.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-25.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-25.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-26.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-26.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-26.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-27.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-27.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-27.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-28.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-28.structure create mode 100644 node_modules/js-yaml/test/functional/data/spec-02-28.tokens create mode 100644 node_modules/js-yaml/test/functional/data/spec-05-03.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-05-03.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-05-04.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-05-04.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-05-06.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-05-06.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-05-07.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-05-07.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-05-08.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-05-08.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-05-09.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-05-09.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-05-11.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-05-11.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-05-13.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-05-13.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-05-14.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-05-14.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-06-01.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-06-01.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-06-03.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-06-03.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-06-04.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-06-04.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-06-05.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-06-05.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-06-06.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-06-06.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-06-07.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-06-07.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-06-08.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-06-08.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-01.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-01.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-02.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-02.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-04.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-04.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-06.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-06.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-07a.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-07a.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-07b.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-07b.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-08.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-08.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-09.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-09.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-10.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-10.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-12a.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-12a.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-12b.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-12b.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-13.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-07-13.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-01.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-01.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-02.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-02.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-03.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-03.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-05.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-05.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-07.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-07.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-08.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-08.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-09.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-09.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-10.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-10.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-11.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-11.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-12.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-12.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-13.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-13.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-14.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-14.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-15.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-08-15.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-01.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-01.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-02.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-02.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-03.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-03.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-04.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-04.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-05.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-05.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-06.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-06.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-07.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-07.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-08.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-08.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-09.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-09.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-10.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-10.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-11.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-11.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-12.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-12.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-13.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-13.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-15.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-15.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-16.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-16.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-17.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-17.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-18.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-18.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-19.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-19.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-20.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-20.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-22.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-22.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-23.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-23.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-24.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-24.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-25.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-25.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-26.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-26.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-27.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-27.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-28.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-28.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-29.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-29.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-30.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-30.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-31.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-31.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-32.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-32.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-33.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-09-33.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-01.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-01.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-02.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-02.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-03.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-03.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-04.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-04.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-05.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-05.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-06.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-06.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-07.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-07.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-09.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-09.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-10.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-10.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-11.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-11.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-12.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-12.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-13.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-13.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-14.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-14.data create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-15.canonical create mode 100644 node_modules/js-yaml/test/functional/data/spec-10-15.data create mode 100644 node_modules/js-yaml/test/functional/data/str.data create mode 100644 node_modules/js-yaml/test/functional/data/str.detect create mode 100644 node_modules/js-yaml/test/functional/data/timestamp.data create mode 100644 node_modules/js-yaml/test/functional/data/timestamp.detect create mode 100644 node_modules/js-yaml/test/functional/data/unclosed-bracket.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/unclosed-quoted-scalar.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/undefined-anchor.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/undefined-constructor.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/undefined-tag-handle.loader-error create mode 100644 node_modules/js-yaml/test/functional/data/value.data create mode 100644 node_modules/js-yaml/test/functional/data/value.detect create mode 100644 node_modules/js-yaml/test/functional/data/yaml.data create mode 100644 node_modules/js-yaml/test/functional/data/yaml.detect create mode 100644 node_modules/js-yaml/test/functional/functional-errors.js create mode 100644 node_modules/js-yaml/test/functional/functional-resolver.js create mode 100644 node_modules/js-yaml/test/functional/functional-structure.js create mode 100644 node_modules/js-yaml/test/functional/functional-tokens.js create mode 100644 node_modules/js-yaml/test/helper.js create mode 100644 node_modules/js-yaml/test/issues-test.js create mode 100644 node_modules/js-yaml/test/issues/data/issue-17.yml create mode 100644 node_modules/js-yaml/test/issues/data/issue-19.yml create mode 100644 node_modules/js-yaml/test/issues/data/issue-26.yml create mode 100644 node_modules/js-yaml/test/issues/data/issue-33.yml create mode 100644 node_modules/js-yaml/test/issues/data/issue-46.yml create mode 100644 node_modules/js-yaml/test/issues/data/issue-8.yml create mode 100644 node_modules/js-yaml/test/issues/data/issue-9.yml create mode 100644 node_modules/js-yaml/test/issues/issue-17.js create mode 100644 node_modules/js-yaml/test/issues/issue-19.js create mode 100644 node_modules/js-yaml/test/issues/issue-26.js create mode 100644 node_modules/js-yaml/test/issues/issue-33.js create mode 100644 node_modules/js-yaml/test/issues/issue-46.js create mode 100644 node_modules/js-yaml/test/issues/issue-8.js create mode 100644 node_modules/js-yaml/test/issues/issue-9.js create mode 100644 node_modules/watch-tree/.npmignore create mode 100644 node_modules/watch-tree/Cakefile create mode 100644 node_modules/watch-tree/README.md create mode 100755 node_modules/watch-tree/bin/watch-tree create mode 100644 node_modules/watch-tree/lib/command.js create mode 100644 node_modules/watch-tree/lib/test/testing_util.js create mode 100644 node_modules/watch-tree/lib/test/tests.js create mode 100644 node_modules/watch-tree/lib/watch-tree.js create mode 100644 node_modules/watch-tree/lib/watchers/stat.js create mode 120000 node_modules/watch-tree/node_modules/.bin/cake create mode 120000 node_modules/watch-tree/node_modules/.bin/coffee create mode 120000 node_modules/watch-tree/node_modules/.bin/node-async-test create mode 100644 node_modules/watch-tree/node_modules/async/.gitmodules create mode 100644 node_modules/watch-tree/node_modules/async/.npmignore create mode 100644 node_modules/watch-tree/node_modules/async/LICENSE create mode 100644 node_modules/watch-tree/node_modules/async/Makefile create mode 100644 node_modules/watch-tree/node_modules/async/README.md create mode 100644 node_modules/watch-tree/node_modules/async/index.js create mode 100644 node_modules/watch-tree/node_modules/async/lib/async.js create mode 100644 node_modules/watch-tree/node_modules/async/package.json create mode 100644 node_modules/watch-tree/node_modules/async_testing/.gitmodules create mode 100644 node_modules/watch-tree/node_modules/async_testing/API.md create mode 100644 node_modules/watch-tree/node_modules/async_testing/AUTHORS create mode 100644 node_modules/watch-tree/node_modules/async_testing/LICENSE create mode 100644 node_modules/watch-tree/node_modules/async_testing/README.md create mode 100755 node_modules/watch-tree/node_modules/async_testing/bin/node-async-test.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/examples/test-suite.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/index.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/async_testing.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/console-runner.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/.gitmodules create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/Makefile create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/README.md create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/io.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/socket.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/transport.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/transports/flashsocket.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/transports/htmlfile.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/transports/jsonp-polling.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/transports/websocket.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/transports/xhr-multipart.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/transports/xhr-polling.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/transports/xhr.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/util.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/.npmignore create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/FABridge.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/README.txt create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/WebSocketMain.swf create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/WebSocketMainInsecure.zip create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/WebSocket.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/WebSocketMain.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/WebSocketMainInsecure.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/WebSocketStateEvent.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/bridge/FABridge.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/build.sh create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/adobe/net/proxies/RFC2817Socket.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/gsolo/encryption/MD5.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/Crypto.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/cert/MozillaRootCertificates.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/cert/X509Certificate.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/cert/X509CertificateCollection.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/HMAC.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/IHMAC.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/IHash.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/MAC.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/MD2.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/MD5.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/SHA1.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/SHA224.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/SHA256.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/SHABase.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/prng/ARC4.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/prng/IPRNG.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/prng/Random.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/prng/TLSPRF.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/rsa/RSAKey.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/AESKey.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/BlowFishKey.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/CBCMode.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/CFB8Mode.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/CFBMode.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/CTRMode.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/DESKey.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/ECBMode.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/ICipher.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/IMode.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/IPad.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/IStreamCipher.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/ISymmetricKey.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/IVMode.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/NullPad.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/OFBMode.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/PKCS5.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/SSLPad.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/SimpleIVMode.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/TLSPad.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/TripleDESKey.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/XTeaKey.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/aeskey.pl create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/dump.txt create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/AESKeyTest.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/ARC4Test.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/BigIntegerTest.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/BlowFishKeyTest.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/CBCModeTest.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/CFB8ModeTest.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/CFBModeTest.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/CTRModeTest.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/DESKeyTest.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/ECBModeTest.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/HMACTest.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/ITestHarness.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/MD2Test.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/MD5Test.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/OFBModeTest.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/RSAKeyTest.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/SHA1Test.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/SHA224Test.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/SHA256Test.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/TLSPRFTest.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/TestCase.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/TripleDESKeyTest.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/XTeaKeyTest.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/BulkCiphers.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/CipherSuites.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/IConnectionState.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/ISecurityParameters.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/KeyExchanges.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/MACs.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/SSLConnectionState.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/SSLEvent.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/SSLSecurityParameters.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSConfig.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSConnectionState.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSEngine.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSError.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSEvent.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSSecurityParameters.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSSocket.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSSocketEvent.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSTest.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/BarrettReduction.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/BigInteger.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/ClassicReduction.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/IReduction.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/MontgomeryReduction.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/NullReduction.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/bi_internal.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/ArrayUtil.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/Base64.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/Hex.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/Memory.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/ByteString.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/DER.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/IAsn1Type.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/Integer.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/OID.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/ObjectIdentifier.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/PEM.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/PrintableString.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/Sequence.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/Set.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/Type.as create mode 100755 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/UTCTime.as create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/sample.html create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/swfobject.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/lib/vendor/web-socket-js/web_socket.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/client/socket.io.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/error.png create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/failure.png create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/images.svg create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/index.html create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/main.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/running.gif create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/style.css create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/public/success.png create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/worker-test-loader.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/lib/web-runner/worker-test-runner.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/package.json create mode 100644 node_modules/watch-tree/node_modules/async_testing/test/test-all_passing.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/test/test-async_assertions.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/test/test-custom_assertions.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/test/test-errors.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/test/test-multiple_errors.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/test/test-sync_assertions.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/test/test-uncaught_exception_handlers.js create mode 100644 node_modules/watch-tree/node_modules/async_testing/test/test-wrap_tests.js create mode 100644 node_modules/watch-tree/node_modules/coffee-script/.npmignore create mode 100644 node_modules/watch-tree/node_modules/coffee-script/CNAME create mode 100644 node_modules/watch-tree/node_modules/coffee-script/LICENSE create mode 100644 node_modules/watch-tree/node_modules/coffee-script/README create mode 100644 node_modules/watch-tree/node_modules/coffee-script/Rakefile create mode 100755 node_modules/watch-tree/node_modules/coffee-script/bin/cake create mode 100755 node_modules/watch-tree/node_modules/coffee-script/bin/coffee create mode 100644 node_modules/watch-tree/node_modules/coffee-script/extras/jsl.conf create mode 100644 node_modules/watch-tree/node_modules/coffee-script/lib/coffee-script/browser.js create mode 100644 node_modules/watch-tree/node_modules/coffee-script/lib/coffee-script/cake.js create mode 100644 node_modules/watch-tree/node_modules/coffee-script/lib/coffee-script/coffee-script.js create mode 100644 node_modules/watch-tree/node_modules/coffee-script/lib/coffee-script/command.js create mode 100644 node_modules/watch-tree/node_modules/coffee-script/lib/coffee-script/grammar.js create mode 100644 node_modules/watch-tree/node_modules/coffee-script/lib/coffee-script/helpers.js create mode 100644 node_modules/watch-tree/node_modules/coffee-script/lib/coffee-script/index.js create mode 100644 node_modules/watch-tree/node_modules/coffee-script/lib/coffee-script/lexer.js create mode 100644 node_modules/watch-tree/node_modules/coffee-script/lib/coffee-script/nodes.js create mode 100644 node_modules/watch-tree/node_modules/coffee-script/lib/coffee-script/optparse.js create mode 100755 node_modules/watch-tree/node_modules/coffee-script/lib/coffee-script/parser.js create mode 100644 node_modules/watch-tree/node_modules/coffee-script/lib/coffee-script/repl.js create mode 100644 node_modules/watch-tree/node_modules/coffee-script/lib/coffee-script/rewriter.js create mode 100644 node_modules/watch-tree/node_modules/coffee-script/lib/coffee-script/scope.js create mode 100644 node_modules/watch-tree/node_modules/coffee-script/package.json create mode 100644 node_modules/watch-tree/node_modules/optimist/.travis.yml create mode 100644 node_modules/watch-tree/node_modules/optimist/LICENSE create mode 100644 node_modules/watch-tree/node_modules/optimist/README.markdown create mode 100644 node_modules/watch-tree/node_modules/optimist/example/bool.js create mode 100644 node_modules/watch-tree/node_modules/optimist/example/boolean_double.js create mode 100644 node_modules/watch-tree/node_modules/optimist/example/boolean_single.js create mode 100644 node_modules/watch-tree/node_modules/optimist/example/default_hash.js create mode 100644 node_modules/watch-tree/node_modules/optimist/example/default_singles.js create mode 100644 node_modules/watch-tree/node_modules/optimist/example/divide.js create mode 100644 node_modules/watch-tree/node_modules/optimist/example/line_count.js create mode 100644 node_modules/watch-tree/node_modules/optimist/example/line_count_options.js create mode 100644 node_modules/watch-tree/node_modules/optimist/example/line_count_wrap.js create mode 100644 node_modules/watch-tree/node_modules/optimist/example/nonopt.js create mode 100644 node_modules/watch-tree/node_modules/optimist/example/reflect.js create mode 100644 node_modules/watch-tree/node_modules/optimist/example/short.js create mode 100644 node_modules/watch-tree/node_modules/optimist/example/string.js create mode 100644 node_modules/watch-tree/node_modules/optimist/example/usage-options.js create mode 100644 node_modules/watch-tree/node_modules/optimist/example/xup.js create mode 100644 node_modules/watch-tree/node_modules/optimist/index.js create mode 100644 node_modules/watch-tree/node_modules/optimist/node_modules/wordwrap/.npmignore create mode 100644 node_modules/watch-tree/node_modules/optimist/node_modules/wordwrap/README.markdown create mode 100644 node_modules/watch-tree/node_modules/optimist/node_modules/wordwrap/example/center.js create mode 100644 node_modules/watch-tree/node_modules/optimist/node_modules/wordwrap/example/meat.js create mode 100644 node_modules/watch-tree/node_modules/optimist/node_modules/wordwrap/index.js create mode 100644 node_modules/watch-tree/node_modules/optimist/node_modules/wordwrap/package.json create mode 100644 node_modules/watch-tree/node_modules/optimist/node_modules/wordwrap/test/break.js create mode 100644 node_modules/watch-tree/node_modules/optimist/node_modules/wordwrap/test/idleness.txt create mode 100644 node_modules/watch-tree/node_modules/optimist/node_modules/wordwrap/test/wrap.js create mode 100644 node_modules/watch-tree/node_modules/optimist/package.json create mode 100644 node_modules/watch-tree/node_modules/optimist/test/_.js create mode 100644 node_modules/watch-tree/node_modules/optimist/test/_/argv.js create mode 100755 node_modules/watch-tree/node_modules/optimist/test/_/bin.js create mode 100644 node_modules/watch-tree/node_modules/optimist/test/parse.js create mode 100644 node_modules/watch-tree/node_modules/optimist/test/usage.js create mode 100644 node_modules/watch-tree/node_modules/underscore/.npmignore create mode 100644 node_modules/watch-tree/node_modules/underscore/CNAME create mode 100644 node_modules/watch-tree/node_modules/underscore/CONTRIBUTING.md create mode 100644 node_modules/watch-tree/node_modules/underscore/LICENSE create mode 100644 node_modules/watch-tree/node_modules/underscore/README.md create mode 100644 node_modules/watch-tree/node_modules/underscore/favicon.ico create mode 100644 node_modules/watch-tree/node_modules/underscore/index.html create mode 100644 node_modules/watch-tree/node_modules/underscore/index.js create mode 100644 node_modules/watch-tree/node_modules/underscore/package.json create mode 100644 node_modules/watch-tree/node_modules/underscore/raw/underscore.psd create mode 100644 node_modules/watch-tree/node_modules/underscore/underscore-min.js create mode 100644 node_modules/watch-tree/node_modules/underscore/underscore.js create mode 100644 node_modules/watch-tree/package.json create mode 100644 node_modules/watch-tree/src/command.coffee create mode 100644 node_modules/watch-tree/src/test/testing_util.coffee create mode 100644 node_modules/watch-tree/src/test/tests.coffee create mode 100644 node_modules/watch-tree/src/watch-tree.coffee create mode 100644 node_modules/watch-tree/src/watchers/stat.coffee create mode 100644 node_modules/watch/LICENSE create mode 100644 node_modules/watch/main.js create mode 100755 node_modules/watch/package.json create mode 100644 node_modules/watch/readme.mkd create mode 100644 node_modules/watch/test/d/d/t create mode 100644 node_modules/watch/test/d/t create mode 100644 node_modules/watch/test/test_monitor.js create mode 100644 node_modules/watch/test/test_watchTree.js create mode 100644 package.json diff --git a/node_modules/.bin/dustc b/node_modules/.bin/dustc new file mode 120000 index 0000000..16d7565 --- /dev/null +++ b/node_modules/.bin/dustc @@ -0,0 +1 @@ +../dustjs-linkedin/bin/dustc \ No newline at end of file diff --git a/node_modules/.bin/js-yaml b/node_modules/.bin/js-yaml new file mode 120000 index 0000000..9dbd010 --- /dev/null +++ b/node_modules/.bin/js-yaml @@ -0,0 +1 @@ +../js-yaml/bin/js-yaml.js \ No newline at end of file diff --git a/node_modules/.bin/watch-tree b/node_modules/.bin/watch-tree new file mode 120000 index 0000000..d3d86b9 --- /dev/null +++ b/node_modules/.bin/watch-tree @@ -0,0 +1 @@ +../watch-tree/bin/watch-tree \ No newline at end of file diff --git a/node_modules/colors/MIT-LICENSE.txt b/node_modules/colors/MIT-LICENSE.txt new file mode 100644 index 0000000..7dca107 --- /dev/null +++ b/node_modules/colors/MIT-LICENSE.txt @@ -0,0 +1,22 @@ +Copyright (c) 2010 + +Marak Squires +Alexis Sellier (cloudhead) + +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/node_modules/colors/ReadMe.md b/node_modules/colors/ReadMe.md new file mode 100644 index 0000000..1c6b0d0 --- /dev/null +++ b/node_modules/colors/ReadMe.md @@ -0,0 +1,77 @@ +# colors.js - get color and style in your node.js console ( and browser ) like what + + + + +## Installation + + npm install colors + +## colors and styles! + +- bold +- italic +- underline +- inverse +- yellow +- cyan +- white +- magenta +- green +- red +- grey +- blue +- rainbow +- zebra +- random + +## Usage + +``` js +var colors = require('./colors'); + +console.log('hello'.green); // outputs green text +console.log('i like cake and pies'.underline.red) // outputs red underlined text +console.log('inverse the color'.inverse); // inverses the color +console.log('OMG Rainbows!'.rainbow); // rainbow (ignores spaces) +``` + +# Creating Custom themes + +```js + +var require('colors'); + +colors.setTheme({ + silly: 'rainbow', + input: 'grey', + verbose: 'cyan', + prompt: 'grey', + info: 'green', + data: 'grey', + help: 'cyan', + warn: 'yellow', + debug: 'blue', + error: 'red' +}); + +// outputs red text +console.log("this is an error".error); + +// outputs yellow text +console.log("this is a warning".warn); +``` + + +### Contributors + +Marak (Marak Squires) +Alexis Sellier (cloudhead) +mmalecki (Maciej Małecki) +nicoreed (Nico Reed) +morganrallen (Morgan Allen) +JustinCampbell (Justin Campbell) +ded (Dustin Diaz) + + +#### , Marak Squires , Justin Campbell, Dustin Diaz (@ded) diff --git a/node_modules/colors/colors.js b/node_modules/colors/colors.js new file mode 100644 index 0000000..a7198f1 --- /dev/null +++ b/node_modules/colors/colors.js @@ -0,0 +1,269 @@ +/* +colors.js + +Copyright (c) 2010 + +Marak Squires +Alexis Sellier (cloudhead) + +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. + +*/ + +var isHeadless = false; + +if (typeof module !== 'undefined') { + isHeadless = true; +} + +if (!isHeadless) { + var exports = {}; + var module = {}; + var colors = exports; + exports.mode = "browser"; +} else { + exports.mode = "console"; +} + +// +// Prototypes the string object to have additional method calls that add terminal colors +// +var addProperty = function (color, func) { + var allowOverride = ['bold']; + exports[color] = function(str) { + return func.apply(str); + }; + String.prototype.__defineGetter__(color, func); +} + +// +// Iterate through all default styles and colors +// + +var x = ['bold', 'underline', 'italic', 'inverse', 'grey', 'black', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta']; +x.forEach(function (style) { + + // __defineGetter__ at the least works in more browsers + // http://robertnyman.com/javascript/javascript-getters-setters.html + // Object.defineProperty only works in Chrome + addProperty(style, function () { + return stylize(this, style); + }); +}); + +function sequencer(map) { + return function () { + if (!isHeadless) { + return this.replace(/( )/, '$1'); + } + var exploded = this.split(""); + var i = 0; + exploded = exploded.map(map); + return exploded.join(""); + } +} + +var rainbowMap = (function () { + var rainbowColors = ['red','yellow','green','blue','magenta']; //RoY G BiV + return function (letter, i, exploded) { + if (letter == " ") { + return letter; + } else { + return stylize(letter, rainbowColors[i++ % rainbowColors.length]); + } + } +})(); + +exports.addSequencer = function (name, map) { + addProperty(name, sequencer(map)); +} + +exports.addSequencer('rainbow', rainbowMap); +exports.addSequencer('zebra', function (letter, i, exploded) { + return i % 2 === 0 ? letter : letter.inverse; +}); + +exports.setTheme = function (theme) { + Object.keys(theme).forEach(function(prop){ + addProperty(prop, function(){ + return exports[theme[prop]](this); + }); + }); +} + +function stylize(str, style) { + + if (exports.mode == 'console') { + var styles = { + //styles + 'bold' : ['\033[1m', '\033[22m'], + 'italic' : ['\033[3m', '\033[23m'], + 'underline' : ['\033[4m', '\033[24m'], + 'inverse' : ['\033[7m', '\033[27m'], + //grayscale + 'white' : ['\033[37m', '\033[39m'], + 'grey' : ['\033[90m', '\033[39m'], + 'black' : ['\033[30m', '\033[39m'], + //colors + 'blue' : ['\033[34m', '\033[39m'], + 'cyan' : ['\033[36m', '\033[39m'], + 'green' : ['\033[32m', '\033[39m'], + 'magenta' : ['\033[35m', '\033[39m'], + 'red' : ['\033[31m', '\033[39m'], + 'yellow' : ['\033[33m', '\033[39m'] + }; + } else if (exports.mode == 'browser') { + var styles = { + //styles + 'bold' : ['', ''], + 'italic' : ['', ''], + 'underline' : ['', ''], + 'inverse' : ['', ''], + //grayscale + 'white' : ['', ''], + 'grey' : ['', ''], + 'black' : ['', ''], + //colors + 'blue' : ['', ''], + 'cyan' : ['', ''], + 'green' : ['', ''], + 'magenta' : ['', ''], + 'red' : ['', ''], + 'yellow' : ['', ''] + }; + } else if (exports.mode == 'none') { + return str; + } else { + console.log('unsupported mode, try "browser", "console" or "none"'); + } + return styles[style][0] + str + styles[style][1]; +}; + +// don't summon zalgo +addProperty('zalgo', function () { + return zalgo(this); +}); + +// please no +function zalgo(text, options) { + var soul = { + "up" : [ + '̍','̎','̄','̅', + '̿','̑','̆','̐', + '͒','͗','͑','̇', + '̈','̊','͂','̓', + '̈','͊','͋','͌', + '̃','̂','̌','͐', + '̀','́','̋','̏', + '̒','̓','̔','̽', + '̉','ͣ','ͤ','ͥ', + 'ͦ','ͧ','ͨ','ͩ', + 'ͪ','ͫ','ͬ','ͭ', + 'ͮ','ͯ','̾','͛', + '͆','̚' + ], + "down" : [ + '̖','̗','̘','̙', + '̜','̝','̞','̟', + '̠','̤','̥','̦', + '̩','̪','̫','̬', + '̭','̮','̯','̰', + '̱','̲','̳','̹', + '̺','̻','̼','ͅ', + '͇','͈','͉','͍', + '͎','͓','͔','͕', + '͖','͙','͚','̣' + ], + "mid" : [ + '̕','̛','̀','́', + '͘','̡','̢','̧', + '̨','̴','̵','̶', + '͜','͝','͞', + '͟','͠','͢','̸', + '̷','͡',' ҉' + ] + }, + all = [].concat(soul.up, soul.down, soul.mid), + zalgo = {}; + + function randomNumber(range) { + r = Math.floor(Math.random()*range); + return r; + }; + + function is_char(character) { + var bool = false; + all.filter(function(i){ + bool = (i == character); + }); + return bool; + } + + function heComes(text, options){ + result = ''; + options = options || {}; + options["up"] = options["up"] || true; + options["mid"] = options["mid"] || true; + options["down"] = options["down"] || true; + options["size"] = options["size"] || "maxi"; + var counts; + text = text.split(''); + for(var l in text){ + if(is_char(l)) { continue; } + result = result + text[l]; + + counts = {"up" : 0, "down" : 0, "mid" : 0}; + + switch(options.size) { + case 'mini': + counts.up = randomNumber(8); + counts.min= randomNumber(2); + counts.down = randomNumber(8); + break; + case 'maxi': + counts.up = randomNumber(16) + 3; + counts.min = randomNumber(4) + 1; + counts.down = randomNumber(64) + 3; + break; + default: + counts.up = randomNumber(8) + 1; + counts.mid = randomNumber(6) / 2; + counts.down= randomNumber(8) + 1; + break; + } + + var arr = ["up", "mid", "down"]; + for(var d in arr){ + var index = arr[d]; + for (var i = 0 ; i <= counts[index]; i++) + { + if(options[index]) { + result = result + soul[index][randomNumber(soul[index].length)]; + } + } + } + } + return result; + }; + return heComes(text); +} + +addProperty('stripColors', function() { + return ("" + this).replace(/\u001b\[\d+m/g,''); +}); diff --git a/node_modules/colors/example.html b/node_modules/colors/example.html new file mode 100644 index 0000000..ab95649 --- /dev/null +++ b/node_modules/colors/example.html @@ -0,0 +1,74 @@ + + + + + Colors Example + + + + + + \ No newline at end of file diff --git a/node_modules/colors/example.js b/node_modules/colors/example.js new file mode 100644 index 0000000..3da2986 --- /dev/null +++ b/node_modules/colors/example.js @@ -0,0 +1,65 @@ +var colors = require('./colors'); + +//colors.mode = "browser"; + +var test = colors.red("hopefully colorless output"); +console.log('Rainbows are fun!'.rainbow); +console.log('So '.italic + 'are'.underline + ' styles! '.bold + 'inverse'.inverse); // styles not widely supported +console.log('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported +//console.log('zalgo time!'.zalgo); +console.log(test.stripColors); +console.log("a".grey + " b".black); + +console.log("Zebras are so fun!".zebra); + +console.log(colors.rainbow('Rainbows are fun!')); +console.log(colors.italic('So ') + colors.underline('are') + colors.bold(' styles! ') + colors.inverse('inverse')); // styles not widely supported +console.log(colors.bold(colors.italic(colors.underline(colors.red('Chains are also cool.'))))); // styles not widely supported +//console.log(colors.zalgo('zalgo time!')); +console.log(colors.stripColors(test)); +console.log(colors.grey("a") + colors.black(" b")); + +colors.addSequencer("america", function(letter, i, exploded) { + if(letter === " ") return letter; + switch(i%3) { + case 0: return letter.red; + case 1: return letter.white; + case 2: return letter.blue; + } +}); + +colors.addSequencer("random", (function() { + var available = ['bold', 'underline', 'italic', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta']; + + return function(letter, i, exploded) { + return letter === " " ? letter : letter[available[Math.round(Math.random() * (available.length - 1))]]; + }; +})()); + +console.log("AMERICA! F--K YEAH!".america); +console.log("So apparently I've been to Mars, with all the little green men. But you know, I don't recall.".random); + +// +// Custom themes +// + +colors.setTheme({ + silly: 'rainbow', + input: 'grey', + verbose: 'cyan', + prompt: 'grey', + info: 'green', + data: 'grey', + help: 'cyan', + warn: 'yellow', + debug: 'blue', + error: 'red' +}); + +// outputs red text +console.log("this is an error".error); + +// outputs yellow text +console.log("this is a warning".warn); + + diff --git a/node_modules/colors/package.json b/node_modules/colors/package.json new file mode 100644 index 0000000..02989e2 --- /dev/null +++ b/node_modules/colors/package.json @@ -0,0 +1,22 @@ +{ + "name": "colors", + "description": "get colors in your node.js console like what", + "version": "0.6.0-1", + "author": { + "name": "Marak Squires" + }, + "repository": { + "type": "git", + "url": "http://github.com/Marak/colors.js.git" + }, + "engines": { + "node": ">=0.1.90" + }, + "main": "colors", + "readme": "# colors.js - get color and style in your node.js console ( and browser ) like what\n\n\n\n\n## Installation\n\n npm install colors\n\n## colors and styles!\n\n- bold\n- italic\n- underline\n- inverse\n- yellow\n- cyan\n- white\n- magenta\n- green\n- red\n- grey\n- blue\n- rainbow\n- zebra\n- random\n\n## Usage\n\n``` js\nvar colors = require('./colors');\n\nconsole.log('hello'.green); // outputs green text\nconsole.log('i like cake and pies'.underline.red) // outputs red underlined text\nconsole.log('inverse the color'.inverse); // inverses the color\nconsole.log('OMG Rainbows!'.rainbow); // rainbow (ignores spaces)\n```\n\n# Creating Custom themes\n\n```js\n\nvar require('colors');\n\ncolors.setTheme({\n silly: 'rainbow',\n input: 'grey',\n verbose: 'cyan',\n prompt: 'grey',\n info: 'green',\n data: 'grey',\n help: 'cyan',\n warn: 'yellow',\n debug: 'blue',\n error: 'red'\n});\n\n// outputs red text\nconsole.log(\"this is an error\".error);\n\n// outputs yellow text\nconsole.log(\"this is a warning\".warn);\n```\n\n\n### Contributors \n\nMarak (Marak Squires)\nAlexis Sellier (cloudhead)\nmmalecki (Maciej Małecki)\nnicoreed (Nico Reed)\nmorganrallen (Morgan Allen)\nJustinCampbell (Justin Campbell)\nded (Dustin Diaz)\n\n\n#### , Marak Squires , Justin Campbell, Dustin Diaz (@ded)\n", + "_id": "colors@0.6.0-1", + "dist": { + "shasum": "a9b7b49416bf9e2e7906279504b031a240ffccdd" + }, + "_from": "colors" +} diff --git a/node_modules/colors/test.js b/node_modules/colors/test.js new file mode 100644 index 0000000..1c03d65 --- /dev/null +++ b/node_modules/colors/test.js @@ -0,0 +1,65 @@ +var assert = require('assert'), + colors = require('./colors'); + +// +// This is a pretty nice example on how tests shouldn't be written. However, +// it's more about API stability than about really testing it (although it's +// a pretty complete test suite). +// + +var s = 'string'; + +function a(s, code) { + return '\033[' + code.toString() + 'm' + s + '\033[39m'; +} + +function aE(s, color, code) { + assert.equal(s[color], a(s, code)); + assert.equal(colors[color](s), a(s, code)); + assert.equal(s[color], colors[color](s)); + assert.equal(s[color].stripColors, s); + assert.equal(s[color].stripColors, colors.stripColors(s)); +} + +function h(s, color) { + return '' + s + ''; + // that's pretty dumb approach to testing it +} + +var stylesColors = ['white', 'grey', 'black', 'blue', 'cyan', 'green', 'magenta', 'red', 'yellow']; +var stylesAll = stylesColors.concat(['bold', 'italic', 'underline', 'inverse', 'rainbow']); + +colors.mode = 'console'; +assert.equal(s.bold, '\033[1m' + s + '\033[22m'); +assert.equal(s.italic, '\033[3m' + s + '\033[23m'); +assert.equal(s.underline, '\033[4m' + s + '\033[24m'); +assert.equal(s.inverse, '\033[7m' + s + '\033[27m'); +assert.ok(s.rainbow); +aE(s, 'white', 37); +aE(s, 'grey', 90); +aE(s, 'black', 30); +aE(s, 'blue', 34); +aE(s, 'cyan', 36); +aE(s, 'green', 32); +aE(s, 'magenta', 35); +aE(s, 'red', 31); +aE(s, 'yellow', 33); +assert.equal(s, 'string'); + +colors.mode = 'browser'; +assert.equal(s.bold, '' + s + ''); +assert.equal(s.italic, '' + s + ''); +assert.equal(s.underline, '' + s + ''); +assert.equal(s.inverse, '' + s + ''); +assert.ok(s.rainbow); +stylesColors.forEach(function (color) { + assert.equal(s[color], h(s, color)); + assert.equal(colors[color](s), h(s, color)); +}); + +colors.mode = 'none'; +stylesAll.forEach(function (style) { + assert.equal(s[style], s); + assert.equal(colors[style](s), s); +}); + diff --git a/node_modules/dustjs-linkedin/.coverignore b/node_modules/dustjs-linkedin/.coverignore new file mode 100644 index 0000000..9daeafb --- /dev/null +++ b/node_modules/dustjs-linkedin/.coverignore @@ -0,0 +1 @@ +test diff --git a/node_modules/dustjs-linkedin/.coverrc b/node_modules/dustjs-linkedin/.coverrc new file mode 100644 index 0000000..7d7d562 --- /dev/null +++ b/node_modules/dustjs-linkedin/.coverrc @@ -0,0 +1,20 @@ +{ + "formatter": "cli", + "ignore": ".coverignore", + + "prefix": "coveragefile_", // Prefix for coverage data files + "dataDirectory": ".coverage_data", // Directory to put coverage files in + + "debugDirectory": ".coverage_debug", // Directory to put instrumented files in + + "modules": false, // Whether or not to cover node_modules directory + + // Formatter-specific info + "html" : { + "directory": "cover_html", // Directory to write HTML files too + "generateIndex": true // Whether to generate an index.html file + }, + + "json": { + } +} diff --git a/node_modules/dustjs-linkedin/.npmignore b/node_modules/dustjs-linkedin/.npmignore new file mode 100644 index 0000000..0462e7a --- /dev/null +++ b/node_modules/dustjs-linkedin/.npmignore @@ -0,0 +1,5 @@ +/nbproject +node_modules +.coverage_data +cover_html +*.DS_Store diff --git a/node_modules/dustjs-linkedin/.travis.yml b/node_modules/dustjs-linkedin/.travis.yml new file mode 100644 index 0000000..7eccbe8 --- /dev/null +++ b/node_modules/dustjs-linkedin/.travis.yml @@ -0,0 +1,10 @@ +language: node_js +node_js: + - 0.4 + - 0.6 + - 0.8 +notifications: + email: + - jdemorais@linkedin.com + - vbasavaraj@linkedin.com + - jleppert@linkedin.com diff --git a/node_modules/dustjs-linkedin/LICENSE b/node_modules/dustjs-linkedin/LICENSE new file mode 100644 index 0000000..1c59043 --- /dev/null +++ b/node_modules/dustjs-linkedin/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2010 Aleksander Williams + +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/node_modules/dustjs-linkedin/Makefile b/node_modules/dustjs-linkedin/Makefile new file mode 100644 index 0000000..2973e30 --- /dev/null +++ b/node_modules/dustjs-linkedin/Makefile @@ -0,0 +1,93 @@ +# +# Run all tests +# +test: + node test/server.js + +# +# Run jasmine-test +# +jasmine: + node test/jasmine-test/server/specRunner.js +# +# Run code coverage and generate report +# +coverage: + cover run test/server.js && cover report && cover report html + +# +# Run the benchmarks +# +bench: + node benchmark/server.js + +# +# Build the docs +# +docs: + node docs/build.js + +# +# Build the parser +# +parser: + node src/build.js + +# +# Build dust.js +# + +SRC = lib +VERSION = ${shell cat package.json | grep version | grep -o '[0-9]\.[0-9]\.[0-9]\+'} +CORE = dist/dust-core-${VERSION}.js +CORE_MIN = dist/dust-core-${VERSION}.min.js +FULL = dist/dust-full-${VERSION}.js +FULL_MIN = dist/dust-full-${VERSION}.min.js + +define HEADER +// +// Dust - Asynchronous Templating v${VERSION} +// http://akdubya.github.com/dustjs +// +// Copyright (c) 2010, Aleksander Williams +// Released under the MIT License. +// + +endef + +export HEADER + +#TODO: REMOVE THE HELPERS IN THE NEXT RELEASE +dust: + @@mkdir -p dist + @@touch ${CORE} + @@echo "$$HEADER" > ${CORE} + @@cat ${SRC}/dust.js\ + ${SRC}/dust-helpers.js >> ${CORE} + @@echo ${CORE} built + + @@touch ${FULL} + @@echo "$$HEADER" > ${FULL} + @@cat ${SRC}/dust.js\ + ${SRC}/dust-helpers.js\ + ${SRC}/compiler.js\ + ${SRC}/parser.js >> ${FULL} + @@echo ${FULL} built + +min: dust + @@echo minifying... + @@echo "$$HEADER" > ${CORE_MIN} + @@echo "$$HEADER" > ${FULL_MIN} + node utils/minifier ${CORE} ${CORE_MIN} + node utils/minifier ${FULL} ${FULL_MIN} + +clean: + git rm dist/* + +release: clean docs min + git add dist/* + git commit -a -m "release v${VERSION}" + git tag -a -m "version v${VERSION}" v${VERSION} + npm publish + +.PHONY: test docs bench parser diff --git a/node_modules/dustjs-linkedin/README.md b/node_modules/dustjs-linkedin/README.md new file mode 100644 index 0000000..8137470 --- /dev/null +++ b/node_modules/dustjs-linkedin/README.md @@ -0,0 +1,7 @@ +Dust [![Build Status](https://secure.travis-ci.org/linkedin/dustjs.png)](http://travis-ci.org/linkedin/dustjs) +==== + + +This is the LinkedIn fork of Dust. + +Read more here : diff --git a/node_modules/dustjs-linkedin/benchmark/index.html b/node_modules/dustjs-linkedin/benchmark/index.html new file mode 100644 index 0000000..529cd90 --- /dev/null +++ b/node_modules/dustjs-linkedin/benchmark/index.html @@ -0,0 +1,161 @@ + + + + shootout + + + + + + +
+
+ +
+ +
+
+

Targets: Dust, Handlebars, Mustache, jquery-tmpl. Each benchmark runs once using an adaptive test cycles algorithm similar to the one found in jslitmus.

+
+ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/benchmark/server.js b/node_modules/dustjs-linkedin/benchmark/server.js new file mode 100644 index 0000000..72ec2d4 --- /dev/null +++ b/node_modules/dustjs-linkedin/benchmark/server.js @@ -0,0 +1,33 @@ +var uubench = require('./uubench'), + dust = require('../lib/dust'), + dustBench = require('./suites/dust_suite').dustBench; + +uubench.nextTick = process.nextTick; + +var suite = new uubench.Suite({ + iterations: 10000, + result: function(name, stats) { + var opms = stats.iterations/stats.elapsed; + console.log(pad(12, name + ": "), pad(5, Math.round(opms), true)); + } +}); + +function pad(amt, val, pre) { + val = String(val); + var len = amt - val.length, out = ''; + for (var i=0; ireplace/}{/peeps}", + context: { peeps: [ + { name: "Moe", count: 15 }, + { name: "Larry", count: 5 }, + { name: "Curly", count: 0 } + ] + } + }, + + recursion: { + source: "{name}{#kids}{>recursion:./}{/kids}", + context: { + name: '1', + kids: [ + { + name: '1.1', + kids: [ + {name: '1.1.1'} + ] + } + ] + } + }, + + filter: { + source: "{#filter}foo {bar}{/filter}", + context: { + filter: function(chunk, context, bodies) { + return chunk.tap(function(data) { + return data.toUpperCase(); + }).render(bodies.block, context).untap(); + }, + bar: "bar" + } + }, + + complex: { + source: "

{header}

\n" + + "{?items}\n" + + "
    \n" + + " {#items}\n" + + " {#current}\n" + + "
  • {name}
  • \n" + + " {:else}\n" + + "
  • {name}
  • \n" + + " {/current}\n" + + " {/items}\n" + + "
\n" + + "{:else}\n" + + "

The list is empty.

\n" + + "{/items}", + context: { + header: function() { + return "Colors"; + }, + items: [ + {name: "red", current: true, url: "#Red"}, + {name: "green", current: false, url: "#Green"}, + {name: "blue", current: false, url: "#Blue"} + ] + } + } + +} + +exports.dustBench = function(suite, name, id) { + var bench = benches[name], + ctx = bench.context; + + dust.loadSource(dust.compile(bench.source, name)); + suite.bench(id || name, function(next) { + dust.render(name, ctx, function() { + next(); + }); + }); +}; + +exports.dustBench.benches = benches; + +})(typeof exports !== "undefined" ? exports : window); \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/benchmark/suites/handlebars_suite.js b/node_modules/dustjs-linkedin/benchmark/suites/handlebars_suite.js new file mode 100644 index 0000000..ae0c88d --- /dev/null +++ b/node_modules/dustjs-linkedin/benchmark/suites/handlebars_suite.js @@ -0,0 +1,101 @@ +(function(exports){ + +var benches = { + + string: { + source: "Hello World!", + context: {} + }, + + replace: { + source: "Hello {{name}}! You have {{count}} new messages.", + context: { name: "Mick", count: 30 } + }, + + array: { + source: "{{#names}}{{name}}{{/names}}", + context: { names: [{name: "Moe"}, {name: "Larry"}, {name: "Curly"}, {name: "Shemp"}] } + }, + + object: { + source: "{{#person}}{{name}}{{age}}{{/person}}", + context: { person: { name: "Larry", age: 45 } } + }, + + partial: { + source: "{{#peeps}}{{>replace}}{{/peeps}}", + context: { peeps: [{name: "Moe", count: 15}, {name: "Larry", count: 5}, {name: "Curly", count: 1}] }, + partials: { replace: "Hello {{name}}! You have {{count}} new messages." } + }, + + recursion: { + source: "{{name}}{{#kids}}{{>recursion}}{{/kids}}", + context: { + name: '1', + kids: [ + { + name: '1.1', + kids: [ + {name: '1.1.1'} + ] + } + ] + }, + partials: { recursion: "{{name}}{{#kids}}{{>recursion}}{{/kids}}" } + }, + + filter: { + source: "{{#filter}}foo {{bar}}{{/filter}}", + context: { + filter: function(ctx, fn) { + return fn(ctx).toUpperCase(); + }, + bar: "bar" + } + }, + + complex: { + source: "

{{header}}

{{#hasItems}}
    {{#items}}{{#current}}" + + "
  • {{name}}
  • {{/current}}{{^current}}" + + "
  • {{name}}
  • {{/current}}" + + "{{/items}}
{{^}}

The list is empty.

{{/hasItems}}", + context: { + header: function() { + return "Colors"; + }, + items: [ + {name: "red", current: true, url: "#Red"}, + {name: "green", current: false, url: "#Green"}, + {name: "blue", current: false, url: "#Blue"} + ], + hasItems: function(ctx, fn) { + if (ctx.items.length) { + return fn(ctx); + } + } + } + } + +} + +exports.handlebarsBench = function(suite, name, id) { + var bench = benches[name], + fn = Handlebars.compile(bench.source), + ctx = bench.context, + partials = {}; + + if (bench.partials) { + for (var key in bench.partials) { + partials[key] = Handlebars.compile(bench.partials[key]); + } + } + + suite.bench(id || name, function(next) { + fn(ctx, {partials: partials}); + next(); + }); +} + +exports.handlebarsBench.benches = benches; + +})(typeof exports !== "undefined" ? exports : window); \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/benchmark/suites/jquery_suite.js b/node_modules/dustjs-linkedin/benchmark/suites/jquery_suite.js new file mode 100644 index 0000000..ee426b7 --- /dev/null +++ b/node_modules/dustjs-linkedin/benchmark/suites/jquery_suite.js @@ -0,0 +1,84 @@ +(function(exports){ + +var benches = { + + string: { + source: "Hello World!", + context: {} + }, + + replace: { + source: "Hello ${name}! You have ${count} new messages.", + context: { name: "Mick", count: 30 } + }, + + array: { + source: "{{each names}}${name}{{/each}}", + context: { names: [{name: "Moe"}, {name: "Larry"}, {name: "Curly"}, {name: "Shemp"}] } + }, + + object: { + source: "${person.name}${person.age}", + context: { person: { name: "Larry", age: 45 } } + }, + + partial: { + source: "{{tmpl(peeps) \"replace\"}}", + context: { peeps: [{name: "Moe", count: 15}, {name: "Larry", count: 5}, {name: "Curly", count: 1}] } + }, + + recursion: { + source: "${name}{{tmpl(kids) \"recursion\"}}", + context: { + name: '1', + kids: [ + { + name: '1.1', + kids: [ + {name: '1.1.1', kids: []} + ] + } + ] + } + }, + + filter: { + source: "FOO ${bar.toUpperCase()}", + context: { + bar: "bar" + } + }, + + complex: { + source: "

${header}

{{if items.length}}
    {{each items}}{{if current}}" + + "
  • ${name}
  • {{else}}" + + "
  • ${name}
  • {{/if}}" + + "{{/each}}
{{else}}

The list is empty.

{{/if}}", + context: { + header: function() { + return "Colors"; + }, + items: [ + {name: "red", current: true, url: "#Red"}, + {name: "green", current: false, url: "#Green"}, + {name: "blue", current: false, url: "#Blue"} + ] + } + } + +} + +exports.jqueryBench = function(suite, name, id) { + var bench = benches[name], + fn = $.template(name, bench.source), + ctx = bench.context; + + suite.bench(id || name, function(next) { + $.tmpl(fn, ctx); + next(); + }); +} + +exports.jqueryBench.benches = benches; + +})(typeof exports !== "undefined" ? exports : window); \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/benchmark/suites/mustache_suite.js b/node_modules/dustjs-linkedin/benchmark/suites/mustache_suite.js new file mode 100644 index 0000000..b2aa9c9 --- /dev/null +++ b/node_modules/dustjs-linkedin/benchmark/suites/mustache_suite.js @@ -0,0 +1,97 @@ +(function(exports){ + +var benches = { + + string: { + source: "Hello World!", + context: {} + }, + + replace: { + source: "Hello {{name}}! You have {{count}} new messages.", + context: { name: "Mick", count: 30 } + }, + + array: { + source: "{{#names}}{{name}}{{/names}}", + context: { names: [{name: "Moe"}, {name: "Larry"}, {name: "Curly"}, {name: "Shemp"}] } + }, + + object: { + source: "{{#person}}{{name}}{{age}}{{/person}}", + context: { person: { name: "Larry", age: 45 } } + }, + + partial: { + source: "{{#peeps}}{{>replace}}{{/peeps}}", + context: { peeps: [{name: "Moe", count: 15}, {name: "Larry", count: 5}, {name: "Curly", count: 1}] }, + partials: { replace: "Hello {{name}}! You have {{count}} new messages." } + }, + + recursion: { + source: "{{name}}{{#kids}}{{>recursion}}{{/kids}}", + context: { + name: '1', + kids: [ + { + name: '1.1', + kids: [ + {name: '1.1.1', kids: []} + ] + } + ] + }, + partials: { recursion: "{{name}}{{#kids}}{{>recursion}}{{/kids}}" } + }, + + filter: { + source: "{{#filter}}foo {{bar}}{{/filter}}", + context: { + filter: function() { + return function(text, render) { + return render(text).toUpperCase(); + } + }, + bar: "bar" + } + }, + + complex: { + source: "

{{header}}

{{#hasItems}}
    {{#items}}{{#current}}" + + "
  • {{name}}
  • {{/current}}{{^current}}" + + "
  • {{name}}
  • {{/current}}" + + "{{/items}}
{{/hasItems}}{{^hasItems}}

The list is empty.

{{/hasItems}}", + context: { + header: function() { + return "Colors"; + }, + items: [ + {name: "red", current: true, url: "#Red"}, + {name: "green", current: false, url: "#Green"}, + {name: "blue", current: false, url: "#Blue"} + ], + hasItems: function() { + return this.items.length !== 0; + }, + empty: function() { + return this.items.length === 0; + } + } + } +} + +exports.mustacheBench = function(suite, name, id) { + var bench = benches[name], + src = bench.source, + ctx = bench.context, + partials = bench.partials; + + suite.bench(id || name, function(next) { + Mustache.to_html(src, ctx, partials); + next(); + }); +} + +exports.mustacheBench.benches = benches; + +})(typeof exports !== "undefined" ? exports : window); \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/benchmark/uubench.js b/node_modules/dustjs-linkedin/benchmark/uubench.js new file mode 100644 index 0000000..b4004a3 --- /dev/null +++ b/node_modules/dustjs-linkedin/benchmark/uubench.js @@ -0,0 +1,107 @@ +(function(uubench){ + +function Bench(id, test, options, callback) { + this.id = id; + this.options = options; + this.test = test; + this.loop = test.length > 1; + this.callback = callback; +} + +Bench.prototype.run = function(iter) { + var self = this, fn = self.test, + checkfn = self.options.type === "adaptive" ? adaptive : fixed, + i = iter, pend = i, + min = self.options.min, start; + + if (self.loop) { + pend = 1; + start = new Date(); + fn(checkfn, i); + } else { + start = new Date(); + while (i--) { + fn(checkfn); + } + } + + function fixed() { + if (--pend === 0) { + var elapsed = new Date() - start; + self.callback({iterations: iter, elapsed: elapsed}); + } + } + + function adaptive() { + if (--pend === 0) { + var elapsed = new Date() - start; + if (elapsed < min) { + self.run(iter*2); + } else { + self.callback({iterations: iter, elapsed: elapsed}); + } + } + } +} + +uubench.Bench = Bench; + +uubench.defaults = { + type: "adaptive", // adaptive or fixed + iterations: 10, // starting iterations + min: 100, // minimum run time (ms) - adaptive only + delay: 100 // delay between tests (ms) +} + +function Suite(opts) { + for (var key in uubench.defaults) { + if (opts[key] === undefined) { + opts[key] = uubench.defaults[key]; + } + } + this.options = opts; + this.tests = []; +} + +Suite.prototype.bench = function(name, fn) { + var self = this; + self.tests.push(new Bench(name, fn, this.options, function(stats) { + self.emit("result", name, stats); + self.pending--; + self.check(); + })); +} + +Suite.prototype.run = function() { + if (this.pending) return; + var self = this, len = self.tests.length; + self.emit("start", self.tests); + self.start = new Date().getTime(); + self.pending = len; + for (var i=0; i] {sourcefilename|-} [destination]"); + process.exit(0); + case 'n': + case 'name': + name = match[2]; + break; + } +}); + +var input = args[1]; +var output = args[2]; +if (output) { + output = path.resolve(process.cwd(), output); +} + +var fd, template; + +if (! input) { + sys.puts("dustc: no input files"); + process.exit(1); +} + +var parseDustFile = function (e, data) { + if (e) { + sys.puts("dustc: " + e.message); + process.exit(1); + } + + template = dust.compile(data, name || input); + if (output) { + fd = fs.openSync(output, "w"); + fs.writeSync(fd, template, 0, "utf8"); + } else { + sys.print(template); + } +}; + +if (input != '-') { + fs.readFile(input, 'utf-8', parseDustFile); +} else { + process.stdin.resume(); + process.stdin.setEncoding('utf8'); + + var buffer = ''; + process.stdin.on('data', function(data) { + buffer += data; + }); + + process.stdin.on('end', function() { + parseDustFile(false, buffer); + }); +} diff --git a/node_modules/dustjs-linkedin/dist/dust-core-1.0.0.js b/node_modules/dustjs-linkedin/dist/dust-core-1.0.0.js new file mode 100644 index 0000000..26019bd --- /dev/null +++ b/node_modules/dustjs-linkedin/dist/dust-core-1.0.0.js @@ -0,0 +1,767 @@ +// +// Dust - Asynchronous Templating v1.0.0 +// http://akdubya.github.com/dustjs +// +// Copyright (c) 2010, Aleksander Williams +// Released under the MIT License. +// + +var dust = {}; + +function getGlobal(){ + return (function(){ + return this.dust; + }).call(null); +} + +(function(dust) { + +dust.cache = {}; + +dust.register = function(name, tmpl) { + if (!name) return; + dust.cache[name] = tmpl; +}; + +dust.render = function(name, context, callback) { + var chunk = new Stub(callback).head; + dust.load(name, chunk, Context.wrap(context)).end(); +}; + +dust.stream = function(name, context) { + var stream = new Stream(); + dust.nextTick(function() { + dust.load(name, stream.head, Context.wrap(context)).end(); + }); + return stream; +}; + +dust.renderSource = function(source, context, callback) { + return dust.compileFn(source)(context, callback); +}; + +dust.compileFn = function(source, name) { + var tmpl = dust.loadSource(dust.compile(source, name)); + return function(context, callback) { + var master = callback ? new Stub(callback) : new Stream(); + dust.nextTick(function() { + tmpl(master.head, Context.wrap(context)).end(); + }); + return master; + } +}; + +dust.load = function(name, chunk, context) { + var tmpl = dust.cache[name]; + if (tmpl) { + return tmpl(chunk, context); + } else { + if (dust.onLoad) { + return chunk.map(function(chunk) { + dust.onLoad(name, function(err, src) { + if (err) return chunk.setError(err); + if (!dust.cache[name]) dust.loadSource(dust.compile(src, name)); + dust.cache[name](chunk, context).end(); + }); + }); + } + return chunk.setError(new Error("Template Not Found: " + name)); + } +}; + +dust.loadSource = function(source, path) { + return eval(source); +}; + +if (Array.isArray) { + dust.isArray = Array.isArray; +} else { + dust.isArray = function(arr) { + return Object.prototype.toString.call(arr) == "[object Array]"; + }; +} + +dust.nextTick = (function() { + if (typeof process !== "undefined") { + return process.nextTick; + } else { + return function(callback) { + setTimeout(callback,0); + } + } +} )(); + +dust.isEmpty = function(value) { + if (dust.isArray(value) && !value.length) return true; + if (value === 0) return false; + return (!value); +}; + +dust.filter = function(string, auto, filters) { + if (filters) { + for (var i=0, len=filters.length; i\"\']/), + AMP = /&/g, + LT = //g, + QUOT = /\"/g, + SQUOT = /\'/g; + +dust.escapeHtml = function(s) { + if (typeof s === "string") { + if (!HCHARS.test(s)) { + return s; + } + return s.replace(AMP,'&').replace(LT,'<').replace(GT,'>').replace(QUOT,'"').replace(SQUOT, '''); + } + return s; +}; + +var BS = /\\/g, + CR = /\r/g, + LS = /\u2028/g, + PS = /\u2029/g, + NL = /\n/g, + LF = /\f/g, + SQ = /'/g, + DQ = /"/g, + TB = /\t/g; + +dust.escapeJs = function(s) { + if (typeof s === "string") { + return s + .replace(BS, '\\\\') + .replace(DQ, '\\"') + .replace(SQ, "\\'") + .replace(CR, '\\r') + .replace(LS, '\\u2028') + .replace(PS, '\\u2029') + .replace(NL, '\\n') + .replace(LF, '\\f') + .replace(TB, "\\t"); + } + return s; +}; + +})(dust); + +if (typeof exports !== "undefined") { + //TODO: Remove the helpers from dust core in the next release. + dust.helpers = require("./dust-helpers").helpers; + if (typeof process !== "undefined") { + require('./server')(dust); + } + module.exports = dust; +} +(function(dust){ + +/* make a safe version of console if it is not available + * currently supporting: + * _console.log + * */ +var _console = (typeof console !== 'undefined')? console: { + log: function(){ + /* a noop*/ + } +}; + +function isSelect(context) { + var value = context.current(); + return typeof value === "object" && value.isSelect === true; +} + +function filter(chunk, context, bodies, params, filter) { + var params = params || {}, + actual, + expected; + if (params.key) { + actual = helpers.tap(params.key, chunk, context); + } else if (isSelect(context)) { + actual = context.current().selectKey; + if (context.current().isResolved) { + filter = function() { return false; }; + } + } else { + throw "No key specified for filter and no key found in context from select statement"; + } + expected = helpers.tap(params.value, chunk, context); + if (filter(expected, coerce(actual, params.type, context))) { + if (isSelect(context)) { + context.current().isResolved = true; + } + return chunk.render(bodies.block, context); + } else if (bodies['else']) { + return chunk.render(bodies['else'], context); + } + + return chunk.write(''); +} + +function coerce (value, type, context) { + if (value) { + switch (type || typeof(value)) { + case 'number': return +value; + case 'string': return String(value); + case 'boolean': return Boolean(value); + case 'date': return new Date(value); + case 'context': return context.get(value); + } + } + + return value; +} + +var helpers = { + + sep: function(chunk, context, bodies) { + if (context.stack.index === context.stack.of - 1) { + return chunk; + } + return bodies.block(chunk, context); + }, + + idx: function(chunk, context, bodies) { + return bodies.block(chunk, context.push(context.stack.index)); + }, + + contextDump: function(chunk, context, bodies) { + _console.log(JSON.stringify(context.stack)); + return chunk; + }, + + // Utility helping to resolve dust references in the given chunk + tap: function( input, chunk, context ){ + // return given input if there is no dust reference to resolve + var output = input; + // dust compiles a string to function, if there are references + if( typeof input === "function"){ + if( ( typeof input.isReference !== "undefined" ) && ( input.isReference === true ) ){ // just a plain function, not a dust `body` function + output = input(); + } else { + output = ''; + chunk.tap(function(data){ + output += data; + return ''; + }).render(input, context).untap(); + if( output === '' ){ + output = false; + } + } + } + return output; + }, + + /** + if helper + @param cond, either a string literal value or a dust reference + a string literal value, is enclosed in double quotes, e.g. cond="2>3" + a dust reference is also enclosed in double quotes, e.g. cond="'{val}'' > 3" + cond argument should evaluate to a valid javascript expression + **/ + + "if": function( chunk, context, bodies, params ){ + if( params && params.cond ){ + var cond = params.cond; + cond = this.tap(cond, chunk, context); + // eval expressions with given dust references + if( eval( cond ) ){ + return chunk.render( bodies.block, context ); + } + if( bodies['else'] ){ + return chunk.render( bodies['else'], context ); + } + } + // no condition + else { + _console.log( "No condition given in the if helper!" ); + } + return chunk; + }, + + /** + select/eq/lt/lte/gt/gte/default helper + @param key, either a string literal value or a dust reference + a string literal value, is enclosed in double quotes, e.g. key="foo" + a dust reference may or may not be enclosed in double quotes, e.g. key="{val}" and key=val are both valid + @param type (optiona), supported types are number, boolean, string, date, context, defaults to string + **/ + select: function(chunk, context, bodies, params) { + if( params && params.key){ + // returns given input as output, if the input is not a dust reference, else does a context lookup + var key = this.tap(params.key, chunk, context); + return chunk.render(bodies.block, context.push({ isSelect: true, isResolved: false, selectKey: key })); + } + // no key + else { + _console.log( "No key given in the select helper!" ); + } + return chunk; + }, + + eq: function(chunk, context, bodies, params) { + return filter(chunk, context, bodies, params, function(expected, actual) { return actual === expected; }); + }, + + lt: function(chunk, context, bodies, params) { + return filter(chunk, context, bodies, params, function(expected, actual) { return actual < expected; }); + }, + + lte: function(chunk, context, bodies, params) { + return filter(chunk, context, bodies, params, function(expected, actual) { return actual <= expected; }); + }, + + gt: function(chunk, context, bodies, params) { + return filter(chunk, context, bodies, params, function(expected, actual) { return actual > expected; }); + }, + + gte: function(chunk, context, bodies, params) { + return filter(chunk, context, bodies, params, function(expected, actual) { return actual >= expected; }); + }, + + "default": function(chunk, context, bodies, params) { + return filter(chunk, context, bodies, params, function(expected, actual) { return true; }); + }, + size: function( chunk, context, bodies, params ) { + var subject = params.subject; + var value = 0; + if (!subject) { //undefined, "", 0 + value = 0; + } else if(dust.isArray(subject)) { //array + value = subject.length; + } else if (!isNaN(subject)) { //numeric values + value = subject; + } else if (Object(subject) === subject) { //object test + var nr = 0; + for(var k in subject) if(Object.hasOwnProperty.call(subject,k)) nr++; + value = nr; + } else { + value = (subject + '').length; //any other value (strings etc.) + } + return chunk.write(value); + } +}; + +dust.helpers = helpers; + +})(typeof exports !== 'undefined' ? exports : getGlobal()); diff --git a/node_modules/dustjs-linkedin/dist/dust-full-1.0.0.js b/node_modules/dustjs-linkedin/dist/dust-full-1.0.0.js new file mode 100644 index 0000000..ee22e96 --- /dev/null +++ b/node_modules/dustjs-linkedin/dist/dust-full-1.0.0.js @@ -0,0 +1,3681 @@ +// +// Dust - Asynchronous Templating v1.0.0 +// http://akdubya.github.com/dustjs +// +// Copyright (c) 2010, Aleksander Williams +// Released under the MIT License. +// + +var dust = {}; + +function getGlobal(){ + return (function(){ + return this.dust; + }).call(null); +} + +(function(dust) { + +dust.cache = {}; + +dust.register = function(name, tmpl) { + if (!name) return; + dust.cache[name] = tmpl; +}; + +dust.render = function(name, context, callback) { + var chunk = new Stub(callback).head; + dust.load(name, chunk, Context.wrap(context)).end(); +}; + +dust.stream = function(name, context) { + var stream = new Stream(); + dust.nextTick(function() { + dust.load(name, stream.head, Context.wrap(context)).end(); + }); + return stream; +}; + +dust.renderSource = function(source, context, callback) { + return dust.compileFn(source)(context, callback); +}; + +dust.compileFn = function(source, name) { + var tmpl = dust.loadSource(dust.compile(source, name)); + return function(context, callback) { + var master = callback ? new Stub(callback) : new Stream(); + dust.nextTick(function() { + tmpl(master.head, Context.wrap(context)).end(); + }); + return master; + } +}; + +dust.load = function(name, chunk, context) { + var tmpl = dust.cache[name]; + if (tmpl) { + return tmpl(chunk, context); + } else { + if (dust.onLoad) { + return chunk.map(function(chunk) { + dust.onLoad(name, function(err, src) { + if (err) return chunk.setError(err); + if (!dust.cache[name]) dust.loadSource(dust.compile(src, name)); + dust.cache[name](chunk, context).end(); + }); + }); + } + return chunk.setError(new Error("Template Not Found: " + name)); + } +}; + +dust.loadSource = function(source, path) { + return eval(source); +}; + +if (Array.isArray) { + dust.isArray = Array.isArray; +} else { + dust.isArray = function(arr) { + return Object.prototype.toString.call(arr) == "[object Array]"; + }; +} + +dust.nextTick = (function() { + if (typeof process !== "undefined") { + return process.nextTick; + } else { + return function(callback) { + setTimeout(callback,0); + } + } +} )(); + +dust.isEmpty = function(value) { + if (dust.isArray(value) && !value.length) return true; + if (value === 0) return false; + return (!value); +}; + +dust.filter = function(string, auto, filters) { + if (filters) { + for (var i=0, len=filters.length; i\"\']/), + AMP = /&/g, + LT = //g, + QUOT = /\"/g, + SQUOT = /\'/g; + +dust.escapeHtml = function(s) { + if (typeof s === "string") { + if (!HCHARS.test(s)) { + return s; + } + return s.replace(AMP,'&').replace(LT,'<').replace(GT,'>').replace(QUOT,'"').replace(SQUOT, '''); + } + return s; +}; + +var BS = /\\/g, + CR = /\r/g, + LS = /\u2028/g, + PS = /\u2029/g, + NL = /\n/g, + LF = /\f/g, + SQ = /'/g, + DQ = /"/g, + TB = /\t/g; + +dust.escapeJs = function(s) { + if (typeof s === "string") { + return s + .replace(BS, '\\\\') + .replace(DQ, '\\"') + .replace(SQ, "\\'") + .replace(CR, '\\r') + .replace(LS, '\\u2028') + .replace(PS, '\\u2029') + .replace(NL, '\\n') + .replace(LF, '\\f') + .replace(TB, "\\t"); + } + return s; +}; + +})(dust); + +if (typeof exports !== "undefined") { + //TODO: Remove the helpers from dust core in the next release. + dust.helpers = require("./dust-helpers").helpers; + if (typeof process !== "undefined") { + require('./server')(dust); + } + module.exports = dust; +} +(function(dust){ + +/* make a safe version of console if it is not available + * currently supporting: + * _console.log + * */ +var _console = (typeof console !== 'undefined')? console: { + log: function(){ + /* a noop*/ + } +}; + +function isSelect(context) { + var value = context.current(); + return typeof value === "object" && value.isSelect === true; +} + +function filter(chunk, context, bodies, params, filter) { + var params = params || {}, + actual, + expected; + if (params.key) { + actual = helpers.tap(params.key, chunk, context); + } else if (isSelect(context)) { + actual = context.current().selectKey; + if (context.current().isResolved) { + filter = function() { return false; }; + } + } else { + throw "No key specified for filter and no key found in context from select statement"; + } + expected = helpers.tap(params.value, chunk, context); + if (filter(expected, coerce(actual, params.type, context))) { + if (isSelect(context)) { + context.current().isResolved = true; + } + return chunk.render(bodies.block, context); + } else if (bodies['else']) { + return chunk.render(bodies['else'], context); + } + + return chunk.write(''); +} + +function coerce (value, type, context) { + if (value) { + switch (type || typeof(value)) { + case 'number': return +value; + case 'string': return String(value); + case 'boolean': return Boolean(value); + case 'date': return new Date(value); + case 'context': return context.get(value); + } + } + + return value; +} + +var helpers = { + + sep: function(chunk, context, bodies) { + if (context.stack.index === context.stack.of - 1) { + return chunk; + } + return bodies.block(chunk, context); + }, + + idx: function(chunk, context, bodies) { + return bodies.block(chunk, context.push(context.stack.index)); + }, + + contextDump: function(chunk, context, bodies) { + _console.log(JSON.stringify(context.stack)); + return chunk; + }, + + // Utility helping to resolve dust references in the given chunk + tap: function( input, chunk, context ){ + // return given input if there is no dust reference to resolve + var output = input; + // dust compiles a string to function, if there are references + if( typeof input === "function"){ + if( ( typeof input.isReference !== "undefined" ) && ( input.isReference === true ) ){ // just a plain function, not a dust `body` function + output = input(); + } else { + output = ''; + chunk.tap(function(data){ + output += data; + return ''; + }).render(input, context).untap(); + if( output === '' ){ + output = false; + } + } + } + return output; + }, + + /** + if helper + @param cond, either a string literal value or a dust reference + a string literal value, is enclosed in double quotes, e.g. cond="2>3" + a dust reference is also enclosed in double quotes, e.g. cond="'{val}'' > 3" + cond argument should evaluate to a valid javascript expression + **/ + + "if": function( chunk, context, bodies, params ){ + if( params && params.cond ){ + var cond = params.cond; + cond = this.tap(cond, chunk, context); + // eval expressions with given dust references + if( eval( cond ) ){ + return chunk.render( bodies.block, context ); + } + if( bodies['else'] ){ + return chunk.render( bodies['else'], context ); + } + } + // no condition + else { + _console.log( "No condition given in the if helper!" ); + } + return chunk; + }, + + /** + select/eq/lt/lte/gt/gte/default helper + @param key, either a string literal value or a dust reference + a string literal value, is enclosed in double quotes, e.g. key="foo" + a dust reference may or may not be enclosed in double quotes, e.g. key="{val}" and key=val are both valid + @param type (optiona), supported types are number, boolean, string, date, context, defaults to string + **/ + select: function(chunk, context, bodies, params) { + if( params && params.key){ + // returns given input as output, if the input is not a dust reference, else does a context lookup + var key = this.tap(params.key, chunk, context); + return chunk.render(bodies.block, context.push({ isSelect: true, isResolved: false, selectKey: key })); + } + // no key + else { + _console.log( "No key given in the select helper!" ); + } + return chunk; + }, + + eq: function(chunk, context, bodies, params) { + return filter(chunk, context, bodies, params, function(expected, actual) { return actual === expected; }); + }, + + lt: function(chunk, context, bodies, params) { + return filter(chunk, context, bodies, params, function(expected, actual) { return actual < expected; }); + }, + + lte: function(chunk, context, bodies, params) { + return filter(chunk, context, bodies, params, function(expected, actual) { return actual <= expected; }); + }, + + gt: function(chunk, context, bodies, params) { + return filter(chunk, context, bodies, params, function(expected, actual) { return actual > expected; }); + }, + + gte: function(chunk, context, bodies, params) { + return filter(chunk, context, bodies, params, function(expected, actual) { return actual >= expected; }); + }, + + "default": function(chunk, context, bodies, params) { + return filter(chunk, context, bodies, params, function(expected, actual) { return true; }); + }, + size: function( chunk, context, bodies, params ) { + var subject = params.subject; + var value = 0; + if (!subject) { //undefined, "", 0 + value = 0; + } else if(dust.isArray(subject)) { //array + value = subject.length; + } else if (!isNaN(subject)) { //numeric values + value = subject; + } else if (Object(subject) === subject) { //object test + var nr = 0; + for(var k in subject) if(Object.hasOwnProperty.call(subject,k)) nr++; + value = nr; + } else { + value = (subject + '').length; //any other value (strings etc.) + } + return chunk.write(value); + } +}; + +dust.helpers = helpers; + +})(typeof exports !== 'undefined' ? exports : getGlobal()); +(function(dust) { + +dust.compile = function(source, name) { + try { + var ast = filterAST(dust.parse(source)); + return compile(ast, name); + } + catch(err) + { + if(!err.line || !err.column) throw err; + throw new SyntaxError(err.message + " At line : " + err.line + ", column : " + err.column); + } +}; + +function filterAST(ast) { + var context = {}; + return dust.filterNode(context, ast); +} + +dust.filterNode = function(context, node) { + return dust.optimizers[node[0]](context, node); +} + +dust.optimizers = { + body: compactBuffers, + buffer: noop, + special: convertSpecial, + format: nullify, // TODO: convert format + reference: visit, + "#": visit, + "?": visit, + "^": visit, + "<": visit, + "+": visit, + "@": visit, + "%": visit, + partial: visit, + context: visit, + params: visit, + bodies: visit, + param: visit, + filters: noop, + key: noop, + path: noop, + literal: noop, + comment: nullify +} + +dust.pragmas = { + esc: function(compiler, context, bodies, params) { + var old = compiler.auto; + if (!context) context = 'h'; + compiler.auto = (context === 's') ? '' : context; + var out = compileParts(compiler, bodies.block); + compiler.auto = old; + return out; + } +} + +function visit(context, node) { + var out = [node[0]]; + for (var i=1, len=node.length; i rightmostFailuresPos.offset) { + rightmostFailuresPos = clone(pos); + rightmostFailuresExpected = []; + } + + rightmostFailuresExpected.push(failure); + } + + function parse_body() { + var result0, result1; + var pos0; + + pos0 = clone(pos); + result0 = []; + result1 = parse_part(); + while (result1 !== null) { + result0.push(result1); + result1 = parse_part(); + } + if (result0 !== null) { + result0 = (function(offset, line, column, p) { return ["body"].concat(p) })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + return result0; + } + + function parse_part() { + var result0; + + result0 = parse_comment(); + if (result0 === null) { + result0 = parse_section(); + if (result0 === null) { + result0 = parse_partial(); + if (result0 === null) { + result0 = parse_special(); + if (result0 === null) { + result0 = parse_reference(); + if (result0 === null) { + result0 = parse_buffer(); + } + } + } + } + } + return result0; + } + + function parse_section() { + var result0, result1, result2, result3, result4, result5, result6; + var pos0, pos1; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + result0 = parse_sec_tag_start(); + if (result0 !== null) { + result1 = []; + result2 = parse_ws(); + while (result2 !== null) { + result1.push(result2); + result2 = parse_ws(); + } + if (result1 !== null) { + result2 = parse_rd(); + if (result2 !== null) { + result3 = parse_body(); + if (result3 !== null) { + result4 = parse_bodies(); + if (result4 !== null) { + result5 = parse_end_tag(); + if (result5 !== null) { + result6 = (function(offset, line, column, t, b, e, n) { return t[1].text === n.text;})(pos.offset, pos.line, pos.column, result0, result3, result4, result5) ? "" : null; + if (result6 !== null) { + result0 = [result0, result1, result2, result3, result4, result5, result6]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, t, b, e, n) { e.push(["param", ["literal", "block"], b]); t.push(e); return t })(pos0.offset, pos0.line, pos0.column, result0[0], result0[3], result0[4], result0[5]); + } + if (result0 === null) { + pos = clone(pos0); + } + if (result0 === null) { + pos0 = clone(pos); + pos1 = clone(pos); + result0 = parse_sec_tag_start(); + if (result0 !== null) { + result1 = []; + result2 = parse_ws(); + while (result2 !== null) { + result1.push(result2); + result2 = parse_ws(); + } + if (result1 !== null) { + if (input.charCodeAt(pos.offset) === 47) { + result2 = "/"; + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("\"/\""); + } + } + if (result2 !== null) { + result3 = parse_rd(); + if (result3 !== null) { + result0 = [result0, result1, result2, result3]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, t) { t.push(["bodies"]); return t })(pos0.offset, pos0.line, pos0.column, result0[0]); + } + if (result0 === null) { + pos = clone(pos0); + } + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("section"); + } + return result0; + } + + function parse_sec_tag_start() { + var result0, result1, result2, result3, result4, result5; + var pos0, pos1; + + pos0 = clone(pos); + pos1 = clone(pos); + result0 = parse_ld(); + if (result0 !== null) { + if (/^[#?^<+@%]/.test(input.charAt(pos.offset))) { + result1 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("[#?^<+@%]"); + } + } + if (result1 !== null) { + result2 = []; + result3 = parse_ws(); + while (result3 !== null) { + result2.push(result3); + result3 = parse_ws(); + } + if (result2 !== null) { + result3 = parse_identifier(); + if (result3 !== null) { + result4 = parse_context(); + if (result4 !== null) { + result5 = parse_params(); + if (result5 !== null) { + result0 = [result0, result1, result2, result3, result4, result5]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, t, n, c, p) { return [t, n, c, p] })(pos0.offset, pos0.line, pos0.column, result0[1], result0[3], result0[4], result0[5]); + } + if (result0 === null) { + pos = clone(pos0); + } + return result0; + } + + function parse_end_tag() { + var result0, result1, result2, result3, result4, result5; + var pos0, pos1; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + result0 = parse_ld(); + if (result0 !== null) { + if (input.charCodeAt(pos.offset) === 47) { + result1 = "/"; + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("\"/\""); + } + } + if (result1 !== null) { + result2 = []; + result3 = parse_ws(); + while (result3 !== null) { + result2.push(result3); + result3 = parse_ws(); + } + if (result2 !== null) { + result3 = parse_identifier(); + if (result3 !== null) { + result4 = []; + result5 = parse_ws(); + while (result5 !== null) { + result4.push(result5); + result5 = parse_ws(); + } + if (result4 !== null) { + result5 = parse_rd(); + if (result5 !== null) { + result0 = [result0, result1, result2, result3, result4, result5]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, n) { return n })(pos0.offset, pos0.line, pos0.column, result0[3]); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("end tag"); + } + return result0; + } + + function parse_context() { + var result0, result1; + var pos0, pos1, pos2; + + pos0 = clone(pos); + pos1 = clone(pos); + pos2 = clone(pos); + if (input.charCodeAt(pos.offset) === 58) { + result0 = ":"; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\":\""); + } + } + if (result0 !== null) { + result1 = parse_identifier(); + if (result1 !== null) { + result0 = [result0, result1]; + } else { + result0 = null; + pos = clone(pos2); + } + } else { + result0 = null; + pos = clone(pos2); + } + if (result0 !== null) { + result0 = (function(offset, line, column, n) {return n})(pos1.offset, pos1.line, pos1.column, result0[1]); + } + if (result0 === null) { + pos = clone(pos1); + } + result0 = result0 !== null ? result0 : ""; + if (result0 !== null) { + result0 = (function(offset, line, column, n) { return n ? ["context", n] : ["context"] })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + return result0; + } + + function parse_params() { + var result0, result1, result2, result3, result4; + var pos0, pos1, pos2; + + reportFailures++; + pos0 = clone(pos); + result0 = []; + pos1 = clone(pos); + pos2 = clone(pos); + result2 = parse_ws(); + if (result2 !== null) { + result1 = []; + while (result2 !== null) { + result1.push(result2); + result2 = parse_ws(); + } + } else { + result1 = null; + } + if (result1 !== null) { + result2 = parse_key(); + if (result2 !== null) { + if (input.charCodeAt(pos.offset) === 61) { + result3 = "="; + advance(pos, 1); + } else { + result3 = null; + if (reportFailures === 0) { + matchFailed("\"=\""); + } + } + if (result3 !== null) { + result4 = parse_number(); + if (result4 === null) { + result4 = parse_identifier(); + if (result4 === null) { + result4 = parse_inline(); + } + } + if (result4 !== null) { + result1 = [result1, result2, result3, result4]; + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + if (result1 !== null) { + result1 = (function(offset, line, column, k, v) {return ["param", ["literal", k], v]})(pos1.offset, pos1.line, pos1.column, result1[1], result1[3]); + } + if (result1 === null) { + pos = clone(pos1); + } + while (result1 !== null) { + result0.push(result1); + pos1 = clone(pos); + pos2 = clone(pos); + result2 = parse_ws(); + if (result2 !== null) { + result1 = []; + while (result2 !== null) { + result1.push(result2); + result2 = parse_ws(); + } + } else { + result1 = null; + } + if (result1 !== null) { + result2 = parse_key(); + if (result2 !== null) { + if (input.charCodeAt(pos.offset) === 61) { + result3 = "="; + advance(pos, 1); + } else { + result3 = null; + if (reportFailures === 0) { + matchFailed("\"=\""); + } + } + if (result3 !== null) { + result4 = parse_number(); + if (result4 === null) { + result4 = parse_identifier(); + if (result4 === null) { + result4 = parse_inline(); + } + } + if (result4 !== null) { + result1 = [result1, result2, result3, result4]; + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + if (result1 !== null) { + result1 = (function(offset, line, column, k, v) {return ["param", ["literal", k], v]})(pos1.offset, pos1.line, pos1.column, result1[1], result1[3]); + } + if (result1 === null) { + pos = clone(pos1); + } + } + if (result0 !== null) { + result0 = (function(offset, line, column, p) { return ["params"].concat(p) })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("params"); + } + return result0; + } + + function parse_bodies() { + var result0, result1, result2, result3, result4, result5; + var pos0, pos1, pos2; + + reportFailures++; + pos0 = clone(pos); + result0 = []; + pos1 = clone(pos); + pos2 = clone(pos); + result1 = parse_ld(); + if (result1 !== null) { + if (input.charCodeAt(pos.offset) === 58) { + result2 = ":"; + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("\":\""); + } + } + if (result2 !== null) { + result3 = parse_key(); + if (result3 !== null) { + result4 = parse_rd(); + if (result4 !== null) { + result5 = parse_body(); + if (result5 !== null) { + result1 = [result1, result2, result3, result4, result5]; + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + if (result1 !== null) { + result1 = (function(offset, line, column, k, v) {return ["param", ["literal", k], v]})(pos1.offset, pos1.line, pos1.column, result1[2], result1[4]); + } + if (result1 === null) { + pos = clone(pos1); + } + while (result1 !== null) { + result0.push(result1); + pos1 = clone(pos); + pos2 = clone(pos); + result1 = parse_ld(); + if (result1 !== null) { + if (input.charCodeAt(pos.offset) === 58) { + result2 = ":"; + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("\":\""); + } + } + if (result2 !== null) { + result3 = parse_key(); + if (result3 !== null) { + result4 = parse_rd(); + if (result4 !== null) { + result5 = parse_body(); + if (result5 !== null) { + result1 = [result1, result2, result3, result4, result5]; + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + if (result1 !== null) { + result1 = (function(offset, line, column, k, v) {return ["param", ["literal", k], v]})(pos1.offset, pos1.line, pos1.column, result1[2], result1[4]); + } + if (result1 === null) { + pos = clone(pos1); + } + } + if (result0 !== null) { + result0 = (function(offset, line, column, p) { return ["bodies"].concat(p) })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("bodies"); + } + return result0; + } + + function parse_reference() { + var result0, result1, result2, result3; + var pos0, pos1; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + result0 = parse_ld(); + if (result0 !== null) { + result1 = parse_identifier(); + if (result1 !== null) { + result2 = parse_filters(); + if (result2 !== null) { + result3 = parse_rd(); + if (result3 !== null) { + result0 = [result0, result1, result2, result3]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, n, f) { return ["reference", n, f] })(pos0.offset, pos0.line, pos0.column, result0[1], result0[2]); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("reference"); + } + return result0; + } + + function parse_partial() { + var result0, result1, result2, result3, result4, result5, result6, result7; + var pos0, pos1, pos2; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + result0 = parse_ld(); + if (result0 !== null) { + if (input.charCodeAt(pos.offset) === 62) { + result1 = ">"; + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("\">\""); + } + } + if (result1 === null) { + if (input.charCodeAt(pos.offset) === 43) { + result1 = "+"; + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("\"+\""); + } + } + } + if (result1 !== null) { + pos2 = clone(pos); + result2 = parse_key(); + if (result2 !== null) { + result2 = (function(offset, line, column, k) {return ["literal", k]})(pos2.offset, pos2.line, pos2.column, result2); + } + if (result2 === null) { + pos = clone(pos2); + } + if (result2 === null) { + result2 = parse_inline(); + } + if (result2 !== null) { + result3 = parse_context(); + if (result3 !== null) { + result4 = parse_params(); + if (result4 !== null) { + result5 = []; + result6 = parse_ws(); + while (result6 !== null) { + result5.push(result6); + result6 = parse_ws(); + } + if (result5 !== null) { + if (input.charCodeAt(pos.offset) === 47) { + result6 = "/"; + advance(pos, 1); + } else { + result6 = null; + if (reportFailures === 0) { + matchFailed("\"/\""); + } + } + if (result6 !== null) { + result7 = parse_rd(); + if (result7 !== null) { + result0 = [result0, result1, result2, result3, result4, result5, result6, result7]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, s, n, c, p) { var key = (s ===">")? "partial" : s; return [key, n, c, p] })(pos0.offset, pos0.line, pos0.column, result0[1], result0[2], result0[3], result0[4]); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("partial"); + } + return result0; + } + + function parse_filters() { + var result0, result1, result2; + var pos0, pos1, pos2; + + reportFailures++; + pos0 = clone(pos); + result0 = []; + pos1 = clone(pos); + pos2 = clone(pos); + if (input.charCodeAt(pos.offset) === 124) { + result1 = "|"; + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("\"|\""); + } + } + if (result1 !== null) { + result2 = parse_key(); + if (result2 !== null) { + result1 = [result1, result2]; + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + if (result1 !== null) { + result1 = (function(offset, line, column, n) {return n})(pos1.offset, pos1.line, pos1.column, result1[1]); + } + if (result1 === null) { + pos = clone(pos1); + } + while (result1 !== null) { + result0.push(result1); + pos1 = clone(pos); + pos2 = clone(pos); + if (input.charCodeAt(pos.offset) === 124) { + result1 = "|"; + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("\"|\""); + } + } + if (result1 !== null) { + result2 = parse_key(); + if (result2 !== null) { + result1 = [result1, result2]; + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + if (result1 !== null) { + result1 = (function(offset, line, column, n) {return n})(pos1.offset, pos1.line, pos1.column, result1[1]); + } + if (result1 === null) { + pos = clone(pos1); + } + } + if (result0 !== null) { + result0 = (function(offset, line, column, f) { return ["filters"].concat(f) })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("filters"); + } + return result0; + } + + function parse_special() { + var result0, result1, result2, result3; + var pos0, pos1; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + result0 = parse_ld(); + if (result0 !== null) { + if (input.charCodeAt(pos.offset) === 126) { + result1 = "~"; + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("\"~\""); + } + } + if (result1 !== null) { + result2 = parse_key(); + if (result2 !== null) { + result3 = parse_rd(); + if (result3 !== null) { + result0 = [result0, result1, result2, result3]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, k) { return ["special", k] })(pos0.offset, pos0.line, pos0.column, result0[2]); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("special"); + } + return result0; + } + + function parse_identifier() { + var result0; + var pos0; + + reportFailures++; + pos0 = clone(pos); + result0 = parse_path(); + if (result0 !== null) { + result0 = (function(offset, line, column, p) { var arr = ["path"].concat(p); arr.text = p[1].join('.'); return arr; })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + if (result0 === null) { + pos0 = clone(pos); + result0 = parse_key(); + if (result0 !== null) { + result0 = (function(offset, line, column, k) { var arr = ["key", k]; arr.text = k; return arr; })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("identifier"); + } + return result0; + } + + function parse_number() { + var result0; + var pos0; + + reportFailures++; + pos0 = clone(pos); + result0 = parse_frac(); + if (result0 === null) { + result0 = parse_integer(); + } + if (result0 !== null) { + result0 = (function(offset, line, column, n) { return ['literal', n]; })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("number"); + } + return result0; + } + + function parse_frac() { + var result0, result1, result2, result3; + var pos0, pos1; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + result0 = parse_integer(); + if (result0 !== null) { + if (input.charCodeAt(pos.offset) === 46) { + result1 = "."; + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("\".\""); + } + } + if (result1 !== null) { + result3 = parse_integer(); + if (result3 !== null) { + result2 = []; + while (result3 !== null) { + result2.push(result3); + result3 = parse_integer(); + } + } else { + result2 = null; + } + if (result2 !== null) { + result0 = [result0, result1, result2]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, l, r) { return parseFloat(l + "." + r.join('')); })(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("frac"); + } + return result0; + } + + function parse_integer() { + var result0, result1; + var pos0; + + reportFailures++; + pos0 = clone(pos); + if (/^[0-9]/.test(input.charAt(pos.offset))) { + result1 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("[0-9]"); + } + } + if (result1 !== null) { + result0 = []; + while (result1 !== null) { + result0.push(result1); + if (/^[0-9]/.test(input.charAt(pos.offset))) { + result1 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("[0-9]"); + } + } + } + } else { + result0 = null; + } + if (result0 !== null) { + result0 = (function(offset, line, column, digits) { return parseInt(digits.join(""), 10); })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("integer"); + } + return result0; + } + + function parse_path() { + var result0, result1, result2; + var pos0, pos1; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + result0 = parse_key(); + result0 = result0 !== null ? result0 : ""; + if (result0 !== null) { + result2 = parse_array_part(); + if (result2 === null) { + result2 = parse_array(); + } + if (result2 !== null) { + result1 = []; + while (result2 !== null) { + result1.push(result2); + result2 = parse_array_part(); + if (result2 === null) { + result2 = parse_array(); + } + } + } else { + result1 = null; + } + if (result1 !== null) { + result0 = [result0, result1]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, k, d) { + d = d[0]; + if (k && d) { + d.unshift(k); + return [false, d]; + } + return [true, d]; + })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]); + } + if (result0 === null) { + pos = clone(pos0); + } + if (result0 === null) { + pos0 = clone(pos); + pos1 = clone(pos); + if (input.charCodeAt(pos.offset) === 46) { + result0 = "."; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\".\""); + } + } + if (result0 !== null) { + result1 = []; + result2 = parse_array_part(); + if (result2 === null) { + result2 = parse_array(); + } + while (result2 !== null) { + result1.push(result2); + result2 = parse_array_part(); + if (result2 === null) { + result2 = parse_array(); + } + } + if (result1 !== null) { + result0 = [result0, result1]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, d) { + if (d.length > 0) { + return [true, d[0]]; + } + return [true, []] + })(pos0.offset, pos0.line, pos0.column, result0[1]); + } + if (result0 === null) { + pos = clone(pos0); + } + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("path"); + } + return result0; + } + + function parse_key() { + var result0, result1, result2; + var pos0, pos1; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + if (/^[a-zA-Z_$]/.test(input.charAt(pos.offset))) { + result0 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("[a-zA-Z_$]"); + } + } + if (result0 !== null) { + result1 = []; + if (/^[0-9a-zA-Z_$\-]/.test(input.charAt(pos.offset))) { + result2 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("[0-9a-zA-Z_$\\-]"); + } + } + while (result2 !== null) { + result1.push(result2); + if (/^[0-9a-zA-Z_$\-]/.test(input.charAt(pos.offset))) { + result2 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("[0-9a-zA-Z_$\\-]"); + } + } + } + if (result1 !== null) { + result0 = [result0, result1]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, h, t) { return h + t.join('') })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("key"); + } + return result0; + } + + function parse_array() { + var result0, result1, result2; + var pos0, pos1, pos2, pos3; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + pos2 = clone(pos); + pos3 = clone(pos); + if (input.charCodeAt(pos.offset) === 91) { + result0 = "["; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"[\""); + } + } + if (result0 !== null) { + if (/^[0-9]/.test(input.charAt(pos.offset))) { + result2 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("[0-9]"); + } + } + if (result2 !== null) { + result1 = []; + while (result2 !== null) { + result1.push(result2); + if (/^[0-9]/.test(input.charAt(pos.offset))) { + result2 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("[0-9]"); + } + } + } + } else { + result1 = null; + } + if (result1 !== null) { + if (input.charCodeAt(pos.offset) === 93) { + result2 = "]"; + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("\"]\""); + } + } + if (result2 !== null) { + result0 = [result0, result1, result2]; + } else { + result0 = null; + pos = clone(pos3); + } + } else { + result0 = null; + pos = clone(pos3); + } + } else { + result0 = null; + pos = clone(pos3); + } + if (result0 !== null) { + result0 = (function(offset, line, column, a) {return a.join('')})(pos2.offset, pos2.line, pos2.column, result0[1]); + } + if (result0 === null) { + pos = clone(pos2); + } + if (result0 !== null) { + result1 = parse_array_part(); + result1 = result1 !== null ? result1 : ""; + if (result1 !== null) { + result0 = [result0, result1]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, i, nk) { if(nk) { nk.unshift(i); } else {nk = [i] } return nk; })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("array"); + } + return result0; + } + + function parse_array_part() { + var result0, result1, result2; + var pos0, pos1, pos2, pos3; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + pos2 = clone(pos); + pos3 = clone(pos); + if (input.charCodeAt(pos.offset) === 46) { + result1 = "."; + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("\".\""); + } + } + if (result1 !== null) { + result2 = parse_key(); + if (result2 !== null) { + result1 = [result1, result2]; + } else { + result1 = null; + pos = clone(pos3); + } + } else { + result1 = null; + pos = clone(pos3); + } + if (result1 !== null) { + result1 = (function(offset, line, column, k) {return k})(pos2.offset, pos2.line, pos2.column, result1[1]); + } + if (result1 === null) { + pos = clone(pos2); + } + if (result1 !== null) { + result0 = []; + while (result1 !== null) { + result0.push(result1); + pos2 = clone(pos); + pos3 = clone(pos); + if (input.charCodeAt(pos.offset) === 46) { + result1 = "."; + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("\".\""); + } + } + if (result1 !== null) { + result2 = parse_key(); + if (result2 !== null) { + result1 = [result1, result2]; + } else { + result1 = null; + pos = clone(pos3); + } + } else { + result1 = null; + pos = clone(pos3); + } + if (result1 !== null) { + result1 = (function(offset, line, column, k) {return k})(pos2.offset, pos2.line, pos2.column, result1[1]); + } + if (result1 === null) { + pos = clone(pos2); + } + } + } else { + result0 = null; + } + if (result0 !== null) { + result1 = parse_array(); + result1 = result1 !== null ? result1 : ""; + if (result1 !== null) { + result0 = [result0, result1]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, d, a) { if (a) { return d.concat(a); } else { return d; } })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("array_part"); + } + return result0; + } + + function parse_inline() { + var result0, result1, result2; + var pos0, pos1; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + if (input.charCodeAt(pos.offset) === 34) { + result0 = "\""; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"\\\"\""); + } + } + if (result0 !== null) { + if (input.charCodeAt(pos.offset) === 34) { + result1 = "\""; + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("\"\\\"\""); + } + } + if (result1 !== null) { + result0 = [result0, result1]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column) { return ["literal", ""] })(pos0.offset, pos0.line, pos0.column); + } + if (result0 === null) { + pos = clone(pos0); + } + if (result0 === null) { + pos0 = clone(pos); + pos1 = clone(pos); + if (input.charCodeAt(pos.offset) === 34) { + result0 = "\""; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"\\\"\""); + } + } + if (result0 !== null) { + result1 = parse_literal(); + if (result1 !== null) { + if (input.charCodeAt(pos.offset) === 34) { + result2 = "\""; + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("\"\\\"\""); + } + } + if (result2 !== null) { + result0 = [result0, result1, result2]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, l) { return ["literal", l] })(pos0.offset, pos0.line, pos0.column, result0[1]); + } + if (result0 === null) { + pos = clone(pos0); + } + if (result0 === null) { + pos0 = clone(pos); + pos1 = clone(pos); + if (input.charCodeAt(pos.offset) === 34) { + result0 = "\""; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"\\\"\""); + } + } + if (result0 !== null) { + result2 = parse_inline_part(); + if (result2 !== null) { + result1 = []; + while (result2 !== null) { + result1.push(result2); + result2 = parse_inline_part(); + } + } else { + result1 = null; + } + if (result1 !== null) { + if (input.charCodeAt(pos.offset) === 34) { + result2 = "\""; + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("\"\\\"\""); + } + } + if (result2 !== null) { + result0 = [result0, result1, result2]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, p) { return ["body"].concat(p) })(pos0.offset, pos0.line, pos0.column, result0[1]); + } + if (result0 === null) { + pos = clone(pos0); + } + } + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("inline"); + } + return result0; + } + + function parse_inline_part() { + var result0; + var pos0; + + result0 = parse_special(); + if (result0 === null) { + result0 = parse_reference(); + if (result0 === null) { + pos0 = clone(pos); + result0 = parse_literal(); + if (result0 !== null) { + result0 = (function(offset, line, column, l) { return ["buffer", l] })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + } + } + return result0; + } + + function parse_buffer() { + var result0, result1, result2, result3, result4; + var pos0, pos1, pos2, pos3; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + result0 = parse_eol(); + if (result0 !== null) { + result1 = []; + result2 = parse_ws(); + while (result2 !== null) { + result1.push(result2); + result2 = parse_ws(); + } + if (result1 !== null) { + result0 = [result0, result1]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, e, w) { return ["format", e, w.join('')] })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]); + } + if (result0 === null) { + pos = clone(pos0); + } + if (result0 === null) { + pos0 = clone(pos); + pos1 = clone(pos); + pos2 = clone(pos); + pos3 = clone(pos); + reportFailures++; + result1 = parse_tag(); + reportFailures--; + if (result1 === null) { + result1 = ""; + } else { + result1 = null; + pos = clone(pos3); + } + if (result1 !== null) { + pos3 = clone(pos); + reportFailures++; + result2 = parse_eol(); + reportFailures--; + if (result2 === null) { + result2 = ""; + } else { + result2 = null; + pos = clone(pos3); + } + if (result2 !== null) { + pos3 = clone(pos); + reportFailures++; + result3 = parse_comment(); + reportFailures--; + if (result3 === null) { + result3 = ""; + } else { + result3 = null; + pos = clone(pos3); + } + if (result3 !== null) { + if (input.length > pos.offset) { + result4 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result4 = null; + if (reportFailures === 0) { + matchFailed("any character"); + } + } + if (result4 !== null) { + result1 = [result1, result2, result3, result4]; + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + if (result1 !== null) { + result1 = (function(offset, line, column, c) {return c})(pos1.offset, pos1.line, pos1.column, result1[3]); + } + if (result1 === null) { + pos = clone(pos1); + } + if (result1 !== null) { + result0 = []; + while (result1 !== null) { + result0.push(result1); + pos1 = clone(pos); + pos2 = clone(pos); + pos3 = clone(pos); + reportFailures++; + result1 = parse_tag(); + reportFailures--; + if (result1 === null) { + result1 = ""; + } else { + result1 = null; + pos = clone(pos3); + } + if (result1 !== null) { + pos3 = clone(pos); + reportFailures++; + result2 = parse_eol(); + reportFailures--; + if (result2 === null) { + result2 = ""; + } else { + result2 = null; + pos = clone(pos3); + } + if (result2 !== null) { + pos3 = clone(pos); + reportFailures++; + result3 = parse_comment(); + reportFailures--; + if (result3 === null) { + result3 = ""; + } else { + result3 = null; + pos = clone(pos3); + } + if (result3 !== null) { + if (input.length > pos.offset) { + result4 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result4 = null; + if (reportFailures === 0) { + matchFailed("any character"); + } + } + if (result4 !== null) { + result1 = [result1, result2, result3, result4]; + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + if (result1 !== null) { + result1 = (function(offset, line, column, c) {return c})(pos1.offset, pos1.line, pos1.column, result1[3]); + } + if (result1 === null) { + pos = clone(pos1); + } + } + } else { + result0 = null; + } + if (result0 !== null) { + result0 = (function(offset, line, column, b) { return ["buffer", b.join('')] })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("buffer"); + } + return result0; + } + + function parse_literal() { + var result0, result1, result2; + var pos0, pos1, pos2, pos3; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + pos2 = clone(pos); + pos3 = clone(pos); + reportFailures++; + result1 = parse_tag(); + reportFailures--; + if (result1 === null) { + result1 = ""; + } else { + result1 = null; + pos = clone(pos3); + } + if (result1 !== null) { + result2 = parse_esc(); + if (result2 === null) { + if (/^[^"]/.test(input.charAt(pos.offset))) { + result2 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("[^\"]"); + } + } + } + if (result2 !== null) { + result1 = [result1, result2]; + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + if (result1 !== null) { + result1 = (function(offset, line, column, c) {return c})(pos1.offset, pos1.line, pos1.column, result1[1]); + } + if (result1 === null) { + pos = clone(pos1); + } + if (result1 !== null) { + result0 = []; + while (result1 !== null) { + result0.push(result1); + pos1 = clone(pos); + pos2 = clone(pos); + pos3 = clone(pos); + reportFailures++; + result1 = parse_tag(); + reportFailures--; + if (result1 === null) { + result1 = ""; + } else { + result1 = null; + pos = clone(pos3); + } + if (result1 !== null) { + result2 = parse_esc(); + if (result2 === null) { + if (/^[^"]/.test(input.charAt(pos.offset))) { + result2 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("[^\"]"); + } + } + } + if (result2 !== null) { + result1 = [result1, result2]; + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + if (result1 !== null) { + result1 = (function(offset, line, column, c) {return c})(pos1.offset, pos1.line, pos1.column, result1[1]); + } + if (result1 === null) { + pos = clone(pos1); + } + } + } else { + result0 = null; + } + if (result0 !== null) { + result0 = (function(offset, line, column, b) { return b.join('') })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("literal"); + } + return result0; + } + + function parse_esc() { + var result0; + var pos0; + + pos0 = clone(pos); + if (input.substr(pos.offset, 2) === "\\\"") { + result0 = "\\\""; + advance(pos, 2); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"\\\\\\\"\""); + } + } + if (result0 !== null) { + result0 = (function(offset, line, column) { return '"' })(pos0.offset, pos0.line, pos0.column); + } + if (result0 === null) { + pos = clone(pos0); + } + return result0; + } + + function parse_comment() { + var result0, result1, result2, result3; + var pos0, pos1, pos2, pos3, pos4; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + if (input.substr(pos.offset, 2) === "{!") { + result0 = "{!"; + advance(pos, 2); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"{!\""); + } + } + if (result0 !== null) { + result1 = []; + pos2 = clone(pos); + pos3 = clone(pos); + pos4 = clone(pos); + reportFailures++; + if (input.substr(pos.offset, 2) === "!}") { + result2 = "!}"; + advance(pos, 2); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("\"!}\""); + } + } + reportFailures--; + if (result2 === null) { + result2 = ""; + } else { + result2 = null; + pos = clone(pos4); + } + if (result2 !== null) { + if (input.length > pos.offset) { + result3 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result3 = null; + if (reportFailures === 0) { + matchFailed("any character"); + } + } + if (result3 !== null) { + result2 = [result2, result3]; + } else { + result2 = null; + pos = clone(pos3); + } + } else { + result2 = null; + pos = clone(pos3); + } + if (result2 !== null) { + result2 = (function(offset, line, column, c) {return c})(pos2.offset, pos2.line, pos2.column, result2[1]); + } + if (result2 === null) { + pos = clone(pos2); + } + while (result2 !== null) { + result1.push(result2); + pos2 = clone(pos); + pos3 = clone(pos); + pos4 = clone(pos); + reportFailures++; + if (input.substr(pos.offset, 2) === "!}") { + result2 = "!}"; + advance(pos, 2); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("\"!}\""); + } + } + reportFailures--; + if (result2 === null) { + result2 = ""; + } else { + result2 = null; + pos = clone(pos4); + } + if (result2 !== null) { + if (input.length > pos.offset) { + result3 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result3 = null; + if (reportFailures === 0) { + matchFailed("any character"); + } + } + if (result3 !== null) { + result2 = [result2, result3]; + } else { + result2 = null; + pos = clone(pos3); + } + } else { + result2 = null; + pos = clone(pos3); + } + if (result2 !== null) { + result2 = (function(offset, line, column, c) {return c})(pos2.offset, pos2.line, pos2.column, result2[1]); + } + if (result2 === null) { + pos = clone(pos2); + } + } + if (result1 !== null) { + if (input.substr(pos.offset, 2) === "!}") { + result2 = "!}"; + advance(pos, 2); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("\"!}\""); + } + } + if (result2 !== null) { + result0 = [result0, result1, result2]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, c) { return ["comment", c.join('')] })(pos0.offset, pos0.line, pos0.column, result0[1]); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("comment"); + } + return result0; + } + + function parse_tag() { + var result0, result1, result2, result3, result4, result5, result6; + var pos0, pos1, pos2; + + pos0 = clone(pos); + result0 = parse_ld(); + if (result0 !== null) { + if (/^[#?^><+%:@\/~%]/.test(input.charAt(pos.offset))) { + result1 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("[#?^><+%:@\\/~%]"); + } + } + if (result1 !== null) { + result2 = []; + result3 = parse_ws(); + while (result3 !== null) { + result2.push(result3); + result3 = parse_ws(); + } + if (result2 !== null) { + pos1 = clone(pos); + pos2 = clone(pos); + reportFailures++; + result4 = parse_rd(); + reportFailures--; + if (result4 === null) { + result4 = ""; + } else { + result4 = null; + pos = clone(pos2); + } + if (result4 !== null) { + pos2 = clone(pos); + reportFailures++; + result5 = parse_eol(); + reportFailures--; + if (result5 === null) { + result5 = ""; + } else { + result5 = null; + pos = clone(pos2); + } + if (result5 !== null) { + if (input.length > pos.offset) { + result6 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result6 = null; + if (reportFailures === 0) { + matchFailed("any character"); + } + } + if (result6 !== null) { + result4 = [result4, result5, result6]; + } else { + result4 = null; + pos = clone(pos1); + } + } else { + result4 = null; + pos = clone(pos1); + } + } else { + result4 = null; + pos = clone(pos1); + } + if (result4 !== null) { + result3 = []; + while (result4 !== null) { + result3.push(result4); + pos1 = clone(pos); + pos2 = clone(pos); + reportFailures++; + result4 = parse_rd(); + reportFailures--; + if (result4 === null) { + result4 = ""; + } else { + result4 = null; + pos = clone(pos2); + } + if (result4 !== null) { + pos2 = clone(pos); + reportFailures++; + result5 = parse_eol(); + reportFailures--; + if (result5 === null) { + result5 = ""; + } else { + result5 = null; + pos = clone(pos2); + } + if (result5 !== null) { + if (input.length > pos.offset) { + result6 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result6 = null; + if (reportFailures === 0) { + matchFailed("any character"); + } + } + if (result6 !== null) { + result4 = [result4, result5, result6]; + } else { + result4 = null; + pos = clone(pos1); + } + } else { + result4 = null; + pos = clone(pos1); + } + } else { + result4 = null; + pos = clone(pos1); + } + } + } else { + result3 = null; + } + if (result3 !== null) { + result4 = []; + result5 = parse_ws(); + while (result5 !== null) { + result4.push(result5); + result5 = parse_ws(); + } + if (result4 !== null) { + result5 = parse_rd(); + if (result5 !== null) { + result0 = [result0, result1, result2, result3, result4, result5]; + } else { + result0 = null; + pos = clone(pos0); + } + } else { + result0 = null; + pos = clone(pos0); + } + } else { + result0 = null; + pos = clone(pos0); + } + } else { + result0 = null; + pos = clone(pos0); + } + } else { + result0 = null; + pos = clone(pos0); + } + } else { + result0 = null; + pos = clone(pos0); + } + if (result0 === null) { + result0 = parse_reference(); + } + return result0; + } + + function parse_ld() { + var result0; + + if (input.charCodeAt(pos.offset) === 123) { + result0 = "{"; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"{\""); + } + } + return result0; + } + + function parse_rd() { + var result0; + + if (input.charCodeAt(pos.offset) === 125) { + result0 = "}"; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"}\""); + } + } + return result0; + } + + function parse_eol() { + var result0; + + if (input.charCodeAt(pos.offset) === 10) { + result0 = "\n"; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"\\n\""); + } + } + if (result0 === null) { + if (input.substr(pos.offset, 2) === "\r\n") { + result0 = "\r\n"; + advance(pos, 2); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"\\r\\n\""); + } + } + if (result0 === null) { + if (input.charCodeAt(pos.offset) === 13) { + result0 = "\r"; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"\\r\""); + } + } + if (result0 === null) { + if (input.charCodeAt(pos.offset) === 8232) { + result0 = "\u2028"; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"\\u2028\""); + } + } + if (result0 === null) { + if (input.charCodeAt(pos.offset) === 8233) { + result0 = "\u2029"; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"\\u2029\""); + } + } + } + } + } + } + return result0; + } + + function parse_ws() { + var result0; + + if (/^[\t\x0B\f \xA0\uFEFF]/.test(input.charAt(pos.offset))) { + result0 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("[\\t\\x0B\\f \\xA0\\uFEFF]"); + } + } + if (result0 === null) { + result0 = parse_eol(); + } + return result0; + } + + + function cleanupExpected(expected) { + expected.sort(); + + var lastExpected = null; + var cleanExpected = []; + for (var i = 0; i < expected.length; i++) { + if (expected[i] !== lastExpected) { + cleanExpected.push(expected[i]); + lastExpected = expected[i]; + } + } + return cleanExpected; + } + + + + var result = parseFunctions[startRule](); + + /* + * The parser is now in one of the following three states: + * + * 1. The parser successfully parsed the whole input. + * + * - |result !== null| + * - |pos.offset === input.length| + * - |rightmostFailuresExpected| may or may not contain something + * + * 2. The parser successfully parsed only a part of the input. + * + * - |result !== null| + * - |pos.offset < input.length| + * - |rightmostFailuresExpected| may or may not contain something + * + * 3. The parser did not successfully parse any part of the input. + * + * - |result === null| + * - |pos.offset === 0| + * - |rightmostFailuresExpected| contains at least one failure + * + * All code following this comment (including called functions) must + * handle these states. + */ + if (result === null || pos.offset !== input.length) { + var offset = Math.max(pos.offset, rightmostFailuresPos.offset); + var found = offset < input.length ? input.charAt(offset) : null; + var errorPosition = pos.offset > rightmostFailuresPos.offset ? pos : rightmostFailuresPos; + + throw new parser.SyntaxError( + cleanupExpected(rightmostFailuresExpected), + found, + offset, + errorPosition.line, + errorPosition.column + ); + } + + return result; + }, + + /* Returns the parser source code. */ + toSource: function() { return this._source; } + }; + + /* Thrown when a parser encounters a syntax error. */ + + result.SyntaxError = function(expected, found, offset, line, column) { + function buildMessage(expected, found) { + var expectedHumanized, foundHumanized; + + switch (expected.length) { + case 0: + expectedHumanized = "end of input"; + break; + case 1: + expectedHumanized = expected[0]; + break; + default: + expectedHumanized = expected.slice(0, expected.length - 1).join(", ") + + " or " + + expected[expected.length - 1]; + } + + foundHumanized = found ? quote(found) : "end of input"; + + return "Expected " + expectedHumanized + " but " + foundHumanized + " found."; + } + + this.name = "SyntaxError"; + this.expected = expected; + this.found = found; + this.message = buildMessage(expected, found); + this.offset = offset; + this.line = line; + this.column = column; + }; + + result.SyntaxError.prototype = Error.prototype; + + return result; +})(); + +dust.parse = parser.parse; + +})(typeof exports !== 'undefined' ? exports : getGlobal()); \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/docs/about.md b/node_modules/dustjs-linkedin/docs/about.md new file mode 100644 index 0000000..e0aae90 --- /dev/null +++ b/node_modules/dustjs-linkedin/docs/about.md @@ -0,0 +1,14 @@ +Why Dust? Why another templating engine when there are so many alternatives? Dust is based on the philosophy that an ideal templating environment should be: + ++ __Markup-like__: _A templating syntax should not encompass operations that are better left to a programming language_. Templates should make it easy to format content for presentation while keeping application logic where it belongs: in the application. ++ __Asynchronous__: Template helpers should be callable _asynchronously_ and in _parallel_ so that expensive operations (caching, deferred loading, filtering) can run as the template is being rendered. ++ __Streaming__: Templates should allow (but not require) data to be flushed to the output in user-defined chunks. ++ __Browser and server compatible__: Templates should render in both server and browser environments without hacks or extensive configuration. ++ __Storage agnostic__: _The templating engine should not impose a particular loading scheme_. Developers should be free to load templates via the filesystem, a database or an army of carrier pigeons. ++ __Composable__: Designers should be able to break presentation markup into manageable components and combine these components at runtime. _It should not be necessary to statically link templates or manually assemble 'layouts' inside application code._ ++ __Format agnostic__: While HTML generation and DOM manipulation are useful in specific instances, a general-purpose template system should not be tied to a particular output format. ++ __Precise__: The parser should be accurate enough that designers rarely have to use escape sequences to achieve the desired result. Similarly, templates shouldn't mysteriously generate or eliminate whitespace. ++ __Safe(r)__: At the very least, the engine should be configurable such that it is reasonably safe to render untrusted templates in a server environment. ++ __Fast__: Server-side templates cannot always be cached. Browser-side templates may be rendered on devices with limited system resources. _A template engine should be fast enough to render in real time without bottlenecking its environment_. + +If this list leaves you nodding your head in agreement you should [give Dust a try](http://akdubya.github.com/dustjs). \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/docs/api.md b/node_modules/dustjs-linkedin/docs/api.md new file mode 100644 index 0000000..c76d9af --- /dev/null +++ b/node_modules/dustjs-linkedin/docs/api.md @@ -0,0 +1,310 @@ +A pure JavaScript library, Dust is runs in both browser-side and server-side environments. Dust templates are compiled and then loaded where they are needed along with the runtime library. The library doesn't make any assumptions about how templates are loaded; you are free to integrate templating into your environment as you see fit. + +### Installation + +To run Dust within Node.js, first install via [npm](http://github.com/isaacs/npm): + + npm install dust + +Then, within your Node script or the REPL: + + var dust = require('dust'); + +This will import everything needed to parse, compile and render templates. To render Dust templates in the browser, grab the runtime distribution and include it in your script tags along with your compiled templates: + + + + +Include the full distribution if you want to compile templates within the browser (as in the online demo): + + + +Precompilation is the recommended approach for general use. + +### Compiling Templates + +Use `dust.compile` to compile a template body into a string of JavaScript source code: + + var compiled = dust.compile("Hello {name}!", "intro"); + +The variable `compiled` now contains the following string: + + '(function(){dust.register("intro",body_0) ...' + +If you save this source to a file and include the file in your HTML script tags, the compiled template will automatically register itself with the local runtime, under the name "intro". To evaluate a compiled template string manually, use `dust.loadSource`: + + dust.loadSource(compiled); + +The template is now available within the `dust.cache` object. + +### Rendering Templates + +The rendering engine provides both callback and streaming interfaces. + +#### The Callback Interface + +To render a template, call `dust.render` with the template name, a context object and a callback function: + + dust.render("intro", {name: "Fred"}, function(err, out) { + console.log(out); + }); + +The code above will write the following to the console: + + Hello Fred! + +#### The Streaming Interface + +Templates may also be streamed. `dust.stream` returns a handler very similar to a Node `EventEmitter`: + + dust.stream("index", context) + .on("data", function(data) { + console.log(data); + }) + .on("end", function() { + console.log("I'm finished!"); + }) + .on("error", function(err) { + console.log("Something terrible happened!"); + }); + +When used with specially crafted context handlers, the streaming interface provides chunked template rendering. + +### Contexts + +The context is a special object that handles variable lookups and controls template behavior. It is the interface between your application logic and your templates. The context can be visualized as a stack of objects that grows as we descend into nested sections: + + global --> { helper: function() { ... }, ... } + root --> { profile: { ... }, ... } + profile --> { friends: [ ... ], ... } + friends[0] --> { name: "Jorge", ... } + +When looking up a key, Dust searches the context stack from the bottom up. There is no need to merge helper functions into the template data; instead, create a base context onto which you can push your local template data: + + // Set up a base context with global helpers + var base = dust.makeBase({ + sayHello: function() { return "Hello!" } + }); + + // Push to the base context at render time + dust.render("index", base.push({foo: "bar"}), function(err, out) { + console.log(out); + }); + +Dust does not care how your reference objects are built. You may, for example, push prototyped objects onto the stack. The system leaves the `this` keyword intact when calling handler functions on your objects. + +### Handlers + +When Dust encounters a function in the context, it calls the function, passing in arguments that reflect the current state of the template. In the simplest case, a handler can pass a value back to the template engine: + + { + name: function() { + return "Bob"; + } + } + +#### Chunks + +But handlers can do much more than return values: they have complete control over the flow of the template, using the same API Dust uses internally. For example, the handler below writes a string directly to the current template chunk: + + { + name: function(chunk) { + return chunk.write("Bob"); + } + } + +A `Chunk` is a Dust primitive for controlling the flow of the template. Depending upon the behaviors defined in the context, templates may output one or more chunks during rendering. A handler that writes to a chunk directly must return the modified chunk. + +#### Accessing the Context + +Handlers have access to the context object: + + { + wrap: function(chunk, context) { + return chunk.write(context.get("foo")); + } + } + +`context.get("foo")` searches for _foo_ within the context stack. `context.current()` retrieves the value most recently pushed onto the context stack. + +#### Accessing Body Parameters + +The `bodies` object provides access to any bodies defined within the calling block. + + {#guide}foo{:else}bar{/guide} + +The template above will either render "foo" or "bar" depending on the behavior of the handler below: + + { + guide: function(chunk, context, bodies) { + if (secret === 42) { + return chunk.render(bodies.block, context); + } else { + return chunk.render(bodies['else'], context); + } + } + } + +`bodies.block` is a special parameter that returns the default (unnamed) block. `chunk.render` renders the chosen block. + +#### Accessing Inline Parameters + +The `params` object contains any inline parameters passed to a section tag: + + { + hello: function(chunk, context, bodies, params) { + if (params.greet === "true") { + return chunk.write("Hello!"); + } + return chunk; + } + } + +#### Asynchronous Handlers + +You may define handlers that execute asynchronously and in parallel: + + { + type: function(chunk) { + return chunk.map(function(chunk) { + setTimeout(function() { + chunk.end("Async"); + }); + }); + } + } + +`chunk.map` tells Dust to manufacture a new chunk, reserving a slot in the output stream before continuing on to render the rest of the template. You must (eventually) call `chunk.end()` on a mapped chunk to weave its content back into the stream. + +`chunk.map` provides a convenient way to split up templates rendered via `dust.stream`. For example, you might wrap the head of an HTML document in a special `{#head} ... {/head}` tag that is flushed to the browser before the rest of the body has finished rendering. + +### Reference + +#### Compiling + + dust.compile(source, name) + +Compiles `source` into a JavaScript template string. Registers itself under `name` when evaluated. + + dust.compileFn(source, [name]) + +Compiles `source` directly into a JavaScript function that takes a context and an optional callback (see `dust.renderSource`). Registers the template under `name` if this argument is supplied. + + dust.optimizers + +Object containing functions that transform the parse-tree before the template is compiled. To disable whitespace compression: + + dust.optimizers.format = function(ctx, node) { return node }; + +#### Loading + + dust.register(name, fn) + +Used internally to register template function `fn` with the runtime environment. Override to customize the way Dust caches templates. + + dust.onLoad(name, callback(err, out)) + +By default Dust returns a "template not found" error when a named template cannot be located in the cache. Override `onLoad` to specify a fallback loading mechanism (e.g., to load templates from the filesystem or a database). + + dust.loadSource(source, [filename]) + +Evaluates compiled `source` string. In Node.js, evaluates `source` as if it were loaded from `filename`. `filename` is optional. + +#### Rendering + + dust.render(name, context, callback(error, output)) + +Renders the named template and calls `callback` on completion. `context` may be a plain object or an instance of `dust.Context`. + + dust.stream(name, context) + +Streams the named template. `context` may be a plain object or an instance of `dust.Context`. Returns an instance of `dust.Stream`. + + stream.on("data", listener(data)) + stream.on("end", listener) + stream.on("error", listener(error)) + +Registers an event listener. Streams accept a single listener for a given event. + + dust.renderSource(source, context, [callback(error, output)]) + +Compiles and renders `source`, invoking `callback` on completion. If no callback is supplied this function returns a Stream object. Use this function when precompilation is not required. + +#### Contexts + + dust.makeBase(object) + +Manufactures a `dust.Context` instance with its global object set to `object`. + + context.get(key) + +Retrieves the value at `key` from the context stack. + + context.push(head, [index], [length]) + +Pushes an arbitrary value onto the context stack and returns a new context instance. Specify `index` and/or `length` to enable enumeration helpers. + + context.rebase(head) + +Returns a new context instance consisting only of the value at `head`, plus any previously defined global object. + + context.current() + +Returns the `head` of the context stack. + +#### Chunks + +The operations below always return a chunk object. + + chunk.write(data) + +Writes `data` to this chunk's buffer. + + chunk.map(callback(chunk)) + +Creates a new chunk and passes it to `callback`. Use `map` to wrap asynchronous functions and to partition the template for streaming. + + chunk.end(data) + +Writes `data` to this chunk's buffer and marks it as flushable. This method _must_ be called on any chunks created via `chunk.map`. Do _not_ call this method on a handler's main chunk -- `dust.render` and `dust.stream` take care of this for you. + + chunk.tap(callback) + chunk.untap() + +Convenience methods for applying filters to a stream. See the _filter_ demo for an example. + + chunk.render(body, context) + +Renders a template block, such as a default block or an `else` block. Basically equivalent to `body(chunk, context)`. + + chunk.setError(error) + +Sets an error on this chunk and immediately flushes the output. + + chunk.reference(elem, context, auto, filters) + chunk.section(elem, context, bodies, params) + chunk.exists(elem, context, bodies) + chunk.notexists(elem, context, bodies) + chunk.block(elem, context, bodies) + chunk.partial(elem, context) + chunk.helper(name, context, bodies, params) + +These methods implement Dust's default behavior for keys, sections, blocks, partials and context helpers. While it is unlikely you'll need to modify these methods or invoke them from within handlers, the source code may be a useful point of reference for developers. + +#### Utilities + + dust.filters + +Object containing built-in key filters. Can be customized with additional filters. + + dust.helpers + +Object containing the built-in context helpers. These may also be customized. + + dust.escapeHtml + +HTML escape function used by `dust.filters.h`. + + dust.escapeJs + +JavaScript string escape function used by `dust.filters.j`. \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/docs/build.js b/node_modules/dustjs-linkedin/docs/build.js new file mode 100644 index 0000000..2ea53a2 --- /dev/null +++ b/node_modules/dustjs-linkedin/docs/build.js @@ -0,0 +1,68 @@ +var path = require('path'), + fs = require('fs'), + Script = process.binding('evals').Script, + dust = require('../lib/dust'), + root = path.join(path.dirname(__filename), ".."); + +var src = fs.readFileSync(path.join(root, 'docs/index.dust.html'), 'utf8'); +dust.loadSource(dust.compile(src, "index")); + +var sd = process.compile(fs.readFileSync(path.join(root, 'vendor/showdown.js'), 'utf8'), 'showdown.js'); + +var inliners = { + css: function(names) { + var out = ""; + return out; + }, + + js: function(names) { + var out = ""; + return out; + } +} + +var context = { + inline: function(chk, ctx, bod, prm) { + var names = prm.names.split(' '); + return chk.write(inliners[prm.ext](names)); + }, + + tmpl: function(chk, ctx, bod, prm) { + var names = prm.names.split(' '); + var out = ""; + return chk.write(out); + }, + + md: function(chk, ctx, bod, prm) { + var converter = new sd(); + return chk.tap(function(data) { + return converter.makeHtml(data); + }).render(bod.block, ctx).untap(); + }, + + file: function(chk, ctx, bod, prm) { + var name = prm.name; + return chk.write(fs.readFileSync(path.join(root, 'docs', name), 'utf8')); + } +} + +function render() { + dust.render("index", context, function(err, output) { + if (err) throw err; + fs.writeFileSync(path.join(root, 'index.html'), output); + }); +} + +render(); \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/docs/index.css b/node_modules/dustjs-linkedin/docs/index.css new file mode 100644 index 0000000..81ca035 --- /dev/null +++ b/node_modules/dustjs-linkedin/docs/index.css @@ -0,0 +1,203 @@ +body { + font-family: 'Georgia', serif; + font-size: 18px; + margin: 0; + padding: 0; +} + +p, h4, h3, .content ul { + line-height: 26px; + margin-top: 26px; + margin-bottom: 26px; +} + +.content ul li { + margin-top: 13px; + margin-bottom: 13px; +} + +h1, h2 { + line-height: 48px; + font-size: 32px; + font-weight: normal; + margin: 8px 0 8px 2%; +} + +h3 { + font-size: 24px; +} + +h4 { + font-size: 1em; +} + +h1, h2, pre, code, .console, .status, #nav, #tagline { + font-family: 'Droid Sans Mono', 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Courier, monospace; +} + +a:link, a:visited { + color: #ef674a; +} + +p code { + font-size: 16px; + line-height: 16px; +} + +pre, .console { + background-color: #191919; + white-space: pre-wrap; + word-wrap: break-word; +} + +.console { + font-size: 16px; + height: 270px; + color: #dddddd; + margin-top: 26px; + margin-bottom: 26px; + border: 1px solid #888; + resize: auto; + overflow: auto; + padding: 2px; +} + +textarea { + width: 100%; + display: block; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; +} + +#nav { + position: fixed; + top: 18px; + right: 2%; + font-size: 22px; + z-index: 99; +} + +#nav a:link, #nav a:visited { + color: #eaf2d9; +} + +#nav a { + text-decoration: none; + margin-left: 17px; +} + +#nav a:last { + margin: 0; +} + +#tagline { + position: absolute; + display: none; + top: 24px; + font-size: 14px; +} + +#guide pre { + font-size: 16px; + line-height: 26px; + color: #dddddd; + padding: 26px; + margin: 26px 0; +} + +#header, #demo { + clear: both; +} + +.ok { + background-color: green; +} + +.error { + background-color: red; +} + +.pending { + background-color: yellow; +} + +.status { + font-size: 14px; + padding: 2px; + margin-top: -24px; +} + +.header, .content { + clear: both; + width: 100%; + overflow: hidden; + color: #ede6da; +} + +.header { + clear: both; + width: 100%; + -webkit-box-shadow: 0px 4px 6px hsla(0, 0%, 0%, 0.4); + -moz-box-shadow: 0px 4px 6px hsla(0, 0%, 0%, 0.4); + background-color: #581406; +} + +.content { + background-color: #2d2929; +} + +.left { + float: left; + width: 100%; + position: relative; + -webkit-box-shadow: 2px 0px 6px hsla(0, 0%, 0%, 0.4); + -moz-box-shadow: 2px 0px 6px hsla(0, 0%, 0%, 0.4); +} + +.content .left, .header .left { + right: 50%; +} + +.content .left { + background-color: #272121; +} + +.header, .col1, .col2 { + float: left; + position: relative; + overflow: hidden; +} + +.col1 { + width: 96%; + left: 2%; +} + +.left .header { + width: 100%; + left: 50%; +} + +.left .col1 { + width: 46%; + left: 52%; +} + +.left .col2 { + width: 46%; + left: 56%; +} + +.docked { + position: fixed; + width: 100%; + top: 0; + background-color: hsla(10, 87%, 18%, 0.80); + z-index: 5; +} + +code .keyword { font-weight: bold; color: #dd7522 } +code .string, code .regexp { color: #669933 } +code .class, code .special { } +code .number { color: #eddd3d } +code .comment { color: grey } \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/docs/index.dust.html b/node_modules/dustjs-linkedin/docs/index.dust.html new file mode 100644 index 0000000..897a20a --- /dev/null +++ b/node_modules/dustjs-linkedin/docs/index.dust.html @@ -0,0 +1,95 @@ + + + + dust + + + {#inline names="index" ext="css"/} + + + + + + + + + + + {#tmpl names="select"/} + {#inline names="index" ext="js"/} + + +
+
+
+

{~lb}dust{~rb}

+ asynchronous streaming templates for the browser and node.js +
+ +
+

1. Select a template or write your own:

+ +
Ready
+

2. The compiled template registers itself by name:

+
+

When you're done messing around have a look at the guide.

+
+
+

3. Control template behavior with contexts and helpers:

+ +
Ready
+

4. Render or stream the result:

+

+        
+
+
+
+
+
+

{~lb}guide{~rb}

+
+
+ {#md}{#file name="syntax.md"/}{/md} +
+
+ {#md}{#file name="api.md"/}{/md} +
+
+
+
+
+
+

{~lb}tests{~rb}

+
+
+

If the console below indicates an error then we have a problem.

+

+        
+
+

Interested in seeing how Dust stacks up against similar templating engines? Have a look at the live benchmarks.

+
+
+
+
+
+
+

{~lb}about{~rb}

+
+
+ {#md}{#file name="about.md"/}{/md} +
+
+

Dust was created by akdubya.

+

This page is powered by Dust, jQuery, showdown, beautify.js, jsDump and hijs. +

+
+
+ + + \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/docs/index.js b/node_modules/dustjs-linkedin/docs/index.js new file mode 100644 index 0000000..d1baaef --- /dev/null +++ b/node_modules/dustjs-linkedin/docs/index.js @@ -0,0 +1,181 @@ +jsDump.parsers['function'] = function(fn) { + return fn.toString(); +} + +function renderDemo() { + var tmpl = dust.cache["demo"], + source = $('#input-context').val(); + + $('#output-text').empty(); + + if (tmpl && source) { + setPending('#input-context'); + setPending('#output-text'); + try { + eval("var context = " + source + ";"); + if (typeof context === 'function') { + context = context(); + } + dust.stream("demo", context) + .on('data', function(data) { + $('#output-text').append(dust.escapeHtml(data)); + }) + .on('end', function() { + setOkay('#input-context'); + setOkay('#output-text'); + }) + .on('error', function(err) { + setError('#input-context', err); + }); + } catch(err) { + setError('#input-context', err); + } + } +} + +function setOkay(sel) { + $(sel).next() + .removeClass('pending') + .addClass('ok') + .html('Ready'); +} + +function setPending(sel) { + $(sel).next() + .removeClass('ok') + .removeClass('error') + .addClass('pending') + .html('Pending'); +} + +function setError(sel, err) { + $(sel).next() + .removeClass('pending') + .addClass('error') + .html(err.toString()); +} + +function dump(obj) { + return js_beautify(jsDump.parse(obj), { + indent_size: 2 + }); +} + +function runSuite() { + var suite = new uutest.Suite({ + start: function() { + $('#test-console').empty(); + }, + pass: function() { + $('#test-console').append("."); + }, + fail: function() { + $('#test-console').append("F"); + }, + done: function(passed, failed, elapsed) { + $('#test-console').append("\n"); + $('#test-console').append(passed + " passed " + failed + " failed " + "(" + elapsed + "ms)"); + this.errors.forEach(function(err) { + $('#test-console').append("\n"); + $('#test-console').append(dust.escapeHtml(dumpError(err))); + }); + } + }); + coreSetup(suite, dustExamples.slice(1), dust); + suite.run(); +} + +function dumpError(err) { + var out = err.testName + " -> "; + if (!err.message) { + err.message = jsDump.parse(err.expected) + + " " + err.operator + " " + jsDump.parse(err.actual); + } + return out + err.stack; +} + +$(document).ready(function() { + + dustExamples.forEach(function(ex) { + dust.loadSource(dust.compile(ex.source, ex.name)); + }); + + runSuite(); + + $('#tagline').empty().show().css({left: ($(window).width() * .02) + 125}); + dust.loadSource(dust.compile(dustExamples[0].source, "intro")); + dust.stream("intro", dustExamples[0].context()) + .on('data', function(data) { + $('#tagline').append(data); + }) + .on('end', function() { + $('#tagline').delay(500).fadeOut('slow'); + }); + + dust.render("select", { + examples: dustExamples, + selected: function(chk, ctx) { + if (ctx.current().name === "replace") return "selected"; + } + }, function(err, output) { + $('#select').html(output); + }); + + $('#select > select').change(function() { + var idx = $(this).val(); + $('#input-source').val(dustExamples[idx].source); + $('#input-context').val(dump(dustExamples[idx].context)); + $('#input-source').change(); + }); + + $('#input-source').change(function() { + setPending('#input-source'); + try { + var compiled = dust.compile($(this).val(), "demo"); + dust.loadSource(compiled); + $('#output-js').text(js_beautify(compiled, { + indent_size: 2 + })); + setOkay('#input-source'); + } catch(err) { + setError('#input-source', err); + return; + } + renderDemo(); + }); + + $('#input-context').change(renderDemo); + + var sections = $("body > div"); + var cur_id; + + $(window).scroll(function() { + var scrollTop = $(window).scrollTop(); + + if (scrollTop === 0) { + cur_id = undefined; + $('.docked').remove(); + return; + } + + sections.each(function(idx, section) { + var sectionTop = section.offsetTop, + sectionBottom = sectionTop + section.offsetHeight; + + if (scrollTop >= sectionTop && scrollTop < sectionBottom) { + var $hdr = $(section).find('.header').clone(); + if (section.id !== cur_id) { + cur_id = section.id; + $('.docked').remove(); + $hdr.appendTo('body'); + $hdr.addClass('docked'); + } + return false; + } + }); + }); + + $('#select > select').change(); + $(window).scroll(); + +}); \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/docs/select.dust.html b/node_modules/dustjs-linkedin/docs/select.dust.html new file mode 100644 index 0000000..130f384 --- /dev/null +++ b/node_modules/dustjs-linkedin/docs/select.dust.html @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/docs/syntax.md b/node_modules/dustjs-linkedin/docs/syntax.md new file mode 100644 index 0000000..cef4423 --- /dev/null +++ b/node_modules/dustjs-linkedin/docs/syntax.md @@ -0,0 +1,286 @@ +Dust is a JavaScript templating engine designed to provide a clean separation between presentation and logic without sacrificing ease of use. It is particularly well-suited for asynchronous and streaming applications. + +### Syntax + +Dust templates use two types of tags: _keys_ and _sections_. Keys reference fields within the current view context. You can think of them as placeholders that allow the context to insert data into the template. Sections accept template blocks that may be enumerated, filtered or transformed in various ways. + +### Keys + +To reference a key from the view context within the template, enclose the key in curly braces. For example, given the template below: + + Hello {name}! + +And the following view context: + + { name: "Fred" } + +The resulting output would be: + + Hello Fred! + +If the _name_ key cannot be found in the view, Dust outputs an empty string: + + Hello ! + +Generally, Dust casts whatever values it finds to strings. If Dust encounters a handler function it calls the function, passing in the current state of the template. + +#### Filters + +By default, the content of all key tags is HTML escaped, so assuming the _name_ key above resolves to a dangerous script tag: + + + +This would be rendered as: + + <script>alert('I am evil!')</script> + +To disable auto-escaping, append a pipe character '|' and an 's' to the end of the tag identifier, like so: + + Hello {name|s} + +There are several other built-in filters: `h` forces HTML escaping, `j` escapes JavaScript strings, `u` proxies to JavaScript's built-in `encodeURI`, and `uc` proxies to JavaScript's `encodeURIComponent`. Filters can also be chained together like so: + + Hello {name|s|h|u} + +When chained in this manner, filters are applied from left to right. Filters do not accept arguments; if you need more sophisticated behavior use a section tag instead. + +### Sections + +Keys are fine for simple lookups, but suppose the view context contains a _friends_ field which resolves to an array of objects containing _name_ and _age_ fields. This is where section tags are useful. + + {#friends} + {name}, {age}{~n} + {/friends} + +Here, the section begins with `{#friends}` and ends with `{/friends}`. Dust's default behavior is to enumerate over the array, passing each object in the array to the block. With a the following view context: + + { + friends: [ + { name: "Moe", age: 37 }, + { name: "Larry", age: 39 }, + { name: "Curly", age: 35 } + ] + } + +The output is as one might expect: + + Moe, 37 + Larry, 39 + Curly, 35 + +When _friends_ resolves to a value or object instead of an array, Dust sets the current context to the value and renders the block one time. If _friends_ resolves to a custom handler function, the function is given control over the section's behavior. + +Dust outputs nothing if the friends key is empty or nonexistent. Let's change that by inserting an `{:else}` tag, which tells Dust to render an alternate template block when a section key resolves to a falsy value: + + {#friends} + {name}, {age}{~n} + {:else} + You have no friends! + {/friends} + +Now when the friends key is empty or nonexistent we get the following: + + You have no friends! + +Internally, Dust builds a stack of contexts as templates delve deeper into nested sections. If a key is not found within the current context, Dust looks for the key within the parent context, and its parent, and so on. + +Self-closing section tags are allowed, so the template code below is permissible (although in this case it won't render anything): + + {#friends/} + +#### Paths + +Paths allow you to reference keys relative to the current context. + + {#names}{.} {/names} + +The dot notation above lets the template reference the current context implicitly, so given an array of strings: + + { names: ["Moe", "Larry", "Curly"] } + +The template block outputs each string in the array. + + Moe Larry Curly + +Paths can also be used to reach into nested contexts: + + {foo.bar} + +Or to constrain lookups to the current section scope: + + {.foo} + +To avoid brittle and confusing references, paths never backtrack up the context stack. If you need to drill into a key available within the parent context, pass the key as a parameter. + +#### Inline Parameters + +Inline parameters appear within the section's opening tag. Parameters are separated by a single space. By default, inline parameters merge values into the section's view context: + + {#profile bar="baz" bing="bong"} + {name}, {bar}, {bing} + {/profile} + +Assuming _name_ within the profile section resolves to "Fred", the output would be: + + Fred, baz, bong + +Inline parameters may be used to alias keys that conflict between parent and child contexts: + + {name}{~n} + {#profile root_name=name} + {name}, {root_name} + {/profile} + +Note here that we're passing in a key rather than a string literal. If the context is as follows: + + { + name: "Foo", + profile: { + name: "Bar" + } + } + +The output will be: + + Foo + Bar, Foo + +Parameters accept interpolated string literals as values: + + {#snippet id="{name}_id"/} + +#### Body Parameters + +Unlike inline parameters, which modify the context, body parameters pass named template blocks to handler functions. Body parameters are useful for implementing striping or other complex behaviors that might otherwise involve manually assembling strings within your view functions. The only body parameter with default behavior is the `{:else}` tag as seen above. + +#### Contexts + +Normally, upon encountering a section tag Dust merges the section's context with the parent context. Sometimes it can be useful to manually set the context provided to a section. Sections accept a context argument for this purpose: + + {#list:projects}{name}{/list} + +Here, we're providing an array of _projects_ to the _list_ section, which might be a special helper defined on the view. If _list_ is not a function but some other value instead, its parent context is simply set to _projects_. + +#### Special Sections + +In addition to the standard hashed (`#`) section tag, Dust provides a few section tags with special semantics, namely the _exists_ tag (`?`), the _notexists_ tag (`^`), and the context helpers tag (`@`). These tags make it easier to work with plain JSON data without additional helpers. + +The exists and notexists sections check for the existence (in the falsy sense) of a key within the current context. They do not alter the current context, making it possible to, for instance, check that an array is non-empty before wrapping it in HTML list tags: + + {?tags} +
    + {#tags} +
  • {.}
  • + {/tags} +
+ {:else} + No Tags! + {/tags} + +Unlike regular sections, conditional sections do not evaluate functions defined on the view. In those cases you'll still have to write your own handlers. + +The context helpers tag provides a couple of convenience functions to support iteration. The `sep` tag prints the enclosed block for every value except for the last. The `idx` tag passes the numerical index of the current element to the enclosed block. + + {#names}{.}{@idx}{.}{/idx}{@sep}, {/sep}{/names} + +The template above might output something like: + + Moe0, Larry1, Curly2 + +### Partials + +Partials, also known as template includes, allow you to compose templates at runtime. + + {>profile/} + +The block above looks for a template named "profile" and inserts its output into the parent template. Like sections, partials inherit the current context. And like sections, partials accept a context argument: + + {>profile:user/} + +Partial tags also accept string literals and interpolated string literals as keys: + + {>"path/to/comments.dust.html"/} + {>"posts/{type}.dust.html"/} + + This is useful when you're retrieving templates from the filesystem and the template names wouldn't otherwise be valid identifiers, or when selecting templates dynamically based on information from the view context. + +### Blocks and Inline Partials + +Often you'll want to have a template inherit the bulk of its content from a common base template. Dust solves this problem via blocks and inline partials. When placed within a template, blocks allow you to define snippets of template code that may be overriden by any templates that reference this template: + + Start{~n} + {+title} + Base Title + {/title} + {~n} + {+main} + Base Content + {/main} + {~n} + End + +Notice the special syntax for blocks: `{+block} ... {/block}`. When this template is rendered standalone, Dust simply renders the content within the blocks: + + Start + Base Title + Base Content + End + +But when the template is invoked from another template that contains inline partial tags (`{base_template/} + {base_template/} + {:else} + {+main/} + {/xhr} + {dust

{dust}

asynchronous streaming templates for the browser and node.js

1. Select a template or write your own:

Ready

2. The compiled template registers itself by name:

When you're done messing around have a look at the guide.

3. Control template behavior with contexts and helpers:

Ready

4. Render or stream the result:

{guide}

Dust is a JavaScript templating engine designed to provide a clean separation between presentation and logic without sacrificing ease of use. It is particularly well-suited for asynchronous and streaming applications.

+ +

Syntax

+ +

Dust templates use two types of tags: keys and sections. Keys reference fields within the current view context. You can think of them as placeholders that allow the context to insert data into the template. Sections accept template blocks that may be enumerated, filtered or transformed in various ways.

+ +

Keys

+ +

To reference a key from the view context within the template, enclose the key in curly braces. For example, given the template below:

+ +
Hello {name}!
+
+ +

And the following view context:

+ +
{ name: "Fred" }
+
+ +

The resulting output would be:

+ +
Hello Fred!
+
+ +

If the name key cannot be found in the view, Dust outputs an empty string:

+ +
Hello !
+
+ +

Generally, Dust casts whatever values it finds to strings. If Dust encounters a handler function it calls the function, passing in the current state of the template.

+ +

Filters

+ +

By default, the content of all key tags is HTML escaped, so assuming the name key above resolves to a dangerous script tag:

+ +
<script>alert('I am evil!')</script>
+
+ +

This would be rendered as:

+ +
&lt;script&gt;alert('I am evil!')&lt;/script&gt;
+
+ +

To disable auto-escaping, append a pipe character '|' and an 's' to the end of the tag identifier, like so:

+ +
Hello {name|s}
+
+ +

There are several other built-in filters: h forces HTML escaping, j escapes JavaScript strings, u proxies to JavaScript's built-in encodeURI, and uc proxies to JavaScript's encodeURIComponent. Filters can also be chained together like so:

+ +
Hello {name|s|h|u}
+
+ +

When chained in this manner, filters are applied from left to right. Filters do not accept arguments; if you need more sophisticated behavior use a section tag instead.

+ +

Sections

+ +

Keys are fine for simple lookups, but suppose the view context contains a friends field which resolves to an array of objects containing name and age fields. This is where section tags are useful.

+ +
{#friends}
+  {name}, {age}{~n}
+{/friends}
+
+ +

Here, the section begins with {#friends} and ends with {/friends}. Dust's default behavior is to enumerate over the array, passing each object in the array to the block. With a the following view context:

+ +
{
+  friends: [
+    { name: "Moe", age: 37 },
+    { name: "Larry", age: 39 },
+    { name: "Curly", age: 35 }
+  ]
+}
+
+ +

The output is as one might expect:

+ +
Moe, 37
+Larry, 39
+Curly, 35
+
+ +

When friends resolves to a value or object instead of an array, Dust sets the current context to the value and renders the block one time. If friends resolves to a custom handler function, the function is given control over the section's behavior.

+ +

Dust outputs nothing if the friends key is empty or nonexistent. Let's change that by inserting an {:else} tag, which tells Dust to render an alternate template block when a section key resolves to a falsy value:

+ +
{#friends}
+  {name}, {age}{~n}
+{:else}
+  You have no friends!
+{/friends}
+
+ +

Now when the friends key is empty or nonexistent we get the following:

+ +
You have no friends!
+
+ +

Internally, Dust builds a stack of contexts as templates delve deeper into nested sections. If a key is not found within the current context, Dust looks for the key within the parent context, and its parent, and so on.

+ +

Self-closing section tags are allowed, so the template code below is permissible (although in this case it won't render anything):

+ +
{#friends/}
+
+ +

Paths

+ +

Paths allow you to reference keys relative to the current context.

+ +
{#names}{.} {/names}
+
+ +

The dot notation above lets the template reference the current context implicitly, so given an array of strings:

+ +
{ names: ["Moe", "Larry", "Curly"] }
+
+ +

The template block outputs each string in the array.

+ +
Moe Larry Curly 
+
+ +

Paths can also be used to reach into nested contexts:

+ +
{foo.bar}
+
+ +

Or to constrain lookups to the current section scope:

+ +
{.foo}
+
+ +

To avoid brittle and confusing references, paths never backtrack up the context stack. If you need to drill into a key available within the parent context, pass the key as a parameter.

+ +

Inline Parameters

+ +

Inline parameters appear within the section's opening tag. Parameters are separated by a single space. By default, inline parameters merge values into the section's view context:

+ +
{#profile bar="baz" bing="bong"}
+  {name}, {bar}, {bing}
+{/profile}
+
+ +

Assuming name within the profile section resolves to "Fred", the output would be:

+ +
Fred, baz, bong
+
+ +

Inline parameters may be used to alias keys that conflict between parent and child contexts:

+ +
{name}{~n}
+{#profile root_name=name}
+  {name}, {root_name}
+{/profile}
+
+ +

Note here that we're passing in a key rather than a string literal. If the context is as follows:

+ +
{
+  name: "Foo",
+  profile: {
+    name: "Bar"
+  }
+}
+
+ +

The output will be:

+ +
Foo
+Bar, Foo
+
+ +

Parameters accept interpolated string literals as values:

+ +
{#snippet id="{name}_id"/}
+
+ +

Body Parameters

+ +

Unlike inline parameters, which modify the context, body parameters pass named template blocks to handler functions. Body parameters are useful for implementing striping or other complex behaviors that might otherwise involve manually assembling strings within your view functions. The only body parameter with default behavior is the {:else} tag as seen above.

+ +

Contexts

+ +

Normally, upon encountering a section tag Dust merges the section's context with the parent context. Sometimes it can be useful to manually set the context provided to a section. Sections accept a context argument for this purpose:

+ +
{#list:projects}{name}{/list}
+
+ +

Here, we're providing an array of projects to the list section, which might be a special helper defined on the view. If list is not a function but some other value instead, its parent context is simply set to projects.

+ +

Special Sections

+ +

In addition to the standard hashed (#) section tag, Dust provides a few section tags with special semantics, namely the exists tag (?), the notexists tag (^), and the context helpers tag (@). These tags make it easier to work with plain JSON data without additional helpers.

+ +

The exists and notexists sections check for the existence (in the falsy sense) of a key within the current context. They do not alter the current context, making it possible to, for instance, check that an array is non-empty before wrapping it in HTML list tags:

+ +
{?tags}
+  <ul>
+    {#tags}
+      <li>{.}</li>
+    {/tags}
+  </ul>
+{:else}
+  No Tags!
+{/tags}
+
+ +

Unlike regular sections, conditional sections do not evaluate functions defined on the view. In those cases you'll still have to write your own handlers.

+ +

The context helpers tag provides a couple of convenience functions to support iteration. The sep tag prints the enclosed block for every value except for the last. The idx tag passes the numerical index of the current element to the enclosed block.

+ +
{#names}{.}{@idx}{.}{/idx}{@sep}, {/sep}{/names}
+
+ +

The template above might output something like:

+ +
Moe0, Larry1, Curly2
+
+ +

Partials

+ +

Partials, also known as template includes, allow you to compose templates at runtime.

+ +
{>profile/}
+
+ +

The block above looks for a template named "profile" and inserts its output into the parent template. Like sections, partials inherit the current context. And like sections, partials accept a context argument:

+ +
{>profile:user/}
+
+ +

Partial tags also accept string literals and interpolated string literals as keys:

+ +
{>"path/to/comments.dust.html"/}
+{>"posts/{type}.dust.html"/}
+
+ +

This is useful when you're retrieving templates from the filesystem and the template names wouldn't otherwise be valid identifiers, or when selecting templates dynamically based on information from the view context.

+ +

Blocks and Inline Partials

+ +

Often you'll want to have a template inherit the bulk of its content from a common base template. Dust solves this problem via blocks and inline partials. When placed within a template, blocks allow you to define snippets of template code that may be overriden by any templates that reference this template:

+ +
Start{~n}
+{+title}
+  Base Title
+{/title}
+{~n}
+{+main}
+  Base Content
+{/main}
+{~n}
+End
+
+ +

Notice the special syntax for blocks: {+block} ... {/block}. When this template is rendered standalone, Dust simply renders the content within the blocks:

+ +
Start
+Base Title
+Base Content
+End
+
+ +

But when the template is invoked from another template that contains inline partial tags ({<snippet} ... {/snippet}):

+ +
{>base_template/}
+{<title}
+  Child Title
+{/title}
+{<main}
+  Child Content
+{/main}
+
+ +

Dust overrides the block contents of the base template:

+ +
Start
+Child Title
+Child Content
+End
+
+ +

A block may be self-closing ({+block/}), in which case it is not displayed unless a calling template overrides the content of the block. Inline partials never output content themselves, and are always global to the template in which they are defined, so the order of their definition has no significance. They are passed to all templates invoked by the template in which they are defined.

+ +

Note that blocks can be used to render inline partials that are defined within the same template. This is useful when you want to use the same template to serve AJAX requests and regular requests:

+ +
{^xhr}
+  {>base_template/}
+{:else}
+  {+main/}
+{/xhr}
+{<title}
+  Child Title
+{/title}
+{<main}
+  Child Content
+{/main}
+
+ +

Static Text

+ +

The Dust parser is finely tuned to minimize the amount of escaping that needs to be done within static text. Any text that does not closely resemble a Dust tag is considered static and will be passed through untouched to the template's output. This makes Dust suitable for use in templating many different formats. In order to be recognized as such, Dust tags should not contain extraneous whitespace and newlines.

+ +

Special Characters

+ +

Depending on whitespace and delimeter settings, it is sometimes necessary to include escape tags within static text. Escape tags begin with a tilde (~), followed by a key identifying the desired escape sequence. Currently newline (n), carriage return (r), space (s), left brace (lb) and right brace (rb) are supported. For example:

+ +
Hello World!{~n}
+
+ +

Inserts a newline after the text. By default, Dust compresses whitespace by eliminating newlines and indentation. This behavior can be toggled at compile time.

+ +

Comments

+ +

Comments, which do not appear in template output, begin and end with a bang (!):

+ +
{!
+  Multiline
+  {#foo}{bar}{/foo}
+!}
+{!before!}Hello{!after!}
+
+ +

The template above would render as follows:

+ +
Hello
+

A pure JavaScript library, Dust is runs in both browser-side and server-side environments. Dust templates are compiled and then loaded where they are needed along with the runtime library. The library doesn't make any assumptions about how templates are loaded; you are free to integrate templating into your environment as you see fit.

+ +

Installation

+ +

To run Dust within Node.js, first install via npm:

+ +
npm install dust
+
+ +

Then, within your Node script or the REPL:

+ +
var dust = require('dust');
+
+ +

This will import everything needed to parse, compile and render templates. To render Dust templates in the browser, grab the runtime distribution and include it in your script tags along with your compiled templates:

+ +
<script src="dust-core-0.3.0.min.js"></script>
+<script src="compiled_templates.js"></script>
+
+ +

Include the full distribution if you want to compile templates within the browser (as in the online demo):

+ +
<script src="dust-full-0.3.0.min.js"></script>
+
+ +

Precompilation is the recommended approach for general use.

+ +

Compiling Templates

+ +

Use dust.compile to compile a template body into a string of JavaScript source code:

+ +
var compiled = dust.compile("Hello {name}!", "intro");
+
+ +

The variable compiled now contains the following string:

+ +
'(function(){dust.register("intro",body_0) ...'
+
+ +

If you save this source to a file and include the file in your HTML script tags, the compiled template will automatically register itself with the local runtime, under the name "intro". To evaluate a compiled template string manually, use dust.loadSource:

+ +
dust.loadSource(compiled);
+
+ +

The template is now available within the dust.cache object.

+ +

Rendering Templates

+ +

The rendering engine provides both callback and streaming interfaces.

+ +

The Callback Interface

+ +

To render a template, call dust.render with the template name, a context object and a callback function:

+ +
dust.render("intro", {name: "Fred"}, function(err, out) {
+  console.log(out);
+});
+
+ +

The code above will write the following to the console:

+ +
Hello Fred!
+
+ +

The Streaming Interface

+ +

Templates may also be streamed. dust.stream returns a handler very similar to a Node EventEmitter:

+ +
dust.stream("index", context)
+    .on("data", function(data) {
+      console.log(data);
+    })
+    .on("end", function() {
+      console.log("I'm finished!");
+    })
+    .on("error", function(err) {
+      console.log("Something terrible happened!");
+    });
+
+ +

When used with specially crafted context handlers, the streaming interface provides chunked template rendering.

+ +

Contexts

+ +

The context is a special object that handles variable lookups and controls template behavior. It is the interface between your application logic and your templates. The context can be visualized as a stack of objects that grows as we descend into nested sections:

+ +
global     --> { helper: function() { ... }, ... }
+root       --> { profile: { ... }, ... }
+profile    --> { friends: [ ... ], ... }
+friends[0] --> { name: "Jorge", ... }
+
+ +

When looking up a key, Dust searches the context stack from the bottom up. There is no need to merge helper functions into the template data; instead, create a base context onto which you can push your local template data:

+ +
// Set up a base context with global helpers
+var base = dust.makeBase({
+  sayHello: function() { return "Hello!" }
+});
+
+// Push to the base context at render time
+dust.render("index", base.push({foo: "bar"}), function(err, out) {
+  console.log(out);
+});
+
+ +

Dust does not care how your reference objects are built. You may, for example, push prototyped objects onto the stack. The system leaves the this keyword intact when calling handler functions on your objects.

+ +

Handlers

+ +

When Dust encounters a function in the context, it calls the function, passing in arguments that reflect the current state of the template. In the simplest case, a handler can pass a value back to the template engine:

+ +
{
+  name: function() {
+    return "Bob";
+  }
+}
+
+ +

Chunks

+ +

But handlers can do much more than return values: they have complete control over the flow of the template, using the same API Dust uses internally. For example, the handler below writes a string directly to the current template chunk:

+ +
{
+  name: function(chunk) {
+    return chunk.write("Bob");
+  }
+}
+
+ +

A Chunk is a Dust primitive for controlling the flow of the template. Depending upon the behaviors defined in the context, templates may output one or more chunks during rendering. A handler that writes to a chunk directly must return the modified chunk.

+ +

Accessing the Context

+ +

Handlers have access to the context object:

+ +
{
+  wrap: function(chunk, context) {
+    return chunk.write(context.get("foo"));
+  }
+}
+
+ +

context.get("foo") searches for foo within the context stack. context.current() retrieves the value most recently pushed onto the context stack.

+ +

Accessing Body Parameters

+ +

The bodies object provides access to any bodies defined within the calling block.

+ +
{#guide}foo{:else}bar{/guide}
+
+ +

The template above will either render "foo" or "bar" depending on the behavior of the handler below:

+ +
{
+  guide: function(chunk, context, bodies) {
+    if (secret === 42) {
+      return chunk.render(bodies.block, context);
+    } else {
+      return chunk.render(bodies['else'], context);
+    }
+  }
+}
+
+ +

bodies.block is a special parameter that returns the default (unnamed) block. chunk.render renders the chosen block.

+ +

Accessing Inline Parameters

+ +

The params object contains any inline parameters passed to a section tag:

+ +
{
+  hello: function(chunk, context, bodies, params) {
+    if (params.greet === "true") {
+      return chunk.write("Hello!");
+    }
+    return chunk;
+  }
+}
+
+ +

Asynchronous Handlers

+ +

You may define handlers that execute asynchronously and in parallel:

+ +
{
+  type: function(chunk) {
+    return chunk.map(function(chunk) {
+      setTimeout(function() {
+        chunk.end("Async");
+      });
+    });
+  }
+}
+
+ +

chunk.map tells Dust to manufacture a new chunk, reserving a slot in the output stream before continuing on to render the rest of the template. You must (eventually) call chunk.end() on a mapped chunk to weave its content back into the stream.

+ +

chunk.map provides a convenient way to split up templates rendered via dust.stream. For example, you might wrap the head of an HTML document in a special {#head} ... {/head} tag that is flushed to the browser before the rest of the body has finished rendering.

+ +

Reference

+ +

Compiling

+ +
dust.compile(source, name)
+
+ +

Compiles source into a JavaScript template string. Registers itself under name when evaluated.

+ +
dust.compileFn(source, [name])
+
+ +

Compiles source directly into a JavaScript function that takes a context and an optional callback (see dust.renderSource). Registers the template under name if this argument is supplied.

+ +
dust.optimizers
+
+ +

Object containing functions that transform the parse-tree before the template is compiled. To disable whitespace compression:

+ +
dust.optimizers.format = function(ctx, node) { return node };
+
+ +

Loading

+ +
dust.register(name, fn)
+
+ +

Used internally to register template function fn with the runtime environment. Override to customize the way Dust caches templates.

+ +
dust.onLoad(name, callback(err, out))
+
+ +

By default Dust returns a "template not found" error when a named template cannot be located in the cache. Override onLoad to specify a fallback loading mechanism (e.g., to load templates from the filesystem or a database).

+ +
dust.loadSource(source, [filename])
+
+ +

Evaluates compiled source string. In Node.js, evaluates source as if it were loaded from filename. filename is optional.

+ +

Rendering

+ +
dust.render(name, context, callback(error, output))
+
+ +

Renders the named template and calls callback on completion. context may be a plain object or an instance of dust.Context.

+ +
dust.stream(name, context)
+
+ +

Streams the named template. context may be a plain object or an instance of dust.Context. Returns an instance of dust.Stream.

+ +
stream.on("data", listener(data))
+stream.on("end", listener)
+stream.on("error", listener(error))
+
+ +

Registers an event listener. Streams accept a single listener for a given event.

+ +
dust.renderSource(source, context, [callback(error, output)])
+
+ +

Compiles and renders source, invoking callback on completion. If no callback is supplied this function returns a Stream object. Use this function when precompilation is not required.

+ +

Contexts

+ +
dust.makeBase(object)
+
+ +

Manufactures a dust.Context instance with its global object set to object.

+ +
context.get(key)
+
+ +

Retrieves the value at key from the context stack.

+ +
context.push(head, [index], [length])
+
+ +

Pushes an arbitrary value onto the context stack and returns a new context instance. Specify index and/or length to enable enumeration helpers.

+ +
context.rebase(head)
+
+ +

Returns a new context instance consisting only of the value at head, plus any previously defined global object.

+ +
context.current()
+
+ +

Returns the head of the context stack.

+ +

Chunks

+ +

The operations below always return a chunk object.

+ +
chunk.write(data)
+
+ +

Writes data to this chunk's buffer.

+ +
chunk.map(callback(chunk))
+
+ +

Creates a new chunk and passes it to callback. Use map to wrap asynchronous functions and to partition the template for streaming.

+ +
chunk.end(data)
+
+ +

Writes data to this chunk's buffer and marks it as flushable. This method must be called on any chunks created via chunk.map. Do not call this method on a handler's main chunk -- dust.render and dust.stream take care of this for you.

+ +
chunk.tap(callback)
+chunk.untap()
+
+ +

Convenience methods for applying filters to a stream. See the filter demo for an example.

+ +
chunk.render(body, context)
+
+ +

Renders a template block, such as a default block or an else block. Basically equivalent to body(chunk, context).

+ +
chunk.setError(error)
+
+ +

Sets an error on this chunk and immediately flushes the output.

+ +
chunk.reference(elem, context, auto, filters)
+chunk.section(elem, context, bodies, params)
+chunk.exists(elem, context, bodies)
+chunk.notexists(elem, context, bodies)
+chunk.block(elem, context, bodies)
+chunk.partial(elem, context)
+chunk.helper(name, context, bodies, params)
+
+ +

These methods implement Dust's default behavior for keys, sections, blocks, partials and context helpers. While it is unlikely you'll need to modify these methods or invoke them from within handlers, the source code may be a useful point of reference for developers.

+ +

Utilities

+ +
dust.filters
+
+ +

Object containing built-in key filters. Can be customized with additional filters.

+ +
dust.helpers
+
+ +

Object containing the built-in context helpers. These may also be customized.

+ +
dust.escapeHtml
+
+ +

HTML escape function used by dust.filters.h.

+ +
dust.escapeJs
+
+ +

JavaScript string escape function used by dust.filters.j.

{tests}

If the console below indicates an error then we have a problem.

Interested in seeing how Dust stacks up against similar templating engines? Have a look at the live benchmarks.

{about}

Why Dust? Why another templating engine when there are so many alternatives? Dust is based on the philosophy that an ideal templating environment should be:

+ +
    +
  • Markup-like: A templating syntax should not encompass operations that are better left to a programming language. Templates should make it easy to format content for presentation while keeping application logic where it belongs: in the application.
  • +
  • Asynchronous: Template helpers should be callable asynchronously and in parallel so that expensive operations (caching, deferred loading, filtering) can run as the template is being rendered.
  • +
  • Streaming: Templates should allow (but not require) data to be flushed to the output in user-defined chunks.
  • +
  • Browser and server compatible: Templates should render in both server and browser environments without hacks or extensive configuration.
  • +
  • Storage agnostic: The templating engine should not impose a particular loading scheme. Developers should be free to load templates via the filesystem, a database or an army of carrier pigeons.
  • +
  • Composable: Designers should be able to break presentation markup into manageable components and combine these components at runtime. It should not be necessary to statically link templates or manually assemble 'layouts' inside application code.
  • +
  • Format agnostic: While HTML generation and DOM manipulation are useful in specific instances, a general-purpose template system should not be tied to a particular output format.
  • +
  • Precise: The parser should be accurate enough that designers rarely have to use escape sequences to achieve the desired result. Similarly, templates shouldn't mysteriously generate or eliminate whitespace.
  • +
  • Safe(r): At the very least, the engine should be configurable such that it is reasonably safe to render untrusted templates in a server environment.
  • +
  • Fast: Server-side templates cannot always be cached. Browser-side templates may be rendered on devices with limited system resources. A template engine should be fast enough to render in real time without bottlenecking its environment.
  • +
+ +

If this list leaves you nodding your head in agreement you should give Dust a try.

Dust was created by akdubya.

This page is powered by Dust, jQuery, showdown, beautify.js, jsDump and hijs.

\ No newline at end of file diff --git a/node_modules/dustjs-linkedin/lib/compiler.js b/node_modules/dustjs-linkedin/lib/compiler.js new file mode 100644 index 0000000..f0fd40d --- /dev/null +++ b/node_modules/dustjs-linkedin/lib/compiler.js @@ -0,0 +1,335 @@ +(function(dust) { + +dust.compile = function(source, name) { + try { + var ast = filterAST(dust.parse(source)); + return compile(ast, name); + } + catch(err) + { + if(!err.line || !err.column) throw err; + throw new SyntaxError(err.message + " At line : " + err.line + ", column : " + err.column); + } +}; + +function filterAST(ast) { + var context = {}; + return dust.filterNode(context, ast); +} + +dust.filterNode = function(context, node) { + return dust.optimizers[node[0]](context, node); +} + +dust.optimizers = { + body: compactBuffers, + buffer: noop, + special: convertSpecial, + format: nullify, // TODO: convert format + reference: visit, + "#": visit, + "?": visit, + "^": visit, + "<": visit, + "+": visit, + "@": visit, + "%": visit, + partial: visit, + context: visit, + params: visit, + bodies: visit, + param: visit, + filters: noop, + key: noop, + path: noop, + literal: noop, + comment: nullify +} + +dust.pragmas = { + esc: function(compiler, context, bodies, params) { + var old = compiler.auto; + if (!context) context = 'h'; + compiler.auto = (context === 's') ? '' : context; + var out = compileParts(compiler, bodies.block); + compiler.auto = old; + return out; + } +} + +function visit(context, node) { + var out = [node[0]]; + for (var i=1, len=node.length; i expected; }); + }, + + gte: function(chunk, context, bodies, params) { + return filter(chunk, context, bodies, params, function(expected, actual) { return actual >= expected; }); + }, + + "default": function(chunk, context, bodies, params) { + return filter(chunk, context, bodies, params, function(expected, actual) { return true; }); + }, + size: function( chunk, context, bodies, params ) { + var subject = params.subject; + var value = 0; + if (!subject) { //undefined, "", 0 + value = 0; + } else if(dust.isArray(subject)) { //array + value = subject.length; + } else if (!isNaN(subject)) { //numeric values + value = subject; + } else if (Object(subject) === subject) { //object test + var nr = 0; + for(var k in subject) if(Object.hasOwnProperty.call(subject,k)) nr++; + value = nr; + } else { + value = (subject + '').length; //any other value (strings etc.) + } + return chunk.write(value); + } +}; + +dust.helpers = helpers; + +})(typeof exports !== 'undefined' ? exports : getGlobal()); diff --git a/node_modules/dustjs-linkedin/lib/dust.js b/node_modules/dustjs-linkedin/lib/dust.js new file mode 100644 index 0000000..d580638 --- /dev/null +++ b/node_modules/dustjs-linkedin/lib/dust.js @@ -0,0 +1,584 @@ +var dust = {}; + +function getGlobal(){ + return (function(){ + return this.dust; + }).call(null); +} + +(function(dust) { + +dust.cache = {}; + +dust.register = function(name, tmpl) { + if (!name) return; + dust.cache[name] = tmpl; +}; + +dust.render = function(name, context, callback) { + var chunk = new Stub(callback).head; + dust.load(name, chunk, Context.wrap(context)).end(); +}; + +dust.stream = function(name, context) { + var stream = new Stream(); + dust.nextTick(function() { + dust.load(name, stream.head, Context.wrap(context)).end(); + }); + return stream; +}; + +dust.renderSource = function(source, context, callback) { + return dust.compileFn(source)(context, callback); +}; + +dust.compileFn = function(source, name) { + var tmpl = dust.loadSource(dust.compile(source, name)); + return function(context, callback) { + var master = callback ? new Stub(callback) : new Stream(); + dust.nextTick(function() { + tmpl(master.head, Context.wrap(context)).end(); + }); + return master; + }; +}; + +dust.load = function(name, chunk, context) { + var tmpl = dust.cache[name]; + if (tmpl) { + return tmpl(chunk, context); + } else { + if (dust.onLoad) { + return chunk.map(function(chunk) { + dust.onLoad(name, function(err, src) { + if (err) return chunk.setError(err); + if (!dust.cache[name]) dust.loadSource(dust.compile(src, name)); + dust.cache[name](chunk, context).end(); + }); + }); + } + return chunk.setError(new Error("Template Not Found: " + name)); + } +}; + +dust.loadSource = function(source, path) { + return eval(source); +}; + +if (Array.isArray) { + dust.isArray = Array.isArray; +} else { + dust.isArray = function(arr) { + return Object.prototype.toString.call(arr) == "[object Array]"; + }; +} + +dust.nextTick = (function() { + if (typeof process !== "undefined") { + return process.nextTick; + } else { + return function(callback) { + setTimeout(callback,0); + }; + } +} )(); + +dust.isEmpty = function(value) { + if (dust.isArray(value) && !value.length) return true; + if (value === 0) return false; + return (!value); +}; + +// apply the filter chain and return the output string +dust.filter = function(string, auto, filters) { + if (filters) { + for (var i=0, len=filters.length; i 0) { + context.stack.head['$len'] = len; + for (var i=0; i\"\']/), + AMP = /&/g, + LT = //g, + QUOT = /\"/g, + SQUOT = /\'/g; + +dust.escapeHtml = function(s) { + if (typeof s === "string") { + if (!HCHARS.test(s)) { + return s; + } + return s.replace(AMP,'&').replace(LT,'<').replace(GT,'>').replace(QUOT,'"').replace(SQUOT, '''); + } + return s; +}; + +var BS = /\\/g, + CR = /\r/g, + LS = /\u2028/g, + PS = /\u2029/g, + NL = /\n/g, + LF = /\f/g, + SQ = /'/g, + DQ = /"/g, + TB = /\t/g; + +dust.escapeJs = function(s) { + if (typeof s === "string") { + return s + .replace(BS, '\\\\') + .replace(DQ, '\\"') + .replace(SQ, "\\'") + .replace(CR, '\\r') + .replace(LS, '\\u2028') + .replace(PS, '\\u2029') + .replace(NL, '\\n') + .replace(LF, '\\f') + .replace(TB, "\\t"); + } + return s; +}; + +})(dust); + +if (typeof exports !== "undefined") { + //TODO: Remove the helpers from dust core in the next release. + dust.helpers = require("./dust-helpers").helpers; + if (typeof process !== "undefined") { + require('./server')(dust); + } + module.exports = dust; +} diff --git a/node_modules/dustjs-linkedin/lib/parser.js b/node_modules/dustjs-linkedin/lib/parser.js new file mode 100644 index 0000000..2b1474e --- /dev/null +++ b/node_modules/dustjs-linkedin/lib/parser.js @@ -0,0 +1,2579 @@ +(function(dust){ + +var parser = (function(){ + /* + * Generated by PEG.js 0.7.0. + * + * http://pegjs.majda.cz/ + */ + + function quote(s) { + /* + * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a + * string literal except for the closing quote character, backslash, + * carriage return, line separator, paragraph separator, and line feed. + * Any character may appear in the form of an escape sequence. + * + * For portability, we also escape escape all control and non-ASCII + * characters. Note that "\0" and "\v" escape sequences are not used + * because JSHint does not like the first and IE the second. + */ + return '"' + s + .replace(/\\/g, '\\\\') // backslash + .replace(/"/g, '\\"') // closing quote character + .replace(/\x08/g, '\\b') // backspace + .replace(/\t/g, '\\t') // horizontal tab + .replace(/\n/g, '\\n') // line feed + .replace(/\f/g, '\\f') // form feed + .replace(/\r/g, '\\r') // carriage return + .replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g, escape) + + '"'; + } + + var result = { + /* + * Parses the input with a generated parser. If the parsing is successfull, + * returns a value explicitly or implicitly specified by the grammar from + * which the parser was generated (see |PEG.buildParser|). If the parsing is + * unsuccessful, throws |PEG.parser.SyntaxError| describing the error. + */ + parse: function(input, startRule) { + var parseFunctions = { + "body": parse_body, + "part": parse_part, + "section": parse_section, + "sec_tag_start": parse_sec_tag_start, + "end_tag": parse_end_tag, + "context": parse_context, + "params": parse_params, + "bodies": parse_bodies, + "reference": parse_reference, + "partial": parse_partial, + "filters": parse_filters, + "special": parse_special, + "identifier": parse_identifier, + "number": parse_number, + "frac": parse_frac, + "integer": parse_integer, + "path": parse_path, + "key": parse_key, + "array": parse_array, + "array_part": parse_array_part, + "inline": parse_inline, + "inline_part": parse_inline_part, + "buffer": parse_buffer, + "literal": parse_literal, + "esc": parse_esc, + "comment": parse_comment, + "tag": parse_tag, + "ld": parse_ld, + "rd": parse_rd, + "eol": parse_eol, + "ws": parse_ws + }; + + if (startRule !== undefined) { + if (parseFunctions[startRule] === undefined) { + throw new Error("Invalid rule name: " + quote(startRule) + "."); + } + } else { + startRule = "body"; + } + + var pos = { offset: 0, line: 1, column: 1, seenCR: false }; + var reportFailures = 0; + var rightmostFailuresPos = { offset: 0, line: 1, column: 1, seenCR: false }; + var rightmostFailuresExpected = []; + + function padLeft(input, padding, length) { + var result = input; + + var padLength = length - input.length; + for (var i = 0; i < padLength; i++) { + result = padding + result; + } + + return result; + } + + function escape(ch) { + var charCode = ch.charCodeAt(0); + var escapeChar; + var length; + + if (charCode <= 0xFF) { + escapeChar = 'x'; + length = 2; + } else { + escapeChar = 'u'; + length = 4; + } + + return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length); + } + + function clone(object) { + var result = {}; + for (var key in object) { + result[key] = object[key]; + } + return result; + } + + function advance(pos, n) { + var endOffset = pos.offset + n; + + for (var offset = pos.offset; offset < endOffset; offset++) { + var ch = input.charAt(offset); + if (ch === "\n") { + if (!pos.seenCR) { pos.line++; } + pos.column = 1; + pos.seenCR = false; + } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { + pos.line++; + pos.column = 1; + pos.seenCR = true; + } else { + pos.column++; + pos.seenCR = false; + } + } + + pos.offset += n; + } + + function matchFailed(failure) { + if (pos.offset < rightmostFailuresPos.offset) { + return; + } + + if (pos.offset > rightmostFailuresPos.offset) { + rightmostFailuresPos = clone(pos); + rightmostFailuresExpected = []; + } + + rightmostFailuresExpected.push(failure); + } + + function parse_body() { + var result0, result1; + var pos0; + + pos0 = clone(pos); + result0 = []; + result1 = parse_part(); + while (result1 !== null) { + result0.push(result1); + result1 = parse_part(); + } + if (result0 !== null) { + result0 = (function(offset, line, column, p) { return ["body"].concat(p) })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + return result0; + } + + function parse_part() { + var result0; + + result0 = parse_comment(); + if (result0 === null) { + result0 = parse_section(); + if (result0 === null) { + result0 = parse_partial(); + if (result0 === null) { + result0 = parse_special(); + if (result0 === null) { + result0 = parse_reference(); + if (result0 === null) { + result0 = parse_buffer(); + } + } + } + } + } + return result0; + } + + function parse_section() { + var result0, result1, result2, result3, result4, result5, result6; + var pos0, pos1; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + result0 = parse_sec_tag_start(); + if (result0 !== null) { + result1 = []; + result2 = parse_ws(); + while (result2 !== null) { + result1.push(result2); + result2 = parse_ws(); + } + if (result1 !== null) { + result2 = parse_rd(); + if (result2 !== null) { + result3 = parse_body(); + if (result3 !== null) { + result4 = parse_bodies(); + if (result4 !== null) { + result5 = parse_end_tag(); + if (result5 !== null) { + result6 = (function(offset, line, column, t, b, e, n) { return t[1].text === n.text;})(pos.offset, pos.line, pos.column, result0, result3, result4, result5) ? "" : null; + if (result6 !== null) { + result0 = [result0, result1, result2, result3, result4, result5, result6]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, t, b, e, n) { e.push(["param", ["literal", "block"], b]); t.push(e); return t })(pos0.offset, pos0.line, pos0.column, result0[0], result0[3], result0[4], result0[5]); + } + if (result0 === null) { + pos = clone(pos0); + } + if (result0 === null) { + pos0 = clone(pos); + pos1 = clone(pos); + result0 = parse_sec_tag_start(); + if (result0 !== null) { + result1 = []; + result2 = parse_ws(); + while (result2 !== null) { + result1.push(result2); + result2 = parse_ws(); + } + if (result1 !== null) { + if (input.charCodeAt(pos.offset) === 47) { + result2 = "/"; + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("\"/\""); + } + } + if (result2 !== null) { + result3 = parse_rd(); + if (result3 !== null) { + result0 = [result0, result1, result2, result3]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, t) { t.push(["bodies"]); return t })(pos0.offset, pos0.line, pos0.column, result0[0]); + } + if (result0 === null) { + pos = clone(pos0); + } + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("section"); + } + return result0; + } + + function parse_sec_tag_start() { + var result0, result1, result2, result3, result4, result5; + var pos0, pos1; + + pos0 = clone(pos); + pos1 = clone(pos); + result0 = parse_ld(); + if (result0 !== null) { + if (/^[#?^<+@%]/.test(input.charAt(pos.offset))) { + result1 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("[#?^<+@%]"); + } + } + if (result1 !== null) { + result2 = []; + result3 = parse_ws(); + while (result3 !== null) { + result2.push(result3); + result3 = parse_ws(); + } + if (result2 !== null) { + result3 = parse_identifier(); + if (result3 !== null) { + result4 = parse_context(); + if (result4 !== null) { + result5 = parse_params(); + if (result5 !== null) { + result0 = [result0, result1, result2, result3, result4, result5]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, t, n, c, p) { return [t, n, c, p] })(pos0.offset, pos0.line, pos0.column, result0[1], result0[3], result0[4], result0[5]); + } + if (result0 === null) { + pos = clone(pos0); + } + return result0; + } + + function parse_end_tag() { + var result0, result1, result2, result3, result4, result5; + var pos0, pos1; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + result0 = parse_ld(); + if (result0 !== null) { + if (input.charCodeAt(pos.offset) === 47) { + result1 = "/"; + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("\"/\""); + } + } + if (result1 !== null) { + result2 = []; + result3 = parse_ws(); + while (result3 !== null) { + result2.push(result3); + result3 = parse_ws(); + } + if (result2 !== null) { + result3 = parse_identifier(); + if (result3 !== null) { + result4 = []; + result5 = parse_ws(); + while (result5 !== null) { + result4.push(result5); + result5 = parse_ws(); + } + if (result4 !== null) { + result5 = parse_rd(); + if (result5 !== null) { + result0 = [result0, result1, result2, result3, result4, result5]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, n) { return n })(pos0.offset, pos0.line, pos0.column, result0[3]); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("end tag"); + } + return result0; + } + + function parse_context() { + var result0, result1; + var pos0, pos1, pos2; + + pos0 = clone(pos); + pos1 = clone(pos); + pos2 = clone(pos); + if (input.charCodeAt(pos.offset) === 58) { + result0 = ":"; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\":\""); + } + } + if (result0 !== null) { + result1 = parse_identifier(); + if (result1 !== null) { + result0 = [result0, result1]; + } else { + result0 = null; + pos = clone(pos2); + } + } else { + result0 = null; + pos = clone(pos2); + } + if (result0 !== null) { + result0 = (function(offset, line, column, n) {return n})(pos1.offset, pos1.line, pos1.column, result0[1]); + } + if (result0 === null) { + pos = clone(pos1); + } + result0 = result0 !== null ? result0 : ""; + if (result0 !== null) { + result0 = (function(offset, line, column, n) { return n ? ["context", n] : ["context"] })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + return result0; + } + + function parse_params() { + var result0, result1, result2, result3, result4; + var pos0, pos1, pos2; + + reportFailures++; + pos0 = clone(pos); + result0 = []; + pos1 = clone(pos); + pos2 = clone(pos); + result2 = parse_ws(); + if (result2 !== null) { + result1 = []; + while (result2 !== null) { + result1.push(result2); + result2 = parse_ws(); + } + } else { + result1 = null; + } + if (result1 !== null) { + result2 = parse_key(); + if (result2 !== null) { + if (input.charCodeAt(pos.offset) === 61) { + result3 = "="; + advance(pos, 1); + } else { + result3 = null; + if (reportFailures === 0) { + matchFailed("\"=\""); + } + } + if (result3 !== null) { + result4 = parse_number(); + if (result4 === null) { + result4 = parse_identifier(); + if (result4 === null) { + result4 = parse_inline(); + } + } + if (result4 !== null) { + result1 = [result1, result2, result3, result4]; + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + if (result1 !== null) { + result1 = (function(offset, line, column, k, v) {return ["param", ["literal", k], v]})(pos1.offset, pos1.line, pos1.column, result1[1], result1[3]); + } + if (result1 === null) { + pos = clone(pos1); + } + while (result1 !== null) { + result0.push(result1); + pos1 = clone(pos); + pos2 = clone(pos); + result2 = parse_ws(); + if (result2 !== null) { + result1 = []; + while (result2 !== null) { + result1.push(result2); + result2 = parse_ws(); + } + } else { + result1 = null; + } + if (result1 !== null) { + result2 = parse_key(); + if (result2 !== null) { + if (input.charCodeAt(pos.offset) === 61) { + result3 = "="; + advance(pos, 1); + } else { + result3 = null; + if (reportFailures === 0) { + matchFailed("\"=\""); + } + } + if (result3 !== null) { + result4 = parse_number(); + if (result4 === null) { + result4 = parse_identifier(); + if (result4 === null) { + result4 = parse_inline(); + } + } + if (result4 !== null) { + result1 = [result1, result2, result3, result4]; + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + if (result1 !== null) { + result1 = (function(offset, line, column, k, v) {return ["param", ["literal", k], v]})(pos1.offset, pos1.line, pos1.column, result1[1], result1[3]); + } + if (result1 === null) { + pos = clone(pos1); + } + } + if (result0 !== null) { + result0 = (function(offset, line, column, p) { return ["params"].concat(p) })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("params"); + } + return result0; + } + + function parse_bodies() { + var result0, result1, result2, result3, result4, result5; + var pos0, pos1, pos2; + + reportFailures++; + pos0 = clone(pos); + result0 = []; + pos1 = clone(pos); + pos2 = clone(pos); + result1 = parse_ld(); + if (result1 !== null) { + if (input.charCodeAt(pos.offset) === 58) { + result2 = ":"; + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("\":\""); + } + } + if (result2 !== null) { + result3 = parse_key(); + if (result3 !== null) { + result4 = parse_rd(); + if (result4 !== null) { + result5 = parse_body(); + if (result5 !== null) { + result1 = [result1, result2, result3, result4, result5]; + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + if (result1 !== null) { + result1 = (function(offset, line, column, k, v) {return ["param", ["literal", k], v]})(pos1.offset, pos1.line, pos1.column, result1[2], result1[4]); + } + if (result1 === null) { + pos = clone(pos1); + } + while (result1 !== null) { + result0.push(result1); + pos1 = clone(pos); + pos2 = clone(pos); + result1 = parse_ld(); + if (result1 !== null) { + if (input.charCodeAt(pos.offset) === 58) { + result2 = ":"; + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("\":\""); + } + } + if (result2 !== null) { + result3 = parse_key(); + if (result3 !== null) { + result4 = parse_rd(); + if (result4 !== null) { + result5 = parse_body(); + if (result5 !== null) { + result1 = [result1, result2, result3, result4, result5]; + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + if (result1 !== null) { + result1 = (function(offset, line, column, k, v) {return ["param", ["literal", k], v]})(pos1.offset, pos1.line, pos1.column, result1[2], result1[4]); + } + if (result1 === null) { + pos = clone(pos1); + } + } + if (result0 !== null) { + result0 = (function(offset, line, column, p) { return ["bodies"].concat(p) })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("bodies"); + } + return result0; + } + + function parse_reference() { + var result0, result1, result2, result3; + var pos0, pos1; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + result0 = parse_ld(); + if (result0 !== null) { + result1 = parse_identifier(); + if (result1 !== null) { + result2 = parse_filters(); + if (result2 !== null) { + result3 = parse_rd(); + if (result3 !== null) { + result0 = [result0, result1, result2, result3]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, n, f) { return ["reference", n, f] })(pos0.offset, pos0.line, pos0.column, result0[1], result0[2]); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("reference"); + } + return result0; + } + + function parse_partial() { + var result0, result1, result2, result3, result4, result5, result6, result7; + var pos0, pos1, pos2; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + result0 = parse_ld(); + if (result0 !== null) { + if (input.charCodeAt(pos.offset) === 62) { + result1 = ">"; + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("\">\""); + } + } + if (result1 === null) { + if (input.charCodeAt(pos.offset) === 43) { + result1 = "+"; + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("\"+\""); + } + } + } + if (result1 !== null) { + pos2 = clone(pos); + result2 = parse_key(); + if (result2 !== null) { + result2 = (function(offset, line, column, k) {return ["literal", k]})(pos2.offset, pos2.line, pos2.column, result2); + } + if (result2 === null) { + pos = clone(pos2); + } + if (result2 === null) { + result2 = parse_inline(); + } + if (result2 !== null) { + result3 = parse_context(); + if (result3 !== null) { + result4 = parse_params(); + if (result4 !== null) { + result5 = []; + result6 = parse_ws(); + while (result6 !== null) { + result5.push(result6); + result6 = parse_ws(); + } + if (result5 !== null) { + if (input.charCodeAt(pos.offset) === 47) { + result6 = "/"; + advance(pos, 1); + } else { + result6 = null; + if (reportFailures === 0) { + matchFailed("\"/\""); + } + } + if (result6 !== null) { + result7 = parse_rd(); + if (result7 !== null) { + result0 = [result0, result1, result2, result3, result4, result5, result6, result7]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, s, n, c, p) { var key = (s ===">")? "partial" : s; return [key, n, c, p] })(pos0.offset, pos0.line, pos0.column, result0[1], result0[2], result0[3], result0[4]); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("partial"); + } + return result0; + } + + function parse_filters() { + var result0, result1, result2; + var pos0, pos1, pos2; + + reportFailures++; + pos0 = clone(pos); + result0 = []; + pos1 = clone(pos); + pos2 = clone(pos); + if (input.charCodeAt(pos.offset) === 124) { + result1 = "|"; + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("\"|\""); + } + } + if (result1 !== null) { + result2 = parse_key(); + if (result2 !== null) { + result1 = [result1, result2]; + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + if (result1 !== null) { + result1 = (function(offset, line, column, n) {return n})(pos1.offset, pos1.line, pos1.column, result1[1]); + } + if (result1 === null) { + pos = clone(pos1); + } + while (result1 !== null) { + result0.push(result1); + pos1 = clone(pos); + pos2 = clone(pos); + if (input.charCodeAt(pos.offset) === 124) { + result1 = "|"; + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("\"|\""); + } + } + if (result1 !== null) { + result2 = parse_key(); + if (result2 !== null) { + result1 = [result1, result2]; + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + if (result1 !== null) { + result1 = (function(offset, line, column, n) {return n})(pos1.offset, pos1.line, pos1.column, result1[1]); + } + if (result1 === null) { + pos = clone(pos1); + } + } + if (result0 !== null) { + result0 = (function(offset, line, column, f) { return ["filters"].concat(f) })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("filters"); + } + return result0; + } + + function parse_special() { + var result0, result1, result2, result3; + var pos0, pos1; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + result0 = parse_ld(); + if (result0 !== null) { + if (input.charCodeAt(pos.offset) === 126) { + result1 = "~"; + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("\"~\""); + } + } + if (result1 !== null) { + result2 = parse_key(); + if (result2 !== null) { + result3 = parse_rd(); + if (result3 !== null) { + result0 = [result0, result1, result2, result3]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, k) { return ["special", k] })(pos0.offset, pos0.line, pos0.column, result0[2]); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("special"); + } + return result0; + } + + function parse_identifier() { + var result0; + var pos0; + + reportFailures++; + pos0 = clone(pos); + result0 = parse_path(); + if (result0 !== null) { + result0 = (function(offset, line, column, p) { var arr = ["path"].concat(p); arr.text = p[1].join('.'); return arr; })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + if (result0 === null) { + pos0 = clone(pos); + result0 = parse_key(); + if (result0 !== null) { + result0 = (function(offset, line, column, k) { var arr = ["key", k]; arr.text = k; return arr; })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("identifier"); + } + return result0; + } + + function parse_number() { + var result0; + var pos0; + + reportFailures++; + pos0 = clone(pos); + result0 = parse_frac(); + if (result0 === null) { + result0 = parse_integer(); + } + if (result0 !== null) { + result0 = (function(offset, line, column, n) { return ['literal', n]; })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("number"); + } + return result0; + } + + function parse_frac() { + var result0, result1, result2, result3; + var pos0, pos1; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + result0 = parse_integer(); + if (result0 !== null) { + if (input.charCodeAt(pos.offset) === 46) { + result1 = "."; + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("\".\""); + } + } + if (result1 !== null) { + result3 = parse_integer(); + if (result3 !== null) { + result2 = []; + while (result3 !== null) { + result2.push(result3); + result3 = parse_integer(); + } + } else { + result2 = null; + } + if (result2 !== null) { + result0 = [result0, result1, result2]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, l, r) { return parseFloat(l + "." + r.join('')); })(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("frac"); + } + return result0; + } + + function parse_integer() { + var result0, result1; + var pos0; + + reportFailures++; + pos0 = clone(pos); + if (/^[0-9]/.test(input.charAt(pos.offset))) { + result1 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("[0-9]"); + } + } + if (result1 !== null) { + result0 = []; + while (result1 !== null) { + result0.push(result1); + if (/^[0-9]/.test(input.charAt(pos.offset))) { + result1 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("[0-9]"); + } + } + } + } else { + result0 = null; + } + if (result0 !== null) { + result0 = (function(offset, line, column, digits) { return parseInt(digits.join(""), 10); })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("integer"); + } + return result0; + } + + function parse_path() { + var result0, result1, result2; + var pos0, pos1; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + result0 = parse_key(); + result0 = result0 !== null ? result0 : ""; + if (result0 !== null) { + result2 = parse_array_part(); + if (result2 === null) { + result2 = parse_array(); + } + if (result2 !== null) { + result1 = []; + while (result2 !== null) { + result1.push(result2); + result2 = parse_array_part(); + if (result2 === null) { + result2 = parse_array(); + } + } + } else { + result1 = null; + } + if (result1 !== null) { + result0 = [result0, result1]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, k, d) { + d = d[0]; + if (k && d) { + d.unshift(k); + return [false, d]; + } + return [true, d]; + })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]); + } + if (result0 === null) { + pos = clone(pos0); + } + if (result0 === null) { + pos0 = clone(pos); + pos1 = clone(pos); + if (input.charCodeAt(pos.offset) === 46) { + result0 = "."; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\".\""); + } + } + if (result0 !== null) { + result1 = []; + result2 = parse_array_part(); + if (result2 === null) { + result2 = parse_array(); + } + while (result2 !== null) { + result1.push(result2); + result2 = parse_array_part(); + if (result2 === null) { + result2 = parse_array(); + } + } + if (result1 !== null) { + result0 = [result0, result1]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, d) { + if (d.length > 0) { + return [true, d[0]]; + } + return [true, []] + })(pos0.offset, pos0.line, pos0.column, result0[1]); + } + if (result0 === null) { + pos = clone(pos0); + } + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("path"); + } + return result0; + } + + function parse_key() { + var result0, result1, result2; + var pos0, pos1; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + if (/^[a-zA-Z_$]/.test(input.charAt(pos.offset))) { + result0 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("[a-zA-Z_$]"); + } + } + if (result0 !== null) { + result1 = []; + if (/^[0-9a-zA-Z_$\-]/.test(input.charAt(pos.offset))) { + result2 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("[0-9a-zA-Z_$\\-]"); + } + } + while (result2 !== null) { + result1.push(result2); + if (/^[0-9a-zA-Z_$\-]/.test(input.charAt(pos.offset))) { + result2 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("[0-9a-zA-Z_$\\-]"); + } + } + } + if (result1 !== null) { + result0 = [result0, result1]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, h, t) { return h + t.join('') })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("key"); + } + return result0; + } + + function parse_array() { + var result0, result1, result2; + var pos0, pos1, pos2, pos3; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + pos2 = clone(pos); + pos3 = clone(pos); + if (input.charCodeAt(pos.offset) === 91) { + result0 = "["; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"[\""); + } + } + if (result0 !== null) { + if (/^[0-9]/.test(input.charAt(pos.offset))) { + result2 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("[0-9]"); + } + } + if (result2 !== null) { + result1 = []; + while (result2 !== null) { + result1.push(result2); + if (/^[0-9]/.test(input.charAt(pos.offset))) { + result2 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("[0-9]"); + } + } + } + } else { + result1 = null; + } + if (result1 !== null) { + if (input.charCodeAt(pos.offset) === 93) { + result2 = "]"; + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("\"]\""); + } + } + if (result2 !== null) { + result0 = [result0, result1, result2]; + } else { + result0 = null; + pos = clone(pos3); + } + } else { + result0 = null; + pos = clone(pos3); + } + } else { + result0 = null; + pos = clone(pos3); + } + if (result0 !== null) { + result0 = (function(offset, line, column, a) {return a.join('')})(pos2.offset, pos2.line, pos2.column, result0[1]); + } + if (result0 === null) { + pos = clone(pos2); + } + if (result0 !== null) { + result1 = parse_array_part(); + result1 = result1 !== null ? result1 : ""; + if (result1 !== null) { + result0 = [result0, result1]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, i, nk) { if(nk) { nk.unshift(i); } else {nk = [i] } return nk; })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("array"); + } + return result0; + } + + function parse_array_part() { + var result0, result1, result2; + var pos0, pos1, pos2, pos3; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + pos2 = clone(pos); + pos3 = clone(pos); + if (input.charCodeAt(pos.offset) === 46) { + result1 = "."; + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("\".\""); + } + } + if (result1 !== null) { + result2 = parse_key(); + if (result2 !== null) { + result1 = [result1, result2]; + } else { + result1 = null; + pos = clone(pos3); + } + } else { + result1 = null; + pos = clone(pos3); + } + if (result1 !== null) { + result1 = (function(offset, line, column, k) {return k})(pos2.offset, pos2.line, pos2.column, result1[1]); + } + if (result1 === null) { + pos = clone(pos2); + } + if (result1 !== null) { + result0 = []; + while (result1 !== null) { + result0.push(result1); + pos2 = clone(pos); + pos3 = clone(pos); + if (input.charCodeAt(pos.offset) === 46) { + result1 = "."; + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("\".\""); + } + } + if (result1 !== null) { + result2 = parse_key(); + if (result2 !== null) { + result1 = [result1, result2]; + } else { + result1 = null; + pos = clone(pos3); + } + } else { + result1 = null; + pos = clone(pos3); + } + if (result1 !== null) { + result1 = (function(offset, line, column, k) {return k})(pos2.offset, pos2.line, pos2.column, result1[1]); + } + if (result1 === null) { + pos = clone(pos2); + } + } + } else { + result0 = null; + } + if (result0 !== null) { + result1 = parse_array(); + result1 = result1 !== null ? result1 : ""; + if (result1 !== null) { + result0 = [result0, result1]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, d, a) { if (a) { return d.concat(a); } else { return d; } })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("array_part"); + } + return result0; + } + + function parse_inline() { + var result0, result1, result2; + var pos0, pos1; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + if (input.charCodeAt(pos.offset) === 34) { + result0 = "\""; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"\\\"\""); + } + } + if (result0 !== null) { + if (input.charCodeAt(pos.offset) === 34) { + result1 = "\""; + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("\"\\\"\""); + } + } + if (result1 !== null) { + result0 = [result0, result1]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column) { return ["literal", ""] })(pos0.offset, pos0.line, pos0.column); + } + if (result0 === null) { + pos = clone(pos0); + } + if (result0 === null) { + pos0 = clone(pos); + pos1 = clone(pos); + if (input.charCodeAt(pos.offset) === 34) { + result0 = "\""; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"\\\"\""); + } + } + if (result0 !== null) { + result1 = parse_literal(); + if (result1 !== null) { + if (input.charCodeAt(pos.offset) === 34) { + result2 = "\""; + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("\"\\\"\""); + } + } + if (result2 !== null) { + result0 = [result0, result1, result2]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, l) { return ["literal", l] })(pos0.offset, pos0.line, pos0.column, result0[1]); + } + if (result0 === null) { + pos = clone(pos0); + } + if (result0 === null) { + pos0 = clone(pos); + pos1 = clone(pos); + if (input.charCodeAt(pos.offset) === 34) { + result0 = "\""; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"\\\"\""); + } + } + if (result0 !== null) { + result2 = parse_inline_part(); + if (result2 !== null) { + result1 = []; + while (result2 !== null) { + result1.push(result2); + result2 = parse_inline_part(); + } + } else { + result1 = null; + } + if (result1 !== null) { + if (input.charCodeAt(pos.offset) === 34) { + result2 = "\""; + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("\"\\\"\""); + } + } + if (result2 !== null) { + result0 = [result0, result1, result2]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, p) { return ["body"].concat(p) })(pos0.offset, pos0.line, pos0.column, result0[1]); + } + if (result0 === null) { + pos = clone(pos0); + } + } + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("inline"); + } + return result0; + } + + function parse_inline_part() { + var result0; + var pos0; + + result0 = parse_special(); + if (result0 === null) { + result0 = parse_reference(); + if (result0 === null) { + pos0 = clone(pos); + result0 = parse_literal(); + if (result0 !== null) { + result0 = (function(offset, line, column, l) { return ["buffer", l] })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + } + } + return result0; + } + + function parse_buffer() { + var result0, result1, result2, result3, result4; + var pos0, pos1, pos2, pos3; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + result0 = parse_eol(); + if (result0 !== null) { + result1 = []; + result2 = parse_ws(); + while (result2 !== null) { + result1.push(result2); + result2 = parse_ws(); + } + if (result1 !== null) { + result0 = [result0, result1]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, e, w) { return ["format", e, w.join('')] })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]); + } + if (result0 === null) { + pos = clone(pos0); + } + if (result0 === null) { + pos0 = clone(pos); + pos1 = clone(pos); + pos2 = clone(pos); + pos3 = clone(pos); + reportFailures++; + result1 = parse_tag(); + reportFailures--; + if (result1 === null) { + result1 = ""; + } else { + result1 = null; + pos = clone(pos3); + } + if (result1 !== null) { + pos3 = clone(pos); + reportFailures++; + result2 = parse_eol(); + reportFailures--; + if (result2 === null) { + result2 = ""; + } else { + result2 = null; + pos = clone(pos3); + } + if (result2 !== null) { + pos3 = clone(pos); + reportFailures++; + result3 = parse_comment(); + reportFailures--; + if (result3 === null) { + result3 = ""; + } else { + result3 = null; + pos = clone(pos3); + } + if (result3 !== null) { + if (input.length > pos.offset) { + result4 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result4 = null; + if (reportFailures === 0) { + matchFailed("any character"); + } + } + if (result4 !== null) { + result1 = [result1, result2, result3, result4]; + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + if (result1 !== null) { + result1 = (function(offset, line, column, c) {return c})(pos1.offset, pos1.line, pos1.column, result1[3]); + } + if (result1 === null) { + pos = clone(pos1); + } + if (result1 !== null) { + result0 = []; + while (result1 !== null) { + result0.push(result1); + pos1 = clone(pos); + pos2 = clone(pos); + pos3 = clone(pos); + reportFailures++; + result1 = parse_tag(); + reportFailures--; + if (result1 === null) { + result1 = ""; + } else { + result1 = null; + pos = clone(pos3); + } + if (result1 !== null) { + pos3 = clone(pos); + reportFailures++; + result2 = parse_eol(); + reportFailures--; + if (result2 === null) { + result2 = ""; + } else { + result2 = null; + pos = clone(pos3); + } + if (result2 !== null) { + pos3 = clone(pos); + reportFailures++; + result3 = parse_comment(); + reportFailures--; + if (result3 === null) { + result3 = ""; + } else { + result3 = null; + pos = clone(pos3); + } + if (result3 !== null) { + if (input.length > pos.offset) { + result4 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result4 = null; + if (reportFailures === 0) { + matchFailed("any character"); + } + } + if (result4 !== null) { + result1 = [result1, result2, result3, result4]; + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + if (result1 !== null) { + result1 = (function(offset, line, column, c) {return c})(pos1.offset, pos1.line, pos1.column, result1[3]); + } + if (result1 === null) { + pos = clone(pos1); + } + } + } else { + result0 = null; + } + if (result0 !== null) { + result0 = (function(offset, line, column, b) { return ["buffer", b.join('')] })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("buffer"); + } + return result0; + } + + function parse_literal() { + var result0, result1, result2; + var pos0, pos1, pos2, pos3; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + pos2 = clone(pos); + pos3 = clone(pos); + reportFailures++; + result1 = parse_tag(); + reportFailures--; + if (result1 === null) { + result1 = ""; + } else { + result1 = null; + pos = clone(pos3); + } + if (result1 !== null) { + result2 = parse_esc(); + if (result2 === null) { + if (/^[^"]/.test(input.charAt(pos.offset))) { + result2 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("[^\"]"); + } + } + } + if (result2 !== null) { + result1 = [result1, result2]; + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + if (result1 !== null) { + result1 = (function(offset, line, column, c) {return c})(pos1.offset, pos1.line, pos1.column, result1[1]); + } + if (result1 === null) { + pos = clone(pos1); + } + if (result1 !== null) { + result0 = []; + while (result1 !== null) { + result0.push(result1); + pos1 = clone(pos); + pos2 = clone(pos); + pos3 = clone(pos); + reportFailures++; + result1 = parse_tag(); + reportFailures--; + if (result1 === null) { + result1 = ""; + } else { + result1 = null; + pos = clone(pos3); + } + if (result1 !== null) { + result2 = parse_esc(); + if (result2 === null) { + if (/^[^"]/.test(input.charAt(pos.offset))) { + result2 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("[^\"]"); + } + } + } + if (result2 !== null) { + result1 = [result1, result2]; + } else { + result1 = null; + pos = clone(pos2); + } + } else { + result1 = null; + pos = clone(pos2); + } + if (result1 !== null) { + result1 = (function(offset, line, column, c) {return c})(pos1.offset, pos1.line, pos1.column, result1[1]); + } + if (result1 === null) { + pos = clone(pos1); + } + } + } else { + result0 = null; + } + if (result0 !== null) { + result0 = (function(offset, line, column, b) { return b.join('') })(pos0.offset, pos0.line, pos0.column, result0); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("literal"); + } + return result0; + } + + function parse_esc() { + var result0; + var pos0; + + pos0 = clone(pos); + if (input.substr(pos.offset, 2) === "\\\"") { + result0 = "\\\""; + advance(pos, 2); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"\\\\\\\"\""); + } + } + if (result0 !== null) { + result0 = (function(offset, line, column) { return '"' })(pos0.offset, pos0.line, pos0.column); + } + if (result0 === null) { + pos = clone(pos0); + } + return result0; + } + + function parse_comment() { + var result0, result1, result2, result3; + var pos0, pos1, pos2, pos3, pos4; + + reportFailures++; + pos0 = clone(pos); + pos1 = clone(pos); + if (input.substr(pos.offset, 2) === "{!") { + result0 = "{!"; + advance(pos, 2); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"{!\""); + } + } + if (result0 !== null) { + result1 = []; + pos2 = clone(pos); + pos3 = clone(pos); + pos4 = clone(pos); + reportFailures++; + if (input.substr(pos.offset, 2) === "!}") { + result2 = "!}"; + advance(pos, 2); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("\"!}\""); + } + } + reportFailures--; + if (result2 === null) { + result2 = ""; + } else { + result2 = null; + pos = clone(pos4); + } + if (result2 !== null) { + if (input.length > pos.offset) { + result3 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result3 = null; + if (reportFailures === 0) { + matchFailed("any character"); + } + } + if (result3 !== null) { + result2 = [result2, result3]; + } else { + result2 = null; + pos = clone(pos3); + } + } else { + result2 = null; + pos = clone(pos3); + } + if (result2 !== null) { + result2 = (function(offset, line, column, c) {return c})(pos2.offset, pos2.line, pos2.column, result2[1]); + } + if (result2 === null) { + pos = clone(pos2); + } + while (result2 !== null) { + result1.push(result2); + pos2 = clone(pos); + pos3 = clone(pos); + pos4 = clone(pos); + reportFailures++; + if (input.substr(pos.offset, 2) === "!}") { + result2 = "!}"; + advance(pos, 2); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("\"!}\""); + } + } + reportFailures--; + if (result2 === null) { + result2 = ""; + } else { + result2 = null; + pos = clone(pos4); + } + if (result2 !== null) { + if (input.length > pos.offset) { + result3 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result3 = null; + if (reportFailures === 0) { + matchFailed("any character"); + } + } + if (result3 !== null) { + result2 = [result2, result3]; + } else { + result2 = null; + pos = clone(pos3); + } + } else { + result2 = null; + pos = clone(pos3); + } + if (result2 !== null) { + result2 = (function(offset, line, column, c) {return c})(pos2.offset, pos2.line, pos2.column, result2[1]); + } + if (result2 === null) { + pos = clone(pos2); + } + } + if (result1 !== null) { + if (input.substr(pos.offset, 2) === "!}") { + result2 = "!}"; + advance(pos, 2); + } else { + result2 = null; + if (reportFailures === 0) { + matchFailed("\"!}\""); + } + } + if (result2 !== null) { + result0 = [result0, result1, result2]; + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + } else { + result0 = null; + pos = clone(pos1); + } + if (result0 !== null) { + result0 = (function(offset, line, column, c) { return ["comment", c.join('')] })(pos0.offset, pos0.line, pos0.column, result0[1]); + } + if (result0 === null) { + pos = clone(pos0); + } + reportFailures--; + if (reportFailures === 0 && result0 === null) { + matchFailed("comment"); + } + return result0; + } + + function parse_tag() { + var result0, result1, result2, result3, result4, result5, result6; + var pos0, pos1, pos2; + + pos0 = clone(pos); + result0 = parse_ld(); + if (result0 !== null) { + if (/^[#?^><+%:@\/~%]/.test(input.charAt(pos.offset))) { + result1 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result1 = null; + if (reportFailures === 0) { + matchFailed("[#?^><+%:@\\/~%]"); + } + } + if (result1 !== null) { + result2 = []; + result3 = parse_ws(); + while (result3 !== null) { + result2.push(result3); + result3 = parse_ws(); + } + if (result2 !== null) { + pos1 = clone(pos); + pos2 = clone(pos); + reportFailures++; + result4 = parse_rd(); + reportFailures--; + if (result4 === null) { + result4 = ""; + } else { + result4 = null; + pos = clone(pos2); + } + if (result4 !== null) { + pos2 = clone(pos); + reportFailures++; + result5 = parse_eol(); + reportFailures--; + if (result5 === null) { + result5 = ""; + } else { + result5 = null; + pos = clone(pos2); + } + if (result5 !== null) { + if (input.length > pos.offset) { + result6 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result6 = null; + if (reportFailures === 0) { + matchFailed("any character"); + } + } + if (result6 !== null) { + result4 = [result4, result5, result6]; + } else { + result4 = null; + pos = clone(pos1); + } + } else { + result4 = null; + pos = clone(pos1); + } + } else { + result4 = null; + pos = clone(pos1); + } + if (result4 !== null) { + result3 = []; + while (result4 !== null) { + result3.push(result4); + pos1 = clone(pos); + pos2 = clone(pos); + reportFailures++; + result4 = parse_rd(); + reportFailures--; + if (result4 === null) { + result4 = ""; + } else { + result4 = null; + pos = clone(pos2); + } + if (result4 !== null) { + pos2 = clone(pos); + reportFailures++; + result5 = parse_eol(); + reportFailures--; + if (result5 === null) { + result5 = ""; + } else { + result5 = null; + pos = clone(pos2); + } + if (result5 !== null) { + if (input.length > pos.offset) { + result6 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result6 = null; + if (reportFailures === 0) { + matchFailed("any character"); + } + } + if (result6 !== null) { + result4 = [result4, result5, result6]; + } else { + result4 = null; + pos = clone(pos1); + } + } else { + result4 = null; + pos = clone(pos1); + } + } else { + result4 = null; + pos = clone(pos1); + } + } + } else { + result3 = null; + } + if (result3 !== null) { + result4 = []; + result5 = parse_ws(); + while (result5 !== null) { + result4.push(result5); + result5 = parse_ws(); + } + if (result4 !== null) { + result5 = parse_rd(); + if (result5 !== null) { + result0 = [result0, result1, result2, result3, result4, result5]; + } else { + result0 = null; + pos = clone(pos0); + } + } else { + result0 = null; + pos = clone(pos0); + } + } else { + result0 = null; + pos = clone(pos0); + } + } else { + result0 = null; + pos = clone(pos0); + } + } else { + result0 = null; + pos = clone(pos0); + } + } else { + result0 = null; + pos = clone(pos0); + } + if (result0 === null) { + result0 = parse_reference(); + } + return result0; + } + + function parse_ld() { + var result0; + + if (input.charCodeAt(pos.offset) === 123) { + result0 = "{"; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"{\""); + } + } + return result0; + } + + function parse_rd() { + var result0; + + if (input.charCodeAt(pos.offset) === 125) { + result0 = "}"; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"}\""); + } + } + return result0; + } + + function parse_eol() { + var result0; + + if (input.charCodeAt(pos.offset) === 10) { + result0 = "\n"; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"\\n\""); + } + } + if (result0 === null) { + if (input.substr(pos.offset, 2) === "\r\n") { + result0 = "\r\n"; + advance(pos, 2); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"\\r\\n\""); + } + } + if (result0 === null) { + if (input.charCodeAt(pos.offset) === 13) { + result0 = "\r"; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"\\r\""); + } + } + if (result0 === null) { + if (input.charCodeAt(pos.offset) === 8232) { + result0 = "\u2028"; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"\\u2028\""); + } + } + if (result0 === null) { + if (input.charCodeAt(pos.offset) === 8233) { + result0 = "\u2029"; + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("\"\\u2029\""); + } + } + } + } + } + } + return result0; + } + + function parse_ws() { + var result0; + + if (/^[\t\x0B\f \xA0\uFEFF]/.test(input.charAt(pos.offset))) { + result0 = input.charAt(pos.offset); + advance(pos, 1); + } else { + result0 = null; + if (reportFailures === 0) { + matchFailed("[\\t\\x0B\\f \\xA0\\uFEFF]"); + } + } + if (result0 === null) { + result0 = parse_eol(); + } + return result0; + } + + + function cleanupExpected(expected) { + expected.sort(); + + var lastExpected = null; + var cleanExpected = []; + for (var i = 0; i < expected.length; i++) { + if (expected[i] !== lastExpected) { + cleanExpected.push(expected[i]); + lastExpected = expected[i]; + } + } + return cleanExpected; + } + + + + var result = parseFunctions[startRule](); + + /* + * The parser is now in one of the following three states: + * + * 1. The parser successfully parsed the whole input. + * + * - |result !== null| + * - |pos.offset === input.length| + * - |rightmostFailuresExpected| may or may not contain something + * + * 2. The parser successfully parsed only a part of the input. + * + * - |result !== null| + * - |pos.offset < input.length| + * - |rightmostFailuresExpected| may or may not contain something + * + * 3. The parser did not successfully parse any part of the input. + * + * - |result === null| + * - |pos.offset === 0| + * - |rightmostFailuresExpected| contains at least one failure + * + * All code following this comment (including called functions) must + * handle these states. + */ + if (result === null || pos.offset !== input.length) { + var offset = Math.max(pos.offset, rightmostFailuresPos.offset); + var found = offset < input.length ? input.charAt(offset) : null; + var errorPosition = pos.offset > rightmostFailuresPos.offset ? pos : rightmostFailuresPos; + + throw new parser.SyntaxError( + cleanupExpected(rightmostFailuresExpected), + found, + offset, + errorPosition.line, + errorPosition.column + ); + } + + return result; + }, + + /* Returns the parser source code. */ + toSource: function() { return this._source; } + }; + + /* Thrown when a parser encounters a syntax error. */ + + result.SyntaxError = function(expected, found, offset, line, column) { + function buildMessage(expected, found) { + var expectedHumanized, foundHumanized; + + switch (expected.length) { + case 0: + expectedHumanized = "end of input"; + break; + case 1: + expectedHumanized = expected[0]; + break; + default: + expectedHumanized = expected.slice(0, expected.length - 1).join(", ") + + " or " + + expected[expected.length - 1]; + } + + foundHumanized = found ? quote(found) : "end of input"; + + return "Expected " + expectedHumanized + " but " + foundHumanized + " found."; + } + + this.name = "SyntaxError"; + this.expected = expected; + this.found = found; + this.message = buildMessage(expected, found); + this.offset = offset; + this.line = line; + this.column = column; + }; + + result.SyntaxError.prototype = Error.prototype; + + return result; +})(); + +dust.parse = parser.parse; + +})(typeof exports !== 'undefined' ? exports : getGlobal()); \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/lib/server.js b/node_modules/dustjs-linkedin/lib/server.js new file mode 100644 index 0000000..6b07fb6 --- /dev/null +++ b/node_modules/dustjs-linkedin/lib/server.js @@ -0,0 +1,18 @@ +var path = require('path'), + parser = require('./parser'), + compiler = require('./compiler'), + vm = require('vm'); + +module.exports = function(dust) { + compiler.parse = parser.parse; + dust.compile = compiler.compile; + + dust.loadSource = function(source, path) { + return vm.runInNewContext(source, {dust: dust}, path); + }; + + dust.nextTick = process.nextTick; + + // expose optimizers in commonjs env too + dust.optimizers = compiler.optimizers; +} diff --git a/node_modules/dustjs-linkedin/node_modules/.bin/cover b/node_modules/dustjs-linkedin/node_modules/.bin/cover new file mode 120000 index 0000000..916bf77 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/.bin/cover @@ -0,0 +1 @@ +../cover/bin/cover \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/.bin/jasmine-node b/node_modules/dustjs-linkedin/node_modules/.bin/jasmine-node new file mode 120000 index 0000000..a1c6532 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/.bin/jasmine-node @@ -0,0 +1 @@ +../jasmine-node/bin/jasmine-node \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/.bin/uglifyjs b/node_modules/dustjs-linkedin/node_modules/.bin/uglifyjs new file mode 120000 index 0000000..fef3468 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/.bin/uglifyjs @@ -0,0 +1 @@ +../uglify-js/bin/uglifyjs \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/.npmignore b/node_modules/dustjs-linkedin/node_modules/cover/.npmignore new file mode 100644 index 0000000..8c95013 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/.npmignore @@ -0,0 +1,7 @@ +**/format/html/* +.coverage_data/* +node_modules/* +.coverignore +npm-debug.log +cover_html/* +.coverage_debug/* \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/README.markdown b/node_modules/dustjs-linkedin/node_modules/cover/README.markdown new file mode 100644 index 0000000..f106e45 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/README.markdown @@ -0,0 +1,96 @@ +## Cover - Native JavaScript Code Coverage + +Cover gives you the ability to collect code-coverage for your projects, using +whatever unit test framework you want, and all using native JavaScript. It also +comes bundled with pre-defined reporters, such as HTML and CLI output, so you +can easily see where you are missing coverage. + +### Standing on the shoulders of giants + +I would be amiss to not mention that the hard work in this library was +by [Chris Dickinson] with his work on [runforcover]. In reality, Cover is +a fork of runforcover, fixing some of the issues and making it more usable. + +The original version of Cover used [substack]'s excellent [bunker] library, +but it has recently been moved to using [esprima] and a new code homegrown +instrumentation library. + +### Known Issues + +There are currently a few known issues that I am working on: + +1. If you use 'global' to pass state between modules (mocha does this, for +example), then you might run into issues. Cover runs modules as if they +were executed with `NODE_MODULE_CONTEXTS` was set. + +2. If you start new node processes, Cover won't work with those, as +it instruments by hooking into `require`. + +### Usage + +Using Cover is simple. Simply install it globally: + +> npm install cover -g + +And then, run it + +> cover run mytests.js + +Want to pass some arguments to your test? No problem (note the `--`): + +> cover run mytests.js -- --arg1 --arg2=foo + + Once you've run your tests, it will create a directory with coverage data in it. + If you want to see the coverage report, simply run: + + > cover report + + which will output the report to the CLI. Want to get an HTML report? + + > cover report html + + This will create a `cover_html` directory with the coverage information. + +### Configuration + +Cover reads from a `.coverrc` file in your project directory, and it comes +with sensible defaults. Here are the defaults that it uses: + + { + "formatter": "cli", + "ignore": ".coverignore", + + "prefix": "coveragefile_", // Prefix for coverage data files + "dataDirectory": ".coverage_data", // Directory to put coverage files in + + "debugDirectory": ".coverage_debug", // Directory to put instrumented files in + + "modules": false, // Whether or not to cover node_modules directory + + // Formatter-specific info + "html" : { + "directory": "cover_html", // Directory to write HTML files too + "generateIndex": true // Whether to generate an index.html file + }, + + "json": { + } + } + +You can also specify which files to ignore using .coverignore. Here is the one used +for Cover itself: + + node_modules + +You can specify both files and directories in the `.coverignore` file. + +If you have a customer path for your configuration files, you can specify this +on the command line: + +> cover --config path/to/config --ignore path/to/ignore run myfile.js + +[esprima]: http://www.esprima.org +[substack]: https://github.com/substack +[bunker]: https://github.com/substack/node-bunker +[Chris Dickinson]: https://github.com/chrisdickinson +[runforcover]: https://github.com/chrisdickinson/node-runforcover \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/bar.js b/node_modules/dustjs-linkedin/node_modules/cover/bar.js new file mode 100644 index 0000000..e69de29 diff --git a/node_modules/dustjs-linkedin/node_modules/cover/bin/.coverrc b/node_modules/dustjs-linkedin/node_modules/cover/bin/.coverrc new file mode 100644 index 0000000..5d4d7b4 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/bin/.coverrc @@ -0,0 +1,20 @@ +{ + "formatter": "cli", + "ignore": ".coverignore", + + "prefix": "coveragefile_", // Prefix for coverage data files + "dataDirectory": ".coverage_data", // Directory to put coverage files in + + "debugDirectory": ".coverage_debug", // Directory to put instrumented files in + + "modules": false, // Whether or not to cover node_modules directory + + // Formatter-specific info + "html" : { + "directory": "cover_html", // Directory to write HTML files too + "generateIndex": true // Whether to generate an index.html file + }, + + "json": { + } +} \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/bin/cover b/node_modules/dustjs-linkedin/node_modules/cover/bin/cover new file mode 100755 index 0000000..aab5902 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/bin/cover @@ -0,0 +1,732 @@ +#!/usr/bin/env node + +// Copyright 2011 Itay Neeman +// +// Licensed under the MIT License + +// TODO: + +(function() { + var fs = require('fs'); + var path = require('path'); + var vm = require("vm"); + var crypto = require('crypto'); + var Module = require('module').Module; + var _ = require('underscore'); + var _s = require('underscore.string'); + var which = require('which').sync; + var commander = require('../contrib/commander'); + var Table = require('../contrib/cli-table'); + var pkg = require('../package.json'); + + var patch_console = require('../utils/console'); + var cover = require("../index.js"); + + // Store the initial CWD, to harden us against process.chdir + var CWD = path.resolve(process.cwd()); + + // Get a list of the built-in reporters + var reporterOptions = "[" + _.keys(cover.reporters).join(",") + "]"; + + /* ====== Utilities ====== */ + + // Delete a directory recursively + var rmdirRecursiveSync = function(dirPath) { + var files = fs.readdirSync(dirPath); + + for(var i = 0; i < files.length; i++) { + var filePath = path.join(dirPath, files[i]); + var file = fs.statSync(filePath); + + if (file.isDirectory()) { + rmdirRecursiveSync(filePath); + } + else { + fs.unlinkSync(filePath); + } + } + + fs.rmdirSync(dirPath); + }; + + /* ====== Config/Ignore File Handling ====== */ + + // Default config + var defaultConfigPath = path.join(path.resolve(__dirname), ".coverrc"); + var defaultConfig = {}; + + var removeJSONComments = function(str) { + str = str || ''; + str = str.replace(/\/\*[\s\S]*(?:\*\/)/g, ''); //everything between "/* */" + str = str.replace(/\/\/[^\n\r]*/g, ''); //everything after "//" + return str; + }; + + var readIgnoreFile = function(ignorePath, ignoreModules) { + var ignore = {}; + + // Get the full path relative to the CWD + var fullIgnorePath = path.resolve(CWD, ignorePath); + if (path.existsSync(fullIgnorePath)) { + // If we found an ignore file, read it in + var ignoreContents = fs.readFileSync(fullIgnorePath, "utf-8"); + try { + // Note that directory fo the ignore path + var dir = path.dirname(fullIgnorePath); + var ignores = ignoreContents.split("\n"); + + // For each line (ignoring blank ones), get the full path, + // and add it to our ignore list. + for(var i = 0; i < ignores.length; i++) { + if (ignores[i].trim() === "") { + continue; + } + + var filePath = path.resolve(dir, ignores[i].trim()); + ignore[path.resolve(dir, filePath)] = true; + } + } + catch (ex) { + throw new Error("There was a problem parsing your .coverignore file at: " + ignorePath); + } + } + + return ignore; + }; + + var readConfigFile = function(configFile) { + var config = {} + + // Get the full path relative to the CWD + configFile = path.resolve(CWD, configFile); + if (!path.existsSync(configFile)) { + configFile = defaultConfigPath; + } + + // Remove any comments from the JSON + var configContents = removeJSONComments(fs.readFileSync(path.resolve(configFile), "utf-8")); + + try { + // If there is no content, we'll just add an empty object + if (configContents.trim() === "") { + configContents = "{}"; + } + + // Parse it and copy in the defaults + var rawConfig = JSON.parse(configContents); + for(var key in defaultConfig) { + config[key] = defaultConfig[key]; + } + + // Override the defaults with specific ones. + for(var key in rawConfig) { + config[key] = rawConfig[key]; + } + } + catch (ex) { + throw new Error("There was a problem parsing your .coverrc file at: " + configFile); + } + + return config; + }; + + var getOptionsAndIgnore = function(cmdline, options) { + options = options || {}; + + // Get configuration + var config = {}; + if (cmdline.config || ".coverrc") { + if (_.isObject(cmdline.config)) { + config = cmdline.config; + } + else { + config = readConfigFile(cmdline.config || ".coverrc"); + } + } + + // Get ignore + var ignore = {}; + if (cmdline.ignore || config.ignore || ".coverignore") { + if (_.isObject(cmdline.ignore)) { + ignore = cmdline.ignore; + } + else { + ignore = readIgnoreFile(cmdline.ignore || config.ignore || ".coverignore"); + } + } + + // If we didn't override it on the command line and the + // coverrc file says to ingore node_modules, then ignore + // it + if (options.modules !== true && config.modules === false) { + ignore[path.resolve(CWD, "node_modules")] = true; + } + + return { + config: config, + ignore: ignore + } + }; + + defaultConfig = readConfigFile(defaultConfigPath); + + /* ====== Context and Execution Handling ====== */ + + // Run a file with coverage enabled + var runFile = function(file, options, ignore, debug) { + if (!path.existsSync(file)) { + try { + file = which(file); + } + catch(ex) { + console.log("Could not find file: '" + file + "' -- exiting..."); + return null; + } + } + else { + file = path.resolve(file); + } + + var coverage = cover.cover(null, ignore, debug); + + process.nextTick(function() { + try { + // Load up the new argv + options = options || []; + process.argv = ["node", file].concat(options) + + // Load the file as the main module + Module.runMain(file, null, true) + } + catch(ex) { + console.log(ex.stack); + } + }); + + return coverage; + }; + + /* ====== Save/Load Coverage Data ====== */ + var saveCoverageData = function(coverageData, configs, noPrecombine) { + if (!noPrecombine) { + savePrecombinedCoverageData(coverageData, configs); + } + + // Setup the information we're going to save + var files = {}; + var toSave = { + version: pkg.version, + files: files + }; + + _.each(coverageData, function(fileData, fileName, lst) { + // For each file, we hash the source to get a "version ID" + // for it + var stats = fileData.stats(); + var fileSource = stats.source; + var md5 = crypto.createHash('md5'); + md5.update(fileSource); + var hash = md5.digest('hex'); + + // We also save the stats and the hash, + // which is everything we need in order + // to be able to generate reports + files[fileName] = { + stats: stats, + hash: hash + } + }); + + // Turn it into JSON and write it out + var data = JSON.stringify(toSave); + + // Get the ID for this data (md5 hash) + var dataMd5 = crypto.createHash('md5'); + dataMd5.update(data); + var dataHash = dataMd5.digest('hex'); + + // Make the directory + var dataDirectory = path.join(CWD, configs.dataDirectory); + if (!path.existsSync(dataDirectory)) { + fs.mkdirSync(dataDirectory, "0755"); + } + + // Write out the file + var dataFilename = path.join(dataDirectory, configs.prefix + dataHash); + fs.writeFileSync(dataFilename, data); + }; + + var savePrecombinedCoverageData = function(coverageData, configs) { + // Setup the information we're going to save + var files = {}; + var toSave = { + version: "0.2.0", + files: files + }; + + var coverageStore = require('../coverage_store'); + + _.each(coverageData, function(fileData, fileName, lst) { + var store = coverageStore.getStore(fileName); + + // For each file, we hash the source to get a "version ID" + // for it + var fileSource = fileData.source; + var md5 = crypto.createHash('md5'); + md5.update(fileSource); + var hash = md5.digest('hex'); + + // We also save the stats and the hash, + // which is everything we need in order + // to be able to generate reports + files[fileName] = { + nodes: store.nodes, + blocks: store.blocks, + hash: hash, + instrumentor: fileData.instrumentor.objectify() + } + }); + + // Turn it into JSON and write it out + var data = JSON.stringify(toSave); + + // Get the ID for this data (md5 hash) + var dataMd5 = crypto.createHash('md5'); + dataMd5.update(data); + var dataHash = dataMd5.digest('hex'); + + // Make the directory + var dataDirectory = path.join(CWD, configs.dataDirectory); + if (!path.existsSync(dataDirectory)) { + fs.mkdirSync(dataDirectory, "0755"); + } + + // Write out the file + var dataFilename = path.join(dataDirectory, "precombined_" + configs.prefix + dataHash); + fs.writeFileSync(dataFilename, data); + }; + + var loadCoverageData = function(filename, configs) { + var dataDirectory = configs.dataDirectory; + var dataPrefix = configs.prefix; + + if (!filename) { + // If we weren't given a file, try and read it from the data directory. + var filesInDataDirectory = fs.readdirSync(dataDirectory); + var matchingFiles = _.filter(filesInDataDirectory, function(file) { return _s.startsWith(file, dataPrefix); }); + if (matchingFiles.length > 1) { + // If there is more than one file, we'll use the last modified one. + var latestTime = 0; + for(var i = 0; i < matchingFiles.length; i++) { + var fileLatest = fs.statSync(path.join(dataDirectory, matchingFiles[i])).mtime; + if (fileLatest > latestTime) { + latestTime = fileLatest; + filename = matchingFiles[i]; + } + } + } + else if (matchingFiles.length === 1) { + // If there was exactly one file, we'll use that one + filename = matchingFiles[0]; + } + else if (matchingFiles.length === 0) { + // If there was no file, error. + console.error("Could not find a coverage data file. Please specify one."); + process.exit(1); + } + + // Note the full path to the file + filename = path.join(dataDirectory, filename); + } + + // If it doesn't exist, then error out + if (!path.existsSync(filename)) { + console.error("Coverage data file does not exist: " + filename); + process.exit(1); + } + + // Read the file + var data = fs.readFileSync(filename, "utf-8"); + var coverageData = JSON.parse(data); + + // Remake the objects into what the reporters expect + _.each(coverageData.files, function(fileData, fileName) { + var stats = fileData.stats; + fileData.filename = fileName; + fileData.stats = function() { return stats; }; + fileData.source = stats.source; + }); + + return coverageData; + }; + + var loadPrecombinedCoverageData = function(configs) { + var dataDirectory = configs.dataDirectory; + var dataPrefix = configs.prefix; + + var filesInDataDirectory = fs.readdirSync(dataDirectory); + var files = _.filter(filesInDataDirectory, function(file) { + return _s.startsWith(file, "precombined_" + dataPrefix); + }).map(function(file) { + return path.join(dataDirectory, file); + }); + + + var datas = []; + _.each(files, function(filename) { + // If it doesn't exist, then error out + if (!path.existsSync(filename)) { + console.error("Coverage data file does not exist: " + filename); + process.exit(1); + } + + // Read the file + var data = fs.readFileSync(filename, "utf-8"); + datas.push(JSON.parse(data)); + + fs.unlinkSync(filename); + }); + + var coverageData = cover.load(datas); + return coverageData; + }; + + /* ====== Reporters ====== */ + + var reporterHandlers = { + html: function(coverageData, config) { + var files = _.sortBy(_.keys(coverageData), function(file) { return file; }); + var allStats = []; + var statsByFile = {}; + + var htmlDirectory = path.join(CWD, config.html.directory); + var templateDir = path.resolve(__dirname, "..", "templates"); + var resourceDir = path.resolve(__dirname, "..", "resources"); + + var htmls = {}; + for(var i = 0; i < files.length; i++) { + var filename = files[i]; + htmls[filename] = cover.reporters.html.format(coverageData[filename]); + } + + // For each file, we compile a list of its summmary stats + for(var i = 0; i < files.length; i++) { + var filename = files[i]; + var stats = coverageData[filename].stats(); + + statsByFile[filename] = { + percentage: Math.floor(stats.percentage * 100) + "%", + missingLines: stats.missing, + seenLines: stats.seen, + partialLines: _.values(stats.coverage).filter(function(lineinfo) { return lineinfo.partial; }).length, + totalLines: stats.total, + blockPercentage: Math.floor(stats.blocks.percentage * 100) + "%", + missingBlocks: stats.blocks.missing, + seenBlocks: stats.blocks.seen, + totalBlocks: stats.blocks.total, + }; + + allStats.push([ + path.relative(CWD, filename), + Math.floor(stats.percentage * 100) + "%", + stats.missing, + stats.total, + Math.floor(stats.blocks.percentage * 100) + "%", + stats.blocks.missing, + stats.blocks.total + ]); + } + + // Delete the HTML directory if necessary, and then create it + if (path.existsSync(htmlDirectory)) { + rmdirRecursiveSync(htmlDirectory); + } + fs.mkdirSync(htmlDirectory, "755"); + + // For each HTML file, use the template to generate an HTML file, + // and write it out to disk + _.each(htmls, function(html, filename) { + var outputPath = path.join(htmlDirectory, filename.replace(/[\/|\:|\\]/g, "_") + ".html"); + + var htmlTemplateString = fs.readFileSync(path.join(templateDir, "file.html")).toString("utf-8"); + var htmlTemplate = _.template(htmlTemplateString); + var completeHtml = htmlTemplate({ + filename: filename, + code: html, + stats: statsByFile[filename] + }); + + fs.writeFileSync(outputPath, completeHtml); + }); + + // Compile the index file with the template, and write it out to disk + var indexTemplateString = fs.readFileSync(path.join(templateDir, "index.html")).toString("utf-8"); + var indexTemplate = _.template(indexTemplateString); + var headers = ["Filename", "% Covered", "Missed Lines", "# Lines", "% Blocks", "Missed Blocks", "# Blocks"]; + var fileUrls = {}; + _.each(files, function(file) { + fileUrls[path.relative(CWD, file)] = file.replace(/[\/|\:|\\]/g, "_") + ".html"; + }); + + var indexHtml = indexTemplate({ headers: headers, data: allStats, fileUrls: fileUrls }); + + fs.writeFileSync(path.join(htmlDirectory, "index.html"), indexHtml); + + // Copy over the resource files + fs.link(path.join(resourceDir, "bootstrap.css"), path.join(htmlDirectory, "bootstrap.css")); + fs.link(path.join(resourceDir, "prettify.css"), path.join(htmlDirectory, "prettify.css")); + fs.link(path.join(resourceDir, "prettify.js"), path.join(htmlDirectory, "prettify.js")); + fs.link(path.join(resourceDir, "jquery.min.js"), path.join(htmlDirectory, "jquery.min.js")); + fs.link(path.join(resourceDir, "jquery.tablesorter.min.js"), path.join(htmlDirectory, "jquery.tablesorter.min.js")); + }, + + cli: function(coverageData, config) { + var files = _.sortBy(_.keys(coverageData), function(file) { return file; }); + + var table = new Table({ + head: ["Filename", "% Covered", "Missed Lines", "# Lines", "% Blocks", "Missed Blocks", "# Blocks"], + style : { + 'padding-left' : 1, + 'padding-right ': 1, + head: ['cyan'] + }, + colWidths: [cover.reporters.cli.MAX_FILENAME_LENGTH + 5, 10, 14, 10, 10, 14, 10] + }); + + for(var i = 0; i < files.length; i++) { + var filename = files[i]; + table.push(cover.reporters.cli.format(coverageData[filename])); + } + + console.log(table.toString()); + }, + + plain: function(coverageData, config) { + var files = _.sortBy(_.keys(coverageData), function(file) { return file; }); + + for(var i = 0; i < files.length; i++) { + var filename = files[i]; + console.log(cover.reporters.plain.format(coverageData[filename])); + } + }, + + json: function(coverageData, config) { + var files = _.sortBy(_.keys(coverageData), function(file) { return file; }); + + var jsons = []; + for(var i = 0; i < files.length; i++) { + var filename = files[i]; + jsons.push(cover.reporters.json.format(coverageData[filename])); + } + + console.log(JSON.stringify(jsons)); + }, + + __catch_all: function(coverageData, config, reporter) { + + } + }; + + /* ====== Commands ====== */ + + var run = function(file, cmdline, config, ignore, debug) { + if (debug) { + var debugDirectory = path.join(CWD, config.debugDirectory); + if (!path.existsSync(debugDirectory)) { + fs.mkdirSync(debugDirectory, "0755"); + } + } + + // Run the file + var coverage = runFile(file, cmdline, ignore, debug ? config.debugDirectory : null); + + // Setup the on exit listener + process.on( + "exit", + function() { + // For debugging purposes, make sure we can print things + patch_console.patch(); + + if (!coverage) { + return; + } + + coverage(function(coverageData) { + try { + saveCoverageData(coverageData, config); + } + catch(e) { + console.log(e.stack); + } + }); + } + ); + }; + + var report = function(reporterName, file, config, ignore) { + var coverageData = loadCoverageData(file, config); + + reporterName = reporterName || "cli"; + + var reporter = ""; + if (cover.reporters[reporterName]) { + reporter = cover.reporters[reporterName]; + } + else { + try { + reporter = require(path.resolve(reporterName)); + } + catch(ex) { + console.log("Could not find reporter: " + reporterName); + process.exit(1); + } + } + + (reporterHandlers[reporterName] || reporterHandlers.__catch_all)(coverageData.files, config, reporter); + } + + var combine = function(configFile, ignoreFile) { + var files = getOptionsAndIgnore({config: configFile, ignore: ignoreFile}); + var config = files.config; + var ignore = files.ignore; + + var coverageData = loadPrecombinedCoverageData(config); + saveCoverageData(coverageData, config, true); + } + + var hook = function(configFile, ignoreFile) { + var files = getOptionsAndIgnore({config: configFile, ignore: ignoreFile}); + var config = files.config; + var ignore = files.ignore; + + var cover = require('../index.js'); + coverage = cover.cover(null, ignore, global); + + // Setup the on exit listener + process.on( + "exit", + function() { + // For debugging purposes, make sure we can print things + patch_console.patch(); + coverage(function(coverageData) { + try { + saveCoverageData(coverageData, config); + } + catch(e) { + console.log(e.stack); + } + }); + } + ); + } + + var hookAndReport = function(reporterName, configFile, ignoreFile) { + var files = getOptionsAndIgnore({config: configFile, ignore: ignoreFile}); + var config = files.config; + var ignore = files.ignore; + + hook(configFile, ignoreFile); + process.on("exit", function() { + report(reporterName, null, config, ignore); + }); + } + + var hookAndCombine = function(configFile, ignoreFile) { + var files = getOptionsAndIgnore({config: configFile, ignore: ignoreFile}); + var config = files.config; + var ignore = files.ignore; + + hook(configFile, ignoreFile); + process.on("exit", function() { + combine(config); + }); + } + + var hookAndCombineAndReport = function(reporterName, configFile, ignoreFile) { + var files = getOptionsAndIgnore({config: configFile, ignore: ignoreFile}); + var config = files.config; + var ignore = files.ignore; + + hook(configFile, ignoreFile); + process.on("exit", function() { + combine(config); + report(reporterName, null, config, ignore); + }); + } + + /* ====== Command Line Parsing ====== */ + + commander + .version(pkg.version) + .option("-c, --config ", "Path to a .coverrc file") + .option("-i, --ignore ", "Path to a .coverignore file") + + commander.command("run ") + .description("Run a file and collect code coverage information for it") + .option("-d, --debug", "Enable debugging") + .option("-m, --modules", "Enable coverage for node_modules") + .action(function(file, options) { + var configs = getOptionsAndIgnore(this, options); + var config = configs.config; + var ignore = configs.ignore; + var debug = options.debug; + + // Remove the command itself + var cmdline = this.args.slice(1); + + run(file, cmdline, config, ignore, debug); + }); + + commander.command("report [reporter] [file]") + .description("Report on saved coverage data. Specify a coverage file and a reporter: " + reporterOptions) + .action(function(reporterName, file) { + var configs = getOptionsAndIgnore(this); + var config = configs.config; + var ignore = configs.ignore; + + report(reporterName, file, config, ignore); + }); + + commander.command("combine") + .description("Combine multiple coverage files (from multiple runs) into a single, reportable file") + .action(function(reporterName, file) { + var configs = getOptionsAndIgnore(this); + var config = configs.config; + var ignore = configs.ignore; + + combine(config, ignore); + }); + + var printHelp = function() { + console.log(commander.helpInformation()); + } + + commander.command("*") + .action(function() { + printHelp(); + }); + + /* ====== Exports ====== */ + + module.exports = { + parse: function(argv) { + var cmdline = commander.parse(argv); + if (!cmdline.executedCommand) { + printHelp(); + } + + return cmdline; + }, + run: run, + report: report, + hook: hook, + hookAndReport: hookAndReport, + combine: combine, + hookAndCombine: hookAndCombine, + hookAndCombineAndReport: hookAndCombineAndReport + }; +})(); + +if (module === require.main) { + module.exports.parse(process.argv); +} \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/contrib/cli-table/README.md b/node_modules/dustjs-linkedin/node_modules/cover/contrib/cli-table/README.md new file mode 100644 index 0000000..ea1e0ef --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/contrib/cli-table/README.md @@ -0,0 +1,77 @@ + +CLI Table +========= + +This utility allows you to render unicode-aided tables on the command line from +your node.js scripts. + +![Screenshot](http://cl.ly/3qxy/Screen_shot_2011-01-03_at_6.56.32_PM.png) + +## Features + +- Customizable characters that constitute the table. +- Color/background styling in the header through + [colors.js](http://github.com/marak/colors.js) +- Column width customization +- Text truncation based on predefined widths +- Text alignment (left, right, center) +- Padding (left, right) +- Easy-to-use API + +## Installation + + npm install cli-table + +## How to use + + var Table = require('cli-table'); + + // instantiate + var table = new Table({ + head: ['TH 1 label', 'TH 2 label'] + , colWidths: [100, 200] + }); + + // table is an Array, so you can `push`, `unshift`, `splice` and friends + table.push( + ['First value', 'Second value'] + , ['First value', 'Second value'] + ); + + // render + console.log(table.toString()); + +## Running tests + +Clone the repository with all its submodules and run: + + $ make test + +## Credits + +- Guillermo Rauch <guillermo@learnboost.com> ([Guille](http://github.com/guille)) + +## License + +(The MIT License) + +Copyright (c) 2010 LearnBoost <dev@learnboost.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. diff --git a/node_modules/dustjs-linkedin/node_modules/cover/contrib/cli-table/index.js b/node_modules/dustjs-linkedin/node_modules/cover/contrib/cli-table/index.js new file mode 100644 index 0000000..1c01669 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/contrib/cli-table/index.js @@ -0,0 +1,2 @@ + +module.exports = require('./lib/cli-table'); diff --git a/node_modules/dustjs-linkedin/node_modules/cover/contrib/cli-table/lib/cli-table/index.js b/node_modules/dustjs-linkedin/node_modules/cover/contrib/cli-table/lib/cli-table/index.js new file mode 100644 index 0000000..60992c1 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/contrib/cli-table/lib/cli-table/index.js @@ -0,0 +1,205 @@ + +/** + * Module dependencies. + */ + +var utils = require('./utils') + , repeat = utils.repeat + , truncate = utils.truncate + , pad = utils.pad; + +require('../../../colors'); + +/** + * Table constructor + * + * @param {Object} options + * @api public + */ + +function Table (options){ + this.options = utils.options({ + chars: { + 'top': '━' + , 'top-mid': '┳' + , 'top-left': '┏' + , 'top-right': '┓' + , 'bottom': '━' + , 'bottom-mid': '┻' + , 'bottom-left': '┗' + , 'bottom-right': '┛' + , 'left': '┃' + , 'left-mid': '┣' + , 'mid': '━' + , 'mid-mid': '╋' + , 'right': '┃' + , 'right-mid': '┫' + } + , truncate: '…' + , colWidths: [] + , colAligns: [] + , style: { + 'padding-left': 1 + , 'padding-right': 1 + , head: ['cyan'] + } + , head: [] + }, options); +}; + +/** + * Inherit from Array. + */ + +Table.prototype.__proto__ = Array.prototype; + +/** + * Width getter + * + * @return {Number} width + * @api public + */ + +Table.prototype.__defineGetter__('width', function (){ + var str = this.toString().split("\n"); + if (str.length) return str[0].length; + return 0; +}); + +/** + * Render to a string. + * + * @return {String} table representation + * @api public + */ + +Table.prototype.render +Table.prototype.toString = function (){ + var ret = '' + , options = this.options + , style = options.style + , head = options.head + , chars = options.chars + , truncater = options.truncate + , colWidths = options.colWidths || new Array(this.head.length) + , totalWidth = 0; + + if (!head.length && !this.length) return ''; + + if (!colWidths.length){ + this.slice(0).concat([head]).forEach(function(cells){ + cells.forEach(function(cell, i){ + var width = typeof cell == 'object' && cell.width != undefined + ? cell.width + : ((typeof cell == 'object' ? utils.strlen(cell.text) : utils.strlen(cell)) + (style['padding-left'] || 0) + (style['padding-right'] || 0)) + colWidths[i] = Math.max(colWidths[i] || 0, width || 0); + }); + }); + }; + + totalWidth = (colWidths.length == 1 ? colWidths[0] : colWidths.reduce( + function (a, b){ + return a + b + })) + colWidths.length + 1; + + // draws a line + function line (line, left, right, intersection){ + var width = 0 + , line = + left + + repeat(line, totalWidth - 2) + + right; + + colWidths.forEach(function (w, i){ + if (i == colWidths.length - 1) return; + width += w + 1; + line = line.substr(0, width) + intersection + line.substr(width + 1); + }); + + ret += line; + }; + + // draws the top line + function lineTop (){ + line(chars.top + , chars['top-left'] || chars.top + , chars['top-right'] || chars.top + , chars['top-mid']); + ret += "\n"; + }; + + // renders a string, by padding it or truncating it + function string (str, index){ + var str = String(typeof str == 'object' && str.text ? str.text : str) + , length = utils.strlen(str) + , width = colWidths[index] + - (style['padding-left'] || 0) + - (style['padding-right'] || 0) + , align = options.colAligns[index] || 'left'; + + return repeat(' ', style['padding-left'] || 0) + + (length == width ? str : + (length < width + ? pad(str, ( width + (str.length - length) ), ' ', align == 'left' ? 'right' : + (align == 'middle' ? 'both' : 'left')) + : (truncater ? truncate(str, width, truncater) : str)) + ) + + repeat(' ', style['padding-right'] || 0); + }; + + if (head.length){ + lineTop(); + + ret += chars.left; + + head.forEach(function (th, index){ + var text = string(th, index); + if (style.head){ + style.head.forEach(function(style){ + text = text[style]; + }); + } + + ret += text; + ret += chars.right; + }); + + ret += "\n"; + } + + if (this.length) + this.forEach(function (cells, i){ + if (!head.length && i == 0) + lineTop(); + else { + line(chars.mid + , chars['left-mid'] + , chars['right-mid'] + , chars['mid-mid']); + + ret += "\n" + chars.left; + + cells.forEach(function(cell, i){ + ret += string(cell, i); + ret += chars.right; + }); + + ret += "\n"; + } + }); + + line(chars.bottom + , chars['bottom-left'] || chars.bottom + , chars['bottom-right'] || chars.bottom + , chars['bottom-mid']); + + return ret; +}; + +/** + * Module exports. + */ + +module.exports = Table; + +module.exports.version = '0.0.1'; \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/contrib/cli-table/lib/cli-table/utils.js b/node_modules/dustjs-linkedin/node_modules/cover/contrib/cli-table/lib/cli-table/utils.js new file mode 100644 index 0000000..892a93c --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/contrib/cli-table/lib/cli-table/utils.js @@ -0,0 +1,95 @@ + +/** + * Repeats a string. + * + * @param {String} char(s) + * @param {Number} number of times + * @return {String} repeated string + */ + +exports.repeat = function (str, times){ + return Array(times + 1).join(str); +}; + +/** + * Pads a string + * + * @api public + */ + +exports.pad = function (str, len, pad, dir) { + if (len + 1 >= str.length) + switch (dir){ + case 'left': + str = Array(len + 1 - str.length).join(pad) + str; + break; + + case 'both': + var right = Math.ceil((padlen = len - str.length) / 2); + var left = padlen - right; + str = Array(left + 1).join(pad) + str + Array(right + 1).join(pad); + break; + + default: + str = str + Array(len + 1 - str.length).join(pad); + }; + + return str; +}; + +/** + * Truncates a string + * + * @api public + */ + +exports.truncate = function (str, length, chr){ + chr = chr || '…'; + return str.length >= length ? str.substr(0, length - chr.length) + chr : str; +}; + +/** + * Copies and merges options with defaults. + * + * @param {Object} defaults + * @param {Object} supplied options + * @return {Object} new (merged) object + */ + +function clone(a){ + var b; + if (Array.isArray(a)){ + b = []; + for (var i = 0, l = a.length; i < l; i++) + b.push(typeof a[i] == 'object' ? clone(a[i]) : a[i]); + return b; + } else if (typeof a == 'object'){ + b = {}; + for (var i in a) + b[i] = typeof a[i] == 'object' ? clone(a[i]) : a[i]; + return b; + } + return a; +}; + +exports.options = function (defaults, opts){ + var c = clone(opts); + for (var i in defaults) + if (!(i in opts)) + c[i] = defaults[i]; + return c; +}; + + +// +// For consideration of terminal "color" programs like colors.js, +// which can add ANSI escape color codes to strings, +// we destyle the ANSI color escape codes for padding calculations. +// +// see: http://en.wikipedia.org/wiki/ANSI_escape_code +// +exports.strlen = function(str){ + var code = /\u001b\[\d+m/g; + var stripped = ("" + str).replace(code,''); + return stripped.length; +} \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/contrib/colors.js b/node_modules/dustjs-linkedin/node_modules/cover/contrib/colors.js new file mode 100644 index 0000000..b981317 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/contrib/colors.js @@ -0,0 +1,304 @@ +/* +colors.js + +Copyright (c) 2010 + +Marak Squires +Alexis Sellier (cloudhead) + +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. + +*/ + +var isHeadless = false; + +if (typeof module !== 'undefined') { + isHeadless = true; +} + +if (!isHeadless) { + var exports = {}; + var module = {}; + var colors = exports; + exports.mode = "browser"; +} else { + exports.mode = "console"; +} + +// +// Prototypes the string object to have additional method calls that add terminal colors +// +var addProperty = function (color, func) { + exports[color] = function (str) { + return func.apply(str); + }; + String.prototype.__defineGetter__(color, func); +}; + + + +function stylize(str, style) { + + var styles; + + if (exports.mode === 'console') { + styles = { + //styles + 'bold' : ['\033[1m', '\033[22m'], + 'italic' : ['\033[3m', '\033[23m'], + 'underline' : ['\033[4m', '\033[24m'], + 'inverse' : ['\033[7m', '\033[27m'], + //grayscale + 'white' : ['\033[37m', '\033[39m'], + 'grey' : ['\033[90m', '\033[39m'], + 'black' : ['\033[30m', '\033[39m'], + //colors + 'blue' : ['\033[34m', '\033[39m'], + 'cyan' : ['\033[36m', '\033[39m'], + 'green' : ['\033[32m', '\033[39m'], + 'magenta' : ['\033[35m', '\033[39m'], + 'red' : ['\033[31m', '\033[39m'], + 'yellow' : ['\033[33m', '\033[39m'] + }; + } else if (exports.mode === 'browser') { + styles = { + //styles + 'bold' : ['', ''], + 'italic' : ['', ''], + 'underline' : ['', ''], + 'inverse' : ['', ''], + //grayscale + 'white' : ['', ''], + 'grey' : ['', ''], + 'black' : ['', ''], + //colors + 'blue' : ['', ''], + 'cyan' : ['', ''], + 'green' : ['', ''], + 'magenta' : ['', ''], + 'red' : ['', ''], + 'yellow' : ['', ''] + }; + } else if (exports.mode === 'none') { + return str; + } else { + console.log('unsupported mode, try "browser", "console" or "none"'); + } + return styles[style][0] + str + styles[style][1]; +} + +function applyTheme(theme) { + + // + // Remark: This is a list of methods that exist + // on String that you should not overwrite. + // + var stringPrototypeBlacklist = [ + '__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', 'charAt', 'constructor', + 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf', 'charCodeAt', + 'indexOf', 'lastIndexof', 'length', 'localeCompare', 'match', 'replace', 'search', 'slice', 'split', 'substring', + 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toUpperCase', 'trim', 'trimLeft', 'trimRight' + ]; + + Object.keys(theme).forEach(function (prop) { + if (stringPrototypeBlacklist.indexOf(prop) !== -1) { + console.log('warn: '.red + ('String.prototype' + prop).magenta + ' is probably something you don\'t want to override. Ignoring style name'); + } else { + addProperty(prop, function () { + return exports[theme[prop]](this); + }); + } + }); +} + + +// +// Iterate through all default styles and colors +// +var x = ['bold', 'underline', 'italic', 'inverse', 'grey', 'black', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta']; +x.forEach(function (style) { + + // __defineGetter__ at the least works in more browsers + // http://robertnyman.com/javascript/javascript-getters-setters.html + // Object.defineProperty only works in Chrome + addProperty(style, function () { + return stylize(this, style); + }); +}); + +function sequencer(map) { + return function () { + if (!isHeadless) { + return this.replace(/( )/, '$1'); + } + var exploded = this.split(""), i = 0; + exploded = exploded.map(map); + return exploded.join(""); + }; +} + +var rainbowMap = (function () { + var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta']; //RoY G BiV + return function (letter, i, exploded) { + if (letter === " ") { + return letter; + } else { + return stylize(letter, rainbowColors[i++ % rainbowColors.length]); + } + }; +})(); + +exports.themes = {}; + +exports.addSequencer = function (name, map) { + addProperty(name, sequencer(map)); +}; + +exports.addSequencer('rainbow', rainbowMap); +exports.addSequencer('zebra', function (letter, i, exploded) { + return i % 2 === 0 ? letter : letter.inverse; +}); + +exports.setTheme = function (theme) { + if (typeof theme === 'string') { + try { + exports.themes[theme] = require(theme); + applyTheme(exports.themes[theme]); + return exports.themes[theme]; + } catch (err) { + console.log(err); + return err; + } + } else { + applyTheme(theme); + } +}; + + +addProperty('stripColors', function () { + return ("" + this).replace(/\u001b\[\d+m/g, ''); +}); + +// please no +function zalgo(text, options) { + var soul = { + "up" : [ + '̍', '̎', '̄', '̅', + '̿', '̑', '̆', '̐', + '͒', '͗', '͑', '̇', + '̈', '̊', '͂', '̓', + '̈', '͊', '͋', '͌', + '̃', '̂', '̌', '͐', + '̀', '́', '̋', '̏', + '̒', '̓', '̔', '̽', + '̉', 'ͣ', 'ͤ', 'ͥ', + 'ͦ', 'ͧ', 'ͨ', 'ͩ', + 'ͪ', 'ͫ', 'ͬ', 'ͭ', + 'ͮ', 'ͯ', '̾', '͛', + '͆', '̚' + ], + "down" : [ + '̖', '̗', '̘', '̙', + '̜', '̝', '̞', '̟', + '̠', '̤', '̥', '̦', + '̩', '̪', '̫', '̬', + '̭', '̮', '̯', '̰', + '̱', '̲', '̳', '̹', + '̺', '̻', '̼', 'ͅ', + '͇', '͈', '͉', '͍', + '͎', '͓', '͔', '͕', + '͖', '͙', '͚', '̣' + ], + "mid" : [ + '̕', '̛', '̀', '́', + '͘', '̡', '̢', '̧', + '̨', '̴', '̵', '̶', + '͜', '͝', '͞', + '͟', '͠', '͢', '̸', + '̷', '͡', ' ҉' + ] + }, + all = [].concat(soul.up, soul.down, soul.mid), + zalgo = {}; + + function randomNumber(range) { + var r = Math.floor(Math.random() * range); + return r; + } + + function is_char(character) { + var bool = false; + all.filter(function (i) { + bool = (i === character); + }); + return bool; + } + + function heComes(text, options) { + var result = '', counts, l; + options = options || {}; + options["up"] = options["up"] || true; + options["mid"] = options["mid"] || true; + options["down"] = options["down"] || true; + options["size"] = options["size"] || "maxi"; + text = text.split(''); + for (l in text) { + if (is_char(l)) { + continue; + } + result = result + text[l]; + counts = {"up" : 0, "down" : 0, "mid" : 0}; + switch (options.size) { + case 'mini': + counts.up = randomNumber(8); + counts.min = randomNumber(2); + counts.down = randomNumber(8); + break; + case 'maxi': + counts.up = randomNumber(16) + 3; + counts.min = randomNumber(4) + 1; + counts.down = randomNumber(64) + 3; + break; + default: + counts.up = randomNumber(8) + 1; + counts.mid = randomNumber(6) / 2; + counts.down = randomNumber(8) + 1; + break; + } + + var arr = ["up", "mid", "down"]; + for (var d in arr) { + var index = arr[d]; + for (var i = 0 ; i <= counts[index]; i++) { + if (options[index]) { + result = result + soul[index][randomNumber(soul[index].length)]; + } + } + } + } + return result; + } + return heComes(text); +} + + +// don't summon zalgo +addProperty('zalgo', function () { + return zalgo(this); +}); \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/contrib/commander.js b/node_modules/dustjs-linkedin/node_modules/cover/contrib/commander.js new file mode 100644 index 0000000..1a00e97 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/contrib/commander.js @@ -0,0 +1,1108 @@ + +/*! + * commander + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/*! + * Console + */ +var util = require('util'); +var fs = require("fs"); + +/* Monkey patching */ +if (!util.format) { + var formatRegExp = /%[sdj%]/g; + util.format = function(f) { + if (typeof f !== 'string') { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(util.inspect(arguments[i])); + } + return objects.join(' '); + } + + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x) { + if (i >= len) return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': return JSON.stringify(args[i++]); + case '%%': return '%'; + default: + return x; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (x === null || typeof x !== 'object') { + str += ' ' + x; + } else { + str += ' ' + util.inspect(x); + } + } + return str; + } +} + +var consoleFlush = function(data) { + if (!Buffer.isBuffer(data)) { + data= new Buffer(''+ data); + } + if (data.length) { + var written= 0; + do { + try { + var len = data.length- written; + written += fs.writeSync(process.stdout.fd, data, written, len, -1); + } + catch (e) { + } + } while(written < data.length); + } +}; + +/** + * Module dependencies. + */ + +var EventEmitter = require('events').EventEmitter + , path = require('path') + , tty = require('tty') + , basename = path.basename; + +/** + * Expose the root command. + */ + +exports = module.exports = new Command; + +/** + * Expose `Command`. + */ + +exports.Command = Command; + +/** + * Expose `Option`. + */ + +exports.Option = Option; + +/** + * Initialize a new `Option` with the given `flags` and `description`. + * + * @param {String} flags + * @param {String} description + * @api public + */ + +function Option(flags, description) { + this.flags = flags; + this.required = ~flags.indexOf('<'); + this.optional = ~flags.indexOf('['); + this.bool = !~flags.indexOf('-no-'); + flags = flags.split(/[ ,|]+/); + if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift(); + this.long = flags.shift(); + this.description = description; +} + +/** + * Return option name. + * + * @return {String} + * @api private + */ + +Option.prototype.name = function(){ + return this.long + .replace('--', '') + .replace('no-', ''); +}; + +/** + * Check if `arg` matches the short or long flag. + * + * @param {String} arg + * @return {Boolean} + * @api private + */ + +Option.prototype.is = function(arg){ + return arg == this.short + || arg == this.long; +}; + +/** + * Initialize a new `Command`. + * + * @param {String} name + * @api public + */ + +function Command(name) { + this.commands = []; + this.options = []; + this.args = []; + this.name = name; + this.opts = {}; +} + +/** + * Inherit from `EventEmitter.prototype`. + */ + +Command.prototype.__proto__ = EventEmitter.prototype; + +/** + * Add command `name`. + * + * The `.action()` callback is invoked when the + * command `name` is specified via __ARGV__, + * and the remaining arguments are applied to the + * function for access. + * + * When the `name` is "*" an un-matched command + * will be passed as the first arg, followed by + * the rest of __ARGV__ remaining. + * + * Examples: + * + * program + * .version('0.0.1') + * .option('-C, --chdir ', 'change the working directory') + * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') + * .option('-T, --no-tests', 'ignore test hook') + * + * program + * .command('setup') + * .description('run remote setup commands') + * .action(function(){ + * console.log('setup'); + * }); + * + * program + * .command('exec ') + * .description('run the given remote command') + * .action(function(cmd){ + * console.log('exec "%s"', cmd); + * }); + * + * program + * .command('*') + * .description('deploy the given env') + * .action(function(env){ + * console.log('deploying "%s"', env); + * }); + * + * program.parse(process.argv); + * + * @param {String} name + * @return {Command} the new command + * @api public + */ + +Command.prototype.command = function(name){ + var args = name.split(/ +/); + var cmd = new Command(args.shift()); + this.commands.push(cmd); + cmd.parseExpectedArgs(args); + cmd.parent = this; + return cmd; +}; + +/** + * Parse expected `args`. + * + * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. + * + * @param {Array} args + * @return {Command} for chaining + * @api public + */ + +Command.prototype.parseExpectedArgs = function(args){ + if (!args.length) return; + var self = this; + args.forEach(function(arg){ + switch (arg[0]) { + case '<': + self.args.push({ required: true, name: arg.slice(1, -1) }); + break; + case '[': + self.args.push({ required: false, name: arg.slice(1, -1) }); + break; + } + }); + return this; +}; + +/** + * Register callback `fn` for the command. + * + * Examples: + * + * program + * .command('help') + * .description('display verbose help') + * .action(function(){ + * // output help here + * }); + * + * @param {Function} fn + * @return {Command} for chaining + * @api public + */ + +Command.prototype.action = function(fn){ + var self = this; + this.parent.on(this.name, function(args, unknown){ + + args = args.slice(); + // Parse any so-far unknown options + unknown = unknown || []; + var parsed = self.parseOptions(unknown); + + // Output help if necessary + outputHelpIfNecessary(self, parsed.unknown); + + // If there are still any unknown options, then we simply + // die, unless someone asked for help, in which case we give it + // to them, and then we die. + if (parsed.unknown.length > 0) { + self.unknownOption(parsed.unknown[0]); + } + + // If we were expecting a required option and we missed it, + // error out + self.options.forEach(function(option, i) { + var oname = option.name(); + var name = camelcase(oname); + if (option.isPresenceRequired && self[name] === undefined && !parsed.required[oname]) { + self.optionMissing(option); + } + }); + + self.args.forEach(function(arg, i){ + if (arg.required && null == args[i]) { + self.missingArgument(arg.name); + } + }); + + // Always append ourselves to the end of the arguments, + // to make sure we match the number of arguments the user + // expects + // If we have expected arguments and we have at most the number of + // expected arguments, then add it to the end. If not, push us + // at the end (for the case of varargs). + if (self.args.length && (args.length <= self.args.length - 1)) { + args[self.args.length] = self; + } else { + args.push(self); + } + + fn.apply(this, args); + }); + return this; +}; + +/** + * Define option with `flags`, `description` and optional + * coercion `fn`. + * + * The `flags` string should contain both the short and long flags, + * separated by comma, a pipe or space. The following are all valid + * all will output this way when `--help` is used. + * + * "-p, --pepper" + * "-p|--pepper" + * "-p --pepper" + * + * Examples: + * + * // simple boolean defaulting to false + * program.option('-p, --pepper', 'add pepper'); + * + * --pepper + * program.pepper + * // => Boolean + * + * // simple boolean defaulting to false + * program.option('-C, --no-cheese', 'remove cheese'); + * + * program.cheese + * // => true + * + * --no-cheese + * program.cheese + * // => true + * + * // required argument + * program.option('-C, --chdir ', 'change the working directory'); + * + * --chdir /tmp + * program.chdir + * // => "/tmp" + * + * // optional argument + * program.option('-c, --cheese [type]', 'add cheese [marble]'); + * + * @param {String} flags + * @param {String} description + * @param {Function|Mixed} fn or default + * @param {Mixed} defaultValue + * @return {Command} for chaining + * @api public + */ + +Command.prototype.option = function(flags, description, fn, defaultValue, isRequired){ + var self = this + , option = new Option(flags, description) + , oname = option.name() + , name = camelcase(oname); + + // default as 3rd arg + if ('function' != typeof fn) isRequired = defaultValue, defaultValue = fn, fn = null; + + // preassign default value only for --no-*, [optional], or + if (false == option.bool || option.optional || option.required) { + // when --no-* we make sure default is true + if (false == option.bool) defaultValue = true; + // preassign only if we have a default + if (undefined !== defaultValue) self[name] = defaultValue; + } + + option.isPresenceRequired = isRequired; + + // register the option + this.options.push(option); + + // when it's passed assign the value + // and conditionally invoke the callback + this.on(oname, function(val){ + // coercion + if (null != val && fn) val = fn(val); + + // unassigned or bool + if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) { + // if no value, bool true, and we have a default, then use it! + if (null == val) { + self[name] = self.opts[name] = option.bool + ? defaultValue || true + : false; + } else { + self[name] = self.opts[name] = val; + } + } else if (null !== val) { + // reassign + self[name] = self.opts[name] = val; + } + }); + + return this; +}; + +/** + * Parse `argv`, settings options and invoking commands when defined. + * + * @param {Array} argv + * @return {Command} for chaining + * @api public + */ + +Command.prototype.parse = function(argv){ + // store raw args + this.rawArgs = argv; + + // guess name + if (!this.name) this.name = basename(argv[1]); + + // process argv + var parsed = this.parseOptions(this.normalize(argv.slice(2))); + this.args = parsed.args; + return this.parseArgs(this.args, parsed.unknown, parsed.required); +}; + +/** + * Normalize `args`, splitting joined short flags. For example + * the arg "-abc" is equivalent to "-a -b -c". + * + * @param {Array} args + * @return {Array} + * @api private + */ + +Command.prototype.normalize = function(args){ + var ret = [] + , arg; + + for (var i = 0, len = args.length; i < len; ++i) { + arg = args[i]; + if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) { + arg.slice(1).split('').forEach(function(c){ + ret.push('-' + c); + }); + } else { + ret.push(arg); + } + } + + return ret; +}; + +/** + * Parse command `args`. + * + * When listener(s) are available those + * callbacks are invoked, otherwise the "*" + * event is emitted and those actions are invoked. + * + * @param {Array} args + * @return {Command} for chaining + * @api private + */ + +Command.prototype.parseArgs = function(args, unknown, required){ + var cmds = this.commands + , len = cmds.length + , self = this + , name; + + if (args.length) { + name = args[0]; + if (this.listeners(name).length) { + var commandName = args.shift(); + this.executedCommand = commandName; + this.emit(commandName, args, unknown); + } else { + this.executedCommand = "*"; + this.emit('*', args); + } + } else { + outputHelpIfNecessary(this, unknown); + + // If there were no args and we have unknown options, + // then they are extraneous and we need to error. + if (unknown.length > 0) { + this.unknownOption(unknown[0]); + } + + // If we were expecting a required option and we missed it, + // error out + this.options.forEach(function(option, i) { + var oname = option.name(); + var name = camelcase(oname); + if (option.isPresenceRequired && self[name] === undefined && !required[oname]) { + self.optionMissing(option); + } + }); + } + + return this; +}; + +/** + * Return an option matching `arg` if any. + * + * @param {String} arg + * @return {Option} + * @api private + */ + +Command.prototype.optionFor = function(arg){ + for (var i = 0, len = this.options.length; i < len; ++i) { + if (this.options[i].is(arg)) { + return this.options[i]; + } + } +}; + +/** + * Parse options from `argv` returning `argv` + * void of these options. + * + * @param {Array} argv + * @return {Array} + * @api public + */ + +Command.prototype.parseOptions = function(argv){ + var args = [] + , len = argv.length + , literal + , option + , arg; + + var unknownOptions = []; + var required = {}; + + // parse options + for (var i = 0; i < len; ++i) { + arg = argv[i]; + + // literal args after -- + if ('--' == arg) { + literal = true; + continue; + } + + if (literal) { + args.push(arg); + continue; + } + + // find matching Option + option = this.optionFor(arg); + + // option is defined + if (option) { + if (option.isPresenceRequired) { + required[option.name()] = true; + } + + // requires arg + if (option.required) { + arg = argv[++i]; + if (null == arg) return this.optionMissingArgument(option); + if ('-' == arg[0]) return this.optionMissingArgument(option, arg); + this.emit(option.name(), arg); + // optional arg + } else if (option.optional) { + arg = argv[i+1]; + if (null == arg || '-' == arg[0]) { + arg = null; + } else { + ++i; + } + this.emit(option.name(), arg); + // bool + } else { + this.emit(option.name()); + } + continue; + } + + // looks like an option + if (arg.length > 1 && '-' == arg[0]) { + unknownOptions.push(arg); + + // If the next argument looks like it might be + // an argument for this option, we pass it on. + // If it isn't, then it'll simply be ignored + if (argv[i+1] && '-' != argv[i+1][0]) { + unknownOptions.push(argv[++i]); + } + continue; + } + + // arg + args.push(arg); + } + + return { args: args, unknown: unknownOptions, required: required }; +}; + +/** + * Argument `name` is missing. + * + * @param {String} name + * @api private + */ + +Command.prototype.missingArgument = function(name){ + console.error(); + console.error(" error: missing required argument `%s'", name); + console.error(); + process.exit(1); +}; + +/** + * `Option` is missing an argument, but received `flag` or nothing. + * + * @param {String} option + * @param {String} flag + * @api private + */ + +Command.prototype.optionMissingArgument = function(option, flag){ + console.error(); + if (flag) { + console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag); + } else { + console.error(" error: option `%s' argument missing", option.flags); + } + console.error(); + process.exit(1); +}; + +/** + * `Option` is missing. + * + * @param {String} option + * @param {String} flag + * @api private + */ + +Command.prototype.optionMissing = function(option){ + console.error(); + console.error(" error: option `%s' is missing", option.name()); + console.error(); + process.exit(1); +}; + +/** + * Unknown option `flag`. + * + * @param {String} flag + * @api private + */ + +Command.prototype.unknownOption = function(flag){ + console.error(); + console.error(" error: unknown option `%s'", flag); + console.error(); + process.exit(1); +}; + +/** + * Set the program version to `str`. + * + * This method auto-registers the "-V, --version" flag + * which will print the version number when passed. + * + * @param {String} str + * @param {String} flags + * @return {Command} for chaining + * @api public + */ + +Command.prototype.version = function(str, flags){ + if (0 == arguments.length) return this._version; + this._version = str; + flags = flags || '-V, --version'; + this.option(flags, 'output the version number'); + this.on('version', function(){ + console.log(str); + process.exit(0); + }); + return this; +}; + +/** + * Set the description `str`. + * + * @param {String} str + * @return {String|Command} + * @api public + */ + +Command.prototype.description = function(str){ + if (0 == arguments.length) return this._description; + this._description = str; + return this; +}; + +/** + * Set / get the command usage `str`. + * + * @param {String} str + * @return {String|Command} + * @api public + */ + +Command.prototype.usage = function(str){ + var args = this.args.map(function(arg){ + return arg.required + ? '<' + arg.name + '>' + : '[' + arg.name + ']'; + }); + + var usage = '[options' + + (this.commands.length ? '] [command' : '') + + ']' + + (this.args.length ? ' ' + args : ''); + if (0 == arguments.length) return this._usage || usage; + this._usage = str; + + return this; +}; + +/** + * Return the largest option length. + * + * @return {Number} + * @api private + */ + +Command.prototype.largestOptionLength = function(){ + return this.options.reduce(function(max, option){ + return Math.max(max, option.flags.length); + }, 0); +}; + +/** + * Return help for options. + * + * @return {String} + * @api private + */ + +Command.prototype.optionHelp = function(){ + var width = this.largestOptionLength(); + + // Prepend the help information + return [pad('-h, --help', width) + ' ' + 'output usage information'] + .concat(this.options.map(function(option){ + return pad(option.flags, width) + + ' ' + option.description; + })) + .join('\n'); +}; + +/** + * Return command help documentation. + * + * @return {String} + * @api private + */ + +Command.prototype.commandHelp = function(){ + if (!this.commands.length) return ''; + return [ + '' + , ' Commands:' + , '' + , this.commands.map(function(cmd){ + var args = cmd.args.map(function(arg){ + return arg.required + ? '<' + arg.name + '>' + : '[' + arg.name + ']'; + }).join(' '); + + return cmd.name + + (cmd.options.length + ? ' [options]' + : '') + ' ' + args + + (cmd.description() + ? '\n' + cmd.description() + : ''); + }).join('\n\n').replace(/^/gm, ' ') + , '' + ].join('\n'); +}; + +/** + * Return program help documentation. + * + * @return {String} + * @api private + */ + +Command.prototype.helpInformation = function(){ + return [ + '' + , ' Usage: ' + this.name + ' ' + this.usage() + , '' + this.commandHelp() + , ' Options:' + , '' + , '' + this.optionHelp().replace(/^/gm, ' ') + , '' + , '' + ].join('\n'); +}; + +/** + * Prompt for a `Number`. + * + * @param {String} str + * @param {Function} fn + * @api private + */ + +Command.prototype.promptForNumber = function(str, fn){ + var self = this; + this.promptSingleLine(str, function parseNumber(val){ + val = Number(val); + if (isNaN(val)) return self.promptSingleLine(str + '(must be a number) ', parseNumber); + fn(val); + }); +}; + +/** + * Prompt for a `Date`. + * + * @param {String} str + * @param {Function} fn + * @api private + */ + +Command.prototype.promptForDate = function(str, fn){ + var self = this; + this.promptSingleLine(str, function parseDate(val){ + val = new Date(val); + if (isNaN(val.getTime())) return self.promptSingleLine(str + '(must be a date) ', parseDate); + fn(val); + }); +}; + +/** + * Single-line prompt. + * + * @param {String} str + * @param {Function} fn + * @api private + */ + +Command.prototype.promptSingleLine = function(str, fn){ + if ('function' == typeof arguments[2]) { + return this['promptFor' + (fn.name || fn)](str, arguments[2]); + } + + process.stdout.write(str); + process.stdin.setEncoding('utf8'); + process.stdin.once('data', function(val){ + fn(val.trim()); + }).resume(); +}; + +/** + * Multi-line prompt. + * + * @param {String} str + * @param {Function} fn + * @api private + */ + +Command.prototype.promptMultiLine = function(str, fn){ + var buf = []; + console.log(str); + process.stdin.setEncoding('utf8'); + process.stdin.on('data', function(val){ + if ('\n' == val || '\r\n' == val) { + process.stdin.removeAllListeners('data'); + fn(buf.join('\n')); + } else { + buf.push(val.trimRight()); + } + }).resume(); +}; + +/** + * Prompt `str` and callback `fn(val)` + * + * Commander supports single-line and multi-line prompts. + * To issue a single-line prompt simply add white-space + * to the end of `str`, something like "name: ", whereas + * for a multi-line prompt omit this "description:". + * + * + * Examples: + * + * program.prompt('Username: ', function(name){ + * console.log('hi %s', name); + * }); + * + * program.prompt('Description:', function(desc){ + * console.log('description was "%s"', desc.trim()); + * }); + * + * @param {String} str + * @param {Function} fn + * @api public + */ + +Command.prototype.prompt = function(str, fn){ + if (/ $/.test(str)) return this.promptSingleLine.apply(this, arguments); + this.promptMultiLine(str, fn); +}; + +/** + * Prompt for password with `str`, `mask` char and callback `fn(val)`. + * + * The mask string defaults to '', aka no output is + * written while typing, you may want to use "*" etc. + * + * Examples: + * + * program.password('Password: ', function(pass){ + * console.log('got "%s"', pass); + * process.stdin.destroy(); + * }); + * + * program.password('Password: ', '*', function(pass){ + * console.log('got "%s"', pass); + * process.stdin.destroy(); + * }); + * + * @param {String} str + * @param {String} mask + * @param {Function} fn + * @api public + */ + +Command.prototype.password = function(str, mask, fn){ + var self = this + , buf = ''; + + // default mask + if ('function' == typeof mask) { + fn = mask; + mask = ''; + } + + tty.setRawMode(true); + process.stdout.write(str); + + // keypress + process.stdin.on('keypress', function(c, key){ + if (key && 'enter' == key.name) { + console.log(); + process.stdin.removeAllListeners('keypress'); + tty.setRawMode(false); + if (!buf.trim().length) return self.password(str, mask, fn); + fn(buf); + return; + } + + if (key && key.ctrl && 'c' == key.name) { + console.log('%s', buf); + process.exit(); + } + + process.stdout.write(mask); + buf += c; + }).resume(); +}; + +/** + * Confirmation prompt with `str` and callback `fn(bool)` + * + * Examples: + * + * program.confirm('continue? ', function(ok){ + * console.log(' got %j', ok); + * process.stdin.destroy(); + * }); + * + * @param {String} str + * @param {Function} fn + * @api public + */ + + +Command.prototype.confirm = function(str, fn){ + var self = this; + this.prompt(str, function(ok){ + if (!ok.trim()) { + return self.confirm(str, fn); + } + fn(parseBool(ok)); + }); +}; + +/** + * Choice prompt with `list` of items and callback `fn(index, item)` + * + * Examples: + * + * var list = ['tobi', 'loki', 'jane', 'manny', 'luna']; + * + * console.log('Choose the coolest pet:'); + * program.choose(list, function(i){ + * console.log('you chose %d "%s"', i, list[i]); + * process.stdin.destroy(); + * }); + * + * @param {Array} list + * @param {Function} fn + * @api public + */ + +Command.prototype.choose = function(list, fn){ + var self = this; + + list.forEach(function(item, i){ + console.log(' %d) %s', i + 1, item); + }); + + function again() { + self.prompt(' : ', function(val){ + val = parseInt(val, 10) - 1; + if (null == list[val]) { + again(); + } else { + fn(val, list[val]); + } + }); + } + + again(); +}; + +/** + * Camel-case the given `flag` + * + * @param {String} flag + * @return {String} + * @api private + */ + +function camelcase(flag) { + return flag.split('-').reduce(function(str, word){ + return str + word[0].toUpperCase() + word.slice(1); + }); +} + +/** + * Parse a boolean `str`. + * + * @param {String} str + * @return {Boolean} + * @api private + */ + +function parseBool(str) { + return /^y|yes|ok|true$/i.test(str); +} + +/** + * Pad `str` to `width`. + * + * @param {String} str + * @param {Number} width + * @return {String} + * @api private + */ + +function pad(str, width) { + var len = Math.max(0, width - str.length); + return str + Array(len + 1).join(' '); +} + +/** + * Output help information if necessary + * + * @param {Command} command to output help for + * @param {Array} array of options to search for -h or --help + * @api private + */ + +function outputHelpIfNecessary(cmd, options) { + options = options || []; + for (var i = 0; i < options.length; i++) { + if (options[i] == '--help' || options[i] == '-h') { + process.on('exit', function() { + consoleFlush(cmd.helpInformation()); + cmd.emit('--help'); + consoleFlush(""); + }); + process.exit(); + } + + return true; + } +} diff --git a/node_modules/dustjs-linkedin/node_modules/cover/contrib/escodegen.js b/node_modules/dustjs-linkedin/node_modules/cover/contrib/escodegen.js new file mode 100644 index 0000000..2eaf1ad --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/contrib/escodegen.js @@ -0,0 +1,843 @@ +/* + Copyright (C) 2012 Ariya Hidayat + Copyright (C) 2012 Mathias Bynens + Copyright (C) 2012 Joost-Wim Boekesteijn + Copyright (C) 2012 Kris Kowal + Copyright (C) 2012 Yusuke Suzuki + Copyright (C) 2012 Arpad Borsos + Copyright (C) 2011 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint bitwise:true */ +/*global escodegen:true, exports:true, generateStatement: true*/ + +(function (exports) { + 'use strict'; + + var Syntax, + Precedence, + BinaryPrecedence, + base, + indent, + extra, + parse; + + Syntax = { + AssignmentExpression: 'AssignmentExpression', + ArrayExpression: 'ArrayExpression', + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DoWhileStatement: 'DoWhileStatement', + DebuggerStatement: 'DebuggerStatement', + EmptyStatement: 'EmptyStatement', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + Identifier: 'Identifier', + IfStatement: 'IfStatement', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + Program: 'Program', + Property: 'Property', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SwitchStatement: 'SwitchStatement', + SwitchCase: 'SwitchCase', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement' + }; + + Precedence = { + Sequence: 0, + Assignment: 1, + Conditional: 2, + LogicalOR: 3, + LogicalAND: 4, + LogicalXOR: 5, + BitwiseOR: 6, + BitwiseAND: 7, + Equality: 8, + Relational: 9, + BitwiseSHIFT: 10, + Additive: 11, + Multiplicative: 12, + Unary: 13, + Postfix: 14, + Call: 15, + New: 16, + Member: 17, + Primary: 18 + }; + + BinaryPrecedence = { + '||': Precedence.LogicalOR, + '&&': Precedence.LogicalAND, + '^': Precedence.LogicalXOR, + '|': Precedence.BitwiseOR, + '&': Precedence.BitwiseAND, + '==': Precedence.Equality, + '!=': Precedence.Equality, + '===': Precedence.Equality, + '!==': Precedence.Equality, + '<': Precedence.Relational, + '>': Precedence.Relational, + '<=': Precedence.Relational, + '>=': Precedence.Relational, + 'in': Precedence.Relational, + 'instanceof': Precedence.Relational, + '<<': Precedence.BitwiseSHIFT, + '>>': Precedence.BitwiseSHIFT, + '>>>': Precedence.BitwiseSHIFT, + '+': Precedence.Additive, + '-': Precedence.Additive, + '*': Precedence.Multiplicative, + '%': Precedence.Multiplicative, + '/': Precedence.Multiplicative + }; + + if (typeof Object.freeze === 'function') { + Object.freeze(Syntax); + Object.freeze(Precedence); + Object.freeze(BinaryPrecedence); + } + + function unicodeEscape(ch) { + var result, i; + result = ch.charCodeAt(0).toString(16); + for (i = result.length; i < 4; i += 1) { + result = '0' + result; + } + return '\\u' + result; + } + + function stringToArray(str) { + var length = str.length, + result = [], + i; + for (i = 0; i < length; i += 1) { + result[i] = str.charAt(i); + } + return result; + } + + function escapeString(str) { + var result = '', i, len, ch; + + if (typeof str[0] === 'undefined') { + str = stringToArray(str); + } + + for (i = 0, len = str.length; i < len; i += 1) { + ch = str[i]; + if ('\'\\\b\f\n\r\t'.indexOf(ch) >= 0) { + result += '\\'; + switch (ch) { + case '\'': + result += '\''; + break; + case '\\': + result += '\\'; + break; + case '\b': + result += 'b'; + break; + case '\f': + result += 'f'; + break; + case '\n': + result += 'n'; + break; + case '\r': + result += 'r'; + break; + case '\t': + result += 't'; + break; + } + } else if (ch < ' ' || ch.charCodeAt(0) >= 0x80) { + result += unicodeEscape(ch); + } else { + result += ch; + } + } + + return '\'' + result + '\''; + } + + function addIndent(stmt) { + return base + stmt; + } + + function parenthesize(text, current, should) { + return (current < should) ? '(' + text + ')' : text; + } + + function maybeBlock(stmt, suffix) { + var previousBase, result; + + if (stmt.type === Syntax.BlockStatement) { + result = ' ' + generateStatement(stmt); + if (suffix) { + return result + ' '; + } + return result; + } + + if (stmt.type === Syntax.EmptyStatement) { + result = ';'; + } else { + previousBase = base; + base += indent; + result = '\n' + addIndent(generateStatement(stmt)); + base = previousBase; + } + + if (suffix) { + return result + '\n' + addIndent(''); + } + return result; + } + + function generateFunctionBody(node) { + var result, i, len; + result = '('; + for (i = 0, len = node.params.length; i < len; i += 1) { + result += node.params[i].name; + if ((i + 1) < len) { + result += ', '; + } + } + return result + ')' + maybeBlock(node.body); + } + + function generateExpression(expr, precedence) { + var result, currentPrecedence, previousBase, i, len, raw; + + if (!precedence) { + precedence = Precedence.Sequence; + } + + switch (expr.type) { + case Syntax.SequenceExpression: + result = ''; + for (i = 0, len = expr.expressions.length; i < len; i += 1) { + result += generateExpression(expr.expressions[i], Precedence.Assignment); + if ((i + 1) < len) { + result += ', '; + } + } + result = parenthesize(result, Precedence.Sequence, precedence); + break; + + case Syntax.AssignmentExpression: + result = parenthesize( + generateExpression(expr.left, Precedence.Call) + ' ' + expr.operator + ' ' + + generateExpression(expr.right, Precedence.Assignment), + Precedence.Assignment, + precedence + ); + break; + + case Syntax.ConditionalExpression: + result = parenthesize( + generateExpression(expr.test, Precedence.LogicalOR) + ' ? ' + + generateExpression(expr.consequent, Precedence.Assignment) + ' : ' + + generateExpression(expr.alternate, Precedence.Assignment), + Precedence.Conditional, + precedence + ); + break; + + case Syntax.LogicalExpression: + case Syntax.BinaryExpression: + currentPrecedence = BinaryPrecedence[expr.operator]; + + result = generateExpression(expr.left, currentPrecedence) + + ' ' + expr.operator + ' ' + + generateExpression(expr.right, currentPrecedence + 1); + if (expr.operator === 'in') { + // TODO parenthesize only in allowIn = false case + result = '(' + result + ')'; + } else { + result = parenthesize(result, currentPrecedence, precedence); + } + break; + + case Syntax.CallExpression: + result = ''; + for (i = 0, len = expr['arguments'].length; i < len; i += 1) { + result += generateExpression(expr['arguments'][i], Precedence.Assignment); + if ((i + 1) < len) { + result += ', '; + } + } + result = parenthesize( + generateExpression(expr.callee, Precedence.Call) + '(' + result + ')', + Precedence.Call, + precedence + ); + break; + + case Syntax.NewExpression: + result = ''; + for (i = 0, len = expr['arguments'].length; i < len; i += 1) { + result += generateExpression(expr['arguments'][i], Precedence.Assignment); + if ((i + 1) < len) { + result += ', '; + } + } + result = parenthesize( + 'new ' + generateExpression(expr.callee, Precedence.New) + '(' + result + ')', + Precedence.New, + precedence + ); + break; + + case Syntax.MemberExpression: + result = generateExpression(expr.object, Precedence.Call); + if (expr.computed) { + result += '[' + generateExpression(expr.property) + ']'; + } else { + if (expr.object.type === Syntax.Literal && typeof expr.object.value === 'number') { + if (result.indexOf('.') < 0) { + if (!/[eExX]/.test(result) && !(result.length >= 2 && result[0] === '0')) { + result += '.'; + } + } + } + result += '.' + expr.property.name; + } + result = parenthesize(result, Precedence.Member, precedence); + break; + + case Syntax.UnaryExpression: + result = expr.operator; + if (result.length > 2) { + result += ' '; + } + result = parenthesize( + result + generateExpression(expr.argument, Precedence.Unary + + ( + expr.argument.type === Syntax.UnaryExpression && + expr.operator.length < 3 && + expr.argument.operator === expr.operator ? 1 : 0 + ) + ), + Precedence.Unary, + precedence + ); + break; + + case Syntax.UpdateExpression: + if (expr.prefix) { + result = parenthesize( + expr.operator + + generateExpression(expr.argument, Precedence.Unary), + Precedence.Unary, + precedence + ); + } else { + result = parenthesize( + generateExpression(expr.argument, Precedence.Postfix) + + expr.operator, + Precedence.Postfix, + precedence + ); + } + break; + + case Syntax.FunctionExpression: + result = 'function '; + if (expr.id) { + result += expr.id.name; + } + result += generateFunctionBody(expr); + break; + + case Syntax.ArrayExpression: + if (!expr.elements.length) { + result = '[]'; + break; + } + result = '[\n'; + previousBase = base; + base += indent; + for (i = 0, len = expr.elements.length; i < len; i += 1) { + if (!expr.elements[i]) { + result += addIndent(''); + if ((i + 1) === len) { + result += ','; + } + } else { + result += addIndent(generateExpression(expr.elements[i], Precedence.Assignment)); + } + if ((i + 1) < len) { + result += ',\n'; + } + } + base = previousBase; + result += '\n' + addIndent(']'); + break; + + case Syntax.Property: + if (expr.kind === 'get' || expr.kind === 'set') { + result = expr.kind + ' ' + generateExpression(expr.key) + + generateFunctionBody(expr.value); + } else { + result = generateExpression(expr.key) + ': ' + + generateExpression(expr.value, Precedence.Assignment); + } + break; + + case Syntax.ObjectExpression: + if (!expr.properties.length) { + result = '{}'; + break; + } + result = '{\n'; + previousBase = base; + base += indent; + for (i = 0, len = expr.properties.length; i < len; i += 1) { + result += addIndent(generateExpression(expr.properties[i])); + if ((i + 1) < len) { + result += ',\n'; + } + } + base = previousBase; + result += '\n' + addIndent('}'); + break; + + case Syntax.ThisExpression: + result = 'this'; + break; + + case Syntax.Identifier: + result = expr.name; + break; + + case Syntax.Literal: + if (expr.hasOwnProperty('raw') && parse) { + try { + raw = parse(expr.raw).body[0].expression; + if (raw.type === Syntax.Literal) { + if (raw.value === expr.value) { + result = expr.raw; + break; + } + } + } catch (e) { + // not use raw property + } + } + + if (expr.value === null) { + result = 'null'; + break; + } + + if (typeof expr.value === 'string') { + result = escapeString(expr.value); + break; + } + + if (typeof expr.value === 'number' && expr.value === Infinity) { + // Infinity is variable + result = '1e+1000'; + break; + } + + result = expr.value.toString(); + break; + + default: + break; + } + + if (result === undefined) { + throw new Error('Unknown expression type: ' + expr.type); + } + return result; + } + + function generateStatement(stmt) { + var i, len, result, previousBase; + + switch (stmt.type) { + case Syntax.BlockStatement: + result = '{\n'; + + previousBase = base; + base += indent; + for (i = 0, len = stmt.body.length; i < len; i += 1) { + result += addIndent(generateStatement(stmt.body[i])) + '\n'; + } + base = previousBase; + + result += addIndent('}'); + break; + + case Syntax.BreakStatement: + if (stmt.label) { + result = 'break ' + stmt.label.name + ';'; + } else { + result = 'break;'; + } + break; + + case Syntax.ContinueStatement: + if (stmt.label) { + result = 'continue ' + stmt.label.name + ';'; + } else { + result = 'continue;'; + } + break; + + case Syntax.DoWhileStatement: + result = 'do' + maybeBlock(stmt.body, true) + 'while (' + generateExpression(stmt.test) + ');'; + break; + + case Syntax.CatchClause: + previousBase = base; + base += indent; + result = ' catch (' + generateExpression(stmt.param) + ')'; + base = previousBase; + result += maybeBlock(stmt.body); + break; + + case Syntax.DebuggerStatement: + result = 'debugger;'; + break; + + case Syntax.EmptyStatement: + result = ';'; + break; + + case Syntax.ExpressionStatement: + result = generateExpression(stmt.expression); + // 12.4 '{', 'function' is not allowed in this position. + // wrap espression with parentheses + if (result[0] === '{' || result.indexOf('function ') === 0) { + result = '(' + result + ');'; + } else { + result += ';'; + } + break; + + case Syntax.VariableDeclarator: + if (stmt.init) { + result = stmt.id.name + ' = ' + generateExpression(stmt.init, Precedence.Assignment); + } else { + result = stmt.id.name; + } + break; + + case Syntax.VariableDeclaration: + result = stmt.kind + ' '; + // special path for + // var x = function () { + // }; + if (stmt.declarations.length === 1 && stmt.declarations[0].init && + stmt.declarations[0].init.type === Syntax.FunctionExpression) { + result += generateStatement(stmt.declarations[0]); + } else { + previousBase = base; + base += indent; + for (i = 0, len = stmt.declarations.length; i < len; i += 1) { + result += generateStatement(stmt.declarations[i]); + if ((i + 1) < len) { + result += ', '; + } + } + base = previousBase; + } + result += ';'; + break; + + case Syntax.ThrowStatement: + result = 'throw ' + generateExpression(stmt.argument) + ';'; + break; + + case Syntax.TryStatement: + result = 'try' + maybeBlock(stmt.block); + for (i = 0, len = stmt.handlers.length; i < len; i += 1) { + result += generateStatement(stmt.handlers[i]); + } + if (stmt.finalizer) { + result += ' finally' + maybeBlock(stmt.finalizer); + } + break; + + case Syntax.SwitchStatement: + previousBase = base; + base += indent; + result = 'switch (' + generateExpression(stmt.discriminant) + ') {\n'; + base = previousBase; + if (stmt.cases) { + for (i = 0, len = stmt.cases.length; i < len; i += 1) { + result += addIndent(generateStatement(stmt.cases[i])) + '\n'; + } + } + result += addIndent('}'); + break; + + case Syntax.SwitchCase: + previousBase = base; + base += indent; + if (stmt.test) { + result = 'case ' + generateExpression(stmt.test) + ':'; + } else { + result = 'default:'; + } + + i = 0; + len = stmt.consequent.length; + if (len && stmt.consequent[0].type === Syntax.BlockStatement) { + result += maybeBlock(stmt.consequent[0]); + i = 1; + } + + for (; i < len; i += 1) { + result += '\n' + addIndent(generateStatement(stmt.consequent[i])); + } + + base = previousBase; + break; + + case Syntax.IfStatement: + if (stmt.alternate) { + if (stmt.alternate.type === Syntax.IfStatement) { + previousBase = base; + base += indent; + result = 'if (' + generateExpression(stmt.test) + ')'; + base = previousBase; + result += maybeBlock(stmt.consequent, true) + 'else ' + generateStatement(stmt.alternate); + } else { + previousBase = base; + base += indent; + result = 'if (' + generateExpression(stmt.test) + ')'; + base = previousBase; + result += maybeBlock(stmt.consequent, true) + 'else' + maybeBlock(stmt.alternate); + } + } else { + previousBase = base; + base += indent; + result = 'if (' + generateExpression(stmt.test) + ')'; + base = previousBase; + result += maybeBlock(stmt.consequent); + } + break; + + case Syntax.ForStatement: + previousBase = base; + base += indent; + result = 'for ('; + if (stmt.init) { + if (stmt.init.type === Syntax.VariableDeclaration) { + result += generateStatement(stmt.init); + } else { + result += generateExpression(stmt.init) + ';'; + } + } else { + result += ';'; + } + + if (stmt.test) { + result += ' ' + generateExpression(stmt.test) + ';'; + } else { + result += ';'; + } + + if (stmt.update) { + result += ' ' + generateExpression(stmt.update) + ')'; + } else { + result += ')'; + } + base = previousBase; + + result += maybeBlock(stmt.body); + break; + + case Syntax.ForInStatement: + result = 'for ('; + if (stmt.left.type === Syntax.VariableDeclaration) { + previousBase = base; + base += indent + indent; + result += stmt.left.kind + ' ' + generateStatement(stmt.left.declarations[0]); + base = previousBase; + } else { + previousBase = base; + base += indent; + result += generateExpression(stmt.left, Precedence.Call); + base = previousBase; + } + + previousBase = base; + base += indent; + result += ' in ' + generateExpression(stmt.right) + ')'; + base = previousBase; + result += maybeBlock(stmt.body); + break; + + case Syntax.LabeledStatement: + result = stmt.label.name + ':' + maybeBlock(stmt.body); + break; + + case Syntax.Program: + result = ''; + for (i = 0, len = stmt.body.length; i < len; i += 1) { + result += generateStatement(stmt.body[i]); + if ((i + 1) < len) { + result += '\n'; + } + } + break; + + case Syntax.FunctionDeclaration: + result = 'function '; + if (stmt.id) { + result += stmt.id.name; + } + result += generateFunctionBody(stmt); + break; + + case Syntax.ReturnStatement: + if (stmt.argument) { + result = 'return ' + generateExpression(stmt.argument) + ';'; + } else { + result = 'return;'; + } + break; + + case Syntax.WhileStatement: + previousBase = base; + base += indent; + result = 'while (' + generateExpression(stmt.test) + ')'; + base = previousBase; + result += maybeBlock(stmt.body); + break; + + case Syntax.WithStatement: + previousBase = base; + base += indent; + result = 'with (' + generateExpression(stmt.object) + ')'; + base = previousBase; + result += maybeBlock(stmt.body); + break; + + default: + break; + } + + if (result === undefined) { + throw new Error('Unknown statement type: ' + stmt.type); + } + return result; + } + + function generate(node, options) { + if (typeof options !== 'undefined') { + base = options.base || ''; + indent = options.indent || ' '; + parse = options.parse; + } else { + base = ''; + indent = ' '; + parse = null; + } + + switch (node.type) { + case Syntax.BlockStatement: + case Syntax.BreakStatement: + case Syntax.CatchClause: + case Syntax.ContinueStatement: + case Syntax.DoWhileStatement: + case Syntax.DebuggerStatement: + case Syntax.EmptyStatement: + case Syntax.ExpressionStatement: + case Syntax.ForStatement: + case Syntax.ForInStatement: + case Syntax.FunctionDeclaration: + case Syntax.IfStatement: + case Syntax.LabeledStatement: + case Syntax.Program: + case Syntax.ReturnStatement: + case Syntax.SwitchStatement: + case Syntax.SwitchCase: + case Syntax.ThrowStatement: + case Syntax.TryStatement: + case Syntax.VariableDeclaration: + case Syntax.VariableDeclarator: + case Syntax.WhileStatement: + case Syntax.WithStatement: + return generateStatement(node); + + case Syntax.AssignmentExpression: + case Syntax.ArrayExpression: + case Syntax.BinaryExpression: + case Syntax.CallExpression: + case Syntax.ConditionalExpression: + case Syntax.FunctionExpression: + case Syntax.Identifier: + case Syntax.Literal: + case Syntax.LogicalExpression: + case Syntax.MemberExpression: + case Syntax.NewExpression: + case Syntax.ObjectExpression: + case Syntax.Property: + case Syntax.SequenceExpression: + case Syntax.ThisExpression: + case Syntax.UnaryExpression: + case Syntax.UpdateExpression: + return generateExpression(node); + + default: + break; + } + throw new Error('Unknown node type: ' + node.type); + } + + // Sync with package.json. + exports.version = '0.0.3-dev'; + + exports.generate = generate; + +}(typeof exports === 'undefined' ? (escodegen = {}) : exports)); +/* vim: set sw=4 ts=4 et tw=80 : */ \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/contrib/esprima.js b/node_modules/dustjs-linkedin/node_modules/cover/contrib/esprima.js new file mode 100644 index 0000000..8a11eba --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/contrib/esprima.js @@ -0,0 +1,3744 @@ +/* + Copyright (C) 2012 Ariya Hidayat + Copyright (C) 2012 Mathias Bynens + Copyright (C) 2012 Joost-Wim Boekesteijn + Copyright (C) 2012 Kris Kowal + Copyright (C) 2012 Yusuke Suzuki + Copyright (C) 2012 Arpad Borsos + Copyright (C) 2011 Ariya Hidayat + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*jslint bitwise:true */ +/*global esprima:true, exports:true, +throwError: true, createLiteral: true, generateStatement: true, +parseAssignmentExpression: true, parseBlock: true, parseExpression: true, +parseFunctionDeclaration: true, parseFunctionExpression: true, +parseFunctionSourceElements: true, parseVariableIdentifier: true, +parseLeftHandSideExpression: true, +parseStatement: true, parseSourceElement: true */ + +(function (exports) { + 'use strict'; + + var Token, + TokenName, + Syntax, + PropertyKind, + Messages, + Regex, + source, + allowIn, + lastParenthesized, + strict, + index, + lineNumber, + lineStart, + length, + buffer, + extra, + labelSet, + inIteration, + inSwitch, + inFunctionBody; + + Token = { + BooleanLiteral: 1, + EOF: 2, + Identifier: 3, + Keyword: 4, + NullLiteral: 5, + NumericLiteral: 6, + Punctuator: 7, + StringLiteral: 8 + }; + + TokenName = {}; + TokenName[Token.BooleanLiteral] = 'Boolean'; + TokenName[Token.EOF] = ''; + TokenName[Token.Identifier] = 'Identifier'; + TokenName[Token.Keyword] = 'Keyword'; + TokenName[Token.NullLiteral] = 'Null'; + TokenName[Token.NumericLiteral] = 'Numeric'; + TokenName[Token.Punctuator] = 'Punctuator'; + TokenName[Token.StringLiteral] = 'String'; + + Syntax = { + AssignmentExpression: 'AssignmentExpression', + ArrayExpression: 'ArrayExpression', + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DoWhileStatement: 'DoWhileStatement', + DebuggerStatement: 'DebuggerStatement', + EmptyStatement: 'EmptyStatement', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + Identifier: 'Identifier', + IfStatement: 'IfStatement', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + Program: 'Program', + Property: 'Property', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SwitchStatement: 'SwitchStatement', + SwitchCase: 'SwitchCase', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement' + }; + + PropertyKind = { + Data: 1, + Get: 2, + Set: 4 + }; + + // Error messages should be identical to V8. + Messages = { + UnexpectedToken: 'Unexpected token %0', + UnexpectedNumber: 'Unexpected number', + UnexpectedString: 'Unexpected string', + UnexpectedIdentifier: 'Unexpected identifier', + UnexpectedReserved: 'Unexpected reserved word', + UnexpectedEOS: 'Unexpected end of input', + NewlineAfterThrow: 'Illegal newline after throw', + InvalidRegExp: 'Invalid regular expression', + UnterminatedRegExp: 'Invalid regular expression: missing /', + InvalidLHSInAssignment: 'Invalid left-hand side in assignment', + InvalidLHSInForIn: 'Invalid left-hand side in for-in', + NoCatchOrFinally: 'Missing catch or finally after try', + UnknownLabel: 'Undefined label \'%0\'', + Redeclaration: '%0 \'%1\' has already been declared', + IllegalContinue: 'Illegal continue statement', + IllegalBreak: 'Illegal break statement', + IllegalReturn: 'Illegal return statement', + StrictModeWith: 'Strict mode code may not include a with statement', + StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode', + StrictVarName: 'Variable name may not be eval or arguments in strict mode', + StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode', + StrictParamDupe: 'Strict mode function may not have duplicate parameter names', + StrictFunctionName: 'Function name may not be eval or arguments in strict mode', + StrictOctalLiteral: 'Octal literals are not allowed in strict mode.', + StrictDelete: 'Delete of an unqualified identifier in strict mode.', + StrictDuplicateProperty: 'Duplicate data property in object literal not allowed in strict mode', + AccessorDataProperty: 'Object literal may not have data and accessor property with the same name', + AccessorGetSet: 'Object literal may not have multiple get/set accessors with the same name', + StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode', + StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode', + StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode', + StrictReservedWord: 'Use of future reserved word in strict mode' + }; + + // See also tools/generate-unicode-regex.py. + Regex = { + NonAsciiIdentifierStart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]'), + NonAsciiIdentifierPart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0300-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u0483-\u0487\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u05d0-\u05ea\u05f0-\u05f2\u0610-\u061a\u0620-\u0669\u066e-\u06d3\u06d5-\u06dc\u06df-\u06e8\u06ea-\u06fc\u06ff\u0710-\u074a\u074d-\u07b1\u07c0-\u07f5\u07fa\u0800-\u082d\u0840-\u085b\u08a0\u08a2-\u08ac\u08e4-\u08fe\u0900-\u0963\u0966-\u096f\u0971-\u0977\u0979-\u097f\u0981-\u0983\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bc-\u09c4\u09c7\u09c8\u09cb-\u09ce\u09d7\u09dc\u09dd\u09df-\u09e3\u09e6-\u09f1\u0a01-\u0a03\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a59-\u0a5c\u0a5e\u0a66-\u0a75\u0a81-\u0a83\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abc-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ad0\u0ae0-\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3c-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b5c\u0b5d\u0b5f-\u0b63\u0b66-\u0b6f\u0b71\u0b82\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd0\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c58\u0c59\u0c60-\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbc-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0cde\u0ce0-\u0ce3\u0ce6-\u0cef\u0cf1\u0cf2\u0d02\u0d03\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d-\u0d44\u0d46-\u0d48\u0d4a-\u0d4e\u0d57\u0d60-\u0d63\u0d66-\u0d6f\u0d7a-\u0d7f\u0d82\u0d83\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e01-\u0e3a\u0e40-\u0e4e\u0e50-\u0e59\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb9\u0ebb-\u0ebd\u0ec0-\u0ec4\u0ec6\u0ec8-\u0ecd\u0ed0-\u0ed9\u0edc-\u0edf\u0f00\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e-\u0f47\u0f49-\u0f6c\u0f71-\u0f84\u0f86-\u0f97\u0f99-\u0fbc\u0fc6\u1000-\u1049\u1050-\u109d\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u135d-\u135f\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176c\u176e-\u1770\u1772\u1773\u1780-\u17d3\u17d7\u17dc\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u1820-\u1877\u1880-\u18aa\u18b0-\u18f5\u1900-\u191c\u1920-\u192b\u1930-\u193b\u1946-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u19d0-\u19d9\u1a00-\u1a1b\u1a20-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1aa7\u1b00-\u1b4b\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1bf3\u1c00-\u1c37\u1c40-\u1c49\u1c4d-\u1c7d\u1cd0-\u1cd2\u1cd4-\u1cf6\u1d00-\u1de6\u1dfc-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u200c\u200d\u203f\u2040\u2054\u2071\u207f\u2090-\u209c\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d7f-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2de0-\u2dff\u2e2f\u3005-\u3007\u3021-\u302f\u3031-\u3035\u3038-\u303c\u3041-\u3096\u3099\u309a\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua62b\ua640-\ua66f\ua674-\ua67d\ua67f-\ua697\ua69f-\ua6f1\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua827\ua840-\ua873\ua880-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f7\ua8fb\ua900-\ua92d\ua930-\ua953\ua960-\ua97c\ua980-\ua9c0\ua9cf-\ua9d9\uaa00-\uaa36\uaa40-\uaa4d\uaa50-\uaa59\uaa60-\uaa76\uaa7a\uaa7b\uaa80-\uaac2\uaadb-\uaadd\uaae0-\uaaef\uaaf2-\uaaf6\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabea\uabec\uabed\uabf0-\uabf9\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\ufe70-\ufe74\ufe76-\ufefc\uff10-\uff19\uff21-\uff3a\uff3f\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]') + }; + + if (typeof Object.freeze === 'function') { + Object.freeze(Token); + Object.freeze(TokenName); + Object.freeze(Syntax); + Object.freeze(PropertyKind); + Object.freeze(Messages); + Object.freeze(Regex); + } + + // Ensure the condition is true, otherwise throw an error. + // This is only to have a better contract semantic, i.e. another safety net + // to catch a logic error. The condition shall be fulfilled in normal case. + // Do NOT use this to enforce a certain condition on any user input. + + function assert(condition, message) { + if (!condition) { + throw new Error('ASSERT: ' + message); + } + } + + function sliceSource(from, to) { + return source.slice(from, to); + } + + if (typeof 'esprima'[0] === 'undefined') { + sliceSource = function sliceArraySource(from, to) { + return source.slice(from, to).join(''); + }; + } + + function isDecimalDigit(ch) { + return '0123456789'.indexOf(ch) >= 0; + } + + function isHexDigit(ch) { + return '0123456789abcdefABCDEF'.indexOf(ch) >= 0; + } + + function isOctalDigit(ch) { + return '01234567'.indexOf(ch) >= 0; + } + + + // 7.2 White Space + + function isWhiteSpace(ch) { + return (ch === ' ') || (ch === '\u0009') || (ch === '\u000B') || + (ch === '\u000C') || (ch === '\u00A0') || + (ch.charCodeAt(0) >= 0x1680 && + '\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\uFEFF'.indexOf(ch) >= 0); + } + + // 7.3 Line Terminators + + function isLineTerminator(ch) { + return (ch === '\n' || ch === '\r' || ch === '\u2028' || ch === '\u2029'); + } + + // 7.6 Identifier Names and Identifiers + + function isIdentifierStart(ch) { + return (ch === '$') || (ch === '_') || (ch === '\\') || + (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || + ((ch.charCodeAt(0) >= 0x80) && Regex.NonAsciiIdentifierStart.test(ch)); + } + + function isIdentifierPart(ch) { + return (ch === '$') || (ch === '_') || (ch === '\\') || + (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || + ((ch >= '0') && (ch <= '9')) || + ((ch.charCodeAt(0) >= 0x80) && Regex.NonAsciiIdentifierPart.test(ch)); + } + + // 7.6.1.2 Future Reserved Words + + function isFutureReservedWord(id) { + switch (id) { + + // Future reserved words. + case 'class': + case 'enum': + case 'export': + case 'extends': + case 'import': + case 'super': + return true; + } + + return false; + } + + function isStrictModeReservedWord(id) { + switch (id) { + + // Strict Mode reserved words. + case 'implements': + case 'interface': + case 'package': + case 'private': + case 'protected': + case 'public': + case 'static': + case 'yield': + case 'let': + return true; + } + + return false; + } + + function isRestrictedWord(id) { + return id === 'eval' || id === 'arguments'; + } + + // 7.6.1.1 Keywords + + function isKeyword(id) { + var keyword = false; + switch (id.length) { + case 2: + keyword = (id === 'if') || (id === 'in') || (id === 'do'); + break; + case 3: + keyword = (id === 'var') || (id === 'for') || (id === 'new') || (id === 'try'); + break; + case 4: + keyword = (id === 'this') || (id === 'else') || (id === 'case') || (id === 'void') || (id === 'with'); + break; + case 5: + keyword = (id === 'while') || (id === 'break') || (id === 'catch') || (id === 'throw'); + break; + case 6: + keyword = (id === 'return') || (id === 'typeof') || (id === 'delete') || (id === 'switch'); + break; + case 7: + keyword = (id === 'default') || (id === 'finally'); + break; + case 8: + keyword = (id === 'function') || (id === 'continue') || (id === 'debugger'); + break; + case 10: + keyword = (id === 'instanceof'); + break; + } + + if (keyword) { + return true; + } + + switch (id) { + // Future reserved words. + // 'const' is specialized as Keyword in V8. + case 'const': + return true; + + // For compatiblity to SpiderMonkey and ES.next + case 'yield': + case 'let': + return true; + } + + if (strict && isStrictModeReservedWord(id)) { + return true; + } + + return isFutureReservedWord(id); + } + + // Return the next character and move forward. + + function nextChar() { + var ch; + if (index < length) { + ch = source[index]; + index += 1; + } + return ch; + } + + // 7.4 Comments + + function skipComment() { + var ch, blockComment, lineComment; + + blockComment = false; + lineComment = false; + + while (index < length) { + ch = source[index]; + + if (lineComment) { + ch = nextChar(); + if (isLineTerminator(ch)) { + lineComment = false; + if (ch === '\r' && source[index] === '\n') { + index += 1; + } + lineNumber += 1; + lineStart = index; + } + } else if (blockComment) { + if (isLineTerminator(ch)) { + if (ch === '\r' && source[index + 1] === '\n') { + index += 1; + } + lineNumber += 1; + index += 1; + lineStart = index; + if (index >= length) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } else { + ch = nextChar(); + if (index >= length) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + if (ch === '*') { + ch = source[index]; + if (ch === '/') { + index += 1; + blockComment = false; + } + } + } + } else if (ch === '/') { + ch = source[index + 1]; + if (ch === '/') { + index += 2; + lineComment = true; + } else if (ch === '*') { + index += 2; + blockComment = true; + if (index >= length) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } else { + break; + } + } else if (isWhiteSpace(ch)) { + index += 1; + } else if (isLineTerminator(ch)) { + index += 1; + if (ch === '\r' && source[index] === '\n') { + index += 1; + } + lineNumber += 1; + lineStart = index; + } else { + break; + } + } + } + + function scanHexEscape(prefix) { + var i, len, ch, code = 0; + + len = (prefix === 'u') ? 4 : 2; + for (i = 0; i < len; i += 1) { + if (index < length && isHexDigit(source[index])) { + ch = nextChar(); + code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); + } else { + return ''; + } + } + return String.fromCharCode(code); + } + + function scanIdentifier() { + var ch, start, id, restore; + + ch = source[index]; + if (!isIdentifierStart(ch)) { + return; + } + + start = index; + if (ch === '\\') { + index += 1; + if (source[index] !== 'u') { + return; + } + index += 1; + restore = index; + ch = scanHexEscape('u'); + if (ch) { + if (ch === '\\' || !isIdentifierStart(ch)) { + return; + } + id = ch; + } else { + index = restore; + id = 'u'; + } + } else { + id = nextChar(); + } + + while (index < length) { + ch = source[index]; + if (!isIdentifierPart(ch)) { + break; + } + if (ch === '\\') { + index += 1; + if (source[index] !== 'u') { + return; + } + index += 1; + restore = index; + ch = scanHexEscape('u'); + if (ch) { + if (ch === '\\' || !isIdentifierPart(ch)) { + return; + } + id += ch; + } else { + index = restore; + id += 'u'; + } + } else { + id += nextChar(); + } + } + + // There is no keyword or literal with only one character. + // Thus, it must be an identifier. + if (id.length === 1) { + return { + type: Token.Identifier, + value: id, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (isKeyword(id)) { + return { + type: Token.Keyword, + value: id, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // 7.8.1 Null Literals + + if (id === 'null') { + return { + type: Token.NullLiteral, + value: id, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // 7.8.2 Boolean Literals + + if (id === 'true' || id === 'false') { + return { + type: Token.BooleanLiteral, + value: id, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + return { + type: Token.Identifier, + value: id, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // 7.7 Punctuators + + function scanPunctuator() { + var start = index, + ch1 = source[index], + ch2, + ch3, + ch4; + + // Check for most common single-character punctuators. + + if (ch1 === ';' || ch1 === '{' || ch1 === '}') { + index += 1; + return { + type: Token.Punctuator, + value: ch1, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (ch1 === ',' || ch1 === '(' || ch1 === ')') { + index += 1; + return { + type: Token.Punctuator, + value: ch1, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // Dot (.) can also start a floating-point number, hence the need + // to check the next character. + + ch2 = source[index + 1]; + if (ch1 === '.' && !isDecimalDigit(ch2)) { + return { + type: Token.Punctuator, + value: nextChar(), + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // Peek more characters. + + ch3 = source[index + 2]; + ch4 = source[index + 3]; + + // 4-character punctuator: >>>= + + if (ch1 === '>' && ch2 === '>' && ch3 === '>') { + if (ch4 === '=') { + index += 4; + return { + type: Token.Punctuator, + value: '>>>=', + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + } + + // 3-character punctuators: === !== >>> <<= >>= + + if (ch1 === '=' && ch2 === '=' && ch3 === '=') { + index += 3; + return { + type: Token.Punctuator, + value: '===', + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (ch1 === '!' && ch2 === '=' && ch3 === '=') { + index += 3; + return { + type: Token.Punctuator, + value: '!==', + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (ch1 === '>' && ch2 === '>' && ch3 === '>') { + index += 3; + return { + type: Token.Punctuator, + value: '>>>', + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (ch1 === '<' && ch2 === '<' && ch3 === '=') { + index += 3; + return { + type: Token.Punctuator, + value: '<<=', + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + if (ch1 === '>' && ch2 === '>' && ch3 === '=') { + index += 3; + return { + type: Token.Punctuator, + value: '>>=', + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // 2-character punctuators: <= >= == != ++ -- << >> && || + // += -= *= %= &= |= ^= /= + + if (ch2 === '=') { + if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) { + index += 2; + return { + type: Token.Punctuator, + value: ch1 + ch2, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + } + + if (ch1 === ch2 && ('+-<>&|'.indexOf(ch1) >= 0)) { + if ('+-<>&|'.indexOf(ch2) >= 0) { + index += 2; + return { + type: Token.Punctuator, + value: ch1 + ch2, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + } + + // The remaining 1-character punctuators. + + if ('[]<>+-*%&|^!~?:=/'.indexOf(ch1) >= 0) { + return { + type: Token.Punctuator, + value: nextChar(), + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + } + + // 7.8.3 Numeric Literals + + function scanNumericLiteral() { + var number, start, ch; + + ch = source[index]; + assert(isDecimalDigit(ch) || (ch === '.'), + 'Numeric literal must start with a decimal digit or a decimal point'); + + start = index; + number = ''; + if (ch !== '.') { + number = nextChar(); + ch = source[index]; + + // Hex number starts with '0x'. + // Octal number starts with '0'. + if (number === '0') { + if (ch === 'x' || ch === 'X') { + number += nextChar(); + while (index < length) { + ch = source[index]; + if (!isHexDigit(ch)) { + break; + } + number += nextChar(); + } + + if (number.length <= 2) { + // only 0x + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + + if (index < length) { + ch = source[index]; + if (isIdentifierStart(ch)) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } + return { + type: Token.NumericLiteral, + value: parseInt(number, 16), + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } else if (isOctalDigit(ch)) { + number += nextChar(); + while (index < length) { + ch = source[index]; + if (!isOctalDigit(ch)) { + break; + } + number += nextChar(); + } + + if (index < length) { + ch = source[index]; + if (isIdentifierStart(ch) || isDecimalDigit(ch)) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } + return { + type: Token.NumericLiteral, + value: parseInt(number, 8), + octal: true, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // decimal number starts with '0' such as '09' is illegal. + if (isDecimalDigit(ch)) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } + + while (index < length) { + ch = source[index]; + if (!isDecimalDigit(ch)) { + break; + } + number += nextChar(); + } + } + + if (ch === '.') { + number += nextChar(); + while (index < length) { + ch = source[index]; + if (!isDecimalDigit(ch)) { + break; + } + number += nextChar(); + } + } + + if (ch === 'e' || ch === 'E') { + number += nextChar(); + + ch = source[index]; + if (ch === '+' || ch === '-') { + number += nextChar(); + } + + ch = source[index]; + if (isDecimalDigit(ch)) { + number += nextChar(); + while (index < length) { + ch = source[index]; + if (!isDecimalDigit(ch)) { + break; + } + number += nextChar(); + } + } else { + ch = 'character ' + ch; + if (index >= length) { + ch = ''; + } + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } + + if (index < length) { + ch = source[index]; + if (isIdentifierStart(ch)) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } + + return { + type: Token.NumericLiteral, + value: parseFloat(number), + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + // 7.8.4 String Literals + + function scanStringLiteral() { + var str = '', quote, start, ch, code, unescaped, restore, octal = false; + + quote = source[index]; + assert((quote === '\'' || quote === '"'), + 'String literal must starts with a quote'); + + start = index; + index += 1; + + while (index < length) { + ch = nextChar(); + + if (ch === quote) { + quote = ''; + break; + } else if (ch === '\\') { + ch = nextChar(); + if (!isLineTerminator(ch)) { + switch (ch) { + case 'n': + str += '\n'; + break; + case 'r': + str += '\r'; + break; + case 't': + str += '\t'; + break; + case 'u': + case 'x': + restore = index; + unescaped = scanHexEscape(ch); + if (unescaped) { + str += unescaped; + } else { + index = restore; + str += ch; + } + break; + case 'b': + str += '\b'; + break; + case 'f': + str += '\f'; + break; + case 'v': + str += '\v'; + break; + + default: + if (isOctalDigit(ch)) { + code = '01234567'.indexOf(ch); + + // \0 is not octal escape sequence + if (code !== 0) { + octal = true; + } + + if (index < length && isOctalDigit(source[index])) { + octal = true; + code = code * 8 + '01234567'.indexOf(nextChar()); + + // 3 digits are only allowed when string starts + // with 0, 1, 2, 3 + if ('0123'.indexOf(ch) >= 0 && + index < length && + isOctalDigit(source[index])) { + code = code * 8 + '01234567'.indexOf(nextChar()); + } + } + str += String.fromCharCode(code); + } else { + str += ch; + } + break; + } + } else { + lineNumber += 1; + if (ch === '\r' && source[index] === '\n') { + index += 1; + } + } + } else if (isLineTerminator(ch)) { + break; + } else { + str += ch; + } + } + + if (quote !== '') { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + + return { + type: Token.StringLiteral, + value: str, + octal: octal, + lineNumber: lineNumber, + lineStart: lineStart, + range: [start, index] + }; + } + + function scanRegExp() { + var str = '', ch, start, pattern, flags, value, classMarker = false, restore; + + buffer = null; + skipComment(); + + start = index; + ch = source[index]; + assert(ch === '/', 'Regular expression literal must start with a slash'); + str = nextChar(); + + while (index < length) { + ch = nextChar(); + str += ch; + if (classMarker) { + if (ch === ']') { + classMarker = false; + } + } else { + if (ch === '\\') { + str += nextChar(); + } + if (ch === '/') { + break; + } + if (ch === '[') { + classMarker = true; + } + if (isLineTerminator(ch)) { + throwError({}, Messages.UnterminatedRegExp); + } + } + } + + if (str.length === 1) { + throwError({}, Messages.UnterminatedRegExp); + } + + // Exclude leading and trailing slash. + pattern = str.substr(1, str.length - 2); + + flags = ''; + while (index < length) { + ch = source[index]; + if (!isIdentifierPart(ch)) { + break; + } + + index += 1; + if (ch === '\\' && index < length) { + ch = source[index]; + if (ch === 'u') { + index += 1; + restore = index; + ch = scanHexEscape('u'); + if (ch) { + flags += ch; + str += '\\u'; + for (; restore < index; restore += 1) { + str += source[restore]; + } + } else { + index = restore; + flags += 'u'; + str += '\\u'; + } + } else { + str += '\\'; + } + } else { + flags += ch; + str += ch; + } + } + + try { + value = new RegExp(pattern, flags); + } catch (e) { + throwError({}, Messages.InvalidRegExp); + } + + return { + literal: str, + value: value, + range: [start, index] + }; + } + + function isIdentifierName(token) { + return token.type === Token.Identifier || + token.type === Token.Keyword || + token.type === Token.BooleanLiteral || + token.type === Token.NullLiteral; + } + + function advance() { + var ch, token; + + skipComment(); + + if (index >= length) { + return { + type: Token.EOF, + lineNumber: lineNumber, + lineStart: lineStart, + range: [index, index] + }; + } + + token = scanPunctuator(); + if (typeof token !== 'undefined') { + return token; + } + + ch = source[index]; + + if (ch === '\'' || ch === '"') { + return scanStringLiteral(); + } + + if (ch === '.' || isDecimalDigit(ch)) { + return scanNumericLiteral(); + } + + token = scanIdentifier(); + if (typeof token !== 'undefined') { + return token; + } + + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + + function lex() { + var token; + + if (buffer) { + index = buffer.range[1]; + lineNumber = buffer.lineNumber; + lineStart = buffer.lineStart; + token = buffer; + buffer = null; + return token; + } + + buffer = null; + return advance(); + } + + function lookahead() { + var pos, line, start; + + if (buffer !== null) { + return buffer; + } + + pos = index; + line = lineNumber; + start = lineStart; + buffer = advance(); + index = pos; + lineNumber = line; + lineStart = start; + + return buffer; + } + + // Return true if there is a line terminator before the next token. + + function peekLineTerminator() { + var pos, line, start, found; + + pos = index; + line = lineNumber; + start = lineStart; + skipComment(); + found = lineNumber !== line; + index = pos; + lineNumber = line; + lineStart = start; + + return found; + } + + // Throw an exception + + function throwError(token, messageFormat) { + var error, + args = Array.prototype.slice.call(arguments, 2), + msg = messageFormat.replace( + /%(\d)/g, + function (whole, index) { + return args[index] || ''; + } + ); + + if (typeof token.lineNumber === 'number') { + error = new Error('Line ' + token.lineNumber + ': ' + msg); + error.index = token.range[0]; + error.lineNumber = token.lineNumber; + error.column = token.range[0] - lineStart + 1; + } else { + error = new Error('Line ' + lineNumber + ': ' + msg); + error.index = index; + error.lineNumber = lineNumber; + error.column = index - lineStart + 1; + } + + throw error; + } + + // Throw an exception because of the token. + + function throwUnexpected(token) { + var s; + + if (token.type === Token.EOF) { + throwError(token, Messages.UnexpectedEOS); + } + + if (token.type === Token.NumericLiteral) { + throwError(token, Messages.UnexpectedNumber); + } + + if (token.type === Token.StringLiteral) { + throwError(token, Messages.UnexpectedString); + } + + if (token.type === Token.Identifier) { + throwError(token, Messages.UnexpectedIdentifier); + } + + if (token.type === Token.Keyword) { + if (isFutureReservedWord(token.value)) { + throwError(token, Messages.UnexpectedReserved); + } else if (strict && isStrictModeReservedWord(token.value)) { + throwError(token, Messages.StrictReservedWord); + } + throwError(token, Messages.UnexpectedToken, token.value); + } + + // BooleanLiteral, NullLiteral, or Punctuator. + throwError(token, Messages.UnexpectedToken, token.value); + } + + // Expect the next token to match the specified punctuator. + // If not, an exception will be thrown. + + function expect(value) { + var token = lex(); + if (token.type !== Token.Punctuator || token.value !== value) { + throwUnexpected(token); + } + } + + // Expect the next token to match the specified keyword. + // If not, an exception will be thrown. + + function expectKeyword(keyword) { + var token = lex(); + if (token.type !== Token.Keyword || token.value !== keyword) { + throwUnexpected(token); + } + } + + // Return true if the next token matches the specified punctuator. + + function match(value) { + var token = lookahead(); + return token.type === Token.Punctuator && token.value === value; + } + + // Return true if the next token matches the specified keyword + + function matchKeyword(keyword) { + var token = lookahead(); + return token.type === Token.Keyword && token.value === keyword; + } + + // Return true if the next token is an assignment operator + + function matchAssign() { + var token = lookahead(), + op = token.value; + + if (token.type !== Token.Punctuator) { + return false; + } + return op === '=' || + op === '*=' || + op === '/=' || + op === '%=' || + op === '+=' || + op === '-=' || + op === '<<=' || + op === '>>=' || + op === '>>>=' || + op === '&=' || + op === '^=' || + op === '|='; + } + + function consumeSemicolon() { + var token, line; + + // Catch the very common case first. + if (source[index] === ';') { + lex(); + return; + } + + line = lineNumber; + skipComment(); + if (lineNumber !== line) { + return; + } + + if (match(';')) { + lex(); + return; + } + + token = lookahead(); + if (token.type !== Token.EOF && !match('}')) { + throwUnexpected(token); + } + return; + } + + // Return true if provided expression is LeftHandSideExpression + + function isLeftHandSide(expr) { + switch (expr.type) { + case 'AssignmentExpression': + case 'BinaryExpression': + case 'ConditionalExpression': + case 'LogicalExpression': + case 'SequenceExpression': + case 'UnaryExpression': + case 'UpdateExpression': + return false; + } + return true; + } + + // 11.1.4 Array Initialiser + + function parseArrayInitialiser() { + var elements = [], + undef; + + expect('['); + + while (!match(']')) { + if (match(',')) { + lex(); + elements.push(undef); + } else { + elements.push(parseAssignmentExpression()); + + if (!match(']')) { + expect(','); + } + } + } + + expect(']'); + + return { + type: Syntax.ArrayExpression, + elements: elements + }; + } + + // 11.1.5 Object Initialiser + + function parsePropertyFunction(param, first) { + var previousStrict, body; + + previousStrict = strict; + body = parseFunctionSourceElements(); + if (first && strict && isRestrictedWord(param[0].name)) { + throwError(first, Messages.StrictParamName); + } + strict = previousStrict; + + return { + type: Syntax.FunctionExpression, + id: null, + params: param, + body: body + }; + } + + function parseObjectPropertyKey() { + var token = lex(), + key; + + switch (token.type) { + + case Token.StringLiteral: + case Token.NumericLiteral: + if (strict && token.octal) { + throwError(token, Messages.StrictOctalLiteral); + } + key = createLiteral(token); + break; + + case Token.Identifier: + case Token.Keyword: + case Token.BooleanLiteral: + case Token.NullLiteral: + key = { + type: Syntax.Identifier, + name: token.value + }; + break; + + default: + // Unreachable, since parseObjectProperty() will not call this + // function with any other type of token. + } + + return key; + } + + function parseObjectProperty() { + var token, property, key, id, param; + + token = lookahead(); + + switch (token.type) { + + case Token.Identifier: + id = parseObjectPropertyKey(); + + // Property Assignment: Getter and Setter. + + if (token.value === 'get' && !match(':')) { + key = parseObjectPropertyKey(); + expect('('); + expect(')'); + property = { + type: Syntax.Property, + key: key, + value: parsePropertyFunction([]), + kind: 'get' + }; + } else if (token.value === 'set' && !match(':')) { + key = parseObjectPropertyKey(); + expect('('); + token = lookahead(); + if (token.type !== Token.Identifier) { + throwUnexpected(lex()); + } + param = [ parseVariableIdentifier() ]; + expect(')'); + property = { + type: Syntax.Property, + key: key, + value: parsePropertyFunction(param, token), + kind: 'set' + }; + } else { + expect(':'); + property = { + type: Syntax.Property, + key: id, + value: parseAssignmentExpression(), + kind: 'init' + }; + } + break; + + case Token.Keyword: + case Token.BooleanLiteral: + case Token.NullLiteral: + case Token.StringLiteral: + case Token.NumericLiteral: + key = parseObjectPropertyKey(); + expect(':'); + property = { + type: Syntax.Property, + key: key, + value: parseAssignmentExpression(), + kind: 'init' + }; + break; + + default: + throwUnexpected(token); + } + + return property; + } + + function parseObjectInitialiser() { + var token, properties = [], property, name, kind, map = {}, toString = String; + + expect('{'); + + while (!match('}')) { + property = parseObjectProperty(); + + if (property.key.type === Syntax.Identifier) { + name = property.key.name; + } else { + name = toString(property.key.value); + } + kind = (property.kind === 'init') ? PropertyKind.Data : (property.kind === 'get') ? PropertyKind.Get : PropertyKind.Set; + if (Object.prototype.hasOwnProperty.call(map, name)) { + if (map[name] === PropertyKind.Data) { + if (strict && kind === PropertyKind.Data) { + throwError({}, Messages.StrictDuplicateProperty); + } else if (kind !== PropertyKind.Data) { + throwError({}, Messages.AccessorDataProperty); + } + } else { + if (kind === PropertyKind.Data) { + throwError({}, Messages.AccessorDataProperty); + } else if (map[name] & kind) { + throwError({}, Messages.AccessorGetSet); + } + } + map[name] |= kind; + } else { + map[name] = kind; + } + + properties.push(property); + + if (!match('}')) { + expect(','); + } + } + + expect('}'); + + return { + type: Syntax.ObjectExpression, + properties: properties + }; + } + + // 11.1 Primary Expressions + + function parsePrimaryExpression() { + var expr, + token = lookahead(), + type = token.type; + + if (type === Token.Identifier) { + return { + type: Syntax.Identifier, + name: lex().value + }; + } + + if (type === Token.StringLiteral || type === Token.NumericLiteral) { + if (strict && token.octal) { + throwError(token, Messages.StrictOctalLiteral); + } + return createLiteral(lex()); + } + + if (type === Token.Keyword) { + if (matchKeyword('this')) { + lex(); + return { + type: Syntax.ThisExpression + }; + } + + if (matchKeyword('function')) { + return parseFunctionExpression(); + } + } + + if (type === Token.BooleanLiteral) { + lex(); + token.value = (token.value === 'true'); + return createLiteral(token); + } + + if (type === Token.NullLiteral) { + lex(); + token.value = null; + return createLiteral(token); + } + + if (match('[')) { + return parseArrayInitialiser(); + } + + if (match('{')) { + return parseObjectInitialiser(); + } + + if (match('(')) { + lex(); + lastParenthesized = expr = parseExpression(); + expect(')'); + return expr; + } + + if (match('/') || match('/=')) { + return createLiteral(scanRegExp()); + } + + return throwUnexpected(lex()); + } + + // 11.2 Left-Hand-Side Expressions + + function parseArguments() { + var args = []; + + expect('('); + + if (!match(')')) { + while (index < length) { + args.push(parseAssignmentExpression()); + if (match(')')) { + break; + } + expect(','); + } + } + + expect(')'); + + return args; + } + + function parseNonComputedProperty() { + var token = lex(); + + if (!isIdentifierName(token)) { + throwUnexpected(token); + } + + return { + type: Syntax.Identifier, + name: token.value + }; + } + + function parseNonComputedMember(object) { + return { + type: Syntax.MemberExpression, + computed: false, + object: object, + property: parseNonComputedProperty() + }; + } + + function parseComputedMember(object) { + var property, expr; + + expect('['); + property = parseExpression(); + expr = { + type: Syntax.MemberExpression, + computed: true, + object: object, + property: property + }; + expect(']'); + return expr; + } + + function parseCallMember(object) { + return { + type: Syntax.CallExpression, + callee: object, + 'arguments': parseArguments() + }; + } + + function parseNewExpression() { + var expr; + + expectKeyword('new'); + + expr = { + type: Syntax.NewExpression, + callee: parseLeftHandSideExpression(), + 'arguments': [] + }; + + if (match('(')) { + expr['arguments'] = parseArguments(); + } + + return expr; + } + + function parseLeftHandSideExpressionAllowCall() { + var useNew, expr; + + useNew = matchKeyword('new'); + expr = useNew ? parseNewExpression() : parsePrimaryExpression(); + + while (index < length) { + if (match('.')) { + lex(); + expr = parseNonComputedMember(expr); + } else if (match('[')) { + expr = parseComputedMember(expr); + } else if (match('(')) { + expr = parseCallMember(expr); + } else { + break; + } + } + + return expr; + } + + function parseLeftHandSideExpression() { + var useNew, expr; + + useNew = matchKeyword('new'); + expr = useNew ? parseNewExpression() : parsePrimaryExpression(); + + while (index < length) { + if (match('.')) { + lex(); + expr = parseNonComputedMember(expr); + } else if (match('[')) { + expr = parseComputedMember(expr); + } else { + break; + } + } + + return expr; + } + + // 11.3 Postfix Expressions + + function parsePostfixExpression() { + var expr = parseLeftHandSideExpressionAllowCall(); + + if ((match('++') || match('--')) && !peekLineTerminator()) { + // 11.3.1, 11.3.2 + if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) { + throwError({}, Messages.StrictLHSPostfix); + } + expr = { + type: Syntax.UpdateExpression, + operator: lex().value, + argument: expr, + prefix: false + }; + } + + return expr; + } + + // 11.4 Unary Operators + + function parseUnaryExpression() { + var token, expr; + + if (match('++') || match('--')) { + token = lex(); + expr = parseUnaryExpression(); + // 11.4.4, 11.4.5 + if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) { + throwError({}, Messages.StrictLHSPrefix); + } + expr = { + type: Syntax.UpdateExpression, + operator: token.value, + argument: expr, + prefix: true + }; + return expr; + } + + if (match('+') || match('-') || match('~') || match('!')) { + expr = { + type: Syntax.UnaryExpression, + operator: lex().value, + argument: parseUnaryExpression() + }; + return expr; + } + + if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) { + expr = { + type: Syntax.UnaryExpression, + operator: lex().value, + argument: parseUnaryExpression() + }; + if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) { + throwError({}, Messages.StrictDelete); + } + return expr; + } + + return parsePostfixExpression(); + } + + // 11.5 Multiplicative Operators + + function parseMultiplicativeExpression() { + var expr = parseUnaryExpression(); + + while (match('*') || match('/') || match('%')) { + expr = { + type: Syntax.BinaryExpression, + operator: lex().value, + left: expr, + right: parseUnaryExpression() + }; + } + + return expr; + } + + // 11.6 Additive Operators + + function parseAdditiveExpression() { + var expr = parseMultiplicativeExpression(); + + while (match('+') || match('-')) { + expr = { + type: Syntax.BinaryExpression, + operator: lex().value, + left: expr, + right: parseMultiplicativeExpression() + }; + } + + return expr; + } + + // 11.7 Bitwise Shift Operators + + function parseShiftExpression() { + var expr = parseAdditiveExpression(); + + while (match('<<') || match('>>') || match('>>>')) { + expr = { + type: Syntax.BinaryExpression, + operator: lex().value, + left: expr, + right: parseAdditiveExpression() + }; + } + + return expr; + } + // 11.8 Relational Operators + + function parseRelationalExpression() { + var expr, previousAllowIn; + + previousAllowIn = allowIn; + allowIn = true; + expr = parseShiftExpression(); + allowIn = previousAllowIn; + + if (match('<') || match('>') || match('<=') || match('>=')) { + expr = { + type: Syntax.BinaryExpression, + operator: lex().value, + left: expr, + right: parseRelationalExpression() + }; + } else if (allowIn && matchKeyword('in')) { + lex(); + expr = { + type: Syntax.BinaryExpression, + operator: 'in', + left: expr, + right: parseRelationalExpression() + }; + } else if (matchKeyword('instanceof')) { + lex(); + expr = { + type: Syntax.BinaryExpression, + operator: 'instanceof', + left: expr, + right: parseRelationalExpression() + }; + } + + return expr; + } + + // 11.9 Equality Operators + + function parseEqualityExpression() { + var expr = parseRelationalExpression(); + + while (match('==') || match('!=') || match('===') || match('!==')) { + expr = { + type: Syntax.BinaryExpression, + operator: lex().value, + left: expr, + right: parseRelationalExpression() + }; + } + + return expr; + } + + // 11.10 Binary Bitwise Operators + + function parseBitwiseANDExpression() { + var expr = parseEqualityExpression(); + + while (match('&')) { + lex(); + expr = { + type: Syntax.BinaryExpression, + operator: '&', + left: expr, + right: parseEqualityExpression() + }; + } + + return expr; + } + + function parseBitwiseORExpression() { + var expr = parseBitwiseANDExpression(); + + while (match('|')) { + lex(); + expr = { + type: Syntax.BinaryExpression, + operator: '|', + left: expr, + right: parseBitwiseANDExpression() + }; + } + + return expr; + } + + function parseBitwiseXORExpression() { + var expr = parseBitwiseORExpression(); + + while (match('^')) { + lex(); + expr = { + type: Syntax.BinaryExpression, + operator: '^', + left: expr, + right: parseBitwiseORExpression() + }; + } + + return expr; + } + + // 11.11 Binary Logical Operators + + function parseLogicalANDExpression() { + var expr = parseBitwiseXORExpression(); + + while (match('&&')) { + lex(); + expr = { + type: Syntax.LogicalExpression, + operator: '&&', + left: expr, + right: parseBitwiseXORExpression() + }; + } + + return expr; + } + + function parseLogicalORExpression() { + var expr = parseLogicalANDExpression(); + + while (match('||')) { + lex(); + expr = { + type: Syntax.LogicalExpression, + operator: '||', + left: expr, + right: parseLogicalANDExpression() + }; + } + + return expr; + } + + // 11.12 Conditional Operator + + function parseConditionalExpression() { + var expr, previousAllowIn, consequent; + + expr = parseLogicalORExpression(); + + if (match('?')) { + lex(); + previousAllowIn = allowIn; + allowIn = true; + consequent = parseAssignmentExpression(); + allowIn = previousAllowIn; + expect(':'); + + expr = { + type: Syntax.ConditionalExpression, + test: expr, + consequent: consequent, + alternate: parseAssignmentExpression() + }; + } + + return expr; + } + + // 11.13 Assignment Operators + + function parseAssignmentExpression() { + var expr; + + expr = parseConditionalExpression(); + + if (matchAssign()) { + // LeftHandSideExpression + if (lastParenthesized !== expr && !isLeftHandSide(expr)) { + throwError({}, Messages.InvalidLHSInAssignment); + } + + // 11.13.1 + if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) { + throwError({}, Messages.StrictLHSAssignment); + } + + expr = { + type: Syntax.AssignmentExpression, + operator: lex().value, + left: expr, + right: parseAssignmentExpression() + }; + } + + return expr; + } + + // 11.14 Comma Operator + + function parseExpression() { + var expr = parseAssignmentExpression(); + + if (match(',')) { + expr = { + type: Syntax.SequenceExpression, + expressions: [ expr ] + }; + + while (index < length) { + if (!match(',')) { + break; + } + lex(); + expr.expressions.push(parseAssignmentExpression()); + } + + } + return expr; + } + + // 12.1 Block + + function parseStatementList() { + var list = [], + statement; + + while (index < length) { + if (match('}')) { + break; + } + statement = parseSourceElement(); + if (typeof statement === 'undefined') { + break; + } + list.push(statement); + } + + return list; + } + + function parseBlock() { + var block; + + expect('{'); + + block = parseStatementList(); + + expect('}'); + + return { + type: Syntax.BlockStatement, + body: block + }; + } + + // 12.2 Variable Statement + + function parseVariableIdentifier() { + var token = lex(); + + if (token.type !== Token.Identifier) { + throwUnexpected(token); + } + + return { + type: Syntax.Identifier, + name: token.value + }; + } + + function parseVariableDeclaration(kind) { + var id = parseVariableIdentifier(), + init = null; + + // 12.2.1 + if (strict && isRestrictedWord(id.name)) { + throwError({}, Messages.StrictVarName); + } + + if (kind === 'const') { + expect('='); + init = parseAssignmentExpression(); + } else if (match('=')) { + lex(); + init = parseAssignmentExpression(); + } + + return { + type: Syntax.VariableDeclarator, + id: id, + init: init + }; + } + + function parseVariableDeclarationList(kind) { + var list = []; + + while (index < length) { + list.push(parseVariableDeclaration(kind)); + if (!match(',')) { + break; + } + lex(); + } + + return list; + } + + function parseVariableStatement() { + var declarations; + + expectKeyword('var'); + + declarations = parseVariableDeclarationList(); + + consumeSemicolon(); + + return { + type: Syntax.VariableDeclaration, + declarations: declarations, + kind: 'var' + }; + } + + // kind may be `const` or `let` + // Both are experimental and not in the specification yet. + // see http://wiki.ecmascript.org/doku.php?id=harmony:const + // and http://wiki.ecmascript.org/doku.php?id=harmony:let + function parseConstLetDeclaration(kind) { + var declarations; + + expectKeyword(kind); + + declarations = parseVariableDeclarationList(kind); + + consumeSemicolon(); + + return { + type: Syntax.VariableDeclaration, + declarations: declarations, + kind: kind + }; + } + + // 12.3 Empty Statement + + function parseEmptyStatement() { + expect(';'); + + return { + type: Syntax.EmptyStatement + }; + } + + // 12.4 Expression Statement + + function parseExpressionStatement() { + var expr = parseExpression(); + + consumeSemicolon(); + + return { + type: Syntax.ExpressionStatement, + expression: expr + }; + } + + // 12.5 If statement + + function parseIfStatement() { + var test, consequent, alternate; + + expectKeyword('if'); + + expect('('); + + test = parseExpression(); + + expect(')'); + + consequent = parseStatement(); + + if (matchKeyword('else')) { + lex(); + alternate = parseStatement(); + } else { + alternate = null; + } + + return { + type: Syntax.IfStatement, + test: test, + consequent: consequent, + alternate: alternate + }; + } + + // 12.6 Iteration Statements + + function parseDoWhileStatement() { + var body, test, oldInIteration; + + expectKeyword('do'); + + oldInIteration = inIteration; + inIteration = true; + + body = parseStatement(); + + inIteration = oldInIteration; + + expectKeyword('while'); + + expect('('); + + test = parseExpression(); + + expect(')'); + + if (match(';')) { + lex(); + } + + return { + type: Syntax.DoWhileStatement, + body: body, + test: test + }; + } + + function parseWhileStatement() { + var test, body, oldInIteration; + + expectKeyword('while'); + + expect('('); + + test = parseExpression(); + + expect(')'); + + oldInIteration = inIteration; + inIteration = true; + + body = parseStatement(); + + inIteration = oldInIteration; + + return { + type: Syntax.WhileStatement, + test: test, + body: body + }; + } + + function parseForVariableDeclaration() { + var token = lex(); + + return { + type: Syntax.VariableDeclaration, + declarations: parseVariableDeclarationList(), + kind: token.value + }; + } + + function parseForStatement() { + var init, test, update, left, right, body, oldInIteration; + + init = test = update = null; + + expectKeyword('for'); + + expect('('); + + if (match(';')) { + lex(); + } else { + if (matchKeyword('var') || matchKeyword('let')) { + allowIn = false; + init = parseForVariableDeclaration(); + allowIn = true; + + if (init.declarations.length === 1 && matchKeyword('in')) { + lex(); + left = init; + right = parseExpression(); + init = null; + } + } else { + allowIn = false; + init = parseExpression(); + allowIn = true; + + if (matchKeyword('in')) { + // LeftHandSideExpression + if (matchKeyword('in') && (lastParenthesized !== init && !isLeftHandSide(init))) { + throwError({}, Messages.InvalidLHSInForIn); + } + lex(); + left = init; + right = parseExpression(); + init = null; + } + } + + if (typeof left === 'undefined') { + expect(';'); + } + } + + if (typeof left === 'undefined') { + + if (!match(';')) { + test = parseExpression(); + } + expect(';'); + + if (!match(')')) { + update = parseExpression(); + } + } + + expect(')'); + + oldInIteration = inIteration; + inIteration = true; + + body = parseStatement(); + + inIteration = oldInIteration; + + if (typeof left === 'undefined') { + return { + type: Syntax.ForStatement, + init: init, + test: test, + update: update, + body: body + }; + } + + return { + type: Syntax.ForInStatement, + left: left, + right: right, + body: body, + each: false + }; + } + + // 12.7 The continue statement + + function parseContinueStatement() { + var token, label = null; + + expectKeyword('continue'); + + // Optimize the most common form: 'continue;'. + if (source[index] === ';') { + lex(); + + if (!inIteration) { + throwError({}, Messages.IllegalContinue); + } + + return { + type: Syntax.ContinueStatement, + label: null + }; + } + + if (peekLineTerminator()) { + if (!inIteration) { + throwError({}, Messages.IllegalContinue); + } + + return { + type: Syntax.ContinueStatement, + label: null + }; + } + + token = lookahead(); + if (token.type === Token.Identifier) { + label = parseVariableIdentifier(); + + if (!Object.prototype.hasOwnProperty.call(labelSet, label.name)) { + throwError({}, Messages.UnknownLabel, label.name); + } + } + + consumeSemicolon(); + + if (label === null && !inIteration) { + throwError({}, Messages.IllegalContinue); + } + + return { + type: Syntax.ContinueStatement, + label: label + }; + } + + // 12.8 The break statement + + function parseBreakStatement() { + var token, label = null; + + expectKeyword('break'); + + // Optimize the most common form: 'break;'. + if (source[index] === ';') { + lex(); + + if (!(inIteration || inSwitch)) { + throwError({}, Messages.IllegalBreak); + } + + return { + type: Syntax.BreakStatement, + label: null + }; + } + + if (peekLineTerminator()) { + if (!(inIteration || inSwitch)) { + throwError({}, Messages.IllegalBreak); + } + + return { + type: Syntax.BreakStatement, + label: null + }; + } + + token = lookahead(); + if (token.type === Token.Identifier) { + label = parseVariableIdentifier(); + + if (!Object.prototype.hasOwnProperty.call(labelSet, label.name)) { + throwError({}, Messages.UnknownLabel, label.name); + } + } + + consumeSemicolon(); + + if (label === null && !(inIteration || inSwitch)) { + throwError({}, Messages.IllegalBreak); + } + + return { + type: Syntax.BreakStatement, + label: label + }; + } + + // 12.9 The return statement + + function parseReturnStatement() { + var token, argument = null; + + expectKeyword('return'); + + if (!inFunctionBody) { + throwError({}, Messages.IllegalReturn); + } + + // 'return' followed by a space and an identifier is very common. + if (source[index] === ' ') { + if (isIdentifierStart(source[index + 1])) { + argument = parseExpression(); + consumeSemicolon(); + return { + type: Syntax.ReturnStatement, + argument: argument + }; + } + } + + if (peekLineTerminator()) { + return { + type: Syntax.ReturnStatement, + argument: null + }; + } + + if (!match(';')) { + token = lookahead(); + if (!match('}') && token.type !== Token.EOF) { + argument = parseExpression(); + } + } + + consumeSemicolon(); + + return { + type: Syntax.ReturnStatement, + argument: argument + }; + } + + // 12.10 The with statement + + function parseWithStatement() { + var object, body; + + if (strict) { + throwError({}, Messages.StrictModeWith); + } + + expectKeyword('with'); + + expect('('); + + object = parseExpression(); + + expect(')'); + + body = parseStatement(); + + return { + type: Syntax.WithStatement, + object: object, + body: body + }; + } + + // 12.10 The swith statement + + function parseSwitchCase(test) { + var consequent = [], + statement; + + while (index < length) { + if (match('}') || matchKeyword('default') || matchKeyword('case')) { + break; + } + statement = parseStatement(); + if (typeof statement === 'undefined') { + break; + } + consequent.push(statement); + } + + return { + type: Syntax.SwitchCase, + test: test, + consequent: consequent + }; + } + + function parseSwitchStatement() { + var discriminant, cases, test, oldInSwitch; + + expectKeyword('switch'); + + expect('('); + + discriminant = parseExpression(); + + expect(')'); + + expect('{'); + + if (match('}')) { + lex(); + return { + type: Syntax.SwitchStatement, + discriminant: discriminant + }; + } + + cases = []; + + oldInSwitch = inSwitch; + inSwitch = true; + + while (index < length) { + if (match('}')) { + break; + } + + if (matchKeyword('default')) { + lex(); + test = null; + } else { + expectKeyword('case'); + test = parseExpression(); + } + expect(':'); + + cases.push(parseSwitchCase(test)); + } + + inSwitch = oldInSwitch; + + expect('}'); + + return { + type: Syntax.SwitchStatement, + discriminant: discriminant, + cases: cases + }; + } + + // 12.13 The throw statement + + function parseThrowStatement() { + var argument; + + expectKeyword('throw'); + + if (peekLineTerminator()) { + throwError({}, Messages.NewlineAfterThrow); + } + + argument = parseExpression(); + + consumeSemicolon(); + + return { + type: Syntax.ThrowStatement, + argument: argument + }; + } + + // 12.14 The try statement + + function parseCatchClause() { + var param; + + expectKeyword('catch'); + + expect('('); + if (!match(')')) { + param = parseExpression(); + // 12.14.1 + if (strict && param.type === Syntax.Identifier && isRestrictedWord(param.name)) { + throwError({}, Messages.StrictCatchVariable); + } + } + expect(')'); + + return { + type: Syntax.CatchClause, + param: param, + guard: null, + body: parseBlock() + }; + } + + function parseTryStatement() { + var block, handlers = [], finalizer = null; + + expectKeyword('try'); + + block = parseBlock(); + + if (matchKeyword('catch')) { + handlers.push(parseCatchClause()); + } + + if (matchKeyword('finally')) { + lex(); + finalizer = parseBlock(); + } + + if (handlers.length === 0 && !finalizer) { + throwError({}, Messages.NoCatchOrFinally); + } + + return { + type: Syntax.TryStatement, + block: block, + handlers: handlers, + finalizer: finalizer + }; + } + + // 12.15 The debugger statement + + function parseDebuggerStatement() { + expectKeyword('debugger'); + + consumeSemicolon(); + + return { + type: Syntax.DebuggerStatement + }; + } + + // 12 Statements + + function parseStatement() { + var token = lookahead(), + expr, + labeledBody; + + if (token.type === Token.EOF) { + throwUnexpected(token); + } + + if (token.type === Token.Punctuator) { + switch (token.value) { + case ';': + return parseEmptyStatement(); + case '{': + return parseBlock(); + case '(': + return parseExpressionStatement(); + default: + break; + } + } + + if (token.type === Token.Keyword) { + switch (token.value) { + case 'break': + return parseBreakStatement(); + case 'continue': + return parseContinueStatement(); + case 'debugger': + return parseDebuggerStatement(); + case 'do': + return parseDoWhileStatement(); + case 'for': + return parseForStatement(); + case 'function': + return parseFunctionDeclaration(); + case 'if': + return parseIfStatement(); + case 'return': + return parseReturnStatement(); + case 'switch': + return parseSwitchStatement(); + case 'throw': + return parseThrowStatement(); + case 'try': + return parseTryStatement(); + case 'var': + return parseVariableStatement(); + case 'while': + return parseWhileStatement(); + case 'with': + return parseWithStatement(); + default: + break; + } + } + + expr = parseExpression(); + + // 12.12 Labelled Statements + if ((expr.type === Syntax.Identifier) && match(':')) { + lex(); + + if (Object.prototype.hasOwnProperty.call(labelSet, expr.name)) { + throwError({}, Messages.Redeclaration, 'Label', expr.name); + } + + labelSet[expr.name] = true; + labeledBody = parseStatement(); + delete labelSet[expr.name]; + + return { + type: Syntax.LabeledStatement, + label: expr, + body: labeledBody + }; + } + + consumeSemicolon(); + + return { + type: Syntax.ExpressionStatement, + expression: expr + }; + } + + // 13 Function Definition + + function parseFunctionSourceElements() { + var sourceElement, sourceElements = [], token, directive, firstRestricted, oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody; + + expect('{'); + + while (index < length) { + token = lookahead(); + if (token.type !== Token.StringLiteral) { + break; + } + + sourceElement = parseSourceElement(); + sourceElements.push(sourceElement); + if (sourceElement.expression.type !== Syntax.Literal) { + // this is not directive + break; + } + directive = sliceSource(token.range[0] + 1, token.range[1] - 1); + if (directive === 'use strict') { + strict = true; + if (firstRestricted) { + throwError(firstRestricted, Messages.StrictOctalLiteral); + } + } else { + if (!firstRestricted && token.octal) { + firstRestricted = token; + } + } + } + + oldLabelSet = labelSet; + oldInIteration = inIteration; + oldInSwitch = inSwitch; + oldInFunctionBody = inFunctionBody; + + labelSet = {}; + inIteration = false; + inSwitch = false; + inFunctionBody = true; + + while (index < length) { + if (match('}')) { + break; + } + sourceElement = parseSourceElement(); + if (typeof sourceElement === 'undefined') { + break; + } + sourceElements.push(sourceElement); + } + + expect('}'); + + labelSet = oldLabelSet; + inIteration = oldInIteration; + inSwitch = oldInSwitch; + inFunctionBody = oldInFunctionBody; + + return { + type: Syntax.BlockStatement, + body: sourceElements + }; + } + + function parseFunctionDeclaration() { + var id, param, params = [], body, token, firstRestricted, message, previousStrict, paramSet; + + expectKeyword('function'); + token = lookahead(); + id = parseVariableIdentifier(); + if (strict) { + if (isRestrictedWord(token.value)) { + throwError(token, Messages.StrictFunctionName); + } + } else { + if (isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictFunctionName; + } else if (isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } + } + + expect('('); + + if (!match(')')) { + paramSet = {}; + while (index < length) { + token = lookahead(); + param = parseVariableIdentifier(); + if (strict) { + if (isRestrictedWord(token.value)) { + throwError(token, Messages.StrictParamName); + } + if (Object.prototype.hasOwnProperty.call(paramSet, token.value)) { + throwError(token, Messages.StrictParamDupe); + } + } else if (!firstRestricted) { + if (isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictParamName; + } else if (isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } else if (Object.prototype.hasOwnProperty.call(paramSet, token.value)) { + firstRestricted = token; + message = Messages.StrictParamDupe; + } + } + params.push(param); + paramSet[param.name] = true; + if (match(')')) { + break; + } + expect(','); + } + } + + expect(')'); + + previousStrict = strict; + body = parseFunctionSourceElements(); + if (strict && firstRestricted) { + throwError(firstRestricted, message); + } + strict = previousStrict; + + return { + type: Syntax.FunctionDeclaration, + id: id, + params: params, + body: body + }; + } + + function parseFunctionExpression() { + var token, id = null, firstRestricted, message, param, params = [], body, previousStrict, paramSet; + + expectKeyword('function'); + + if (!match('(')) { + token = lookahead(); + id = parseVariableIdentifier(); + if (strict) { + if (isRestrictedWord(token.value)) { + throwError(token, Messages.StrictFunctionName); + } + } else { + if (isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictFunctionName; + } else if (isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } + } + } + + expect('('); + + if (!match(')')) { + paramSet = {}; + while (index < length) { + token = lookahead(); + param = parseVariableIdentifier(); + if (strict) { + if (isRestrictedWord(token.value)) { + throwError(token, Messages.StrictParamName); + } + if (Object.prototype.hasOwnProperty.call(paramSet, token.value)) { + throwError(token, Messages.StrictParamDupe); + } + } else if (!firstRestricted) { + if (isRestrictedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictParamName; + } else if (isStrictModeReservedWord(token.value)) { + firstRestricted = token; + message = Messages.StrictReservedWord; + } else if (Object.prototype.hasOwnProperty.call(paramSet, token.value)) { + firstRestricted = token; + message = Messages.StrictParamDupe; + } + } + params.push(param); + paramSet[param.name] = true; + if (match(')')) { + break; + } + expect(','); + } + } + + expect(')'); + + previousStrict = strict; + body = parseFunctionSourceElements(); + if (strict && firstRestricted) { + throwError(firstRestricted, message); + } + strict = previousStrict; + + return { + type: Syntax.FunctionExpression, + id: id, + params: params, + body: body + }; + } + + // 14 Program + + function parseSourceElement() { + var token = lookahead(); + + if (token.type === Token.Keyword) { + switch (token.value) { + case 'const': + case 'let': + return parseConstLetDeclaration(token.value); + case 'function': + return parseFunctionDeclaration(); + default: + return parseStatement(); + } + } + + if (token.type !== Token.EOF) { + return parseStatement(); + } + } + + function parseSourceElements() { + var sourceElement, sourceElements = [], token, directive, firstRestricted; + + while (index < length) { + token = lookahead(); + if (token.type !== Token.StringLiteral) { + break; + } + + sourceElement = parseSourceElement(); + sourceElements.push(sourceElement); + if (sourceElement.expression.type !== Syntax.Literal) { + // this is not directive + break; + } + directive = sliceSource(token.range[0] + 1, token.range[1] - 1); + if (directive === 'use strict') { + strict = true; + if (firstRestricted) { + throwError(firstRestricted, Messages.StrictOctalLiteral); + } + } else { + if (!firstRestricted && token.octal) { + firstRestricted = token; + } + } + } + + while (index < length) { + sourceElement = parseSourceElement(); + if (typeof sourceElement === 'undefined') { + break; + } + sourceElements.push(sourceElement); + } + return sourceElements; + } + + function parseProgram() { + var program; + strict = false; + program = { + type: Syntax.Program, + body: parseSourceElements() + }; + return program; + } + + // The following functions are needed only when the option to preserve + // the comments is active. + + function addComment(start, end, type, value) { + if (typeof start !== 'number') { + return; + } + + // Because the way the actual token is scanned, often the comments + // (if any) are skipped twice during the lexical analysis. + // Thus, we need to skip adding a comment if the comment array already + // handled it. + if (extra.comments.length > 0) { + if (extra.comments[extra.comments.length - 1].range[1] > start) { + return; + } + } + + extra.comments.push({ + range: [start, end], + type: type, + value: value + }); + } + + function scanComment() { + var comment, ch, start, blockComment, lineComment; + + comment = ''; + blockComment = false; + lineComment = false; + + while (index < length) { + ch = source[index]; + + if (lineComment) { + ch = nextChar(); + if (isLineTerminator(ch)) { + lineComment = false; + addComment(start, index - 1, 'Line', comment); + if (ch === '\r' && source[index] === '\n') { + index += 1; + } + lineNumber += 1; + lineStart = index; + comment = ''; + } else { + comment += ch; + } + } else if (blockComment) { + if (isLineTerminator(ch)) { + if (ch === '\r' && source[index + 1] === '\n') { + index += 1; + } + lineNumber += 1; + index += 1; + lineStart = index; + if (index >= length) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } else { + ch = nextChar(); + if (index >= length) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + comment += ch; + if (ch === '*') { + ch = source[index]; + if (ch === '/') { + comment = comment.substr(0, comment.length - 1); + blockComment = false; + index += 1; + addComment(start, index - 1, 'Block', comment); + comment = ''; + } + } + } + } else if (ch === '/') { + ch = source[index + 1]; + if (ch === '/') { + start = index; + index += 2; + lineComment = true; + } else if (ch === '*') { + start = index; + index += 2; + blockComment = true; + if (index >= length) { + throwError({}, Messages.UnexpectedToken, 'ILLEGAL'); + } + } else { + break; + } + } else if (isWhiteSpace(ch)) { + index += 1; + } else if (isLineTerminator(ch)) { + index += 1; + if (ch === '\r' && source[index] === '\n') { + index += 1; + } + lineNumber += 1; + lineStart = index; + } else { + break; + } + } + + addComment(start, index, (blockComment) ? 'Block' : 'Line', comment); + } + + function collectToken() { + var token = extra.advance(), + range, + value; + + if (token.type !== Token.EOF) { + range = [token.range[0], token.range[1] - 1]; + value = sliceSource(token.range[0], token.range[1]); + extra.tokens.push({ + type: TokenName[token.type], + value: value, + range: range + }); + } + + return token; + } + + function collectRegex() { + var pos, regex, token; + + skipComment(); + + pos = index; + regex = extra.scanRegExp(); + + // Pop the previous token, which is likely '/' or '/=' + if (extra.tokens.length > 0) { + token = extra.tokens[extra.tokens.length - 1]; + if (token.range[0] === pos && token.type === 'Punctuator') { + if (token.value === '/' || token.value === '/=') { + extra.tokens.pop(); + } + } + } + + extra.tokens.push({ + type: 'RegularExpression', + value: regex.literal, + range: [pos, index - 1] + }); + + return regex; + } + + function createLiteral(token) { + return { + type: Syntax.Literal, + value: token.value + }; + } + + function createRawLiteral(token) { + return { + type: Syntax.Literal, + value: token.value, + raw: sliceSource(token.range[0], token.range[1]) + }; + } + + function wrapTrackingFunction(range, loc) { + + return function (parseFunction) { + + function isBinary(node) { + return node.type === Syntax.LogicalExpression || + node.type === Syntax.BinaryExpression; + } + + function visit(node) { + if (range) { + if (isBinary(node.left) && (typeof node.left.range === 'undefined')) { + visit(node.left); + } + if (isBinary(node.right) && (typeof node.right.range === 'undefined')) { + visit(node.right); + } + + // Expression enclosed in brackets () already has the correct range. + if (typeof node.range === 'undefined') { + node.range = [node.left.range[0], node.right.range[1]]; + } + } + + if (loc) { + if (isBinary(node.left) && (typeof node.left.loc === 'undefined')) { + visit(node.left); + } + if (isBinary(node.right) && (typeof node.right.loc === 'undefined')) { + visit(node.right); + } + + if (typeof node.loc === 'undefined') { + node.loc = { + start: node.left.loc.start, + end: node.right.loc.end + }; + } + } + } + + return function () { + var node, rangeInfo, locInfo; + + skipComment(); + rangeInfo = [index, 0]; + locInfo = { + start: { + line: lineNumber, + column: index - lineStart + } + }; + + node = parseFunction.apply(null, arguments); + if (typeof node !== 'undefined') { + + if (range) { + rangeInfo[1] = index - 1; + node.range = rangeInfo; + } + + if (loc) { + locInfo.end = { + line: lineNumber, + column: index - lineStart + }; + node.loc = locInfo; + } + + if (isBinary(node)) { + visit(node); + } + + if (node.type === Syntax.MemberExpression) { + if (typeof node.object.range !== 'undefined') { + node.range[0] = node.object.range[0]; + } + if (typeof node.object.loc !== 'undefined') { + node.loc.start = node.object.loc.start; + } + } + return node; + } + }; + + }; + } + + function patch() { + + var wrapTracking; + + if (extra.comments) { + extra.skipComment = skipComment; + skipComment = scanComment; + } + + if (extra.raw) { + extra.createLiteral = createLiteral; + createLiteral = createRawLiteral; + } + + if (extra.range || extra.loc) { + + wrapTracking = wrapTrackingFunction(extra.range, extra.loc); + + extra.parseAdditiveExpression = parseAdditiveExpression; + extra.parseAssignmentExpression = parseAssignmentExpression; + extra.parseBitwiseANDExpression = parseBitwiseANDExpression; + extra.parseBitwiseORExpression = parseBitwiseORExpression; + extra.parseBitwiseXORExpression = parseBitwiseXORExpression; + extra.parseBlock = parseBlock; + extra.parseFunctionSourceElements = parseFunctionSourceElements; + extra.parseCallMember = parseCallMember; + extra.parseCatchClause = parseCatchClause; + extra.parseComputedMember = parseComputedMember; + extra.parseConditionalExpression = parseConditionalExpression; + extra.parseConstLetDeclaration = parseConstLetDeclaration; + extra.parseEqualityExpression = parseEqualityExpression; + extra.parseExpression = parseExpression; + extra.parseForVariableDeclaration = parseForVariableDeclaration; + extra.parseFunctionDeclaration = parseFunctionDeclaration; + extra.parseFunctionExpression = parseFunctionExpression; + extra.parseLogicalANDExpression = parseLogicalANDExpression; + extra.parseLogicalORExpression = parseLogicalORExpression; + extra.parseMultiplicativeExpression = parseMultiplicativeExpression; + extra.parseNewExpression = parseNewExpression; + extra.parseNonComputedMember = parseNonComputedMember; + extra.parseNonComputedProperty = parseNonComputedProperty; + extra.parseObjectProperty = parseObjectProperty; + extra.parseObjectPropertyKey = parseObjectPropertyKey; + extra.parsePostfixExpression = parsePostfixExpression; + extra.parsePrimaryExpression = parsePrimaryExpression; + extra.parseProgram = parseProgram; + extra.parsePropertyFunction = parsePropertyFunction; + extra.parseRelationalExpression = parseRelationalExpression; + extra.parseStatement = parseStatement; + extra.parseShiftExpression = parseShiftExpression; + extra.parseSwitchCase = parseSwitchCase; + extra.parseUnaryExpression = parseUnaryExpression; + extra.parseVariableDeclaration = parseVariableDeclaration; + extra.parseVariableIdentifier = parseVariableIdentifier; + + parseAdditiveExpression = wrapTracking(extra.parseAdditiveExpression); + parseAssignmentExpression = wrapTracking(extra.parseAssignmentExpression); + parseBitwiseANDExpression = wrapTracking(extra.parseBitwiseANDExpression); + parseBitwiseORExpression = wrapTracking(extra.parseBitwiseORExpression); + parseBitwiseXORExpression = wrapTracking(extra.parseBitwiseXORExpression); + parseBlock = wrapTracking(extra.parseBlock); + parseFunctionSourceElements = wrapTracking(extra.parseFunctionSourceElements); + parseCallMember = wrapTracking(extra.parseCallMember); + parseCatchClause = wrapTracking(extra.parseCatchClause); + parseComputedMember = wrapTracking(extra.parseComputedMember); + parseConditionalExpression = wrapTracking(extra.parseConditionalExpression); + parseConstLetDeclaration = wrapTracking(extra.parseConstLetDeclaration); + parseEqualityExpression = wrapTracking(extra.parseEqualityExpression); + parseExpression = wrapTracking(extra.parseExpression); + parseForVariableDeclaration = wrapTracking(extra.parseForVariableDeclaration); + parseFunctionDeclaration = wrapTracking(extra.parseFunctionDeclaration); + parseFunctionExpression = wrapTracking(extra.parseFunctionExpression); + parseLogicalANDExpression = wrapTracking(extra.parseLogicalANDExpression); + parseLogicalORExpression = wrapTracking(extra.parseLogicalORExpression); + parseMultiplicativeExpression = wrapTracking(extra.parseMultiplicativeExpression); + parseNewExpression = wrapTracking(extra.parseNewExpression); + parseNonComputedMember = wrapTracking(extra.parseNonComputedMember); + parseNonComputedProperty = wrapTracking(extra.parseNonComputedProperty); + parseObjectProperty = wrapTracking(extra.parseObjectProperty); + parseObjectPropertyKey = wrapTracking(extra.parseObjectPropertyKey); + parsePostfixExpression = wrapTracking(extra.parsePostfixExpression); + parsePrimaryExpression = wrapTracking(extra.parsePrimaryExpression); + parseProgram = wrapTracking(extra.parseProgram); + parsePropertyFunction = wrapTracking(extra.parsePropertyFunction); + parseRelationalExpression = wrapTracking(extra.parseRelationalExpression); + parseStatement = wrapTracking(extra.parseStatement); + parseShiftExpression = wrapTracking(extra.parseShiftExpression); + parseSwitchCase = wrapTracking(extra.parseSwitchCase); + parseUnaryExpression = wrapTracking(extra.parseUnaryExpression); + parseVariableDeclaration = wrapTracking(extra.parseVariableDeclaration); + parseVariableIdentifier = wrapTracking(extra.parseVariableIdentifier); + } + + if (typeof extra.tokens !== 'undefined') { + extra.advance = advance; + extra.scanRegExp = scanRegExp; + + advance = collectToken; + scanRegExp = collectRegex; + } + } + + function unpatch() { + if (typeof extra.skipComment === 'function') { + skipComment = extra.skipComment; + } + + if (extra.raw) { + createLiteral = extra.createLiteral; + } + + if (extra.range || extra.loc) { + parseAdditiveExpression = extra.parseAdditiveExpression; + parseAssignmentExpression = extra.parseAssignmentExpression; + parseBitwiseANDExpression = extra.parseBitwiseANDExpression; + parseBitwiseORExpression = extra.parseBitwiseORExpression; + parseBitwiseXORExpression = extra.parseBitwiseXORExpression; + parseBlock = extra.parseBlock; + parseFunctionSourceElements = extra.parseFunctionSourceElements; + parseCallMember = extra.parseCallMember; + parseCatchClause = extra.parseCatchClause; + parseComputedMember = extra.parseComputedMember; + parseConditionalExpression = extra.parseConditionalExpression; + parseConstLetDeclaration = extra.parseConstLetDeclaration; + parseEqualityExpression = extra.parseEqualityExpression; + parseExpression = extra.parseExpression; + parseForVariableDeclaration = extra.parseForVariableDeclaration; + parseFunctionDeclaration = extra.parseFunctionDeclaration; + parseFunctionExpression = extra.parseFunctionExpression; + parseLogicalANDExpression = extra.parseLogicalANDExpression; + parseLogicalORExpression = extra.parseLogicalORExpression; + parseMultiplicativeExpression = extra.parseMultiplicativeExpression; + parseNewExpression = extra.parseNewExpression; + parseNonComputedMember = extra.parseNonComputedMember; + parseNonComputedProperty = extra.parseNonComputedProperty; + parseObjectProperty = extra.parseObjectProperty; + parseObjectPropertyKey = extra.parseObjectPropertyKey; + parsePrimaryExpression = extra.parsePrimaryExpression; + parsePostfixExpression = extra.parsePostfixExpression; + parseProgram = extra.parseProgram; + parsePropertyFunction = extra.parsePropertyFunction; + parseRelationalExpression = extra.parseRelationalExpression; + parseStatement = extra.parseStatement; + parseShiftExpression = extra.parseShiftExpression; + parseSwitchCase = extra.parseSwitchCase; + parseUnaryExpression = extra.parseUnaryExpression; + parseVariableDeclaration = extra.parseVariableDeclaration; + parseVariableIdentifier = extra.parseVariableIdentifier; + } + + if (typeof extra.scanRegExp === 'function') { + advance = extra.advance; + scanRegExp = extra.scanRegExp; + } + } + + function stringToArray(str) { + var length = str.length, + result = [], + i; + for (i = 0; i < length; i += 1) { + result[i] = str.charAt(i); + } + return result; + } + + function parse(code, options) { + var program, toString; + + toString = String; + if (typeof code !== 'string' && !(code instanceof String)) { + code = toString(code); + } + + source = code; + index = 0; + lineNumber = (source.length > 0) ? 1 : 0; + lineStart = 0; + length = source.length; + buffer = null; + allowIn = true; + labelSet = {}; + inSwitch = false; + inIteration = false; + lastParenthesized = null; + inFunctionBody = false; + + extra = {}; + if (typeof options !== 'undefined') { + extra.range = (typeof options.range === 'boolean') && options.range; + extra.loc = (typeof options.loc === 'boolean') && options.loc; + extra.raw = (typeof options.raw === 'boolean') && options.raw; + if (typeof options.tokens === 'boolean' && options.tokens) { + extra.tokens = []; + } + if (typeof options.comment === 'boolean' && options.comment) { + extra.comments = []; + } + } + + if (length > 0) { + if (typeof source[0] === 'undefined') { + // Try first to convert to a string. This is good as fast path + // for old IE which understands string indexing for string + // literals only and not for string object. + if (code instanceof String) { + source = code.valueOf(); + } + + // Force accessing the characters via an array. + if (typeof source[0] === 'undefined') { + source = stringToArray(code); + } + } + } + + patch(); + try { + program = parseProgram(); + if (typeof extra.comments !== 'undefined') { + program.comments = extra.comments; + } + if (typeof extra.tokens !== 'undefined') { + program.tokens = extra.tokens; + } + } catch (e) { + throw e; + } finally { + unpatch(); + extra = {}; + } + + return program; + } + + // Executes visitor on the object and its children (recursively). + + function traverse(object, visitor, master) { + var key, child, parent, path; + + parent = (typeof master === 'undefined') ? [] : master; + + if (visitor.call(null, object, parent) === false) { + return; + } + for (key in object) { + if (object.hasOwnProperty(key)) { + child = object[key]; + path = [ object ]; + path.push(parent); + if (typeof child === 'object' && child !== null) { + traverse(child, visitor, path); + } + } + } + } + + // Insert a prolog in the body of every function. + // It will be in the form of a function call: + // + // traceName(object); + // + // where the object contains the following properties: + // + // 'name' holds the name of the function + // 'lineNumber' holds the starting line number of the function block + // 'range' contains the index-based range of the function + // + // The name of the function represents the associated reference for + // the function (deduced on a best-effort basis if it is not + // a function declaration). + // + // If traceName is a function instead of a string, it will be invoked and + // the result will be used as the entire prolog. The arguments for the + // invocation are the function name, range, and location info. + + function traceFunctionEntrance(traceName) { + + return function (code) { + var tree, + functionList, + param, + signature, + pos, + i; + + + tree = parse(code, { range: true, loc: true }); + + functionList = []; + traverse(tree, function (node, path) { + var parent; + if (node.type === Syntax.FunctionDeclaration) { + functionList.push({ + name: node.id.name, + range: node.range, + loc: node.loc, + blockStart: node.body.range[0] + }); + } else if (node.type === Syntax.FunctionExpression) { + parent = path[0]; + if (parent.type === Syntax.AssignmentExpression) { + if (typeof parent.left.range !== 'undefined') { + functionList.push({ + name: code.slice(parent.left.range[0], + parent.left.range[1] + 1), + range: node.range, + loc: node.loc, + blockStart: node.body.range[0] + }); + } + } else if (parent.type === Syntax.VariableDeclarator) { + functionList.push({ + name: parent.id.name, + range: node.range, + loc: node.loc, + blockStart: node.body.range[0] + }); + } else if (parent.type === Syntax.CallExpression) { + functionList.push({ + name: parent.id ? parent.id.name : '[Anonymous]', + range: node.range, + loc: node.loc, + blockStart: node.body.range[0] + }); + } else if (typeof parent.length === 'number') { + functionList.push({ + name: parent.id ? parent.id.name : '[Anonymous]', + range: node.range, + loc: node.loc, + blockStart: node.body.range[0] + }); + } else if (typeof parent.key !== 'undefined') { + if (parent.key.type === 'Identifier') { + if (parent.value === node && parent.key.name) { + functionList.push({ + name: parent.key.name, + range: node.range, + loc: node.loc, + blockStart: node.body.range[0] + }); + } + } + } + } + }); + + // Insert the instrumentation code from the last entry. + // This is to ensure that the range for each entry remains valid) + // (it won't shift due to some new inserting string before the range). + for (i = functionList.length - 1; i >= 0; i -= 1) { + param = { + name: functionList[i].name, + range: functionList[i].range, + loc: functionList[i].loc + }; + if (typeof traceName === 'function') { + signature = traceName.call(null, param); + } else { + signature = traceName + '({ '; + signature += 'name: \'' + functionList[i].name + '\', '; + if (typeof functionList[i].loc !== 'undefined') { + signature += 'lineNumber: ' + functionList[i].loc.start.line + ', '; + } + signature += 'range: [' + functionList[i].range[0] + ', ' + + functionList[i].range[1] + '] '; + signature += '});'; + } + pos = functionList[i].blockStart + 1; + code = code.slice(0, pos) + '\n' + signature + code.slice(pos, code.length); + } + + return code; + }; + } + + function modify(code, modifiers) { + var i; + + if (Object.prototype.toString.call(modifiers) === '[object Array]') { + for (i = 0; i < modifiers.length; i += 1) { + code = modifiers[i].call(null, code); + } + } else if (typeof modifiers === 'function') { + code = modifiers.call(null, code); + } else { + throw new Error('Wrong use of esprima.modify() function'); + } + + return code; + } + + // Sync with package.json. + exports.version = '0.9.9-dev'; + + exports.parse = parse; + + exports.modify = modify; + + exports.Tracer = { + FunctionEntrance: traceFunctionEntrance + }; + +}(typeof exports === 'undefined' ? (esprima = {}) : exports)); +/* vim: set sw=4 ts=4 et tw=80 : */ diff --git a/node_modules/dustjs-linkedin/node_modules/cover/coverage_store.js b/node_modules/dustjs-linkedin/node_modules/cover/coverage_store.js new file mode 100644 index 0000000..5ee6f6b --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/coverage_store.js @@ -0,0 +1,18 @@ +// Copyright 2011 Itay Neeman +// +// Licensed under the MIT License + +(function() { + var coverageStore = {}; + + module.exports = {}; + module.exports.register = function(filename) { + var store = coverageStore[filename] = coverageStore[filename] || {nodes: {}, blocks: {}}; + + return store; + } + + module.exports.getStore = function(filename) { + return coverageStore[filename] || {}; + } +})(); \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/foo.js b/node_modules/dustjs-linkedin/node_modules/cover/foo.js new file mode 100644 index 0000000..53e85d3 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/foo.js @@ -0,0 +1,2 @@ +console.log("a"); +console.log("b"); if (0) { b(""); } \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/index.js b/node_modules/dustjs-linkedin/node_modules/cover/index.js new file mode 100644 index 0000000..7eefadd --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/index.js @@ -0,0 +1,440 @@ +var instrument = require('./instrument') +var Module = require('module').Module; +var path = require('path'); +var fs = require('fs'); +var vm = require('vm'); +var _ = require('underscore'); + +// Coverage tracker +function CoverageData (filename, instrumentor) { + this.instrumentor = instrumentor; + this.filename = filename; + this.nodes = {}; + this.visitedBlocks = {}; + this.source = instrumentor.source; +}; + +// Note that a node has been visited +CoverageData.prototype.visit = function(node) { + var node = this.nodes[node.id] = (this.nodes[node.id] || {node:node, count:0}) + node.count++; +}; + +// Note that a node has been visited +CoverageData.prototype.visitBlock = function(blockIndex) { + var block = this.visitedBlocks[blockIndex] = (this.visitedBlocks[blockIndex] || {count:0}) + block.count++; +}; + +// Get all the nodes we did not see +CoverageData.prototype.missing = function() { + // Find all the nodes which we haven't seen + var nodes = this.nodes; + var missing = this.instrumentor.filter(function(node) { + return !nodes[node.id]; + }); + + return missing; +}; + +// Get all the nodes we did see +CoverageData.prototype.seen = function() { + // Find all the nodes we have seen + var nodes = this.nodes; + var seen = this.instrumentor.filter(function(node) { + return !!nodes[node.id]; + }); + + return seen; +}; + +// Calculate node coverage statistics +CoverageData.prototype.blocks = function() { + var totalBlocks = this.instrumentor.blockCounter; + var numSeenBlocks = 0; + for(var index in this.visitedBlocks) { + numSeenBlocks++; + } + var numMissingBlocks = totalBlocks - numSeenBlocks; + + var toReturn = { + total: totalBlocks, + seen: numSeenBlocks, + missing: numMissingBlocks, + percentage: totalBlocks ? numSeenBlocks / totalBlocks : 1 + }; + + return toReturn; +}; + +// Explode all multi-line nodes into single-line ones. +var explodeNodes = function(coverageData, fileData) { + var missing = coverageData.missing(); + var newNodes = []; + + // Get only the multi-line nodes. + var multiLineNodes = missing.filter(function(node) { + return (node.loc.start.line < node.loc.end.line); + }); + + for(var i = 0; i < multiLineNodes.length; i++) { + // Get the current node and delta + var node = multiLineNodes[i]; + var lineDelta = node.loc.end.line - node.loc.start.line + 1; + + for(var j = 0; j < lineDelta; j++) { + // For each line in the multi-line node, we'll create a + // new node, and we set the start and end columns + // to the correct vlaues. + var curLine = node.loc.start.line + j; + var startCol = 0; + var endCol = fileData[curLine - 1].length; + + if (curLine === node.loc.start.line) { + startCol = node.loc.start.column; + } + else if (curLine === node.loc.end.line) { + startCol = 0; + endCol = node.loc.end.column; + } + + var newNode = { + loc: + { + start: { + line: curLine, + col: startCol + }, + end: { + line: curLine, + col: endCol + } + } + }; + + newNodes.push(newNode); + } + } + + return newNodes; +} + +// Get per-line code coverage information +CoverageData.prototype.coverage = function() { + var missingLines = this.missing(); + var fileData = this.instrumentor.source.split('\n'); + + // Get a dictionary of all the lines we did observe being at least + // partially covered + var seen = {}; + + this.seen().forEach(function(node) { + seen[node.loc.start.line] = true; + }); + + // Add all the new multi-line nodes. + missingLines = missingLines.concat(explodeNodes(this, fileData)); + + var seenNodes = {}; + missingLines = missingLines.sort( + function(lhs, rhs) { + var lhsNode = lhs.loc; + var rhsNode = rhs.loc; + + // First try to sort based on line + return lhsNode.start.line < rhsNode.start.line ? -1 : // first try line + lhsNode.start.line > rhsNode.start.line ? 1 : + lhsNode.start.column < rhsNode.start.column ? -1 : // then try start col + lhsNode.start.column > rhsNode.start.column ? 1 : + lhsNode.end.column < rhsNode.end.column ? -1 : // then try end col + lhsNode.end.column > rhsNode.end.column ? 1 : + 0; // then just give up and say they are equal + }).filter(function(node) { + // If it is a multi-line node, we can just ignore it + if (node.loc.start.line < node.loc.end.line) { + return false; + } + + // We allow multiple nodes per line, but only one node per + // start column (due to how instrumented works) + var okay = false; + if (seenNodes.hasOwnProperty(node.loc.start.line)) { + var isNew = (seenNodes[node.loc.start.line].indexOf(node.loc.start.column) < 0); + if (isNew) { + seenNodes[node.loc.start.line].push(node.loc.start.column); + okay = true; + } + } + else { + seenNodes[node.loc.start.line] = [node.loc.start.column]; + okay = true; + } + + return okay; + }); + + var coverage = {}; + + missingLines.forEach(function(node) { + // For each missing line, add some information for it + var line = node.loc.start.line; + var startCol = node.loc.start.column; + var endCol = node.loc.end.column; + var source = fileData[line - 1]; + var partial = seen.hasOwnProperty(line) && seen[line]; + + if (coverage.hasOwnProperty(line)) { + coverage[line].missing.push({startCol: startCol, endCol: endCol}); + } + else { + coverage[line] = { + partial: partial, + source: source, + missing: [{startCol: startCol, endCol: endCol}] + }; + } + }); + + return coverage; +}; + +CoverageData.prototype.prepare = function() { + var store = require('./coverage_store').getStore(this.filename); + + for(var index in store.nodes) { + if (store.nodes.hasOwnProperty(index)) { + this.nodes[index] = {node: this.instrumentor.nodes[index], count: store.nodes[index].count}; + } + } + + for(var index in store.blocks) { + if (store.blocks.hasOwnProperty(index)) { + this.visitedBlocks[index] = {count: store.blocks[index].count}; + } + } +}; + +// Get statistics for the entire file, including per-line code coverage +// and block-level coverage +CoverageData.prototype.stats = function() { + this.prepare(); + + var missing = this.missing(); + var filedata = this.instrumentor.source.split('\n'); + + var observedMissing = []; + var linesInfo = missing.sort(function(lhs, rhs) { + return lhs.loc.start.line < rhs.loc.start.line ? -1 : + lhs.loc.start.line > rhs.loc.start.line ? 1 : + 0; + }).filter(function(node) { + // Make sure we don't double count missing lines due to multi-line + // issues + var okay = (observedMissing.indexOf(node.loc.start.line) < 0); + if(okay) { + observedMissing.push(node.loc.start.line); + } + + return okay; + }).map(function(node, idx, all) { + // For each missing line, add info for it + return { + lineno: node.loc.start.line, + source: function() { return filedata[node.loc.start.line - 1]; } + }; + }); + + var numLines = filedata.length; + var numMissingLines = observedMissing.length; + var numSeenLines = numLines - numMissingLines; + var percentageCovered = numSeenLines / numLines; + + return { + percentage: percentageCovered, + lines: linesInfo, + missing: numMissingLines, + seen: numSeenLines, + total: numLines, + coverage: this.coverage(), + source: this.source, + blocks: this.blocks() + }; +}; + +// Require the CLI module of cover and return it, +// in case anyone wants to use it programmatically +var cli = function() { + return require('./bin/cover'); +}; + +var addInstrumentationHeader = function(template, filename, instrumented, coverageStorePath) { + var template = _.template(template); + var renderedSource = template({ + instrumented: instrumented, + coverageStorePath: coverageStorePath, + filename: filename, + source: instrumented.instrumentedSource + }); + + return renderedSource +}; + +var stripBOM = function(content) { + // Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + // because the buffer-to-string conversion in `fs.readFileSync()` + // translates it to FEFF, the UTF-16 BOM. + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; +} + +var load = function(datas) { + var combinedCoverage = {}; + + _.each(datas, function(data) { + _.each(data.files, function(fileData, filename) { + var instrumentor = { + source: fileData.instrumentor.source, + nodes: fileData.instrumentor.nodes, + nodeCounter: fileData.instrumentor.nodeCounter, + blockCounter: fileData.instrumentor.blockCounter, + }; + + var coverage = new CoverageData(filename, new instrument.Instrumentor()); + coverage.instrumentor.source = fileData.instrumentor.source; + coverage.instrumentor.nodes = fileData.instrumentor.nodes; + coverage.instrumentor.nodeCounter = fileData.instrumentor.nodeCounter; + coverage.instrumentor.blockCounter = fileData.instrumentor.blockCounter; + + coverage.source = coverage.instrumentor.source; + coverage.hash = fileData.hash; + coverage.nodes = fileData.nodes; + coverage.visitedBlocks = fileData.blocks; + + if (combinedCoverage.hasOwnProperty(filename)) { + var coverageSoFar = combinedCoverage[filename]; + + if (coverageSoFar.hash !== coverage.hash) { + throw new Error("Multiple versions of file '" + filename + "' in coverage data!"); + } + + // Merge nodes + _.each(coverage.nodes, function(nodeData, index) { + var nodeDataSoFar = coverageSoFar.nodes[index] = (coverageSoFar.nodes[index] || {node: nodeData.node, count: 0}); + nodeDataSoFar.count += nodeData.count; + }); + + // Merge blocks + _.each(coverage.visitedBlocks, function(blockData, index) { + var blockDataSoFar = coverageSoFar.visitedBlocks[index] = (coverageSoFar.visitedBlocks[index] || {count: 0}); + blockDataSoFar.count += blockData.count; + }); + } + else { + combinedCoverage[filename] = coverage; + } + }); + }); + + return combinedCoverage; +} + +var cover = function(fileRegex, ignore, debugDirectory) { + var originalRequire = require.extensions['.js']; + var coverageData = {}; + var match = null; + + ignore = ignore || {}; + + if (fileRegex instanceof RegExp) { + match = regex; + } + else { + match = new RegExp(fileRegex ? (fileRegex.replace(/\//g, '\\/').replace(/\./g, '\\.')) : ".*", ''); + } + + var pathToCoverageStore = path.resolve(path.resolve(__dirname), "coverage_store.js").replace(/\\/g, "/"); + var templatePath = path.resolve(path.resolve(__dirname), "templates", "instrumentation_header.js"); + var template = fs.readFileSync(templatePath, 'utf-8'); + + require.extensions['.js'] = function(module, filename) { + + filename = filename.replace(/\\/g, "/"); + + if(!match.test(filename)) return originalRequire(module, filename); + if(filename === pathToCoverageStore) return originalRequire(module, filename); + + // If the specific file is to be ignored + var full = path.resolve(filename); + if(ignore[full]) { + return originalRequire(module, filename); + } + + // If any of the parents of the file are to be ignored + do { + full = path.dirname(full); + if (ignore[full]) { + return originalRequire(module, filename); + } + } while(full !== path.dirname(full)); + + var data = stripBOM(fs.readFileSync(filename, 'utf8').trim()); + data = data.replace(/^\#\!.*/, ''); + + var instrumented = instrument(data); + var coverage = coverageData[filename] = new CoverageData(filename, instrumented); + + var newCode = addInstrumentationHeader(template, filename, instrumented, pathToCoverageStore); + + if (debugDirectory) { + var outputPath = path.join(debugDirectory, filename.replace(/[\/|\:|\\]/g, "_") + ".js"); + fs.writeFileSync(outputPath, newCode); + } + + return module._compile(newCode, filename); + }; + + // Setup the data retrieval and release functions + var coverage = function(ready) { + ready(coverageData); + }; + + coverage.release = function() { + require.extensions['.js'] = originalRequire; + }; + + return coverage; +}; + +module.exports = { + cover: cover, + cli: cli, + load: load, + hook: function() { + var c = cli(); + c.hook.apply(c, arguments); + }, + combine: function() { + var c = cli(); + c.combine.apply(c, arguments); + }, + hookAndReport: function() { + var c = cli(); + c.hookAndReport.apply(c, arguments); + }, + hookAndCombine: function() { + var c = cli(); + c.hookAndCombine.apply(c, arguments); + }, + hookAndCombineAndReport: function() { + var c = cli(); + c.hookAndCombineAndReport.apply(c, arguments); + }, + reporters: { + html: require('./reporters/html'), + plain: require('./reporters/plain'), + cli: require('./reporters/cli'), + json: require('./reporters/json') + } +}; \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/instrument.js b/node_modules/dustjs-linkedin/node_modules/cover/instrument.js new file mode 100644 index 0000000..0d90845 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/instrument.js @@ -0,0 +1,489 @@ +var fs = require('fs'); +var esprima = require('./contrib/esprima'); +var escodegen = require('./contrib/escodegen'); +var EventEmitter = require('events').EventEmitter; + +esprima.Syntax = { + AssignmentExpression: 'AssignmentExpression', + ArrayExpression: 'ArrayExpression', + BlockStatement: 'BlockStatement', + BinaryExpression: 'BinaryExpression', + BreakStatement: 'BreakStatement', + CallExpression: 'CallExpression', + CatchClause: 'CatchClause', + ConditionalExpression: 'ConditionalExpression', + ContinueStatement: 'ContinueStatement', + DoWhileStatement: 'DoWhileStatement', + DebuggerStatement: 'DebuggerStatement', + EmptyStatement: 'EmptyStatement', + ExpressionStatement: 'ExpressionStatement', + ForStatement: 'ForStatement', + ForInStatement: 'ForInStatement', + FunctionDeclaration: 'FunctionDeclaration', + FunctionExpression: 'FunctionExpression', + Identifier: 'Identifier', + IfStatement: 'IfStatement', + Literal: 'Literal', + LabeledStatement: 'LabeledStatement', + LogicalExpression: 'LogicalExpression', + MemberExpression: 'MemberExpression', + NewExpression: 'NewExpression', + ObjectExpression: 'ObjectExpression', + Program: 'Program', + Property: 'Property', + ReturnStatement: 'ReturnStatement', + SequenceExpression: 'SequenceExpression', + SwitchStatement: 'SwitchStatement', + SwitchCase: 'SwitchCase', + ThisExpression: 'ThisExpression', + ThrowStatement: 'ThrowStatement', + TryStatement: 'TryStatement', + UnaryExpression: 'UnaryExpression', + UpdateExpression: 'UpdateExpression', + VariableDeclaration: 'VariableDeclaration', + VariableDeclarator: 'VariableDeclarator', + WhileStatement: 'WhileStatement', + WithStatement: 'WithStatement' +}; + +module.exports = function(src) { + var instrumentor = new Instrumentor(src); + return instrumentor; +}; + +module.exports.Instrumentor = Instrumentor; + +function Instrumentor(src) { + // Setup our names + this.names = { + statement: this.generateName(6, "__statement_"), + expression: this.generateName(6, "__expression_"), + block: this.generateName(6, "__block_") + }; + + // Setup the node store + this.nodes = {}; + + // Setup the counters + this.blockCounter = 0; + this.nodeCounter = 0; + + if (src) { + this.instrumentedSource = this.instrument(src); + } +}; + +Instrumentor.prototype = new EventEmitter; + +Instrumentor.prototype.objectify = function() { + var obj = {}; + obj.blockCounter = this.blockCounter; + obj.nodeCounter = this.nodeCounter; + obj.source = this.source; + + obj.nodes = {}; + for(var key in this.nodes) { + if (this.nodes.hasOwnProperty(key)) { + var node = this.nodes[key]; + obj.nodes[key] = { loc: node.loc, id: node.id }; + } + } + + return obj; +} + +Instrumentor.prototype.filter = function(action) { + action = action || function() {}; + + var filtered = []; + for(var key in this.nodes) { + if (this.nodes.hasOwnProperty(key)) { + var node = this.nodes[key]; + if (action(node)) { + filtered.push(node); + } + } + } + + return filtered; +}; + +Instrumentor.prototype.instrument = function(code) { + this.source = code; + + // We wrap the code with a function to make sure it is compliant with node + var header = "(function() {"; + var footer = "\n})();" + var wrappedCode = header + code + footer; + + // Parse the wrapped code + var tree = esprima.parse(wrappedCode, {range: true, loc: true}); + + // We only "instrument" the original part, which is in this sub-statement + this.wrap(tree.body[0].expression.callee.body.body); + + // We need to adjust the nodes for everything on the first line, + // such that their location statements will start at 1 and not at header.length + for(var nodeKey in this.nodes) { + if (this.nodes.hasOwnProperty(nodeKey)) { + var node = this.nodes[nodeKey]; + + if (node.loc.start.line === 1 || node.loc.end.line === 1) { + // Copy over the location data, as these are shared across + // nodes. We only do it for things on the first line + node.loc = { + start: { + line: node.loc.start.line, + column: node.loc.start.column + }, + end: { + line: node.loc.end.line, + column: node.loc.end.column + } + } + + // Adjust the columns + if (node.loc.start.line == 1) { + node.loc.start.column = node.loc.start.column - header.length; + } + if (node.loc.end.line == 1) { + node.loc.end.column = node.loc.end.column - header.length; + } + } + } + } + + return escodegen.generate(tree); +}; + +Instrumentor.prototype.addToContext = function(context) { + context = context || {}; + + var that = this; + + context[that.names.expression] = function (i) { + var node = that.nodes[i]; + that.emit('node', node); + + return function (expr) { + return expr; + }; + }; + + context[that.names.statement] = function (i) { + var node = that.nodes[i]; + that.emit('node', node); + }; + + context[that.names.block] = function (i) { + that.emit('block', i); + }; + + return context; +}; + +Instrumentor.prototype.generateName = function (len, prefix) { + var name = ''; + var lower = '$'.charCodeAt(0); + var upper = 'z'.charCodeAt(0); + + while (name.length < len) { + var c = String.fromCharCode(Math.floor( + Math.random() * (upper - lower + 1) + lower + )); + if ((name + c).match(/^[A-Za-z_$][A-Za-z0-9_$]*$/)) name += c; + } + + return prefix + name; +}; + +Instrumentor.prototype.traverseAndWrap = function(object, visitor, master) { + var key, child, parent, path; + + parent = (typeof master === 'undefined') ? [] : master; + + var returned = visitor.call(null, object, parent); + if (returned === false) { + return; + } + + for (key in object) { + if (object.hasOwnProperty(key)) { + child = object[key]; + path = [ object ]; + path.push(parent); + var newNode; + if (typeof child === 'object' && child !== null && !object.noCover) { + newNode = this.traverseAndWrap(child, visitor, path); + } + + if (newNode) { + object[key] = newNode; + newNode = null; + } + } + } + + return object.noCover ? undefined : returned; +}; + +Instrumentor.prototype.wrap = function(tree) { + var that = this; + this.traverseAndWrap(tree, function(node, path) { + if (node.noCover) { + return; + } + + parent = path[0]; + switch(node.type) { + case esprima.Syntax.ExpressionStatement: + case esprima.Syntax.ThrowStatement: + case esprima.Syntax.VariableDeclaration: { + if (parent && ( + (parent.type === esprima.Syntax.ForInStatement) || + (parent.type === esprima.Syntax.ForStatement) + )) { + return; + } + + var newNode = { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": that.names.statement + }, + "arguments": [ + { + "type": "Literal", + "value": that.nodeCounter++ + } + ] + } + }, + node + ] + } + that.nodes[that.nodeCounter - 1] = node; + node.id = that.nodeCounter - 1; + + return newNode; + } + case esprima.Syntax.ReturnStatement: { + var newNode = { + "type": "SequenceExpression", + "expressions": [ + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": that.names.expression + }, + "arguments": [ + { + "type": "Identifier", + "name": that.nodeCounter++ + } + ], + noCover: true + } + ], + } + + if (node.argument) { + newNode.expressions.push(node.argument); + } + + that.nodes[that.nodeCounter - 1] = node; + node.id = that.nodeCounter - 1; + + node.argument = newNode + break; + } + case esprima.Syntax.ConditionalExpression: { + var newConsequentNode = { + "type": "SequenceExpression", + "expressions": [ + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": that.names.expression + }, + "arguments": [ + { + "type": "Identifier", + "name": that.nodeCounter++ + } + ], + noCover: true + }, + node.consequent + ], + } + that.nodes[that.nodeCounter - 1] = node.consequent; + node.consequent.id = that.nodeCounter - 1 + + var newAlternateNode = { + "type": "SequenceExpression", + "expressions": [ + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": that.names.expression + }, + "arguments": [ + { + "type": "Identifier", + "name": that.nodeCounter++ + } + ], + noCover: true + }, + node.alternate + ], + } + that.nodes[that.nodeCounter - 1] = node.alternate; + node.alternate.id = that.nodeCounter - 1 + + node.consequent = newConsequentNode; + node.alternate = newAlternateNode; + break; + } + case esprima.Syntax.BinaryExpression: + case esprima.Syntax.UpdateExpression: + case esprima.Syntax.LogicalExpression: + case esprima.Syntax.CallExpression: { + var newNode = { + "type": "SequenceExpression", + "expressions": [ + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": that.names.expression + }, + "arguments": [ + { + "type": "Identifier", + "name": that.nodeCounter++ + } + ] + }, + node + ] + } + + that.nodes[that.nodeCounter - 1] = node; + node.id = that.nodeCounter - 1; + + return newNode + } + case esprima.Syntax.BlockStatement: { + var newNode = { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": that.names.block + }, + "arguments": [ + { + "type": "Literal", + "value": that.blockCounter++ + } + ] + }, + "noCover": true + } + + node.body.unshift(newNode) + break; + } + case esprima.Syntax.ForStatement: + case esprima.Syntax.ForInStatement: + case esprima.Syntax.LabeledStatement: + case esprima.Syntax.WhileStatement: + case esprima.Syntax.WithStatement: + case esprima.Syntax.CatchClause: + case esprima.Syntax.DoWhileStatement: { + if (node.body && node.body.type !== esprima.Syntax.BlockStatement) { + var newNode = { + "type": "BlockStatement", + "body": [ + node.body + ] + } + + node.body = newNode; + } + break; + } + case esprima.Syntax.TryStatement: { + if (node.block && node.block.type !== esprima.Syntax.BlockStatement) { + var newNode = { + "type": "BlockStatement", + "body": [ + node.block + ] + } + + node.block = newNode; + } + if (node.finalizer && node.finalizer.type !== esprima.Syntax.BlockStatement) { + var newNode = { + "type": "BlockStatement", + "body": [ + node.block + ] + } + + node.finalizer = newNode; + } + break; + } + case esprima.Syntax.SwitchCase: { + if (node.consequent && node.consequent.length > 0 && + (node.consequent.length != 1 || node.consequent[0].type !== esprima.Syntax.BlockStatement)) { + var newNode = { + "type": "BlockStatement", + "body": node.consequent + } + + node.consequent = [newNode]; + } + break; + } + case esprima.Syntax.IfStatement: { + if (node.consequent && node.consequent.type !== esprima.Syntax.BlockStatement) { + var newNode = { + "type": "BlockStatement", + "body": [ + node.consequent + ] + } + + node.consequent = newNode; + } + if (node.alternate && node.alternate.type !== esprima.Syntax.BlockStatement + && node.alternate.type !== esprima.Syntax.IfStatement) { + var newNode = { + "type": "BlockStatement", + "body": [ + node.alternate + ] + } + + node.alternate = newNode; + } + break; + } + } + }); +} \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/.bin/which b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/.bin/which new file mode 120000 index 0000000..f62471c --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/.bin/which @@ -0,0 +1 @@ +../which/bin/which \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/.npmignore b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/.npmignore new file mode 100644 index 0000000..8ec3d50 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/.npmignore @@ -0,0 +1 @@ +lib-cov diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/History.md b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/History.md new file mode 100644 index 0000000..4f02434 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/History.md @@ -0,0 +1,5 @@ + +0.0.1 / 2011-01-03 +================== + +Initial release diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/Makefile b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/Makefile new file mode 100644 index 0000000..479a783 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/Makefile @@ -0,0 +1,14 @@ + +test: + @NODE_ENV=test ./support/expresso/bin/expresso \ + -I lib \ + -I support \ + -I support/should.js/lib \ + -I support/colors.js \ + $(TESTFLAGS) \ + test/*.test.js + +test-cov: + @TESTFLAGS=--cov $(MAKE) test + +.PHONY: test test-cov diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/README.md b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/README.md new file mode 100644 index 0000000..4ecf190 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/README.md @@ -0,0 +1,82 @@ +CLI Table +========= + +This utility allows you to render unicode-aided tables on the command line from +your node.js scripts. + +![Screenshot](http://i.imgur.com/sYq4T.png) + +## Features + +- Customizable characters that constitute the table. +- Color/background styling in the header through + [colors.js](http://github.com/marak/colors.js) +- Column width customization +- Text truncation based on predefined widths +- Text alignment (left, right, center) +- Padding (left, right) +- Easy-to-use API + +## Installation + +```bash +npm install cli-table +``` + +## How to use + +```javascript +var Table = require('cli-table'); + +// instantiate +var table = new Table({ + head: ['TH 1 label', 'TH 2 label'] + , colWidths: [100, 200] +}); + +// table is an Array, so you can `push`, `unshift`, `splice` and friends +table.push( + ['First value', 'Second value'] + , ['First value', 'Second value'] +); + +// render +console.log(table.toString()); +``` + +## Running tests + +Clone the repository with all its submodules and run: + +```bash +$ make test +``` + +## Credits + +- Guillermo Rauch <guillermo@learnboost.com> ([Guille](http://github.com/guille)) + +## License + +(The MIT License) + +Copyright (c) 2010 LearnBoost <dev@learnboost.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/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/examples/revs.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/examples/revs.js new file mode 100644 index 0000000..ba1d91c --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/examples/revs.js @@ -0,0 +1,41 @@ + +/** + * Module requirements. + */ + +// this line is only needed if you refuse to use npm +require.paths.unshift(__dirname + '/../support/colors'); + +var Table = require('../lib/cli-table'); + +/** + * Example. + */ + +var table = new Table({ + head: ['Rel', 'Change', 'By', 'When'] + , colWidths: [6, 21, 25, 17] +}); + +table.push( + ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '7 minutes ago'] + , ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '8 minutes ago'] +); + +console.log(table.toString()); + + +var table = new Table({ + head: ['Rel', 'Change', 'By', 'When'] + , colWidths: [6, 21, 25, 17] + , style : {compact : true, 'padding-left' : 1} +}); + +table.push( + ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '7 minutes ago'] + , ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '8 minutes ago'] + , [] + , ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '8 minutes ago'] +); + +console.log(table.toString()); \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/examples/table.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/examples/table.js new file mode 100644 index 0000000..2172dde --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/examples/table.js @@ -0,0 +1,40 @@ + +/** + * Module requirements. + */ + +// this line is only needed if you refuse to use npm +require.paths.unshift(__dirname + '/../support/colors'); + +var Table = require('../lib/cli-table'); + +/** + * Example. + */ + +var table = new Table({ + head: ['First', 'Last', 'Email', 'Twitter'] + , chars: { + 'top': '-' + , 'top-mid': '-' + , 'top-left': '-' + , 'top-right': '-' + , 'bottom': '-' + , 'bottom-mid': '-' + , 'bottom-left': '-' + , 'bottom-right': '-' + , 'left': '|' + , 'left-mid': '|' + , 'mid': '-' + , 'mid-mid': '-' + , 'right': '|' + , 'right-mid': '-' + } + , colWidths: [14, 10, 25, 17] +}); + +table.push( + ['Guillermo', 'Rauch', 'rauchg@gmail.com', 'rauchg'] +); + +console.log(table.toString()); diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/index.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/index.js new file mode 100644 index 0000000..1c01669 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/index.js @@ -0,0 +1,2 @@ + +module.exports = require('./lib/cli-table'); diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/lib/cli-table/index.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/lib/cli-table/index.js new file mode 100644 index 0000000..e395531 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/lib/cli-table/index.js @@ -0,0 +1,212 @@ + +/** + * Module dependencies. + */ + +var utils = require('./utils') + , repeat = utils.repeat + , truncate = utils.truncate + , pad = utils.pad; + +require('colors'); + +/** + * Table constructor + * + * @param {Object} options + * @api public + */ + +function Table (options){ + this.options = utils.options({ + chars: { + 'top': '━' + , 'top-mid': '┳' + , 'top-left': '┏' + , 'top-right': '┓' + , 'bottom': '━' + , 'bottom-mid': '┻' + , 'bottom-left': '┗' + , 'bottom-right': '┛' + , 'left': '┃' + , 'left-mid': '┣' + , 'mid': '━' + , 'mid-mid': '╋' + , 'right': '┃' + , 'right-mid': '┫' + } + , truncate: '…' + , colWidths: [] + , colAligns: [] + , style: { + 'padding-left': 1 + , 'padding-right': 1 + , head: ['cyan'] + , compact : false + } + , head: [] + }, options); +}; + +/** + * Inherit from Array. + */ + +Table.prototype.__proto__ = Array.prototype; + +/** + * Width getter + * + * @return {Number} width + * @api public + */ + +Table.prototype.__defineGetter__('width', function (){ + var str = this.toString().split("\n"); + if (str.length) return str[0].length; + return 0; +}); + +/** + * Render to a string. + * + * @return {String} table representation + * @api public + */ + +Table.prototype.render +Table.prototype.toString = function (){ + var ret = '' + , options = this.options + , style = options.style + , head = options.head + , chars = options.chars + , truncater = options.truncate + , colWidths = options.colWidths || new Array(this.head.length) + , totalWidth = 0; + + if (!head.length && !this.length) return ''; + + if (!colWidths.length){ + this.slice(0).concat([head]).forEach(function(cells){ + cells.forEach(function(cell, i){ + var width = typeof cell == 'object' && cell.width != undefined + ? cell.width + : ((typeof cell == 'object' ? utils.strlen(cell.text) : utils.strlen(cell)) + (style['padding-left'] || 0) + (style['padding-right'] || 0)) + colWidths[i] = Math.max(colWidths[i] || 0, width || 0); + }); + }); + }; + + totalWidth = (colWidths.length == 1 ? colWidths[0] : colWidths.reduce( + function (a, b){ + return a + b + })) + colWidths.length + 1; + + // draws a line + function line (line, left, right, intersection){ + var width = 0 + , line = + left + + repeat(line, totalWidth - 2) + + right; + + colWidths.forEach(function (w, i){ + if (i == colWidths.length - 1) return; + width += w + 1; + line = line.substr(0, width) + intersection + line.substr(width + 1); + }); + + ret += line; + }; + + // draws the top line + function lineTop (){ + line(chars.top + , chars['top-left'] || chars.top + , chars['top-right'] || chars.top + , chars['top-mid']); + ret += "\n"; + }; + + // renders a string, by padding it or truncating it + function string (str, index){ + var str = String(typeof str == 'object' && str.text ? str.text : str) + , length = utils.strlen(str) + , width = colWidths[index] + - (style['padding-left'] || 0) + - (style['padding-right'] || 0) + , align = options.colAligns[index] || 'left'; + + return repeat(' ', style['padding-left'] || 0) + + (length == width ? str : + (length < width + ? pad(str, ( width + (str.length - length) ), ' ', align == 'left' ? 'right' : + (align == 'middle' ? 'both' : 'left')) + : (truncater ? truncate(str, width, truncater) : str)) + ) + + repeat(' ', style['padding-right'] || 0); + }; + + if (head.length){ + lineTop(); + + ret += chars.left; + + head.forEach(function (th, index){ + var text = string(th, index); + if (style.head){ + style.head.forEach(function(style){ + text = text[style]; + }); + } + + ret += text; + ret += chars.right; + }); + + ret += "\n"; + } + + if (this.length) + this.forEach(function (cells, i){ + if (!head.length && i == 0) + lineTop(); + else { + if (!style.compact || i<(!!head.length) ?1:0 || cells.length == 0){ + line(chars.mid + , chars['left-mid'] + , chars['right-mid'] + , chars['mid-mid']); + + ret += "\n" + } + if (!cells.length) + return; + + ret += chars.left; + + cells.forEach(function(cell, i){ + ret += string(cell, i); + ret += chars.right; + }); + + ret += "\n"; + } + }); + + line(chars.bottom + , chars['bottom-left'] || chars.bottom + , chars['bottom-right'] || chars.bottom + , chars['bottom-mid']); + + return ret; +}; + +/** + * Module exports. + */ + +module.exports = Table; + +module.exports.version = '0.0.1'; diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/lib/cli-table/utils.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/lib/cli-table/utils.js new file mode 100644 index 0000000..2990c84 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/lib/cli-table/utils.js @@ -0,0 +1,95 @@ + +/** + * Repeats a string. + * + * @param {String} char(s) + * @param {Number} number of times + * @return {String} repeated string + */ + +exports.repeat = function (str, times){ + return Array(times + 1).join(str); +}; + +/** + * Pads a string + * + * @api public + */ + +exports.pad = function (str, len, pad, dir) { + if (len + 1 >= str.length) + switch (dir){ + case 'left': + str = Array(len + 1 - str.length).join(pad) + str; + break; + + case 'both': + var right = Math.ceil((padlen = len - str.length) / 2); + var left = padlen - right; + str = Array(left + 1).join(pad) + str + Array(right + 1).join(pad); + break; + + default: + str = str + Array(len + 1 - str.length).join(pad); + }; + + return str; +}; + +/** + * Truncates a string + * + * @api public + */ + +exports.truncate = function (str, length, chr){ + chr = chr || '…'; + return str.length >= length ? str.substr(0, length - chr.length) + chr : str; +}; + +/** + * Copies and merges options with defaults. + * + * @param {Object} defaults + * @param {Object} supplied options + * @return {Object} new (merged) object + */ + +function clone(a){ + var b; + if (Array.isArray(a)){ + b = []; + for (var i = 0, l = a.length; i < l; i++) + b.push(typeof a[i] == 'object' ? clone(a[i]) : a[i]); + return b; + } else if (typeof a == 'object'){ + b = {}; + for (var i in a) + b[i] = typeof a[i] == 'object' ? clone(a[i]) : a[i]; + return b; + } + return a; +}; + +exports.options = function (defaults, opts){ + var c = clone(opts); + for (var i in defaults) + if (!(i in opts)) + c[i] = defaults[i]; + return c; +}; + + +// +// For consideration of terminal "color" programs like colors.js, +// which can add ANSI escape color codes to strings, +// we destyle the ANSI color escape codes for padding calculations. +// +// see: http://en.wikipedia.org/wiki/ANSI_escape_code +// +exports.strlen = function(str){ + var code = /\u001b\[\d+m/g; + var stripped = ("" + str).replace(code,''); + return stripped.length; +} diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/node_modules/colors/MIT-LICENSE.txt b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/node_modules/colors/MIT-LICENSE.txt new file mode 100644 index 0000000..94a870b --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/node_modules/colors/MIT-LICENSE.txt @@ -0,0 +1,20 @@ +Copyright (c) 2010 Marak Squires http://github.com/marak/say.js/ + +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. diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/node_modules/colors/ReadMe.md b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/node_modules/colors/ReadMe.md new file mode 100644 index 0000000..4d965e3 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/node_modules/colors/ReadMe.md @@ -0,0 +1,30 @@ +

colors.js - get color and style in your node.js console like what

+ + + + var sys = require('sys'); + var colors = require('./colors'); + + sys.puts('hello'.green); // outputs green text + sys.puts('i like cake and pies'.underline.red) // outputs red underlined text + sys.puts('inverse the color'.inverse); // inverses the color + sys.puts('OMG Rainbows!'.rainbow); // rainbow (ignores spaces) + +

colors and styles!

+- bold +- italic +- underline +- inverse +- yellow +- cyan +- white +- magenta +- green +- red +- grey +- blue + + +### Authors + +#### Alexis Sellier (cloudhead) , Marak Squires , Justin Campbell diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/node_modules/colors/colors.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/node_modules/colors/colors.js new file mode 100644 index 0000000..c56ff20 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/node_modules/colors/colors.js @@ -0,0 +1,75 @@ +/* +colors.js + +Copyright (c) 2010 Alexis Sellier (cloudhead) , Marak Squires + +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. + +*/ + +// prototypes the string object to have additional method calls that add terminal colors +['bold', 'underline', 'italic', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta'].forEach(function (style) { + Object.defineProperty(String.prototype, style, { + get: function () { + return stylize(this, style); + } + }); +}); + +// prototypes string with method "rainbow" +// rainbow will apply a the color spectrum to a string, changing colors every letter +Object.defineProperty(String.prototype, 'rainbow', { + get: function () { + var rainbowcolors = ['red','yellow','green','blue','magenta']; //RoY G BiV + var exploded = this.split(""); + var i=0; + exploded = exploded.map(function(letter) { + if (letter==" ") { + return letter; + } + else { + return stylize(letter,rainbowcolors[i++ % rainbowcolors.length]); + } + }); + return exploded.join(""); + } +}); + +function stylize(str, style) { + var styles = { + //styles + 'bold' : [1, 22], + 'italic' : [3, 23], + 'underline' : [4, 24], + 'inverse' : [7, 27], + //grayscale + 'white' : [37, 39], + 'grey' : [90, 39], + 'black' : [90, 39], + //colors + 'blue' : [34, 39], + 'cyan' : [36, 39], + 'green' : [32, 39], + 'magenta' : [35, 39], + 'red' : [31, 39], + 'yellow' : [33, 39] + }; + return '\033[' + styles[style][0] + 'm' + str + + '\033[' + styles[style][1] + 'm'; +}; \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/node_modules/colors/example.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/node_modules/colors/example.js new file mode 100644 index 0000000..5c08c9c --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/node_modules/colors/example.js @@ -0,0 +1,6 @@ +var sys = require('sys'); +var colors = require('./colors'); + +sys.puts('Rainbows are fun!'.rainbow); +sys.puts('So '.italic + 'are'.underline + ' styles! '.bold + 'inverse'.inverse); // styles not widely supported +sys.puts('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/node_modules/colors/package.json b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/node_modules/colors/package.json new file mode 100644 index 0000000..78db41e --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/node_modules/colors/package.json @@ -0,0 +1,19 @@ +{ + "name": "colors", + "description": "get colors in your node.js console like what", + "version": "0.3.0", + "author": { + "name": "Marak Squires" + }, + "repository": { + "type": "git", + "url": "http://github.com/Marak/colors.js.git" + }, + "engine": [ + "node >=0.1.90" + ], + "main": "colors", + "readme": "

colors.js - get color and style in your node.js console like what

\n\n\n\n var sys = require('sys');\n var colors = require('./colors');\n\n sys.puts('hello'.green); // outputs green text\n sys.puts('i like cake and pies'.underline.red) // outputs red underlined text\n sys.puts('inverse the color'.inverse); // inverses the color\n sys.puts('OMG Rainbows!'.rainbow); // rainbow (ignores spaces)\n \n

colors and styles!

\n- bold\n- italic\n- underline\n- inverse\n- yellow\n- cyan\n- white\n- magenta\n- green\n- red\n- grey\n- blue\n\n\n### Authors \n\n#### Alexis Sellier (cloudhead) , Marak Squires , Justin Campbell\n", + "_id": "colors@0.3.0", + "_from": "colors@0.3.0" +} diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/package.json b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/package.json new file mode 100644 index 0000000..786597b --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/package.json @@ -0,0 +1,24 @@ +{ + "name": "cli-table", + "description": "Pretty unicode tables for the CLI", + "version": "0.0.2", + "author": { + "name": "Guillermo Rauch", + "email": "guillermo@learnboost.com" + }, + "keywords": [ + "cli", + "colors", + "table" + ], + "dependencies": { + "colors": "0.3.0" + }, + "main": "./index.js", + "engines": { + "node": ">= 0.2.0" + }, + "readme": "CLI Table\n=========\n\nThis utility allows you to render unicode-aided tables on the command line from\nyour node.js scripts.\n\n![Screenshot](http://i.imgur.com/sYq4T.png)\n\n## Features\n\n- Customizable characters that constitute the table.\n- Color/background styling in the header through\n [colors.js](http://github.com/marak/colors.js)\n- Column width customization\n- Text truncation based on predefined widths\n- Text alignment (left, right, center)\n- Padding (left, right)\n- Easy-to-use API\n\n## Installation\n\n```bash \nnpm install cli-table\n```\n\n## How to use\n\n```javascript\nvar Table = require('cli-table');\n\n// instantiate\nvar table = new Table({\n head: ['TH 1 label', 'TH 2 label']\n , colWidths: [100, 200]\n});\n\n// table is an Array, so you can `push`, `unshift`, `splice` and friends\ntable.push(\n ['First value', 'Second value']\n , ['First value', 'Second value']\n);\n\n// render\nconsole.log(table.toString());\n```\n\n## Running tests\n\nClone the repository with all its submodules and run:\n\n```bash\n$ make test\n```\n\n## Credits\n\n- Guillermo Rauch <guillermo@learnboost.com> ([Guille](http://github.com/guille))\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2010 LearnBoost <dev@learnboost.com>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", + "_id": "cli-table@0.0.2", + "_from": "cli-table@0.0.x" +} diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/test/common.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/test/common.js new file mode 100644 index 0000000..9b65e08 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/test/common.js @@ -0,0 +1,6 @@ + +/** + * Module dependencies. + */ + +require('should'); diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/test/index.test.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/test/index.test.js new file mode 100644 index 0000000..2711e11 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/cli-table/test/index.test.js @@ -0,0 +1,52 @@ + +/** + * Module requirements. + */ + +require('./common'); + +var Table = require('cli-table'); + +/** + * Tests. + */ + +module.exports = { + + 'test complete table': function (){ + var table = new Table({ + head: ['Rel', 'Change', 'By', 'When'] + , style: { + 'padding-left': 1 + , 'padding-right': 1 + } + , colWidths: [6, 21, 25, 17] + }); + + table.push( + ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '7 minutes ago'] + , ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '8 minutes ago'] + ); + + var expected = [ + '┏━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓' + , '┃ Rel ┃ Change ┃ By ┃ When ┃' + , '┣━━━━━━╋━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━┫' + , '┃ v0.1 ┃ Testing something … ┃ rauchg@gmail.com ┃ 7 minutes ago ┃' + , '┣━━━━━━╋━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━┫' + , '┃ v0.1 ┃ Testing something … ┃ rauchg@gmail.com ┃ 8 minutes ago ┃' + , '┗━━━━━━┻━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━┛' + ]; + + table.toString().should.eql(expected.join("\n")); + }, + + 'test width property': function (){ + var table = new Table({ + head: ['Cool'] + }); + + table.width.should.eql(8); + } + +}; diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/README.markdown b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/README.markdown new file mode 100644 index 0000000..5dcb249 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/README.markdown @@ -0,0 +1,506 @@ +# Underscore.string # + +Javascript lacks complete string manipulation operations. +This an attempt to fill that gap. List of build-in methods can be found +for example from [Dive Into JavaScript][d]. + +[d]: http://www.diveintojavascript.com/core-javascript-reference/the-string-object + + +As name states this an extension for [Underscore.js][u], but it can be used +independently from **_s**-global variable. But with Underscore.js you can +use Object-Oriented style and chaining: + +[u]: http://documentcloud.github.com/underscore/ + + _(" epeli ").chain().trim().capitalize().value() + => "Epeli" + +## Node.js installation ## + +**npm package** + + npm install underscore.string + +**Standalone usage**: + + var _s = require('underscore.string'); + +**Integrate with Underscore.js**: + + var _ = require('underscore'); + + // Import Underscore.string to separate object, because there are conflict functions (include, reverse, contains) + _.str = require('underscore.string'); + + // Mix in non-conflict functions to Underscore namespace if you want + _.mixin(_.str.exports()); + + // All functions, include conflict, will be available through _.str object + _.str.include('Underscore.string', 'string'); // => true + +## String Functions ## + +For availability of functions in this way you need to mix in Underscore.string functions: + + _.mixin(_.string.exports()); + +otherwise functions from examples will be available through _.string or _.str objects: + + _.str.capitalize('epeli') + => "Epeli" + +**capitalize** _.capitalize(string) + +Converts first letter of the string to uppercase. + + _.capitalize("epeli") + => "Epeli" + +**chop** _.chop(string, step) + + _.chop('whitespace', 3) + => ['whi','tes','pac','e'] + +**clean** _.clean(str) + +Compress some whitespaces to one. + + _.clean(" foo bar ") + => 'foo bar' + +**chars** _.chars(str) + + _.chars('Hello') + => ['H','e','l','l','o'] + +**includes** _.includes(string, substring) + +Tests if string contains a substring. + + _.includes("foobar", "ob") + => true + +**include** available only through _.str object, because Underscore has function with the same name. + + _.str.include("foobar", "ob") + => true + +**includes** function was removed + +But you can create it in this way, for compatibility with previous versions: + + _.includes = _.str.include + +**count** _.count(string, substring) + + _('Hello world').count('l') + => 3 + +**escapeHTML** _.escapeHTML(string) + +Converts HTML special characters to their entity equivalents. + + _('
Blah blah blah
').escapeHTML(); + => '<div>Blah blah blah</div>' + +**unescapeHTML** _.unescapeHTML(string) + +Converts entity characters to HTML equivalents. + + _('<div>Blah blah blah</div>').unescapeHTML(); + => '
Blah blah blah
' + +**insert** _.insert(string, index, substing) + + _('Hello ').insert(6, 'world') + => 'Hello world' + +**isBlank** _.isBlank(string) + + _('').isBlank(); // => true + _('\n').isBlank(); // => true + _(' ').isBlank(); // => true + _('a').isBlank(); // => false + +**join** _.join(separator, *strings) + +Joins strings together with given separator + + _.join(" ", "foo", "bar") + => "foo bar" + +**lines** _.lines(str) + + _.lines("Hello\nWorld") + => ["Hello", "World"] + +**reverse** available only through _.str object, because Underscore has function with the same name. + +Return reversed string: + + _.str.reverse("foobar") + => 'raboof' + +**splice** _.splice(string, index, howmany, substring) + +Like a array splice. + + _('https://edtsech@bitbucket.org/edtsech/underscore.strings').splice(30, 7, 'epeli') + => 'https://edtsech@bitbucket.org/epeli/underscore.strings' + +**startsWith** _.startsWith(string, starts) + +This method checks whether string starts with starts. + + _("image.gif").startsWith("image") + => true + +**endsWith** _.endsWith(string, ends) + +This method checks whether string ends with ends. + + _("image.gif").endsWith("gif") + => true + +**succ** _.succ(str) + +Returns the successor to str. + + _('a').succ() + => 'b' + + _('A').succ() + => 'B' + +**supplant** + +Supplant function was removed, use Underscore.js [template function][p]. + +[p]: http://documentcloud.github.com/underscore/#template + +**strip** alias for *trim* + +**lstrip** alias for *ltrim* + +**rstrip** alias for *rtrim* + +**titleize** _.titleize(string) + + _('my name is epeli').titleize() + => 'My Name Is Epeli' + +**camelize** _.camelize(string) + +Converts underscored or dasherized string to a camelized one + + _('-moz-transform').camelize() + => 'MozTransform' + +**underscored** _.underscored(string) + +Converts a camelized or dasherized string into an underscored one + + _(MozTransform).underscored() + => 'moz_transform' + +**dasherize** _.dasherize(string) + +Converts a underscored or camelized string into an dasherized one + + _('MozTransform').dasherize() + => '-moz-transform' + +**humanize** _.humanize(string) + +Converts an underscored, camelized, or dasherized string into a humanized one. +Also removes beginning and ending whitespace, and removes the postfix '_id'. + + _(' capitalize dash-CamelCase_underscore trim ').humanize() + => 'Capitalize dash camel case underscore trim' + +**trim** _.trim(string, [characters]) + +trims defined characters from begining and ending of the string. +Defaults to whitespace characters. + + _.trim(" foobar ") + => "foobar" + + _.trim("_-foobar-_", "_-") + => "foobar" + + +**ltrim** _.ltrim(string, [characters]) + +Left trim. Similar to trim, but only for left side. + + +**rtrim** _.rtrim(string, [characters]) + +Right trim. Similar to trim, but only for right side. + +**truncate** _.truncate(string, length, truncateString) + + _('Hello world').truncate(5) + => 'Hello...' + + _('Hello').truncate(10) + => 'Hello' + +**prune** _.prune(string, length, pruneString) + +Elegant version of truncate. +Makes sure the pruned string does not exceed the original length. +Avoid half-chopped words when truncating. + + _('Hello, world').prune(5) + => 'Hello...' + + _('Hello, world').prune(8) + => 'Hello...' + + _('Hello, world').prune(5, ' (read a lot more)') + => 'Hello, world' (as adding "(read a lot more)" would be longer than the original string) + + _('Hello, cruel world').prune(15) + => 'Hello, cruel...' + + _('Hello').prune(10) + => 'Hello' + +**words** _.words(str, delimiter=" ") + +Split string by delimiter (String or RegExp), ' ' by default. + + _.words("I love you") + => ["I","love","you"] + + _.words("I_love_you", "_") + => ["I","love","you"] + + _.words("I-love-you", /-/) + => ["I","love","you"] + +**sprintf** _.sprintf(string format, *arguments) + +C like string formatting. +Credits goes to [Alexandru Marasteanu][o]. +For more detailed documentation, see the [original page][o]. + +[o]: http://www.diveintojavascript.com/projects/sprintf-for-javascript + + _.sprintf("%.1f", 1.17) + "1.2" + +**pad** _.pad(str, length, [padStr, type]) + +pads the `str` with characters until the total string length is equal to the passed `length` parameter. By default, pads on the **left** with the space char (`" "`). `padStr` is truncated to a single character if necessary. + + _.pad("1", 8) + -> " 1"; + + _.pad("1", 8, '0') + -> "00000001"; + + _.pad("1", 8, '0', 'right') + -> "10000000"; + + _.pad("1", 8, '0', 'both') + -> "00001000"; + + _.pad("1", 8, 'bleepblorp', 'both') + -> "bbbb1bbb"; + +**lpad** _.lpad(str, length, [padStr]) + +left-pad a string. Alias for `pad(str, length, padStr, 'left')` + + _.lpad("1", 8, '0') + -> "00000001"; + +**rpad** _.rpad(str, length, [padStr]) + +right-pad a string. Alias for `pad(str, length, padStr, 'right')` + + _.rpad("1", 8, '0') + -> "10000000"; + +**lrpad** _.lrpad(str, length, [padStr]) + +left/right-pad a string. Alias for `pad(str, length, padStr, 'both')` + + _.lrpad("1", 8, '0') + -> "00001000"; + +**center** alias for **lrpad** + +**ljust** alias for *lpad* + +**rjust** alias for *rpad* + +**toNumber** _.toNumber(string, [decimals]) + +Parse string to number. Returns NaN if string can't be parsed to number. + + _('2.556').toNumber() + => 3 + + _('2.556').toNumber(1) + => 2.6 + +**strRight** _.strRight(string, pattern) + +Searches a string from left to right for a pattern and returns a substring consisting of the characters in the string that are to the right of the pattern or all string if no match found. + + _('This_is_a_test_string').strRight('_') + => "is_a_test_string"; + +**strRightBack** _.strRightBack(string, pattern) + +Searches a string from right to left for a pattern and returns a substring consisting of the characters in the string that are to the right of the pattern or all string if no match found. + + _('This_is_a_test_string').strRightBack('_') + => "string"; + +**strLeft** _.strLeft(string, pattern) + +Searches a string from left to right for a pattern and returns a substring consisting of the characters in the string that are to the left of the pattern or all string if no match found. + + _('This_is_a_test_string').strLeft('_') + => "This"; + +**strLeftBack** _.strLeftBack(string, pattern) + +Searches a string from right to left for a pattern and returns a substring consisting of the characters in the string that are to the left of the pattern or all string if no match found. + + _('This_is_a_test_string').strLeftBack('_') + => "This_is_a_test"; + +**stripTags** + +Removes all html tags from string. + + _('a link').stripTags() + => 'a link' + _('a link').stripTags() + => 'a linkalert("hello world!")' + + +## Roadmap ## + +Any suggestions or bug reports are welcome. Just email me or more preferably open an issue. + +## Changelog ## + +### 2.0.0 ### + +* Added prune, humanize functions +* Added _.string (_.str) namespace for Underscore.string library +* Removed includes function + +#### Problems + +We lose two things for `include` and `reverse` methods from `_.string`: + +* Calls like `_('foobar').include('bar')` aren't available; +* Chaining isn't available too. + +But if you need this functionality you can create aliases for conflict functions which will be convenient for you: + + _.mixin({ + includeString: _.str.include, + reverseString: _.str.reverse + }) + + // Now wrapper calls and chaining are available. + _('foobar').chain().reverseString().includeString('rab').value() + +#### Standalone Usage + +If you are using Underscore.string without Underscore. You also have `_.string` namespace for it and `_.str` alias +But of course you can just reassign `_` variable with `_.string` + + _ = _.string + +#### Upgrade + +For upgrading to this version you need to mix in Underscore.string library to Underscore object: + + _.mixin(_.string.exports()); + +and all non-conflict Underscore.string functions will be available through Underscore object. +Also function `includes` has been removed, you should replace this function by `_.str.include` +or create alias `_.includes = _.str.include` and all your code will work fine. + +### 1.1.6 ### + +* Fixed reverse and truncate +* Added isBlank, stripTags, inlude(alias for includes) +* Added uglifier compression + +### 1.1.5 ### + +* Added strRight, strRightBack, strLeft, strLeftBack + +### 1.1.4 ### + +* Added pad, lpad, rpad, lrpad methods and aliases center, ljust, rjust +* Integration with Underscore 1.1.6 + +### 1.1.3 ### + +* Added methods: underscored, camelize, dasherize +* Support newer version of npm + +### 1.1.2 ### + +* Created functions: lines, chars, words functions + +### 1.0.2 ### + +* Created integration test suite with underscore.js 1.1.4 (now it's absolutely compatible) +* Removed 'reverse' function, because this function override underscore.js 'reverse' + +## Contribute ## + +* Fork & pull request. Don't forget about tests. +* If you planning add some feature please create issue before. + +Otherwise changes will be rejected. + +## Contributors list ## + +* Esa-Matti Suuronen (), +* Edward Tsech , +* Sasha Koss (), +* Vladimir Dronnikov , +* Pete Kruckenberg (), +* Paul Chavard (), +* Ed Finkler () +* Pavel Pravosud + +## Licence ## + +The MIT License + +Copyright (c) 2011 Esa-Matti Suuronen esa-matti@suuronen.org + +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. + diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/Rakefile b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/Rakefile new file mode 100644 index 0000000..30c5415 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/Rakefile @@ -0,0 +1,16 @@ +require 'rubygems' +require 'closure-compiler' +require 'uglifier' + +task :default => :build + +desc 'Use UglifyJS or Closure Compiler to compress Underscore.string' +task :build do + source = File.read('lib/underscore.string.js') + uglified = Uglifier.compile(source, :copyright => false) + closured = Closure::Compiler.new.compile(source) + compressed = [ uglified, closured ].sort_by(&:length).first + File.open('dist/underscore.string.min.js', 'w'){ |f| f.write compressed } + compression_rate = compressed.length.to_f/source.length + puts "compressed dist/underscore.string.min.js: #{compressed.length}/#{source.length} #{(compression_rate * 100).round}%" +end diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/dist/underscore.string.min.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/dist/underscore.string.min.js new file mode 100644 index 0000000..dfc1b46 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/dist/underscore.string.min.js @@ -0,0 +1,14 @@ +(function(k){var o=String.prototype.trim,l=function(a,b){for(var c=[];b>0;c[--b]=a);return c.join("")},d=function(a){return function(){for(var b=Array.prototype.slice.call(arguments),c=0;c=0?"+"+f:f;i=g[4]?g[4]=="0"?"0":g[4].charAt(1):" ";k=g[6]-String(f).length;i=g[6]?l(i,k):"";j.push(g[5]?f+i:i+f)}return j.join("")};b.cache= +{};b.parse=function(a){for(var b=[],e=[],d=0;a;){if((b=/^[^\x25]+/.exec(a))!==null)e.push(b[0]);else if((b=/^\x25{2}/.exec(a))!==null)e.push("%");else if((b=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(a))!==null){if(b[2]){d|=1;var f=[],j=b[2],h=[];if((h=/^([a-z_][a-z_\d]*)/i.exec(j))!==null)for(f.push(h[1]);(j=j.substring(h[0].length))!=="";)if((h=/^\.([a-z_][a-z_\d]*)/i.exec(j))!==null)f.push(h[1]);else if((h=/^\[(\d+)\]/.exec(j))!==null)f.push(h[1]); +else throw"[_.sprintf] huh?";else throw"[_.sprintf] huh?";b[2]=f}else d|=2;if(d===3)throw"[_.sprintf] mixing positional and named placeholders is not (yet) supported";e.push(b)}else throw"[_.sprintf] huh?";a=a.substring(b[0].length)}return e};return b}(),e={VERSION:"1.2.0",isBlank:d(function(a){return/^\s*$/.test(a)}),stripTags:d(function(a){return a.replace(/<\/?[^>]+>/ig,"")}),capitalize:d(function(a){return a.charAt(0).toUpperCase()+a.substring(1).toLowerCase()}),chop:d(function(a,b){for(var b= +b*1||0||a.length,c=[],e=0;e=0&&c++,d=d+(e>=0?e:0)+b.length;return c}),chars:d(function(a){return a.split("")}),escapeHTML:d(function(a){return a.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}),unescapeHTML:d(function(a){return a.replace(/</g,"<").replace(/>/g, +">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}),escapeRegExp:d(function(a){return a.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1")}),insert:d(function(a,b,c){a=a.split("");a.splice(b*1||0,0,c);return a.join("")}),include:d(function(a,b){return a.indexOf(b)!==-1}),join:d(function(a){var b=Array.prototype.slice.call(arguments);return b.join(b.shift())}),lines:d(function(a){return a.split("\n")}),reverse:d(function(a){return Array.prototype.reverse.apply(String(a).split("")).join("")}), +splice:d(function(a,b,c,e){a=a.split("");a.splice(b*1||0,c*1||0,e);return a.join("")}),startsWith:d(function(a,b){return a.length>=b.length&&a.substring(0,b.length)===b}),endsWith:d(function(a,b){return a.length>=b.length&&a.substring(a.length-b.length)===b}),succ:d(function(a){var b=a.split("");b.splice(a.length-1,1,String.fromCharCode(a.charCodeAt(a.length-1)+1));return b.join("")}),titleize:d(function(a){for(var a=a.split(" "),b,c=0;cb?a.slice(0,b)+(c||"..."):a}),prune:d(function(a,b,c){var c=c||"...",b=b*1||0,d="",d=a.substring(b- +1,b+1).search(/^\w\w$/)===0?e.rtrim(a.slice(0,b).replace(/([\W][\w]*)$/,"")):e.rtrim(a.slice(0,b)),d=d.replace(/\W+$/,"");return d.length+c.length>a.length?a:d+c}),words:function(a,b){return String(a).split(b||" ")},pad:d(function(a,b,c,e){var d="",d=0,b=b*1||0;c?c.length>1&&(c=c.charAt(0)):c=" ";switch(e){case "right":d=b-a.length;d=l(c,d);a+=d;break;case "both":d=b-a.length;d={left:l(c,Math.ceil(d/2)),right:l(c,Math.floor(d/2))};a=d.left+a+d.right;break;default:d=b-a.length,d=l(c,d),a=d+a}return a}), +lpad:function(a,b,c){return e.pad(a,b,c)},rpad:function(a,b,c){return e.pad(a,b,c,"right")},lrpad:function(a,b,c){return e.pad(a,b,c,"both")},sprintf:m,vsprintf:function(a,b){b.unshift(a);return m.apply(null,b)},toNumber:function(a,b){var c;c=(a*1||0).toFixed(b*1||0)*1||0;return!(c===0&&a!=="0"&&a!==0)?c:Number.NaN},strRight:d(function(a,b){var c=!b?-1:a.indexOf(b);return c!=-1?a.slice(c+b.length,a.length):a}),strRightBack:d(function(a,b){var c=!b?-1:a.lastIndexOf(b);return c!=-1?a.slice(c+b.length, +a.length):a}),strLeft:d(function(a,b){var c=!b?-1:a.indexOf(b);return c!=-1?a.slice(0,c):a}),strLeftBack:d(function(a,b){var c=a.lastIndexOf(b);return c!=-1?a.slice(0,c):a}),exports:function(){var a={},b;for(b in this)if(this.hasOwnProperty(b)&&!(b=="include"||b=="contains"||b=="reverse"))a[b]=this[b];return a}};e.strip=e.trim;e.lstrip=e.ltrim;e.rstrip=e.rtrim;e.center=e.lrpad;e.ljust=e.lpad;e.rjust=e.rpad;e.contains=e.include;if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)module.exports= +e;exports._s=e}else typeof k._!=="undefined"?(k._.string=e,k._.str=k._.string):k._={string:e,str:e}})(this||window); diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/lib/underscore.string.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/lib/underscore.string.js new file mode 100644 index 0000000..221cf48 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/lib/underscore.string.js @@ -0,0 +1,480 @@ +// Underscore.string +// (c) 2010 Esa-Matti Suuronen +// Underscore.strings is freely distributable under the terms of the MIT license. +// Documentation: https://github.com/epeli/underscore.string +// Some code is borrowed from MooTools and Alexandru Marasteanu. + +// Version 2.0.0 + +(function(root){ + 'use strict'; + + // Defining helper functions. + + var nativeTrim = String.prototype.trim; + + var parseNumber = function(source) { return source * 1 || 0; }; + + var strRepeat = function(i, m) { + for (var o = []; m > 0; o[--m] = i) {} + return o.join(''); + }; + + var slice = function(a){ + return Array.prototype.slice.call(a); + }; + + var defaultToWhiteSpace = function(characters){ + if (characters) { + return _s.escapeRegExp(characters); + } + return '\\s'; + }; + + var sArgs = function(method){ + return function(){ + var args = slice(arguments); + for(var i=0; i + // All rights reserved. + + var sprintf = (function() { + function get_type(variable) { + return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase(); + } + + var str_repeat = strRepeat; + + var str_format = function() { + if (!str_format.cache.hasOwnProperty(arguments[0])) { + str_format.cache[arguments[0]] = str_format.parse(arguments[0]); + } + return str_format.format.call(null, str_format.cache[arguments[0]], arguments); + }; + + str_format.format = function(parse_tree, argv) { + var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length; + for (i = 0; i < tree_length; i++) { + node_type = get_type(parse_tree[i]); + if (node_type === 'string') { + output.push(parse_tree[i]); + } + else if (node_type === 'array') { + match = parse_tree[i]; // convenience purposes only + if (match[2]) { // keyword argument + arg = argv[cursor]; + for (k = 0; k < match[2].length; k++) { + if (!arg.hasOwnProperty(match[2][k])) { + throw(sprintf('[_.sprintf] property "%s" does not exist', match[2][k])); + } + arg = arg[match[2][k]]; + } + } else if (match[1]) { // positional argument (explicit) + arg = argv[match[1]]; + } + else { // positional argument (implicit) + arg = argv[cursor++]; + } + + if (/[^s]/.test(match[8]) && (get_type(arg) != 'number')) { + throw(sprintf('[_.sprintf] expecting number but found %s', get_type(arg))); + } + switch (match[8]) { + case 'b': arg = arg.toString(2); break; + case 'c': arg = String.fromCharCode(arg); break; + case 'd': arg = parseInt(arg, 10); break; + case 'e': arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential(); break; + case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg); break; + case 'o': arg = arg.toString(8); break; + case 's': arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg); break; + case 'u': arg = Math.abs(arg); break; + case 'x': arg = arg.toString(16); break; + case 'X': arg = arg.toString(16).toUpperCase(); break; + } + arg = (/[def]/.test(match[8]) && match[3] && arg >= 0 ? '+'+ arg : arg); + pad_character = match[4] ? match[4] == '0' ? '0' : match[4].charAt(1) : ' '; + pad_length = match[6] - String(arg).length; + pad = match[6] ? str_repeat(pad_character, pad_length) : ''; + output.push(match[5] ? arg + pad : pad + arg); + } + } + return output.join(''); + }; + + str_format.cache = {}; + + str_format.parse = function(fmt) { + var _fmt = fmt, match = [], parse_tree = [], arg_names = 0; + while (_fmt) { + if ((match = /^[^\x25]+/.exec(_fmt)) !== null) { + parse_tree.push(match[0]); + } + else if ((match = /^\x25{2}/.exec(_fmt)) !== null) { + parse_tree.push('%'); + } + else if ((match = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt)) !== null) { + if (match[2]) { + arg_names |= 1; + var field_list = [], replacement_field = match[2], field_match = []; + if ((field_match = /^([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) { + field_list.push(field_match[1]); + while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') { + if ((field_match = /^\.([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) { + field_list.push(field_match[1]); + } + else if ((field_match = /^\[(\d+)\]/.exec(replacement_field)) !== null) { + field_list.push(field_match[1]); + } + else { + throw('[_.sprintf] huh?'); + } + } + } + else { + throw('[_.sprintf] huh?'); + } + match[2] = field_list; + } + else { + arg_names |= 2; + } + if (arg_names === 3) { + throw('[_.sprintf] mixing positional and named placeholders is not (yet) supported'); + } + parse_tree.push(match); + } + else { + throw('[_.sprintf] huh?'); + } + _fmt = _fmt.substring(match[0].length); + } + return parse_tree; + }; + + return str_format; + })(); + + + + // Defining underscore.string + + var _s = { + + VERSION: '2.0.0', + + isBlank: sArgs(function(str){ + return (/^\s*$/).test(str); + }), + + stripTags: sArgs(function(str){ + return str.replace(/<\/?[^>]+>/ig, ''); + }), + + capitalize : sArgs(function(str) { + return str.charAt(0).toUpperCase() + str.substring(1).toLowerCase(); + }), + + chop: sArgs(function(str, step){ + step = parseNumber(step) || str.length; + var arr = []; + for (var i = 0; i < str.length;) { + arr.push(str.slice(i,i + step)); + i = i + step; + } + return arr; + }), + + clean: sArgs(function(str){ + return _s.strip(str.replace(/\s+/g, ' ')); + }), + + count: sArgs(function(str, substr){ + var count = 0, index; + for (var i=0; i < str.length;) { + index = str.indexOf(substr, i); + index >= 0 && count++; + i = i + (index >= 0 ? index : 0) + substr.length; + } + return count; + }), + + chars: sArgs(function(str) { + return str.split(''); + }), + + escapeHTML: sArgs(function(str) { + return str.replace(/&/g,'&').replace(//g,'>') + .replace(/"/g, '"').replace(/'/g, "'"); + }), + + unescapeHTML: sArgs(function(str) { + return str.replace(/</g, '<').replace(/>/g, '>') + .replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, '&'); + }), + + escapeRegExp: sArgs(function(str){ + // From MooTools core 1.2.4 + return str.replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1'); + }), + + insert: sArgs(function(str, i, substr){ + var arr = str.split(''); + arr.splice(parseNumber(i), 0, substr); + return arr.join(''); + }), + + include: sArgs(function(str, needle){ + return str.indexOf(needle) !== -1; + }), + + join: sArgs(function(sep) { + var args = slice(arguments); + return args.join(args.shift()); + }), + + lines: sArgs(function(str) { + return str.split("\n"); + }), + + reverse: sArgs(function(str){ + return Array.prototype.reverse.apply(String(str).split('')).join(''); + }), + + splice: sArgs(function(str, i, howmany, substr){ + var arr = str.split(''); + arr.splice(parseNumber(i), parseNumber(howmany), substr); + return arr.join(''); + }), + + startsWith: sArgs(function(str, starts){ + return str.length >= starts.length && str.substring(0, starts.length) === starts; + }), + + endsWith: sArgs(function(str, ends){ + return str.length >= ends.length && str.substring(str.length - ends.length) === ends; + }), + + succ: sArgs(function(str){ + var arr = str.split(''); + arr.splice(str.length-1, 1, String.fromCharCode(str.charCodeAt(str.length-1) + 1)); + return arr.join(''); + }), + + titleize: sArgs(function(str){ + var arr = str.split(' '), + word; + for (var i=0; i < arr.length; i++) { + word = arr[i].split(''); + if(typeof word[0] !== 'undefined') word[0] = word[0].toUpperCase(); + i+1 === arr.length ? arr[i] = word.join('') : arr[i] = word.join('') + ' '; + } + return arr.join(''); + }), + + camelize: sArgs(function(str){ + return _s.trim(str).replace(/(\-|_|\s)+(.)?/g, function(match, separator, chr) { + return chr ? chr.toUpperCase() : ''; + }); + }), + + underscored: function(str){ + return _s.trim(str).replace(/([a-z\d])([A-Z]+)/g, '$1_$2').replace(/\-|\s+/g, '_').toLowerCase(); + }, + + dasherize: function(str){ + return _s.trim(str).replace(/([a-z\d])([A-Z]+)/g, '$1-$2').replace(/^([A-Z]+)/, '-$1').replace(/\_|\s+/g, '-').toLowerCase(); + }, + + humanize: function(str){ + return _s.capitalize(this.underscored(str).replace(/_id$/,'').replace(/_/g, ' ')); + }, + + trim: sArgs(function(str, characters){ + if (!characters && nativeTrim) { + return nativeTrim.call(str); + } + characters = defaultToWhiteSpace(characters); + return str.replace(new RegExp('\^[' + characters + ']+|[' + characters + ']+$', 'g'), ''); + }), + + ltrim: sArgs(function(str, characters){ + characters = defaultToWhiteSpace(characters); + return str.replace(new RegExp('\^[' + characters + ']+', 'g'), ''); + }), + + rtrim: sArgs(function(str, characters){ + characters = defaultToWhiteSpace(characters); + return str.replace(new RegExp('[' + characters + ']+$', 'g'), ''); + }), + + truncate: sArgs(function(str, length, truncateStr){ + truncateStr = truncateStr || '...'; + length = parseNumber(length); + return str.length > length ? str.slice(0,length) + truncateStr : str; + }), + + /** + * _s.prune: a more elegant version of truncate + * prune extra chars, never leaving a half-chopped word. + * @author github.com/sergiokas + */ + prune: sArgs(function(str, length, pruneStr){ + // Function to check word/digit chars including non-ASCII encodings. + var isWordChar = function(c) { return ((c.toUpperCase() != c.toLowerCase()) || /[-_\d]/.test(c)); } + + var template = ''; + var pruned = ''; + var i = 0; + + // Set default values + pruneStr = pruneStr || '...'; + length = parseNumber(length); + + // Convert to an ASCII string to avoid problems with unicode chars. + for (i in str) { + template += (isWordChar(str[i]))?'A':' '; + } + + // Check if we're in the middle of a word + if( template.substring(length-1, length+1).search(/^\w\w$/) === 0 ) + pruned = _s.rtrim(template.slice(0,length).replace(/([\W][\w]*)$/,'')); + else + pruned = _s.rtrim(template.slice(0,length)); + + pruned = pruned.replace(/\W+$/,''); + + return (pruned.length+pruneStr.length>str.length) ? str : str.substring(0, pruned.length)+pruneStr; + }), + + words: function(str, delimiter) { + return String(str).split(delimiter || " "); + }, + + pad: sArgs(function(str, length, padStr, type) { + var padding = '', + padlen = 0; + + length = parseNumber(length); + + if (!padStr) { padStr = ' '; } + else if (padStr.length > 1) { padStr = padStr.charAt(0); } + switch(type) { + case 'right': + padlen = (length - str.length); + padding = strRepeat(padStr, padlen); + str = str+padding; + break; + case 'both': + padlen = (length - str.length); + padding = { + 'left' : strRepeat(padStr, Math.ceil(padlen/2)), + 'right': strRepeat(padStr, Math.floor(padlen/2)) + }; + str = padding.left+str+padding.right; + break; + default: // 'left' + padlen = (length - str.length); + padding = strRepeat(padStr, padlen);; + str = padding+str; + } + return str; + }), + + lpad: function(str, length, padStr) { + return _s.pad(str, length, padStr); + }, + + rpad: function(str, length, padStr) { + return _s.pad(str, length, padStr, 'right'); + }, + + lrpad: function(str, length, padStr) { + return _s.pad(str, length, padStr, 'both'); + }, + + sprintf: sprintf, + + vsprintf: function(fmt, argv){ + argv.unshift(fmt); + return sprintf.apply(null, argv); + }, + + toNumber: function(str, decimals) { + var num = parseNumber(parseNumber(str).toFixed(parseNumber(decimals))); + return (!(num === 0 && (str !== "0" && str !== 0))) ? num : Number.NaN; + }, + + strRight: sArgs(function(sourceStr, sep){ + var pos = (!sep) ? -1 : sourceStr.indexOf(sep); + return (pos != -1) ? sourceStr.slice(pos+sep.length, sourceStr.length) : sourceStr; + }), + + strRightBack: sArgs(function(sourceStr, sep){ + var pos = (!sep) ? -1 : sourceStr.lastIndexOf(sep); + return (pos != -1) ? sourceStr.slice(pos+sep.length, sourceStr.length) : sourceStr; + }), + + strLeft: sArgs(function(sourceStr, sep){ + var pos = (!sep) ? -1 : sourceStr.indexOf(sep); + return (pos != -1) ? sourceStr.slice(0, pos) : sourceStr; + }), + + strLeftBack: sArgs(function(sourceStr, sep){ + var pos = sourceStr.lastIndexOf(sep); + return (pos != -1) ? sourceStr.slice(0, pos) : sourceStr; + }), + + exports: function() { + var result = {}; + + for (var prop in this) { + if (!this.hasOwnProperty(prop) || prop == 'include' || prop == 'contains' || prop == 'reverse') continue; + result[prop] = this[prop]; + } + + return result; + } + + }; + + // Aliases + + _s.strip = _s.trim; + _s.lstrip = _s.ltrim; + _s.rstrip = _s.rtrim; + _s.center = _s.lrpad; + _s.ljust = _s.lpad; + _s.rjust = _s.rpad; + _s.contains = _s.include; + + // CommonJS module is defined + if (typeof exports !== 'undefined') { + if (typeof module !== 'undefined' && module.exports) { + // Export module + module.exports = _s; + } + exports._s = _s; + + // Integrate with Underscore.js + } else if (typeof root._ !== 'undefined') { + // root._.mixin(_s); + root._.string = _s; + root._.str = root._.string; + + // Or define it + } else { + root._ = { + string: _s, + str: _s + }; + } + +}(this || window)); diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/package.json b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/package.json new file mode 100644 index 0000000..6412858 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/package.json @@ -0,0 +1,72 @@ +{ + "name": "underscore.string", + "version": "2.0.0", + "description": "String manipulation extensions for Underscore.js javascript library.", + "homepage": "http://epeli.github.com/underscore.string/", + "contributors": [ + { + "name": "Esa-Matti Suuronen", + "email": "esa-matti@suuronen.org", + "url": "http://esa-matti.suuronen.org/" + }, + { + "name": "Edward Tsech", + "email": "edtsech@gmail.com" + }, + { + "name": "Sasha Koss", + "email": "kossnocorp@gmail.com", + "url": "http://koss.nocorp.me/" + }, + { + "name": "Vladimir Dronnikov", + "email": "dronnikov@gmail.com" + }, + { + "name": "Pete Kruckenberg", + "email": "https://github.com/kruckenb", + "url": "" + }, + { + "name": "Paul Chavard", + "email": "paul@chavard.net", + "url": "" + }, + { + "name": "Ed Finkler", + "email": "coj@funkatron.com", + "url": "" + }, + { + "name": "Pavel Pravosud", + "email": "rwz@duckroll.ru" + } + ], + "keywords": [ + "underscore", + "string" + ], + "main": "./lib/underscore.string", + "directories": { + "lib": "./lib" + }, + "engines": { + "node": "*" + }, + "dependencies": {}, + "repository": { + "type": "git", + "url": "https://github.com/epeli/underscore.string.git" + }, + "bugs": { + "url": "https://github.com/epeli/underscore.string/issues" + }, + "licenses": [ + { + "type": "MIT" + } + ], + "readme": "# Underscore.string #\n\nJavascript lacks complete string manipulation operations.\nThis an attempt to fill that gap. List of build-in methods can be found\nfor example from [Dive Into JavaScript][d].\n\n[d]: http://www.diveintojavascript.com/core-javascript-reference/the-string-object\n\n\nAs name states this an extension for [Underscore.js][u], but it can be used\nindependently from **_s**-global variable. But with Underscore.js you can\nuse Object-Oriented style and chaining:\n\n[u]: http://documentcloud.github.com/underscore/\n\n _(\" epeli \").chain().trim().capitalize().value()\n => \"Epeli\"\n\n## Node.js installation ##\n\n**npm package**\n\n npm install underscore.string\n\n**Standalone usage**:\n\n var _s = require('underscore.string');\n\n**Integrate with Underscore.js**:\n\n var _ = require('underscore');\n\n // Import Underscore.string to separate object, because there are conflict functions (include, reverse, contains)\n _.str = require('underscore.string');\n\n // Mix in non-conflict functions to Underscore namespace if you want\n _.mixin(_.str.exports());\n\n // All functions, include conflict, will be available through _.str object\n _.str.include('Underscore.string', 'string'); // => true\n\n## String Functions ##\n\nFor availability of functions in this way you need to mix in Underscore.string functions:\n\n _.mixin(_.string.exports());\n\notherwise functions from examples will be available through _.string or _.str objects:\n\n _.str.capitalize('epeli')\n => \"Epeli\"\n\n**capitalize** _.capitalize(string)\n\nConverts first letter of the string to uppercase.\n\n _.capitalize(\"epeli\")\n => \"Epeli\"\n\n**chop** _.chop(string, step)\n\n _.chop('whitespace', 3)\n => ['whi','tes','pac','e']\n\n**clean** _.clean(str)\n\nCompress some whitespaces to one.\n\n _.clean(\" foo bar \")\n => 'foo bar'\n\n**chars** _.chars(str)\n\n _.chars('Hello')\n => ['H','e','l','l','o']\n\n**includes** _.includes(string, substring)\n\nTests if string contains a substring.\n\n _.includes(\"foobar\", \"ob\")\n => true\n\n**include** available only through _.str object, because Underscore has function with the same name.\n\n _.str.include(\"foobar\", \"ob\")\n => true\n\n**includes** function was removed\n\nBut you can create it in this way, for compatibility with previous versions:\n\n _.includes = _.str.include\n\n**count** _.count(string, substring)\n\n _('Hello world').count('l')\n => 3\n\n**escapeHTML** _.escapeHTML(string)\n\nConverts HTML special characters to their entity equivalents.\n\n _('
Blah blah blah
').escapeHTML();\n => '<div>Blah blah blah</div>'\n\n**unescapeHTML** _.unescapeHTML(string)\n\nConverts entity characters to HTML equivalents.\n\n _('<div>Blah blah blah</div>').unescapeHTML();\n => '
Blah blah blah
'\n\n**insert** _.insert(string, index, substing)\n\n _('Hello ').insert(6, 'world')\n => 'Hello world'\n\n**isBlank** _.isBlank(string)\n\n _('').isBlank(); // => true\n _('\\n').isBlank(); // => true\n _(' ').isBlank(); // => true\n _('a').isBlank(); // => false\n\n**join** _.join(separator, *strings)\n\nJoins strings together with given separator\n\n _.join(\" \", \"foo\", \"bar\")\n => \"foo bar\"\n\n**lines** _.lines(str)\n\n _.lines(\"Hello\\nWorld\")\n => [\"Hello\", \"World\"]\n\n**reverse** available only through _.str object, because Underscore has function with the same name.\n\nReturn reversed string:\n\n _.str.reverse(\"foobar\")\n => 'raboof'\n\n**splice** _.splice(string, index, howmany, substring)\n\nLike a array splice.\n\n _('https://edtsech@bitbucket.org/edtsech/underscore.strings').splice(30, 7, 'epeli')\n => 'https://edtsech@bitbucket.org/epeli/underscore.strings'\n\n**startsWith** _.startsWith(string, starts)\n\nThis method checks whether string starts with starts.\n\n _(\"image.gif\").startsWith(\"image\")\n => true\n\n**endsWith** _.endsWith(string, ends)\n\nThis method checks whether string ends with ends.\n\n _(\"image.gif\").endsWith(\"gif\")\n => true\n\n**succ** _.succ(str)\n\nReturns the successor to str.\n\n _('a').succ()\n => 'b'\n\n _('A').succ()\n => 'B'\n\n**supplant**\n\nSupplant function was removed, use Underscore.js [template function][p].\n\n[p]: http://documentcloud.github.com/underscore/#template\n\n**strip** alias for *trim*\n\n**lstrip** alias for *ltrim*\n\n**rstrip** alias for *rtrim*\n\n**titleize** _.titleize(string)\n\n _('my name is epeli').titleize()\n => 'My Name Is Epeli'\n\n**camelize** _.camelize(string)\n\nConverts underscored or dasherized string to a camelized one\n\n _('-moz-transform').camelize()\n => 'MozTransform'\n\n**underscored** _.underscored(string)\n\nConverts a camelized or dasherized string into an underscored one\n\n _(MozTransform).underscored()\n => 'moz_transform'\n\n**dasherize** _.dasherize(string)\n\nConverts a underscored or camelized string into an dasherized one\n\n _('MozTransform').dasherize()\n => '-moz-transform'\n\n**humanize** _.humanize(string)\n\nConverts an underscored, camelized, or dasherized string into a humanized one.\nAlso removes beginning and ending whitespace, and removes the postfix '_id'.\n\n _(' capitalize dash-CamelCase_underscore trim ').humanize()\n => 'Capitalize dash camel case underscore trim'\n\n**trim** _.trim(string, [characters])\n\ntrims defined characters from begining and ending of the string.\nDefaults to whitespace characters.\n\n _.trim(\" foobar \")\n => \"foobar\"\n\n _.trim(\"_-foobar-_\", \"_-\")\n => \"foobar\"\n\n\n**ltrim** _.ltrim(string, [characters])\n\nLeft trim. Similar to trim, but only for left side.\n\n\n**rtrim** _.rtrim(string, [characters])\n\nRight trim. Similar to trim, but only for right side.\n\n**truncate** _.truncate(string, length, truncateString)\n\n _('Hello world').truncate(5)\n => 'Hello...'\n\n _('Hello').truncate(10)\n => 'Hello'\n\n**prune** _.prune(string, length, pruneString)\n\nElegant version of truncate.\nMakes sure the pruned string does not exceed the original length.\nAvoid half-chopped words when truncating.\n\n _('Hello, world').prune(5)\n => 'Hello...'\n\n _('Hello, world').prune(8)\n => 'Hello...'\n\n _('Hello, world').prune(5, ' (read a lot more)')\n => 'Hello, world' (as adding \"(read a lot more)\" would be longer than the original string)\n\n _('Hello, cruel world').prune(15)\n => 'Hello, cruel...'\n\n _('Hello').prune(10)\n => 'Hello'\n\n**words** _.words(str, delimiter=\" \")\n\nSplit string by delimiter (String or RegExp), ' ' by default.\n\n _.words(\"I love you\")\n => [\"I\",\"love\",\"you\"]\n\n _.words(\"I_love_you\", \"_\")\n => [\"I\",\"love\",\"you\"]\n\n _.words(\"I-love-you\", /-/)\n => [\"I\",\"love\",\"you\"]\n\n**sprintf** _.sprintf(string format, *arguments)\n\nC like string formatting.\nCredits goes to [Alexandru Marasteanu][o].\nFor more detailed documentation, see the [original page][o].\n\n[o]: http://www.diveintojavascript.com/projects/sprintf-for-javascript\n\n _.sprintf(\"%.1f\", 1.17)\n \"1.2\"\n\n**pad** _.pad(str, length, [padStr, type])\n\npads the `str` with characters until the total string length is equal to the passed `length` parameter. By default, pads on the **left** with the space char (`\" \"`). `padStr` is truncated to a single character if necessary.\n\n _.pad(\"1\", 8)\n -> \" 1\";\n\n _.pad(\"1\", 8, '0')\n -> \"00000001\";\n\n _.pad(\"1\", 8, '0', 'right')\n -> \"10000000\";\n\n _.pad(\"1\", 8, '0', 'both')\n -> \"00001000\";\n\n _.pad(\"1\", 8, 'bleepblorp', 'both')\n -> \"bbbb1bbb\";\n\n**lpad** _.lpad(str, length, [padStr])\n\nleft-pad a string. Alias for `pad(str, length, padStr, 'left')`\n\n _.lpad(\"1\", 8, '0')\n -> \"00000001\";\n\n**rpad** _.rpad(str, length, [padStr])\n\nright-pad a string. Alias for `pad(str, length, padStr, 'right')`\n\n _.rpad(\"1\", 8, '0')\n -> \"10000000\";\n\n**lrpad** _.lrpad(str, length, [padStr])\n\nleft/right-pad a string. Alias for `pad(str, length, padStr, 'both')`\n\n _.lrpad(\"1\", 8, '0')\n -> \"00001000\";\n\n**center** alias for **lrpad**\n\n**ljust** alias for *lpad*\n\n**rjust** alias for *rpad*\n\n**toNumber** _.toNumber(string, [decimals])\n\nParse string to number. Returns NaN if string can't be parsed to number.\n\n _('2.556').toNumber()\n => 3\n\n _('2.556').toNumber(1)\n => 2.6\n\n**strRight** _.strRight(string, pattern)\n\nSearches a string from left to right for a pattern and returns a substring consisting of the characters in the string that are to the right of the pattern or all string if no match found.\n\n _('This_is_a_test_string').strRight('_')\n => \"is_a_test_string\";\n\n**strRightBack** _.strRightBack(string, pattern)\n\nSearches a string from right to left for a pattern and returns a substring consisting of the characters in the string that are to the right of the pattern or all string if no match found.\n\n _('This_is_a_test_string').strRightBack('_')\n => \"string\";\n\n**strLeft** _.strLeft(string, pattern)\n\nSearches a string from left to right for a pattern and returns a substring consisting of the characters in the string that are to the left of the pattern or all string if no match found.\n\n _('This_is_a_test_string').strLeft('_')\n => \"This\";\n\n**strLeftBack** _.strLeftBack(string, pattern)\n\nSearches a string from right to left for a pattern and returns a substring consisting of the characters in the string that are to the left of the pattern or all string if no match found.\n\n _('This_is_a_test_string').strLeftBack('_')\n => \"This_is_a_test\";\n\n**stripTags**\n\nRemoves all html tags from string.\n\n _('a link').stripTags()\n => 'a link'\n _('a link').stripTags()\n => 'a linkalert(\"hello world!\")'\n\n\n## Roadmap ##\n\nAny suggestions or bug reports are welcome. Just email me or more preferably open an issue.\n\n## Changelog ##\n\n### 2.0.0 ###\n\n* Added prune, humanize functions\n* Added _.string (_.str) namespace for Underscore.string library\n* Removed includes function\n\n#### Problems\n\nWe lose two things for `include` and `reverse` methods from `_.string`:\n\n* Calls like `_('foobar').include('bar')` aren't available;\n* Chaining isn't available too.\n\nBut if you need this functionality you can create aliases for conflict functions which will be convenient for you:\n\n _.mixin({\n includeString: _.str.include,\n reverseString: _.str.reverse\n })\n\n // Now wrapper calls and chaining are available.\n _('foobar').chain().reverseString().includeString('rab').value()\n\n#### Standalone Usage\n\nIf you are using Underscore.string without Underscore. You also have `_.string` namespace for it and `_.str` alias\nBut of course you can just reassign `_` variable with `_.string`\n\n _ = _.string\n\n#### Upgrade\n\nFor upgrading to this version you need to mix in Underscore.string library to Underscore object:\n\n _.mixin(_.string.exports());\n\nand all non-conflict Underscore.string functions will be available through Underscore object.\nAlso function `includes` has been removed, you should replace this function by `_.str.include`\nor create alias `_.includes = _.str.include` and all your code will work fine.\n\n### 1.1.6 ###\n\n* Fixed reverse and truncate\n* Added isBlank, stripTags, inlude(alias for includes)\n* Added uglifier compression\n\n### 1.1.5 ###\n\n* Added strRight, strRightBack, strLeft, strLeftBack\n\n### 1.1.4 ###\n\n* Added pad, lpad, rpad, lrpad methods and aliases center, ljust, rjust\n* Integration with Underscore 1.1.6\n\n### 1.1.3 ###\n\n* Added methods: underscored, camelize, dasherize\n* Support newer version of npm\n\n### 1.1.2 ###\n\n* Created functions: lines, chars, words functions\n\n### 1.0.2 ###\n\n* Created integration test suite with underscore.js 1.1.4 (now it's absolutely compatible)\n* Removed 'reverse' function, because this function override underscore.js 'reverse'\n\n## Contribute ##\n\n* Fork & pull request. Don't forget about tests.\n* If you planning add some feature please create issue before.\n\nOtherwise changes will be rejected.\n\n## Contributors list ##\n\n* Esa-Matti Suuronen (),\n* Edward Tsech ,\n* Sasha Koss (),\n* Vladimir Dronnikov ,\n* Pete Kruckenberg (),\n* Paul Chavard (),\n* Ed Finkler ()\n* Pavel Pravosud \n\n## Licence ##\n\nThe MIT License\n\nCopyright (c) 2011 Esa-Matti Suuronen esa-matti@suuronen.org\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n", + "_id": "underscore.string@2.0.0", + "_from": "underscore.string@2.0.x" +} diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/speed.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/speed.js new file mode 100644 index 0000000..af74ef0 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/speed.js @@ -0,0 +1,134 @@ +(function() { + + JSLitmus.test('trimNoNative', function() { + return _.trim(" foobar ", " "); + }); + + JSLitmus.test('trim', function() { + return _.trim(" foobar "); + }); + + JSLitmus.test('trim object-oriented', function() { + return _(" foobar ").trim(); + }); + + JSLitmus.test('trim jQuery', function() { + return jQuery.trim(" foobar "); + }); + + JSLitmus.test('ltrimp', function() { + return _.ltrim(" foobar ", " "); + }); + + JSLitmus.test('rtrimp', function() { + return _.rtrim(" foobar ", " "); + }); + + JSLitmus.test('startsWith', function() { + return _.startsWith("foobar", "foo"); + }); + + JSLitmus.test('endsWith', function() { + return _.endsWith("foobar", "xx"); + }); + + JSLitmus.test('chop', function(){ + return _('whitespace').chop(2); + }); + + JSLitmus.test('count', function(){ + return _('Hello worls').count('l'); + }); + + JSLitmus.test('insert', function() { + return _('Hello ').insert(6, 'world'); + }); + + JSLitmus.test('splice', function() { + return _('https://edtsech@bitbucket.org/edtsech/underscore.strings').splice(30, 7, 'epeli'); + }); + + JSLitmus.test('succ', function(){ + var let = 'a', alphabet = []; + + for (var i=0; i < 26; i++) { + alphabet.push(let); + let = _(let).succ(); + } + + return alphabet; + }); + + JSLitmus.test('titleize', function(){ + return _('the titleize string method').titleize(); + }); + + JSLitmus.test('truncate', function(){ + return _('Hello world').truncate(5); + }); + + JSLitmus.test('prune', function(){ + return _('Hello world').prune(5); + }); + + JSLitmus.test('isBlank', function(){ + return _('').isBlank(); + }); + + JSLitmus.test('escapeHTML', function(){ + _('
Blah blah blah
').escapeHTML(); + }); + + JSLitmus.test('unescapeHTML', function(){ + _('<div>Blah blah blah</div>').unescapeHTML(); + }); + + JSLitmus.test('reverse', function(){ + _('Hello World').reverse(); + }); + + JSLitmus.test('pad default', function(){ + _('foo').pad(12); + }); + + JSLitmus.test('pad hash left', function(){ + _('foo').pad(12, '#'); + }); + + JSLitmus.test('pad hash right', function(){ + _('foo').pad(12, '#', 'right'); + }); + + JSLitmus.test('pad hash both', function(){ + _('foo').pad(12, '#', 'both'); + }); + + JSLitmus.test('pad hash both longPad', function(){ + _('foo').pad(12, 'f00f00f00', 'both'); + }); + + JSLitmus.test('toNumber', function(){ + _('10.232323').toNumber(2); + }); + + JSLitmus.test('strRight', function(){ + _('aaa_bbb_ccc').strRight('_'); + }); + + JSLitmus.test('strRightBack', function(){ + _('aaa_bbb_ccc').strRightBack('_'); + }); + + JSLitmus.test('strLeft', function(){ + _('aaa_bbb_ccc').strLeft('_'); + }); + + JSLitmus.test('strLeftBack', function(){ + _('aaa_bbb_ccc').strLeftBack('_'); + }); + + JSLitmus.test('join', function(){ + _('separator').join(1, 2, 3, 4, 5, 6, 7, 8, 'foo', 'bar', 'lol', 'wut'); + }); + +})(); diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/strings.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/strings.js new file mode 100644 index 0000000..ca609c1 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/strings.js @@ -0,0 +1,358 @@ +$(document).ready(function() { + + // Include Underscore.string methods to Underscore namespace + _.mixin(_.str.exports()); + + module("String extensions"); + + test("Strings: trim", function() { + equals(_.trim(123), "123", "Non string"); + equals(_(" foo").trim(), "foo"); + equals(_("foo ").trim(), "foo"); + equals(_(" foo ").trim(), "foo"); + equals(_(" foo ").trim(), "foo"); + equals(_(" foo ", " ").trim(), "foo", "Manually set whitespace"); + + equals(_("ffoo").trim("f"), "oo"); + equals(_("ooff").trim("f"), "oo"); + equals(_("ffooff").trim("f"), "oo"); + + + equals(_("_-foobar-_").trim("_-"), "foobar"); + + equals(_("http://foo/").trim("/"), "http://foo"); + equals(_("c:\\").trim('\\'), "c:"); + }); + + test("Strings: ltrim", function() { + equals(_(" foo").ltrim(), "foo"); + equals(_(" foo").ltrim(), "foo"); + equals(_("foo ").ltrim(), "foo "); + equals(_(" foo ").ltrim(), "foo "); + + + equals(_("ffoo").ltrim("f"), "oo"); + equals(_("ooff").ltrim("f"), "ooff"); + equals(_("ffooff").ltrim("f"), "ooff"); + + equals(_("_-foobar-_").ltrim("_-"), "foobar-_"); + }); + + test("Strings: rtrim", function() { + equals(_("http://foo/").rtrim("/"), "http://foo", 'clean trailing slash'); + equals(_(" foo").rtrim(), " foo"); + equals(_("foo ").rtrim(), "foo"); + equals(_("foo ").rtrim(), "foo"); + equals(_("foo bar ").rtrim(), "foo bar"); + equals(_(" foo ").rtrim(), " foo"); + + equals(_("ffoo").rtrim("f"), "ffoo"); + equals(_("ooff").rtrim("f"), "oo"); + equals(_("ffooff").rtrim("f"), "ffoo"); + + equals(_("_-foobar-_").rtrim("_-"), "_-foobar"); + }); + + test("Strings: capitalize", function() { + equals(_("fabio").capitalize(), "Fabio", 'First letter is upper case'); + equals(_.capitalize("fabio"), "Fabio", 'First letter is upper case'); + equals(_(123).capitalize(), "123", "Non string"); + }); + + test("Strings: join", function() { + equals(_.join("", "foo", "bar"), "foobar", 'basic join'); + equals(_.join("", 1, "foo", 2), "1foo2", 'join numbers and strings'); + equals(_.join(" ","foo", "bar"), "foo bar", 'join with spaces'); + equals(_.join("1", "2", "2"), "212", 'join number strings'); + equals(_.join(1, 2, 2), "212", 'join numbers'); + equals(_(" ").join("foo", "bar"), "foo bar", 'join object oriented'); + }); + + test("Strings: reverse", function() { + equals(_.str.reverse("foo"), "oof" ); + equals(_.str.reverse("foobar"), "raboof" ); + equals(_.str.reverse("foo bar"), "rab oof" ); + equals(_.str.reverse("saippuakauppias"), "saippuakauppias" ); + equals(_.str.reverse(123), "321", "Non string"); + equals(_.str.reverse(123.45), "54.321", "Non string"); + }); + + test("Strings: clean", function() { + equals(_(" foo bar ").clean(), "foo bar"); + equals(_(123).clean(), "123"); + }); + + test("Strings: sprintf", function() { + // Should be very tested function already. Thanks to + // http://www.diveintojavascript.com/projects/sprintf-for-javascript + equals(_.sprintf("Hello %s", "me"), "Hello me", 'basic'); + equals(_("Hello %s").sprintf("me"), "Hello me", 'object'); + equals(_("hello %s").chain().sprintf("me").capitalize().value(), "Hello me", 'Chaining works'); + equals(_.sprintf("%.1f", 1.22222), "1.2", 'round'); + equals(_.sprintf("%.1f", 1.17), "1.2", 'round 2'); + equals(_.sprintf("%(id)d - %(name)s", {id: 824, name: "Hello World"}), "824 - Hello World", 'Named replacements work'); + equals(_.sprintf("%(args[0].id)d - %(args[1].name)s", {args: [{id: 824}, {name: "Hello World"}]}), "824 - Hello World", 'Named replacements with arrays work'); + }); + + + test("Strings: vsprintf", function() { + equals(_.vsprintf("Hello %s", ["me"]), "Hello me", 'basic'); + equals(_("Hello %s").vsprintf(["me"]), "Hello me", 'object'); + equals(_("hello %s").chain().vsprintf(["me"]).capitalize().value(), "Hello me", 'Chaining works'); + equals(_.vsprintf("%.1f", [1.22222]), "1.2", 'round'); + equals(_.vsprintf("%.1f", [1.17]), "1.2", 'round 2'); + equals(_.vsprintf("%(id)d - %(name)s", [{id: 824, name: "Hello World"}]), "824 - Hello World", 'Named replacement works'); + equals(_.vsprintf("%(args[0].id)d - %(args[1].name)s", [{args: [{id: 824}, {name: "Hello World"}]}]), "824 - Hello World", 'Named replacement with arrays works'); + }); + + test("Strings: startsWith", function() { + ok(_("foobar").startsWith("foo"), 'foobar starts with foo'); + ok(!_("oobar").startsWith("foo"), 'oobar does not start with foo'); + ok(_(12345).startsWith(123), '12345 starts with 123'); + ok(!_(2345).startsWith(123), '2345 does not start with 123'); + }); + + test("Strings: endsWith", function() { + ok(_("foobar").endsWith("bar"), 'foobar ends with bar'); + ok(_.endsWith("foobar", "bar"), 'foobar ends with bar'); + ok(_.endsWith("00018-0000062.Plone.sdh264.1a7264e6912a91aa4a81b64dc5517df7b8875994.mp4", "mp4"), 'endsWith .mp4'); + ok(!_("fooba").endsWith("bar"), 'fooba does not end with bar'); + ok(_.endsWith(12345, 45), '12345 ends with 45'); + ok(!_.endsWith(12345, 6), '12345 does not end with 6'); + }); + + test("Strings: include", function() { + ok(_.str.include("foobar", "bar"), 'foobar includes bar'); + ok(!_.str.include("foobar", "buzz"), 'foobar does not includes buzz'); + ok(_.str.include(12345, 34), '12345 includes 34'); + ok(!_.str.contains(12345, 6), '12345 does not includes 6'); + }); + + test('String: chop', function(){ + ok(_('whitespace').chop(2).length === 5, "output ['wh','it','es','pa','ce']"); + ok(_('whitespace').chop(3).length === 4, "output ['whi','tes','pac','e']"); + ok(_('whitespace').chop()[0].length === 10, "output ['whitespace']"); + ok(_(12345).chop(1).length === 5, "output ['1','2','3','4','5']"); + }); + + test('String: count', function(){ + equals(_('Hello world').count('l'), 3); + equals(_('Hello world').count('Hello'), 1); + equals(_('Hello world').count('foo'), 0); + equals(_(12345).count(1), 1); + equals(_(11345).count(1), 2); + }); + + test('String: insert', function(){ + equals(_('Hello ').insert(6, 'Jessy'), 'Hello Jessy'); + equals(_('Hello ').insert(100, 'Jessy'), 'Hello Jessy'); + equals(_(12345).insert(6, 'Jessy'), '12345Jessy'); + }); + + test('String: splice', function(){ + equals(_('https://edtsech@bitbucket.org/edtsech/underscore.strings').splice(30, 7, 'epeli'), + 'https://edtsech@bitbucket.org/epeli/underscore.strings'); + equals(_.splice(12345, 1, 2, 321), '132145', 'Non strings'); + }); + + test('String: succ', function(){ + equals(_('a').succ(), 'b'); + equals(_('A').succ(), 'B'); + equals(_('+').succ(), ','); + equals(_(1).succ(), '2'); + }); + + test('String: titleize', function(){ + equals(_('the titleize string method').titleize(), 'The Titleize String Method'); + equals(_('the titleize string method').titleize(), 'The Titleize String Method'); + equals(_(123).titleize(), '123'); + }); + + test('String: camelize', function(){ + equals(_('the_camelize_string_method').camelize(), 'theCamelizeStringMethod'); + equals(_('-the-camelize-string-method').camelize(), 'TheCamelizeStringMethod'); + equals(_('the camelize string method').camelize(), 'theCamelizeStringMethod'); + equals(_(' the camelize string method').camelize(), 'theCamelizeStringMethod'); + equals(_('the camelize string method').camelize(), 'theCamelizeStringMethod'); + equals(_(123).camelize(), '123'); + }); + + test('String: underscored', function(){ + equals(_('the-underscored-string-method').underscored(), 'the_underscored_string_method'); + equals(_('theUnderscoredStringMethod').underscored(), 'the_underscored_string_method'); + equals(_('TheUnderscoredStringMethod').underscored(), 'the_underscored_string_method'); + equals(_(' the underscored string method').underscored(), 'the_underscored_string_method'); + equals(_(123).underscored(), '123'); + }); + + test('String: dasherize', function(){ + equals(_('the_dasherize_string_method').dasherize(), 'the-dasherize-string-method'); + equals(_('TheDasherizeStringMethod').dasherize(), '-the-dasherize-string-method'); + equals(_('the dasherize string method').dasherize(), 'the-dasherize-string-method'); + equals(_('the dasherize string method ').dasherize(), 'the-dasherize-string-method'); + equals(_(123).dasherize(), '123'); + }); + + test('String: humanize', function(){ + equals(_('the_humanize_string_method').humanize(), 'The humanize string method'); + equals(_('ThehumanizeStringMethod').humanize(), 'Thehumanize string method'); + equals(_('the humanize string method').humanize(), 'The humanize string method'); + equals(_('the humanize_id string method_id').humanize(), 'The humanize id string method'); + equals(_('the humanize string method ').humanize(), 'The humanize string method'); + equals(_(' capitalize dash-CamelCase_underscore trim ').humanize(), 'Capitalize dash camel case underscore trim'); + equals(_(123).humanize(), '123'); + }); + + test('String: truncate', function(){ + equals(_('Hello world').truncate(6, 'read more'), 'Hello read more'); + equals(_('Hello world').truncate(5), 'Hello...'); + equals(_('Hello').truncate(10), 'Hello'); + equals(_(1234567890).truncate(5), '12345...'); + }); + + test('String: prune', function(){ + equals(_('Hello, cruel world').prune(6, ' read more'), 'Hello read more'); + equals(_('Hello, world').prune(5, 'read a lot more'), 'Hello, world'); + equals(_('Hello, world').prune(5), 'Hello...'); + equals(_('Hello, world').prune(8), 'Hello...'); + equals(_('Hello, cruel world').prune(15), 'Hello, cruel...'); + equals(_('Hello world').prune(22), 'Hello world'); + }); + + test('String: isBlank', function(){ + ok(_('').isBlank()); + ok(_(' ').isBlank()); + ok(_('\n').isBlank()); + ok(!_('a').isBlank()); + ok(!_('0').isBlank()); + ok(!_(0).isBlank()); + }); + + test('String: escapeHTML', function(){ + equals(_('
Blah & "blah" & \'blah\'
').escapeHTML(), + '<div>Blah & "blah" & 'blah'</div>'); + equals(_('<').escapeHTML(), '&lt;'); + equals(_(5).escapeHTML(), '5'); + equals(_(undefined).escapeHTML(), ''); + }); + + test('String: unescapeHTML', function(){ + equals(_('<div>Blah & "blah" & 'blah'</div>').unescapeHTML(), + '
Blah & "blah" & \'blah\'
'); + equals(_('&lt;').unescapeHTML(), '<'); + equals(_(5).unescapeHTML(), '5'); + equals(_(undefined).unescapeHTML(), ''); + }); + + test('String: words', function() { + equals(_("I love you!").words().length, 3); + equals(_("I_love_you!").words('_').length, 3); + equals(_("I-love-you!").words(/-/).length, 3); + equals(_(123).words().length, 1); + }); + + test('String: chars', function() { + equals(_("Hello").chars().length, 5); + equals(_(123).chars().length, 3); + }); + + test('String: lines', function() { + equals(_("Hello\nWorld").lines().length, 2); + equals(_("Hello World").lines().length, 1); + equals(_(123).lines().length, 1); + }); + + test('String: pad', function() { + equals(_("1").pad(8), ' 1'); + equals(_(1).pad(8), ' 1'); + equals(_("1").pad(8, '0'), '00000001'); + equals(_("1").pad(8, '0', 'left'), '00000001'); + equals(_("1").pad(8, '0', 'right'), '10000000'); + equals(_("1").pad(8, '0', 'both'), '00001000'); + equals(_("foo").pad(8, '0', 'both'), '000foo00'); + equals(_("foo").pad(7, '0', 'both'), '00foo00'); + equals(_("foo").pad(7, '!@$%dofjrofj', 'both'), '!!foo!!'); + }); + + test('String: lpad', function() { + equals(_("1").lpad(8), ' 1'); + equals(_(1).lpad(8), ' 1'); + equals(_("1").lpad(8, '0'), '00000001'); + equals(_("1").lpad(8, '0', 'left'), '00000001'); + }); + + test('String: rpad', function() { + equals(_("1").rpad(8), '1 '); + equals(_(1).lpad(8), ' 1'); + equals(_("1").rpad(8, '0'), '10000000'); + equals(_("foo").rpad(8, '0'), 'foo00000'); + equals(_("foo").rpad(7, '0'), 'foo0000'); + }); + + test('String: lrpad', function() { + equals(_("1").lrpad(8), ' 1 '); + equals(_(1).lrpad(8), ' 1 '); + equals(_("1").lrpad(8, '0'), '00001000'); + equals(_("foo").lrpad(8, '0'), '000foo00'); + equals(_("foo").lrpad(7, '0'), '00foo00'); + equals(_("foo").lrpad(7, '!@$%dofjrofj'), '!!foo!!'); + }); + + test('String: toNumber', function() { + deepEqual(_("not a number").toNumber(), Number.NaN); + equals(_(0).toNumber(), 0); + equals(_("0").toNumber(), 0); + equals(_("2.345").toNumber(), 2); + equals(_("2.345").toNumber(NaN), 2); + equals(_("2.345").toNumber(2), 2.35); + equals(_("2.344").toNumber(2), 2.34); + equals(_("2").toNumber(2), 2.00); + equals(_(2).toNumber(2), 2.00); + equals(_(-2).toNumber(), -2); + equals(_("-2").toNumber(), -2); + }); + + test('String: strRight', function() { + equals(_("This_is_a_test_string").strRight("_"), "is_a_test_string"); + equals(_("This_is_a_test_string").strRight("string"), ""); + equals(_("This_is_a_test_string").strRight(), "This_is_a_test_string"); + equals(_("This_is_a_test_string").strRight(""), "This_is_a_test_string"); + equals(_("This_is_a_test_string").strRight("-"), "This_is_a_test_string"); + equals(_(12345).strRight(2), "345"); + }); + + test('String: strRightBack', function() { + equals(_("This_is_a_test_string").strRightBack("_"), "string"); + equals(_("This_is_a_test_string").strRightBack("string"), ""); + equals(_("This_is_a_test_string").strRightBack(), "This_is_a_test_string"); + equals(_("This_is_a_test_string").strRightBack(""), "This_is_a_test_string"); + equals(_("This_is_a_test_string").strRightBack("-"), "This_is_a_test_string"); + equals(_(12345).strRightBack(2), "345"); + }); + + test('String: strLeft', function() { + equals(_("This_is_a_test_string").strLeft("_"), "This"); + equals(_("This_is_a_test_string").strLeft("This"), ""); + equals(_("This_is_a_test_string").strLeft(), "This_is_a_test_string"); + equals(_("This_is_a_test_string").strLeft(""), "This_is_a_test_string"); + equals(_("This_is_a_test_string").strLeft("-"), "This_is_a_test_string"); + equals(_(123454321).strLeft(3), "12"); + }); + + test('String: strLeftBack', function() { + equals(_("This_is_a_test_string").strLeftBack("_"), "This_is_a_test"); + equals(_("This_is_a_test_string").strLeftBack("This"), ""); + equals(_("This_is_a_test_string").strLeftBack(), "This_is_a_test_string"); + equals(_("This_is_a_test_string").strLeftBack(""), "This_is_a_test_string"); + equals(_("This_is_a_test_string").strLeftBack("-"), "This_is_a_test_string"); + equals(_(123454321).strLeftBack(3), "123454"); + }); + + test('Strings: stripTags', function() { + equals(_('a link').stripTags(), 'a link'); + equals(_('a link + + + + + + + + +

Underscore.string Test Suite

+

+

+
    +
    +

    Underscore.string Speed Suite

    + +
    + + diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_standalone.html b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_standalone.html new file mode 100644 index 0000000..9854c17 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_standalone.html @@ -0,0 +1,18 @@ + + + + Underscore.strings Test Suite + + + + + + + + +

    Underscore.string Test Suite

    +

    +

    +
      + + diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/arrays.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/arrays.js new file mode 100644 index 0000000..c648f08 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/arrays.js @@ -0,0 +1,161 @@ +$(document).ready(function() { + + module("Arrays"); + + test("arrays: first", function() { + equals(_.first([1,2,3]), 1, 'can pull out the first element of an array'); + equals(_([1, 2, 3]).first(), 1, 'can perform OO-style "first()"'); + equals(_.first([1,2,3], 0).join(', '), "", 'can pass an index to first'); + equals(_.first([1,2,3], 2).join(', '), '1, 2', 'can pass an index to first'); + var result = (function(){ return _.first(arguments); })(4, 3, 2, 1); + equals(result, 4, 'works on an arguments object.'); + result = _.map([[1,2,3],[1,2,3]], _.first); + equals(result.join(','), '1,1', 'works well with _.map'); + }); + + test("arrays: rest", function() { + var numbers = [1, 2, 3, 4]; + equals(_.rest(numbers).join(", "), "2, 3, 4", 'working rest()'); + equals(_.rest(numbers, 0).join(", "), "1, 2, 3, 4", 'working rest(0)'); + equals(_.rest(numbers, 2).join(', '), '3, 4', 'rest can take an index'); + var result = (function(){ return _(arguments).tail(); })(1, 2, 3, 4); + equals(result.join(', '), '2, 3, 4', 'aliased as tail and works on arguments object'); + result = _.map([[1,2,3],[1,2,3]], _.rest); + equals(_.flatten(result).join(','), '2,3,2,3', 'works well with _.map'); + }); + + test("arrays: initial", function() { + equals(_.initial([1,2,3,4,5]).join(", "), "1, 2, 3, 4", 'working initial()'); + equals(_.initial([1,2,3,4],2).join(", "), "1, 2", 'initial can take an index'); + var result = (function(){ return _(arguments).initial(); })(1, 2, 3, 4); + equals(result.join(", "), "1, 2, 3", 'initial works on arguments object'); + result = _.map([[1,2,3],[1,2,3]], _.initial); + equals(_.flatten(result).join(','), '1,2,1,2', 'initial works with _.map'); + }); + + test("arrays: last", function() { + equals(_.last([1,2,3]), 3, 'can pull out the last element of an array'); + equals(_.last([1,2,3], 0).join(', '), "", 'can pass an index to last'); + equals(_.last([1,2,3], 2).join(', '), '2, 3', 'can pass an index to last'); + var result = (function(){ return _(arguments).last(); })(1, 2, 3, 4); + equals(result, 4, 'works on an arguments object'); + result = _.map([[1,2,3],[1,2,3]], _.last); + equals(result.join(','), '3,3', 'works well with _.map'); + }); + + test("arrays: compact", function() { + equals(_.compact([0, 1, false, 2, false, 3]).length, 3, 'can trim out all falsy values'); + var result = (function(){ return _(arguments).compact().length; })(0, 1, false, 2, false, 3); + equals(result, 3, 'works on an arguments object'); + }); + + test("arrays: flatten", function() { + if (window.JSON) { + var list = [1, [2], [3, [[[4]]]]]; + equals(JSON.stringify(_.flatten(list)), '[1,2,3,4]', 'can flatten nested arrays'); + equals(JSON.stringify(_.flatten(list, true)), '[1,2,3,[[[4]]]]', 'can shallowly flatten nested arrays'); + var result = (function(){ return _.flatten(arguments); })(1, [2], [3, [[[4]]]]); + equals(JSON.stringify(result), '[1,2,3,4]', 'works on an arguments object'); + } + }); + + test("arrays: without", function() { + var list = [1, 2, 1, 0, 3, 1, 4]; + equals(_.without(list, 0, 1).join(', '), '2, 3, 4', 'can remove all instances of an object'); + var result = (function(){ return _.without(arguments, 0, 1); })(1, 2, 1, 0, 3, 1, 4); + equals(result.join(', '), '2, 3, 4', 'works on an arguments object'); + + var list = [{one : 1}, {two : 2}]; + ok(_.without(list, {one : 1}).length == 2, 'uses real object identity for comparisons.'); + ok(_.without(list, list[0]).length == 1, 'ditto.'); + }); + + test("arrays: uniq", function() { + var list = [1, 2, 1, 3, 1, 4]; + equals(_.uniq(list).join(', '), '1, 2, 3, 4', 'can find the unique values of an unsorted array'); + + var list = [1, 1, 1, 2, 2, 3]; + equals(_.uniq(list, true).join(', '), '1, 2, 3', 'can find the unique values of a sorted array faster'); + + var list = [{name:'moe'}, {name:'curly'}, {name:'larry'}, {name:'curly'}]; + var iterator = function(value) { return value.name; }; + equals(_.map(_.uniq(list, false, iterator), iterator).join(', '), 'moe, curly, larry', 'can find the unique values of an array using a custom iterator'); + + var iterator = function(value) { return value +1; }; + var list = [1, 2, 2, 3, 4, 4]; + equals(_.uniq(list, true, iterator).join(', '), '1, 2, 3, 4', 'iterator works with sorted array'); + + var result = (function(){ return _.uniq(arguments); })(1, 2, 1, 3, 1, 4); + equals(result.join(', '), '1, 2, 3, 4', 'works on an arguments object'); + }); + + test("arrays: intersection", function() { + var stooges = ['moe', 'curly', 'larry'], leaders = ['moe', 'groucho']; + equals(_.intersection(stooges, leaders).join(''), 'moe', 'can take the set intersection of two arrays'); + equals(_(stooges).intersection(leaders).join(''), 'moe', 'can perform an OO-style intersection'); + var result = (function(){ return _.intersection(arguments, leaders); })('moe', 'curly', 'larry'); + equals(result.join(''), 'moe', 'works on an arguments object'); + }); + + test("arrays: union", function() { + var result = _.union([1, 2, 3], [2, 30, 1], [1, 40]); + equals(result.join(' '), '1 2 3 30 40', 'takes the union of a list of arrays'); + + var result = _.union([1, 2, 3], [2, 30, 1], [1, 40, [1]]); + equals(result.join(' '), '1 2 3 30 40 1', 'takes the union of a list of nested arrays'); + }); + + test("arrays: difference", function() { + var result = _.difference([1, 2, 3], [2, 30, 40]); + equals(result.join(' '), '1 3', 'takes the difference of two arrays'); + }); + + test('arrays: zip', function() { + var names = ['moe', 'larry', 'curly'], ages = [30, 40, 50], leaders = [true]; + var stooges = _.zip(names, ages, leaders); + equals(String(stooges), 'moe,30,true,larry,40,,curly,50,', 'zipped together arrays of different lengths'); + }); + + test("arrays: indexOf", function() { + var numbers = [1, 2, 3]; + numbers.indexOf = null; + equals(_.indexOf(numbers, 2), 1, 'can compute indexOf, even without the native function'); + var result = (function(){ return _.indexOf(arguments, 2); })(1, 2, 3); + equals(result, 1, 'works on an arguments object'); + equals(_.indexOf(null, 2), -1, 'handles nulls properly'); + + var numbers = [10, 20, 30, 40, 50], num = 35; + var index = _.indexOf(numbers, num, true); + equals(index, -1, '35 is not in the list'); + + numbers = [10, 20, 30, 40, 50]; num = 40; + index = _.indexOf(numbers, num, true); + equals(index, 3, '40 is in the list'); + + numbers = [1, 40, 40, 40, 40, 40, 40, 40, 50, 60, 70]; num = 40; + index = _.indexOf(numbers, num, true); + equals(index, 1, '40 is in the list'); + }); + + test("arrays: lastIndexOf", function() { + var numbers = [1, 0, 1, 0, 0, 1, 0, 0, 0]; + numbers.lastIndexOf = null; + equals(_.lastIndexOf(numbers, 1), 5, 'can compute lastIndexOf, even without the native function'); + equals(_.lastIndexOf(numbers, 0), 8, 'lastIndexOf the other element'); + var result = (function(){ return _.lastIndexOf(arguments, 1); })(1, 0, 1, 0, 0, 1, 0, 0, 0); + equals(result, 5, 'works on an arguments object'); + equals(_.indexOf(null, 2), -1, 'handles nulls properly'); + }); + + test("arrays: range", function() { + equals(_.range(0).join(''), '', 'range with 0 as a first argument generates an empty array'); + equals(_.range(4).join(' '), '0 1 2 3', 'range with a single positive argument generates an array of elements 0,1,2,...,n-1'); + equals(_.range(5, 8).join(' '), '5 6 7', 'range with two arguments a & b, a<b generates an array of elements a,a+1,a+2,...,b-2,b-1'); + equals(_.range(8, 5).join(''), '', 'range with two arguments a & b, b<a generates an empty array'); + equals(_.range(3, 10, 3).join(' '), '3 6 9', 'range with three arguments a & b & c, c < b-a, a < b generates an array of elements a,a+c,a+2c,...,b - (multiplier of a) < c'); + equals(_.range(3, 10, 15).join(''), '3', 'range with three arguments a & b & c, c > b-a, a < b generates an array with a single element, equal to a'); + equals(_.range(12, 7, -2).join(' '), '12 10 8', 'range with three arguments a & b & c, a > b, c < 0 generates an array of elements a,a-c,a-2c and ends with the number not less than b'); + equals(_.range(0, -10, -1).join(' '), '0 -1 -2 -3 -4 -5 -6 -7 -8 -9', 'final example in the Python docs'); + }); + +}); diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/chaining.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/chaining.js new file mode 100644 index 0000000..64b0500 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/chaining.js @@ -0,0 +1,47 @@ +$(document).ready(function() { + + module("Chaining"); + + test("chaining: map/flatten/reduce", function() { + var lyrics = [ + "I'm a lumberjack and I'm okay", + "I sleep all night and I work all day", + "He's a lumberjack and he's okay", + "He sleeps all night and he works all day" + ]; + var counts = _(lyrics).chain() + .map(function(line) { return line.split(''); }) + .flatten() + .reduce(function(hash, l) { + hash[l] = hash[l] || 0; + hash[l]++; + return hash; + }, {}).value(); + ok(counts['a'] == 16 && counts['e'] == 10, 'counted all the letters in the song'); + }); + + test("chaining: select/reject/sortBy", function() { + var numbers = [1,2,3,4,5,6,7,8,9,10]; + numbers = _(numbers).chain().select(function(n) { + return n % 2 == 0; + }).reject(function(n) { + return n % 4 == 0; + }).sortBy(function(n) { + return -n; + }).value(); + equals(numbers.join(', '), "10, 6, 2", "filtered and reversed the numbers"); + }); + + test("chaining: reverse/concat/unshift/pop/map", function() { + var numbers = [1,2,3,4,5]; + numbers = _(numbers).chain() + .reverse() + .concat([5, 5, 5]) + .unshift(17) + .pop() + .map(function(n){ return n * 2; }) + .value(); + equals(numbers.join(', '), "34, 10, 8, 6, 4, 2, 10, 10", 'can chain together array functions.'); + }); + +}); diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/collections.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/collections.js new file mode 100644 index 0000000..009d2f3 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/collections.js @@ -0,0 +1,241 @@ +$(document).ready(function() { + + module("Collections"); + + test("collections: each", function() { + _.each([1, 2, 3], function(num, i) { + equals(num, i + 1, 'each iterators provide value and iteration count'); + }); + + var answers = []; + _.each([1, 2, 3], function(num){ answers.push(num * this.multiplier);}, {multiplier : 5}); + equals(answers.join(', '), '5, 10, 15', 'context object property accessed'); + + answers = []; + _.forEach([1, 2, 3], function(num){ answers.push(num); }); + equals(answers.join(', '), '1, 2, 3', 'aliased as "forEach"'); + + answers = []; + var obj = {one : 1, two : 2, three : 3}; + obj.constructor.prototype.four = 4; + _.each(obj, function(value, key){ answers.push(key); }); + equals(answers.join(", "), 'one, two, three', 'iterating over objects works, and ignores the object prototype.'); + delete obj.constructor.prototype.four; + + answer = null; + _.each([1, 2, 3], function(num, index, arr){ if (_.include(arr, num)) answer = true; }); + ok(answer, 'can reference the original collection from inside the iterator'); + + answers = 0; + _.each(null, function(){ ++answers; }); + equals(answers, 0, 'handles a null properly'); + }); + + test('collections: map', function() { + var doubled = _.map([1, 2, 3], function(num){ return num * 2; }); + equals(doubled.join(', '), '2, 4, 6', 'doubled numbers'); + + var tripled = _.map([1, 2, 3], function(num){ return num * this.multiplier; }, {multiplier : 3}); + equals(tripled.join(', '), '3, 6, 9', 'tripled numbers with context'); + + var doubled = _([1, 2, 3]).map(function(num){ return num * 2; }); + equals(doubled.join(', '), '2, 4, 6', 'OO-style doubled numbers'); + + var ids = _.map($('div.underscore-test').children(), function(n){ return n.id; }); + ok(_.include(ids, 'qunit-header'), 'can use collection methods on NodeLists'); + + var ids = _.map(document.images, function(n){ return n.id; }); + ok(ids[0] == 'chart_image', 'can use collection methods on HTMLCollections'); + + var ifnull = _.map(null, function(){}); + ok(_.isArray(ifnull) && ifnull.length === 0, 'handles a null properly'); + }); + + test('collections: reduce', function() { + var sum = _.reduce([1, 2, 3], function(sum, num){ return sum + num; }, 0); + equals(sum, 6, 'can sum up an array'); + + var context = {multiplier : 3}; + sum = _.reduce([1, 2, 3], function(sum, num){ return sum + num * this.multiplier; }, 0, context); + equals(sum, 18, 'can reduce with a context object'); + + sum = _.inject([1, 2, 3], function(sum, num){ return sum + num; }, 0); + equals(sum, 6, 'aliased as "inject"'); + + sum = _([1, 2, 3]).reduce(function(sum, num){ return sum + num; }, 0); + equals(sum, 6, 'OO-style reduce'); + + var sum = _.reduce([1, 2, 3], function(sum, num){ return sum + num; }); + equals(sum, 6, 'default initial value'); + + var ifnull; + try { + _.reduce(null, function(){}); + } catch (ex) { + ifnull = ex; + } + ok(ifnull instanceof TypeError, 'handles a null (without inital value) properly'); + + ok(_.reduce(null, function(){}, 138) === 138, 'handles a null (with initial value) properly'); + + // Sparse arrays: + var sparseArray = []; + sparseArray[100] = 10; + sparseArray[200] = 20; + + equals(_.reduce(sparseArray, function(a, b){ return a + b }), 30, 'initially-sparse arrays with no memo'); + }); + + test('collections: reduceRight', function() { + var list = _.reduceRight(["foo", "bar", "baz"], function(memo, str){ return memo + str; }, ''); + equals(list, 'bazbarfoo', 'can perform right folds'); + + var list = _.foldr(["foo", "bar", "baz"], function(memo, str){ return memo + str; }, ''); + equals(list, 'bazbarfoo', 'aliased as "foldr"'); + + var list = _.foldr(["foo", "bar", "baz"], function(memo, str){ return memo + str; }); + equals(list, 'bazbarfoo', 'default initial value'); + + var ifnull; + try { + _.reduceRight(null, function(){}); + } catch (ex) { + ifnull = ex; + } + ok(ifnull instanceof TypeError, 'handles a null (without inital value) properly'); + + ok(_.reduceRight(null, function(){}, 138) === 138, 'handles a null (with initial value) properly'); + }); + + test('collections: detect', function() { + var result = _.detect([1, 2, 3], function(num){ return num * 2 == 4; }); + equals(result, 2, 'found the first "2" and broke the loop'); + }); + + test('collections: select', function() { + var evens = _.select([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; }); + equals(evens.join(', '), '2, 4, 6', 'selected each even number'); + + evens = _.filter([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; }); + equals(evens.join(', '), '2, 4, 6', 'aliased as "filter"'); + }); + + test('collections: reject', function() { + var odds = _.reject([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; }); + equals(odds.join(', '), '1, 3, 5', 'rejected each even number'); + }); + + test('collections: all', function() { + ok(_.all([], _.identity), 'the empty set'); + ok(_.all([true, true, true], _.identity), 'all true values'); + ok(!_.all([true, false, true], _.identity), 'one false value'); + ok(_.all([0, 10, 28], function(num){ return num % 2 == 0; }), 'even numbers'); + ok(!_.all([0, 11, 28], function(num){ return num % 2 == 0; }), 'an odd number'); + ok(_.every([true, true, true], _.identity), 'aliased as "every"'); + }); + + test('collections: any', function() { + var nativeSome = Array.prototype.some; + Array.prototype.some = null; + ok(!_.any([]), 'the empty set'); + ok(!_.any([false, false, false]), 'all false values'); + ok(_.any([false, false, true]), 'one true value'); + ok(!_.any([1, 11, 29], function(num){ return num % 2 == 0; }), 'all odd numbers'); + ok(_.any([1, 10, 29], function(num){ return num % 2 == 0; }), 'an even number'); + ok(_.some([false, false, true]), 'aliased as "some"'); + Array.prototype.some = nativeSome; + }); + + test('collections: include', function() { + ok(_.include([1,2,3], 2), 'two is in the array'); + ok(!_.include([1,3,9], 2), 'two is not in the array'); + ok(_.contains({moe:1, larry:3, curly:9}, 3) === true, '_.include on objects checks their values'); + ok(_([1,2,3]).include(2), 'OO-style include'); + }); + + test('collections: invoke', function() { + var list = [[5, 1, 7], [3, 2, 1]]; + var result = _.invoke(list, 'sort'); + equals(result[0].join(', '), '1, 5, 7', 'first array sorted'); + equals(result[1].join(', '), '1, 2, 3', 'second array sorted'); + }); + + test('collections: invoke w/ function reference', function() { + var list = [[5, 1, 7], [3, 2, 1]]; + var result = _.invoke(list, Array.prototype.sort); + equals(result[0].join(', '), '1, 5, 7', 'first array sorted'); + equals(result[1].join(', '), '1, 2, 3', 'second array sorted'); + }); + + test('collections: pluck', function() { + var people = [{name : 'moe', age : 30}, {name : 'curly', age : 50}]; + equals(_.pluck(people, 'name').join(', '), 'moe, curly', 'pulls names out of objects'); + }); + + test('collections: max', function() { + equals(3, _.max([1, 2, 3]), 'can perform a regular Math.max'); + + var neg = _.max([1, 2, 3], function(num){ return -num; }); + equals(neg, 1, 'can perform a computation-based max'); + + equals(-Infinity, _.max({}), 'Maximum value of an empty object'); + equals(-Infinity, _.max([]), 'Maximum value of an empty array'); + }); + + test('collections: min', function() { + equals(1, _.min([1, 2, 3]), 'can perform a regular Math.min'); + + var neg = _.min([1, 2, 3], function(num){ return -num; }); + equals(neg, 3, 'can perform a computation-based min'); + + equals(Infinity, _.min({}), 'Minimum value of an empty object'); + equals(Infinity, _.min([]), 'Minimum value of an empty array'); + }); + + test('collections: sortBy', function() { + var people = [{name : 'curly', age : 50}, {name : 'moe', age : 30}]; + people = _.sortBy(people, function(person){ return person.age; }); + equals(_.pluck(people, 'name').join(', '), 'moe, curly', 'stooges sorted by age'); + }); + + test('collections: groupBy', function() { + var parity = _.groupBy([1, 2, 3, 4, 5, 6], function(num){ return num % 2; }); + ok('0' in parity && '1' in parity, 'created a group for each value'); + equals(parity[0].join(', '), '2, 4, 6', 'put each even number in the right group'); + + var list = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"]; + var grouped = _.groupBy(list, 'length'); + equals(grouped['3'].join(' '), 'one two six ten'); + equals(grouped['4'].join(' '), 'four five nine'); + equals(grouped['5'].join(' '), 'three seven eight'); + }); + + test('collections: sortedIndex', function() { + var numbers = [10, 20, 30, 40, 50], num = 35; + var index = _.sortedIndex(numbers, num); + equals(index, 3, '35 should be inserted at index 3'); + }); + + test('collections: shuffle', function() { + var numbers = _.range(10); + var shuffled = _.shuffle(numbers).sort(); + notStrictEqual(numbers, shuffled, 'original object is unmodified'); + equals(shuffled.join(','), numbers.join(','), 'contains the same members before and after shuffle'); + }); + + test('collections: toArray', function() { + ok(!_.isArray(arguments), 'arguments object is not an array'); + ok(_.isArray(_.toArray(arguments)), 'arguments object converted into array'); + var a = [1,2,3]; + ok(_.toArray(a) !== a, 'array is cloned'); + equals(_.toArray(a).join(', '), '1, 2, 3', 'cloned array contains same elements'); + + var numbers = _.toArray({one : 1, two : 2, three : 3}); + equals(numbers.join(', '), '1, 2, 3', 'object flattened into array'); + }); + + test('collections: size', function() { + equals(_.size({one : 1, two : 2, three : 3}), 3, 'can compute the size of an object'); + }); + +}); diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/functions.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/functions.js new file mode 100644 index 0000000..3df3e96 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/functions.js @@ -0,0 +1,193 @@ +$(document).ready(function() { + + module("Functions"); + + test("functions: bind", function() { + var context = {name : 'moe'}; + var func = function(arg) { return "name: " + (this.name || arg); }; + var bound = _.bind(func, context); + equals(bound(), 'name: moe', 'can bind a function to a context'); + + bound = _(func).bind(context); + equals(bound(), 'name: moe', 'can do OO-style binding'); + + bound = _.bind(func, null, 'curly'); + equals(bound(), 'name: curly', 'can bind without specifying a context'); + + func = function(salutation, name) { return salutation + ': ' + name; }; + func = _.bind(func, this, 'hello'); + equals(func('moe'), 'hello: moe', 'the function was partially applied in advance'); + + var func = _.bind(func, this, 'curly'); + equals(func(), 'hello: curly', 'the function was completely applied in advance'); + + var func = function(salutation, firstname, lastname) { return salutation + ': ' + firstname + ' ' + lastname; }; + func = _.bind(func, this, 'hello', 'moe', 'curly'); + equals(func(), 'hello: moe curly', 'the function was partially applied in advance and can accept multiple arguments'); + + func = function(context, message) { equals(this, context, message); }; + _.bind(func, 0, 0, 'can bind a function to `0`')(); + _.bind(func, '', '', 'can bind a function to an empty string')(); + _.bind(func, false, false, 'can bind a function to `false`')(); + + // These tests are only meaningful when using a browser without a native bind function + // To test this with a modern browser, set underscore's nativeBind to undefined + var F = function () { return this; }; + var Boundf = _.bind(F, {hello: "moe curly"}); + equal(new Boundf().hello, undefined, "function should not be bound to the context, to comply with ECMAScript 5"); + equal(Boundf().hello, "moe curly", "When called without the new operator, it's OK to be bound to the context"); + }); + + test("functions: bindAll", function() { + var curly = {name : 'curly'}, moe = { + name : 'moe', + getName : function() { return 'name: ' + this.name; }, + sayHi : function() { return 'hi: ' + this.name; } + }; + curly.getName = moe.getName; + _.bindAll(moe, 'getName', 'sayHi'); + curly.sayHi = moe.sayHi; + equals(curly.getName(), 'name: curly', 'unbound function is bound to current object'); + equals(curly.sayHi(), 'hi: moe', 'bound function is still bound to original object'); + + curly = {name : 'curly'}; + moe = { + name : 'moe', + getName : function() { return 'name: ' + this.name; }, + sayHi : function() { return 'hi: ' + this.name; } + }; + _.bindAll(moe); + curly.sayHi = moe.sayHi; + equals(curly.sayHi(), 'hi: moe', 'calling bindAll with no arguments binds all functions to the object'); + }); + + test("functions: memoize", function() { + var fib = function(n) { + return n < 2 ? n : fib(n - 1) + fib(n - 2); + }; + var fastFib = _.memoize(fib); + equals(fib(10), 55, 'a memoized version of fibonacci produces identical results'); + equals(fastFib(10), 55, 'a memoized version of fibonacci produces identical results'); + + var o = function(str) { + return str; + }; + var fastO = _.memoize(o); + equals(o('toString'), 'toString', 'checks hasOwnProperty'); + equals(fastO('toString'), 'toString', 'checks hasOwnProperty'); + }); + + asyncTest("functions: delay", 2, function() { + var delayed = false; + _.delay(function(){ delayed = true; }, 100); + setTimeout(function(){ ok(!delayed, "didn't delay the function quite yet"); }, 50); + setTimeout(function(){ ok(delayed, 'delayed the function'); start(); }, 150); + }); + + asyncTest("functions: defer", 1, function() { + var deferred = false; + _.defer(function(bool){ deferred = bool; }, true); + _.delay(function(){ ok(deferred, "deferred the function"); start(); }, 50); + }); + + asyncTest("functions: throttle", 2, function() { + var counter = 0; + var incr = function(){ counter++; }; + var throttledIncr = _.throttle(incr, 100); + throttledIncr(); throttledIncr(); throttledIncr(); + setTimeout(throttledIncr, 70); + setTimeout(throttledIncr, 120); + setTimeout(throttledIncr, 140); + setTimeout(throttledIncr, 190); + setTimeout(throttledIncr, 220); + setTimeout(throttledIncr, 240); + _.delay(function(){ ok(counter == 1, "incr was called immediately"); }, 30); + _.delay(function(){ ok(counter == 4, "incr was throttled"); start(); }, 400); + }); + + asyncTest("functions: throttle arguments", 2, function() { + var value = 0; + var update = function(val){ value = val; }; + var throttledUpdate = _.throttle(update, 100); + throttledUpdate(1); throttledUpdate(2); throttledUpdate(3); + setTimeout(function(){ throttledUpdate(4); }, 120); + setTimeout(function(){ throttledUpdate(5); }, 140); + setTimeout(function(){ throttledUpdate(6); }, 260); + setTimeout(function(){ throttledUpdate(7); }, 270); + _.delay(function(){ ok(value == 1, "updated to latest value"); }, 40); + _.delay(function(){ ok(value == 7, "updated to latest value"); start(); }, 400); + }); + + asyncTest("functions: throttle once", 1, function() { + var counter = 0; + var incr = function(){ counter++; }; + var throttledIncr = _.throttle(incr, 100); + throttledIncr(); + _.delay(function(){ ok(counter == 1, "incr was called once"); start(); }, 220); + }); + + asyncTest("functions: throttle twice", 1, function() { + var counter = 0; + var incr = function(){ counter++; }; + var throttledIncr = _.throttle(incr, 100); + throttledIncr(); throttledIncr(); + _.delay(function(){ ok(counter == 2, "incr was called twice"); start(); }, 220); + }); + + asyncTest("functions: debounce", 1, function() { + var counter = 0; + var incr = function(){ counter++; }; + var debouncedIncr = _.debounce(incr, 50); + debouncedIncr(); debouncedIncr(); debouncedIncr(); + setTimeout(debouncedIncr, 30); + setTimeout(debouncedIncr, 60); + setTimeout(debouncedIncr, 90); + setTimeout(debouncedIncr, 120); + setTimeout(debouncedIncr, 150); + _.delay(function(){ ok(counter == 1, "incr was debounced"); start(); }, 220); + }); + + test("functions: once", function() { + var num = 0; + var increment = _.once(function(){ num++; }); + increment(); + increment(); + equals(num, 1); + }); + + test("functions: wrap", function() { + var greet = function(name){ return "hi: " + name; }; + var backwards = _.wrap(greet, function(func, name){ return func(name) + ' ' + name.split('').reverse().join(''); }); + equals(backwards('moe'), 'hi: moe eom', 'wrapped the saluation function'); + + var inner = function(){ return "Hello "; }; + var obj = {name : "Moe"}; + obj.hi = _.wrap(inner, function(fn){ return fn() + this.name; }); + equals(obj.hi(), "Hello Moe"); + }); + + test("functions: compose", function() { + var greet = function(name){ return "hi: " + name; }; + var exclaim = function(sentence){ return sentence + '!'; }; + var composed = _.compose(exclaim, greet); + equals(composed('moe'), 'hi: moe!', 'can compose a function that takes another'); + + composed = _.compose(greet, exclaim); + equals(composed('moe'), 'hi: moe!', 'in this case, the functions are also commutative'); + }); + + test("functions: after", function() { + var testAfter = function(afterAmount, timesCalled) { + var afterCalled = 0; + var after = _.after(afterAmount, function() { + afterCalled++; + }); + while (timesCalled--) after(); + return afterCalled; + }; + + equals(testAfter(5, 5), 1, "after(N) should fire after being called N times"); + equals(testAfter(5, 4), 0, "after(N) should not fire unless called N times"); + }); + +}); diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/objects.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/objects.js new file mode 100644 index 0000000..7e6cd7c --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/objects.js @@ -0,0 +1,533 @@ +$(document).ready(function() { + + module("Objects"); + + test("objects: keys", function() { + var exception = /object/; + equals(_.keys({one : 1, two : 2}).join(', '), 'one, two', 'can extract the keys from an object'); + // the test above is not safe because it relies on for-in enumeration order + var a = []; a[1] = 0; + equals(_.keys(a).join(', '), '1', 'is not fooled by sparse arrays; see issue #95'); + raises(function() { _.keys(null); }, exception, 'throws an error for `null` values'); + raises(function() { _.keys(void 0); }, exception, 'throws an error for `undefined` values'); + raises(function() { _.keys(1); }, exception, 'throws an error for number primitives'); + raises(function() { _.keys('a'); }, exception, 'throws an error for string primitives'); + raises(function() { _.keys(true); }, exception, 'throws an error for boolean primitives'); + }); + + test("objects: values", function() { + equals(_.values({one : 1, two : 2}).join(', '), '1, 2', 'can extract the values from an object'); + }); + + test("objects: functions", function() { + var obj = {a : 'dash', b : _.map, c : (/yo/), d : _.reduce}; + ok(_.isEqual(['b', 'd'], _.functions(obj)), 'can grab the function names of any passed-in object'); + + var Animal = function(){}; + Animal.prototype.run = function(){}; + equals(_.functions(new Animal).join(''), 'run', 'also looks up functions on the prototype'); + }); + + test("objects: extend", function() { + var result; + equals(_.extend({}, {a:'b'}).a, 'b', 'can extend an object with the attributes of another'); + equals(_.extend({a:'x'}, {a:'b'}).a, 'b', 'properties in source override destination'); + equals(_.extend({x:'x'}, {a:'b'}).x, 'x', 'properties not in source dont get overriden'); + result = _.extend({x:'x'}, {a:'a'}, {b:'b'}); + ok(_.isEqual(result, {x:'x', a:'a', b:'b'}), 'can extend from multiple source objects'); + result = _.extend({x:'x'}, {a:'a', x:2}, {a:'b'}); + ok(_.isEqual(result, {x:2, a:'b'}), 'extending from multiple source objects last property trumps'); + result = _.extend({}, {a: void 0, b: null}); + equals(_.keys(result).join(''), 'b', 'extend does not copy undefined values'); + }); + + test("objects: defaults", function() { + var result; + var options = {zero: 0, one: 1, empty: "", nan: NaN, string: "string"}; + + _.defaults(options, {zero: 1, one: 10, twenty: 20}); + equals(options.zero, 0, 'value exists'); + equals(options.one, 1, 'value exists'); + equals(options.twenty, 20, 'default applied'); + + _.defaults(options, {empty: "full"}, {nan: "nan"}, {word: "word"}, {word: "dog"}); + equals(options.empty, "", 'value exists'); + ok(_.isNaN(options.nan), "NaN isn't overridden"); + equals(options.word, "word", 'new value is added, first one wins'); + }); + + test("objects: clone", function() { + var moe = {name : 'moe', lucky : [13, 27, 34]}; + var clone = _.clone(moe); + equals(clone.name, 'moe', 'the clone as the attributes of the original'); + + clone.name = 'curly'; + ok(clone.name == 'curly' && moe.name == 'moe', 'clones can change shallow attributes without affecting the original'); + + clone.lucky.push(101); + equals(_.last(moe.lucky), 101, 'changes to deep attributes are shared with the original'); + + equals(_.clone(undefined), void 0, 'non objects should not be changed by clone'); + equals(_.clone(1), 1, 'non objects should not be changed by clone'); + equals(_.clone(null), null, 'non objects should not be changed by clone'); + }); + + test("objects: isEqual", function() { + function First() { + this.value = 1; + } + First.prototype.value = 1; + function Second() { + this.value = 1; + } + Second.prototype.value = 2; + + // Basic equality and identity comparisons. + ok(_.isEqual(null, null), "`null` is equal to `null`"); + ok(_.isEqual(), "`undefined` is equal to `undefined`"); + + ok(!_.isEqual(0, -0), "`0` is not equal to `-0`"); + ok(!_.isEqual(-0, 0), "Commutative equality is implemented for `0` and `-0`"); + ok(!_.isEqual(null, undefined), "`null` is not equal to `undefined`"); + ok(!_.isEqual(undefined, null), "Commutative equality is implemented for `null` and `undefined`"); + + // String object and primitive comparisons. + ok(_.isEqual("Curly", "Curly"), "Identical string primitives are equal"); + ok(_.isEqual(new String("Curly"), new String("Curly")), "String objects with identical primitive values are equal"); + + ok(!_.isEqual("Curly", "Larry"), "String primitives with different values are not equal"); + ok(!_.isEqual(new String("Curly"), "Curly"), "String primitives and their corresponding object wrappers are not equal"); + ok(!_.isEqual("Curly", new String("Curly")), "Commutative equality is implemented for string objects and primitives"); + ok(!_.isEqual(new String("Curly"), new String("Larry")), "String objects with different primitive values are not equal"); + ok(!_.isEqual(new String("Curly"), {toString: function(){ return "Curly"; }}), "String objects and objects with a custom `toString` method are not equal"); + + // Number object and primitive comparisons. + ok(_.isEqual(75, 75), "Identical number primitives are equal"); + ok(_.isEqual(new Number(75), new Number(75)), "Number objects with identical primitive values are equal"); + + ok(!_.isEqual(75, new Number(75)), "Number primitives and their corresponding object wrappers are not equal"); + ok(!_.isEqual(new Number(75), 75), "Commutative equality is implemented for number objects and primitives"); + ok(!_.isEqual(new Number(75), new Number(63)), "Number objects with different primitive values are not equal"); + ok(!_.isEqual(new Number(63), {valueOf: function(){ return 63; }}), "Number objects and objects with a `valueOf` method are not equal"); + + // Comparisons involving `NaN`. + ok(_.isEqual(NaN, NaN), "`NaN` is equal to `NaN`"); + ok(!_.isEqual(61, NaN), "A number primitive is not equal to `NaN`"); + ok(!_.isEqual(new Number(79), NaN), "A number object is not equal to `NaN`"); + ok(!_.isEqual(Infinity, NaN), "`Infinity` is not equal to `NaN`"); + + // Boolean object and primitive comparisons. + ok(_.isEqual(true, true), "Identical boolean primitives are equal"); + ok(_.isEqual(new Boolean, new Boolean), "Boolean objects with identical primitive values are equal"); + ok(!_.isEqual(true, new Boolean(true)), "Boolean primitives and their corresponding object wrappers are not equal"); + ok(!_.isEqual(new Boolean(true), true), "Commutative equality is implemented for booleans"); + ok(!_.isEqual(new Boolean(true), new Boolean), "Boolean objects with different primitive values are not equal"); + + // Common type coercions. + ok(!_.isEqual(true, new Boolean(false)), "Boolean objects are not equal to the boolean primitive `true`"); + ok(!_.isEqual("75", 75), "String and number primitives with like values are not equal"); + ok(!_.isEqual(new Number(63), new String(63)), "String and number objects with like values are not equal"); + ok(!_.isEqual(75, "75"), "Commutative equality is implemented for like string and number values"); + ok(!_.isEqual(0, ""), "Number and string primitives with like values are not equal"); + ok(!_.isEqual(1, true), "Number and boolean primitives with like values are not equal"); + ok(!_.isEqual(new Boolean(false), new Number(0)), "Boolean and number objects with like values are not equal"); + ok(!_.isEqual(false, new String("")), "Boolean primitives and string objects with like values are not equal"); + ok(!_.isEqual(12564504e5, new Date(2009, 9, 25)), "Dates and their corresponding numeric primitive values are not equal"); + + // Dates. + ok(_.isEqual(new Date(2009, 9, 25), new Date(2009, 9, 25)), "Date objects referencing identical times are equal"); + ok(!_.isEqual(new Date(2009, 9, 25), new Date(2009, 11, 13)), "Date objects referencing different times are not equal"); + ok(!_.isEqual(new Date(2009, 11, 13), { + getTime: function(){ + return 12606876e5; + } + }), "Date objects and objects with a `getTime` method are not equal"); + ok(!_.isEqual(new Date("Curly"), new Date("Curly")), "Invalid dates are not equal"); + + // Functions. + ok(!_.isEqual(First, Second), "Different functions with identical bodies and source code representations are not equal"); + + // RegExps. + ok(_.isEqual(/(?:)/gim, /(?:)/gim), "RegExps with equivalent patterns and flags are equal"); + ok(!_.isEqual(/(?:)/g, /(?:)/gi), "RegExps with equivalent patterns and different flags are not equal"); + ok(!_.isEqual(/Moe/gim, /Curly/gim), "RegExps with different patterns and equivalent flags are not equal"); + ok(!_.isEqual(/(?:)/gi, /(?:)/g), "Commutative equality is implemented for RegExps"); + ok(!_.isEqual(/Curly/g, {source: "Larry", global: true, ignoreCase: false, multiline: false}), "RegExps and RegExp-like objects are not equal"); + + // Empty arrays, array-like objects, and object literals. + ok(_.isEqual({}, {}), "Empty object literals are equal"); + ok(_.isEqual([], []), "Empty array literals are equal"); + ok(_.isEqual([{}], [{}]), "Empty nested arrays and objects are equal"); + ok(!_.isEqual({length: 0}, []), "Array-like objects and arrays are not equal."); + ok(!_.isEqual([], {length: 0}), "Commutative equality is implemented for array-like objects"); + + ok(!_.isEqual({}, []), "Object literals and array literals are not equal"); + ok(!_.isEqual([], {}), "Commutative equality is implemented for objects and arrays"); + + // Arrays with primitive and object values. + ok(_.isEqual([1, "Larry", true], [1, "Larry", true]), "Arrays containing identical primitives are equal"); + ok(_.isEqual([/Moe/g, new Date(2009, 9, 25)], [/Moe/g, new Date(2009, 9, 25)]), "Arrays containing equivalent elements are equal"); + + // Multi-dimensional arrays. + var a = [new Number(47), false, "Larry", /Moe/, new Date(2009, 11, 13), ['running', 'biking', new String('programming')], {a: 47}]; + var b = [new Number(47), false, "Larry", /Moe/, new Date(2009, 11, 13), ['running', 'biking', new String('programming')], {a: 47}]; + ok(_.isEqual(a, b), "Arrays containing nested arrays and objects are recursively compared"); + + // Overwrite the methods defined in ES 5.1 section 15.4.4. + a.forEach = a.map = a.filter = a.every = a.indexOf = a.lastIndexOf = a.some = a.reduce = a.reduceRight = null; + b.join = b.pop = b.reverse = b.shift = b.slice = b.splice = b.concat = b.sort = b.unshift = null; + + // Array elements and properties. + ok(!_.isEqual(a, b), "Arrays containing equivalent elements and different non-numeric properties are not equal"); + a.push("White Rocks"); + ok(!_.isEqual(a, b), "Arrays of different lengths are not equal"); + a.push("East Boulder"); + b.push("Gunbarrel Ranch", "Teller Farm"); + ok(!_.isEqual(a, b), "Arrays of identical lengths containing different elements are not equal"); + + // Sparse arrays. + ok(_.isEqual(Array(3), Array(3)), "Sparse arrays of identical lengths are equal"); + ok(!_.isEqual(Array(3), Array(6)), "Sparse arrays of different lengths are not equal when both are empty"); + + // According to the Microsoft deviations spec, section 2.1.26, JScript 5.x treats `undefined` + // elements in arrays as elisions. Thus, sparse arrays and dense arrays containing `undefined` + // values are equivalent. + if (0 in [undefined]) { + ok(!_.isEqual(Array(3), [undefined, undefined, undefined]), "Sparse and dense arrays are not equal"); + ok(!_.isEqual([undefined, undefined, undefined], Array(3)), "Commutative equality is implemented for sparse and dense arrays"); + } + + // Simple objects. + ok(_.isEqual({a: "Curly", b: 1, c: true}, {a: "Curly", b: 1, c: true}), "Objects containing identical primitives are equal"); + ok(_.isEqual({a: /Curly/g, b: new Date(2009, 11, 13)}, {a: /Curly/g, b: new Date(2009, 11, 13)}), "Objects containing equivalent members are equal"); + ok(!_.isEqual({a: 63, b: 75}, {a: 61, b: 55}), "Objects of identical sizes with different values are not equal"); + ok(!_.isEqual({a: 63, b: 75}, {a: 61, c: 55}), "Objects of identical sizes with different property names are not equal"); + ok(!_.isEqual({a: 1, b: 2}, {a: 1}), "Objects of different sizes are not equal"); + ok(!_.isEqual({a: 1}, {a: 1, b: 2}), "Commutative equality is implemented for objects"); + ok(!_.isEqual({x: 1, y: undefined}, {x: 1, z: 2}), "Objects with identical keys and different values are not equivalent"); + + // `A` contains nested objects and arrays. + a = { + name: new String("Moe Howard"), + age: new Number(77), + stooge: true, + hobbies: ["acting"], + film: { + name: "Sing a Song of Six Pants", + release: new Date(1947, 9, 30), + stars: [new String("Larry Fine"), "Shemp Howard"], + minutes: new Number(16), + seconds: 54 + } + }; + + // `B` contains equivalent nested objects and arrays. + b = { + name: new String("Moe Howard"), + age: new Number(77), + stooge: true, + hobbies: ["acting"], + film: { + name: "Sing a Song of Six Pants", + release: new Date(1947, 9, 30), + stars: [new String("Larry Fine"), "Shemp Howard"], + minutes: new Number(16), + seconds: 54 + } + }; + ok(_.isEqual(a, b), "Objects with nested equivalent members are recursively compared"); + + // Instances. + ok(_.isEqual(new First, new First), "Object instances are equal"); + ok(!_.isEqual(new First, new Second), "Objects with different constructors and identical own properties are not equal"); + ok(!_.isEqual({value: 1}, new First), "Object instances and objects sharing equivalent properties are not identical"); + ok(!_.isEqual({value: 2}, new Second), "The prototype chain of objects should not be examined"); + + // Circular Arrays. + (a = []).push(a); + (b = []).push(b); + ok(_.isEqual(a, b), "Arrays containing circular references are equal"); + a.push(new String("Larry")); + b.push(new String("Larry")); + ok(_.isEqual(a, b), "Arrays containing circular references and equivalent properties are equal"); + a.push("Shemp"); + b.push("Curly"); + ok(!_.isEqual(a, b), "Arrays containing circular references and different properties are not equal"); + + // Circular Objects. + a = {abc: null}; + b = {abc: null}; + a.abc = a; + b.abc = b; + ok(_.isEqual(a, b), "Objects containing circular references are equal"); + a.def = 75; + b.def = 75; + ok(_.isEqual(a, b), "Objects containing circular references and equivalent properties are equal"); + a.def = new Number(75); + b.def = new Number(63); + ok(!_.isEqual(a, b), "Objects containing circular references and different properties are not equal"); + + // Cyclic Structures. + a = [{abc: null}]; + b = [{abc: null}]; + (a[0].abc = a).push(a); + (b[0].abc = b).push(b); + ok(_.isEqual(a, b), "Cyclic structures are equal"); + a[0].def = "Larry"; + b[0].def = "Larry"; + ok(_.isEqual(a, b), "Cyclic structures containing equivalent properties are equal"); + a[0].def = new String("Larry"); + b[0].def = new String("Curly"); + ok(!_.isEqual(a, b), "Cyclic structures containing different properties are not equal"); + + // Complex Circular References. + a = {foo: {b: {foo: {c: {foo: null}}}}}; + b = {foo: {b: {foo: {c: {foo: null}}}}}; + a.foo.b.foo.c.foo = a; + b.foo.b.foo.c.foo = b; + ok(_.isEqual(a, b), "Cyclic structures with nested and identically-named properties are equal"); + + // Chaining. + ok(!_.isEqual(_({x: 1, y: undefined}).chain(), _({x: 1, z: 2}).chain()), 'Chained objects containing different values are not equal'); + equals(_({x: 1, y: 2}).chain().isEqual(_({x: 1, y: 2}).chain()).value(), true, '`isEqual` can be chained'); + + // Custom `isEqual` methods. + var isEqualObj = {isEqual: function (o) { return o.isEqual == this.isEqual; }, unique: {}}; + var isEqualObjClone = {isEqual: isEqualObj.isEqual, unique: {}}; + + ok(_.isEqual(isEqualObj, isEqualObjClone), 'Both objects implement identical `isEqual` methods'); + ok(_.isEqual(isEqualObjClone, isEqualObj), 'Commutative equality is implemented for objects with custom `isEqual` methods'); + ok(!_.isEqual(isEqualObj, {}), 'Objects that do not implement equivalent `isEqual` methods are not equal'); + ok(!_.isEqual({}, isEqualObj), 'Commutative equality is implemented for objects with different `isEqual` methods'); + + // Custom `isEqual` methods - comparing different types + LocalizedString = (function() { + function LocalizedString(id) { this.id = id; this.string = (this.id===10)? 'Bonjour': ''; } + LocalizedString.prototype.isEqual = function(that) { + if (_.isString(that)) return this.string == that; + else if (that instanceof LocalizedString) return this.id == that.id; + return false; + }; + return LocalizedString; + })(); + var localized_string1 = new LocalizedString(10), localized_string2 = new LocalizedString(10), localized_string3 = new LocalizedString(11); + ok(_.isEqual(localized_string1, localized_string2), 'comparing same typed instances with same ids'); + ok(!_.isEqual(localized_string1, localized_string3), 'comparing same typed instances with different ids'); + ok(_.isEqual(localized_string1, 'Bonjour'), 'comparing different typed instances with same values'); + ok(_.isEqual('Bonjour', localized_string1), 'comparing different typed instances with same values'); + ok(!_.isEqual('Bonjour', localized_string3), 'comparing two localized strings with different ids'); + ok(!_.isEqual(localized_string1, 'Au revoir'), 'comparing different typed instances with different values'); + ok(!_.isEqual('Au revoir', localized_string1), 'comparing different typed instances with different values'); + + // Custom `isEqual` methods - comparing with serialized data + Date.prototype.toJSON = function() { + return { + _type:'Date', + year:this.getUTCFullYear(), + month:this.getUTCMonth(), + day:this.getUTCDate(), + hours:this.getUTCHours(), + minutes:this.getUTCMinutes(), + seconds:this.getUTCSeconds() + }; + }; + Date.prototype.isEqual = function(that) { + var this_date_components = this.toJSON(); + var that_date_components = (that instanceof Date) ? that.toJSON() : that; + delete this_date_components['_type']; delete that_date_components['_type'] + return _.isEqual(this_date_components, that_date_components); + }; + + var date = new Date(); + var date_json = { + _type:'Date', + year:date.getUTCFullYear(), + month:date.getUTCMonth(), + day:date.getUTCDate(), + hours:date.getUTCHours(), + minutes:date.getUTCMinutes(), + seconds:date.getUTCSeconds() + }; + + ok(_.isEqual(date_json, date), 'serialized date matches date'); + ok(_.isEqual(date, date_json), 'date matches serialized date'); + }); + + test("objects: isEmpty", function() { + ok(!_([1]).isEmpty(), '[1] is not empty'); + ok(_.isEmpty([]), '[] is empty'); + ok(!_.isEmpty({one : 1}), '{one : 1} is not empty'); + ok(_.isEmpty({}), '{} is empty'); + ok(_.isEmpty(new RegExp('')), 'objects with prototype properties are empty'); + ok(_.isEmpty(null), 'null is empty'); + ok(_.isEmpty(), 'undefined is empty'); + ok(_.isEmpty(''), 'the empty string is empty'); + ok(!_.isEmpty('moe'), 'but other strings are not'); + + var obj = {one : 1}; + delete obj.one; + ok(_.isEmpty(obj), 'deleting all the keys from an object empties it'); + }); + + // Setup remote variables for iFrame tests. + var iframe = document.createElement('iframe'); + jQuery(iframe).appendTo(document.body); + var iDoc = iframe.contentDocument || iframe.contentWindow.document; + iDoc.write( + "" + ); + iDoc.close(); + + test("objects: isElement", function() { + ok(!_.isElement('div'), 'strings are not dom elements'); + ok(_.isElement($('html')[0]), 'the html tag is a DOM element'); + ok(_.isElement(iElement), 'even from another frame'); + }); + + test("objects: isArguments", function() { + var args = (function(){ return arguments; })(1, 2, 3); + ok(!_.isArguments('string'), 'a string is not an arguments object'); + ok(!_.isArguments(_.isArguments), 'a function is not an arguments object'); + ok(_.isArguments(args), 'but the arguments object is an arguments object'); + ok(!_.isArguments(_.toArray(args)), 'but not when it\'s converted into an array'); + ok(!_.isArguments([1,2,3]), 'and not vanilla arrays.'); + ok(_.isArguments(iArguments), 'even from another frame'); + }); + + test("objects: isObject", function() { + ok(_.isObject(arguments), 'the arguments object is object'); + ok(_.isObject([1, 2, 3]), 'and arrays'); + ok(_.isObject($('html')[0]), 'and DOM element'); + ok(_.isObject(iElement), 'even from another frame'); + ok(_.isObject(function () {}), 'and functions'); + ok(_.isObject(iFunction), 'even from another frame'); + ok(!_.isObject(null), 'but not null'); + ok(!_.isObject(undefined), 'and not undefined'); + ok(!_.isObject('string'), 'and not string'); + ok(!_.isObject(12), 'and not number'); + ok(!_.isObject(true), 'and not boolean'); + ok(_.isObject(new String('string')), 'but new String()'); + }); + + test("objects: isArray", function() { + ok(!_.isArray(arguments), 'the arguments object is not an array'); + ok(_.isArray([1, 2, 3]), 'but arrays are'); + ok(_.isArray(iArray), 'even from another frame'); + }); + + test("objects: isString", function() { + ok(!_.isString(document.body), 'the document body is not a string'); + ok(_.isString([1, 2, 3].join(', ')), 'but strings are'); + ok(_.isString(iString), 'even from another frame'); + }); + + test("objects: isNumber", function() { + ok(!_.isNumber('string'), 'a string is not a number'); + ok(!_.isNumber(arguments), 'the arguments object is not a number'); + ok(!_.isNumber(undefined), 'undefined is not a number'); + ok(_.isNumber(3 * 4 - 7 / 10), 'but numbers are'); + ok(_.isNumber(NaN), 'NaN *is* a number'); + ok(_.isNumber(Infinity), 'Infinity is a number'); + ok(_.isNumber(iNumber), 'even from another frame'); + ok(!_.isNumber('1'), 'numeric strings are not numbers'); + }); + + test("objects: isBoolean", function() { + ok(!_.isBoolean(2), 'a number is not a boolean'); + ok(!_.isBoolean("string"), 'a string is not a boolean'); + ok(!_.isBoolean("false"), 'the string "false" is not a boolean'); + ok(!_.isBoolean("true"), 'the string "true" is not a boolean'); + ok(!_.isBoolean(arguments), 'the arguments object is not a boolean'); + ok(!_.isBoolean(undefined), 'undefined is not a boolean'); + ok(!_.isBoolean(NaN), 'NaN is not a boolean'); + ok(!_.isBoolean(null), 'null is not a boolean'); + ok(_.isBoolean(true), 'but true is'); + ok(_.isBoolean(false), 'and so is false'); + ok(_.isBoolean(iBoolean), 'even from another frame'); + }); + + test("objects: isFunction", function() { + ok(!_.isFunction([1, 2, 3]), 'arrays are not functions'); + ok(!_.isFunction('moe'), 'strings are not functions'); + ok(_.isFunction(_.isFunction), 'but functions are'); + ok(_.isFunction(iFunction), 'even from another frame'); + }); + + test("objects: isDate", function() { + ok(!_.isDate(100), 'numbers are not dates'); + ok(!_.isDate({}), 'objects are not dates'); + ok(_.isDate(new Date()), 'but dates are'); + ok(_.isDate(iDate), 'even from another frame'); + }); + + test("objects: isRegExp", function() { + ok(!_.isRegExp(_.identity), 'functions are not RegExps'); + ok(_.isRegExp(/identity/), 'but RegExps are'); + ok(_.isRegExp(iRegExp), 'even from another frame'); + }); + + test("objects: isNaN", function() { + ok(!_.isNaN(undefined), 'undefined is not NaN'); + ok(!_.isNaN(null), 'null is not NaN'); + ok(!_.isNaN(0), '0 is not NaN'); + ok(_.isNaN(NaN), 'but NaN is'); + ok(_.isNaN(iNaN), 'even from another frame'); + }); + + test("objects: isNull", function() { + ok(!_.isNull(undefined), 'undefined is not null'); + ok(!_.isNull(NaN), 'NaN is not null'); + ok(_.isNull(null), 'but null is'); + ok(_.isNull(iNull), 'even from another frame'); + }); + + test("objects: isUndefined", function() { + ok(!_.isUndefined(1), 'numbers are defined'); + ok(!_.isUndefined(null), 'null is defined'); + ok(!_.isUndefined(false), 'false is defined'); + ok(!_.isUndefined(NaN), 'NaN is defined'); + ok(_.isUndefined(), 'nothing is undefined'); + ok(_.isUndefined(undefined), 'undefined is undefined'); + ok(_.isUndefined(iUndefined), 'even from another frame'); + }); + + if (window.ActiveXObject) { + test("objects: IE host objects", function() { + var xml = new ActiveXObject("Msxml2.DOMDocument.3.0"); + ok(!_.isNumber(xml)); + ok(!_.isBoolean(xml)); + ok(!_.isNaN(xml)); + ok(!_.isFunction(xml)); + ok(!_.isNull(xml)); + ok(!_.isUndefined(xml)); + }); + } + + test("objects: tap", function() { + var intercepted = null; + var interceptor = function(obj) { intercepted = obj; }; + var returned = _.tap(1, interceptor); + equals(intercepted, 1, "passes tapped object to interceptor"); + equals(returned, 1, "returns tapped object"); + + returned = _([1,2,3]).chain(). + map(function(n){ return n * 2; }). + max(). + tap(interceptor). + value(); + ok(returned == 6 && intercepted == 6, 'can use tapped objects in a chain'); + }); +}); diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/speed.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/speed.js new file mode 100644 index 0000000..86663a2 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/speed.js @@ -0,0 +1,70 @@ +(function() { + + var numbers = []; + for (var i=0; i<1000; i++) numbers.push(i); + var objects = _.map(numbers, function(n){ return {num : n}; }); + var randomized = _.sortBy(numbers, function(){ return Math.random(); }); + + JSLitmus.test('_.each()', function() { + var timesTwo = []; + _.each(numbers, function(num){ timesTwo.push(num * 2); }); + return timesTwo; + }); + + JSLitmus.test('_(list).each()', function() { + var timesTwo = []; + _(numbers).each(function(num){ timesTwo.push(num * 2); }); + return timesTwo; + }); + + JSLitmus.test('jQuery.each()', function() { + var timesTwo = []; + jQuery.each(numbers, function(){ timesTwo.push(this * 2); }); + return timesTwo; + }); + + JSLitmus.test('_.map()', function() { + return _.map(objects, function(obj){ return obj.num; }); + }); + + JSLitmus.test('jQuery.map()', function() { + return jQuery.map(objects, function(obj){ return obj.num; }); + }); + + JSLitmus.test('_.pluck()', function() { + return _.pluck(objects, 'num'); + }); + + JSLitmus.test('_.uniq()', function() { + return _.uniq(randomized); + }); + + JSLitmus.test('_.uniq() (sorted)', function() { + return _.uniq(numbers, true); + }); + + JSLitmus.test('_.sortBy()', function() { + return _.sortBy(numbers, function(num){ return -num; }); + }); + + JSLitmus.test('_.isEqual()', function() { + return _.isEqual(numbers, randomized); + }); + + JSLitmus.test('_.keys()', function() { + return _.keys(objects); + }); + + JSLitmus.test('_.values()', function() { + return _.values(objects); + }); + + JSLitmus.test('_.intersect()', function() { + return _.intersect(numbers, randomized); + }); + + JSLitmus.test('_.range()', function() { + return _.range(1000); + }); + +})(); \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/temp.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/temp.js new file mode 100644 index 0000000..68c39dc --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/temp.js @@ -0,0 +1,27 @@ +(function() { + + var func = function(){}; + var date = new Date(); + var str = "a string"; + var numbers = []; + for (var i=0; i<1000; i++) numbers.push(i); + var objects = _.map(numbers, function(n){ return {num : n}; }); + var randomized = _.sortBy(numbers, function(){ return Math.random(); }); + + JSLitmus.test('_.isNumber', function() { + return _.isNumber(1000) + }); + + JSLitmus.test('_.newIsNumber', function() { + return _.newIsNumber(1000) + }); + + JSLitmus.test('_.isNumber(NaN)', function() { + return _.isNumber(NaN) + }); + + JSLitmus.test('_.newIsNumber(NaN)', function() { + return _.newIsNumber(NaN) + }); + +})(); \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/temp_tests.html b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/temp_tests.html new file mode 100644 index 0000000..bd34f9d --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/temp_tests.html @@ -0,0 +1,19 @@ + + + + Underscore Temporary Tests + + + + + + + +

      Underscore Temporary Tests

      +

      + A page for temporary speed tests, used for developing faster implementations + of existing Underscore methods. +

      +
      + + diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/test.html b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/test.html new file mode 100644 index 0000000..77f2f3a --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/test.html @@ -0,0 +1,43 @@ + + + + Underscore Test Suite + + + + + + + + + + + + + + + +
      +

      Underscore Test Suite

      +

      +

      +
        +
        +

        Underscore Speed Suite

        +

        + A representative sample of the functions are benchmarked here, to provide + a sense of how fast they might run in different browsers. + Each iteration runs on an array of 1000 elements.

        + For example, the 'intersect' test measures the number of times you can + find the intersection of two thousand-element arrays in one second. +

        +
        + + +
        + + diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/utility.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/utility.js new file mode 100644 index 0000000..f1f0bfb --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore.string/test/test_underscore/utility.js @@ -0,0 +1,136 @@ +$(document).ready(function() { + + module("Utility"); + + test("utility: noConflict", function() { + var underscore = _.noConflict(); + ok(underscore.isUndefined(_), "The '_' variable has been returned to its previous state."); + var intersection = underscore.intersect([-1, 0, 1, 2], [1, 2, 3, 4]); + equals(intersection.join(', '), '1, 2', 'but the intersection function still works'); + window._ = underscore; + }); + + test("utility: identity", function() { + var moe = {name : 'moe'}; + equals(_.identity(moe), moe, 'moe is the same as his identity'); + }); + + test("utility: uniqueId", function() { + var ids = [], i = 0; + while(i++ < 100) ids.push(_.uniqueId()); + equals(_.uniq(ids).length, ids.length, 'can generate a globally-unique stream of ids'); + }); + + test("utility: times", function() { + var vals = []; + _.times(3, function (i) { vals.push(i); }); + ok(_.isEqual(vals, [0,1,2]), "is 0 indexed"); + // + vals = []; + _(3).times(function (i) { vals.push(i); }); + ok(_.isEqual(vals, [0,1,2]), "works as a wrapper"); + }); + + test("utility: mixin", function() { + _.mixin({ + myReverse: function(string) { + return string.split('').reverse().join(''); + } + }); + equals(_.myReverse('panacea'), 'aecanap', 'mixed in a function to _'); + equals(_('champ').myReverse(), 'pmahc', 'mixed in a function to the OOP wrapper'); + }); + + test("utility: _.escape", function() { + equals(_.escape("Curly & Moe"), "Curly & Moe"); + equals(_.escape("Curly & Moe"), "Curly &amp; Moe"); + }); + + test("utility: template", function() { + var basicTemplate = _.template("<%= thing %> is gettin' on my noives!"); + var result = basicTemplate({thing : 'This'}); + equals(result, "This is gettin' on my noives!", 'can do basic attribute interpolation'); + + var backslashTemplate = _.template("<%= thing %> is \\ridanculous"); + equals(backslashTemplate({thing: 'This'}), "This is \\ridanculous"); + + var fancyTemplate = _.template("
          <% \ + for (key in people) { \ + %>
        • <%= people[key] %>
        • <% } %>
        "); + result = fancyTemplate({people : {moe : "Moe", larry : "Larry", curly : "Curly"}}); + equals(result, "
        • Moe
        • Larry
        • Curly
        ", 'can run arbitrary javascript in templates'); + + var namespaceCollisionTemplate = _.template("<%= pageCount %> <%= thumbnails[pageCount] %> <% _.each(thumbnails, function(p) { %>
        \">
        <% }); %>"); + result = namespaceCollisionTemplate({ + pageCount: 3, + thumbnails: { + 1: "p1-thumbnail.gif", + 2: "p2-thumbnail.gif", + 3: "p3-thumbnail.gif" + } + }); + equals(result, "3 p3-thumbnail.gif
        "); + + var noInterpolateTemplate = _.template("

        Just some text. Hey, I know this is silly but it aids consistency.

        "); + result = noInterpolateTemplate(); + equals(result, "

        Just some text. Hey, I know this is silly but it aids consistency.

        "); + + var quoteTemplate = _.template("It's its, not it's"); + equals(quoteTemplate({}), "It's its, not it's"); + + var quoteInStatementAndBody = _.template("<%\ + if(foo == 'bar'){ \ + %>Statement quotes and 'quotes'.<% } %>"); + equals(quoteInStatementAndBody({foo: "bar"}), "Statement quotes and 'quotes'."); + + var withNewlinesAndTabs = _.template('This\n\t\tis: <%= x %>.\n\tok.\nend.'); + equals(withNewlinesAndTabs({x: 'that'}), 'This\n\t\tis: that.\n\tok.\nend.'); + + var template = _.template("<%- value %>"); + var result = template({value: " + + + diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/index.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/index.js new file mode 100644 index 0000000..2cf0ca5 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/index.js @@ -0,0 +1 @@ +module.exports = require('./underscore'); diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/package.json b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/package.json new file mode 100644 index 0000000..b936f2b --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/package.json @@ -0,0 +1,26 @@ +{ + "name": "underscore", + "description": "JavaScript's functional programming helper library.", + "homepage": "http://documentcloud.github.com/underscore/", + "keywords": [ + "util", + "functional", + "server", + "client", + "browser" + ], + "author": { + "name": "Jeremy Ashkenas", + "email": "jeremy@documentcloud.org" + }, + "contributors": [], + "repository": { + "type": "git", + "url": "git://github.com/documentcloud/underscore.git" + }, + "main": "underscore.js", + "version": "1.2.4", + "readme": " __ \n /\\ \\ \n __ __ ___ \\_\\ \\ __ _ __ ____ ___ ___ _ __ __ \n/\\ \\/\\ \\ /' _ `\\ /'_ \\ /'__`\\/\\ __\\/ ,__\\ / ___\\ / __`\\/\\ __\\/'__`\\ \n\\ \\ \\_\\ \\/\\ \\/\\ \\/\\ \\ \\ \\/\\ __/\\ \\ \\//\\__, `\\/\\ \\__//\\ \\ \\ \\ \\ \\//\\ __/ \n \\ \\____/\\ \\_\\ \\_\\ \\___,_\\ \\____\\\\ \\_\\\\/\\____/\\ \\____\\ \\____/\\ \\_\\\\ \\____\\\n \\/___/ \\/_/\\/_/\\/__,_ /\\/____/ \\/_/ \\/___/ \\/____/\\/___/ \\/_/ \\/____/\n \n \n\nUnderscore.js is a utility-belt library for JavaScript that provides \nsupport for the usual functional suspects (each, map, reduce, filter...) \nwithout extending any core JavaScript objects.\n\nFor Docs, License, Tests, and pre-packed downloads, see:\nhttp://documentcloud.github.com/underscore/\n\nMany thanks to our contributors:\nhttps://github.com/documentcloud/underscore/contributors\n", + "_id": "underscore@1.2.4", + "_from": "underscore@1.2.x" +} diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/raw/underscore.psd b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/raw/underscore.psd new file mode 100644 index 0000000000000000000000000000000000000000..73ad2d7c8eebce69b4f46f31c0a1a8c2d523bc0d GIT binary patch literal 215540 zcmeEv2Vfk<)&EFxuQDY-0^vdu0*UQgow{+6EV+SY3(H`@6rZKFbog|4xjVVQ-v~lN zk}nBP`4W;)6d<%vOec^Kk@AIn3E(fGLx@tS24kAst^NPrY@NN`y=GIAm3_CjGxKKN zym{}TM~>t?sMu@a{KmEkgnv664HQH*}$uj9zN*$Y~ReU{&p^KZ)+&-)A|%>Lf= zS?dzv_SJGauu|@f#AY0`?HB#W1R@gL zs-}jfhNiSjHI;$t%Bhvrp_)+DVi^juu_^*Q8!Jho>o;6(Eg5@IR?L`Cp%V6 zThcsNYY=xcj_FFL6VrmhwQJW-U0XRdp6m=()YsPsrBE;wnt~EjQtM;s@VY6n)Th-- z^m>}*RC_X#NJrwa0M#2_8ShEYIOZ5?$oSKG)}1gKilwIVUQTU~cL&#n6Tyn9QqZUw zfYU*hX-!EvoQ@}##^ceMYTsMC;^}y*E1n26wN(XL!tIe5-A@nNi<|A6HObB4v^+B; zRfMKU6;q_Dr4_Z)K%!9n6i`W$ES0DwZFRI@G&;iRu)UU03UNF-+NZ6G zC%ePxnc+kt8fg#HkO$YqI<$dI=p!>dXcpbySYwo1S`5S;nW(!v=)`=f^qe)|OO4MR zAyZ4&C*d?tR9jP1Db;h%5H)PT zg5e`LE!<9gH?y5IgWNGaD5RQb*})D#J7Sg6v=9s_)p+tpY=4YcR!gD?t!Ot? zKjI^%&TgW8p<7xudt|?v&FRQ0bG0N`k(86UilNkLFrYA@bAx$i#q?lCnmGwf=Xs}* zAr$T5h7K%B`~@rMTLZOb+d)tF2DN6}K~2b0Vv+RBkk*^#cV5(~- zhpKDwsl%s!G8UwhL$y`-Ag!)ya&@JIPX&G>y{>X{sJ>=$rBpGwvZ4;3`pMNHd@4go zLp`+;J}6sD_tnV9r?RRtbV5yIZH-h@U0Yi}x4Jqsx30daR%#AaG}q6muWqiag0;=5 zC}5_cz2EpiUKerU1Io$d14^CN8d)btPiv0A%ukUKTUlQ-J?NNYp|Y8Ox(Qi>PC91T z0h{8{c(M(C33+Bsb#-O624+dNLkMK6tf{N1np`E-*GT*uLseT5QolnyMg6WsdUb_b zrfM=l)$(r)D~1dy_(n=qUA4r&F{Jp70mV01ptceWLfFi}-S6>{kt*y3AFspY@x=(`?x;+vPLug34%5T)0G;qVQ%tg5I-o%Btx z^>qYWUq@x?>!?h9Jug#V!GBY2^}M$FdTOzr*I7@Pz`am28LT@Q>^`|>a_!{0$@P;# znu?0a6`{!$m6I!~CWDnxsG@c<_&$WPkOl|?e{)rbF{$}Mr?mGy0NTxUOOAvnJjN)P2=3w67P^_R!$E(C3_;R z$}Id0`_F$z>ym_pMJZZ~EABeRA0d;(hCr%bPy7T%TMvf_UHhyyiyKDJz+TsDGu-}>b8rjISxCzp*N z-nTxvyy;`h^~q%;i1)2eE^qqSa(!~y2;zO~lgpbvwp^cFHiCHH`sDJak1f|HmyICa zw?4VN>0`_F$z>ym_pK+n#+c_%$T1u`u@&WPx4yd<@clcH@-?Z)aTR_GR7DuYLxJ@gS^yy7F@Lo zIZ=F%;3*|q%GE#mv5^wum7Rfay-YPvnPR5!I(Oopu>@m^<6qgUlD}&(wO>0{iO3pCh?M^cnVPwX{8P7M;nnEq%w9RK3YEA z#(JVrTsYjR$y6*Fk9FdnpJ*b-!Yfze>nC|d8F_p%R&5p)ev{EB^e<~@pl(;Ap=P{IL!+G?oWVl;y zOUsGHE6;65zIHT=)=eTc^+Zn6xgc6ghahomha8IoQ!}~rG%CxhTS7+##CujY%tVs< zH!O{(uySvLfLxjw)zJfF@Hkh_wH=mluWiiQcyjfE*wX!l-B_w`aZft03cV0y3!7qT z3%gA0jK)`nqf3)G`eq>xfjBj~Fr|{1jqVDkTH-_+&V-yFs(9X9d}s0lmm?cL9Fppi zWsZF`5|bD6b7oR{8@$F(@*0W5RGIoX{VLs#FOrGOR_I)xQ7gkKc@Y?G>73J+;(j`cac5<=35I6vY;hFAb*+?+P5T|Kh{ z_v6Do>G(W3MiL`;Ac4_Y8(QHpYGF#DoCV#T0bCAr|I2XRj7E5ibc-o1sZM=x)G{N& z(e%=Ar%-A_yBv)!mDi;gq~-zFpVgU%%CoU_ z&K1${C-@wRpMPhp>O!QCW{0y9ZB$Tae96y@roTe65s=Uc2 z@H^H4C_p^VzRbpr8Z~P4sBxo5kDD}h%-BhXP8>IG;-QBheDI+MAAI@d4j~NSdNz5!^rDb|%IV%}fQdT;wboj^-qlTA_t3>9c zvSFV(sA72I$>D>K`Qk;P5r=%|>N{qC`ZI?v`Sr@ms^pjc+%)pD-)(#AA8)s(sy}wk zofjY5{Jo_ebAEGey5_LIobpfkox8sL+sAwU_3qry{r6A5a`*Rt_r#0uU3bs_Jo(b# zsjJpp@`LN|{ryufZ?B!VtaI&GFT3Hsho63B$0Sx-3T%gQoJNiqUd>VXRK-EVfWa4! zIe2*JqVF6+82oz4pWmwd%*uZxzx3UvwnN)fRd0WG1R*f;*y`W>1xQ?bSjU`GYSQvQ z4HVol_?(G?@*Epi#@n34X0bPab$$I~yYKtjD|Pq(?)lID?t6Q;_FwVhll24dK7ah> zm;U+jimydqJ9h8Dnt|`$I(Ys~@BMA#m(HtQ`o|k4R*w18MYrv^_nO_`y7$?Q-(UQ* zQuPLl*V|x6>mkpk9opJgP7EL_$7oSM?`(Gcr?ZuY|1~=Zg?1>}pI^p242Os^J zjn}sSD0cp{mn|Ist4q(SS@xZ~h92MZ_AUE9d;C#uc<_x<~({b|95 zC-3;pmiYgySupcfg{^w<`=@X0?!V={^`HFy51xJXy1};B4{P}KtKAPjvSr;5cRc-_ zAD+{4-%}6Yo4oVv7oME4XWt{qOIDxt#M`@HdFt4wcHc2^!Cez?xV-F#dycsGjVr#{ zKl}HgKmP2VH?R3+yltTK>eqX#yXOxsn|oC4(Ra~T>t5(T@6TI)e)xuYudn&!)Si|*p+a z_HpU?HN6YFZ@K0tZ@qrUuP2O)&)oLt;wN{<7jNlX{?;82d}Z7puY2%>V}JkjifSI#^5sV((CKjP3OV{g9utkduK^7%J>?74Hc|9I2( zJr_K>JAKGyKihZped&RlADpqh{mK9S)A(Ie&cCvI-OnGr=?9_9-$>oMXVIMd>z>$f z!$5b>?j61J-@9c_{K=zlj*hGT`yH2^`uFWG-hTi6pSb9S`*%H>c;v2K7hI>XpY9#} z#>Ta$J@ncOV>b<+_~u=2^qjNti65SJ&bJ>q^Wx<W+P9-~Z&DSKaj0_S+J-U4PdxHyrlh!>d={Qa!Ze{(&Dp@!kL1^M&(v zoW6O}^iNFdT-dYj$?%&qzklDf2kzSRhev)oV)xMHp^8_p`No51%<8-E@xd9h=AYGh z!#_5h^_#nHeJ{G^A6JC_6nguPhi^FLnXPHL=8Opvwwaj@xYFg zUt3o*^RXYzt^U~V_}$OH+VRZm&+R?;%Jy3xxc>BwryOzgs)0KJO@0{0W zEPws%-mR0*xO3mQ$-$GJjBWkJty`9FSJ?9QlV{%c^f~kI`rMYMe*aWO;~yS6|BR=` zela>@d))(nz2Xb~r~K(24A6ap3vcdS@ZaA(a?w}L+4;-6ev*Er^M%JRcxvy7iTtykT5>jRJe?S`9v@x)($@v~?C_yXVwxd++R{&OZCo|9I)qr(<&$ov`oBzMbdZdCPrI zC~U%IO^^NNq1Wo`k9hj&Z!~O~(RlsyS3UR4=tuwf-1r}S?5@Awwfk4|p4{>BzvTD6 za7W+Zm)`jC;ZKKuKJ8DD4fkxgZ|m0Iy|CpU_f5F@>^;f;d5dq@{kh#k-#xKc`M>uj zUv=GJZ0D*|Pd)TkKl<~%&$iwB^Yt_S_Vh6qyzpv!;}aFVTem3eoz;&dXTALNb5mc~ zzV&a{zC3gD!T101=TdT0`XPx%dx^73hy9C!5F zPb%!izwEpJ|6cCxTKT`*USFoL@11>?!rG7C(W@}|FABS3u! z<$GUL*#9g$ta>PR^uK0azNc-=vkJRs-8tJ|I%n5s7C(RGgwE}kOy0ShuzLEk-e(@( zH=wX*(?(Ti9(muc|5ez3-8Oag-oMWJ{f5RD*8ZgA!F}_}N1T7(CvJZH-fh?4JmH?f zx^uRFr|aDd~f&ak6*HE!<1;>i+B8EUH`s|dtZKDVI83L?eV?O z_rCGtQzpE0_OE^oG#(v1w{!b#hg_wwuA3Eh;;{<5qW{zd6J{(MG55lK*WC2y1w+tY%=(v6mV3+_?7m!R-_8{^Wy$^WS~qy!BW0wk#fMS+?cq)6Q$ZIsDp&&g1{PZq`{qUE)Mo)U5sU7O>-`?{1uO>I1vtsv-`CEEV zePHdP*ijG0Crr?*l;EvXTCC~qD?-iHNIChpC-SG73cW!#CXK3T!ZuwWwrk^c6 z=#hm(eJ9`j_3mX$UU+QgQ?EXJ{uRG$*K6;3ruW@XZ~ft(S?6vWT>bnn-uTW5&)>IZ z;HA&DzIn>)Zyc>WtJ>3_;^yKh_~uKLiL8-zusBsGbxl_j4rexF-%oK^-VdPxPm zRE*IYIaw0ozsc_Z_E#f(B};h!6rcZNWA`VY4&0a6YA z$EShM1OJ&kU{M|=q|8kpWfhI^86A0mrCEI-T4TCXXFy zFL>4iy3dhosCmhlaKEHO%wL*}rF4hbm{pOeJeMEdtULbZ8Y!rIc0~&T!pXgItbKiRB;6$^8>5}@L#DfMwi)+BPP8Rc zA2i?B;SSKunY^O04xO$7E%ox4 zY1qMLS>B)7(H?y}got{GEqh)Pj#AC}O8E!b@|VaRmRvh@8&3SwYp40f()fbzaHrfF zPIn0&%0o^`$vmeqWj3Ufd>nPvvxBq&b!cOBZFqgEv7@6gnr=*|laZA@X<6rk@kUA$ z{NEbt#9iZ>qVbg62xn@zlXDHy*r++NcAP&RgM*)MDN))%#5Zl>HAwZug|>DkG{qC^ z#f}gej%e;tj}MorE^@-pmb*}+v7JMOJ~lty9o6%j;@t^&O>ru@=J+3>VN|MJ56^NX z${fTg+t#ykRXo}uCoRtZku1WxS(tUgZd11|CQ&Z6ihZ4xktlY)965?8H{L9Y!|3(F znqa1$vS`6+I{hv6E{nuE;%g0B9}Mqqq9@$~-*Y4ZSp{W`yu(#`yHaDc*839edWd$_ zsdKP)uT#y9T12J8_~wCYQ+gFlt5UD}NbNqOYE(H%=W2uY204(k5WF>KU0OX5(dcsd zy!b+#Dya`alyflZV&!}kTf&KjarFRttzj~9$LV?GgV)jtX5xZad$gy6YU4-S>&+je zrJo@uq2iJ_C7riV>^EXT4Eu>(A8Cf(*oD}BniC^&NNIJ`@Q+o;?KFM+f!aIh}p&Fakr-)Yhi+FKMEM7#Zr8F*-WkKBm9h zK<&Gy9vFq@#zGr4_278;?gdNq21X)n&S?wg>h~jXkJno0w+E}YZTuj9;>J^!EYS1D za?RZu$1az?A&o}Z1Rbl4oQcaYFUc*DSfo1~wKVcEo{og2@wP~Z+#XH}VmA_`rc*i% zit<_M8fuG;>P}Uy#kG``{`7Z@ed9(pmZz&f=v=N=T;K z5kN8ZTuc*G-_rGMU5w3rh?VI3Y+9|xMNfZ-dX2w^X7$Q|t%VY7>AHnPN3v1yI~~yM zf(h7{j=`xwJJTuF4rf9Vzo)WuwTWt68k?W5g=mvF2CDjF~=t z%;=z&5ou448BGaD>4+d!1Hbs~=pfY>IBrPs=-c??QGDi1f^H2b!=1@+qH9S{%&enX z-KRwwp@4L)a!dI(3LKyuJ!^DOgW~#>T7QNe}gL5OvRGOwXb;2VYRkTM3VZJ8QnaP*~GZXpbq(&DBRnWP^Jif@9 z+K7OJ`RfySVFv8uKswnY>rEP|9n0d$j<(2oa-dGnYfZ{(cA(Noil@@{w5E70CAZ_~ z>@`~PR3N06KLbW&pt8p7B5#F4n_`_9qp5X#+$yG4R_cQ{I=B!^HJKlvtQOJ-(i}|i z=)5SpLo`s!(CF(QjSEHxsn-kTFbOI$4V<(jGFi+~nU9x6P`Op%Xv!eYY=jx5!kyt{ zL`**kc1wJ9&*CK1lUW7cUXxr;14}j(Z2P1YNaa6`0fE~7=W5<iAbn;nxz`S1 zg3)G<0NrsGuC6vYZf>||-E1sCtfK)yq%MHH7ikyMtvq9u6P=H0LuSpU)z}8}5M(v8 zbel0Fg9mL9qZvX^EuJJNW0YuZQBN}p&ZY$<*sHB8vI?Cx8>4PFg%cLBqZGZk*%F^l zsRpsjZCJA66>42r&v$l-Sqmeb;dD<@P6?Pbo5`ZMXb3h(k}`i~5N9-+4uVTl2q3iL ztTP@D_aW_W>WqaD#U3oyO~e<)XXD*Nt3}*kIYzl%s_7b?AE`AGZDMl%7d$l#pM!O- zm@3s)RfhsoaXPsaG8B&{qJRfQ;;SLXILAG|%5@b)S6vO6)e^>YqhWEF)wX!DKulhk zrV6pwr<;SQcQA-W0gWnOc@Ps;*Hl$&cn6!hFqyYQpPGYWFx31A7FUaUx>v%;5?eVb zoa%~ngbf-7n#sc z&&}i&^yg;F+Uk8Xw5L?~b8}QCmj?yn`*X8DH~Vw5x-RtB%|r)(ZuaNq56THPrP809 z{ka)RNOQUQbMr@fZuU)W+6wVaZC{*CtIBtSk$U${ZQs=Px2QhI{pKkZ#-5GW5;e9+5B}l=!3u3F{NKk#7YD#Kx z%nWh~wspnVQb9`+-SX(MiaIs6io@xFUm-2j5O*9w;c$vabq4X+!CZWU|{$SETS zi&^TS6+bGDSV|sZml0`9Qc1CQT0KTLxwK~1glIK-un(sMcJn$VOH8vKLWUZ}LKRx8 z23OJQ!d@ukgqltTJu*|jYU#X1{+qt&gYi%CXF{4S@#R_oES^K*W2w?ANKat#DD%t* z@lV17Uok|`$JuJugXa{&h^p_Pi1X3GMR6YXOn_2}RH}?qCP;gfk1L;0j#f&fy@5jm zM+A;iMoWh(GnBKW(b8CHyfjgoB<+)iq${PXq~TJd)FjQ3=1B{rcIjg2E7Dh`OQox& zYo+U?8>E}0-%9_IUXoss-joKV?b7Aa6*x8NQ|!#+*;#A@n~cc*Y3zhgm3?Y7yG9uv zkaV07b4?fp4i6lujFJvfPEeLhqogs?IB9}Z&dxlJEobK|FDb*=wMu~9ARVNXsgNhh za)JXM8u+Z5qDK~M{X>J3DT5O^U&6J4fU8(qN793E*@&iB;n`2MP<~w^4hpu!&yAea z(;cxf$O3xQ6>7$VQEFHV`gktbjlH?D1X{36XN>@+K)uF!t0t8zcqRb|x0iMX^& zUPKQNN6lzTt__1mhVh_=`DBIdDF)jB7=&NMpKGB@+)H)ekQ}B3d1kc!a=@vs9V)zr<^D>+f&1FllZG8-9N+80Y z&oPeHNedozO`^sy9*=CruQ*y*f)+b5Q%A|9Q>PH;Rye!o(u#Sa(*pEj4cbewxo9iq z-3!L_A;)dp%c z^SL?Rjz?c&Y2A#*8iosnu7}+Q)3>1&nEt*E?c30JY&laH+|~)c4Xw^Zz71{qMg+4^ ze-K!=3Vj<|df6v{Ul(sf&z#ARsxc3- z8MZdekEWrcSVz-uzFyVNQZW;dJBo7k*FVs2{wO#db%RX(Zz5&1VtJ6Dr`Ff-lW_Dr zTo18jFQ%jSY*mb*GE3rg`ka2G3myGJwdlvaSZbu7be4^Fl28D*<2_DhQOjzl3Ss-C zgTtDq3Js_G5B;e^Gp32B3Vl&Mp68*nE=2bo{`gr=bdC`IN;w1I!QA|%Q6xZ*mM>Y&UNbKOWhtUu4i(}>*qVAE^_5d4RpzZma##65T0yJK<1t+BH3X$GZMgX`?^$E~LizUr%SW)93|u#-qGYW302`Y`qA2mrBP};C0akGnqB5?$#<@ z$I;ibRz`c0M)^bZR5}7ICF@9-sp_#``nh@xC&spkG-&He5DmEAThtxUPbH(1=4c01 zCO4Z}T~l&RKs%hXRIH;Z*-9hM>!9h!PM=eg>2_;ccIbxq-_=I(twUSV#`9C;uyN8Z zreU3+(|jeb*QU=S+Ok?Nph{h$VbFwN-nM+f4ms-NGgCF3|> zsicImEQt{}aJ?#CmKy5ri3V6nzYeU`*%_tQ>8N+Jb$&eguO3uOzy%m%fTBYw^|Xiz z^@VIu=%N*DrM!k%XAuXZeh`lM5O&mzfhC6$Pem{7@8^>s)hFg~==dr+lkga-neJ(R zRL?a;ih3|Q&N)>7DBtxALud=0ug`IrXBhJLFMjB?apOCpHa_>JSI+vz|C{{Kyqg~G z3jOF0IxUQA4%(Pra#u1=gUDGM4@=>kO8{A@PIU}}Q#(SZ4Dxi-mK)3ORSSa3@zG3# zQza@k1=tR;4KA9E-pXUpo%Nv@N*EJmZdFwPUHMBMaFGM1>y{0?0 z8b2Sxhua0}d7Ze+{2P^-WTXs(^5mErDe8|>_V{^m77yH!aaD5^c?!?5UQ5}|$G^ZR z#eP+Ds5Z*6UU^?MtxM;ij>9Hh7v^%>u%nY>1N@}X1Y6I!QPaLDM2qozQ$I|g`wzYL zZBpOXVw@mblQ`thp)Zem==5W2&S;mvWg7!%Lq4Oa6TZt@k8|^vHOQQ~d8Ee8M70CT z#b-8r`a%sk-6CyR^^?&JNTasj7cOQ$Zsojcy{cUN#iPE)bF5dDS1E;f)p}KPs20kx zUaeeArtU}^7pwX1+&lgw!M)Aj;{7nVcjXhur4QeIjD>sawV{TkuAe&1F6C*fxR$w; z8?TpAZ&gnP7?uqu{Yig0b8oq>i;u(0mpkQ-;{i-{Mn8nBx|V2~_pk7ofYV0%(q+h+ zCami8Go4W&?^T_CKr~gJ)2hybg}yV!r?2E_$sE^jCF6 zg;Zgyy3c@+zy zp?`z?+rRpBaN`F|Hy;v?Wux41^wWJ=w(2mSXMKJ4QPT-N&-y(35#-tb$1Y;uX1`)r zvv0BgVwbS5u&=T&u`lCu3I2Tz|NaY~Z?W&O3$P{m4W54qyBPm2L8(jF*Lm*cY!iDD zd6%&TYyz98{hP!NW0TmSN&}O&u(I-ohQJOs)Ubt7!VWCZ-fLjxuQMiXZ`g^HT}T;3 z%B!rjp|@{ee_3B|Yv46jDkXaN_Lpt!Z7AQ$$^t9;`q{R9N?CtjBCw6aGU-jm0&g_D z!RvjS05$@8Q|}6C4|Wk*KiY0klwP!rDC*aF5?XI~M=9Ifx1#(l#`?D_J5de@G`y>n z_HS(6#!Ab3w{2HS2m0uDL*KSRrF3&|;2l=d(7z9bOE#}~8*uL_WdoZMfp;0}eM3R} zsN`K%vSMJjvQHVlZPN;D71$6c*;cNWBMjbDN;WmTBeegPQo60T9F-){Np!S-x55T^ zvwIY_ncr?4WF-=?DB0G}HV*ZcZtO?VlFbsZ=zmKo>2Dacpo6jv1ACQyAle>OEs6M` ziA_2>M5Df)4P`5OHvyoeKkyza?N^kY+Sq8>rM(+BqqPAEjr0wHSStd1*og9m-pz{A z{~jwT-?$Hn328SQfuY)_D6QMss1>+w>ysGUjltQt4a1PoE2rkDryIAkvR*|=Y@=ZW z8MiaG0@V*Bq`la?9odlBgeuBK?Dt|gxALSN>IkFKKw@ABlvy#TBG0y|IfFo_m#_fe z4cmxoE0yhS1$hFS0nmprELowoTC%BpAKOWN0j7OwP3T%{Ki#4!;Mwq;)-G#BV(%`t zmkldl(Q6xSMH$A?e$$HN+h~YLumW$0Bl_wnzRQM}Z&s9n@?C6L17Z3S8y+B(8(!kH zU@P{p?Z`q>LInlqfJQ8_(~8ngAc7(*cCsD3RfG8zhyW01^z9Y_cISjD{W^Debqg2(Umit-t~hD_&A*0Fuyv2MCK{XoLoVpir17W=Ep| zQtp5TG>JOYZ!-%q-ry|_WTJugdsQ?VURDR_U;F~`c!!ns8K`fA&UL_`*9n9EA+QwT z|Bi?P?_L8`2Rda)3wmeb&%P zKmZLqfUBq`FfX9m&C)I>YM^t-#B5=a4YYusLKsWYg29)-164y4(8N$Ou;O))?4KMu zz>xq^wPA$H3=o9{YV5!~wGFAgpt1u!c59=u-G)dn7e@gRXz&$O{SH>rfawM^X*uRX zYW|-(M*lY~c;O#FQq+(rp_9`_XTbeXMmSZ_+ZoQh!yUQM0rO1tl!Q z)4QveVQ%K#-`QKTiHxbu64{%H&17}KDsUvtPR-6^y@R~IzPEZ+`d|iMu?h51Fu*o* zS0f2p-{gT2><`xPHZ{G4tg`{K?iw@z zg3i$B>~b8P(tcHL$P#Cm&0t``5bOhIHGl`irr(7X45l#~rey=`BjS}0Ikl?}#BN)| zeOz7Y4O2VB^(!D0|ALtGqZ^w+MA9UX5>g=LTxiP`GC&9nV~W&P%yGR24L~*)0I!t6 zx@H+9P={-i9TU`LS7E3dsfm9=aJON|cB`6$3fj~cR8<2o!YV<)Vu+291}Hrf35*$4 zt@4M-muLpvrG6Ru3w1+BY%BjK=u0vSYM@TiqkW(qM`Q&i8I>9s-c4M-1w8h#;oNp4 zG&Za3pvfnUHE6eO0hLoUJTSMRMUB1&9;kXF+W80X;wE5$hG zXs6m|XnOz^sF-N-xrG6RUW`#$A5cXTo46@V%|h+-!BE9V8w?nH4QRk-@M-LWW(f(@ zh<0c&HlkvV1n9C+M?&RIj31iKzybvmud~ttvV8~%$TX5*`B?}79MDW}1`aA?qFD_I z0>oVa1mH*jDa_ub$koho7aRbvS?y<^io{!N6o3*8Na%yH)mYC^ea2{@V)S_vTE$RF zWO!{;DM9dj8L$F%sLKGd#*r(5vb`cDP(@-GLk$gBY;3~CK!Xnma&$DXCL$@sTw_B+ zzQJpqKfPyrf0p$U*4H|&DYT;~SBZ;`I-#}!W zy727FSSAv84ge3-j7f%@P*|MN5_@y`ZmiCTP*?#H`WWj0PzwsziiR$x3Ln?Lx6lV* z4qJgZ;!QRJfC&?iw-`%sEp0;tb)#VKE1K5YsV<#qov5O;2kX_cJ}$N@DqJ^+w$~PB zYA!aMu;_z|<>>UP7AVl65gIVa0z0A=RuUWrw#7V*y9OGH*Hn1eNxZ@VtmV~}G<4t& zAPMSh)?i_wqYDrtP9Cf$TKoITbt411ooqDd_93k%=;D&{UNA?Wx>DE*%3%7`IR{>g z2AazmP^TUnER1GA2WZriK6s3H6`1tM+<}$I(`eEwDW`7rVs71qmdSHMWvC*IKme^m z?QuL`Wt>Ab17jDAHF#Fwuvq~Rnh*D>6_*WcY?ZLKYJg7&&>PkD)fM>p+S!YVupzOr zpSY-`9L7=UrbGiYIHU!BBoyC-WewF2rtei~Q9zfzZN0lyLv@=<^<8Wv%JlcHXh4l6 zQfmo$uHg9^Vz@2udk4)nsH^2SR8dDiSOXk*0~-V69MqkP+{{2z5UGK^Y#W(M+ZddL zZ((``+T@!3I9+#ZUwio5-sPyZQ}Q+S&(iCw!SJ%87HyZ?~IQ{1(UQ zP1WB~zE{JEE4Ga~mCDLj^bG)7frFG*Ev12m#J=8=2I;@qBSi9s#NOVL72y1mK*OG1 z_<4_xy5h= z^xG>{V!Woo_F>3KS{n3(>se{<=1oJrC7XyLSG=l~yB=NKg&|t;ijhz%^+6aoab89u zdtdg`srMIYDEL=({69!KyicQk@J0BygMa(i51tP1)2JVN5&rGq-~RQ3rvoeWuLRGu zWd57@B_5-IH^i#|X2`SEZtj1T&7u3rwFLP!9pc z;nMWmI5-c-SzGV<4GzVW!`(~6odG)5J4%N+@xw%e3p#M-USw4SQMm+U9DM6_Mq)ra zSTZnkruM)1_OhRusI@BX&sM$8P|R%aENa>~v$-kWAuo+LMe)!nolR&ZLCR?ebkZJ= zD&+2!I7fxU@CsVOi3H9~HQ?xE?4jzRYLsolGlpoESI?7chiaXY>xb%{l1~^q!6|vh z&-DY;xKcS=4)I>aG)sAi~!Cx^t*sT-k%Zu}-DOOXHoA zCrT5Yk|#-%oRSZf4s}RYCMs$rmBQ#KXDes((qb|W##i~_oRYsPebp)XQt48sztBrkZy2FzDc^tDfze3Z=I6=CH>1O`6cNkr{q_pSDcdHl-_ho#;XpTlJ`nO zPRYZi;SR}4iBiIot3+lyS~=P&8EX^*tWAvsVUP?eHcTA84zDy&AVq*N;9 zm59lBRfMVsYsJzfl8U#OjMHRQk*X6)2R<7(me(yNE5npwJh@&d&8}rCpNPqL6NEZw zw&dZ8O4tfMyBl*IyM|rEE4QcL&Te-~58#w+$MjI3$|+sK{-ByJ&au*LNmZ#8qB@kC zB~_=|)8|Ta)p~5@=S%Y)(@&IEI;M9>Uv^BtM7qQ={cF;<9Md;S-*ZY=$`w^_SJ+hA zHIhbWk%gt7N=j_KQ^cb(Eh zfl!lU`h_8lf5d);{x77;eTA4_$tssQ)l>P!$~BJZ7goODl)i}dUFVbzHq?waQOxoF zl?&AJqCg`MS8+-Y92q#$G5x5(QI>RW$EvpbSy)*_QVE<(v@nvwOKJo&7UG0bqSd=J zyfP~1W$)&7D6!2pHcf2c!cSaPPv9pF!GGBd=h-se44q2m`0qvL# ztJEtS)~QD}S*c#x7!HqYGG@K9VbpqML#caZV}|g`#=PQ{4Wn1fR$nF}(iC={NA3*I z+_SuL$*^>{Ov?ykI0NP|MA4pL`@_{UPY;3ZTPn)7(n2=K| z^yx^OH2CsERDs|`Q8aP`w@qeMj$B?<1eaG8#jI6DF)Q%SPEwGTGrI##0iT_w4)8Xj z!jN(>KB{d*&2PS}cC`_7vxTm_V-B-zwN3Tp+qS3r*Lc;vZE;L&ZJYYv5pQukOxWCd zEo#1ep+(JSLg%7&s{^9?%NN?F1M>#=vNUwsxsRB)rIB^O;Z8!`hMAo=^2M>6O$X%N zx*N;oHtZF-@tm94QRApPYP@xaDMJo+V~w}$Yp@1By3tV+@EiqqFi&Z(1spzZoL6I0 z|Kixu0C?FdH8xvCgw|ID4n6f0Rrj8H%cuvOr*L|}iPlZd-SZYlkM;`W0B-@*+QZ7% zVFm`Hdx~E+U{~SefSv|_t)t}C<|=s(wsUPxk_SRK!sbGJH&{;@%%Z+)i;}_GoMg}q z?_31Y4K^ofbOp{uv|NEbr#q8n9f#Srd~gqbUPfv=b*^} zTp%d{=|zxii(Y_>Q<{i1DRM7m4sg+3kO}U>uz)O3odXj8tt;((8nvzQ^8zh=hzezQ z>Z{lA(%5+DbOPTG4DYh7=)SMW(aK_QV^^ps&a22y8G~~jraLsBl{8N9wh0gH1qhWl;v9f|Wt2IAstjZb(7}D}zwM$^e8eR2cxYz?lzlg-(40THxGAprSG`mrc3s zoe;dJ4RV9Gv%K>jAqY~${8#WUA(|CwVw1FNTBx{vLbP7!{8w2p%Y)E`vOGWwWqE)W zI{yK*P?iU%IJ_pyl6K}34KLuhrXikm<9H8nJHtC~7otx^Fnm?PI=;BAMqpjkv|Cj$ z!&eo|@E~-d3=hyk86Kd8GCV*FWq5$PF?>!s9`J4)?*(sXdFRbspjHIS+qYv)O>JTZ zbgW$ zAYC@Y#fu$lvg&eg=t9{M16~w60^UtAn}eRo&USWm-ZaA=xEniy8tQ*ulPYHRN}cxy zD%>{+Tr1TZ3AQHX4tZ51CU?*?&o(yDpOoeyyZU3fc|4|2iDxN+yb)q|1m*{8Gb{207AJ2JSm?9E1`b?nqG2L}XX~_W zrI{zNXwu{fEE=JC0=q3WiCkIxEczjwTZZmZ|J$r3XCEZoJsulF-Ut=!fh^7eS)Bi| zVE1Fe-bau)+fveH#}AOAh-9u<+#w6}#Gp-4IPz&zlnfKnYo(yak)mNyHgW^Eak;bO z5iXvBxx6^%VR6304A+(uO*~fI8Lq7y;cY~P_2WOMz$bKi3bWd_ed4T!F@LKd!8~c`KWz}eSbB<>Hkb|rVzW_l9+8|Zc&GL}rO5+NPZltl)nOwA z#PJlOY{13X?arQ4yW`ZE>X?LVE=-!h{KpOK>vPLG$B|xQ++BXO_MZ4m&T(uwC)siv z<(ve}6*w0ua|O;()SUaAqo_Fp7b9xU`w8yb3E9`|{__SnUluAycLupES3%+em&kw= zO*?ailf6yRs>=sb6pnl#Majs7ger2|&PQKG(Z~tfX36=_8$f9-$7XD{&0H5&^`AG$ zB3J(N2Acm>U$Q{8c?rG$yn(*mMsf*a6{^q)v_OqcparUQ0`(eR%|>w3=>%T9QpeKG z$wP-^FVwPfp8vc7oxA3+cLf$Ll+*m@4T70wi_2UKG8e2209yDE6|4-hS}~VB z5bCg~4RV9G*?8!=qdLGAOTpV9sIyRd7PsAphQ&2qCi{?%b=z78c!8E4AjNfmX2WiL z3qlvTo2!{8cH^`mgLFhsm z9-sxT;AwaZWq5!VYVZNnjp1|B@ql;ZcrSQ6%R6t%0<|Jo-hbWz(}-~#Stk2?DKh_g z1BVy^aC#B!Xx}3=2gDQTwhg^vqxeI96hHK!5id<|&;rfuie{NcZBz<48oigHpr-EJT#Hnr+U<6GUd;s}uR z(8tY4w|mt@Xx(0Q2s`%_IL*v;0P~hK4>(T|^MLb|Ee|+Pq4I$9lqL^2PchQq5Pe~D z-cgKDLDBd&5%Qzz)mIAohxmIeS)C)ya}gBR!1!FG#T7V5k#R=bbKWuK%>rx_89zE6 z1G5~_B%tDz=e4LiT~CWOkSX( zeV-R-;X_oY7n1twHM~S751mfnqTQ0&Uk7lT;o?WfTc%4pZJaj_DG=F%MfGJe3?heZ z9RL@~X?}FPA04l{ZY(To=z2doKEuI;jisXIzk)a5&~TyiAGW3no&Nw@===xJLbVb= z#dUk;EaW!V1GJd=58&ebC%P+Lrcb+$cix6WpNi1&esp~9OaMX`%J2X!l;HtdD8mD^ zP=*Jn8^h^m z!x|lLU0d07ByF%9$nf~AO^e34`dZd_c%WrBO7F0SM9g)WL)Y^%9^+jd*a>4WXiZ`)F? zkVtu|-JxdPjPgU}b2^m|&Zh$17Jw8P-ZXRdfp>A30a9f4d>}69WL+H*PM)X2O4>bn^%LL=hu4zdWo1PpqFrY0(yy+C!iN67=Q@NaM(W25;pGw zZ4;+L;^wV2Tf&QV`^oz_`mDe?k+VKIZ2mW zuX7VISLmF?#T7aynQ?_KYP54+%Q}+WX65HJU^eL~B!u2701mzd|AhIR*0O#K{f9b+ zJ`0oA7aCAlUsP~$eNnMheh|Ip4t8<%{09cnXJK>9%i`>4dXfl|J}$Hbq-e^Bkl9Qb zfQz<_2(CBownzZDA4PBISN9=u-MiNb>;dXEyacXWiw=fAhR0^RWDc(bxXpI)qv$Q9 zwbQ1cD0=I#Iaqdn7`-JrCYyvHG+cDkWwN-NZ~;_Y(c}eMsKQ38;#wxJRz+=KE=6+L zuRw2Y>L53GJI_0B%whXRba-a=OV>3{JYVqE9NHC$BDR}#2K3|T;TqSEZ6j%O6PLnw z=!i86<#~XL!)x-at{QZd}8ZXS$6KbxEGNx zbXJYd=k<(@LK<;5g>DWSC#&Ob7{R-#W-oZIANf~iD81!)W*QskQ2NtZn5||#teeGI z44?V9k0FJp`oZ%UZ9jNkJx;%IRoV}pH(oB_Kn*{5-VdJ72MUlB-PPs-oZ;`WyV!DvD~61I@Vstv zID6qToN&1hi_KKY15mV7@&NSW1S{J*xH-{LFL`o-wuzG;JkM8t^!WUNJa^tY7><$L zUQ=3DV4GR*!hWs+?4oI(FSKah=L?;a;J9L*tMoXMJZI^#K-;9p51vD|!d|(IATUD0D6{Ih*{owhW0-F$yUZBGUkfK)4 zWE&TT1Ei?Y^MNdo$7dmKd_Qo!%d4L&isQVB;yAA&J7tJEd}qdqG=R@W z8Yg(WHt>Vz)%|{27hxtT^ii6S%~hAFnO$Zfv=JI`a|sZgE=XrVk0(87nP;299DiZh_QpPV3$^(G>c;W8>`D_?y0N?$yq)L$ z;Q7o+%KqByOa?Y=MvE^{cV=K%v)M-u>rV@Gw)w&vI;#Y6aHmeY3Xm5+S@3oh1uu9z zKRWN{fz^xA!S)?Jb3jeh{NQ=FAoODR5#yFkqr329#=f1?pm7cAhIiro$e9u%VmpUE zr{MW{Y&}BeyAdp(W+?>G`@!^B&!Ji@cU&I9#bhvJnIIQ{) zpX$Ic!a2C*v*byVlzPVY+GEz zVb8vzPvyxf0yZGoURzG|m z)`F82VSfXmO_gSu_^R>V8S6%k3GHQr=!0TEcEN<^1DdsMk;U_c7TMeeZ7On$?PTKZ z>WtHHcCx%oXmNAGY&kcYiT)-NIyahmnhRMeZqtGJHtu;Ow%&WY#cI;crbqK`T~wxd zgBQnc-iAYV%Db_g*Rb2vs-LHRn5WFv0#$t6 z_~$^z&U>KjDR3Hb9eV05X&!Lm9GUZgc*~YYd!9n&0p}@A9&ny4pur(#*kR)kjP5B! zj=(k%DkNlHXAZYW=3FS~2Ac~N-C#W_nMENT$awi|^vXq|-1?l8Sh)hb89O%n(_x>e z)^5r>3#Mz!#f-D}%wuxBGuk}ax3ZYR(J*_}YWhF3GV+;lpDi*`#UsT{<`X1Mq#%v+{QJ8hgd4xv)T^`}Vp zEXp8Murdf0rwr`-cOurrY@W)%kCD&eiJAY<82KzLU-0f5l(LtC%sT%SxBrIL3!VQ8 z-ho4#(CdZGe}(VCQLBZTC;%;V{sXAj@MfF;04~mdqPxKb+^*xDx8cyIB6PeTA)h(9 zxS5I|bfF9n&_WG9fELQ|04iuKs!2_OVMi%qPKbGDS)L@&pvy)C#t9gTqYBe`-n_6}D(%GGK zwyHf%A-j*x8P+gn^jX60n#&o?lZJj=eE?%A&XGA&)@GyR4kubDxx(ZlHSGIw*4lUB=#z z<2SahJ$T%Y<*N@|OI0OO|ymemiHg6sFew+@%L9*!L5viGl<^4E*kz6EaZo&dW7r5m|V^rXt zAAuIi@&GMxNkgr=vAn(-^04;^+>PTs!0in0yzPfR6~XX+9DnW%4?-8p@Bl58;Q?AG z!vnNXh6kt{!+Ysyeceh->BjM1@OGB>b&W_GI zgy8fdG_ZY-(5YwGJ$3V!q4DfJ^M)4%-E5zxrmVKQAIDz+JAz@d4_fA!b9UrkaGluB zxwq}fImhwa&$ajC_PM9kkK6a-_E)9t=lJ_^`}~L!^&ERra{jsYi02knl(<=epgUCPI5VRO~O0%n#PK+{zPJw8=zZq0f$E zWm~U_;MqEDTe0N{TnwAIuG(_pPuC?|PQaoY-R!eUEbbmLBHe6;wX-V^UXy|YnhSR1 z6?Yy-amR7^Vf)@O357fGGW>VuD#vU6r>`F~{CBy5+qm4>e+N%V!CdZ#?fYT-e%QVr zwqH!#y{EO2#ju21tr)u$;BHQ0ZgFI9-PPvMK*@cjJ4|4F*c7s}JJ0UTGcB3yW{};P z=L~C@LHhh+_u=IX=1F}&;NK7UH(v2(^AFNfqF{7S@iSMm&cLq1#{oSJem~ydkN4M) zzjao2u1DzS=zwv4Sip0#Gx^;a*i+eN1I|&>oLeqJ()@6LKipqGSA^^rmuMb8++SEn z`N#JA$M(ZY*X?rz?2F3Z^#71dY3l;FEqXuPKO>065BJA@S`KO%J0P~bgiOwJ(dYy! znmc)c7Qye-vS{vPw#-)t;-kd2#kqfMzh%{Br;UGXzoDD4QCHw$M}YLh{g)dLthwnC zKir?5$W;I91_6|^mx9b1HCNm|AzCk#}I8wUZj(CBA?iVOa{S}k<` zL#yKOiav@g_8yT+od0qHx9fQ4?LvyIE_lBXz=cw?xUEJsEc!4qhmnZt7J>rsLK(iQ zU>y%a`{Dk}1G(&v6H~fzycfKk<^6E~jETk%_oq46R2N?CWX#TfxWAh(0%9u8Y$j#- ztd?cV72rkbasSwUzHTvz?#0e_?dZH|hQol|41ydY?<$=42aue1r5s(D$+ia*EIS%t z%H~Ka5e=_j7)hnE14#mFJgFe*2cH-z{BeDu46jT`;lZ0i3STx0Db*P@*JPyBQVQ=v z@T5pA6<^)cCZ`1iQ+9-@jYZ*Ze&jt{#Nv1bf_%Is6k}1mEgep#=|p@aFN)8Jb!fj& zlI4WodHe}bKzmoMQFH{b)o4rJ}Ley!A@ckpprt$ zYSzQ%voK4t4j07Or`Vatv&n2Ko5oIHv)EZ|1G^@0NZ^RTQ32^wWuF=?l}M%1aA~wO zRvIr&lqN}sN{v#JG)I~zEs)x!i>0qfUzIMEE|;#5u9U8lu9mKqu9I$%Zjyd0{Y!dD zdPRCu8kDw6d!)V6K50lPQHCp{m2t`h<>SgHl%tgy%2`(0urrTi%h~ztT6RO=@W7GM zC~1r|PMRQFrv1B zxT{zil^bvIw2U@U&w*}4pFJ8CJZNC+_#x;rI$UUXE#fE0gup{Sj}*WoA4wi~A62lb zOxx1yqjFo9ET{9=r%BcgxahL-_r z$l%;?&$`+1Xh&dGIGU2x`vvK6G}5l8H1?$93*~SJ>D_d)2W9j-vVns0`r{pN~c3W3uRhqlhf=yjv6u@IeOXBHpIuehm z$<+8sax$i4-V{!xs0QkVUW4RVWd+dpxSRt$L&d(8VDybDeIXU<(hz!ye{1nj%H*vM$xfYI4x)7ERJ^Y zG1rMbmxzD{QhLJTBnXe8(eK;VhErYo&C*C39qH6>fk8~>;B({2ZW9Dd1q&k5ZlGag zEe2NIax85m%#Cz{V^owt=GJ695yw!X$I%uU6m2(3o)nIS^@df3F|wBQtX!{W>4Vf9 zNvf#fsi5G}R1XXRPGjEGlAc&&G}0L(R49KTrum+5CyE4uCx#Q@n4FRgPu?Li21zF&H38Qpr)9I%qn&WF@jUDGAk9QgPAbFv@D!nAq z*_9S^D7kTUBrt_bmRi8LJu%V@`J)akiqB5U;ng}7=0>8?rg$`-BsU!GfyP+Q<(NiD{}=`<>WZ%hX%9r*v!gQ1J{pD$jCmHG zI;4T1&drUYH>zB!81V#Mi&23{5@xenf&dn;k&~@S>b6!$1#EH1(mt<>as0QppIOGeynKkD`dc#0kA;r7$4%~8VX)cql*L*Pe4 zrVP;~vZvd-Ira`vE6 zTY&ihOrdEbEJ3UZScO<`@la>GtUUm&0#HIDe;k(IH$!3aISQg=oj5C|l3G(|Q7&r0 zfb!?BPjtyNGiZ!z+;=RCCp-8&jks&rTWSU=M+|@3yo1h9$?ZMq$QrE(XQ4CVF*#6K z!{=wc1)vq7iTyme!`2woJ6c#JC*@eXOfj%Q-Z;8OlM9@hSl^{AHGmdgZGIP zYPPN+=!)T<7e$L^t_n%eJhu%nP}%65I3nn!z8=xUlgI*cyQBv47pSE$Mqo~K%Q=~nv*q(5=q0J%R%kp}1m<3+b%3qERlzmZ zboxLL*%l`w5Gu`(gW3Zwi({?fbl1`)nA>Gk&Zjf}1)f4B! zR^65`Z3RM?D}7#P6ndP` z3sYfCo|2N=x-n&)+!F`CX{ymo0r%>DIIBs$I3dTH<2}%J9FDjva3m|<}w+V2#4q(qPUuS8w3F&ldld8_EO;oJ{AL!0^cGavb^{{Y%VxPVhf4=iyhOwxh62e?sZRdj$Gb=F1nI^hGSa}n9_0g%^4 z8y(mg%~>5CVDf$t`iS;C9Yp59Dx``JLL-G-G|~Z`N<%Ih>A*JXqLB`4qb?fBwbA`y zd4^mxQr?Zannw=iF2X|gkI3X>tAt!M(g9V2p$|eMg`72#yUFXuNO>(MoHdf8xO+aV~SRgav&@9s5gP=X!5$PYvAZM7LevtD=C&+oKR9jUY!qeMT^%5Pvpy@7E zQ5GHQEQUa8b@O;;t^q0LHf#;f=2?h^BlVd_sIwNKxW8kat82&`Ak3YiP<0*j69xMD zG0#REx;n5lXxf}-K7VQPK752HwJGFZ)Ppedcy`C1*3@UKgg|_MTJxXXIndAU_|qDn zqZ}XM@u#(XALY@fHS?f>e~)R+pVa6XVa-Z_Wl}kZ_VFV`}cqK zl)kUVUwW&aJVLJ$%zi?gY{u_eZPS@^473ay4JKQ$t+<&XaJ_w(ql=vX4B;yp>c zfr-DvhTe*Um!aXMOdZC_b+mcna;Tm9t|EHf9p6UO`)F)xq;V&DT(=uPCHy8%ggLj&>yQ+$*we|Hl`&H#K zFhXOholXgwQdK*(qOyVxz%{a(Wi_v&3P81VOl|%gVAe}-gfeP!U`WpqXp=kn`x%4! z%bVyJB11gXw@cDH54b{5Z^5w3mf$6d5&ey-B=7vxNCS?u(}I{@`GH_@&t7qC_0cSb zwpCIEMz3DNJJt2E0)=_?qzjKsMH&XB>cAP6hiN;Ig z%%!*X60UGMtZE4mkw`xquaKP^S%(+cO$p(JdTMHB-qdRS9p;&N6;o^UOlx&sAXDpb zpu5o)>E)i7dcp_wG6aQ7AM+n|2*si0Q+OGypdC%Vbf%rI@$&*&5L-k1roL=VeQTSg zolx!6>dHDC*J2%`wyrSVVakspN$C?ApJmk3QVoTtAE>3i23372sP-a1+Z*0=tze!T z28E(0TFwfg8CZW&+??)}atFN#bD_Kj$Gy_rfVb^MWs*6(VV4@$G0_H6y+zF*PQ-As z>W33C=+_S?V$kj%PQ)--eK--r!M-0(#BkvGhZ8XhL;H|ohI#tKgjw!$8{UhXS`cem zqQ7#GuO9NX>ss&h<%+sRx+AB%{H>{u&Y>_ zm9s-o|0wo(c067H)5k7l&$D;f%j{9S9A+&$&C=50>@fB%b|rh3ZD9lKUG@}9SaNg4 z>E9lcixm1d$iF}8*S*RO#9HiTbqf)W3T>swk6DVNg!g3nfb?0Nf?VVrmO zDMQTq+0EflD_WrRA*F=jLTs)U+lM40nX)K(r=`_>yau)PA*GB!?H9)O@Iqpyija=D z9mdSn8`yHt5*bvYB@VfGr@~QnIxAB9 ze^71!Y5(RxE`9V!qgY3L56bIW#v~`{n7tY=5TxEWb>Q}KKG55y{D=8;em5}KtUQPB zoA~|D@rxj>Y4@S@V|?PbPXFKJ`jwbz5anr}colfkZ~8pLXAkPa1FfrYI{(EV_9wVL%oqiHrKV9``ROR0p9? zSNhz>uN+;b4C4w;r={AQHmV-_O`EDjFtxuXc3L&6jwN9y)bO9vpIS1}qiIk@jWiF@ z+!ZfXf}9vnMV?qmtxU&mmx76k|0AX%1a{)XEf*^`WD4mZI=OdS=P^<>`Y7l{IUAx@ zU9L5iiHax(STYXuOI&xm_KPah`PsQ+TB_PAP2Gg3*)J7sUMNe~?A7n#Ln2hK>Qk|x zc1HuF;$Zey$BAgJ4zHf~V3tmM>Np1uBhFI0r;jg3%dy9Q&KPsSXj74U6(!yYTfwxye+uM9|BgE~WQGkz|1}8CAbRznILn(f%q; zr1n_Q?N&ZhFuvar6YmM?Y71&E5#{L6X45XqH!Ef}4l;9V{z;UxN5+)I+hGzKBjbRc zU5=~eyS4ae9(|rIX4si<$Z03LH&)0}&Mk<%YaO&$g&6bg7IEagENvzF zpiZe;R4L3w^(_gmTB^ptXBGiMk%}3Flco037W3Mgoo$`5SwNsmkO-DY+*wRNSA=!< zzAxHBX>V8m>9@DbZrtk~V{X?dv!f>Nmsod5M@p08xGgmCY|0f3F8}9doo)jup#Tdx zB)D5uFHT=Zbu2Y*XBoyPm&WY|sk#b$Z6No?&o^L=qxfoBeM+D^VCI_J_ovh8#wr2Q zhv3&wvR;N2t5l(Zgu zZe1a<^weF=WRVYHrG@yGYUT&!quGb$z5V6b_W0QH?=z^yjM}CaGujcQdGrZlnJxX0)lCl3vdiiy1|!_UOlLS`^CZxsz*G zF{4TaKs$)W$q+owc7(zi@TdQNTd&YTw zQi_nLsWG+Cy)zy|y0M`WsZ0JhM=NI3fYI4lr(K}&({C}OjR7rYv>7>uZdd>5x5bPa zDl5J)$gN^VO<736@xJoTfR%Uh-*Dn+Rp3_4s9_;&aK*)pj;bMKiW&VI3~Vu@W`4zt zc5gJK{CbU6%&5QRDrU4Phh9^5Jt1)U%iBHLt~Jw9qxXo8YuXN<4=G&VjDi;^3pf4h z1?L{b)X&%+LR`#fF{ApwjbcX4zBrTMb;h$wep~4;?RROWqz@TJFLCOdQBHVqz)RN9 z{g|J3bW#+{;C0uw569f$13s?484WFNzJFI`iy5`=uuwr)x$)ylsbn6F{5Zq jeKQ(9y?Gb6AAh4z%&7dzj8cCpX4DTS_08!2@XhEQ>0aBj literal 0 HcmV?d00001 diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/underscore-min.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/underscore-min.js new file mode 100644 index 0000000..122914e --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/underscore-min.js @@ -0,0 +1,31 @@ +// Underscore.js 1.2.4 +// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. +// Underscore is freely distributable under the MIT license. +// Portions of Underscore are inspired or borrowed from Prototype, +// Oliver Steele's Functional, and John Resig's Micro-Templating. +// For all details and documentation: +// http://documentcloud.github.com/underscore +(function(){function r(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return false;switch(e){case "[object String]":return a==String(c);case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source== +c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&r(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(m.call(a,h)&&(f++,!(g=m.call(c,h)&&r(a[h],c[h],d))))break;if(g){for(h in c)if(m.call(c, +h)&&!f--)break;g=!f}}d.pop();return g}var s=this,G=s._,o={},k=Array.prototype,p=Object.prototype,i=k.slice,H=k.unshift,l=p.toString,m=p.hasOwnProperty,w=k.forEach,x=k.map,y=k.reduce,z=k.reduceRight,A=k.filter,B=k.every,C=k.some,q=k.indexOf,D=k.lastIndexOf,p=Array.isArray,I=Object.keys,t=Function.prototype.bind,b=function(a){return new n(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}else typeof define==="function"&&define.amd? +define("underscore",function(){return b}):s._=b;b.VERSION="1.2.4";var j=b.each=b.forEach=function(a,c,b){if(a!=null)if(w&&a.forEach===w)a.forEach(c,b);else if(a.length===+a.length)for(var e=0,f=a.length;e2;a==null&&(a=[]);if(y&&a.reduce===y)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(z&&a.reduceRight===z)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&& +(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=function(a,c,b){var e;E(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(A&&a.filter===A)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e; +if(B&&a.every===B)return a.every(c,b);j(a,function(a,g,h){if(!(e=e&&c.call(b,a,g,h)))return o});return e};var E=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(C&&a.some===C)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return o});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return q&&a.indexOf===q?a.indexOf(c)!=-1:b=E(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a, +function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck=function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a, +b,h){b=c?c.call(d,a,b,h):a;bd?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c= +e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a,c,d){d||(d=b.identity);for(var e=0,f=a.length;e>1;d(a[g])=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e= +0;e= +0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=I||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[],d;for(d in a)m.call(a,d)&&(b[b.length]=d);return b};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)b[d]!== +void 0&&(a[d]=b[d])});return a};b.defaults=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return r(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(m.call(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=p||function(a){return l.call(a)== +"[object Array]"};b.isObject=function(a){return a===Object(a)};b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!m.call(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"}; +b.isDate=function(a){return l.call(a)=="[object Date]"};b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.noConflict=function(){s._=G;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}; +b.mixin=function(a){j(b.functions(a),function(c){J(c,b[c]=a[c])})};var K=0;b.uniqueId=function(a){var b=K++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var u=/.^/;b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape||u,function(a,b){return"',_.escape("+b.replace(/\\'/g,"'")+"),'"}).replace(d.interpolate|| +u,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(d.evaluate||u,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ").replace(/\\\\/g,"\\")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};b.chain=function(a){return b(a).chain()};var n=function(a){this._wrapped=a};b.prototype=n.prototype;var v=function(a,c){return c?b(a).chain(): +a},J=function(a,c){n.prototype[a]=function(){var a=i.call(arguments);H.call(a,this._wrapped);return v(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];n.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return v(d,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];n.prototype[a]=function(){return v(b.apply(this._wrapped,arguments),this._chain)}}); +n.prototype.chain=function(){this._chain=true;return this};n.prototype.value=function(){return this._wrapped}}).call(this); diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/underscore.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/underscore.js new file mode 100644 index 0000000..c8cd1fd --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/underscore/underscore.js @@ -0,0 +1,995 @@ +// Underscore.js 1.2.4 +// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. +// Underscore is freely distributable under the MIT license. +// Portions of Underscore are inspired or borrowed from Prototype, +// Oliver Steele's Functional, and John Resig's Micro-Templating. +// For all details and documentation: +// http://documentcloud.github.com/underscore + +(function() { + + // Baseline setup + // -------------- + + // Establish the root object, `window` in the browser, or `global` on the server. + var root = this; + + // Save the previous value of the `_` variable. + var previousUnderscore = root._; + + // Establish the object that gets returned to break out of a loop iteration. + var breaker = {}; + + // Save bytes in the minified (but not gzipped) version: + var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype; + + // Create quick reference variables for speed access to core prototypes. + var slice = ArrayProto.slice, + unshift = ArrayProto.unshift, + toString = ObjProto.toString, + hasOwnProperty = ObjProto.hasOwnProperty; + + // All **ECMAScript 5** native function implementations that we hope to use + // are declared here. + var + nativeForEach = ArrayProto.forEach, + nativeMap = ArrayProto.map, + nativeReduce = ArrayProto.reduce, + nativeReduceRight = ArrayProto.reduceRight, + nativeFilter = ArrayProto.filter, + nativeEvery = ArrayProto.every, + nativeSome = ArrayProto.some, + nativeIndexOf = ArrayProto.indexOf, + nativeLastIndexOf = ArrayProto.lastIndexOf, + nativeIsArray = Array.isArray, + nativeKeys = Object.keys, + nativeBind = FuncProto.bind; + + // Create a safe reference to the Underscore object for use below. + var _ = function(obj) { return new wrapper(obj); }; + + // Export the Underscore object for **Node.js** and **"CommonJS"**, with + // backwards-compatibility for the old `require()` API. If we're not in + // CommonJS, add `_` to the global object. + if (typeof exports !== 'undefined') { + if (typeof module !== 'undefined' && module.exports) { + exports = module.exports = _; + } + exports._ = _; + } else if (typeof define === 'function' && define.amd) { + // Register as a named module with AMD. + define('underscore', function() { + return _; + }); + } else { + // Exported as a string, for Closure Compiler "advanced" mode. + root['_'] = _; + } + + // Current version. + _.VERSION = '1.2.4'; + + // Collection Functions + // -------------------- + + // The cornerstone, an `each` implementation, aka `forEach`. + // Handles objects with the built-in `forEach`, arrays, and raw objects. + // Delegates to **ECMAScript 5**'s native `forEach` if available. + var each = _.each = _.forEach = function(obj, iterator, context) { + if (obj == null) return; + if (nativeForEach && obj.forEach === nativeForEach) { + obj.forEach(iterator, context); + } else if (obj.length === +obj.length) { + for (var i = 0, l = obj.length; i < l; i++) { + if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) return; + } + } else { + for (var key in obj) { + if (hasOwnProperty.call(obj, key)) { + if (iterator.call(context, obj[key], key, obj) === breaker) return; + } + } + } + }; + + // Return the results of applying the iterator to each element. + // Delegates to **ECMAScript 5**'s native `map` if available. + _.map = function(obj, iterator, context) { + var results = []; + if (obj == null) return results; + if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context); + each(obj, function(value, index, list) { + results[results.length] = iterator.call(context, value, index, list); + }); + if (obj.length === +obj.length) results.length = obj.length; + return results; + }; + + // **Reduce** builds up a single result from a list of values, aka `inject`, + // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available. + _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) { + var initial = arguments.length > 2; + if (obj == null) obj = []; + if (nativeReduce && obj.reduce === nativeReduce) { + if (context) iterator = _.bind(iterator, context); + return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator); + } + each(obj, function(value, index, list) { + if (!initial) { + memo = value; + initial = true; + } else { + memo = iterator.call(context, memo, value, index, list); + } + }); + if (!initial) throw new TypeError('Reduce of empty array with no initial value'); + return memo; + }; + + // The right-associative version of reduce, also known as `foldr`. + // Delegates to **ECMAScript 5**'s native `reduceRight` if available. + _.reduceRight = _.foldr = function(obj, iterator, memo, context) { + var initial = arguments.length > 2; + if (obj == null) obj = []; + if (nativeReduceRight && obj.reduceRight === nativeReduceRight) { + if (context) iterator = _.bind(iterator, context); + return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator); + } + var reversed = _.toArray(obj).reverse(); + if (context && !initial) iterator = _.bind(iterator, context); + return initial ? _.reduce(reversed, iterator, memo, context) : _.reduce(reversed, iterator); + }; + + // Return the first value which passes a truth test. Aliased as `detect`. + _.find = _.detect = function(obj, iterator, context) { + var result; + any(obj, function(value, index, list) { + if (iterator.call(context, value, index, list)) { + result = value; + return true; + } + }); + return result; + }; + + // Return all the elements that pass a truth test. + // Delegates to **ECMAScript 5**'s native `filter` if available. + // Aliased as `select`. + _.filter = _.select = function(obj, iterator, context) { + var results = []; + if (obj == null) return results; + if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context); + each(obj, function(value, index, list) { + if (iterator.call(context, value, index, list)) results[results.length] = value; + }); + return results; + }; + + // Return all the elements for which a truth test fails. + _.reject = function(obj, iterator, context) { + var results = []; + if (obj == null) return results; + each(obj, function(value, index, list) { + if (!iterator.call(context, value, index, list)) results[results.length] = value; + }); + return results; + }; + + // Determine whether all of the elements match a truth test. + // Delegates to **ECMAScript 5**'s native `every` if available. + // Aliased as `all`. + _.every = _.all = function(obj, iterator, context) { + var result = true; + if (obj == null) return result; + if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context); + each(obj, function(value, index, list) { + if (!(result = result && iterator.call(context, value, index, list))) return breaker; + }); + return result; + }; + + // Determine if at least one element in the object matches a truth test. + // Delegates to **ECMAScript 5**'s native `some` if available. + // Aliased as `any`. + var any = _.some = _.any = function(obj, iterator, context) { + iterator || (iterator = _.identity); + var result = false; + if (obj == null) return result; + if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context); + each(obj, function(value, index, list) { + if (result || (result = iterator.call(context, value, index, list))) return breaker; + }); + return !!result; + }; + + // Determine if a given value is included in the array or object using `===`. + // Aliased as `contains`. + _.include = _.contains = function(obj, target) { + var found = false; + if (obj == null) return found; + if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1; + found = any(obj, function(value) { + return value === target; + }); + return found; + }; + + // Invoke a method (with arguments) on every item in a collection. + _.invoke = function(obj, method) { + var args = slice.call(arguments, 2); + return _.map(obj, function(value) { + return (_.isFunction(method) ? method || value : value[method]).apply(value, args); + }); + }; + + // Convenience version of a common use case of `map`: fetching a property. + _.pluck = function(obj, key) { + return _.map(obj, function(value){ return value[key]; }); + }; + + // Return the maximum element or (element-based computation). + _.max = function(obj, iterator, context) { + if (!iterator && _.isArray(obj)) return Math.max.apply(Math, obj); + if (!iterator && _.isEmpty(obj)) return -Infinity; + var result = {computed : -Infinity}; + each(obj, function(value, index, list) { + var computed = iterator ? iterator.call(context, value, index, list) : value; + computed >= result.computed && (result = {value : value, computed : computed}); + }); + return result.value; + }; + + // Return the minimum element (or element-based computation). + _.min = function(obj, iterator, context) { + if (!iterator && _.isArray(obj)) return Math.min.apply(Math, obj); + if (!iterator && _.isEmpty(obj)) return Infinity; + var result = {computed : Infinity}; + each(obj, function(value, index, list) { + var computed = iterator ? iterator.call(context, value, index, list) : value; + computed < result.computed && (result = {value : value, computed : computed}); + }); + return result.value; + }; + + // Shuffle an array. + _.shuffle = function(obj) { + var shuffled = [], rand; + each(obj, function(value, index, list) { + if (index == 0) { + shuffled[0] = value; + } else { + rand = Math.floor(Math.random() * (index + 1)); + shuffled[index] = shuffled[rand]; + shuffled[rand] = value; + } + }); + return shuffled; + }; + + // Sort the object's values by a criterion produced by an iterator. + _.sortBy = function(obj, iterator, context) { + return _.pluck(_.map(obj, function(value, index, list) { + return { + value : value, + criteria : iterator.call(context, value, index, list) + }; + }).sort(function(left, right) { + var a = left.criteria, b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + }), 'value'); + }; + + // Groups the object's values by a criterion. Pass either a string attribute + // to group by, or a function that returns the criterion. + _.groupBy = function(obj, val) { + var result = {}; + var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; }; + each(obj, function(value, index) { + var key = iterator(value, index); + (result[key] || (result[key] = [])).push(value); + }); + return result; + }; + + // Use a comparator function to figure out at what index an object should + // be inserted so as to maintain order. Uses binary search. + _.sortedIndex = function(array, obj, iterator) { + iterator || (iterator = _.identity); + var low = 0, high = array.length; + while (low < high) { + var mid = (low + high) >> 1; + iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid; + } + return low; + }; + + // Safely convert anything iterable into a real, live array. + _.toArray = function(iterable) { + if (!iterable) return []; + if (iterable.toArray) return iterable.toArray(); + if (_.isArray(iterable)) return slice.call(iterable); + if (_.isArguments(iterable)) return slice.call(iterable); + return _.values(iterable); + }; + + // Return the number of elements in an object. + _.size = function(obj) { + return _.toArray(obj).length; + }; + + // Array Functions + // --------------- + + // Get the first element of an array. Passing **n** will return the first N + // values in the array. Aliased as `head`. The **guard** check allows it to work + // with `_.map`. + _.first = _.head = function(array, n, guard) { + return (n != null) && !guard ? slice.call(array, 0, n) : array[0]; + }; + + // Returns everything but the last entry of the array. Especcialy useful on + // the arguments object. Passing **n** will return all the values in + // the array, excluding the last N. The **guard** check allows it to work with + // `_.map`. + _.initial = function(array, n, guard) { + return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n)); + }; + + // Get the last element of an array. Passing **n** will return the last N + // values in the array. The **guard** check allows it to work with `_.map`. + _.last = function(array, n, guard) { + if ((n != null) && !guard) { + return slice.call(array, Math.max(array.length - n, 0)); + } else { + return array[array.length - 1]; + } + }; + + // Returns everything but the first entry of the array. Aliased as `tail`. + // Especially useful on the arguments object. Passing an **index** will return + // the rest of the values in the array from that index onward. The **guard** + // check allows it to work with `_.map`. + _.rest = _.tail = function(array, index, guard) { + return slice.call(array, (index == null) || guard ? 1 : index); + }; + + // Trim out all falsy values from an array. + _.compact = function(array) { + return _.filter(array, function(value){ return !!value; }); + }; + + // Return a completely flattened version of an array. + _.flatten = function(array, shallow) { + return _.reduce(array, function(memo, value) { + if (_.isArray(value)) return memo.concat(shallow ? value : _.flatten(value)); + memo[memo.length] = value; + return memo; + }, []); + }; + + // Return a version of the array that does not contain the specified value(s). + _.without = function(array) { + return _.difference(array, slice.call(arguments, 1)); + }; + + // Produce a duplicate-free version of the array. If the array has already + // been sorted, you have the option of using a faster algorithm. + // Aliased as `unique`. + _.uniq = _.unique = function(array, isSorted, iterator) { + var initial = iterator ? _.map(array, iterator) : array; + var result = []; + _.reduce(initial, function(memo, el, i) { + if (0 == i || (isSorted === true ? _.last(memo) != el : !_.include(memo, el))) { + memo[memo.length] = el; + result[result.length] = array[i]; + } + return memo; + }, []); + return result; + }; + + // Produce an array that contains the union: each distinct element from all of + // the passed-in arrays. + _.union = function() { + return _.uniq(_.flatten(arguments, true)); + }; + + // Produce an array that contains every item shared between all the + // passed-in arrays. (Aliased as "intersect" for back-compat.) + _.intersection = _.intersect = function(array) { + var rest = slice.call(arguments, 1); + return _.filter(_.uniq(array), function(item) { + return _.every(rest, function(other) { + return _.indexOf(other, item) >= 0; + }); + }); + }; + + // Take the difference between one array and a number of other arrays. + // Only the elements present in just the first array will remain. + _.difference = function(array) { + var rest = _.flatten(slice.call(arguments, 1)); + return _.filter(array, function(value){ return !_.include(rest, value); }); + }; + + // Zip together multiple lists into a single array -- elements that share + // an index go together. + _.zip = function() { + var args = slice.call(arguments); + var length = _.max(_.pluck(args, 'length')); + var results = new Array(length); + for (var i = 0; i < length; i++) results[i] = _.pluck(args, "" + i); + return results; + }; + + // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**), + // we need this function. Return the position of the first occurrence of an + // item in an array, or -1 if the item is not included in the array. + // Delegates to **ECMAScript 5**'s native `indexOf` if available. + // If the array is large and already in sort order, pass `true` + // for **isSorted** to use binary search. + _.indexOf = function(array, item, isSorted) { + if (array == null) return -1; + var i, l; + if (isSorted) { + i = _.sortedIndex(array, item); + return array[i] === item ? i : -1; + } + if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item); + for (i = 0, l = array.length; i < l; i++) if (i in array && array[i] === item) return i; + return -1; + }; + + // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available. + _.lastIndexOf = function(array, item) { + if (array == null) return -1; + if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) return array.lastIndexOf(item); + var i = array.length; + while (i--) if (i in array && array[i] === item) return i; + return -1; + }; + + // Generate an integer Array containing an arithmetic progression. A port of + // the native Python `range()` function. See + // [the Python documentation](http://docs.python.org/library/functions.html#range). + _.range = function(start, stop, step) { + if (arguments.length <= 1) { + stop = start || 0; + start = 0; + } + step = arguments[2] || 1; + + var len = Math.max(Math.ceil((stop - start) / step), 0); + var idx = 0; + var range = new Array(len); + + while(idx < len) { + range[idx++] = start; + start += step; + } + + return range; + }; + + // Function (ahem) Functions + // ------------------ + + // Reusable constructor function for prototype setting. + var ctor = function(){}; + + // Create a function bound to a given object (assigning `this`, and arguments, + // optionally). Binding with arguments is also known as `curry`. + // Delegates to **ECMAScript 5**'s native `Function.bind` if available. + // We check for `func.bind` first, to fail fast when `func` is undefined. + _.bind = function bind(func, context) { + var bound, args; + if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); + if (!_.isFunction(func)) throw new TypeError; + args = slice.call(arguments, 2); + return bound = function() { + if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments))); + ctor.prototype = func.prototype; + var self = new ctor; + var result = func.apply(self, args.concat(slice.call(arguments))); + if (Object(result) === result) return result; + return self; + }; + }; + + // Bind all of an object's methods to that object. Useful for ensuring that + // all callbacks defined on an object belong to it. + _.bindAll = function(obj) { + var funcs = slice.call(arguments, 1); + if (funcs.length == 0) funcs = _.functions(obj); + each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); }); + return obj; + }; + + // Memoize an expensive function by storing its results. + _.memoize = function(func, hasher) { + var memo = {}; + hasher || (hasher = _.identity); + return function() { + var key = hasher.apply(this, arguments); + return hasOwnProperty.call(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments)); + }; + }; + + // Delays a function for the given number of milliseconds, and then calls + // it with the arguments supplied. + _.delay = function(func, wait) { + var args = slice.call(arguments, 2); + return setTimeout(function(){ return func.apply(func, args); }, wait); + }; + + // Defers a function, scheduling it to run after the current call stack has + // cleared. + _.defer = function(func) { + return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1))); + }; + + // Returns a function, that, when invoked, will only be triggered at most once + // during a given window of time. + _.throttle = function(func, wait) { + var context, args, timeout, throttling, more; + var whenDone = _.debounce(function(){ more = throttling = false; }, wait); + return function() { + context = this; args = arguments; + var later = function() { + timeout = null; + if (more) func.apply(context, args); + whenDone(); + }; + if (!timeout) timeout = setTimeout(later, wait); + if (throttling) { + more = true; + } else { + func.apply(context, args); + } + whenDone(); + throttling = true; + }; + }; + + // Returns a function, that, as long as it continues to be invoked, will not + // be triggered. The function will be called after it stops being called for + // N milliseconds. + _.debounce = function(func, wait) { + var timeout; + return function() { + var context = this, args = arguments; + var later = function() { + timeout = null; + func.apply(context, args); + }; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + }; + }; + + // Returns a function that will be executed at most one time, no matter how + // often you call it. Useful for lazy initialization. + _.once = function(func) { + var ran = false, memo; + return function() { + if (ran) return memo; + ran = true; + return memo = func.apply(this, arguments); + }; + }; + + // Returns the first function passed as an argument to the second, + // allowing you to adjust arguments, run code before and after, and + // conditionally execute the original function. + _.wrap = function(func, wrapper) { + return function() { + var args = [func].concat(slice.call(arguments, 0)); + return wrapper.apply(this, args); + }; + }; + + // Returns a function that is the composition of a list of functions, each + // consuming the return value of the function that follows. + _.compose = function() { + var funcs = arguments; + return function() { + var args = arguments; + for (var i = funcs.length - 1; i >= 0; i--) { + args = [funcs[i].apply(this, args)]; + } + return args[0]; + }; + }; + + // Returns a function that will only be executed after being called N times. + _.after = function(times, func) { + if (times <= 0) return func(); + return function() { + if (--times < 1) { return func.apply(this, arguments); } + }; + }; + + // Object Functions + // ---------------- + + // Retrieve the names of an object's properties. + // Delegates to **ECMAScript 5**'s native `Object.keys` + _.keys = nativeKeys || function(obj) { + if (obj !== Object(obj)) throw new TypeError('Invalid object'); + var keys = []; + for (var key in obj) if (hasOwnProperty.call(obj, key)) keys[keys.length] = key; + return keys; + }; + + // Retrieve the values of an object's properties. + _.values = function(obj) { + return _.map(obj, _.identity); + }; + + // Return a sorted list of the function names available on the object. + // Aliased as `methods` + _.functions = _.methods = function(obj) { + var names = []; + for (var key in obj) { + if (_.isFunction(obj[key])) names.push(key); + } + return names.sort(); + }; + + // Extend a given object with all the properties in passed-in object(s). + _.extend = function(obj) { + each(slice.call(arguments, 1), function(source) { + for (var prop in source) { + if (source[prop] !== void 0) obj[prop] = source[prop]; + } + }); + return obj; + }; + + // Fill in a given object with default properties. + _.defaults = function(obj) { + each(slice.call(arguments, 1), function(source) { + for (var prop in source) { + if (obj[prop] == null) obj[prop] = source[prop]; + } + }); + return obj; + }; + + // Create a (shallow-cloned) duplicate of an object. + _.clone = function(obj) { + if (!_.isObject(obj)) return obj; + return _.isArray(obj) ? obj.slice() : _.extend({}, obj); + }; + + // Invokes interceptor with the obj, and then returns obj. + // The primary purpose of this method is to "tap into" a method chain, in + // order to perform operations on intermediate results within the chain. + _.tap = function(obj, interceptor) { + interceptor(obj); + return obj; + }; + + // Internal recursive comparison function. + function eq(a, b, stack) { + // Identical objects are equal. `0 === -0`, but they aren't identical. + // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal. + if (a === b) return a !== 0 || 1 / a == 1 / b; + // A strict comparison is necessary because `null == undefined`. + if (a == null || b == null) return a === b; + // Unwrap any wrapped objects. + if (a._chain) a = a._wrapped; + if (b._chain) b = b._wrapped; + // Invoke a custom `isEqual` method if one is provided. + if (a.isEqual && _.isFunction(a.isEqual)) return a.isEqual(b); + if (b.isEqual && _.isFunction(b.isEqual)) return b.isEqual(a); + // Compare `[[Class]]` names. + var className = toString.call(a); + if (className != toString.call(b)) return false; + switch (className) { + // Strings, numbers, dates, and booleans are compared by value. + case '[object String]': + // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is + // equivalent to `new String("5")`. + return a == String(b); + case '[object Number]': + // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for + // other numeric values. + return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b); + case '[object Date]': + case '[object Boolean]': + // Coerce dates and booleans to numeric primitive values. Dates are compared by their + // millisecond representations. Note that invalid dates with millisecond representations + // of `NaN` are not equivalent. + return +a == +b; + // RegExps are compared by their source patterns and flags. + case '[object RegExp]': + return a.source == b.source && + a.global == b.global && + a.multiline == b.multiline && + a.ignoreCase == b.ignoreCase; + } + if (typeof a != 'object' || typeof b != 'object') return false; + // Assume equality for cyclic structures. The algorithm for detecting cyclic + // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. + var length = stack.length; + while (length--) { + // Linear search. Performance is inversely proportional to the number of + // unique nested structures. + if (stack[length] == a) return true; + } + // Add the first object to the stack of traversed objects. + stack.push(a); + var size = 0, result = true; + // Recursively compare objects and arrays. + if (className == '[object Array]') { + // Compare array lengths to determine if a deep comparison is necessary. + size = a.length; + result = size == b.length; + if (result) { + // Deep compare the contents, ignoring non-numeric properties. + while (size--) { + // Ensure commutative equality for sparse arrays. + if (!(result = size in a == size in b && eq(a[size], b[size], stack))) break; + } + } + } else { + // Objects with different constructors are not equivalent. + if ('constructor' in a != 'constructor' in b || a.constructor != b.constructor) return false; + // Deep compare objects. + for (var key in a) { + if (hasOwnProperty.call(a, key)) { + // Count the expected number of properties. + size++; + // Deep compare each member. + if (!(result = hasOwnProperty.call(b, key) && eq(a[key], b[key], stack))) break; + } + } + // Ensure that both objects contain the same number of properties. + if (result) { + for (key in b) { + if (hasOwnProperty.call(b, key) && !(size--)) break; + } + result = !size; + } + } + // Remove the first object from the stack of traversed objects. + stack.pop(); + return result; + } + + // Perform a deep comparison to check if two objects are equal. + _.isEqual = function(a, b) { + return eq(a, b, []); + }; + + // Is a given array, string, or object empty? + // An "empty" object has no enumerable own-properties. + _.isEmpty = function(obj) { + if (_.isArray(obj) || _.isString(obj)) return obj.length === 0; + for (var key in obj) if (hasOwnProperty.call(obj, key)) return false; + return true; + }; + + // Is a given value a DOM element? + _.isElement = function(obj) { + return !!(obj && obj.nodeType == 1); + }; + + // Is a given value an array? + // Delegates to ECMA5's native Array.isArray + _.isArray = nativeIsArray || function(obj) { + return toString.call(obj) == '[object Array]'; + }; + + // Is a given variable an object? + _.isObject = function(obj) { + return obj === Object(obj); + }; + + // Is a given variable an arguments object? + _.isArguments = function(obj) { + return toString.call(obj) == '[object Arguments]'; + }; + if (!_.isArguments(arguments)) { + _.isArguments = function(obj) { + return !!(obj && hasOwnProperty.call(obj, 'callee')); + }; + } + + // Is a given value a function? + _.isFunction = function(obj) { + return toString.call(obj) == '[object Function]'; + }; + + // Is a given value a string? + _.isString = function(obj) { + return toString.call(obj) == '[object String]'; + }; + + // Is a given value a number? + _.isNumber = function(obj) { + return toString.call(obj) == '[object Number]'; + }; + + // Is the given value `NaN`? + _.isNaN = function(obj) { + // `NaN` is the only value for which `===` is not reflexive. + return obj !== obj; + }; + + // Is a given value a boolean? + _.isBoolean = function(obj) { + return obj === true || obj === false || toString.call(obj) == '[object Boolean]'; + }; + + // Is a given value a date? + _.isDate = function(obj) { + return toString.call(obj) == '[object Date]'; + }; + + // Is the given value a regular expression? + _.isRegExp = function(obj) { + return toString.call(obj) == '[object RegExp]'; + }; + + // Is a given value equal to null? + _.isNull = function(obj) { + return obj === null; + }; + + // Is a given variable undefined? + _.isUndefined = function(obj) { + return obj === void 0; + }; + + // Utility Functions + // ----------------- + + // Run Underscore.js in *noConflict* mode, returning the `_` variable to its + // previous owner. Returns a reference to the Underscore object. + _.noConflict = function() { + root._ = previousUnderscore; + return this; + }; + + // Keep the identity function around for default iterators. + _.identity = function(value) { + return value; + }; + + // Run a function **n** times. + _.times = function (n, iterator, context) { + for (var i = 0; i < n; i++) iterator.call(context, i); + }; + + // Escape a string for HTML interpolation. + _.escape = function(string) { + return (''+string).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\//g,'/'); + }; + + // Add your own custom functions to the Underscore object, ensuring that + // they're correctly added to the OOP wrapper as well. + _.mixin = function(obj) { + each(_.functions(obj), function(name){ + addToWrapper(name, _[name] = obj[name]); + }); + }; + + // Generate a unique integer id (unique within the entire client session). + // Useful for temporary DOM ids. + var idCounter = 0; + _.uniqueId = function(prefix) { + var id = idCounter++; + return prefix ? prefix + id : id; + }; + + // By default, Underscore uses ERB-style template delimiters, change the + // following template settings to use alternative delimiters. + _.templateSettings = { + evaluate : /<%([\s\S]+?)%>/g, + interpolate : /<%=([\s\S]+?)%>/g, + escape : /<%-([\s\S]+?)%>/g + }; + + // When customizing `templateSettings`, if you don't want to define an + // interpolation, evaluation or escaping regex, we need one that is + // guaranteed not to match. + var noMatch = /.^/; + + // JavaScript micro-templating, similar to John Resig's implementation. + // Underscore templating handles arbitrary delimiters, preserves whitespace, + // and correctly escapes quotes within interpolated code. + _.template = function(str, data) { + var c = _.templateSettings; + var tmpl = 'var __p=[],print=function(){__p.push.apply(__p,arguments);};' + + 'with(obj||{}){__p.push(\'' + + str.replace(/\\/g, '\\\\') + .replace(/'/g, "\\'") + .replace(c.escape || noMatch, function(match, code) { + return "',_.escape(" + code.replace(/\\'/g, "'") + "),'"; + }) + .replace(c.interpolate || noMatch, function(match, code) { + return "'," + code.replace(/\\'/g, "'") + ",'"; + }) + .replace(c.evaluate || noMatch, function(match, code) { + return "');" + code.replace(/\\'/g, "'") + .replace(/[\r\n\t]/g, ' ') + .replace(/\\\\/g, '\\') + ";__p.push('"; + }) + .replace(/\r/g, '\\r') + .replace(/\n/g, '\\n') + .replace(/\t/g, '\\t') + + "');}return __p.join('');"; + var func = new Function('obj', '_', tmpl); + if (data) return func(data, _); + return function(data) { + return func.call(this, data, _); + }; + }; + + // Add a "chain" function, which will delegate to the wrapper. + _.chain = function(obj) { + return _(obj).chain(); + }; + + // The OOP Wrapper + // --------------- + + // If Underscore is called as a function, it returns a wrapped object that + // can be used OO-style. This wrapper holds altered versions of all the + // underscore functions. Wrapped objects may be chained. + var wrapper = function(obj) { this._wrapped = obj; }; + + // Expose `wrapper.prototype` as `_.prototype` + _.prototype = wrapper.prototype; + + // Helper function to continue chaining intermediate results. + var result = function(obj, chain) { + return chain ? _(obj).chain() : obj; + }; + + // A method to easily add functions to the OOP wrapper. + var addToWrapper = function(name, func) { + wrapper.prototype[name] = function() { + var args = slice.call(arguments); + unshift.call(args, this._wrapped); + return result(func.apply(_, args), this._chain); + }; + }; + + // Add all of the Underscore functions to the wrapper object. + _.mixin(_); + + // Add all mutator Array functions to the wrapper. + each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { + var method = ArrayProto[name]; + wrapper.prototype[name] = function() { + var wrapped = this._wrapped; + method.apply(wrapped, arguments); + var length = wrapped.length; + if ((name == 'shift' || name == 'splice') && length === 0) delete wrapped[0]; + return result(wrapped, this._chain); + }; + }); + + // Add all accessor Array functions to the wrapper. + each(['concat', 'join', 'slice'], function(name) { + var method = ArrayProto[name]; + wrapper.prototype[name] = function() { + return result(method.apply(this._wrapped, arguments), this._chain); + }; + }); + + // Start chaining a wrapped Underscore object. + wrapper.prototype.chain = function() { + this._chain = true; + return this; + }; + + // Extracts the result from a wrapped and chained object. + wrapper.prototype.value = function() { + return this._wrapped; + }; + +}).call(this); diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/which/LICENSE b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/which/LICENSE new file mode 100644 index 0000000..05a4010 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/which/LICENSE @@ -0,0 +1,23 @@ +Copyright 2009, 2010, 2011 Isaac Z. Schlueter. +All rights reserved. + +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. diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/which/README.md b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/which/README.md new file mode 100644 index 0000000..ff1eb53 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/which/README.md @@ -0,0 +1,5 @@ +The "which" util from npm's guts. + +Finds the first instance of a specified executable in the PATH +environment variable. Does not cache the results, so `hash -r` is not +needed when the PATH changes. diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/which/bin/which b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/which/bin/which new file mode 100755 index 0000000..8432ce2 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/which/bin/which @@ -0,0 +1,14 @@ +#!/usr/bin/env node +var which = require("../") +if (process.argv.length < 3) { + console.error("Usage: which ") + process.exit(1) +} + +which(process.argv[2], function (er, thing) { + if (er) { + console.error(er.message) + process.exit(er.errno || 127) + } + console.log(thing) +}) diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/which/package.json b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/which/package.json new file mode 100644 index 0000000..3b16f56 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/which/package.json @@ -0,0 +1,26 @@ +{ + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me" + }, + "name": "which", + "description": "Like which(1) unix command. Find the first instance of an executable in the PATH.", + "version": "1.0.5", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-which.git" + }, + "main": "which.js", + "bin": { + "which": "./bin/which" + }, + "engines": { + "node": "*" + }, + "dependencies": {}, + "devDependencies": {}, + "readme": "The \"which\" util from npm's guts.\n\nFinds the first instance of a specified executable in the PATH\nenvironment variable. Does not cache the results, so `hash -r` is not\nneeded when the PATH changes.\n", + "_id": "which@1.0.5", + "_from": "which@1.0.x" +} diff --git a/node_modules/dustjs-linkedin/node_modules/cover/node_modules/which/which.js b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/which/which.js new file mode 100644 index 0000000..db7e8f7 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/node_modules/which/which.js @@ -0,0 +1,104 @@ +module.exports = which +which.sync = whichSync + +var path = require("path") + , fs + , COLON = process.platform === "win32" ? ";" : ":" + , isExe + +try { + fs = require("graceful-fs") +} catch (ex) { + fs = require("fs") +} + +if (process.platform == "win32") { + // On windows, there is no good way to check that a file is executable + isExe = function isExe () { return true } +} else { + isExe = function isExe (mod, uid, gid) { + //console.error(mod, uid, gid); + //console.error("isExe?", (mod & 0111).toString(8)) + var ret = (mod & 0001) + || (mod & 0010) && process.getgid && gid === process.getgid() + || (mod & 0100) && process.getuid && uid === process.getuid() + //console.error("isExe?", ret) + return ret + } +} + + + +function which (cmd, cb) { + if (isAbsolute(cmd)) return cb(null, cmd) + var pathEnv = (process.env.PATH || "").split(COLON) + , pathExt = [""] + if (process.platform === "win32") { + pathEnv.push(process.cwd()) + pathExt = (process.env.PATHEXT || ".EXE").split(COLON) + if (cmd.indexOf(".") !== -1) pathExt.unshift("") + } + //console.error("pathEnv", pathEnv) + ;(function F (i, l) { + if (i === l) return cb(new Error("not found: "+cmd)) + var p = path.resolve(pathEnv[i], cmd) + ;(function E (ii, ll) { + if (ii === ll) return F(i + 1, l) + var ext = pathExt[ii] + //console.error(p + ext) + fs.stat(p + ext, function (er, stat) { + if (!er && + stat && + stat.isFile() && + isExe(stat.mode, stat.uid, stat.gid)) { + //console.error("yes, exe!", p + ext) + return cb(null, p + ext) + } + return E(ii + 1, ll) + }) + })(0, pathExt.length) + })(0, pathEnv.length) +} + +function whichSync (cmd) { + if (isAbsolute(cmd)) return cmd + var pathEnv = (process.env.PATH || "").split(COLON) + , pathExt = [""] + if (process.platform === "win32") { + pathEnv.push(process.cwd()) + pathExt = (process.env.PATHEXT || ".EXE").split(COLON) + if (cmd.indexOf(".") !== -1) pathExt.unshift("") + } + for (var i = 0, l = pathEnv.length; i < l; i ++) { + var p = path.join(pathEnv[i], cmd) + for (var j = 0, ll = pathExt.length; j < ll; j ++) { + var cur = p + pathExt[j] + var stat + try { stat = fs.statSync(cur) } catch (ex) {} + if (stat && + stat.isFile() && + isExe(stat.mode, stat.uid, stat.gid)) return cur + } + } + throw new Error("not found: "+cmd) +} + +var isAbsolute = process.platform === "win32" ? absWin : absUnix + +function absWin (p) { + if (absUnix(p)) return true + // pull off the device/UNC bit from a windows path. + // from node's lib/path.js + var splitDeviceRe = + /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?([\\\/])?/ + , result = splitDeviceRe.exec(p) + , device = result[1] || '' + , isUnc = device && device.charAt(1) !== ':' + , isAbsolute = !!result[2] || isUnc // UNC paths are always absolute + + return isAbsolute +} + +function absUnix (p) { + return p.charAt(0) === "/" || p === "" +} diff --git a/node_modules/dustjs-linkedin/node_modules/cover/package.json b/node_modules/dustjs-linkedin/node_modules/cover/package.json new file mode 100644 index 0000000..4d78167 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/package.json @@ -0,0 +1,44 @@ +{ + "name": "cover", + "version": "0.2.8", + "description": "Native JavaScript code coverage", + "main": "index.js", + "directories": { + "bin": "bin", + "lib": ".", + "test": "test" + }, + "dependencies": { + "cli-table": "0.0.x", + "underscore": "1.2.x", + "underscore.string": "2.0.x", + "which": "1.0.x" + }, + "repository": { + "type": "git", + "url": "http://github.com/itay/node-cover.git" + }, + "keywords": [ + "code", + "coverage", + "esprima", + "cover", + "test" + ], + "author": { + "name": "Itay Neeman", + "email": "itay@neeman.net", + "url": "http://www.pretzelwisdom.com" + }, + "license": "MIT/X11", + "engine": { + "node": ">=0.6" + }, + "preferGlobal": "true", + "bin": { + "cover": "bin/cover" + }, + "readme": "## Cover - Native JavaScript Code Coverage\n\nCover gives you the ability to collect code-coverage for your projects, using\nwhatever unit test framework you want, and all using native JavaScript. It also\ncomes bundled with pre-defined reporters, such as HTML and CLI output, so you\ncan easily see where you are missing coverage.\n\n### Standing on the shoulders of giants\n\nI would be amiss to not mention that the hard work in this library was\nby [Chris Dickinson] with his work on [runforcover]. In reality, Cover is \na fork of runforcover, fixing some of the issues and making it more usable.\n\nThe original version of Cover used [substack]'s excellent [bunker] library,\nbut it has recently been moved to using [esprima] and a new code homegrown\ninstrumentation library.\n\n### Known Issues\n\nThere are currently a few known issues that I am working on:\n\n1. If you use 'global' to pass state between modules (mocha does this, for\nexample), then you might run into issues. Cover runs modules as if they\nwere executed with `NODE_MODULE_CONTEXTS` was set.\n\n2. If you start new node processes, Cover won't work with those, as\nit instruments by hooking into `require`.\n\n### Usage\n\nUsing Cover is simple. Simply install it globally:\n\n> npm install cover -g\n\nAnd then, run it\n\n> cover run mytests.js\n\nWant to pass some arguments to your test? No problem (note the `--`):\n\n> cover run mytests.js -- --arg1 --arg2=foo\n\n Once you've run your tests, it will create a directory with coverage data in it.\n If you want to see the coverage report, simply run:\n \n > cover report\n \n which will output the report to the CLI. Want to get an HTML report?\n \n > cover report html\n \n This will create a `cover_html` directory with the coverage information.\n \n### Configuration\n\nCover reads from a `.coverrc` file in your project directory, and it comes\nwith sensible defaults. Here are the defaults that it uses:\n\n {\n \"formatter\": \"cli\",\n \"ignore\": \".coverignore\",\n \n \"prefix\": \"coveragefile_\", // Prefix for coverage data files\n \"dataDirectory\": \".coverage_data\", // Directory to put coverage files in\n \n \"debugDirectory\": \".coverage_debug\", // Directory to put instrumented files in\n \n \"modules\": false, // Whether or not to cover node_modules directory\n \n // Formatter-specific info\n \"html\" : {\n \"directory\": \"cover_html\", // Directory to write HTML files too\n \"generateIndex\": true // Whether to generate an index.html file\n },\n \n \"json\": {\n }\n }\n \nYou can also specify which files to ignore using .coverignore. Here is the one used\nfor Cover itself:\n\n node_modules\n \nYou can specify both files and directories in the `.coverignore` file.\n\nIf you have a customer path for your configuration files, you can specify this\non the command line:\n\n> cover --config path/to/config --ignore path/to/ignore run myfile.js\n\n[esprima]: http://www.esprima.org\n[substack]: https://github.com/substack\n[bunker]: https://github.com/substack/node-bunker\n[Chris Dickinson]: https://github.com/chrisdickinson\n[runforcover]: https://github.com/chrisdickinson/node-runforcover", + "_id": "cover@0.2.8", + "_from": "cover@0.2.x" +} diff --git a/node_modules/dustjs-linkedin/node_modules/cover/reporters/cli.js b/node_modules/dustjs-linkedin/node_modules/cover/reporters/cli.js new file mode 100644 index 0000000..b84396f --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/reporters/cli.js @@ -0,0 +1,47 @@ +var path = require('path'); +var colors = require('../contrib/colors') + +module.exports.MAX_FILENAME_LENGTH = 60; +module.exports.name = "cli"; +module.exports.format = function(coverageData) { + var stats = coverageData.stats(); + var filename = path.relative(process.cwd(), coverageData.filename); + + if (filename.length > module.exports.MAX_FILENAME_LENGTH) { + filename = "…" + filename.substr(filename.length - module.exports.MAX_FILENAME_LENGTH + 2); + } + + var blockPercentage = Math.floor(stats.blocks.percentage * 100); + var linePercentage = Math.floor(stats.percentage * 100); + + var blockColor = "____"; + if (blockPercentage >= 75) { + blockColor = "green"; + } + else if (blockPercentage >= 50) { + blockColor = "yellow"; + } + else { + blockColor = "red"; + } + + var lineColor = ""; + if (linePercentage >= 75) { + lineColor = "green"; + } + else if (linePercentage >= 50) { + lineColor = "yellow"; + } + else { + lineColor = "red"; + } + + return [ + filename, + (Math.floor(stats.percentage * 100) + "%")[lineColor], + stats.missing, + stats.total, + (Math.floor(stats.blocks.percentage * 100) + "%")[blockColor], + stats.blocks.missing, + stats.blocks.total]; +} \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/reporters/html.js b/node_modules/dustjs-linkedin/node_modules/cover/reporters/html.js new file mode 100644 index 0000000..3aa7315 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/reporters/html.js @@ -0,0 +1,83 @@ +var fs = require('fs'); +var _ = require('underscore'); + +function htmlEscape(string) { + return string.replace(/&/g, "&") + .replace(//g, ">") + .replace(/"/g, """) + .replace(/'/g, "'"); +} + +module.exports = { + name: "html", + format: function(coverageData) { + var source = coverageData.source.split("\n"); + var stats = coverageData.stats(); + var finalOutput = []; + var fileOutput = []; + + for(var i = 0 ; i < source.length; i++) { + var sourceLine = source[i]; + var line = i; + var lineOutput = []; + if (!stats.coverage.hasOwnProperty(line + 1)) { + lineOutput.push(" "); + lineOutput.push(htmlEscape(sourceLine)); + lineOutput.push(""); + } + else { + var lineInfo = stats.coverage[line + 1]; + sourceLine = lineInfo.source; + + if (!lineInfo.partial) { + // If it isn't partial, then we can just append the entire line + lineOutput.push(" "); + lineOutput.push(htmlEscape(sourceLine)); + lineOutput.push(""); + } + else { + lineOutput.push(" "); + + for(var j = 0; j < lineInfo.missing.length; j++) { + curStart = j == 0 ? 0 : (lineInfo.missing[j-1].endCol + 1); + curEnd = lineInfo.missing[j].startCol; + + lineOutput.push(htmlEscape(sourceLine.slice(curStart, curEnd))); + + lineOutput.push(""); + lineOutput.push(htmlEscape(sourceLine.slice(lineInfo.missing[j].startCol, lineInfo.missing[j].endCol + 1))); + lineOutput.push(""); + } + + // Add the straggling part + curStart = lineInfo.missing[lineInfo.missing.length - 1].endCol + 1; + curEnd = sourceLine.length; + lineOutput.push(htmlEscape(sourceLine.slice(curStart, curEnd))); + + lineOutput.push(""); + } + } + fileOutput.push(lineOutput.join("")); + } + + var lineOutput = []; + for(var i = 0; i < source.length; i++) { + var lineNum = i + 1; + lineOutput.push("

        " + lineNum + "

        "); + } + + finalOutput.push(""); + finalOutput.push(lineOutput.join("")); + finalOutput.push(""); + finalOutput.push(""); + finalOutput.push("
        ");
        +        finalOutput.push(fileOutput.join("\n"));
        +        finalOutput.push("
        "); + finalOutput.push(""); + + var outputString = finalOutput.join(""); + + return outputString; + } +} \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/reporters/json.js b/node_modules/dustjs-linkedin/node_modules/cover/reporters/json.js new file mode 100644 index 0000000..1ed8131 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/reporters/json.js @@ -0,0 +1,11 @@ +module.exports = { + name: "json", + format: function(coverageData) { + var source = coverageData.source; + var stats = coverageData.stats(); + var filename = coverageData.filename; + var result = { filename: filename, stats: stats, source: source }; + + return result; + } +} \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/reporters/plain.js b/node_modules/dustjs-linkedin/node_modules/cover/reporters/plain.js new file mode 100644 index 0000000..4158317 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/reporters/plain.js @@ -0,0 +1,48 @@ +function pad(text, width) { + text = text + ''; + var result = ''; + for (var i = 0; i < width - text.length; i++) { + result += ' '; + } + return result + text; +} + +module.exports = { + name: "plain", + format: function(coverageData) { + var source = coverageData.source.split('\n'); + var stats = coverageData.stats(); + var filename = coverageData.filename; + var result = 'File: ' + filename + '\n\n'; + + for(var i = 0 ; i < source.length; i++) { + var sourceLine = source[i]; + var line = i; + var lineOutput = []; + if (!stats.coverage.hasOwnProperty(line + 1)) { + // ignore covered + } + else { + var lineInfo = stats.coverage[line + 1]; + sourceLine = lineInfo.source; + + if (!lineInfo.partial) { + // If it isn't partial, then we can just append the entire line + result += pad(i + 1, 5) + ' | ' + sourceLine + '\n'; + } + else { + var partialLine = ''; + for(var j = 0; j < lineInfo.missing.length; j++) { + curStart = j == 0 ? 0 : (lineInfo.missing[j-1].endCol + 1); + curEnd = lineInfo.missing[j].startCol; + partialLine += pad('', curEnd - curStart); + partialLine += sourceLine.slice(lineInfo.missing[j].startCol, lineInfo.missing[j].endCol + 1); + } + + result += pad(i + 1, 5) + ' | ' + partialLine + '\n'; + } + } + } + return result + '\n'; + } +} \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/resources/bootstrap.css b/node_modules/dustjs-linkedin/node_modules/cover/resources/bootstrap.css new file mode 100644 index 0000000..0374fd6 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/resources/bootstrap.css @@ -0,0 +1,2469 @@ +/*! + * Bootstrap v1.4.0 + * + * Copyright 2011 Twitter, Inc + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Designed and built with all the love in the world @twitter by @mdo and @fat. + * Date: Sun Nov 20 21:42:29 PST 2011 + */ +/* Reset.less + * Props to Eric Meyer (meyerweb.com) for his CSS reset file. We're using an adapted version here that cuts out some of the reset HTML elements we will never need here (i.e., dfn, samp, etc). + * ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */ +html, body { + margin: 0; + padding: 0; +} +h1, +h2, +h3, +h4, +h5, +h6, +p, +blockquote, +pre, +a, +abbr, +acronym, +address, +cite, +code, +del, +dfn, +em, +img, +q, +s, +samp, +small, +strike, +strong, +sub, +sup, +tt, +var, +dd, +dl, +dt, +li, +ol, +ul, +fieldset, +form, +label, +legend, +button, +table, +caption, +tbody, +tfoot, +thead, +tr, +th, +td { + margin: 0; + padding: 0; + border: 0; + font-weight: normal; + font-style: normal; + font-size: 100%; + line-height: 1; + font-family: inherit; +} +table { + border-collapse: collapse; + border-spacing: 0; +} +ol, ul { + list-style: none; +} +q:before, +q:after, +blockquote:before, +blockquote:after { + content: ""; +} +html { + overflow-y: scroll; + font-size: 100%; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; +} +a:focus { + outline: thin dotted; +} +a:hover, a:active { + outline: 0; +} +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +nav, +section { + display: block; +} +audio, canvas, video { + display: inline-block; + *display: inline; + *zoom: 1; +} +audio:not([controls]) { + display: none; +} +sub, sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} +sup { + top: -0.5em; +} +sub { + bottom: -0.25em; +} +img { + border: 0; + -ms-interpolation-mode: bicubic; +} +button, +input, +select, +textarea { + font-size: 100%; + margin: 0; + vertical-align: baseline; + *vertical-align: middle; +} +button, input { + line-height: normal; + *overflow: visible; +} +button::-moz-focus-inner, input::-moz-focus-inner { + border: 0; + padding: 0; +} +button, +input[type="button"], +input[type="reset"], +input[type="submit"] { + cursor: pointer; + -webkit-appearance: button; +} +input[type="search"] { + -webkit-appearance: textfield; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; +} +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} +textarea { + overflow: auto; + vertical-align: top; +} +/* Variables.less + * Variables to customize the look and feel of Bootstrap + * ----------------------------------------------------- */ +/* Mixins.less + * Snippets of reusable CSS to develop faster and keep code readable + * ----------------------------------------------------------------- */ +/* + * Scaffolding + * Basic and global styles for generating a grid system, structural layout, and page templates + * ------------------------------------------------------------------------------------------- */ +body { + background-color: #ffffff; + margin: 0; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 13px; + font-weight: normal; + line-height: 18px; + color: #404040; +} +.container { + width: 940px; + margin-left: auto; + margin-right: auto; + zoom: 1; +} +.container:before, .container:after { + display: table; + content: ""; + zoom: 1; +} +.container:after { + clear: both; +} +.container-fluid { + position: relative; + min-width: 940px; + padding-left: 20px; + padding-right: 20px; + zoom: 1; +} +.container-fluid:before, .container-fluid:after { + display: table; + content: ""; + zoom: 1; +} +.container-fluid:after { + clear: both; +} +.container-fluid > .sidebar { + position: absolute; + top: 0; + left: 20px; + width: 220px; +} +.container-fluid > .content { + margin-left: 240px; +} +a { + color: #0069d6; + text-decoration: none; + line-height: inherit; + font-weight: inherit; +} +a:hover { + color: #00438a; + text-decoration: underline; +} +.pull-right { + float: right; +} +.pull-left { + float: left; +} +.hide { + display: none; +} +.show { + display: block; +} +.row { + zoom: 1; + margin-left: -20px; +} +.row:before, .row:after { + display: table; + content: ""; + zoom: 1; +} +.row:after { + clear: both; +} +.row > [class*="span"] { + display: inline; + float: left; + margin-left: 20px; +} +.span1 { + width: 40px; +} +.span2 { + width: 100px; +} +.span3 { + width: 160px; +} +.span4 { + width: 220px; +} +.span5 { + width: 280px; +} +.span6 { + width: 340px; +} +.span7 { + width: 400px; +} +.span8 { + width: 460px; +} +.span9 { + width: 520px; +} +.span10 { + width: 580px; +} +.span11 { + width: 640px; +} +.span12 { + width: 700px; +} +.span13 { + width: 760px; +} +.span14 { + width: 820px; +} +.span15 { + width: 880px; +} +.span16 { + width: 940px; +} +.span17 { + width: 1000px; +} +.span18 { + width: 1060px; +} +.span19 { + width: 1120px; +} +.span20 { + width: 1180px; +} +.span21 { + width: 1240px; +} +.span22 { + width: 1300px; +} +.span23 { + width: 1360px; +} +.span24 { + width: 1420px; +} +.row > .offset1 { + margin-left: 80px; +} +.row > .offset2 { + margin-left: 140px; +} +.row > .offset3 { + margin-left: 200px; +} +.row > .offset4 { + margin-left: 260px; +} +.row > .offset5 { + margin-left: 320px; +} +.row > .offset6 { + margin-left: 380px; +} +.row > .offset7 { + margin-left: 440px; +} +.row > .offset8 { + margin-left: 500px; +} +.row > .offset9 { + margin-left: 560px; +} +.row > .offset10 { + margin-left: 620px; +} +.row > .offset11 { + margin-left: 680px; +} +.row > .offset12 { + margin-left: 740px; +} +.span-one-third { + width: 300px; +} +.span-two-thirds { + width: 620px; +} +.row > .offset-one-third { + margin-left: 340px; +} +.row > .offset-two-thirds { + margin-left: 660px; +} +/* Typography.less + * Headings, body text, lists, code, and more for a versatile and durable typography system + * ---------------------------------------------------------------------------------------- */ +p { + font-size: 13px; + font-weight: normal; + line-height: 18px; + margin-bottom: 9px; +} +p small { + font-size: 11px; + color: #bfbfbf; +} +h1, +h2, +h3, +h4, +h5, +h6 { + font-weight: bold; + color: #404040; +} +h1 small, +h2 small, +h3 small, +h4 small, +h5 small, +h6 small { + color: #bfbfbf; +} +h1 { + margin-bottom: 18px; + font-size: 30px; + line-height: 36px; +} +h1 small { + font-size: 18px; +} +h2 { + font-size: 24px; + line-height: 36px; +} +h2 small { + font-size: 14px; +} +h3, +h4, +h5, +h6 { + line-height: 36px; +} +h3 { + font-size: 18px; +} +h3 small { + font-size: 14px; +} +h4 { + font-size: 16px; +} +h4 small { + font-size: 12px; +} +h5 { + font-size: 14px; +} +h6 { + font-size: 13px; + color: #bfbfbf; + text-transform: uppercase; +} +ul, ol { + margin: 0 0 18px 25px; +} +ul ul, +ul ol, +ol ol, +ol ul { + margin-bottom: 0; +} +ul { + list-style: disc; +} +ol { + list-style: decimal; +} +li { + line-height: 18px; + color: #808080; +} +ul.unstyled { + list-style: none; + margin-left: 0; +} +dl { + margin-bottom: 18px; +} +dl dt, dl dd { + line-height: 18px; +} +dl dt { + font-weight: bold; +} +dl dd { + margin-left: 9px; +} +hr { + margin: 20px 0 19px; + border: 0; + border-bottom: 1px solid #eee; +} +strong { + font-style: inherit; + font-weight: bold; +} +em { + font-style: italic; + font-weight: inherit; + line-height: inherit; +} +.muted { + color: #bfbfbf; +} +blockquote { + margin-bottom: 18px; + border-left: 5px solid #eee; + padding-left: 15px; +} +blockquote p { + font-size: 14px; + font-weight: 300; + line-height: 18px; + margin-bottom: 0; +} +blockquote small { + display: block; + font-size: 12px; + font-weight: 300; + line-height: 18px; + color: #bfbfbf; +} +blockquote small:before { + content: '\2014 \00A0'; +} +address { + display: block; + line-height: 18px; + margin-bottom: 18px; +} + +/*code, pre { + padding: 0 3px 2px; + font-family: Monaco, Andale Mono, Courier New, monospace; + font-size: 12px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} +code { + background-color: #fee9cc; + color: rgba(0, 0, 0, 0.75); + padding: 1px 3px; +} +pre { + background-color: #f5f5f5; + display: block; + padding: 8.5px; + margin: 0 0 18px; + line-height: 18px; + font-size: 12px; + border: 1px solid #ccc; + border: 1px solid rgba(0, 0, 0, 0.15); + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + white-space: pre; + white-space: pre-wrap; + word-wrap: break-word; +}*/ + +/* Forms.less + * Base styles for various input types, form layouts, and states + * ------------------------------------------------------------- */ +form { + margin-bottom: 18px; +} +fieldset { + margin-bottom: 18px; + padding-top: 18px; +} +fieldset legend { + display: block; + padding-left: 150px; + font-size: 19.5px; + line-height: 1; + color: #404040; + *padding: 0 0 5px 145px; + /* IE6-7 */ + + *line-height: 1.5; + /* IE6-7 */ + +} +form .clearfix { + margin-bottom: 18px; + zoom: 1; +} +form .clearfix:before, form .clearfix:after { + display: table; + content: ""; + zoom: 1; +} +form .clearfix:after { + clear: both; +} +label, +input, +select, +textarea { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 13px; + font-weight: normal; + line-height: normal; +} +label { + padding-top: 6px; + font-size: 13px; + line-height: 18px; + float: left; + width: 130px; + text-align: right; + color: #404040; +} +form .input { + margin-left: 150px; +} +input[type=checkbox], input[type=radio] { + cursor: pointer; +} +input, +textarea, +select, +.uneditable-input { + display: inline-block; + width: 210px; + height: 18px; + padding: 4px; + font-size: 13px; + line-height: 18px; + color: #808080; + border: 1px solid #ccc; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} +select { + padding: initial; +} +input[type=checkbox], input[type=radio] { + width: auto; + height: auto; + padding: 0; + margin: 3px 0; + *margin-top: 0; + /* IE6-7 */ + + line-height: normal; + border: none; +} +input[type=file] { + background-color: #ffffff; + padding: initial; + border: initial; + line-height: initial; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} +input[type=button], input[type=reset], input[type=submit] { + width: auto; + height: auto; +} +select, input[type=file] { + height: 27px; + *height: auto; + line-height: 27px; + *margin-top: 4px; + /* For IE7, add top margin to align select with labels */ + +} +select[multiple] { + height: inherit; + background-color: #ffffff; +} +textarea { + height: auto; +} +.uneditable-input { + background-color: #ffffff; + display: block; + border-color: #eee; + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); + -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); + cursor: not-allowed; +} +:-moz-placeholder { + color: #bfbfbf; +} +::-webkit-input-placeholder { + color: #bfbfbf; +} +input, textarea { + -webkit-transition: border linear 0.2s, box-shadow linear 0.2s; + -moz-transition: border linear 0.2s, box-shadow linear 0.2s; + -ms-transition: border linear 0.2s, box-shadow linear 0.2s; + -o-transition: border linear 0.2s, box-shadow linear 0.2s; + transition: border linear 0.2s, box-shadow linear 0.2s; + -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1); + -moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1); + box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1); +} +input:focus, textarea:focus { + outline: 0; + border-color: rgba(82, 168, 236, 0.8); + -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 8px rgba(82, 168, 236, 0.6); + -moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 8px rgba(82, 168, 236, 0.6); + box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1), 0 0 8px rgba(82, 168, 236, 0.6); +} +input[type=file]:focus, input[type=checkbox]:focus, select:focus { + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; + outline: 1px dotted #666; +} +form .clearfix.error > label, form .clearfix.error .help-block, form .clearfix.error .help-inline { + color: #b94a48; +} +form .clearfix.error input, form .clearfix.error textarea { + color: #b94a48; + border-color: #ee5f5b; +} +form .clearfix.error input:focus, form .clearfix.error textarea:focus { + border-color: #e9322d; + -webkit-box-shadow: 0 0 6px #f8b9b7; + -moz-box-shadow: 0 0 6px #f8b9b7; + box-shadow: 0 0 6px #f8b9b7; +} +form .clearfix.error .input-prepend .add-on, form .clearfix.error .input-append .add-on { + color: #b94a48; + background-color: #fce6e6; + border-color: #b94a48; +} +form .clearfix.warning > label, form .clearfix.warning .help-block, form .clearfix.warning .help-inline { + color: #c09853; +} +form .clearfix.warning input, form .clearfix.warning textarea { + color: #c09853; + border-color: #ccae64; +} +form .clearfix.warning input:focus, form .clearfix.warning textarea:focus { + border-color: #be9a3f; + -webkit-box-shadow: 0 0 6px #e5d6b1; + -moz-box-shadow: 0 0 6px #e5d6b1; + box-shadow: 0 0 6px #e5d6b1; +} +form .clearfix.warning .input-prepend .add-on, form .clearfix.warning .input-append .add-on { + color: #c09853; + background-color: #d2b877; + border-color: #c09853; +} +form .clearfix.success > label, form .clearfix.success .help-block, form .clearfix.success .help-inline { + color: #468847; +} +form .clearfix.success input, form .clearfix.success textarea { + color: #468847; + border-color: #57a957; +} +form .clearfix.success input:focus, form .clearfix.success textarea:focus { + border-color: #458845; + -webkit-box-shadow: 0 0 6px #9acc9a; + -moz-box-shadow: 0 0 6px #9acc9a; + box-shadow: 0 0 6px #9acc9a; +} +form .clearfix.success .input-prepend .add-on, form .clearfix.success .input-append .add-on { + color: #468847; + background-color: #bcddbc; + border-color: #468847; +} +.input-mini, +input.mini, +textarea.mini, +select.mini { + width: 60px; +} +.input-small, +input.small, +textarea.small, +select.small { + width: 90px; +} +.input-medium, +input.medium, +textarea.medium, +select.medium { + width: 150px; +} +.input-large, +input.large, +textarea.large, +select.large { + width: 210px; +} +.input-xlarge, +input.xlarge, +textarea.xlarge, +select.xlarge { + width: 270px; +} +.input-xxlarge, +input.xxlarge, +textarea.xxlarge, +select.xxlarge { + width: 530px; +} +textarea.xxlarge { + overflow-y: auto; +} +input.span1, textarea.span1 { + display: inline-block; + float: none; + width: 30px; + margin-left: 0; +} +input.span2, textarea.span2 { + display: inline-block; + float: none; + width: 90px; + margin-left: 0; +} +input.span3, textarea.span3 { + display: inline-block; + float: none; + width: 150px; + margin-left: 0; +} +input.span4, textarea.span4 { + display: inline-block; + float: none; + width: 210px; + margin-left: 0; +} +input.span5, textarea.span5 { + display: inline-block; + float: none; + width: 270px; + margin-left: 0; +} +input.span6, textarea.span6 { + display: inline-block; + float: none; + width: 330px; + margin-left: 0; +} +input.span7, textarea.span7 { + display: inline-block; + float: none; + width: 390px; + margin-left: 0; +} +input.span8, textarea.span8 { + display: inline-block; + float: none; + width: 450px; + margin-left: 0; +} +input.span9, textarea.span9 { + display: inline-block; + float: none; + width: 510px; + margin-left: 0; +} +input.span10, textarea.span10 { + display: inline-block; + float: none; + width: 570px; + margin-left: 0; +} +input.span11, textarea.span11 { + display: inline-block; + float: none; + width: 630px; + margin-left: 0; +} +input.span12, textarea.span12 { + display: inline-block; + float: none; + width: 690px; + margin-left: 0; +} +input.span13, textarea.span13 { + display: inline-block; + float: none; + width: 750px; + margin-left: 0; +} +input.span14, textarea.span14 { + display: inline-block; + float: none; + width: 810px; + margin-left: 0; +} +input.span15, textarea.span15 { + display: inline-block; + float: none; + width: 870px; + margin-left: 0; +} +input.span16, textarea.span16 { + display: inline-block; + float: none; + width: 930px; + margin-left: 0; +} +input[disabled], +select[disabled], +textarea[disabled], +input[readonly], +select[readonly], +textarea[readonly] { + background-color: #f5f5f5; + border-color: #ddd; + cursor: not-allowed; +} +.actions { + background: #f5f5f5; + margin-top: 18px; + margin-bottom: 18px; + padding: 17px 20px 18px 150px; + border-top: 1px solid #ddd; + -webkit-border-radius: 0 0 3px 3px; + -moz-border-radius: 0 0 3px 3px; + border-radius: 0 0 3px 3px; +} +.actions .secondary-action { + float: right; +} +.actions .secondary-action a { + line-height: 30px; +} +.actions .secondary-action a:hover { + text-decoration: underline; +} +.help-inline, .help-block { + font-size: 13px; + line-height: 18px; + color: #bfbfbf; +} +.help-inline { + padding-left: 5px; + *position: relative; + /* IE6-7 */ + + *top: -5px; + /* IE6-7 */ + +} +.help-block { + display: block; + max-width: 600px; +} +.inline-inputs { + color: #808080; +} +.inline-inputs span { + padding: 0 2px 0 1px; +} +.input-prepend input, .input-append input { + -webkit-border-radius: 0 3px 3px 0; + -moz-border-radius: 0 3px 3px 0; + border-radius: 0 3px 3px 0; +} +.input-prepend .add-on, .input-append .add-on { + position: relative; + background: #f5f5f5; + border: 1px solid #ccc; + z-index: 2; + float: left; + display: block; + width: auto; + min-width: 16px; + height: 18px; + padding: 4px 4px 4px 5px; + margin-right: -1px; + font-weight: normal; + line-height: 18px; + color: #bfbfbf; + text-align: center; + text-shadow: 0 1px 0 #ffffff; + -webkit-border-radius: 3px 0 0 3px; + -moz-border-radius: 3px 0 0 3px; + border-radius: 3px 0 0 3px; +} +.input-prepend .active, .input-append .active { + background: #a9dba9; + border-color: #46a546; +} +.input-prepend .add-on { + *margin-top: 1px; + /* IE6-7 */ + +} +.input-append input { + float: left; + -webkit-border-radius: 3px 0 0 3px; + -moz-border-radius: 3px 0 0 3px; + border-radius: 3px 0 0 3px; +} +.input-append .add-on { + -webkit-border-radius: 0 3px 3px 0; + -moz-border-radius: 0 3px 3px 0; + border-radius: 0 3px 3px 0; + margin-right: 0; + margin-left: -1px; +} +.inputs-list { + margin: 0 0 5px; + width: 100%; +} +.inputs-list li { + display: block; + padding: 0; + width: 100%; +} +.inputs-list label { + display: block; + float: none; + width: auto; + padding: 0; + margin-left: 20px; + line-height: 18px; + text-align: left; + white-space: normal; +} +.inputs-list label strong { + color: #808080; +} +.inputs-list label small { + font-size: 11px; + font-weight: normal; +} +.inputs-list .inputs-list { + margin-left: 25px; + margin-bottom: 10px; + padding-top: 0; +} +.inputs-list:first-child { + padding-top: 6px; +} +.inputs-list li + li { + padding-top: 2px; +} +.inputs-list input[type=radio], .inputs-list input[type=checkbox] { + margin-bottom: 0; + margin-left: -20px; + float: left; +} +.form-stacked { + padding-left: 20px; +} +.form-stacked fieldset { + padding-top: 9px; +} +.form-stacked legend { + padding-left: 0; +} +.form-stacked label { + display: block; + float: none; + width: auto; + font-weight: bold; + text-align: left; + line-height: 20px; + padding-top: 0; +} +.form-stacked .clearfix { + margin-bottom: 9px; +} +.form-stacked .clearfix div.input { + margin-left: 0; +} +.form-stacked .inputs-list { + margin-bottom: 0; +} +.form-stacked .inputs-list li { + padding-top: 0; +} +.form-stacked .inputs-list li label { + font-weight: normal; + padding-top: 0; +} +.form-stacked div.clearfix.error { + padding-top: 10px; + padding-bottom: 10px; + padding-left: 10px; + margin-top: 0; + margin-left: -10px; +} +.form-stacked .actions { + margin-left: -20px; + padding-left: 20px; +} +/* + * Tables.less + * Tables for, you guessed it, tabular data + * ---------------------------------------- */ +table { + width: 100%; + margin-bottom: 18px; + padding: 0; + font-size: 13px; + border-collapse: collapse; +} +table th, table td { + padding: 10px 10px 9px; + line-height: 18px; + text-align: left; +} +table th { + padding-top: 9px; + font-weight: bold; + vertical-align: middle; +} +table td { + vertical-align: top; + border-top: 1px solid #ddd; +} +table tbody th { + border-top: 1px solid #ddd; + vertical-align: top; +} +.condensed-table th, .condensed-table td { + padding: 5px 5px 4px; +} +.bordered-table { + border: 1px solid #ddd; + border-collapse: separate; + *border-collapse: collapse; + /* IE7, collapse table to remove spacing */ + + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.bordered-table th + th, .bordered-table td + td, .bordered-table th + td { + border-left: 1px solid #ddd; +} +.bordered-table thead tr:first-child th:first-child, .bordered-table tbody tr:first-child td:first-child { + -webkit-border-radius: 4px 0 0 0; + -moz-border-radius: 4px 0 0 0; + border-radius: 4px 0 0 0; +} +.bordered-table thead tr:first-child th:last-child, .bordered-table tbody tr:first-child td:last-child { + -webkit-border-radius: 0 4px 0 0; + -moz-border-radius: 0 4px 0 0; + border-radius: 0 4px 0 0; +} +.bordered-table tbody tr:last-child td:first-child { + -webkit-border-radius: 0 0 0 4px; + -moz-border-radius: 0 0 0 4px; + border-radius: 0 0 0 4px; +} +.bordered-table tbody tr:last-child td:last-child { + -webkit-border-radius: 0 0 4px 0; + -moz-border-radius: 0 0 4px 0; + border-radius: 0 0 4px 0; +} +table .span1 { + width: 20px; +} +table .span2 { + width: 60px; +} +table .span3 { + width: 100px; +} +table .span4 { + width: 140px; +} +table .span5 { + width: 180px; +} +table .span6 { + width: 220px; +} +table .span7 { + width: 260px; +} +table .span8 { + width: 300px; +} +table .span9 { + width: 340px; +} +table .span10 { + width: 380px; +} +table .span11 { + width: 420px; +} +table .span12 { + width: 460px; +} +table .span13 { + width: 500px; +} +table .span14 { + width: 540px; +} +table .span15 { + width: 580px; +} +table .span16 { + width: 620px; +} +.zebra-striped tbody tr:nth-child(odd) td, .zebra-striped tbody tr:nth-child(odd) th { + background-color: #f9f9f9; +} +.zebra-striped tbody tr:hover td, .zebra-striped tbody tr:hover th { + background-color: #f5f5f5; +} +table .header { + cursor: pointer; +} +table .header:after { + content: ""; + float: right; + margin-top: 7px; + border-width: 0 4px 4px; + border-style: solid; + border-color: #000 transparent; + visibility: hidden; +} +table .headerSortUp, table .headerSortDown { + background-color: rgba(141, 192, 219, 0.25); + text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); +} +table .header:hover:after { + visibility: visible; +} +table .headerSortDown:after, table .headerSortDown:hover:after { + visibility: visible; + filter: alpha(opacity=60); + -khtml-opacity: 0.6; + -moz-opacity: 0.6; + opacity: 0.6; +} +table .headerSortUp:after { + border-bottom: none; + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 4px solid #000; + visibility: visible; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; + filter: alpha(opacity=60); + -khtml-opacity: 0.6; + -moz-opacity: 0.6; + opacity: 0.6; +} +table .blue { + color: #049cdb; + border-bottom-color: #049cdb; +} +table .headerSortUp.blue, table .headerSortDown.blue { + background-color: #ade6fe; +} +table .green { + color: #46a546; + border-bottom-color: #46a546; +} +table .headerSortUp.green, table .headerSortDown.green { + background-color: #cdeacd; +} +table .red { + color: #9d261d; + border-bottom-color: #9d261d; +} +table .headerSortUp.red, table .headerSortDown.red { + background-color: #f4c8c5; +} +table .yellow { + color: #ffc40d; + border-bottom-color: #ffc40d; +} +table .headerSortUp.yellow, table .headerSortDown.yellow { + background-color: #fff6d9; +} +table .orange { + color: #f89406; + border-bottom-color: #f89406; +} +table .headerSortUp.orange, table .headerSortDown.orange { + background-color: #fee9cc; +} +table .purple { + color: #7a43b6; + border-bottom-color: #7a43b6; +} +table .headerSortUp.purple, table .headerSortDown.purple { + background-color: #e2d5f0; +} +/* Patterns.less + * Repeatable UI elements outside the base styles provided from the scaffolding + * ---------------------------------------------------------------------------- */ +.topbar { + height: 40px; + position: fixed; + top: 0; + left: 0; + right: 0; + z-index: 10000; + overflow: visible; +} +.topbar a { + color: #bfbfbf; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); +} +.topbar h3 a:hover, .topbar .brand:hover, .topbar ul .active > a { + background-color: #333; + background-color: rgba(255, 255, 255, 0.05); + color: #ffffff; + text-decoration: none; +} +.topbar h3 { + position: relative; +} +.topbar h3 a, .topbar .brand { + float: left; + display: block; + padding: 8px 20px 12px; + margin-left: -20px; + color: #ffffff; + font-size: 20px; + font-weight: 200; + line-height: 1; +} +.topbar p { + margin: 0; + line-height: 40px; +} +.topbar p a:hover { + background-color: transparent; + color: #ffffff; +} +.topbar form { + float: left; + margin: 5px 0 0 0; + position: relative; + filter: alpha(opacity=100); + -khtml-opacity: 1; + -moz-opacity: 1; + opacity: 1; +} +.topbar form.pull-right { + float: right; +} +.topbar input { + background-color: #444; + background-color: rgba(255, 255, 255, 0.3); + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: normal; + font-weight: 13px; + line-height: 1; + padding: 4px 9px; + color: #ffffff; + color: rgba(255, 255, 255, 0.75); + border: 1px solid #111; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0px rgba(255, 255, 255, 0.25); + -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0px rgba(255, 255, 255, 0.25); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0px rgba(255, 255, 255, 0.25); + -webkit-transition: none; + -moz-transition: none; + -ms-transition: none; + -o-transition: none; + transition: none; +} +.topbar input:-moz-placeholder { + color: #e6e6e6; +} +.topbar input::-webkit-input-placeholder { + color: #e6e6e6; +} +.topbar input:hover { + background-color: #bfbfbf; + background-color: rgba(255, 255, 255, 0.5); + color: #ffffff; +} +.topbar input:focus, .topbar input.focused { + outline: 0; + background-color: #ffffff; + color: #404040; + text-shadow: 0 1px 0 #ffffff; + border: 0; + padding: 5px 10px; + -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); + -moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); + box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); +} +.topbar-inner, .topbar .fill { + background-color: #222; + background-color: #222222; + background-repeat: repeat-x; + background-image: -khtml-gradient(linear, left top, left bottom, from(#333333), to(#222222)); + background-image: -moz-linear-gradient(top, #333333, #222222); + background-image: -ms-linear-gradient(top, #333333, #222222); + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #333333), color-stop(100%, #222222)); + background-image: -webkit-linear-gradient(top, #333333, #222222); + background-image: -o-linear-gradient(top, #333333, #222222); + background-image: linear-gradient(top, #333333, #222222); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0); + -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1); + -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1); + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1); +} +.topbar div > ul, .nav { + display: block; + float: left; + margin: 0 10px 0 0; + position: relative; + left: 0; +} +.topbar div > ul > li, .nav > li { + display: block; + float: left; +} +.topbar div > ul a, .nav a { + display: block; + float: none; + padding: 10px 10px 11px; + line-height: 19px; + text-decoration: none; +} +.topbar div > ul a:hover, .nav a:hover { + color: #ffffff; + text-decoration: none; +} +.topbar div > ul .active > a, .nav .active > a { + background-color: #222; + background-color: rgba(0, 0, 0, 0.5); +} +.topbar div > ul.secondary-nav, .nav.secondary-nav { + float: right; + margin-left: 10px; + margin-right: 0; +} +.topbar div > ul.secondary-nav .menu-dropdown, +.nav.secondary-nav .menu-dropdown, +.topbar div > ul.secondary-nav .dropdown-menu, +.nav.secondary-nav .dropdown-menu { + right: 0; + border: 0; +} +.topbar div > ul a.menu:hover, +.nav a.menu:hover, +.topbar div > ul li.open .menu, +.nav li.open .menu, +.topbar div > ul .dropdown-toggle:hover, +.nav .dropdown-toggle:hover, +.topbar div > ul .dropdown.open .dropdown-toggle, +.nav .dropdown.open .dropdown-toggle { + background: #444; + background: rgba(255, 255, 255, 0.05); +} +.topbar div > ul .menu-dropdown, +.nav .menu-dropdown, +.topbar div > ul .dropdown-menu, +.nav .dropdown-menu { + background-color: #333; +} +.topbar div > ul .menu-dropdown a.menu, +.nav .menu-dropdown a.menu, +.topbar div > ul .dropdown-menu a.menu, +.nav .dropdown-menu a.menu, +.topbar div > ul .menu-dropdown .dropdown-toggle, +.nav .menu-dropdown .dropdown-toggle, +.topbar div > ul .dropdown-menu .dropdown-toggle, +.nav .dropdown-menu .dropdown-toggle { + color: #ffffff; +} +.topbar div > ul .menu-dropdown a.menu.open, +.nav .menu-dropdown a.menu.open, +.topbar div > ul .dropdown-menu a.menu.open, +.nav .dropdown-menu a.menu.open, +.topbar div > ul .menu-dropdown .dropdown-toggle.open, +.nav .menu-dropdown .dropdown-toggle.open, +.topbar div > ul .dropdown-menu .dropdown-toggle.open, +.nav .dropdown-menu .dropdown-toggle.open { + background: #444; + background: rgba(255, 255, 255, 0.05); +} +.topbar div > ul .menu-dropdown li a, +.nav .menu-dropdown li a, +.topbar div > ul .dropdown-menu li a, +.nav .dropdown-menu li a { + color: #999; + text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5); +} +.topbar div > ul .menu-dropdown li a:hover, +.nav .menu-dropdown li a:hover, +.topbar div > ul .dropdown-menu li a:hover, +.nav .dropdown-menu li a:hover { + background-color: #191919; + background-repeat: repeat-x; + background-image: -khtml-gradient(linear, left top, left bottom, from(#292929), to(#191919)); + background-image: -moz-linear-gradient(top, #292929, #191919); + background-image: -ms-linear-gradient(top, #292929, #191919); + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #292929), color-stop(100%, #191919)); + background-image: -webkit-linear-gradient(top, #292929, #191919); + background-image: -o-linear-gradient(top, #292929, #191919); + background-image: linear-gradient(top, #292929, #191919); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#292929', endColorstr='#191919', GradientType=0); + color: #ffffff; +} +.topbar div > ul .menu-dropdown .active a, +.nav .menu-dropdown .active a, +.topbar div > ul .dropdown-menu .active a, +.nav .dropdown-menu .active a { + color: #ffffff; +} +.topbar div > ul .menu-dropdown .divider, +.nav .menu-dropdown .divider, +.topbar div > ul .dropdown-menu .divider, +.nav .dropdown-menu .divider { + background-color: #222; + border-color: #444; +} +.topbar ul .menu-dropdown li a, .topbar ul .dropdown-menu li a { + padding: 4px 15px; +} +li.menu, .dropdown { + position: relative; +} +a.menu:after, .dropdown-toggle:after { + width: 0; + height: 0; + display: inline-block; + content: "↓"; + text-indent: -99999px; + vertical-align: top; + margin-top: 8px; + margin-left: 4px; + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 4px solid #ffffff; + filter: alpha(opacity=50); + -khtml-opacity: 0.5; + -moz-opacity: 0.5; + opacity: 0.5; +} +.menu-dropdown, .dropdown-menu { + background-color: #ffffff; + float: left; + display: none; + position: absolute; + top: 40px; + z-index: 900; + min-width: 160px; + max-width: 220px; + _width: 160px; + margin-left: 0; + margin-right: 0; + padding: 6px 0; + zoom: 1; + border-color: #999; + border-color: rgba(0, 0, 0, 0.2); + border-style: solid; + border-width: 0 1px 1px; + -webkit-border-radius: 0 0 6px 6px; + -moz-border-radius: 0 0 6px 6px; + border-radius: 0 0 6px 6px; + -webkit-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); + -moz-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); + -webkit-background-clip: padding-box; + -moz-background-clip: padding-box; + background-clip: padding-box; +} +.menu-dropdown li, .dropdown-menu li { + float: none; + display: block; + background-color: none; +} +.menu-dropdown .divider, .dropdown-menu .divider { + height: 1px; + margin: 5px 0; + overflow: hidden; + background-color: #eee; + border-bottom: 1px solid #ffffff; +} +.topbar .dropdown-menu a, .dropdown-menu a { + display: block; + padding: 4px 15px; + clear: both; + font-weight: normal; + line-height: 18px; + color: #808080; + text-shadow: 0 1px 0 #ffffff; +} +.topbar .dropdown-menu a:hover, +.dropdown-menu a:hover, +.topbar .dropdown-menu a.hover, +.dropdown-menu a.hover { + background-color: #dddddd; + background-repeat: repeat-x; + background-image: -khtml-gradient(linear, left top, left bottom, from(#eeeeee), to(#dddddd)); + background-image: -moz-linear-gradient(top, #eeeeee, #dddddd); + background-image: -ms-linear-gradient(top, #eeeeee, #dddddd); + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #eeeeee), color-stop(100%, #dddddd)); + background-image: -webkit-linear-gradient(top, #eeeeee, #dddddd); + background-image: -o-linear-gradient(top, #eeeeee, #dddddd); + background-image: linear-gradient(top, #eeeeee, #dddddd); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#dddddd', GradientType=0); + color: #404040; + text-decoration: none; + -webkit-box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.025), inset 0 -1px rgba(0, 0, 0, 0.025); + -moz-box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.025), inset 0 -1px rgba(0, 0, 0, 0.025); + box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.025), inset 0 -1px rgba(0, 0, 0, 0.025); +} +.open .menu, +.dropdown.open .menu, +.open .dropdown-toggle, +.dropdown.open .dropdown-toggle { + color: #ffffff; + background: #ccc; + background: rgba(0, 0, 0, 0.3); +} +.open .menu-dropdown, +.dropdown.open .menu-dropdown, +.open .dropdown-menu, +.dropdown.open .dropdown-menu { + display: block; +} +.tabs, .pills { + margin: 0 0 18px; + padding: 0; + list-style: none; + zoom: 1; +} +.tabs:before, +.pills:before, +.tabs:after, +.pills:after { + display: table; + content: ""; + zoom: 1; +} +.tabs:after, .pills:after { + clear: both; +} +.tabs > li, .pills > li { + float: left; +} +.tabs > li > a, .pills > li > a { + display: block; +} +.tabs { + border-color: #ddd; + border-style: solid; + border-width: 0 0 1px; +} +.tabs > li { + position: relative; + margin-bottom: -1px; +} +.tabs > li > a { + padding: 0 15px; + margin-right: 2px; + line-height: 34px; + border: 1px solid transparent; + -webkit-border-radius: 4px 4px 0 0; + -moz-border-radius: 4px 4px 0 0; + border-radius: 4px 4px 0 0; +} +.tabs > li > a:hover { + text-decoration: none; + background-color: #eee; + border-color: #eee #eee #ddd; +} +.tabs .active > a, .tabs .active > a:hover { + color: #808080; + background-color: #ffffff; + border: 1px solid #ddd; + border-bottom-color: transparent; + cursor: default; +} +.tabs .menu-dropdown, .tabs .dropdown-menu { + top: 35px; + border-width: 1px; + -webkit-border-radius: 0 6px 6px 6px; + -moz-border-radius: 0 6px 6px 6px; + border-radius: 0 6px 6px 6px; +} +.tabs a.menu:after, .tabs .dropdown-toggle:after { + border-top-color: #999; + margin-top: 15px; + margin-left: 5px; +} +.tabs li.open.menu .menu, .tabs .open.dropdown .dropdown-toggle { + border-color: #999; +} +.tabs li.open a.menu:after, .tabs .dropdown.open .dropdown-toggle:after { + border-top-color: #555; +} +.pills a { + margin: 5px 3px 5px 0; + padding: 0 15px; + line-height: 30px; + text-shadow: 0 1px 1px #ffffff; + -webkit-border-radius: 15px; + -moz-border-radius: 15px; + border-radius: 15px; +} +.pills a:hover { + color: #ffffff; + text-decoration: none; + text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25); + background-color: #00438a; +} +.pills .active a { + color: #ffffff; + text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25); + background-color: #0069d6; +} +.pills-vertical > li { + float: none; +} +.tab-content > .tab-pane, +.pill-content > .pill-pane, +.tab-content > div, +.pill-content > div { + display: none; +} +.tab-content > .active, .pill-content > .active { + display: block; +} +.breadcrumb { + padding: 7px 14px; + margin: 0 0 18px; + background-color: #f5f5f5; + background-repeat: repeat-x; + background-image: -khtml-gradient(linear, left top, left bottom, from(#ffffff), to(#f5f5f5)); + background-image: -moz-linear-gradient(top, #ffffff, #f5f5f5); + background-image: -ms-linear-gradient(top, #ffffff, #f5f5f5); + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffffff), color-stop(100%, #f5f5f5)); + background-image: -webkit-linear-gradient(top, #ffffff, #f5f5f5); + background-image: -o-linear-gradient(top, #ffffff, #f5f5f5); + background-image: linear-gradient(top, #ffffff, #f5f5f5); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f5f5f5', GradientType=0); + border: 1px solid #ddd; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + -webkit-box-shadow: inset 0 1px 0 #ffffff; + -moz-box-shadow: inset 0 1px 0 #ffffff; + box-shadow: inset 0 1px 0 #ffffff; +} +.breadcrumb li { + display: inline; + text-shadow: 0 1px 0 #ffffff; +} +.breadcrumb .divider { + padding: 0 5px; + color: #bfbfbf; +} +.breadcrumb .active a { + color: #404040; +} +.hero-unit { + background-color: #f5f5f5; + margin-bottom: 30px; + padding: 60px; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; +} +.hero-unit h1 { + margin-bottom: 0; + font-size: 60px; + line-height: 1; + letter-spacing: -1px; +} +.hero-unit p { + font-size: 18px; + font-weight: 200; + line-height: 27px; +} +footer { + margin-top: 17px; + padding-top: 17px; + border-top: 1px solid #eee; +} +.page-header { + margin-bottom: 17px; + border-bottom: 1px solid #ddd; + -webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); + -moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); + box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); +} +.page-header h1 { + margin-bottom: 8px; +} +.btn.danger, +.alert-message.danger, +.btn.danger:hover, +.alert-message.danger:hover, +.btn.error, +.alert-message.error, +.btn.error:hover, +.alert-message.error:hover, +.btn.success, +.alert-message.success, +.btn.success:hover, +.alert-message.success:hover, +.btn.info, +.alert-message.info, +.btn.info:hover, +.alert-message.info:hover { + color: #ffffff; +} +.btn .close, .alert-message .close { + font-family: Arial, sans-serif; + line-height: 18px; +} +.btn.danger, +.alert-message.danger, +.btn.error, +.alert-message.error { + background-color: #c43c35; + background-repeat: repeat-x; + background-image: -khtml-gradient(linear, left top, left bottom, from(#ee5f5b), to(#c43c35)); + background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35); + background-image: -ms-linear-gradient(top, #ee5f5b, #c43c35); + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ee5f5b), color-stop(100%, #c43c35)); + background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35); + background-image: -o-linear-gradient(top, #ee5f5b, #c43c35); + background-image: linear-gradient(top, #ee5f5b, #c43c35); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#c43c35', GradientType=0); + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + border-color: #c43c35 #c43c35 #882a25; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); +} +.btn.success, .alert-message.success { + background-color: #57a957; + background-repeat: repeat-x; + background-image: -khtml-gradient(linear, left top, left bottom, from(#62c462), to(#57a957)); + background-image: -moz-linear-gradient(top, #62c462, #57a957); + background-image: -ms-linear-gradient(top, #62c462, #57a957); + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #62c462), color-stop(100%, #57a957)); + background-image: -webkit-linear-gradient(top, #62c462, #57a957); + background-image: -o-linear-gradient(top, #62c462, #57a957); + background-image: linear-gradient(top, #62c462, #57a957); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#57a957', GradientType=0); + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + border-color: #57a957 #57a957 #3d773d; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); +} +.btn.info, .alert-message.info { + background-color: #339bb9; + background-repeat: repeat-x; + background-image: -khtml-gradient(linear, left top, left bottom, from(#5bc0de), to(#339bb9)); + background-image: -moz-linear-gradient(top, #5bc0de, #339bb9); + background-image: -ms-linear-gradient(top, #5bc0de, #339bb9); + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #5bc0de), color-stop(100%, #339bb9)); + background-image: -webkit-linear-gradient(top, #5bc0de, #339bb9); + background-image: -o-linear-gradient(top, #5bc0de, #339bb9); + background-image: linear-gradient(top, #5bc0de, #339bb9); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5bc0de', endColorstr='#339bb9', GradientType=0); + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + border-color: #339bb9 #339bb9 #22697d; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); +} +.btn { + cursor: pointer; + display: inline-block; + background-color: #e6e6e6; + background-repeat: no-repeat; + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), color-stop(25%, #ffffff), to(#e6e6e6)); + background-image: -webkit-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6); + background-image: -moz-linear-gradient(top, #ffffff, #ffffff 25%, #e6e6e6); + background-image: -ms-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6); + background-image: -o-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6); + background-image: linear-gradient(#ffffff, #ffffff 25%, #e6e6e6); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0); + padding: 5px 14px 6px; + text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); + color: #333; + font-size: 13px; + line-height: normal; + border: 1px solid #ccc; + border-bottom-color: #bbb; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + -webkit-transition: 0.1s linear all; + -moz-transition: 0.1s linear all; + -ms-transition: 0.1s linear all; + -o-transition: 0.1s linear all; + transition: 0.1s linear all; +} +.btn:hover { + background-position: 0 -15px; + color: #333; + text-decoration: none; +} +.btn:focus { + outline: 1px dotted #666; +} +.btn.primary { + color: #ffffff; + background-color: #0064cd; + background-repeat: repeat-x; + background-image: -khtml-gradient(linear, left top, left bottom, from(#049cdb), to(#0064cd)); + background-image: -moz-linear-gradient(top, #049cdb, #0064cd); + background-image: -ms-linear-gradient(top, #049cdb, #0064cd); + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #049cdb), color-stop(100%, #0064cd)); + background-image: -webkit-linear-gradient(top, #049cdb, #0064cd); + background-image: -o-linear-gradient(top, #049cdb, #0064cd); + background-image: linear-gradient(top, #049cdb, #0064cd); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#049cdb', endColorstr='#0064cd', GradientType=0); + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + border-color: #0064cd #0064cd #003f81; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); +} +.btn.active, .btn:active { + -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05); +} +.btn.disabled { + cursor: default; + background-image: none; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + filter: alpha(opacity=65); + -khtml-opacity: 0.65; + -moz-opacity: 0.65; + opacity: 0.65; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} +.btn[disabled] { + cursor: default; + background-image: none; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + filter: alpha(opacity=65); + -khtml-opacity: 0.65; + -moz-opacity: 0.65; + opacity: 0.65; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} +.btn.large { + font-size: 15px; + line-height: normal; + padding: 9px 14px 9px; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; +} +.btn.small { + padding: 7px 9px 7px; + font-size: 11px; +} +:root .alert-message, :root .btn { + border-radius: 0 \0; +} +button.btn::-moz-focus-inner, input[type=submit].btn::-moz-focus-inner { + padding: 0; + border: 0; +} +.close { + float: right; + color: #000000; + font-size: 20px; + font-weight: bold; + line-height: 13.5px; + text-shadow: 0 1px 0 #ffffff; + filter: alpha(opacity=25); + -khtml-opacity: 0.25; + -moz-opacity: 0.25; + opacity: 0.25; +} +.close:hover { + color: #000000; + text-decoration: none; + filter: alpha(opacity=40); + -khtml-opacity: 0.4; + -moz-opacity: 0.4; + opacity: 0.4; +} +.alert-message { + position: relative; + padding: 7px 15px; + margin-bottom: 18px; + color: #404040; + background-color: #eedc94; + background-repeat: repeat-x; + background-image: -khtml-gradient(linear, left top, left bottom, from(#fceec1), to(#eedc94)); + background-image: -moz-linear-gradient(top, #fceec1, #eedc94); + background-image: -ms-linear-gradient(top, #fceec1, #eedc94); + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fceec1), color-stop(100%, #eedc94)); + background-image: -webkit-linear-gradient(top, #fceec1, #eedc94); + background-image: -o-linear-gradient(top, #fceec1, #eedc94); + background-image: linear-gradient(top, #fceec1, #eedc94); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fceec1', endColorstr='#eedc94', GradientType=0); + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + border-color: #eedc94 #eedc94 #e4c652; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); + border-width: 1px; + border-style: solid; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25); +} +.alert-message .close { + margin-top: 1px; + *margin-top: 0; +} +.alert-message a { + font-weight: bold; + color: #404040; +} +.alert-message.danger p a, +.alert-message.error p a, +.alert-message.success p a, +.alert-message.info p a { + color: #ffffff; +} +.alert-message h5 { + line-height: 18px; +} +.alert-message p { + margin-bottom: 0; +} +.alert-message div { + margin-top: 5px; + margin-bottom: 2px; + line-height: 28px; +} +.alert-message .btn { + -webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25); + -moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25); + box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25); +} +.alert-message.block-message { + background-image: none; + background-color: #fdf5d9; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + padding: 14px; + border-color: #fceec1; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} +.alert-message.block-message ul, .alert-message.block-message p { + margin-right: 30px; +} +.alert-message.block-message ul { + margin-bottom: 0; +} +.alert-message.block-message li { + color: #404040; +} +.alert-message.block-message .alert-actions { + margin-top: 5px; +} +.alert-message.block-message.error, .alert-message.block-message.success, .alert-message.block-message.info { + color: #404040; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); +} +.alert-message.block-message.error { + background-color: #fddfde; + border-color: #fbc7c6; +} +.alert-message.block-message.success { + background-color: #d1eed1; + border-color: #bfe7bf; +} +.alert-message.block-message.info { + background-color: #ddf4fb; + border-color: #c6edf9; +} +.alert-message.block-message.danger p a, +.alert-message.block-message.error p a, +.alert-message.block-message.success p a, +.alert-message.block-message.info p a { + color: #404040; +} +.pagination { + height: 36px; + margin: 18px 0; +} +.pagination ul { + float: left; + margin: 0; + border: 1px solid #ddd; + border: 1px solid rgba(0, 0, 0, 0.15); + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); + -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); +} +.pagination li { + display: inline; +} +.pagination a { + float: left; + padding: 0 14px; + line-height: 34px; + border-right: 1px solid; + border-right-color: #ddd; + border-right-color: rgba(0, 0, 0, 0.15); + *border-right-color: #ddd; + /* IE6-7 */ + + text-decoration: none; +} +.pagination a:hover, .pagination .active a { + background-color: #c7eefe; +} +.pagination .disabled a, .pagination .disabled a:hover { + background-color: transparent; + color: #bfbfbf; +} +.pagination .next a { + border: 0; +} +.well { + background-color: #f5f5f5; + margin-bottom: 20px; + padding: 19px; + min-height: 20px; + border: 1px solid #eee; + border: 1px solid rgba(0, 0, 0, 0.05); + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); +} +.well blockquote { + border-color: #ddd; + border-color: rgba(0, 0, 0, 0.15); +} +.modal-backdrop { + background-color: #000000; + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 10000; +} +.modal-backdrop.fade { + opacity: 0; +} +.modal-backdrop, .modal-backdrop.fade.in { + filter: alpha(opacity=80); + -khtml-opacity: 0.8; + -moz-opacity: 0.8; + opacity: 0.8; +} +.modal { + position: fixed; + top: 50%; + left: 50%; + z-index: 11000; + width: 560px; + margin: -250px 0 0 -280px; + background-color: #ffffff; + border: 1px solid #999; + border: 1px solid rgba(0, 0, 0, 0.3); + *border: 1px solid #999; + /* IE6-7 */ + + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; + -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); + -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); + box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); + -webkit-background-clip: padding-box; + -moz-background-clip: padding-box; + background-clip: padding-box; +} +.modal .close { + margin-top: 7px; +} +.modal.fade { + -webkit-transition: opacity .3s linear, top .3s ease-out; + -moz-transition: opacity .3s linear, top .3s ease-out; + -ms-transition: opacity .3s linear, top .3s ease-out; + -o-transition: opacity .3s linear, top .3s ease-out; + transition: opacity .3s linear, top .3s ease-out; + top: -25%; +} +.modal.fade.in { + top: 50%; +} +.modal-header { + border-bottom: 1px solid #eee; + padding: 5px 15px; +} +.modal-body { + padding: 15px; +} +.modal-body form { + margin-bottom: 0; +} +.modal-footer { + background-color: #f5f5f5; + padding: 14px 15px 15px; + border-top: 1px solid #ddd; + -webkit-border-radius: 0 0 6px 6px; + -moz-border-radius: 0 0 6px 6px; + border-radius: 0 0 6px 6px; + -webkit-box-shadow: inset 0 1px 0 #ffffff; + -moz-box-shadow: inset 0 1px 0 #ffffff; + box-shadow: inset 0 1px 0 #ffffff; + zoom: 1; + margin-bottom: 0; +} +.modal-footer:before, .modal-footer:after { + display: table; + content: ""; + zoom: 1; +} +.modal-footer:after { + clear: both; +} +.modal-footer .btn { + float: right; + margin-left: 5px; +} +.modal .popover, .modal .twipsy { + z-index: 12000; +} +.twipsy { + display: block; + position: absolute; + visibility: visible; + padding: 5px; + font-size: 11px; + z-index: 1000; + filter: alpha(opacity=80); + -khtml-opacity: 0.8; + -moz-opacity: 0.8; + opacity: 0.8; +} +.twipsy.fade.in { + filter: alpha(opacity=80); + -khtml-opacity: 0.8; + -moz-opacity: 0.8; + opacity: 0.8; +} +.twipsy.above .twipsy-arrow { + bottom: 0; + left: 50%; + margin-left: -5px; + border-left: 5px solid transparent; + border-right: 5px solid transparent; + border-top: 5px solid #000000; +} +.twipsy.left .twipsy-arrow { + top: 50%; + right: 0; + margin-top: -5px; + border-top: 5px solid transparent; + border-bottom: 5px solid transparent; + border-left: 5px solid #000000; +} +.twipsy.below .twipsy-arrow { + top: 0; + left: 50%; + margin-left: -5px; + border-left: 5px solid transparent; + border-right: 5px solid transparent; + border-bottom: 5px solid #000000; +} +.twipsy.right .twipsy-arrow { + top: 50%; + left: 0; + margin-top: -5px; + border-top: 5px solid transparent; + border-bottom: 5px solid transparent; + border-right: 5px solid #000000; +} +.twipsy-inner { + padding: 3px 8px; + background-color: #000000; + color: white; + text-align: center; + max-width: 200px; + text-decoration: none; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.twipsy-arrow { + position: absolute; + width: 0; + height: 0; +} +.popover { + position: absolute; + top: 0; + left: 0; + z-index: 1000; + padding: 5px; + display: none; +} +.popover.above .arrow { + bottom: 0; + left: 50%; + margin-left: -5px; + border-left: 5px solid transparent; + border-right: 5px solid transparent; + border-top: 5px solid #000000; +} +.popover.right .arrow { + top: 50%; + left: 0; + margin-top: -5px; + border-top: 5px solid transparent; + border-bottom: 5px solid transparent; + border-right: 5px solid #000000; +} +.popover.below .arrow { + top: 0; + left: 50%; + margin-left: -5px; + border-left: 5px solid transparent; + border-right: 5px solid transparent; + border-bottom: 5px solid #000000; +} +.popover.left .arrow { + top: 50%; + right: 0; + margin-top: -5px; + border-top: 5px solid transparent; + border-bottom: 5px solid transparent; + border-left: 5px solid #000000; +} +.popover .arrow { + position: absolute; + width: 0; + height: 0; +} +.popover .inner { + background: #000000; + background: rgba(0, 0, 0, 0.8); + padding: 3px; + overflow: hidden; + width: 280px; + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; + -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); + -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); + box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); +} +.popover .title { + background-color: #f5f5f5; + padding: 9px 15px; + line-height: 1; + -webkit-border-radius: 3px 3px 0 0; + -moz-border-radius: 3px 3px 0 0; + border-radius: 3px 3px 0 0; + border-bottom: 1px solid #eee; +} +.popover .content { + background-color: #ffffff; + padding: 14px; + -webkit-border-radius: 0 0 3px 3px; + -moz-border-radius: 0 0 3px 3px; + border-radius: 0 0 3px 3px; + -webkit-background-clip: padding-box; + -moz-background-clip: padding-box; + background-clip: padding-box; +} +.popover .content p, .popover .content ul, .popover .content ol { + margin-bottom: 0; +} +.fade { + -webkit-transition: opacity 0.15s linear; + -moz-transition: opacity 0.15s linear; + -ms-transition: opacity 0.15s linear; + -o-transition: opacity 0.15s linear; + transition: opacity 0.15s linear; + opacity: 0; +} +.fade.in { + opacity: 1; +} +.label { + padding: 1px 3px 2px; + font-size: 9.75px; + font-weight: bold; + color: #ffffff; + text-transform: uppercase; + white-space: nowrap; + background-color: #bfbfbf; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} +.label.important { + background-color: #c43c35; +} +.label.warning { + background-color: #f89406; +} +.label.success { + background-color: #46a546; +} +.label.notice { + background-color: #62cffc; +} +.media-grid { + margin-left: -20px; + margin-bottom: 0; + zoom: 1; +} +.media-grid:before, .media-grid:after { + display: table; + content: ""; + zoom: 1; +} +.media-grid:after { + clear: both; +} +.media-grid li { + display: inline; +} +.media-grid a { + float: left; + padding: 4px; + margin: 0 0 18px 20px; + border: 1px solid #ddd; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075); + -moz-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075); +} +.media-grid a img { + display: block; +} +.media-grid a:hover { + border-color: #0069d6; + -webkit-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25); + -moz-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25); + box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25); +} \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/resources/jquery.min.js b/node_modules/dustjs-linkedin/node_modules/cover/resources/jquery.min.js new file mode 100644 index 0000000..ee02337 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/resources/jquery.min.js @@ -0,0 +1,4 @@ +/*! jQuery v1.7.1 jquery.com | jquery.org/license */ +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
        a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
        "+""+"
        ",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
        t
        ",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
        ",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; +f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

        ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
        ";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
        ","
        "],thead:[1,"","
        "],tr:[2,"","
        "],td:[3,"","
        "],col:[2,"","
        "],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
        ","
        "]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() +{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
        ").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/resources/jquery.tablesorter.min.js b/node_modules/dustjs-linkedin/node_modules/cover/resources/jquery.tablesorter.min.js new file mode 100644 index 0000000..4f8c77c --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/resources/jquery.tablesorter.min.js @@ -0,0 +1,4 @@ + +(function($){$.extend({tablesorter:new +function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'/\.|\,/g',onRenderHeader:null,selectorHeaders:'thead th',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}if(table.tBodies.length==0)return;var rows=table.tBodies[0].rows;if(rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function checkHeaderOptionsSortingLocked(table,i){if((table.config.headers[i])&&(table.config.headers[i].lockedOrder))return table.config.headers[i].lockedOrder;return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('
        ').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i b["+i+"]) ? 1 : 0));";};function makeSortTextDesc(i){return"((b["+i+"] < a["+i+"]) ? -1 : ((b["+i+"] > a["+i+"]) ? 1 : 0));";};function makeSortNumeric(i){return"a["+i+"]-b["+i+"];";};function makeSortNumericDesc(i){return"b["+i+"]-a["+i+"];";};function sortText(a,b){if(table.config.sortLocaleCompare)return a.localeCompare(b);return((ab)?1:0));};function sortTextDesc(a,b){if(table.config.sortLocaleCompare)return b.localeCompare(a);return((ba)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){$this.trigger("sortStart");var $cell=$(this);var i=this.column;this.order=this.count++%2;if(this.lockedOrder)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), +l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, +q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, +q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, +"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), +a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} +for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], +"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], +H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], +J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ +I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), +["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", +/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), +["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", +hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= +!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p + + + + <%= filename %> -- cover.io + + + + + + + + + + + + + + + + + + + + + + + +
        +
        +
        + « index +

        Coverage for <%= filename %> : <%= stats.percentage %>

        +
        + <%= stats.totalLines %> lines | + <%= stats.seenLines %> run | + <%= stats.missingLines %> missing | + <%= stats.partialLines %> partial | + <%= stats.totalBlocks %> blocks | + <%= stats.seenBlocks %> blocks run | + <%= stats.missingBlocks %> blocks missing +
        +
        +
        +
        + + + <%= code %> + + +
        + « index | cover.io + + + diff --git a/node_modules/dustjs-linkedin/node_modules/cover/templates/index.html b/node_modules/dustjs-linkedin/node_modules/cover/templates/index.html new file mode 100644 index 0000000..59986c0 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/templates/index.html @@ -0,0 +1,110 @@ + + + + + + Coverage Report -- cover.io + + + + + + + + + + + + + + + + + + + + + + + +
        + +
        +
        +
        +

        Coverage Report

        + + + + <% _.each(headers, function(header) { %> <% }); %> + + + + <% _.each(data, function(fileData) { %> + + <% _.each(fileData, function(cell, index) { %> + <% if (index === 0) { %> + + <% } %> + <% }); %> + + <% }); %> + +
        <%= header %>
        <%= cell %> + <% } else { %> + <%= cell %>
        +
        +
        +
        + + + +
        + + + diff --git a/node_modules/dustjs-linkedin/node_modules/cover/templates/instrumentation_header.js b/node_modules/dustjs-linkedin/node_modules/cover/templates/instrumentation_header.js new file mode 100644 index 0000000..bb8b949 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/templates/instrumentation_header.js @@ -0,0 +1,28 @@ + +// Instrumentation Header +{ + var <%= instrumented.names.statement %>, <%= instrumented.names.expression %>, <%= instrumented.names.block %>; + var store = require('<%= coverageStorePath %>'); + var data = store.register('<%= filename %>'); + var nodes = data.nodes; + var blocks = data.blocks; + + <%= instrumented.names.statement %> = function(i) { + var node = nodes[i] = (nodes[i] || {index: i, count:0}) + node.count++; + }; + + <%= instrumented.names.expression %> = function(i) { + var node = nodes[i] = (nodes[i] || {index: i, count:0}) + node.count++; + }; + + <%= instrumented.names.block %> = function(i) { + var block = blocks[i] = (blocks[i] || {index: i, count:0}) + block.count++; + }; +}; +//////////////////////// + +// Instrumented Code +<%= source %> \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/test/format/index.js b/node_modules/dustjs-linkedin/node_modules/cover/test/format/index.js new file mode 100644 index 0000000..278da61 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/test/format/index.js @@ -0,0 +1,49 @@ +#!/usr/bin/env node + +var runforcover = require("../../index"); +var fs = require('fs'); +var path = require('path'); + +var coverage = runforcover.cover(); + +var test1 = require("./src/test1"); +var test2 = require("./src/test2"); + +test1.run(); +test2.run(); + +var types = ['html', 'plain', 'json']; +var outDir = 'test-out'; +try { + fs.statSync(outDir); +} catch (e) { + fs.mkdirSync(outDir, 0755); +} + +coverage(function(coverageData) { + // coverageData is an object keyed by filename. + for(var filename in coverageData) { + if (!coverageData.hasOwnProperty(filename)) { + continue; + } + + types.forEach(function (type) { + + var result = runforcover.formatters[type].format(coverageData[filename]); + var filePath = path.join(outDir, path.basename(filename) + "." + type); + + if (type === 'html') { + result = "" + "\n" + + result; + } + fs.writeFileSync(filePath, result); + }); + + // return control back to the original require function + coverage.release(); + } +}); diff --git a/node_modules/dustjs-linkedin/node_modules/cover/test/format/src/test1.js b/node_modules/dustjs-linkedin/node_modules/cover/test/format/src/test1.js new file mode 100644 index 0000000..9a613a0 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/test/format/src/test1.js @@ -0,0 +1,59 @@ +exports.run = function() { + + var abc = function() { + a = 4; + return true; + } + + if (0) { console.log(1); } a = 3; if (0) { console.log(3) } + + if (0) { + console.log(1); + console.log(2); + if (abc()) { console.log(3); console.log(4); } + return; + } + + var printhello = function() { + a = 1; + } + + var printgoodbye = function() { + a + 2; + } + + // Yo yo + printhello(); + + // Hey hey + if (false) { + if (0) { + + console.log(1); + } + + a = function() { + a = 1 + 1 + + 1 + 1 + + 1 + 1; + + b = [ 1, 2, + 3, 4]; + + c = [ + 1, + 2, 3, + 4 + ]; + + if (1 && 2 + && 3 && 4) { + e = 2; + } + } + + if (0) { + console.log(2) + } + } +}; \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/test/format/src/test2.js b/node_modules/dustjs-linkedin/node_modules/cover/test/format/src/test2.js new file mode 100644 index 0000000..24cf742 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/test/format/src/test2.js @@ -0,0 +1,8 @@ +exports.run = function(a) { + if (a < 0) { + console.log("less!"); + } + else { + console.log("more!"); + } +}; \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/test/index.js b/node_modules/dustjs-linkedin/node_modules/cover/test/index.js new file mode 100644 index 0000000..ea59662 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/test/index.js @@ -0,0 +1 @@ +require('./interface').coverageInterface() diff --git a/node_modules/dustjs-linkedin/node_modules/cover/test/interface.js b/node_modules/dustjs-linkedin/node_modules/cover/test/interface.js new file mode 100644 index 0000000..a6455ed --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/test/interface.js @@ -0,0 +1,50 @@ +var assert = require('assert'); +var runforcover = require('../'); + +exports.coverageInterface = function() { + assert.ok(runforcover.cover); + + var originalRequire = require.extensions['.js']; + + var coverage = runforcover.cover(); + + assert.notEqual(originalRequire, require.extensions['.js']); + + var file = require('./src/coverage'); + + coverage(function(coverageData) { + assert.equal(Object.keys(coverageData).length, 1); + assert.equal(Object.keys(coverageData)[0], __dirname + '/src/coverage.js'); + + var fileCoverageData = coverageData[Object.keys(coverageData)[0]]; + + assert.ok(fileCoverageData.stats); + assert.ok(fileCoverageData.missing); + + var stats = fileCoverageData.stats(); + + assert.ok(stats.percentage !== undefined); + assert.ok(stats.lines !== undefined); + assert.ok(stats.missing !== undefined); + assert.ok(stats.seen !== undefined); + + assert.equal(stats.lines.length, 3); + assert.equal(stats.lines[0].source(), ' if(a > 0) {'); + assert.equal(stats.lines[1].source(), ' return a + 1;'); + assert.equal(stats.lines[2].source(), ' return a - 1;'); + + file.something(1); + stats = fileCoverageData.stats(); + + assert.equal(stats.lines.length, 1); + assert.equal(stats.lines[0].source(), ' return a - 1;'); + + file.something(-1); + stats = fileCoverageData.stats(); + + assert.equal(stats.lines.length, 0); + + coverage.release(); + assert.equal(require.extensions['.js'], originalRequire); + }); +}; diff --git a/node_modules/dustjs-linkedin/node_modules/cover/test/src/coverage.js b/node_modules/dustjs-linkedin/node_modules/cover/test/src/coverage.js new file mode 100644 index 0000000..4dd9a76 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/test/src/coverage.js @@ -0,0 +1,79 @@ +var a = 5 || (c = 5); + +exports.something = function(a) { + if(a > 0) { + b = 1; + c = 2; + d = 3; + } else { + b = 1; + c = function() { + return 5; + }; + d = function() { return 6; + a = 5;}; + f = 11; + if (1) f = 1; if (0) f = 2; + return [a + 1, a + 2, c(), d()]; + return a - 1; + } +}; + +a = function() { + return true; +} + +b = function() { + aa = 5; + return true; +} + +c = function() { + bb = 6; + return false; +} + +if (a() || b() && c()) { + c = 5; +} + +b = function() { + if (a < 0) return; + + a = 1; + b = 2; + c = 3; +} + +b2 = function() { + a2 = 1; + b2 = 2; + c2 = 3; +} + +d = 3; +e = (function() { return 6; })() + +f = d || (g = 3); + +var cond = function() { + return true ? a() : b(); +} + +cond(); + +var g = 1; +g++; + +/*c = 1; +d = function() { + return 1; +} + +e = (function() { + if (1) { + return 2; + } +})(); + +f = 1;*/ \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/test/test.js b/node_modules/dustjs-linkedin/node_modules/cover/test/test.js new file mode 100644 index 0000000..7598478 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/test/test.js @@ -0,0 +1,6 @@ + +var src = require("./src/coverage") + +src.something(process.argv[2] || 0); + +//console.log(src.something(0)); \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/cover/utils/console.js b/node_modules/dustjs-linkedin/node_modules/cover/utils/console.js new file mode 100644 index 0000000..216b43c --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/cover/utils/console.js @@ -0,0 +1,77 @@ +/* + A console.log that won't leave you hanging when node exits + 90% of this file was ripped from node.js + + License: see: https://github.com/joyent/node/blob/master/lib/console.js + */ + +var util = require('util'); +var fs = require("fs"); + +/* Monkey patching */ +if (!util.format) { + var formatRegExp = /%[sdj%]/g; + util.format = function(f) { + if (typeof f !== 'string') { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(util.inspect(arguments[i])); + } + return objects.join(' '); + } + + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x) { + if (i >= len) return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': return JSON.stringify(args[i++]); + case '%%': return '%'; + default: + return x; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (x === null || typeof x !== 'object') { + str += ' ' + x; + } else { + str += ' ' + util.inspect(x); + } + } + return str; + } +} + +var consoleFlush = function(data) { + if (!Buffer.isBuffer(data)) { + data= new Buffer(''+ data); + } + if (data.length) { + var written= 0; + do { + try { + var len = data.length- written; + written += fs.writeSync(process.stdout.fd, data, written, len, -1); + } + catch (e) { + } + } while(written < data.length); + } +}; + +var originalConsoleLog = console.log; +var patchedConsoleLog = function() { + var str = util.format.apply(null, arguments) + "\n"; + consoleFlush(str); +}; + +exports.patch = function() { + console.log = patchedConsoleLog; +} + +exports.unpatch = function() { + console.log = originalConsoleLog; +} \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/.npmignore b/node_modules/dustjs-linkedin/node_modules/jasmine-node/.npmignore new file mode 100755 index 0000000..c72cd43 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/.npmignore @@ -0,0 +1,12 @@ +.DS_Store +.idea +*.iml +*.ipr +*.iws +*.tmproj +.project +.settings +.externalToolBuilders +*.swp +node_modules +*~ diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/.travis.yml b/node_modules/dustjs-linkedin/node_modules/jasmine-node/.travis.yml new file mode 100644 index 0000000..c6eab65 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +node_js: + - 0.6 +branches: + only: + - travis diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/LICENSE b/node_modules/dustjs-linkedin/node_modules/jasmine-node/LICENSE new file mode 100755 index 0000000..b6ad6d3 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/LICENSE @@ -0,0 +1,22 @@ +The MIT License + +Copyright (c) 2010 Adam Abrons and Misko Hevery http://getangular.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. + diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/README.md b/node_modules/dustjs-linkedin/node_modules/jasmine-node/README.md new file mode 100644 index 0000000..a4e5fd5 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/README.md @@ -0,0 +1,83 @@ +jasmine-node +====== + +[![Build Status](https://secure.travis-ci.org/spaghetticode/jasmine-node.png)](http://travis-ci.org/spaghetticode/jasmine-node) + +This node.js module makes the wonderful Pivotal Lab's jasmine +(http://github.com/pivotal/jasmine) spec framework available in +node.js. + +install +------ + npm install jasmine-node -g + +usage +------ + +Write the specifications for your code in *.js and *.coffee files in the +spec/ directory (note: your specification files must end with either +.spec.js or .spec.coffee; otherwise jasmine-node won't find them!). You +can use sub-directories to better organise your specs. + +If you have installed the npm package, you can run it with: + + jasmine-node + +If you aren't using npm, you should add `pwd`/lib to the $NODE_PATH +environment variable, then run: + + node lib/jasmine-node/cli.js + + +You can supply the following arguments: + + * --autotest, provides automatic execution of specs after + each changes + * --coffee, allow execution of .coffee specs + * --color, indicates spec output should uses color to +indicates passing (green) or failing (red) specs + * --noColor, do not use color in the output + * --verbose, verbose output as the specs are run + * --junitreport, export tests results as junitreport xml format' + +Checkout spec/SampleSpecs.js to see how to use it. + +async tests +----------- + +jasmine-node includes an alternate syntax for writing asynchronous tests. Accepting +a done callback in the specification will trigger jasmine-node to run the test +asynchronously waiting until the done() callback is called. + +```javascript + it("should respond with hello world", function(done) { + request("http://localhost:3000/hello", function(error, response, body){ + expect(body).toEqual("hello world"); + done(); + }); + }); +``` + +An asynchronous test will fail after 5000 ms if done() is not called. This timeout +can be changed by setting jasmine.DEFAULT_TIMEOUT_INTERVAL or by passing a timeout +interval in the specification. + + it("should respond with hello world", function(done) { + request("http://localhost:3000/hello", function(error, response, body){ + done(); + }, 250); // timeout after 250 ms + }); + +development +----------- +Install the dependent packages by running: + + npm install + +Run the specs before you send your pull request: + + scripts/specs + +or + + scripts/specs --verbose diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/bin/jasmine-node b/node_modules/dustjs-linkedin/node_modules/jasmine-node/bin/jasmine-node new file mode 100755 index 0000000..86e4492 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/bin/jasmine-node @@ -0,0 +1,7 @@ +#!/usr/bin/env node + +if( !process.env.NODE_ENV ) process.env.NODE_ENV = 'test'; + +var path = require('path'); +var fs = require('fs'); +require(path.join(__dirname,'../lib/jasmine-node/cli.js')); diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/async-callback.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/async-callback.js new file mode 100644 index 0000000..893c140 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/async-callback.js @@ -0,0 +1,54 @@ +(function() { + var withoutAsync = {}; + + ["it", "beforeEach", "afterEach"].forEach(function(jasmineFunction) { + withoutAsync[jasmineFunction] = jasmine.Env.prototype[jasmineFunction]; + return jasmine.Env.prototype[jasmineFunction] = function() { + var args = Array.prototype.slice.call(arguments, 0); + var timeout = null; + if (isLastArgumentATimeout(args)) { + timeout = args.pop(); + } + if (isLastArgumentAnAsyncSpecFunction(args)) + { + var specFunction = args.pop(); + args.push(function() { + return asyncSpec(specFunction, this, timeout); + }); + } + return withoutAsync[jasmineFunction].apply(this, args); + }; + }); + + function isLastArgumentATimeout(args) + { + return args.length > 0 && (typeof args[args.length-1]) === "number"; + } + + function isLastArgumentAnAsyncSpecFunction(args) + { + return args.length > 0 && (typeof args[args.length-1]) === "function" && args[args.length-1].length > 0; + } + + function asyncSpec(specFunction, spec, timeout) { + if (timeout == null) timeout = jasmine.DEFAULT_TIMEOUT_INTERVAL || 1000; + var done = false; + spec.runs(function() { + try { + return specFunction(function(error) { + done = true; + if (error != null) return spec.fail(error); + }); + } catch (e) { + done = true; + throw e; + } + }); + return spec.waitsFor(function() { + if (done === true) { + return true; + } + }, "spec to complete", timeout); + }; + +}).call(this); diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/autotest.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/autotest.js new file mode 100644 index 0000000..2ff8d62 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/autotest.js @@ -0,0 +1,90 @@ +var walkdir = require('walkdir'); +var collection = require('./spec-collection'); +var path = require('path'); +var fs = require('fs'); +var child_process = require('child_process'); + +var baseArgv = []; + +for(var i = 0; i < process.argv.length; i++) { + if(process.argv[i] !== '--autotest') { + baseArgv.push(process.argv[i]); + } +} + +var run_external = function(command, args, callback) { + var child = child_process.spawn(command, args); + child.stdout.on('data', function(data) { + process.stdout.write(data); + }); + child.stderr.on('data', function(data) { + process.stderr.write(data); + }); + if(typeof callback == 'function') { + child.on('exit', callback); + } +} + +var run_everything = function() { + // run the suite when it starts + var argv = [].concat(baseArgv); + run_external(argv.shift(), argv, function() { console.log(arguments) }); +} + +var last_run_succesful = true; + +var watchFile = function(file, stat) { + + var file = path.normalize(file) + + var prevStats = stat; + + var watcher = fs.watch(file, function(ev) { + + if(!path.existsSync(file)) { + watcher.close(); + return; + } + + var currStats = fs.statSync( file ); + + if(prevStats.mtime.getTime() != currStats.mtime.getTime()) { + prevStats = currStats; + + // narrow down a pattern to reduce the specs runned + var match = path.basename(file, path.extname(file)) + ".*"; + match = match.replace(new RegExp("spec", "i"), ""); + + // so we need to rerun the jasmine suite + var argv = [].concat(baseArgv, ["--match", match]); + run_external(argv.shift(), argv, function(code) { + // run everything if we fixed some bugs + if(code == 0) { + if(!last_run_succesful) { + run_everything(); + } + last_run_succesful = true; + } else { + last_run_succesful = false; + } + }); + } + }); +} + + +exports.start = function(loadpath, pattern) { + + var finder = walkdir.find(loadpath); + + finder.on('file', function(file, stat) { + var basename = path.basename(file); + + if(pattern.test(basename)) { + watchFile(file,stat); + } + + }); + + run_everything(); +} diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/cli.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/cli.js new file mode 100755 index 0000000..e16fd69 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/cli.js @@ -0,0 +1,176 @@ +var jasmine = require('./index'); +var util, + Path= require('path'); +try { + util = require('util') +} catch(e) { + util = require('sys') +} + +var helperCollection = require('./spec-collection'); + +var specFolder = null; + +for (var key in jasmine) + global[key] = jasmine[key]; + +var isVerbose = false; +var showColors = true; +var teamcity = process.env.TEAMCITY_PROJECT_NAME || false; +var useRequireJs = false; +var extentions = "js"; +var match = '.'; +var matchall = false; +var autotest = false; +var useHelpers = true; +var forceExit = false; + +var junitreport = { + report: false, + savePath : "./reports/", + useDotNotation: true, + consolidate: true +} + +var args = process.argv.slice(2); + +while(args.length) { + var arg = args.shift(); + + switch(arg) + { + case '--color': + showColors = true; + break; + case '--noColor': + case '--nocolor': + showColors = false; + break; + case '--verbose': + isVerbose = true; + break; + case '--coffee': + require('coffee-script'); + extentions = "js|coffee"; + break; + case '-m': + case '--match': + match = args.shift(); + break; + case '--matchall': + matchall = true; + break; + case '--junitreport': + junitreport.report = true; + break; + case '--output': + junitreport.savePath = args.shift(); + break; + case '--teamcity': + teamcity = true; + break; + case '--runWithRequireJs': + useRequireJs = true; + break; + case '--nohelpers': + useHelpers = false; + break; + case '--test-dir': + var dir = args.shift(); + + if(!Path.existsSync(dir)) + throw new Error("Test root path '" + dir + "' doesn't exist!"); + + specFolder = dir; // NOTE: Does not look from current working directory. + break; + case '--autotest': + autotest = true; + break; + case '--forceexit': + forceExit = true; + break; + case '-h': + help(); + default: + if (arg.match(/^--/)) help(); + if (arg.match(/^\/.*/)) { + specFolder = arg; + } else { + specFolder = Path.join(process.cwd(), arg); + } + break; + } +} + +if (!specFolder) { + help(); +} + +if (autotest) { + require('./autotest').start(specFolder, + new RegExp(".+\\.(" + extentions + ")$", "i")); + return; +} + +var exitCode = 0; + +process.on("exit", onExit); + +function onExit() { + process.removeListener("exit", onExit); + process.exit(exitCode); +} + +var onComplete = function(runner, log) { + util.print('\n'); + if (runner.results().failedCount == 0) { + exitCode = 0; + } else { + exitCode = 1; + } + if (forceExit) { + process.exit(exitCode); + } +}; + +if(useHelpers){ + jasmine.loadHelpersInFolder(specFolder, + new RegExp("helpers?\\.(" + extentions + ")$", 'i')); +} + +var regExpSpec = new RegExp(match + (matchall ? "" : "spec\\.") + "(" + extentions + ")$", 'i') + +jasmine.executeSpecsInFolder(specFolder, + onComplete, + isVerbose, + showColors, + teamcity, + useRequireJs, + regExpSpec, + junitreport); + +function help(){ + util.print([ + 'USAGE: jasmine-node [--color|--noColor] [--verbose] [--coffee] directory' + , '' + , 'Options:' + , ' --autotest - rerun automatically the specs when a file changes' + , ' --color - use color coding for output' + , ' --noColor - do not use color coding for output' + , ' -m, --match REGEXP - load only specs containing "REGEXPspec"' + , ' --matchall - relax requirement of "spec" in spec file names' + , ' --verbose - print extra information per each test run' + , ' --coffee - load coffee-script which allows execution .coffee files' + , ' --junitreport - export tests results as junitreport xml format' + , ' --output - defines the output folder for junitreport files' + , ' --teamcity - converts all console output to teamcity custom test runner commands. (Normally auto detected.)' + , ' --runWithRequireJs - loads all specs using requirejs instead of node\'s native require method' + , ' --test-dir - the absolute root directory path where tests are located' + , ' --nohelpers - does not load helpers.' + , ' --forceexit - force exit once tests complete.' + , ' -h, --help - display this help and exit' + , '' + ].join("\n")); + + process.exit(-1); +} diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/index.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/index.js new file mode 100755 index 0000000..0444f53 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/index.js @@ -0,0 +1,148 @@ +var fs = require('fs'); +var util; +try { + util = require('util') +} catch(e) { + util = require('sys') +} + +var path = require('path'); + +var filename = __dirname + '/jasmine-2.0.0.rc1.js'; +global.window = { + setTimeout: setTimeout, + clearTimeout: clearTimeout, + setInterval: setInterval, + clearInterval: clearInterval +}; + +var src = fs.readFileSync(filename); +var jasmine; +var minorVersion = process.version.match(/\d\.(\d)\.\d/)[1]; +switch (minorVersion) { + case "1": + case "2": + jasmine = process.compile(src + '\njasmine;', filename); + break; + default: + jasmine = require('vm').runInThisContext(src + "\njasmine;", filename); +} + +delete global.window; +require("./async-callback"); +require("jasmine-reporters"); + +var jasmineNode = require('./reporter').jasmineNode; + +jasmine.loadHelpersInFolder=function(folder, matcher) +{ + var helpers = [], + helperCollection = require('./spec-collection'); + + helperCollection.load(folder, matcher); + helpers = helperCollection.getSpecs(); + + for (var i = 0, len = helpers.length; i < len; ++i) + { + var file = helpers[i].path(); + var helper= require(file.replace(/\.*$/, "")); + for (var key in helper) + global[key]= helper[key]; + } +}; + +function removeJasmineFrames(text) { + var lines = []; + text.split(/\n/).forEach(function(line){ + if (line.indexOf(filename) == -1) { + lines.push(line); + } + }); + return lines.join('\n'); +} + +jasmine.executeSpecsInFolder = function(folder, + done, + isVerbose, + showColors, + teamcity, + useRequireJs, + matcher, + junitreport){ + var fileMatcher = matcher || new RegExp(".(js)$", "i"), + colors = showColors || false, + specs = require('./spec-collection'), + jasmineEnv = jasmine.getEnv(); + + specs.load(folder, fileMatcher); + + if(junitreport && junitreport.report) { + if(!path.existsSync(junitreport.savePath)) { + util.puts('creating junit xml report save path: ' + junitreport.savePath); + fs.mkdirSync(junitreport.savePath, "0755"); + } + jasmineEnv.addReporter(new jasmine.JUnitXmlReporter(junitreport.savePath, + junitreport.consolidate, + junitreport.useDotNotation)); + } + + if(teamcity){ + jasmineEnv.addReporter(new jasmineNode.TerminalReporter({print: util.print, + color: false, + onComplete: done, + stackFilter: removeJasmineFrames})); + } else if(isVerbose) { + jasmineEnv.addReporter(new jasmineNode.TerminalVerboseReporter({ print: util.print, + color: showColors, + onComplete: done, + stackFilter: removeJasmineFrames})); + } else { + jasmineEnv.addReporter(new jasmineNode.TerminalReporter({print: util.print, + color: showColors, + onComplete: done, + stackFilter: removeJasmineFrames})); + } + + if (useRequireJs) { + require('./requirejs-runner').executeJsRunner(specs, done, jasmineEnv); + } else { + var specsList = specs.getSpecs(); + + for (var i = 0, len = specsList.length; i < len; ++i) { + var filename = specsList[i]; + require(filename.path().replace(/\.\w+$/, "")); + } + + jasmineEnv.execute(); + } +}; + +function now(){ + return new Date().getTime(); +} + +jasmine.asyncSpecWait = function(){ + var wait = jasmine.asyncSpecWait; + wait.start = now(); + wait.done = false; + (function innerWait(){ + waits(10); + runs(function() { + if (wait.start + wait.timeout < now()) { + expect('timeout waiting for spec').toBeNull(); + } else if (wait.done) { + wait.done = false; + } else { + innerWait(); + } + }); + })(); +}; +jasmine.asyncSpecWait.timeout = 4 * 1000; +jasmine.asyncSpecDone = function(){ + jasmine.asyncSpecWait.done = true; +}; + +for ( var key in jasmine) { + exports[key] = jasmine[key]; +} diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js new file mode 100644 index 0000000..eeac8ae --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/jasmine-2.0.0.rc1.js @@ -0,0 +1,2479 @@ +var isCommonJS = typeof window == "undefined"; + +/** + * Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework. + * + * @namespace + */ +var jasmine = {}; +if (isCommonJS) exports.jasmine = jasmine; +/** + * @private + */ +jasmine.unimplementedMethod_ = function() { + throw new Error("unimplemented method"); +}; + +/** + * Use jasmine.undefined instead of undefined, since undefined is just + * a plain old variable and may be redefined by somebody else. + * + * @private + */ +jasmine.undefined = jasmine.___undefined___; + +/** + * Show diagnostic messages in the console if set to true + * + */ +jasmine.VERBOSE = false; + +/** + * Default interval in milliseconds for event loop yields (e.g. to allow network activity or to refresh the screen with the HTML-based runner). Small values here may result in slow test running. Zero means no updates until all tests have completed. + * + */ +jasmine.DEFAULT_UPDATE_INTERVAL = 250; + +/** + * Default timeout interval in milliseconds for waitsFor() blocks. + */ +jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000; + +jasmine.getGlobal = function() { + function getGlobal() { + return this; + } + + return getGlobal(); +}; + +/** + * Allows for bound functions to be compared. Internal use only. + * + * @ignore + * @private + * @param base {Object} bound 'this' for the function + * @param name {Function} function to find + */ +jasmine.bindOriginal_ = function(base, name) { + var original = base[name]; + if (original.apply) { + return function() { + return original.apply(base, arguments); + }; + } else { + // IE support + return jasmine.getGlobal()[name]; + } +}; + +jasmine.setTimeout = jasmine.bindOriginal_(jasmine.getGlobal(), 'setTimeout'); +jasmine.clearTimeout = jasmine.bindOriginal_(jasmine.getGlobal(), 'clearTimeout'); +jasmine.setInterval = jasmine.bindOriginal_(jasmine.getGlobal(), 'setInterval'); +jasmine.clearInterval = jasmine.bindOriginal_(jasmine.getGlobal(), 'clearInterval'); + +jasmine.MessageResult = function(values) { + this.type = 'log'; + this.values = values; + this.trace = new Error(); // todo: test better +}; + +jasmine.MessageResult.prototype.toString = function() { + var text = ""; + for (var i = 0; i < this.values.length; i++) { + if (i > 0) text += " "; + if (jasmine.isString_(this.values[i])) { + text += this.values[i]; + } else { + text += jasmine.pp(this.values[i]); + } + } + return text; +}; + +jasmine.ExpectationResult = function(params) { + this.type = 'expect'; + this.matcherName = params.matcherName; + this.passed_ = params.passed; + this.expected = params.expected; + this.actual = params.actual; + this.message = this.passed_ ? 'Passed.' : params.message; + + var trace = (params.trace || new Error(this.message)); + this.trace = this.passed_ ? '' : trace; +}; + +jasmine.ExpectationResult.prototype.toString = function () { + return this.message; +}; + +jasmine.ExpectationResult.prototype.passed = function () { + return this.passed_; +}; + +/** + * Getter for the Jasmine environment. Ensures one gets created + */ +jasmine.getEnv = function() { + var env = jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env(); + return env; +}; + +/** + * @ignore + * @private + * @param value + * @returns {Boolean} + */ +jasmine.isArray_ = function(value) { + return jasmine.isA_("Array", value); +}; + +/** + * @ignore + * @private + * @param value + * @returns {Boolean} + */ +jasmine.isString_ = function(value) { + return jasmine.isA_("String", value); +}; + +/** + * @ignore + * @private + * @param value + * @returns {Boolean} + */ +jasmine.isNumber_ = function(value) { + return jasmine.isA_("Number", value); +}; + +/** + * @ignore + * @private + * @param {String} typeName + * @param value + * @returns {Boolean} + */ +jasmine.isA_ = function(typeName, value) { + return Object.prototype.toString.apply(value) === '[object ' + typeName + ']'; +}; + +/** + * Pretty printer for expecations. Takes any object and turns it into a human-readable string. + * + * @param value {Object} an object to be outputted + * @returns {String} + */ +jasmine.pp = function(value) { + var stringPrettyPrinter = new jasmine.StringPrettyPrinter(); + stringPrettyPrinter.format(value); + return stringPrettyPrinter.string; +}; + +/** + * Returns true if the object is a DOM Node. + * + * @param {Object} obj object to check + * @returns {Boolean} + */ +jasmine.isDomNode = function(obj) { + return obj.nodeType > 0; +}; + +/** + * Returns a matchable 'generic' object of the class type. For use in expecations of type when values don't matter. + * + * @example + * // don't care about which function is passed in, as long as it's a function + * expect(mySpy).toHaveBeenCalledWith(jasmine.any(Function)); + * + * @param {Class} clazz + * @returns matchable object of the type clazz + */ +jasmine.any = function(clazz) { + return new jasmine.Matchers.Any(clazz); +}; + +/** + * Jasmine Spies are test doubles that can act as stubs, spies, fakes or when used in an expecation, mocks. + * + * Spies should be created in test setup, before expectations. They can then be checked, using the standard Jasmine + * expectation syntax. Spies can be checked if they were called or not and what the calling params were. + * + * A Spy has the following fields: wasCalled, callCount, mostRecentCall, and argsForCall (see docs). + * + * Spies are torn down at the end of every spec. + * + * Note: Do not call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj. + * + * @example + * // a stub + * var myStub = jasmine.createSpy('myStub'); // can be used anywhere + * + * // spy example + * var foo = { + * not: function(bool) { return !bool; } + * } + * + * // actual foo.not will not be called, execution stops + * spyOn(foo, 'not'); + + // foo.not spied upon, execution will continue to implementation + * spyOn(foo, 'not').andCallThrough(); + * + * // fake example + * var foo = { + * not: function(bool) { return !bool; } + * } + * + * // foo.not(val) will return val + * spyOn(foo, 'not').andCallFake(function(value) {return value;}); + * + * // mock example + * foo.not(7 == 7); + * expect(foo.not).toHaveBeenCalled(); + * expect(foo.not).toHaveBeenCalledWith(true); + * + * @constructor + * @see spyOn, jasmine.createSpy, jasmine.createSpyObj + * @param {String} name + */ +jasmine.Spy = function(name) { + /** + * The name of the spy, if provided. + */ + this.identity = name || 'unknown'; + /** + * Is this Object a spy? + */ + this.isSpy = true; + /** + * The actual function this spy stubs. + */ + this.plan = function() { + }; + /** + * Tracking of the most recent call to the spy. + * @example + * var mySpy = jasmine.createSpy('foo'); + * mySpy(1, 2); + * mySpy.mostRecentCall.args = [1, 2]; + */ + this.mostRecentCall = {}; + + /** + * Holds arguments for each call to the spy, indexed by call count + * @example + * var mySpy = jasmine.createSpy('foo'); + * mySpy(1, 2); + * mySpy(7, 8); + * mySpy.mostRecentCall.args = [7, 8]; + * mySpy.argsForCall[0] = [1, 2]; + * mySpy.argsForCall[1] = [7, 8]; + */ + this.argsForCall = []; + this.calls = []; +}; + +/** + * Tells a spy to call through to the actual implemenatation. + * + * @example + * var foo = { + * bar: function() { // do some stuff } + * } + * + * // defining a spy on an existing property: foo.bar + * spyOn(foo, 'bar').andCallThrough(); + */ +jasmine.Spy.prototype.andCallThrough = function() { + this.plan = this.originalValue; + return this; +}; + +/** + * For setting the return value of a spy. + * + * @example + * // defining a spy from scratch: foo() returns 'baz' + * var foo = jasmine.createSpy('spy on foo').andReturn('baz'); + * + * // defining a spy on an existing property: foo.bar() returns 'baz' + * spyOn(foo, 'bar').andReturn('baz'); + * + * @param {Object} value + */ +jasmine.Spy.prototype.andReturn = function(value) { + this.plan = function() { + return value; + }; + return this; +}; + +/** + * For throwing an exception when a spy is called. + * + * @example + * // defining a spy from scratch: foo() throws an exception w/ message 'ouch' + * var foo = jasmine.createSpy('spy on foo').andThrow('baz'); + * + * // defining a spy on an existing property: foo.bar() throws an exception w/ message 'ouch' + * spyOn(foo, 'bar').andThrow('baz'); + * + * @param {String} exceptionMsg + */ +jasmine.Spy.prototype.andThrow = function(exceptionMsg) { + this.plan = function() { + throw exceptionMsg; + }; + return this; +}; + +/** + * Calls an alternate implementation when a spy is called. + * + * @example + * var baz = function() { + * // do some stuff, return something + * } + * // defining a spy from scratch: foo() calls the function baz + * var foo = jasmine.createSpy('spy on foo').andCall(baz); + * + * // defining a spy on an existing property: foo.bar() calls an anonymnous function + * spyOn(foo, 'bar').andCall(function() { return 'baz';} ); + * + * @param {Function} fakeFunc + */ +jasmine.Spy.prototype.andCallFake = function(fakeFunc) { + this.plan = fakeFunc; + return this; +}; + +/** + * Resets all of a spy's the tracking variables so that it can be used again. + * + * @example + * spyOn(foo, 'bar'); + * + * foo.bar(); + * + * expect(foo.bar.callCount).toEqual(1); + * + * foo.bar.reset(); + * + * expect(foo.bar.callCount).toEqual(0); + */ +jasmine.Spy.prototype.reset = function() { + this.wasCalled = false; + this.callCount = 0; + this.argsForCall = []; + this.calls = []; + this.mostRecentCall = {}; +}; + +jasmine.createSpy = function(name) { + + var spyObj = function() { + spyObj.wasCalled = true; + spyObj.callCount++; + var args = jasmine.util.argsToArray(arguments); + spyObj.mostRecentCall.object = this; + spyObj.mostRecentCall.args = args; + spyObj.argsForCall.push(args); + spyObj.calls.push({object: this, args: args}); + return spyObj.plan.apply(this, arguments); + }; + + var spy = new jasmine.Spy(name); + + for (var prop in spy) { + spyObj[prop] = spy[prop]; + } + + spyObj.reset(); + + return spyObj; +}; + +/** + * Determines whether an object is a spy. + * + * @param {jasmine.Spy|Object} putativeSpy + * @returns {Boolean} + */ +jasmine.isSpy = function(putativeSpy) { + return putativeSpy && putativeSpy.isSpy; +}; + +/** + * Creates a more complicated spy: an Object that has every property a function that is a spy. Used for stubbing something + * large in one call. + * + * @param {String} baseName name of spy class + * @param {Array} methodNames array of names of methods to make spies + */ +jasmine.createSpyObj = function(baseName, methodNames) { + if (!jasmine.isArray_(methodNames) || methodNames.length === 0) { + throw new Error('createSpyObj requires a non-empty array of method names to create spies for'); + } + var obj = {}; + for (var i = 0; i < methodNames.length; i++) { + obj[methodNames[i]] = jasmine.createSpy(baseName + '.' + methodNames[i]); + } + return obj; +}; + +/** + * All parameters are pretty-printed and concatenated together, then written to the current spec's output. + * + * Be careful not to leave calls to jasmine.log in production code. + */ +jasmine.log = function() { + var spec = jasmine.getEnv().currentSpec; + spec.log.apply(spec, arguments); +}; + +/** + * Function that installs a spy on an existing object's method name. Used within a Spec to create a spy. + * + * @example + * // spy example + * var foo = { + * not: function(bool) { return !bool; } + * } + * spyOn(foo, 'not'); // actual foo.not will not be called, execution stops + * + * @see jasmine.createSpy + * @param obj + * @param methodName + * @returns a Jasmine spy that can be chained with all spy methods + */ +var spyOn = function(obj, methodName) { + return jasmine.getEnv().currentSpec.spyOn(obj, methodName); +}; +if (isCommonJS) exports.spyOn = spyOn; + +/** + * Creates a Jasmine spec that will be added to the current suite. + * + * // TODO: pending tests + * + * @example + * it('should be true', function() { + * expect(true).toEqual(true); + * }); + * + * @param {String} desc description of this specification + * @param {Function} func defines the preconditions and expectations of the spec + */ +var it = function(desc, func) { + return jasmine.getEnv().it(desc, func); +}; +if (isCommonJS) exports.it = it; + +/** + * Creates a disabled Jasmine spec. + * + * A convenience method that allows existing specs to be disabled temporarily during development. + * + * @param {String} desc description of this specification + * @param {Function} func defines the preconditions and expectations of the spec + */ +var xit = function(desc, func) { + return jasmine.getEnv().xit(desc, func); +}; +if (isCommonJS) exports.xit = xit; + +/** + * Starts a chain for a Jasmine expectation. + * + * It is passed an Object that is the actual value and should chain to one of the many + * jasmine.Matchers functions. + * + * @param {Object} actual Actual value to test against and expected value + */ +var expect = function(actual) { + return jasmine.getEnv().currentSpec.expect(actual); +}; +if (isCommonJS) exports.expect = expect; + +/** + * Defines part of a jasmine spec. Used in cominbination with waits or waitsFor in asynchrnous specs. + * + * @param {Function} func Function that defines part of a jasmine spec. + */ +var runs = function(func) { + jasmine.getEnv().currentSpec.runs(func); +}; +if (isCommonJS) exports.runs = runs; + +/** + * Waits a fixed time period before moving to the next block. + * + * @deprecated Use waitsFor() instead + * @param {Number} timeout milliseconds to wait + */ +var waits = function(timeout) { + jasmine.getEnv().currentSpec.waits(timeout); +}; +if (isCommonJS) exports.waits = waits; + +/** + * Waits for the latchFunction to return true before proceeding to the next block. + * + * @param {Function} latchFunction + * @param {String} optional_timeoutMessage + * @param {Number} optional_timeout + */ +var waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) { + jasmine.getEnv().currentSpec.waitsFor.apply(jasmine.getEnv().currentSpec, arguments); +}; +if (isCommonJS) exports.waitsFor = waitsFor; + +/** + * A function that is called before each spec in a suite. + * + * Used for spec setup, including validating assumptions. + * + * @param {Function} beforeEachFunction + */ +var beforeEach = function(beforeEachFunction) { + jasmine.getEnv().beforeEach(beforeEachFunction); +}; +if (isCommonJS) exports.beforeEach = beforeEach; + +/** + * A function that is called after each spec in a suite. + * + * Used for restoring any state that is hijacked during spec execution. + * + * @param {Function} afterEachFunction + */ +var afterEach = function(afterEachFunction) { + jasmine.getEnv().afterEach(afterEachFunction); +}; +if (isCommonJS) exports.afterEach = afterEach; + +/** + * Defines a suite of specifications. + * + * Stores the description and all defined specs in the Jasmine environment as one suite of specs. Variables declared + * are accessible by calls to beforeEach, it, and afterEach. Describe blocks can be nested, allowing for specialization + * of setup in some tests. + * + * @example + * // TODO: a simple suite + * + * // TODO: a simple suite with a nested describe block + * + * @param {String} description A string, usually the class under test. + * @param {Function} specDefinitions function that defines several specs. + */ +var describe = function(description, specDefinitions) { + return jasmine.getEnv().describe(description, specDefinitions); +}; +if (isCommonJS) exports.describe = describe; + +/** + * Disables a suite of specifications. Used to disable some suites in a file, or files, temporarily during development. + * + * @param {String} description A string, usually the class under test. + * @param {Function} specDefinitions function that defines several specs. + */ +var xdescribe = function(description, specDefinitions) { + return jasmine.getEnv().xdescribe(description, specDefinitions); +}; +if (isCommonJS) exports.xdescribe = xdescribe; + + +// Provide the XMLHttpRequest class for IE 5.x-6.x: +jasmine.XmlHttpRequest = (typeof XMLHttpRequest == "undefined") ? function() { + function tryIt(f) { + try { + return f(); + } catch(e) { + } + return null; + } + + var xhr = tryIt(function() { + return new ActiveXObject("Msxml2.XMLHTTP.6.0"); + }) || + tryIt(function() { + return new ActiveXObject("Msxml2.XMLHTTP.3.0"); + }) || + tryIt(function() { + return new ActiveXObject("Msxml2.XMLHTTP"); + }) || + tryIt(function() { + return new ActiveXObject("Microsoft.XMLHTTP"); + }); + + if (!xhr) throw new Error("This browser does not support XMLHttpRequest."); + + return xhr; +} : XMLHttpRequest; +/** + * @namespace + */ +jasmine.util = {}; + +/** + * Declare that a child class inherit it's prototype from the parent class. + * + * @private + * @param {Function} childClass + * @param {Function} parentClass + */ +jasmine.util.inherit = function(childClass, parentClass) { + /** + * @private + */ + var subclass = function() { + }; + subclass.prototype = parentClass.prototype; + childClass.prototype = new subclass(); +}; + +jasmine.util.formatException = function(e) { + var lineNumber; + if (e.line) { + lineNumber = e.line; + } + else if (e.lineNumber) { + lineNumber = e.lineNumber; + } + + var file; + + if (e.sourceURL) { + file = e.sourceURL; + } + else if (e.fileName) { + file = e.fileName; + } + + var message = (e.name && e.message) ? (e.name + ': ' + e.message) : e.toString(); + + if (file && lineNumber) { + message += ' in ' + file + ' (line ' + lineNumber + ')'; + } + + return message; +}; + +jasmine.util.htmlEscape = function(str) { + if (!str) return str; + return str.replace(/&/g, '&') + .replace(//g, '>'); +}; + +jasmine.util.argsToArray = function(args) { + var arrayOfArgs = []; + for (var i = 0; i < args.length; i++) arrayOfArgs.push(args[i]); + return arrayOfArgs; +}; + +jasmine.util.extend = function(destination, source) { + for (var property in source) destination[property] = source[property]; + return destination; +}; + +/** + * Environment for Jasmine + * + * @constructor + */ +jasmine.Env = function() { + this.currentSpec = null; + this.currentSuite = null; + this.currentRunner_ = new jasmine.Runner(this); + + this.reporter = new jasmine.MultiReporter(); + + this.updateInterval = jasmine.DEFAULT_UPDATE_INTERVAL; + this.defaultTimeoutInterval = jasmine.DEFAULT_TIMEOUT_INTERVAL; + this.lastUpdate = 0; + this.specFilter = function() { + return true; + }; + + this.nextSpecId_ = 0; + this.nextSuiteId_ = 0; + this.equalityTesters_ = []; + + // wrap matchers + this.matchersClass = function() { + jasmine.Matchers.apply(this, arguments); + }; + jasmine.util.inherit(this.matchersClass, jasmine.Matchers); + + jasmine.Matchers.wrapInto_(jasmine.Matchers.prototype, this.matchersClass); +}; + + +jasmine.Env.prototype.setTimeout = jasmine.setTimeout; +jasmine.Env.prototype.clearTimeout = jasmine.clearTimeout; +jasmine.Env.prototype.setInterval = jasmine.setInterval; +jasmine.Env.prototype.clearInterval = jasmine.clearInterval; + +/** + * @returns an object containing jasmine version build info, if set. + */ +jasmine.Env.prototype.version = function () { + if (jasmine.version_) { + return jasmine.version_; + } else { + throw new Error('Version not set'); + } +}; + +/** + * @returns string containing jasmine version build info, if set. + */ +jasmine.Env.prototype.versionString = function() { + if (jasmine.version_) { + var version = this.version(); + var versionString = version.major + "." + version.minor + "." + version.build; + if (version.release_candidate) { + versionString += ".rc" + version.release_candidate + } + versionString += " revision " + version.revision + return versionString; + } else { + return "version unknown"; + } +}; + +/** + * @returns a sequential integer starting at 0 + */ +jasmine.Env.prototype.nextSpecId = function () { + return this.nextSpecId_++; +}; + +/** + * @returns a sequential integer starting at 0 + */ +jasmine.Env.prototype.nextSuiteId = function () { + return this.nextSuiteId_++; +}; + +/** + * Register a reporter to receive status updates from Jasmine. + * @param {jasmine.Reporter} reporter An object which will receive status updates. + */ +jasmine.Env.prototype.addReporter = function(reporter) { + this.reporter.addReporter(reporter); +}; + +jasmine.Env.prototype.execute = function() { + this.currentRunner_.execute(); +}; + +jasmine.Env.prototype.describe = function(description, specDefinitions) { + var suite = new jasmine.Suite(this, description, specDefinitions, this.currentSuite); + + var parentSuite = this.currentSuite; + if (parentSuite) { + parentSuite.add(suite); + } else { + this.currentRunner_.add(suite); + } + + this.currentSuite = suite; + + var declarationError = null; + try { + specDefinitions.call(suite); + } catch(e) { + declarationError = e; + } + + if (declarationError) { + this.it("encountered a declaration exception", function() { + throw declarationError; + }); + } + + this.currentSuite = parentSuite; + + return suite; +}; + +jasmine.Env.prototype.beforeEach = function(beforeEachFunction) { + if (this.currentSuite) { + this.currentSuite.beforeEach(beforeEachFunction); + } else { + this.currentRunner_.beforeEach(beforeEachFunction); + } +}; + +jasmine.Env.prototype.currentRunner = function () { + return this.currentRunner_; +}; + +jasmine.Env.prototype.afterEach = function(afterEachFunction) { + if (this.currentSuite) { + this.currentSuite.afterEach(afterEachFunction); + } else { + this.currentRunner_.afterEach(afterEachFunction); + } + +}; + +jasmine.Env.prototype.xdescribe = function(desc, specDefinitions) { + return { + execute: function() { + } + }; +}; + +jasmine.Env.prototype.it = function(description, func) { + var spec = new jasmine.Spec(this, this.currentSuite, description); + this.currentSuite.add(spec); + this.currentSpec = spec; + + if (func) { + spec.runs(func); + } + + return spec; +}; + +jasmine.Env.prototype.xit = function(desc, func) { + return { + id: this.nextSpecId(), + runs: function() { + } + }; +}; + +jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchValues) { + if (a.__Jasmine_been_here_before__ === b && b.__Jasmine_been_here_before__ === a) { + return true; + } + + a.__Jasmine_been_here_before__ = b; + b.__Jasmine_been_here_before__ = a; + + var hasKey = function(obj, keyName) { + return obj !== null && obj[keyName] !== jasmine.undefined; + }; + + for (var property in b) { + if (!hasKey(a, property) && hasKey(b, property)) { + mismatchKeys.push("expected has key '" + property + "', but missing from actual."); + } + } + for (property in a) { + if (!hasKey(b, property) && hasKey(a, property)) { + mismatchKeys.push("expected missing key '" + property + "', but present in actual."); + } + } + for (property in b) { + if (property == '__Jasmine_been_here_before__') continue; + if (!this.equals_(a[property], b[property], mismatchKeys, mismatchValues)) { + mismatchValues.push("'" + property + "' was '" + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + "' in expected, but was '" + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + "' in actual."); + } + } + + if (jasmine.isArray_(a) && jasmine.isArray_(b) && a.length != b.length) { + mismatchValues.push("arrays were not the same length"); + } + + delete a.__Jasmine_been_here_before__; + delete b.__Jasmine_been_here_before__; + return (mismatchKeys.length === 0 && mismatchValues.length === 0); +}; + +jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) { + mismatchKeys = mismatchKeys || []; + mismatchValues = mismatchValues || []; + + for (var i = 0; i < this.equalityTesters_.length; i++) { + var equalityTester = this.equalityTesters_[i]; + var result = equalityTester(a, b, this, mismatchKeys, mismatchValues); + if (result !== jasmine.undefined) return result; + } + + if (a === b) return true; + + if (a === jasmine.undefined || a === null || b === jasmine.undefined || b === null) { + return (a == jasmine.undefined && b == jasmine.undefined); + } + + if (jasmine.isDomNode(a) && jasmine.isDomNode(b)) { + return a === b; + } + + if (a instanceof Date && b instanceof Date) { + return a.getTime() == b.getTime(); + } + + if (a instanceof jasmine.Matchers.Any) { + return a.matches(b); + } + + if (b instanceof jasmine.Matchers.Any) { + return b.matches(a); + } + + if (jasmine.isString_(a) && jasmine.isString_(b)) { + return (a == b); + } + + if (jasmine.isNumber_(a) && jasmine.isNumber_(b)) { + return (a == b); + } + + if (typeof a === "object" && typeof b === "object") { + return this.compareObjects_(a, b, mismatchKeys, mismatchValues); + } + + //Straight check + return (a === b); +}; + +jasmine.Env.prototype.contains_ = function(haystack, needle) { + if (jasmine.isArray_(haystack)) { + for (var i = 0; i < haystack.length; i++) { + if (this.equals_(haystack[i], needle)) return true; + } + return false; + } + return haystack.indexOf(needle) >= 0; +}; + +jasmine.Env.prototype.addEqualityTester = function(equalityTester) { + this.equalityTesters_.push(equalityTester); +}; +/** No-op base class for Jasmine reporters. + * + * @constructor + */ +jasmine.Reporter = function() { +}; + +//noinspection JSUnusedLocalSymbols +jasmine.Reporter.prototype.reportRunnerStarting = function(runner) { +}; + +//noinspection JSUnusedLocalSymbols +jasmine.Reporter.prototype.reportRunnerResults = function(runner) { +}; + +//noinspection JSUnusedLocalSymbols +jasmine.Reporter.prototype.reportSuiteResults = function(suite) { +}; + +//noinspection JSUnusedLocalSymbols +jasmine.Reporter.prototype.reportSpecStarting = function(spec) { +}; + +//noinspection JSUnusedLocalSymbols +jasmine.Reporter.prototype.reportSpecResults = function(spec) { +}; + +//noinspection JSUnusedLocalSymbols +jasmine.Reporter.prototype.log = function(str) { +}; + +/** + * Blocks are functions with executable code that make up a spec. + * + * @constructor + * @param {jasmine.Env} env + * @param {Function} func + * @param {jasmine.Spec} spec + */ +jasmine.Block = function(env, func, spec) { + this.env = env; + this.func = func; + this.spec = spec; +}; + +jasmine.Block.prototype.execute = function(onComplete) { + try { + this.func.apply(this.spec); + } catch (e) { + this.spec.fail(e); + } + onComplete(); +}; +/** JavaScript API reporter. + * + * @constructor + */ +jasmine.JsApiReporter = function() { + this.started = false; + this.finished = false; + this.suites_ = []; + this.results_ = {}; +}; + +jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) { + this.started = true; + var suites = runner.topLevelSuites(); + for (var i = 0; i < suites.length; i++) { + var suite = suites[i]; + this.suites_.push(this.summarize_(suite)); + } +}; + +jasmine.JsApiReporter.prototype.suites = function() { + return this.suites_; +}; + +jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) { + var isSuite = suiteOrSpec instanceof jasmine.Suite; + var summary = { + id: suiteOrSpec.id, + name: suiteOrSpec.description, + type: isSuite ? 'suite' : 'spec', + children: [] + }; + + if (isSuite) { + var children = suiteOrSpec.children(); + for (var i = 0; i < children.length; i++) { + summary.children.push(this.summarize_(children[i])); + } + } + return summary; +}; + +jasmine.JsApiReporter.prototype.results = function() { + return this.results_; +}; + +jasmine.JsApiReporter.prototype.resultsForSpec = function(specId) { + return this.results_[specId]; +}; + +//noinspection JSUnusedLocalSymbols +jasmine.JsApiReporter.prototype.reportRunnerResults = function(runner) { + this.finished = true; +}; + +//noinspection JSUnusedLocalSymbols +jasmine.JsApiReporter.prototype.reportSuiteResults = function(suite) { +}; + +//noinspection JSUnusedLocalSymbols +jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) { + this.results_[spec.id] = { + messages: spec.results().getItems(), + result: spec.results().failedCount > 0 ? "failed" : "passed" + }; +}; + +//noinspection JSUnusedLocalSymbols +jasmine.JsApiReporter.prototype.log = function(str) { +}; + +jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){ + var results = {}; + for (var i = 0; i < specIds.length; i++) { + var specId = specIds[i]; + results[specId] = this.summarizeResult_(this.results_[specId]); + } + return results; +}; + +jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){ + var summaryMessages = []; + var messagesLength = result.messages.length; + for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) { + var resultMessage = result.messages[messageIndex]; + summaryMessages.push({ + text: resultMessage.type == 'log' ? resultMessage.toString() : jasmine.undefined, + passed: resultMessage.passed ? resultMessage.passed() : true, + type: resultMessage.type, + message: resultMessage.message, + trace: { + stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : jasmine.undefined + } + }); + } + + return { + result : result.result, + messages : summaryMessages + }; +}; + +/** + * @constructor + * @param {jasmine.Env} env + * @param actual + * @param {jasmine.Spec} spec + */ +jasmine.Matchers = function(env, actual, spec, opt_isNot) { + this.env = env; + this.actual = actual; + this.spec = spec; + this.isNot = opt_isNot || false; + this.reportWasCalled_ = false; +}; + +// todo: @deprecated as of Jasmine 0.11, remove soon [xw] +jasmine.Matchers.pp = function(str) { + throw new Error("jasmine.Matchers.pp() is no longer supported, please use jasmine.pp() instead!"); +}; + +// todo: @deprecated Deprecated as of Jasmine 0.10. Rewrite your custom matchers to return true or false. [xw] +jasmine.Matchers.prototype.report = function(result, failing_message, details) { + throw new Error("As of jasmine 0.11, custom matchers must be implemented differently -- please see jasmine docs"); +}; + +jasmine.Matchers.wrapInto_ = function(prototype, matchersClass) { + for (var methodName in prototype) { + if (methodName == 'report') continue; + var orig = prototype[methodName]; + matchersClass.prototype[methodName] = jasmine.Matchers.matcherFn_(methodName, orig); + } +}; + +jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) { + return function() { + var matcherArgs = jasmine.util.argsToArray(arguments); + var result = matcherFunction.apply(this, arguments); + + if (this.isNot) { + result = !result; + } + + if (this.reportWasCalled_) return result; + + var message; + if (!result) { + if (this.message) { + message = this.message.apply(this, arguments); + if (jasmine.isArray_(message)) { + message = message[this.isNot ? 1 : 0]; + } + } else { + var englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); }); + message = "Expected " + jasmine.pp(this.actual) + (this.isNot ? " not " : " ") + englishyPredicate; + if (matcherArgs.length > 0) { + for (var i = 0; i < matcherArgs.length; i++) { + if (i > 0) message += ","; + message += " " + jasmine.pp(matcherArgs[i]); + } + } + message += "."; + } + } + var expectationResult = new jasmine.ExpectationResult({ + matcherName: matcherName, + passed: result, + expected: matcherArgs.length > 1 ? matcherArgs : matcherArgs[0], + actual: this.actual, + message: message + }); + this.spec.addMatcherResult(expectationResult); + return jasmine.undefined; + }; +}; + + + + +/** + * toBe: compares the actual to the expected using === + * @param expected + */ +jasmine.Matchers.prototype.toBe = function(expected) { + return this.actual === expected; +}; + +/** + * toNotBe: compares the actual to the expected using !== + * @param expected + * @deprecated as of 1.0. Use not.toBe() instead. + */ +jasmine.Matchers.prototype.toNotBe = function(expected) { + return this.actual !== expected; +}; + +/** + * toEqual: compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc. + * + * @param expected + */ +jasmine.Matchers.prototype.toEqual = function(expected) { + return this.env.equals_(this.actual, expected); +}; + +/** + * toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual + * @param expected + * @deprecated as of 1.0. Use not.toNotEqual() instead. + */ +jasmine.Matchers.prototype.toNotEqual = function(expected) { + return !this.env.equals_(this.actual, expected); +}; + +/** + * Matcher that compares the actual to the expected using a regular expression. Constructs a RegExp, so takes + * a pattern or a String. + * + * @param expected + */ +jasmine.Matchers.prototype.toMatch = function(expected) { + return new RegExp(expected).test(this.actual); +}; + +/** + * Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch + * @param expected + * @deprecated as of 1.0. Use not.toMatch() instead. + */ +jasmine.Matchers.prototype.toNotMatch = function(expected) { + return !(new RegExp(expected).test(this.actual)); +}; + +/** + * Matcher that compares the actual to jasmine.undefined. + */ +jasmine.Matchers.prototype.toBeDefined = function() { + return (this.actual !== jasmine.undefined); +}; + +/** + * Matcher that compares the actual to jasmine.undefined. + */ +jasmine.Matchers.prototype.toBeUndefined = function() { + return (this.actual === jasmine.undefined); +}; + +/** + * Matcher that compares the actual to null. + */ +jasmine.Matchers.prototype.toBeNull = function() { + return (this.actual === null); +}; + +/** + * Matcher that boolean not-nots the actual. + */ +jasmine.Matchers.prototype.toBeTruthy = function() { + return !!this.actual; +}; + + +/** + * Matcher that boolean nots the actual. + */ +jasmine.Matchers.prototype.toBeFalsy = function() { + return !this.actual; +}; + + +/** + * Matcher that checks to see if the actual, a Jasmine spy, was called. + */ +jasmine.Matchers.prototype.toHaveBeenCalled = function() { + if (arguments.length > 0) { + throw new Error('toHaveBeenCalled does not take arguments, use toHaveBeenCalledWith'); + } + + if (!jasmine.isSpy(this.actual)) { + throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); + } + + this.message = function() { + return [ + "Expected spy " + this.actual.identity + " to have been called.", + "Expected spy " + this.actual.identity + " not to have been called." + ]; + }; + + return this.actual.wasCalled; +}; + +/** @deprecated Use expect(xxx).toHaveBeenCalled() instead */ +jasmine.Matchers.prototype.wasCalled = jasmine.Matchers.prototype.toHaveBeenCalled; + +/** + * Matcher that checks to see if the actual, a Jasmine spy, was not called. + * + * @deprecated Use expect(xxx).not.toHaveBeenCalled() instead + */ +jasmine.Matchers.prototype.wasNotCalled = function() { + if (arguments.length > 0) { + throw new Error('wasNotCalled does not take arguments'); + } + + if (!jasmine.isSpy(this.actual)) { + throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); + } + + this.message = function() { + return [ + "Expected spy " + this.actual.identity + " to not have been called.", + "Expected spy " + this.actual.identity + " to have been called." + ]; + }; + + return !this.actual.wasCalled; +}; + +/** + * Matcher that checks to see if the actual, a Jasmine spy, was called with a set of parameters. + * + * @example + * + */ +jasmine.Matchers.prototype.toHaveBeenCalledWith = function() { + var expectedArgs = jasmine.util.argsToArray(arguments); + if (!jasmine.isSpy(this.actual)) { + throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); + } + this.message = function() { + if (this.actual.callCount === 0) { + // todo: what should the failure message for .not.toHaveBeenCalledWith() be? is this right? test better. [xw] + return [ + "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but it was never called.", + "Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but it was." + ]; + } else { + return [ + "Expected spy " + this.actual.identity + " to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall), + "Expected spy " + this.actual.identity + " not to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall) + ]; + } + }; + + return this.env.contains_(this.actual.argsForCall, expectedArgs); +}; + +/** @deprecated Use expect(xxx).toHaveBeenCalledWith() instead */ +jasmine.Matchers.prototype.wasCalledWith = jasmine.Matchers.prototype.toHaveBeenCalledWith; + +/** @deprecated Use expect(xxx).not.toHaveBeenCalledWith() instead */ +jasmine.Matchers.prototype.wasNotCalledWith = function() { + var expectedArgs = jasmine.util.argsToArray(arguments); + if (!jasmine.isSpy(this.actual)) { + throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.'); + } + + this.message = function() { + return [ + "Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but it was", + "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but it was" + ]; + }; + + return !this.env.contains_(this.actual.argsForCall, expectedArgs); +}; + +/** + * Matcher that checks that the expected item is an element in the actual Array. + * + * @param {Object} expected + */ +jasmine.Matchers.prototype.toContain = function(expected) { + return this.env.contains_(this.actual, expected); +}; + +/** + * Matcher that checks that the expected item is NOT an element in the actual Array. + * + * @param {Object} expected + * @deprecated as of 1.0. Use not.toNotContain() instead. + */ +jasmine.Matchers.prototype.toNotContain = function(expected) { + return !this.env.contains_(this.actual, expected); +}; + +jasmine.Matchers.prototype.toBeLessThan = function(expected) { + return this.actual < expected; +}; + +jasmine.Matchers.prototype.toBeGreaterThan = function(expected) { + return this.actual > expected; +}; + +/** + * Matcher that checks that the expected item is equal to the actual item + * up to a given level of decimal precision (default 2). + * + * @param {Number} expected + * @param {Number} precision + */ +jasmine.Matchers.prototype.toBeCloseTo = function(expected, precision) { + if (!(precision === 0)) { + precision = precision || 2; + } + var multiplier = Math.pow(10, precision); + var actual = Math.round(this.actual * multiplier); + expected = Math.round(expected * multiplier); + return expected == actual; +}; + +/** + * Matcher that checks that the expected exception was thrown by the actual. + * + * @param {String} expected + */ +jasmine.Matchers.prototype.toThrow = function(expected) { + var result = false; + var exception; + if (typeof this.actual != 'function') { + throw new Error('Actual is not a function'); + } + try { + this.actual(); + } catch (e) { + exception = e; + } + if (exception) { + result = (expected === jasmine.undefined || this.env.equals_(exception.message || exception, expected.message || expected)); + } + + var not = this.isNot ? "not " : ""; + + this.message = function() { + if (exception && (expected === jasmine.undefined || !this.env.equals_(exception.message || exception, expected.message || expected))) { + return ["Expected function " + not + "to throw", expected ? expected.message || expected : "an exception", ", but it threw", exception.message || exception].join(' '); + } else { + return "Expected function to throw an exception."; + } + }; + + return result; +}; + +jasmine.Matchers.Any = function(expectedClass) { + this.expectedClass = expectedClass; +}; + +jasmine.Matchers.Any.prototype.matches = function(other) { + if (this.expectedClass == String) { + return typeof other == 'string' || other instanceof String; + } + + if (this.expectedClass == Number) { + return typeof other == 'number' || other instanceof Number; + } + + if (this.expectedClass == Function) { + return typeof other == 'function' || other instanceof Function; + } + + if (this.expectedClass == Object) { + return typeof other == 'object'; + } + + return other instanceof this.expectedClass; +}; + +jasmine.Matchers.Any.prototype.toString = function() { + return ''; +}; + +/** + * @constructor + */ +jasmine.MultiReporter = function() { + this.subReporters_ = []; +}; +jasmine.util.inherit(jasmine.MultiReporter, jasmine.Reporter); + +jasmine.MultiReporter.prototype.addReporter = function(reporter) { + this.subReporters_.push(reporter); +}; + +(function() { + var functionNames = [ + "reportRunnerStarting", + "reportRunnerResults", + "reportSuiteResults", + "reportSpecStarting", + "reportSpecResults", + "log" + ]; + for (var i = 0; i < functionNames.length; i++) { + var functionName = functionNames[i]; + jasmine.MultiReporter.prototype[functionName] = (function(functionName) { + return function() { + for (var j = 0; j < this.subReporters_.length; j++) { + var subReporter = this.subReporters_[j]; + if (subReporter[functionName]) { + subReporter[functionName].apply(subReporter, arguments); + } + } + }; + })(functionName); + } +})(); +/** + * Holds results for a set of Jasmine spec. Allows for the results array to hold another jasmine.NestedResults + * + * @constructor + */ +jasmine.NestedResults = function() { + /** + * The total count of results + */ + this.totalCount = 0; + /** + * Number of passed results + */ + this.passedCount = 0; + /** + * Number of failed results + */ + this.failedCount = 0; + /** + * Was this suite/spec skipped? + */ + this.skipped = false; + /** + * @ignore + */ + this.items_ = []; +}; + +/** + * Roll up the result counts. + * + * @param result + */ +jasmine.NestedResults.prototype.rollupCounts = function(result) { + this.totalCount += result.totalCount; + this.passedCount += result.passedCount; + this.failedCount += result.failedCount; +}; + +/** + * Adds a log message. + * @param values Array of message parts which will be concatenated later. + */ +jasmine.NestedResults.prototype.log = function(values) { + this.items_.push(new jasmine.MessageResult(values)); +}; + +/** + * Getter for the results: message & results. + */ +jasmine.NestedResults.prototype.getItems = function() { + return this.items_; +}; + +/** + * Adds a result, tracking counts (total, passed, & failed) + * @param {jasmine.ExpectationResult|jasmine.NestedResults} result + */ +jasmine.NestedResults.prototype.addResult = function(result) { + if (result.type != 'log') { + if (result.items_) { + this.rollupCounts(result); + } else { + this.totalCount++; + if (result.passed()) { + this.passedCount++; + } else { + this.failedCount++; + } + } + } + this.items_.push(result); +}; + +/** + * @returns {Boolean} True if everything below passed + */ +jasmine.NestedResults.prototype.passed = function() { + return this.passedCount === this.totalCount; +}; +/** + * Base class for pretty printing for expectation results. + */ +jasmine.PrettyPrinter = function() { + this.ppNestLevel_ = 0; +}; + +/** + * Formats a value in a nice, human-readable string. + * + * @param value + */ +jasmine.PrettyPrinter.prototype.format = function(value) { + if (this.ppNestLevel_ > 40) { + throw new Error('jasmine.PrettyPrinter: format() nested too deeply!'); + } + + this.ppNestLevel_++; + try { + if (value === jasmine.undefined) { + this.emitScalar('undefined'); + } else if (value === null) { + this.emitScalar('null'); + } else if (value === jasmine.getGlobal()) { + this.emitScalar(''); + } else if (value instanceof jasmine.Matchers.Any) { + this.emitScalar(value.toString()); + } else if (typeof value === 'string') { + this.emitString(value); + } else if (jasmine.isSpy(value)) { + this.emitScalar("spy on " + value.identity); + } else if (value instanceof RegExp) { + this.emitScalar(value.toString()); + } else if (typeof value === 'function') { + this.emitScalar('Function'); + } else if (typeof value.nodeType === 'number') { + this.emitScalar('HTMLNode'); + } else if (value instanceof Date) { + this.emitScalar('Date(' + value + ')'); + } else if (value.__Jasmine_been_here_before__) { + this.emitScalar(''); + } else if (jasmine.isArray_(value) || typeof value == 'object') { + value.__Jasmine_been_here_before__ = true; + if (jasmine.isArray_(value)) { + this.emitArray(value); + } else { + this.emitObject(value); + } + delete value.__Jasmine_been_here_before__; + } else { + this.emitScalar(value.toString()); + } + } finally { + this.ppNestLevel_--; + } +}; + +jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) { + for (var property in obj) { + if (property == '__Jasmine_been_here_before__') continue; + fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) !== jasmine.undefined && + obj.__lookupGetter__(property) !== null) : false); + } +}; + +jasmine.PrettyPrinter.prototype.emitArray = jasmine.unimplementedMethod_; +jasmine.PrettyPrinter.prototype.emitObject = jasmine.unimplementedMethod_; +jasmine.PrettyPrinter.prototype.emitScalar = jasmine.unimplementedMethod_; +jasmine.PrettyPrinter.prototype.emitString = jasmine.unimplementedMethod_; + +jasmine.StringPrettyPrinter = function() { + jasmine.PrettyPrinter.call(this); + + this.string = ''; +}; +jasmine.util.inherit(jasmine.StringPrettyPrinter, jasmine.PrettyPrinter); + +jasmine.StringPrettyPrinter.prototype.emitScalar = function(value) { + this.append(value); +}; + +jasmine.StringPrettyPrinter.prototype.emitString = function(value) { + this.append("'" + value + "'"); +}; + +jasmine.StringPrettyPrinter.prototype.emitArray = function(array) { + this.append('[ '); + for (var i = 0; i < array.length; i++) { + if (i > 0) { + this.append(', '); + } + this.format(array[i]); + } + this.append(' ]'); +}; + +jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) { + var self = this; + this.append('{ '); + var first = true; + + this.iterateObject(obj, function(property, isGetter) { + if (first) { + first = false; + } else { + self.append(', '); + } + + self.append(property); + self.append(' : '); + if (isGetter) { + self.append(''); + } else { + self.format(obj[property]); + } + }); + + this.append(' }'); +}; + +jasmine.StringPrettyPrinter.prototype.append = function(value) { + this.string += value; +}; +jasmine.Queue = function(env) { + this.env = env; + this.blocks = []; + this.running = false; + this.index = 0; + this.offset = 0; + this.abort = false; +}; + +jasmine.Queue.prototype.addBefore = function(block) { + this.blocks.unshift(block); +}; + +jasmine.Queue.prototype.add = function(block) { + this.blocks.push(block); +}; + +jasmine.Queue.prototype.insertNext = function(block) { + this.blocks.splice((this.index + this.offset + 1), 0, block); + this.offset++; +}; + +jasmine.Queue.prototype.start = function(onComplete) { + this.running = true; + this.onComplete = onComplete; + this.next_(); +}; + +jasmine.Queue.prototype.isRunning = function() { + return this.running; +}; + +jasmine.Queue.LOOP_DONT_RECURSE = true; + +jasmine.Queue.prototype.next_ = function() { + var self = this; + var goAgain = true; + + while (goAgain) { + goAgain = false; + + if (self.index < self.blocks.length && !this.abort) { + var calledSynchronously = true; + var completedSynchronously = false; + + var onComplete = function () { + if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) { + completedSynchronously = true; + return; + } + + if (self.blocks[self.index] && self.blocks[self.index].abort) { + self.abort = true; + } + + self.offset = 0; + self.index++; + + var now = new Date().getTime(); + if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) { + self.env.lastUpdate = now; + self.env.setTimeout(function() { + self.next_(); + }, 0); + } else { + if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) { + goAgain = true; + } else { + self.next_(); + } + } + }; + self.blocks[self.index].execute(onComplete); + + calledSynchronously = false; + if (completedSynchronously) { + onComplete(); + } + + } else { + self.running = false; + if (self.onComplete) { + self.onComplete(); + } + } + } +}; + +jasmine.Queue.prototype.results = function() { + var results = new jasmine.NestedResults(); + for (var i = 0; i < this.blocks.length; i++) { + if (this.blocks[i].results) { + results.addResult(this.blocks[i].results()); + } + } + return results; +}; + + +/** + * Runner + * + * @constructor + * @param {jasmine.Env} env + */ +jasmine.Runner = function(env) { + var self = this; + self.env = env; + self.queue = new jasmine.Queue(env); + self.before_ = []; + self.after_ = []; + self.suites_ = []; +}; + +jasmine.Runner.prototype.execute = function() { + var self = this; + if (self.env.reporter.reportRunnerStarting) { + self.env.reporter.reportRunnerStarting(this); + } + self.queue.start(function () { + self.finishCallback(); + }); +}; + +jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) { + beforeEachFunction.typeName = 'beforeEach'; + this.before_.splice(0,0,beforeEachFunction); +}; + +jasmine.Runner.prototype.afterEach = function(afterEachFunction) { + afterEachFunction.typeName = 'afterEach'; + this.after_.splice(0,0,afterEachFunction); +}; + + +jasmine.Runner.prototype.finishCallback = function() { + this.env.reporter.reportRunnerResults(this); +}; + +jasmine.Runner.prototype.addSuite = function(suite) { + this.suites_.push(suite); +}; + +jasmine.Runner.prototype.add = function(block) { + if (block instanceof jasmine.Suite) { + this.addSuite(block); + } + this.queue.add(block); +}; + +jasmine.Runner.prototype.specs = function () { + var suites = this.suites(); + var specs = []; + for (var i = 0; i < suites.length; i++) { + specs = specs.concat(suites[i].specs()); + } + return specs; +}; + +jasmine.Runner.prototype.suites = function() { + return this.suites_; +}; + +jasmine.Runner.prototype.topLevelSuites = function() { + var topLevelSuites = []; + for (var i = 0; i < this.suites_.length; i++) { + if (!this.suites_[i].parentSuite) { + topLevelSuites.push(this.suites_[i]); + } + } + return topLevelSuites; +}; + +jasmine.Runner.prototype.results = function() { + return this.queue.results(); +}; +/** + * Internal representation of a Jasmine specification, or test. + * + * @constructor + * @param {jasmine.Env} env + * @param {jasmine.Suite} suite + * @param {String} description + */ +jasmine.Spec = function(env, suite, description) { + if (!env) { + throw new Error('jasmine.Env() required'); + } + if (!suite) { + throw new Error('jasmine.Suite() required'); + } + var spec = this; + spec.id = env.nextSpecId ? env.nextSpecId() : null; + spec.env = env; + spec.suite = suite; + spec.description = description; + spec.queue = new jasmine.Queue(env); + + spec.afterCallbacks = []; + spec.spies_ = []; + + spec.results_ = new jasmine.NestedResults(); + spec.results_.description = description; + spec.matchersClass = null; +}; + +jasmine.Spec.prototype.getFullName = function() { + return this.suite.getFullName() + ' ' + this.description + '.'; +}; + + +jasmine.Spec.prototype.results = function() { + return this.results_; +}; + +/** + * All parameters are pretty-printed and concatenated together, then written to the spec's output. + * + * Be careful not to leave calls to jasmine.log in production code. + */ +jasmine.Spec.prototype.log = function() { + return this.results_.log(arguments); +}; + +jasmine.Spec.prototype.runs = function (func) { + var block = new jasmine.Block(this.env, func, this); + this.addToQueue(block); + return this; +}; + +jasmine.Spec.prototype.addToQueue = function (block) { + if (this.queue.isRunning()) { + this.queue.insertNext(block); + } else { + this.queue.add(block); + } +}; + +/** + * @param {jasmine.ExpectationResult} result + */ +jasmine.Spec.prototype.addMatcherResult = function(result) { + this.results_.addResult(result); +}; + +jasmine.Spec.prototype.expect = function(actual) { + var positive = new (this.getMatchersClass_())(this.env, actual, this); + positive.not = new (this.getMatchersClass_())(this.env, actual, this, true); + return positive; +}; + +/** + * Waits a fixed time period before moving to the next block. + * + * @deprecated Use waitsFor() instead + * @param {Number} timeout milliseconds to wait + */ +jasmine.Spec.prototype.waits = function(timeout) { + var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this); + this.addToQueue(waitsFunc); + return this; +}; + +/** + * Waits for the latchFunction to return true before proceeding to the next block. + * + * @param {Function} latchFunction + * @param {String} optional_timeoutMessage + * @param {Number} optional_timeout + */ +jasmine.Spec.prototype.waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) { + var latchFunction_ = null; + var optional_timeoutMessage_ = null; + var optional_timeout_ = null; + + for (var i = 0; i < arguments.length; i++) { + var arg = arguments[i]; + switch (typeof arg) { + case 'function': + latchFunction_ = arg; + break; + case 'string': + optional_timeoutMessage_ = arg; + break; + case 'number': + optional_timeout_ = arg; + break; + } + } + + var waitsForFunc = new jasmine.WaitsForBlock(this.env, optional_timeout_, latchFunction_, optional_timeoutMessage_, this); + this.addToQueue(waitsForFunc); + return this; +}; + +jasmine.Spec.prototype.fail = function (e) { + var expectationResult = new jasmine.ExpectationResult({ + passed: false, + message: e ? jasmine.util.formatException(e) : 'Exception', + trace: { stack: e.stack } + }); + this.results_.addResult(expectationResult); +}; + +jasmine.Spec.prototype.getMatchersClass_ = function() { + return this.matchersClass || this.env.matchersClass; +}; + +jasmine.Spec.prototype.addMatchers = function(matchersPrototype) { + var parent = this.getMatchersClass_(); + var newMatchersClass = function() { + parent.apply(this, arguments); + }; + jasmine.util.inherit(newMatchersClass, parent); + jasmine.Matchers.wrapInto_(matchersPrototype, newMatchersClass); + this.matchersClass = newMatchersClass; +}; + +jasmine.Spec.prototype.finishCallback = function() { + this.env.reporter.reportSpecResults(this); +}; + +jasmine.Spec.prototype.finish = function(onComplete) { + this.removeAllSpies(); + this.finishCallback(); + if (onComplete) { + onComplete(); + } +}; + +jasmine.Spec.prototype.after = function(doAfter) { + if (this.queue.isRunning()) { + this.queue.add(new jasmine.Block(this.env, doAfter, this)); + } else { + this.afterCallbacks.unshift(doAfter); + } +}; + +jasmine.Spec.prototype.execute = function(onComplete) { + var spec = this; + if (!spec.env.specFilter(spec)) { + spec.results_.skipped = true; + spec.finish(onComplete); + return; + } + + this.env.reporter.reportSpecStarting(this); + + spec.env.currentSpec = spec; + + spec.addBeforesAndAftersToQueue(); + + spec.queue.start(function () { + spec.finish(onComplete); + }); +}; + +jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() { + var runner = this.env.currentRunner(); + var i; + + for (var suite = this.suite; suite; suite = suite.parentSuite) { + for (i = 0; i < suite.before_.length; i++) { + this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this)); + } + } + for (i = 0; i < runner.before_.length; i++) { + this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this)); + } + for (i = 0; i < this.afterCallbacks.length; i++) { + this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this)); + } + for (suite = this.suite; suite; suite = suite.parentSuite) { + for (i = 0; i < suite.after_.length; i++) { + this.queue.add(new jasmine.Block(this.env, suite.after_[i], this)); + } + } + for (i = 0; i < runner.after_.length; i++) { + this.queue.add(new jasmine.Block(this.env, runner.after_[i], this)); + } +}; + +jasmine.Spec.prototype.explodes = function() { + throw 'explodes function should not have been called'; +}; + +jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) { + if (obj == jasmine.undefined) { + throw "spyOn could not find an object to spy upon for " + methodName + "()"; + } + + if (!ignoreMethodDoesntExist && obj[methodName] === jasmine.undefined) { + throw methodName + '() method does not exist'; + } + + if (!ignoreMethodDoesntExist && obj[methodName] && obj[methodName].isSpy) { + throw new Error(methodName + ' has already been spied upon'); + } + + var spyObj = jasmine.createSpy(methodName); + + this.spies_.push(spyObj); + spyObj.baseObj = obj; + spyObj.methodName = methodName; + spyObj.originalValue = obj[methodName]; + + obj[methodName] = spyObj; + + return spyObj; +}; + +jasmine.Spec.prototype.removeAllSpies = function() { + for (var i = 0; i < this.spies_.length; i++) { + var spy = this.spies_[i]; + spy.baseObj[spy.methodName] = spy.originalValue; + } + this.spies_ = []; +}; + +/** + * Internal representation of a Jasmine suite. + * + * @constructor + * @param {jasmine.Env} env + * @param {String} description + * @param {Function} specDefinitions + * @param {jasmine.Suite} parentSuite + */ +jasmine.Suite = function(env, description, specDefinitions, parentSuite) { + var self = this; + self.id = env.nextSuiteId ? env.nextSuiteId() : null; + self.description = description; + self.queue = new jasmine.Queue(env); + self.parentSuite = parentSuite; + self.env = env; + self.before_ = []; + self.after_ = []; + self.children_ = []; + self.suites_ = []; + self.specs_ = []; +}; + +jasmine.Suite.prototype.getFullName = function() { + var fullName = this.description; + for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) { + fullName = parentSuite.description + ' ' + fullName; + } + return fullName; +}; + +jasmine.Suite.prototype.finish = function(onComplete) { + this.env.reporter.reportSuiteResults(this); + this.finished = true; + if (typeof(onComplete) == 'function') { + onComplete(); + } +}; + +jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) { + beforeEachFunction.typeName = 'beforeEach'; + this.before_.unshift(beforeEachFunction); +}; + +jasmine.Suite.prototype.afterEach = function(afterEachFunction) { + afterEachFunction.typeName = 'afterEach'; + this.after_.unshift(afterEachFunction); +}; + +jasmine.Suite.prototype.results = function() { + return this.queue.results(); +}; + +jasmine.Suite.prototype.add = function(suiteOrSpec) { + this.children_.push(suiteOrSpec); + if (suiteOrSpec instanceof jasmine.Suite) { + this.suites_.push(suiteOrSpec); + this.env.currentRunner().addSuite(suiteOrSpec); + } else { + this.specs_.push(suiteOrSpec); + } + this.queue.add(suiteOrSpec); +}; + +jasmine.Suite.prototype.specs = function() { + return this.specs_; +}; + +jasmine.Suite.prototype.suites = function() { + return this.suites_; +}; + +jasmine.Suite.prototype.children = function() { + return this.children_; +}; + +jasmine.Suite.prototype.execute = function(onComplete) { + var self = this; + this.queue.start(function () { + self.finish(onComplete); + }); +}; +jasmine.WaitsBlock = function(env, timeout, spec) { + this.timeout = timeout; + jasmine.Block.call(this, env, null, spec); +}; + +jasmine.util.inherit(jasmine.WaitsBlock, jasmine.Block); + +jasmine.WaitsBlock.prototype.execute = function (onComplete) { + if (jasmine.VERBOSE) { + this.env.reporter.log('>> Jasmine waiting for ' + this.timeout + ' ms...'); + } + this.env.setTimeout(function () { + onComplete(); + }, this.timeout); +}; +/** + * A block which waits for some condition to become true, with timeout. + * + * @constructor + * @extends jasmine.Block + * @param {jasmine.Env} env The Jasmine environment. + * @param {Number} timeout The maximum time in milliseconds to wait for the condition to become true. + * @param {Function} latchFunction A function which returns true when the desired condition has been met. + * @param {String} message The message to display if the desired condition hasn't been met within the given time period. + * @param {jasmine.Spec} spec The Jasmine spec. + */ +jasmine.WaitsForBlock = function(env, timeout, latchFunction, message, spec) { + this.timeout = timeout || env.defaultTimeoutInterval; + this.latchFunction = latchFunction; + this.message = message; + this.totalTimeSpentWaitingForLatch = 0; + jasmine.Block.call(this, env, null, spec); +}; +jasmine.util.inherit(jasmine.WaitsForBlock, jasmine.Block); + +jasmine.WaitsForBlock.TIMEOUT_INCREMENT = 10; + +jasmine.WaitsForBlock.prototype.execute = function(onComplete) { + if (jasmine.VERBOSE) { + this.env.reporter.log('>> Jasmine waiting for ' + (this.message || 'something to happen')); + } + var latchFunctionResult; + try { + latchFunctionResult = this.latchFunction.apply(this.spec); + } catch (e) { + this.spec.fail(e); + onComplete(); + return; + } + + if (latchFunctionResult) { + onComplete(); + } else if (this.totalTimeSpentWaitingForLatch >= this.timeout) { + var message = 'timed out after ' + this.timeout + ' msec waiting for ' + (this.message || 'something to happen'); + this.spec.fail({ + name: 'timeout', + message: message + }); + + this.abort = true; + onComplete(); + } else { + this.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT; + var self = this; + this.env.setTimeout(function() { + self.execute(onComplete); + }, jasmine.WaitsForBlock.TIMEOUT_INCREMENT); + } +}; +// Mock setTimeout, clearTimeout +// Contributed by Pivotal Computer Systems, www.pivotalsf.com + +jasmine.FakeTimer = function() { + this.reset(); + + var self = this; + self.setTimeout = function(funcToCall, millis) { + self.timeoutsMade++; + self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false); + return self.timeoutsMade; + }; + + self.setInterval = function(funcToCall, millis) { + self.timeoutsMade++; + self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true); + return self.timeoutsMade; + }; + + self.clearTimeout = function(timeoutKey) { + self.scheduledFunctions[timeoutKey] = jasmine.undefined; + }; + + self.clearInterval = function(timeoutKey) { + self.scheduledFunctions[timeoutKey] = jasmine.undefined; + }; + +}; + +jasmine.FakeTimer.prototype.reset = function() { + this.timeoutsMade = 0; + this.scheduledFunctions = {}; + this.nowMillis = 0; +}; + +jasmine.FakeTimer.prototype.tick = function(millis) { + var oldMillis = this.nowMillis; + var newMillis = oldMillis + millis; + this.runFunctionsWithinRange(oldMillis, newMillis); + this.nowMillis = newMillis; +}; + +jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) { + var scheduledFunc; + var funcsToRun = []; + for (var timeoutKey in this.scheduledFunctions) { + scheduledFunc = this.scheduledFunctions[timeoutKey]; + if (scheduledFunc != jasmine.undefined && + scheduledFunc.runAtMillis >= oldMillis && + scheduledFunc.runAtMillis <= nowMillis) { + funcsToRun.push(scheduledFunc); + this.scheduledFunctions[timeoutKey] = jasmine.undefined; + } + } + + if (funcsToRun.length > 0) { + funcsToRun.sort(function(a, b) { + return a.runAtMillis - b.runAtMillis; + }); + for (var i = 0; i < funcsToRun.length; ++i) { + try { + var funcToRun = funcsToRun[i]; + this.nowMillis = funcToRun.runAtMillis; + funcToRun.funcToCall(); + if (funcToRun.recurring) { + this.scheduleFunction(funcToRun.timeoutKey, + funcToRun.funcToCall, + funcToRun.millis, + true); + } + } catch(e) { + } + } + this.runFunctionsWithinRange(oldMillis, nowMillis); + } +}; + +jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) { + this.scheduledFunctions[timeoutKey] = { + runAtMillis: this.nowMillis + millis, + funcToCall: funcToCall, + recurring: recurring, + timeoutKey: timeoutKey, + millis: millis + }; +}; + +/** + * @namespace + */ +jasmine.Clock = { + defaultFakeTimer: new jasmine.FakeTimer(), + + reset: function() { + jasmine.Clock.assertInstalled(); + jasmine.Clock.defaultFakeTimer.reset(); + }, + + tick: function(millis) { + jasmine.Clock.assertInstalled(); + jasmine.Clock.defaultFakeTimer.tick(millis); + }, + + runFunctionsWithinRange: function(oldMillis, nowMillis) { + jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis); + }, + + scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) { + jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring); + }, + + useMock: function() { + if (!jasmine.Clock.isInstalled()) { + var spec = jasmine.getEnv().currentSpec; + spec.after(jasmine.Clock.uninstallMock); + + jasmine.Clock.installMock(); + } + }, + + installMock: function() { + jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer; + }, + + uninstallMock: function() { + jasmine.Clock.assertInstalled(); + jasmine.Clock.installed = jasmine.Clock.real; + }, + + real: { + setTimeout: jasmine.getGlobal().setTimeout, + clearTimeout: jasmine.getGlobal().clearTimeout, + setInterval: jasmine.getGlobal().setInterval, + clearInterval: jasmine.getGlobal().clearInterval + }, + + assertInstalled: function() { + if (!jasmine.Clock.isInstalled()) { + throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()"); + } + }, + + isInstalled: function() { + return jasmine.Clock.installed == jasmine.Clock.defaultFakeTimer; + }, + + installed: null +}; +jasmine.Clock.installed = jasmine.Clock.real; + +//else for IE support +jasmine.getGlobal().setTimeout = function(funcToCall, millis) { + if (jasmine.Clock.installed.setTimeout.apply) { + return jasmine.Clock.installed.setTimeout.apply(this, arguments); + } else { + return jasmine.Clock.installed.setTimeout(funcToCall, millis); + } +}; + +jasmine.getGlobal().setInterval = function(funcToCall, millis) { + if (jasmine.Clock.installed.setInterval.apply) { + return jasmine.Clock.installed.setInterval.apply(this, arguments); + } else { + return jasmine.Clock.installed.setInterval(funcToCall, millis); + } +}; + +jasmine.getGlobal().clearTimeout = function(timeoutKey) { + if (jasmine.Clock.installed.clearTimeout.apply) { + return jasmine.Clock.installed.clearTimeout.apply(this, arguments); + } else { + return jasmine.Clock.installed.clearTimeout(timeoutKey); + } +}; + +jasmine.getGlobal().clearInterval = function(timeoutKey) { + if (jasmine.Clock.installed.clearTimeout.apply) { + return jasmine.Clock.installed.clearInterval.apply(this, arguments); + } else { + return jasmine.Clock.installed.clearInterval(timeoutKey); + } +}; + + +jasmine.version_= { + "major": 2, + "minor": 0, + "build": 0, + "revision": 1315499111, + "release_candidate": 1 +}; + diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/reporter.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/reporter.js new file mode 100755 index 0000000..fc23840 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/reporter.js @@ -0,0 +1,275 @@ +(function() { + // + // Imports + // + var util; + try { + util = require('util') + } catch(e) { + util = require('sys') + } + + if (! jasmineNode) { + var jasmineNode = {}; + } + + // + // Helpers + // + function noop() {} + + jasmineNode.ANSIColors = { + pass: function() { return '\033[32m'; }, // Green + fail: function() { return '\033[31m'; }, // Red + neutral: function() { return '\033[0m'; } // Normal + }; + + jasmineNode.NoColors = { + pass: function() { return ''; }, + fail: function() { return ''; }, + neutral: function() { return ''; } + }; + + jasmineNode.TerminalReporter = function(config) { + this.print_ = config.print || util.print; + this.color_ = config.color ? jasmineNode.ANSIColors : jasmineNode.NoColors; + + this.started_ = false; + this.finished_ = false; + + this.callback_ = config.onComplete || false + + this.suites_ = []; + this.specResults_ = {}; + this.failures_ = []; + } + + jasmineNode.TerminalReporter.prototype = { + reportRunnerStarting: function(runner) { + this.started_ = true; + this.startedAt = new Date(); + var suites = runner.topLevelSuites(); + for (var i = 0; i < suites.length; i++) { + var suite = suites[i]; + this.suites_.push(this.summarize_(suite)); + } + }, + + summarize_: function(suiteOrSpec) { + var isSuite = suiteOrSpec instanceof jasmine.Suite; + + // We could use a separate object for suite and spec + var summary = { + id: suiteOrSpec.id, + name: suiteOrSpec.description, + type: isSuite? 'suite' : 'spec', + suiteNestingLevel: 0, + children: [] + }; + + if (isSuite) { + var calculateNestingLevel = function(examinedSuite) { + var nestingLevel = 0; + while (examinedSuite.parentSuite !== null) { + nestingLevel += 1; + examinedSuite = examinedSuite.parentSuite; + } + return nestingLevel; + }; + + summary.suiteNestingLevel = calculateNestingLevel(suiteOrSpec); + + var children = suiteOrSpec.children(); + for (var i = 0; i < children.length; i++) { + summary.children.push(this.summarize_(children[i])); + } + } + + return summary; + }, + + // This is heavily influenced by Jasmine's Html/Trivial Reporter + reportRunnerResults: function(runner) { + this.reportFailures_(); + + var results = runner.results(); + var resultColor = (results.failedCount > 0) ? this.color_.fail() : this.color_.pass(); + + var specs = runner.specs(); + var specCount = specs.length; + + var message = "\n\nFinished in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + " seconds"; + this.printLine_(message); + + // This is what jasmine-html.js has + //message = "" + specCount + " spec" + ( specCount === 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount === 1) ? "" : "s"); + + this.printLine_(this.stringWithColor_(this.printRunnerResults_(runner), resultColor)); + + this.finished_ = true; + if(this.callback_) { this.callback_(runner); } + }, + + reportFailures_: function() { + if (this.failures_.length === 0) { + return; + } + + var indent = ' ', failure; + this.printLine_('\n'); + + this.print_('Failures:'); + + for (var i = 0; i < this.failures_.length; i++) { + failure = this.failures_[i]; + this.printLine_('\n'); + this.printLine_(' ' + (i + 1) + ') ' + failure.spec); + this.printLine_(' Message:'); + this.printLine_(' ' + this.stringWithColor_(failure.message, this.color_.fail())); + this.printLine_(' Stacktrace:'); + this.print_(' ' + failure.stackTrace); + } + }, + + reportSuiteResults: function(suite) { + // Not used in this context + }, + + reportSpecResults: function(spec) { + var result = spec.results(); + var msg = ''; + if (result.passed()) { + msg = this.stringWithColor_('.', this.color_.pass()); + // } else if (result.skipped) { TODO: Research why "result.skipped" returns false when "xit" is called on a spec? + // msg = (colors) ? (ansi.yellow + '*' + ansi.none) : '*'; + } else { + msg = this.stringWithColor_('F', this.color_.fail()); + this.addFailureToFailures_(spec); + } + this.spec_results += msg; + this.print_(msg); + }, + + addFailureToFailures_: function(spec) { + var result = spec.results(); + var failureItem = null; + + var items_length = result.items_.length; + for (var i = 0; i < items_length; i++) { + if (result.items_[i].passed_ === false) { + failureItem = result.items_[i]; + var failure = { + spec: spec.description, + message: failureItem.message, + stackTrace: failureItem.trace.stack + } + + this.failures_.push(failure); + } + } + }, + + printRunnerResults_: function(runner){ + var results = runner.results(); + var specs = runner.specs(); + var msg = ''; + msg += specs.length + ' test' + ((specs.length === 1) ? '' : 's') + ', '; + msg += results.totalCount + ' assertion' + ((results.totalCount === 1) ? '' : 's') + ', '; + msg += results.failedCount + ' failure' + ((results.failedCount === 1) ? '' : 's') + '\n'; + return msg; + }, + + // Helper Methods // + stringWithColor_: function(stringValue, color) { + return (color || this.color_.neutral()) + stringValue + this.color_.neutral(); + }, + + printLine_: function(stringValue) { + this.print_(stringValue); + this.print_('\n'); + } + }; + + // *************************************************************** + // TerminalVerboseReporter uses the TerminalReporter's constructor + // *************************************************************** + jasmineNode.TerminalVerboseReporter = function(config) { + jasmineNode.TerminalReporter.call(this, config); + // The extra field in this object + this.indent_ = 0; + } + + + jasmineNode.TerminalVerboseReporter.prototype = { + reportSpecResults: function(spec) { + if (spec.results().failedCount > 0) { + this.addFailureToFailures_(spec); + } + + this.specResults_[spec.id] = { + messages: spec.results().getItems(), + result: spec.results().failedCount > 0 ? 'failed' : 'passed' + }; + }, + + reportRunnerResults: function(runner) { + var messages = new Array(); + this.buildMessagesFromResults_(messages, this.suites_); + + var messages_length = messages.length; + for (var i = 0; i < messages_length-1; i++) { + this.printLine_(messages[i]); + } + + this.print_(messages[messages_length-1]); + + // Call the parent object's method + jasmineNode.TerminalReporter.prototype.reportRunnerResults.call(this, runner); + }, + + buildMessagesFromResults_: function(messages, results) { + var element, specResult, specIndentSpaces, msg = ''; + + var results_length = results.length; + for (var i = 0; i < results_length; i++) { + element = results[i]; + + if (element.type === 'spec') { + specResult = this.specResults_[element.id.toString()]; + + specIndentSpaces = this.indent_ + 2; + if (specResult.result === 'passed') { + msg = this.stringWithColor_(this.indentMessage_(element.name, specIndentSpaces), this.color_.pass()); + } else { + msg = this.stringWithColor_(this.indentMessage_(element.name, specIndentSpaces), this.color_.fail()); + } + + messages.push(msg); + } else { + this.indent_ = element.suiteNestingLevel * 2; + + messages.push(''); + messages.push(this.indentMessage_(element.name, this.indent_)); + } + + this.buildMessagesFromResults_(messages, element.children); + } + }, + + indentMessage_: function(message, indentCount) { + var _indent = ''; + for (var i = 0; i < indentCount; i++) { + _indent += ' '; + } + return (_indent + message); + } + }; + + // Inherit from TerminalReporter + jasmineNode.TerminalVerboseReporter.prototype.__proto__ = jasmineNode.TerminalReporter.prototype; + + // + // Exports + // + exports.jasmineNode = jasmineNode; +})(); diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/requirejs-runner.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/requirejs-runner.js new file mode 100644 index 0000000..6270ac8 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/requirejs-runner.js @@ -0,0 +1,80 @@ +exports.executeJsRunner = function(specCollection, done, jasmineEnv) { + var specs, + specLoader = require('./requirejs-spec-loader'), + requirejs = require('requirejs'), + vm = require('vm'), + fs = require('fs'), + template = fs.readFileSync(__dirname + '/requirejs-wrapper-template.js', 'utf8'), + buildNewContext = function(spec){ + var context = { + describe: describe, + it: it, + xdescribe: xdescribe, + xit: xit, + beforeEach: beforeEach, + spyOn: spyOn, + waitsFor: waitsFor, + runs: runs, + jasmine: jasmine, + expect: expect, + require: require, + console: console, + process: process, + module: module, + specLoader: specLoader, + __dirname: spec.directory(), + __filename: spec.path() + }; + + context.global = context; + + return context; + }, + buildRelativeDirName = function(dir){ + var retVal = "", + thisDir = process.cwd(), + toDir = dir.split('/'), + index = 0, + colonMatches = __dirname.match(/^.:/); + + for(var i = 0; i < (colonMatches && colonMatches.length) || 0; i++){ + thisDir = thisDir.replace(colonMatches[i], '\\' + colonMatches[i].substring(0,1)); + } + + thisDir = thisDir.replace(/\\/g, '/').split('/'); + + for(; index < thisDir.length || index < toDir.length; index++) { + if(thisDir[index] != toDir[index]){ + for(var i = index; i < thisDir.length-1; i++){ + retVal += '../'; + } + + for(var i = index; i < toDir.length; i++){ + retVal += toDir[i] + '/'; + } + + break; + } + } + + return retVal.trim('/'); + }; + + specCollection.getSpecs().forEach(function(s){ + var script = fs.readFileSync(s.path(), 'utf8'), + dir = s.directory(), + colonMatches = dir.match(/.:/), + wrappedScript; + + for(var i = 0; i < (colonMatches && colonMatches.length) || 0; i++){ + dir = dir.replace(colonMatches[i], '/' + colonMatches[i].substring(0,1)); + } + + wrappedScript = template.replace(/#REPLACE URL#/, buildRelativeDirName(dir)) + .replace(/#REPLACE TEST SCRIPT#/, script); + + vm.runInNewContext(wrappedScript, buildNewContext(s), s.path()); + }); + + specLoader.executeWhenAllSpecsAreComplete(jasmineEnv); +}; diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/requirejs-spec-loader.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/requirejs-spec-loader.js new file mode 100644 index 0000000..284db7d --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/requirejs-spec-loader.js @@ -0,0 +1,48 @@ +var _ = require('underscore'), + registry = {}, + timeout = 120000, + now = function() { + return new Date().getTime(); + }, + loader = { + register: function(name) { + registry[name] = false; + }, + completed: function(name){ + registry[name] = true; + } + }, + specLoader = { + defineLoader: function(requirejs) { + requirejs.define('jasmine-spec-loader', function() { + return loader; + }); + }, + executeWhenAllSpecsAreComplete: function(jasmineEnv) { + var allComplete = false, + wait = now(), + timeoutCallback = function() { + allComplete = _.all(registry, function(value) { + return value; + }); + + if(!allComplete && wait + timeout > now()) { + setTimeout(timeoutCallback, 100); + } else if (!allComplete) { + console.log('Failed to load all specs within timeout window.'); + process.exit(-1); + } else { + jasmineEnv.execute(); + } + }; + + setTimeout(timeoutCallback, 100); + }, + setTimeoutInterval: function(value) { + timeout = value; + }, + }; + +for(var key in specLoader) { + exports[key] = specLoader[key]; +} diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/requirejs-wrapper-template.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/requirejs-wrapper-template.js new file mode 100644 index 0000000..047e7cb --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/requirejs-wrapper-template.js @@ -0,0 +1,65 @@ +var test = function(require, define, undefined) { #REPLACE TEST SCRIPT# +}; + +var requirejsOrig = require('requirejs'), + ostring = Object.prototype.toString, + path = require('path'), + baseUrl = '#REPLACE URL#', + isArray = function(it){ + return ostring.call(it) === '[object Array]'; + }, + isFunction = function(it){ + return ostring.call(it) === '[object Function]'; + }, + requirejs = function(deps, callback){ + var retVal; + + if(!isArray(deps) && typeof deps !== 'string'){ + if(isArray(callback)){ + retVal = requirejsOrig(deps, callback, arguments[2]); + } else { + retVal = requirejsOrig(deps, [], callback); + } + } else { + retVal = requirejsOrig(deps, callback); + } + + return retVal; + }; + +requirejsOrig.config({ + baseUrl: baseUrl, + nodeRequire: require +}); + +for(var key in requirejsOrig) { + requirejs[key] = requirejsOrig[key]; +} + +requirejs.config = function(config){ + var alteredConfig = {}; + + for(var key in config) { + alteredConfig[key] = config[key]; + } + + if(alteredConfig.baseUrl){ + var base = baseUrl.replace(/\\/g, '/'), + splitUrl = alteredConfig.baseUrl.replace(/\\/g, '/').split('/'), + index = 0; + + for(; index < splitUrl.length; index++){ + if(splitUrl[index] === '..'){ + base = path.dirname(base); + } else { + base += '/' + splitUrl[index]; + } + } + + alteredConfig.baseUrl = base; + } + + return requirejsOrig.config(alteredConfig); +}; + +test(requirejs, requirejs.define); diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/spec-collection.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/spec-collection.js new file mode 100644 index 0000000..c5d8574 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/lib/jasmine-node/spec-collection.js @@ -0,0 +1,35 @@ +var walkdir = require('walkdir'); +var path = require('path'); +var fs = require('fs'); +var specs = []; + +var createSpecObj = function(path, root) { + return { + path: function() { return path; }, + relativePath: function() { return path.replace(root, '').replace(/^[\/\\]/, '').replace(/\\/g, '/'); }, + directory: function() { return path.replace(/[\/\\][\s\w\.-]*$/, "").replace(/\\/g, '/'); }, + relativeDirectory: function() { return relativePath().replace(/[\/\\][\s\w\.-]*$/, "").replace(/\\/g, '/'); }, + filename: function() { return path.replace(/^.*[\\\/]/, ''); } + }; +}; + +exports.load = function(loadpath, matcher) { + var wannaBeSpecs = walkdir.sync(loadpath) + + for (var i = 0; i < wannaBeSpecs.length; i++) { + var file = wannaBeSpecs[i]; + try { + if (fs.statSync(file).isFile()) { + if (!/.*node_modules.*/.test(file) && matcher.test(path.basename(file))) { + specs.push(createSpecObj(file)); + } + } + } catch(e) { + // nothing to do here + } + } +}; + +exports.getSpecs = function() { + return specs; +}; diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/.bin/cake b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/.bin/cake new file mode 120000 index 0000000..d95f32a --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/.bin/cake @@ -0,0 +1 @@ +../coffee-script/bin/cake \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/.bin/coffee b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/.bin/coffee new file mode 120000 index 0000000..b57f275 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/.bin/coffee @@ -0,0 +1 @@ +../coffee-script/bin/coffee \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/.bin/r.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/.bin/r.js new file mode 120000 index 0000000..2075b60 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/.bin/r.js @@ -0,0 +1 @@ +../requirejs/bin/r.js \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/.npmignore b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/.npmignore new file mode 100644 index 0000000..21e430d --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/.npmignore @@ -0,0 +1,11 @@ +*.coffee +*.html +.DS_Store +.git* +Cakefile +documentation/ +examples/ +extras/coffee-script.js +raw/ +src/ +test/ diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/CNAME b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/CNAME new file mode 100644 index 0000000..faadabe --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/CNAME @@ -0,0 +1 @@ +coffeescript.org \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/LICENSE b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/LICENSE new file mode 100644 index 0000000..dbe6b4e --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2009-2012 Jeremy Ashkenas + +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/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/README b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/README new file mode 100644 index 0000000..69ee6f4 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/README @@ -0,0 +1,51 @@ + + { + } } { + { { } } + } }{ { + { }{ } } _____ __ __ + ( }{ }{ { ) / ____| / _|/ _| + .- { { } { }} -. | | ___ | |_| |_ ___ ___ + ( ( } { } { } } ) | | / _ \| _| _/ _ \/ _ \ + |`-..________ ..-'| | |___| (_) | | | || __/ __/ + | | \_____\___/|_| |_| \___|\___| + | ;--. + | (__ \ _____ _ _ + | | ) ) / ____| (_) | | + | |/ / | (___ ___ _ __ _ _ __ | |_ + | ( / \___ \ / __| '__| | '_ \| __| + | |/ ____) | (__| | | | |_) | |_ + | | |_____/ \___|_| |_| .__/ \__| + `-.._________..-' | | + |_| + + + CoffeeScript is a little language that compiles into JavaScript. + + Install Node.js, and then the CoffeeScript compiler: + sudo bin/cake install + + Or, if you have the Node Package Manager installed: + npm install -g coffee-script + (Leave off the -g if you don't wish to install globally.) + + Execute a script: + coffee /path/to/script.coffee + + Compile a script: + coffee -c /path/to/script.coffee + + For documentation, usage, and examples, see: + http://coffeescript.org/ + + To suggest a feature, report a bug, or general discussion: + http://github.com/jashkenas/coffee-script/issues/ + + If you'd like to chat, drop by #coffeescript on Freenode IRC, + or on webchat.freenode.net. + + The source repository: + git://github.com/jashkenas/coffee-script.git + + All contributors are listed here: + http://github.com/jashkenas/coffee-script/contributors diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/Rakefile b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/Rakefile new file mode 100644 index 0000000..dfb85da --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/Rakefile @@ -0,0 +1,78 @@ +require 'rubygems' +require 'erb' +require 'fileutils' +require 'rake/testtask' +require 'json' + +desc "Build the documentation page" +task :doc do + source = 'documentation/index.html.erb' + child = fork { exec "bin/coffee -bcw -o documentation/js documentation/coffee/*.coffee" } + at_exit { Process.kill("INT", child) } + Signal.trap("INT") { exit } + loop do + mtime = File.stat(source).mtime + if !@mtime || mtime > @mtime + rendered = ERB.new(File.read(source)).result(binding) + File.open('index.html', 'w+') {|f| f.write(rendered) } + end + @mtime = mtime + sleep 1 + end +end + +desc "Build coffee-script-source gem" +task :gem do + require 'rubygems' + require 'rubygems/package' + + gemspec = Gem::Specification.new do |s| + s.name = 'coffee-script-source' + s.version = JSON.parse(File.read('package.json'))["version"] + s.date = Time.now.strftime("%Y-%m-%d") + + s.homepage = "http://jashkenas.github.com/coffee-script/" + s.summary = "The CoffeeScript Compiler" + s.description = <<-EOS + CoffeeScript is a little language that compiles into JavaScript. + Underneath all of those embarrassing braces and semicolons, + JavaScript has always had a gorgeous object model at its heart. + CoffeeScript is an attempt to expose the good parts of JavaScript + in a simple way. + EOS + + s.files = [ + 'lib/coffee_script/coffee-script.js', + 'lib/coffee_script/source.rb' + ] + + s.authors = ['Jeremy Ashkenas'] + s.email = 'jashkenas@gmail.com' + s.rubyforge_project = 'coffee-script-source' + end + + file = File.open("coffee-script-source.gem", "w") + Gem::Package.open(file, 'w') do |pkg| + pkg.metadata = gemspec.to_yaml + + path = "lib/coffee_script/source.rb" + contents = <<-ERUBY +module CoffeeScript + module Source + def self.bundled_path + File.expand_path("../coffee-script.js", __FILE__) + end + end +end + ERUBY + pkg.add_file_simple(path, 0644, contents.size) do |tar_io| + tar_io.write(contents) + end + + contents = File.read("extras/coffee-script.js") + path = "lib/coffee_script/coffee-script.js" + pkg.add_file_simple(path, 0644, contents.size) do |tar_io| + tar_io.write(contents) + end + end +end diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/bin/cake b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/bin/cake new file mode 100755 index 0000000..5965f4e --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/bin/cake @@ -0,0 +1,7 @@ +#!/usr/bin/env node + +var path = require('path'); +var fs = require('fs'); +var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib'); + +require(lib + '/coffee-script/cake').run(); diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/bin/coffee b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/bin/coffee new file mode 100755 index 0000000..3d1d71c --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/bin/coffee @@ -0,0 +1,7 @@ +#!/usr/bin/env node + +var path = require('path'); +var fs = require('fs'); +var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib'); + +require(lib + '/coffee-script/command').run(); diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/extras/jsl.conf b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/extras/jsl.conf new file mode 100644 index 0000000..1190da5 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/extras/jsl.conf @@ -0,0 +1,44 @@ +# JavaScriptLint configuration file for CoffeeScript. + ++no_return_value # function {0} does not always return a value ++duplicate_formal # duplicate formal argument {0} +-equal_as_assign # test for equality (==) mistyped as assignment (=)?{0} ++var_hides_arg # variable {0} hides argument ++redeclared_var # redeclaration of {0} {1} +-anon_no_return_value # anonymous function does not always return a value ++missing_semicolon # missing semicolon ++meaningless_block # meaningless block; curly braces have no impact +-comma_separated_stmts # multiple statements separated by commas (use semicolons?) ++unreachable_code # unreachable code ++missing_break # missing break statement +-missing_break_for_last_case # missing break statement for last case in switch +-comparison_type_conv # comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==) +-inc_dec_within_stmt # increment (++) and decrement (--) operators used as part of greater statement +-useless_void # use of the void type may be unnecessary (void is always undefined) ++multiple_plus_minus # unknown order of operations for successive plus (e.g. x+++y) or minus (e.g. x---y) signs ++use_of_label # use of label +-block_without_braces # block statement without curly braces ++leading_decimal_point # leading decimal point may indicate a number or an object member ++trailing_decimal_point # trailing decimal point may indicate a number or an object member ++octal_number # leading zeros make an octal number ++nested_comment # nested comment ++misplaced_regex # regular expressions should be preceded by a left parenthesis, assignment, colon, or comma ++ambiguous_newline # unexpected end of line; it is ambiguous whether these lines are part of the same statement ++empty_statement # empty statement or extra semicolon +-missing_option_explicit # the "option explicit" control comment is missing ++partial_option_explicit # the "option explicit" control comment, if used, must be in the first script tag ++dup_option_explicit # duplicate "option explicit" control comment ++useless_assign # useless assignment ++ambiguous_nested_stmt # block statements containing block statements should use curly braces to resolve ambiguity ++ambiguous_else_stmt # the else statement could be matched with one of multiple if statements (use curly braces to indicate intent) +-missing_default_case # missing default case in switch statement ++duplicate_case_in_switch # duplicate case in switch statements ++default_not_at_end # the default case is not at the end of the switch statement ++legacy_cc_not_understood # couldn't understand control comment using /*@keyword@*/ syntax ++jsl_cc_not_understood # couldn't understand control comment using /*jsl:keyword*/ syntax ++useless_comparison # useless comparison; comparing identical expressions ++with_statement # with statement hides undeclared variables; use temporary variable instead ++trailing_comma_in_array # extra comma is not recommended in array initializers ++assign_to_function_call # assignment to a function call ++parseint_missing_radix # parseInt missing radix parameter ++lambda_assign_requires_semicolon diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/browser.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/browser.js new file mode 100644 index 0000000..825cbf3 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/browser.js @@ -0,0 +1,92 @@ +// Generated by CoffeeScript 1.3.3 +(function() { + var CoffeeScript, runScripts; + + CoffeeScript = require('./coffee-script'); + + CoffeeScript.require = require; + + CoffeeScript["eval"] = function(code, options) { + var _ref; + if (options == null) { + options = {}; + } + if ((_ref = options.bare) == null) { + options.bare = true; + } + return eval(CoffeeScript.compile(code, options)); + }; + + CoffeeScript.run = function(code, options) { + if (options == null) { + options = {}; + } + options.bare = true; + return Function(CoffeeScript.compile(code, options))(); + }; + + if (typeof window === "undefined" || window === null) { + return; + } + + CoffeeScript.load = function(url, callback) { + var xhr; + xhr = new (window.ActiveXObject || XMLHttpRequest)('Microsoft.XMLHTTP'); + xhr.open('GET', url, true); + if ('overrideMimeType' in xhr) { + xhr.overrideMimeType('text/plain'); + } + xhr.onreadystatechange = function() { + var _ref; + if (xhr.readyState === 4) { + if ((_ref = xhr.status) === 0 || _ref === 200) { + CoffeeScript.run(xhr.responseText); + } else { + throw new Error("Could not load " + url); + } + if (callback) { + return callback(); + } + } + }; + return xhr.send(null); + }; + + runScripts = function() { + var coffees, execute, index, length, s, scripts; + scripts = document.getElementsByTagName('script'); + coffees = (function() { + var _i, _len, _results; + _results = []; + for (_i = 0, _len = scripts.length; _i < _len; _i++) { + s = scripts[_i]; + if (s.type === 'text/coffeescript') { + _results.push(s); + } + } + return _results; + })(); + index = 0; + length = coffees.length; + (execute = function() { + var script; + script = coffees[index++]; + if ((script != null ? script.type : void 0) === 'text/coffeescript') { + if (script.src) { + return CoffeeScript.load(script.src, execute); + } else { + CoffeeScript.run(script.innerHTML); + return execute(); + } + } + })(); + return null; + }; + + if (window.addEventListener) { + addEventListener('DOMContentLoaded', runScripts, false); + } else { + attachEvent('onload', runScripts); + } + +}).call(this); diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/cake.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/cake.js new file mode 100644 index 0000000..1523418 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/cake.js @@ -0,0 +1,111 @@ +// Generated by CoffeeScript 1.3.3 +(function() { + var CoffeeScript, cakefileDirectory, fatalError, fs, helpers, missingTask, oparse, options, optparse, path, printTasks, switches, tasks; + + fs = require('fs'); + + path = require('path'); + + helpers = require('./helpers'); + + optparse = require('./optparse'); + + CoffeeScript = require('./coffee-script'); + + tasks = {}; + + options = {}; + + switches = []; + + oparse = null; + + helpers.extend(global, { + task: function(name, description, action) { + var _ref; + if (!action) { + _ref = [description, action], action = _ref[0], description = _ref[1]; + } + return tasks[name] = { + name: name, + description: description, + action: action + }; + }, + option: function(letter, flag, description) { + return switches.push([letter, flag, description]); + }, + invoke: function(name) { + if (!tasks[name]) { + missingTask(name); + } + return tasks[name].action(options); + } + }); + + exports.run = function() { + var arg, args, _i, _len, _ref, _results; + global.__originalDirname = fs.realpathSync('.'); + process.chdir(cakefileDirectory(__originalDirname)); + args = process.argv.slice(2); + CoffeeScript.run(fs.readFileSync('Cakefile').toString(), { + filename: 'Cakefile' + }); + oparse = new optparse.OptionParser(switches); + if (!args.length) { + return printTasks(); + } + try { + options = oparse.parse(args); + } catch (e) { + return fatalError("" + e); + } + _ref = options["arguments"]; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + arg = _ref[_i]; + _results.push(invoke(arg)); + } + return _results; + }; + + printTasks = function() { + var cakefilePath, desc, name, relative, spaces, task; + relative = path.relative || path.resolve; + cakefilePath = path.join(relative(__originalDirname, process.cwd()), 'Cakefile'); + console.log("" + cakefilePath + " defines the following tasks:\n"); + for (name in tasks) { + task = tasks[name]; + spaces = 20 - name.length; + spaces = spaces > 0 ? Array(spaces + 1).join(' ') : ''; + desc = task.description ? "# " + task.description : ''; + console.log("cake " + name + spaces + " " + desc); + } + if (switches.length) { + return console.log(oparse.help()); + } + }; + + fatalError = function(message) { + console.error(message + '\n'); + console.log('To see a list of all tasks/options, run "cake"'); + return process.exit(1); + }; + + missingTask = function(task) { + return fatalError("No such task: " + task); + }; + + cakefileDirectory = function(dir) { + var parent; + if (path.existsSync(path.join(dir, 'Cakefile'))) { + return dir; + } + parent = path.normalize(path.join(dir, '..')); + if (parent !== dir) { + return cakefileDirectory(parent); + } + throw new Error("Cakefile not found in " + (process.cwd())); + }; + +}).call(this); diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/coffee-script.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/coffee-script.js new file mode 100644 index 0000000..c43fa49 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/coffee-script.js @@ -0,0 +1,167 @@ +// Generated by CoffeeScript 1.3.3 +(function() { + var Lexer, RESERVED, compile, fs, lexer, parser, path, vm, _ref, + __hasProp = {}.hasOwnProperty; + + fs = require('fs'); + + path = require('path'); + + _ref = require('./lexer'), Lexer = _ref.Lexer, RESERVED = _ref.RESERVED; + + parser = require('./parser').parser; + + vm = require('vm'); + + if (require.extensions) { + require.extensions['.coffee'] = function(module, filename) { + var content; + content = compile(fs.readFileSync(filename, 'utf8'), { + filename: filename + }); + return module._compile(content, filename); + }; + } else if (require.registerExtension) { + require.registerExtension('.coffee', function(content) { + return compile(content); + }); + } + + exports.VERSION = '1.3.3'; + + exports.RESERVED = RESERVED; + + exports.helpers = require('./helpers'); + + exports.compile = compile = function(code, options) { + var header, js, merge; + if (options == null) { + options = {}; + } + merge = exports.helpers.merge; + try { + js = (parser.parse(lexer.tokenize(code))).compile(options); + if (!options.header) { + return js; + } + } catch (err) { + if (options.filename) { + err.message = "In " + options.filename + ", " + err.message; + } + throw err; + } + header = "Generated by CoffeeScript " + this.VERSION; + return "// " + header + "\n" + js; + }; + + exports.tokens = function(code, options) { + return lexer.tokenize(code, options); + }; + + exports.nodes = function(source, options) { + if (typeof source === 'string') { + return parser.parse(lexer.tokenize(source, options)); + } else { + return parser.parse(source); + } + }; + + exports.run = function(code, options) { + var mainModule; + if (options == null) { + options = {}; + } + mainModule = require.main; + mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '.'; + mainModule.moduleCache && (mainModule.moduleCache = {}); + mainModule.paths = require('module')._nodeModulePaths(path.dirname(fs.realpathSync(options.filename))); + if (path.extname(mainModule.filename) !== '.coffee' || require.extensions) { + return mainModule._compile(compile(code, options), mainModule.filename); + } else { + return mainModule._compile(code, mainModule.filename); + } + }; + + exports["eval"] = function(code, options) { + var Module, Script, js, k, o, r, sandbox, v, _i, _len, _module, _ref1, _ref2, _require; + if (options == null) { + options = {}; + } + if (!(code = code.trim())) { + return; + } + Script = vm.Script; + if (Script) { + if (options.sandbox != null) { + if (options.sandbox instanceof Script.createContext().constructor) { + sandbox = options.sandbox; + } else { + sandbox = Script.createContext(); + _ref1 = options.sandbox; + for (k in _ref1) { + if (!__hasProp.call(_ref1, k)) continue; + v = _ref1[k]; + sandbox[k] = v; + } + } + sandbox.global = sandbox.root = sandbox.GLOBAL = sandbox; + } else { + sandbox = global; + } + sandbox.__filename = options.filename || 'eval'; + sandbox.__dirname = path.dirname(sandbox.__filename); + if (!(sandbox !== global || sandbox.module || sandbox.require)) { + Module = require('module'); + sandbox.module = _module = new Module(options.modulename || 'eval'); + sandbox.require = _require = function(path) { + return Module._load(path, _module, true); + }; + _module.filename = sandbox.__filename; + _ref2 = Object.getOwnPropertyNames(require); + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + r = _ref2[_i]; + if (r !== 'paths') { + _require[r] = require[r]; + } + } + _require.paths = _module.paths = Module._nodeModulePaths(process.cwd()); + _require.resolve = function(request) { + return Module._resolveFilename(request, _module); + }; + } + } + o = {}; + for (k in options) { + if (!__hasProp.call(options, k)) continue; + v = options[k]; + o[k] = v; + } + o.bare = true; + js = compile(code, o); + if (sandbox === global) { + return vm.runInThisContext(js); + } else { + return vm.runInContext(js, sandbox); + } + }; + + lexer = new Lexer; + + parser.lexer = { + lex: function() { + var tag, _ref1; + _ref1 = this.tokens[this.pos++] || [''], tag = _ref1[0], this.yytext = _ref1[1], this.yylineno = _ref1[2]; + return tag; + }, + setInput: function(tokens) { + this.tokens = tokens; + return this.pos = 0; + }, + upcomingInput: function() { + return ""; + } + }; + + parser.yy = require('./nodes'); + +}).call(this); diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/command.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/command.js new file mode 100644 index 0000000..e02da9f --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/command.js @@ -0,0 +1,500 @@ +// Generated by CoffeeScript 1.3.3 +(function() { + var BANNER, CoffeeScript, EventEmitter, SWITCHES, compileJoin, compileOptions, compilePath, compileScript, compileStdio, exec, forkNode, fs, helpers, hidden, joinTimeout, lint, loadRequires, notSources, optionParser, optparse, opts, outputPath, parseOptions, path, printLine, printTokens, printWarn, removeSource, sourceCode, sources, spawn, timeLog, unwatchDir, usage, version, wait, watch, watchDir, watchers, writeJs, _ref; + + fs = require('fs'); + + path = require('path'); + + helpers = require('./helpers'); + + optparse = require('./optparse'); + + CoffeeScript = require('./coffee-script'); + + _ref = require('child_process'), spawn = _ref.spawn, exec = _ref.exec; + + EventEmitter = require('events').EventEmitter; + + helpers.extend(CoffeeScript, new EventEmitter); + + printLine = function(line) { + return process.stdout.write(line + '\n'); + }; + + printWarn = function(line) { + return process.stderr.write(line + '\n'); + }; + + hidden = function(file) { + return /^\.|~$/.test(file); + }; + + BANNER = 'Usage: coffee [options] path/to/script.coffee -- [args]\n\nIf called without options, `coffee` will run your script.'; + + SWITCHES = [['-b', '--bare', 'compile without a top-level function wrapper'], ['-c', '--compile', 'compile to JavaScript and save as .js files'], ['-e', '--eval', 'pass a string from the command line as input'], ['-h', '--help', 'display this help message'], ['-i', '--interactive', 'run an interactive CoffeeScript REPL'], ['-j', '--join [FILE]', 'concatenate the source CoffeeScript before compiling'], ['-l', '--lint', 'pipe the compiled JavaScript through JavaScript Lint'], ['-n', '--nodes', 'print out the parse tree that the parser produces'], ['--nodejs [ARGS]', 'pass options directly to the "node" binary'], ['-o', '--output [DIR]', 'set the output directory for compiled JavaScript'], ['-p', '--print', 'print out the compiled JavaScript'], ['-r', '--require [FILE*]', 'require a library before executing your script'], ['-s', '--stdio', 'listen for and compile scripts over stdio'], ['-t', '--tokens', 'print out the tokens that the lexer/rewriter produce'], ['-v', '--version', 'display the version number'], ['-w', '--watch', 'watch scripts for changes and rerun commands']]; + + opts = {}; + + sources = []; + + sourceCode = []; + + notSources = {}; + + watchers = {}; + + optionParser = null; + + exports.run = function() { + var literals, source, _i, _len, _results; + parseOptions(); + if (opts.nodejs) { + return forkNode(); + } + if (opts.help) { + return usage(); + } + if (opts.version) { + return version(); + } + if (opts.require) { + loadRequires(); + } + if (opts.interactive) { + return require('./repl'); + } + if (opts.watch && !fs.watch) { + return printWarn("The --watch feature depends on Node v0.6.0+. You are running " + process.version + "."); + } + if (opts.stdio) { + return compileStdio(); + } + if (opts["eval"]) { + return compileScript(null, sources[0]); + } + if (!sources.length) { + return require('./repl'); + } + literals = opts.run ? sources.splice(1) : []; + process.argv = process.argv.slice(0, 2).concat(literals); + process.argv[0] = 'coffee'; + process.execPath = require.main.filename; + _results = []; + for (_i = 0, _len = sources.length; _i < _len; _i++) { + source = sources[_i]; + _results.push(compilePath(source, true, path.normalize(source))); + } + return _results; + }; + + compilePath = function(source, topLevel, base) { + return fs.stat(source, function(err, stats) { + if (err && err.code !== 'ENOENT') { + throw err; + } + if ((err != null ? err.code : void 0) === 'ENOENT') { + if (topLevel && source.slice(-7) !== '.coffee') { + source = sources[sources.indexOf(source)] = "" + source + ".coffee"; + return compilePath(source, topLevel, base); + } + if (topLevel) { + console.error("File not found: " + source); + process.exit(1); + } + return; + } + if (stats.isDirectory()) { + if (opts.watch) { + watchDir(source, base); + } + return fs.readdir(source, function(err, files) { + var file, index, _ref1, _ref2; + if (err && err.code !== 'ENOENT') { + throw err; + } + if ((err != null ? err.code : void 0) === 'ENOENT') { + return; + } + index = sources.indexOf(source); + files = files.filter(function(file) { + return !hidden(file); + }); + [].splice.apply(sources, [index, index - index + 1].concat(_ref1 = (function() { + var _i, _len, _results; + _results = []; + for (_i = 0, _len = files.length; _i < _len; _i++) { + file = files[_i]; + _results.push(path.join(source, file)); + } + return _results; + })())), _ref1; + [].splice.apply(sourceCode, [index, index - index + 1].concat(_ref2 = files.map(function() { + return null; + }))), _ref2; + return files.forEach(function(file) { + return compilePath(path.join(source, file), false, base); + }); + }); + } else if (topLevel || path.extname(source) === '.coffee') { + if (opts.watch) { + watch(source, base); + } + return fs.readFile(source, function(err, code) { + if (err && err.code !== 'ENOENT') { + throw err; + } + if ((err != null ? err.code : void 0) === 'ENOENT') { + return; + } + return compileScript(source, code.toString(), base); + }); + } else { + notSources[source] = true; + return removeSource(source, base); + } + }); + }; + + compileScript = function(file, input, base) { + var o, options, t, task; + o = opts; + options = compileOptions(file); + try { + t = task = { + file: file, + input: input, + options: options + }; + CoffeeScript.emit('compile', task); + if (o.tokens) { + return printTokens(CoffeeScript.tokens(t.input)); + } else if (o.nodes) { + return printLine(CoffeeScript.nodes(t.input).toString().trim()); + } else if (o.run) { + return CoffeeScript.run(t.input, t.options); + } else if (o.join && t.file !== o.join) { + sourceCode[sources.indexOf(t.file)] = t.input; + return compileJoin(); + } else { + t.output = CoffeeScript.compile(t.input, t.options); + CoffeeScript.emit('success', task); + if (o.print) { + return printLine(t.output.trim()); + } else if (o.compile) { + return writeJs(t.file, t.output, base); + } else if (o.lint) { + return lint(t.file, t.output); + } + } + } catch (err) { + CoffeeScript.emit('failure', err, task); + if (CoffeeScript.listeners('failure').length) { + return; + } + if (o.watch) { + return printLine(err.message + '\x07'); + } + printWarn(err instanceof Error && err.stack || ("ERROR: " + err)); + return process.exit(1); + } + }; + + compileStdio = function() { + var code, stdin; + code = ''; + stdin = process.openStdin(); + stdin.on('data', function(buffer) { + if (buffer) { + return code += buffer.toString(); + } + }); + return stdin.on('end', function() { + return compileScript(null, code); + }); + }; + + joinTimeout = null; + + compileJoin = function() { + if (!opts.join) { + return; + } + if (!sourceCode.some(function(code) { + return code === null; + })) { + clearTimeout(joinTimeout); + return joinTimeout = wait(100, function() { + return compileScript(opts.join, sourceCode.join('\n'), opts.join); + }); + } + }; + + loadRequires = function() { + var realFilename, req, _i, _len, _ref1; + realFilename = module.filename; + module.filename = '.'; + _ref1 = opts.require; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + req = _ref1[_i]; + require(req); + } + return module.filename = realFilename; + }; + + watch = function(source, base) { + var compile, compileTimeout, prevStats, rewatch, watchErr, watcher; + prevStats = null; + compileTimeout = null; + watchErr = function(e) { + if (e.code === 'ENOENT') { + if (sources.indexOf(source) === -1) { + return; + } + try { + rewatch(); + return compile(); + } catch (e) { + removeSource(source, base, true); + return compileJoin(); + } + } else { + throw e; + } + }; + compile = function() { + clearTimeout(compileTimeout); + return compileTimeout = wait(25, function() { + return fs.stat(source, function(err, stats) { + if (err) { + return watchErr(err); + } + if (prevStats && stats.size === prevStats.size && stats.mtime.getTime() === prevStats.mtime.getTime()) { + return rewatch(); + } + prevStats = stats; + return fs.readFile(source, function(err, code) { + if (err) { + return watchErr(err); + } + compileScript(source, code.toString(), base); + return rewatch(); + }); + }); + }); + }; + try { + watcher = fs.watch(source, compile); + } catch (e) { + watchErr(e); + } + return rewatch = function() { + if (watcher != null) { + watcher.close(); + } + return watcher = fs.watch(source, compile); + }; + }; + + watchDir = function(source, base) { + var readdirTimeout, watcher; + readdirTimeout = null; + try { + return watcher = fs.watch(source, function() { + clearTimeout(readdirTimeout); + return readdirTimeout = wait(25, function() { + return fs.readdir(source, function(err, files) { + var file, _i, _len, _results; + if (err) { + if (err.code !== 'ENOENT') { + throw err; + } + watcher.close(); + return unwatchDir(source, base); + } + _results = []; + for (_i = 0, _len = files.length; _i < _len; _i++) { + file = files[_i]; + if (!(!hidden(file) && !notSources[file])) { + continue; + } + file = path.join(source, file); + if (sources.some(function(s) { + return s.indexOf(file) >= 0; + })) { + continue; + } + sources.push(file); + sourceCode.push(null); + _results.push(compilePath(file, false, base)); + } + return _results; + }); + }); + }); + } catch (e) { + if (e.code !== 'ENOENT') { + throw e; + } + } + }; + + unwatchDir = function(source, base) { + var file, prevSources, toRemove, _i, _len; + prevSources = sources.slice(0); + toRemove = (function() { + var _i, _len, _results; + _results = []; + for (_i = 0, _len = sources.length; _i < _len; _i++) { + file = sources[_i]; + if (file.indexOf(source) >= 0) { + _results.push(file); + } + } + return _results; + })(); + for (_i = 0, _len = toRemove.length; _i < _len; _i++) { + file = toRemove[_i]; + removeSource(file, base, true); + } + if (!sources.some(function(s, i) { + return prevSources[i] !== s; + })) { + return; + } + return compileJoin(); + }; + + removeSource = function(source, base, removeJs) { + var index, jsPath; + index = sources.indexOf(source); + sources.splice(index, 1); + sourceCode.splice(index, 1); + if (removeJs && !opts.join) { + jsPath = outputPath(source, base); + return path.exists(jsPath, function(exists) { + if (exists) { + return fs.unlink(jsPath, function(err) { + if (err && err.code !== 'ENOENT') { + throw err; + } + return timeLog("removed " + source); + }); + } + }); + } + }; + + outputPath = function(source, base) { + var baseDir, dir, filename, srcDir; + filename = path.basename(source, path.extname(source)) + '.js'; + srcDir = path.dirname(source); + baseDir = base === '.' ? srcDir : srcDir.substring(base.length); + dir = opts.output ? path.join(opts.output, baseDir) : srcDir; + return path.join(dir, filename); + }; + + writeJs = function(source, js, base) { + var compile, jsDir, jsPath; + jsPath = outputPath(source, base); + jsDir = path.dirname(jsPath); + compile = function() { + if (js.length <= 0) { + js = ' '; + } + return fs.writeFile(jsPath, js, function(err) { + if (err) { + return printLine(err.message); + } else if (opts.compile && opts.watch) { + return timeLog("compiled " + source); + } + }); + }; + return path.exists(jsDir, function(exists) { + if (exists) { + return compile(); + } else { + return exec("mkdir -p " + jsDir, compile); + } + }); + }; + + wait = function(milliseconds, func) { + return setTimeout(func, milliseconds); + }; + + timeLog = function(message) { + return console.log("" + ((new Date).toLocaleTimeString()) + " - " + message); + }; + + lint = function(file, js) { + var conf, jsl, printIt; + printIt = function(buffer) { + return printLine(file + ':\t' + buffer.toString().trim()); + }; + conf = __dirname + '/../../extras/jsl.conf'; + jsl = spawn('jsl', ['-nologo', '-stdin', '-conf', conf]); + jsl.stdout.on('data', printIt); + jsl.stderr.on('data', printIt); + jsl.stdin.write(js); + return jsl.stdin.end(); + }; + + printTokens = function(tokens) { + var strings, tag, token, value; + strings = (function() { + var _i, _len, _ref1, _results; + _results = []; + for (_i = 0, _len = tokens.length; _i < _len; _i++) { + token = tokens[_i]; + _ref1 = [token[0], token[1].toString().replace(/\n/, '\\n')], tag = _ref1[0], value = _ref1[1]; + _results.push("[" + tag + " " + value + "]"); + } + return _results; + })(); + return printLine(strings.join(' ')); + }; + + parseOptions = function() { + var i, o, source, _i, _len; + optionParser = new optparse.OptionParser(SWITCHES, BANNER); + o = opts = optionParser.parse(process.argv.slice(2)); + o.compile || (o.compile = !!o.output); + o.run = !(o.compile || o.print || o.lint); + o.print = !!(o.print || (o["eval"] || o.stdio && o.compile)); + sources = o["arguments"]; + for (i = _i = 0, _len = sources.length; _i < _len; i = ++_i) { + source = sources[i]; + sourceCode[i] = null; + } + }; + + compileOptions = function(filename) { + return { + filename: filename, + bare: opts.bare, + header: opts.compile + }; + }; + + forkNode = function() { + var args, nodeArgs; + nodeArgs = opts.nodejs.split(/\s+/); + args = process.argv.slice(1); + args.splice(args.indexOf('--nodejs'), 2); + return spawn(process.execPath, nodeArgs.concat(args), { + cwd: process.cwd(), + env: process.env, + customFds: [0, 1, 2] + }); + }; + + usage = function() { + return printLine((new optparse.OptionParser(SWITCHES, BANNER)).help()); + }; + + version = function() { + return printLine("CoffeeScript version " + CoffeeScript.VERSION); + }; + +}).call(this); diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/grammar.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/grammar.js new file mode 100644 index 0000000..5662138 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/grammar.js @@ -0,0 +1,606 @@ +// Generated by CoffeeScript 1.3.3 +(function() { + var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap; + + Parser = require('jison').Parser; + + unwrap = /^function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/; + + o = function(patternString, action, options) { + var match; + patternString = patternString.replace(/\s{2,}/g, ' '); + if (!action) { + return [patternString, '$$ = $1;', options]; + } + action = (match = unwrap.exec(action)) ? match[1] : "(" + action + "())"; + action = action.replace(/\bnew /g, '$&yy.'); + action = action.replace(/\b(?:Block\.wrap|extend)\b/g, 'yy.$&'); + return [patternString, "$$ = " + action + ";", options]; + }; + + grammar = { + Root: [ + o('', function() { + return new Block; + }), o('Body'), o('Block TERMINATOR') + ], + Body: [ + o('Line', function() { + return Block.wrap([$1]); + }), o('Body TERMINATOR Line', function() { + return $1.push($3); + }), o('Body TERMINATOR') + ], + Line: [o('Expression'), o('Statement')], + Statement: [ + o('Return'), o('Comment'), o('STATEMENT', function() { + return new Literal($1); + }) + ], + Expression: [o('Value'), o('Invocation'), o('Code'), o('Operation'), o('Assign'), o('If'), o('Try'), o('While'), o('For'), o('Switch'), o('Class'), o('Throw')], + Block: [ + o('INDENT OUTDENT', function() { + return new Block; + }), o('INDENT Body OUTDENT', function() { + return $2; + }) + ], + Identifier: [ + o('IDENTIFIER', function() { + return new Literal($1); + }) + ], + AlphaNumeric: [ + o('NUMBER', function() { + return new Literal($1); + }), o('STRING', function() { + return new Literal($1); + }) + ], + Literal: [ + o('AlphaNumeric'), o('JS', function() { + return new Literal($1); + }), o('REGEX', function() { + return new Literal($1); + }), o('DEBUGGER', function() { + return new Literal($1); + }), o('UNDEFINED', function() { + return new Undefined; + }), o('NULL', function() { + return new Null; + }), o('BOOL', function() { + return new Bool($1); + }) + ], + Assign: [ + o('Assignable = Expression', function() { + return new Assign($1, $3); + }), o('Assignable = TERMINATOR Expression', function() { + return new Assign($1, $4); + }), o('Assignable = INDENT Expression OUTDENT', function() { + return new Assign($1, $4); + }) + ], + AssignObj: [ + o('ObjAssignable', function() { + return new Value($1); + }), o('ObjAssignable : Expression', function() { + return new Assign(new Value($1), $3, 'object'); + }), o('ObjAssignable :\ + INDENT Expression OUTDENT', function() { + return new Assign(new Value($1), $4, 'object'); + }), o('Comment') + ], + ObjAssignable: [o('Identifier'), o('AlphaNumeric'), o('ThisProperty')], + Return: [ + o('RETURN Expression', function() { + return new Return($2); + }), o('RETURN', function() { + return new Return; + }) + ], + Comment: [ + o('HERECOMMENT', function() { + return new Comment($1); + }) + ], + Code: [ + o('PARAM_START ParamList PARAM_END FuncGlyph Block', function() { + return new Code($2, $5, $4); + }), o('FuncGlyph Block', function() { + return new Code([], $2, $1); + }) + ], + FuncGlyph: [ + o('->', function() { + return 'func'; + }), o('=>', function() { + return 'boundfunc'; + }) + ], + OptComma: [o(''), o(',')], + ParamList: [ + o('', function() { + return []; + }), o('Param', function() { + return [$1]; + }), o('ParamList , Param', function() { + return $1.concat($3); + }), o('ParamList OptComma TERMINATOR Param', function() { + return $1.concat($4); + }), o('ParamList OptComma INDENT ParamList OptComma OUTDENT', function() { + return $1.concat($4); + }) + ], + Param: [ + o('ParamVar', function() { + return new Param($1); + }), o('ParamVar ...', function() { + return new Param($1, null, true); + }), o('ParamVar = Expression', function() { + return new Param($1, $3); + }) + ], + ParamVar: [o('Identifier'), o('ThisProperty'), o('Array'), o('Object')], + Splat: [ + o('Expression ...', function() { + return new Splat($1); + }) + ], + SimpleAssignable: [ + o('Identifier', function() { + return new Value($1); + }), o('Value Accessor', function() { + return $1.add($2); + }), o('Invocation Accessor', function() { + return new Value($1, [].concat($2)); + }), o('ThisProperty') + ], + Assignable: [ + o('SimpleAssignable'), o('Array', function() { + return new Value($1); + }), o('Object', function() { + return new Value($1); + }) + ], + Value: [ + o('Assignable'), o('Literal', function() { + return new Value($1); + }), o('Parenthetical', function() { + return new Value($1); + }), o('Range', function() { + return new Value($1); + }), o('This') + ], + Accessor: [ + o('. Identifier', function() { + return new Access($2); + }), o('?. Identifier', function() { + return new Access($2, 'soak'); + }), o(':: Identifier', function() { + return [new Access(new Literal('prototype')), new Access($2)]; + }), o('::', function() { + return new Access(new Literal('prototype')); + }), o('Index') + ], + Index: [ + o('INDEX_START IndexValue INDEX_END', function() { + return $2; + }), o('INDEX_SOAK Index', function() { + return extend($2, { + soak: true + }); + }) + ], + IndexValue: [ + o('Expression', function() { + return new Index($1); + }), o('Slice', function() { + return new Slice($1); + }) + ], + Object: [ + o('{ AssignList OptComma }', function() { + return new Obj($2, $1.generated); + }) + ], + AssignList: [ + o('', function() { + return []; + }), o('AssignObj', function() { + return [$1]; + }), o('AssignList , AssignObj', function() { + return $1.concat($3); + }), o('AssignList OptComma TERMINATOR AssignObj', function() { + return $1.concat($4); + }), o('AssignList OptComma INDENT AssignList OptComma OUTDENT', function() { + return $1.concat($4); + }) + ], + Class: [ + o('CLASS', function() { + return new Class; + }), o('CLASS Block', function() { + return new Class(null, null, $2); + }), o('CLASS EXTENDS Expression', function() { + return new Class(null, $3); + }), o('CLASS EXTENDS Expression Block', function() { + return new Class(null, $3, $4); + }), o('CLASS SimpleAssignable', function() { + return new Class($2); + }), o('CLASS SimpleAssignable Block', function() { + return new Class($2, null, $3); + }), o('CLASS SimpleAssignable EXTENDS Expression', function() { + return new Class($2, $4); + }), o('CLASS SimpleAssignable EXTENDS Expression Block', function() { + return new Class($2, $4, $5); + }) + ], + Invocation: [ + o('Value OptFuncExist Arguments', function() { + return new Call($1, $3, $2); + }), o('Invocation OptFuncExist Arguments', function() { + return new Call($1, $3, $2); + }), o('SUPER', function() { + return new Call('super', [new Splat(new Literal('arguments'))]); + }), o('SUPER Arguments', function() { + return new Call('super', $2); + }) + ], + OptFuncExist: [ + o('', function() { + return false; + }), o('FUNC_EXIST', function() { + return true; + }) + ], + Arguments: [ + o('CALL_START CALL_END', function() { + return []; + }), o('CALL_START ArgList OptComma CALL_END', function() { + return $2; + }) + ], + This: [ + o('THIS', function() { + return new Value(new Literal('this')); + }), o('@', function() { + return new Value(new Literal('this')); + }) + ], + ThisProperty: [ + o('@ Identifier', function() { + return new Value(new Literal('this'), [new Access($2)], 'this'); + }) + ], + Array: [ + o('[ ]', function() { + return new Arr([]); + }), o('[ ArgList OptComma ]', function() { + return new Arr($2); + }) + ], + RangeDots: [ + o('..', function() { + return 'inclusive'; + }), o('...', function() { + return 'exclusive'; + }) + ], + Range: [ + o('[ Expression RangeDots Expression ]', function() { + return new Range($2, $4, $3); + }) + ], + Slice: [ + o('Expression RangeDots Expression', function() { + return new Range($1, $3, $2); + }), o('Expression RangeDots', function() { + return new Range($1, null, $2); + }), o('RangeDots Expression', function() { + return new Range(null, $2, $1); + }), o('RangeDots', function() { + return new Range(null, null, $1); + }) + ], + ArgList: [ + o('Arg', function() { + return [$1]; + }), o('ArgList , Arg', function() { + return $1.concat($3); + }), o('ArgList OptComma TERMINATOR Arg', function() { + return $1.concat($4); + }), o('INDENT ArgList OptComma OUTDENT', function() { + return $2; + }), o('ArgList OptComma INDENT ArgList OptComma OUTDENT', function() { + return $1.concat($4); + }) + ], + Arg: [o('Expression'), o('Splat')], + SimpleArgs: [ + o('Expression'), o('SimpleArgs , Expression', function() { + return [].concat($1, $3); + }) + ], + Try: [ + o('TRY Block', function() { + return new Try($2); + }), o('TRY Block Catch', function() { + return new Try($2, $3[0], $3[1]); + }), o('TRY Block FINALLY Block', function() { + return new Try($2, null, null, $4); + }), o('TRY Block Catch FINALLY Block', function() { + return new Try($2, $3[0], $3[1], $5); + }) + ], + Catch: [ + o('CATCH Identifier Block', function() { + return [$2, $3]; + }) + ], + Throw: [ + o('THROW Expression', function() { + return new Throw($2); + }) + ], + Parenthetical: [ + o('( Body )', function() { + return new Parens($2); + }), o('( INDENT Body OUTDENT )', function() { + return new Parens($3); + }) + ], + WhileSource: [ + o('WHILE Expression', function() { + return new While($2); + }), o('WHILE Expression WHEN Expression', function() { + return new While($2, { + guard: $4 + }); + }), o('UNTIL Expression', function() { + return new While($2, { + invert: true + }); + }), o('UNTIL Expression WHEN Expression', function() { + return new While($2, { + invert: true, + guard: $4 + }); + }) + ], + While: [ + o('WhileSource Block', function() { + return $1.addBody($2); + }), o('Statement WhileSource', function() { + return $2.addBody(Block.wrap([$1])); + }), o('Expression WhileSource', function() { + return $2.addBody(Block.wrap([$1])); + }), o('Loop', function() { + return $1; + }) + ], + Loop: [ + o('LOOP Block', function() { + return new While(new Literal('true')).addBody($2); + }), o('LOOP Expression', function() { + return new While(new Literal('true')).addBody(Block.wrap([$2])); + }) + ], + For: [ + o('Statement ForBody', function() { + return new For($1, $2); + }), o('Expression ForBody', function() { + return new For($1, $2); + }), o('ForBody Block', function() { + return new For($2, $1); + }) + ], + ForBody: [ + o('FOR Range', function() { + return { + source: new Value($2) + }; + }), o('ForStart ForSource', function() { + $2.own = $1.own; + $2.name = $1[0]; + $2.index = $1[1]; + return $2; + }) + ], + ForStart: [ + o('FOR ForVariables', function() { + return $2; + }), o('FOR OWN ForVariables', function() { + $3.own = true; + return $3; + }) + ], + ForValue: [ + o('Identifier'), o('ThisProperty'), o('Array', function() { + return new Value($1); + }), o('Object', function() { + return new Value($1); + }) + ], + ForVariables: [ + o('ForValue', function() { + return [$1]; + }), o('ForValue , ForValue', function() { + return [$1, $3]; + }) + ], + ForSource: [ + o('FORIN Expression', function() { + return { + source: $2 + }; + }), o('FOROF Expression', function() { + return { + source: $2, + object: true + }; + }), o('FORIN Expression WHEN Expression', function() { + return { + source: $2, + guard: $4 + }; + }), o('FOROF Expression WHEN Expression', function() { + return { + source: $2, + guard: $4, + object: true + }; + }), o('FORIN Expression BY Expression', function() { + return { + source: $2, + step: $4 + }; + }), o('FORIN Expression WHEN Expression BY Expression', function() { + return { + source: $2, + guard: $4, + step: $6 + }; + }), o('FORIN Expression BY Expression WHEN Expression', function() { + return { + source: $2, + step: $4, + guard: $6 + }; + }) + ], + Switch: [ + o('SWITCH Expression INDENT Whens OUTDENT', function() { + return new Switch($2, $4); + }), o('SWITCH Expression INDENT Whens ELSE Block OUTDENT', function() { + return new Switch($2, $4, $6); + }), o('SWITCH INDENT Whens OUTDENT', function() { + return new Switch(null, $3); + }), o('SWITCH INDENT Whens ELSE Block OUTDENT', function() { + return new Switch(null, $3, $5); + }) + ], + Whens: [ + o('When'), o('Whens When', function() { + return $1.concat($2); + }) + ], + When: [ + o('LEADING_WHEN SimpleArgs Block', function() { + return [[$2, $3]]; + }), o('LEADING_WHEN SimpleArgs Block TERMINATOR', function() { + return [[$2, $3]]; + }) + ], + IfBlock: [ + o('IF Expression Block', function() { + return new If($2, $3, { + type: $1 + }); + }), o('IfBlock ELSE IF Expression Block', function() { + return $1.addElse(new If($4, $5, { + type: $3 + })); + }) + ], + If: [ + o('IfBlock'), o('IfBlock ELSE Block', function() { + return $1.addElse($3); + }), o('Statement POST_IF Expression', function() { + return new If($3, Block.wrap([$1]), { + type: $2, + statement: true + }); + }), o('Expression POST_IF Expression', function() { + return new If($3, Block.wrap([$1]), { + type: $2, + statement: true + }); + }) + ], + Operation: [ + o('UNARY Expression', function() { + return new Op($1, $2); + }), o('- Expression', (function() { + return new Op('-', $2); + }), { + prec: 'UNARY' + }), o('+ Expression', (function() { + return new Op('+', $2); + }), { + prec: 'UNARY' + }), o('-- SimpleAssignable', function() { + return new Op('--', $2); + }), o('++ SimpleAssignable', function() { + return new Op('++', $2); + }), o('SimpleAssignable --', function() { + return new Op('--', $1, null, true); + }), o('SimpleAssignable ++', function() { + return new Op('++', $1, null, true); + }), o('Expression ?', function() { + return new Existence($1); + }), o('Expression + Expression', function() { + return new Op('+', $1, $3); + }), o('Expression - Expression', function() { + return new Op('-', $1, $3); + }), o('Expression MATH Expression', function() { + return new Op($2, $1, $3); + }), o('Expression SHIFT Expression', function() { + return new Op($2, $1, $3); + }), o('Expression COMPARE Expression', function() { + return new Op($2, $1, $3); + }), o('Expression LOGIC Expression', function() { + return new Op($2, $1, $3); + }), o('Expression RELATION Expression', function() { + if ($2.charAt(0) === '!') { + return new Op($2.slice(1), $1, $3).invert(); + } else { + return new Op($2, $1, $3); + } + }), o('SimpleAssignable COMPOUND_ASSIGN\ + Expression', function() { + return new Assign($1, $3, $2); + }), o('SimpleAssignable COMPOUND_ASSIGN\ + INDENT Expression OUTDENT', function() { + return new Assign($1, $4, $2); + }), o('SimpleAssignable EXTENDS Expression', function() { + return new Extends($1, $3); + }) + ] + }; + + operators = [['left', '.', '?.', '::'], ['left', 'CALL_START', 'CALL_END'], ['nonassoc', '++', '--'], ['left', '?'], ['right', 'UNARY'], ['left', 'MATH'], ['left', '+', '-'], ['left', 'SHIFT'], ['left', 'RELATION'], ['left', 'COMPARE'], ['left', 'LOGIC'], ['nonassoc', 'INDENT', 'OUTDENT'], ['right', '=', ':', 'COMPOUND_ASSIGN', 'RETURN', 'THROW', 'EXTENDS'], ['right', 'FORIN', 'FOROF', 'BY', 'WHEN'], ['right', 'IF', 'ELSE', 'FOR', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS'], ['right', 'POST_IF']]; + + tokens = []; + + for (name in grammar) { + alternatives = grammar[name]; + grammar[name] = (function() { + var _i, _j, _len, _len1, _ref, _results; + _results = []; + for (_i = 0, _len = alternatives.length; _i < _len; _i++) { + alt = alternatives[_i]; + _ref = alt[0].split(' '); + for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { + token = _ref[_j]; + if (!grammar[token]) { + tokens.push(token); + } + } + if (name === 'Root') { + alt[1] = "return " + alt[1]; + } + _results.push(alt); + } + return _results; + })(); + } + + exports.parser = new Parser({ + tokens: tokens.join(' '), + bnf: grammar, + operators: operators.reverse(), + startSymbol: 'Root' + }); + +}).call(this); diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/helpers.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/helpers.js new file mode 100644 index 0000000..b0a997b --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/helpers.js @@ -0,0 +1,77 @@ +// Generated by CoffeeScript 1.3.3 +(function() { + var extend, flatten; + + exports.starts = function(string, literal, start) { + return literal === string.substr(start, literal.length); + }; + + exports.ends = function(string, literal, back) { + var len; + len = literal.length; + return literal === string.substr(string.length - len - (back || 0), len); + }; + + exports.compact = function(array) { + var item, _i, _len, _results; + _results = []; + for (_i = 0, _len = array.length; _i < _len; _i++) { + item = array[_i]; + if (item) { + _results.push(item); + } + } + return _results; + }; + + exports.count = function(string, substr) { + var num, pos; + num = pos = 0; + if (!substr.length) { + return 1 / 0; + } + while (pos = 1 + string.indexOf(substr, pos)) { + num++; + } + return num; + }; + + exports.merge = function(options, overrides) { + return extend(extend({}, options), overrides); + }; + + extend = exports.extend = function(object, properties) { + var key, val; + for (key in properties) { + val = properties[key]; + object[key] = val; + } + return object; + }; + + exports.flatten = flatten = function(array) { + var element, flattened, _i, _len; + flattened = []; + for (_i = 0, _len = array.length; _i < _len; _i++) { + element = array[_i]; + if (element instanceof Array) { + flattened = flattened.concat(flatten(element)); + } else { + flattened.push(element); + } + } + return flattened; + }; + + exports.del = function(obj, key) { + var val; + val = obj[key]; + delete obj[key]; + return val; + }; + + exports.last = function(array, back) { + return array[array.length - (back || 0) - 1]; + }; + +}).call(this); diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/index.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/index.js new file mode 100644 index 0000000..d344c41 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/index.js @@ -0,0 +1,11 @@ +// Generated by CoffeeScript 1.3.3 +(function() { + var key, val, _ref; + + _ref = require('./coffee-script'); + for (key in _ref) { + val = _ref[key]; + exports[key] = val; + } + +}).call(this); diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/lexer.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/lexer.js new file mode 100644 index 0000000..f80a443 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/lexer.js @@ -0,0 +1,788 @@ +// Generated by CoffeeScript 1.3.3 +(function() { + var BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_ILLEGAL, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDEXABLE, INVERSES, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NOT_SPACED_REGEX, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, STRICT_PROSCRIBED, TRAILING_SPACES, UNARY, WHITESPACE, compact, count, key, last, starts, _ref, _ref1, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; + + _ref = require('./rewriter'), Rewriter = _ref.Rewriter, INVERSES = _ref.INVERSES; + + _ref1 = require('./helpers'), count = _ref1.count, starts = _ref1.starts, compact = _ref1.compact, last = _ref1.last; + + exports.Lexer = Lexer = (function() { + + function Lexer() {} + + Lexer.prototype.tokenize = function(code, opts) { + var i, tag; + if (opts == null) { + opts = {}; + } + if (WHITESPACE.test(code)) { + code = "\n" + code; + } + code = code.replace(/\r/g, '').replace(TRAILING_SPACES, ''); + this.code = code; + this.line = opts.line || 0; + this.indent = 0; + this.indebt = 0; + this.outdebt = 0; + this.indents = []; + this.ends = []; + this.tokens = []; + i = 0; + while (this.chunk = code.slice(i)) { + i += this.identifierToken() || this.commentToken() || this.whitespaceToken() || this.lineToken() || this.heredocToken() || this.stringToken() || this.numberToken() || this.regexToken() || this.jsToken() || this.literalToken(); + } + this.closeIndentation(); + if (tag = this.ends.pop()) { + this.error("missing " + tag); + } + if (opts.rewrite === false) { + return this.tokens; + } + return (new Rewriter).rewrite(this.tokens); + }; + + Lexer.prototype.identifierToken = function() { + var colon, forcedIdentifier, id, input, match, prev, tag, _ref2, _ref3; + if (!(match = IDENTIFIER.exec(this.chunk))) { + return 0; + } + input = match[0], id = match[1], colon = match[2]; + if (id === 'own' && this.tag() === 'FOR') { + this.token('OWN', id); + return id.length; + } + forcedIdentifier = colon || (prev = last(this.tokens)) && (((_ref2 = prev[0]) === '.' || _ref2 === '?.' || _ref2 === '::') || !prev.spaced && prev[0] === '@'); + tag = 'IDENTIFIER'; + if (!forcedIdentifier && (__indexOf.call(JS_KEYWORDS, id) >= 0 || __indexOf.call(COFFEE_KEYWORDS, id) >= 0)) { + tag = id.toUpperCase(); + if (tag === 'WHEN' && (_ref3 = this.tag(), __indexOf.call(LINE_BREAK, _ref3) >= 0)) { + tag = 'LEADING_WHEN'; + } else if (tag === 'FOR') { + this.seenFor = true; + } else if (tag === 'UNLESS') { + tag = 'IF'; + } else if (__indexOf.call(UNARY, tag) >= 0) { + tag = 'UNARY'; + } else if (__indexOf.call(RELATION, tag) >= 0) { + if (tag !== 'INSTANCEOF' && this.seenFor) { + tag = 'FOR' + tag; + this.seenFor = false; + } else { + tag = 'RELATION'; + if (this.value() === '!') { + this.tokens.pop(); + id = '!' + id; + } + } + } + } + if (__indexOf.call(JS_FORBIDDEN, id) >= 0) { + if (forcedIdentifier) { + tag = 'IDENTIFIER'; + id = new String(id); + id.reserved = true; + } else if (__indexOf.call(RESERVED, id) >= 0) { + this.error("reserved word \"" + id + "\""); + } + } + if (!forcedIdentifier) { + if (__indexOf.call(COFFEE_ALIASES, id) >= 0) { + id = COFFEE_ALIAS_MAP[id]; + } + tag = (function() { + switch (id) { + case '!': + return 'UNARY'; + case '==': + case '!=': + return 'COMPARE'; + case '&&': + case '||': + return 'LOGIC'; + case 'true': + case 'false': + return 'BOOL'; + case 'break': + case 'continue': + return 'STATEMENT'; + default: + return tag; + } + })(); + } + this.token(tag, id); + if (colon) { + this.token(':', ':'); + } + return input.length; + }; + + Lexer.prototype.numberToken = function() { + var binaryLiteral, lexedLength, match, number, octalLiteral; + if (!(match = NUMBER.exec(this.chunk))) { + return 0; + } + number = match[0]; + if (/^0[BOX]/.test(number)) { + this.error("radix prefix '" + number + "' must be lowercase"); + } else if (/E/.test(number) && !/^0x/.test(number)) { + this.error("exponential notation '" + number + "' must be indicated with a lowercase 'e'"); + } else if (/^0\d*[89]/.test(number)) { + this.error("decimal literal '" + number + "' must not be prefixed with '0'"); + } else if (/^0\d+/.test(number)) { + this.error("octal literal '" + number + "' must be prefixed with '0o'"); + } + lexedLength = number.length; + if (octalLiteral = /^0o([0-7]+)/.exec(number)) { + number = '0x' + (parseInt(octalLiteral[1], 8)).toString(16); + } + if (binaryLiteral = /^0b([01]+)/.exec(number)) { + number = '0x' + (parseInt(binaryLiteral[1], 2)).toString(16); + } + this.token('NUMBER', number); + return lexedLength; + }; + + Lexer.prototype.stringToken = function() { + var match, octalEsc, string; + switch (this.chunk.charAt(0)) { + case "'": + if (!(match = SIMPLESTR.exec(this.chunk))) { + return 0; + } + this.token('STRING', (string = match[0]).replace(MULTILINER, '\\\n')); + break; + case '"': + if (!(string = this.balancedString(this.chunk, '"'))) { + return 0; + } + if (0 < string.indexOf('#{', 1)) { + this.interpolateString(string.slice(1, -1)); + } else { + this.token('STRING', this.escapeLines(string)); + } + break; + default: + return 0; + } + if (octalEsc = /^(?:\\.|[^\\])*\\(?:0[0-7]|[1-7])/.test(string)) { + this.error("octal escape sequences " + string + " are not allowed"); + } + this.line += count(string, '\n'); + return string.length; + }; + + Lexer.prototype.heredocToken = function() { + var doc, heredoc, match, quote; + if (!(match = HEREDOC.exec(this.chunk))) { + return 0; + } + heredoc = match[0]; + quote = heredoc.charAt(0); + doc = this.sanitizeHeredoc(match[2], { + quote: quote, + indent: null + }); + if (quote === '"' && 0 <= doc.indexOf('#{')) { + this.interpolateString(doc, { + heredoc: true + }); + } else { + this.token('STRING', this.makeString(doc, quote, true)); + } + this.line += count(heredoc, '\n'); + return heredoc.length; + }; + + Lexer.prototype.commentToken = function() { + var comment, here, match; + if (!(match = this.chunk.match(COMMENT))) { + return 0; + } + comment = match[0], here = match[1]; + if (here) { + this.token('HERECOMMENT', this.sanitizeHeredoc(here, { + herecomment: true, + indent: Array(this.indent + 1).join(' ') + })); + } + this.line += count(comment, '\n'); + return comment.length; + }; + + Lexer.prototype.jsToken = function() { + var match, script; + if (!(this.chunk.charAt(0) === '`' && (match = JSTOKEN.exec(this.chunk)))) { + return 0; + } + this.token('JS', (script = match[0]).slice(1, -1)); + return script.length; + }; + + Lexer.prototype.regexToken = function() { + var flags, length, match, prev, regex, _ref2, _ref3; + if (this.chunk.charAt(0) !== '/') { + return 0; + } + if (match = HEREGEX.exec(this.chunk)) { + length = this.heregexToken(match); + this.line += count(match[0], '\n'); + return length; + } + prev = last(this.tokens); + if (prev && (_ref2 = prev[0], __indexOf.call((prev.spaced ? NOT_REGEX : NOT_SPACED_REGEX), _ref2) >= 0)) { + return 0; + } + if (!(match = REGEX.exec(this.chunk))) { + return 0; + } + _ref3 = match, match = _ref3[0], regex = _ref3[1], flags = _ref3[2]; + if (regex.slice(0, 2) === '/*') { + this.error('regular expressions cannot begin with `*`'); + } + if (regex === '//') { + regex = '/(?:)/'; + } + this.token('REGEX', "" + regex + flags); + return match.length; + }; + + Lexer.prototype.heregexToken = function(match) { + var body, flags, heregex, re, tag, tokens, value, _i, _len, _ref2, _ref3, _ref4, _ref5; + heregex = match[0], body = match[1], flags = match[2]; + if (0 > body.indexOf('#{')) { + re = body.replace(HEREGEX_OMIT, '').replace(/\//g, '\\/'); + if (re.match(/^\*/)) { + this.error('regular expressions cannot begin with `*`'); + } + this.token('REGEX', "/" + (re || '(?:)') + "/" + flags); + return heregex.length; + } + this.token('IDENTIFIER', 'RegExp'); + this.tokens.push(['CALL_START', '(']); + tokens = []; + _ref2 = this.interpolateString(body, { + regex: true + }); + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + _ref3 = _ref2[_i], tag = _ref3[0], value = _ref3[1]; + if (tag === 'TOKENS') { + tokens.push.apply(tokens, value); + } else { + if (!(value = value.replace(HEREGEX_OMIT, ''))) { + continue; + } + value = value.replace(/\\/g, '\\\\'); + tokens.push(['STRING', this.makeString(value, '"', true)]); + } + tokens.push(['+', '+']); + } + tokens.pop(); + if (((_ref4 = tokens[0]) != null ? _ref4[0] : void 0) !== 'STRING') { + this.tokens.push(['STRING', '""'], ['+', '+']); + } + (_ref5 = this.tokens).push.apply(_ref5, tokens); + if (flags) { + this.tokens.push([',', ','], ['STRING', '"' + flags + '"']); + } + this.token(')', ')'); + return heregex.length; + }; + + Lexer.prototype.lineToken = function() { + var diff, indent, match, noNewlines, prev, size; + if (!(match = MULTI_DENT.exec(this.chunk))) { + return 0; + } + indent = match[0]; + this.line += count(indent, '\n'); + this.seenFor = false; + prev = last(this.tokens, 1); + size = indent.length - 1 - indent.lastIndexOf('\n'); + noNewlines = this.unfinished(); + if (size - this.indebt === this.indent) { + if (noNewlines) { + this.suppressNewlines(); + } else { + this.newlineToken(); + } + return indent.length; + } + if (size > this.indent) { + if (noNewlines) { + this.indebt = size - this.indent; + this.suppressNewlines(); + return indent.length; + } + diff = size - this.indent + this.outdebt; + this.token('INDENT', diff); + this.indents.push(diff); + this.ends.push('OUTDENT'); + this.outdebt = this.indebt = 0; + } else { + this.indebt = 0; + this.outdentToken(this.indent - size, noNewlines); + } + this.indent = size; + return indent.length; + }; + + Lexer.prototype.outdentToken = function(moveOut, noNewlines) { + var dent, len; + while (moveOut > 0) { + len = this.indents.length - 1; + if (this.indents[len] === void 0) { + moveOut = 0; + } else if (this.indents[len] === this.outdebt) { + moveOut -= this.outdebt; + this.outdebt = 0; + } else if (this.indents[len] < this.outdebt) { + this.outdebt -= this.indents[len]; + moveOut -= this.indents[len]; + } else { + dent = this.indents.pop() - this.outdebt; + moveOut -= dent; + this.outdebt = 0; + this.pair('OUTDENT'); + this.token('OUTDENT', dent); + } + } + if (dent) { + this.outdebt -= moveOut; + } + while (this.value() === ';') { + this.tokens.pop(); + } + if (!(this.tag() === 'TERMINATOR' || noNewlines)) { + this.token('TERMINATOR', '\n'); + } + return this; + }; + + Lexer.prototype.whitespaceToken = function() { + var match, nline, prev; + if (!((match = WHITESPACE.exec(this.chunk)) || (nline = this.chunk.charAt(0) === '\n'))) { + return 0; + } + prev = last(this.tokens); + if (prev) { + prev[match ? 'spaced' : 'newLine'] = true; + } + if (match) { + return match[0].length; + } else { + return 0; + } + }; + + Lexer.prototype.newlineToken = function() { + while (this.value() === ';') { + this.tokens.pop(); + } + if (this.tag() !== 'TERMINATOR') { + this.token('TERMINATOR', '\n'); + } + return this; + }; + + Lexer.prototype.suppressNewlines = function() { + if (this.value() === '\\') { + this.tokens.pop(); + } + return this; + }; + + Lexer.prototype.literalToken = function() { + var match, prev, tag, value, _ref2, _ref3, _ref4, _ref5; + if (match = OPERATOR.exec(this.chunk)) { + value = match[0]; + if (CODE.test(value)) { + this.tagParameters(); + } + } else { + value = this.chunk.charAt(0); + } + tag = value; + prev = last(this.tokens); + if (value === '=' && prev) { + if (!prev[1].reserved && (_ref2 = prev[1], __indexOf.call(JS_FORBIDDEN, _ref2) >= 0)) { + this.error("reserved word \"" + (this.value()) + "\" can't be assigned"); + } + if ((_ref3 = prev[1]) === '||' || _ref3 === '&&') { + prev[0] = 'COMPOUND_ASSIGN'; + prev[1] += '='; + return value.length; + } + } + if (value === ';') { + this.seenFor = false; + tag = 'TERMINATOR'; + } else if (__indexOf.call(MATH, value) >= 0) { + tag = 'MATH'; + } else if (__indexOf.call(COMPARE, value) >= 0) { + tag = 'COMPARE'; + } else if (__indexOf.call(COMPOUND_ASSIGN, value) >= 0) { + tag = 'COMPOUND_ASSIGN'; + } else if (__indexOf.call(UNARY, value) >= 0) { + tag = 'UNARY'; + } else if (__indexOf.call(SHIFT, value) >= 0) { + tag = 'SHIFT'; + } else if (__indexOf.call(LOGIC, value) >= 0 || value === '?' && (prev != null ? prev.spaced : void 0)) { + tag = 'LOGIC'; + } else if (prev && !prev.spaced) { + if (value === '(' && (_ref4 = prev[0], __indexOf.call(CALLABLE, _ref4) >= 0)) { + if (prev[0] === '?') { + prev[0] = 'FUNC_EXIST'; + } + tag = 'CALL_START'; + } else if (value === '[' && (_ref5 = prev[0], __indexOf.call(INDEXABLE, _ref5) >= 0)) { + tag = 'INDEX_START'; + switch (prev[0]) { + case '?': + prev[0] = 'INDEX_SOAK'; + } + } + } + switch (value) { + case '(': + case '{': + case '[': + this.ends.push(INVERSES[value]); + break; + case ')': + case '}': + case ']': + this.pair(value); + } + this.token(tag, value); + return value.length; + }; + + Lexer.prototype.sanitizeHeredoc = function(doc, options) { + var attempt, herecomment, indent, match, _ref2; + indent = options.indent, herecomment = options.herecomment; + if (herecomment) { + if (HEREDOC_ILLEGAL.test(doc)) { + this.error("block comment cannot contain \"*/\", starting"); + } + if (doc.indexOf('\n') <= 0) { + return doc; + } + } else { + while (match = HEREDOC_INDENT.exec(doc)) { + attempt = match[1]; + if (indent === null || (0 < (_ref2 = attempt.length) && _ref2 < indent.length)) { + indent = attempt; + } + } + } + if (indent) { + doc = doc.replace(RegExp("\\n" + indent, "g"), '\n'); + } + if (!herecomment) { + doc = doc.replace(/^\n/, ''); + } + return doc; + }; + + Lexer.prototype.tagParameters = function() { + var i, stack, tok, tokens; + if (this.tag() !== ')') { + return this; + } + stack = []; + tokens = this.tokens; + i = tokens.length; + tokens[--i][0] = 'PARAM_END'; + while (tok = tokens[--i]) { + switch (tok[0]) { + case ')': + stack.push(tok); + break; + case '(': + case 'CALL_START': + if (stack.length) { + stack.pop(); + } else if (tok[0] === '(') { + tok[0] = 'PARAM_START'; + return this; + } else { + return this; + } + } + } + return this; + }; + + Lexer.prototype.closeIndentation = function() { + return this.outdentToken(this.indent); + }; + + Lexer.prototype.balancedString = function(str, end) { + var continueCount, i, letter, match, prev, stack, _i, _ref2; + continueCount = 0; + stack = [end]; + for (i = _i = 1, _ref2 = str.length; 1 <= _ref2 ? _i < _ref2 : _i > _ref2; i = 1 <= _ref2 ? ++_i : --_i) { + if (continueCount) { + --continueCount; + continue; + } + switch (letter = str.charAt(i)) { + case '\\': + ++continueCount; + continue; + case end: + stack.pop(); + if (!stack.length) { + return str.slice(0, i + 1 || 9e9); + } + end = stack[stack.length - 1]; + continue; + } + if (end === '}' && (letter === '"' || letter === "'")) { + stack.push(end = letter); + } else if (end === '}' && letter === '/' && (match = HEREGEX.exec(str.slice(i)) || REGEX.exec(str.slice(i)))) { + continueCount += match[0].length - 1; + } else if (end === '}' && letter === '{') { + stack.push(end = '}'); + } else if (end === '"' && prev === '#' && letter === '{') { + stack.push(end = '}'); + } + prev = letter; + } + return this.error("missing " + (stack.pop()) + ", starting"); + }; + + Lexer.prototype.interpolateString = function(str, options) { + var expr, heredoc, i, inner, interpolated, len, letter, nested, pi, regex, tag, tokens, value, _i, _len, _ref2, _ref3, _ref4; + if (options == null) { + options = {}; + } + heredoc = options.heredoc, regex = options.regex; + tokens = []; + pi = 0; + i = -1; + while (letter = str.charAt(i += 1)) { + if (letter === '\\') { + i += 1; + continue; + } + if (!(letter === '#' && str.charAt(i + 1) === '{' && (expr = this.balancedString(str.slice(i + 1), '}')))) { + continue; + } + if (pi < i) { + tokens.push(['NEOSTRING', str.slice(pi, i)]); + } + inner = expr.slice(1, -1); + if (inner.length) { + nested = new Lexer().tokenize(inner, { + line: this.line, + rewrite: false + }); + nested.pop(); + if (((_ref2 = nested[0]) != null ? _ref2[0] : void 0) === 'TERMINATOR') { + nested.shift(); + } + if (len = nested.length) { + if (len > 1) { + nested.unshift(['(', '(', this.line]); + nested.push([')', ')', this.line]); + } + tokens.push(['TOKENS', nested]); + } + } + i += expr.length; + pi = i + 1; + } + if ((i > pi && pi < str.length)) { + tokens.push(['NEOSTRING', str.slice(pi)]); + } + if (regex) { + return tokens; + } + if (!tokens.length) { + return this.token('STRING', '""'); + } + if (tokens[0][0] !== 'NEOSTRING') { + tokens.unshift(['', '']); + } + if (interpolated = tokens.length > 1) { + this.token('(', '('); + } + for (i = _i = 0, _len = tokens.length; _i < _len; i = ++_i) { + _ref3 = tokens[i], tag = _ref3[0], value = _ref3[1]; + if (i) { + this.token('+', '+'); + } + if (tag === 'TOKENS') { + (_ref4 = this.tokens).push.apply(_ref4, value); + } else { + this.token('STRING', this.makeString(value, '"', heredoc)); + } + } + if (interpolated) { + this.token(')', ')'); + } + return tokens; + }; + + Lexer.prototype.pair = function(tag) { + var size, wanted; + if (tag !== (wanted = last(this.ends))) { + if ('OUTDENT' !== wanted) { + this.error("unmatched " + tag); + } + this.indent -= size = last(this.indents); + this.outdentToken(size, true); + return this.pair(tag); + } + return this.ends.pop(); + }; + + Lexer.prototype.token = function(tag, value) { + return this.tokens.push([tag, value, this.line]); + }; + + Lexer.prototype.tag = function(index, tag) { + var tok; + return (tok = last(this.tokens, index)) && (tag ? tok[0] = tag : tok[0]); + }; + + Lexer.prototype.value = function(index, val) { + var tok; + return (tok = last(this.tokens, index)) && (val ? tok[1] = val : tok[1]); + }; + + Lexer.prototype.unfinished = function() { + var _ref2; + return LINE_CONTINUER.test(this.chunk) || ((_ref2 = this.tag()) === '\\' || _ref2 === '.' || _ref2 === '?.' || _ref2 === 'UNARY' || _ref2 === 'MATH' || _ref2 === '+' || _ref2 === '-' || _ref2 === 'SHIFT' || _ref2 === 'RELATION' || _ref2 === 'COMPARE' || _ref2 === 'LOGIC' || _ref2 === 'THROW' || _ref2 === 'EXTENDS'); + }; + + Lexer.prototype.escapeLines = function(str, heredoc) { + return str.replace(MULTILINER, heredoc ? '\\n' : ''); + }; + + Lexer.prototype.makeString = function(body, quote, heredoc) { + if (!body) { + return quote + quote; + } + body = body.replace(/\\([\s\S])/g, function(match, contents) { + if (contents === '\n' || contents === quote) { + return contents; + } else { + return match; + } + }); + body = body.replace(RegExp("" + quote, "g"), '\\$&'); + return quote + this.escapeLines(body, heredoc) + quote; + }; + + Lexer.prototype.error = function(message) { + throw SyntaxError("" + message + " on line " + (this.line + 1)); + }; + + return Lexer; + + })(); + + JS_KEYWORDS = ['true', 'false', 'null', 'this', 'new', 'delete', 'typeof', 'in', 'instanceof', 'return', 'throw', 'break', 'continue', 'debugger', 'if', 'else', 'switch', 'for', 'while', 'do', 'try', 'catch', 'finally', 'class', 'extends', 'super']; + + COFFEE_KEYWORDS = ['undefined', 'then', 'unless', 'until', 'loop', 'of', 'by', 'when']; + + COFFEE_ALIAS_MAP = { + and: '&&', + or: '||', + is: '==', + isnt: '!=', + not: '!', + yes: 'true', + no: 'false', + on: 'true', + off: 'false' + }; + + COFFEE_ALIASES = (function() { + var _results; + _results = []; + for (key in COFFEE_ALIAS_MAP) { + _results.push(key); + } + return _results; + })(); + + COFFEE_KEYWORDS = COFFEE_KEYWORDS.concat(COFFEE_ALIASES); + + RESERVED = ['case', 'default', 'function', 'var', 'void', 'with', 'const', 'let', 'enum', 'export', 'import', 'native', '__hasProp', '__extends', '__slice', '__bind', '__indexOf', 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', 'yield']; + + STRICT_PROSCRIBED = ['arguments', 'eval']; + + JS_FORBIDDEN = JS_KEYWORDS.concat(RESERVED).concat(STRICT_PROSCRIBED); + + exports.RESERVED = RESERVED.concat(JS_KEYWORDS).concat(COFFEE_KEYWORDS).concat(STRICT_PROSCRIBED); + + exports.STRICT_PROSCRIBED = STRICT_PROSCRIBED; + + IDENTIFIER = /^([$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)([^\n\S]*:(?!:))?/; + + NUMBER = /^0b[01]+|^0o[0-7]+|^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i; + + HEREDOC = /^("""|''')([\s\S]*?)(?:\n[^\n\S]*)?\1/; + + OPERATOR = /^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?\.|\.{2,3})/; + + WHITESPACE = /^[^\n\S]+/; + + COMMENT = /^###([^#][\s\S]*?)(?:###[^\n\S]*|(?:###)?$)|^(?:\s*#(?!##[^#]).*)+/; + + CODE = /^[-=]>/; + + MULTI_DENT = /^(?:\n[^\n\S]*)+/; + + SIMPLESTR = /^'[^\\']*(?:\\.[^\\']*)*'/; + + JSTOKEN = /^`[^\\`]*(?:\\.[^\\`]*)*`/; + + REGEX = /^(\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)([imgy]{0,4})(?!\w)/; + + HEREGEX = /^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/; + + HEREGEX_OMIT = /\s+(?:#.*)?/g; + + MULTILINER = /\n/g; + + HEREDOC_INDENT = /\n+([^\n\S]*)/g; + + HEREDOC_ILLEGAL = /\*\//; + + LINE_CONTINUER = /^\s*(?:,|\??\.(?![.\d])|::)/; + + TRAILING_SPACES = /\s+$/; + + COMPOUND_ASSIGN = ['-=', '+=', '/=', '*=', '%=', '||=', '&&=', '?=', '<<=', '>>=', '>>>=', '&=', '^=', '|=']; + + UNARY = ['!', '~', 'NEW', 'TYPEOF', 'DELETE', 'DO']; + + LOGIC = ['&&', '||', '&', '|', '^']; + + SHIFT = ['<<', '>>', '>>>']; + + COMPARE = ['==', '!=', '<', '>', '<=', '>=']; + + MATH = ['*', '/', '%']; + + RELATION = ['IN', 'OF', 'INSTANCEOF']; + + BOOL = ['TRUE', 'FALSE']; + + NOT_REGEX = ['NUMBER', 'REGEX', 'BOOL', 'NULL', 'UNDEFINED', '++', '--', ']']; + + NOT_SPACED_REGEX = NOT_REGEX.concat(')', '}', 'THIS', 'IDENTIFIER', 'STRING'); + + CALLABLE = ['IDENTIFIER', 'STRING', 'REGEX', ')', ']', '}', '?', '::', '@', 'THIS', 'SUPER']; + + INDEXABLE = CALLABLE.concat('NUMBER', 'BOOL', 'NULL', 'UNDEFINED'); + + LINE_BREAK = ['INDENT', 'OUTDENT', 'TERMINATOR']; + +}).call(this); diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/nodes.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/nodes.js new file mode 100644 index 0000000..799b68e --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/nodes.js @@ -0,0 +1,2986 @@ +// Generated by CoffeeScript 1.3.3 +(function() { + var Access, Arr, Assign, Base, Block, Call, Class, Closure, Code, Comment, Existence, Extends, For, IDENTIFIER, IDENTIFIER_STR, IS_STRING, If, In, Index, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, METHOD_DEF, NEGATE, NO, Obj, Op, Param, Parens, RESERVED, Range, Return, SIMPLENUM, STRICT_PROSCRIBED, Scope, Slice, Splat, Switch, TAB, THIS, Throw, Try, UTILITIES, Value, While, YES, compact, del, ends, extend, flatten, last, merge, multident, starts, unfoldSoak, utility, _ref, _ref1, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; + + Scope = require('./scope').Scope; + + _ref = require('./lexer'), RESERVED = _ref.RESERVED, STRICT_PROSCRIBED = _ref.STRICT_PROSCRIBED; + + _ref1 = require('./helpers'), compact = _ref1.compact, flatten = _ref1.flatten, extend = _ref1.extend, merge = _ref1.merge, del = _ref1.del, starts = _ref1.starts, ends = _ref1.ends, last = _ref1.last; + + exports.extend = extend; + + YES = function() { + return true; + }; + + NO = function() { + return false; + }; + + THIS = function() { + return this; + }; + + NEGATE = function() { + this.negated = !this.negated; + return this; + }; + + exports.Base = Base = (function() { + + function Base() {} + + Base.prototype.compile = function(o, lvl) { + var node; + o = extend({}, o); + if (lvl) { + o.level = lvl; + } + node = this.unfoldSoak(o) || this; + node.tab = o.indent; + if (o.level === LEVEL_TOP || !node.isStatement(o)) { + return node.compileNode(o); + } else { + return node.compileClosure(o); + } + }; + + Base.prototype.compileClosure = function(o) { + if (this.jumps()) { + throw SyntaxError('cannot use a pure statement in an expression.'); + } + o.sharedScope = true; + return Closure.wrap(this).compileNode(o); + }; + + Base.prototype.cache = function(o, level, reused) { + var ref, sub; + if (!this.isComplex()) { + ref = level ? this.compile(o, level) : this; + return [ref, ref]; + } else { + ref = new Literal(reused || o.scope.freeVariable('ref')); + sub = new Assign(ref, this); + if (level) { + return [sub.compile(o, level), ref.value]; + } else { + return [sub, ref]; + } + } + }; + + Base.prototype.compileLoopReference = function(o, name) { + var src, tmp; + src = tmp = this.compile(o, LEVEL_LIST); + if (!((-Infinity < +src && +src < Infinity) || IDENTIFIER.test(src) && o.scope.check(src, true))) { + src = "" + (tmp = o.scope.freeVariable(name)) + " = " + src; + } + return [src, tmp]; + }; + + Base.prototype.makeReturn = function(res) { + var me; + me = this.unwrapAll(); + if (res) { + return new Call(new Literal("" + res + ".push"), [me]); + } else { + return new Return(me); + } + }; + + Base.prototype.contains = function(pred) { + var contains; + contains = false; + this.traverseChildren(false, function(node) { + if (pred(node)) { + contains = true; + return false; + } + }); + return contains; + }; + + Base.prototype.containsType = function(type) { + return this instanceof type || this.contains(function(node) { + return node instanceof type; + }); + }; + + Base.prototype.lastNonComment = function(list) { + var i; + i = list.length; + while (i--) { + if (!(list[i] instanceof Comment)) { + return list[i]; + } + } + return null; + }; + + Base.prototype.toString = function(idt, name) { + var tree; + if (idt == null) { + idt = ''; + } + if (name == null) { + name = this.constructor.name; + } + tree = '\n' + idt + name; + if (this.soak) { + tree += '?'; + } + this.eachChild(function(node) { + return tree += node.toString(idt + TAB); + }); + return tree; + }; + + Base.prototype.eachChild = function(func) { + var attr, child, _i, _j, _len, _len1, _ref2, _ref3; + if (!this.children) { + return this; + } + _ref2 = this.children; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + attr = _ref2[_i]; + if (this[attr]) { + _ref3 = flatten([this[attr]]); + for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { + child = _ref3[_j]; + if (func(child) === false) { + return this; + } + } + } + } + return this; + }; + + Base.prototype.traverseChildren = function(crossScope, func) { + return this.eachChild(function(child) { + if (func(child) === false) { + return false; + } + return child.traverseChildren(crossScope, func); + }); + }; + + Base.prototype.invert = function() { + return new Op('!', this); + }; + + Base.prototype.unwrapAll = function() { + var node; + node = this; + while (node !== (node = node.unwrap())) { + continue; + } + return node; + }; + + Base.prototype.children = []; + + Base.prototype.isStatement = NO; + + Base.prototype.jumps = NO; + + Base.prototype.isComplex = YES; + + Base.prototype.isChainable = NO; + + Base.prototype.isAssignable = NO; + + Base.prototype.unwrap = THIS; + + Base.prototype.unfoldSoak = NO; + + Base.prototype.assigns = NO; + + return Base; + + })(); + + exports.Block = Block = (function(_super) { + + __extends(Block, _super); + + function Block(nodes) { + this.expressions = compact(flatten(nodes || [])); + } + + Block.prototype.children = ['expressions']; + + Block.prototype.push = function(node) { + this.expressions.push(node); + return this; + }; + + Block.prototype.pop = function() { + return this.expressions.pop(); + }; + + Block.prototype.unshift = function(node) { + this.expressions.unshift(node); + return this; + }; + + Block.prototype.unwrap = function() { + if (this.expressions.length === 1) { + return this.expressions[0]; + } else { + return this; + } + }; + + Block.prototype.isEmpty = function() { + return !this.expressions.length; + }; + + Block.prototype.isStatement = function(o) { + var exp, _i, _len, _ref2; + _ref2 = this.expressions; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + exp = _ref2[_i]; + if (exp.isStatement(o)) { + return true; + } + } + return false; + }; + + Block.prototype.jumps = function(o) { + var exp, _i, _len, _ref2; + _ref2 = this.expressions; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + exp = _ref2[_i]; + if (exp.jumps(o)) { + return exp; + } + } + }; + + Block.prototype.makeReturn = function(res) { + var expr, len; + len = this.expressions.length; + while (len--) { + expr = this.expressions[len]; + if (!(expr instanceof Comment)) { + this.expressions[len] = expr.makeReturn(res); + if (expr instanceof Return && !expr.expression) { + this.expressions.splice(len, 1); + } + break; + } + } + return this; + }; + + Block.prototype.compile = function(o, level) { + if (o == null) { + o = {}; + } + if (o.scope) { + return Block.__super__.compile.call(this, o, level); + } else { + return this.compileRoot(o); + } + }; + + Block.prototype.compileNode = function(o) { + var code, codes, node, top, _i, _len, _ref2; + this.tab = o.indent; + top = o.level === LEVEL_TOP; + codes = []; + _ref2 = this.expressions; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + node = _ref2[_i]; + node = node.unwrapAll(); + node = node.unfoldSoak(o) || node; + if (node instanceof Block) { + codes.push(node.compileNode(o)); + } else if (top) { + node.front = true; + code = node.compile(o); + if (!node.isStatement(o)) { + code = "" + this.tab + code + ";"; + if (node instanceof Literal) { + code = "" + code + "\n"; + } + } + codes.push(code); + } else { + codes.push(node.compile(o, LEVEL_LIST)); + } + } + if (top) { + if (this.spaced) { + return "\n" + (codes.join('\n\n')) + "\n"; + } else { + return codes.join('\n'); + } + } + code = codes.join(', ') || 'void 0'; + if (codes.length > 1 && o.level >= LEVEL_LIST) { + return "(" + code + ")"; + } else { + return code; + } + }; + + Block.prototype.compileRoot = function(o) { + var code, exp, i, prelude, preludeExps, rest; + o.indent = o.bare ? '' : TAB; + o.scope = new Scope(null, this, null); + o.level = LEVEL_TOP; + this.spaced = true; + prelude = ""; + if (!o.bare) { + preludeExps = (function() { + var _i, _len, _ref2, _results; + _ref2 = this.expressions; + _results = []; + for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) { + exp = _ref2[i]; + if (!(exp.unwrap() instanceof Comment)) { + break; + } + _results.push(exp); + } + return _results; + }).call(this); + rest = this.expressions.slice(preludeExps.length); + this.expressions = preludeExps; + if (preludeExps.length) { + prelude = "" + (this.compileNode(merge(o, { + indent: '' + }))) + "\n"; + } + this.expressions = rest; + } + code = this.compileWithDeclarations(o); + if (o.bare) { + return code; + } + return "" + prelude + "(function() {\n" + code + "\n}).call(this);\n"; + }; + + Block.prototype.compileWithDeclarations = function(o) { + var assigns, code, declars, exp, i, post, rest, scope, spaced, _i, _len, _ref2, _ref3, _ref4; + code = post = ''; + _ref2 = this.expressions; + for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) { + exp = _ref2[i]; + exp = exp.unwrap(); + if (!(exp instanceof Comment || exp instanceof Literal)) { + break; + } + } + o = merge(o, { + level: LEVEL_TOP + }); + if (i) { + rest = this.expressions.splice(i, 9e9); + _ref3 = [this.spaced, false], spaced = _ref3[0], this.spaced = _ref3[1]; + _ref4 = [this.compileNode(o), spaced], code = _ref4[0], this.spaced = _ref4[1]; + this.expressions = rest; + } + post = this.compileNode(o); + scope = o.scope; + if (scope.expressions === this) { + declars = o.scope.hasDeclarations(); + assigns = scope.hasAssignments; + if (declars || assigns) { + if (i) { + code += '\n'; + } + code += "" + this.tab + "var "; + if (declars) { + code += scope.declaredVariables().join(', '); + } + if (assigns) { + if (declars) { + code += ",\n" + (this.tab + TAB); + } + code += scope.assignedVariables().join(",\n" + (this.tab + TAB)); + } + code += ';\n'; + } + } + return code + post; + }; + + Block.wrap = function(nodes) { + if (nodes.length === 1 && nodes[0] instanceof Block) { + return nodes[0]; + } + return new Block(nodes); + }; + + return Block; + + })(Base); + + exports.Literal = Literal = (function(_super) { + + __extends(Literal, _super); + + function Literal(value) { + this.value = value; + } + + Literal.prototype.makeReturn = function() { + if (this.isStatement()) { + return this; + } else { + return Literal.__super__.makeReturn.apply(this, arguments); + } + }; + + Literal.prototype.isAssignable = function() { + return IDENTIFIER.test(this.value); + }; + + Literal.prototype.isStatement = function() { + var _ref2; + return (_ref2 = this.value) === 'break' || _ref2 === 'continue' || _ref2 === 'debugger'; + }; + + Literal.prototype.isComplex = NO; + + Literal.prototype.assigns = function(name) { + return name === this.value; + }; + + Literal.prototype.jumps = function(o) { + if (this.value === 'break' && !((o != null ? o.loop : void 0) || (o != null ? o.block : void 0))) { + return this; + } + if (this.value === 'continue' && !(o != null ? o.loop : void 0)) { + return this; + } + }; + + Literal.prototype.compileNode = function(o) { + var code, _ref2; + code = this.value === 'this' ? ((_ref2 = o.scope.method) != null ? _ref2.bound : void 0) ? o.scope.method.context : this.value : this.value.reserved ? "\"" + this.value + "\"" : this.value; + if (this.isStatement()) { + return "" + this.tab + code + ";"; + } else { + return code; + } + }; + + Literal.prototype.toString = function() { + return ' "' + this.value + '"'; + }; + + return Literal; + + })(Base); + + exports.Undefined = (function(_super) { + + __extends(Undefined, _super); + + function Undefined() { + return Undefined.__super__.constructor.apply(this, arguments); + } + + Undefined.prototype.isAssignable = NO; + + Undefined.prototype.isComplex = NO; + + Undefined.prototype.compileNode = function(o) { + if (o.level >= LEVEL_ACCESS) { + return '(void 0)'; + } else { + return 'void 0'; + } + }; + + return Undefined; + + })(Base); + + exports.Null = (function(_super) { + + __extends(Null, _super); + + function Null() { + return Null.__super__.constructor.apply(this, arguments); + } + + Null.prototype.isAssignable = NO; + + Null.prototype.isComplex = NO; + + Null.prototype.compileNode = function() { + return "null"; + }; + + return Null; + + })(Base); + + exports.Bool = (function(_super) { + + __extends(Bool, _super); + + Bool.prototype.isAssignable = NO; + + Bool.prototype.isComplex = NO; + + Bool.prototype.compileNode = function() { + return this.val; + }; + + function Bool(val) { + this.val = val; + } + + return Bool; + + })(Base); + + exports.Return = Return = (function(_super) { + + __extends(Return, _super); + + function Return(expr) { + if (expr && !expr.unwrap().isUndefined) { + this.expression = expr; + } + } + + Return.prototype.children = ['expression']; + + Return.prototype.isStatement = YES; + + Return.prototype.makeReturn = THIS; + + Return.prototype.jumps = THIS; + + Return.prototype.compile = function(o, level) { + var expr, _ref2; + expr = (_ref2 = this.expression) != null ? _ref2.makeReturn() : void 0; + if (expr && !(expr instanceof Return)) { + return expr.compile(o, level); + } else { + return Return.__super__.compile.call(this, o, level); + } + }; + + Return.prototype.compileNode = function(o) { + return this.tab + ("return" + [this.expression ? " " + (this.expression.compile(o, LEVEL_PAREN)) : void 0] + ";"); + }; + + return Return; + + })(Base); + + exports.Value = Value = (function(_super) { + + __extends(Value, _super); + + function Value(base, props, tag) { + if (!props && base instanceof Value) { + return base; + } + this.base = base; + this.properties = props || []; + if (tag) { + this[tag] = true; + } + return this; + } + + Value.prototype.children = ['base', 'properties']; + + Value.prototype.add = function(props) { + this.properties = this.properties.concat(props); + return this; + }; + + Value.prototype.hasProperties = function() { + return !!this.properties.length; + }; + + Value.prototype.isArray = function() { + return !this.properties.length && this.base instanceof Arr; + }; + + Value.prototype.isComplex = function() { + return this.hasProperties() || this.base.isComplex(); + }; + + Value.prototype.isAssignable = function() { + return this.hasProperties() || this.base.isAssignable(); + }; + + Value.prototype.isSimpleNumber = function() { + return this.base instanceof Literal && SIMPLENUM.test(this.base.value); + }; + + Value.prototype.isString = function() { + return this.base instanceof Literal && IS_STRING.test(this.base.value); + }; + + Value.prototype.isAtomic = function() { + var node, _i, _len, _ref2; + _ref2 = this.properties.concat(this.base); + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + node = _ref2[_i]; + if (node.soak || node instanceof Call) { + return false; + } + } + return true; + }; + + Value.prototype.isStatement = function(o) { + return !this.properties.length && this.base.isStatement(o); + }; + + Value.prototype.assigns = function(name) { + return !this.properties.length && this.base.assigns(name); + }; + + Value.prototype.jumps = function(o) { + return !this.properties.length && this.base.jumps(o); + }; + + Value.prototype.isObject = function(onlyGenerated) { + if (this.properties.length) { + return false; + } + return (this.base instanceof Obj) && (!onlyGenerated || this.base.generated); + }; + + Value.prototype.isSplice = function() { + return last(this.properties) instanceof Slice; + }; + + Value.prototype.unwrap = function() { + if (this.properties.length) { + return this; + } else { + return this.base; + } + }; + + Value.prototype.cacheReference = function(o) { + var base, bref, name, nref; + name = last(this.properties); + if (this.properties.length < 2 && !this.base.isComplex() && !(name != null ? name.isComplex() : void 0)) { + return [this, this]; + } + base = new Value(this.base, this.properties.slice(0, -1)); + if (base.isComplex()) { + bref = new Literal(o.scope.freeVariable('base')); + base = new Value(new Parens(new Assign(bref, base))); + } + if (!name) { + return [base, bref]; + } + if (name.isComplex()) { + nref = new Literal(o.scope.freeVariable('name')); + name = new Index(new Assign(nref, name.index)); + nref = new Index(nref); + } + return [base.add(name), new Value(bref || base.base, [nref || name])]; + }; + + Value.prototype.compileNode = function(o) { + var code, prop, props, _i, _len; + this.base.front = this.front; + props = this.properties; + code = this.base.compile(o, props.length ? LEVEL_ACCESS : null); + if ((this.base instanceof Parens || props.length) && SIMPLENUM.test(code)) { + code = "" + code + "."; + } + for (_i = 0, _len = props.length; _i < _len; _i++) { + prop = props[_i]; + code += prop.compile(o); + } + return code; + }; + + Value.prototype.unfoldSoak = function(o) { + var result, + _this = this; + if (this.unfoldedSoak != null) { + return this.unfoldedSoak; + } + result = (function() { + var fst, i, ifn, prop, ref, snd, _i, _len, _ref2; + if (ifn = _this.base.unfoldSoak(o)) { + Array.prototype.push.apply(ifn.body.properties, _this.properties); + return ifn; + } + _ref2 = _this.properties; + for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) { + prop = _ref2[i]; + if (!prop.soak) { + continue; + } + prop.soak = false; + fst = new Value(_this.base, _this.properties.slice(0, i)); + snd = new Value(_this.base, _this.properties.slice(i)); + if (fst.isComplex()) { + ref = new Literal(o.scope.freeVariable('ref')); + fst = new Parens(new Assign(ref, fst)); + snd.base = ref; + } + return new If(new Existence(fst), snd, { + soak: true + }); + } + return null; + })(); + return this.unfoldedSoak = result || false; + }; + + return Value; + + })(Base); + + exports.Comment = Comment = (function(_super) { + + __extends(Comment, _super); + + function Comment(comment) { + this.comment = comment; + } + + Comment.prototype.isStatement = YES; + + Comment.prototype.makeReturn = THIS; + + Comment.prototype.compileNode = function(o, level) { + var code; + code = '/*' + multident(this.comment, this.tab) + ("\n" + this.tab + "*/\n"); + if ((level || o.level) === LEVEL_TOP) { + code = o.indent + code; + } + return code; + }; + + return Comment; + + })(Base); + + exports.Call = Call = (function(_super) { + + __extends(Call, _super); + + function Call(variable, args, soak) { + this.args = args != null ? args : []; + this.soak = soak; + this.isNew = false; + this.isSuper = variable === 'super'; + this.variable = this.isSuper ? null : variable; + } + + Call.prototype.children = ['variable', 'args']; + + Call.prototype.newInstance = function() { + var base, _ref2; + base = ((_ref2 = this.variable) != null ? _ref2.base : void 0) || this.variable; + if (base instanceof Call && !base.isNew) { + base.newInstance(); + } else { + this.isNew = true; + } + return this; + }; + + Call.prototype.superReference = function(o) { + var accesses, method, name; + method = o.scope.namedMethod(); + if (!method) { + throw SyntaxError('cannot call super outside of a function.'); + } + name = method.name; + if (name == null) { + throw SyntaxError('cannot call super on an anonymous function.'); + } + if (method.klass) { + accesses = [new Access(new Literal('__super__'))]; + if (method["static"]) { + accesses.push(new Access(new Literal('constructor'))); + } + accesses.push(new Access(new Literal(name))); + return (new Value(new Literal(method.klass), accesses)).compile(o); + } else { + return "" + name + ".__super__.constructor"; + } + }; + + Call.prototype.superThis = function(o) { + var method; + method = o.scope.method; + return (method && !method.klass && method.context) || "this"; + }; + + Call.prototype.unfoldSoak = function(o) { + var call, ifn, left, list, rite, _i, _len, _ref2, _ref3; + if (this.soak) { + if (this.variable) { + if (ifn = unfoldSoak(o, this, 'variable')) { + return ifn; + } + _ref2 = new Value(this.variable).cacheReference(o), left = _ref2[0], rite = _ref2[1]; + } else { + left = new Literal(this.superReference(o)); + rite = new Value(left); + } + rite = new Call(rite, this.args); + rite.isNew = this.isNew; + left = new Literal("typeof " + (left.compile(o)) + " === \"function\""); + return new If(left, new Value(rite), { + soak: true + }); + } + call = this; + list = []; + while (true) { + if (call.variable instanceof Call) { + list.push(call); + call = call.variable; + continue; + } + if (!(call.variable instanceof Value)) { + break; + } + list.push(call); + if (!((call = call.variable.base) instanceof Call)) { + break; + } + } + _ref3 = list.reverse(); + for (_i = 0, _len = _ref3.length; _i < _len; _i++) { + call = _ref3[_i]; + if (ifn) { + if (call.variable instanceof Call) { + call.variable = ifn; + } else { + call.variable.base = ifn; + } + } + ifn = unfoldSoak(o, call, 'variable'); + } + return ifn; + }; + + Call.prototype.filterImplicitObjects = function(list) { + var node, nodes, obj, prop, properties, _i, _j, _len, _len1, _ref2; + nodes = []; + for (_i = 0, _len = list.length; _i < _len; _i++) { + node = list[_i]; + if (!((typeof node.isObject === "function" ? node.isObject() : void 0) && node.base.generated)) { + nodes.push(node); + continue; + } + obj = null; + _ref2 = node.base.properties; + for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { + prop = _ref2[_j]; + if (prop instanceof Assign || prop instanceof Comment) { + if (!obj) { + nodes.push(obj = new Obj(properties = [], true)); + } + properties.push(prop); + } else { + nodes.push(prop); + obj = null; + } + } + } + return nodes; + }; + + Call.prototype.compileNode = function(o) { + var arg, args, code, _ref2; + if ((_ref2 = this.variable) != null) { + _ref2.front = this.front; + } + if (code = Splat.compileSplattedArray(o, this.args, true)) { + return this.compileSplat(o, code); + } + args = this.filterImplicitObjects(this.args); + args = ((function() { + var _i, _len, _results; + _results = []; + for (_i = 0, _len = args.length; _i < _len; _i++) { + arg = args[_i]; + _results.push(arg.compile(o, LEVEL_LIST)); + } + return _results; + })()).join(', '); + if (this.isSuper) { + return this.superReference(o) + (".call(" + (this.superThis(o)) + (args && ', ' + args) + ")"); + } else { + return (this.isNew ? 'new ' : '') + this.variable.compile(o, LEVEL_ACCESS) + ("(" + args + ")"); + } + }; + + Call.prototype.compileSuper = function(args, o) { + return "" + (this.superReference(o)) + ".call(" + (this.superThis(o)) + (args.length ? ', ' : '') + args + ")"; + }; + + Call.prototype.compileSplat = function(o, splatArgs) { + var base, fun, idt, name, ref; + if (this.isSuper) { + return "" + (this.superReference(o)) + ".apply(" + (this.superThis(o)) + ", " + splatArgs + ")"; + } + if (this.isNew) { + idt = this.tab + TAB; + return "(function(func, args, ctor) {\n" + idt + "ctor.prototype = func.prototype;\n" + idt + "var child = new ctor, result = func.apply(child, args), t = typeof result;\n" + idt + "return t == \"object\" || t == \"function\" ? result || child : child;\n" + this.tab + "})(" + (this.variable.compile(o, LEVEL_LIST)) + ", " + splatArgs + ", function(){})"; + } + base = new Value(this.variable); + if ((name = base.properties.pop()) && base.isComplex()) { + ref = o.scope.freeVariable('ref'); + fun = "(" + ref + " = " + (base.compile(o, LEVEL_LIST)) + ")" + (name.compile(o)); + } else { + fun = base.compile(o, LEVEL_ACCESS); + if (SIMPLENUM.test(fun)) { + fun = "(" + fun + ")"; + } + if (name) { + ref = fun; + fun += name.compile(o); + } else { + ref = 'null'; + } + } + return "" + fun + ".apply(" + ref + ", " + splatArgs + ")"; + }; + + return Call; + + })(Base); + + exports.Extends = Extends = (function(_super) { + + __extends(Extends, _super); + + function Extends(child, parent) { + this.child = child; + this.parent = parent; + } + + Extends.prototype.children = ['child', 'parent']; + + Extends.prototype.compile = function(o) { + return new Call(new Value(new Literal(utility('extends'))), [this.child, this.parent]).compile(o); + }; + + return Extends; + + })(Base); + + exports.Access = Access = (function(_super) { + + __extends(Access, _super); + + function Access(name, tag) { + this.name = name; + this.name.asKey = true; + this.soak = tag === 'soak'; + } + + Access.prototype.children = ['name']; + + Access.prototype.compile = function(o) { + var name; + name = this.name.compile(o); + if (IDENTIFIER.test(name)) { + return "." + name; + } else { + return "[" + name + "]"; + } + }; + + Access.prototype.isComplex = NO; + + return Access; + + })(Base); + + exports.Index = Index = (function(_super) { + + __extends(Index, _super); + + function Index(index) { + this.index = index; + } + + Index.prototype.children = ['index']; + + Index.prototype.compile = function(o) { + return "[" + (this.index.compile(o, LEVEL_PAREN)) + "]"; + }; + + Index.prototype.isComplex = function() { + return this.index.isComplex(); + }; + + return Index; + + })(Base); + + exports.Range = Range = (function(_super) { + + __extends(Range, _super); + + Range.prototype.children = ['from', 'to']; + + function Range(from, to, tag) { + this.from = from; + this.to = to; + this.exclusive = tag === 'exclusive'; + this.equals = this.exclusive ? '' : '='; + } + + Range.prototype.compileVariables = function(o) { + var step, _ref2, _ref3, _ref4, _ref5; + o = merge(o, { + top: true + }); + _ref2 = this.from.cache(o, LEVEL_LIST), this.fromC = _ref2[0], this.fromVar = _ref2[1]; + _ref3 = this.to.cache(o, LEVEL_LIST), this.toC = _ref3[0], this.toVar = _ref3[1]; + if (step = del(o, 'step')) { + _ref4 = step.cache(o, LEVEL_LIST), this.step = _ref4[0], this.stepVar = _ref4[1]; + } + _ref5 = [this.fromVar.match(SIMPLENUM), this.toVar.match(SIMPLENUM)], this.fromNum = _ref5[0], this.toNum = _ref5[1]; + if (this.stepVar) { + return this.stepNum = this.stepVar.match(SIMPLENUM); + } + }; + + Range.prototype.compileNode = function(o) { + var cond, condPart, from, gt, idx, idxName, known, lt, namedIndex, stepPart, to, varPart, _ref2, _ref3; + if (!this.fromVar) { + this.compileVariables(o); + } + if (!o.index) { + return this.compileArray(o); + } + known = this.fromNum && this.toNum; + idx = del(o, 'index'); + idxName = del(o, 'name'); + namedIndex = idxName && idxName !== idx; + varPart = "" + idx + " = " + this.fromC; + if (this.toC !== this.toVar) { + varPart += ", " + this.toC; + } + if (this.step !== this.stepVar) { + varPart += ", " + this.step; + } + _ref2 = ["" + idx + " <" + this.equals, "" + idx + " >" + this.equals], lt = _ref2[0], gt = _ref2[1]; + condPart = this.stepNum ? +this.stepNum > 0 ? "" + lt + " " + this.toVar : "" + gt + " " + this.toVar : known ? ((_ref3 = [+this.fromNum, +this.toNum], from = _ref3[0], to = _ref3[1], _ref3), from <= to ? "" + lt + " " + to : "" + gt + " " + to) : (cond = "" + this.fromVar + " <= " + this.toVar, "" + cond + " ? " + lt + " " + this.toVar + " : " + gt + " " + this.toVar); + stepPart = this.stepVar ? "" + idx + " += " + this.stepVar : known ? namedIndex ? from <= to ? "++" + idx : "--" + idx : from <= to ? "" + idx + "++" : "" + idx + "--" : namedIndex ? "" + cond + " ? ++" + idx + " : --" + idx : "" + cond + " ? " + idx + "++ : " + idx + "--"; + if (namedIndex) { + varPart = "" + idxName + " = " + varPart; + } + if (namedIndex) { + stepPart = "" + idxName + " = " + stepPart; + } + return "" + varPart + "; " + condPart + "; " + stepPart; + }; + + Range.prototype.compileArray = function(o) { + var args, body, cond, hasArgs, i, idt, post, pre, range, result, vars, _i, _ref2, _ref3, _results; + if (this.fromNum && this.toNum && Math.abs(this.fromNum - this.toNum) <= 20) { + range = (function() { + _results = []; + for (var _i = _ref2 = +this.fromNum, _ref3 = +this.toNum; _ref2 <= _ref3 ? _i <= _ref3 : _i >= _ref3; _ref2 <= _ref3 ? _i++ : _i--){ _results.push(_i); } + return _results; + }).apply(this); + if (this.exclusive) { + range.pop(); + } + return "[" + (range.join(', ')) + "]"; + } + idt = this.tab + TAB; + i = o.scope.freeVariable('i'); + result = o.scope.freeVariable('results'); + pre = "\n" + idt + result + " = [];"; + if (this.fromNum && this.toNum) { + o.index = i; + body = this.compileNode(o); + } else { + vars = ("" + i + " = " + this.fromC) + (this.toC !== this.toVar ? ", " + this.toC : ''); + cond = "" + this.fromVar + " <= " + this.toVar; + body = "var " + vars + "; " + cond + " ? " + i + " <" + this.equals + " " + this.toVar + " : " + i + " >" + this.equals + " " + this.toVar + "; " + cond + " ? " + i + "++ : " + i + "--"; + } + post = "{ " + result + ".push(" + i + "); }\n" + idt + "return " + result + ";\n" + o.indent; + hasArgs = function(node) { + return node != null ? node.contains(function(n) { + return n instanceof Literal && n.value === 'arguments' && !n.asKey; + }) : void 0; + }; + if (hasArgs(this.from) || hasArgs(this.to)) { + args = ', arguments'; + } + return "(function() {" + pre + "\n" + idt + "for (" + body + ")" + post + "}).apply(this" + (args != null ? args : '') + ")"; + }; + + return Range; + + })(Base); + + exports.Slice = Slice = (function(_super) { + + __extends(Slice, _super); + + Slice.prototype.children = ['range']; + + function Slice(range) { + this.range = range; + Slice.__super__.constructor.call(this); + } + + Slice.prototype.compileNode = function(o) { + var compiled, from, fromStr, to, toStr, _ref2; + _ref2 = this.range, to = _ref2.to, from = _ref2.from; + fromStr = from && from.compile(o, LEVEL_PAREN) || '0'; + compiled = to && to.compile(o, LEVEL_PAREN); + if (to && !(!this.range.exclusive && +compiled === -1)) { + toStr = ', ' + (this.range.exclusive ? compiled : SIMPLENUM.test(compiled) ? "" + (+compiled + 1) : (compiled = to.compile(o, LEVEL_ACCESS), "" + compiled + " + 1 || 9e9")); + } + return ".slice(" + fromStr + (toStr || '') + ")"; + }; + + return Slice; + + })(Base); + + exports.Obj = Obj = (function(_super) { + + __extends(Obj, _super); + + function Obj(props, generated) { + this.generated = generated != null ? generated : false; + this.objects = this.properties = props || []; + } + + Obj.prototype.children = ['properties']; + + Obj.prototype.compileNode = function(o) { + var i, idt, indent, join, lastNoncom, node, obj, prop, propName, propNames, props, _i, _j, _len, _len1, _ref2; + props = this.properties; + propNames = []; + _ref2 = this.properties; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + prop = _ref2[_i]; + if (prop.isComplex()) { + prop = prop.variable; + } + if (prop != null) { + propName = prop.unwrapAll().value.toString(); + if (__indexOf.call(propNames, propName) >= 0) { + throw SyntaxError("multiple object literal properties named \"" + propName + "\""); + } + propNames.push(propName); + } + } + if (!props.length) { + return (this.front ? '({})' : '{}'); + } + if (this.generated) { + for (_j = 0, _len1 = props.length; _j < _len1; _j++) { + node = props[_j]; + if (node instanceof Value) { + throw new Error('cannot have an implicit value in an implicit object'); + } + } + } + idt = o.indent += TAB; + lastNoncom = this.lastNonComment(this.properties); + props = (function() { + var _k, _len2, _results; + _results = []; + for (i = _k = 0, _len2 = props.length; _k < _len2; i = ++_k) { + prop = props[i]; + join = i === props.length - 1 ? '' : prop === lastNoncom || prop instanceof Comment ? '\n' : ',\n'; + indent = prop instanceof Comment ? '' : idt; + if (prop instanceof Value && prop["this"]) { + prop = new Assign(prop.properties[0].name, prop, 'object'); + } + if (!(prop instanceof Comment)) { + if (!(prop instanceof Assign)) { + prop = new Assign(prop, prop, 'object'); + } + (prop.variable.base || prop.variable).asKey = true; + } + _results.push(indent + prop.compile(o, LEVEL_TOP) + join); + } + return _results; + })(); + props = props.join(''); + obj = "{" + (props && '\n' + props + '\n' + this.tab) + "}"; + if (this.front) { + return "(" + obj + ")"; + } else { + return obj; + } + }; + + Obj.prototype.assigns = function(name) { + var prop, _i, _len, _ref2; + _ref2 = this.properties; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + prop = _ref2[_i]; + if (prop.assigns(name)) { + return true; + } + } + return false; + }; + + return Obj; + + })(Base); + + exports.Arr = Arr = (function(_super) { + + __extends(Arr, _super); + + function Arr(objs) { + this.objects = objs || []; + } + + Arr.prototype.children = ['objects']; + + Arr.prototype.filterImplicitObjects = Call.prototype.filterImplicitObjects; + + Arr.prototype.compileNode = function(o) { + var code, obj, objs; + if (!this.objects.length) { + return '[]'; + } + o.indent += TAB; + objs = this.filterImplicitObjects(this.objects); + if (code = Splat.compileSplattedArray(o, objs)) { + return code; + } + code = ((function() { + var _i, _len, _results; + _results = []; + for (_i = 0, _len = objs.length; _i < _len; _i++) { + obj = objs[_i]; + _results.push(obj.compile(o, LEVEL_LIST)); + } + return _results; + })()).join(', '); + if (code.indexOf('\n') >= 0) { + return "[\n" + o.indent + code + "\n" + this.tab + "]"; + } else { + return "[" + code + "]"; + } + }; + + Arr.prototype.assigns = function(name) { + var obj, _i, _len, _ref2; + _ref2 = this.objects; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + obj = _ref2[_i]; + if (obj.assigns(name)) { + return true; + } + } + return false; + }; + + return Arr; + + })(Base); + + exports.Class = Class = (function(_super) { + + __extends(Class, _super); + + function Class(variable, parent, body) { + this.variable = variable; + this.parent = parent; + this.body = body != null ? body : new Block; + this.boundFuncs = []; + this.body.classBody = true; + } + + Class.prototype.children = ['variable', 'parent', 'body']; + + Class.prototype.determineName = function() { + var decl, tail; + if (!this.variable) { + return null; + } + decl = (tail = last(this.variable.properties)) ? tail instanceof Access && tail.name.value : this.variable.base.value; + if (__indexOf.call(STRICT_PROSCRIBED, decl) >= 0) { + throw SyntaxError("variable name may not be " + decl); + } + return decl && (decl = IDENTIFIER.test(decl) && decl); + }; + + Class.prototype.setContext = function(name) { + return this.body.traverseChildren(false, function(node) { + if (node.classBody) { + return false; + } + if (node instanceof Literal && node.value === 'this') { + return node.value = name; + } else if (node instanceof Code) { + node.klass = name; + if (node.bound) { + return node.context = name; + } + } + }); + }; + + Class.prototype.addBoundFunctions = function(o) { + var bvar, lhs, _i, _len, _ref2, _results; + if (this.boundFuncs.length) { + _ref2 = this.boundFuncs; + _results = []; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + bvar = _ref2[_i]; + lhs = (new Value(new Literal("this"), [new Access(bvar)])).compile(o); + _results.push(this.ctor.body.unshift(new Literal("" + lhs + " = " + (utility('bind')) + "(" + lhs + ", this)"))); + } + return _results; + } + }; + + Class.prototype.addProperties = function(node, name, o) { + var assign, base, exprs, func, props; + props = node.base.properties.slice(0); + exprs = (function() { + var _results; + _results = []; + while (assign = props.shift()) { + if (assign instanceof Assign) { + base = assign.variable.base; + delete assign.context; + func = assign.value; + if (base.value === 'constructor') { + if (this.ctor) { + throw new Error('cannot define more than one constructor in a class'); + } + if (func.bound) { + throw new Error('cannot define a constructor as a bound function'); + } + if (func instanceof Code) { + assign = this.ctor = func; + } else { + this.externalCtor = o.scope.freeVariable('class'); + assign = new Assign(new Literal(this.externalCtor), func); + } + } else { + if (assign.variable["this"]) { + func["static"] = true; + if (func.bound) { + func.context = name; + } + } else { + assign.variable = new Value(new Literal(name), [new Access(new Literal('prototype')), new Access(base)]); + if (func instanceof Code && func.bound) { + this.boundFuncs.push(base); + func.bound = false; + } + } + } + } + _results.push(assign); + } + return _results; + }).call(this); + return compact(exprs); + }; + + Class.prototype.walkBody = function(name, o) { + var _this = this; + return this.traverseChildren(false, function(child) { + var exps, i, node, _i, _len, _ref2; + if (child instanceof Class) { + return false; + } + if (child instanceof Block) { + _ref2 = exps = child.expressions; + for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) { + node = _ref2[i]; + if (node instanceof Value && node.isObject(true)) { + exps[i] = _this.addProperties(node, name, o); + } + } + return child.expressions = exps = flatten(exps); + } + }); + }; + + Class.prototype.hoistDirectivePrologue = function() { + var expressions, index, node; + index = 0; + expressions = this.body.expressions; + while ((node = expressions[index]) && node instanceof Comment || node instanceof Value && node.isString()) { + ++index; + } + return this.directives = expressions.splice(0, index); + }; + + Class.prototype.ensureConstructor = function(name) { + if (!this.ctor) { + this.ctor = new Code; + if (this.parent) { + this.ctor.body.push(new Literal("" + name + ".__super__.constructor.apply(this, arguments)")); + } + if (this.externalCtor) { + this.ctor.body.push(new Literal("" + this.externalCtor + ".apply(this, arguments)")); + } + this.ctor.body.makeReturn(); + this.body.expressions.unshift(this.ctor); + } + this.ctor.ctor = this.ctor.name = name; + this.ctor.klass = null; + return this.ctor.noReturn = true; + }; + + Class.prototype.compileNode = function(o) { + var call, decl, klass, lname, name, params, _ref2; + decl = this.determineName(); + name = decl || '_Class'; + if (name.reserved) { + name = "_" + name; + } + lname = new Literal(name); + this.hoistDirectivePrologue(); + this.setContext(name); + this.walkBody(name, o); + this.ensureConstructor(name); + this.body.spaced = true; + if (!(this.ctor instanceof Code)) { + this.body.expressions.unshift(this.ctor); + } + this.body.expressions.push(lname); + (_ref2 = this.body.expressions).unshift.apply(_ref2, this.directives); + this.addBoundFunctions(o); + call = Closure.wrap(this.body); + if (this.parent) { + this.superClass = new Literal(o.scope.freeVariable('super', false)); + this.body.expressions.unshift(new Extends(lname, this.superClass)); + call.args.push(this.parent); + params = call.variable.params || call.variable.base.params; + params.push(new Param(this.superClass)); + } + klass = new Parens(call, true); + if (this.variable) { + klass = new Assign(this.variable, klass); + } + return klass.compile(o); + }; + + return Class; + + })(Base); + + exports.Assign = Assign = (function(_super) { + + __extends(Assign, _super); + + function Assign(variable, value, context, options) { + var forbidden, name, _ref2; + this.variable = variable; + this.value = value; + this.context = context; + this.param = options && options.param; + this.subpattern = options && options.subpattern; + forbidden = (_ref2 = (name = this.variable.unwrapAll().value), __indexOf.call(STRICT_PROSCRIBED, _ref2) >= 0); + if (forbidden && this.context !== 'object') { + throw SyntaxError("variable name may not be \"" + name + "\""); + } + } + + Assign.prototype.children = ['variable', 'value']; + + Assign.prototype.isStatement = function(o) { + return (o != null ? o.level : void 0) === LEVEL_TOP && (this.context != null) && __indexOf.call(this.context, "?") >= 0; + }; + + Assign.prototype.assigns = function(name) { + return this[this.context === 'object' ? 'value' : 'variable'].assigns(name); + }; + + Assign.prototype.unfoldSoak = function(o) { + return unfoldSoak(o, this, 'variable'); + }; + + Assign.prototype.compileNode = function(o) { + var isValue, match, name, val, varBase, _ref2, _ref3, _ref4, _ref5; + if (isValue = this.variable instanceof Value) { + if (this.variable.isArray() || this.variable.isObject()) { + return this.compilePatternMatch(o); + } + if (this.variable.isSplice()) { + return this.compileSplice(o); + } + if ((_ref2 = this.context) === '||=' || _ref2 === '&&=' || _ref2 === '?=') { + return this.compileConditional(o); + } + } + name = this.variable.compile(o, LEVEL_LIST); + if (!this.context) { + if (!(varBase = this.variable.unwrapAll()).isAssignable()) { + throw SyntaxError("\"" + (this.variable.compile(o)) + "\" cannot be assigned."); + } + if (!(typeof varBase.hasProperties === "function" ? varBase.hasProperties() : void 0)) { + if (this.param) { + o.scope.add(name, 'var'); + } else { + o.scope.find(name); + } + } + } + if (this.value instanceof Code && (match = METHOD_DEF.exec(name))) { + if (match[1]) { + this.value.klass = match[1]; + } + this.value.name = (_ref3 = (_ref4 = (_ref5 = match[2]) != null ? _ref5 : match[3]) != null ? _ref4 : match[4]) != null ? _ref3 : match[5]; + } + val = this.value.compile(o, LEVEL_LIST); + if (this.context === 'object') { + return "" + name + ": " + val; + } + val = name + (" " + (this.context || '=') + " ") + val; + if (o.level <= LEVEL_LIST) { + return val; + } else { + return "(" + val + ")"; + } + }; + + Assign.prototype.compilePatternMatch = function(o) { + var acc, assigns, code, i, idx, isObject, ivar, name, obj, objects, olen, ref, rest, splat, top, val, value, vvar, _i, _len, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8; + top = o.level === LEVEL_TOP; + value = this.value; + objects = this.variable.base.objects; + if (!(olen = objects.length)) { + code = value.compile(o); + if (o.level >= LEVEL_OP) { + return "(" + code + ")"; + } else { + return code; + } + } + isObject = this.variable.isObject(); + if (top && olen === 1 && !((obj = objects[0]) instanceof Splat)) { + if (obj instanceof Assign) { + _ref2 = obj, (_ref3 = _ref2.variable, idx = _ref3.base), obj = _ref2.value; + } else { + if (obj.base instanceof Parens) { + _ref4 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref4[0], idx = _ref4[1]; + } else { + idx = isObject ? obj["this"] ? obj.properties[0].name : obj : new Literal(0); + } + } + acc = IDENTIFIER.test(idx.unwrap().value || 0); + value = new Value(value); + value.properties.push(new (acc ? Access : Index)(idx)); + if (_ref5 = obj.unwrap().value, __indexOf.call(RESERVED, _ref5) >= 0) { + throw new SyntaxError("assignment to a reserved word: " + (obj.compile(o)) + " = " + (value.compile(o))); + } + return new Assign(obj, value, null, { + param: this.param + }).compile(o, LEVEL_TOP); + } + vvar = value.compile(o, LEVEL_LIST); + assigns = []; + splat = false; + if (!IDENTIFIER.test(vvar) || this.variable.assigns(vvar)) { + assigns.push("" + (ref = o.scope.freeVariable('ref')) + " = " + vvar); + vvar = ref; + } + for (i = _i = 0, _len = objects.length; _i < _len; i = ++_i) { + obj = objects[i]; + idx = i; + if (isObject) { + if (obj instanceof Assign) { + _ref6 = obj, (_ref7 = _ref6.variable, idx = _ref7.base), obj = _ref6.value; + } else { + if (obj.base instanceof Parens) { + _ref8 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref8[0], idx = _ref8[1]; + } else { + idx = obj["this"] ? obj.properties[0].name : obj; + } + } + } + if (!splat && obj instanceof Splat) { + name = obj.name.unwrap().value; + obj = obj.unwrap(); + val = "" + olen + " <= " + vvar + ".length ? " + (utility('slice')) + ".call(" + vvar + ", " + i; + if (rest = olen - i - 1) { + ivar = o.scope.freeVariable('i'); + val += ", " + ivar + " = " + vvar + ".length - " + rest + ") : (" + ivar + " = " + i + ", [])"; + } else { + val += ") : []"; + } + val = new Literal(val); + splat = "" + ivar + "++"; + } else { + name = obj.unwrap().value; + if (obj instanceof Splat) { + obj = obj.name.compile(o); + throw new SyntaxError("multiple splats are disallowed in an assignment: " + obj + "..."); + } + if (typeof idx === 'number') { + idx = new Literal(splat || idx); + acc = false; + } else { + acc = isObject && IDENTIFIER.test(idx.unwrap().value || 0); + } + val = new Value(new Literal(vvar), [new (acc ? Access : Index)(idx)]); + } + if ((name != null) && __indexOf.call(RESERVED, name) >= 0) { + throw new SyntaxError("assignment to a reserved word: " + (obj.compile(o)) + " = " + (val.compile(o))); + } + assigns.push(new Assign(obj, val, null, { + param: this.param, + subpattern: true + }).compile(o, LEVEL_LIST)); + } + if (!(top || this.subpattern)) { + assigns.push(vvar); + } + code = assigns.join(', '); + if (o.level < LEVEL_LIST) { + return code; + } else { + return "(" + code + ")"; + } + }; + + Assign.prototype.compileConditional = function(o) { + var left, right, _ref2; + _ref2 = this.variable.cacheReference(o), left = _ref2[0], right = _ref2[1]; + if (!left.properties.length && left.base instanceof Literal && left.base.value !== "this" && !o.scope.check(left.base.value)) { + throw new Error("the variable \"" + left.base.value + "\" can't be assigned with " + this.context + " because it has not been defined."); + } + if (__indexOf.call(this.context, "?") >= 0) { + o.isExistentialEquals = true; + } + return new Op(this.context.slice(0, -1), left, new Assign(right, this.value, '=')).compile(o); + }; + + Assign.prototype.compileSplice = function(o) { + var code, exclusive, from, fromDecl, fromRef, name, to, valDef, valRef, _ref2, _ref3, _ref4; + _ref2 = this.variable.properties.pop().range, from = _ref2.from, to = _ref2.to, exclusive = _ref2.exclusive; + name = this.variable.compile(o); + _ref3 = (from != null ? from.cache(o, LEVEL_OP) : void 0) || ['0', '0'], fromDecl = _ref3[0], fromRef = _ref3[1]; + if (to) { + if ((from != null ? from.isSimpleNumber() : void 0) && to.isSimpleNumber()) { + to = +to.compile(o) - +fromRef; + if (!exclusive) { + to += 1; + } + } else { + to = to.compile(o, LEVEL_ACCESS) + ' - ' + fromRef; + if (!exclusive) { + to += ' + 1'; + } + } + } else { + to = "9e9"; + } + _ref4 = this.value.cache(o, LEVEL_LIST), valDef = _ref4[0], valRef = _ref4[1]; + code = "[].splice.apply(" + name + ", [" + fromDecl + ", " + to + "].concat(" + valDef + ")), " + valRef; + if (o.level > LEVEL_TOP) { + return "(" + code + ")"; + } else { + return code; + } + }; + + return Assign; + + })(Base); + + exports.Code = Code = (function(_super) { + + __extends(Code, _super); + + function Code(params, body, tag) { + this.params = params || []; + this.body = body || new Block; + this.bound = tag === 'boundfunc'; + if (this.bound) { + this.context = '_this'; + } + } + + Code.prototype.children = ['params', 'body']; + + Code.prototype.isStatement = function() { + return !!this.ctor; + }; + + Code.prototype.jumps = NO; + + Code.prototype.compileNode = function(o) { + var code, exprs, i, idt, lit, name, p, param, params, ref, splats, uniqs, val, wasEmpty, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8; + o.scope = new Scope(o.scope, this.body, this); + o.scope.shared = del(o, 'sharedScope'); + o.indent += TAB; + delete o.bare; + delete o.isExistentialEquals; + params = []; + exprs = []; + _ref2 = this.paramNames(); + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + name = _ref2[_i]; + if (!o.scope.check(name)) { + o.scope.parameter(name); + } + } + _ref3 = this.params; + for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { + param = _ref3[_j]; + if (!param.splat) { + continue; + } + _ref4 = this.params; + for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) { + p = _ref4[_k].name; + if (p["this"]) { + p = p.properties[0].name; + } + if (p.value) { + o.scope.add(p.value, 'var', true); + } + } + splats = new Assign(new Value(new Arr((function() { + var _l, _len3, _ref5, _results; + _ref5 = this.params; + _results = []; + for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) { + p = _ref5[_l]; + _results.push(p.asReference(o)); + } + return _results; + }).call(this))), new Value(new Literal('arguments'))); + break; + } + _ref5 = this.params; + for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) { + param = _ref5[_l]; + if (param.isComplex()) { + val = ref = param.asReference(o); + if (param.value) { + val = new Op('?', ref, param.value); + } + exprs.push(new Assign(new Value(param.name), val, '=', { + param: true + })); + } else { + ref = param; + if (param.value) { + lit = new Literal(ref.name.value + ' == null'); + val = new Assign(new Value(param.name), param.value, '='); + exprs.push(new If(lit, val)); + } + } + if (!splats) { + params.push(ref); + } + } + wasEmpty = this.body.isEmpty(); + if (splats) { + exprs.unshift(splats); + } + if (exprs.length) { + (_ref6 = this.body.expressions).unshift.apply(_ref6, exprs); + } + for (i = _m = 0, _len4 = params.length; _m < _len4; i = ++_m) { + p = params[i]; + o.scope.parameter(params[i] = p.compile(o)); + } + uniqs = []; + _ref7 = this.paramNames(); + for (_n = 0, _len5 = _ref7.length; _n < _len5; _n++) { + name = _ref7[_n]; + if (__indexOf.call(uniqs, name) >= 0) { + throw SyntaxError("multiple parameters named '" + name + "'"); + } + uniqs.push(name); + } + if (!(wasEmpty || this.noReturn)) { + this.body.makeReturn(); + } + if (this.bound) { + if ((_ref8 = o.scope.parent.method) != null ? _ref8.bound : void 0) { + this.bound = this.context = o.scope.parent.method.context; + } else if (!this["static"]) { + o.scope.parent.assign('_this', 'this'); + } + } + idt = o.indent; + code = 'function'; + if (this.ctor) { + code += ' ' + this.name; + } + code += '(' + params.join(', ') + ') {'; + if (!this.body.isEmpty()) { + code += "\n" + (this.body.compileWithDeclarations(o)) + "\n" + this.tab; + } + code += '}'; + if (this.ctor) { + return this.tab + code; + } + if (this.front || (o.level >= LEVEL_ACCESS)) { + return "(" + code + ")"; + } else { + return code; + } + }; + + Code.prototype.paramNames = function() { + var names, param, _i, _len, _ref2; + names = []; + _ref2 = this.params; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + param = _ref2[_i]; + names.push.apply(names, param.names()); + } + return names; + }; + + Code.prototype.traverseChildren = function(crossScope, func) { + if (crossScope) { + return Code.__super__.traverseChildren.call(this, crossScope, func); + } + }; + + return Code; + + })(Base); + + exports.Param = Param = (function(_super) { + + __extends(Param, _super); + + function Param(name, value, splat) { + var _ref2; + this.name = name; + this.value = value; + this.splat = splat; + if (_ref2 = (name = this.name.unwrapAll().value), __indexOf.call(STRICT_PROSCRIBED, _ref2) >= 0) { + throw SyntaxError("parameter name \"" + name + "\" is not allowed"); + } + } + + Param.prototype.children = ['name', 'value']; + + Param.prototype.compile = function(o) { + return this.name.compile(o, LEVEL_LIST); + }; + + Param.prototype.asReference = function(o) { + var node; + if (this.reference) { + return this.reference; + } + node = this.name; + if (node["this"]) { + node = node.properties[0].name; + if (node.value.reserved) { + node = new Literal(o.scope.freeVariable(node.value)); + } + } else if (node.isComplex()) { + node = new Literal(o.scope.freeVariable('arg')); + } + node = new Value(node); + if (this.splat) { + node = new Splat(node); + } + return this.reference = node; + }; + + Param.prototype.isComplex = function() { + return this.name.isComplex(); + }; + + Param.prototype.names = function(name) { + var atParam, names, obj, _i, _len, _ref2; + if (name == null) { + name = this.name; + } + atParam = function(obj) { + var value; + value = obj.properties[0].name.value; + if (value.reserved) { + return []; + } else { + return [value]; + } + }; + if (name instanceof Literal) { + return [name.value]; + } + if (name instanceof Value) { + return atParam(name); + } + names = []; + _ref2 = name.objects; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + obj = _ref2[_i]; + if (obj instanceof Assign) { + names.push(obj.value.unwrap().value); + } else if (obj instanceof Splat) { + names.push(obj.name.unwrap().value); + } else if (obj instanceof Value) { + if (obj.isArray() || obj.isObject()) { + names.push.apply(names, this.names(obj.base)); + } else if (obj["this"]) { + names.push.apply(names, atParam(obj)); + } else { + names.push(obj.base.value); + } + } else { + throw SyntaxError("illegal parameter " + (obj.compile())); + } + } + return names; + }; + + return Param; + + })(Base); + + exports.Splat = Splat = (function(_super) { + + __extends(Splat, _super); + + Splat.prototype.children = ['name']; + + Splat.prototype.isAssignable = YES; + + function Splat(name) { + this.name = name.compile ? name : new Literal(name); + } + + Splat.prototype.assigns = function(name) { + return this.name.assigns(name); + }; + + Splat.prototype.compile = function(o) { + if (this.index != null) { + return this.compileParam(o); + } else { + return this.name.compile(o); + } + }; + + Splat.prototype.unwrap = function() { + return this.name; + }; + + Splat.compileSplattedArray = function(o, list, apply) { + var args, base, code, i, index, node, _i, _len; + index = -1; + while ((node = list[++index]) && !(node instanceof Splat)) { + continue; + } + if (index >= list.length) { + return ''; + } + if (list.length === 1) { + code = list[0].compile(o, LEVEL_LIST); + if (apply) { + return code; + } + return "" + (utility('slice')) + ".call(" + code + ")"; + } + args = list.slice(index); + for (i = _i = 0, _len = args.length; _i < _len; i = ++_i) { + node = args[i]; + code = node.compile(o, LEVEL_LIST); + args[i] = node instanceof Splat ? "" + (utility('slice')) + ".call(" + code + ")" : "[" + code + "]"; + } + if (index === 0) { + return args[0] + (".concat(" + (args.slice(1).join(', ')) + ")"); + } + base = (function() { + var _j, _len1, _ref2, _results; + _ref2 = list.slice(0, index); + _results = []; + for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { + node = _ref2[_j]; + _results.push(node.compile(o, LEVEL_LIST)); + } + return _results; + })(); + return "[" + (base.join(', ')) + "].concat(" + (args.join(', ')) + ")"; + }; + + return Splat; + + })(Base); + + exports.While = While = (function(_super) { + + __extends(While, _super); + + function While(condition, options) { + this.condition = (options != null ? options.invert : void 0) ? condition.invert() : condition; + this.guard = options != null ? options.guard : void 0; + } + + While.prototype.children = ['condition', 'guard', 'body']; + + While.prototype.isStatement = YES; + + While.prototype.makeReturn = function(res) { + if (res) { + return While.__super__.makeReturn.apply(this, arguments); + } else { + this.returns = !this.jumps({ + loop: true + }); + return this; + } + }; + + While.prototype.addBody = function(body) { + this.body = body; + return this; + }; + + While.prototype.jumps = function() { + var expressions, node, _i, _len; + expressions = this.body.expressions; + if (!expressions.length) { + return false; + } + for (_i = 0, _len = expressions.length; _i < _len; _i++) { + node = expressions[_i]; + if (node.jumps({ + loop: true + })) { + return node; + } + } + return false; + }; + + While.prototype.compileNode = function(o) { + var body, code, rvar, set; + o.indent += TAB; + set = ''; + body = this.body; + if (body.isEmpty()) { + body = ''; + } else { + if (this.returns) { + body.makeReturn(rvar = o.scope.freeVariable('results')); + set = "" + this.tab + rvar + " = [];\n"; + } + if (this.guard) { + if (body.expressions.length > 1) { + body.expressions.unshift(new If((new Parens(this.guard)).invert(), new Literal("continue"))); + } else { + if (this.guard) { + body = Block.wrap([new If(this.guard, body)]); + } + } + } + body = "\n" + (body.compile(o, LEVEL_TOP)) + "\n" + this.tab; + } + code = set + this.tab + ("while (" + (this.condition.compile(o, LEVEL_PAREN)) + ") {" + body + "}"); + if (this.returns) { + code += "\n" + this.tab + "return " + rvar + ";"; + } + return code; + }; + + return While; + + })(Base); + + exports.Op = Op = (function(_super) { + var CONVERSIONS, INVERSIONS; + + __extends(Op, _super); + + function Op(op, first, second, flip) { + if (op === 'in') { + return new In(first, second); + } + if (op === 'do') { + return this.generateDo(first); + } + if (op === 'new') { + if (first instanceof Call && !first["do"] && !first.isNew) { + return first.newInstance(); + } + if (first instanceof Code && first.bound || first["do"]) { + first = new Parens(first); + } + } + this.operator = CONVERSIONS[op] || op; + this.first = first; + this.second = second; + this.flip = !!flip; + return this; + } + + CONVERSIONS = { + '==': '===', + '!=': '!==', + 'of': 'in' + }; + + INVERSIONS = { + '!==': '===', + '===': '!==' + }; + + Op.prototype.children = ['first', 'second']; + + Op.prototype.isSimpleNumber = NO; + + Op.prototype.isUnary = function() { + return !this.second; + }; + + Op.prototype.isComplex = function() { + var _ref2; + return !(this.isUnary() && ((_ref2 = this.operator) === '+' || _ref2 === '-')) || this.first.isComplex(); + }; + + Op.prototype.isChainable = function() { + var _ref2; + return (_ref2 = this.operator) === '<' || _ref2 === '>' || _ref2 === '>=' || _ref2 === '<=' || _ref2 === '===' || _ref2 === '!=='; + }; + + Op.prototype.invert = function() { + var allInvertable, curr, fst, op, _ref2; + if (this.isChainable() && this.first.isChainable()) { + allInvertable = true; + curr = this; + while (curr && curr.operator) { + allInvertable && (allInvertable = curr.operator in INVERSIONS); + curr = curr.first; + } + if (!allInvertable) { + return new Parens(this).invert(); + } + curr = this; + while (curr && curr.operator) { + curr.invert = !curr.invert; + curr.operator = INVERSIONS[curr.operator]; + curr = curr.first; + } + return this; + } else if (op = INVERSIONS[this.operator]) { + this.operator = op; + if (this.first.unwrap() instanceof Op) { + this.first.invert(); + } + return this; + } else if (this.second) { + return new Parens(this).invert(); + } else if (this.operator === '!' && (fst = this.first.unwrap()) instanceof Op && ((_ref2 = fst.operator) === '!' || _ref2 === 'in' || _ref2 === 'instanceof')) { + return fst; + } else { + return new Op('!', this); + } + }; + + Op.prototype.unfoldSoak = function(o) { + var _ref2; + return ((_ref2 = this.operator) === '++' || _ref2 === '--' || _ref2 === 'delete') && unfoldSoak(o, this, 'first'); + }; + + Op.prototype.generateDo = function(exp) { + var call, func, param, passedParams, ref, _i, _len, _ref2; + passedParams = []; + func = exp instanceof Assign && (ref = exp.value.unwrap()) instanceof Code ? ref : exp; + _ref2 = func.params || []; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + param = _ref2[_i]; + if (param.value) { + passedParams.push(param.value); + delete param.value; + } else { + passedParams.push(param); + } + } + call = new Call(exp, passedParams); + call["do"] = true; + return call; + }; + + Op.prototype.compileNode = function(o) { + var code, isChain, _ref2, _ref3; + isChain = this.isChainable() && this.first.isChainable(); + if (!isChain) { + this.first.front = this.front; + } + if (this.operator === 'delete' && o.scope.check(this.first.unwrapAll().value)) { + throw SyntaxError('delete operand may not be argument or var'); + } + if (((_ref2 = this.operator) === '--' || _ref2 === '++') && (_ref3 = this.first.unwrapAll().value, __indexOf.call(STRICT_PROSCRIBED, _ref3) >= 0)) { + throw SyntaxError('prefix increment/decrement may not have eval or arguments operand'); + } + if (this.isUnary()) { + return this.compileUnary(o); + } + if (isChain) { + return this.compileChain(o); + } + if (this.operator === '?') { + return this.compileExistence(o); + } + code = this.first.compile(o, LEVEL_OP) + ' ' + this.operator + ' ' + this.second.compile(o, LEVEL_OP); + if (o.level <= LEVEL_OP) { + return code; + } else { + return "(" + code + ")"; + } + }; + + Op.prototype.compileChain = function(o) { + var code, fst, shared, _ref2; + _ref2 = this.first.second.cache(o), this.first.second = _ref2[0], shared = _ref2[1]; + fst = this.first.compile(o, LEVEL_OP); + code = "" + fst + " " + (this.invert ? '&&' : '||') + " " + (shared.compile(o)) + " " + this.operator + " " + (this.second.compile(o, LEVEL_OP)); + return "(" + code + ")"; + }; + + Op.prototype.compileExistence = function(o) { + var fst, ref; + if (this.first.isComplex()) { + ref = new Literal(o.scope.freeVariable('ref')); + fst = new Parens(new Assign(ref, this.first)); + } else { + fst = this.first; + ref = fst; + } + return new If(new Existence(fst), ref, { + type: 'if' + }).addElse(this.second).compile(o); + }; + + Op.prototype.compileUnary = function(o) { + var op, parts, plusMinus; + if (o.level >= LEVEL_ACCESS) { + return (new Parens(this)).compile(o); + } + parts = [op = this.operator]; + plusMinus = op === '+' || op === '-'; + if ((op === 'new' || op === 'typeof' || op === 'delete') || plusMinus && this.first instanceof Op && this.first.operator === op) { + parts.push(' '); + } + if ((plusMinus && this.first instanceof Op) || (op === 'new' && this.first.isStatement(o))) { + this.first = new Parens(this.first); + } + parts.push(this.first.compile(o, LEVEL_OP)); + if (this.flip) { + parts.reverse(); + } + return parts.join(''); + }; + + Op.prototype.toString = function(idt) { + return Op.__super__.toString.call(this, idt, this.constructor.name + ' ' + this.operator); + }; + + return Op; + + })(Base); + + exports.In = In = (function(_super) { + + __extends(In, _super); + + function In(object, array) { + this.object = object; + this.array = array; + } + + In.prototype.children = ['object', 'array']; + + In.prototype.invert = NEGATE; + + In.prototype.compileNode = function(o) { + var hasSplat, obj, _i, _len, _ref2; + if (this.array instanceof Value && this.array.isArray()) { + _ref2 = this.array.base.objects; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + obj = _ref2[_i]; + if (!(obj instanceof Splat)) { + continue; + } + hasSplat = true; + break; + } + if (!hasSplat) { + return this.compileOrTest(o); + } + } + return this.compileLoopTest(o); + }; + + In.prototype.compileOrTest = function(o) { + var cmp, cnj, i, item, ref, sub, tests, _ref2, _ref3; + if (this.array.base.objects.length === 0) { + return "" + (!!this.negated); + } + _ref2 = this.object.cache(o, LEVEL_OP), sub = _ref2[0], ref = _ref2[1]; + _ref3 = this.negated ? [' !== ', ' && '] : [' === ', ' || '], cmp = _ref3[0], cnj = _ref3[1]; + tests = (function() { + var _i, _len, _ref4, _results; + _ref4 = this.array.base.objects; + _results = []; + for (i = _i = 0, _len = _ref4.length; _i < _len; i = ++_i) { + item = _ref4[i]; + _results.push((i ? ref : sub) + cmp + item.compile(o, LEVEL_ACCESS)); + } + return _results; + }).call(this); + tests = tests.join(cnj); + if (o.level < LEVEL_OP) { + return tests; + } else { + return "(" + tests + ")"; + } + }; + + In.prototype.compileLoopTest = function(o) { + var code, ref, sub, _ref2; + _ref2 = this.object.cache(o, LEVEL_LIST), sub = _ref2[0], ref = _ref2[1]; + code = utility('indexOf') + (".call(" + (this.array.compile(o, LEVEL_LIST)) + ", " + ref + ") ") + (this.negated ? '< 0' : '>= 0'); + if (sub === ref) { + return code; + } + code = sub + ', ' + code; + if (o.level < LEVEL_LIST) { + return code; + } else { + return "(" + code + ")"; + } + }; + + In.prototype.toString = function(idt) { + return In.__super__.toString.call(this, idt, this.constructor.name + (this.negated ? '!' : '')); + }; + + return In; + + })(Base); + + exports.Try = Try = (function(_super) { + + __extends(Try, _super); + + function Try(attempt, error, recovery, ensure) { + this.attempt = attempt; + this.error = error; + this.recovery = recovery; + this.ensure = ensure; + } + + Try.prototype.children = ['attempt', 'recovery', 'ensure']; + + Try.prototype.isStatement = YES; + + Try.prototype.jumps = function(o) { + var _ref2; + return this.attempt.jumps(o) || ((_ref2 = this.recovery) != null ? _ref2.jumps(o) : void 0); + }; + + Try.prototype.makeReturn = function(res) { + if (this.attempt) { + this.attempt = this.attempt.makeReturn(res); + } + if (this.recovery) { + this.recovery = this.recovery.makeReturn(res); + } + return this; + }; + + Try.prototype.compileNode = function(o) { + var catchPart, ensurePart, errorPart, tryPart; + o.indent += TAB; + errorPart = this.error ? " (" + (this.error.compile(o)) + ") " : ' '; + tryPart = this.attempt.compile(o, LEVEL_TOP); + catchPart = (function() { + var _ref2; + if (this.recovery) { + if (_ref2 = this.error.value, __indexOf.call(STRICT_PROSCRIBED, _ref2) >= 0) { + throw SyntaxError("catch variable may not be \"" + this.error.value + "\""); + } + if (!o.scope.check(this.error.value)) { + o.scope.add(this.error.value, 'param'); + } + return " catch" + errorPart + "{\n" + (this.recovery.compile(o, LEVEL_TOP)) + "\n" + this.tab + "}"; + } else if (!(this.ensure || this.recovery)) { + return ' catch (_error) {}'; + } + }).call(this); + ensurePart = this.ensure ? " finally {\n" + (this.ensure.compile(o, LEVEL_TOP)) + "\n" + this.tab + "}" : ''; + return "" + this.tab + "try {\n" + tryPart + "\n" + this.tab + "}" + (catchPart || '') + ensurePart; + }; + + return Try; + + })(Base); + + exports.Throw = Throw = (function(_super) { + + __extends(Throw, _super); + + function Throw(expression) { + this.expression = expression; + } + + Throw.prototype.children = ['expression']; + + Throw.prototype.isStatement = YES; + + Throw.prototype.jumps = NO; + + Throw.prototype.makeReturn = THIS; + + Throw.prototype.compileNode = function(o) { + return this.tab + ("throw " + (this.expression.compile(o)) + ";"); + }; + + return Throw; + + })(Base); + + exports.Existence = Existence = (function(_super) { + + __extends(Existence, _super); + + function Existence(expression) { + this.expression = expression; + } + + Existence.prototype.children = ['expression']; + + Existence.prototype.invert = NEGATE; + + Existence.prototype.compileNode = function(o) { + var cmp, cnj, code, _ref2; + this.expression.front = this.front; + code = this.expression.compile(o, LEVEL_OP); + if (IDENTIFIER.test(code) && !o.scope.check(code)) { + _ref2 = this.negated ? ['===', '||'] : ['!==', '&&'], cmp = _ref2[0], cnj = _ref2[1]; + code = "typeof " + code + " " + cmp + " \"undefined\" " + cnj + " " + code + " " + cmp + " null"; + } else { + code = "" + code + " " + (this.negated ? '==' : '!=') + " null"; + } + if (o.level <= LEVEL_COND) { + return code; + } else { + return "(" + code + ")"; + } + }; + + return Existence; + + })(Base); + + exports.Parens = Parens = (function(_super) { + + __extends(Parens, _super); + + function Parens(body) { + this.body = body; + } + + Parens.prototype.children = ['body']; + + Parens.prototype.unwrap = function() { + return this.body; + }; + + Parens.prototype.isComplex = function() { + return this.body.isComplex(); + }; + + Parens.prototype.compileNode = function(o) { + var bare, code, expr; + expr = this.body.unwrap(); + if (expr instanceof Value && expr.isAtomic()) { + expr.front = this.front; + return expr.compile(o); + } + code = expr.compile(o, LEVEL_PAREN); + bare = o.level < LEVEL_OP && (expr instanceof Op || expr instanceof Call || (expr instanceof For && expr.returns)); + if (bare) { + return code; + } else { + return "(" + code + ")"; + } + }; + + return Parens; + + })(Base); + + exports.For = For = (function(_super) { + + __extends(For, _super); + + function For(body, source) { + var _ref2; + this.source = source.source, this.guard = source.guard, this.step = source.step, this.name = source.name, this.index = source.index; + this.body = Block.wrap([body]); + this.own = !!source.own; + this.object = !!source.object; + if (this.object) { + _ref2 = [this.index, this.name], this.name = _ref2[0], this.index = _ref2[1]; + } + if (this.index instanceof Value) { + throw SyntaxError('index cannot be a pattern matching expression'); + } + this.range = this.source instanceof Value && this.source.base instanceof Range && !this.source.properties.length; + this.pattern = this.name instanceof Value; + if (this.range && this.index) { + throw SyntaxError('indexes do not apply to range loops'); + } + if (this.range && this.pattern) { + throw SyntaxError('cannot pattern match over range loops'); + } + this.returns = false; + } + + For.prototype.children = ['body', 'source', 'guard', 'step']; + + For.prototype.compileNode = function(o) { + var body, defPart, forPart, forVarPart, guardPart, idt1, index, ivar, kvar, kvarAssign, lastJumps, lvar, name, namePart, ref, resultPart, returnResult, rvar, scope, source, stepPart, stepvar, svar, varPart, _ref2; + body = Block.wrap([this.body]); + lastJumps = (_ref2 = last(body.expressions)) != null ? _ref2.jumps() : void 0; + if (lastJumps && lastJumps instanceof Return) { + this.returns = false; + } + source = this.range ? this.source.base : this.source; + scope = o.scope; + name = this.name && this.name.compile(o, LEVEL_LIST); + index = this.index && this.index.compile(o, LEVEL_LIST); + if (name && !this.pattern) { + scope.find(name); + } + if (index) { + scope.find(index); + } + if (this.returns) { + rvar = scope.freeVariable('results'); + } + ivar = (this.object && index) || scope.freeVariable('i'); + kvar = (this.range && name) || index || ivar; + kvarAssign = kvar !== ivar ? "" + kvar + " = " : ""; + if (this.step && !this.range) { + stepvar = scope.freeVariable("step"); + } + if (this.pattern) { + name = ivar; + } + varPart = ''; + guardPart = ''; + defPart = ''; + idt1 = this.tab + TAB; + if (this.range) { + forPart = source.compile(merge(o, { + index: ivar, + name: name, + step: this.step + })); + } else { + svar = this.source.compile(o, LEVEL_LIST); + if ((name || this.own) && !IDENTIFIER.test(svar)) { + defPart = "" + this.tab + (ref = scope.freeVariable('ref')) + " = " + svar + ";\n"; + svar = ref; + } + if (name && !this.pattern) { + namePart = "" + name + " = " + svar + "[" + kvar + "]"; + } + if (!this.object) { + lvar = scope.freeVariable('len'); + forVarPart = "" + kvarAssign + ivar + " = 0, " + lvar + " = " + svar + ".length"; + if (this.step) { + forVarPart += ", " + stepvar + " = " + (this.step.compile(o, LEVEL_OP)); + } + stepPart = "" + kvarAssign + (this.step ? "" + ivar + " += " + stepvar : (kvar !== ivar ? "++" + ivar : "" + ivar + "++")); + forPart = "" + forVarPart + "; " + ivar + " < " + lvar + "; " + stepPart; + } + } + if (this.returns) { + resultPart = "" + this.tab + rvar + " = [];\n"; + returnResult = "\n" + this.tab + "return " + rvar + ";"; + body.makeReturn(rvar); + } + if (this.guard) { + if (body.expressions.length > 1) { + body.expressions.unshift(new If((new Parens(this.guard)).invert(), new Literal("continue"))); + } else { + if (this.guard) { + body = Block.wrap([new If(this.guard, body)]); + } + } + } + if (this.pattern) { + body.expressions.unshift(new Assign(this.name, new Literal("" + svar + "[" + kvar + "]"))); + } + defPart += this.pluckDirectCall(o, body); + if (namePart) { + varPart = "\n" + idt1 + namePart + ";"; + } + if (this.object) { + forPart = "" + kvar + " in " + svar; + if (this.own) { + guardPart = "\n" + idt1 + "if (!" + (utility('hasProp')) + ".call(" + svar + ", " + kvar + ")) continue;"; + } + } + body = body.compile(merge(o, { + indent: idt1 + }), LEVEL_TOP); + if (body) { + body = '\n' + body + '\n'; + } + return "" + defPart + (resultPart || '') + this.tab + "for (" + forPart + ") {" + guardPart + varPart + body + this.tab + "}" + (returnResult || ''); + }; + + For.prototype.pluckDirectCall = function(o, body) { + var base, defs, expr, fn, idx, ref, val, _i, _len, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7; + defs = ''; + _ref2 = body.expressions; + for (idx = _i = 0, _len = _ref2.length; _i < _len; idx = ++_i) { + expr = _ref2[idx]; + expr = expr.unwrapAll(); + if (!(expr instanceof Call)) { + continue; + } + val = expr.variable.unwrapAll(); + if (!((val instanceof Code) || (val instanceof Value && ((_ref3 = val.base) != null ? _ref3.unwrapAll() : void 0) instanceof Code && val.properties.length === 1 && ((_ref4 = (_ref5 = val.properties[0].name) != null ? _ref5.value : void 0) === 'call' || _ref4 === 'apply')))) { + continue; + } + fn = ((_ref6 = val.base) != null ? _ref6.unwrapAll() : void 0) || val; + ref = new Literal(o.scope.freeVariable('fn')); + base = new Value(ref); + if (val.base) { + _ref7 = [base, val], val.base = _ref7[0], base = _ref7[1]; + } + body.expressions[idx] = new Call(base, expr.args); + defs += this.tab + new Assign(ref, fn).compile(o, LEVEL_TOP) + ';\n'; + } + return defs; + }; + + return For; + + })(While); + + exports.Switch = Switch = (function(_super) { + + __extends(Switch, _super); + + function Switch(subject, cases, otherwise) { + this.subject = subject; + this.cases = cases; + this.otherwise = otherwise; + } + + Switch.prototype.children = ['subject', 'cases', 'otherwise']; + + Switch.prototype.isStatement = YES; + + Switch.prototype.jumps = function(o) { + var block, conds, _i, _len, _ref2, _ref3, _ref4; + if (o == null) { + o = { + block: true + }; + } + _ref2 = this.cases; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + _ref3 = _ref2[_i], conds = _ref3[0], block = _ref3[1]; + if (block.jumps(o)) { + return block; + } + } + return (_ref4 = this.otherwise) != null ? _ref4.jumps(o) : void 0; + }; + + Switch.prototype.makeReturn = function(res) { + var pair, _i, _len, _ref2, _ref3; + _ref2 = this.cases; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + pair = _ref2[_i]; + pair[1].makeReturn(res); + } + if (res) { + this.otherwise || (this.otherwise = new Block([new Literal('void 0')])); + } + if ((_ref3 = this.otherwise) != null) { + _ref3.makeReturn(res); + } + return this; + }; + + Switch.prototype.compileNode = function(o) { + var block, body, code, cond, conditions, expr, i, idt1, idt2, _i, _j, _len, _len1, _ref2, _ref3, _ref4, _ref5; + idt1 = o.indent + TAB; + idt2 = o.indent = idt1 + TAB; + code = this.tab + ("switch (" + (((_ref2 = this.subject) != null ? _ref2.compile(o, LEVEL_PAREN) : void 0) || false) + ") {\n"); + _ref3 = this.cases; + for (i = _i = 0, _len = _ref3.length; _i < _len; i = ++_i) { + _ref4 = _ref3[i], conditions = _ref4[0], block = _ref4[1]; + _ref5 = flatten([conditions]); + for (_j = 0, _len1 = _ref5.length; _j < _len1; _j++) { + cond = _ref5[_j]; + if (!this.subject) { + cond = cond.invert(); + } + code += idt1 + ("case " + (cond.compile(o, LEVEL_PAREN)) + ":\n"); + } + if (body = block.compile(o, LEVEL_TOP)) { + code += body + '\n'; + } + if (i === this.cases.length - 1 && !this.otherwise) { + break; + } + expr = this.lastNonComment(block.expressions); + if (expr instanceof Return || (expr instanceof Literal && expr.jumps() && expr.value !== 'debugger')) { + continue; + } + code += idt2 + 'break;\n'; + } + if (this.otherwise && this.otherwise.expressions.length) { + code += idt1 + ("default:\n" + (this.otherwise.compile(o, LEVEL_TOP)) + "\n"); + } + return code + this.tab + '}'; + }; + + return Switch; + + })(Base); + + exports.If = If = (function(_super) { + + __extends(If, _super); + + function If(condition, body, options) { + this.body = body; + if (options == null) { + options = {}; + } + this.condition = options.type === 'unless' ? condition.invert() : condition; + this.elseBody = null; + this.isChain = false; + this.soak = options.soak; + } + + If.prototype.children = ['condition', 'body', 'elseBody']; + + If.prototype.bodyNode = function() { + var _ref2; + return (_ref2 = this.body) != null ? _ref2.unwrap() : void 0; + }; + + If.prototype.elseBodyNode = function() { + var _ref2; + return (_ref2 = this.elseBody) != null ? _ref2.unwrap() : void 0; + }; + + If.prototype.addElse = function(elseBody) { + if (this.isChain) { + this.elseBodyNode().addElse(elseBody); + } else { + this.isChain = elseBody instanceof If; + this.elseBody = this.ensureBlock(elseBody); + } + return this; + }; + + If.prototype.isStatement = function(o) { + var _ref2; + return (o != null ? o.level : void 0) === LEVEL_TOP || this.bodyNode().isStatement(o) || ((_ref2 = this.elseBodyNode()) != null ? _ref2.isStatement(o) : void 0); + }; + + If.prototype.jumps = function(o) { + var _ref2; + return this.body.jumps(o) || ((_ref2 = this.elseBody) != null ? _ref2.jumps(o) : void 0); + }; + + If.prototype.compileNode = function(o) { + if (this.isStatement(o)) { + return this.compileStatement(o); + } else { + return this.compileExpression(o); + } + }; + + If.prototype.makeReturn = function(res) { + if (res) { + this.elseBody || (this.elseBody = new Block([new Literal('void 0')])); + } + this.body && (this.body = new Block([this.body.makeReturn(res)])); + this.elseBody && (this.elseBody = new Block([this.elseBody.makeReturn(res)])); + return this; + }; + + If.prototype.ensureBlock = function(node) { + if (node instanceof Block) { + return node; + } else { + return new Block([node]); + } + }; + + If.prototype.compileStatement = function(o) { + var body, child, cond, exeq, ifPart; + child = del(o, 'chainChild'); + exeq = del(o, 'isExistentialEquals'); + if (exeq) { + return new If(this.condition.invert(), this.elseBodyNode(), { + type: 'if' + }).compile(o); + } + cond = this.condition.compile(o, LEVEL_PAREN); + o.indent += TAB; + body = this.ensureBlock(this.body); + ifPart = "if (" + cond + ") {\n" + (body.compile(o)) + "\n" + this.tab + "}"; + if (!child) { + ifPart = this.tab + ifPart; + } + if (!this.elseBody) { + return ifPart; + } + return ifPart + ' else ' + (this.isChain ? (o.indent = this.tab, o.chainChild = true, this.elseBody.unwrap().compile(o, LEVEL_TOP)) : "{\n" + (this.elseBody.compile(o, LEVEL_TOP)) + "\n" + this.tab + "}"); + }; + + If.prototype.compileExpression = function(o) { + var alt, body, code, cond; + cond = this.condition.compile(o, LEVEL_COND); + body = this.bodyNode().compile(o, LEVEL_LIST); + alt = this.elseBodyNode() ? this.elseBodyNode().compile(o, LEVEL_LIST) : 'void 0'; + code = "" + cond + " ? " + body + " : " + alt; + if (o.level >= LEVEL_COND) { + return "(" + code + ")"; + } else { + return code; + } + }; + + If.prototype.unfoldSoak = function() { + return this.soak && this; + }; + + return If; + + })(Base); + + Closure = { + wrap: function(expressions, statement, noReturn) { + var args, call, func, mentionsArgs, meth; + if (expressions.jumps()) { + return expressions; + } + func = new Code([], Block.wrap([expressions])); + args = []; + if ((mentionsArgs = expressions.contains(this.literalArgs)) || expressions.contains(this.literalThis)) { + meth = new Literal(mentionsArgs ? 'apply' : 'call'); + args = [new Literal('this')]; + if (mentionsArgs) { + args.push(new Literal('arguments')); + } + func = new Value(func, [new Access(meth)]); + } + func.noReturn = noReturn; + call = new Call(func, args); + if (statement) { + return Block.wrap([call]); + } else { + return call; + } + }, + literalArgs: function(node) { + return node instanceof Literal && node.value === 'arguments' && !node.asKey; + }, + literalThis: function(node) { + return (node instanceof Literal && node.value === 'this' && !node.asKey) || (node instanceof Code && node.bound) || (node instanceof Call && node.isSuper); + } + }; + + unfoldSoak = function(o, parent, name) { + var ifn; + if (!(ifn = parent[name].unfoldSoak(o))) { + return; + } + parent[name] = ifn.body; + ifn.body = new Value(parent); + return ifn; + }; + + UTILITIES = { + "extends": function() { + return "function(child, parent) { for (var key in parent) { if (" + (utility('hasProp')) + ".call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }"; + }, + bind: function() { + return 'function(fn, me){ return function(){ return fn.apply(me, arguments); }; }'; + }, + indexOf: function() { + return "[].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }"; + }, + hasProp: function() { + return '{}.hasOwnProperty'; + }, + slice: function() { + return '[].slice'; + } + }; + + LEVEL_TOP = 1; + + LEVEL_PAREN = 2; + + LEVEL_LIST = 3; + + LEVEL_COND = 4; + + LEVEL_OP = 5; + + LEVEL_ACCESS = 6; + + TAB = ' '; + + IDENTIFIER_STR = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*"; + + IDENTIFIER = RegExp("^" + IDENTIFIER_STR + "$"); + + SIMPLENUM = /^[+-]?\d+$/; + + METHOD_DEF = RegExp("^(?:(" + IDENTIFIER_STR + ")\\.prototype(?:\\.(" + IDENTIFIER_STR + ")|\\[(\"(?:[^\\\\\"\\r\\n]|\\\\.)*\"|'(?:[^\\\\'\\r\\n]|\\\\.)*')\\]|\\[(0x[\\da-fA-F]+|\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\]))|(" + IDENTIFIER_STR + ")$"); + + IS_STRING = /^['"]/; + + utility = function(name) { + var ref; + ref = "__" + name; + Scope.root.assign(ref, UTILITIES[name]()); + return ref; + }; + + multident = function(code, tab) { + code = code.replace(/\n/g, '$&' + tab); + return code.replace(/\s+$/, ''); + }; + +}).call(this); diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/optparse.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/optparse.js new file mode 100644 index 0000000..d7fda40 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/optparse.js @@ -0,0 +1,138 @@ +// Generated by CoffeeScript 1.3.3 +(function() { + var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments; + + exports.OptionParser = OptionParser = (function() { + + function OptionParser(rules, banner) { + this.banner = banner; + this.rules = buildRules(rules); + } + + OptionParser.prototype.parse = function(args) { + var arg, i, isOption, matchedRule, options, originalArgs, pos, rule, seenNonOptionArg, skippingArgument, value, _i, _j, _len, _len1, _ref; + options = { + "arguments": [] + }; + skippingArgument = false; + originalArgs = args; + args = normalizeArguments(args); + for (i = _i = 0, _len = args.length; _i < _len; i = ++_i) { + arg = args[i]; + if (skippingArgument) { + skippingArgument = false; + continue; + } + if (arg === '--') { + pos = originalArgs.indexOf('--'); + options["arguments"] = options["arguments"].concat(originalArgs.slice(pos + 1)); + break; + } + isOption = !!(arg.match(LONG_FLAG) || arg.match(SHORT_FLAG)); + seenNonOptionArg = options["arguments"].length > 0; + if (!seenNonOptionArg) { + matchedRule = false; + _ref = this.rules; + for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { + rule = _ref[_j]; + if (rule.shortFlag === arg || rule.longFlag === arg) { + value = true; + if (rule.hasArgument) { + skippingArgument = true; + value = args[i + 1]; + } + options[rule.name] = rule.isList ? (options[rule.name] || []).concat(value) : value; + matchedRule = true; + break; + } + } + if (isOption && !matchedRule) { + throw new Error("unrecognized option: " + arg); + } + } + if (seenNonOptionArg || !isOption) { + options["arguments"].push(arg); + } + } + return options; + }; + + OptionParser.prototype.help = function() { + var letPart, lines, rule, spaces, _i, _len, _ref; + lines = []; + if (this.banner) { + lines.unshift("" + this.banner + "\n"); + } + _ref = this.rules; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + rule = _ref[_i]; + spaces = 15 - rule.longFlag.length; + spaces = spaces > 0 ? Array(spaces + 1).join(' ') : ''; + letPart = rule.shortFlag ? rule.shortFlag + ', ' : ' '; + lines.push(' ' + letPart + rule.longFlag + spaces + rule.description); + } + return "\n" + (lines.join('\n')) + "\n"; + }; + + return OptionParser; + + })(); + + LONG_FLAG = /^(--\w[\w\-]*)/; + + SHORT_FLAG = /^(-\w)$/; + + MULTI_FLAG = /^-(\w{2,})/; + + OPTIONAL = /\[(\w+(\*?))\]/; + + buildRules = function(rules) { + var tuple, _i, _len, _results; + _results = []; + for (_i = 0, _len = rules.length; _i < _len; _i++) { + tuple = rules[_i]; + if (tuple.length < 3) { + tuple.unshift(null); + } + _results.push(buildRule.apply(null, tuple)); + } + return _results; + }; + + buildRule = function(shortFlag, longFlag, description, options) { + var match; + if (options == null) { + options = {}; + } + match = longFlag.match(OPTIONAL); + longFlag = longFlag.match(LONG_FLAG)[1]; + return { + name: longFlag.substr(2), + shortFlag: shortFlag, + longFlag: longFlag, + description: description, + hasArgument: !!(match && match[1]), + isList: !!(match && match[2]) + }; + }; + + normalizeArguments = function(args) { + var arg, l, match, result, _i, _j, _len, _len1, _ref; + args = args.slice(0); + result = []; + for (_i = 0, _len = args.length; _i < _len; _i++) { + arg = args[_i]; + if (match = arg.match(MULTI_FLAG)) { + _ref = match[1].split(''); + for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { + l = _ref[_j]; + result.push('-' + l); + } + } else { + result.push(arg); + } + } + return result; + }; + +}).call(this); diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/parser.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/parser.js new file mode 100755 index 0000000..f049903 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/parser.js @@ -0,0 +1,683 @@ +/* Jison generated parser */ +var parser = (function(){ +var parser = {trace: function trace() { }, +yy: {}, +symbols_: {"error":2,"Root":3,"Body":4,"Block":5,"TERMINATOR":6,"Line":7,"Expression":8,"Statement":9,"Return":10,"Comment":11,"STATEMENT":12,"Value":13,"Invocation":14,"Code":15,"Operation":16,"Assign":17,"If":18,"Try":19,"While":20,"For":21,"Switch":22,"Class":23,"Throw":24,"INDENT":25,"OUTDENT":26,"Identifier":27,"IDENTIFIER":28,"AlphaNumeric":29,"NUMBER":30,"STRING":31,"Literal":32,"JS":33,"REGEX":34,"DEBUGGER":35,"UNDEFINED":36,"NULL":37,"BOOL":38,"Assignable":39,"=":40,"AssignObj":41,"ObjAssignable":42,":":43,"ThisProperty":44,"RETURN":45,"HERECOMMENT":46,"PARAM_START":47,"ParamList":48,"PARAM_END":49,"FuncGlyph":50,"->":51,"=>":52,"OptComma":53,",":54,"Param":55,"ParamVar":56,"...":57,"Array":58,"Object":59,"Splat":60,"SimpleAssignable":61,"Accessor":62,"Parenthetical":63,"Range":64,"This":65,".":66,"?.":67,"::":68,"Index":69,"INDEX_START":70,"IndexValue":71,"INDEX_END":72,"INDEX_SOAK":73,"Slice":74,"{":75,"AssignList":76,"}":77,"CLASS":78,"EXTENDS":79,"OptFuncExist":80,"Arguments":81,"SUPER":82,"FUNC_EXIST":83,"CALL_START":84,"CALL_END":85,"ArgList":86,"THIS":87,"@":88,"[":89,"]":90,"RangeDots":91,"..":92,"Arg":93,"SimpleArgs":94,"TRY":95,"Catch":96,"FINALLY":97,"CATCH":98,"THROW":99,"(":100,")":101,"WhileSource":102,"WHILE":103,"WHEN":104,"UNTIL":105,"Loop":106,"LOOP":107,"ForBody":108,"FOR":109,"ForStart":110,"ForSource":111,"ForVariables":112,"OWN":113,"ForValue":114,"FORIN":115,"FOROF":116,"BY":117,"SWITCH":118,"Whens":119,"ELSE":120,"When":121,"LEADING_WHEN":122,"IfBlock":123,"IF":124,"POST_IF":125,"UNARY":126,"-":127,"+":128,"--":129,"++":130,"?":131,"MATH":132,"SHIFT":133,"COMPARE":134,"LOGIC":135,"RELATION":136,"COMPOUND_ASSIGN":137,"$accept":0,"$end":1}, +terminals_: {2:"error",6:"TERMINATOR",12:"STATEMENT",25:"INDENT",26:"OUTDENT",28:"IDENTIFIER",30:"NUMBER",31:"STRING",33:"JS",34:"REGEX",35:"DEBUGGER",36:"UNDEFINED",37:"NULL",38:"BOOL",40:"=",43:":",45:"RETURN",46:"HERECOMMENT",47:"PARAM_START",49:"PARAM_END",51:"->",52:"=>",54:",",57:"...",66:".",67:"?.",68:"::",70:"INDEX_START",72:"INDEX_END",73:"INDEX_SOAK",75:"{",77:"}",78:"CLASS",79:"EXTENDS",82:"SUPER",83:"FUNC_EXIST",84:"CALL_START",85:"CALL_END",87:"THIS",88:"@",89:"[",90:"]",92:"..",95:"TRY",97:"FINALLY",98:"CATCH",99:"THROW",100:"(",101:")",103:"WHILE",104:"WHEN",105:"UNTIL",107:"LOOP",109:"FOR",113:"OWN",115:"FORIN",116:"FOROF",117:"BY",118:"SWITCH",120:"ELSE",122:"LEADING_WHEN",124:"IF",125:"POST_IF",126:"UNARY",127:"-",128:"+",129:"--",130:"++",131:"?",132:"MATH",133:"SHIFT",134:"COMPARE",135:"LOGIC",136:"RELATION",137:"COMPOUND_ASSIGN"}, +productions_: [0,[3,0],[3,1],[3,2],[4,1],[4,3],[4,2],[7,1],[7,1],[9,1],[9,1],[9,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[8,1],[5,2],[5,3],[27,1],[29,1],[29,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[17,3],[17,4],[17,5],[41,1],[41,3],[41,5],[41,1],[42,1],[42,1],[42,1],[10,2],[10,1],[11,1],[15,5],[15,2],[50,1],[50,1],[53,0],[53,1],[48,0],[48,1],[48,3],[48,4],[48,6],[55,1],[55,2],[55,3],[56,1],[56,1],[56,1],[56,1],[60,2],[61,1],[61,2],[61,2],[61,1],[39,1],[39,1],[39,1],[13,1],[13,1],[13,1],[13,1],[13,1],[62,2],[62,2],[62,2],[62,1],[62,1],[69,3],[69,2],[71,1],[71,1],[59,4],[76,0],[76,1],[76,3],[76,4],[76,6],[23,1],[23,2],[23,3],[23,4],[23,2],[23,3],[23,4],[23,5],[14,3],[14,3],[14,1],[14,2],[80,0],[80,1],[81,2],[81,4],[65,1],[65,1],[44,2],[58,2],[58,4],[91,1],[91,1],[64,5],[74,3],[74,2],[74,2],[74,1],[86,1],[86,3],[86,4],[86,4],[86,6],[93,1],[93,1],[94,1],[94,3],[19,2],[19,3],[19,4],[19,5],[96,3],[24,2],[63,3],[63,5],[102,2],[102,4],[102,2],[102,4],[20,2],[20,2],[20,2],[20,1],[106,2],[106,2],[21,2],[21,2],[21,2],[108,2],[108,2],[110,2],[110,3],[114,1],[114,1],[114,1],[114,1],[112,1],[112,3],[111,2],[111,2],[111,4],[111,4],[111,4],[111,6],[111,6],[22,5],[22,7],[22,4],[22,6],[119,1],[119,2],[121,3],[121,4],[123,3],[123,5],[18,1],[18,3],[18,3],[18,3],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,2],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,3],[16,5],[16,3]], +performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { + +var $0 = $$.length - 1; +switch (yystate) { +case 1:return this.$ = new yy.Block; +break; +case 2:return this.$ = $$[$0]; +break; +case 3:return this.$ = $$[$0-1]; +break; +case 4:this.$ = yy.Block.wrap([$$[$0]]); +break; +case 5:this.$ = $$[$0-2].push($$[$0]); +break; +case 6:this.$ = $$[$0-1]; +break; +case 7:this.$ = $$[$0]; +break; +case 8:this.$ = $$[$0]; +break; +case 9:this.$ = $$[$0]; +break; +case 10:this.$ = $$[$0]; +break; +case 11:this.$ = new yy.Literal($$[$0]); +break; +case 12:this.$ = $$[$0]; +break; +case 13:this.$ = $$[$0]; +break; +case 14:this.$ = $$[$0]; +break; +case 15:this.$ = $$[$0]; +break; +case 16:this.$ = $$[$0]; +break; +case 17:this.$ = $$[$0]; +break; +case 18:this.$ = $$[$0]; +break; +case 19:this.$ = $$[$0]; +break; +case 20:this.$ = $$[$0]; +break; +case 21:this.$ = $$[$0]; +break; +case 22:this.$ = $$[$0]; +break; +case 23:this.$ = $$[$0]; +break; +case 24:this.$ = new yy.Block; +break; +case 25:this.$ = $$[$0-1]; +break; +case 26:this.$ = new yy.Literal($$[$0]); +break; +case 27:this.$ = new yy.Literal($$[$0]); +break; +case 28:this.$ = new yy.Literal($$[$0]); +break; +case 29:this.$ = $$[$0]; +break; +case 30:this.$ = new yy.Literal($$[$0]); +break; +case 31:this.$ = new yy.Literal($$[$0]); +break; +case 32:this.$ = new yy.Literal($$[$0]); +break; +case 33:this.$ = new yy.Undefined; +break; +case 34:this.$ = new yy.Null; +break; +case 35:this.$ = new yy.Bool($$[$0]); +break; +case 36:this.$ = new yy.Assign($$[$0-2], $$[$0]); +break; +case 37:this.$ = new yy.Assign($$[$0-3], $$[$0]); +break; +case 38:this.$ = new yy.Assign($$[$0-4], $$[$0-1]); +break; +case 39:this.$ = new yy.Value($$[$0]); +break; +case 40:this.$ = new yy.Assign(new yy.Value($$[$0-2]), $$[$0], 'object'); +break; +case 41:this.$ = new yy.Assign(new yy.Value($$[$0-4]), $$[$0-1], 'object'); +break; +case 42:this.$ = $$[$0]; +break; +case 43:this.$ = $$[$0]; +break; +case 44:this.$ = $$[$0]; +break; +case 45:this.$ = $$[$0]; +break; +case 46:this.$ = new yy.Return($$[$0]); +break; +case 47:this.$ = new yy.Return; +break; +case 48:this.$ = new yy.Comment($$[$0]); +break; +case 49:this.$ = new yy.Code($$[$0-3], $$[$0], $$[$0-1]); +break; +case 50:this.$ = new yy.Code([], $$[$0], $$[$0-1]); +break; +case 51:this.$ = 'func'; +break; +case 52:this.$ = 'boundfunc'; +break; +case 53:this.$ = $$[$0]; +break; +case 54:this.$ = $$[$0]; +break; +case 55:this.$ = []; +break; +case 56:this.$ = [$$[$0]]; +break; +case 57:this.$ = $$[$0-2].concat($$[$0]); +break; +case 58:this.$ = $$[$0-3].concat($$[$0]); +break; +case 59:this.$ = $$[$0-5].concat($$[$0-2]); +break; +case 60:this.$ = new yy.Param($$[$0]); +break; +case 61:this.$ = new yy.Param($$[$0-1], null, true); +break; +case 62:this.$ = new yy.Param($$[$0-2], $$[$0]); +break; +case 63:this.$ = $$[$0]; +break; +case 64:this.$ = $$[$0]; +break; +case 65:this.$ = $$[$0]; +break; +case 66:this.$ = $$[$0]; +break; +case 67:this.$ = new yy.Splat($$[$0-1]); +break; +case 68:this.$ = new yy.Value($$[$0]); +break; +case 69:this.$ = $$[$0-1].add($$[$0]); +break; +case 70:this.$ = new yy.Value($$[$0-1], [].concat($$[$0])); +break; +case 71:this.$ = $$[$0]; +break; +case 72:this.$ = $$[$0]; +break; +case 73:this.$ = new yy.Value($$[$0]); +break; +case 74:this.$ = new yy.Value($$[$0]); +break; +case 75:this.$ = $$[$0]; +break; +case 76:this.$ = new yy.Value($$[$0]); +break; +case 77:this.$ = new yy.Value($$[$0]); +break; +case 78:this.$ = new yy.Value($$[$0]); +break; +case 79:this.$ = $$[$0]; +break; +case 80:this.$ = new yy.Access($$[$0]); +break; +case 81:this.$ = new yy.Access($$[$0], 'soak'); +break; +case 82:this.$ = [new yy.Access(new yy.Literal('prototype')), new yy.Access($$[$0])]; +break; +case 83:this.$ = new yy.Access(new yy.Literal('prototype')); +break; +case 84:this.$ = $$[$0]; +break; +case 85:this.$ = $$[$0-1]; +break; +case 86:this.$ = yy.extend($$[$0], { + soak: true + }); +break; +case 87:this.$ = new yy.Index($$[$0]); +break; +case 88:this.$ = new yy.Slice($$[$0]); +break; +case 89:this.$ = new yy.Obj($$[$0-2], $$[$0-3].generated); +break; +case 90:this.$ = []; +break; +case 91:this.$ = [$$[$0]]; +break; +case 92:this.$ = $$[$0-2].concat($$[$0]); +break; +case 93:this.$ = $$[$0-3].concat($$[$0]); +break; +case 94:this.$ = $$[$0-5].concat($$[$0-2]); +break; +case 95:this.$ = new yy.Class; +break; +case 96:this.$ = new yy.Class(null, null, $$[$0]); +break; +case 97:this.$ = new yy.Class(null, $$[$0]); +break; +case 98:this.$ = new yy.Class(null, $$[$0-1], $$[$0]); +break; +case 99:this.$ = new yy.Class($$[$0]); +break; +case 100:this.$ = new yy.Class($$[$0-1], null, $$[$0]); +break; +case 101:this.$ = new yy.Class($$[$0-2], $$[$0]); +break; +case 102:this.$ = new yy.Class($$[$0-3], $$[$0-1], $$[$0]); +break; +case 103:this.$ = new yy.Call($$[$0-2], $$[$0], $$[$0-1]); +break; +case 104:this.$ = new yy.Call($$[$0-2], $$[$0], $$[$0-1]); +break; +case 105:this.$ = new yy.Call('super', [new yy.Splat(new yy.Literal('arguments'))]); +break; +case 106:this.$ = new yy.Call('super', $$[$0]); +break; +case 107:this.$ = false; +break; +case 108:this.$ = true; +break; +case 109:this.$ = []; +break; +case 110:this.$ = $$[$0-2]; +break; +case 111:this.$ = new yy.Value(new yy.Literal('this')); +break; +case 112:this.$ = new yy.Value(new yy.Literal('this')); +break; +case 113:this.$ = new yy.Value(new yy.Literal('this'), [new yy.Access($$[$0])], 'this'); +break; +case 114:this.$ = new yy.Arr([]); +break; +case 115:this.$ = new yy.Arr($$[$0-2]); +break; +case 116:this.$ = 'inclusive'; +break; +case 117:this.$ = 'exclusive'; +break; +case 118:this.$ = new yy.Range($$[$0-3], $$[$0-1], $$[$0-2]); +break; +case 119:this.$ = new yy.Range($$[$0-2], $$[$0], $$[$0-1]); +break; +case 120:this.$ = new yy.Range($$[$0-1], null, $$[$0]); +break; +case 121:this.$ = new yy.Range(null, $$[$0], $$[$0-1]); +break; +case 122:this.$ = new yy.Range(null, null, $$[$0]); +break; +case 123:this.$ = [$$[$0]]; +break; +case 124:this.$ = $$[$0-2].concat($$[$0]); +break; +case 125:this.$ = $$[$0-3].concat($$[$0]); +break; +case 126:this.$ = $$[$0-2]; +break; +case 127:this.$ = $$[$0-5].concat($$[$0-2]); +break; +case 128:this.$ = $$[$0]; +break; +case 129:this.$ = $$[$0]; +break; +case 130:this.$ = $$[$0]; +break; +case 131:this.$ = [].concat($$[$0-2], $$[$0]); +break; +case 132:this.$ = new yy.Try($$[$0]); +break; +case 133:this.$ = new yy.Try($$[$0-1], $$[$0][0], $$[$0][1]); +break; +case 134:this.$ = new yy.Try($$[$0-2], null, null, $$[$0]); +break; +case 135:this.$ = new yy.Try($$[$0-3], $$[$0-2][0], $$[$0-2][1], $$[$0]); +break; +case 136:this.$ = [$$[$0-1], $$[$0]]; +break; +case 137:this.$ = new yy.Throw($$[$0]); +break; +case 138:this.$ = new yy.Parens($$[$0-1]); +break; +case 139:this.$ = new yy.Parens($$[$0-2]); +break; +case 140:this.$ = new yy.While($$[$0]); +break; +case 141:this.$ = new yy.While($$[$0-2], { + guard: $$[$0] + }); +break; +case 142:this.$ = new yy.While($$[$0], { + invert: true + }); +break; +case 143:this.$ = new yy.While($$[$0-2], { + invert: true, + guard: $$[$0] + }); +break; +case 144:this.$ = $$[$0-1].addBody($$[$0]); +break; +case 145:this.$ = $$[$0].addBody(yy.Block.wrap([$$[$0-1]])); +break; +case 146:this.$ = $$[$0].addBody(yy.Block.wrap([$$[$0-1]])); +break; +case 147:this.$ = $$[$0]; +break; +case 148:this.$ = new yy.While(new yy.Literal('true')).addBody($$[$0]); +break; +case 149:this.$ = new yy.While(new yy.Literal('true')).addBody(yy.Block.wrap([$$[$0]])); +break; +case 150:this.$ = new yy.For($$[$0-1], $$[$0]); +break; +case 151:this.$ = new yy.For($$[$0-1], $$[$0]); +break; +case 152:this.$ = new yy.For($$[$0], $$[$0-1]); +break; +case 153:this.$ = { + source: new yy.Value($$[$0]) + }; +break; +case 154:this.$ = (function () { + $$[$0].own = $$[$0-1].own; + $$[$0].name = $$[$0-1][0]; + $$[$0].index = $$[$0-1][1]; + return $$[$0]; + }()); +break; +case 155:this.$ = $$[$0]; +break; +case 156:this.$ = (function () { + $$[$0].own = true; + return $$[$0]; + }()); +break; +case 157:this.$ = $$[$0]; +break; +case 158:this.$ = $$[$0]; +break; +case 159:this.$ = new yy.Value($$[$0]); +break; +case 160:this.$ = new yy.Value($$[$0]); +break; +case 161:this.$ = [$$[$0]]; +break; +case 162:this.$ = [$$[$0-2], $$[$0]]; +break; +case 163:this.$ = { + source: $$[$0] + }; +break; +case 164:this.$ = { + source: $$[$0], + object: true + }; +break; +case 165:this.$ = { + source: $$[$0-2], + guard: $$[$0] + }; +break; +case 166:this.$ = { + source: $$[$0-2], + guard: $$[$0], + object: true + }; +break; +case 167:this.$ = { + source: $$[$0-2], + step: $$[$0] + }; +break; +case 168:this.$ = { + source: $$[$0-4], + guard: $$[$0-2], + step: $$[$0] + }; +break; +case 169:this.$ = { + source: $$[$0-4], + step: $$[$0-2], + guard: $$[$0] + }; +break; +case 170:this.$ = new yy.Switch($$[$0-3], $$[$0-1]); +break; +case 171:this.$ = new yy.Switch($$[$0-5], $$[$0-3], $$[$0-1]); +break; +case 172:this.$ = new yy.Switch(null, $$[$0-1]); +break; +case 173:this.$ = new yy.Switch(null, $$[$0-3], $$[$0-1]); +break; +case 174:this.$ = $$[$0]; +break; +case 175:this.$ = $$[$0-1].concat($$[$0]); +break; +case 176:this.$ = [[$$[$0-1], $$[$0]]]; +break; +case 177:this.$ = [[$$[$0-2], $$[$0-1]]]; +break; +case 178:this.$ = new yy.If($$[$0-1], $$[$0], { + type: $$[$0-2] + }); +break; +case 179:this.$ = $$[$0-4].addElse(new yy.If($$[$0-1], $$[$0], { + type: $$[$0-2] + })); +break; +case 180:this.$ = $$[$0]; +break; +case 181:this.$ = $$[$0-2].addElse($$[$0]); +break; +case 182:this.$ = new yy.If($$[$0], yy.Block.wrap([$$[$0-2]]), { + type: $$[$0-1], + statement: true + }); +break; +case 183:this.$ = new yy.If($$[$0], yy.Block.wrap([$$[$0-2]]), { + type: $$[$0-1], + statement: true + }); +break; +case 184:this.$ = new yy.Op($$[$0-1], $$[$0]); +break; +case 185:this.$ = new yy.Op('-', $$[$0]); +break; +case 186:this.$ = new yy.Op('+', $$[$0]); +break; +case 187:this.$ = new yy.Op('--', $$[$0]); +break; +case 188:this.$ = new yy.Op('++', $$[$0]); +break; +case 189:this.$ = new yy.Op('--', $$[$0-1], null, true); +break; +case 190:this.$ = new yy.Op('++', $$[$0-1], null, true); +break; +case 191:this.$ = new yy.Existence($$[$0-1]); +break; +case 192:this.$ = new yy.Op('+', $$[$0-2], $$[$0]); +break; +case 193:this.$ = new yy.Op('-', $$[$0-2], $$[$0]); +break; +case 194:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); +break; +case 195:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); +break; +case 196:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); +break; +case 197:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]); +break; +case 198:this.$ = (function () { + if ($$[$0-1].charAt(0) === '!') { + return new yy.Op($$[$0-1].slice(1), $$[$0-2], $$[$0]).invert(); + } else { + return new yy.Op($$[$0-1], $$[$0-2], $$[$0]); + } + }()); +break; +case 199:this.$ = new yy.Assign($$[$0-2], $$[$0], $$[$0-1]); +break; +case 200:this.$ = new yy.Assign($$[$0-4], $$[$0-1], $$[$0-3]); +break; +case 201:this.$ = new yy.Extends($$[$0-2], $$[$0]); +break; +} +}, +table: [{1:[2,1],3:1,4:2,5:3,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,5],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[3]},{1:[2,2],6:[1,74]},{6:[1,75]},{1:[2,4],6:[2,4],26:[2,4],101:[2,4]},{4:77,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[1,76],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,7],6:[2,7],26:[2,7],101:[2,7],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,8],6:[2,8],26:[2,8],101:[2,8],102:90,103:[1,65],105:[1,66],108:91,109:[1,68],110:69,125:[1,89]},{1:[2,12],6:[2,12],25:[2,12],26:[2,12],49:[2,12],54:[2,12],57:[2,12],62:93,66:[1,95],67:[1,96],68:[1,97],69:98,70:[1,99],72:[2,12],73:[1,100],77:[2,12],80:92,83:[1,94],84:[2,107],85:[2,12],90:[2,12],92:[2,12],101:[2,12],103:[2,12],104:[2,12],105:[2,12],109:[2,12],117:[2,12],125:[2,12],127:[2,12],128:[2,12],131:[2,12],132:[2,12],133:[2,12],134:[2,12],135:[2,12],136:[2,12]},{1:[2,13],6:[2,13],25:[2,13],26:[2,13],49:[2,13],54:[2,13],57:[2,13],62:102,66:[1,95],67:[1,96],68:[1,97],69:98,70:[1,99],72:[2,13],73:[1,100],77:[2,13],80:101,83:[1,94],84:[2,107],85:[2,13],90:[2,13],92:[2,13],101:[2,13],103:[2,13],104:[2,13],105:[2,13],109:[2,13],117:[2,13],125:[2,13],127:[2,13],128:[2,13],131:[2,13],132:[2,13],133:[2,13],134:[2,13],135:[2,13],136:[2,13]},{1:[2,14],6:[2,14],25:[2,14],26:[2,14],49:[2,14],54:[2,14],57:[2,14],72:[2,14],77:[2,14],85:[2,14],90:[2,14],92:[2,14],101:[2,14],103:[2,14],104:[2,14],105:[2,14],109:[2,14],117:[2,14],125:[2,14],127:[2,14],128:[2,14],131:[2,14],132:[2,14],133:[2,14],134:[2,14],135:[2,14],136:[2,14]},{1:[2,15],6:[2,15],25:[2,15],26:[2,15],49:[2,15],54:[2,15],57:[2,15],72:[2,15],77:[2,15],85:[2,15],90:[2,15],92:[2,15],101:[2,15],103:[2,15],104:[2,15],105:[2,15],109:[2,15],117:[2,15],125:[2,15],127:[2,15],128:[2,15],131:[2,15],132:[2,15],133:[2,15],134:[2,15],135:[2,15],136:[2,15]},{1:[2,16],6:[2,16],25:[2,16],26:[2,16],49:[2,16],54:[2,16],57:[2,16],72:[2,16],77:[2,16],85:[2,16],90:[2,16],92:[2,16],101:[2,16],103:[2,16],104:[2,16],105:[2,16],109:[2,16],117:[2,16],125:[2,16],127:[2,16],128:[2,16],131:[2,16],132:[2,16],133:[2,16],134:[2,16],135:[2,16],136:[2,16]},{1:[2,17],6:[2,17],25:[2,17],26:[2,17],49:[2,17],54:[2,17],57:[2,17],72:[2,17],77:[2,17],85:[2,17],90:[2,17],92:[2,17],101:[2,17],103:[2,17],104:[2,17],105:[2,17],109:[2,17],117:[2,17],125:[2,17],127:[2,17],128:[2,17],131:[2,17],132:[2,17],133:[2,17],134:[2,17],135:[2,17],136:[2,17]},{1:[2,18],6:[2,18],25:[2,18],26:[2,18],49:[2,18],54:[2,18],57:[2,18],72:[2,18],77:[2,18],85:[2,18],90:[2,18],92:[2,18],101:[2,18],103:[2,18],104:[2,18],105:[2,18],109:[2,18],117:[2,18],125:[2,18],127:[2,18],128:[2,18],131:[2,18],132:[2,18],133:[2,18],134:[2,18],135:[2,18],136:[2,18]},{1:[2,19],6:[2,19],25:[2,19],26:[2,19],49:[2,19],54:[2,19],57:[2,19],72:[2,19],77:[2,19],85:[2,19],90:[2,19],92:[2,19],101:[2,19],103:[2,19],104:[2,19],105:[2,19],109:[2,19],117:[2,19],125:[2,19],127:[2,19],128:[2,19],131:[2,19],132:[2,19],133:[2,19],134:[2,19],135:[2,19],136:[2,19]},{1:[2,20],6:[2,20],25:[2,20],26:[2,20],49:[2,20],54:[2,20],57:[2,20],72:[2,20],77:[2,20],85:[2,20],90:[2,20],92:[2,20],101:[2,20],103:[2,20],104:[2,20],105:[2,20],109:[2,20],117:[2,20],125:[2,20],127:[2,20],128:[2,20],131:[2,20],132:[2,20],133:[2,20],134:[2,20],135:[2,20],136:[2,20]},{1:[2,21],6:[2,21],25:[2,21],26:[2,21],49:[2,21],54:[2,21],57:[2,21],72:[2,21],77:[2,21],85:[2,21],90:[2,21],92:[2,21],101:[2,21],103:[2,21],104:[2,21],105:[2,21],109:[2,21],117:[2,21],125:[2,21],127:[2,21],128:[2,21],131:[2,21],132:[2,21],133:[2,21],134:[2,21],135:[2,21],136:[2,21]},{1:[2,22],6:[2,22],25:[2,22],26:[2,22],49:[2,22],54:[2,22],57:[2,22],72:[2,22],77:[2,22],85:[2,22],90:[2,22],92:[2,22],101:[2,22],103:[2,22],104:[2,22],105:[2,22],109:[2,22],117:[2,22],125:[2,22],127:[2,22],128:[2,22],131:[2,22],132:[2,22],133:[2,22],134:[2,22],135:[2,22],136:[2,22]},{1:[2,23],6:[2,23],25:[2,23],26:[2,23],49:[2,23],54:[2,23],57:[2,23],72:[2,23],77:[2,23],85:[2,23],90:[2,23],92:[2,23],101:[2,23],103:[2,23],104:[2,23],105:[2,23],109:[2,23],117:[2,23],125:[2,23],127:[2,23],128:[2,23],131:[2,23],132:[2,23],133:[2,23],134:[2,23],135:[2,23],136:[2,23]},{1:[2,9],6:[2,9],26:[2,9],101:[2,9],103:[2,9],105:[2,9],109:[2,9],125:[2,9]},{1:[2,10],6:[2,10],26:[2,10],101:[2,10],103:[2,10],105:[2,10],109:[2,10],125:[2,10]},{1:[2,11],6:[2,11],26:[2,11],101:[2,11],103:[2,11],105:[2,11],109:[2,11],125:[2,11]},{1:[2,75],6:[2,75],25:[2,75],26:[2,75],40:[1,103],49:[2,75],54:[2,75],57:[2,75],66:[2,75],67:[2,75],68:[2,75],70:[2,75],72:[2,75],73:[2,75],77:[2,75],83:[2,75],84:[2,75],85:[2,75],90:[2,75],92:[2,75],101:[2,75],103:[2,75],104:[2,75],105:[2,75],109:[2,75],117:[2,75],125:[2,75],127:[2,75],128:[2,75],131:[2,75],132:[2,75],133:[2,75],134:[2,75],135:[2,75],136:[2,75]},{1:[2,76],6:[2,76],25:[2,76],26:[2,76],49:[2,76],54:[2,76],57:[2,76],66:[2,76],67:[2,76],68:[2,76],70:[2,76],72:[2,76],73:[2,76],77:[2,76],83:[2,76],84:[2,76],85:[2,76],90:[2,76],92:[2,76],101:[2,76],103:[2,76],104:[2,76],105:[2,76],109:[2,76],117:[2,76],125:[2,76],127:[2,76],128:[2,76],131:[2,76],132:[2,76],133:[2,76],134:[2,76],135:[2,76],136:[2,76]},{1:[2,77],6:[2,77],25:[2,77],26:[2,77],49:[2,77],54:[2,77],57:[2,77],66:[2,77],67:[2,77],68:[2,77],70:[2,77],72:[2,77],73:[2,77],77:[2,77],83:[2,77],84:[2,77],85:[2,77],90:[2,77],92:[2,77],101:[2,77],103:[2,77],104:[2,77],105:[2,77],109:[2,77],117:[2,77],125:[2,77],127:[2,77],128:[2,77],131:[2,77],132:[2,77],133:[2,77],134:[2,77],135:[2,77],136:[2,77]},{1:[2,78],6:[2,78],25:[2,78],26:[2,78],49:[2,78],54:[2,78],57:[2,78],66:[2,78],67:[2,78],68:[2,78],70:[2,78],72:[2,78],73:[2,78],77:[2,78],83:[2,78],84:[2,78],85:[2,78],90:[2,78],92:[2,78],101:[2,78],103:[2,78],104:[2,78],105:[2,78],109:[2,78],117:[2,78],125:[2,78],127:[2,78],128:[2,78],131:[2,78],132:[2,78],133:[2,78],134:[2,78],135:[2,78],136:[2,78]},{1:[2,79],6:[2,79],25:[2,79],26:[2,79],49:[2,79],54:[2,79],57:[2,79],66:[2,79],67:[2,79],68:[2,79],70:[2,79],72:[2,79],73:[2,79],77:[2,79],83:[2,79],84:[2,79],85:[2,79],90:[2,79],92:[2,79],101:[2,79],103:[2,79],104:[2,79],105:[2,79],109:[2,79],117:[2,79],125:[2,79],127:[2,79],128:[2,79],131:[2,79],132:[2,79],133:[2,79],134:[2,79],135:[2,79],136:[2,79]},{1:[2,105],6:[2,105],25:[2,105],26:[2,105],49:[2,105],54:[2,105],57:[2,105],66:[2,105],67:[2,105],68:[2,105],70:[2,105],72:[2,105],73:[2,105],77:[2,105],81:104,83:[2,105],84:[1,105],85:[2,105],90:[2,105],92:[2,105],101:[2,105],103:[2,105],104:[2,105],105:[2,105],109:[2,105],117:[2,105],125:[2,105],127:[2,105],128:[2,105],131:[2,105],132:[2,105],133:[2,105],134:[2,105],135:[2,105],136:[2,105]},{6:[2,55],25:[2,55],27:109,28:[1,73],44:110,48:106,49:[2,55],54:[2,55],55:107,56:108,58:111,59:112,75:[1,70],88:[1,113],89:[1,114]},{5:115,25:[1,5]},{8:116,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:118,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:119,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{13:121,14:122,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:123,44:63,58:47,59:48,61:120,63:25,64:26,65:27,75:[1,70],82:[1,28],87:[1,58],88:[1,59],89:[1,57],100:[1,56]},{13:121,14:122,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:123,44:63,58:47,59:48,61:124,63:25,64:26,65:27,75:[1,70],82:[1,28],87:[1,58],88:[1,59],89:[1,57],100:[1,56]},{1:[2,72],6:[2,72],25:[2,72],26:[2,72],40:[2,72],49:[2,72],54:[2,72],57:[2,72],66:[2,72],67:[2,72],68:[2,72],70:[2,72],72:[2,72],73:[2,72],77:[2,72],79:[1,128],83:[2,72],84:[2,72],85:[2,72],90:[2,72],92:[2,72],101:[2,72],103:[2,72],104:[2,72],105:[2,72],109:[2,72],117:[2,72],125:[2,72],127:[2,72],128:[2,72],129:[1,125],130:[1,126],131:[2,72],132:[2,72],133:[2,72],134:[2,72],135:[2,72],136:[2,72],137:[1,127]},{1:[2,180],6:[2,180],25:[2,180],26:[2,180],49:[2,180],54:[2,180],57:[2,180],72:[2,180],77:[2,180],85:[2,180],90:[2,180],92:[2,180],101:[2,180],103:[2,180],104:[2,180],105:[2,180],109:[2,180],117:[2,180],120:[1,129],125:[2,180],127:[2,180],128:[2,180],131:[2,180],132:[2,180],133:[2,180],134:[2,180],135:[2,180],136:[2,180]},{5:130,25:[1,5]},{5:131,25:[1,5]},{1:[2,147],6:[2,147],25:[2,147],26:[2,147],49:[2,147],54:[2,147],57:[2,147],72:[2,147],77:[2,147],85:[2,147],90:[2,147],92:[2,147],101:[2,147],103:[2,147],104:[2,147],105:[2,147],109:[2,147],117:[2,147],125:[2,147],127:[2,147],128:[2,147],131:[2,147],132:[2,147],133:[2,147],134:[2,147],135:[2,147],136:[2,147]},{5:132,25:[1,5]},{8:133,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,134],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,95],5:135,6:[2,95],13:121,14:122,25:[1,5],26:[2,95],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:123,44:63,49:[2,95],54:[2,95],57:[2,95],58:47,59:48,61:137,63:25,64:26,65:27,72:[2,95],75:[1,70],77:[2,95],79:[1,136],82:[1,28],85:[2,95],87:[1,58],88:[1,59],89:[1,57],90:[2,95],92:[2,95],100:[1,56],101:[2,95],103:[2,95],104:[2,95],105:[2,95],109:[2,95],117:[2,95],125:[2,95],127:[2,95],128:[2,95],131:[2,95],132:[2,95],133:[2,95],134:[2,95],135:[2,95],136:[2,95]},{8:138,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,47],6:[2,47],8:139,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[2,47],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],101:[2,47],102:39,103:[2,47],105:[2,47],106:40,107:[1,67],108:41,109:[2,47],110:69,118:[1,42],123:37,124:[1,64],125:[2,47],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,48],6:[2,48],25:[2,48],26:[2,48],54:[2,48],77:[2,48],101:[2,48],103:[2,48],105:[2,48],109:[2,48],125:[2,48]},{1:[2,73],6:[2,73],25:[2,73],26:[2,73],40:[2,73],49:[2,73],54:[2,73],57:[2,73],66:[2,73],67:[2,73],68:[2,73],70:[2,73],72:[2,73],73:[2,73],77:[2,73],83:[2,73],84:[2,73],85:[2,73],90:[2,73],92:[2,73],101:[2,73],103:[2,73],104:[2,73],105:[2,73],109:[2,73],117:[2,73],125:[2,73],127:[2,73],128:[2,73],131:[2,73],132:[2,73],133:[2,73],134:[2,73],135:[2,73],136:[2,73]},{1:[2,74],6:[2,74],25:[2,74],26:[2,74],40:[2,74],49:[2,74],54:[2,74],57:[2,74],66:[2,74],67:[2,74],68:[2,74],70:[2,74],72:[2,74],73:[2,74],77:[2,74],83:[2,74],84:[2,74],85:[2,74],90:[2,74],92:[2,74],101:[2,74],103:[2,74],104:[2,74],105:[2,74],109:[2,74],117:[2,74],125:[2,74],127:[2,74],128:[2,74],131:[2,74],132:[2,74],133:[2,74],134:[2,74],135:[2,74],136:[2,74]},{1:[2,29],6:[2,29],25:[2,29],26:[2,29],49:[2,29],54:[2,29],57:[2,29],66:[2,29],67:[2,29],68:[2,29],70:[2,29],72:[2,29],73:[2,29],77:[2,29],83:[2,29],84:[2,29],85:[2,29],90:[2,29],92:[2,29],101:[2,29],103:[2,29],104:[2,29],105:[2,29],109:[2,29],117:[2,29],125:[2,29],127:[2,29],128:[2,29],131:[2,29],132:[2,29],133:[2,29],134:[2,29],135:[2,29],136:[2,29]},{1:[2,30],6:[2,30],25:[2,30],26:[2,30],49:[2,30],54:[2,30],57:[2,30],66:[2,30],67:[2,30],68:[2,30],70:[2,30],72:[2,30],73:[2,30],77:[2,30],83:[2,30],84:[2,30],85:[2,30],90:[2,30],92:[2,30],101:[2,30],103:[2,30],104:[2,30],105:[2,30],109:[2,30],117:[2,30],125:[2,30],127:[2,30],128:[2,30],131:[2,30],132:[2,30],133:[2,30],134:[2,30],135:[2,30],136:[2,30]},{1:[2,31],6:[2,31],25:[2,31],26:[2,31],49:[2,31],54:[2,31],57:[2,31],66:[2,31],67:[2,31],68:[2,31],70:[2,31],72:[2,31],73:[2,31],77:[2,31],83:[2,31],84:[2,31],85:[2,31],90:[2,31],92:[2,31],101:[2,31],103:[2,31],104:[2,31],105:[2,31],109:[2,31],117:[2,31],125:[2,31],127:[2,31],128:[2,31],131:[2,31],132:[2,31],133:[2,31],134:[2,31],135:[2,31],136:[2,31]},{1:[2,32],6:[2,32],25:[2,32],26:[2,32],49:[2,32],54:[2,32],57:[2,32],66:[2,32],67:[2,32],68:[2,32],70:[2,32],72:[2,32],73:[2,32],77:[2,32],83:[2,32],84:[2,32],85:[2,32],90:[2,32],92:[2,32],101:[2,32],103:[2,32],104:[2,32],105:[2,32],109:[2,32],117:[2,32],125:[2,32],127:[2,32],128:[2,32],131:[2,32],132:[2,32],133:[2,32],134:[2,32],135:[2,32],136:[2,32]},{1:[2,33],6:[2,33],25:[2,33],26:[2,33],49:[2,33],54:[2,33],57:[2,33],66:[2,33],67:[2,33],68:[2,33],70:[2,33],72:[2,33],73:[2,33],77:[2,33],83:[2,33],84:[2,33],85:[2,33],90:[2,33],92:[2,33],101:[2,33],103:[2,33],104:[2,33],105:[2,33],109:[2,33],117:[2,33],125:[2,33],127:[2,33],128:[2,33],131:[2,33],132:[2,33],133:[2,33],134:[2,33],135:[2,33],136:[2,33]},{1:[2,34],6:[2,34],25:[2,34],26:[2,34],49:[2,34],54:[2,34],57:[2,34],66:[2,34],67:[2,34],68:[2,34],70:[2,34],72:[2,34],73:[2,34],77:[2,34],83:[2,34],84:[2,34],85:[2,34],90:[2,34],92:[2,34],101:[2,34],103:[2,34],104:[2,34],105:[2,34],109:[2,34],117:[2,34],125:[2,34],127:[2,34],128:[2,34],131:[2,34],132:[2,34],133:[2,34],134:[2,34],135:[2,34],136:[2,34]},{1:[2,35],6:[2,35],25:[2,35],26:[2,35],49:[2,35],54:[2,35],57:[2,35],66:[2,35],67:[2,35],68:[2,35],70:[2,35],72:[2,35],73:[2,35],77:[2,35],83:[2,35],84:[2,35],85:[2,35],90:[2,35],92:[2,35],101:[2,35],103:[2,35],104:[2,35],105:[2,35],109:[2,35],117:[2,35],125:[2,35],127:[2,35],128:[2,35],131:[2,35],132:[2,35],133:[2,35],134:[2,35],135:[2,35],136:[2,35]},{4:140,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,141],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:142,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],86:144,87:[1,58],88:[1,59],89:[1,57],90:[1,143],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,111],6:[2,111],25:[2,111],26:[2,111],49:[2,111],54:[2,111],57:[2,111],66:[2,111],67:[2,111],68:[2,111],70:[2,111],72:[2,111],73:[2,111],77:[2,111],83:[2,111],84:[2,111],85:[2,111],90:[2,111],92:[2,111],101:[2,111],103:[2,111],104:[2,111],105:[2,111],109:[2,111],117:[2,111],125:[2,111],127:[2,111],128:[2,111],131:[2,111],132:[2,111],133:[2,111],134:[2,111],135:[2,111],136:[2,111]},{1:[2,112],6:[2,112],25:[2,112],26:[2,112],27:148,28:[1,73],49:[2,112],54:[2,112],57:[2,112],66:[2,112],67:[2,112],68:[2,112],70:[2,112],72:[2,112],73:[2,112],77:[2,112],83:[2,112],84:[2,112],85:[2,112],90:[2,112],92:[2,112],101:[2,112],103:[2,112],104:[2,112],105:[2,112],109:[2,112],117:[2,112],125:[2,112],127:[2,112],128:[2,112],131:[2,112],132:[2,112],133:[2,112],134:[2,112],135:[2,112],136:[2,112]},{25:[2,51]},{25:[2,52]},{1:[2,68],6:[2,68],25:[2,68],26:[2,68],40:[2,68],49:[2,68],54:[2,68],57:[2,68],66:[2,68],67:[2,68],68:[2,68],70:[2,68],72:[2,68],73:[2,68],77:[2,68],79:[2,68],83:[2,68],84:[2,68],85:[2,68],90:[2,68],92:[2,68],101:[2,68],103:[2,68],104:[2,68],105:[2,68],109:[2,68],117:[2,68],125:[2,68],127:[2,68],128:[2,68],129:[2,68],130:[2,68],131:[2,68],132:[2,68],133:[2,68],134:[2,68],135:[2,68],136:[2,68],137:[2,68]},{1:[2,71],6:[2,71],25:[2,71],26:[2,71],40:[2,71],49:[2,71],54:[2,71],57:[2,71],66:[2,71],67:[2,71],68:[2,71],70:[2,71],72:[2,71],73:[2,71],77:[2,71],79:[2,71],83:[2,71],84:[2,71],85:[2,71],90:[2,71],92:[2,71],101:[2,71],103:[2,71],104:[2,71],105:[2,71],109:[2,71],117:[2,71],125:[2,71],127:[2,71],128:[2,71],129:[2,71],130:[2,71],131:[2,71],132:[2,71],133:[2,71],134:[2,71],135:[2,71],136:[2,71],137:[2,71]},{8:149,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:150,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:151,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{5:152,8:153,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,5],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{27:158,28:[1,73],44:159,58:160,59:161,64:154,75:[1,70],88:[1,113],89:[1,57],112:155,113:[1,156],114:157},{111:162,115:[1,163],116:[1,164]},{6:[2,90],11:168,25:[2,90],27:169,28:[1,73],29:170,30:[1,71],31:[1,72],41:166,42:167,44:171,46:[1,46],54:[2,90],76:165,77:[2,90],88:[1,113]},{1:[2,27],6:[2,27],25:[2,27],26:[2,27],43:[2,27],49:[2,27],54:[2,27],57:[2,27],66:[2,27],67:[2,27],68:[2,27],70:[2,27],72:[2,27],73:[2,27],77:[2,27],83:[2,27],84:[2,27],85:[2,27],90:[2,27],92:[2,27],101:[2,27],103:[2,27],104:[2,27],105:[2,27],109:[2,27],117:[2,27],125:[2,27],127:[2,27],128:[2,27],131:[2,27],132:[2,27],133:[2,27],134:[2,27],135:[2,27],136:[2,27]},{1:[2,28],6:[2,28],25:[2,28],26:[2,28],43:[2,28],49:[2,28],54:[2,28],57:[2,28],66:[2,28],67:[2,28],68:[2,28],70:[2,28],72:[2,28],73:[2,28],77:[2,28],83:[2,28],84:[2,28],85:[2,28],90:[2,28],92:[2,28],101:[2,28],103:[2,28],104:[2,28],105:[2,28],109:[2,28],117:[2,28],125:[2,28],127:[2,28],128:[2,28],131:[2,28],132:[2,28],133:[2,28],134:[2,28],135:[2,28],136:[2,28]},{1:[2,26],6:[2,26],25:[2,26],26:[2,26],40:[2,26],43:[2,26],49:[2,26],54:[2,26],57:[2,26],66:[2,26],67:[2,26],68:[2,26],70:[2,26],72:[2,26],73:[2,26],77:[2,26],79:[2,26],83:[2,26],84:[2,26],85:[2,26],90:[2,26],92:[2,26],101:[2,26],103:[2,26],104:[2,26],105:[2,26],109:[2,26],115:[2,26],116:[2,26],117:[2,26],125:[2,26],127:[2,26],128:[2,26],129:[2,26],130:[2,26],131:[2,26],132:[2,26],133:[2,26],134:[2,26],135:[2,26],136:[2,26],137:[2,26]},{1:[2,6],6:[2,6],7:172,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,26:[2,6],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],101:[2,6],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,3]},{1:[2,24],6:[2,24],25:[2,24],26:[2,24],49:[2,24],54:[2,24],57:[2,24],72:[2,24],77:[2,24],85:[2,24],90:[2,24],92:[2,24],97:[2,24],98:[2,24],101:[2,24],103:[2,24],104:[2,24],105:[2,24],109:[2,24],117:[2,24],120:[2,24],122:[2,24],125:[2,24],127:[2,24],128:[2,24],131:[2,24],132:[2,24],133:[2,24],134:[2,24],135:[2,24],136:[2,24]},{6:[1,74],26:[1,173]},{1:[2,191],6:[2,191],25:[2,191],26:[2,191],49:[2,191],54:[2,191],57:[2,191],72:[2,191],77:[2,191],85:[2,191],90:[2,191],92:[2,191],101:[2,191],103:[2,191],104:[2,191],105:[2,191],109:[2,191],117:[2,191],125:[2,191],127:[2,191],128:[2,191],131:[2,191],132:[2,191],133:[2,191],134:[2,191],135:[2,191],136:[2,191]},{8:174,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:175,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:176,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:177,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:178,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:179,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:180,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:181,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,146],6:[2,146],25:[2,146],26:[2,146],49:[2,146],54:[2,146],57:[2,146],72:[2,146],77:[2,146],85:[2,146],90:[2,146],92:[2,146],101:[2,146],103:[2,146],104:[2,146],105:[2,146],109:[2,146],117:[2,146],125:[2,146],127:[2,146],128:[2,146],131:[2,146],132:[2,146],133:[2,146],134:[2,146],135:[2,146],136:[2,146]},{1:[2,151],6:[2,151],25:[2,151],26:[2,151],49:[2,151],54:[2,151],57:[2,151],72:[2,151],77:[2,151],85:[2,151],90:[2,151],92:[2,151],101:[2,151],103:[2,151],104:[2,151],105:[2,151],109:[2,151],117:[2,151],125:[2,151],127:[2,151],128:[2,151],131:[2,151],132:[2,151],133:[2,151],134:[2,151],135:[2,151],136:[2,151]},{8:182,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,145],6:[2,145],25:[2,145],26:[2,145],49:[2,145],54:[2,145],57:[2,145],72:[2,145],77:[2,145],85:[2,145],90:[2,145],92:[2,145],101:[2,145],103:[2,145],104:[2,145],105:[2,145],109:[2,145],117:[2,145],125:[2,145],127:[2,145],128:[2,145],131:[2,145],132:[2,145],133:[2,145],134:[2,145],135:[2,145],136:[2,145]},{1:[2,150],6:[2,150],25:[2,150],26:[2,150],49:[2,150],54:[2,150],57:[2,150],72:[2,150],77:[2,150],85:[2,150],90:[2,150],92:[2,150],101:[2,150],103:[2,150],104:[2,150],105:[2,150],109:[2,150],117:[2,150],125:[2,150],127:[2,150],128:[2,150],131:[2,150],132:[2,150],133:[2,150],134:[2,150],135:[2,150],136:[2,150]},{81:183,84:[1,105]},{1:[2,69],6:[2,69],25:[2,69],26:[2,69],40:[2,69],49:[2,69],54:[2,69],57:[2,69],66:[2,69],67:[2,69],68:[2,69],70:[2,69],72:[2,69],73:[2,69],77:[2,69],79:[2,69],83:[2,69],84:[2,69],85:[2,69],90:[2,69],92:[2,69],101:[2,69],103:[2,69],104:[2,69],105:[2,69],109:[2,69],117:[2,69],125:[2,69],127:[2,69],128:[2,69],129:[2,69],130:[2,69],131:[2,69],132:[2,69],133:[2,69],134:[2,69],135:[2,69],136:[2,69],137:[2,69]},{84:[2,108]},{27:184,28:[1,73]},{27:185,28:[1,73]},{1:[2,83],6:[2,83],25:[2,83],26:[2,83],27:186,28:[1,73],40:[2,83],49:[2,83],54:[2,83],57:[2,83],66:[2,83],67:[2,83],68:[2,83],70:[2,83],72:[2,83],73:[2,83],77:[2,83],79:[2,83],83:[2,83],84:[2,83],85:[2,83],90:[2,83],92:[2,83],101:[2,83],103:[2,83],104:[2,83],105:[2,83],109:[2,83],117:[2,83],125:[2,83],127:[2,83],128:[2,83],129:[2,83],130:[2,83],131:[2,83],132:[2,83],133:[2,83],134:[2,83],135:[2,83],136:[2,83],137:[2,83]},{1:[2,84],6:[2,84],25:[2,84],26:[2,84],40:[2,84],49:[2,84],54:[2,84],57:[2,84],66:[2,84],67:[2,84],68:[2,84],70:[2,84],72:[2,84],73:[2,84],77:[2,84],79:[2,84],83:[2,84],84:[2,84],85:[2,84],90:[2,84],92:[2,84],101:[2,84],103:[2,84],104:[2,84],105:[2,84],109:[2,84],117:[2,84],125:[2,84],127:[2,84],128:[2,84],129:[2,84],130:[2,84],131:[2,84],132:[2,84],133:[2,84],134:[2,84],135:[2,84],136:[2,84],137:[2,84]},{8:188,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],57:[1,192],58:47,59:48,61:36,63:25,64:26,65:27,71:187,74:189,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],91:190,92:[1,191],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{69:193,70:[1,99],73:[1,100]},{81:194,84:[1,105]},{1:[2,70],6:[2,70],25:[2,70],26:[2,70],40:[2,70],49:[2,70],54:[2,70],57:[2,70],66:[2,70],67:[2,70],68:[2,70],70:[2,70],72:[2,70],73:[2,70],77:[2,70],79:[2,70],83:[2,70],84:[2,70],85:[2,70],90:[2,70],92:[2,70],101:[2,70],103:[2,70],104:[2,70],105:[2,70],109:[2,70],117:[2,70],125:[2,70],127:[2,70],128:[2,70],129:[2,70],130:[2,70],131:[2,70],132:[2,70],133:[2,70],134:[2,70],135:[2,70],136:[2,70],137:[2,70]},{6:[1,196],8:195,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,197],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,106],6:[2,106],25:[2,106],26:[2,106],49:[2,106],54:[2,106],57:[2,106],66:[2,106],67:[2,106],68:[2,106],70:[2,106],72:[2,106],73:[2,106],77:[2,106],83:[2,106],84:[2,106],85:[2,106],90:[2,106],92:[2,106],101:[2,106],103:[2,106],104:[2,106],105:[2,106],109:[2,106],117:[2,106],125:[2,106],127:[2,106],128:[2,106],131:[2,106],132:[2,106],133:[2,106],134:[2,106],135:[2,106],136:[2,106]},{8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],85:[1,198],86:199,87:[1,58],88:[1,59],89:[1,57],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,53],25:[2,53],49:[1,201],53:203,54:[1,202]},{6:[2,56],25:[2,56],26:[2,56],49:[2,56],54:[2,56]},{6:[2,60],25:[2,60],26:[2,60],40:[1,205],49:[2,60],54:[2,60],57:[1,204]},{6:[2,63],25:[2,63],26:[2,63],40:[2,63],49:[2,63],54:[2,63],57:[2,63]},{6:[2,64],25:[2,64],26:[2,64],40:[2,64],49:[2,64],54:[2,64],57:[2,64]},{6:[2,65],25:[2,65],26:[2,65],40:[2,65],49:[2,65],54:[2,65],57:[2,65]},{6:[2,66],25:[2,66],26:[2,66],40:[2,66],49:[2,66],54:[2,66],57:[2,66]},{27:148,28:[1,73]},{8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],86:144,87:[1,58],88:[1,59],89:[1,57],90:[1,143],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,50],6:[2,50],25:[2,50],26:[2,50],49:[2,50],54:[2,50],57:[2,50],72:[2,50],77:[2,50],85:[2,50],90:[2,50],92:[2,50],101:[2,50],103:[2,50],104:[2,50],105:[2,50],109:[2,50],117:[2,50],125:[2,50],127:[2,50],128:[2,50],131:[2,50],132:[2,50],133:[2,50],134:[2,50],135:[2,50],136:[2,50]},{1:[2,184],6:[2,184],25:[2,184],26:[2,184],49:[2,184],54:[2,184],57:[2,184],72:[2,184],77:[2,184],85:[2,184],90:[2,184],92:[2,184],101:[2,184],102:87,103:[2,184],104:[2,184],105:[2,184],108:88,109:[2,184],110:69,117:[2,184],125:[2,184],127:[2,184],128:[2,184],131:[1,78],132:[2,184],133:[2,184],134:[2,184],135:[2,184],136:[2,184]},{102:90,103:[1,65],105:[1,66],108:91,109:[1,68],110:69,125:[1,89]},{1:[2,185],6:[2,185],25:[2,185],26:[2,185],49:[2,185],54:[2,185],57:[2,185],72:[2,185],77:[2,185],85:[2,185],90:[2,185],92:[2,185],101:[2,185],102:87,103:[2,185],104:[2,185],105:[2,185],108:88,109:[2,185],110:69,117:[2,185],125:[2,185],127:[2,185],128:[2,185],131:[1,78],132:[2,185],133:[2,185],134:[2,185],135:[2,185],136:[2,185]},{1:[2,186],6:[2,186],25:[2,186],26:[2,186],49:[2,186],54:[2,186],57:[2,186],72:[2,186],77:[2,186],85:[2,186],90:[2,186],92:[2,186],101:[2,186],102:87,103:[2,186],104:[2,186],105:[2,186],108:88,109:[2,186],110:69,117:[2,186],125:[2,186],127:[2,186],128:[2,186],131:[1,78],132:[2,186],133:[2,186],134:[2,186],135:[2,186],136:[2,186]},{1:[2,187],6:[2,187],25:[2,187],26:[2,187],49:[2,187],54:[2,187],57:[2,187],66:[2,72],67:[2,72],68:[2,72],70:[2,72],72:[2,187],73:[2,72],77:[2,187],83:[2,72],84:[2,72],85:[2,187],90:[2,187],92:[2,187],101:[2,187],103:[2,187],104:[2,187],105:[2,187],109:[2,187],117:[2,187],125:[2,187],127:[2,187],128:[2,187],131:[2,187],132:[2,187],133:[2,187],134:[2,187],135:[2,187],136:[2,187]},{62:93,66:[1,95],67:[1,96],68:[1,97],69:98,70:[1,99],73:[1,100],80:92,83:[1,94],84:[2,107]},{62:102,66:[1,95],67:[1,96],68:[1,97],69:98,70:[1,99],73:[1,100],80:101,83:[1,94],84:[2,107]},{66:[2,75],67:[2,75],68:[2,75],70:[2,75],73:[2,75],83:[2,75],84:[2,75]},{1:[2,188],6:[2,188],25:[2,188],26:[2,188],49:[2,188],54:[2,188],57:[2,188],66:[2,72],67:[2,72],68:[2,72],70:[2,72],72:[2,188],73:[2,72],77:[2,188],83:[2,72],84:[2,72],85:[2,188],90:[2,188],92:[2,188],101:[2,188],103:[2,188],104:[2,188],105:[2,188],109:[2,188],117:[2,188],125:[2,188],127:[2,188],128:[2,188],131:[2,188],132:[2,188],133:[2,188],134:[2,188],135:[2,188],136:[2,188]},{1:[2,189],6:[2,189],25:[2,189],26:[2,189],49:[2,189],54:[2,189],57:[2,189],72:[2,189],77:[2,189],85:[2,189],90:[2,189],92:[2,189],101:[2,189],103:[2,189],104:[2,189],105:[2,189],109:[2,189],117:[2,189],125:[2,189],127:[2,189],128:[2,189],131:[2,189],132:[2,189],133:[2,189],134:[2,189],135:[2,189],136:[2,189]},{1:[2,190],6:[2,190],25:[2,190],26:[2,190],49:[2,190],54:[2,190],57:[2,190],72:[2,190],77:[2,190],85:[2,190],90:[2,190],92:[2,190],101:[2,190],103:[2,190],104:[2,190],105:[2,190],109:[2,190],117:[2,190],125:[2,190],127:[2,190],128:[2,190],131:[2,190],132:[2,190],133:[2,190],134:[2,190],135:[2,190],136:[2,190]},{8:206,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,207],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:208,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{5:209,25:[1,5],124:[1,210]},{1:[2,132],6:[2,132],25:[2,132],26:[2,132],49:[2,132],54:[2,132],57:[2,132],72:[2,132],77:[2,132],85:[2,132],90:[2,132],92:[2,132],96:211,97:[1,212],98:[1,213],101:[2,132],103:[2,132],104:[2,132],105:[2,132],109:[2,132],117:[2,132],125:[2,132],127:[2,132],128:[2,132],131:[2,132],132:[2,132],133:[2,132],134:[2,132],135:[2,132],136:[2,132]},{1:[2,144],6:[2,144],25:[2,144],26:[2,144],49:[2,144],54:[2,144],57:[2,144],72:[2,144],77:[2,144],85:[2,144],90:[2,144],92:[2,144],101:[2,144],103:[2,144],104:[2,144],105:[2,144],109:[2,144],117:[2,144],125:[2,144],127:[2,144],128:[2,144],131:[2,144],132:[2,144],133:[2,144],134:[2,144],135:[2,144],136:[2,144]},{1:[2,152],6:[2,152],25:[2,152],26:[2,152],49:[2,152],54:[2,152],57:[2,152],72:[2,152],77:[2,152],85:[2,152],90:[2,152],92:[2,152],101:[2,152],103:[2,152],104:[2,152],105:[2,152],109:[2,152],117:[2,152],125:[2,152],127:[2,152],128:[2,152],131:[2,152],132:[2,152],133:[2,152],134:[2,152],135:[2,152],136:[2,152]},{25:[1,214],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{119:215,121:216,122:[1,217]},{1:[2,96],6:[2,96],25:[2,96],26:[2,96],49:[2,96],54:[2,96],57:[2,96],72:[2,96],77:[2,96],85:[2,96],90:[2,96],92:[2,96],101:[2,96],103:[2,96],104:[2,96],105:[2,96],109:[2,96],117:[2,96],125:[2,96],127:[2,96],128:[2,96],131:[2,96],132:[2,96],133:[2,96],134:[2,96],135:[2,96],136:[2,96]},{8:218,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,99],5:219,6:[2,99],25:[1,5],26:[2,99],49:[2,99],54:[2,99],57:[2,99],66:[2,72],67:[2,72],68:[2,72],70:[2,72],72:[2,99],73:[2,72],77:[2,99],79:[1,220],83:[2,72],84:[2,72],85:[2,99],90:[2,99],92:[2,99],101:[2,99],103:[2,99],104:[2,99],105:[2,99],109:[2,99],117:[2,99],125:[2,99],127:[2,99],128:[2,99],131:[2,99],132:[2,99],133:[2,99],134:[2,99],135:[2,99],136:[2,99]},{1:[2,137],6:[2,137],25:[2,137],26:[2,137],49:[2,137],54:[2,137],57:[2,137],72:[2,137],77:[2,137],85:[2,137],90:[2,137],92:[2,137],101:[2,137],102:87,103:[2,137],104:[2,137],105:[2,137],108:88,109:[2,137],110:69,117:[2,137],125:[2,137],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,46],6:[2,46],26:[2,46],101:[2,46],102:87,103:[2,46],105:[2,46],108:88,109:[2,46],110:69,125:[2,46],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[1,74],101:[1,221]},{4:222,7:4,8:6,9:7,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,128],25:[2,128],54:[2,128],57:[1,224],90:[2,128],91:223,92:[1,191],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,114],6:[2,114],25:[2,114],26:[2,114],40:[2,114],49:[2,114],54:[2,114],57:[2,114],66:[2,114],67:[2,114],68:[2,114],70:[2,114],72:[2,114],73:[2,114],77:[2,114],83:[2,114],84:[2,114],85:[2,114],90:[2,114],92:[2,114],101:[2,114],103:[2,114],104:[2,114],105:[2,114],109:[2,114],115:[2,114],116:[2,114],117:[2,114],125:[2,114],127:[2,114],128:[2,114],131:[2,114],132:[2,114],133:[2,114],134:[2,114],135:[2,114],136:[2,114]},{6:[2,53],25:[2,53],53:225,54:[1,226],90:[2,53]},{6:[2,123],25:[2,123],26:[2,123],54:[2,123],85:[2,123],90:[2,123]},{8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],86:227,87:[1,58],88:[1,59],89:[1,57],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,129],25:[2,129],26:[2,129],54:[2,129],85:[2,129],90:[2,129]},{1:[2,113],6:[2,113],25:[2,113],26:[2,113],40:[2,113],43:[2,113],49:[2,113],54:[2,113],57:[2,113],66:[2,113],67:[2,113],68:[2,113],70:[2,113],72:[2,113],73:[2,113],77:[2,113],79:[2,113],83:[2,113],84:[2,113],85:[2,113],90:[2,113],92:[2,113],101:[2,113],103:[2,113],104:[2,113],105:[2,113],109:[2,113],115:[2,113],116:[2,113],117:[2,113],125:[2,113],127:[2,113],128:[2,113],129:[2,113],130:[2,113],131:[2,113],132:[2,113],133:[2,113],134:[2,113],135:[2,113],136:[2,113],137:[2,113]},{5:228,25:[1,5],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,140],6:[2,140],25:[2,140],26:[2,140],49:[2,140],54:[2,140],57:[2,140],72:[2,140],77:[2,140],85:[2,140],90:[2,140],92:[2,140],101:[2,140],102:87,103:[1,65],104:[1,229],105:[1,66],108:88,109:[1,68],110:69,117:[2,140],125:[2,140],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,142],6:[2,142],25:[2,142],26:[2,142],49:[2,142],54:[2,142],57:[2,142],72:[2,142],77:[2,142],85:[2,142],90:[2,142],92:[2,142],101:[2,142],102:87,103:[1,65],104:[1,230],105:[1,66],108:88,109:[1,68],110:69,117:[2,142],125:[2,142],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,148],6:[2,148],25:[2,148],26:[2,148],49:[2,148],54:[2,148],57:[2,148],72:[2,148],77:[2,148],85:[2,148],90:[2,148],92:[2,148],101:[2,148],103:[2,148],104:[2,148],105:[2,148],109:[2,148],117:[2,148],125:[2,148],127:[2,148],128:[2,148],131:[2,148],132:[2,148],133:[2,148],134:[2,148],135:[2,148],136:[2,148]},{1:[2,149],6:[2,149],25:[2,149],26:[2,149],49:[2,149],54:[2,149],57:[2,149],72:[2,149],77:[2,149],85:[2,149],90:[2,149],92:[2,149],101:[2,149],102:87,103:[1,65],104:[2,149],105:[1,66],108:88,109:[1,68],110:69,117:[2,149],125:[2,149],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,153],6:[2,153],25:[2,153],26:[2,153],49:[2,153],54:[2,153],57:[2,153],72:[2,153],77:[2,153],85:[2,153],90:[2,153],92:[2,153],101:[2,153],103:[2,153],104:[2,153],105:[2,153],109:[2,153],117:[2,153],125:[2,153],127:[2,153],128:[2,153],131:[2,153],132:[2,153],133:[2,153],134:[2,153],135:[2,153],136:[2,153]},{115:[2,155],116:[2,155]},{27:158,28:[1,73],44:159,58:160,59:161,75:[1,70],88:[1,113],89:[1,114],112:231,114:157},{54:[1,232],115:[2,161],116:[2,161]},{54:[2,157],115:[2,157],116:[2,157]},{54:[2,158],115:[2,158],116:[2,158]},{54:[2,159],115:[2,159],116:[2,159]},{54:[2,160],115:[2,160],116:[2,160]},{1:[2,154],6:[2,154],25:[2,154],26:[2,154],49:[2,154],54:[2,154],57:[2,154],72:[2,154],77:[2,154],85:[2,154],90:[2,154],92:[2,154],101:[2,154],103:[2,154],104:[2,154],105:[2,154],109:[2,154],117:[2,154],125:[2,154],127:[2,154],128:[2,154],131:[2,154],132:[2,154],133:[2,154],134:[2,154],135:[2,154],136:[2,154]},{8:233,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:234,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,53],25:[2,53],53:235,54:[1,236],77:[2,53]},{6:[2,91],25:[2,91],26:[2,91],54:[2,91],77:[2,91]},{6:[2,39],25:[2,39],26:[2,39],43:[1,237],54:[2,39],77:[2,39]},{6:[2,42],25:[2,42],26:[2,42],54:[2,42],77:[2,42]},{6:[2,43],25:[2,43],26:[2,43],43:[2,43],54:[2,43],77:[2,43]},{6:[2,44],25:[2,44],26:[2,44],43:[2,44],54:[2,44],77:[2,44]},{6:[2,45],25:[2,45],26:[2,45],43:[2,45],54:[2,45],77:[2,45]},{1:[2,5],6:[2,5],26:[2,5],101:[2,5]},{1:[2,25],6:[2,25],25:[2,25],26:[2,25],49:[2,25],54:[2,25],57:[2,25],72:[2,25],77:[2,25],85:[2,25],90:[2,25],92:[2,25],97:[2,25],98:[2,25],101:[2,25],103:[2,25],104:[2,25],105:[2,25],109:[2,25],117:[2,25],120:[2,25],122:[2,25],125:[2,25],127:[2,25],128:[2,25],131:[2,25],132:[2,25],133:[2,25],134:[2,25],135:[2,25],136:[2,25]},{1:[2,192],6:[2,192],25:[2,192],26:[2,192],49:[2,192],54:[2,192],57:[2,192],72:[2,192],77:[2,192],85:[2,192],90:[2,192],92:[2,192],101:[2,192],102:87,103:[2,192],104:[2,192],105:[2,192],108:88,109:[2,192],110:69,117:[2,192],125:[2,192],127:[2,192],128:[2,192],131:[1,78],132:[1,81],133:[2,192],134:[2,192],135:[2,192],136:[2,192]},{1:[2,193],6:[2,193],25:[2,193],26:[2,193],49:[2,193],54:[2,193],57:[2,193],72:[2,193],77:[2,193],85:[2,193],90:[2,193],92:[2,193],101:[2,193],102:87,103:[2,193],104:[2,193],105:[2,193],108:88,109:[2,193],110:69,117:[2,193],125:[2,193],127:[2,193],128:[2,193],131:[1,78],132:[1,81],133:[2,193],134:[2,193],135:[2,193],136:[2,193]},{1:[2,194],6:[2,194],25:[2,194],26:[2,194],49:[2,194],54:[2,194],57:[2,194],72:[2,194],77:[2,194],85:[2,194],90:[2,194],92:[2,194],101:[2,194],102:87,103:[2,194],104:[2,194],105:[2,194],108:88,109:[2,194],110:69,117:[2,194],125:[2,194],127:[2,194],128:[2,194],131:[1,78],132:[2,194],133:[2,194],134:[2,194],135:[2,194],136:[2,194]},{1:[2,195],6:[2,195],25:[2,195],26:[2,195],49:[2,195],54:[2,195],57:[2,195],72:[2,195],77:[2,195],85:[2,195],90:[2,195],92:[2,195],101:[2,195],102:87,103:[2,195],104:[2,195],105:[2,195],108:88,109:[2,195],110:69,117:[2,195],125:[2,195],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[2,195],134:[2,195],135:[2,195],136:[2,195]},{1:[2,196],6:[2,196],25:[2,196],26:[2,196],49:[2,196],54:[2,196],57:[2,196],72:[2,196],77:[2,196],85:[2,196],90:[2,196],92:[2,196],101:[2,196],102:87,103:[2,196],104:[2,196],105:[2,196],108:88,109:[2,196],110:69,117:[2,196],125:[2,196],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[2,196],135:[2,196],136:[1,85]},{1:[2,197],6:[2,197],25:[2,197],26:[2,197],49:[2,197],54:[2,197],57:[2,197],72:[2,197],77:[2,197],85:[2,197],90:[2,197],92:[2,197],101:[2,197],102:87,103:[2,197],104:[2,197],105:[2,197],108:88,109:[2,197],110:69,117:[2,197],125:[2,197],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[2,197],136:[1,85]},{1:[2,198],6:[2,198],25:[2,198],26:[2,198],49:[2,198],54:[2,198],57:[2,198],72:[2,198],77:[2,198],85:[2,198],90:[2,198],92:[2,198],101:[2,198],102:87,103:[2,198],104:[2,198],105:[2,198],108:88,109:[2,198],110:69,117:[2,198],125:[2,198],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[2,198],135:[2,198],136:[2,198]},{1:[2,183],6:[2,183],25:[2,183],26:[2,183],49:[2,183],54:[2,183],57:[2,183],72:[2,183],77:[2,183],85:[2,183],90:[2,183],92:[2,183],101:[2,183],102:87,103:[1,65],104:[2,183],105:[1,66],108:88,109:[1,68],110:69,117:[2,183],125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,182],6:[2,182],25:[2,182],26:[2,182],49:[2,182],54:[2,182],57:[2,182],72:[2,182],77:[2,182],85:[2,182],90:[2,182],92:[2,182],101:[2,182],102:87,103:[1,65],104:[2,182],105:[1,66],108:88,109:[1,68],110:69,117:[2,182],125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,103],6:[2,103],25:[2,103],26:[2,103],49:[2,103],54:[2,103],57:[2,103],66:[2,103],67:[2,103],68:[2,103],70:[2,103],72:[2,103],73:[2,103],77:[2,103],83:[2,103],84:[2,103],85:[2,103],90:[2,103],92:[2,103],101:[2,103],103:[2,103],104:[2,103],105:[2,103],109:[2,103],117:[2,103],125:[2,103],127:[2,103],128:[2,103],131:[2,103],132:[2,103],133:[2,103],134:[2,103],135:[2,103],136:[2,103]},{1:[2,80],6:[2,80],25:[2,80],26:[2,80],40:[2,80],49:[2,80],54:[2,80],57:[2,80],66:[2,80],67:[2,80],68:[2,80],70:[2,80],72:[2,80],73:[2,80],77:[2,80],79:[2,80],83:[2,80],84:[2,80],85:[2,80],90:[2,80],92:[2,80],101:[2,80],103:[2,80],104:[2,80],105:[2,80],109:[2,80],117:[2,80],125:[2,80],127:[2,80],128:[2,80],129:[2,80],130:[2,80],131:[2,80],132:[2,80],133:[2,80],134:[2,80],135:[2,80],136:[2,80],137:[2,80]},{1:[2,81],6:[2,81],25:[2,81],26:[2,81],40:[2,81],49:[2,81],54:[2,81],57:[2,81],66:[2,81],67:[2,81],68:[2,81],70:[2,81],72:[2,81],73:[2,81],77:[2,81],79:[2,81],83:[2,81],84:[2,81],85:[2,81],90:[2,81],92:[2,81],101:[2,81],103:[2,81],104:[2,81],105:[2,81],109:[2,81],117:[2,81],125:[2,81],127:[2,81],128:[2,81],129:[2,81],130:[2,81],131:[2,81],132:[2,81],133:[2,81],134:[2,81],135:[2,81],136:[2,81],137:[2,81]},{1:[2,82],6:[2,82],25:[2,82],26:[2,82],40:[2,82],49:[2,82],54:[2,82],57:[2,82],66:[2,82],67:[2,82],68:[2,82],70:[2,82],72:[2,82],73:[2,82],77:[2,82],79:[2,82],83:[2,82],84:[2,82],85:[2,82],90:[2,82],92:[2,82],101:[2,82],103:[2,82],104:[2,82],105:[2,82],109:[2,82],117:[2,82],125:[2,82],127:[2,82],128:[2,82],129:[2,82],130:[2,82],131:[2,82],132:[2,82],133:[2,82],134:[2,82],135:[2,82],136:[2,82],137:[2,82]},{72:[1,238]},{57:[1,192],72:[2,87],91:239,92:[1,191],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{72:[2,88]},{8:240,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,72:[2,122],75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{12:[2,116],28:[2,116],30:[2,116],31:[2,116],33:[2,116],34:[2,116],35:[2,116],36:[2,116],37:[2,116],38:[2,116],45:[2,116],46:[2,116],47:[2,116],51:[2,116],52:[2,116],72:[2,116],75:[2,116],78:[2,116],82:[2,116],87:[2,116],88:[2,116],89:[2,116],95:[2,116],99:[2,116],100:[2,116],103:[2,116],105:[2,116],107:[2,116],109:[2,116],118:[2,116],124:[2,116],126:[2,116],127:[2,116],128:[2,116],129:[2,116],130:[2,116]},{12:[2,117],28:[2,117],30:[2,117],31:[2,117],33:[2,117],34:[2,117],35:[2,117],36:[2,117],37:[2,117],38:[2,117],45:[2,117],46:[2,117],47:[2,117],51:[2,117],52:[2,117],72:[2,117],75:[2,117],78:[2,117],82:[2,117],87:[2,117],88:[2,117],89:[2,117],95:[2,117],99:[2,117],100:[2,117],103:[2,117],105:[2,117],107:[2,117],109:[2,117],118:[2,117],124:[2,117],126:[2,117],127:[2,117],128:[2,117],129:[2,117],130:[2,117]},{1:[2,86],6:[2,86],25:[2,86],26:[2,86],40:[2,86],49:[2,86],54:[2,86],57:[2,86],66:[2,86],67:[2,86],68:[2,86],70:[2,86],72:[2,86],73:[2,86],77:[2,86],79:[2,86],83:[2,86],84:[2,86],85:[2,86],90:[2,86],92:[2,86],101:[2,86],103:[2,86],104:[2,86],105:[2,86],109:[2,86],117:[2,86],125:[2,86],127:[2,86],128:[2,86],129:[2,86],130:[2,86],131:[2,86],132:[2,86],133:[2,86],134:[2,86],135:[2,86],136:[2,86],137:[2,86]},{1:[2,104],6:[2,104],25:[2,104],26:[2,104],49:[2,104],54:[2,104],57:[2,104],66:[2,104],67:[2,104],68:[2,104],70:[2,104],72:[2,104],73:[2,104],77:[2,104],83:[2,104],84:[2,104],85:[2,104],90:[2,104],92:[2,104],101:[2,104],103:[2,104],104:[2,104],105:[2,104],109:[2,104],117:[2,104],125:[2,104],127:[2,104],128:[2,104],131:[2,104],132:[2,104],133:[2,104],134:[2,104],135:[2,104],136:[2,104]},{1:[2,36],6:[2,36],25:[2,36],26:[2,36],49:[2,36],54:[2,36],57:[2,36],72:[2,36],77:[2,36],85:[2,36],90:[2,36],92:[2,36],101:[2,36],102:87,103:[2,36],104:[2,36],105:[2,36],108:88,109:[2,36],110:69,117:[2,36],125:[2,36],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{8:241,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:242,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,109],6:[2,109],25:[2,109],26:[2,109],49:[2,109],54:[2,109],57:[2,109],66:[2,109],67:[2,109],68:[2,109],70:[2,109],72:[2,109],73:[2,109],77:[2,109],83:[2,109],84:[2,109],85:[2,109],90:[2,109],92:[2,109],101:[2,109],103:[2,109],104:[2,109],105:[2,109],109:[2,109],117:[2,109],125:[2,109],127:[2,109],128:[2,109],131:[2,109],132:[2,109],133:[2,109],134:[2,109],135:[2,109],136:[2,109]},{6:[2,53],25:[2,53],53:243,54:[1,226],85:[2,53]},{6:[2,128],25:[2,128],26:[2,128],54:[2,128],57:[1,244],85:[2,128],90:[2,128],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{50:245,51:[1,60],52:[1,61]},{6:[2,54],25:[2,54],26:[2,54],27:109,28:[1,73],44:110,55:246,56:108,58:111,59:112,75:[1,70],88:[1,113],89:[1,114]},{6:[1,247],25:[1,248]},{6:[2,61],25:[2,61],26:[2,61],49:[2,61],54:[2,61]},{8:249,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,199],6:[2,199],25:[2,199],26:[2,199],49:[2,199],54:[2,199],57:[2,199],72:[2,199],77:[2,199],85:[2,199],90:[2,199],92:[2,199],101:[2,199],102:87,103:[2,199],104:[2,199],105:[2,199],108:88,109:[2,199],110:69,117:[2,199],125:[2,199],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{8:250,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,201],6:[2,201],25:[2,201],26:[2,201],49:[2,201],54:[2,201],57:[2,201],72:[2,201],77:[2,201],85:[2,201],90:[2,201],92:[2,201],101:[2,201],102:87,103:[2,201],104:[2,201],105:[2,201],108:88,109:[2,201],110:69,117:[2,201],125:[2,201],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,181],6:[2,181],25:[2,181],26:[2,181],49:[2,181],54:[2,181],57:[2,181],72:[2,181],77:[2,181],85:[2,181],90:[2,181],92:[2,181],101:[2,181],103:[2,181],104:[2,181],105:[2,181],109:[2,181],117:[2,181],125:[2,181],127:[2,181],128:[2,181],131:[2,181],132:[2,181],133:[2,181],134:[2,181],135:[2,181],136:[2,181]},{8:251,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,133],6:[2,133],25:[2,133],26:[2,133],49:[2,133],54:[2,133],57:[2,133],72:[2,133],77:[2,133],85:[2,133],90:[2,133],92:[2,133],97:[1,252],101:[2,133],103:[2,133],104:[2,133],105:[2,133],109:[2,133],117:[2,133],125:[2,133],127:[2,133],128:[2,133],131:[2,133],132:[2,133],133:[2,133],134:[2,133],135:[2,133],136:[2,133]},{5:253,25:[1,5]},{27:254,28:[1,73]},{119:255,121:216,122:[1,217]},{26:[1,256],120:[1,257],121:258,122:[1,217]},{26:[2,174],120:[2,174],122:[2,174]},{8:260,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],94:259,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,97],5:261,6:[2,97],25:[1,5],26:[2,97],49:[2,97],54:[2,97],57:[2,97],72:[2,97],77:[2,97],85:[2,97],90:[2,97],92:[2,97],101:[2,97],102:87,103:[1,65],104:[2,97],105:[1,66],108:88,109:[1,68],110:69,117:[2,97],125:[2,97],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,100],6:[2,100],25:[2,100],26:[2,100],49:[2,100],54:[2,100],57:[2,100],72:[2,100],77:[2,100],85:[2,100],90:[2,100],92:[2,100],101:[2,100],103:[2,100],104:[2,100],105:[2,100],109:[2,100],117:[2,100],125:[2,100],127:[2,100],128:[2,100],131:[2,100],132:[2,100],133:[2,100],134:[2,100],135:[2,100],136:[2,100]},{8:262,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,138],6:[2,138],25:[2,138],26:[2,138],49:[2,138],54:[2,138],57:[2,138],66:[2,138],67:[2,138],68:[2,138],70:[2,138],72:[2,138],73:[2,138],77:[2,138],83:[2,138],84:[2,138],85:[2,138],90:[2,138],92:[2,138],101:[2,138],103:[2,138],104:[2,138],105:[2,138],109:[2,138],117:[2,138],125:[2,138],127:[2,138],128:[2,138],131:[2,138],132:[2,138],133:[2,138],134:[2,138],135:[2,138],136:[2,138]},{6:[1,74],26:[1,263]},{8:264,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,67],12:[2,117],25:[2,67],28:[2,117],30:[2,117],31:[2,117],33:[2,117],34:[2,117],35:[2,117],36:[2,117],37:[2,117],38:[2,117],45:[2,117],46:[2,117],47:[2,117],51:[2,117],52:[2,117],54:[2,67],75:[2,117],78:[2,117],82:[2,117],87:[2,117],88:[2,117],89:[2,117],90:[2,67],95:[2,117],99:[2,117],100:[2,117],103:[2,117],105:[2,117],107:[2,117],109:[2,117],118:[2,117],124:[2,117],126:[2,117],127:[2,117],128:[2,117],129:[2,117],130:[2,117]},{6:[1,266],25:[1,267],90:[1,265]},{6:[2,54],8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[2,54],26:[2,54],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],85:[2,54],87:[1,58],88:[1,59],89:[1,57],90:[2,54],93:268,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,53],25:[2,53],26:[2,53],53:269,54:[1,226]},{1:[2,178],6:[2,178],25:[2,178],26:[2,178],49:[2,178],54:[2,178],57:[2,178],72:[2,178],77:[2,178],85:[2,178],90:[2,178],92:[2,178],101:[2,178],103:[2,178],104:[2,178],105:[2,178],109:[2,178],117:[2,178],120:[2,178],125:[2,178],127:[2,178],128:[2,178],131:[2,178],132:[2,178],133:[2,178],134:[2,178],135:[2,178],136:[2,178]},{8:270,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:271,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{115:[2,156],116:[2,156]},{27:158,28:[1,73],44:159,58:160,59:161,75:[1,70],88:[1,113],89:[1,114],114:272},{1:[2,163],6:[2,163],25:[2,163],26:[2,163],49:[2,163],54:[2,163],57:[2,163],72:[2,163],77:[2,163],85:[2,163],90:[2,163],92:[2,163],101:[2,163],102:87,103:[2,163],104:[1,273],105:[2,163],108:88,109:[2,163],110:69,117:[1,274],125:[2,163],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,164],6:[2,164],25:[2,164],26:[2,164],49:[2,164],54:[2,164],57:[2,164],72:[2,164],77:[2,164],85:[2,164],90:[2,164],92:[2,164],101:[2,164],102:87,103:[2,164],104:[1,275],105:[2,164],108:88,109:[2,164],110:69,117:[2,164],125:[2,164],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[1,277],25:[1,278],77:[1,276]},{6:[2,54],11:168,25:[2,54],26:[2,54],27:169,28:[1,73],29:170,30:[1,71],31:[1,72],41:279,42:167,44:171,46:[1,46],77:[2,54],88:[1,113]},{8:280,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,281],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,85],6:[2,85],25:[2,85],26:[2,85],40:[2,85],49:[2,85],54:[2,85],57:[2,85],66:[2,85],67:[2,85],68:[2,85],70:[2,85],72:[2,85],73:[2,85],77:[2,85],79:[2,85],83:[2,85],84:[2,85],85:[2,85],90:[2,85],92:[2,85],101:[2,85],103:[2,85],104:[2,85],105:[2,85],109:[2,85],117:[2,85],125:[2,85],127:[2,85],128:[2,85],129:[2,85],130:[2,85],131:[2,85],132:[2,85],133:[2,85],134:[2,85],135:[2,85],136:[2,85],137:[2,85]},{8:282,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,72:[2,120],75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{72:[2,121],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,37],6:[2,37],25:[2,37],26:[2,37],49:[2,37],54:[2,37],57:[2,37],72:[2,37],77:[2,37],85:[2,37],90:[2,37],92:[2,37],101:[2,37],102:87,103:[2,37],104:[2,37],105:[2,37],108:88,109:[2,37],110:69,117:[2,37],125:[2,37],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{26:[1,283],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[1,266],25:[1,267],85:[1,284]},{6:[2,67],25:[2,67],26:[2,67],54:[2,67],85:[2,67],90:[2,67]},{5:285,25:[1,5]},{6:[2,57],25:[2,57],26:[2,57],49:[2,57],54:[2,57]},{27:109,28:[1,73],44:110,55:286,56:108,58:111,59:112,75:[1,70],88:[1,113],89:[1,114]},{6:[2,55],25:[2,55],26:[2,55],27:109,28:[1,73],44:110,48:287,54:[2,55],55:107,56:108,58:111,59:112,75:[1,70],88:[1,113],89:[1,114]},{6:[2,62],25:[2,62],26:[2,62],49:[2,62],54:[2,62],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{26:[1,288],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{5:289,25:[1,5],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{5:290,25:[1,5]},{1:[2,134],6:[2,134],25:[2,134],26:[2,134],49:[2,134],54:[2,134],57:[2,134],72:[2,134],77:[2,134],85:[2,134],90:[2,134],92:[2,134],101:[2,134],103:[2,134],104:[2,134],105:[2,134],109:[2,134],117:[2,134],125:[2,134],127:[2,134],128:[2,134],131:[2,134],132:[2,134],133:[2,134],134:[2,134],135:[2,134],136:[2,134]},{5:291,25:[1,5]},{26:[1,292],120:[1,293],121:258,122:[1,217]},{1:[2,172],6:[2,172],25:[2,172],26:[2,172],49:[2,172],54:[2,172],57:[2,172],72:[2,172],77:[2,172],85:[2,172],90:[2,172],92:[2,172],101:[2,172],103:[2,172],104:[2,172],105:[2,172],109:[2,172],117:[2,172],125:[2,172],127:[2,172],128:[2,172],131:[2,172],132:[2,172],133:[2,172],134:[2,172],135:[2,172],136:[2,172]},{5:294,25:[1,5]},{26:[2,175],120:[2,175],122:[2,175]},{5:295,25:[1,5],54:[1,296]},{25:[2,130],54:[2,130],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,98],6:[2,98],25:[2,98],26:[2,98],49:[2,98],54:[2,98],57:[2,98],72:[2,98],77:[2,98],85:[2,98],90:[2,98],92:[2,98],101:[2,98],103:[2,98],104:[2,98],105:[2,98],109:[2,98],117:[2,98],125:[2,98],127:[2,98],128:[2,98],131:[2,98],132:[2,98],133:[2,98],134:[2,98],135:[2,98],136:[2,98]},{1:[2,101],5:297,6:[2,101],25:[1,5],26:[2,101],49:[2,101],54:[2,101],57:[2,101],72:[2,101],77:[2,101],85:[2,101],90:[2,101],92:[2,101],101:[2,101],102:87,103:[1,65],104:[2,101],105:[1,66],108:88,109:[1,68],110:69,117:[2,101],125:[2,101],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{101:[1,298]},{90:[1,299],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,115],6:[2,115],25:[2,115],26:[2,115],40:[2,115],49:[2,115],54:[2,115],57:[2,115],66:[2,115],67:[2,115],68:[2,115],70:[2,115],72:[2,115],73:[2,115],77:[2,115],83:[2,115],84:[2,115],85:[2,115],90:[2,115],92:[2,115],101:[2,115],103:[2,115],104:[2,115],105:[2,115],109:[2,115],115:[2,115],116:[2,115],117:[2,115],125:[2,115],127:[2,115],128:[2,115],131:[2,115],132:[2,115],133:[2,115],134:[2,115],135:[2,115],136:[2,115]},{8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],93:300,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:200,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,25:[1,146],27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,60:147,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],86:301,87:[1,58],88:[1,59],89:[1,57],93:145,95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[2,124],25:[2,124],26:[2,124],54:[2,124],85:[2,124],90:[2,124]},{6:[1,266],25:[1,267],26:[1,302]},{1:[2,141],6:[2,141],25:[2,141],26:[2,141],49:[2,141],54:[2,141],57:[2,141],72:[2,141],77:[2,141],85:[2,141],90:[2,141],92:[2,141],101:[2,141],102:87,103:[1,65],104:[2,141],105:[1,66],108:88,109:[1,68],110:69,117:[2,141],125:[2,141],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,143],6:[2,143],25:[2,143],26:[2,143],49:[2,143],54:[2,143],57:[2,143],72:[2,143],77:[2,143],85:[2,143],90:[2,143],92:[2,143],101:[2,143],102:87,103:[1,65],104:[2,143],105:[1,66],108:88,109:[1,68],110:69,117:[2,143],125:[2,143],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{115:[2,162],116:[2,162]},{8:303,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:304,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:305,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,89],6:[2,89],25:[2,89],26:[2,89],40:[2,89],49:[2,89],54:[2,89],57:[2,89],66:[2,89],67:[2,89],68:[2,89],70:[2,89],72:[2,89],73:[2,89],77:[2,89],83:[2,89],84:[2,89],85:[2,89],90:[2,89],92:[2,89],101:[2,89],103:[2,89],104:[2,89],105:[2,89],109:[2,89],115:[2,89],116:[2,89],117:[2,89],125:[2,89],127:[2,89],128:[2,89],131:[2,89],132:[2,89],133:[2,89],134:[2,89],135:[2,89],136:[2,89]},{11:168,27:169,28:[1,73],29:170,30:[1,71],31:[1,72],41:306,42:167,44:171,46:[1,46],88:[1,113]},{6:[2,90],11:168,25:[2,90],26:[2,90],27:169,28:[1,73],29:170,30:[1,71],31:[1,72],41:166,42:167,44:171,46:[1,46],54:[2,90],76:307,88:[1,113]},{6:[2,92],25:[2,92],26:[2,92],54:[2,92],77:[2,92]},{6:[2,40],25:[2,40],26:[2,40],54:[2,40],77:[2,40],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{8:308,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{72:[2,119],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,38],6:[2,38],25:[2,38],26:[2,38],49:[2,38],54:[2,38],57:[2,38],72:[2,38],77:[2,38],85:[2,38],90:[2,38],92:[2,38],101:[2,38],103:[2,38],104:[2,38],105:[2,38],109:[2,38],117:[2,38],125:[2,38],127:[2,38],128:[2,38],131:[2,38],132:[2,38],133:[2,38],134:[2,38],135:[2,38],136:[2,38]},{1:[2,110],6:[2,110],25:[2,110],26:[2,110],49:[2,110],54:[2,110],57:[2,110],66:[2,110],67:[2,110],68:[2,110],70:[2,110],72:[2,110],73:[2,110],77:[2,110],83:[2,110],84:[2,110],85:[2,110],90:[2,110],92:[2,110],101:[2,110],103:[2,110],104:[2,110],105:[2,110],109:[2,110],117:[2,110],125:[2,110],127:[2,110],128:[2,110],131:[2,110],132:[2,110],133:[2,110],134:[2,110],135:[2,110],136:[2,110]},{1:[2,49],6:[2,49],25:[2,49],26:[2,49],49:[2,49],54:[2,49],57:[2,49],72:[2,49],77:[2,49],85:[2,49],90:[2,49],92:[2,49],101:[2,49],103:[2,49],104:[2,49],105:[2,49],109:[2,49],117:[2,49],125:[2,49],127:[2,49],128:[2,49],131:[2,49],132:[2,49],133:[2,49],134:[2,49],135:[2,49],136:[2,49]},{6:[2,58],25:[2,58],26:[2,58],49:[2,58],54:[2,58]},{6:[2,53],25:[2,53],26:[2,53],53:309,54:[1,202]},{1:[2,200],6:[2,200],25:[2,200],26:[2,200],49:[2,200],54:[2,200],57:[2,200],72:[2,200],77:[2,200],85:[2,200],90:[2,200],92:[2,200],101:[2,200],103:[2,200],104:[2,200],105:[2,200],109:[2,200],117:[2,200],125:[2,200],127:[2,200],128:[2,200],131:[2,200],132:[2,200],133:[2,200],134:[2,200],135:[2,200],136:[2,200]},{1:[2,179],6:[2,179],25:[2,179],26:[2,179],49:[2,179],54:[2,179],57:[2,179],72:[2,179],77:[2,179],85:[2,179],90:[2,179],92:[2,179],101:[2,179],103:[2,179],104:[2,179],105:[2,179],109:[2,179],117:[2,179],120:[2,179],125:[2,179],127:[2,179],128:[2,179],131:[2,179],132:[2,179],133:[2,179],134:[2,179],135:[2,179],136:[2,179]},{1:[2,135],6:[2,135],25:[2,135],26:[2,135],49:[2,135],54:[2,135],57:[2,135],72:[2,135],77:[2,135],85:[2,135],90:[2,135],92:[2,135],101:[2,135],103:[2,135],104:[2,135],105:[2,135],109:[2,135],117:[2,135],125:[2,135],127:[2,135],128:[2,135],131:[2,135],132:[2,135],133:[2,135],134:[2,135],135:[2,135],136:[2,135]},{1:[2,136],6:[2,136],25:[2,136],26:[2,136],49:[2,136],54:[2,136],57:[2,136],72:[2,136],77:[2,136],85:[2,136],90:[2,136],92:[2,136],97:[2,136],101:[2,136],103:[2,136],104:[2,136],105:[2,136],109:[2,136],117:[2,136],125:[2,136],127:[2,136],128:[2,136],131:[2,136],132:[2,136],133:[2,136],134:[2,136],135:[2,136],136:[2,136]},{1:[2,170],6:[2,170],25:[2,170],26:[2,170],49:[2,170],54:[2,170],57:[2,170],72:[2,170],77:[2,170],85:[2,170],90:[2,170],92:[2,170],101:[2,170],103:[2,170],104:[2,170],105:[2,170],109:[2,170],117:[2,170],125:[2,170],127:[2,170],128:[2,170],131:[2,170],132:[2,170],133:[2,170],134:[2,170],135:[2,170],136:[2,170]},{5:310,25:[1,5]},{26:[1,311]},{6:[1,312],26:[2,176],120:[2,176],122:[2,176]},{8:313,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{1:[2,102],6:[2,102],25:[2,102],26:[2,102],49:[2,102],54:[2,102],57:[2,102],72:[2,102],77:[2,102],85:[2,102],90:[2,102],92:[2,102],101:[2,102],103:[2,102],104:[2,102],105:[2,102],109:[2,102],117:[2,102],125:[2,102],127:[2,102],128:[2,102],131:[2,102],132:[2,102],133:[2,102],134:[2,102],135:[2,102],136:[2,102]},{1:[2,139],6:[2,139],25:[2,139],26:[2,139],49:[2,139],54:[2,139],57:[2,139],66:[2,139],67:[2,139],68:[2,139],70:[2,139],72:[2,139],73:[2,139],77:[2,139],83:[2,139],84:[2,139],85:[2,139],90:[2,139],92:[2,139],101:[2,139],103:[2,139],104:[2,139],105:[2,139],109:[2,139],117:[2,139],125:[2,139],127:[2,139],128:[2,139],131:[2,139],132:[2,139],133:[2,139],134:[2,139],135:[2,139],136:[2,139]},{1:[2,118],6:[2,118],25:[2,118],26:[2,118],49:[2,118],54:[2,118],57:[2,118],66:[2,118],67:[2,118],68:[2,118],70:[2,118],72:[2,118],73:[2,118],77:[2,118],83:[2,118],84:[2,118],85:[2,118],90:[2,118],92:[2,118],101:[2,118],103:[2,118],104:[2,118],105:[2,118],109:[2,118],117:[2,118],125:[2,118],127:[2,118],128:[2,118],131:[2,118],132:[2,118],133:[2,118],134:[2,118],135:[2,118],136:[2,118]},{6:[2,125],25:[2,125],26:[2,125],54:[2,125],85:[2,125],90:[2,125]},{6:[2,53],25:[2,53],26:[2,53],53:314,54:[1,226]},{6:[2,126],25:[2,126],26:[2,126],54:[2,126],85:[2,126],90:[2,126]},{1:[2,165],6:[2,165],25:[2,165],26:[2,165],49:[2,165],54:[2,165],57:[2,165],72:[2,165],77:[2,165],85:[2,165],90:[2,165],92:[2,165],101:[2,165],102:87,103:[2,165],104:[2,165],105:[2,165],108:88,109:[2,165],110:69,117:[1,315],125:[2,165],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,167],6:[2,167],25:[2,167],26:[2,167],49:[2,167],54:[2,167],57:[2,167],72:[2,167],77:[2,167],85:[2,167],90:[2,167],92:[2,167],101:[2,167],102:87,103:[2,167],104:[1,316],105:[2,167],108:88,109:[2,167],110:69,117:[2,167],125:[2,167],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,166],6:[2,166],25:[2,166],26:[2,166],49:[2,166],54:[2,166],57:[2,166],72:[2,166],77:[2,166],85:[2,166],90:[2,166],92:[2,166],101:[2,166],102:87,103:[2,166],104:[2,166],105:[2,166],108:88,109:[2,166],110:69,117:[2,166],125:[2,166],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[2,93],25:[2,93],26:[2,93],54:[2,93],77:[2,93]},{6:[2,53],25:[2,53],26:[2,53],53:317,54:[1,236]},{26:[1,318],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[1,247],25:[1,248],26:[1,319]},{26:[1,320]},{1:[2,173],6:[2,173],25:[2,173],26:[2,173],49:[2,173],54:[2,173],57:[2,173],72:[2,173],77:[2,173],85:[2,173],90:[2,173],92:[2,173],101:[2,173],103:[2,173],104:[2,173],105:[2,173],109:[2,173],117:[2,173],125:[2,173],127:[2,173],128:[2,173],131:[2,173],132:[2,173],133:[2,173],134:[2,173],135:[2,173],136:[2,173]},{26:[2,177],120:[2,177],122:[2,177]},{25:[2,131],54:[2,131],102:87,103:[1,65],105:[1,66],108:88,109:[1,68],110:69,125:[1,86],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[1,266],25:[1,267],26:[1,321]},{8:322,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{8:323,9:117,10:20,11:21,12:[1,22],13:8,14:9,15:10,16:11,17:12,18:13,19:14,20:15,21:16,22:17,23:18,24:19,27:62,28:[1,73],29:49,30:[1,71],31:[1,72],32:24,33:[1,50],34:[1,51],35:[1,52],36:[1,53],37:[1,54],38:[1,55],39:23,44:63,45:[1,45],46:[1,46],47:[1,29],50:30,51:[1,60],52:[1,61],58:47,59:48,61:36,63:25,64:26,65:27,75:[1,70],78:[1,43],82:[1,28],87:[1,58],88:[1,59],89:[1,57],95:[1,38],99:[1,44],100:[1,56],102:39,103:[1,65],105:[1,66],106:40,107:[1,67],108:41,109:[1,68],110:69,118:[1,42],123:37,124:[1,64],126:[1,31],127:[1,32],128:[1,33],129:[1,34],130:[1,35]},{6:[1,277],25:[1,278],26:[1,324]},{6:[2,41],25:[2,41],26:[2,41],54:[2,41],77:[2,41]},{6:[2,59],25:[2,59],26:[2,59],49:[2,59],54:[2,59]},{1:[2,171],6:[2,171],25:[2,171],26:[2,171],49:[2,171],54:[2,171],57:[2,171],72:[2,171],77:[2,171],85:[2,171],90:[2,171],92:[2,171],101:[2,171],103:[2,171],104:[2,171],105:[2,171],109:[2,171],117:[2,171],125:[2,171],127:[2,171],128:[2,171],131:[2,171],132:[2,171],133:[2,171],134:[2,171],135:[2,171],136:[2,171]},{6:[2,127],25:[2,127],26:[2,127],54:[2,127],85:[2,127],90:[2,127]},{1:[2,168],6:[2,168],25:[2,168],26:[2,168],49:[2,168],54:[2,168],57:[2,168],72:[2,168],77:[2,168],85:[2,168],90:[2,168],92:[2,168],101:[2,168],102:87,103:[2,168],104:[2,168],105:[2,168],108:88,109:[2,168],110:69,117:[2,168],125:[2,168],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{1:[2,169],6:[2,169],25:[2,169],26:[2,169],49:[2,169],54:[2,169],57:[2,169],72:[2,169],77:[2,169],85:[2,169],90:[2,169],92:[2,169],101:[2,169],102:87,103:[2,169],104:[2,169],105:[2,169],108:88,109:[2,169],110:69,117:[2,169],125:[2,169],127:[1,80],128:[1,79],131:[1,78],132:[1,81],133:[1,82],134:[1,83],135:[1,84],136:[1,85]},{6:[2,94],25:[2,94],26:[2,94],54:[2,94],77:[2,94]}], +defaultActions: {60:[2,51],61:[2,52],75:[2,3],94:[2,108],189:[2,88]}, +parseError: function parseError(str, hash) { + throw new Error(str); +}, +parse: function parse(input) { + var self = this, + stack = [0], + vstack = [null], // semantic value stack + lstack = [], // location stack + table = this.table, + yytext = '', + yylineno = 0, + yyleng = 0, + recovering = 0, + TERROR = 2, + EOF = 1; + + //this.reductionCount = this.shiftCount = 0; + + this.lexer.setInput(input); + this.lexer.yy = this.yy; + this.yy.lexer = this.lexer; + if (typeof this.lexer.yylloc == 'undefined') + this.lexer.yylloc = {}; + var yyloc = this.lexer.yylloc; + lstack.push(yyloc); + + if (typeof this.yy.parseError === 'function') + this.parseError = this.yy.parseError; + + function popStack (n) { + stack.length = stack.length - 2*n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + + function lex() { + var token; + token = self.lexer.lex() || 1; // $end = 1 + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + return token; + } + + var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected; + while (true) { + // retreive state number from top of stack + state = stack[stack.length-1]; + + // use default actions if available + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol == null) + symbol = lex(); + // read action for current state and first input + action = table[state] && table[state][symbol]; + } + + // handle parse error + _handle_error: + if (typeof action === 'undefined' || !action.length || !action[0]) { + + if (!recovering) { + // Report error + expected = []; + for (p in table[state]) if (this.terminals_[p] && p > 2) { + expected.push("'"+this.terminals_[p]+"'"); + } + var errStr = ''; + if (this.lexer.showPosition) { + errStr = 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(', ') + ", got '" + this.terminals_[symbol]+ "'"; + } else { + errStr = 'Parse error on line '+(yylineno+1)+": Unexpected " + + (symbol == 1 /*EOF*/ ? "end of input" : + ("'"+(this.terminals_[symbol] || symbol)+"'")); + } + this.parseError(errStr, + {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); + } + + // just recovered from another error + if (recovering == 3) { + if (symbol == EOF) { + throw new Error(errStr || 'Parsing halted.'); + } + + // discard current lookahead and grab another + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + symbol = lex(); + } + + // try to recover from error + while (1) { + // check for error recovery rule in this state + if ((TERROR.toString()) in table[state]) { + break; + } + if (state == 0) { + throw new Error(errStr || 'Parsing halted.'); + } + popStack(1); + state = stack[stack.length-1]; + } + + preErrorSymbol = symbol; // save the lookahead token + symbol = TERROR; // insert generic error symbol as new lookahead + state = stack[stack.length-1]; + action = table[state] && table[state][TERROR]; + recovering = 3; // allow 3 real symbols to be shifted before reporting a new error + } + + // this shouldn't happen, unless resolve defaults are off + if (action[0] instanceof Array && action.length > 1) { + throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol); + } + + switch (action[0]) { + + case 1: // shift + //this.shiftCount++; + + stack.push(symbol); + vstack.push(this.lexer.yytext); + lstack.push(this.lexer.yylloc); + stack.push(action[1]); // push state + symbol = null; + if (!preErrorSymbol) { // normal execution/no error + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + if (recovering > 0) + recovering--; + } else { // error just occurred, resume old lookahead f/ before error + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + + case 2: // reduce + //this.reductionCount++; + + len = this.productions_[action[1]][1]; + + // perform semantic action + yyval.$ = vstack[vstack.length-len]; // default to $$ = $1 + // default location, uses first token for firsts, last for lasts + yyval._$ = { + first_line: lstack[lstack.length-(len||1)].first_line, + last_line: lstack[lstack.length-1].last_line, + first_column: lstack[lstack.length-(len||1)].first_column, + last_column: lstack[lstack.length-1].last_column + }; + r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); + + if (typeof r !== 'undefined') { + return r; + } + + // pop off stack + if (len) { + stack = stack.slice(0,-1*len*2); + vstack = vstack.slice(0, -1*len); + lstack = lstack.slice(0, -1*len); + } + + stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce) + vstack.push(yyval.$); + lstack.push(yyval._$); + // goto new state = table[STATE][NONTERMINAL] + newState = table[stack[stack.length-2]][stack[stack.length-1]]; + stack.push(newState); + break; + + case 3: // accept + return true; + } + + } + + return true; +}}; +undefined +return parser; +})(); +if (typeof require !== 'undefined' && typeof exports !== 'undefined') { +exports.parser = parser; +exports.parse = function () { return parser.parse.apply(parser, arguments); } +exports.main = function commonjsMain(args) { + if (!args[1]) + throw new Error('Usage: '+args[0]+' FILE'); + if (typeof process !== 'undefined') { + var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8"); + } else { + var cwd = require("file").path(require("file").cwd()); + var source = cwd.join(args[1]).read({charset: "utf-8"}); + } + return exports.parser.parse(source); +} +if (typeof module !== 'undefined' && require.main === module) { + exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args); +} +} \ No newline at end of file diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/repl.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/repl.js new file mode 100644 index 0000000..b4a4765 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/repl.js @@ -0,0 +1,261 @@ +// Generated by CoffeeScript 1.3.3 +(function() { + var ACCESSOR, CoffeeScript, Module, REPL_PROMPT, REPL_PROMPT_CONTINUATION, REPL_PROMPT_MULTILINE, SIMPLEVAR, Script, autocomplete, backlog, completeAttribute, completeVariable, enableColours, error, getCompletions, inspect, multilineMode, pipedInput, readline, repl, run, stdin, stdout; + + stdin = process.openStdin(); + + stdout = process.stdout; + + CoffeeScript = require('./coffee-script'); + + readline = require('readline'); + + inspect = require('util').inspect; + + Script = require('vm').Script; + + Module = require('module'); + + REPL_PROMPT = 'coffee> '; + + REPL_PROMPT_MULTILINE = '------> '; + + REPL_PROMPT_CONTINUATION = '......> '; + + enableColours = false; + + if (process.platform !== 'win32') { + enableColours = !process.env.NODE_DISABLE_COLORS; + } + + error = function(err) { + return stdout.write((err.stack || err.toString()) + '\n'); + }; + + ACCESSOR = /\s*([\w\.]+)(?:\.(\w*))$/; + + SIMPLEVAR = /(\w+)$/i; + + autocomplete = function(text) { + return completeAttribute(text) || completeVariable(text) || [[], text]; + }; + + completeAttribute = function(text) { + var all, completions, key, match, obj, possibilities, prefix, val; + if (match = text.match(ACCESSOR)) { + all = match[0], obj = match[1], prefix = match[2]; + try { + val = Script.runInThisContext(obj); + } catch (error) { + return; + } + val = Object(val); + possibilities = Object.getOwnPropertyNames(val); + for (key in val) { + if (~possibilities.indexOf(val)) { + possibilities.push(key); + } + } + completions = getCompletions(prefix, possibilities); + return [completions, prefix]; + } + }; + + completeVariable = function(text) { + var completions, free, keywords, possibilities, r, vars, _ref; + free = (_ref = text.match(SIMPLEVAR)) != null ? _ref[1] : void 0; + if (text === "") { + free = ""; + } + if (free != null) { + vars = Script.runInThisContext('Object.getOwnPropertyNames(Object(this))'); + keywords = (function() { + var _i, _len, _ref1, _results; + _ref1 = CoffeeScript.RESERVED; + _results = []; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + r = _ref1[_i]; + if (r.slice(0, 2) !== '__') { + _results.push(r); + } + } + return _results; + })(); + possibilities = vars.concat(keywords); + completions = getCompletions(free, possibilities); + return [completions, free]; + } + }; + + getCompletions = function(prefix, candidates) { + var el, _i, _len, _results; + _results = []; + for (_i = 0, _len = candidates.length; _i < _len; _i++) { + el = candidates[_i]; + if (el.indexOf(prefix) === 0) { + _results.push(el); + } + } + return _results; + }; + + process.on('uncaughtException', error); + + backlog = ''; + + run = function(buffer) { + var code, returnValue, _; + buffer = buffer.replace(/(^|[\r\n]+)(\s*)##?(?:[^#\r\n][^\r\n]*|)($|[\r\n])/, "$1$2$3"); + buffer = buffer.replace(/[\r\n]+$/, ""); + if (multilineMode) { + backlog += "" + buffer + "\n"; + repl.setPrompt(REPL_PROMPT_CONTINUATION); + repl.prompt(); + return; + } + if (!buffer.toString().trim() && !backlog) { + repl.prompt(); + return; + } + code = backlog += buffer; + if (code[code.length - 1] === '\\') { + backlog = "" + backlog.slice(0, -1) + "\n"; + repl.setPrompt(REPL_PROMPT_CONTINUATION); + repl.prompt(); + return; + } + repl.setPrompt(REPL_PROMPT); + backlog = ''; + try { + _ = global._; + returnValue = CoffeeScript["eval"]("_=(" + code + "\n)", { + filename: 'repl', + modulename: 'repl' + }); + if (returnValue === void 0) { + global._ = _; + } + repl.output.write("" + (inspect(returnValue, false, 2, enableColours)) + "\n"); + } catch (err) { + error(err); + } + return repl.prompt(); + }; + + if (stdin.readable) { + pipedInput = ''; + repl = { + prompt: function() { + return stdout.write(this._prompt); + }, + setPrompt: function(p) { + return this._prompt = p; + }, + input: stdin, + output: stdout, + on: function() {} + }; + stdin.on('data', function(chunk) { + var line, lines, _i, _len, _ref; + pipedInput += chunk; + if (!/\n/.test(pipedInput)) { + return; + } + lines = pipedInput.split("\n"); + pipedInput = lines[lines.length - 1]; + _ref = lines.slice(0, -1); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + line = _ref[_i]; + if (!(line)) { + continue; + } + stdout.write("" + line + "\n"); + run(line); + } + }); + stdin.on('end', function() { + var line, _i, _len, _ref; + _ref = pipedInput.trim().split("\n"); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + line = _ref[_i]; + if (!(line)) { + continue; + } + stdout.write("" + line + "\n"); + run(line); + } + stdout.write('\n'); + return process.exit(0); + }); + } else { + if (readline.createInterface.length < 3) { + repl = readline.createInterface(stdin, autocomplete); + stdin.on('data', function(buffer) { + return repl.write(buffer); + }); + } else { + repl = readline.createInterface(stdin, stdout, autocomplete); + } + } + + multilineMode = false; + + repl.input.on('keypress', function(char, key) { + var cursorPos, newPrompt; + if (!(key && key.ctrl && !key.meta && !key.shift && key.name === 'v')) { + return; + } + cursorPos = repl.cursor; + repl.output.cursorTo(0); + repl.output.clearLine(1); + multilineMode = !multilineMode; + if (!multilineMode && backlog) { + repl._line(); + } + backlog = ''; + repl.setPrompt((newPrompt = multilineMode ? REPL_PROMPT_MULTILINE : REPL_PROMPT)); + repl.prompt(); + return repl.output.cursorTo(newPrompt.length + (repl.cursor = cursorPos)); + }); + + repl.input.on('keypress', function(char, key) { + if (!(multilineMode && repl.line)) { + return; + } + if (!(key && key.ctrl && !key.meta && !key.shift && key.name === 'd')) { + return; + } + multilineMode = false; + return repl._line(); + }); + + repl.on('attemptClose', function() { + if (multilineMode) { + multilineMode = false; + repl.output.cursorTo(0); + repl.output.clearLine(1); + repl._onLine(repl.line); + return; + } + if (backlog) { + backlog = ''; + repl.output.write('\n'); + repl.setPrompt(REPL_PROMPT); + return repl.prompt(); + } else { + return repl.close(); + } + }); + + repl.on('close', function() { + repl.output.write('\n'); + return repl.input.destroy(); + }); + + repl.on('line', run); + + repl.setPrompt(REPL_PROMPT); + + repl.prompt(); + +}).call(this); diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/rewriter.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/rewriter.js new file mode 100644 index 0000000..d26133c --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/rewriter.js @@ -0,0 +1,349 @@ +// Generated by CoffeeScript 1.3.3 +(function() { + var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_BLOCK, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, left, rite, _i, _len, _ref, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, + __slice = [].slice; + + exports.Rewriter = (function() { + + function Rewriter() {} + + Rewriter.prototype.rewrite = function(tokens) { + this.tokens = tokens; + this.removeLeadingNewlines(); + this.removeMidExpressionNewlines(); + this.closeOpenCalls(); + this.closeOpenIndexes(); + this.addImplicitIndentation(); + this.tagPostfixConditionals(); + this.addImplicitBraces(); + this.addImplicitParentheses(); + return this.tokens; + }; + + Rewriter.prototype.scanTokens = function(block) { + var i, token, tokens; + tokens = this.tokens; + i = 0; + while (token = tokens[i]) { + i += block.call(this, token, i, tokens); + } + return true; + }; + + Rewriter.prototype.detectEnd = function(i, condition, action) { + var levels, token, tokens, _ref, _ref1; + tokens = this.tokens; + levels = 0; + while (token = tokens[i]) { + if (levels === 0 && condition.call(this, token, i)) { + return action.call(this, token, i); + } + if (!token || levels < 0) { + return action.call(this, token, i - 1); + } + if (_ref = token[0], __indexOf.call(EXPRESSION_START, _ref) >= 0) { + levels += 1; + } else if (_ref1 = token[0], __indexOf.call(EXPRESSION_END, _ref1) >= 0) { + levels -= 1; + } + i += 1; + } + return i - 1; + }; + + Rewriter.prototype.removeLeadingNewlines = function() { + var i, tag, _i, _len, _ref; + _ref = this.tokens; + for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { + tag = _ref[i][0]; + if (tag !== 'TERMINATOR') { + break; + } + } + if (i) { + return this.tokens.splice(0, i); + } + }; + + Rewriter.prototype.removeMidExpressionNewlines = function() { + return this.scanTokens(function(token, i, tokens) { + var _ref; + if (!(token[0] === 'TERMINATOR' && (_ref = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref) >= 0))) { + return 1; + } + tokens.splice(i, 1); + return 0; + }); + }; + + Rewriter.prototype.closeOpenCalls = function() { + var action, condition; + condition = function(token, i) { + var _ref; + return ((_ref = token[0]) === ')' || _ref === 'CALL_END') || token[0] === 'OUTDENT' && this.tag(i - 1) === ')'; + }; + action = function(token, i) { + return this.tokens[token[0] === 'OUTDENT' ? i - 1 : i][0] = 'CALL_END'; + }; + return this.scanTokens(function(token, i) { + if (token[0] === 'CALL_START') { + this.detectEnd(i + 1, condition, action); + } + return 1; + }); + }; + + Rewriter.prototype.closeOpenIndexes = function() { + var action, condition; + condition = function(token, i) { + var _ref; + return (_ref = token[0]) === ']' || _ref === 'INDEX_END'; + }; + action = function(token, i) { + return token[0] = 'INDEX_END'; + }; + return this.scanTokens(function(token, i) { + if (token[0] === 'INDEX_START') { + this.detectEnd(i + 1, condition, action); + } + return 1; + }); + }; + + Rewriter.prototype.addImplicitBraces = function() { + var action, condition, sameLine, stack, start, startIndent, startIndex, startsLine; + stack = []; + start = null; + startsLine = null; + sameLine = true; + startIndent = 0; + startIndex = 0; + condition = function(token, i) { + var one, tag, three, two, _ref, _ref1; + _ref = this.tokens.slice(i + 1, (i + 3) + 1 || 9e9), one = _ref[0], two = _ref[1], three = _ref[2]; + if ('HERECOMMENT' === (one != null ? one[0] : void 0)) { + return false; + } + tag = token[0]; + if (__indexOf.call(LINEBREAKS, tag) >= 0) { + sameLine = false; + } + return (((tag === 'TERMINATOR' || tag === 'OUTDENT') || (__indexOf.call(IMPLICIT_END, tag) >= 0 && sameLine && !(i - startIndex === 1))) && ((!startsLine && this.tag(i - 1) !== ',') || !((two != null ? two[0] : void 0) === ':' || (one != null ? one[0] : void 0) === '@' && (three != null ? three[0] : void 0) === ':'))) || (tag === ',' && one && ((_ref1 = one[0]) !== 'IDENTIFIER' && _ref1 !== 'NUMBER' && _ref1 !== 'STRING' && _ref1 !== '@' && _ref1 !== 'TERMINATOR' && _ref1 !== 'OUTDENT')); + }; + action = function(token, i) { + var tok; + tok = this.generate('}', '}', token[2]); + return this.tokens.splice(i, 0, tok); + }; + return this.scanTokens(function(token, i, tokens) { + var ago, idx, prevTag, tag, tok, value, _ref, _ref1; + if (_ref = (tag = token[0]), __indexOf.call(EXPRESSION_START, _ref) >= 0) { + stack.push([(tag === 'INDENT' && this.tag(i - 1) === '{' ? '{' : tag), i]); + return 1; + } + if (__indexOf.call(EXPRESSION_END, tag) >= 0) { + start = stack.pop(); + return 1; + } + if (!(tag === ':' && ((ago = this.tag(i - 2)) === ':' || ((_ref1 = stack[stack.length - 1]) != null ? _ref1[0] : void 0) !== '{'))) { + return 1; + } + sameLine = true; + startIndex = i + 1; + stack.push(['{']); + idx = ago === '@' ? i - 2 : i - 1; + while (this.tag(idx - 2) === 'HERECOMMENT') { + idx -= 2; + } + prevTag = this.tag(idx - 1); + startsLine = !prevTag || (__indexOf.call(LINEBREAKS, prevTag) >= 0); + value = new String('{'); + value.generated = true; + tok = this.generate('{', value, token[2]); + tokens.splice(idx, 0, tok); + this.detectEnd(i + 2, condition, action); + return 2; + }); + }; + + Rewriter.prototype.addImplicitParentheses = function() { + var action, condition, noCall, seenControl, seenSingle; + noCall = seenSingle = seenControl = false; + condition = function(token, i) { + var post, tag, _ref, _ref1; + tag = token[0]; + if (!seenSingle && token.fromThen) { + return true; + } + if (tag === 'IF' || tag === 'ELSE' || tag === 'CATCH' || tag === '->' || tag === '=>' || tag === 'CLASS') { + seenSingle = true; + } + if (tag === 'IF' || tag === 'ELSE' || tag === 'SWITCH' || tag === 'TRY' || tag === '=') { + seenControl = true; + } + if ((tag === '.' || tag === '?.' || tag === '::') && this.tag(i - 1) === 'OUTDENT') { + return true; + } + return !token.generated && this.tag(i - 1) !== ',' && (__indexOf.call(IMPLICIT_END, tag) >= 0 || (tag === 'INDENT' && !seenControl)) && (tag !== 'INDENT' || (((_ref = this.tag(i - 2)) !== 'CLASS' && _ref !== 'EXTENDS') && (_ref1 = this.tag(i - 1), __indexOf.call(IMPLICIT_BLOCK, _ref1) < 0) && !((post = this.tokens[i + 1]) && post.generated && post[0] === '{'))); + }; + action = function(token, i) { + return this.tokens.splice(i, 0, this.generate('CALL_END', ')', token[2])); + }; + return this.scanTokens(function(token, i, tokens) { + var callObject, current, next, prev, tag, _ref, _ref1, _ref2; + tag = token[0]; + if (tag === 'CLASS' || tag === 'IF' || tag === 'FOR' || tag === 'WHILE') { + noCall = true; + } + _ref = tokens.slice(i - 1, (i + 1) + 1 || 9e9), prev = _ref[0], current = _ref[1], next = _ref[2]; + callObject = !noCall && tag === 'INDENT' && next && next.generated && next[0] === '{' && prev && (_ref1 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref1) >= 0); + seenSingle = false; + seenControl = false; + if (__indexOf.call(LINEBREAKS, tag) >= 0) { + noCall = false; + } + if (prev && !prev.spaced && tag === '?') { + token.call = true; + } + if (token.fromThen) { + return 1; + } + if (!(callObject || (prev != null ? prev.spaced : void 0) && (prev.call || (_ref2 = prev[0], __indexOf.call(IMPLICIT_FUNC, _ref2) >= 0)) && (__indexOf.call(IMPLICIT_CALL, tag) >= 0 || !(token.spaced || token.newLine) && __indexOf.call(IMPLICIT_UNSPACED_CALL, tag) >= 0))) { + return 1; + } + tokens.splice(i, 0, this.generate('CALL_START', '(', token[2])); + this.detectEnd(i + 1, condition, action); + if (prev[0] === '?') { + prev[0] = 'FUNC_EXIST'; + } + return 2; + }); + }; + + Rewriter.prototype.addImplicitIndentation = function() { + var action, condition, indent, outdent, starter; + starter = indent = outdent = null; + condition = function(token, i) { + var _ref; + return token[1] !== ';' && (_ref = token[0], __indexOf.call(SINGLE_CLOSERS, _ref) >= 0) && !(token[0] === 'ELSE' && (starter !== 'IF' && starter !== 'THEN')); + }; + action = function(token, i) { + return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent); + }; + return this.scanTokens(function(token, i, tokens) { + var tag, _ref, _ref1; + tag = token[0]; + if (tag === 'TERMINATOR' && this.tag(i + 1) === 'THEN') { + tokens.splice(i, 1); + return 0; + } + if (tag === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') { + tokens.splice.apply(tokens, [i, 0].concat(__slice.call(this.indentation(token)))); + return 2; + } + if (tag === 'CATCH' && ((_ref = this.tag(i + 2)) === 'OUTDENT' || _ref === 'TERMINATOR' || _ref === 'FINALLY')) { + tokens.splice.apply(tokens, [i + 2, 0].concat(__slice.call(this.indentation(token)))); + return 4; + } + if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) { + starter = tag; + _ref1 = this.indentation(token, true), indent = _ref1[0], outdent = _ref1[1]; + if (starter === 'THEN') { + indent.fromThen = true; + } + tokens.splice(i + 1, 0, indent); + this.detectEnd(i + 2, condition, action); + if (tag === 'THEN') { + tokens.splice(i, 1); + } + return 1; + } + return 1; + }); + }; + + Rewriter.prototype.tagPostfixConditionals = function() { + var action, condition, original; + original = null; + condition = function(token, i) { + var _ref; + return (_ref = token[0]) === 'TERMINATOR' || _ref === 'INDENT'; + }; + action = function(token, i) { + if (token[0] !== 'INDENT' || (token.generated && !token.fromThen)) { + return original[0] = 'POST_' + original[0]; + } + }; + return this.scanTokens(function(token, i) { + if (token[0] !== 'IF') { + return 1; + } + original = token; + this.detectEnd(i + 1, condition, action); + return 1; + }); + }; + + Rewriter.prototype.indentation = function(token, implicit) { + var indent, outdent; + if (implicit == null) { + implicit = false; + } + indent = ['INDENT', 2, token[2]]; + outdent = ['OUTDENT', 2, token[2]]; + if (implicit) { + indent.generated = outdent.generated = true; + } + return [indent, outdent]; + }; + + Rewriter.prototype.generate = function(tag, value, line) { + var tok; + tok = [tag, value, line]; + tok.generated = true; + return tok; + }; + + Rewriter.prototype.tag = function(i) { + var _ref; + return (_ref = this.tokens[i]) != null ? _ref[0] : void 0; + }; + + return Rewriter; + + })(); + + BALANCED_PAIRS = [['(', ')'], ['[', ']'], ['{', '}'], ['INDENT', 'OUTDENT'], ['CALL_START', 'CALL_END'], ['PARAM_START', 'PARAM_END'], ['INDEX_START', 'INDEX_END']]; + + exports.INVERSES = INVERSES = {}; + + EXPRESSION_START = []; + + EXPRESSION_END = []; + + for (_i = 0, _len = BALANCED_PAIRS.length; _i < _len; _i++) { + _ref = BALANCED_PAIRS[_i], left = _ref[0], rite = _ref[1]; + EXPRESSION_START.push(INVERSES[rite] = left); + EXPRESSION_END.push(INVERSES[left] = rite); + } + + EXPRESSION_CLOSE = ['CATCH', 'WHEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_END); + + IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS']; + + IMPLICIT_CALL = ['IDENTIFIER', 'NUMBER', 'STRING', 'JS', 'REGEX', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'BOOL', 'NULL', 'UNDEFINED', 'UNARY', 'SUPER', '@', '->', '=>', '[', '(', '{', '--', '++']; + + IMPLICIT_UNSPACED_CALL = ['+', '-']; + + IMPLICIT_BLOCK = ['->', '=>', '{', '[', ',']; + + IMPLICIT_END = ['POST_IF', 'FOR', 'WHILE', 'UNTIL', 'WHEN', 'BY', 'LOOP', 'TERMINATOR']; + + SINGLE_LINERS = ['ELSE', '->', '=>', 'TRY', 'FINALLY', 'THEN']; + + SINGLE_CLOSERS = ['TERMINATOR', 'CATCH', 'FINALLY', 'ELSE', 'OUTDENT', 'LEADING_WHEN']; + + LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT']; + +}).call(this); diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/scope.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/scope.js new file mode 100644 index 0000000..3efc4ed --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/lib/coffee-script/scope.js @@ -0,0 +1,146 @@ +// Generated by CoffeeScript 1.3.3 +(function() { + var Scope, extend, last, _ref; + + _ref = require('./helpers'), extend = _ref.extend, last = _ref.last; + + exports.Scope = Scope = (function() { + + Scope.root = null; + + function Scope(parent, expressions, method) { + this.parent = parent; + this.expressions = expressions; + this.method = method; + this.variables = [ + { + name: 'arguments', + type: 'arguments' + } + ]; + this.positions = {}; + if (!this.parent) { + Scope.root = this; + } + } + + Scope.prototype.add = function(name, type, immediate) { + if (this.shared && !immediate) { + return this.parent.add(name, type, immediate); + } + if (Object.prototype.hasOwnProperty.call(this.positions, name)) { + return this.variables[this.positions[name]].type = type; + } else { + return this.positions[name] = this.variables.push({ + name: name, + type: type + }) - 1; + } + }; + + Scope.prototype.namedMethod = function() { + if (this.method.name || !this.parent) { + return this.method; + } + return this.parent.namedMethod(); + }; + + Scope.prototype.find = function(name) { + if (this.check(name)) { + return true; + } + this.add(name, 'var'); + return false; + }; + + Scope.prototype.parameter = function(name) { + if (this.shared && this.parent.check(name, true)) { + return; + } + return this.add(name, 'param'); + }; + + Scope.prototype.check = function(name) { + var _ref1; + return !!(this.type(name) || ((_ref1 = this.parent) != null ? _ref1.check(name) : void 0)); + }; + + Scope.prototype.temporary = function(name, index) { + if (name.length > 1) { + return '_' + name + (index > 1 ? index - 1 : ''); + } else { + return '_' + (index + parseInt(name, 36)).toString(36).replace(/\d/g, 'a'); + } + }; + + Scope.prototype.type = function(name) { + var v, _i, _len, _ref1; + _ref1 = this.variables; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + v = _ref1[_i]; + if (v.name === name) { + return v.type; + } + } + return null; + }; + + Scope.prototype.freeVariable = function(name, reserve) { + var index, temp; + if (reserve == null) { + reserve = true; + } + index = 0; + while (this.check((temp = this.temporary(name, index)))) { + index++; + } + if (reserve) { + this.add(temp, 'var', true); + } + return temp; + }; + + Scope.prototype.assign = function(name, value) { + this.add(name, { + value: value, + assigned: true + }, true); + return this.hasAssignments = true; + }; + + Scope.prototype.hasDeclarations = function() { + return !!this.declaredVariables().length; + }; + + Scope.prototype.declaredVariables = function() { + var realVars, tempVars, v, _i, _len, _ref1; + realVars = []; + tempVars = []; + _ref1 = this.variables; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + v = _ref1[_i]; + if (v.type === 'var') { + (v.name.charAt(0) === '_' ? tempVars : realVars).push(v.name); + } + } + return realVars.sort().concat(tempVars.sort()); + }; + + Scope.prototype.assignedVariables = function() { + var v, _i, _len, _ref1, _results; + _ref1 = this.variables; + _results = []; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + v = _ref1[_i]; + if (v.type.assigned) { + _results.push("" + v.name + " = " + v.type.value); + } + } + return _results; + }; + + return Scope; + + })(); + +}).call(this); diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/package.json b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/package.json new file mode 100644 index 0000000..10b88a8 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/coffee-script/package.json @@ -0,0 +1,45 @@ +{ + "name": "coffee-script", + "description": "Unfancy JavaScript", + "keywords": [ + "javascript", + "language", + "coffeescript", + "compiler" + ], + "author": { + "name": "Jeremy Ashkenas" + }, + "version": "1.3.3", + "licenses": [ + { + "type": "MIT", + "url": "https://raw.github.com/jashkenas/coffee-script/master/LICENSE" + } + ], + "engines": { + "node": ">=0.4.0" + }, + "directories": { + "lib": "./lib/coffee-script" + }, + "main": "./lib/coffee-script/coffee-script", + "bin": { + "coffee": "./bin/coffee", + "cake": "./bin/cake" + }, + "homepage": "http://coffeescript.org", + "bugs": "https://github.com/jashkenas/coffee-script/issues", + "repository": { + "type": "git", + "url": "git://github.com/jashkenas/coffee-script.git" + }, + "devDependencies": { + "uglify-js": ">=1.0.0", + "jison": ">=0.2.0" + }, + "readme": "\n {\n } } {\n { { } }\n } }{ {\n { }{ } } _____ __ __\n ( }{ }{ { ) / ____| / _|/ _|\n .- { { } { }} -. | | ___ | |_| |_ ___ ___\n ( ( } { } { } } ) | | / _ \\| _| _/ _ \\/ _ \\\n |`-..________ ..-'| | |___| (_) | | | || __/ __/\n | | \\_____\\___/|_| |_| \\___|\\___|\n | ;--.\n | (__ \\ _____ _ _\n | | ) ) / ____| (_) | |\n | |/ / | (___ ___ _ __ _ _ __ | |_\n | ( / \\___ \\ / __| '__| | '_ \\| __|\n | |/ ____) | (__| | | | |_) | |_\n | | |_____/ \\___|_| |_| .__/ \\__|\n `-.._________..-' | |\n |_|\n\n\n CoffeeScript is a little language that compiles into JavaScript.\n\n Install Node.js, and then the CoffeeScript compiler:\n sudo bin/cake install\n\n Or, if you have the Node Package Manager installed:\n npm install -g coffee-script\n (Leave off the -g if you don't wish to install globally.)\n\n Execute a script:\n coffee /path/to/script.coffee\n\n Compile a script:\n coffee -c /path/to/script.coffee\n\n For documentation, usage, and examples, see:\n http://coffeescript.org/\n\n To suggest a feature, report a bug, or general discussion:\n http://github.com/jashkenas/coffee-script/issues/\n\n If you'd like to chat, drop by #coffeescript on Freenode IRC,\n or on webchat.freenode.net.\n\n The source repository:\n git://github.com/jashkenas/coffee-script.git\n\n All contributors are listed here:\n http://github.com/jashkenas/coffee-script/contributors\n", + "_id": "coffee-script@1.3.3", + "_from": "coffee-script@>=1.0.1", + "scripts": {} +} diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/.npmignore b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/.npmignore new file mode 100644 index 0000000..c9b568f --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/.npmignore @@ -0,0 +1,2 @@ +*.pyc +*.swp diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/LICENSE b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/LICENSE new file mode 100644 index 0000000..fcc702f --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2010 Larry Myers + +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. diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/README.markdown b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/README.markdown new file mode 100644 index 0000000..0c1f285 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/README.markdown @@ -0,0 +1,52 @@ +# Jasmine Reporters + +Jasmine Reporters is a collection of javascript jasmine.Reporter classes that can be used with +the [JasmineBDD testing framework](http://pivotal.github.com/jasmine/). + +Right now the project is focused on two new reporters: + +* ConsoleReporter - Report test results to the browser console. +* JUnitXmlReporter - Report test results to a file (using Rhino or PyPhantomJS) in JUnit XML Report format. + +## Usage + +Examples are included in the test directory that show how to use the reporters, +as well a basic runner scripts for Rhino + envjs, and a basic runner for +[PhantomJS](https://github.com/ariya/phantomjs) (using PyPhantomJS and the +saveToFile plugin). Either of these methods could be used in a Continuous +Integration project for running headless tests and generating JUnit XML output. + +### Rhino + EnvJS + +Everything needed to run the tests in Rhino + EnvJS is included in this +repository inside the `ext` directory, specifically Rhino 1.7r2 and envjs 1.2 +for Rhino. + +### PhantomJS, PyPhantomJS + +PhantomJS is included as a submodule inside the `ext` directory. The included +example runner makes use of PyPhantomJS to execute the headless tests and +save XML output to the filesystem. + +While PhantomJS and PyPhantomJS both run on MacOS / Linux / Windows, there are +specific dependencies for each platform. Specifics on installing these are not +included here, but is left as an exercise for the reader. The [PhantomJS](https://github.com/ariya/phantomjs) +project contains links to various documentation, including installation notes. + +Here is how I got it working in MacOSX 10.6 (YMMV): + +* ensure you are using Python 2.6+ +* install Xcode (this gives you make, et al) +* install qt (this gives you qmake, et al) + * this may be easiest via [homebrew](https://github.com/mxcl/homebrew) + * `brew install qt` +* install the python sip module + * `pip install sip # this will fail to fully install sip, keep going` + * `cd build/sip` + * `python configure.py` + * `make && sudo make install` +* install the python pyqt module + * `pip install pyqt # this will fail to fully install pyqt, keep going` + * `cd build/pyqt` + * `python configure.py` + * `make && sudo make install` diff --git a/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/ext/env.rhino.1.2.js b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/ext/env.rhino.1.2.js new file mode 100644 index 0000000..8da1c07 --- /dev/null +++ b/node_modules/dustjs-linkedin/node_modules/jasmine-node/node_modules/jasmine-reporters/ext/env.rhino.1.2.js @@ -0,0 +1,13989 @@ +/* + * Envjs core-env.1.2.13 + * Pure JavaScript Browser Environment + * By John Resig and the Envjs Team + * Copyright 2008-2010 John Resig, under the MIT License + */ + +var Envjs = function(){ + var i, + name, + override = function(){ + for(i=0;i and the Envjs Team + * Copyright 2008-2010 John Resig, under the MIT License + */ + +//CLOSURE_START +(function(){ + + + + + +/** + * @author john resig + */ +// Helper method for extending one object with another. +function __extend__(a,b) { + for ( var i in b ) { + var g = b.__lookupGetter__(i), s = b.__lookupSetter__(i); + if ( g || s ) { + if ( g ) { a.__defineGetter__(i, g); } + if ( s ) { a.__defineSetter__(i, s); } + } else { + a[i] = b[i]; + } + } return a; +} + +/** + * Writes message to system out + * @param {String} message + */ +Envjs.log = function(message){}; + +/** + * Constants providing enumerated levels for logging in modules + */ +Envjs.DEBUG = 1; +Envjs.INFO = 2; +Envjs.WARN = 3; +Envjs.ERROR = 3; +Envjs.NONE = 3; + +/** + * Writes error info out to console + * @param {Error} e + */ +Envjs.lineSource = function(e){}; + + +/** + * TODO: used in ./event/eventtarget.js + * @param {Object} event + */ +Envjs.defaultEventBehaviors = {}; + + +/** + * describes which script src values will trigger Envjs to load + * the script like a browser would + */ +Envjs.scriptTypes = { + "text/javascript" :false, + "text/envjs" :true +}; + +/** + * will be called when loading a script throws an error + * @param {Object} script + * @param {Object} e + */ +Envjs.onScriptLoadError = function(script, e){ + console.log('error loading script %s %s', script, e); +}; + + +/** + * load and execute script tag text content + * @param {Object} script + */ +Envjs.loadInlineScript = function(script){ + var tmpFile; + tmpFile = Envjs.writeToTempFile(script.text, 'js') ; + load(tmpFile); +}; + +/** + * Should evaluate script in some context + * @param {Object} context + * @param {Object} source + * @param {Object} name + */ +Envjs.eval = function(context, source, name){}; + + +/** + * Executes a script tag + * @param {Object} script + * @param {Object} parser + */ +Envjs.loadLocalScript = function(script){ + //console.log("loading script %s", script); + var types, + src, + i, + base, + filename, + xhr; + + if(script.type){ + types = script.type.split(";"); + for(i=0;i + * - Via an innerHTML parse of a + * - A modificiation of the 'src' attribute of an Image/HTMLImageElement + * + * NOTE: this is optional API. If this doesn't exist then the default + * 'loaded' event occurs. + * + * @param node {Object} the node + * @param node the src value + * @return 'true' to indicate the 'load' succeed, false otherwise + */ +Envjs.loadImage = function(node, src) { + return true; +}; + + +/** + * A 'link' was requested by the document. Typically this occurs when: + * - During inital parse of a + * - Via an innerHTML parse of a + * - A modificiation of the 'href' attribute on a node in the tree + * + * @param node {Object} is the link node in question + * @param href {String} is the href. + * + * Return 'true' to indicate that the 'load' was successful, or false + * otherwise. The appropriate event is then triggered. + * + * NOTE: this is optional API. If this doesn't exist then the default + * 'loaded' event occurs + */ +Envjs.loadLink = function(node, href) { + return true; +}; + +(function(){ + + +/* + * cookie handling + * Private internal helper class used to save/retreive cookies + */ + +/** + * Specifies the location of the cookie file + */ +Envjs.cookieFile = function(){ + return 'file://'+Envjs.homedir+'/.cookies'; +}; + +/** + * saves cookies to a local file + * @param {Object} htmldoc + */ +Envjs.saveCookies = function(){ + var cookiejson = JSON.stringify(Envjs.cookies.peristent,null,'\t'); + //console.log('persisting cookies %s', cookiejson); + Envjs.writeToFile(cookiejson, Envjs.cookieFile()); +}; + +/** + * loads cookies from a local file + * @param {Object} htmldoc + */ +Envjs.loadCookies = function(){ + var cookiejson, + js; + try{ + cookiejson = Envjs.readFromFile(Envjs.cookieFile()) + js = JSON.parse(cookiejson, null, '\t'); + }catch(e){ + //console.log('failed to load cookies %s', e); + js = {}; + } + return js; +}; + +Envjs.cookies = { + persistent:{ + //domain - key on domain name { + //path - key on path { + //name - key on name { + //value : cookie value + //other cookie properties + //} + //} + //} + //expire - provides a timestamp for expiring the cookie + //cookie - the cookie! + }, + temporary:{//transient is a reserved word :( + //like above + } +}; + +var __cookies__; + +//HTMLDocument cookie +Envjs.setCookie = function(url, cookie){ + var i, + index, + name, + value, + properties = {}, + attr, + attrs; + url = Envjs.urlsplit(url); + if(cookie) + attrs = cookie.split(";"); + else + return; + + //for now the strategy is to simply create a json object + //and post it to a file in the .cookies.js file. I hate parsing + //dates so I decided not to implement support for 'expires' + //(which is deprecated) and instead focus on the easier 'max-age' + //(which succeeds 'expires') + cookie = {};//keyword properties of the cookie + cookie['domain'] = url.hostname; + cookie['path'] = url.path||'/'; + for(i=0;i -1){ + name = __trim__(attrs[i].slice(0,index)); + value = __trim__(attrs[i].slice(index+1)); + if(name=='max-age'){ + //we'll have to when to check these + //and garbage collect expired cookies + cookie[name] = parseInt(value, 10); + } else if( name == 'domain' ){ + if(__domainValid__(url, value)){ + cookie['domain'] = value; + } + } else if( name == 'path' ){ + //not sure of any special logic for path + cookie['path'] = value; + } else { + //its not a cookie keyword so store it in our array of properties + //and we'll serialize individually in a moment + properties[name] = value; + } + }else{ + if( attrs[i] == 'secure' ){ + cookie[attrs[i]] = true; + } + } + } + if(!('max-age' in cookie)){ + //it's a transient cookie so it only lasts as long as + //the window.location remains the same (ie in-memory cookie) + __mergeCookie__(Envjs.cookies.temporary, cookie, properties); + }else{ + //the cookie is persistent + __mergeCookie__(Envjs.cookies.persistent, cookie, properties); + Envjs.saveCookies(); + } +}; + +function __domainValid__(url, value){ + var i, + domainParts = url.hostname.split('.').reverse(), + newDomainParts = value.split('.').reverse(); + if(newDomainParts.length > 1){ + for(i=0;i -1) { + for (name in cookies[domain][path]) { + // console.log('cookie domain path name %s', name); + cookieString += + ((i++ > 0)?'; ':'') + + name + "=" + + cookies[domain][path][name].value; + } + } + } + } + } + return cookieString; +}; + +function __mergeCookie__(target, cookie, properties){ + var name, now; + if(!target[cookie.domain]){ + target[cookie.domain] = {}; + } + if(!target[cookie.domain][cookie.path]){ + target[cookie.domain][cookie.path] = {}; + } + for(name in properties){ + now = new Date().getTime(); + target[cookie.domain][cookie.path][name] = { + "value":properties[name], + "secure":cookie.secure, + "max-age":cookie['max-age'], + "date-created":now, + "expiration":(cookie['max-age']===0) ? + 0 : + now + cookie['max-age'] + }; + //console.log('cookie is %o',target[cookie.domain][cookie.path][name]); + } +}; + +})();//end cookies +/* + http://www.JSON.org/json2.js + 2008-07-15 + + Public Domain. + + NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. + + See http://www.JSON.org/js.html + + + This code should be minified before deployment. + See http://javascript.crockford.com/jsmin.html + + USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO + NOT CONTROL. +*/ +try{ JSON; }catch(e){ +JSON = function () { + + function f(n) { + // Format integers to have at least two digits. + return n < 10 ? '0' + n : n; + } + + Date.prototype.toJSON = function (key) { + + return this.getUTCFullYear() + '-' + + f(this.getUTCMonth() + 1) + '-' + + f(this.getUTCDate()) + 'T' + + f(this.getUTCHours()) + ':' + + f(this.getUTCMinutes()) + ':' + + f(this.getUTCSeconds()) + 'Z'; + }; + + String.prototype.toJSON = function (key) { + return String(this); + }; + Number.prototype.toJSON = + Boolean.prototype.toJSON = function (key) { + return this.valueOf(); + }; + + var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + escapeable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + gap, + indent, + meta = { // table of character substitutions + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '"' : '\\"', + '\\': '\\\\' + }, + rep; + + + function quote(string) { + + escapeable.lastIndex = 0; + return escapeable.test(string) ? + '"' + string.replace(escapeable, function (a) { + var c = meta[a]; + if (typeof c === 'string') { + return c; + } + return '\\u' + ('0000' + + (+(a.charCodeAt(0))).toString(16)).slice(-4); + }) + '"' : + '"' + string + '"'; + } + + + function str(key, holder) { + + var i, // The loop counter. + k, // The member key. + v, // The member value. + length, + mind = gap, + partial, + value = holder[key]; + + if (value && typeof value === 'object' && + typeof value.toJSON === 'function') { + value = value.toJSON(key); + } + if (typeof rep === 'function') { + value = rep.call(holder, key, value); + } + + switch (typeof value) { + case 'string': + return quote(value); + + case 'number': + return isFinite(value) ? String(value) : 'null'; + + case 'boolean': + case 'null': + + return String(value); + + case 'object': + + if (!value) { + return 'null'; + } + gap += indent; + partial = []; + + if (typeof value.length === 'number' && + !(value.propertyIsEnumerable('length'))) { + + length = value.length; + for (i = 0; i < length; i += 1) { + partial[i] = str(i, value) || 'null'; + } + + v = partial.length === 0 ? '[]' : + gap ? '[\n' + gap + + partial.join(',\n' + gap) + '\n' + + mind + ']' : + '[' + partial.join(',') + ']'; + gap = mind; + return v; + } + + if (rep && typeof rep === 'object') { + length = rep.length; + for (i = 0; i < length; i += 1) { + k = rep[i]; + if (typeof k === 'string') { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } else { + + for (k in value) { + if (Object.hasOwnProperty.call(value, k)) { + v = str(k, value); + if (v) { + partial.push(quote(k) + (gap ? ': ' : ':') + v); + } + } + } + } + + v = partial.length === 0 ? '{}' : + gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + + mind + '}' : '{' + partial.join(',') + '}'; + gap = mind; + return v; + } + } + + return { + stringify: function (value, replacer, space) { + + var i; + gap = ''; + indent = ''; + + if (typeof space === 'number') { + for (i = 0; i < space; i += 1) { + indent += ' '; + } + + } else if (typeof space === 'string') { + indent = space; + } + + rep = replacer; + if (replacer && typeof replacer !== 'function' && + (typeof replacer !== 'object' || + typeof replacer.length !== 'number')) { + throw new Error('JSON.stringify'); + } + + return str('', {'': value}); + }, + + + parse: function (text, reviver) { + var j; + function walk(holder, key) { + var k, v, value = holder[key]; + if (value && typeof value === 'object') { + for (k in value) { + if (Object.hasOwnProperty.call(value, k)) { + v = walk(value, k); + if (v !== undefined) { + value[k] = v; + } else { + delete value[k]; + } + } + } + } + return reviver.call(holder, key, value); + } + + cx.lastIndex = 0; + if (cx.test(text)) { + text = text.replace(cx, function (a) { + return '\\u' + ('0000' + + (+(a.charCodeAt(0))).toString(16)).slice(-4); + }); + } + + + if (/^[\],:{}\s]*$/. +test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@'). +replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'). +replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { + + j = eval('(' + text + ')'); + + return typeof reviver === 'function' ? + walk({'': j}, '') : j; + } + + throw new SyntaxError('JSON.parse'); + } + }; +}(); + +} + +/** + * synchronizes thread modifications + * @param {Function} fn + */ +Envjs.sync = function(fn){}; + +/** + * sleep thread for specified duration + * @param {Object} millseconds + */ +Envjs.sleep = function(millseconds){}; + +/** + * Interval to wait on event loop when nothing is happening + */ +Envjs.WAIT_INTERVAL = 20;//milliseconds + +/* + * Copyright (c) 2010 Nick Galbreath + * http://code.google.com/p/stringencoders/source/browse/#svn/trunk/javascript + * + * 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. + */ + +/* + * url processing in the spirit of python's urlparse module + * see `pydoc urlparse` or + * http://docs.python.org/library/urlparse.html + * + * urlsplit: break apart a URL into components + * urlunsplit: reconsistute a URL from componets + * urljoin: join an absolute and another URL + * urldefrag: remove the fragment from a URL + * + * Take a look at the tests in urlparse-test.html + * + * On URL Normalization: + * + * urlsplit only does minor normalization the components Only scheme + * and hostname are lowercased urljoin does a bit more, normalizing + * paths with "." and "..". + + * urlnormalize adds additional normalization + * + * * removes default port numbers + * http://abc.com:80/ -> http://abc.com/, etc + * * normalizes path + * http://abc.com -> http://abc.com/ + * and other "." and ".." cleanups + * * if file, remove query and fragment + * + * It does not do: + * * normalizes escaped hex values + * http://abc.com/%7efoo -> http://abc.com/%7Efoo + * * normalize '+' <--> '%20' + * + * Differences with Python + * + * The javascript urlsplit returns a normal object with the following + * properties: scheme, netloc, hostname, port, path, query, fragment. + * All properties are read-write. + * + * In python, the resulting object is not a dict, but a specialized, + * read-only, and has alternative tuple interface (e.g. obj[0] == + * obj.scheme). It's not clear why such a simple function requires + * a unique datastructure. + * + * urlunsplit in javascript takes an duck-typed object, + * { scheme: 'http', netloc: 'abc.com', ...} + * while in * python it takes a list-like object. + * ['http', 'abc.com'... ] + * + * For all functions, the javascript version use + * hostname+port if netloc is missing. In python + * hostname+port were always ignored. + * + * Similar functionality in different languages: + * + * http://php.net/manual/en/function.parse-url.php + * returns assocative array but cannot handle relative URL + * + * TODO: test allowfragments more + * TODO: test netloc missing, but hostname present + */ + +var urlparse = {}; + +// Unlike to be useful standalone +// +// NORMALIZE PATH with "../" and "./" +// http://en.wikipedia.org/wiki/URL_normalization +// http://tools.ietf.org/html/rfc3986#section-5.2.3 +// +urlparse.normalizepath = function(path) +{ + if (!path || path === '/') { + return '/'; + } + + var parts = path.split('/'); + + var newparts = []; + // make sure path always starts with '/' + if (parts[0]) { + newparts.push(''); + } + + for (var i = 0; i < parts.length; ++i) { + if (parts[i] === '..') { + if (newparts.length > 1) { + newparts.pop(); + } else { + newparts.push(parts[i]); + } + } else if (parts[i] != '.') { + newparts.push(parts[i]); + } + } + + path = newparts.join('/'); + if (!path) { + path = '/'; + } + return path; +}; + +// +// Does many of the normalizations that the stock +// python urlsplit/urlunsplit/urljoin neglects +// +// Doesn't do hex-escape normalization on path or query +// %7e -> %7E +// Nor, '+' <--> %20 translation +// +urlparse.urlnormalize = function(url) +{ + var parts = urlparse.urlsplit(url); + switch (parts.scheme) { + case 'file': + // files can't have query strings + // and we don't bother with fragments + parts.query = ''; + parts.fragment = ''; + break; + case 'http': + case 'https': + // remove default port + if ((parts.scheme === 'http' && parts.port == 80) || + (parts.scheme === 'https' && parts.port == 443)) { + parts.port = null; + // hostname is already lower case + parts.netloc = parts.hostname; + } + break; + default: + // if we don't have specific normalizations for this + // scheme, return the original url unmolested + return url; + } + + // for [file|http|https]. Not sure about other schemes + parts.path = urlparse.normalizepath(parts.path); + + return urlparse.urlunsplit(parts); +}; + +urlparse.urldefrag = function(url) +{ + var idx = url.indexOf('#'); + if (idx == -1) { + return [ url, '' ]; + } else { + return [ url.substr(0,idx), url.substr(idx+1) ]; + } +}; + +urlparse.urlsplit = function(url, default_scheme, allow_fragments) +{ + var leftover; + + if (typeof allow_fragments === 'undefined') { + allow_fragments = true; + } + + // scheme (optional), host, port + var fullurl = /^([A-Za-z]+)?(:?\/\/)([0-9.\-A-Za-z]*)(?::(\d+))?(.*)$/; + // path, query, fragment + var parse_leftovers = /([^?#]*)?(?:\?([^#]*))?(?:#(.*))?$/; + + var o = {}; + + var parts = url.match(fullurl); + if (parts) { + o.scheme = parts[1] || default_scheme || ''; + o.hostname = parts[3].toLowerCase() || ''; + o.port = parseInt(parts[4],10) || ''; + // Probably should grab the netloc from regexp + // and then parse again for hostname/port + + o.netloc = parts[3]; + if (parts[4]) { + o.netloc += ':' + parts[4]; + } + + leftover = parts[5]; + } else { + o.scheme = default_scheme || ''; + o.netloc = ''; + o.hostname = ''; + leftover = url; + } + o.scheme = o.scheme.toLowerCase(); + + parts = leftover.match(parse_leftovers); + + o.path = parts[1] || ''; + o.query = parts[2] || ''; + + if (allow_fragments) { + o.fragment = parts[3] || ''; + } else { + o.fragment = ''; + } + + return o; +}; + +urlparse.urlunsplit = function(o) { + var s = ''; + if (o.scheme) { + s += o.scheme + '://'; + } + + if (o.netloc) { + if (s == '') { + s += '//'; + } + s += o.netloc; + } else if (o.hostname) { + // extension. Python only uses netloc + if (s == '') { + s += '//'; + } + s += o.hostname; + if (o.port) { + s += ':' + o.port; + } + } + + if (o.path) { + s += o.path; + } + + if (o.query) { + s += '?' + o.query; + } + if (o.fragment) { + s += '#' + o.fragment; + } + return s; +}; + +urlparse.urljoin = function(base, url, allow_fragments) +{ + if (typeof allow_fragments === 'undefined') { + allow_fragments = true; + } + + var url_parts = urlparse.urlsplit(url); + + // if url parts has a scheme (i.e. absolute) + // then nothing to do + if (url_parts.scheme) { + if (! allow_fragments) { + return url; + } else { + return urlparse.urldefrag(url)[0]; + } + } + var base_parts = urlparse.urlsplit(base); + + // copy base, only if not present + if (!base_parts.scheme) { + base_parts.scheme = url_parts.scheme; + } + + // copy netloc, only if not present + if (!base_parts.netloc || !base_parts.hostname) { + base_parts.netloc = url_parts.netloc; + base_parts.hostname = url_parts.hostname; + base_parts.port = url_parts.port; + } + + // paths + if (url_parts.path.length > 0) { + if (url_parts.path.charAt(0) == '/') { + base_parts.path = url_parts.path; + } else { + // relative path.. get rid of "current filename" and + // replace. Same as var parts = + // base_parts.path.split('/'); parts[parts.length-1] = + // url_parts.path; base_parts.path = parts.join('/'); + var idx = base_parts.path.lastIndexOf('/'); + if (idx == -1) { + base_parts.path = url_parts.path; + } else { + base_parts.path = base_parts.path.substr(0,idx) + '/' + + url_parts.path; + } + } + } + + // clean up path + base_parts.path = urlparse.normalizepath(base_parts.path); + + // copy query string + base_parts.query = url_parts.query; + + // copy fragments + if (allow_fragments) { + base_parts.fragment = url_parts.fragment; + } else { + base_parts.fragment = ''; + } + + return urlparse.urlunsplit(base_parts); +}; + +/** + * getcwd - named after posix call of same name (see 'man 2 getcwd') + * + */ +Envjs.getcwd = function() { + return '.'; +}; + +/** + * resolves location relative to doc location + * + * @param {Object} path Relative or absolute URL + * @param {Object} base (semi-optional) The base url used in resolving "path" above + */ +Envjs.uri = function(path, base) { + //console.log('constructing uri from path %s and base %s', path, base); + + // Semi-common trick is to make an iframe with src='javascript:false' + // (or some equivalent). By returning '', the load is skipped + if (path.indexOf('javascript') === 0) { + return ''; + } + + // if path is absolute, then just normalize and return + if (path.match('^[a-zA-Z]+://')) { + return urlparse.urlnormalize(path); + } + + // interesting special case, a few very large websites use + // '//foo/bar/' to mean 'http://foo/bar' + if (path.match('^//')) { + path = 'http:' + path; + } + + // if base not passed in, try to get it from document + // Ideally I would like the caller to pass in document.baseURI to + // make this more self-sufficient and testable + if (!base && document) { + base = document.baseURI; + } + + // about:blank doesn't count + if (base === 'about:blank'){ + base = ''; + } + + // if base is still empty, then we are in QA mode loading local + // files. Get current working directory + if (!base) { + base = 'file://' + Envjs.getcwd() + '/'; + } + // handles all cases if path is abosulte or relative to base + // 3rd arg is "false" --> remove fragments + var newurl = urlparse.urlnormalize(urlparse.urljoin(base, path, false)); + + return newurl; +}; + + + +/** + * Used in the XMLHttpRquest implementation to run a + * request in a seperate thread + * @param {Object} fn + */ +Envjs.runAsync = function(fn){}; + + +/** + * Used to write to a local file + * @param {Object} text + * @param {Object} url + */ +Envjs.writeToFile = function(text, url){}; + + +/** + * Used to write to a local file + * @param {Object} text + * @param {Object} suffix + */ +Envjs.writeToTempFile = function(text, suffix){}; + +/** + * Used to read the contents of a local file + * @param {Object} url + */ +Envjs.readFromFile = function(url){}; + +/** + * Used to delete a local file + * @param {Object} url + */ +Envjs.deleteFile = function(url){}; + +/** + * establishes connection and calls responsehandler + * @param {Object} xhr + * @param {Object} responseHandler + * @param {Object} data + */ +Envjs.connection = function(xhr, responseHandler, data){}; + + +__extend__(Envjs, urlparse); + +/** + * Makes an object window-like by proxying object accessors + * @param {Object} scope + * @param {Object} parent + */ +Envjs.proxy = function(scope, parent, aliasList){}; + +Envjs.javaEnabled = false; + +Envjs.homedir = ''; +Envjs.tmpdir = ''; +Envjs.os_name = ''; +Envjs.os_arch = ''; +Envjs.os_version = ''; +Envjs.lang = ''; +Envjs.platform = ''; + +/** + * + * @param {Object} frameElement + * @param {Object} url + */ +Envjs.loadFrame = function(frame, url){ + try { + if(frame.contentWindow){ + //mark for garbage collection + frame.contentWindow = null; + } + + //create a new scope for the window proxy + //platforms will need to override this function + //to make sure the scope is global-like + frame.contentWindow = (function(){return this;})(); + new Window(frame.contentWindow, window); + + //I dont think frames load asynchronously in firefox + //and I think the tests have verified this but for + //some reason I'm less than confident... Are there cases? + frame.contentDocument = frame.contentWindow.document; + frame.contentDocument.async = false; + if(url){ + //console.log('envjs.loadFrame async %s', frame.contentDocument.async); + frame.contentWindow.location = url; + } + } catch(e) { + console.log("failed to load frame content: from %s %s", url, e); + } +}; + + +// The following are in rhino/window.js +// TODO: Envjs.unloadFrame +// TODO: Envjs.proxy + +/** + * @author john resig & the envjs team + * @uri http://www.envjs.com/ + * @copyright 2008-2010 + * @license MIT + */ +//CLOSURE_END +}()); +/* + * Envjs rhino-env.1.2.13 + * Pure JavaScript Browser Environment + * By John Resig and the Envjs Team + * Copyright 2008-2010 John Resig, under the MIT License + */ + +var __context__ = Packages.org.mozilla.javascript.Context.getCurrentContext(); + +Envjs.platform = "Rhino"; +Envjs.revision = "1.7.0.rc2"; + +/* + * Envjs rhino-env.1.2.13 + * Pure JavaScript Browser Environment + * By John Resig and the Envjs Team + * Copyright 2008-2010 John Resig, under the MIT License + */ + +//CLOSURE_START +(function(){ + + + + + +/** + * @author john resig + */ +// Helper method for extending one object with another. +function __extend__(a,b) { + for ( var i in b ) { + var g = b.__lookupGetter__(i), s = b.__lookupSetter__(i); + if ( g || s ) { + if ( g ) { a.__defineGetter__(i, g); } + if ( s ) { a.__defineSetter__(i, s); } + } else { + a[i] = b[i]; + } + } return a; +} + +/** + * Writes message to system out. + * + * Some sites redefine 'print' as in 'window.print', so instead of + * printing to stdout, you are popping open a new window, which might + * call print, etc, etc,etc This can cause infinite loops and can + * exhausing all memory. + * + * By defining this upfront now, Envjs.log will always call the native 'print' + * function + * + * @param {Object} message + */ +Envjs.log = print; + +Envjs.lineSource = function(e){ + return e&&e.rhinoException?e.rhinoException.lineSource():"(line ?)"; +}; +/** + * load and execute script tag text content + * @param {Object} script + */ +Envjs.loadInlineScript = function(script){ + if(script.ownerDocument.ownerWindow){ + Envjs.eval( + script.ownerDocument.ownerWindow, + script.text, + 'eval('+script.text.substring(0,16)+'...):'+new Date().getTime() + ); + }else{ + Envjs.eval( + __this__, + script.text, + 'eval('+script.text.substring(0,16)+'...):'+new Date().getTime() + ); + } + //console.log('evaluated at scope %s \n%s', + // script.ownerDocument.ownerWindow.guid, script.text); +}; + + +Envjs.eval = function(context, source, name){ + __context__.evaluateString( + context, + source, + name, + 0, + null + ); +}; + +//Temporary patch for parser module +Packages.org.mozilla.javascript.Context. + getCurrentContext().setOptimizationLevel(-1); + +/** + * Rhino provides a very succinct 'sync' + * @param {Function} fn + */ +try{ + Envjs.sync = sync; + Envjs.spawn = spawn; +} catch(e){ + //sync unavailable on AppEngine + Envjs.sync = function(fn){ + //console.log('Threadless platform, sync is safe'); + return fn; + }; + + Envjs.spawn = function(fn){ + //console.log('Threadless platform, spawn shares main thread.'); + return fn(); + }; +} + +/** + * sleep thread for specified duration + * @param {Object} millseconds + */ +Envjs.sleep = function(millseconds){ + try{ + java.lang.Thread.currentThread().sleep(millseconds); + }catch(e){ + console.log('Threadless platform, cannot sleep.'); + } +}; + +/** + * provides callback hook for when the system exits + */ +Envjs.onExit = function(callback){ + var rhino = Packages.org.mozilla.javascript, + contextFactory = __context__.getFactory(), + listener = new rhino.ContextFactory.Listener({ + contextReleased: function(context){ + if(context === __context__) + console.log('context released', context); + contextFactory.removeListener(this); + if(callback) + callback(); + } + }); + contextFactory.addListener(listener); +}; + +/** + * Get 'Current Working Directory' + */ +Envjs.getcwd = function() { + return java.lang.System.getProperty('user.dir'); +} + +/** + * + * @param {Object} fn + * @param {Object} onInterupt + */ +Envjs.runAsync = function(fn, onInterupt){ + ////Envjs.debug("running async"); + var running = true, + run; + + try{ + run = Envjs.sync(function(){ + fn(); + Envjs.wait(); + }); + Envjs.spawn(run); + }catch(e){ + console.log("error while running async operation", e); + try{if(onInterrupt)onInterrupt(e)}catch(ee){}; + } +}; + +/** + * Used to write to a local file + * @param {Object} text + * @param {Object} url + */ +Envjs.writeToFile = function(text, url){ + //Envjs.debug("writing text to url : " + url); + var out = new java.io.FileWriter( + new java.io.File( + new java.net.URI(url.toString()))); + out.write( text, 0, text.length ); + out.flush(); + out.close(); +}; + +/** + * Used to write to a local file + * @param {Object} text + * @param {Object} suffix + */ +Envjs.writeToTempFile = function(text, suffix){ + //Envjs.debug("writing text to temp url : " + suffix); + // Create temp file. + var temp = java.io.File.createTempFile("envjs-tmp", suffix); + + // Delete temp file when program exits. + temp.deleteOnExit(); + + // Write to temp file + var out = new java.io.FileWriter(temp); + out.write(text, 0, text.length); + out.close(); + return temp.getAbsolutePath().toString()+''; +}; + + +/** + * Used to read the contents of a local file + * @param {Object} url + */ +Envjs.readFromFile = function( url ){ + var fileReader = new java.io.FileReader( + new java.io.File( + new java.net.URI( url ))); + + var stringwriter = new java.io.StringWriter(), + buffer = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 1024), + length; + + while ((length = fileReader.read(buffer, 0, 1024)) != -1) { + stringwriter.write(buffer, 0, length); + } + + stringwriter.close(); + return stringwriter.toString()+""; +}; + + +/** + * Used to delete a local file + * @param {Object} url + */ +Envjs.deleteFile = function(url){ + var file = new java.io.File( new java.net.URI( url ) ); + file["delete"](); +}; + +/** + * establishes connection and calls responsehandler + * @param {Object} xhr + * @param {Object} responseHandler + * @param {Object} data + */ +Envjs.connection = function(xhr, responseHandler, data){ + var url = java.net.URL(xhr.url), + connection, + header, + outstream, + buffer, + length, + binary = false, + name, value, + contentEncoding, + instream, + responseXML, + i; + if ( /^file\:/.test(url) ) { + try{ + if ( "PUT" == xhr.method || "POST" == xhr.method ) { + data = data || "" ; + Envjs.writeToFile(data, url); + xhr.readyState = 4; + //could be improved, I just cant recall the correct http codes + xhr.status = 200; + xhr.statusText = ""; + } else if ( xhr.method == "DELETE" ) { + Envjs.deleteFile(url); + xhr.readyState = 4; + //could be improved, I just cant recall the correct http codes + xhr.status = 200; + xhr.statusText = ""; + } else { + connection = url.openConnection(); + connection.connect(); + //try to add some canned headers that make sense + + try{ + if(xhr.url.match(/html$/)){ + xhr.responseHeaders["Content-Type"] = 'text/html'; + }else if(xhr.url.match(/.xml$/)){ + xhr.responseHeaders["Content-Type"] = 'text/xml'; + }else if(xhr.url.match(/.js$/)){ + xhr.responseHeaders["Content-Type"] = 'text/javascript'; + }else if(xhr.url.match(/.json$/)){ + xhr.responseHeaders["Content-Type"] = 'application/json'; + }else{ + xhr.responseHeaders["Content-Type"] = 'text/plain'; + } + //xhr.responseHeaders['Last-Modified'] = connection.getLastModified(); + //xhr.responseHeaders['Content-Length'] = headerValue+''; + //xhr.responseHeaders['Date'] = new Date()+'';*/ + }catch(e){ + console.log('failed to load response headers',e); + } + } + }catch(e){ + console.log('failed to open file %s %s', url, e); + connection = null; + xhr.readyState = 4; + xhr.statusText = "Local File Protocol Error"; + xhr.responseText = "

        "+ e+ "

        "; + } + } else { + connection = url.openConnection(); + connection.setRequestMethod( xhr.method ); + + // Add headers to Java connection + for (header in xhr.headers){ + connection.addRequestProperty(header+'', xhr.headers[header]+''); + } + + //write data to output stream if required + if(data){ + if(data instanceof Document){ + if ( xhr.method == "PUT" || xhr.method == "POST" ) { + connection.setDoOutput(true); + outstream = connection.getOutputStream(), + xml = (new XMLSerializer()).serializeToString(data); + buffer = new java.lang.String(xml).getBytes('UTF-8'); + outstream.write(buffer, 0, buffer.length); + outstream.close(); + } + }else if(data.length&&data.length>0){ + if ( xhr.method == "PUT" || xhr.method == "POST" ) { + connection.setDoOutput(true); + outstream = connection.getOutputStream(); + buffer = new java.lang.String(data).getBytes('UTF-8'); + outstream.write(buffer, 0, buffer.length); + outstream.close(); + } + } + connection.connect(); + }else{ + connection.connect(); + } + } + + if(connection){ + try{ + length = connection.getHeaderFields().size(); + // Stick the response headers into responseHeaders + for (i = 0; i < length; i++) { + name = connection.getHeaderFieldKey(i); + value = connection.getHeaderField(i); + if (name) + xhr.responseHeaders[name+''] = value+''; + } + }catch(e){ + console.log('failed to load response headers \n%s',e); + } + + xhr.readyState = 4; + xhr.status = parseInt(connection.responseCode,10) || undefined; + xhr.statusText = connection.responseMessage || ""; + + contentEncoding = connection.getContentEncoding() || "utf-8"; + instream = null; + responseXML = null; + + try{ + //console.log('contentEncoding %s', contentEncoding); + if( contentEncoding.equalsIgnoreCase("gzip") || + contentEncoding.equalsIgnoreCase("decompress")){ + //zipped content + binary = true; + outstream = new java.io.ByteArrayOutputStream(); + buffer = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024); + instream = new java.util.zip.GZIPInputStream(connection.getInputStream()) + }else{ + //this is a text file + outstream = new java.io.StringWriter(); + buffer = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 1024); + instream = new java.io.InputStreamReader(connection.getInputStream()); + } + }catch(e){ + if (connection.getResponseCode() == 404){ + console.log('failed to open connection stream \n %s %s', + e.toString(), e); + }else{ + console.log('failed to open connection stream \n %s %s', + e.toString(), e); + } + instream = connection.getErrorStream(); + } + + while ((length = instream.read(buffer, 0, 1024)) != -1) { + outstream.write(buffer, 0, length); + } + + outstream.close(); + instream.close(); + + if(binary){ + xhr.responseText = new String(outstream.toByteArray(), 'UTF-8') + ''; + }else{ + xhr.responseText = outstream.toString() + ''; + } + + } + if(responseHandler){ + //Envjs.debug('calling ajax response handler'); + responseHandler(); + } +}; + +//Since we're running in rhino I guess we can safely assume +//java is 'enabled'. I'm sure this requires more thought +//than I've given it here +Envjs.javaEnabled = true; + +Envjs.homedir = java.lang.System.getProperty("user.home"); +Envjs.tmpdir = java.lang.System.getProperty("java.io.tmpdir"); +Envjs.os_name = java.lang.System.getProperty("os.name"); +Envjs.os_arch = java.lang.System.getProperty("os.arch"); +Envjs.os_version = java.lang.System.getProperty("os.version"); +Envjs.lang = java.lang.System.getProperty("user.lang"); + + +/** + * + * @param {Object} frameElement + * @param {Object} url + */ +Envjs.loadFrame = function(frame, url){ + try { + if(frame.contentWindow){ + //mark for garbage collection + frame.contentWindow = null; + } + + //create a new scope for the window proxy + frame.contentWindow = Envjs.proxy(); + new Window(frame.contentWindow, window); + + //I dont think frames load asynchronously in firefox + //and I think the tests have verified this but for + //some reason I'm less than confident... Are there cases? + frame.contentDocument = frame.contentWindow.document; + frame.contentDocument.async = false; + if(url){ + //console.log('envjs.loadFrame async %s', frame.contentDocument.async); + frame.contentWindow.location = url; + } + } catch(e) { + console.log("failed to load frame content: from %s %s", url, e); + } +}; + +/** + * unloadFrame + * @param {Object} frame + */ +Envjs.unloadFrame = function(frame){ + var all, length, i; + try{ + //TODO: probably self-referencing structures within a document tree + //preventing it from being entirely garbage collected once orphaned. + //Should have code to walk tree and break all links between contained + //objects. + frame.contentDocument = null; + if(frame.contentWindow){ + frame.contentWindow.close(); + } + gc(); + }catch(e){ + console.log(e); + } +}; + +/** + * Makes an object window-like by proxying object accessors + * @param {Object} scope + * @param {Object} parent + */ +Envjs.proxy = function(scope, parent) { + try{ + if(scope+'' == '[object global]'){ + return scope + }else{ + return __context__.initStandardObjects(); + } + }catch(e){ + console.log('failed to init standard objects %s %s \n%s', scope, parent, e); + } + +}; + +/** + * @author john resig & the envjs team + * @uri http://www.envjs.com/ + * @copyright 2008-2010 + * @license MIT + */ +//CLOSURE_END +}()); + +/** + * @author envjs team + */ +var Console, + console; + +/* + * Envjs console.1.2.13 + * Pure JavaScript Browser Environment + * By John Resig and the Envjs Team + * Copyright 2008-2010 John Resig, under the MIT License + */ + +//CLOSURE_START +(function(){ + + + + + +/** + * @author envjs team + * borrowed 99%-ish with love from firebug-lite + * + * http://wiki.commonjs.org/wiki/Console + */ +Console = function(module){ + var $level, + $logger, + $null = function(){}; + + + if(Envjs[module] && Envjs[module].loglevel){ + $level = Envjs.module.loglevel; + $logger = { + log: function(level){ + logFormatted(arguments, (module)+" "); + }, + debug: $level>1 ? $null: function() { + logFormatted(arguments, (module)+" debug"); + }, + info: $level>2 ? $null:function(){ + logFormatted(arguments, (module)+" info"); + }, + warn: $level>3 ? $null:function(){ + logFormatted(arguments, (module)+" warning"); + }, + error: $level>4 ? $null:function(){ + logFormatted(arguments, (module)+" error"); + } + }; + } else { + $logger = { + log: function(level){ + logFormatted(arguments, ""); + }, + debug: $null, + info: $null, + warn: $null, + error: $null + }; + } + + return $logger; +}; + +console = new Console("console",1); + +function logFormatted(objects, className) +{ + var html = []; + + var format = objects[0]; + var objIndex = 0; + + if (typeof(format) != "string") + { + format = ""; + objIndex = -1; + } + + var parts = parseFormat(format); + for (var i = 0; i < parts.length; ++i) + { + var part = parts[i]; + if (part && typeof(part) == "object") + { + var object = objects[++objIndex]; + part.appender(object, html); + } + else { + appendText(part, html); + } + } + + for (var i = objIndex+1; i < objects.length; ++i) + { + appendText(" ", html); + + var object = objects[i]; + if (typeof(object) == "string") { + appendText(object, html); + } else { + appendObject(object, html); + } + } + + Envjs.log(html.join(' ')); +} + +function parseFormat(format) +{ + var parts = []; + + var reg = /((^%|[^\\]%)(\d+)?(\.)([a-zA-Z]))|((^%|[^\\]%)([a-zA-Z]))/; + var appenderMap = {s: appendText, d: appendInteger, i: appendInteger, f: appendFloat}; + + for (var m = reg.exec(format); m; m = reg.exec(format)) + { + var type = m[8] ? m[8] : m[5]; + var appender = type in appenderMap ? appenderMap[type] : appendObject; + var precision = m[3] ? parseInt(m[3]) : (m[4] == "." ? -1 : 0); + + parts.push(format.substr(0, m[0][0] == "%" ? m.index : m.index+1)); + parts.push({appender: appender, precision: precision}); + + format = format.substr(m.index+m[0].length); + } + + parts.push(format); + + return parts; +} + +function escapeHTML(value) +{ + return value; +} + +function objectToString(object) +{ + try + { + return object+""; + } + catch (exc) + { + return null; + } +} + +// ******************************************************************************************** + +function appendText(object, html) +{ + html.push(escapeHTML(objectToString(object))); +} + +function appendNull(object, html) +{ + html.push(escapeHTML(objectToString(object))); +} + +function appendString(object, html) +{ + html.push(escapeHTML(objectToString(object))); +} + +function appendInteger(object, html) +{ + html.push(escapeHTML(objectToString(object))); +} + +function appendFloat(object, html) +{ + html.push(escapeHTML(objectToString(object))); +} + +function appendFunction(object, html) +{ + var reName = /function ?(.*?)\(/; + var m = reName.exec(objectToString(object)); + var name = m ? m[1] : "function"; + html.push(escapeHTML(name)); +} + +function appendObject(object, html) +{ + try + { + if (object == undefined) { + appendNull("undefined", html); + } else if (object == null) { + appendNull("null", html); + } else if (typeof object == "string") { + appendString(object, html); + } else if (typeof object == "number") { + appendInteger(object, html); + } else if (typeof object == "function") { + appendFunction(object, html); + } else if (object.nodeType == 1) { + appendSelector(object, html); + } else if (typeof object == "object") { + appendObjectFormatted(object, html); + } else { + appendText(object, html); + } + } + catch (exc) + { + } +} + +function appendObjectFormatted(object, html) +{ + var text = objectToString(object); + var reObject = /\[object (.*?)\]/; + + var m = reObject.exec(text); + html.push( m ? m[1] : text); +} + +function appendSelector(object, html) +{ + + html.push(escapeHTML(object.nodeName.toLowerCase())); + if (object.id) { + html.push(escapeHTML(object.id)); + } + if (object.className) { + html.push(escapeHTML(object.className)); + } +} + +function appendNode(node, html) +{ + if (node.nodeType == 1) + { + html.push( node.nodeName.toLowerCase()); + + for (var i = 0; i < node.attributes.length; ++i) + { + var attr = node.attributes[i]; + if (!attr.specified) { + continue; + } + + html.push( attr.nodeName.toLowerCase(),escapeHTML(attr.nodeValue)); + } + + if (node.firstChild) + { + for (var child = node.firstChild; child; child = child.nextSibling) { + appendNode(child, html); + } + + html.push( node.nodeName.toLowerCase()); + } + } + else if (node.nodeType === 3) + { + html.push(escapeHTML(node.nodeValue)); + } +}; + +/** + * @author john resig & the envjs team + * @uri http://www.envjs.com/ + * @copyright 2008-2010 + * @license MIT + */ +//CLOSURE_END +}()); +/* + * Envjs dom.1.2.13 + * Pure JavaScript Browser Environment + * By John Resig and the Envjs Team + * Copyright 2008-2010 John Resig, under the MIT License + * + * Parts of the implementation were originally written by:\ + * and Jon van Noort (jon@webarcana.com.au) \ + * and David Joham (djoham@yahoo.com)",\ + * and Scott Severtson + * + * This file simply provides the global definitions we need to \ + * be able to correctly implement to core browser DOM interfaces." + */ + +var Attr, + CDATASection, + CharacterData, + Comment, + Document, + DocumentFragment, + DocumentType, + DOMException, + DOMImplementation, + Element, + Entity, + EntityReference, + NamedNodeMap, + Namespace, + Node, + NodeList, + Notation, + ProcessingInstruction, + Text, + Range, + XMLSerializer, + DOMParser; + + + +/* + * Envjs dom.1.2.13 + * Pure JavaScript Browser Environment + * By John Resig and the Envjs Team + * Copyright 2008-2010 John Resig, under the MIT License + */ + +//CLOSURE_START +(function(){ + + + + + +/** + * @author john resig + */ +// Helper method for extending one object with another. +function __extend__(a,b) { + for ( var i in b ) { + var g = b.__lookupGetter__(i), s = b.__lookupSetter__(i); + if ( g || s ) { + if ( g ) { a.__defineGetter__(i, g); } + if ( s ) { a.__defineSetter__(i, s); } + } else { + a[i] = b[i]; + } + } return a; +} + +/** + * @author john resig + */ +//from jQuery +function __setArray__( target, array ) { + // Resetting the length to 0, then using the native Array push + // is a super-fast way to populate an object with array-like properties + target.length = 0; + Array.prototype.push.apply( target, array ); +} + +/** + * @class NodeList - + * provides the abstraction of an ordered collection of nodes + * + * @param ownerDocument : Document - the ownerDocument + * @param parentNode : Node - the node that the NodeList is attached to (or null) + */ +NodeList = function(ownerDocument, parentNode) { + this.length = 0; + this.parentNode = parentNode; + this.ownerDocument = ownerDocument; + this._readonly = false; + __setArray__(this, []); +}; + +__extend__(NodeList.prototype, { + item : function(index) { + var ret = null; + if ((index >= 0) && (index < this.length)) { + // bounds check + ret = this[index]; + } + // if the index is out of bounds, default value null is returned + return ret; + }, + get xml() { + var ret = "", + i; + + // create string containing the concatenation of the string values of each child + for (i=0; i < this.length; i++) { + if(this[i]){ + if(this[i].nodeType == Node.TEXT_NODE && i>0 && + this[i-1].nodeType == Node.TEXT_NODE){ + //add a single space between adjacent text nodes + ret += " "+this[i].xml; + }else{ + ret += this[i].xml; + } + } + } + return ret; + }, + toArray: function () { + var children = [], + i; + for ( i=0; i < this.length; i++) { + children.push (this[i]); + } + return children; + }, + toString: function(){ + return "[object NodeList]"; + } +}); + + +/** + * @method __findItemIndex__ + * find the item index of the node + * @author Jon van Noort (jon@webarcana.com.au) + * @param node : Node + * @return : int + */ +var __findItemIndex__ = function (nodelist, node) { + var ret = -1, i; + for (i=0; i= 0) && (refChildIndex <= nodelist.length)) { + // bounds check + if (newChild.nodeType == Node.DOCUMENT_FRAGMENT_NODE) { + // node is a DocumentFragment + // append the children of DocumentFragment + Array.prototype.splice.apply(nodelist, + [refChildIndex, 0].concat(newChild.childNodes.toArray())); + } + else { + // append the newChild + Array.prototype.splice.apply(nodelist,[refChildIndex, 0, newChild]); + } + } +}; + +/** + * @method __replaceChild__ + * replace the specified Node in the NodeList at the specified index + * Used by Node.replaceChild(). Note: Node.replaceChild() is responsible + * for Node Pointer surgery __replaceChild__ simply modifies the internal + * data structure (Array). + * + * @param newChild : Node - the Node to be inserted + * @param refChildIndex : int - the array index to hold the Node + */ +var __replaceChild__ = function(nodelist, newChild, refChildIndex) { + var ret = null; + + // bounds check + if ((refChildIndex >= 0) && (refChildIndex < nodelist.length)) { + // preserve old child for return + ret = nodelist[refChildIndex]; + + if (newChild.nodeType == Node.DOCUMENT_FRAGMENT_NODE) { + // node is a DocumentFragment + // get array containing children prior to refChild + Array.prototype.splice.apply(nodelist, + [refChildIndex, 1].concat(newChild.childNodes.toArray())); + } + else { + // simply replace node in array (links between Nodes are + // made at higher level) + nodelist[refChildIndex] = newChild; + } + } + // return replaced node + return ret; +}; + +/** + * @method __removeChild__ + * remove the specified Node in the NodeList at the specified index + * Used by Node.removeChild(). Note: Node.removeChild() is responsible + * for Node Pointer surgery __removeChild__ simply modifies the internal + * data structure (Array). + * @param refChildIndex : int - the array index holding the Node to be removed + */ +var __removeChild__ = function(nodelist, refChildIndex) { + var ret = null; + + if (refChildIndex > -1) { + // found it! + // return removed node + ret = nodelist[refChildIndex]; + + // rebuild array without removed child + Array.prototype.splice.apply(nodelist,[refChildIndex, 1]); + } + // return removed node + return ret; +}; + +/** + * @method __appendChild__ + * append the specified Node to the NodeList. Used by Node.appendChild(). + * Note: Node.appendChild() is responsible for Node Pointer surgery + * __appendChild__ simply modifies the internal data structure (Array). + * @param newChild : Node - the Node to be inserted + */ +var __appendChild__ = function(nodelist, newChild) { + if (newChild.nodeType == Node.DOCUMENT_FRAGMENT_NODE) { + // node is a DocumentFragment + // append the children of DocumentFragment + Array.prototype.push.apply(nodelist, newChild.childNodes.toArray() ); + } else { + // simply add node to array (links between Nodes are made at higher level) + Array.prototype.push.apply(nodelist, [newChild]); + } + +}; + +/** + * @method __cloneNodes__ - + * Returns a NodeList containing clones of the Nodes in this NodeList + * @param deep : boolean - + * If true, recursively clone the subtree under each of the nodes; + * if false, clone only the nodes themselves (and their attributes, + * if it is an Element). + * @param parentNode : Node - the new parent of the cloned NodeList + * @return : NodeList - NodeList containing clones of the Nodes in this NodeList + */ +var __cloneNodes__ = function(nodelist, deep, parentNode) { + var cloneNodeList = new NodeList(nodelist.ownerDocument, parentNode); + + // create list containing clones of each child + for (var i=0; i < nodelist.length; i++) { + __appendChild__(cloneNodeList, nodelist[i].cloneNode(deep)); + } + + return cloneNodeList; +}; + + +var __ownerDocument__ = function(node){ + return (node.nodeType == Node.DOCUMENT_NODE)?node:node.ownerDocument; +}; + +/** + * @class Node - + * The Node interface is the primary datatype for the entire + * Document Object Model. It represents a single node in the + * document tree. + * @param ownerDocument : Document - The Document object associated with this node. + */ + +Node = function(ownerDocument) { + this.baseURI = 'about:blank'; + this.namespaceURI = null; + this.nodeName = ""; + this.nodeValue = null; + + // A NodeList that contains all children of this node. If there are no + // children, this is a NodeList containing no nodes. The content of the + // returned NodeList is "live" in the sense that, for instance, changes to + // the children of the node object that it was created from are immediately + // reflected in the nodes returned by the NodeList accessors; it is not a + // static snapshot of the content of the node. This is true for every + // NodeList, including the ones returned by the getElementsByTagName method. + this.childNodes = new NodeList(ownerDocument, this); + + // The first child of this node. If there is no such node, this is null + this.firstChild = null; + // The last child of this node. If there is no such node, this is null. + this.lastChild = null; + // The node immediately preceding this node. If there is no such node, + // this is null. + this.previousSibling = null; + // The node immediately following this node. If there is no such node, + // this is null. + this.nextSibling = null; + + this.attributes = null; + // The namespaces in scope for this node + this._namespaces = new NamespaceNodeMap(ownerDocument, this); + this._readonly = false; + + //IMPORTANT: These must come last so rhino will not iterate parent + // properties before child properties. (qunit.equiv issue) + + // The parent of this node. All nodes, except Document, DocumentFragment, + // and Attr may have a parent. However, if a node has just been created + // and not yet added to the tree, or if it has been removed from the tree, + // this is null + this.parentNode = null; + // The Document object associated with this node + this.ownerDocument = ownerDocument; + +}; + +// nodeType constants +Node.ELEMENT_NODE = 1; +Node.ATTRIBUTE_NODE = 2; +Node.TEXT_NODE = 3; +Node.CDATA_SECTION_NODE = 4; +Node.ENTITY_REFERENCE_NODE = 5; +Node.ENTITY_NODE = 6; +Node.PROCESSING_INSTRUCTION_NODE = 7; +Node.COMMENT_NODE = 8; +Node.DOCUMENT_NODE = 9; +Node.DOCUMENT_TYPE_NODE = 10; +Node.DOCUMENT_FRAGMENT_NODE = 11; +Node.NOTATION_NODE = 12; +Node.NAMESPACE_NODE = 13; + +Node.DOCUMENT_POSITION_EQUAL = 0x00; +Node.DOCUMENT_POSITION_DISCONNECTED = 0x01; +Node.DOCUMENT_POSITION_PRECEDING = 0x02; +Node.DOCUMENT_POSITION_FOLLOWING = 0x04; +Node.DOCUMENT_POSITION_CONTAINS = 0x08; +Node.DOCUMENT_POSITION_CONTAINED_BY = 0x10; +Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; + + +__extend__(Node.prototype, { + get localName(){ + return this.prefix? + this.nodeName.substring(this.prefix.length+1, this.nodeName.length): + this.nodeName; + }, + get prefix(){ + return this.nodeName.split(':').length>1? + this.nodeName.split(':')[0]: + null; + }, + set prefix(value){ + if(value === null){ + this.nodeName = this.localName; + }else{ + this.nodeName = value+':'+this.localName; + } + }, + hasAttributes : function() { + if (this.attributes.length == 0) { + return false; + }else{ + return true; + } + }, + get textContent(){ + return __recursivelyGatherText__(this); + }, + set textContent(newText){ + while(this.firstChild != null){ + this.removeChild( this.firstChild ); + } + var text = this.ownerDocument.createTextNode(newText); + this.appendChild(text); + }, + insertBefore : function(newChild, refChild) { + var prevNode; + + if(newChild==null){ + return newChild; + } + if(refChild==null){ + this.appendChild(newChild); + return this.newChild; + } + + // test for exceptions + if (__ownerDocument__(this).implementation.errorChecking) { + // throw Exception if Node is readonly + if (this._readonly) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } + + // throw Exception if newChild was not created by this Document + if (__ownerDocument__(this) != __ownerDocument__(newChild)) { + throw(new DOMException(DOMException.WRONG_DOCUMENT_ERR)); + } + + // throw Exception if the node is an ancestor + if (__isAncestor__(this, newChild)) { + throw(new DOMException(DOMException.HIERARCHY_REQUEST_ERR)); + } + } + + // if refChild is specified, insert before it + if (refChild) { + // find index of refChild + var itemIndex = __findItemIndex__(this.childNodes, refChild); + // throw Exception if there is no child node with this id + if (__ownerDocument__(this).implementation.errorChecking && (itemIndex < 0)) { + throw(new DOMException(DOMException.NOT_FOUND_ERR)); + } + + // if the newChild is already in the tree, + var newChildParent = newChild.parentNode; + if (newChildParent) { + // remove it + newChildParent.removeChild(newChild); + } + + // insert newChild into childNodes + __insertBefore__(this.childNodes, newChild, itemIndex); + + // do node pointer surgery + prevNode = refChild.previousSibling; + + // handle DocumentFragment + if (newChild.nodeType == Node.DOCUMENT_FRAGMENT_NODE) { + if (newChild.childNodes.length > 0) { + // set the parentNode of DocumentFragment's children + for (var ind = 0; ind < newChild.childNodes.length; ind++) { + newChild.childNodes[ind].parentNode = this; + } + + // link refChild to last child of DocumentFragment + refChild.previousSibling = newChild.childNodes[newChild.childNodes.length-1]; + } + }else { + // set the parentNode of the newChild + newChild.parentNode = this; + // link refChild to newChild + refChild.previousSibling = newChild; + } + + }else { + // otherwise, append to end + prevNode = this.lastChild; + this.appendChild(newChild); + } + + if (newChild.nodeType == Node.DOCUMENT_FRAGMENT_NODE) { + // do node pointer surgery for DocumentFragment + if (newChild.childNodes.length > 0) { + if (prevNode) { + prevNode.nextSibling = newChild.childNodes[0]; + }else { + // this is the first child in the list + this.firstChild = newChild.childNodes[0]; + } + newChild.childNodes[0].previousSibling = prevNode; + newChild.childNodes[newChild.childNodes.length-1].nextSibling = refChild; + } + }else { + // do node pointer surgery for newChild + if (prevNode) { + prevNode.nextSibling = newChild; + }else { + // this is the first child in the list + this.firstChild = newChild; + } + newChild.previousSibling = prevNode; + newChild.nextSibling = refChild; + } + + return newChild; + }, + replaceChild : function(newChild, oldChild) { + var ret = null; + + if(newChild==null || oldChild==null){ + return oldChild; + } + + // test for exceptions + if (__ownerDocument__(this).implementation.errorChecking) { + // throw Exception if Node is readonly + if (this._readonly) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } + + // throw Exception if newChild was not created by this Document + if (__ownerDocument__(this) != __ownerDocument__(newChild)) { + throw(new DOMException(DOMException.WRONG_DOCUMENT_ERR)); + } + + // throw Exception if the node is an ancestor + if (__isAncestor__(this, newChild)) { + throw(new DOMException(DOMException.HIERARCHY_REQUEST_ERR)); + } + } + + // get index of oldChild + var index = __findItemIndex__(this.childNodes, oldChild); + + // throw Exception if there is no child node with this id + if (__ownerDocument__(this).implementation.errorChecking && (index < 0)) { + throw(new DOMException(DOMException.NOT_FOUND_ERR)); + } + + // if the newChild is already in the tree, + var newChildParent = newChild.parentNode; + if (newChildParent) { + // remove it + newChildParent.removeChild(newChild); + } + + // add newChild to childNodes + ret = __replaceChild__(this.childNodes,newChild, index); + + + if (newChild.nodeType == Node.DOCUMENT_FRAGMENT_NODE) { + // do node pointer surgery for Document Fragment + if (newChild.childNodes.length > 0) { + for (var ind = 0; ind < newChild.childNodes.length; ind++) { + newChild.childNodes[ind].parentNode = this; + } + + if (oldChild.previousSibling) { + oldChild.previousSibling.nextSibling = newChild.childNodes[0]; + } else { + this.firstChild = newChild.childNodes[0]; + } + + if (oldChild.nextSibling) { + oldChild.nextSibling.previousSibling = newChild; + } else { + this.lastChild = newChild.childNodes[newChild.childNodes.length-1]; + } + + newChild.childNodes[0].previousSibling = oldChild.previousSibling; + newChild.childNodes[newChild.childNodes.length-1].nextSibling = oldChild.nextSibling; + } + } else { + // do node pointer surgery for newChild + newChild.parentNode = this; + + if (oldChild.previousSibling) { + oldChild.previousSibling.nextSibling = newChild; + }else{ + this.firstChild = newChild; + } + if (oldChild.nextSibling) { + oldChild.nextSibling.previousSibling = newChild; + }else{ + this.lastChild = newChild; + } + newChild.previousSibling = oldChild.previousSibling; + newChild.nextSibling = oldChild.nextSibling; + } + + return ret; + }, + removeChild : function(oldChild) { + if(!oldChild){ + return null; + } + // throw Exception if NamedNodeMap is readonly + if (__ownerDocument__(this).implementation.errorChecking && + (this._readonly || oldChild._readonly)) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } + + // get index of oldChild + var itemIndex = __findItemIndex__(this.childNodes, oldChild); + + // throw Exception if there is no child node with this id + if (__ownerDocument__(this).implementation.errorChecking && (itemIndex < 0)) { + throw(new DOMException(DOMException.NOT_FOUND_ERR)); + } + + // remove oldChild from childNodes + __removeChild__(this.childNodes, itemIndex); + + // do node pointer surgery + oldChild.parentNode = null; + + if (oldChild.previousSibling) { + oldChild.previousSibling.nextSibling = oldChild.nextSibling; + }else { + this.firstChild = oldChild.nextSibling; + } + if (oldChild.nextSibling) { + oldChild.nextSibling.previousSibling = oldChild.previousSibling; + }else { + this.lastChild = oldChild.previousSibling; + } + + oldChild.previousSibling = null; + oldChild.nextSibling = null; + + return oldChild; + }, + appendChild : function(newChild) { + if(!newChild){ + return null; + } + // test for exceptions + if (__ownerDocument__(this).implementation.errorChecking) { + // throw Exception if Node is readonly + if (this._readonly) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } + + // throw Exception if arg was not created by this Document + if (__ownerDocument__(this) != __ownerDocument__(this)) { + throw(new DOMException(DOMException.WRONG_DOCUMENT_ERR)); + } + + // throw Exception if the node is an ancestor + if (__isAncestor__(this, newChild)) { + throw(new DOMException(DOMException.HIERARCHY_REQUEST_ERR)); + } + } + + // if the newChild is already in the tree, + var newChildParent = newChild.parentNode; + if (newChildParent) { + // remove it + //console.debug('removing node %s', newChild); + newChildParent.removeChild(newChild); + } + + // add newChild to childNodes + __appendChild__(this.childNodes, newChild); + + if (newChild.nodeType == Node.DOCUMENT_FRAGMENT_NODE) { + // do node pointer surgery for DocumentFragment + if (newChild.childNodes.length > 0) { + for (var ind = 0; ind < newChild.childNodes.length; ind++) { + newChild.childNodes[ind].parentNode = this; + } + + if (this.lastChild) { + this.lastChild.nextSibling = newChild.childNodes[0]; + newChild.childNodes[0].previousSibling = this.lastChild; + this.lastChild = newChild.childNodes[newChild.childNodes.length-1]; + } else { + this.lastChild = newChild.childNodes[newChild.childNodes.length-1]; + this.firstChild = newChild.childNodes[0]; + } + } + } else { + // do node pointer surgery for newChild + newChild.parentNode = this; + if (this.lastChild) { + this.lastChild.nextSibling = newChild; + newChild.previousSibling = this.lastChild; + this.lastChild = newChild; + } else { + this.lastChild = newChild; + this.firstChild = newChild; + } + } + return newChild; + }, + hasChildNodes : function() { + return (this.childNodes.length > 0); + }, + cloneNode: function(deep) { + // use importNode to clone this Node + //do not throw any exceptions + try { + return __ownerDocument__(this).importNode(this, deep); + } catch (e) { + //there shouldn't be any exceptions, but if there are, return null + // may want to warn: $debug("could not clone node: "+e.code); + return null; + } + }, + normalize : function() { + var i; + var inode; + var nodesToRemove = new NodeList(); + + if (this.nodeType == Node.ELEMENT_NODE || this.nodeType == Node.DOCUMENT_NODE) { + var adjacentTextNode = null; + + // loop through all childNodes + for(i = 0; i < this.childNodes.length; i++) { + inode = this.childNodes.item(i); + + if (inode.nodeType == Node.TEXT_NODE) { + // this node is a text node + if (inode.length < 1) { + // this text node is empty + // add this node to the list of nodes to be remove + __appendChild__(nodesToRemove, inode); + }else { + if (adjacentTextNode) { + // previous node was also text + adjacentTextNode.appendData(inode.data); + // merge the data in adjacent text nodes + // add this node to the list of nodes to be removed + __appendChild__(nodesToRemove, inode); + } else { + // remember this node for next cycle + adjacentTextNode = inode; + } + } + } else { + // (soon to be) previous node is not a text node + adjacentTextNode = null; + // normalize non Text childNodes + inode.normalize(); + } + } + + // remove redundant Text Nodes + for(i = 0; i < nodesToRemove.length; i++) { + inode = nodesToRemove.item(i); + inode.parentNode.removeChild(inode); + } + } + }, + isSupported : function(feature, version) { + // use Implementation.hasFeature to determine if this feature is supported + return __ownerDocument__(this).implementation.hasFeature(feature, version); + }, + getElementsByTagName : function(tagname) { + // delegate to _getElementsByTagNameRecursive + // recurse childNodes + var nodelist = new NodeList(__ownerDocument__(this)); + for (var i = 0; i < this.childNodes.length; i++) { + __getElementsByTagNameRecursive__(this.childNodes.item(i), + tagname, + nodelist); + } + return nodelist; + }, + getElementsByTagNameNS : function(namespaceURI, localName) { + // delegate to _getElementsByTagNameNSRecursive + return __getElementsByTagNameNSRecursive__(this, namespaceURI, localName, + new NodeList(__ownerDocument__(this))); + }, + importNode : function(importedNode, deep) { + var i; + var importNode; + + //there is no need to perform namespace checks since everything has already gone through them + //in order to have gotten into the DOM in the first place. The following line + //turns namespace checking off in ._isValidNamespace + __ownerDocument__(this).importing = true; + + if (importedNode.nodeType == Node.ELEMENT_NODE) { + if (!__ownerDocument__(this).implementation.namespaceAware) { + // create a local Element (with the name of the importedNode) + importNode = __ownerDocument__(this).createElement(importedNode.tagName); + + // create attributes matching those of the importedNode + for(i = 0; i < importedNode.attributes.length; i++) { + importNode.setAttribute(importedNode.attributes.item(i).name, importedNode.attributes.item(i).value); + } + } else { + // create a local Element (with the name & namespaceURI of the importedNode) + importNode = __ownerDocument__(this).createElementNS(importedNode.namespaceURI, importedNode.nodeName); + + // create attributes matching those of the importedNode + for(i = 0; i < importedNode.attributes.length; i++) { + importNode.setAttributeNS(importedNode.attributes.item(i).namespaceURI, + importedNode.attributes.item(i).name, importedNode.attributes.item(i).value); + } + + // create namespace definitions matching those of the importedNode + for(i = 0; i < importedNode._namespaces.length; i++) { + importNode._namespaces[i] = __ownerDocument__(this).createNamespace(importedNode._namespaces.item(i).localName); + importNode._namespaces[i].value = importedNode._namespaces.item(i).value; + } + } + } else if (importedNode.nodeType == Node.ATTRIBUTE_NODE) { + if (!__ownerDocument__(this).implementation.namespaceAware) { + // create a local Attribute (with the name of the importedAttribute) + importNode = __ownerDocument__(this).createAttribute(importedNode.name); + } else { + // create a local Attribute (with the name & namespaceURI of the importedAttribute) + importNode = __ownerDocument__(this).createAttributeNS(importedNode.namespaceURI, importedNode.nodeName); + + // create namespace definitions matching those of the importedAttribute + for(i = 0; i < importedNode._namespaces.length; i++) { + importNode._namespaces[i] = __ownerDocument__(this).createNamespace(importedNode._namespaces.item(i).localName); + importNode._namespaces[i].value = importedNode._namespaces.item(i).value; + } + } + + // set the value of the local Attribute to match that of the importedAttribute + importNode.value = importedNode.value; + + } else if (importedNode.nodeType == Node.DOCUMENT_FRAGMENT_NODE) { + // create a local DocumentFragment + importNode = __ownerDocument__(this).createDocumentFragment(); + } else if (importedNode.nodeType == Node.NAMESPACE_NODE) { + // create a local NamespaceNode (with the same name & value as the importedNode) + importNode = __ownerDocument__(this).createNamespace(importedNode.nodeName); + importNode.value = importedNode.value; + } else if (importedNode.nodeType == Node.TEXT_NODE) { + // create a local TextNode (with the same data as the importedNode) + importNode = __ownerDocument__(this).createTextNode(importedNode.data); + } else if (importedNode.nodeType == Node.CDATA_SECTION_NODE) { + // create a local CDATANode (with the same data as the importedNode) + importNode = __ownerDocument__(this).createCDATASection(importedNode.data); + } else if (importedNode.nodeType == Node.PROCESSING_INSTRUCTION_NODE) { + // create a local ProcessingInstruction (with the same target & data as the importedNode) + importNode = __ownerDocument__(this).createProcessingInstruction(importedNode.target, importedNode.data); + } else if (importedNode.nodeType == Node.COMMENT_NODE) { + // create a local Comment (with the same data as the importedNode) + importNode = __ownerDocument__(this).createComment(importedNode.data); + } else { // throw Exception if nodeType is not supported + throw(new DOMException(DOMException.NOT_SUPPORTED_ERR)); + } + + if (deep) { + // recurse childNodes + for(i = 0; i < importedNode.childNodes.length; i++) { + importNode.appendChild(__ownerDocument__(this).importNode(importedNode.childNodes.item(i), true)); + } + } + + //reset importing + __ownerDocument__(this).importing = false; + return importNode; + + }, + contains : function(node){ + while(node && node != this ){ + node = node.parentNode; + } + return !!node; + }, + compareDocumentPosition : function(b){ + //console.log("comparing document position %s %s", this, b); + var i, + length, + a = this, + parent, + aparents, + bparents; + //handle a couple simpler case first + if(a === b) { + return Node.DOCUMENT_POSITION_EQUAL; + } + if(a.ownerDocument !== b.ownerDocument) { + return Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC| + Node.DOCUMENT_POSITION_FOLLOWING| + Node.DOCUMENT_POSITION_DISCONNECTED; + } + if(a.parentNode === b.parentNode){ + length = a.parentNode.childNodes.length; + for(i=0;i aparents.length){ + return Node.DOCUMENT_POSITION_FOLLOWING; + }else if(bparents.length < aparents.length){ + return Node.DOCUMENT_POSITION_PRECEDING; + }else{ + //common ancestor diverge point + if (i === 0) { + return Node.DOCUMENT_POSITION_FOLLOWING; + } else { + parent = aparents[i-1]; + } + return parent.compareDocumentPosition(bparents.pop()); + } + } + } + + return Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC| + Node.DOCUMENT_POSITION_DISCONNECTED; + + }, + toString : function() { + return '[object Node]'; + } + +}); + + + +/** + * @method __getElementsByTagNameRecursive__ - implements getElementsByTagName() + * @param elem : Element - The element which are checking and then recursing into + * @param tagname : string - The name of the tag to match on. The special value "*" matches all tags + * @param nodeList : NodeList - The accumulating list of matching nodes + * + * @return : NodeList + */ +var __getElementsByTagNameRecursive__ = function (elem, tagname, nodeList) { + + if (elem.nodeType == Node.ELEMENT_NODE || elem.nodeType == Node.DOCUMENT_NODE) { + + if(elem.nodeType !== Node.DOCUMENT_NODE && + ((elem.nodeName.toUpperCase() == tagname.toUpperCase()) || + (tagname == "*")) ){ + // add matching node to nodeList + __appendChild__(nodeList, elem); + } + + // recurse childNodes + for(var i = 0; i < elem.childNodes.length; i++) { + nodeList = __getElementsByTagNameRecursive__(elem.childNodes.item(i), tagname, nodeList); + } + } + + return nodeList; +}; + +/** + * @method __getElementsByTagNameNSRecursive__ + * implements getElementsByTagName() + * + * @param elem : Element - The element which are checking and then recursing into + * @param namespaceURI : string - the namespace URI of the required node + * @param localName : string - the local name of the required node + * @param nodeList : NodeList - The accumulating list of matching nodes + * + * @return : NodeList + */ +var __getElementsByTagNameNSRecursive__ = function(elem, namespaceURI, localName, nodeList) { + if (elem.nodeType == Node.ELEMENT_NODE || elem.nodeType == Node.DOCUMENT_NODE) { + + if (((elem.namespaceURI == namespaceURI) || (namespaceURI == "*")) && + ((elem.localName == localName) || (localName == "*"))) { + // add matching node to nodeList + __appendChild__(nodeList, elem); + } + + // recurse childNodes + for(var i = 0; i < elem.childNodes.length; i++) { + nodeList = __getElementsByTagNameNSRecursive__( + elem.childNodes.item(i), namespaceURI, localName, nodeList); + } + } + + return nodeList; +}; + +/** + * @method __isAncestor__ - returns true if node is ancestor of target + * @param target : Node - The node we are using as context + * @param node : Node - The candidate ancestor node + * @return : boolean + */ +var __isAncestor__ = function(target, node) { + // if this node matches, return true, + // otherwise recurse up (if there is a parentNode) + return ((target == node) || ((target.parentNode) && (__isAncestor__(target.parentNode, node)))); +}; + + + +var __recursivelyGatherText__ = function(aNode) { + var accumulateText = "", + idx, + node; + for (idx=0;idx < aNode.childNodes.length;idx++){ + node = aNode.childNodes.item(idx); + if(node.nodeType == Node.TEXT_NODE) + accumulateText += node.data; + else + accumulateText += __recursivelyGatherText__(node); + } + return accumulateText; +}; + +/** + * function __escapeXML__ + * @param str : string - The string to be escaped + * @return : string - The escaped string + */ +var escAmpRegEx = /&(?!(amp;|lt;|gt;|quot|apos;))/g; +var escLtRegEx = /
        /g; +var quotRegEx = /"/g; +var aposRegEx = /'/g; + +function __escapeXML__(str) { + str = str.replace(escAmpRegEx, "&"). + replace(escLtRegEx, "<"). + replace(escGtRegEx, ">"). + replace(quotRegEx, """). + replace(aposRegEx, "'"); + + return str; +}; + +/* +function __escapeHTML5__(str) { + str = str.replace(escAmpRegEx, "&"). + replace(escLtRegEx, "<"). + replace(escGtRegEx, ">"); + + return str; +}; +function __escapeHTML5Atribute__(str) { + str = str.replace(escAmpRegEx, "&"). + replace(escLtRegEx, "<"). + replace(escGtRegEx, ">"). + replace(quotRegEx, """). + replace(aposRegEx, "'"); + + return str; +}; +*/ + +/** + * function __unescapeXML__ + * @param str : string - The string to be unescaped + * @return : string - The unescaped string + */ +var unescAmpRegEx = /&/g; +var unescLtRegEx = /</g; +var unescGtRegEx = />/g; +var unquotRegEx = /"/g; +var unaposRegEx = /'/g; +function __unescapeXML__(str) { + str = str.replace(unescAmpRegEx, "&"). + replace(unescLtRegEx, "<"). + replace(unescGtRegEx, ">"). + replace(unquotRegEx, "\""). + replace(unaposRegEx, "'"); + + return str; +}; + +/** + * @class NamedNodeMap - + * used to represent collections of nodes that can be accessed by name + * typically a set of Element attributes + * + * @extends NodeList - + * note W3C spec says that this is not the case, but we need an item() + * method identical to NodeList's, so why not? + * @param ownerDocument : Document - the ownerDocument + * @param parentNode : Node - the node that the NamedNodeMap is attached to (or null) + */ +NamedNodeMap = function(ownerDocument, parentNode) { + NodeList.apply(this, arguments); + __setArray__(this, []); +}; +NamedNodeMap.prototype = new NodeList(); +__extend__(NamedNodeMap.prototype, { + add: function(name){ + this[this.length] = name; + }, + getNamedItem : function(name) { + var ret = null; + //console.log('NamedNodeMap getNamedItem %s', name); + // test that Named Node exists + var itemIndex = __findNamedItemIndex__(this, name); + + if (itemIndex > -1) { + // found it! + ret = this[itemIndex]; + } + // if node is not found, default value null is returned + return ret; + }, + setNamedItem : function(arg) { + //console.log('setNamedItem %s', arg); + // test for exceptions + if (__ownerDocument__(this).implementation.errorChecking) { + // throw Exception if arg was not created by this Document + if (this.ownerDocument != arg.ownerDocument) { + throw(new DOMException(DOMException.WRONG_DOCUMENT_ERR)); + } + + // throw Exception if DOMNamedNodeMap is readonly + if (this._readonly || (this.parentNode && this.parentNode._readonly)) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } + + // throw Exception if arg is already an attribute of another Element object + if (arg.ownerElement && (arg.ownerElement != this.parentNode)) { + throw(new DOMException(DOMException.INUSE_ATTRIBUTE_ERR)); + } + } + + //console.log('setNamedItem __findNamedItemIndex__ '); + // get item index + var itemIndex = __findNamedItemIndex__(this, arg.name); + var ret = null; + + //console.log('setNamedItem __findNamedItemIndex__ %s', itemIndex); + if (itemIndex > -1) { // found it! + ret = this[itemIndex]; // use existing Attribute + + // throw Exception if DOMAttr is readonly + if (__ownerDocument__(this).implementation.errorChecking && ret._readonly) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } else { + this[itemIndex] = arg; // over-write existing NamedNode + this[arg.name.toLowerCase()] = arg; + } + } else { + // add new NamedNode + //console.log('setNamedItem add new named node map (by index)'); + Array.prototype.push.apply(this, [arg]); + //console.log('setNamedItem add new named node map (by name) %s %s', arg, arg.name); + this[arg.name] = arg; + //console.log('finsished setNamedItem add new named node map (by name) %s', arg.name); + + } + + //console.log('setNamedItem parentNode'); + arg.ownerElement = this.parentNode; // update ownerElement + // return old node or new node + //console.log('setNamedItem exit'); + return ret; + }, + removeNamedItem : function(name) { + var ret = null; + // test for exceptions + // throw Exception if NamedNodeMap is readonly + if (__ownerDocument__(this).implementation.errorChecking && + (this._readonly || (this.parentNode && this.parentNode._readonly))) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } + + // get item index + var itemIndex = __findNamedItemIndex__(this, name); + + // throw Exception if there is no node named name in this map + if (__ownerDocument__(this).implementation.errorChecking && (itemIndex < 0)) { + throw(new DOMException(DOMException.NOT_FOUND_ERR)); + } + + // get Node + var oldNode = this[itemIndex]; + //this[oldNode.name] = undefined; + + // throw Exception if Node is readonly + if (__ownerDocument__(this).implementation.errorChecking && oldNode._readonly) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } + + // return removed node + return __removeChild__(this, itemIndex); + }, + getNamedItemNS : function(namespaceURI, localName) { + var ret = null; + + // test that Named Node exists + var itemIndex = __findNamedItemNSIndex__(this, namespaceURI, localName); + + if (itemIndex > -1) { + // found it! return NamedNode + ret = this[itemIndex]; + } + // if node is not found, default value null is returned + return ret; + }, + setNamedItemNS : function(arg) { + //console.log('setNamedItemNS %s', arg); + // test for exceptions + if (__ownerDocument__(this).implementation.errorChecking) { + // throw Exception if NamedNodeMap is readonly + if (this._readonly || (this.parentNode && this.parentNode._readonly)) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } + + // throw Exception if arg was not created by this Document + if (__ownerDocument__(this) != __ownerDocument__(arg)) { + throw(new DOMException(DOMException.WRONG_DOCUMENT_ERR)); + } + + // throw Exception if arg is already an attribute of another Element object + if (arg.ownerElement && (arg.ownerElement != this.parentNode)) { + throw(new DOMException(DOMException.INUSE_ATTRIBUTE_ERR)); + } + } + + // get item index + var itemIndex = __findNamedItemNSIndex__(this, arg.namespaceURI, arg.localName); + var ret = null; + + if (itemIndex > -1) { + // found it! + // use existing Attribute + ret = this[itemIndex]; + // throw Exception if Attr is readonly + if (__ownerDocument__(this).implementation.errorChecking && ret._readonly) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } else { + // over-write existing NamedNode + this[itemIndex] = arg; + } + }else { + // add new NamedNode + Array.prototype.push.apply(this, [arg]); + } + arg.ownerElement = this.parentNode; + + // return old node or null + return ret; + //console.log('finished setNamedItemNS %s', arg); + }, + removeNamedItemNS : function(namespaceURI, localName) { + var ret = null; + + // test for exceptions + // throw Exception if NamedNodeMap is readonly + if (__ownerDocument__(this).implementation.errorChecking && (this._readonly || (this.parentNode && this.parentNode._readonly))) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } + + // get item index + var itemIndex = __findNamedItemNSIndex__(this, namespaceURI, localName); + + // throw Exception if there is no matching node in this map + if (__ownerDocument__(this).implementation.errorChecking && (itemIndex < 0)) { + throw(new DOMException(DOMException.NOT_FOUND_ERR)); + } + + // get Node + var oldNode = this[itemIndex]; + + // throw Exception if Node is readonly + if (__ownerDocument__(this).implementation.errorChecking && oldNode._readonly) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } + + return __removeChild__(this, itemIndex); // return removed node + }, + get xml() { + var ret = ""; + + // create string containing concatenation of all (but last) Attribute string values (separated by spaces) + for (var i=0; i < this.length -1; i++) { + ret += this[i].xml +" "; + } + + // add last Attribute to string (without trailing space) + if (this.length > 0) { + ret += this[this.length -1].xml; + } + + return ret; + }, + toString : function(){ + return "[object NamedNodeMap]"; + } + +}); + +/** + * @method __findNamedItemIndex__ + * find the item index of the node with the specified name + * + * @param name : string - the name of the required node + * @param isnsmap : if its a NamespaceNodeMap + * @return : int + */ +var __findNamedItemIndex__ = function(namednodemap, name, isnsmap) { + var ret = -1; + // loop through all nodes + for (var i=0; i -1) { + // found it! + ret = true; + } + // if node is not found, default value false is returned + return ret; +} + +/** + * @method __hasAttributeNS__ + * Returns true if specified node exists + * + * @param namespaceURI : string - the namespace URI of the required node + * @param localName : string - the local name of the required node + * @return : boolean + */ +var __hasAttributeNS__ = function(namednodemap, namespaceURI, localName) { + var ret = false; + // test that Named Node exists + var itemIndex = __findNamedItemNSIndex__(namednodemap, namespaceURI, localName); + if (itemIndex > -1) { + // found it! + ret = true; + } + // if node is not found, default value false is returned + return ret; +} + +/** + * @method __cloneNamedNodes__ + * Returns a NamedNodeMap containing clones of the Nodes in this NamedNodeMap + * + * @param parentNode : Node - the new parent of the cloned NodeList + * @param isnsmap : bool - is this a NamespaceNodeMap + * @return NamedNodeMap containing clones of the Nodes in this NamedNodeMap + */ +var __cloneNamedNodes__ = function(namednodemap, parentNode, isnsmap) { + var cloneNamedNodeMap = isnsmap? + new NamespaceNodeMap(namednodemap.ownerDocument, parentNode): + new NamedNodeMap(namednodemap.ownerDocument, parentNode); + + // create list containing clones of all children + for (var i=0; i < namednodemap.length; i++) { + __appendChild__(cloneNamedNodeMap, namednodemap[i].cloneNode(false)); + } + + return cloneNamedNodeMap; +}; + + +/** + * @class NamespaceNodeMap - + * used to represent collections of namespace nodes that can be + * accessed by name typically a set of Element attributes + * + * @extends NamedNodeMap + * + * @param ownerDocument : Document - the ownerDocument + * @param parentNode : Node - the node that the NamespaceNodeMap is attached to (or null) + */ +var NamespaceNodeMap = function(ownerDocument, parentNode) { + this.NamedNodeMap = NamedNodeMap; + this.NamedNodeMap(ownerDocument, parentNode); + __setArray__(this, []); +}; +NamespaceNodeMap.prototype = new NamedNodeMap(); +__extend__(NamespaceNodeMap.prototype, { + get xml() { + var ret = "", + ns, + ind; + // identify namespaces declared local to this Element (ie, not inherited) + for (ind = 0; ind < this.length; ind++) { + // if namespace declaration does not exist in the containing node's, parentNode's namespaces + ns = null; + try { + var ns = this.parentNode.parentNode._namespaces. + getNamedItem(this[ind].localName); + }catch (e) { + //breaking to prevent default namespace being inserted into return value + break; + } + if (!(ns && (""+ ns.nodeValue == ""+ this[ind].nodeValue))) { + // display the namespace declaration + ret += this[ind].xml +" "; + } + } + return ret; + } +}); + +/** + * @class Namespace - + * The Namespace interface represents an namespace in an Element object + * + * @param ownerDocument : The Document object associated with this node. + */ +Namespace = function(ownerDocument) { + Node.apply(this, arguments); + // the name of this attribute + this.name = ""; + + // If this attribute was explicitly given a value in the original document, + // this is true; otherwise, it is false. + // Note that the implementation is in charge of this attribute, not the user. + // If the user changes the value of the attribute (even if it ends up having + // the same value as the default value) then the specified flag is + // automatically flipped to true + this.specified = false; +}; +Namespace.prototype = new Node(); +__extend__(Namespace.prototype, { + get value(){ + // the value of the attribute is returned as a string + return this.nodeValue; + }, + set value(value){ + this.nodeValue = value+''; + }, + get nodeType(){ + return Node.NAMESPACE_NODE; + }, + get xml(){ + var ret = ""; + + // serialize Namespace Declaration + if (this.nodeName != "") { + ret += this.nodeName +"=\""+ __escapeXML__(this.nodeValue) +"\""; + } + else { // handle default namespace + ret += "xmlns=\""+ __escapeXML__(this.nodeValue) +"\""; + } + + return ret; + }, + toString: function(){ + return '[object Namespace]'; + } +}); + + +/** + * @class CharacterData - parent abstract class for Text and Comment + * @extends Node + * @param ownerDocument : The Document object associated with this node. + */ +CharacterData = function(ownerDocument) { + Node.apply(this, arguments); +}; +CharacterData.prototype = new Node(); +__extend__(CharacterData.prototype,{ + get data(){ + return this.nodeValue; + }, + set data(data){ + this.nodeValue = data; + }, + get textContent(){ + return this.nodeValue; + }, + set textContent(newText){ + this.nodeValue = newText; + }, + get length(){return this.nodeValue.length;}, + appendData: function(arg){ + // throw Exception if CharacterData is readonly + if (__ownerDocument__(this).implementation.errorChecking && this._readonly) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } + // append data + this.data = "" + this.data + arg; + }, + deleteData: function(offset, count){ + // throw Exception if CharacterData is readonly + if (__ownerDocument__(this).implementation.errorChecking && this._readonly) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } + if (this.data) { + // throw Exception if offset is negative or greater than the data length, + if (__ownerDocument__(this).implementation.errorChecking && + ((offset < 0) || (offset > this.data.length) || (count < 0))) { + throw(new DOMException(DOMException.INDEX_SIZE_ERR)); + } + + // delete data + if(!count || (offset + count) > this.data.length) { + this.data = this.data.substring(0, offset); + }else { + this.data = this.data.substring(0, offset). + concat(this.data.substring(offset + count)); + } + } + }, + insertData: function(offset, arg){ + // throw Exception if CharacterData is readonly + if(__ownerDocument__(this).implementation.errorChecking && this._readonly){ + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } + + if(this.data){ + // throw Exception if offset is negative or greater than the data length, + if (__ownerDocument__(this).implementation.errorChecking && + ((offset < 0) || (offset > this.data.length))) { + throw(new DOMException(DOMException.INDEX_SIZE_ERR)); + } + + // insert data + this.data = this.data.substring(0, offset).concat(arg, this.data.substring(offset)); + }else { + // throw Exception if offset is negative or greater than the data length, + if (__ownerDocument__(this).implementation.errorChecking && (offset !== 0)) { + throw(new DOMException(DOMException.INDEX_SIZE_ERR)); + } + + // set data + this.data = arg; + } + }, + replaceData: function(offset, count, arg){ + // throw Exception if CharacterData is readonly + if (__ownerDocument__(this).implementation.errorChecking && this._readonly) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } + + if (this.data) { + // throw Exception if offset is negative or greater than the data length, + if (__ownerDocument__(this).implementation.errorChecking && + ((offset < 0) || (offset > this.data.length) || (count < 0))) { + throw(new DOMException(DOMException.INDEX_SIZE_ERR)); + } + + // replace data + this.data = this.data.substring(0, offset). + concat(arg, this.data.substring(offset + count)); + }else { + // set data + this.data = arg; + } + }, + substringData: function(offset, count){ + var ret = null; + if (this.data) { + // throw Exception if offset is negative or greater than the data length, + // or the count is negative + if (__ownerDocument__(this).implementation.errorChecking && + ((offset < 0) || (offset > this.data.length) || (count < 0))) { + throw(new DOMException(DOMException.INDEX_SIZE_ERR)); + } + // if count is not specified + if (!count) { + ret = this.data.substring(offset); // default to 'end of string' + }else{ + ret = this.data.substring(offset, offset + count); + } + } + return ret; + }, + toString : function(){ + return "[object CharacterData]"; + } +}); + +/** + * @class Text + * The Text interface represents the textual content (termed + * character data in XML) of an Element or Attr. + * If there is no markup inside an element's content, the text is + * contained in a single object implementing the Text interface that + * is the only child of the element. If there is markup, it is + * parsed into a list of elements and Text nodes that form the + * list of children of the element. + * @extends CharacterData + * @param ownerDocument The Document object associated with this node. + */ +Text = function(ownerDocument) { + CharacterData.apply(this, arguments); + this.nodeName = "#text"; +}; +Text.prototype = new CharacterData(); +__extend__(Text.prototype,{ + get localName(){ + return null; + }, + // Breaks this Text node into two Text nodes at the specified offset, + // keeping both in the tree as siblings. This node then only contains + // all the content up to the offset point. And a new Text node, which + // is inserted as the next sibling of this node, contains all the + // content at and after the offset point. + splitText : function(offset) { + var data, + inode; + // test for exceptions + if (__ownerDocument__(this).implementation.errorChecking) { + // throw Exception if Node is readonly + if (this._readonly) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } + // throw Exception if offset is negative or greater than the data length, + if ((offset < 0) || (offset > this.data.length)) { + throw(new DOMException(DOMException.INDEX_SIZE_ERR)); + } + } + if (this.parentNode) { + // get remaining string (after offset) + data = this.substringData(offset); + // create new TextNode with remaining string + inode = __ownerDocument__(this).createTextNode(data); + // attach new TextNode + if (this.nextSibling) { + this.parentNode.insertBefore(inode, this.nextSibling); + } else { + this.parentNode.appendChild(inode); + } + // remove remaining string from original TextNode + this.deleteData(offset); + } + return inode; + }, + get nodeType(){ + return Node.TEXT_NODE; + }, + get xml(){ + return __escapeXML__(""+ this.nodeValue); + }, + toString: function(){ + return "[object Text]"; + } +}); + +/** + * @class CDATASection + * CDATA sections are used to escape blocks of text containing + * characters that would otherwise be regarded as markup. + * The only delimiter that is recognized in a CDATA section is + * the "\]\]\>" string that ends the CDATA section + * @extends Text + * @param ownerDocument : The Document object associated with this node. + */ +CDATASection = function(ownerDocument) { + Text.apply(this, arguments); + this.nodeName = '#cdata-section'; +}; +CDATASection.prototype = new Text(); +__extend__(CDATASection.prototype,{ + get nodeType(){ + return Node.CDATA_SECTION_NODE; + }, + get xml(){ + return ""; + }, + toString : function(){ + return "[object CDATASection]"; + } +}); +/** + * @class Comment + * This represents the content of a comment, i.e., all the + * characters between the starting '' + * @extends CharacterData + * @param ownerDocument : The Document object associated with this node. + */ +Comment = function(ownerDocument) { + CharacterData.apply(this, arguments); + this.nodeName = "#comment"; +}; +Comment.prototype = new CharacterData(); +__extend__(Comment.prototype, { + get localName(){ + return null; + }, + get nodeType(){ + return Node.COMMENT_NODE; + }, + get xml(){ + return ""; + }, + toString : function(){ + return "[object Comment]"; + } +}); + + +/** + * @author envjs team + * @param {Document} onwnerDocument + */ +DocumentType = function(ownerDocument) { + Node.apply(this, arguments); + this.systemId = null; + this.publicId = null; +}; +DocumentType.prototype = new Node(); +__extend__({ + get name(){ + return this.nodeName; + }, + get entities(){ + return null; + }, + get internalSubsets(){ + return null; + }, + get notations(){ + return null; + }, + toString : function(){ + return "[object DocumentType]"; + } +}); + +/** + * @class Attr + * The Attr interface represents an attribute in an Element object + * @extends Node + * @param ownerDocument : The Document object associated with this node. + */ +Attr = function(ownerDocument) { + Node.apply(this, arguments); + // set when Attr is added to NamedNodeMap + this.ownerElement = null; + //TODO: our implementation of Attr is incorrect because we don't + // treat the value of the attribute as a child text node. +}; +Attr.prototype = new Node(); +__extend__(Attr.prototype, { + // the name of this attribute + get name(){ + return this.nodeName; + }, + // the value of the attribute is returned as a string + get value(){ + return this.nodeValue||''; + }, + set value(value){ + // throw Exception if Attribute is readonly + if (__ownerDocument__(this).implementation.errorChecking && this._readonly) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } + // delegate to node + this.nodeValue = value; + }, + get textContent(){ + return this.nodeValue; + }, + set textContent(newText){ + this.nodeValue = newText; + }, + get specified(){ + return (this !== null && this !== undefined); + }, + get nodeType(){ + return Node.ATTRIBUTE_NODE; + }, + get xml() { + if (this.nodeValue) { + return __escapeXML__(this.nodeValue+""); + } else { + return ''; + } + }, + toString : function() { + return '[object Attr]'; + } +}); + + +/** + * @class Element - + * By far the vast majority of objects (apart from text) + * that authors encounter when traversing a document are + * Element nodes. + * @extends Node + * @param ownerDocument : The Document object associated with this node. + */ +Element = function(ownerDocument) { + Node.apply(this, arguments); + this.attributes = new NamedNodeMap(this.ownerDocument, this); +}; +Element.prototype = new Node(); +__extend__(Element.prototype, { + // The name of the element. + get tagName(){ + return this.nodeName; + }, + + getAttribute: function(name) { + var ret = null; + // if attribute exists, use it + var attr = this.attributes.getNamedItem(name); + if (attr) { + ret = attr.value; + } + // if Attribute exists, return its value, otherwise, return null + return ret; + }, + setAttribute : function (name, value) { + // if attribute exists, use it + var attr = this.attributes.getNamedItem(name); + //console.log('attr %s', attr); + //I had to add this check because as the script initializes + //the id may be set in the constructor, and the html element + //overrides the id property with a getter/setter. + if(__ownerDocument__(this)){ + if (attr===null||attr===undefined) { + // otherwise create it + attr = __ownerDocument__(this).createAttribute(name); + //console.log('attr %s', attr); + } + + + // test for exceptions + if (__ownerDocument__(this).implementation.errorChecking) { + // throw Exception if Attribute is readonly + if (attr._readonly) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } + + // throw Exception if the value string contains an illegal character + if (!__isValidString__(value+'')) { + throw(new DOMException(DOMException.INVALID_CHARACTER_ERR)); + } + } + + // assign values to properties (and aliases) + attr.value = value + ''; + + // add/replace Attribute in NamedNodeMap + this.attributes.setNamedItem(attr); + //console.log('element setNamedItem %s', attr); + }else{ + console.warn('Element has no owner document '+this.tagName+ + '\n\t cant set attribute ' + name + ' = '+value ); + } + }, + removeAttribute : function removeAttribute(name) { + // delegate to NamedNodeMap.removeNamedItem + return this.attributes.removeNamedItem(name); + }, + getAttributeNode : function getAttributeNode(name) { + // delegate to NamedNodeMap.getNamedItem + return this.attributes.getNamedItem(name); + }, + setAttributeNode: function(newAttr) { + // if this Attribute is an ID + if (__isIdDeclaration__(newAttr.name)) { + this.id = newAttr.value; // cache ID for getElementById() + } + // delegate to NamedNodeMap.setNamedItem + return this.attributes.setNamedItem(newAttr); + }, + removeAttributeNode: function(oldAttr) { + // throw Exception if Attribute is readonly + if (__ownerDocument__(this).implementation.errorChecking && oldAttr._readonly) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } + + // get item index + var itemIndex = this.attributes._findItemIndex(oldAttr._id); + + // throw Exception if node does not exist in this map + if (__ownerDocument__(this).implementation.errorChecking && (itemIndex < 0)) { + throw(new DOMException(DOMException.NOT_FOUND_ERR)); + } + + return this.attributes._removeChild(itemIndex); + }, + getAttributeNS : function(namespaceURI, localName) { + var ret = ""; + // delegate to NAmedNodeMap.getNamedItemNS + var attr = this.attributes.getNamedItemNS(namespaceURI, localName); + if (attr) { + ret = attr.value; + } + return ret; // if Attribute exists, return its value, otherwise return "" + }, + setAttributeNS : function(namespaceURI, qualifiedName, value) { + // call NamedNodeMap.getNamedItem + //console.log('setAttributeNS %s %s %s', namespaceURI, qualifiedName, value); + var attr = this.attributes.getNamedItem(namespaceURI, qualifiedName); + + if (!attr) { // if Attribute exists, use it + // otherwise create it + attr = __ownerDocument__(this).createAttributeNS(namespaceURI, qualifiedName); + } + + value = '' + value; + + // test for exceptions + if (__ownerDocument__(this).implementation.errorChecking) { + // throw Exception if Attribute is readonly + if (attr._readonly) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } + + // throw Exception if the Namespace is invalid + if (!__isValidNamespace__(this.ownerDocument, namespaceURI, qualifiedName, true)) { + throw(new DOMException(DOMException.NAMESPACE_ERR)); + } + + // throw Exception if the value string contains an illegal character + if (!__isValidString__(value)) { + throw(new DOMException(DOMException.INVALID_CHARACTER_ERR)); + } + } + + // if this Attribute is an ID + //if (__isIdDeclaration__(name)) { + // this.id = value; + //} + + // assign values to properties (and aliases) + attr.value = value; + attr.nodeValue = value; + + // delegate to NamedNodeMap.setNamedItem + this.attributes.setNamedItemNS(attr); + }, + removeAttributeNS : function(namespaceURI, localName) { + // delegate to NamedNodeMap.removeNamedItemNS + return this.attributes.removeNamedItemNS(namespaceURI, localName); + }, + getAttributeNodeNS : function(namespaceURI, localName) { + // delegate to NamedNodeMap.getNamedItemNS + return this.attributes.getNamedItemNS(namespaceURI, localName); + }, + setAttributeNodeNS : function(newAttr) { + // if this Attribute is an ID + if ((newAttr.prefix == "") && __isIdDeclaration__(newAttr.name)) { + this.id = newAttr.value+''; // cache ID for getElementById() + } + + // delegate to NamedNodeMap.setNamedItemNS + return this.attributes.setNamedItemNS(newAttr); + }, + hasAttribute : function(name) { + // delegate to NamedNodeMap._hasAttribute + return __hasAttribute__(this.attributes,name); + }, + hasAttributeNS : function(namespaceURI, localName) { + // delegate to NamedNodeMap._hasAttributeNS + return __hasAttributeNS__(this.attributes, namespaceURI, localName); + }, + get nodeType(){ + return Node.ELEMENT_NODE; + }, + get xml() { + var ret = "", + ns = "", + attrs, + attrstring, + i; + + // serialize namespace declarations + if (this.namespaceURI ){ + if((this === this.ownerDocument.documentElement) || + (!this.parentNode)|| + (this.parentNode && (this.parentNode.namespaceURI !== this.namespaceURI))) { + ns = ' xmlns' + (this.prefix?(':'+this.prefix):'') + + '="' + this.namespaceURI + '"'; + } + } + + // serialize Attribute declarations + attrs = this.attributes; + attrstring = ""; + for(i=0;i< attrs.length;i++){ + if(attrs[i].name.match('xmlns:')) { + attrstring += " "+attrs[i].name+'="'+attrs[i].xml+'"'; + } + } + for(i=0;i< attrs.length;i++){ + if(!attrs[i].name.match('xmlns:')) { + attrstring += " "+attrs[i].name+'="'+attrs[i].xml+'"'; + } + } + + if(this.hasChildNodes()){ + // serialize this Element + ret += "<" + this.tagName + ns + attrstring +">"; + ret += this.childNodes.xml; + ret += ""; + }else{ + ret += "<" + this.tagName + ns + attrstring +"/>"; + } + + return ret; + }, + toString : function(){ + return '[object Element]'; + } +}); +/** + * @class DOMException - raised when an operation is impossible to perform + * @author Jon van Noort (jon@webarcana.com.au) + * @param code : int - the exception code (one of the DOMException constants) + */ +DOMException = function(code) { + this.code = code; +}; + +// DOMException constants +// Introduced in DOM Level 1: +DOMException.INDEX_SIZE_ERR = 1; +DOMException.DOMSTRING_SIZE_ERR = 2; +DOMException.HIERARCHY_REQUEST_ERR = 3; +DOMException.WRONG_DOCUMENT_ERR = 4; +DOMException.INVALID_CHARACTER_ERR = 5; +DOMException.NO_DATA_ALLOWED_ERR = 6; +DOMException.NO_MODIFICATION_ALLOWED_ERR = 7; +DOMException.NOT_FOUND_ERR = 8; +DOMException.NOT_SUPPORTED_ERR = 9; +DOMException.INUSE_ATTRIBUTE_ERR = 10; + +// Introduced in DOM Level 2: +DOMException.INVALID_STATE_ERR = 11; +DOMException.SYNTAX_ERR = 12; +DOMException.INVALID_MODIFICATION_ERR = 13; +DOMException.NAMESPACE_ERR = 14; +DOMException.INVALID_ACCESS_ERR = 15; + +/** + * @class DocumentFragment - + * DocumentFragment is a "lightweight" or "minimal" Document object. + * @extends Node + * @param ownerDocument : The Document object associated with this node. + */ +DocumentFragment = function(ownerDocument) { + Node.apply(this, arguments); + this.nodeName = "#document-fragment"; +}; +DocumentFragment.prototype = new Node(); +__extend__(DocumentFragment.prototype,{ + get nodeType(){ + return Node.DOCUMENT_FRAGMENT_NODE; + }, + get xml(){ + var xml = "", + count = this.childNodes.length; + + // create string concatenating the serialized ChildNodes + for (var i = 0; i < count; i++) { + xml += this.childNodes.item(i).xml; + } + + return xml; + }, + toString : function(){ + return "[object DocumentFragment]"; + }, + get localName(){ + return null; + } +}); + + +/** + * @class ProcessingInstruction - + * The ProcessingInstruction interface represents a + * "processing instruction", used in XML as a way to + * keep processor-specific information in the text of + * the document + * @extends Node + * @author Jon van Noort (jon@webarcana.com.au) + * @param ownerDocument : The Document object associated with this node. + */ +ProcessingInstruction = function(ownerDocument) { + Node.apply(this, arguments); +}; +ProcessingInstruction.prototype = new Node(); +__extend__(ProcessingInstruction.prototype, { + get data(){ + return this.nodeValue; + }, + set data(data){ + // throw Exception if Node is readonly + if (__ownerDocument__(this).errorChecking && this._readonly) { + throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR)); + } + this.nodeValue = data; + }, + get textContent(){ + return this.data; + }, + get localName(){ + return null; + }, + get target(){ + // The target of this processing instruction. + // XML defines this as being the first token following the markup that begins the processing instruction. + // The content of this processing instruction. + return this.nodeName; + }, + set target(value){ + // The target of this processing instruction. + // XML defines this as being the first token following the markup that begins the processing instruction. + // The content of this processing instruction. + this.nodeName = value; + }, + get nodeType(){ + return Node.PROCESSING_INSTRUCTION_NODE; + }, + get xml(){ + return ""; + }, + toString : function(){ + return "[object ProcessingInstruction]"; + } +}); + + +/** + * @author envjs team + */ + +Entity = function() { + throw new Error("Entity Not Implemented" ); +}; + +Entity.constants = { + // content taken from W3C "HTML 4.01 Specification" + // "W3C Recommendation 24 December 1999" + + nbsp: "\u00A0", + iexcl: "\u00A1", + cent: "\u00A2", + pound: "\u00A3", + curren: "\u00A4", + yen: "\u00A5", + brvbar: "\u00A6", + sect: "\u00A7", + uml: "\u00A8", + copy: "\u00A9", + ordf: "\u00AA", + laquo: "\u00AB", + not: "\u00AC", + shy: "\u00AD", + reg: "\u00AE", + macr: "\u00AF", + deg: "\u00B0", + plusmn: "\u00B1", + sup2: "\u00B2", + sup3: "\u00B3", + acute: "\u00B4", + micro: "\u00B5", + para: "\u00B6", + middot: "\u00B7", + cedil: "\u00B8", + sup1: "\u00B9", + ordm: "\u00BA", + raquo: "\u00BB", + frac14: "\u00BC", + frac12: "\u00BD", + frac34: "\u00BE", + iquest: "\u00BF", + Agrave: "\u00C0", + Aacute: "\u00C1", + Acirc: "\u00C2", + Atilde: "\u00C3", + Auml: "\u00C4", + Aring: "\u00C5", + AElig: "\u00C6", + Ccedil: "\u00C7", + Egrave: "\u00C8", + Eacute: "\u00C9", + Ecirc: "\u00CA", + Euml: "\u00CB", + Igrave: "\u00CC", + Iacute: "\u00CD", + Icirc: "\u00CE", + Iuml: "\u00CF", + ETH: "\u00D0", + Ntilde: "\u00D1", + Ograve: "\u00D2", + Oacute: "\u00D3", + Ocirc: "\u00D4", + Otilde: "\u00D5", + Ouml: "\u00D6", + times: "\u00D7", + Oslash: "\u00D8", + Ugrave: "\u00D9", + Uacute: "\u00DA", + Ucirc: "\u00DB", + Uuml: "\u00DC", + Yacute: "\u00DD", + THORN: "\u00DE", + szlig: "\u00DF", + agrave: "\u00E0", + aacute: "\u00E1", + acirc: "\u00E2", + atilde: "\u00E3", + auml: "\u00E4", + aring: "\u00E5", + aelig: "\u00E6", + ccedil: "\u00E7", + egrave: "\u00E8", + eacute: "\u00E9", + ecirc: "\u00EA", + euml: "\u00EB", + igrave: "\u00EC", + iacute: "\u00ED", + icirc: "\u00EE", + iuml: "\u00EF", + eth: "\u00F0", + ntilde: "\u00F1", + ograve: "\u00F2", + oacute: "\u00F3", + ocirc: "\u00F4", + otilde: "\u00F5", + ouml: "\u00F6", + divide: "\u00F7", + oslash: "\u00F8", + ugrave: "\u00F9", + uacute: "\u00FA", + ucirc: "\u00FB", + uuml: "\u00FC", + yacute: "\u00FD", + thorn: "\u00FE", + yuml: "\u00FF", + fnof: "\u0192", + Alpha: "\u0391", + Beta: "\u0392", + Gamma: "\u0393", + Delta: "\u0394", + Epsilon: "\u0395", + Zeta: "\u0396", + Eta: "\u0397", + Theta: "\u0398", + Iota: "\u0399", + Kappa: "\u039A", + Lambda: "\u039B", + Mu: "\u039C", + Nu: "\u039D", + Xi: "\u039E", + Omicron: "\u039F", + Pi: "\u03A0", + Rho: "\u03A1", + Sigma: "\u03A3", + Tau: "\u03A4", + Upsilon: "\u03A5", + Phi: "\u03A6", + Chi: "\u03A7", + Psi: "\u03A8", + Omega: "\u03A9", + alpha: "\u03B1", + beta: "\u03B2", + gamma: "\u03B3", + delta: "\u03B4", + epsilon: "\u03B5", + zeta: "\u03B6", + eta: "\u03B7", + theta: "\u03B8", + iota: "\u03B9", + kappa: "\u03BA", + lambda: "\u03BB", + mu: "\u03BC", + nu: "\u03BD", + xi: "\u03BE", + omicron: "\u03BF", + pi: "\u03C0", + rho: "\u03C1", + sigmaf: "\u03C2", + sigma: "\u03C3", + tau: "\u03C4", + upsilon: "\u03C5", + phi: "\u03C6", + chi: "\u03C7", + psi: "\u03C8", + omega: "\u03C9", + thetasym: "\u03D1", + upsih: "\u03D2", + piv: "\u03D6", + bull: "\u2022", + hellip: "\u2026", + prime: "\u2032", + Prime: "\u2033", + oline: "\u203E", + frasl: "\u2044", + weierp: "\u2118", + image: "\u2111", + real: "\u211C", + trade: "\u2122", + alefsym: "\u2135", + larr: "\u2190", + uarr: "\u2191", + rarr: "\u2192", + darr: "\u2193", + harr: "\u2194", + crarr: "\u21B5", + lArr: "\u21D0", + uArr: "\u21D1", + rArr: "\u21D2", + dArr: "\u21D3", + hArr: "\u21D4", + forall: "\u2200", + part: "\u2202", + exist: "\u2203", + empty: "\u2205", + nabla: "\u2207", + isin: "\u2208", + notin: "\u2209", + ni: "\u220B", + prod: "\u220F", + sum: "\u2211", + minus: "\u2212", + lowast: "\u2217", + radic: "\u221A", + prop: "\u221D", + infin: "\u221E", + ang: "\u2220", + and: "\u2227", + or: "\u2228", + cap: "\u2229", + cup: "\u222A", + intXX: "\u222B", + there4: "\u2234", + sim: "\u223C", + cong: "\u2245", + asymp: "\u2248", + ne: "\u2260", + equiv: "\u2261", + le: "\u2264", + ge: "\u2265", + sub: "\u2282", + sup: "\u2283", + nsub: "\u2284", + sube: "\u2286", + supe: "\u2287", + oplus: "\u2295", + otimes: "\u2297", + perp: "\u22A5", + sdot: "\u22C5", + lceil: "\u2308", + rceil: "\u2309", + lfloor: "\u230A", + rfloor: "\u230B", + lang: "\u2329", + rang: "\u232A", + loz: "\u25CA", + spades: "\u2660", + clubs: "\u2663", + hearts: "\u2665", + diams: "\u2666", + quot: "\u0022", + amp: "\u0026", + lt: "\u003C", + gt: "\u003E", + OElig: "\u0152", + oelig: "\u0153", + Scaron: "\u0160", + scaron: "\u0161", + Yuml: "\u0178", + circ: "\u02C6", + tilde: "\u02DC", + ensp: "\u2002", + emsp: "\u2003", + thinsp: "\u2009", + zwnj: "\u200C", + zwj: "\u200D", + lrm: "\u200E", + rlm: "\u200F", + ndash: "\u2013", + mdash: "\u2014", + lsquo: "\u2018", + rsquo: "\u2019", + sbquo: "\u201A", + ldquo: "\u201C", + rdquo: "\u201D", + bdquo: "\u201E", + dagger: "\u2020", + Dagger: "\u2021", + permil: "\u2030", + lsaquo: "\u2039", + rsaquo: "\u203A", + euro: "\u20AC", + + // non-standard entities + apos: "'" +}; + +/** + * @author envjs team + */ + +EntityReference = function() { + throw new Error("EntityReference Not Implemented" ); +}; + +/** + * @class DOMImplementation - + * provides a number of methods for performing operations + * that are independent of any particular instance of the + * document object model. + * + * @author Jon van Noort (jon@webarcana.com.au) + */ +DOMImplementation = function() { + this.preserveWhiteSpace = false; // by default, ignore whitespace + this.namespaceAware = true; // by default, handle namespaces + this.errorChecking = true; // by default, test for exceptions +}; + +__extend__(DOMImplementation.prototype,{ + // @param feature : string - The package name of the feature to test. + // the legal only values are "XML" and "CORE" (case-insensitive). + // @param version : string - This is the version number of the package + // name to test. In Level 1, this is the string "1.0".* + // @return : boolean + hasFeature : function(feature, version) { + var ret = false; + if (feature.toLowerCase() == "xml") { + ret = (!version || (version == "1.0") || (version == "2.0")); + } + else if (feature.toLowerCase() == "core") { + ret = (!version || (version == "2.0")); + } + else if (feature == "http://www.w3.org/TR/SVG11/feature#BasicStructure") { + ret = (version == "1.1"); + } + return ret; + }, + createDocumentType : function(qname, publicId, systemId){ + var doctype = new DocumentType(); + doctype.nodeName = qname?qname.toUpperCase():null; + doctype.publicId = publicId?publicId:null; + doctype.systemId = systemId?systemId:null; + return doctype; + }, + createDocument : function(nsuri, qname, doctype){ + + var doc = null, documentElement; + + doc = new Document(this, null); + if(doctype){ + doc.doctype = doctype; + } + + if(nsuri && qname){ + documentElement = doc.createElementNS(nsuri, qname); + }else if(qname){ + documentElement = doc.createElement(qname); + } + if(documentElement){ + doc.appendChild(documentElement); + } + return doc; + }, + createHTMLDocument : function(title){ + var doc = new HTMLDocument($implementation, null, ""); + var html = doc.createElement("html"); doc.appendChild(html); + var head = doc.createElement("head"); html.appendChild(head); + var body = doc.createElement("body"); html.appendChild(body); + var t = doc.createElement("title"); head.appendChild(t); + if( title) { + t.appendChild(doc.createTextNode(title)); + } + return doc; + }, + translateErrCode : function(code) { + //convert DOMException Code to human readable error message; + var msg = ""; + + switch (code) { + case DOMException.INDEX_SIZE_ERR : // 1 + msg = "INDEX_SIZE_ERR: Index out of bounds"; + break; + + case DOMException.DOMSTRING_SIZE_ERR : // 2 + msg = "DOMSTRING_SIZE_ERR: The resulting string is too long to fit in a DOMString"; + break; + + case DOMException.HIERARCHY_REQUEST_ERR : // 3 + msg = "HIERARCHY_REQUEST_ERR: The Node can not be inserted at this location"; + break; + + case DOMException.WRONG_DOCUMENT_ERR : // 4 + msg = "WRONG_DOCUMENT_ERR: The source and the destination Documents are not the same"; + break; + + case DOMException.INVALID_CHARACTER_ERR : // 5 + msg = "INVALID_CHARACTER_ERR: The string contains an invalid character"; + break; + + case DOMException.NO_DATA_ALLOWED_ERR : // 6 + msg = "NO_DATA_ALLOWED_ERR: This Node / NodeList does not support data"; + break; + + case DOMException.NO_MODIFICATION_ALLOWED_ERR : // 7 + msg = "NO_MODIFICATION_ALLOWED_ERR: This object cannot be modified"; + break; + + case DOMException.NOT_FOUND_ERR : // 8 + msg = "NOT_FOUND_ERR: The item cannot be found"; + break; + + case DOMException.NOT_SUPPORTED_ERR : // 9 + msg = "NOT_SUPPORTED_ERR: This implementation does not support function"; + break; + + case DOMException.INUSE_ATTRIBUTE_ERR : // 10 + msg = "INUSE_ATTRIBUTE_ERR: The Attribute has already been assigned to another Element"; + break; + + // Introduced in DOM Level 2: + case DOMException.INVALID_STATE_ERR : // 11 + msg = "INVALID_STATE_ERR: The object is no longer usable"; + break; + + case DOMException.SYNTAX_ERR : // 12 + msg = "SYNTAX_ERR: Syntax error"; + break; + + case DOMException.INVALID_MODIFICATION_ERR : // 13 + msg = "INVALID_MODIFICATION_ERR: Cannot change the type of the object"; + break; + + case DOMException.NAMESPACE_ERR : // 14 + msg = "NAMESPACE_ERR: The namespace declaration is incorrect"; + break; + + case DOMException.INVALID_ACCESS_ERR : // 15 + msg = "INVALID_ACCESS_ERR: The object does not support this function"; + break; + + default : + msg = "UNKNOWN: Unknown Exception Code ("+ code +")"; + } + + return msg; + }, + toString : function(){ + return "[object DOMImplementation]"; + } +}); + + + +/** + * @method DOMImplementation._isNamespaceDeclaration - Return true, if attributeName is a namespace declaration + * @author Jon van Noort (jon@webarcana.com.au) + * @param attributeName : string - the attribute name + * @return : boolean + */ +function __isNamespaceDeclaration__(attributeName) { + // test if attributeName is 'xmlns' + return (attributeName.indexOf('xmlns') > -1); +} + +/** + * @method DOMImplementation._isIdDeclaration - Return true, if attributeName is an id declaration + * @author Jon van Noort (jon@webarcana.com.au) + * @param attributeName : string - the attribute name + * @return : boolean + */ +function __isIdDeclaration__(attributeName) { + // test if attributeName is 'id' (case insensitive) + return attributeName?(attributeName.toLowerCase() == 'id'):false; +} + +/** + * @method DOMImplementation._isValidName - Return true, + * if name contains no invalid characters + * @author Jon van Noort (jon@webarcana.com.au) + * @param name : string - the candidate name + * @return : boolean + */ +function __isValidName__(name) { + // test if name contains only valid characters + return name.match(re_validName); +} +var re_validName = /^[a-zA-Z_:][a-zA-Z0-9\.\-_:]*$/; + +/** + * @method DOMImplementation._isValidString - Return true, if string does not contain any illegal chars + * All of the characters 0 through 31 and character 127 are nonprinting control characters. + * With the exception of characters 09, 10, and 13, (Ox09, Ox0A, and Ox0D) + * Note: different from _isValidName in that ValidStrings may contain spaces + * @author Jon van Noort (jon@webarcana.com.au) + * @param name : string - the candidate string + * @return : boolean + */ +function __isValidString__(name) { + // test that string does not contains invalid characters + return (name.search(re_invalidStringChars) < 0); +} +var re_invalidStringChars = /\x01|\x02|\x03|\x04|\x05|\x06|\x07|\x08|\x0B|\x0C|\x0E|\x0F|\x10|\x11|\x12|\x13|\x14|\x15|\x16|\x17|\x18|\x19|\x1A|\x1B|\x1C|\x1D|\x1E|\x1F|\x7F/; + +/** + * @method DOMImplementation._parseNSName - parse the namespace name. + * if there is no colon, the + * @author Jon van Noort (jon@webarcana.com.au) + * @param qualifiedName : string - The qualified name + * @return : NSName - [ + .prefix : string - The prefix part of the qname + .namespaceName : string - The namespaceURI part of the qname + ] + */ +function __parseNSName__(qualifiedName) { + var resultNSName = {}; + // unless the qname has a namespaceName, the prefix is the entire String + resultNSName.prefix = qualifiedName; + resultNSName.namespaceName = ""; + // split on ':' + var delimPos = qualifiedName.indexOf(':'); + if (delimPos > -1) { + // get prefix + resultNSName.prefix = qualifiedName.substring(0, delimPos); + // get namespaceName + resultNSName.namespaceName = qualifiedName.substring(delimPos +1, qualifiedName.length); + } + return resultNSName; +} + +/** + * @method DOMImplementation._parseQName - parse the qualified name + * @author Jon van Noort (jon@webarcana.com.au) + * @param qualifiedName : string - The qualified name + * @return : QName + */ +function __parseQName__(qualifiedName) { + var resultQName = {}; + // unless the qname has a prefix, the local name is the entire String + resultQName.localName = qualifiedName; + resultQName.prefix = ""; + // split on ':' + var delimPos = qualifiedName.indexOf(':'); + if (delimPos > -1) { + // get prefix + resultQName.prefix = qualifiedName.substring(0, delimPos); + // get localName + resultQName.localName = qualifiedName.substring(delimPos +1, qualifiedName.length); + } + return resultQName; +} +/** + * @author envjs team + */ +Notation = function() { + throw new Error("Notation Not Implemented" ); +};/** + * @author thatcher + */ +Range = function(){ + +}; + +__extend__(Range.prototype, { + get startContainer(){ + + }, + get endContainer(){ + + }, + get startOffset(){ + + }, + get endOffset(){ + + }, + get collapsed(){ + + }, + get commonAncestorContainer(){ + + }, + setStart: function(refNode, offset){//throws RangeException + + }, + setEnd: function(refNode, offset){//throws RangeException + + }, + setStartBefore: function(refNode){//throws RangeException + + }, + setStartAfter: function(refNode){//throws RangeException + + }, + setEndBefore: function(refNode){//throws RangeException + + }, + setEndAfter: function(refNode){//throws RangeException + + }, + collapse: function(toStart){//throws RangeException + + }, + selectNode: function(refNode){//throws RangeException + + }, + selectNodeContents: function(refNode){//throws RangeException + + }, + compareBoundaryPoints: function(how, sourceRange){ + + }, + deleteContents: function(){ + + }, + extractContents: function(){ + + }, + cloneContents: function(){ + + }, + insertNode: function(newNode){ + + }, + surroundContents: function(newParent){ + + }, + cloneRange: function(){ + + }, + toString: function(){ + return '[object Range]'; + }, + detach: function(){ + + } +}); + + + // CompareHow +Range.START_TO_START = 0; +Range.START_TO_END = 1; +Range.END_TO_END = 2; +Range.END_TO_START = 3; + +/* + * Forward declarations + */ +var __isValidNamespace__; + +/** + * @class Document - The Document interface represents the entire HTML + * or XML document. Conceptually, it is the root of the document tree, + * and provides the primary access to the document's data. + * + * @extends Node + * @param implementation : DOMImplementation - the creator Implementation + */ +Document = function(implementation, docParentWindow) { + Node.apply(this, arguments); + + //TODO: Temporary!!! Cnage back to true!!! + this.async = true; + // The Document Type Declaration (see DocumentType) associated with this document + this.doctype = null; + // The DOMImplementation object that handles this document. + this.implementation = implementation; + + this.nodeName = "#document"; + // initially false, set to true by parser + this.parsing = false; + this.baseURI = 'about:blank'; + + this.ownerDocument = null; + + this.importing = false; +}; + +Document.prototype = new Node(); +__extend__(Document.prototype,{ + get localName(){ + return null; + }, + get textContent(){ + return null; + }, + get all(){ + return this.getElementsByTagName("*"); + }, + get documentElement(){ + var i, length = this.childNodes?this.childNodes.length:0; + for(i=0;i -1 ){ + valid = false; + } + + if ((valid) && (!isAttribute)) { + // if the namespaceURI is not null + if (!namespaceURI) { + valid = false; + } + } + + // if the qualifiedName has a prefix + if ((valid) && (qName.prefix === "")) { + valid = false; + } + } + + // if the qualifiedName has a prefix that is "xml" and the namespaceURI is + // different from "http://www.w3.org/XML/1998/namespace" [Namespaces]. + if ((valid) && (qName.prefix === "xml") && (namespaceURI !== "http://www.w3.org/XML/1998/namespace")) { + valid = false; + } + + return valid; +}; +/** + * + * This file only handles XML parser. + * It is extended by parser/domparser.js (and parser/htmlparser.js) + * + * This depends on e4x, which some engines may not have. + * + * @author thatcher + */ +DOMParser = function(principle, documentURI, baseURI) { + // TODO: why/what should these 3 args do? +}; +__extend__(DOMParser.prototype,{ + parseFromString: function(xmlstring, mimetype){ + var doc = new Document(new DOMImplementation()), + e4; + + // The following are e4x directives. + // Full spec is here: + // http://www.ecma-international.org/publications/standards/Ecma-357.htm + // + // that is pretty gross, so checkout this summary + // http://rephrase.net/days/07/06/e4x + // + // also see the Mozilla Developer Center: + // https://developer.mozilla.org/en/E4X + // + XML.ignoreComments = false; + XML.ignoreProcessingInstructions = false; + XML.ignoreWhitespace = false; + + // for some reason e4x can't handle initial xml declarations + // https://bugzilla.mozilla.org/show_bug.cgi?id=336551 + // The official workaround is the big regexp below + // but simpler one seems to be ok + // xmlstring = xmlstring.replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>/, ""); + // + xmlstring = xmlstring.replace(/<\?xml.*\?>/); + + e4 = new XMLList(xmlstring); + + __toDomNode__(e4, doc, doc); + + //console.log('xml \n %s', doc.documentElement.xml); + return doc; + } +}); + +var __toDomNode__ = function(e4, parent, doc){ + var xnode, + domnode, + children, + target, + value, + length, + element, + kind, + item; + //console.log('converting e4x node list \n %s', e4) + + // not using the for each(item in e4) since some engines can't + // handle the syntax (i.e. says syntax error) + // + // for each(xnode in e4) { + for (item in e4) { + // NO do not do this if (e4.hasOwnProperty(item)) { + // breaks spidermonkey + xnode = e4[item]; + + kind = xnode.nodeKind(); + //console.log('treating node kind %s', kind); + switch(kind){ + case 'element': + // add node + //console.log('creating element %s %s', xnode.localName(), xnode.namespace()); + if(xnode.namespace() && (xnode.namespace()+'') !== ''){ + //console.log('createElementNS %s %s',xnode.namespace()+'', xnode.localName() ); + domnode = doc.createElementNS(xnode.namespace()+'', xnode.localName()); + }else{ + domnode = doc.createElement(xnode.name()+''); + } + parent.appendChild(domnode); + + // add attributes + __toDomNode__(xnode.attributes(), domnode, doc); + + // add children + children = xnode.children(); + length = children.length(); + //console.log('recursing? %s', length ? 'yes' : 'no'); + if (length > 0) { + __toDomNode__(children, domnode, doc); + } + break; + case 'attribute': + // console.log('setting attribute %s %s %s', + // xnode.localName(), xnode.namespace(), xnode.valueOf()); + + // + // cross-platform alert. The original code used + // xnode.text() to get the attribute value + // This worked in Rhino, but did not in Spidermonkey + // valueOf seemed to work in both + // + if(xnode.namespace() && xnode.namespace().prefix){ + //console.log("%s", xnode.namespace().prefix); + parent.setAttributeNS(xnode.namespace()+'', + xnode.namespace().prefix+':'+xnode.localName(), + xnode.valueOf()); + }else if((xnode.name()+'').match('http://www.w3.org/2000/xmlns/::')){ + if(xnode.localName()!=='xmlns'){ + parent.setAttributeNS('http://www.w3.org/2000/xmlns/', + 'xmlns:'+xnode.localName(), + xnode.valueOf()); + } + }else{ + parent.setAttribute(xnode.localName()+'', xnode.valueOf()); + } + break; + case 'text': + //console.log('creating text node : %s', xnode); + domnode = doc.createTextNode(xnode+''); + parent.appendChild(domnode); + break; + case 'comment': + //console.log('creating comment node : %s', xnode); + value = xnode+''; + domnode = doc.createComment(value.substring(4,value.length-3)); + parent.appendChild(domnode); + break; + case 'processing-instruction': + //console.log('creating processing-instruction node : %s', xnode); + value = xnode+''; + target = value.split(' ')[0].substring(2); + value = value.split(' ').splice(1).join(' ').replace('?>',''); + //console.log('creating processing-instruction data : %s', value); + domnode = doc.createProcessingInstruction(target, value); + parent.appendChild(domnode); + break; + default: + console.log('e4x DOM ERROR'); + throw new Error("Assertion failed in xml parser"); + } + } +}; +/** + * @author envjs team + * @class XMLSerializer + */ + +XMLSerializer = function() {}; + +__extend__(XMLSerializer.prototype, { + serializeToString: function(node){ + return node.xml; + }, + toString : function(){ + return "[object XMLSerializer]"; + } +}); + +/** + * @author john resig & the envjs team + * @uri http://www.envjs.com/ + * @copyright 2008-2010 + * @license MIT + */ +//CLOSURE_END +}()); +/* + * Envjs event.1.2.13 + * Pure JavaScript Browser Environment + * By John Resig and the Envjs Team + * Copyright 2008-2010 John Resig, under the MIT License + * + * This file simply provides the global definitions we need to + * be able to correctly implement to core browser DOM Event interfaces. + */ +var Event, + MouseEvent, + UIEvent, + KeyboardEvent, + MutationEvent, + DocumentEvent, + EventTarget, + EventException, + //nonstandard but very useful for implementing mutation events + //among other things like general profiling + Aspect; +/* + * Envjs event.1.2.13 + * Pure JavaScript Browser Environment + * By John Resig and the Envjs Team + * Copyright 2008-2010 John Resig, under the MIT License + */ + +//CLOSURE_START +(function(){ + + + + + +/** + * @author john resig + */ +// Helper method for extending one object with another. +function __extend__(a,b) { + for ( var i in b ) { + var g = b.__lookupGetter__(i), s = b.__lookupSetter__(i); + if ( g || s ) { + if ( g ) { a.__defineGetter__(i, g); } + if ( s ) { a.__defineSetter__(i, s); } + } else { + a[i] = b[i]; + } + } return a; +} + +/** + * @author john resig + */ +//from jQuery +function __setArray__( target, array ) { + // Resetting the length to 0, then using the native Array push + // is a super-fast way to populate an object with array-like properties + target.length = 0; + Array.prototype.push.apply( target, array ); +} +/** + * Borrowed with love from: + * + * jQuery AOP - jQuery plugin to add features of aspect-oriented programming (AOP) to jQuery. + * http://jquery-aop.googlecode.com/ + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/mit-license.php + * + * Version: 1.1 + */ +(function() { + + var _after = 1; + var _before = 2; + var _around = 3; + var _intro = 4; + var _regexEnabled = true; + + /** + * Private weaving function. + */ + var weaveOne = function(source, method, advice) { + + var old = source[method]; + + var aspect; + if (advice.type == _after) + aspect = function() { + var returnValue = old.apply(this, arguments); + return advice.value.apply(this, [returnValue, method]); + }; + else if (advice.type == _before) + aspect = function() { + advice.value.apply(this, [arguments, method]); + return old.apply(this, arguments); + }; + else if (advice.type == _intro) + aspect = function() { + return advice.value.apply(this, arguments); + }; + else if (advice.type == _around) { + aspect = function() { + var invocation = { object: this, args: arguments }; + return advice.value.apply(invocation.object, [{ arguments: invocation.args, method: method, proceed : + function() { + return old.apply(invocation.object, invocation.args); + } + }] ); + }; + } + + aspect.unweave = function() { + source[method] = old; + pointcut = source = aspect = old = null; + }; + + source[method] = aspect; + + return aspect; + + }; + + + /** + * Private weaver and pointcut parser. + */ + var weave = function(pointcut, advice) + { + + var source = (typeof(pointcut.target.prototype) != 'undefined') ? pointcut.target.prototype : pointcut.target; + var advices = []; + + // If it's not an introduction and no method was found, try with regex... + if (advice.type != _intro && typeof(source[pointcut.method]) == 'undefined') + { + + for (var method in source) + { + if (source[method] != null && source[method] instanceof Function && method.match(pointcut.method)) + { + advices[advices.length] = weaveOne(source, method, advice); + } + } + + if (advices.length == 0) + throw 'No method: ' + pointcut.method; + + } + else + { + // Return as an array of one element + advices[0] = weaveOne(source, pointcut.method, advice); + } + + return _regexEnabled ? advices : advices[0]; + + }; + + Aspect = + { + /** + * Creates an advice after the defined point-cut. The advice will be executed after the point-cut method + * has completed execution successfully, and will receive one parameter with the result of the execution. + * This function returns an array of weaved aspects (Function). + * + * @example jQuery.aop.after( {target: window, method: 'MyGlobalMethod'}, function(result) { alert('Returned: ' + result); } ); + * @result Array + * + * @example jQuery.aop.after( {target: String, method: 'indexOf'}, function(index) { alert('Result found at: ' + index + ' on:' + this); } ); + * @result Array + * + * @name after + * @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved. + * @option Object target Target object to be weaved. + * @option String method Name of the function to be weaved. Regex are supported, but not on built-in objects. + * @param Function advice Function containing the code that will get called after the execution of the point-cut. It receives one parameter + * with the result of the point-cut's execution. + * + * @type Array + * @cat Plugins/General + */ + after : function(pointcut, advice) + { + return weave( pointcut, { type: _after, value: advice } ); + }, + + /** + * Creates an advice before the defined point-cut. The advice will be executed before the point-cut method + * but cannot modify the behavior of the method, or prevent its execution. + * This function returns an array of weaved aspects (Function). + * + * @example jQuery.aop.before( {target: window, method: 'MyGlobalMethod'}, function() { alert('About to execute MyGlobalMethod'); } ); + * @result Array + * + * @example jQuery.aop.before( {target: String, method: 'indexOf'}, function(index) { alert('About to execute String.indexOf on: ' + this); } ); + * @result Array + * + * @name before + * @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved. + * @option Object target Target object to be weaved. + * @option String method Name of the function to be weaved. Regex are supported, but not on built-in objects. + * @param Function advice Function containing the code that will get called before the execution of the point-cut. + * + * @type Array + * @cat Plugins/General + */ + before : function(pointcut, advice) + { + return weave( pointcut, { type: _before, value: advice } ); + }, + + + /** + * Creates an advice 'around' the defined point-cut. This type of advice can control the point-cut method execution by calling + * the functions '.proceed()' on the 'invocation' object, and also, can modify the arguments collection before sending them to the function call. + * This function returns an array of weaved aspects (Function). + * + * @example jQuery.aop.around( {target: window, method: 'MyGlobalMethod'}, function(invocation) { + * alert('# of Arguments: ' + invocation.arguments.length); + * return invocation.proceed(); + * } ); + * @result Array + * + * @example jQuery.aop.around( {target: String, method: 'indexOf'}, function(invocation) { + * alert('Searching: ' + invocation.arguments[0] + ' on: ' + this); + * return invocation.proceed(); + * } ); + * @result Array + * + * @example jQuery.aop.around( {target: window, method: /Get(\d+)/}, function(invocation) { + * alert('Executing ' + invocation.method); + * return invocation.proceed(); + * } ); + * @desc Matches all global methods starting with 'Get' and followed by a number. + * @result Array + * + * + * @name around + * @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved. + * @option Object target Target object to be weaved. + * @option String method Name of the function to be weaved. Regex are supported, but not on built-in objects. + * @param Function advice Function containing the code that will get called around the execution of the point-cut. This advice will be called with one + * argument containing one function '.proceed()', the collection of arguments '.arguments', and the matched method name '.method'. + * + * @type Array + * @cat Plugins/General + */ + around : function(pointcut, advice) + { + return weave( pointcut, { type: _around, value: advice } ); + }, + + /** + * Creates an introduction on the defined point-cut. This type of advice replaces any existing methods with the same + * name. To restore them, just unweave it. + * This function returns an array with only one weaved aspect (Function). + * + * @example jQuery.aop.introduction( {target: window, method: 'MyGlobalMethod'}, function(result) { alert('Returned: ' + result); } ); + * @result Array + * + * @example jQuery.aop.introduction( {target: String, method: 'log'}, function() { alert('Console: ' + this); } ); + * @result Array + * + * @name introduction + * @param Map pointcut Definition of the point-cut to apply the advice. A point-cut is the definition of the object/s and method/s to be weaved. + * @option Object target Target object to be weaved. + * @option String method Name of the function to be weaved. + * @param Function advice Function containing the code that will be executed on the point-cut. + * + * @type Array + * @cat Plugins/General + */ + introduction : function(pointcut, advice) + { + return weave( pointcut, { type: _intro, value: advice } ); + }, + + /** + * Configures global options. + * + * @name setup + * @param Map settings Configuration options. + * @option Boolean regexMatch Enables/disables regex matching of method names. + * + * @example jQuery.aop.setup( { regexMatch: false } ); + * @desc Disable regex matching. + * + * @type Void + * @cat Plugins/General + */ + setup: function(settings) + { + _regexEnabled = settings.regexMatch; + } + }; + +})(); + + + + +/** + * @name EventTarget + * @w3c:domlevel 2 + * @uri -//TODO: paste dom event level 2 w3c spc uri here + */ +EventTarget = function(){}; +EventTarget.prototype.addEventListener = function(type, fn, phase){ + __addEventListener__(this, type, fn, phase); +}; +EventTarget.prototype.removeEventListener = function(type, fn){ + __removeEventListener__(this, type, fn); +}; +EventTarget.prototype.dispatchEvent = function(event, bubbles){ + __dispatchEvent__(this, event, bubbles); +}; + +__extend__(Node.prototype, EventTarget.prototype); + + +var $events = [{}]; + +function __addEventListener__(target, type, fn, phase){ + phase = !!phase?"CAPTURING":"BUBBLING"; + if ( !target.uuid ) { + //console.log('event uuid %s %s', target, target.uuid); + target.uuid = $events.length+''; + } + if ( !$events[target.uuid] ) { + //console.log('creating listener for target: %s %s', target, target.uuid); + $events[target.uuid] = {}; + } + if ( !$events[target.uuid][type] ){ + //console.log('creating listener for type: %s %s %s', target, target.uuid, type); + $events[target.uuid][type] = { + CAPTURING:[], + BUBBLING:[] + }; + } + if ( $events[target.uuid][type][phase].indexOf( fn ) < 0 ){ + //console.log('adding event listener %s %s %s %s %s %s', target, target.uuid, type, phase, + // $events[target.uuid][type][phase].length, $events[target.uuid][type][phase].indexOf( fn )); + //console.log('creating listener for function: %s %s %s', target, target.uuid, phase); + $events[target.uuid][type][phase].push( fn ); + //console.log('adding event listener %s %s %s %s %s %s', target, target.uuid, type, phase, + // $events[target.uuid][type][phase].length, $events[target.uuid][type][phase].indexOf( fn )); + } + //console.log('registered event listeners %s', $events.length); +} + +function __removeEventListener__(target, type, fn, phase){ + + phase = !!phase?"CAPTURING":"BUBBLING"; + if ( !target.uuid ) { + return; + } + if ( !$events[target.uuid] ) { + return; + } + if(type == '*'){ + //used to clean all event listeners for a given node + //console.log('cleaning all event listeners for node %s %s',target, target.uuid); + delete $events[target.uuid]; + return; + }else if ( !$events[target.uuid][type] ){ + return; + } + $events[target.uuid][type][phase] = + $events[target.uuid][type][phase].filter(function(f){ + //console.log('removing event listener %s %s %s %s', target, type, phase, fn); + return f != fn; + }); +} + +var __eventuuid__ = 0; +function __dispatchEvent__(target, event, bubbles){ + + if (!event.uuid) { + event.uuid = __eventuuid__++; + } + //the window scope defines the $event object, for IE(^^^) compatibility; + //$event = event; + //console.log('dispatching event %s', event.uuid); + if (bubbles === undefined || bubbles === null) { + bubbles = true; + } + + if (!event.target) { + event.target = target; + } + + //console.log('dispatching? %s %s %s', target, event.type, bubbles); + if ( event.type && (target.nodeType || target === window )) { + + //console.log('dispatching event %s %s %s', target, event.type, bubbles); + __captureEvent__(target, event); + + event.eventPhase = Event.AT_TARGET; + if ( target.uuid && $events[target.uuid] && $events[target.uuid][event.type] ) { + event.currentTarget = target; + //console.log('dispatching %s %s %s %s', target, event.type, + // $events[target.uuid][event.type]['CAPTURING'].length); + $events[target.uuid][event.type].CAPTURING.forEach(function(fn){ + //console.log('AT_TARGET (CAPTURING) event %s', fn); + var returnValue = fn( event ); + //console.log('AT_TARGET (CAPTURING) return value %s', returnValue); + if(returnValue === false){ + event.stopPropagation(); + } + }); + //console.log('dispatching %s %s %s %s', target, event.type, + // $events[target.uuid][event.type]['BUBBLING'].length); + $events[target.uuid][event.type].BUBBLING.forEach(function(fn){ + //console.log('AT_TARGET (BUBBLING) event %s', fn); + var returnValue = fn( event ); + //console.log('AT_TARGET (BUBBLING) return value %s', returnValue); + if(returnValue === false){ + event.stopPropagation(); + } + }); + } + if (target["on" + event.type]) { + target["on" + event.type](event); + } + if (bubbles && !event.cancelled){ + __bubbleEvent__(target, event); + } + if(!event._preventDefault){ + //At this point I'm guessing that just HTMLEvents are concerned + //with default behavior being executed in a browser but I could be + //wrong as usual. The goal is much more to filter at this point + //what events have no need to be handled + //console.log('triggering default behavior for %s', event.type); + if(event.type in Envjs.defaultEventBehaviors){ + Envjs.defaultEventBehaviors[event.type](event); + } + } + //console.log('deleting event %s', event.uuid); + event.target = null; + event = null; + }else{ + throw new EventException(EventException.UNSPECIFIED_EVENT_TYPE_ERR); + } +} + +function __captureEvent__(target, event){ + var ancestorStack = [], + parent = target.parentNode; + + event.eventPhase = Event.CAPTURING_PHASE; + while(parent){ + if(parent.uuid && $events[parent.uuid] && $events[parent.uuid][event.type]){ + ancestorStack.push(parent); + } + parent = parent.parentNode; + } + while(ancestorStack.length && !event.cancelled){ + event.currentTarget = ancestorStack.pop(); + if($events[event.currentTarget.uuid] && $events[event.currentTarget.uuid][event.type]){ + $events[event.currentTarget.uuid][event.type].CAPTURING.forEach(function(fn){ + var returnValue = fn( event ); + if(returnValue === false){ + event.stopPropagation(); + } + }); + } + } +} + +function __bubbleEvent__(target, event){ + var parent = target.parentNode; + event.eventPhase = Event.BUBBLING_PHASE; + while(parent){ + if(parent.uuid && $events[parent.uuid] && $events[parent.uuid][event.type] ){ + event.currentTarget = parent; + $events[event.currentTarget.uuid][event.type].BUBBLING.forEach(function(fn){ + var returnValue = fn( event ); + if(returnValue === false){ + event.stopPropagation(); + } + }); + } + parent = parent.parentNode; + } +} + +/** + * @class Event + */ +Event = function(options){ + // event state is kept read-only by forcing + // a new object for each event. This may not + // be appropriate in the long run and we'll + // have to decide if we simply dont adhere to + // the read-only restriction of the specification + this._bubbles = true; + this._cancelable = true; + this._cancelled = false; + this._currentTarget = null; + this._target = null; + this._eventPhase = Event.AT_TARGET; + this._timeStamp = new Date().getTime(); + this._preventDefault = false; + this._stopPropogation = false; +}; + +__extend__(Event.prototype,{ + get bubbles(){return this._bubbles;}, + get cancelable(){return this._cancelable;}, + get currentTarget(){return this._currentTarget;}, + set currentTarget(currentTarget){ this._currentTarget = currentTarget; }, + get eventPhase(){return this._eventPhase;}, + set eventPhase(eventPhase){this._eventPhase = eventPhase;}, + get target(){return this._target;}, + set target(target){ this._target = target;}, + get timeStamp(){return this._timeStamp;}, + get type(){return this._type;}, + initEvent: function(type, bubbles, cancelable){ + this._type=type?type:''; + this._bubbles=!!bubbles; + this._cancelable=!!cancelable; + }, + preventDefault: function(){ + this._preventDefault = true; + }, + stopPropagation: function(){ + if(this._cancelable){ + this._cancelled = true; + this._bubbles = false; + } + }, + get cancelled(){ + return this._cancelled; + }, + toString: function(){ + return '[object Event]'; + } +}); + +__extend__(Event,{ + CAPTURING_PHASE : 1, + AT_TARGET : 2, + BUBBLING_PHASE : 3 +}); + + + +/** + * @name UIEvent + * @param {Object} options + */ +UIEvent = function(options) { + this._view = null; + this._detail = 0; +}; + +UIEvent.prototype = new Event(); +__extend__(UIEvent.prototype,{ + get view(){ + return this._view; + }, + get detail(){ + return this._detail; + }, + initUIEvent: function(type, bubbles, cancelable, windowObject, detail){ + this.initEvent(type, bubbles, cancelable); + this._detail = 0; + this._view = windowObject; + } +}); + +var $onblur, + $onfocus, + $onresize; + + +/** + * @name MouseEvent + * @w3c:domlevel 2 + * @uri http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html + */ +MouseEvent = function(options) { + this._screenX= 0; + this._screenY= 0; + this._clientX= 0; + this._clientY= 0; + this._ctrlKey= false; + this._metaKey= false; + this._altKey= false; + this._button= null; + this._relatedTarget= null; +}; +MouseEvent.prototype = new UIEvent(); +__extend__(MouseEvent.prototype,{ + get screenX(){ + return this._screenX; + }, + get screenY(){ + return this._screenY; + }, + get clientX(){ + return this._clientX; + }, + get clientY(){ + return this._clientY; + }, + get ctrlKey(){ + return this._ctrlKey; + }, + get altKey(){ + return this._altKey; + }, + get shiftKey(){ + return this._shiftKey; + }, + get metaKey(){ + return this._metaKey; + }, + get button(){ + return this._button; + }, + get relatedTarget(){ + return this._relatedTarget; + }, + initMouseEvent: function(type, bubbles, cancelable, windowObject, detail, + screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, + metaKey, button, relatedTarget){ + this.initUIEvent(type, bubbles, cancelable, windowObject, detail); + this._screenX = screenX; + this._screenY = screenY; + this._clientX = clientX; + this._clientY = clientY; + this._ctrlKey = ctrlKey; + this._altKey = altKey; + this._shiftKey = shiftKey; + this._metaKey = metaKey; + this._button = button; + this._relatedTarget = relatedTarget; + } +}); + +/** + * Interface KeyboardEvent (introduced in DOM Level 3) + */ +KeyboardEvent = function(options) { + this._keyIdentifier = 0; + this._keyLocation = 0; + this._ctrlKey = false; + this._metaKey = false; + this._altKey = false; + this._metaKey = false; +}; +KeyboardEvent.prototype = new UIEvent(); + +__extend__(KeyboardEvent.prototype,{ + + get ctrlKey(){ + return this._ctrlKey; + }, + get altKey(){ + return this._altKey; + }, + get shiftKey(){ + return this._shiftKey; + }, + get metaKey(){ + return this._metaKey; + }, + get button(){ + return this._button; + }, + get relatedTarget(){ + return this._relatedTarget; + }, + getModifiersState: function(keyIdentifier){ + + }, + initMouseEvent: function(type, bubbles, cancelable, windowObject, + keyIdentifier, keyLocation, modifiersList, repeat){ + this.initUIEvent(type, bubbles, cancelable, windowObject, 0); + this._keyIdentifier = keyIdentifier; + this._keyLocation = keyLocation; + this._modifiersList = modifiersList; + this._repeat = repeat; + } +}); + +KeyboardEvent.DOM_KEY_LOCATION_STANDARD = 0; +KeyboardEvent.DOM_KEY_LOCATION_LEFT = 1; +KeyboardEvent.DOM_KEY_LOCATION_RIGHT = 2; +KeyboardEvent.DOM_KEY_LOCATION_NUMPAD = 3; +KeyboardEvent.DOM_KEY_LOCATION_MOBILE = 4; +KeyboardEvent.DOM_KEY_LOCATION_JOYSTICK = 5; + + + +//We dont fire mutation events until someone has registered for them +var __supportedMutations__ = /DOMSubtreeModified|DOMNodeInserted|DOMNodeRemoved|DOMAttrModified|DOMCharacterDataModified/; + +var __fireMutationEvents__ = Aspect.before({ + target: EventTarget, + method: 'addEventListener' +}, function(target, type){ + if(type && type.match(__supportedMutations__)){ + //unweaving removes the __addEventListener__ aspect + __fireMutationEvents__.unweave(); + // These two methods are enough to cover all dom 2 manipulations + Aspect.around({ + target: Node, + method:"removeChild" + }, function(invocation){ + var event, + node = invocation.arguments[0]; + event = node.ownerDocument.createEvent('MutationEvents'); + event.initEvent('DOMNodeRemoved', true, false, node.parentNode, null, null, null, null); + node.dispatchEvent(event, false); + return invocation.proceed(); + + }); + Aspect.around({ + target: Node, + method:"appendChild" + }, function(invocation) { + var event, + node = invocation.proceed(); + event = node.ownerDocument.createEvent('MutationEvents'); + event.initEvent('DOMNodeInserted', true, false, node.parentNode, null, null, null, null); + node.dispatchEvent(event, false); + return node; + }); + } +}); + +/** + * @name MutationEvent + * @param {Object} options + */ +MutationEvent = function(options) { + this._cancelable = false; + this._timeStamp = 0; +}; + +MutationEvent.prototype = new Event(); +__extend__(MutationEvent.prototype,{ + get relatedNode(){ + return this._relatedNode; + }, + get prevValue(){ + return this._prevValue; + }, + get newValue(){ + return this._newValue; + }, + get attrName(){ + return this._attrName; + }, + get attrChange(){ + return this._attrChange; + }, + initMutationEvent: function( type, bubbles, cancelable, + relatedNode, prevValue, newValue, attrName, attrChange ){ + this._relatedNode = relatedNode; + this._prevValue = prevValue; + this._newValue = newValue; + this._attrName = attrName; + this._attrChange = attrChange; + switch(type){ + case "DOMSubtreeModified": + this.initEvent(type, true, false); + break; + case "DOMNodeInserted": + this.initEvent(type, true, false); + break; + case "DOMNodeRemoved": + this.initEvent(type, true, false); + break; + case "DOMNodeRemovedFromDocument": + this.initEvent(type, false, false); + break; + case "DOMNodeInsertedIntoDocument": + this.initEvent(type, false, false); + break; + case "DOMAttrModified": + this.initEvent(type, true, false); + break; + case "DOMCharacterDataModified": + this.initEvent(type, true, false); + break; + default: + this.initEvent(type, bubbles, cancelable); + } + } +}); + +// constants +MutationEvent.ADDITION = 0; +MutationEvent.MODIFICATION = 1; +MutationEvent.REMOVAL = 2; + + +/** + * @name EventException + */ +EventException = function(code) { + this.code = code; +}; +EventException.UNSPECIFIED_EVENT_TYPE_ERR = 0; +/** + * + * DOM Level 2: http://www.w3.org/TR/DOM-Level-2-Events/events.html + * DOM Level 3: http://www.w3.org/TR/DOM-Level-3-Events/ + * + * interface DocumentEvent { + * Event createEvent (in DOMString eventType) + * raises (DOMException); + * }; + * + * Firefox (3.6) exposes DocumentEvent + * Safari (4) does NOT. + */ + +/** + * TODO: Not sure we need a full prototype. We not just an regular object? + */ +DocumentEvent = function(){}; +DocumentEvent.prototype.__EventMap__ = { + // Safari4: singular and plural forms accepted + // Firefox3.6: singular and plural forms accepted + 'Event' : Event, + 'Events' : Event, + 'UIEvent' : UIEvent, + 'UIEvents' : UIEvent, + 'MouseEvent' : MouseEvent, + 'MouseEvents' : MouseEvent, + 'MutationEvent' : MutationEvent, + 'MutationEvents' : MutationEvent, + + // Safari4: accepts HTMLEvents, but not HTMLEvent + // Firefox3.6: accepts HTMLEvents, but not HTMLEvent + 'HTMLEvent' : Event, + 'HTMLEvents' : Event, + + // Safari4: both not accepted + // Firefox3.6, only KeyEvents is accepted + 'KeyEvent' : KeyboardEvent, + 'KeyEvents' : KeyboardEvent, + + // Safari4: both accepted + // Firefox3.6: none accepted + 'KeyboardEvent' : KeyboardEvent, + 'KeyboardEvents' : KeyboardEvent +}; + +DocumentEvent.prototype.createEvent = function(eventType) { + var Clazz = this.__EventMap__[eventType]; + if (Clazz) { + return new Clazz(); + } + throw(new DOMException(DOMException.NOT_SUPPORTED_ERR)); +}; + +__extend__(Document.prototype, DocumentEvent.prototype); + +/** + * @author john resig & the envjs team + * @uri http://www.envjs.com/ + * @copyright 2008-2010 + * @license MIT + */ +//CLOSURE_END +}()); + +/* + * Envjs timer.1.2.13 + * Pure JavaScript Browser Environment + * By John Resig and the Envjs Team + * Copyright 2008-2010 John Resig, under the MIT License + * + * Parts of the implementation were originally written by:\ + * Steven Parkes + * + * requires Envjs.wait, Envjs.sleep, Envjs.WAIT_INTERVAL + */ +var setTimeout, + clearTimeout, + setInterval, + clearInterval; + +/* + * Envjs timer.1.2.13 + * Pure JavaScript Browser Environment + * By John Resig and the Envjs Team + * Copyright 2008-2010 John Resig, under the MIT License + */ + +//CLOSURE_START +(function(){ + + + + +/* +* timer.js +* implementation provided by Steven Parkes +*/ + +//private +var $timers = [], + EVENT_LOOP_RUNNING = false; + +$timers.lock = function(fn){ + Envjs.sync(fn)(); +}; + +//private internal class +var Timer = function(fn, interval){ + this.fn = fn; + this.interval = interval; + this.at = Date.now() + interval; + // allows for calling wait() from callbacks + this.running = false; +}; + +Timer.prototype.start = function(){}; +Timer.prototype.stop = function(){}; + +//static +Timer.normalize = function(time) { + time = time*1; + if ( isNaN(time) || time < 0 ) { + time = 0; + } + + if ( EVENT_LOOP_RUNNING && time < Timer.MIN_TIME ) { + time = Timer.MIN_TIME; + } + return time; +}; +// html5 says this should be at least 4, but the parser is using +// a setTimeout for the SAX stuff which messes up the world +Timer.MIN_TIME = /* 4 */ 0; + +/** + * @function setTimeout + * @param {Object} fn + * @param {Object} time + */ +setTimeout = function(fn, time){ + var num; + time = Timer.normalize(time); + $timers.lock(function(){ + num = $timers.length+1; + var tfn; + if (typeof fn == 'string') { + tfn = function() { + try { + // eval in global scope + eval(fn, null); + } catch (e) { + console.log('timer error %s %s', fn, e); + } finally { + clearInterval(num); + } + }; + } else { + tfn = function() { + try { + fn(); + } catch (e) { + console.log('timer error %s %s', fn, e); + } finally { + clearInterval(num); + } + }; + } + //console.log("Creating timer number %s", num); + $timers[num] = new Timer(tfn, time); + $timers[num].start(); + }); + return num; +}; + +/** + * @function setInterval + * @param {Object} fn + * @param {Object} time + */ +setInterval = function(fn, time){ + //console.log('setting interval %s %s', time, fn.toString().substring(0,64)); + time = Timer.normalize(time); + if ( time < 10 ) { + time = 10; + } + if (typeof fn == 'string') { + var fnstr = fn; + fn = function() { + eval(fnstr); + }; + } + var num; + $timers.lock(function(){ + num = $timers.length+1; + //Envjs.debug("Creating timer number "+num); + $timers[num] = new Timer(fn, time); + $timers[num].start(); + }); + return num; +}; + +/** + * clearInterval + * @param {Object} num + */ +clearInterval = clearTimeout = function(num){ + //console.log("clearing interval "+num); + $timers.lock(function(){ + if ( $timers[num] ) { + $timers[num].stop(); + delete $timers[num]; + } + }); +}; + +// wait === null/undefined: execute any timers as they fire, +// waiting until there are none left +// wait(n) (n > 0): execute any timers as they fire until there +// are none left waiting at least n ms but no more, even if there +// are future events/current threads +// wait(0): execute any immediately runnable timers and return +// wait(-n): keep sleeping until the next event is more than n ms +// in the future +// +// TODO: make a priority queue ... + +Envjs.wait = function(wait) { + //console.log('wait %s', wait); + var delta_wait, + start = Date.now(), + was_running = EVENT_LOOP_RUNNING; + + if (wait < 0) { + delta_wait = -wait; + wait = 0; + } + EVENT_LOOP_RUNNING = true; + if (wait !== 0 && wait !== null && wait !== undefined){ + wait += Date.now(); + } + + var earliest, + timer, + sleep, + index, + goal, + now, + nextfn; + + for (;;) { + //console.log('timer loop'); + earliest = sleep = goal = now = nextfn = null; + $timers.lock(function(){ + for(index in $timers){ + if( isNaN(index*0) ) { + continue; + } + timer = $timers[index]; + // determine timer with smallest run-at time that is + // not already running + if( !timer.running && ( !earliest || timer.at < earliest.at) ) { + earliest = timer; + } + } + }); + //next sleep time + sleep = earliest && earliest.at - Date.now(); + if ( earliest && sleep <= 0 ) { + nextfn = earliest.fn; + try { + //console.log('running stack %s', nextfn.toString().substring(0,64)); + earliest.running = true; + nextfn(); + } catch (e) { + console.log('timer error %s %s', nextfn, e); + } finally { + earliest.running = false; + } + goal = earliest.at + earliest.interval; + now = Date.now(); + if ( goal < now ) { + earliest.at = now; + } else { + earliest.at = goal; + } + continue; + } + + // bunch of subtle cases here ... + if ( !earliest ) { + // no events in the queue (but maybe XHR will bring in events, so ... + if ( !wait || wait < Date.now() ) { + // Loop ends if there are no events and a wait hasn't been + // requested or has expired + break; + } + // no events, but a wait requested: fall through to sleep + } else { + // there are events in the queue, but they aren't firable now + /*if ( delta_wait && sleep <= delta_wait ) { + //TODO: why waste a check on a tight + // loop if it just falls through? + // if they will happen within the next delta, fall through to sleep + } else */if ( wait === 0 || ( wait > 0 && wait < Date.now () ) ) { + // loop ends even if there are events but the user + // specifcally asked not to wait too long + break; + } + // there are events and the user wants to wait: fall through to sleep + } + + // Related to ajax threads ... hopefully can go away .. + var interval = Envjs.WAIT_INTERVAL || 100; + if ( !sleep || sleep > interval ) { + sleep = interval; + } + //console.log('sleeping %s', sleep); + Envjs.sleep(sleep); + + } + EVENT_LOOP_RUNNING = was_running; +}; + + +/** + * @author john resig & the envjs team + * @uri http://www.envjs.com/ + * @copyright 2008-2010 + * @license MIT + */ +//CLOSURE_END +}()); +/* + * Pure JavaScript Browser Environment + * By John Resig and the Envjs Team + * Copyright 2008-2010 John Resig, under the MIT License + * + * This file simply provides the global definitions we need to + * be able to correctly implement to core browser DOM HTML interfaces. + */ +var HTMLDocument, + HTMLElement, + HTMLCollection, + HTMLAnchorElement, + HTMLAreaElement, + HTMLBaseElement, + HTMLQuoteElement, + HTMLBodyElement, + HTMLBRElement, + HTMLButtonElement, + HTMLCanvasElement, + HTMLTableColElement, + HTMLModElement, + HTMLDivElement, + HTMLDListElement, + HTMLFieldSetElement, + HTMLFormElement, + HTMLFrameElement, + HTMLFrameSetElement, + HTMLHeadElement, + HTMLHeadingElement, + HTMLHRElement, + HTMLHtmlElement, + HTMLIFrameElement, + HTMLImageElement, + HTMLInputElement, + HTMLLabelElement, + HTMLLegendElement, + HTMLLIElement, + HTMLLinkElement, + HTMLMapElement, + HTMLMetaElement, + HTMLObjectElement, + HTMLOListElement, + HTMLOptGroupElement, + HTMLOptionElement, + HTMLParagraphElement, + HTMLParamElement, + HTMLPreElement, + HTMLScriptElement, + HTMLSelectElement, + HTMLSpanElement, + HTMLStyleElement, + HTMLTableElement, + HTMLTableSectionElement, + HTMLTableCellElement, + HTMLTableDataCellElement, + HTMLTableHeaderCellElement, + HTMLTableRowElement, + HTMLTextAreaElement, + HTMLTitleElement, + HTMLUListElement, + HTMLUnknownElement, + Image, + Option, + __loadImage__, + __loadLink__; + +/* + * Envjs html.1.2.13 + * Pure JavaScript Browser Environment + * By John Resig and the Envjs Team + * Copyright 2008-2010 John Resig, under the MIT License + */ + +//CLOSURE_START +(function(){ + + + + + +/** + * @author ariel flesler + * http://flesler.blogspot.com/2008/11/fast-trim-function-for-javascript.html + * @param {Object} str + */ +function __trim__( str ){ + return (str || "").replace( /^\s+|\s+$/g, "" ); +} + + +/** + * @author john resig + */ +// Helper method for extending one object with another. +function __extend__(a,b) { + for ( var i in b ) { + var g = b.__lookupGetter__(i), s = b.__lookupSetter__(i); + if ( g || s ) { + if ( g ) { a.__defineGetter__(i, g); } + if ( s ) { a.__defineSetter__(i, s); } + } else { + a[i] = b[i]; + } + } return a; +} + +/** + * @author john resig + */ +//from jQuery +function __setArray__( target, array ) { + // Resetting the length to 0, then using the native Array push + // is a super-fast way to populate an object with array-like properties + target.length = 0; + Array.prototype.push.apply( target, array ); +} + +/** + * @class HTMLDocument + * The Document interface represents the entire HTML or XML document. + * Conceptually, it is the root of the document tree, and provides + * the primary access to the document's data. + * + * @extends Document + */ +HTMLDocument = function(implementation, ownerWindow, referrer) { + Document.apply(this, arguments); + this.referrer = referrer || ''; + this.baseURI = "about:blank"; + this.ownerWindow = ownerWindow; +}; + +HTMLDocument.prototype = new Document(); + +__extend__(HTMLDocument.prototype, { + createElement: function(tagName){ + var node; + tagName = tagName.toUpperCase(); + // create Element specifying 'this' as ownerDocument + // This is an html document so we need to use explicit interfaces per the + //TODO: would be much faster as a big switch + switch(tagName){ + case "A": + node = new HTMLAnchorElement(this);break; + case "AREA": + node = new HTMLAreaElement(this);break; + case "BASE": + node = new HTMLBaseElement(this);break; + case "BLOCKQUOTE": + node = new HTMLQuoteElement(this);break; + case "CANVAS": + node = new HTMLCanvasElement(this);break; + case "Q": + node = new HTMLQuoteElement(this);break; + case "BODY": + node = new HTMLBodyElement(this);break; + case "BR": + node = new HTMLBRElement(this);break; + case "BUTTON": + node = new HTMLButtonElement(this);break; + case "CAPTION": + node = new HTMLElement(this);break; + case "COL": + node = new HTMLTableColElement(this);break; + case "COLGROUP": + node = new HTMLTableColElement(this);break; + case "DEL": + node = new HTMLModElement(this);break; + case "INS": + node = new HTMLModElement(this);break; + case "DIV": + node = new HTMLDivElement(this);break; + case "DL": + node = new HTMLDListElement(this);break; + case "DT": + node = new HTMLElement(this); break; + case "FIELDSET": + node = new HTMLFieldSetElement(this);break; + case "FORM": + node = new HTMLFormElement(this);break; + case "FRAME": + node = new HTMLFrameElement(this);break; + case "H1": + node = new HTMLHeadingElement(this);break; + case "H2": + node = new HTMLHeadingElement(this);break; + case "H3": + node = new HTMLHeadingElement(this);break; + case "H4": + node = new HTMLHeadingElement(this);break; + case "H5": + node = new HTMLHeadingElement(this);break; + case "H6": + node = new HTMLHeadingElement(this);break; + case "HEAD": + node = new HTMLHeadElement(this);break; + case "HR": + node = new HTMLHRElement(this);break; + case "HTML": + node = new HTMLHtmlElement(this);break; + case "IFRAME": + node = new HTMLIFrameElement(this);break; + case "IMG": + node = new HTMLImageElement(this);break; + case "INPUT": + node = new HTMLInputElement(this);break; + case "LABEL": + node = new HTMLLabelElement(this);break; + case "LEGEND": + node = new HTMLLegendElement(this);break; + case "LI": + node = new HTMLLIElement(this);break; + case "LINK": + node = new HTMLLinkElement(this);break; + case "MAP": + node = new HTMLMapElement(this);break; + case "META": + node = new HTMLMetaElement(this);break; + case "NOSCRIPT": + node = new HTMLElement(this);break; + case "OBJECT": + node = new HTMLObjectElement(this);break; + case "OPTGROUP": + node = new HTMLOptGroupElement(this);break; + case "OL": + node = new HTMLOListElement(this); break; + case "OPTION": + node = new HTMLOptionElement(this);break; + case "P": + node = new HTMLParagraphElement(this);break; + case "PARAM": + node = new HTMLParamElement(this);break; + case "PRE": + node = new HTMLPreElement(this);break; + case "SCRIPT": + node = new HTMLScriptElement(this);break; + case "SELECT": + node = new HTMLSelectElement(this);break; + case "SMALL": + node = new HTMLElement(this);break; + case "SPAN": + node = new HTMLSpanElement(this);break; + case "STRONG": + node = new HTMLElement(this);break; + case "STYLE": + node = new HTMLStyleElement(this);break; + case "TABLE": + node = new HTMLTableElement(this);break; + case "TBODY": + node = new HTMLTableSectionElement(this);break; + case "TFOOT": + node = new HTMLTableSectionElement(this);break; + case "THEAD": + node = new HTMLTableSectionElement(this);break; + case "TD": + node = new HTMLTableDataCellElement(this);break; + case "TH": + node = new HTMLTableHeaderCellElement(this);break; + case "TEXTAREA": + node = new HTMLTextAreaElement(this);break; + case "TITLE": + node = new HTMLTitleElement(this);break; + case "TR": + node = new HTMLTableRowElement(this);break; + case "UL": + node = new HTMLUListElement(this);break; + default: + node = new HTMLUnknownElement(this); + } + // assign values to properties (and aliases) + node.nodeName = tagName; + return node; + }, + createElementNS : function (uri, local) { + //print('createElementNS :'+uri+" "+local); + if(!uri){ + return this.createElement(local); + }else if ("http://www.w3.org/1999/xhtml" == uri) { + return this.createElement(local); + } else if ("http://www.w3.org/1998/Math/MathML" == uri) { + return this.createElement(local); + } else { + return Document.prototype.createElementNS.apply(this,[uri, local]); + } + }, + get anchors(){ + return new HTMLCollection(this.getElementsByTagName('a')); + }, + get applets(){ + return new HTMLCollection(this.getElementsByTagName('applet')); + }, + get documentElement(){ + var html = Document.prototype.__lookupGetter__('documentElement').apply(this,[]); + if( html === null){ + html = this.createElement('html'); + this.appendChild(html); + html.appendChild(this.createElement('head')); + html.appendChild(this.createElement('body')); + } + return html; + }, + //document.head is non-standard + get head(){ + //console.log('get head'); + if (!this.documentElement) { + this.appendChild(this.createElement('html')); + } + var element = this.documentElement, + length = element.childNodes.length, + i; + //check for the presence of the head element in this html doc + for(i=0;i1?matches[1]:""; + }, + set domain(value){ + var i, + domainParts = this.domain.split('.').reverse(), + newDomainParts = value.split('.').reverse(); + if(newDomainParts.length > 1){ + for(i=0;i 0){ + event = doc.createEvent('HTMLEvents'); + event.initEvent( okay ? "load" : "error", false, false ); + node.dispatchEvent( event, false ); + } + }catch(e){ + console.log('error loading html element %s %e', node, e.toString()); + } + } + break; + case 'frame': + case 'iframe': + node.contentWindow = { }; + node.contentDocument = new HTMLDocument(new DOMImplementation(), node.contentWindow); + node.contentWindow.document = node.contentDocument; + try{ + Window; + }catch(e){ + node.contentDocument.addEventListener('DOMContentLoaded', function(){ + event = node.contentDocument.createEvent('HTMLEvents'); + event.initEvent("load", false, false); + node.dispatchEvent( event, false ); + }); + } + try{ + if (node.src && node.src.length > 0){ + //console.log("getting content document for (i)frame from %s", node.src); + Envjs.loadFrame(node, Envjs.uri(node.src)); + event = node.contentDocument.createEvent('HTMLEvents'); + event.initEvent("load", false, false); + node.dispatchEvent( event, false ); + }else{ + //I dont like this being here: + //TODO: better mix-in strategy so the try/catch isnt required + try{ + if(Window){ + Envjs.loadFrame(node); + //console.log('src/html/document.js: triggering frame load'); + event = node.contentDocument.createEvent('HTMLEvents'); + event.initEvent("load", false, false); + node.dispatchEvent( event, false ); + } + }catch(e){} + } + }catch(e){ + console.log('error loading html element %s %e', node, e.toString()); + } + break; + + case 'link': + if (node.href && node.href.length > 0) { + __loadLink__(node, node.href); + } + break; + /* + case 'img': + if (node.src && node.src.length > 0){ + // don't actually load anything, so we're "done" immediately: + event = doc.createEvent('HTMLEvents'); + event.initEvent("load", false, false); + node.dispatchEvent( event, false ); + } + break; + */ + case 'option': + node._updateoptions(); + break; + default: + if(node.getAttribute('onload')){ + console.log('calling attribute onload %s | %s', node.onload, node.tagName); + node.onload(); + } + break; + }//switch on name + default: + break; + }//switch on ns + break; + default: + // console.log('element appended: %s %s', node+'', node.namespaceURI); + }//switch on doc.parsing + return node; + +}); + +Aspect.around({ + target: Node, + method:"removeChild" +}, function(invocation) { + var event, + okay, + node = invocation.proceed(), + doc = node.ownerDocument; + if((node.nodeType !== Node.ELEMENT_NODE)){ + //for now we are only handling element insertions. probably we will need + //to handle text node changes to script tags and changes to src + //attributes + if(node.nodeType !== Node.DOCUMENT_NODE && node.uuid){ + //console.log('removing event listeners, %s', node, node.uuid); + node.removeEventListener('*', null, null); + } + return node; + } + //console.log('appended html element %s %s %s', node.namespaceURI, node.nodeName, node); + + switch(doc.parsing){ + case true: + //handled by parser if included + break; + case false: + switch(node.namespaceURI){ + case null: + //fall through + case "": + //fall through + case "http://www.w3.org/1999/xhtml": + //this is interesting dillema since our event engine is + //storing the registered events in an array accessed + //by the uuid property of the node. unforunately this + //means listeners hang out way after(forever ;)) the node + //has been removed and gone out of scope. + //console.log('removing event listeners, %s', node, node.uuid); + node.removeEventListener('*', null, null); + switch(node.tagName.toLowerCase()){ + case 'frame': + case 'iframe': + try{ + //console.log('removing iframe document'); + try{ + Envjs.unloadFrame(node); + }catch(e){ + console.log('error freeing resources from frame %s', e); + } + node.contentWindow = null; + node.contentDocument = null; + }catch(e){ + console.log('error unloading html element %s %e', node, e.toString()); + } + break; + default: + break; + }//switch on name + default: + break; + }//switch on ns + break; + default: + console.log('element appended: %s %s', node+'', node.namespaceURI); + }//switch on doc.parsing + return node; + +}); + + + +/** + * Named Element Support + * + * + */ + +/* + * + * @returns 'name' if the node has a appropriate name + * null if node does not have a name + */ + +var __isNamedElement__ = function(node) { + if (node.nodeType !== Node.ELEMENT_NODE) { + return null; + } + var tagName = node.tagName.toLowerCase(); + var nodename = null; + + switch (tagName) { + case 'embed': + case 'form': + case 'iframe': + nodename = node.getAttribute('name'); + break; + case 'applet': + nodename = node.id; + break; + case 'object': + // TODO: object needs to be 'fallback free' + nodename = node.id; + break; + case 'img': + nodename = node.id; + if (!nodename || ! node.getAttribute('name')) { + nodename = null; + } + break; + } + return (nodename) ? nodename : null; +}; + + +var __addNamedMap__ = function(target, node) { + var nodename = __isNamedElement__(node); + if (nodename) { + target.__defineGetter__(nodename, function() { + return node; + }); + } +}; + +var __removeNamedMap__ = function(target, node) { + if (!node) { + return; + } + var nodename = __isNamedElement__(node); + if (nodename) { + delete target[nodename]; + } +}; + +/** + * @name HTMLEvents + * @w3c:domlevel 2 + * @uri http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html + */ + +var __eval__ = function(script, node){ + if (!script == ""){ + // don't assemble environment if no script... + try{ + eval(script); + }catch(e){ + console.log('error evaluating %s', e); + } + } +}; + +var HTMLEvents= function(){}; +HTMLEvents.prototype = { + onload: function(event){ + __eval__(this.getAttribute('onload')||'', this); + }, + onunload: function(event){ + __eval__(this.getAttribute('onunload')||'', this); + }, + onabort: function(event){ + __eval__(this.getAttribute('onabort')||'', this); + }, + onerror: function(event){ + __eval__(this.getAttribute('onerror')||'', this); + }, + onselect: function(event){ + __eval__(this.getAttribute('onselect')||'', this); + }, + onchange: function(event){ + __eval__(this.getAttribute('onchange')||'', this); + }, + onsubmit: function(event){ + if (__eval__(this.getAttribute('onsubmit')||'', this)) { + this.submit(); + } + }, + onreset: function(event){ + __eval__(this.getAttribute('onreset')||'', this); + }, + onfocus: function(event){ + __eval__(this.getAttribute('onfocus')||'', this); + }, + onblur: function(event){ + __eval__(this.getAttribute('onblur')||'', this); + }, + onresize: function(event){ + __eval__(this.getAttribute('onresize')||'', this); + }, + onscroll: function(event){ + __eval__(this.getAttribute('onscroll')||'', this); + } +}; + +//HTMLDocument, HTMLFramesetElement, HTMLObjectElement +var __load__ = function(element){ + var event = new Event('HTMLEvents'); + event.initEvent("load", false, false); + element.dispatchEvent(event); + return event; +}; + +//HTMLFramesetElement, HTMLBodyElement +var __unload__ = function(element){ + var event = new Event('HTMLEvents'); + event.initEvent("unload", false, false); + element.dispatchEvent(event); + return event; +}; + +//HTMLObjectElement +var __abort__ = function(element){ + var event = new Event('HTMLEvents'); + event.initEvent("abort", true, false); + element.dispatchEvent(event); + return event; +}; + +//HTMLFramesetElement, HTMLObjectElement, HTMLBodyElement +var __error__ = function(element){ + var event = new Event('HTMLEvents'); + event.initEvent("error", true, false); + element.dispatchEvent(event); + return event; +}; + +//HTMLInputElement, HTMLTextAreaElement +var __select__ = function(element){ + var event = new Event('HTMLEvents'); + event.initEvent("select", true, false); + element.dispatchEvent(event); + return event; +}; + +//HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement +var __change__ = function(element){ + var event = new Event('HTMLEvents'); + event.initEvent("change", true, false); + element.dispatchEvent(event); + return event; +}; + +//HtmlFormElement +var __submit__ = function(element){ + var event = new Event('HTMLEvents'); + event.initEvent("submit", true, true); + element.dispatchEvent(event); + return event; +}; + +//HtmlFormElement +var __reset__ = function(element){ + var event = new Event('HTMLEvents'); + event.initEvent("reset", false, false); + element.dispatchEvent(event); + return event; +}; + +//LABEL, INPUT, SELECT, TEXTAREA, and BUTTON +var __focus__ = function(element){ + var event = new Event('HTMLEvents'); + event.initEvent("focus", false, false); + element.dispatchEvent(event); + return event; +}; + +//LABEL, INPUT, SELECT, TEXTAREA, and BUTTON +var __blur__ = function(element){ + var event = new Event('HTMLEvents'); + event.initEvent("blur", false, false); + element.dispatchEvent(event); + return event; +}; + +//Window +var __resize__ = function(element){ + var event = new Event('HTMLEvents'); + event.initEvent("resize", true, false); + element.dispatchEvent(event); + return event; +}; + +//Window +var __scroll__ = function(element){ + var event = new Event('HTMLEvents'); + event.initEvent("scroll", true, false); + element.dispatchEvent(event); + return event; +}; + +/** + * @name KeyboardEvents + * @w3c:domlevel 2 + * @uri http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html + */ +var KeyboardEvents= function(){}; +KeyboardEvents.prototype = { + onkeydown: function(event){ + __eval__(this.getAttribute('onkeydown')||'', this); + }, + onkeypress: function(event){ + __eval__(this.getAttribute('onkeypress')||'', this); + }, + onkeyup: function(event){ + __eval__(this.getAttribute('onkeyup')||'', this); + } +}; + + +var __registerKeyboardEventAttrs__ = function(elm){ + if(elm.hasAttribute('onkeydown')){ + elm.addEventListener('keydown', elm.onkeydown, false); + } + if(elm.hasAttribute('onkeypress')){ + elm.addEventListener('keypress', elm.onkeypress, false); + } + if(elm.hasAttribute('onkeyup')){ + elm.addEventListener('keyup', elm.onkeyup, false); + } + return elm; +}; + +//HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement +var __keydown__ = function(element){ + var event = new Event('KeyboardEvents'); + event.initEvent("keydown", false, false); + element.dispatchEvent(event); +}; + +//HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement +var __keypress__ = function(element){ + var event = new Event('KeyboardEvents'); + event.initEvent("keypress", false, false); + element.dispatchEvent(event); +}; + +//HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement +var __keyup__ = function(element){ + var event = new Event('KeyboardEvents'); + event.initEvent("keyup", false, false); + element.dispatchEvent(event); +}; + +/** + * @name MaouseEvents + * @w3c:domlevel 2 + * @uri http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html + */ +var MouseEvents= function(){}; +MouseEvents.prototype = { + onclick: function(event){ + __eval__(this.getAttribute('onclick')||'', this); + }, + ondblclick: function(event){ + __eval__(this.getAttribute('ondblclick')||'', this); + }, + onmousedown: function(event){ + __eval__(this.getAttribute('onmousedown')||'', this); + }, + onmousemove: function(event){ + __eval__(this.getAttribute('onmousemove')||'', this); + }, + onmouseout: function(event){ + __eval__(this.getAttribute('onmouseout')||'', this); + }, + onmouseover: function(event){ + __eval__(this.getAttribute('onmouseover')||'', this); + }, + onmouseup: function(event){ + __eval__(this.getAttribute('onmouseup')||'', this); + } +}; + +var __registerMouseEventAttrs__ = function(elm){ + if(elm.hasAttribute('onclick')){ + elm.addEventListener('click', elm.onclick, false); + } + if(elm.hasAttribute('ondblclick')){ + elm.addEventListener('dblclick', elm.ondblclick, false); + } + if(elm.hasAttribute('onmousedown')){ + elm.addEventListener('mousedown', elm.onmousedown, false); + } + if(elm.hasAttribute('onmousemove')){ + elm.addEventListener('mousemove', elm.onmousemove, false); + } + if(elm.hasAttribute('onmouseout')){ + elm.addEventListener('mouseout', elm.onmouseout, false); + } + if(elm.hasAttribute('onmouseover')){ + elm.addEventListener('mouseover', elm.onmouseover, false); + } + if(elm.hasAttribute('onmouseup')){ + elm.addEventListener('mouseup', elm.onmouseup, false); + } + return elm; +}; + + +var __click__ = function(element){ + var event = new Event('MouseEvents'); + event.initEvent("click", true, true, null, 0, + 0, 0, 0, 0, false, false, false, + false, null, null); + element.dispatchEvent(event); +}; +var __mousedown__ = function(element){ + var event = new Event('MouseEvents'); + event.initEvent("mousedown", true, true, null, 0, + 0, 0, 0, 0, false, false, false, + false, null, null); + element.dispatchEvent(event); +}; +var __mouseup__ = function(element){ + var event = new Event('MouseEvents'); + event.initEvent("mouseup", true, true, null, 0, + 0, 0, 0, 0, false, false, false, + false, null, null); + element.dispatchEvent(event); +}; +var __mouseover__ = function(element){ + var event = new Event('MouseEvents'); + event.initEvent("mouseover", true, true, null, 0, + 0, 0, 0, 0, false, false, false, + false, null, null); + element.dispatchEvent(event); +}; +var __mousemove__ = function(element){ + var event = new Event('MouseEvents'); + event.initEvent("mousemove", true, true, null, 0, + 0, 0, 0, 0, false, false, false, + false, null, null); + element.dispatchEvent(event); +}; +var __mouseout__ = function(element){ + var event = new Event('MouseEvents'); + event.initEvent("mouseout", true, true, null, 0, + 0, 0, 0, 0, false, false, false, + false, null, null); + element.dispatchEvent(event); +}; + +/** + * HTMLElement - DOM Level 2 + */ + + +/* Hack for http://www.prototypejs.org/ + * + * Prototype 1.6 (the library) creates a new global Element, which causes + * envjs to use the wrong Element. + * + * http://envjs.lighthouseapp.com/projects/21590/tickets/108-prototypejs-wont-load-due-it-clobbering-element + * + * Options: + * (1) Rename the dom/element to something else + * rejected: been done before. people want Element. + * (2) merge dom+html and not export Element to global namespace + * (meaning we would use a local var Element in a closure, so prototype + * can do what ever it wants) + * rejected: want dom and html separate + * (3) use global namespace (put everything under Envjs = {}) + * rejected: massive change + * (4) use commonjs modules (similar to (3) in spirit) + * rejected: massive change + * + * or + * + * (5) take a reference to Element during initial loading ("compile + * time"), and use the reference instead of "Element". That's + * what the next line does. We use __DOMElement__ if we need to + * reference the parent class. Only this file explcity uses + * Element so this should work, and is the most minimal change I + * could think of with no external API changes. + * + */ +var __DOMElement__ = Element; + +HTMLElement = function(ownerDocument) { + __DOMElement__.apply(this, arguments); +}; + +HTMLElement.prototype = new Element(); +__extend__(HTMLElement.prototype, HTMLEvents.prototype); +__extend__(HTMLElement.prototype, { + get className() { + return this.getAttribute("class")||''; + }, + set className(value) { + return this.setAttribute("class",__trim__(value)); + }, + get dir() { + return this.getAttribute("dir")||"ltr"; + }, + set dir(val) { + return this.setAttribute("dir",val); + }, + get id(){ + return this.getAttribute('id'); + }, + set id(id){ + this.setAttribute('id', id); + }, + get innerHTML(){ + var ret = "", + i; + + // create string containing the concatenation of the string + // values of each child + for (i=0; i < this.childNodes.length; i++) { + if(this.childNodes[i]){ + if(this.childNodes[i].nodeType === Node.ELEMENT_NODE){ + ret += this.childNodes[i].xhtml; + } else if (this.childNodes[i].nodeType === Node.TEXT_NODE && i>0 && + this.childNodes[i-1].nodeType === Node.TEXT_NODE){ + //add a single space between adjacent text nodes + ret += " "+this.childNodes[i].xml; + }else{ + ret += this.childNodes[i].xml; + } + } + } + return ret; + }, + get lang() { + return this.getAttribute("lang"); + }, + set lang(val) { + return this.setAttribute("lang",val); + }, + get offsetHeight(){ + return Number((this.style.height || '').replace("px","")); + }, + get offsetWidth(){ + return Number((this.style.width || '').replace("px","")); + }, + offsetLeft: 0, + offsetRight: 0, + get offsetParent(){ + /* TODO */ + return; + }, + set offsetParent(element){ + /* TODO */ + return; + }, + scrollHeight: 0, + scrollWidth: 0, + scrollLeft: 0, + scrollRight: 0, + get style(){ + return this.getAttribute('style')||''; + }, + get title() { + return this.getAttribute("title"); + }, + set title(value) { + return this.setAttribute("title", value); + }, + get tabIndex(){ + var tabindex = this.getAttribute('tabindex'); + if(tabindex!==null){ + return Number(tabindex); + } else { + return 0; + } + }, + set tabIndex(value){ + if (value === undefined || value === null) { + value = 0; + } + this.setAttribute('tabindex',Number(value)); + }, + get outerHTML(){ + //Not in the specs but I'll leave it here for now. + return this.xhtml; + }, + scrollIntoView: function(){ + /*TODO*/ + return; + }, + toString: function(){ + return '[object HTMLElement]'; + }, + get xhtml() { + // HTMLDocument.xhtml is non-standard + // This is exactly like Document.xml except the tagName has to be + // lower cased. I dont like to duplicate this but its really not + // a simple work around between xml and html serialization via + // XMLSerializer (which uppercases html tags) and innerHTML (which + // lowercases tags) + + var ret = "", + ns = "", + name = (this.tagName+"").toLowerCase(), + attrs, + attrstring = "", + i; + + // serialize namespace declarations + if (this.namespaceURI){ + if((this === this.ownerDocument.documentElement) || + (!this.parentNode) || + (this.parentNode && + (this.parentNode.namespaceURI !== this.namespaceURI))) { + ns = ' xmlns' + (this.prefix ? (':' + this.prefix) : '') + + '="' + this.namespaceURI + '"'; + } + } + + // serialize Attribute declarations + attrs = this.attributes; + for(i=0;i< attrs.length;i++){ + attrstring += " "+attrs[i].name+'="'+attrs[i].xml+'"'; + } + + if(this.hasChildNodes()){ + // serialize this Element + ret += "<" + name + ns + attrstring +">"; + for(i=0;i< this.childNodes.length;i++){ + ret += this.childNodes[i].xhtml ? + this.childNodes[i].xhtml : + this.childNodes[i].xml; + } + ret += ""; + }else{ + switch(name){ + case 'script': + ret += "<" + name + ns + attrstring +">"; + break; + default: + ret += "<" + name + ns + attrstring +"/>"; + } + } + + return ret; + }, + + /** + * setAttribute use a dispatch table that other tags can set to + * "listen" to various values being set. The dispatch table + * and registration functions are at the end of the file. + * + */ + + setAttribute: function(name, value) { + var result = __DOMElement__.prototype.setAttribute.apply(this, arguments); + __addNamedMap__(this.ownerDocument, this); + var tagname = this.tagName; + var callback = HTMLElement.getAttributeCallback('set', tagname, name); + if (callback) { + callback(this, value); + } + }, + setAttributeNS: function(namespaceURI, name, value) { + var result = __DOMElement__.prototype.setAttributeNS.apply(this, arguments); + __addNamedMap__(this.ownerDocument, this); + var tagname = this.tagName; + var callback = HTMLElement.getAttributeCallback('set', tagname, name); + if (callback) { + callback(this, value); + } + + return result; + }, + setAttributeNode: function(newnode) { + var result = __DOMElement__.prototype.setAttributeNode.apply(this, arguments); + __addNamedMap__(this.ownerDocument, this); + var tagname = this.tagName; + var callback = HTMLElement.getAttributeCallback('set', tagname, newnode.name); + if (callback) { + callback(this, node.value); + } + return result; + }, + setAttributeNodeNS: function(newnode) { + var result = __DOMElement__.prototype.setAttributeNodeNS.apply(this, arguments); + __addNamedMap__(this.ownerDocument, this); + var tagname = this.tagName; + var callback = HTMLElement.getAttributeCallback('set', tagname, newnode.name); + if (callback) { + callback(this, node.value); + } + return result; + }, + removeAttribute: function(name) { + __removeNamedMap__(this.ownerDocument, this); + return __DOMElement__.prototype.removeAttribute.apply(this, arguments); + }, + removeAttributeNS: function(namespace, localname) { + __removeNamedMap__(this.ownerDocument, this); + return __DOMElement__.prototype.removeAttributeNS.apply(this, arguments); + }, + removeAttributeNode: function(name) { + __removeNamedMap__(this.ownerDocument, this); + return __DOMElement__.prototype.removeAttribute.apply(this, arguments); + }, + removeChild: function(oldChild) { + __removeNamedMap__(this.ownerDocument, oldChild); + return __DOMElement__.prototype.removeChild.apply(this, arguments); + }, + importNode: function(othernode, deep) { + var newnode = __DOMElement__.prototype.importNode.apply(this, arguments); + __addNamedMap__(this.ownerDocument, newnode); + return newnode; + }, + + // not actually sure if this is needed or not + replaceNode: function(newchild, oldchild) { + var newnode = __DOMElement__.prototype.replaceNode.apply(this, arguments); + __removeNamedMap__(this.ownerDocument, oldchild); + __addNamedMap__(this.ownerDocument, newnode); + return newnode; + } +}); + + +HTMLElement.attributeCallbacks = {}; +HTMLElement.registerSetAttribute = function(tag, attrib, callbackfn) { + HTMLElement.attributeCallbacks[tag + ':set:' + attrib] = callbackfn; +}; +HTMLElement.registerRemoveAttribute = function(tag, attrib, callbackfn) { + HTMLElement.attributeCallbacks[tag + ':remove:' + attrib] = callbackfn; +}; + +/** + * This is really only useful internally + * + */ +HTMLElement.getAttributeCallback = function(type, tag, attrib) { + return HTMLElement.attributeCallbacks[tag + ':' + type + ':' + attrib] || null; +}; +/* + * HTMLCollection + * + * HTML5 -- 2.7.2.1 HTMLCollection + * http://dev.w3.org/html5/spec/Overview.html#htmlcollection + * http://dev.w3.org/html5/spec/Overview.html#collections + */ +HTMLCollection = function(nodelist, type) { + + __setArray__(this, []); + var n; + for (var i=0; i= 0) && (idx < this.length)) ? this[idx] : null; + }, + + namedItem: function (name) { + return this[name] || null; + }, + + toString: function() { + return '[object HTMLCollection]'; + } +}; +/* + * a set of convenience classes to centralize implementation of + * properties and methods across multiple in-form elements + * + * the hierarchy of related HTML elements and their members is as follows: + * + * Condensed Version + * + * HTMLInputCommon + * * legent (no value attr) + * * fieldset (no value attr) + * * label (no value attr) + * * option (custom value) + * HTMLTypeValueInputs (extends InputCommon) + * * select (custom value) + * * button (just sets value) + * HTMLInputAreaCommon (extends TypeValueIput) + * * input (custom) + * * textarea (just sets value) + * + * ----------------------- + * HTMLInputCommon: common to all elements + * .form + * + * + * [common plus:] + * .align + * + *
        + * [identical to "legend" plus:] + * .margin + * + * + * **** + * + *