diff --git a/.gitignore b/.gitignore index c1b8bd2b3..c342f71ee 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,6 @@ /.ntvs_analysis.dat /.ntvs_analysis.dat.tmp obj/Debug/VSProj.njsproj.FileListAbsolute.txt -./node_modules .baseDir.ts -node_modules/immutable/ -node_modules/react/ -node_modules \ No newline at end of file +node_modules/ +/typings/ diff --git a/node_modules/basarat-text-buffer/node_modules/grim/node_modules/coffeestack/node_modules/source-map/.travis.yml b/.travis.yml similarity index 55% rename from node_modules/basarat-text-buffer/node_modules/grim/node_modules/coffeestack/node_modules/source-map/.travis.yml rename to .travis.yml index ddc9c4f98..650c27d80 100644 --- a/node_modules/basarat-text-buffer/node_modules/grim/node_modules/coffeestack/node_modules/source-map/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ language: node_js node_js: - - 0.8 - - "0.10" \ No newline at end of file + - "4.1" +sudo: false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5c9faa389..7ffdb9ece 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,6 +17,8 @@ apm link -l You still have to reload atom with `ctrl+alt+r` to test your changes. +Now you can use atom-typescript *to develop atom-typescript*. This is covered more in the workflow https://github.com/TypeStrong/atom-typescript/blob/master/CONTRIBUTING.md#workflow + (Note: [There is more guidance here](https://github.com/atom/atom/blob/master/docs/contributing-to-packages.md) but what we have is sufficient. `apm link -l` creates a symlink for the folder into `%HOMEPATH%\.atom\packages`) **Optional**: If you are working on the binaries that are used if we deploy the package to NPM you can run (again from the directory that has `package.json`): @@ -99,12 +101,6 @@ The TypeScript Language service docs: https://github.com/Microsoft/TypeScript/wi ## Showing errors in atom Done using the `linter` plugin. If you think about it. TypeScript is really just a super powerful version of `jshint` and that is the reason to use `linter` for errors. - -You need to inherit from `Linter` class from the `linter`: http://atomlinter.github.io/Linter/ -```js -var linterPath = atom.packages.getLoadedPackage("linter").path -var Linter:LinterClass = require linterPath+"/lib/linter" -``` Just look at `linter.ts` in our code. ## Grammar diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index 5f4bc4318..000000000 --- a/Gruntfile.js +++ /dev/null @@ -1,32 +0,0 @@ -module.exports = function (grunt) { - 'use strict'; - - var srcDir = 'lib'; - - grunt.initConfig({ - ts: { - options: { - target: 'es5', - module: 'commonjs', - sourceMap: false, - preserveConstEnums: true, - compiler: './node_modules/ntypescript/bin/tsc' - }, - dev: { - src: [srcDir + '/**/*.ts'], - watch: srcDir, - outDir: './dist/', - baseDir: './lib/' - }, - build: { - src: [srcDir + '/**/*.ts'], - outDir: './dist/', - baseDir: './lib/' - }, - }, - }); - - grunt.loadNpmTasks('grunt-ts'); - grunt.registerTask('default', ['ts:dev']); - grunt.registerTask('build', ['ts:build']); -}; diff --git a/README.md b/README.md index b8aa3ceba..a4928d6ce 100644 --- a/README.md +++ b/README.md @@ -209,11 +209,3 @@ Look at [CONTRIBUTING.md](https://github.com/TypeStrong/atom-typescript/blob/mas ## Changelog Breaking changes [available online](https://github.com/TypeStrong/atom-typescript/blob/master/docs/CHANGELOG.md). - -## Donating -Support this project and [others by basarat][gratipay-basarat] via [gratipay][gratipay-basarat]. - -[![Support via Gratipay][gratipay]][gratipay-basarat] - -[gratipay]: https://cdn.rawgit.com/gratipay/gratipay-badge/2.3.0/dist/gratipay.png -[gratipay-basarat]: https://gratipay.com/basarat/ diff --git a/VSProj.njsproj b/VSProj.njsproj index 0f3b609c7..2eb8214f6 100644 --- a/VSProj.njsproj +++ b/VSProj.njsproj @@ -39,7 +39,7 @@ - + @@ -93,4 +93,4 @@ - \ No newline at end of file + diff --git a/dist/linter.js b/dist/linter.js index 4c487130b..fa5ac3ab9 100644 --- a/dist/linter.js +++ b/dist/linter.js @@ -1,8 +1,10 @@ +"use strict"; var parent = require('./worker/parent'); var fs = require('fs'); var atom_1 = require("atom"); exports.provider = { - grammarScopes: ['source.ts', 'source.ts.tsx'], + name: 'TS', + grammarScopes: ['source.ts', 'source.tsx'], scope: 'file', lintOnFly: true, lint: function (textEditor) { @@ -16,7 +18,7 @@ exports.provider = { var linterErrors = resp.errors.map(function (err) { return ({ type: "Error", filePath: filePath, - html: " TS " + err.message.replace(/\n/g, '
'), + text: err.message, range: new atom_1.Range([err.startPos.line, err.startPos.col], [err.endPos.line, err.endPos.col]), }); }); return linterErrors; diff --git a/dist/main/atom/atomConfig.js b/dist/main/atom/atomConfig.js index 6cd6307a6..f8b9811fb 100644 --- a/dist/main/atom/atomConfig.js +++ b/dist/main/atom/atomConfig.js @@ -1,3 +1,4 @@ +"use strict"; var utils_1 = require("../lang/utils"); var packageName = 'atom-typescript'; function getConfig(nameLambda) { @@ -68,6 +69,6 @@ var Config = (function () { configurable: true }); return Config; -})(); +}()); var config = new Config(); module.exports = config; diff --git a/dist/main/atom/atomUtils.js b/dist/main/atom/atomUtils.js index e7b711957..f3c38b77f 100644 --- a/dist/main/atom/atomUtils.js +++ b/dist/main/atom/atomUtils.js @@ -1,3 +1,4 @@ +"use strict"; var path = require('path'); var fs = require('fs'); var fsu = require("../utils/fsUtil"); diff --git a/dist/main/atom/autoCompleteProvider.js b/dist/main/atom/autoCompleteProvider.js index 4977310ea..823b5c583 100644 --- a/dist/main/atom/autoCompleteProvider.js +++ b/dist/main/atom/autoCompleteProvider.js @@ -1,3 +1,4 @@ +"use strict"; var parent = require('../../worker/parent'); var atomConfig = require('./atomConfig'); var fs = require('fs'); @@ -10,29 +11,10 @@ function triggerAutocompletePlus() { explicitlyTriggered = true; } exports.triggerAutocompletePlus = triggerAutocompletePlus; -var tsSnipPrefixLookup = Object.create(null); -function loadSnippets() { - var confPath = atom.getConfigDirPath(); - CSON.readFile(confPath + "/packages/atom-typescript/snippets/typescript-snippets.cson", function (err, snippetsRoot) { - if (err) - return; - if (!snippetsRoot || !snippetsRoot['.source.ts']) - return; - var tsSnippets = snippetsRoot['.source.ts']; - for (var snippetName in tsSnippets) { - if (tsSnippets.hasOwnProperty(snippetName)) { - tsSnipPrefixLookup[tsSnippets[snippetName].prefix] = { - body: tsSnippets[snippetName].body, - name: snippetName - }; - } - } - }); -} -loadSnippets(); exports.provider = { - selector: '.source.ts', + selector: '.source.ts, .source.tsx', inclusionPriority: 3, + suggestionPriority: 3, excludeLowerPriority: false, getSuggestions: function (options) { var filePath = options.editor.getPath(); @@ -78,7 +60,8 @@ exports.provider = { explicitlyTriggered = false; } else { - if (options.prefix && options.prefix.trim() == ';') { + var prefix = options.prefix.trim(); + if (prefix === '' || prefix === ';') { return Promise.resolve([]); } } @@ -114,15 +97,6 @@ exports.provider = { }; } }); - if (tsSnipPrefixLookup[options.prefix]) { - var suggestion = { - snippet: tsSnipPrefixLookup[options.prefix].body, - replacementPrefix: options.prefix, - rightLabelHTML: "snippet: " + options.prefix, - type: 'snippet' - }; - suggestions.unshift(suggestion); - } return suggestions; }); return promisedSuggestions; @@ -141,10 +115,11 @@ exports.provider = { if (options.suggestion.atomTS_IsImport) { options.editor.moveToBeginningOfLine(); options.editor.selectToEndOfLine(); - var groups = /^\s*import\s*(\w*)\s*=\s*require\s*\(\s*(["'])/.exec(options.editor.getSelectedText()); - var alias = groups[1]; - quote = quote || groups[2]; - options.editor.replaceSelectedText(null, function () { return "import " + alias + " = require(" + quote + options.suggestion.atomTS_IsImport.relativePath + quote + ");"; }); + var groups = /^(\s*)import\s*(\w*)\s*=\s*require\s*\(\s*(["'])/.exec(options.editor.getSelectedText()); + var leadingWhiteSpace = groups[1]; + var alias = groups[2]; + quote = quote || groups[3]; + options.editor.replaceSelectedText(null, function () { return leadingWhiteSpace + "import " + alias + " = require(" + quote + options.suggestion.atomTS_IsImport.relativePath + quote + ");"; }); } if (options.suggestion.atomTS_IsES6Import) { var row = options.editor.getCursorBufferPosition().row; diff --git a/dist/main/atom/buildView.js b/dist/main/atom/buildView.js index 8e0dc4f71..a730293a8 100644 --- a/dist/main/atom/buildView.js +++ b/dist/main/atom/buildView.js @@ -1,3 +1,4 @@ +"use strict"; var mainPanelView = require('./views/mainPanelView'); var lineMessageView = require('./views/lineMessageView'); var gotoHistory = require('./gotoHistory'); diff --git a/dist/main/atom/commands/commands.js b/dist/main/atom/commands/commands.js index bf8582db8..401b256d6 100644 --- a/dist/main/atom/commands/commands.js +++ b/dist/main/atom/commands/commands.js @@ -1,3 +1,4 @@ +"use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } @@ -282,7 +283,7 @@ function registerCommands() { var editor = atom.workspace.getActiveTextEditor(); if (!editor) return false; - if (path.extname(editor.getPath()) !== '.ts') + if (path.extname(editor.getPath()) !== '.ts' && path.extname(editor.getPath()) !== '.tsx') return false; e.abortKeyBinding(); var filePath = editor.getPath(); diff --git a/dist/main/atom/commands/json2dtsCommands.js b/dist/main/atom/commands/json2dtsCommands.js index 0906203e5..4fd16c14a 100644 --- a/dist/main/atom/commands/json2dtsCommands.js +++ b/dist/main/atom/commands/json2dtsCommands.js @@ -1,3 +1,4 @@ +"use strict"; var atomUtils = require("../atomUtils"); var json2dts_1 = require("../../json2dts/json2dts"); function registerJson2dtsCommands() { diff --git a/dist/main/atom/commands/moveFilesHandling.js b/dist/main/atom/commands/moveFilesHandling.js index 59f87a8c9..a085ae1cc 100644 --- a/dist/main/atom/commands/moveFilesHandling.js +++ b/dist/main/atom/commands/moveFilesHandling.js @@ -1,3 +1,4 @@ +"use strict"; function registerRenameHandling() { } exports.registerRenameHandling = registerRenameHandling; diff --git a/dist/main/atom/commands/outputFileCommands.js b/dist/main/atom/commands/outputFileCommands.js index 6c874a64d..844f5c34b 100644 --- a/dist/main/atom/commands/outputFileCommands.js +++ b/dist/main/atom/commands/outputFileCommands.js @@ -1,3 +1,4 @@ +"use strict"; var atomUtils = require("../atomUtils"); var parent = require("../../../worker/parent"); var child_process_1 = require("child_process"); diff --git a/dist/main/atom/commands/reactCommands.js b/dist/main/atom/commands/reactCommands.js index 512ca42b2..2adb4c4dc 100644 --- a/dist/main/atom/commands/reactCommands.js +++ b/dist/main/atom/commands/reactCommands.js @@ -1,3 +1,4 @@ +"use strict"; var atomUtils = require("../atomUtils"); var htmltotsx_1 = require("../../react/htmltotsx"); function registerReactCommands() { diff --git a/dist/main/atom/components/componentRegistry.js b/dist/main/atom/components/componentRegistry.js index e1ac3237c..d2905b34c 100644 --- a/dist/main/atom/components/componentRegistry.js +++ b/dist/main/atom/components/componentRegistry.js @@ -1,3 +1,4 @@ +"use strict"; function __export(m) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } diff --git a/dist/main/atom/components/ts-view.js b/dist/main/atom/components/ts-view.js index 5446d6fdc..15ee4a167 100644 --- a/dist/main/atom/components/ts-view.js +++ b/dist/main/atom/components/ts-view.js @@ -1,3 +1,4 @@ +"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -26,6 +27,6 @@ var TsView = (function (_super) { this.editor.setText(text); }; return TsView; -})(HTMLElement); +}(HTMLElement)); exports.TsView = TsView; document.registerElement('ts-view', TsView); diff --git a/dist/main/atom/debugAtomTs.js b/dist/main/atom/debugAtomTs.js index d6acc0067..82ee36549 100644 --- a/dist/main/atom/debugAtomTs.js +++ b/dist/main/atom/debugAtomTs.js @@ -1,3 +1,4 @@ +"use strict"; var atomConfig = require('./atomConfig'); function runDebugCode(details) { if (!atomConfig.debugAtomTs) diff --git a/dist/main/atom/editorSetup.js b/dist/main/atom/editorSetup.js index cbf507943..9e755204d 100644 --- a/dist/main/atom/editorSetup.js +++ b/dist/main/atom/editorSetup.js @@ -1,45 +1,4 @@ -var utils_1 = require("../lang/utils"); -var parent = require("../../worker/parent"); -var atomUtils = require("./atomUtils"); -var transformer_1 = require("../lang/transformers/transformer"); +"use strict"; function setupEditor(editor) { - var quickFixDecoration = null; - var quickFixMarker = null; - function clearExistingQuickfixDecoration() { - if (quickFixDecoration) { - quickFixDecoration.destroy(); - quickFixDecoration = null; - } - if (quickFixMarker) { - quickFixMarker.destroy(); - quickFixMarker = null; - } - } - var queryForQuickFix = utils_1.debounce(function (filePathPosition) { - parent.getQuickFixes(filePathPosition).then(function (res) { - clearExistingQuickfixDecoration(); - if (res.fixes.length) { - quickFixMarker = editor.markBufferRange(editor.getSelectedBufferRange()); - quickFixDecoration = editor.decorateMarker(quickFixMarker, { type: "line-number", class: "quickfix" }); - } - }); - }, 500); - var cursorObserver = editor.onDidChangeCursorPosition(function () { - try { - var pathPos = atomUtils.getFilePathPosition(); - if (transformer_1.isTransformerFile(pathPos.filePath)) { - clearExistingQuickfixDecoration(); - return; - } - queryForQuickFix(pathPos); - } - catch (ex) { - clearExistingQuickfixDecoration(); - } - }); - var destroyObserver = editor.onDidDestroy(function () { - cursorObserver.dispose(); - destroyObserver.dispose(); - }); } exports.setupEditor = setupEditor; diff --git a/dist/main/atom/fileStatusCache.js b/dist/main/atom/fileStatusCache.js index f90d4e436..a92dfc0a4 100644 --- a/dist/main/atom/fileStatusCache.js +++ b/dist/main/atom/fileStatusCache.js @@ -1,3 +1,4 @@ +"use strict"; var fsUtil_1 = require('../utils/fsUtil'); ; var fileStatuses = {}; diff --git a/dist/main/atom/gotoHistory.js b/dist/main/atom/gotoHistory.js index af2404bf1..acb6dbf9c 100644 --- a/dist/main/atom/gotoHistory.js +++ b/dist/main/atom/gotoHistory.js @@ -1,3 +1,4 @@ +"use strict"; exports.errorsInOpenFiles = { members: [] }; exports.buildOutput = { members: [] }; exports.referencesOutput = { members: [] }; diff --git a/dist/main/atom/onSaveHandler.js b/dist/main/atom/onSaveHandler.js index eac4bf7cf..0fb427d5d 100644 --- a/dist/main/atom/onSaveHandler.js +++ b/dist/main/atom/onSaveHandler.js @@ -1,3 +1,4 @@ +"use strict"; var atomUtils = require("./atomUtils"); var parent = require('../../worker/parent'); var mainPanelView_1 = require("./views/mainPanelView"); diff --git a/dist/main/atom/signatureProvider.js b/dist/main/atom/signatureProvider.js index ef89850d3..df09737c2 100644 --- a/dist/main/atom/signatureProvider.js +++ b/dist/main/atom/signatureProvider.js @@ -1,3 +1,4 @@ +"use strict"; function requestHandler(config) { } exports.requestHandler = requestHandler; diff --git a/dist/main/atom/tooltipManager.js b/dist/main/atom/tooltipManager.js index a844fd926..7e6d54fc8 100644 --- a/dist/main/atom/tooltipManager.js +++ b/dist/main/atom/tooltipManager.js @@ -1,3 +1,4 @@ +"use strict"; var atomUtils = require('./atomUtils'); var parent = require('../../worker/parent'); var path = require('path'); @@ -46,8 +47,8 @@ function attach(editorView, editor) { if (exprTypeTooltip) return; var pixelPt = pixelPositionFromMouseEvent(editorView, e); - pixelPt.top += editor.displayBuffer.getScrollTop(); - pixelPt.left += editor.displayBuffer.getScrollLeft(); + pixelPt.top += editor.getScrollTop(); + pixelPt.left += editor.getScrollLeft(); var screenPt = editor.screenPositionForPixelPosition(pixelPt); var bufferPt = editor.bufferPositionForScreenPosition(screenPt); var curCharPixelPt = rawView.pixelPositionForBufferPosition([bufferPt.row, bufferPt.column]); diff --git a/dist/main/atom/typescriptGrammar.js b/dist/main/atom/typescriptGrammar.js index f4c367f2f..97a4d0ecf 100644 --- a/dist/main/atom/typescriptGrammar.js +++ b/dist/main/atom/typescriptGrammar.js @@ -1,3 +1,4 @@ +"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -167,7 +168,7 @@ var TypeScriptSemanticGrammar = (function (_super) { return { tokens: tokens, ruleStack: tsTokensWithRuleStack.ruleStack }; }; return TypeScriptSemanticGrammar; -})(AtomTSBaseGrammar); +}(AtomTSBaseGrammar)); exports.TypeScriptSemanticGrammar = TypeScriptSemanticGrammar; function getAtomStyleForToken(token, str) { switch (token.classification) { diff --git a/dist/main/atom/views/astView.js b/dist/main/atom/views/astView.js index f4a3906b2..650053db7 100644 --- a/dist/main/atom/views/astView.js +++ b/dist/main/atom/views/astView.js @@ -1,3 +1,4 @@ +"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -47,7 +48,7 @@ var AstView = (function (_super) { }); }; return AstView; -})(sp.ScrollView); +}(sp.ScrollView)); exports.AstView = AstView; function renderTree(rootNode, _mainContent, display) { var root = { diff --git a/dist/main/atom/views/awesomePanelView.js b/dist/main/atom/views/awesomePanelView.js index 109366d8c..968c720a9 100644 --- a/dist/main/atom/views/awesomePanelView.js +++ b/dist/main/atom/views/awesomePanelView.js @@ -1,3 +1,4 @@ +"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -18,7 +19,7 @@ var AwesomePanelView = (function (_super) { this.something.html('
tada
'); }; return AwesomePanelView; -})(view.View); +}(view.View)); exports.AwesomePanelView = AwesomePanelView; function attach() { exports.panelView = new AwesomePanelView({}); diff --git a/dist/main/atom/views/contextView.js b/dist/main/atom/views/contextView.js index d65d7a5f4..d28535c26 100644 --- a/dist/main/atom/views/contextView.js +++ b/dist/main/atom/views/contextView.js @@ -1,3 +1,4 @@ +"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -66,5 +67,5 @@ var ContextView = (function (_super) { this.hide(); }; return ContextView; -})(sp.SelectListView); +}(sp.SelectListView)); exports.ContextView = ContextView; diff --git a/dist/main/atom/views/dependencyView.js b/dist/main/atom/views/dependencyView.js index f39924337..586a6b27a 100644 --- a/dist/main/atom/views/dependencyView.js +++ b/dist/main/atom/views/dependencyView.js @@ -1,3 +1,4 @@ +"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -41,7 +42,7 @@ var DependencyView = (function (_super) { }); }; return DependencyView; -})(sp.ScrollView); +}(sp.ScrollView)); exports.DependencyView = DependencyView; var prefixes = { circle: 'circle' @@ -88,8 +89,8 @@ function renderGraph(dependencies, mainContent, display) { var cycles = d3Graph.cycles(); var message = ''; var textContent = ''; - for (var _i = 0; _i < cycles.length; _i++) { - var cycle = cycles[_i]; + for (var _i = 0, cycles_1 = cycles; _i < cycles_1.length; _i++) { + var cycle = cycles_1[_i]; message += '

Cycle Found:

'; message += cycle.join('
') + '
'; textContent += '---Cycle Found---' + os.EOL; @@ -368,7 +369,7 @@ var D3Graph = (function () { return this.circularPaths; }; return D3Graph; -})(); +}()); function linkArc(d) { var targetX = d.target.x; var targetY = d.target.y; diff --git a/dist/main/atom/views/documentationView.js b/dist/main/atom/views/documentationView.js index aaa0047a0..3c6102e14 100644 --- a/dist/main/atom/views/documentationView.js +++ b/dist/main/atom/views/documentationView.js @@ -1,3 +1,4 @@ +"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -46,7 +47,7 @@ var DocumentationView = (function (_super) { } }; return DocumentationView; -})(view.View); +}(view.View)); exports.DocumentationView = DocumentationView; function attach() { if (exports.docView) diff --git a/dist/main/atom/views/fileSymbolsView.js b/dist/main/atom/views/fileSymbolsView.js index 90c550fa2..8d21b1a2c 100644 --- a/dist/main/atom/views/fileSymbolsView.js +++ b/dist/main/atom/views/fileSymbolsView.js @@ -1,3 +1,4 @@ +"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -49,5 +50,5 @@ var FileSymbolsView = (function (_super) { this.hide(); }; return FileSymbolsView; -})(sp.SelectListView); +}(sp.SelectListView)); exports.FileSymbolsView = FileSymbolsView; diff --git a/dist/main/atom/views/lineMessageView.js b/dist/main/atom/views/lineMessageView.js index caa7338a0..92ad22931 100644 --- a/dist/main/atom/views/lineMessageView.js +++ b/dist/main/atom/views/lineMessageView.js @@ -1,3 +1,4 @@ +"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -66,5 +67,5 @@ var LineMessageView = (function (_super) { }; }; return LineMessageView; -})(view.View); +}(view.View)); exports.LineMessageView = LineMessageView; diff --git a/dist/main/atom/views/mainPanelView.js b/dist/main/atom/views/mainPanelView.js index 611d30589..ca1576dc9 100644 --- a/dist/main/atom/views/mainPanelView.js +++ b/dist/main/atom/views/mainPanelView.js @@ -1,3 +1,4 @@ +"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -65,7 +66,7 @@ var MainPanelView = (function (_super) { }); _this.span({ class: 'layout horizontal atomts-panel-header', - style: 'align-items: center; flex: 1 1 auto' + style: 'align-items: center; flex: 1 1 auto; line-height: 24px;' }, function () { _this.div({ style: 'cursor: pointer;', @@ -209,10 +210,10 @@ var MainPanelView = (function (_super) { this.txtPendingCount.html("" + this.pendingRequests.length + ""); this.sectionPending.stop(); if (pending.length) { - this.sectionPending.fadeIn(500); + this.sectionPending.animate({ opacity: 0.5 }, 500); } else { - this.sectionPending.fadeOut(200); + this.sectionPending.animate({ opacity: 0 }, 200); } }; MainPanelView.prototype.errorPanelSelectedClick = function () { @@ -295,8 +296,8 @@ var MainPanelView = (function (_super) { var title = panelHeaders.references + " ( Found: " + references.length + " )"; this.referencesPanelBtn.html(title); gotoHistory.referencesOutput.members = []; - for (var _i = 0; _i < references.length; _i++) { - var ref = references[_i]; + for (var _i = 0, references_1 = references; _i < references_1.length; _i++) { + var ref = references_1[_i]; var view = new lineMessageView.LineMessageView({ goToLine: function (filePath, line, col) { return gotoHistory.gotoLine(filePath, line, col, gotoHistory.referencesOutput); }, message: '', @@ -311,6 +312,7 @@ var MainPanelView = (function (_super) { }; MainPanelView.prototype.clearError = function () { this.clearedError = true; + this.clearSummary(); this.errorBody.empty(); }; MainPanelView.prototype.addError = function (view) { @@ -330,13 +332,17 @@ var MainPanelView = (function (_super) { handler(this.summary); } }; + MainPanelView.prototype.clearSummary = function () { + this.summary.html(''); + this.summary.off(); + }; MainPanelView.prototype.setErrorPanelErrorCount = function (fileErrorCount, totalErrorCount) { var title = panelHeaders.error + " ( No Errors )"; if (totalErrorCount > 0) { title = panelHeaders.error + " (\n " + fileErrorCount + " \n file" + (fileErrorCount === 1 ? "" : "s") + " \n " + totalErrorCount + " \n error" + (totalErrorCount === 1 ? "" : "s") + " \n )"; } else { - this.summary.html(''); + this.clearSummary(); this.errorBody.html('No errors in open files \u2665'); } this.errorPanelBtn.html(title); @@ -394,7 +400,7 @@ var MainPanelView = (function (_super) { } }; return MainPanelView; -})(view.View); +}(view.View)); exports.MainPanelView = MainPanelView; var panel; function attach() { diff --git a/dist/main/atom/views/plainMessageView.js b/dist/main/atom/views/plainMessageView.js index 43f3685e5..efa2465a9 100644 --- a/dist/main/atom/views/plainMessageView.js +++ b/dist/main/atom/views/plainMessageView.js @@ -1,3 +1,4 @@ +"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -27,5 +28,5 @@ var PlainMessageView = (function (_super) { }; }; return PlainMessageView; -})(view.View); +}(view.View)); exports.PlainMessageView = PlainMessageView; diff --git a/dist/main/atom/views/projectSymbolsView.js b/dist/main/atom/views/projectSymbolsView.js index 3df89e694..bd2f51d81 100644 --- a/dist/main/atom/views/projectSymbolsView.js +++ b/dist/main/atom/views/projectSymbolsView.js @@ -1,3 +1,4 @@ +"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -59,5 +60,5 @@ var ProjectSymbolsView = (function (_super) { this.hide(); }; return ProjectSymbolsView; -})(sp.SelectListView); +}(sp.SelectListView)); exports.ProjectSymbolsView = ProjectSymbolsView; diff --git a/dist/main/atom/views/rView.js b/dist/main/atom/views/rView.js index 332cda392..0d912ff42 100644 --- a/dist/main/atom/views/rView.js +++ b/dist/main/atom/views/rView.js @@ -1,3 +1,4 @@ +"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -23,11 +24,11 @@ var MyComponent = (function (_super) { }); }; MyComponent.prototype.render = function () { - return React.createElement("div", {"onClick": this.stop}, "This is a test: ", this.state.count); + return React.createElement("div", {onClick: this.stop}, "This is a test: ", this.state.count); }; MyComponent.defaultProps = { count: 0 }; return MyComponent; -})(React.Component); +}(React.Component)); var RView = (function (_super) { __extends(RView, _super); function RView(config) { @@ -59,5 +60,5 @@ var RView = (function (_super) { }); RView.protocol = 'atomtsview:'; return RView; -})(sp.ScrollView); +}(sp.ScrollView)); exports.RView = RView; diff --git a/dist/main/atom/views/renameView.js b/dist/main/atom/views/renameView.js index ff6f919ca..da45847a8 100644 --- a/dist/main/atom/views/renameView.js +++ b/dist/main/atom/views/renameView.js @@ -1,3 +1,4 @@ +"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -72,7 +73,7 @@ var RenameView = (function (_super) { }; RenameView.content = html; return RenameView; -})(view.View); +}(view.View)); exports.RenameView = RenameView; var panel; function attach() { diff --git a/dist/main/atom/views/semanticView.js b/dist/main/atom/views/semanticView.js index a58ade601..bf0175e64 100644 --- a/dist/main/atom/views/semanticView.js +++ b/dist/main/atom/views/semanticView.js @@ -1,3 +1,4 @@ +"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -75,7 +76,7 @@ var MyComponent = (function (_super) { }; MyComponent.prototype.renderNode = function (node, indent) { var _this = this; - return React.createElement("div", {"className": "node", "onClick": function (event) { _this.gotoNode(node); event.stopPropagation(); }, "data-start": node.start.line, "data-end": node.end.line}, rts.indent(indent), React.createElement("span", {"className": this.getIconForKind(node.kind) + ' ' + this.isSelected(node)}, node.text), node.subNodes.map(function (sn) { return _this.renderNode(sn, indent + 1); })); + return React.createElement("div", {className: "node", onClick: function (event) { _this.gotoNode(node); event.stopPropagation(); }, "data-start": node.start.line, "data-end": node.end.line}, rts.indent(indent), React.createElement("span", {className: this.getIconForKind(node.kind) + ' ' + this.isSelected(node)}, node.text), node.subNodes.map(function (sn) { return _this.renderNode(sn, indent + 1); })); }; MyComponent.prototype.getIconForKind = function (kind) { return "icon icon-" + kind; @@ -95,7 +96,7 @@ var MyComponent = (function (_super) { this.state.editor.setCursorBufferPosition([gotoLine, 0]); }; return MyComponent; -})(React.Component); +}(React.Component)); var SemanticView = (function (_super) { __extends(SemanticView, _super); function SemanticView(config) { @@ -123,7 +124,7 @@ var SemanticView = (function (_super) { React.render(React.createElement(MyComponent, {}), this.rootDomElement); }; return SemanticView; -})(sp.ScrollView); +}(sp.ScrollView)); exports.SemanticView = SemanticView; var panel; function attach() { diff --git a/dist/main/atom/views/simpleOverlaySelectionView.js b/dist/main/atom/views/simpleOverlaySelectionView.js index 12132e3f6..1fbc08067 100644 --- a/dist/main/atom/views/simpleOverlaySelectionView.js +++ b/dist/main/atom/views/simpleOverlaySelectionView.js @@ -1,3 +1,4 @@ +"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -62,5 +63,5 @@ var SimpleOverlaySelectListView = (function (_super) { this.hide(); }; return SimpleOverlaySelectListView; -})(sp.SelectListView); +}(sp.SelectListView)); exports.SimpleOverlaySelectListView = SimpleOverlaySelectListView; diff --git a/dist/main/atom/views/simpleSelectionView.js b/dist/main/atom/views/simpleSelectionView.js index 67f7d4282..b466dc3fa 100644 --- a/dist/main/atom/views/simpleSelectionView.js +++ b/dist/main/atom/views/simpleSelectionView.js @@ -1,3 +1,4 @@ +"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -66,5 +67,5 @@ var SimpleSelectListView = (function (_super) { this.hide(); }; return SimpleSelectListView; -})(sp.SelectListView); +}(sp.SelectListView)); exports.SimpleSelectListView = SimpleSelectListView; diff --git a/dist/main/atom/views/tooltipView.js b/dist/main/atom/views/tooltipView.js index 1a21def8d..cb6949497 100644 --- a/dist/main/atom/views/tooltipView.js +++ b/dist/main/atom/views/tooltipView.js @@ -1,3 +1,4 @@ +"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -42,5 +43,5 @@ var TooltipView = (function (_super) { this.$.css({ left: left, top: top, right: right }); }; return TooltipView; -})(view.View); +}(view.View)); exports.TooltipView = TooltipView; diff --git a/dist/main/atom/views/view.js b/dist/main/atom/views/view.js index 1503acf45..70f77ef1a 100644 --- a/dist/main/atom/views/view.js +++ b/dist/main/atom/views/view.js @@ -1,3 +1,4 @@ +"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -23,7 +24,7 @@ var View = (function (_super) { }; View.prototype.init = function () { }; return View; -})(sp.View); +}(sp.View)); exports.View = View; exports.$ = sp.$; var ScrollView = (function (_super) { @@ -45,5 +46,5 @@ var ScrollView = (function (_super) { }; ScrollView.prototype.init = function () { }; return ScrollView; -})(sp.ScrollView); +}(sp.ScrollView)); exports.ScrollView = ScrollView; diff --git a/dist/main/atomts.js b/dist/main/atomts.js index 907845f24..4cc89483c 100644 --- a/dist/main/atomts.js +++ b/dist/main/atomts.js @@ -1,3 +1,4 @@ +"use strict"; var atomConfig = require('./atom/atomConfig'); var makeTypeScriptGlobal_1 = require("../typescript/makeTypeScriptGlobal"); makeTypeScriptGlobal_1.makeTsGlobal(atomConfig.typescriptServices); diff --git a/dist/main/bin/atbuild.js b/dist/main/bin/atbuild.js index fead2d79b..689bd6e78 100644 --- a/dist/main/bin/atbuild.js +++ b/dist/main/bin/atbuild.js @@ -1,3 +1,4 @@ +"use strict"; var makeTypeScriptGlobal_1 = require("../../typescript/makeTypeScriptGlobal"); makeTypeScriptGlobal_1.makeTsGlobal(); var tsconfig = require("../tsconfig/tsconfig"); diff --git a/dist/main/json2dts/json2dts.js b/dist/main/json2dts/json2dts.js index 205acfe80..893efe6d7 100644 --- a/dist/main/json2dts/json2dts.js +++ b/dist/main/json2dts/json2dts.js @@ -1,3 +1,4 @@ +"use strict"; var JSON2DTS = require("json2dts"); var Json2dts = JSON2DTS.Json2dts; var toValidJSON = JSON2DTS.toValidJSON; diff --git a/dist/main/lang/core/languageServiceHost2.js b/dist/main/lang/core/languageServiceHost2.js index ce9482f96..c3bc58cb6 100644 --- a/dist/main/lang/core/languageServiceHost2.js +++ b/dist/main/lang/core/languageServiceHost2.js @@ -1,3 +1,4 @@ +"use strict"; var path = require('path'); var fs = require('fs'); var textBuffer = require('basarat-text-buffer'); @@ -241,5 +242,5 @@ var LanguageServiceHost = (function () { } } return LanguageServiceHost; -})(); +}()); exports.LanguageServiceHost = LanguageServiceHost; diff --git a/dist/main/lang/core/project.js b/dist/main/lang/core/project.js index 32bb699c0..87f5e37f0 100644 --- a/dist/main/lang/core/project.js +++ b/dist/main/lang/core/project.js @@ -1,3 +1,4 @@ +"use strict"; var fs = require('fs'); exports.languageServiceHost = require('./languageServiceHost2'); var tsconfig = require('../../tsconfig/tsconfig'); @@ -33,5 +34,5 @@ var Project = (function () { return (this.getProjectSourceFiles().filter(function (f) { return f.fileName === fileName; }).length === 1); }; return Project; -})(); +}()); exports.Project = Project; diff --git a/dist/main/lang/fixmyts/astUtils.js b/dist/main/lang/fixmyts/astUtils.js index 750ff9518..26f82a79d 100644 --- a/dist/main/lang/fixmyts/astUtils.js +++ b/dist/main/lang/fixmyts/astUtils.js @@ -1,3 +1,4 @@ +"use strict"; exports.forEachChild = ts.forEachChild; function forEachChildRecursive(node, cbNode, depth) { if (depth === void 0) { depth = 0; } diff --git a/dist/main/lang/fixmyts/quickFix.js b/dist/main/lang/fixmyts/quickFix.js index d87ea67de..d9b265ecf 100644 --- a/dist/main/lang/fixmyts/quickFix.js +++ b/dist/main/lang/fixmyts/quickFix.js @@ -1,14 +1,15 @@ +"use strict"; function getRefactoringsByFilePath(refactorings) { var loc = {}; - for (var _i = 0; _i < refactorings.length; _i++) { - var refac = refactorings[_i]; + for (var _i = 0, refactorings_1 = refactorings; _i < refactorings_1.length; _i++) { + var refac = refactorings_1[_i]; if (!loc[refac.filePath]) loc[refac.filePath] = []; loc[refac.filePath].push(refac); } for (var filePath in loc) { - var refactorings_1 = loc[filePath]; - refactorings_1.sort(function (a, b) { + var refactorings_2 = loc[filePath]; + refactorings_2.sort(function (a, b) { return (b.span.start - a.span.start); }); } diff --git a/dist/main/lang/fixmyts/quickFixRegistry.js b/dist/main/lang/fixmyts/quickFixRegistry.js index ec1ad27d7..ab1c36edb 100644 --- a/dist/main/lang/fixmyts/quickFixRegistry.js +++ b/dist/main/lang/fixmyts/quickFixRegistry.js @@ -1,5 +1,7 @@ +"use strict"; var addClassMember_1 = require("./quickFixes/addClassMember"); var addClassMethod_1 = require("./quickFixes/addClassMethod"); +var addImportFromStatement_1 = require("./quickFixes/addImportFromStatement"); var addImportStatement_1 = require("./quickFixes/addImportStatement"); var equalsToEquals_1 = require("./quickFixes/equalsToEquals"); var extractVariable_1 = require("./quickFixes/extractVariable"); @@ -14,6 +16,7 @@ var singleLineCommentToJsdoc_1 = require("./quickFixes/singleLineCommentToJsdoc" exports.allQuickFixes = [ new addClassMethod_1.AddClassMethod(), new addClassMember_1.AddClassMember(), + new addImportFromStatement_1.AddImportFromStatement(), new addImportStatement_1.AddImportStatement(), new wrapInProperty_1.WrapInProperty(), new equalsToEquals_1.EqualsToEquals(), diff --git a/dist/main/lang/fixmyts/quickFixes/addClassMember.js b/dist/main/lang/fixmyts/quickFixes/addClassMember.js index 0828f8e35..409c4bbb8 100644 --- a/dist/main/lang/fixmyts/quickFixes/addClassMember.js +++ b/dist/main/lang/fixmyts/quickFixes/addClassMember.js @@ -1,3 +1,4 @@ +"use strict"; var ast = require("../astUtils"); var os_1 = require("os"); function getIdentifierAndClassNames(error) { @@ -83,5 +84,5 @@ var AddClassMember = (function () { return [refactoring]; }; return AddClassMember; -})(); +}()); exports.AddClassMember = AddClassMember; diff --git a/dist/main/lang/fixmyts/quickFixes/addClassMethod.js b/dist/main/lang/fixmyts/quickFixes/addClassMethod.js index 259633092..5bc5c571a 100644 --- a/dist/main/lang/fixmyts/quickFixes/addClassMethod.js +++ b/dist/main/lang/fixmyts/quickFixes/addClassMethod.js @@ -1,3 +1,4 @@ +"use strict"; var ast = require("../astUtils"); var os_1 = require("os"); function getIdentifierAndClassNames(error) { @@ -149,5 +150,5 @@ var AddClassMethod = (function () { return [refactoring]; }; return AddClassMethod; -})(); +}()); exports.AddClassMethod = AddClassMethod; diff --git a/dist/main/lang/fixmyts/quickFixes/addImportFromStatement.js b/dist/main/lang/fixmyts/quickFixes/addImportFromStatement.js new file mode 100644 index 000000000..ba7e5ba41 --- /dev/null +++ b/dist/main/lang/fixmyts/quickFixes/addImportFromStatement.js @@ -0,0 +1,58 @@ +"use strict"; +var os_1 = require("os"); +var displayPartsToString = ts.displayPartsToString, typeToDisplayParts = ts.typeToDisplayParts; +var getPathCompletions_1 = require("../../modules/getPathCompletions"); +function getIdentifierAndFileNames(error, project) { + var errorText = error.messageText; + if (typeof errorText !== 'string') { + return undefined; + } + ; + var match = errorText.match(/Cannot find name \'(\w+)\'./); + if (!match) + return; + var identifierName = match[1]; + var files = getPathCompletions_1.getPathCompletions({ + project: project, + filePath: error.file.fileName, + prefix: identifierName, + includeExternalModules: false + }).files; + var file = files.length > 0 ? files[0].relativePath : undefined; + var basename = files.length > 0 ? files[0].name : undefined; + return { identifierName: identifierName, file: file, basename: basename }; +} +var AddImportFromStatement = (function () { + function AddImportFromStatement() { + this.key = AddImportFromStatement.name; + } + AddImportFromStatement.prototype.canProvideFix = function (info) { + var relevantError = info.positionErrors.filter(function (x) { return x.code == 2304; })[0]; + if (!relevantError) + return; + if (info.positionNode.kind !== ts.SyntaxKind.Identifier) + return; + var matches = getIdentifierAndFileNames(relevantError, info.project); + if (!matches) + return; + var identifierName = matches.identifierName, file = matches.file; + return file ? { display: "import {" + identifierName + "} from \"" + file + "\"" } : undefined; + }; + AddImportFromStatement.prototype.provideFix = function (info) { + var relevantError = info.positionErrors.filter(function (x) { return x.code == 2304; })[0]; + var identifier = info.positionNode; + var identifierName = identifier.text; + var fileNameforFix = getIdentifierAndFileNames(relevantError, info.project); + var refactorings = [{ + span: { + start: 0, + length: 0 + }, + newText: "import {" + identifierName + "} from \"" + fileNameforFix.file + "\";" + os_1.EOL, + filePath: info.sourceFile.fileName + }]; + return refactorings; + }; + return AddImportFromStatement; +}()); +exports.AddImportFromStatement = AddImportFromStatement; diff --git a/dist/main/lang/fixmyts/quickFixes/addImportStatement.js b/dist/main/lang/fixmyts/quickFixes/addImportStatement.js index 1c20095f8..b690f14f7 100644 --- a/dist/main/lang/fixmyts/quickFixes/addImportStatement.js +++ b/dist/main/lang/fixmyts/quickFixes/addImportStatement.js @@ -1,3 +1,4 @@ +"use strict"; var os_1 = require("os"); var displayPartsToString = ts.displayPartsToString, typeToDisplayParts = ts.typeToDisplayParts; var getPathCompletions_1 = require("../../modules/getPathCompletions"); @@ -53,5 +54,5 @@ var AddImportStatement = (function () { return refactorings; }; return AddImportStatement; -})(); +}()); exports.AddImportStatement = AddImportStatement; diff --git a/dist/main/lang/fixmyts/quickFixes/equalsToEquals.js b/dist/main/lang/fixmyts/quickFixes/equalsToEquals.js index 841dc5056..7175617fe 100644 --- a/dist/main/lang/fixmyts/quickFixes/equalsToEquals.js +++ b/dist/main/lang/fixmyts/quickFixes/equalsToEquals.js @@ -1,3 +1,4 @@ +"use strict"; var EqualsToEquals = (function () { function EqualsToEquals() { this.key = EqualsToEquals.name; @@ -28,5 +29,5 @@ var EqualsToEquals = (function () { return [refactoring]; }; return EqualsToEquals; -})(); +}()); exports.EqualsToEquals = EqualsToEquals; diff --git a/dist/main/lang/fixmyts/quickFixes/extractVariable.js b/dist/main/lang/fixmyts/quickFixes/extractVariable.js index e6e3c2675..d16491836 100644 --- a/dist/main/lang/fixmyts/quickFixes/extractVariable.js +++ b/dist/main/lang/fixmyts/quickFixes/extractVariable.js @@ -1,3 +1,4 @@ +"use strict"; var os_1 = require("os"); var ExtractVariable = (function () { function ExtractVariable() { @@ -13,7 +14,6 @@ var ExtractVariable = (function () { }, function () { return { display: "Extract variable" }; }); - throw "Unexpected state in canProvideFix"; }; ExtractVariable.prototype.provideFix = function (info) { return execute(info, function () { @@ -23,10 +23,9 @@ var ExtractVariable = (function () { }, function (callExpression) { return extractVariableFromArg(info, callExpression); }); - throw "Unexpected state in provideFix"; }; return ExtractVariable; -})(); +}()); exports.ExtractVariable = ExtractVariable; function execute(info, onProperty, onFuncCall, onExtractable) { var callExpression = findLowestNode(info.positionNode, ts.SyntaxKind.CallExpression); diff --git a/dist/main/lang/fixmyts/quickFixes/implementInterface.js b/dist/main/lang/fixmyts/quickFixes/implementInterface.js index 83701b9da..8133aa175 100644 --- a/dist/main/lang/fixmyts/quickFixes/implementInterface.js +++ b/dist/main/lang/fixmyts/quickFixes/implementInterface.js @@ -1,3 +1,4 @@ +"use strict"; var ast = require("../astUtils"); var os_1 = require("os"); function getClassAndInterfaceName(error) { @@ -42,5 +43,5 @@ var ImplementInterface = (function () { return refactorings; }; return ImplementInterface; -})(); +}()); exports.ImplementInterface = ImplementInterface; diff --git a/dist/main/lang/fixmyts/quickFixes/quoteToTemplate.js b/dist/main/lang/fixmyts/quickFixes/quoteToTemplate.js index 80b5e0768..ad1cd7f98 100644 --- a/dist/main/lang/fixmyts/quickFixes/quoteToTemplate.js +++ b/dist/main/lang/fixmyts/quickFixes/quoteToTemplate.js @@ -1,3 +1,4 @@ +"use strict"; var QuoteToTemplate = (function () { function QuoteToTemplate() { this.key = QuoteToTemplate.name; @@ -29,5 +30,5 @@ var QuoteToTemplate = (function () { return [refactoring]; }; return QuoteToTemplate; -})(); +}()); exports.QuoteToTemplate = QuoteToTemplate; diff --git a/dist/main/lang/fixmyts/quickFixes/quotesToQuotes.js b/dist/main/lang/fixmyts/quickFixes/quotesToQuotes.js index c6f1ba7c0..7b258d6ab 100644 --- a/dist/main/lang/fixmyts/quickFixes/quotesToQuotes.js +++ b/dist/main/lang/fixmyts/quickFixes/quotesToQuotes.js @@ -1,3 +1,4 @@ +"use strict"; var QuotesToQuotes = (function () { function QuotesToQuotes() { this.key = QuotesToQuotes.name; @@ -34,5 +35,5 @@ var QuotesToQuotes = (function () { return [refactoring]; }; return QuotesToQuotes; -})(); +}()); exports.QuotesToQuotes = QuotesToQuotes; diff --git a/dist/main/lang/fixmyts/quickFixes/singleLineCommentToJsdoc.js b/dist/main/lang/fixmyts/quickFixes/singleLineCommentToJsdoc.js index 363c6c8a5..eadb457f7 100644 --- a/dist/main/lang/fixmyts/quickFixes/singleLineCommentToJsdoc.js +++ b/dist/main/lang/fixmyts/quickFixes/singleLineCommentToJsdoc.js @@ -1,3 +1,4 @@ +"use strict"; var utils = require("../../utils"); var SingleLineCommentToJsdoc = (function () { function SingleLineCommentToJsdoc() { @@ -39,5 +40,5 @@ var SingleLineCommentToJsdoc = (function () { return [refactoring]; }; return SingleLineCommentToJsdoc; -})(); +}()); exports.SingleLineCommentToJsdoc = SingleLineCommentToJsdoc; diff --git a/dist/main/lang/fixmyts/quickFixes/stringConcatToTemplate.js b/dist/main/lang/fixmyts/quickFixes/stringConcatToTemplate.js index 14793f213..987d69fdd 100644 --- a/dist/main/lang/fixmyts/quickFixes/stringConcatToTemplate.js +++ b/dist/main/lang/fixmyts/quickFixes/stringConcatToTemplate.js @@ -1,3 +1,4 @@ +"use strict"; function isBinaryAddition(node) { return (node.kind == ts.SyntaxKind.BinaryExpression && node.operatorToken.kind == ts.SyntaxKind.PlusToken); @@ -82,5 +83,5 @@ var StringConcatToTemplate = (function () { return [refactoring]; }; return StringConcatToTemplate; -})(); +}()); exports.StringConcatToTemplate = StringConcatToTemplate; diff --git a/dist/main/lang/fixmyts/quickFixes/typeAssertPropertyAccessToAny.js b/dist/main/lang/fixmyts/quickFixes/typeAssertPropertyAccessToAny.js index 7c9bbfe85..be8213084 100644 --- a/dist/main/lang/fixmyts/quickFixes/typeAssertPropertyAccessToAny.js +++ b/dist/main/lang/fixmyts/quickFixes/typeAssertPropertyAccessToAny.js @@ -1,3 +1,4 @@ +"use strict"; var TypeAssertPropertyAccessToAny = (function () { function TypeAssertPropertyAccessToAny() { this.key = TypeAssertPropertyAccessToAny.name; @@ -34,7 +35,7 @@ var TypeAssertPropertyAccessToAny = (function () { return []; }; return TypeAssertPropertyAccessToAny; -})(); +}()); exports.TypeAssertPropertyAccessToAny = TypeAssertPropertyAccessToAny; function getIdentifierName(errorText) { var match = /Property \'(\w+)\' does not exist on type \.*/.exec(errorText); diff --git a/dist/main/lang/fixmyts/quickFixes/typeAssertPropertyAccessToType.js b/dist/main/lang/fixmyts/quickFixes/typeAssertPropertyAccessToType.js index 5132c0fd4..7ddbea954 100644 --- a/dist/main/lang/fixmyts/quickFixes/typeAssertPropertyAccessToType.js +++ b/dist/main/lang/fixmyts/quickFixes/typeAssertPropertyAccessToType.js @@ -1,3 +1,4 @@ +"use strict"; var TypeAssertPropertyAccessToType = (function () { function TypeAssertPropertyAccessToType() { this.key = TypeAssertPropertyAccessToType.name; @@ -35,7 +36,7 @@ var TypeAssertPropertyAccessToType = (function () { return []; }; return TypeAssertPropertyAccessToType; -})(); +}()); exports.TypeAssertPropertyAccessToType = TypeAssertPropertyAccessToType; function getIdentifierName(errorText) { var match = /Property \'(\w+)\' does not exist on type \.*/.exec(errorText); diff --git a/dist/main/lang/fixmyts/quickFixes/wrapInProperty.js b/dist/main/lang/fixmyts/quickFixes/wrapInProperty.js index a01f22013..69f0134ad 100644 --- a/dist/main/lang/fixmyts/quickFixes/wrapInProperty.js +++ b/dist/main/lang/fixmyts/quickFixes/wrapInProperty.js @@ -1,3 +1,4 @@ +"use strict"; var os_1 = require("os"); var WrapInProperty = (function () { function WrapInProperty() { @@ -30,7 +31,7 @@ var WrapInProperty = (function () { return [assignemnt, property]; }; return WrapInProperty; -})(); +}()); exports.WrapInProperty = WrapInProperty; function createAssignment(constructorDecl, symbolName, indentSetting, filePath) { var indentLevel2 = createIndent(indentSetting, 2); diff --git a/dist/main/lang/modules/astToText.js b/dist/main/lang/modules/astToText.js index 2c9a5780e..06c4ca9f3 100644 --- a/dist/main/lang/modules/astToText.js +++ b/dist/main/lang/modules/astToText.js @@ -1,3 +1,4 @@ +"use strict"; var astUtils_1 = require("../fixmyts/astUtils"); function astToText(srcFile) { var nodeIndex = 0; diff --git a/dist/main/lang/modules/building.js b/dist/main/lang/modules/building.js index 2d1cadadb..d49ef76ce 100644 --- a/dist/main/lang/modules/building.js +++ b/dist/main/lang/modules/building.js @@ -1,9 +1,12 @@ +"use strict"; var mkdirp = require('mkdirp'); var path = require('path'); var fs = require('fs'); var fsUtil_1 = require("../../utils/fsUtil"); var utils_1 = require("../utils"); -var babel; +var findup = require('findup'); +var babels = {}; +var babelConfigs = {}; exports.Not_In_Context = "/* NotInContext */"; function diagnosticToTSError(diagnostic) { var filePath = diagnostic.file.fileName; @@ -37,13 +40,14 @@ function emitFile(proj, filePath) { var sourceMapContents = {}; output.outputFiles.forEach(function (o) { mkdirp.sync(path.dirname(o.name)); - var additionalEmits = runExternalTranspiler(filePath, sourceFile.text, o, proj, sourceMapContents); - if (!sourceMapContents[o.name] && !proj.projectFile.project.compilerOptions.noEmit) { - fs.writeFileSync(o.name, o.text, "utf8"); - } - additionalEmits.forEach(function (a) { - mkdirp.sync(path.dirname(a.name)); - fs.writeFileSync(a.name, a.text, "utf8"); + runExternalTranspiler(filePath, sourceFile.text, o, proj, sourceMapContents).then(function (additionalEmits) { + if (!sourceMapContents[o.name] && !proj.projectFile.project.compilerOptions.noEmit) { + fs.writeFileSync(o.name, o.text, "utf8"); + } + additionalEmits.forEach(function (a) { + mkdirp.sync(path.dirname(a.name)); + fs.writeFileSync(a.name, a.text, "utf8"); + }); }); }); } @@ -75,20 +79,60 @@ function getRawOutput(proj, filePath) { return output; } exports.getRawOutput = getRawOutput; +function getBabelInstance(projectDirectory) { + return new Promise(function (resolve) { + if (!babels[projectDirectory]) { + findup(projectDirectory, 'node_modules/babel-core', function (err, dir) { + if (err) { + findup(projectDirectory, 'node_modules/babel', function (err, dir) { + if (err) { + babels[projectDirectory] = require('babel'); + } + else { + babels[projectDirectory] = require(path.join(dir, 'node_modules/babel')); + } + resolve(babels[projectDirectory]); + }); + } + else { + babels[projectDirectory] = require(path.join(dir, 'node_modules/babel-core')); + resolve(babels[projectDirectory]); + } + }); + } + else { + resolve(babels[projectDirectory]); + } + }).then(function (babel) { + return new Promise(function (resolve) { + findup(projectDirectory, '.babelrc', function (err, dir) { + if (err) + return resolve(babel); + fs.readFile(path.join(dir, '.babelrc'), function (err, data) { + try { + babelConfigs[projectDirectory] = JSON.parse(data.toString()); + } + catch (e) { } + resolve(babel); + }); + }); + }); + }); +} function runExternalTranspiler(sourceFileName, sourceFileText, outputFile, project, sourceMapContents) { if (!isJSFile(outputFile.name) && !isJSSourceMapFile(outputFile.name)) { - return []; + return Promise.resolve([]); } var settings = project.projectFile.project; var externalTranspiler = settings.externalTranspiler; if (!externalTranspiler) { - return []; + return Promise.resolve([]); } if (isJSSourceMapFile(outputFile.name)) { var sourceMapPayload = JSON.parse(outputFile.text); var jsFileName = fsUtil_1.consistentPath(path.resolve(path.dirname(outputFile.name), sourceMapPayload.file)); sourceMapContents[outputFile.name] = { jsFileName: jsFileName, sourceMapPayload: sourceMapPayload }; - return []; + return Promise.resolve([]); } if (typeof externalTranspiler === 'string') { externalTranspiler = { @@ -98,43 +142,45 @@ function runExternalTranspiler(sourceFileName, sourceFileText, outputFile, proje } if (typeof externalTranspiler === 'object') { if (externalTranspiler.name.toLocaleLowerCase() === "babel") { - if (!babel) { - babel = require("babel"); - } - var babelOptions = utils_1.assign({}, externalTranspiler.options || {}, { - filename: outputFile.name - }); - var sourceMapFileName = getJSMapNameForJSFile(outputFile.name); - if (sourceMapContents[sourceMapFileName]) { - babelOptions.inputSourceMap = sourceMapContents[sourceMapFileName].sourceMapPayload; - var baseName = path.basename(sourceFileName); - babelOptions.inputSourceMap.sources = [baseName]; - babelOptions.inputSourceMap.file = baseName; - } - if (settings.compilerOptions.sourceMap) { - babelOptions.sourceMaps = true; - } - if (settings.compilerOptions.inlineSourceMap) { - babelOptions.sourceMaps = "inline"; - } - if (!settings.compilerOptions.removeComments) { - babelOptions.comments = true; - } - var babelResult = babel.transform(outputFile.text, babelOptions); - outputFile.text = babelResult.code; - if (babelResult.map && settings.compilerOptions.sourceMap) { - var additionalEmit = { - name: sourceMapFileName, - text: JSON.stringify(babelResult.map), - writeByteOrderMark: settings.compilerOptions.emitBOM - }; - if (additionalEmit.name === "") { - console.warn("The TypeScript language service did not yet provide a .js.map name for file " + outputFile.name); - return []; + return getBabelInstance(project.projectFile.projectFileDirectory).then(function (babel) { + var babelOptions = utils_1.assign(babelConfigs[project.projectFile.projectFileDirectory] || {}, externalTranspiler.options || {}, { + filename: outputFile.name + }); + var sourceMapFileName = getJSMapNameForJSFile(outputFile.name); + if (sourceMapContents[sourceMapFileName]) { + babelOptions.inputSourceMap = sourceMapContents[sourceMapFileName].sourceMapPayload; + var baseName = path.basename(sourceFileName); + babelOptions.inputSourceMap.sources = [baseName]; + babelOptions.inputSourceMap.file = baseName; } - return [additionalEmit]; - } - return []; + if (settings.compilerOptions.sourceMap) { + babelOptions.sourceMaps = true; + } + if (settings.compilerOptions.inlineSourceMap) { + babelOptions.sourceMaps = "inline"; + } + if (!settings.compilerOptions.removeComments) { + babelOptions.comments = true; + } + var directory = process.cwd(); + process.chdir(project.projectFile.projectFileDirectory); + var babelResult = babel.transform(outputFile.text, babelOptions); + process.chdir(directory); + outputFile.text = babelResult.code; + if (babelResult.map && settings.compilerOptions.sourceMap) { + var additionalEmit = { + name: sourceMapFileName, + text: JSON.stringify(babelResult.map), + writeByteOrderMark: settings.compilerOptions.emitBOM + }; + if (additionalEmit.name === "") { + console.warn("The TypeScript language service did not yet provide a .js.map name for file " + outputFile.name); + return []; + } + return [additionalEmit]; + } + return []; + }); } } function getJSMapNameForJSFile(jsFileName) { diff --git a/dist/main/lang/modules/formatting.js b/dist/main/lang/modules/formatting.js index 70567c635..ba6d5e8cc 100644 --- a/dist/main/lang/modules/formatting.js +++ b/dist/main/lang/modules/formatting.js @@ -1,3 +1,4 @@ +"use strict"; function formatDocument(proj, filePath) { var textChanges = proj.languageService.getFormattingEditsForDocument(filePath, proj.projectFile.project.formatCodeOptions); var edits = textChanges.map(function (change) { diff --git a/dist/main/lang/modules/getPathCompletions.js b/dist/main/lang/modules/getPathCompletions.js index 5b3663f72..0402a8991 100644 --- a/dist/main/lang/modules/getPathCompletions.js +++ b/dist/main/lang/modules/getPathCompletions.js @@ -1,3 +1,4 @@ +"use strict"; var path = require("path"); var tsconfig = require("../../tsconfig/tsconfig"); var utils = require("../utils"); diff --git a/dist/main/lang/modules/moveFiles.js b/dist/main/lang/modules/moveFiles.js index af02c5b1f..daf35ba20 100644 --- a/dist/main/lang/modules/moveFiles.js +++ b/dist/main/lang/modules/moveFiles.js @@ -1,3 +1,4 @@ +"use strict"; var astUtils_1 = require("../fixmyts/astUtils"); var path = require("path"); var tsconfig_1 = require("../../tsconfig/tsconfig"); @@ -20,8 +21,8 @@ function getRenameFilesRefactorings(program, oldDirectoryOrFile, newDirectoryOrF }); var matches = imports.filter(function (f) { return f.path == oldFileNoExt; }); if (matches.length) { - for (var _i = 0; _i < matches.length; _i++) { - var match = matches[_i]; + for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { + var match = matches_1[_i]; refactorings.push({ filePath: sourceFile.fileName, span: { diff --git a/dist/main/lang/modules/programDependencies.js b/dist/main/lang/modules/programDependencies.js index 116cf2135..0fe6bdd76 100644 --- a/dist/main/lang/modules/programDependencies.js +++ b/dist/main/lang/modules/programDependencies.js @@ -1,3 +1,4 @@ +"use strict"; var tsconfig_1 = require("../../tsconfig/tsconfig"); var fsUtil_1 = require("../../utils/fsUtil"); var path = require("path"); @@ -19,8 +20,8 @@ function getDependencies(projectFile, program) { } return file; }); - for (var _b = 0; _b < targets.length; _b++) { - var target = targets[_b]; + for (var _b = 0, targets_1 = targets; _b < targets_1.length; _b++) { + var target = targets_1[_b]; var targetPath = fsUtil_1.consistentPath(path.relative(projectDir, fsUtil_1.consistentPath(target))); var sourcePath = fsUtil_1.consistentPath(path.relative(projectDir, filePath)); links.push({ diff --git a/dist/main/lang/projectCache.js b/dist/main/lang/projectCache.js index feff4f840..902bd9b36 100644 --- a/dist/main/lang/projectCache.js +++ b/dist/main/lang/projectCache.js @@ -1,3 +1,4 @@ +"use strict"; var fs = require("fs"); var path = require("path"); var tsconfig = require("../tsconfig/tsconfig"); diff --git a/dist/main/lang/projectService.js b/dist/main/lang/projectService.js index cb866cb43..51f4c898b 100644 --- a/dist/main/lang/projectService.js +++ b/dist/main/lang/projectService.js @@ -1,3 +1,4 @@ +"use strict"; var fsu = require("../utils/fsUtil"); var fs = require('fs'); var path = require('path'); @@ -334,8 +335,8 @@ function getProjectFileDetails(query) { exports.getProjectFileDetails = getProjectFileDetails; function sortNavbarItemsBySpan(items) { items.sort(function (a, b) { return a.spans[0].start - b.spans[0].start; }); - for (var _i = 0; _i < items.length; _i++) { - var item = items[_i]; + for (var _i = 0, items_1 = items; _i < items_1.length; _i++) { + var item = items_1[_i]; if (item.childItems) { sortNavbarItemsBySpan(item.childItems); } diff --git a/dist/main/lang/transformers/implementations/nullTransformer.js b/dist/main/lang/transformers/implementations/nullTransformer.js index ea5b82f6d..e35b530cd 100644 --- a/dist/main/lang/transformers/implementations/nullTransformer.js +++ b/dist/main/lang/transformers/implementations/nullTransformer.js @@ -1,3 +1,4 @@ +"use strict"; var transformerRegistry_1 = require("../transformerRegistry"); var NullTransformer = (function () { function NullTransformer() { @@ -7,6 +8,6 @@ var NullTransformer = (function () { return { code: code }; }; return NullTransformer; -})(); +}()); exports.NullTransformer = NullTransformer; transformerRegistry_1.add(new NullTransformer()); diff --git a/dist/main/lang/transformers/transformer.js b/dist/main/lang/transformers/transformer.js index 5b96c7c76..47313d684 100644 --- a/dist/main/lang/transformers/transformer.js +++ b/dist/main/lang/transformers/transformer.js @@ -1,3 +1,4 @@ +"use strict"; var path = require("path"); function isTransformerFile(filePath) { var ext = path.extname(filePath); diff --git a/dist/main/lang/transformers/transformerRegistry.js b/dist/main/lang/transformers/transformerRegistry.js index 3f6105304..896ba9da6 100644 --- a/dist/main/lang/transformers/transformerRegistry.js +++ b/dist/main/lang/transformers/transformerRegistry.js @@ -1,3 +1,4 @@ +"use strict"; var allTransformers = []; function add(transformer) { transformer.regex = (new RegExp("transform:" + transformer.name + "{[.\\s]*}transform:" + transformer.name, 'g')); @@ -16,17 +17,6 @@ var transformFinderRegex = /transform:(.*){/g; var transformEndFinderRegexGenerator = function (name) { return new RegExp("}transform:" + name); }; function getInitialTransformation(code) { var transforms = []; - var processedSrcUpto = 0; - var srcCode = code; - var destCode = ''; - var destDelta = 0; - while (true) { - var remainingCode = code.substr(processedSrcUpto); - var matches = transformFinderRegex.exec(remainingCode); - if (!matches || !matches.length || matches.length < 2) - return { transforms: transforms }; - var nextTransformName = matches.slice[1]; - } return { transforms: transforms }; } exports.getInitialTransformation = getInitialTransformation; @@ -39,8 +29,9 @@ function transform(name, code) { return transformer.transform(code); } exports.transform = transform; -var expand = require('glob-expand'); -var files = expand({ filter: 'isFile', cwd: __dirname }, [ - "./implementations/*.js" -]); +var glob = require('glob'); +var files = glob.sync('./implementations/*.js', { + nodir: true, + cwd: __dirname +}); files = files.map(function (f) { return require(f); }); diff --git a/dist/main/lang/utils.js b/dist/main/lang/utils.js index 1b0a23977..9c0b803d5 100644 --- a/dist/main/lang/utils.js +++ b/dist/main/lang/utils.js @@ -81,7 +81,7 @@ var Signal = (function () { return this.listeners.length > 0; }; return Signal; -})(); +}()); exports.Signal = Signal; function binarySearch(array, value) { var low = 0; @@ -139,7 +139,7 @@ var Dict = (function () { return array; }; return Dict; -})(); +}()); exports.Dict = Dict; function delay(seconds) { if (seconds === void 0) { seconds = 2; } diff --git a/dist/main/react/htmltotsx.js b/dist/main/react/htmltotsx.js index 59347377f..12ed744a8 100644 --- a/dist/main/react/htmltotsx.js +++ b/dist/main/react/htmltotsx.js @@ -1,3 +1,4 @@ +"use strict"; var HTMLtoJSX = require("htmltojsx"); function convert(content, indentSize) { var indent = Array(indentSize + 1).join(' '); diff --git a/dist/main/tsconfig/dts-generator.js b/dist/main/tsconfig/dts-generator.js index b3bae7d05..6cf34cd73 100644 --- a/dist/main/tsconfig/dts-generator.js +++ b/dist/main/tsconfig/dts-generator.js @@ -1,3 +1,4 @@ +"use strict"; var pathUtil = require("path"); var os = require("os"); var fs = require("fs"); diff --git a/dist/main/tsconfig/formatting.js b/dist/main/tsconfig/formatting.js index 6e7de6faf..12532f7ad 100644 --- a/dist/main/tsconfig/formatting.js +++ b/dist/main/tsconfig/formatting.js @@ -1,3 +1,4 @@ +"use strict"; var os = require('os'); function defaultFormatCodeOptions() { return { @@ -5,6 +6,7 @@ function defaultFormatCodeOptions() { TabSize: 4, NewLineCharacter: os.EOL, ConvertTabsToSpaces: true, + IndentStyle: ts.IndentStyle.Smart, InsertSpaceAfterCommaDelimiter: true, InsertSpaceAfterSemicolonInForStatements: true, InsertSpaceBeforeAndAfterBinaryOperators: true, diff --git a/dist/main/tsconfig/simpleValidator.js b/dist/main/tsconfig/simpleValidator.js index 77eba6085..a75fd158e 100644 --- a/dist/main/tsconfig/simpleValidator.js +++ b/dist/main/tsconfig/simpleValidator.js @@ -1,3 +1,4 @@ +"use strict"; exports.types = { string: 'string', boolean: 'boolean', @@ -44,7 +45,7 @@ var SimpleValidator = (function () { return errors; }; return SimpleValidator; -})(); +}()); exports.SimpleValidator = SimpleValidator; function createMap(arr) { return arr.reduce(function (result, key) { diff --git a/dist/main/tsconfig/tsconfig.js b/dist/main/tsconfig/tsconfig.js index 715c0d6f7..5c02e707b 100644 --- a/dist/main/tsconfig/tsconfig.js +++ b/dist/main/tsconfig/tsconfig.js @@ -1,10 +1,13 @@ +"use strict"; var fsu = require("../utils/fsUtil"); var simpleValidator = require('./simpleValidator'); -var stripBom = require('strip-bom'); var types = simpleValidator.types; var compilerOptionsValidation = { - allowNonTsExtensions: { type: simpleValidator.types.boolean }, - charset: { type: simpleValidator.types.string }, + allowNonTsExtensions: { type: types.boolean }, + allowSyntheticDefaultImports: { type: types.boolean }, + allowUnreachableCode: { type: types.boolean }, + allowUnusedLabels: { type: types.boolean }, + charset: { type: types.string }, codepage: { type: types.number }, declaration: { type: types.boolean }, diagnostics: { type: types.boolean }, @@ -20,24 +23,28 @@ var compilerOptionsValidation = { locals: { type: types.string }, listFiles: { type: types.boolean }, mapRoot: { type: types.string }, - module: { type: types.string, validValues: ['commonjs', 'amd', 'system', 'umd'] }, + module: { type: types.string, validValues: ['commonjs', 'amd', 'system', 'umd', 'es6', 'es2015'] }, moduleResolution: { type: types.string, validValues: ['classic', 'node'] }, newLine: { type: types.string }, noEmit: { type: types.boolean }, noEmitHelpers: { type: types.boolean }, noEmitOnError: { type: types.boolean }, noErrorTruncation: { type: types.boolean }, + noFallthroughCasesInSwitch: { type: types.boolean }, noImplicitAny: { type: types.boolean }, + noImplicitReturns: { type: types.boolean }, noLib: { type: types.boolean }, noLibCheck: { type: types.boolean }, noResolve: { type: types.boolean }, out: { type: types.string }, + outFile: { type: types.string }, outDir: { type: types.string }, preserveConstEnums: { type: types.boolean }, removeComments: { type: types.boolean }, rootDir: { type: types.string }, sourceMap: { type: types.boolean }, sourceRoot: { type: types.string }, + stripInternal: { type: types.boolean }, suppressExcessPropertyErrors: { type: types.boolean }, suppressImplicitAnyIndexErrors: { type: types.boolean }, target: { type: types.string, validValues: ['es3', 'es5', 'es6'] }, @@ -46,7 +53,7 @@ var compilerOptionsValidation = { }; var validator = new simpleValidator.SimpleValidator(compilerOptionsValidation); exports.errors = { - GET_PROJECT_INVALID_PATH: 'Invalid Path', + GET_PROJECT_INVALID_PATH: 'The path used to query for tsconfig.json does not exist', GET_PROJECT_NO_PROJECT_FOUND: 'No Project Found', GET_PROJECT_FAILED_TO_OPEN_PROJECT_FILE: 'Failed to fs.readFileSync the project file', GET_PROJECT_JSON_PARSE_FAILED: 'Failed to JSON.parse the project file', @@ -61,16 +68,17 @@ function errorWithDetails(error, details) { } var fs = require('fs'); var path = require('path'); -var expand = require('glob-expand'); +var tsconfig = require('tsconfig'); var os = require('os'); +var detectIndent = require('detect-indent'); var formatting = require('./formatting'); var projectFileName = 'tsconfig.json'; var defaultFilesGlob = [ - "./**/*.ts", - "./**/*.tsx", - "!./node_modules/**/*", + "**/*.ts", + "**/*.tsx", + "!node_modules/**", ]; -var invisibleFilesGlob = ["./**/*.ts", "./**/*.tsx"]; +var invisibleFilesGlob = '{**/*.ts,**/*.tsx}'; exports.defaults = { target: ts.ScriptTarget.ES5, module: ts.ModuleKind.CommonJS, @@ -97,8 +105,10 @@ var typescriptEnumMap = { 'none': ts.ModuleKind.None, 'commonjs': ts.ModuleKind.CommonJS, 'amd': ts.ModuleKind.AMD, - 'system': ts.ModuleKind.System, 'umd': ts.ModuleKind.UMD, + 'system': ts.ModuleKind.System, + 'es6': ts.ModuleKind.ES6, + 'es2015': ts.ModuleKind.ES2015, }, moduleResolution: { 'node': ts.ModuleResolutionKind.NodeJs, @@ -142,6 +152,9 @@ function rawToTsCompilerOptions(jsonOptions, projectDir) { if (compilerOptions.out !== undefined) { compilerOptions.out = path.resolve(projectDir, compilerOptions.out); } + if (compilerOptions.outFile !== undefined) { + compilerOptions.out = path.resolve(projectDir, compilerOptions.outFile); + } return compilerOptions; } function tsToRawCompilerOptions(compilerOptions) { @@ -167,7 +180,8 @@ function getDefaultInMemoryProject(srcFile) { formatCodeOptions: formatting.defaultFormatCodeOptions(), compileOnSave: true, buildOnSave: false, - scripts: {} + scripts: {}, + atom: { rewriteTsconfig: true }, }; return { projectFileDirectory: dir, @@ -182,55 +196,36 @@ function getProjectSync(pathOrSrcFile) { throw new Error(exports.errors.GET_PROJECT_INVALID_PATH); } var dir = fs.lstatSync(pathOrSrcFile).isDirectory() ? pathOrSrcFile : path.dirname(pathOrSrcFile); - var projectFile = ''; - try { - projectFile = travelUpTheDirectoryTreeTillYouFind(dir, projectFileName); + var projectFile = tsconfig.resolveSync(dir); + if (!projectFile) { + throw errorWithDetails(new Error(exports.errors.GET_PROJECT_NO_PROJECT_FOUND), { projectFilePath: fsu.consistentPath(pathOrSrcFile), errorMessage: 'not found' }); } - catch (e) { - var err = e; - if (err.message == "not found") { - throw errorWithDetails(new Error(exports.errors.GET_PROJECT_NO_PROJECT_FOUND), { projectFilePath: fsu.consistentPath(pathOrSrcFile), errorMessage: err.message }); - } - } - projectFile = path.normalize(projectFile); var projectFileDirectory = path.dirname(projectFile) + path.sep; var projectSpec; + var projectFileTextContent; try { - var projectFileTextContent = fs.readFileSync(projectFile, 'utf8'); + projectFileTextContent = fs.readFileSync(projectFile, 'utf8'); } catch (ex) { throw new Error(exports.errors.GET_PROJECT_FAILED_TO_OPEN_PROJECT_FILE); } try { - projectSpec = JSON.parse(stripBom(projectFileTextContent)); + projectSpec = tsconfig.parseFileSync(projectFileTextContent, projectFile, { resolvePaths: false }); } catch (ex) { throw errorWithDetails(new Error(exports.errors.GET_PROJECT_JSON_PARSE_FAILED), { projectFilePath: fsu.consistentPath(projectFile), error: ex.message }); } - if (!projectSpec.compilerOptions) - projectSpec.compilerOptions = {}; - var cwdPath = path.relative(process.cwd(), path.dirname(projectFile)); - if (!projectSpec.files && !projectSpec.filesGlob) { - var toExpand = invisibleFilesGlob; + if (!projectSpec.atom) { + projectSpec.atom = { + rewriteTsconfig: true, + }; } if (projectSpec.filesGlob) { - var toExpand = projectSpec.filesGlob; - } - if (toExpand) { - try { - projectSpec.files = expand({ filter: 'isFile', cwd: cwdPath }, toExpand); - } - catch (ex) { - throw errorWithDetails(new Error(exports.errors.GET_PROJECT_GLOB_EXPAND_FAILED), { glob: projectSpec.filesGlob, projectFilePath: fsu.consistentPath(projectFile), errorMessage: ex.message }); - } - } - if (projectSpec.filesGlob) { - var prettyJSONProjectSpec = prettyJSON(projectSpec); - if (prettyJSONProjectSpec !== projectFileTextContent) { - fs.writeFileSync(projectFile, prettyJSON(projectSpec)); + var prettyJSONProjectSpec = prettyJSON(projectSpec, detectIndent(projectFileTextContent).indent); + if (prettyJSONProjectSpec !== projectFileTextContent && projectSpec.atom.rewriteTsconfig) { + fs.writeFileSync(projectFile, prettyJSONProjectSpec); } } - projectSpec.files = projectSpec.files.map(function (file) { return path.resolve(projectFileDirectory, file); }); var pkg = null; try { var packagePath = travelUpTheDirectoryTreeTillYouFind(projectFileDirectory, 'package.json'); @@ -249,7 +244,7 @@ function getProjectSync(pathOrSrcFile) { } var project = { compilerOptions: {}, - files: projectSpec.files, + files: projectSpec.files.map(function (x) { return path.resolve(projectFileDirectory, x); }), filesGlob: projectSpec.filesGlob, formatCodeOptions: formatting.makeFormatCodeOptions(projectSpec.formatCodeOptions), compileOnSave: projectSpec.compileOnSave == undefined ? true : projectSpec.compileOnSave, @@ -257,7 +252,8 @@ function getProjectSync(pathOrSrcFile) { typings: [], externalTranspiler: projectSpec.externalTranspiler == undefined ? undefined : projectSpec.externalTranspiler, scripts: projectSpec.scripts || {}, - buildOnSave: !!projectSpec.buildOnSave + buildOnSave: !!projectSpec.buildOnSave, + atom: { rewriteTsconfig: true } }; var validationResult = validator.validate(projectSpec.compilerOptions); if (validationResult.errorMessage) { @@ -290,6 +286,8 @@ function createProjectRootSync(srcFile, defaultOptions) { var projectSpec = {}; projectSpec.compilerOptions = tsToRawCompilerOptions(defaultOptions || exports.defaults); projectSpec.filesGlob = defaultFilesGlob; + projectSpec.compileOnSave = true; + projectSpec.buildOnSave = false; fs.writeFileSync(projectFilePath, prettyJSON(projectSpec)); return getProjectSync(srcFile); } @@ -316,28 +314,32 @@ function increaseProjectForReferenceAndImports(files) { return; } var preProcessedFileInfo = ts.preProcessFile(content, true), dir = path.dirname(file); + var extensions = ['.ts', '.d.ts', '.tsx']; + function getIfExists(filePathNoExt) { + for (var _i = 0, extensions_1 = extensions; _i < extensions_1.length; _i++) { + var ext = extensions_1[_i]; + if (fs.existsSync(filePathNoExt + ext)) { + return filePathNoExt + ext; + } + } + } referenced.push(preProcessedFileInfo.referencedFiles.map(function (fileReference) { var file = path.resolve(dir, fsu.consistentPath(fileReference.fileName)); if (fs.existsSync(file)) { return file; } - if (fs.existsSync(file + '.ts')) { - return file + '.ts'; - } - if (fs.existsSync(file + '.d.ts')) { - return file + '.d.ts'; - } - return null; + return getIfExists(file); }).filter(function (file) { return !!file; }) .concat(preProcessedFileInfo.importedFiles .filter(function (fileReference) { return pathIsRelative(fileReference.fileName); }) .map(function (fileReference) { - var file = path.resolve(dir, fileReference.fileName + '.ts'); - if (!fs.existsSync(file)) { - file = path.resolve(dir, fileReference.fileName + '.d.ts'); + var fileNoExt = path.resolve(dir, fileReference.fileName); + var file = getIfExists(fileNoExt); + if (!file) { + file = getIfExists(file + "/index"); } return file; - }))); + }).filter(function (file) { return !!file; }))); }); return selectMany(referenced); }; @@ -387,8 +389,8 @@ function getDefinitionsForNodeModules(projectDir, files) { try { var node_modules = travelUpTheDirectoryTreeTillYouFind(projectDir, 'node_modules', true); var moduleDirs = getDirs(node_modules); - for (var _i = 0; _i < moduleDirs.length; _i++) { - var moduleDir = moduleDirs[_i]; + for (var _i = 0, moduleDirs_1 = moduleDirs; _i < moduleDirs_1.length; _i++) { + var moduleDir = moduleDirs_1[_i]; try { var package_json = JSON.parse(fs.readFileSync(moduleDir + "/package.json").toString()); packagejson.push(moduleDir + "/package.json"); @@ -422,7 +424,8 @@ function getDefinitionsForNodeModules(projectDir, files) { .filter(function (x) { return existing[x]; }); return { implicit: implicit, ours: ours, packagejson: packagejson }; } -function prettyJSON(object) { +function prettyJSON(object, indent) { + if (indent === void 0) { indent = 4; } var cache = []; var value = JSON.stringify(object, function (key, value) { if (typeof value === 'object' && value !== null) { @@ -432,7 +435,7 @@ function prettyJSON(object) { cache.push(value); } return value; - }, 4); + }, indent); value = value.split('\n').join(os.EOL) + os.EOL; cache = null; return value; @@ -512,8 +515,8 @@ exports.getPotentiallyRelativeFile = getPotentiallyRelativeFile; function getDirs(rootDir) { var files = fs.readdirSync(rootDir); var dirs = []; - for (var _i = 0; _i < files.length; _i++) { - var file = files[_i]; + for (var _i = 0, files_1 = files; _i < files_1.length; _i++) { + var file = files_1[_i]; if (file[0] != '.') { var filePath = rootDir + "/" + file; var stat = fs.statSync(filePath); diff --git a/dist/main/utils/fsUtil.js b/dist/main/utils/fsUtil.js index 28deb7766..1cde4272c 100644 --- a/dist/main/utils/fsUtil.js +++ b/dist/main/utils/fsUtil.js @@ -1,3 +1,4 @@ +"use strict"; function consistentPath(filePath) { return filePath.split('\\').join('/'); } diff --git a/dist/typescript/makeTypeScriptGlobal.js b/dist/typescript/makeTypeScriptGlobal.js index 45d9a5ad1..978443a0f 100644 --- a/dist/typescript/makeTypeScriptGlobal.js +++ b/dist/typescript/makeTypeScriptGlobal.js @@ -1,3 +1,4 @@ +"use strict"; var vm = require('vm'); var fs = require('fs'); global.stack = function () { diff --git a/dist/worker/child.js b/dist/worker/child.js index 080ea9996..df1df3c34 100644 --- a/dist/worker/child.js +++ b/dist/worker/child.js @@ -1,3 +1,4 @@ +"use strict"; var typescriptServices = ''; if (process.argv.length > 2) { typescriptServices = process.argv[2]; diff --git a/dist/worker/debug.js b/dist/worker/debug.js index ad5f2b7ee..a77b0f234 100644 --- a/dist/worker/debug.js +++ b/dist/worker/debug.js @@ -1,2 +1,3 @@ +"use strict"; exports.debugAll = false; exports.debugSync = false || exports.debugAll; diff --git a/dist/worker/lib/workerLib.js b/dist/worker/lib/workerLib.js index 3d1677d9a..837a8ed0d 100644 --- a/dist/worker/lib/workerLib.js +++ b/dist/worker/lib/workerLib.js @@ -1,3 +1,4 @@ +"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -17,7 +18,6 @@ var orphanExitCode = 100; var RequesterResponder = (function () { function RequesterResponder() { var _this = this; - this.getProcess = function () { throw new Error('getProcess is abstract'); return null; }; this.currentListeners = {}; this.currentLastOfType = {}; this.pendingRequests = []; @@ -139,7 +139,7 @@ var RequesterResponder = (function () { .forEach(function (funcName) { return _this.addToResponders(aModule[funcName]); }); }; return RequesterResponder; -})(); +}()); var Parent = (function (_super) { __extends(Parent, _super); function Parent() { @@ -153,9 +153,15 @@ var Parent = (function (_super) { Parent.prototype.startWorker = function (childJsPath, terminalError, customArguments) { var _this = this; try { + var spawnEnv = (process.platform === 'linux') ? Object.create(process.env) : {}; + spawnEnv['ATOM_SHELL_INTERNAL_RUN_AS_NODE'] = '1'; this.child = spawn(this.node, [ childJsPath - ].concat(customArguments), { cwd: path.dirname(childJsPath), env: { ATOM_SHELL_INTERNAL_RUN_AS_NODE: '1' }, stdio: ['ipc'] }); + ].concat(customArguments), { + cwd: path.dirname(childJsPath), + env: spawnEnv, + stdio: ['ipc'] + }); this.child.on('error', function (err) { if (err.code === "ENOENT" && err.path === _this.node) { _this.gotENOENTonSpawnNode = true; @@ -207,7 +213,7 @@ var Parent = (function (_super) { this.child = null; }; return Parent; -})(RequesterResponder); +}(RequesterResponder)); exports.Parent = Parent; var Child = (function (_super) { __extends(Child, _super); @@ -233,5 +239,5 @@ var Child = (function (_super) { }, 1000); }; return Child; -})(RequesterResponder); +}(RequesterResponder)); exports.Child = Child; diff --git a/dist/worker/parent.js b/dist/worker/parent.js index 2c5885ab8..f57feb6cd 100644 --- a/dist/worker/parent.js +++ b/dist/worker/parent.js @@ -1,3 +1,4 @@ +"use strict"; var debug_1 = require("./debug"); var childprocess = require('child_process'); var exec = childprocess.exec; @@ -16,11 +17,15 @@ if (debug_1.debugSync) { parent.sendToIpcOnlyLast = function (x) { return x; }; } function startWorker() { - parent.startWorker(__dirname + '/child.js', showError, atomConfig.typescriptServices ? [atomConfig.typescriptServices] : []); + if (!debug_1.debugSync) { + parent.startWorker(__dirname + '/child.js', showError, atomConfig.typescriptServices ? [atomConfig.typescriptServices] : []); + } } exports.startWorker = startWorker; function stopWorker() { - parent.stopWorker(); + if (!debug_1.debugSync) { + parent.stopWorker(); + } } exports.stopWorker = stopWorker; function showError(error) { diff --git a/dist/worker/queryParent.js b/dist/worker/queryParent.js index 5816d167f..f76da632f 100644 --- a/dist/worker/queryParent.js +++ b/dist/worker/queryParent.js @@ -1,3 +1,4 @@ +"use strict"; var resolve = Promise.resolve.bind(Promise); var tsconfig = require('../main/tsconfig/tsconfig'); var atomUtils; diff --git a/docs/faq.md b/docs/faq.md index 1ba0c31ac..03e0e0dfd 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -3,8 +3,27 @@ ## I keep getting changes to tsconfig.json This is probably because of us keeping `files` updated with the `filesGlob` option. The reason why we do this is because the official `tsconfig.json` spec does not support `filesGlob`. Therefore we keep `files` in sync with the `filesGlob` so that your team mates can use whatever editor they prefer (sublime text, visual studio etc.). +You can now disable this behavior by setting the `rewriteTsconfig` flag to `false` in your project's `tsconfig.json` under the `atom` key. + +[Further Details](https://github.com/TypeStrong/atom-typescript/blob/master/docs/tsconfig.md#atom) + +## For really large projects atom-typescript gets slow +If you have `tsconfig.json` in a folder that contains `node_modules`, atom-typescript might become slow (due to extensive file listing). Two possible fixes: +* Move `tsconfig.json` into a sub folder e.g. `src` +* Add a `filesGlob` that excludes `node_modules` e.g.: + +```ts +"filesGlob" : [ + "**/*.ts", + "**/*.tsx", + "!node_modules/**", +]; +``` + +[Further Details](https://github.com/TypeStrong/atom-typescript/issues/648). + ## I don't want atom-typescript compiling my js -Set `compileOnSave : false` in your tsconfig.json (https://github.com/TypeStrong/atom-typescript/blob/master/docs/tsconfig.md#compileonsave). Then you've got all the intellisense / refactoring goodness of atom-typescript but no generated JavaScript. Why is this useful? Well you might be using something else for your build such as [gulp-typescript](https://github.com/ivogabe/gulp-typescript) or [tsify](https://github.com/smrq/tsify). +Set `compileOnSave : false` in your tsconfig.json (https://github.com/TypeStrong/atom-typescript/blob/master/docs/tsconfig.md#compileonsave). Then you've got all the intellisense / refactoring goodness of atom-typescript but no generated JavaScript. Why is this useful? Well you might be using something else for your build such as [ts-loader](https://github.com/TypeStrong/ts-loader) or [tsify](https://github.com/TypeStrong/tsify) or [gulp-typescript](https://github.com/ivogabe/gulp-typescript). ## Which version of TypeScript does atom-typescript use? It uses [ntypescript](https://github.com/TypeStrong/ntypescript) which is just a build of Microsoft/Master. This means it's the latest and greatest of the TypeScript goodness. There is a possibility that in the future it will move to TypeScript nightlies but our current automation is working well. @@ -35,7 +54,7 @@ You can set that in the package settings https://atom.io/docs/latest/using-atom- You probably deleted them or added them or moved them around. We don't watch the file system as it is memory intensive and unreliable across operating systems. You can ask atom-typescript to do a rescan of your file system using the `sync` command (https://github.com/TypeStrong/atom-typescript#sync) ## Failed to Update -This can happen particularly on windows as it is not possible to delete a file if it is executing. Close all atom instances and run the following commands: +This can happen particularly on windows ([relevant issue](https://github.com/TypeStrong/atom-typescript/issues/195)) as it is not possible to delete a file if it is executing. Close all atom instances and run the following commands: ``` apm uninstall atom-typescript diff --git a/docs/packages.md b/docs/packages.md index 86d038424..4fc10a02a 100644 --- a/docs/packages.md +++ b/docs/packages.md @@ -2,9 +2,6 @@ ## Critical -### autocomplete-plus -We will install this for you to give a good autocomplete experience - ### linter We will install this for you to give a good error highlight experience @@ -55,4 +52,4 @@ https://atom.io/packages/pain-split a better pane splitting mechanism. https://atom.io/packages/docblockr for easier jsdocing ### Styles -[Here's my styles.less](https://gist.github.com/basarat/87d0a17a850b74a1cc07) \ No newline at end of file +[Here's my styles.less](https://gist.github.com/basarat/87d0a17a850b74a1cc07) diff --git a/docs/tsconfig.md b/docs/tsconfig.md index 0e8ecafd2..50e443e33 100644 --- a/docs/tsconfig.md +++ b/docs/tsconfig.md @@ -1,5 +1,5 @@ # `tsconfig.json` -A unified project format for TypeScript ([see merged PR on Microsoft/TypeScript](https://github.com/Microsoft/TypeScript/pull/1692)). The TypeScript compiler (`1.5` and above) only cares about `compilerOptions` and `files`. We add additional features to this [with the typescript team's approval to extend the file as long as we don't conflict](https://github.com/Microsoft/TypeScript/issues/1955). +A unified project format for TypeScript ([see merged PR on Microsoft/TypeScript](https://github.com/Microsoft/TypeScript/pull/1692)). The TypeScript compiler (`1.5` and above) only cares about `compilerOptions` and `files`. TypeScript `1.6` introduced the `exclude` property. We add additional features to this [with the typescript team's approval to extend the file as long as we don't conflict](https://github.com/Microsoft/TypeScript/issues/1955). `tsconfig.json` is great for building the ["compilation context" so you **don't need to use** `/// ]|var|type|function|class|interface)" + patterns: [ + { + include: "#type" + } + ] + "enum-declaration": + name: "meta.enum.declaration.ts" + match: "(?:\\b(const)\\s+)?\\b(enum)\\s+([a-zA-Z_$][\\w$]*)" + captures: + "1": + name: "storage.modifier.ts" + "2": + name: "storage.type.ts" + "3": + name: "entity.name.class.ts" + "object-declaration": + name: "meta.declaration.object.ts" + begin: "\\b(?:(export)\\s+)?\\b(?:(abstract)\\s+)?\\b(?])|(?<=[\\}>\\]\\)]|[a-zA-Z_$])\\s*(?=\\{)" + patterns: [ + { + include: "#type" + } + { + include: "#string" + } + { + include: "#comment" + } + ] + type: + name: "meta.type.ts" + patterns: [ + { + include: "#type-primitive" + } + { + include: "#type-parameters" + } + { + include: "#type-tuple" + } + { + include: "#type-object" + } + { + include: "#type-operator" + } + { + include: "#type-paren-or-function-type-parameters" + } + { + include: "#type-function-return-type" + } + { + include: "#type-name" + } + ] + "function-type-parameters": + name: "meta.function.type.parameter.ts" + begin: "\\(" + beginCaptures: + "0": + name: "meta.brace.round.ts" + end: "\\)" + endCaptures: + "0": + name: "meta.brace.round.ts" + patterns: [ + { + include: "#comment" + } + { + include: "#parameter-name" + } + { + include: "#type-annotation" + } + { + include: "#variable-initializer" + } + ] + "type-primitive": + name: "meta.type.primitive.ts" + match: "\\b(string|number|boolean|symbol|any|void)\\b" + captures: + "1": + name: "storage.type.ts" + "type-paren-or-function-type-parameters": + name: "meta.type.paren.cover.ts" + begin: "(?:\\b(new)\\b)?\\s*\\(" + beginCaptures: + "1": + name: "keyword.control.ts" + end: "\\)" + patterns: [ + { + include: "#comment" + } + { + include: "#type" + } + { + include: "#function-type-parameters" + } + ] + "await-modifier": + name: "storage.modifier.ts" + match: "await" + "type-operator": + name: "keyword.operator.type.ts" + match: "[.|]" + "type-function-return-type": + name: "meta.type.function.return.ts" + begin: "=>" + beginCaptures: + "0": + name: "keyword.operator.ts" + end: "(?=\\s*[,\\)\\{=;>]|//|$)" + patterns: [ + { + include: "#type" + } + ] + "type-tuple": + name: "meta.type.tuple.ts" + begin: "\\[" + beginCaptures: + "0": + name: "meta.brace.square.ts" + end: "\\]" + endCaptures: + "0": + name: "meta.brace.square.ts" + patterns: [ + { + include: "#type" + } + { + include: "#comment" + } + ] + "type-name": + name: "meta.type.name.ts" + match: "[a-zA-Z_$][.\\w$]*" + captures: + "1": + name: "entity.name.type.ts" + "type-parameters": + name: "meta.type.parameters.ts" + begin: "([a-zA-Z_$][\\w$]*)?(<)" + beginCaptures: + "1": + name: "entity.name.type.ts" + "2": + name: "meta.brace.angle.ts" + end: "(?=$)|(>)" + endCaptures: + "2": + name: "meta.brace.angle.ts" + patterns: [ + { + name: "keyword.other.ts" + match: "\\b(extends)\\b" + } + { + include: "#comment" + } + { + include: "#type" + } + ] + "variable-initializer": + begin: "(=)" + beginCaptures: + "1": + name: "keyword.operator.ts" + end: "(?=$|[,);=])" + patterns: [ + { + include: "#expression" + } + ] + expression: + name: "meta.expression.ts" + patterns: [ + { + comment: "Match ES6 \"import from\" syntax" + match: "(import).*(from)\\s+((['\"`]).*\\4)" + captures: + "1": + name: "keyword.other.ts" + "2": + name: "keyword.other.ts" + "3": + name: "es6import.path.string" + } + { + comment: "Match import = require" + match: "(import)\\s*([\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*)\\s*=\\s*(require)\\s*\\((.*)\\)" + captures: + "1": + name: "keyword.other.ts" + "2": + name: "variable.type.ts" + "3": + name: "keyword.other.ts" + "4": + name: "require.path.string" + } + { + comment: "Match )" + captures: + "1": + name: "keyword.other.ts" + "2": + name: "amd.path.string" + "3": + name: "keyword.other.ts" + } + { + comment: "Match )" + captures: + "1": + name: "keyword.other.ts" + "2": + name: "amd.path.string" + "3": + name: "keyword.other.ts" + } + { + comment: "Match full triple slash reference comments" + match: "(\\/\\/\\/\\s*)" + captures: + "1": + name: "keyword.other.ts" + "2": + name: "reference.path.string" + "3": + name: "keyword.other.ts" + } + { + comment: "Match debugger statement" + match: "\\b(debugger)\\b" + captures: + "1": + name: "keyword.debugger.ts" + } + { + include: "#for-in-simple" + } + { + include: "#string" + } + { + include: "#regex" + } + { + include: "#template" + } + { + include: "#comment" + } + { + include: "#literal" + } + { + include: "#paren-expression" + } + { + include: "#var-expr" + } + { + include: "#declaration" + } + { + include: "#cast" + } + { + include: "#new-expr" + } + { + include: "#block" + } + { + include: "#expression-operator" + } + { + include: "#relational-operator" + } + { + include: "#arithmetic-operator" + } + { + include: "#logic-operator" + } + { + include: "#assignment-operator" + } + { + include: "#storage-keyword" + } + { + include: "#function-call" + } + { + include: "#switch-case" + } + { + include: "#control-statement" + } + ] + "for-in-simple": + name: "forin.expr.ts" + match: "(?<=\\()\\s*\\b(var|let|const)\\s+([a-zA-Z_$][\\w$]*)\\s+(in|of)\\b" + captures: + "1": + name: "storage.type.ts" + "3": + name: "keyword.operator.ts" + "function-call": + name: "functioncall.expr.ts" + patterns: [ + { + include: "#await-modifier" + } + { + include: "#type-parameters" + } + { + include: "#paren-expression" + } + ] + cast: + name: "cast.expr.ts" + begin: "(?:(?<=return|throw|yield|await|[=(,:>]))\\s*(<)(?!" + endCaptures: + "0": + name: "meta.brace.angle.ts" + patterns: [ + { + include: "#type" + } + ] + "new-expr": + name: "new.expr.ts" + begin: "\\b(new)\\b" + beginCaptures: + "1": + name: "keyword.operator.ts" + end: "(?=[(;]|$)" + patterns: [ + { + include: "#type" + } + { + include: "#comment" + } + ] + "object-member": + name: "meta.object.member.ts" + begin: "[a-zA-Z_$][\\w$]*\\s*:" + end: "(?=,|\\})" + patterns: [ + { + include: "#expression" + } + ] + "expression-operator": + name: "keyword.operator.ts" + match: "=>|\\b(delete|export|import|in|instanceof|module|namespace|new|typeof|void)\\b" + "arithmetic-operator": + name: "keyword.operator.arithmetic.ts" + match: "\\*|/|\\-\\-|\\-|\\+\\+|\\+|%" + "relational-operator": + name: "keyword.operator.comparison.ts" + match: "===|==|=|!=|!==|<=|>=|<>|<|>" + "assignment-operator": + name: "keyword.operator.assignment.ts" + match: "<<=|>>=|>>>=|\\*=|(?]|var|type|function|class|interface)" + patterns: [ + { + include: "#type" + } + ] + "enum-declaration": + name: "meta.enum.declaration.tsx" + match: "(?:\\b(const)\\s+)?\\b(enum)\\s+([a-zA-Z_$][\\w$]*)" + captures: + "1": + name: "storage.modifier.tsx" + "2": + name: "storage.type.tsx" + "3": + name: "entity.name.class.tsx" + "object-declaration": + name: "meta.declaration.object.tsx" + begin: "\\b(?:(export)\\s+)?\\b(?:(abstract)\\s+)?\\b(?])|(?<=[\\}>\\]\\)]|[a-zA-Z_$])\\s*(?=\\{)" + patterns: [ + { + include: "#type" + } + { + include: "#string" + } + { + include: "#comment" + } + ] + type: + name: "meta.type.tsx" + patterns: [ + { + include: "#type-primitive" + } + { + include: "#type-parameters" + } + { + include: "#type-tuple" + } + { + include: "#type-object" + } + { + include: "#type-operator" + } + { + include: "#type-paren-or-function-type-parameters" + } + { + include: "#type-function-return-type" + } + { + include: "#type-name" + } + ] + "function-type-parameters": + name: "meta.function.type.parameter.tsx" + begin: "\\(" + beginCaptures: + "0": + name: "meta.brace.round.tsx" + end: "\\)" + endCaptures: + "0": + name: "meta.brace.round.tsx" + patterns: [ + { + include: "#comment" + } + { + include: "#parameter-name" + } + { + include: "#type-annotation" + } + { + include: "#variable-initializer" + } + ] + "type-primitive": + name: "meta.type.primitive.tsx" + match: "\\b(string|number|boolean|symbol|any|void)\\b" + captures: + "1": + name: "storage.type.tsx" + "type-paren-or-function-type-parameters": + name: "meta.type.paren.cover.tsx" + begin: "(?:\\b(new)\\b)?\\s*\\(" + beginCaptures: + "1": + name: "keyword.control.tsx" + end: "\\)" + patterns: [ + { + include: "#comment" + } + { + include: "#type" + } + { + include: "#function-type-parameters" + } + ] + "type-operator": + name: "keyword.operator.type.tsx" + match: "[.|]" + "type-function-return-type": + name: "meta.type.function.return.tsx" + begin: "=>" + beginCaptures: + "0": + name: "keyword.operator.tsx" + end: "(?=\\s*[,\\)\\{=;>]|//|$)" + patterns: [ + { + include: "#type" + } + ] + "type-tuple": + name: "meta.type.tuple.tsx" + begin: "\\[" + beginCaptures: + "0": + name: "meta.brace.square.tsx" + end: "\\]" + endCaptures: + "0": + name: "meta.brace.square.tsx" + patterns: [ + { + include: "#type" + } + { + include: "#comment" + } + ] + "type-name": + name: "meta.type.name.tsx" + match: "[a-zA-Z_$][.\\w$]*" + captures: + "1": + name: "entity.name.type.tsx" + "type-parameters": + name: "meta.type.parameters.tsx" + begin: "([a-zA-Z_$][\\w$]*)?(<)" + beginCaptures: + "1": + name: "entity.name.type.tsx" + "2": + name: "meta.brace.angle.tsx" + end: "(?=$)|(>)" + endCaptures: + "2": + name: "meta.brace.angle.tsx" + patterns: [ + { + name: "keyword.other.tsx" + match: "\\b(extends)\\b" + } + { + include: "#comment" + } + { + include: "#type" + } + ] + "variable-initializer": + begin: "(=)" + beginCaptures: + "1": + name: "keyword.operator.tsx" + end: "(?=$|[,);=])" + patterns: [ + { + include: "#expression" + } + ] + expression: + name: "meta.expression.tsx" + patterns: [ + { + comment: "Match ES6 \"import from\" syntax" + match: "(import).*(from)\\s+((['\"`]).*\\4)" + captures: + "1": + name: "keyword.other.ts" + "2": + name: "keyword.other.ts" + "3": + name: "es6import.path.string" + } + { + comment: "Match import = require" + match: "(import)\\s*([\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*)\\s*=\\s*(require)\\s*\\((.*)\\)" + captures: + "1": + name: "keyword.other.ts" + "2": + name: "variable.type.ts" + "3": + name: "keyword.other.ts" + "4": + name: "require.path.string" + } + { + comment: "Match )" + captures: + "1": + name: "keyword.other.ts" + "2": + name: "amd.path.string" + "3": + name: "keyword.other.ts" + } + { + comment: "Match )" + captures: + "1": + name: "keyword.other.ts" + "2": + name: "amd.path.string" + "3": + name: "keyword.other.ts" + } + { + comment: "Match full triple slash reference comments" + match: "(\\/\\/\\/\\s*)" + captures: + "1": + name: "keyword.other.ts" + "2": + name: "reference.path.string" + "3": + name: "keyword.other.ts" + } + { + comment: "Match debugger statement" + match: "\\b(debugger)\\b" + captures: + "1": + name: "keyword.debugger.ts" + } + { + include: "#jsx" + } + { + include: "#for-in-simple" + } + { + include: "#string" + } + { + include: "#regex" + } + { + include: "#template" + } + { + include: "#comment" + } + { + include: "#literal" + } + { + include: "#paren-expression" + } { - 'include': '#pcdata-quotes' + include: "#var-expr" + } + { + include: "#declaration" + } + { + include: "#new-expr" + } + { + include: "#block" + } + { + include: "#expression-operator" + } + { + include: "#relational-operator" + } + { + include: "#arithmetic-operator" + } + { + include: "#logic-operator" + } + { + include: "#assignment-operator" + } + { + include: "#storage-keyword" + } + { + include: "#function-call" + } + { + include: "#switch-case" + } + { + include: "#control-statement" } ] - 'pcdata-quotes': - 'name': 'meta.other.pcdata.js' - 'match': '\\b\\w+[\'"]\\w+\\b' - 'jsx-tag-attributes': - 'patterns': [ + "for-in-simple": + name: "forin.expr.tsx" + match: "(?<=\\()\\s*\\b(var|let|const)\\s+([a-zA-Z_$][\\w$]*)\\s+(in|of)\\b" + captures: + "1": + name: "storage.type.tsx" + "3": + name: "keyword.operator.tsx" + "function-call": + name: "functioncall.expr.tsx" + patterns: [ { - 'include': '#jsx-tag-attribute-name' + include: "#type-parameters" } { - 'include': '#jsx-string-double-quoted' + include: "#paren-expression" } + ] + "new-expr": + name: "new.expr.tsx" + begin: "\\b(new)\\b" + beginCaptures: + "1": + name: "keyword.operator.tsx" + end: "(?=[(;]|$)" + patterns: [ { - 'include': '#jsx-string-single-quoted' - } - { - 'include': '#jsx-evaluated-code' - } - ] - 'jsx-tag-attribute-name': - 'name': 'meta.tag.attribute-name.js' - 'match': '\\b([a-zA-Z0-9\\-:]+)' - 'captures': - '1': - 'name': 'entity.other.attribute-name.js' - 'jsx-string-double-quoted': - 'begin': '"' - 'end': '"' - 'name': 'string.quoted.double.js' - 'endCaptures': - '0': - 'name': 'punctuation.definition.string.end.js' - 'beginCaptures': - '0': - 'name': 'punctuation.definition.string.begin.js' - 'patterns': [ + include: "#type" + } + ] + "object-member": + name: "meta.object.member.tsx" + begin: "[a-zA-Z_$][\\w$]*\\s*:" + end: "(?=,|\\})" + patterns: [ { - 'include': '#jsx-entities' + include: "#expression" } ] - 'jsx-string-single-quoted': - 'begin': '\'' - 'end': '\'' - 'name': 'string.quoted.single.js' - 'endCaptures': - '0': - 'name': 'punctuation.definition.string.end.js' - 'beginCaptures': - '0': - 'name': 'punctuation.definition.string.begin.js' - 'patterns': [ + "expression-operator": + name: "keyword.operator.tsx" + match: "=>|\\b(delete|export|import|in|instanceof|module|namespace|new|typeof|void|as)\\b" + "arithmetic-operator": + name: "keyword.operator.arithmetic.tsx" + match: "\\*|/|\\-\\-|\\-|\\+\\+|\\+|%" + "relational-operator": + name: "keyword.operator.comparison.tsx" + match: "===|==|=|!=|!==|<=|>=|<>|<|>" + "assignment-operator": + name: "keyword.operator.assignment.tsx" + match: "<<=|>>=|>>>=|\\*=|(?)' - 'name': 'tag.open.js' - 'endCaptures': - '1': - 'name': 'punctuation.definition.tag.end.js' - 'beginCaptures': - '1': - 'name': 'punctuation.definition.tag.begin.js' - '2': - 'name': 'entity.name.tag.js' - 'patterns': [ + string: + name: "string.tsx" + patterns: [ + { + include: "#qstring-single" + } { - 'include': '#jsx-tag-attributes' + include: "#qstring-double" } ] - 'jsx-tag-close': - 'match': '(]+)(>)' - 'name': 'tag.closed.js' - 'captures': - '1': - 'name': 'punctuation.definition.tag.begin.js' - '2': - 'name': 'entity.name.tag.js' - '3': - 'name': 'punctuation.definition.tag.end.js' - 'jsx-tag-invalid': - 'name': 'invalid.illegal.tag.incomplete.js' - 'match': '<\\s*>' - 'jsx': - 'name': 'meta.jsx.js' - 'patterns': [ - { - 'include': '#jsx-tag-open' - } - { - 'include': '#jsx-tag-close' - } - { - 'include': '#jsx-tag-invalid' + template: + name: "meta.template.tsx" + begin: "`" + beginCaptures: + "0": + name: "string.template.tsx" + end: "`" + endCaptures: + "0": + name: "string.template.tsx" + patterns: [ + { + include: "#template-substitution-element" + } + { + include: "#template-string-contents" + } + ] + "template-string-contents": + name: "string.template.tsx" + begin: ".*?" + end: "(?=(\\$\\{|`))" + patterns: [ + { + include: "#string-character-escape" } ] + "string-character-escape": + name: "constant.character.escape" + match: "\\\\(x\\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.|$)" + "template-substitution-element": + name: "template.element.tsx" + begin: "\\$\\{" + beginCaptures: + "0": + name: "keyword.operator.tsx" + end: "\\}" + endCaptures: + "0": + name: "keyword.operator.tsx" + patterns: [ + { + include: "#expression" + } + ] + comment: + name: "comment.tsx" + patterns: [ + { + include: "#comment-block-doc" + } + { + include: "#comment-block" + } + { + include: "#comment-line" + } + ] + "comment-block-doc": + name: "comment.block.documentation.tsx" + begin: "/\\*\\*(?!/)" + end: "\\*/" + "comment-block": + name: "comment.block.tsx" + begin: "/\\*" + end: "\\*/" + "comment-line": + name: "comment.line.tsx" + match: "(//).*$\\n?" + literal: + name: "literal.tsx" + patterns: [ + { + include: "#numeric-literal" + } + { + include: "#boolean-literal" + } + { + include: "#null-literal" + } + { + include: "#undefined-literal" + } + { + include: "#array-literal" + } + { + include: "#this-literal" + } + ] + "array-literal": + name: "meta.array.literal.tsx" + begin: "\\[" + beginCaptures: + "0": + name: "meta.brace.square.tsx" + end: "\\]" + endCaptures: + "0": + name: "meta.brace.square.tsx" + patterns: [ + { + include: "#expression" + } + ] + "numeric-literal": + name: "constant.numeric.tsx" + match: "\\b(?<=[^$])((0(x|X)[0-9a-fA-F]+)|([0-9]+(\\.[0-9]+)?))\\b" + "boolean-literal": + name: "constant.language.boolean.tsx" + match: "\\b(false|true)\\b" + "null-literal": + name: "constant.language.null.tsx" + match: "\\b(null)\\b" + "this-literal": + name: "constant.language.this.tsx" + match: "\\b(this)\\b" + "undefined-literal": + name: "constant.language.tsx" + match: "\\b(undefined)\\b" + "access-modifier": + name: "storage.modifier.tsx" + match: "\\b(public|protected|private)\\b" + "static-modifier": + name: "keyword.other.tsx" + match: "\\b(static)\\b" + "property-accessor": + name: "storage.type.property.tsx" + match: "\\b(get|set)\\b" + "jsx-tag-attributes": + patterns: [ + { + include: "#jsx-tag-attribute-name" + } + { + include: "#jsx-tag-attribute-assignment" + } + { + include: "#jsx-string-double-quoted" + } + { + include: "#jsx-string-single-quoted" + } + { + include: "#jsx-evaluated-code" + } + ] + "jsx-tag-attribute-name": + name: "meta.tag.attribute-name.tsx" + match: ''' + (?x) + \\s* + ([_$a-zA-Z][-$\\w]*) + (?=\\s|=|/?>|/\\*|//) + ''' + captures: + "1": + name: "entity.other.attribute-name.tsx" + "jsx-tag-attribute-assignment": + name: "keyword.operator.assignment.tsx" + match: "=(?=\\s*(?:'|\"|{|/\\*|//|\\n))" + "jsx-string-double-quoted": + name: "string.quoted.double.tsx" + begin: "\"" + end: "\"" + beginCaptures: + "0": + name: "punctuation.definition.string.begin.tsx" + endCaptures: + "0": + name: "punctuation.definition.string.end.tsx" + patterns: [ + { + include: "#jsx-entities" + } + ] + "jsx-string-single-quoted": + name: "string.quoted.single.tsx" + begin: "'" + end: "'" + beginCaptures: + "0": + name: "punctuation.definition.string.begin.tsx" + endCaptures: + "0": + name: "punctuation.definition.string.end.tsx" + patterns: [ + { + include: "#jsx-entities" + } + ] + "jsx-entities": + patterns: [ + { + name: "constant.character.entity.tsx" + match: "(&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)" + captures: + "1": + name: "punctuation.definition.entity.tsx" + "3": + name: "punctuation.definition.entity.tsx" + } + { + name: "invalid.illegal.bad-ampersand.tsx" + match: "&" + } + ] + "jsx-evaluated-code": + name: "meta.brace.curly.tsx" + begin: "{" + end: "}" + beginCaptures: + "0": + name: "punctuation.definition.brace.curly.start.tsx" + endCaptures: + "0": + name: "punctuation.definition.brace.curly.end.tsx" + patterns: [ + { + include: "#expression" + } + ] + "jsx-tag-attributes-illegal": + name: "invalid.illegal.attribute.tsx" + match: "\\S+" + "jsx-tag-without-attributes": + name: "tag.without-attributes.tsx" + begin: "(<)([_$a-zA-Z][-$\\w.]*(?)" + end: "()" + beginCaptures: + "1": + name: "punctuation.definition.tag.begin.tsx" + "2": + name: "entity.name.tag.tsx" + "3": + name: "punctuation.definition.tag.end.tsx" + endCaptures: + "1": + name: "punctuation.definition.tag.begin.tsx" + "2": + name: "entity.name.tag.tsx" + "3": + name: "punctuation.definition.tag.end.tsx" + patterns: [ + { + include: "#jsx-children" + } + ] + "jsx-tag-open": + name: "tag.open.tsx" + begin: ''' + (?x) + (<) + ([_$a-zA-Z][-$\\w.]*(?) + ''' + end: "(/?>)" + beginCaptures: + "1": + name: "punctuation.definition.tag.begin.tsx" + "2": + name: "entity.name.tag.tsx" + endCaptures: + "1": + name: "punctuation.definition.tag.end.tsx" + patterns: [ + { + include: "#comment" + } + { + include: "#jsx-tag-attributes" + } + { + include: "#jsx-tag-attributes-illegal" + } + ] + "jsx-tag-close": + name: "tag.close.tsx" + begin: "()" + beginCaptures: + "1": + name: "punctuation.definition.tag.begin.tsx" + "2": + name: "entity.name.tag.tsx" + endCaptures: + "1": + name: "punctuation.definition.tag.end.tsx" + patterns: [ + { + include: "#comment" + } + ] + "jsx-tag-invalid": + name: "invalid.illegal.tag.incomplete.tsx" + match: "<\\s*>" + "jsx-children": + patterns: [ + { + include: "#jsx-tag-without-attributes" + } + { + include: "#jsx-tag-open" + } + { + include: "#jsx-tag-close" + } + { + include: "#jsx-tag-invalid" + } + { + include: "#jsx-evaluated-code" + } + { + include: "#jsx-entities" + } + ] + jsx: + name: "meta.jsx.tsx" + patterns: [ + { + include: "#jsx-tag-without-attributes" + } + { + include: "#jsx-tag-open" + } + { + include: "#jsx-tag-close" + } + { + include: "#jsx-tag-invalid" + } + { + name: "meta.jsx.children.tsx" + begin: "(?<=(?:'|\"|})>)" + end: "(?=)?)?(?:\\s+(extends|implements)\\s)?' - 'beginCaptures': - '1': - 'patterns': [ - { - 'match': '[\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*' - 'name': 'meta.class.ts' - } - { - 'match': ',' - 'name': 'meta.delimiter.object.comma.js' - } - ] - '2': - 'name': 'storage.modifier.ts' - 'end': '(?(?=\\()' - 'patterns': [ - { - 'include': '#typeextend' - } - { - 'include': '#type' - } - { - 'include': '#comma' - } - { - 'include': '#comments' - } - ] - } - { - 'match': '((?:(?:private|public|protected|static)\\s+){0,2})(?:(get|set)\\s+)?([\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*)(?=\\()' - 'captures': - '1': - 'name': 'storage.modifier.js' - '2': - 'name': 'storage.modifier.ts' - '3': - 'name': 'entity.name.function.js' - } - { - 'include': '#functionargumentstype' - } - { - 'comment': 'Match function return type' - 'begin': '(?<=\\))\\s*:\\s*' - 'end': '(?!\\G)' - 'patterns': [ - { - 'include': '#type' - } - { - 'include': '#comments' - } - ] - } - { - 'begin': '((?:(?:private|public|protected|static)\\s+){0,2})([\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*)(\\??)\\s*:\\s*' - 'beginCaptures': - '1': - 'name': 'storage.modifier.js' - '2': - 'name': 'entity.name.variable.ts' - '3': - 'name': 'keyword.operator.js' - 'end': '(?!\\G)' - 'patterns': [ - { - 'include': '#type' - } - { - 'include': '#comments' - } - ] - } - { - 'match': '((?:(?:private|public|protected|static)\\s+){0,2})([\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*)(\\??)' - 'captures': - '1': - 'name': 'storage.modifier.js' - '2': - 'name': 'entity.name.variable.ts' - '3': - 'name': 'keyword.operator.js' - } - { - 'begin': '\\s*(=)\\s*' - 'beginCaptures': - '1': - 'name': 'keyword.operator.js' - 'end': '(;)|$' - 'endCaptures': - '1': - 'name': 'meta.delimiter.semicolon.js' - 'patterns': [ - 'include': '$self' - ] - } - { - 'include': '#curlybracerecursion' - } - { - 'include': '$self' - } - { - 'match': ';' - 'name': 'meta.delimiter.semicolon.js' - } - { - 'include': '#comments' - } - ] - } - { - 'begin': '([\\p{L}\\p{Nl}$_.][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}.]*)\\.(prototype)\\.([\\p{L}\\p{Nl}$_.][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}.]*)\\s*(=)\\s*(?=(?:(?:async\\s+)?function)|(?:(?:<(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))+>)?\\((?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))*\\)(?:\\:\\s*(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))+)?\\s*=>))' - 'beginCaptures': - '1': - 'name': 'support.class.js' - '2': - 'name': 'support.constant.js' - '3': - 'name': 'entity.name.function.js' - '4': - 'name': 'keyword.operator.js' - 'comment': 'match stuff like: Sound.prototype.play = function() { … }' - 'end': '(?!\\G)' - 'name': 'meta.function.prototype.js' - 'patterns': [ - { - 'include': '#functionnolookahead' - } - { - 'include': '#comments' - } - ] - } - { - 'begin': '([\\p{L}\\p{Nl}$_.][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}.]*)\\.([\\p{L}\\p{Nl}$_.][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}.]*)\\s*(=)\\s*(?=(?:(?:async\\s+)?function)|(?:(?:<(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))+>)?\\((?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))*\\)(?:\\:\\s*(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))+)?\\s*=>))' - 'beginCaptures': - '0': - 'name': 'meta.function.js' - '1': - 'name': 'support.class.js' - '2': - 'name': 'entity.name.function.js' - '3': - 'name': 'keyword.operator.js' - 'comment': 'match stuff like: Sound.play = function() { … }' - 'end': '(?!\\G)' - 'patterns': [ - { - 'include': '#functionnolookahead' - } - { - 'include': '#comments' - } - ] - } - { - 'begin': '([\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*)\\s*(=)\\s*(?=(?:(?:async\\s+)?function)|(?:(?:<(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))+>)?\\((?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))*\\)(?:\\:\\s*(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))+)?\\s*=>))' - 'beginCaptures': - '0': - 'name': 'meta.function.js' - '1': - 'name': 'entity.name.function.js' - '2': - 'name': 'keyword.operator.js' - 'comment': 'match stuff like: play = function() { … }' - 'end': '(?!\\G)' - 'patterns': [ - { - 'include': '#functionnolookahead' - } - { - 'include': '#comments' - } - ] - } - { - 'begin': '\\b([\\p{L}\\p{Nl}$_.][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}.]*)\\s*(:)\\s*(?=(?:(?:async\\s+)?function)|(?:(?:<(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))+>)?\\((?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))*\\)(?:\\:\\s*(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))+)?\\s*=>))' - 'beginCaptures': - '1': - 'name': 'entity.name.function.js' - '2': - 'name': 'keyword.operator.js' - 'comment': 'match stuff like: foobar: function() { … }' - 'end': '(?!\\G)' - 'name': 'meta.function.json.js' - 'patterns': [ - { - 'include': '#functionnolookahead' - } - { - 'include': '#comments' - } - ] - } - { - 'begin': '(?:((\')(.*?)(\'))|((")(.*?)(")))\\s*(:)\\s*(?=(?:(?:async\\s+)?function)|(?:(?:<(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))+>)?\\((?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))*\\)(?:\\:\\s*(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))+)?\\s*=>))' - 'beginCaptures': - '1': - 'name': 'string.quoted.single.js' - '2': - 'name': 'punctuation.definition.string.begin.js' - '3': - 'name': 'entity.name.function.js' - '4': - 'name': 'punctuation.definition.string.end.js' - '5': - 'name': 'string.quoted.double.js' - '6': - 'name': 'punctuation.definition.string.begin.js' - '7': - 'name': 'entity.name.function.js' - '8': - 'name': 'punctuation.definition.string.end.js' - '9': - 'name': 'keyword.operator.js' - 'comment': 'Attempt to match "foo": function' - 'end': '(?!\\G)' - 'name': 'meta.function.json.js' - 'patterns': [ - { - 'include': '#functionnolookahead' - } - { - 'include': '#comments' - } - ] - } - { - 'include': '#decorator' - } - { - 'include': '#function' - } - { - 'match': '(new)\\s+([\\p{L}\\p{Nl}$_.][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}.]*(?:\\.[\\p{L}\\p{Nl}$_.][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}.]*)*)' - 'captures': - '1': - 'name': 'keyword.operator.new.js' - '2': - 'patterns': [ - { - 'name': 'entity.name.type.instance.js' - 'match': '[\\p{L}\\p{Nl}$_.][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}.]*' - } - ] - 'name': 'meta.class.instance.constructor' - } - { - 'begin': '(?:(?<=[\\)\\]])|\\b([\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*))(\\()' - 'beginCaptures': - '1': - 'patterns': [ - { - 'match': '\\b(shift|showModelessDialog|showModalDialog|showHelp|scroll|scrollX|scrollByPages|scrollByLines|scrollY|scrollTo|stop|strike|sin|sizeToContent|sidebar|signText|sort|sup|sub|substr|substring|splice|split|send|set(Milliseconds|Seconds|Minutes|Hours|Month|Year|FullYear|Date|UTC(Milliseconds|Seconds|Minutes|Hours|Month|FullYear|Date)|Time|Hotkeys|Cursor|Timeout|Interval|ZOptions|Active|Resizable|RequestHeader)|search|sqrt|slice|savePreferences|small|home|handleEvent|navigate|char|charCodeAt|charAt|cos|concat|contextual|confirm|compile|ceil|clear|clearTimeout|clearInterval|captureEvents|call|createStyleSheet|createPopup|createEventObject|to(GMTString|UTCString|String|Source|UpperCase|LowerCase|LocaleString)|test|tan|taint|taintEnabled|isNaN|isFinite|indexOf|italics|disableExternalCapture|dump|detachEvent|unshift|untaint|unescape|unwatch|updateCommands|join|javaEnabled|pop|pow|push|plugins.refresh|paddings|parse|parseInt|parseFloat|print|prompt|preference|escape|enableExternalCapture|eval|elementFromPoint|exp|exec|execScript|execCommand|valueOf|UTC|queryCommandState|queryCommandIndeterm|queryCommandEnabled|queryCommandValue|find|file|fileModifiedDate|fileSize|fileCreatedDate|fileUpdatedDate|fixed|fontsize|fontcolor|forward|floor|fromCharCode|watch|link|load|log|lastIndexOf|asin|anchor|acos|attachEvent|atob|atan|atan2|apply|alert|abs|abort|round|routeEvents|resize|resizeBy|resizeTo|recalc|returnValue|replace|reverse|reload|releaseCapture|releaseEvents|random|go|get(Milliseconds|Seconds|Minutes|Hours|Month|Day|Year|FullYear|Time|Date|TimezoneOffset|UTC(Milliseconds|Seconds|Minutes|Hours|Day|Month|FullYear|Date)|Attention|Selection|ResponseHeader|AllResponseHeaders)|min|moveBy|moveBelow|moveTo|moveToAbsolute|moveAbove|mergeAttributes|match|margins|max|btoa|big|bold|borderWidths|blink|back)\\b' - 'name': 'support.function.js' - } - { - 'match': '\\b(substringData|submit|splitText|setNamedItem|setAttribute|setAttributeNode|select|hasChildNodes|hasFeature|namedItem|click|close|cloneNode|createComment|createCDATASection|createCaption|createTHead|createTextNode|createTFoot|createDocumentFragment|createProcessingInstruction|createEntityReference|createElement|createAttribute|tabIndex|insertRow|insertBefore|insertCell|insertData|item|open|deleteRow|deleteCell|deleteCaption|deleteTHead|deleteTFoot|deleteData|focus|write|writeln|add|appendChild|appendData|reset|replaceChild|replaceData|move|moveNamedItem|moveChild|moveAttribute|moveAttributeNode|getNamedItem|getElementsByName|getElementsByTagName|getElementById|getAttribute|getAttributeNode|blur)\\b' - 'name': 'support.function.dom.js' - } - { - 'match': '\\bsuper\\b' - 'name': 'keyword.other.ts' - } - ] - '2': - 'name': 'punctuation.definition.parameters.begin.js' - 'end': '\\)' - 'endCaptures': - '0': - 'name': 'punctuation.definition.parameters.end.js' - 'patterns': [ - { - 'begin': '(?=)' - 'end': '(,)\\s*|(?=\\))' - 'endCaptures': - '1': - 'include': '#comma' - 'patterns': [ - { - 'include': '$self' - } - ] - } - { - 'include': '#comments' - } - ] - } - { - 'comment': 'Prevent built-in types from being highlighted if accessed as property' - 'match': '(\\.)(?:Anchor|Applet|Area|Array|Boolean|Button|Checkbox|Date|document|event|FileUpload|Form|Frame|Function|Hidden|History|Image|JavaArray|JavaClass|JavaObject|JavaPackage|java|Layer|Link|Location|Math|MimeType|Number|navigator|netscape|Object|Option|Packages|Password|Plugin|Radio|RegExp|Reset|Select|String|Style|Submit|screen|sun|Text|Textarea|window|XMLHttpRequest)' - 'captures': - '1': - 'name': 'meta.delimiter.method.period.js' - } - { - 'comment': 'Match export, declare and constructor' - 'match': '\\b(?:export|declare|constructor)\\b' - 'name': 'keyword.other.ts' - } - { - 'comment': 'Match stuff like: as' - 'match': '\\b(?:as|AS)\\b' - 'name': 'keyword.operator.ts' - } - { - 'comment': 'Match type SomeType = OtherType' - 'begin': '(type)\\s+([\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*)' - 'beginCaptures': - '1': - 'name': 'storage.modifier.ts' - '2': - 'name': 'meta.class.ts' - 'end': '(?)(?!\\G)' - 'patterns': [ - { - 'begin': '\\G<' - 'end': '>' - 'patterns': [ - { - 'include': '#typeextend' - } - { - 'include': '#type' - } - { - 'include': '#comma' - } - { - 'include': '#comments' - } - ] - } - { - 'begin': '\\s*(=)\\s*' - 'beginCaptures': - '1': - 'name': 'keyword.operator.js' - 'end': '(?!\\G)' - 'patterns': [ - { - 'include': '#type' - } - { - 'include': '#comments' - } - ] - } - { - 'include': '#comments' - } - ] - } - { - 'comment': 'Match types in template instantiation' - 'begin': '(?<=[\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}])<(?=(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))+>\\()' - 'end': '>' - 'patterns': [ - { - 'include': '#type' - } - { - 'include': '#comma' - } - { - 'include': '#comments' - } - ] - } - { - 'comment': 'Match type assertions' - 'begin': '(?])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))+>[\\p{L}\\p{Nl}$_\\(\\[\\d\\{])' - 'end': '>' - 'patterns': [ - { - 'include': '#type' - } - { - 'include': '#comma' - } - { - 'include': '#comments' - } - ] - } - { - 'begin': '\\?' - 'beginCaptures': - '0': - 'name': 'keyword.operator.js' - 'end': ':' - 'endCaptures': - '0': - 'name': 'keyword.operator.js' - 'patterns': [ - { - 'include': '$self' - } - ] - } - { - 'comment': 'Match debugger statement' - 'match': '\\s*(debugger)[\\s;]+' - 'captures': - '1': - 'name':'keyword.debugger.ts' - } - { - 'comment': 'Match full triple slash reference comments' - 'match': '(\\/\\/\\/\\s*)' - 'captures': - '1': - 'name':'keyword.other.ts' - '2': - 'name':'reference.path.string' - '3': - 'name':'keyword.other.ts' - } - { - 'comment': 'Match )' - 'captures': - '1': - 'name':'keyword.other.ts' - '2': - 'name':'amd.path.string' - '3': - 'name':'keyword.other.ts' - } - { - 'comment': 'Match )' - 'captures': - '1': - 'name':'keyword.other.ts' - '2': - 'name':'amd.path.string' - '3': - 'name':'keyword.other.ts' - } - { - 'comment': 'Match import = require' - 'match': '(import)\\s*([\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*)?\\s*=\\s*(require)\\s*\\((.*)\\)' - 'captures': - '1': - 'name':'keyword.other.ts' - '2': - 'name':'variable.type.ts' - '3': - 'name':'keyword.other.ts' - '4': - 'name':'require.path.string' - } - { - 'comment': 'Match ES6 "import from" syntax' - 'match': '(import).*(from)\\s*(.*[\'"])' - 'captures': - '1': - 'name':'keyword.other.ts' - '2': - 'name':'keyword.other.ts' - '3': - 'name':'es6import.path.string' - } - { - 'include': '#curlybracerecursion' - } - { - 'comment': 'Match all [] pairs' - 'begin': '\\[' - 'end': '\\]' - 'captures': - '0': - 'name': 'meta.brace.square.js' - 'patterns': [ - { - 'include': '$self' - } - ] - } - { - 'comment': 'Match all () pairs' - 'begin': '\\(' - 'end': '\\)' - 'captures': - '0': - 'name': 'meta.brace.round.js' - 'patterns': [ - { - 'include': '$self' - } - ] - } - { - 'include': 'source.js' - } - - # TRANSFORMS - { - 'comment': 'Embedded Syntaxes support' - 'begin': '(transform):(null){' - 'beginCaptures': - '1': - 'name': 'keyword.other.ts' - '2': - 'name': 'meta.support.constant.ts' - 'end': '}(transform):(null)' - 'endCaptures': - '1': - 'name': 'keyword.other.ts' - '2': - 'name': 'meta.support.constant.ts' - 'patterns': [ - { - 'include': 'source.ts' - } - ] - } - { - 'comment': 'Embedded Syntax for JSX' - 'begin': '(transform):(jsx){' - 'beginCaptures': - '1': - 'name': 'keyword.other.ts' - '2': - 'name': 'meta.support.constant.ts' - 'end': '}(transform):(jsx)' - 'endCaptures': - '1': - 'name': 'keyword.other.ts' - '2': - 'name': 'meta.support.constant.ts' - 'patterns': [ - { - 'include': 'text.html.basic' - } - ] - } -] - -'repository': - 'curlybracerecursion': - 'comment': 'Match all {} pairs' - 'begin': '{' - 'end': '}' - 'captures': - '0': - 'name': 'meta.brace.curly.js' - 'patterns': [ - { - 'include': '$self' - } - ] - - 'type': - 'begin': '(?=)' - 'end': '(?))' - 'end': '\\)(?:\\[\\])*' - 'patterns': [ - { - 'include': '#type' - } - ] - } - { - 'include': '#keytype' - } - { - 'include': '#typetemplate' - } - { - 'include': '#typenontemplate' - } - { - 'include': '#functiontype' - } - { - 'include': '#tuple' - } - { - 'include': '#objecttype' - } - { - 'match': '\\s*(\\|)\\s*' - 'captures': - '1': - 'name': 'keyword.operator.union.ts' - } - { - 'include': '#comments' - } - { - 'match': '\\.' - 'captures': - '0': - 'name': 'meta.delimiter.period.type.ts' - } - ] - - 'typeinheritedfrom': - 'begin': '(?=)' - 'end': '(?))' - 'end': '\\)(?:\\[\\])*' - 'patterns': [ - { - 'include': '#typeinheritedfrom' - } - ] - } - { - 'include': '#keytype' - } - { - 'include': '#functiontype' - } - { - 'include': '#objecttype' - } - { - 'include': '#tuple' - } - { - 'include': '#typetemplateinheritedfrom' - } - { - 'include': '#typenontemplateinheritedfrom' - } - { - 'match': '\\|' - 'captures': - '0': - 'name': 'keyword.operator.union.ts' - } - { - 'match': '\\.' - 'captures': - '0': - 'name': 'meta.delimiter.period.type.ts' - } - { - 'include': '#comments' - } - ] - - 'typenontemplate': - 'comment': 'Matches a simple type without template specification' - 'match': '([\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*)\\b((?:\\[\\])*)(?!<)' - 'captures': - '1': - 'name': 'support.class.ts' - - 'typetemplate': - 'begin': '([\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*)<' - 'beginCaptures': - '1': - 'name': 'support.class.template.ts' - 'end': '>((?:\\[\\])*)' - 'patterns': [ - { - 'include': '#type' - } - { - 'include': '#comma' - } - { - 'include': '#comments' - } - ] - - 'typenontemplateinheritedfrom': - 'comment': 'Matches a simple type without template specification' - 'match': '([\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*)\\b((?:\\[\\])*)(?!<)' - 'captures': - '1': - 'name': 'entity.other.inherited-class.ts' - - 'typetemplateinheritedfrom': - 'begin': '([\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*)<' - 'beginCaptures': - '1': - 'name': 'entity.other.template.inherited-class.ts' - 'end': '>((?:\\[\\])*)' - 'patterns': [ - { - 'include': '#type' - } - { - 'include': '#comma' - } - { - 'include': '#comments' - } - ] - - 'keytype': - 'comment': 'Match key types.' - 'match': '(number|string|boolean|any|void)(?:\\[\\])*' - 'captures': - '1': - 'name': 'storage.type.variable.ts' - - 'functiontype': - 'patterns': [ - { - 'include': '#functionargumentreturntype' - } - { - 'begin': '(?=<)' - 'end': '(?)(?!\\G)' - 'patterns': [ - { - 'begin': '\\G<' - 'end': '>' - 'patterns': [ - { - 'include': '#typeextend' - } - { - 'include': '#type' - } - { - 'include': '#comma' - } - { - 'include': '#comments' - } - ] - } - { - 'include': '#functionargumentreturntype' - } - { - 'include': '#comments' - } - ] - } - ] - - 'functionargumentreturntype': - 'begin': '(?=\\()' - 'end': '(?)\\s*' - 'beginCaptures': - '1': - 'name': 'storage.type.arrow.js' - 'end': '(?!\\G)' - 'patterns': [ - { - 'include': '#type' - } - { - 'include': '#comments' - } - ] - } - { - 'include': '#comments' - } - ] - - 'functionargumentstype': - 'comment': 'Matches the types for functions.' - 'begin': '\\(' - 'beginCaptures': - '0': - 'name': 'punctuation.definition.parameters.begin.js' - 'end': '\\)' - 'endCaptures': - '0': - 'name': 'punctuation.definition.parameters.end.js' - 'patterns': [ - { - 'include': '#args' - } - { - 'include': '#comments' - } - ] - - 'objecttype': - 'comment': 'Matches anonymous object types.' - 'begin': '{' - 'beginCaptures': - '0': - 'name': 'meta.brace.curly.js' - 'end': '(})(\\[\\])?' - 'endCaptures': - '1': - 'name': 'meta.brace.curly.js' - 'patterns': [ - { - 'include': '#typeindexable' - } - { - 'include': '#typedvariable' - } - { - 'match': ';' - 'name': 'meta.delimiter.semicolon.js' - } - { - 'include': '#comma' - } - { - 'include': '#comments' - } - ] - - 'typeindexable': - 'begin': '\\[[\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*:\\s*(string|number)\\s*\\]:\\s*' - 'beginCaptures': - '1': - 'name': 'storage.type.variable.ts' - 'end': '(?!\\G)' - 'patterns': [ - { - 'include': '#type' - } - { - 'include': '#comments' - } - ] - - 'tuple': - 'begin': '\\[' - 'end': '\\]' - 'patterns': [ - { - 'include': '#type' - } - { - 'include': '#comma' - } - { - 'include': '#comments' - } - ] - - 'typedvariable': - 'begin': '[\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*\\??\\s*:\\s*' - 'end': '(?!\\G)' - 'patterns': [ - { - 'include': '#type' - } - { - 'include': '#comments' - } - ] - - 'decorator': - 'begin': '(\\@[\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*)(\\()' - 'beginCaptures': - '1': - 'name': 'storage.type.annotation.js' - '2': - 'name': 'punctuation.definition.parameters.begin.js' - 'end': '\\)' - 'endCaptures': - '0': - 'name': 'punctuation.definition.parameters.end.js' - 'patterns': [ - { - 'include': '$self' - } - ] - - 'args': - 'comment': 'Match the arguments in a function' - 'patterns': [ - { - 'match': '(?:\\.\\.\\.)?[\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*(?=\\??\\s*[,\\)])' - 'name': 'variable.parameter.function.ts' - } - { - 'begin': '((?:\\.\\.\\.)?[\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*)\\??\\s*:\\s*' - 'beginCaptures': - '1': - 'name': 'variable.parameter.function.ts' - 'end': '(?=\\s*[,\\)])' - 'patterns': [ - { - 'include': '#type' - } - { - 'include': '#comments' - } - ] - } - { - 'include': '#comma' - } - { - 'include': '#comments' - } - ] - - 'function': - 'patterns': [ - { - 'include': '#oldstylefunction' - } - { - 'include': '#newstylefunction' - } - ] - - 'functionnolookahead': - 'patterns': [ - { - 'include': '#oldstylefunction' - } - { - 'include': '#newstylefunctionnolookahead' - } - ] - - 'newstylefunction': - 'patterns': [ - { - 'include': '#newstylefunctionnontemplate' - } - { - 'begin': '(?\\([^\\(].+=>)(?=<(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))+>\\((?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))*\\)(?:\\:\\s*(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))+)?\\s*=>)' - 'end': '(?)(?!\\G)' - 'patterns': [ - { - 'begin': '\\G<' - 'end': '>' - 'patterns': [ - { - 'include': '#typeextend' - } - { - 'include': '#type' - } - { - 'include': '#comma' - } - { - 'include': '#comments' - } - ] - } - { - 'include': '#newstylefunctionnontemplatenolookahead' - } - { - 'include': '#comments' - } - ] - } - ] - - 'newstylefunctionnolookahead': - 'patterns': [ - { - 'begin': '(?=<)' - 'end': '(?)(?!\\G)' - 'patterns': [ - { - 'begin': '\\G<' - 'end': '>' - 'patterns': [ - { - 'include': '#typeextend' - } - { - 'include': '#type' - } - { - 'include': '#comma' - } - { - 'include': '#comments' - } - ] - } - { - 'include': '#newstylefunctionnontemplatenolookahead' - } - { - 'include': '#comments' - } - ] - } - { - 'include': '#newstylefunctionnontemplatenolookahead' - } - ] - - 'newstylefunctionnontemplate': - 'begin': '(?)(?=(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))*\\)(?:\\:\\s*(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/|\\|(?:[^&|*/+\\-\\)]|\\)(?=[\\[\\)|>])|\\/\\*\\*?(?:[^*]*?\\*)*\\/))+)?\\s*=>)' - 'end': '(?!\\:)\\s*(=>)' - 'endCaptures': - '1': - 'name': 'storage.type.arrow.js' - 'patterns': [ - { - 'include': '#functionargumentstype' - } - { - 'begin': '\\:\\s*' - 'end': '(?!\\G)' - 'patterns': [ - { - 'include': '#type' - } - { - 'include': '#comments' - } - ] - } - { - 'include': '#comments' - } - ] - - 'newstylefunctionnontemplatenolookahead': - 'begin': '(?=\\()' - 'end': '(?!\\:)\\s*(=>)' - 'endCaptures': - '1': - 'name': 'storage.type.arrow.js' - 'patterns': [ - { - 'include': '#functionargumentstype' - } - { - 'begin': '\\:\\s*' - 'end': '(?!\\G)' - 'patterns': [ - { - 'include': '#type' - } - { - 'include': '#comments' - } - ] - } - { - 'include': '#comments' - } - ] - - 'oldstylefunction': - 'begin': '(?=(?:(async)(?:\\s+))?(function))' - 'end': '(?!\\G)(?!:)' - 'name': 'meta.function.js' - 'patterns': [ - { - 'begin': '\\G(?:(async)(?:\\s+))?(function)(?:\\s+([\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*))?(\\*?)\\s*(\\*?)(?=\\()' - 'beginCaptures': - '1': - 'name': 'storage.modifier.js' - '2': - 'name': 'storage.type.function.js' - '3': - 'name': 'entity.name.function.js' - '4': - 'name': 'storage.type.function.js' - '5': - 'name': 'storage.type.function.js' - 'end': '(?<=\\))' - 'patterns': [ - { - 'include': '#functionargumentstype' - } - { - 'include': '#comments' - } - ] - } - { - 'begin': '\\G(?:(async)(?:\\s+))?(function)(?:\\s+([\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*))?(?=<)' - 'beginCaptures': - '1': - 'name': 'storage.modifier.js' - '2': - 'name': 'storage.type.function.js' - '3': - 'name': 'entity.name.function.js' - 'end': '(?<=\\))' - 'patterns': [ - { - 'begin': '(?<=\\G)<' - 'end': '>(?:(\\*)\\s*|\\s*(\\*)|\\s*)(?=\\()' - 'endCaptures': - '1': - 'name': 'storage.type.function.js' - '2': - 'name': 'storage.type.function.js' - 'patterns': [ - { - 'include': '#typeextend' - } - { - 'include': '#type' - } - { - 'include': '#comma' - } - { - 'include': '#comments' - } - ] - } - { - 'include': '#functionargumentstype' - } - { - 'include': '#comments' - } - ] - } - { - 'begin': '(?<=\\)):\\s*' - 'end': '(?!\\G)' - 'patterns': [ - { - 'include': '#type' - } - { - 'include': '#comments' - } - ] - } - { - 'include': '#comments' - } - ] - - 'typeextend': - 'begin': '(extends)\\s+' - 'beginCaptures': - '1': - 'name': 'storage.type.modifier.ts' - 'end': '(?!\\G)' - 'patterns': [ - { - 'include': '#typeinheritedfrom' - } - ] - - # Taken from JS grammar (https://github.com/atom/language-javascript/blob/897e999910fb001780286778a20b7e5c02eb59dd/grammars/javascript.cson#L631-L661) - 'docblock': - 'patterns': [ - { - 'match': '(? +/// /// // From brackets plugin /// /// /// -/// /// /// @@ -33,14 +34,14 @@ declare module 'escape-html' { export = escape; } -// courtesy @blakeembrey -declare module 'strip-bom' { - import Buffer = require('buffer') - - function stripBom(value: string): string - function stripBom(value: Buffer): Buffer +declare module 'detect-indent' { + function detectIndent (string: string): { amount: number; type?: string; indent: string }; + export = detectIndent; +} - export = stripBom +declare module 'xtend' { + function extend (dest: T, src: U): T & U; + export = extend; } declare module 'atom-space-pen-views' { diff --git a/lib/linter.ts b/lib/linter.ts index 031e406ee..9f3f2e249 100644 --- a/lib/linter.ts +++ b/lib/linter.ts @@ -19,7 +19,8 @@ interface LinterMessage { } export var provider = { - grammarScopes: ['source.ts', 'source.ts.tsx'], + name: 'TS', + grammarScopes: ['source.ts', 'source.tsx'], scope: 'file', // # or 'project' lintOnFly: true, // # must be false for scope: 'project' lint: (textEditor: AtomCore.IEditor): Promise => { @@ -36,9 +37,7 @@ export var provider = { var linterErrors: LinterMessage[] = resp.errors.map((err) => ({ type: "Error", filePath, - html: ` TS ${ - err.message.replace(/\n/g,'
') - }`, + text: err.message, range: new Range([err.startPos.line, err.startPos.col], [err.endPos.line, err.endPos.col]), })); return linterErrors; diff --git a/lib/main/atom/autoCompleteProvider.ts b/lib/main/atom/autoCompleteProvider.ts index 817877aea..d6ab9c6cf 100644 --- a/lib/main/atom/autoCompleteProvider.ts +++ b/lib/main/atom/autoCompleteProvider.ts @@ -53,6 +53,7 @@ declare module autocompleteplus { export interface Provider { inclusionPriority?: number; excludeLowerPriority?: boolean; + suggestionPriority?: number; selector: string; disableForSelector?: string; getSuggestions: (options: RequestOptions) => Promise; @@ -77,45 +78,10 @@ interface SnippetsContianer { [name: string]: SnippetDescriptor; } - -// this is the structure we use to speed up the lookup by avoiding having to -// iterate over the object properties during the requestHandler -// this will take a little longer during load but I guess that is better than -// taking longer at each key stroke -interface SnippetDetail { - body: string; - name: string; -} - -var tsSnipPrefixLookup: { [prefix: string]: SnippetDetail; } = Object.create(null); -function loadSnippets() { - var confPath = atom.getConfigDirPath(); - CSON.readFile(confPath + "/packages/atom-typescript/snippets/typescript-snippets.cson", - (err, snippetsRoot) => { - if (err) return; - if (!snippetsRoot || !snippetsRoot['.source.ts']) return; - - // rearrange/invert the way this can be looked up: we want to lookup by prefix - // this way the lookup gets faster because we dont have to iterate over the - // properties of the object - var tsSnippets: SnippetsContianer = snippetsRoot['.source.ts']; - for (var snippetName in tsSnippets) { - if (tsSnippets.hasOwnProperty(snippetName)) { - // if the file contains a prefix multiple times only - // the last will be active because the previous ones will be overwritten - tsSnipPrefixLookup[tsSnippets[snippetName].prefix] = { - body: tsSnippets[snippetName].body, - name: snippetName - } - } - } - }); -} -loadSnippets(); - export var provider: autocompleteplus.Provider = { - selector: '.source.ts', + selector: '.source.ts, .source.tsx', inclusionPriority: 3, + suggestionPriority: 3, excludeLowerPriority: false, getSuggestions: (options: autocompleteplus.RequestOptions): Promise=> { @@ -175,7 +141,9 @@ export var provider: autocompleteplus.Provider = { explicitlyTriggered = false; } else { // else in special cases for automatic triggering refuse to provide completions - if (options.prefix && options.prefix.trim() == ';') { + const prefix = options.prefix.trim() + + if (prefix === '' || prefix === ';') { return Promise.resolve([]); } } @@ -224,21 +192,6 @@ export var provider: autocompleteplus.Provider = { } }); - - // see if we have a snippet for this prefix - if (tsSnipPrefixLookup[options.prefix]) { - // you only get the snippet suggested after you have typed - // the full trigger word/ prefex - // and then it replaces a keyword/match that might also be present, e.g. "class" - let suggestion: autocompleteplus.Suggestion = { - snippet: tsSnipPrefixLookup[options.prefix].body, - replacementPrefix: options.prefix, - rightLabelHTML: "snippet: " + options.prefix, - type: 'snippet' - }; - suggestions.unshift(suggestion); - } - return suggestions; }); @@ -261,13 +214,14 @@ export var provider: autocompleteplus.Provider = { if (options.suggestion.atomTS_IsImport) { options.editor.moveToBeginningOfLine(); options.editor.selectToEndOfLine(); - var groups = /^\s*import\s*(\w*)\s*=\s*require\s*\(\s*(["'])/.exec(options.editor.getSelectedText()); - var alias = groups[1]; + var groups = /^(\s*)import\s*(\w*)\s*=\s*require\s*\(\s*(["'])/.exec(options.editor.getSelectedText()); + var leadingWhiteSpace = groups[1]; + var alias = groups[2]; // Use the option if they have a preferred. Otherwise preserve - quote = quote || groups[2]; - - options.editor.replaceSelectedText(null, function() { return `import ${alias} = require(${quote}${options.suggestion.atomTS_IsImport.relativePath}${quote});`; }); + quote = quote || groups[3]; + + options.editor.replaceSelectedText(null, function() { return `${leadingWhiteSpace}import ${alias} = require(${quote}${options.suggestion.atomTS_IsImport.relativePath}${quote});`; }); } if (options.suggestion.atomTS_IsES6Import) { var {row} = options.editor.getCursorBufferPosition(); diff --git a/lib/main/atom/commands/commands.ts b/lib/main/atom/commands/commands.ts index 4f970d054..d7434c962 100644 --- a/lib/main/atom/commands/commands.ts +++ b/lib/main/atom/commands/commands.ts @@ -207,11 +207,11 @@ export function registerCommands() { /*atom.commands.dispatch( atom.views.getView(atom.workspace.getActiveTextEditor()), 'typescript:testing-r-view');*/ - + // atom.commands.dispatch( // atom.views.getView(atom.workspace.getActiveTextEditor()), // 'typescript:toggle-semantic-view'); - + atom.commands.dispatch( atom.views.getView(atom.workspace.getActiveTextEditor()), 'typescript:dependency-view'); @@ -371,7 +371,7 @@ export function registerCommands() { (e) => { var editor = atom.workspace.getActiveTextEditor(); if (!editor) return false; - if (path.extname(editor.getPath()) !== '.ts') return false; + if (path.extname(editor.getPath()) !== '.ts' && path.extname(editor.getPath()) !== '.tsx') return false; // Abort it for others diff --git a/lib/main/atom/editorSetup.ts b/lib/main/atom/editorSetup.ts index 1e952ef56..87caffb45 100644 --- a/lib/main/atom/editorSetup.ts +++ b/lib/main/atom/editorSetup.ts @@ -7,57 +7,57 @@ import * as atomUtils from "./atomUtils"; import {isTransformerFile} from "../lang/transformers/transformer"; export function setupEditor(editor: AtomCore.IEditor) { - - // Quick fix decoration stuff - var quickFixDecoration: AtomCore.Decoration = null; - var quickFixMarker: any = null; - function clearExistingQuickfixDecoration() { - if (quickFixDecoration) { - quickFixDecoration.destroy(); - quickFixDecoration = null; - } - if (quickFixMarker) { - quickFixMarker.destroy(); - quickFixMarker = null; - } - } - var queryForQuickFix = debounce((filePathPosition:{filePath:string;position:number}) => { - parent.getQuickFixes(filePathPosition).then(res=> { - clearExistingQuickfixDecoration(); - if (res.fixes.length) { - quickFixMarker = editor.markBufferRange(editor.getSelectedBufferRange()); - quickFixDecoration = editor.decorateMarker(quickFixMarker, - { type: "line-number", class: "quickfix" }); - } - }) - }, 500); - var cursorObserver = editor.onDidChangeCursorPosition(() => { - try { - // This line seems to throw an exception sometimes. - // https://github.com/TypeStrong/atom-typescript/issues/325 - // https://github.com/TypeStrong/atom-typescript/issues/310 - let pathPos = atomUtils.getFilePathPosition(); - - // TODO: implement quickfix logic for transformed files - if (isTransformerFile(pathPos.filePath)) { - clearExistingQuickfixDecoration(); - return; - } - - queryForQuickFix(pathPos); - } - catch (ex) { - clearExistingQuickfixDecoration(); - } - }); - - - /** - * On final dispose - */ - var destroyObserver = editor.onDidDestroy(() => { - // Clear editor observers - cursorObserver.dispose(); - destroyObserver.dispose(); - }); + // + // // Quick fix decoration stuff + // var quickFixDecoration: AtomCore.Decoration = null; + // var quickFixMarker: any = null; + // function clearExistingQuickfixDecoration() { + // if (quickFixDecoration) { + // quickFixDecoration.destroy(); + // quickFixDecoration = null; + // } + // if (quickFixMarker) { + // quickFixMarker.destroy(); + // quickFixMarker = null; + // } + // } + // var queryForQuickFix = debounce((filePathPosition:{filePath:string;position:number}) => { + // parent.getQuickFixes(filePathPosition).then(res=> { + // clearExistingQuickfixDecoration(); + // if (res.fixes.length) { + // quickFixMarker = editor.markBufferRange(editor.getSelectedBufferRange()); + // quickFixDecoration = editor.decorateMarker(quickFixMarker, + // { type: "line-number", class: "quickfix" }); + // } + // }) + // }, 500); + // var cursorObserver = editor.onDidChangeCursorPosition(() => { + // try { + // // This line seems to throw an exception sometimes. + // // https://github.com/TypeStrong/atom-typescript/issues/325 + // // https://github.com/TypeStrong/atom-typescript/issues/310 + // let pathPos = atomUtils.getFilePathPosition(); + // + // // TODO: implement quickfix logic for transformed files + // if (isTransformerFile(pathPos.filePath)) { + // clearExistingQuickfixDecoration(); + // return; + // } + // + // queryForQuickFix(pathPos); + // } + // catch (ex) { + // clearExistingQuickfixDecoration(); + // } + // }); + // + // + // /** + // * On final dispose + // */ + // var destroyObserver = editor.onDidDestroy(() => { + // // Clear editor observers + // cursorObserver.dispose(); + // destroyObserver.dispose(); + // }); } diff --git a/lib/main/atom/tooltipManager.ts b/lib/main/atom/tooltipManager.ts index e6b3afed7..69101174a 100644 --- a/lib/main/atom/tooltipManager.ts +++ b/lib/main/atom/tooltipManager.ts @@ -69,8 +69,8 @@ export function attach(editorView: JQuery, editor: AtomCore.IEditor) { if (exprTypeTooltip) return; var pixelPt = pixelPositionFromMouseEvent(editorView, e); - pixelPt.top += editor.displayBuffer.getScrollTop(); - pixelPt.left += editor.displayBuffer.getScrollLeft(); + pixelPt.top += editor.getScrollTop(); + pixelPt.left += editor.getScrollLeft(); var screenPt = editor.screenPositionForPixelPosition(pixelPt); var bufferPt = editor.bufferPositionForScreenPosition(screenPt); var curCharPixelPt = rawView.pixelPositionForBufferPosition([bufferPt.row, bufferPt.column]); diff --git a/lib/main/atom/views/mainPanelView.ts b/lib/main/atom/views/mainPanelView.ts index ea6a5c43c..eb2584ae9 100644 --- a/lib/main/atom/views/mainPanelView.ts +++ b/lib/main/atom/views/mainPanelView.ts @@ -78,7 +78,7 @@ export class MainPanelView extends view.View { this.span({ class: 'layout horizontal atomts-panel-header', - style: 'align-items: center; flex: 1 1 auto' + style: 'align-items: center; flex: 1 1 auto; line-height: 24px;' // Line height is equal to height of github loading icon }, () => { this.div({ style: 'cursor: pointer;', @@ -241,10 +241,10 @@ export class MainPanelView extends view.View { this.sectionPending.stop(); if (pending.length) { - this.sectionPending.fadeIn(500); + this.sectionPending.animate({opacity: 0.5}, 500); } else { - this.sectionPending.fadeOut(200); + this.sectionPending.animate({opacity: 0}, 200); } } @@ -365,6 +365,7 @@ export class MainPanelView extends view.View { private clearedError = true; clearError() { this.clearedError = true; + this.clearSummary(); this.errorBody.empty(); } @@ -396,6 +397,11 @@ export class MainPanelView extends view.View { } } + clearSummary() { + this.summary.html(''); + this.summary.off(); + } + setErrorPanelErrorCount(fileErrorCount: number, totalErrorCount: number) { var title = `${panelHeaders.error} ( No Errors )`; if (totalErrorCount > 0) { @@ -407,7 +413,7 @@ export class MainPanelView extends view.View { )`; } else { - this.summary.html(''); + this.clearSummary(); this.errorBody.html('No errors in open files \u2665'); } diff --git a/lib/main/lang/fixmyts/quickFixRegistry.ts b/lib/main/lang/fixmyts/quickFixRegistry.ts index eb2f04f56..d81ec89f6 100644 --- a/lib/main/lang/fixmyts/quickFixRegistry.ts +++ b/lib/main/lang/fixmyts/quickFixRegistry.ts @@ -4,6 +4,7 @@ import {QuickFix} from "./quickFix"; */ import {AddClassMember} from "./quickFixes/addClassMember"; import {AddClassMethod} from "./quickFixes/addClassMethod"; +import {AddImportFromStatement} from "./quickFixes/addImportFromStatement"; import {AddImportStatement} from "./quickFixes/addImportStatement"; import {EqualsToEquals} from "./quickFixes/equalsToEquals"; import {ExtractVariable} from "./quickFixes/extractVariable"; @@ -18,6 +19,7 @@ import {SingleLineCommentToJsdoc} from "./quickFixes/singleLineCommentToJsdoc"; export var allQuickFixes: QuickFix[] = [ new AddClassMethod(), new AddClassMember(), + new AddImportFromStatement(), new AddImportStatement(), new WrapInProperty(), new EqualsToEquals(), diff --git a/lib/main/lang/fixmyts/quickFixes/addImportFromStatement.ts b/lib/main/lang/fixmyts/quickFixes/addImportFromStatement.ts new file mode 100644 index 000000000..b9ce35671 --- /dev/null +++ b/lib/main/lang/fixmyts/quickFixes/addImportFromStatement.ts @@ -0,0 +1,84 @@ +import {QuickFix, QuickFixQueryInformation, Refactoring, CanProvideFixResponse} from "../quickFix"; +import * as ast from "../astUtils"; +import {EOL } from "os"; +var { displayPartsToString, typeToDisplayParts } = ts; +import path = require('path'); +import {Project} from "../../core/project"; + +import {getPathCompletions} from "../../modules/getPathCompletions"; + +function getIdentifierAndFileNames(error: ts.Diagnostic, project: Project) { + + var errorText: string = error.messageText; + + // We don't support error chains yet + if (typeof errorText !== 'string') { + return undefined; + }; + + var match = errorText.match(/Cannot find name \'(\w+)\'./); + + // If for whatever reason the error message doesn't match + if (!match) return; + + var [, identifierName] = match; + var {files} = getPathCompletions({ + project, + filePath: error.file.fileName, + prefix: identifierName, + includeExternalModules: false + }); + var file = files.length > 0 ? files[0].relativePath : undefined; + var basename = files.length > 0 ? files[0].name : undefined; + return { identifierName, file, basename }; +} + +export class AddImportFromStatement implements QuickFix { + key = AddImportFromStatement.name; + + canProvideFix(info: QuickFixQueryInformation): CanProvideFixResponse { + var relevantError = info.positionErrors.filter(x=> x.code == 2304)[0]; + if (!relevantError) return; + if (info.positionNode.kind !== ts.SyntaxKind.Identifier) return; + var matches = getIdentifierAndFileNames(relevantError, info.project); + if (!matches) return; + + var { identifierName, file} = matches; + return file ? { display: `import {${identifierName}} from \"${file}\"` } : undefined; + } + + provideFix(info: QuickFixQueryInformation): Refactoring[] { + var relevantError = info.positionErrors.filter(x=> x.code == 2304)[0]; + var identifier = info.positionNode; + + var identifierName = identifier.text; + var fileNameforFix = getIdentifierAndFileNames(relevantError, info.project); + + // Add stuff at the top of the file + let refactorings: Refactoring[] = [{ + span: { + start: 0, + length: 0 + }, + newText: `import {${identifierName}} from \"${fileNameforFix.file}\";${EOL}`, + filePath: info.sourceFile.fileName + }]; + + // Also refactor the variable name to match the file name + // TODO: the following code only takes into account location + // There may be other locations where this is used. + // Better that they trigger a *rename* explicitly later if they want to rename the variable + // if (identifierName !== fileNameforFix.basename) { + // refactorings.push({ + // span: { + // start: identifier.getStart(), + // length: identifier.end - identifier.getStart() + // }, + // newText: fileNameforFix.basename, + // filePath: info.srcFile.fileName + // }) + // } + + return refactorings; + } +} diff --git a/lib/main/lang/fixmyts/quickFixes/extractVariable.ts b/lib/main/lang/fixmyts/quickFixes/extractVariable.ts index 0e0b99165..7d473d411 100644 --- a/lib/main/lang/fixmyts/quickFixes/extractVariable.ts +++ b/lib/main/lang/fixmyts/quickFixes/extractVariable.ts @@ -19,9 +19,6 @@ export class ExtractVariable implements QuickFix { () => { return { display: `Extract variable` }; }); - - throw "Unexpected state in canProvideFix"; - } provideFix(info: QuickFixQueryInformation): Refactoring[] { @@ -36,8 +33,6 @@ export class ExtractVariable implements QuickFix { (callExpression) => { return extractVariableFromArg(info, callExpression); }); - - throw "Unexpected state in provideFix"; } } diff --git a/lib/main/lang/modules/building.ts b/lib/main/lang/modules/building.ts index fa1e3ab3c..1681706fc 100644 --- a/lib/main/lang/modules/building.ts +++ b/lib/main/lang/modules/building.ts @@ -5,9 +5,12 @@ import fs = require('fs'); import {pathIsRelative, makeRelativePath} from "../../tsconfig/tsconfig"; import {consistentPath} from "../../utils/fsUtil"; import {createMap, assign} from "../utils"; +var findup = require('findup'); /** Lazy loaded babel tanspiler */ -let babel: any; +let babels: { [key: string]: any } = {}; +/** Store babel configurations from .babelrc */ +let babelConfigs: { [key: string]: any } = {}; /** If we get a compile request for a ts file that is not in project. We return a js file with the following content */ export const Not_In_Context = "/* NotInContext */"; @@ -54,23 +57,23 @@ export function emitFile(proj: project.Project, filePath: string): EmitOutput { let sourceMapContents: { [index: string]: any } = {}; output.outputFiles.forEach(o => { mkdirp.sync(path.dirname(o.name)); - let additionalEmits = runExternalTranspiler( + runExternalTranspiler( filePath, sourceFile.text, o, proj, sourceMapContents - ); - - if (!sourceMapContents[o.name] && !proj.projectFile.project.compilerOptions.noEmit) { - // .js.map files will be written as an "additional emit" later. - fs.writeFileSync(o.name, o.text, "utf8"); - } + ).then((additionalEmits) => { + if (!sourceMapContents[o.name] && !proj.projectFile.project.compilerOptions.noEmit) { + // .js.map files will be written as an "additional emit" later. + fs.writeFileSync(o.name, o.text, "utf8"); + } - additionalEmits.forEach(a => { - mkdirp.sync(path.dirname(a.name)); - fs.writeFileSync(a.name, a.text, "utf8"); - }) + additionalEmits.forEach(a => { + mkdirp.sync(path.dirname(a.name)); + fs.writeFileSync(a.name, a.text, "utf8"); + }); + }); }); } @@ -103,27 +106,66 @@ export function getRawOutput(proj: project.Project, filePath: string): ts.EmitOu return output; } +function getBabelInstance(projectDirectory: string) { + return new Promise(resolve => { + if (!babels[projectDirectory]) { + findup(projectDirectory, 'node_modules/babel-core', function(err: any, dir: string) { + if (err) { + findup(projectDirectory, 'node_modules/babel', function(err: any, dir: string) { + if (err) { + babels[projectDirectory] = require('babel'); + } else { + babels[projectDirectory] = require(path.join(dir, 'node_modules/babel')); + } + + resolve(babels[projectDirectory]); + }); + } else { + babels[projectDirectory] = require(path.join(dir, 'node_modules/babel-core')); + resolve(babels[projectDirectory]); + } + }); + } else { + resolve(babels[projectDirectory]); + } + }).then(babel => { + return new Promise(resolve => { + findup(projectDirectory, '.babelrc', function(err: any, dir) { + if (err) return resolve(babel); + + fs.readFile(path.join(dir, '.babelrc'), function(err, data) { + try { + babelConfigs[projectDirectory] = JSON.parse(data.toString()); + } catch (e) { } + + resolve(babel); + }); + }); + }); + }); +} + function runExternalTranspiler(sourceFileName: string, sourceFileText: string, outputFile: ts.OutputFile, project: project.Project, - sourceMapContents: { [index: string]: any }): ts.OutputFile[] { + sourceMapContents: { [index: string]: any }): Promise { if (!isJSFile(outputFile.name) && !isJSSourceMapFile(outputFile.name)) { - return []; + return Promise.resolve([]); } let settings = project.projectFile.project; let externalTranspiler = settings.externalTranspiler; if (!externalTranspiler) { - return []; + return Promise.resolve([]); } if (isJSSourceMapFile(outputFile.name)) { let sourceMapPayload = JSON.parse(outputFile.text); let jsFileName = consistentPath(path.resolve(path.dirname(outputFile.name), sourceMapPayload.file)); sourceMapContents[outputFile.name] = { jsFileName: jsFileName, sourceMapPayload }; - return []; + return Promise.resolve([]); } if (typeof externalTranspiler === 'string') { @@ -136,54 +178,56 @@ function runExternalTranspiler(sourceFileName: string, // We need this type guard to narrow externalTranspiler's type if (typeof externalTranspiler === 'object') { if (externalTranspiler.name.toLocaleLowerCase() === "babel") { - if (!babel) { - babel = require("babel") - } + return getBabelInstance(project.projectFile.projectFileDirectory).then((babel) => { - let babelOptions: any = assign({}, externalTranspiler.options || {}, { - filename: outputFile.name - }); - - let sourceMapFileName = getJSMapNameForJSFile(outputFile.name); + let babelOptions: any = assign(babelConfigs[project.projectFile.projectFileDirectory] || {}, externalTranspiler.options || {}, { + filename: outputFile.name + }); - if (sourceMapContents[sourceMapFileName]) { - babelOptions.inputSourceMap = sourceMapContents[sourceMapFileName].sourceMapPayload; - let baseName = path.basename(sourceFileName); - // NOTE: Babel generates invalid source map without consistent `sources` and `file`. - babelOptions.inputSourceMap.sources = [baseName]; - babelOptions.inputSourceMap.file = baseName; - } - if (settings.compilerOptions.sourceMap) { - babelOptions.sourceMaps = true; - } - if (settings.compilerOptions.inlineSourceMap) { - babelOptions.sourceMaps = "inline"; - } - if (!settings.compilerOptions.removeComments) { - babelOptions.comments = true; - } + let sourceMapFileName = getJSMapNameForJSFile(outputFile.name); - let babelResult = babel.transform(outputFile.text, babelOptions); - outputFile.text = babelResult.code; - - if (babelResult.map && settings.compilerOptions.sourceMap) { - let additionalEmit: ts.OutputFile = { - name: sourceMapFileName, - text: JSON.stringify(babelResult.map), - writeByteOrderMark: settings.compilerOptions.emitBOM - }; - - if (additionalEmit.name === "") { - // can't emit a blank file name - this should only be reached if the TypeScript - // language service returns the .js file before the .js.map file. - console.warn(`The TypeScript language service did not yet provide a .js.map name for file ${outputFile.name}`); - return []; + if (sourceMapContents[sourceMapFileName]) { + babelOptions.inputSourceMap = sourceMapContents[sourceMapFileName].sourceMapPayload; + let baseName = path.basename(sourceFileName); + // NOTE: Babel generates invalid source map without consistent `sources` and `file`. + babelOptions.inputSourceMap.sources = [baseName]; + babelOptions.inputSourceMap.file = baseName; + } + if (settings.compilerOptions.sourceMap) { + babelOptions.sourceMaps = true; + } + if (settings.compilerOptions.inlineSourceMap) { + babelOptions.sourceMaps = "inline"; + } + if (!settings.compilerOptions.removeComments) { + babelOptions.comments = true; } - return [additionalEmit]; - } + var directory = process.cwd(); + process.chdir(project.projectFile.projectFileDirectory); + let babelResult = babel.transform(outputFile.text, babelOptions); + process.chdir(directory); + outputFile.text = babelResult.code; + + if (babelResult.map && settings.compilerOptions.sourceMap) { + let additionalEmit: ts.OutputFile = { + name: sourceMapFileName, + text: JSON.stringify(babelResult.map), + writeByteOrderMark: settings.compilerOptions.emitBOM + }; + + if (additionalEmit.name === "") { + // can't emit a blank file name - this should only be reached if the TypeScript + // language service returns the .js file before the .js.map file. + console.warn(`The TypeScript language service did not yet provide a .js.map name for file ${outputFile.name}`); + return []; + } + + return [additionalEmit]; + } - return []; + return []; + }); } } diff --git a/lib/main/lang/projectService.ts b/lib/main/lang/projectService.ts index 7b1e45c0b..4d4ab90f9 100644 --- a/lib/main/lang/projectService.ts +++ b/lib/main/lang/projectService.ts @@ -124,7 +124,7 @@ export function build(query: BuildQuery): Promise { return output; }); - // Also optionally emit a root dts: + // Also optionally emit a root dts: building.emitDts(proj); // If there is a post build script to run ... run it @@ -138,7 +138,7 @@ export function build(query: BuildQuery): Promise { } }); } - + let tsFilesWithInvalidEmit = outputs .filter((o) => o.emitError) .map((o) => o.sourceFileName); diff --git a/lib/main/lang/transformers/transformerRegistry.ts b/lib/main/lang/transformers/transformerRegistry.ts index 3ee4c72da..f4cc21c46 100644 --- a/lib/main/lang/transformers/transformerRegistry.ts +++ b/lib/main/lang/transformers/transformerRegistry.ts @@ -2,7 +2,7 @@ import utils = require("../utils"); import {Transformer, TransformerDelimiter, FileTransformationDetails} from "./transformer"; /** - * Transformers should push themeselves into this registry. + * Transformers should push themeselves into this registry. * This is so that the registry does not depend on the transformers * As that will cause a circular reference */ @@ -30,27 +30,28 @@ export function getInitialTransformation(code: string): FileTransformationDetail var transforms: TransformerDelimiter[] = []; - var processedSrcUpto = 0; - var srcCode = code; - var destCode = ''; - var destDelta = 0; - - while (true) { - let remainingCode = code.substr(processedSrcUpto); - // Get the next transform that exist in this file: - var matches = transformFinderRegex.exec(remainingCode); - // No more transforms: - if (!matches || !matches.length || matches.length < 2) return { transforms }; - // Found one! - var nextTransformName = matches.slice[1]; - // Update the processedUpto - } - - /** - * TODO: for each transform we note down the src start and src end - * Then we transform the src code. This gives a dest start (initially same as src start) and dest end (more or less) - * we use this to additionally compute a running (delta) in dest. This delta is used in the next (dest start). - */ + // var processedSrcUpto = 0; + // var srcCode = code; + // var destCode = ''; + // var destDelta = 0; + // + // while (true) { + // let remainingCode = code.substr(processedSrcUpto); + // // Get the next transform that exist in this file: + // var matches = transformFinderRegex.exec(remainingCode); + // // No more transforms: + // if (!matches || !matches.length || matches.length < 2) return { transforms }; + // // Found one! + // var nextTransformName = matches.slice[1]; + // // Update the processedUpto + // break; + // } + // + // /** + // * TODO: for each transform we note down the src start and src end + // * Then we transform the src code. This gives a dest start (initially same as src start) and dest end (more or less) + // * we use this to additionally compute a running (delta) in dest. This delta is used in the next (dest start). + // */ return { transforms }; @@ -67,12 +68,13 @@ export function transform(name: string, code: string): { code: string } { return transformer.transform(code); } -// Ensure that all the transformers are loaded: +// Ensure that all the transformers are loaded: // Since nothing depends on these explicitly (don't want a circular ref) // We need to load them manually: import * as path from "path"; -var expand = require('glob-expand'); -let files: string[] = expand({ filter: 'isFile', cwd: __dirname }, [ - "./implementations/*.js" -]); -files = files.map(f=> require(f)); \ No newline at end of file +var glob = require('glob'); +let files: string[] = glob.sync('./implementations/*.js', { + nodir: true, + cwd: __dirname +}); +files = files.map(f=> require(f)); diff --git a/lib/main/tsconfig/formatting.ts b/lib/main/tsconfig/formatting.ts index 7bf19f2dc..b0dcc10f6 100644 --- a/lib/main/tsconfig/formatting.ts +++ b/lib/main/tsconfig/formatting.ts @@ -26,6 +26,7 @@ export function defaultFormatCodeOptions(): ts.FormatCodeOptions { TabSize: 4, NewLineCharacter: os.EOL, ConvertTabsToSpaces: true, + IndentStyle: ts.IndentStyle.Smart, InsertSpaceAfterCommaDelimiter: true, InsertSpaceAfterSemicolonInForStatements: true, InsertSpaceBeforeAndAfterBinaryOperators: true, diff --git a/lib/main/tsconfig/tsconfig.ts b/lib/main/tsconfig/tsconfig.ts index f582c0c81..ab1baebbd 100644 --- a/lib/main/tsconfig/tsconfig.ts +++ b/lib/main/tsconfig/tsconfig.ts @@ -1,7 +1,6 @@ import * as fsu from "../utils/fsUtil"; import simpleValidator = require('./simpleValidator'); -import stripBom = require('strip-bom'); var types = simpleValidator.types; // Most compiler options come from require('typescript').CompilerOptions, but @@ -18,6 +17,9 @@ var types = simpleValidator.types; */ interface CompilerOptions { allowNonTsExtensions?: boolean; + allowSyntheticDefaultImports?: boolean; + allowUnreachableCode?: boolean; + allowUnusedLabels?: boolean; charset?: string; codepage?: number; declaration?: boolean; @@ -41,17 +43,21 @@ interface CompilerOptions { noEmitHelpers?: boolean; noEmitOnError?: boolean; noErrorTruncation?: boolean; + noFallthroughCasesInSwitch?: boolean; noImplicitAny?: boolean; // Error on inferred `any` type + noImplicitReturns?: boolean; noLib?: boolean; noLibCheck?: boolean; noResolve?: boolean; out?: string; + outFile?: string; // new name for out outDir?: string; // Redirect output structure to this directory preserveConstEnums?: boolean; removeComments?: boolean; // Do not emit comments in output rootDir?: string; sourceMap?: boolean; // Generates SourceMaps (.map files) sourceRoot?: string; // Optionally specifies the location where debugger should locate TypeScript source files after deployment + stripInternal?: boolean; suppressExcessPropertyErrors?: boolean; // Optionally disable strict object literal assignment checking suppressImplicitAnyIndexErrors?: boolean; target?: string; // 'es3'|'es5' (default)|'es6' @@ -60,8 +66,11 @@ interface CompilerOptions { } var compilerOptionsValidation: simpleValidator.ValidationInfo = { - allowNonTsExtensions: { type: simpleValidator.types.boolean }, - charset: { type: simpleValidator.types.string }, + allowNonTsExtensions: { type: types.boolean }, + allowSyntheticDefaultImports: { type: types.boolean }, + allowUnreachableCode: { type: types.boolean }, + allowUnusedLabels: { type: types.boolean }, + charset: { type: types.string }, codepage: { type: types.number }, declaration: { type: types.boolean }, diagnostics: { type: types.boolean }, @@ -77,24 +86,28 @@ var compilerOptionsValidation: simpleValidator.ValidationInfo = { locals: { type: types.string }, listFiles: { type: types.boolean }, mapRoot: { type: types.string }, - module: { type: types.string, validValues: ['commonjs', 'amd', 'system', 'umd'] }, + module: { type: types.string, validValues: ['commonjs', 'amd', 'system', 'umd', 'es6', 'es2015'] }, moduleResolution: { type: types.string, validValues: ['classic', 'node'] }, newLine: { type: types.string }, noEmit: { type: types.boolean }, noEmitHelpers: { type: types.boolean }, noEmitOnError: { type: types.boolean }, noErrorTruncation: { type: types.boolean }, + noFallthroughCasesInSwitch: { type: types.boolean }, noImplicitAny: { type: types.boolean }, + noImplicitReturns: { type: types.boolean }, noLib: { type: types.boolean }, noLibCheck: { type: types.boolean }, noResolve: { type: types.boolean }, out: { type: types.string }, + outFile: { type: types.string }, outDir: { type: types.string }, preserveConstEnums: { type: types.boolean }, removeComments: { type: types.boolean }, rootDir: { type: types.string }, sourceMap: { type: types.boolean }, sourceRoot: { type: types.string }, + stripInternal: { type: types.boolean }, suppressExcessPropertyErrors: { type: types.boolean }, suppressImplicitAnyIndexErrors: { type: types.boolean }, target: { type: types.string, validValues: ['es3', 'es5', 'es6'] }, @@ -118,6 +131,7 @@ interface UsefulFromPackageJson { */ interface TypeScriptProjectRawSpecification { compilerOptions?: CompilerOptions; + exclude?: string[]; // optional: An array of 'glob / minimatch / RegExp' patterns to specify directories / files to exclude files?: string[]; // optional: paths to files filesGlob?: string[]; // optional: An array of 'glob / minimatch / RegExp' patterns to specify source files formatCodeOptions?: formatting.FormatCodeOptions; // optional: formatting options @@ -125,6 +139,7 @@ interface TypeScriptProjectRawSpecification { buildOnSave?: boolean; externalTranspiler?: string | { name: string; options?: any }; scripts?: { postbuild?: string }; + atom?: { rewriteTsconfig?: boolean }; } /** @@ -142,6 +157,7 @@ export interface TypeScriptProjectSpecification { package?: UsefulFromPackageJson; externalTranspiler?: string | { name: string; options?: any }; scripts: { postbuild?: string }; + atom: { rewriteTsconfig: boolean }; } ///////// FOR USE WITH THE API ///////////// @@ -159,7 +175,7 @@ export interface TypeScriptProjectFileDetails { ////////////////////////////////////////////////////////////////////// export var errors = { - GET_PROJECT_INVALID_PATH: 'Invalid Path', + GET_PROJECT_INVALID_PATH: 'The path used to query for tsconfig.json does not exist', GET_PROJECT_NO_PROJECT_FOUND: 'No Project Found', GET_PROJECT_FAILED_TO_OPEN_PROJECT_FILE: 'Failed to fs.readFileSync the project file', GET_PROJECT_JSON_PARSE_FAILED: 'Failed to JSON.parse the project file', @@ -193,23 +209,26 @@ function errorWithDetails(error: Error, details: T): Error { import fs = require('fs'); import path = require('path'); -import expand = require('glob-expand'); +import tsconfig = require('tsconfig'); import os = require('os'); +import detectIndent = require('detect-indent'); +import extend = require('xtend'); import formatting = require('./formatting'); var projectFileName = 'tsconfig.json'; + /** * This is what we write to new files */ var defaultFilesGlob = [ - "./**/*.ts", - "./**/*.tsx", - "!./node_modules/**/*", + "**/*.ts", + "**/*.tsx", + "!node_modules/**", ]; /** * This is what we use when the user doens't specify a files / filesGlob */ -var invisibleFilesGlob = ["./**/*.ts", "./**/*.tsx"]; +var invisibleFilesGlob = '{**/*.ts,**/*.tsx}'; export var defaults: ts.CompilerOptions = { target: ts.ScriptTarget.ES5, @@ -238,8 +257,10 @@ var typescriptEnumMap = { 'none': ts.ModuleKind.None, 'commonjs': ts.ModuleKind.CommonJS, 'amd': ts.ModuleKind.AMD, - 'system': ts.ModuleKind.System, 'umd': ts.ModuleKind.UMD, + 'system': ts.ModuleKind.System, + 'es6': ts.ModuleKind.ES6, + 'es2015': ts.ModuleKind.ES2015, }, moduleResolution: { 'node': ts.ModuleResolutionKind.NodeJs, @@ -291,6 +312,11 @@ function rawToTsCompilerOptions(jsonOptions: CompilerOptions, projectDir: string compilerOptions.out = path.resolve(projectDir, compilerOptions.out); } + if (compilerOptions.outFile !== undefined) { + // Till out is removed. Support outFile by just copying it to `out` + compilerOptions.out = path.resolve(projectDir, compilerOptions.outFile); + } + return compilerOptions; } @@ -323,7 +349,8 @@ export function getDefaultInMemoryProject(srcFile: string): TypeScriptProjectFil formatCodeOptions: formatting.defaultFormatCodeOptions(), compileOnSave: true, buildOnSave: false, - scripts: {} + scripts: {}, + atom: { rewriteTsconfig: true }, }; return { @@ -344,70 +371,48 @@ export function getProjectSync(pathOrSrcFile: string): TypeScriptProjectFileDeta throw new Error(errors.GET_PROJECT_INVALID_PATH); } - // Get the path directory var dir = fs.lstatSync(pathOrSrcFile).isDirectory() ? pathOrSrcFile : path.dirname(pathOrSrcFile); + var projectFile = tsconfig.resolveSync(dir); - // Keep going up till we find the project file - var projectFile = ''; - try { - projectFile = travelUpTheDirectoryTreeTillYouFind(dir, projectFileName); + if (!projectFile) { + throw errorWithDetails( + new Error(errors.GET_PROJECT_NO_PROJECT_FOUND), { projectFilePath: fsu.consistentPath(pathOrSrcFile), errorMessage: 'not found' }); } - catch (e) { - let err: Error = e; - if (err.message == "not found") { - throw errorWithDetails( - new Error(errors.GET_PROJECT_NO_PROJECT_FOUND), { projectFilePath: fsu.consistentPath(pathOrSrcFile), errorMessage: err.message }); - } - } - projectFile = path.normalize(projectFile); + var projectFileDirectory = path.dirname(projectFile) + path.sep; // We now have a valid projectFile. Parse it: var projectSpec: TypeScriptProjectRawSpecification; + var projectFileTextContent: string; + try { - var projectFileTextContent = fs.readFileSync(projectFile, 'utf8'); + projectFileTextContent = fs.readFileSync(projectFile, 'utf8'); } catch (ex) { throw new Error(errors.GET_PROJECT_FAILED_TO_OPEN_PROJECT_FILE); } + try { - projectSpec = JSON.parse(stripBom(projectFileTextContent)); + projectSpec = tsconfig.parseFileSync(projectFileTextContent, projectFile, { resolvePaths: false }); } catch (ex) { throw errorWithDetails( new Error(errors.GET_PROJECT_JSON_PARSE_FAILED), { projectFilePath: fsu.consistentPath(projectFile), error: ex.message }); } - // Setup default project options - if (!projectSpec.compilerOptions) projectSpec.compilerOptions = {}; - - // Our customizations for "tsconfig.json" - // Use grunt.file.expand type of logic - var cwdPath = path.relative(process.cwd(), path.dirname(projectFile)); - if (!projectSpec.files && !projectSpec.filesGlob) { // If there is no files and no filesGlob, we create an invisible one. - var toExpand = invisibleFilesGlob; - } - if (projectSpec.filesGlob) { // If there is a files glob we will use that - var toExpand = projectSpec.filesGlob - } - if (toExpand) { // Expand whatever needs expanding - try { - projectSpec.files = expand({ filter: 'isFile', cwd: cwdPath }, toExpand); - } - catch (ex) { - throw errorWithDetails( - new Error(errors.GET_PROJECT_GLOB_EXPAND_FAILED), - { glob: projectSpec.filesGlob, projectFilePath: fsu.consistentPath(projectFile), errorMessage: ex.message }); + /** Setup defaults for atom key */ + if (!projectSpec.atom) { + projectSpec.atom = { + rewriteTsconfig: true, } } + if (projectSpec.filesGlob) { // for filesGlob we keep the files in sync - var prettyJSONProjectSpec = prettyJSON(projectSpec); - if (prettyJSONProjectSpec !== projectFileTextContent) { - fs.writeFileSync(projectFile, prettyJSON(projectSpec)); + var prettyJSONProjectSpec = prettyJSON(projectSpec, detectIndent(projectFileTextContent).indent); + + if (prettyJSONProjectSpec !== projectFileTextContent && projectSpec.atom.rewriteTsconfig) { + fs.writeFileSync(projectFile, prettyJSONProjectSpec); } } - // Remove all relativeness - projectSpec.files = projectSpec.files.map((file) => path.resolve(projectFileDirectory, file)); - var pkg: UsefulFromPackageJson = null; try { var packagePath = travelUpTheDirectoryTreeTillYouFind(projectFileDirectory, 'package.json'); @@ -428,7 +433,7 @@ export function getProjectSync(pathOrSrcFile: string): TypeScriptProjectFileDeta var project: TypeScriptProjectSpecification = { compilerOptions: {}, - files: projectSpec.files, + files: projectSpec.files.map(x => path.resolve(projectFileDirectory, x)), filesGlob: projectSpec.filesGlob, formatCodeOptions: formatting.makeFormatCodeOptions(projectSpec.formatCodeOptions), compileOnSave: projectSpec.compileOnSave == undefined ? true : projectSpec.compileOnSave, @@ -436,7 +441,8 @@ export function getProjectSync(pathOrSrcFile: string): TypeScriptProjectFileDeta typings: [], externalTranspiler: projectSpec.externalTranspiler == undefined ? undefined : projectSpec.externalTranspiler, scripts: projectSpec.scripts || {}, - buildOnSave: !!projectSpec.buildOnSave + buildOnSave: !!projectSpec.buildOnSave, + atom: { rewriteTsconfig: true } }; // Validate the raw compiler options before converting them to TS compiler options @@ -491,6 +497,8 @@ export function createProjectRootSync(srcFile: string, defaultOptions?: ts.Compi var projectSpec: TypeScriptProjectRawSpecification = {}; projectSpec.compilerOptions = tsToRawCompilerOptions(defaultOptions || defaults); projectSpec.filesGlob = defaultFilesGlob; + projectSpec.compileOnSave = true; + projectSpec.buildOnSave = false; fs.writeFileSync(projectFilePath, prettyJSON(projectSpec)); return getProjectSync(srcFile); @@ -527,32 +535,36 @@ function increaseProjectForReferenceAndImports(files: string[]): string[] { var preProcessedFileInfo = ts.preProcessFile(content, true), dir = path.dirname(file); + let extensions = ['.ts', '.d.ts', '.tsx']; + function getIfExists(filePathNoExt: string) { + for (let ext of extensions) { + if (fs.existsSync(filePathNoExt + ext)) { + return filePathNoExt + ext; + } + } + } + referenced.push( preProcessedFileInfo.referencedFiles.map(fileReference => { // We assume reference paths are always relative var file = path.resolve(dir, fsu.consistentPath(fileReference.fileName)); - // Try all three, by itself, .ts, .d.ts + // Try by itself then with extensions if (fs.existsSync(file)) { return file; } - if (fs.existsSync(file + '.ts')) { - return file + '.ts'; - } - if (fs.existsSync(file + '.d.ts')) { - return file + '.d.ts'; - } - return null; + return getIfExists(file); }).filter(file=> !!file) .concat( preProcessedFileInfo.importedFiles .filter((fileReference) => pathIsRelative(fileReference.fileName)) .map(fileReference => { - var file = path.resolve(dir, fileReference.fileName + '.ts'); - if (!fs.existsSync(file)) { - file = path.resolve(dir, fileReference.fileName + '.d.ts'); + let fileNoExt = path.resolve(dir, fileReference.fileName); + let file = getIfExists(fileNoExt); + if (!file) { + file = getIfExists(`${file}/index`); } return file; - }) + }).filter(file=> !!file) ) ); }); @@ -688,9 +700,10 @@ function getDefinitionsForNodeModules(projectDir: string, files: string[]): { ou return { implicit, ours, packagejson }; } -export function prettyJSON(object: any): string { +export function prettyJSON(object: any, indent: string | number = 4): string { var cache = []; - var value = JSON.stringify(object, + var value = JSON.stringify( + object, // fixup circular reference function(key, value) { if (typeof value === 'object' && value !== null) { @@ -703,8 +716,8 @@ export function prettyJSON(object: any): string { } return value; }, - // indent 4 spaces - 4); + indent + ); value = value.split('\n').join(os.EOL) + os.EOL; cache = null; return value; diff --git a/lib/tsconfig.json b/lib/tsconfig.json index 7aac82c90..bc01d87bd 100644 --- a/lib/tsconfig.json +++ b/lib/tsconfig.json @@ -17,6 +17,7 @@ "filesGlob": [ "./**/*.ts", "./**/*.tsx", + "../typings/main.d.ts", "!node_modules/**/*.ts", "!node_modules/**/*.tsx" ], @@ -65,20 +66,21 @@ "./main/lang/core/project.ts", "./main/lang/fixmyts/astUtils.ts", "./main/lang/fixmyts/quickFix.ts", - "./main/lang/fixmyts/quickFixRegistry.ts", "./main/lang/fixmyts/quickFixes/addClassMember.ts", "./main/lang/fixmyts/quickFixes/addClassMethod.ts", + "./main/lang/fixmyts/quickFixes/addImportFromStatement.ts", "./main/lang/fixmyts/quickFixes/addImportStatement.ts", "./main/lang/fixmyts/quickFixes/equalsToEquals.ts", "./main/lang/fixmyts/quickFixes/extractVariable.ts", "./main/lang/fixmyts/quickFixes/implementInterface.ts", - "./main/lang/fixmyts/quickFixes/quoteToTemplate.ts", "./main/lang/fixmyts/quickFixes/quotesToQuotes.ts", + "./main/lang/fixmyts/quickFixes/quoteToTemplate.ts", "./main/lang/fixmyts/quickFixes/singleLineCommentToJsdoc.ts", "./main/lang/fixmyts/quickFixes/stringConcatToTemplate.ts", "./main/lang/fixmyts/quickFixes/typeAssertPropertyAccessToAny.ts", "./main/lang/fixmyts/quickFixes/typeAssertPropertyAccessToType.ts", "./main/lang/fixmyts/quickFixes/wrapInProperty.ts", + "./main/lang/fixmyts/quickFixRegistry.ts", "./main/lang/modules/astToText.ts", "./main/lang/modules/building.ts", "./main/lang/modules/formatting.ts", @@ -105,10 +107,10 @@ "./typings/codemirror.d.ts", "./typings/d3/d3.d.ts", "./typings/emissary/emissary.d.ts", - "./typings/glob-expand/glob-expand.d.ts", + "./typings/glob/glob.d.ts", "./typings/htmltojsx/htmltojsx.d.ts", "./typings/jquery/jquery.d.ts", - "./typings/minimatch.d.ts", + "./typings/minimatch/minimatch.d.ts", "./typings/mixto/mixto.d.ts", "./typings/mkdirp/mkdirp.d.ts", "./typings/mustache.d.ts", @@ -117,7 +119,6 @@ "./typings/q/Q.d.ts", "./typings/react/react-jsx.d.ts", "./typings/react/react.d.ts", - "./typings/source-map/source-map.d.ts", "./typings/space-pen/space-pen.d.ts", "./typings/status-bar/status-bar.d.ts", "./typings/text-buffer/text-buffer.d.ts", @@ -128,6 +129,11 @@ "./worker/parent.ts", "./worker/queryParent.ts", "./main/atom/views/rView.tsx", - "./main/atom/views/semanticView.tsx" - ] + "./main/atom/views/semanticView.tsx", + "../typings/main.d.ts" + ], + "exclude": [], + "atom": { + "rewriteTsconfig": true + } } diff --git a/lib/tsd.json b/lib/tsd.json index 028c42bfd..04d8a827f 100644 --- a/lib/tsd.json +++ b/lib/tsd.json @@ -30,7 +30,7 @@ "commit": "69bdfb0884020e41f17a1dd80ad4c77de2636874" }, "node/node.d.ts": { - "commit": "69bdfb0884020e41f17a1dd80ad4c77de2636874" + "commit": "66f88ec51858bb21bc375fa91a963c04bc09401e" }, "q/Q.d.ts": { "commit": "69bdfb0884020e41f17a1dd80ad4c77de2636874" @@ -41,9 +41,6 @@ "d3/d3.d.ts": { "commit": "2520bce9a8a71b66e67487cbd5b33fec880b0c55" }, - "source-map/source-map.d.ts": { - "commit": "70737c2a2496f7a13c4da63eb00081cad94d19f1" - }, "react/react.d.ts": { "commit": "6f04d25ad38982d372cc3cda62fa4c0eef9e24d7" }, @@ -52,6 +49,12 @@ }, "htmltojsx/htmltojsx.d.ts": { "commit": "1632606f82cfbaf89d4b96b8dccacfaf2a6ae2f3" + }, + "glob/glob.d.ts": { + "commit": "66f88ec51858bb21bc375fa91a963c04bc09401e" + }, + "minimatch/minimatch.d.ts": { + "commit": "66f88ec51858bb21bc375fa91a963c04bc09401e" } } } diff --git a/lib/typings/atompromise.d.ts b/lib/typings/atompromise.d.ts index 2aaf30bdc..98bad30e6 100644 --- a/lib/typings/atompromise.d.ts +++ b/lib/typings/atompromise.d.ts @@ -33,7 +33,7 @@ interface PromiseConstructor { * and a reject callback used to reject the promise with a provided reason or error. */ new (init: (resolve: (value?: T | Promise) => void, reject: (reason?: any) => void) => void): Promise; - + (init: (resolve: (value?: T | Promise) => void, reject: (reason?: any) => void) => void): Promise; /** @@ -96,3 +96,7 @@ interface PromiseDeferred { } declare var Promise: PromiseConstructor; + +declare module 'pinkie-promise'{ + export = Promise; +} diff --git a/lib/typings/glob-expand/glob-expand.d.ts b/lib/typings/glob-expand/glob-expand.d.ts deleted file mode 100644 index b020a1bdc..000000000 --- a/lib/typings/glob-expand/glob-expand.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "glob-expand" { - var foo; - export = foo; -} diff --git a/lib/typings/glob/glob.d.ts b/lib/typings/glob/glob.d.ts new file mode 100644 index 000000000..6e9714375 --- /dev/null +++ b/lib/typings/glob/glob.d.ts @@ -0,0 +1,112 @@ +// Type definitions for Glob 5.0.10 +// Project: https://github.com/isaacs/node-glob +// Definitions by: vvakame +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "glob" { + + import events = require("events"); + import fs = require('fs'); + import minimatch = require("minimatch"); + + function G(pattern: string, cb: (err: Error, matches: string[]) => void): void; + function G(pattern: string, options: G.IOptions, cb: (err: Error, matches: string[]) => void): void; + + module G { + function sync(pattern: string, options?: IOptions): string[]; + + function hasMagic(pattern: string, options?: IOptions): boolean; + + var Glob: IGlobStatic; + var GlobSync: IGlobSyncStatic; + + interface IOptions extends minimatch.IOptions { + cwd?: string; + root?: string; + dot?: boolean; + nomount?: boolean; + mark?: boolean; + nosort?: boolean; + stat?: boolean; + silent?: boolean; + strict?: boolean; + cache?: { [path: string]: any /* boolean | string | string[] */ }; + statCache?: { [path: string]: fs.Stats }; + symlinks?: any; + sync?: boolean; + nounique?: boolean; + nonull?: boolean; + debug?: boolean; + nobrace?: boolean; + noglobstar?: boolean; + noext?: boolean; + nocase?: boolean; + matchBase?: any; + nodir?: boolean; + ignore?: any; /* string | string[] */ + follow?: boolean; + realpath?: boolean; + nonegate?: boolean; + nocomment?: boolean; + + /** Deprecated. */ + globDebug?: boolean; + } + + interface IGlobStatic extends events.EventEmitter { + new (pattern: string, cb?: (err: Error, matches: string[]) => void): IGlob; + new (pattern: string, options: IOptions, cb?: (err: Error, matches: string[]) => void): IGlob; + prototype: IGlob; + } + + interface IGlobSyncStatic { + new (pattern: string, options?: IOptions): IGlobBase + prototype: IGlobBase; + } + + interface IGlobBase { + minimatch: minimatch.IMinimatch; + options: IOptions; + aborted: boolean; + cache: { [path: string]: any /* boolean | string | string[] */ }; + statCache: { [path: string]: fs.Stats }; + symlinks: { [path: string]: boolean }; + realpathCache: { [path: string]: string }; + found: string[]; + } + + interface IGlob extends IGlobBase, events.EventEmitter { + pause(): void; + resume(): void; + abort(): void; + + /** Deprecated. */ + EOF: any; + /** Deprecated. */ + paused: boolean; + /** Deprecated. */ + maxDepth: number; + /** Deprecated. */ + maxLength: number; + /** Deprecated. */ + changedCwd: boolean; + /** Deprecated. */ + cwd: string; + /** Deprecated. */ + root: string; + /** Deprecated. */ + error: any; + /** Deprecated. */ + matches: string[]; + /** Deprecated. */ + log(...args: any[]): void; + /** Deprecated. */ + emitMatch(m: any): void; + } + } + + export = G; +} diff --git a/lib/typings/minimatch.d.ts b/lib/typings/minimatch.d.ts deleted file mode 100644 index 684e0a0bf..000000000 --- a/lib/typings/minimatch.d.ts +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2013-2014 François de Campredon -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * All options are false by default. - */ -interface MiniMatchOptions { - - /** - * Dump a ton of stuff to stderr. - */ - debug?: boolean; - - /** - * Do not expand {a,b} and {1..3} brace sets. - */ - nobrace?: boolean; - - /** - * Disable ** matching against multiple folder names. - */ - noglobstar?: boolean; - - /** - * Allow patterns to match filenames starting with a period, even if the pattern does not explicitly have a period in that spot. - * Note that by default, a/** /b will not match a/.d/b, unless dot is set. - */ - dot?: boolean; - - /** - * Disable "extglob" style patterns like +(a|b). - */ - noext?: boolean; - - /** - * Perform a case-insensitive match. - */ - nocase?: boolean; - - - /** - * When a match is not found by minimatch.match, return a list containing the pattern itself. - * When set, an empty list is returned if there are no matches. - */ - nonull?: boolean; - - - /** - * If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. - * For example, a?b would match the path /xyz/123/acb, but not /xyz/acb/123. - */ - matchBase?: boolean; - - - /** - * Suppress the behavior of treating # at the start of a pattern as a comment. - */ - nocomment?: boolean; - - - /** - * Suppress the behavior of treating a leading ! character as negation. - */ - nonegate?: boolean; - - - /** - * Returns from negate expressions the same as if they were not negated. (Ie, true on a hit, false on a miss.) - */ - flipNegate?: boolean; -} - - -interface MiniMatchStatic { - (path: string, pattern: string, options?: MiniMatchOptions): boolean; - filter(pattern: string, options?: MiniMatchOptions): { (path: string): boolean }; -} - -declare module 'minimatch' { - var minimatch: MiniMatchStatic; - export = minimatch; -} - - diff --git a/lib/typings/minimatch/minimatch.d.ts b/lib/typings/minimatch/minimatch.d.ts new file mode 100644 index 000000000..a79c6ff11 --- /dev/null +++ b/lib/typings/minimatch/minimatch.d.ts @@ -0,0 +1,64 @@ +// Type definitions for Minimatch 2.0.8 +// Project: https://github.com/isaacs/minimatch +// Definitions by: vvakame +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "minimatch" { + + function M(target: string, pattern: string, options?: M.IOptions): boolean; + + module M { + function match(list: string[], pattern: string, options?: IOptions): string[]; + function filter(pattern: string, options?: IOptions): (element: string, indexed: number, array: string[]) => boolean; + function makeRe(pattern: string, options?: IOptions): RegExp; + + var Minimatch: IMinimatchStatic; + + interface IOptions { + debug?: boolean; + nobrace?: boolean; + noglobstar?: boolean; + dot?: boolean; + noext?: boolean; + nocase?: boolean; + nonull?: boolean; + matchBase?: boolean; + nocomment?: boolean; + nonegate?: boolean; + flipNegate?: boolean; + } + + interface IMinimatchStatic { + new (pattern: string, options?: IOptions): IMinimatch; + prototype: IMinimatch; + } + + interface IMinimatch { + pattern: string; + options: IOptions; + /** 2-dimensional array of regexp or string expressions. */ + set: any[][]; // (RegExp | string)[][] + regexp: RegExp; + negate: boolean; + comment: boolean; + empty: boolean; + + makeRe(): RegExp; // regexp or boolean + match(fname: string): boolean; + matchOne(files: string[], pattern: string[], partial: boolean): boolean; + + /** Deprecated. For internal use. */ + debug(): void; + /** Deprecated. For internal use. */ + make(): void; + /** Deprecated. For internal use. */ + parseNegate(): void; + /** Deprecated. For internal use. */ + braceExpand(pattern: string, options: IOptions): void; + /** Deprecated. For internal use. */ + parse(pattern: string, isSub?: boolean): void; + } + } + + export = M; +} diff --git a/lib/typings/node/node.d.ts b/lib/typings/node/node.d.ts index 7bd8ca118..e90a4a146 100644 --- a/lib/typings/node/node.d.ts +++ b/lib/typings/node/node.d.ts @@ -9,6 +9,19 @@ * * ************************************************/ +interface Error { + stack?: string; +} + + +// compat for TypeScript 1.5.3 +// if you use with --target es3 or --target es5 and use below definitions, +// use the lib.es6.d.ts that is bundled with TypeScript 1.5.3. +interface MapConstructor {} +interface WeakMapConstructor {} +interface SetConstructor {} +interface WeakSetConstructor {} + /************************************************ * * * GLOBAL * @@ -27,23 +40,30 @@ declare function clearInterval(intervalId: NodeJS.Timer): void; declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): any; declare function clearImmediate(immediateId: any): void; -declare var require: { +interface NodeRequireFunction { (id: string): any; +} + +interface NodeRequire extends NodeRequireFunction { resolve(id:string): string; cache: any; extensions: any; main: any; -}; +} + +declare var require: NodeRequire; -declare var module: { +interface NodeModule { exports: any; - require(id: string): any; + require: NodeRequireFunction; id: string; filename: string; loaded: boolean; parent: any; children: any[]; -}; +} + +declare var module: NodeModule; // Same as module.exports declare var exports: any; @@ -61,15 +81,76 @@ declare var SlowBuffer: { // Buffer class interface Buffer extends NodeBuffer {} + +/** + * Raw data is stored in instances of the Buffer class. + * A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized. + * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' + */ declare var Buffer: { + /** + * Allocates a new buffer containing the given {str}. + * + * @param str String to store in buffer. + * @param encoding encoding to use, optional. Default is 'utf8' + */ new (str: string, encoding?: string): Buffer; + /** + * Allocates a new buffer of {size} octets. + * + * @param size count of octets to allocate. + */ new (size: number): Buffer; - new (size: Uint8Array): Buffer; + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + */ + new (array: Uint8Array): Buffer; + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + */ new (array: any[]): Buffer; prototype: Buffer; + /** + * Returns true if {obj} is a Buffer + * + * @param obj object to test. + */ isBuffer(obj: any): boolean; + /** + * Returns true if {encoding} is a valid encoding argument. + * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' + * + * @param encoding string to test. + */ + isEncoding(encoding: string): boolean; + /** + * Gives the actual byte length of a string. encoding defaults to 'utf8'. + * This is not the same as String.prototype.length since that returns the number of characters in a string. + * + * @param string string to test. + * @param encoding encoding used to evaluate (defaults to 'utf8') + */ byteLength(string: string, encoding?: string): number; + /** + * Returns a buffer which is the result of concatenating all the buffers in the list together. + * + * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer. + * If the list has exactly one item, then the first item of the list is returned. + * If the list has more than one item, then a new Buffer is created. + * + * @param list An array of Buffer objects to concatenate + * @param totalLength Total length of the buffers when concatenated. + * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly. + */ concat(list: Buffer[], totalLength?: number): Buffer; + /** + * The same as buf1.compare(buf2). + */ + compare(buf1: Buffer, buf2: Buffer): number; }; /************************************************ @@ -79,10 +160,11 @@ declare var Buffer: { ************************************************/ declare module NodeJS { export interface ErrnoException extends Error { - errno?: any; + errno?: number; code?: string; path?: string; syscall?: string; + stack?: string; } export interface EventEmitter { @@ -98,7 +180,7 @@ declare module NodeJS { export interface ReadableStream extends EventEmitter { readable: boolean; - read(size?: number): any; + read(size?: number): string|Buffer; setEncoding(encoding: string): void; pause(): void; resume(): void; @@ -111,8 +193,7 @@ declare module NodeJS { export interface WritableStream extends EventEmitter { writable: boolean; - write(buffer: Buffer, cb?: Function): boolean; - write(str: string, cb?: Function): boolean; + write(buffer: Buffer|string, cb?: Function): boolean; write(str: string, encoding?: string, cb?: Function): boolean; end(): void; end(buffer: Buffer, cb?: Function): void; @@ -190,6 +271,71 @@ declare module NodeJS { send?(message: any, sendHandle?: any): void; } + export interface Global { + Array: typeof Array; + ArrayBuffer: typeof ArrayBuffer; + Boolean: typeof Boolean; + Buffer: typeof Buffer; + DataView: typeof DataView; + Date: typeof Date; + Error: typeof Error; + EvalError: typeof EvalError; + Float32Array: typeof Float32Array; + Float64Array: typeof Float64Array; + Function: typeof Function; + GLOBAL: Global; + Infinity: typeof Infinity; + Int16Array: typeof Int16Array; + Int32Array: typeof Int32Array; + Int8Array: typeof Int8Array; + Intl: typeof Intl; + JSON: typeof JSON; + Map: MapConstructor; + Math: typeof Math; + NaN: typeof NaN; + Number: typeof Number; + Object: typeof Object; + Promise: Function; + RangeError: typeof RangeError; + ReferenceError: typeof ReferenceError; + RegExp: typeof RegExp; + Set: SetConstructor; + String: typeof String; + Symbol: Function; + SyntaxError: typeof SyntaxError; + TypeError: typeof TypeError; + URIError: typeof URIError; + Uint16Array: typeof Uint16Array; + Uint32Array: typeof Uint32Array; + Uint8Array: typeof Uint8Array; + Uint8ClampedArray: Function; + WeakMap: WeakMapConstructor; + WeakSet: WeakSetConstructor; + clearImmediate: (immediateId: any) => void; + clearInterval: (intervalId: NodeJS.Timer) => void; + clearTimeout: (timeoutId: NodeJS.Timer) => void; + console: typeof console; + decodeURI: typeof decodeURI; + decodeURIComponent: typeof decodeURIComponent; + encodeURI: typeof encodeURI; + encodeURIComponent: typeof encodeURIComponent; + escape: (str: string) => string; + eval: typeof eval; + global: Global; + isFinite: typeof isFinite; + isNaN: typeof isNaN; + parseFloat: typeof parseFloat; + parseInt: typeof parseInt; + process: Process; + root: Global; + setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => any; + setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer; + setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer; + undefined: typeof undefined; + unescape: (str: string) => string; + gc: () => void; + } + export interface Timer { ref() : void; unref() : void; @@ -205,8 +351,18 @@ interface NodeBuffer { toString(encoding?: string, start?: number, end?: number): string; toJSON(): any; length: number; + equals(otherBuffer: Buffer): boolean; + compare(otherBuffer: Buffer): number; copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; slice(start?: number, end?: number): Buffer; + writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number; + readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number; + readIntLE(offset: number, byteLength: number, noAssert?: boolean): number; + readIntBE(offset: number, byteLength: number, noAssert?: boolean): number; readUInt8(offset: number, noAsset?: boolean): number; readUInt16LE(offset: number, noAssert?: boolean): number; readUInt16BE(offset: number, noAssert?: boolean): number; @@ -270,27 +426,23 @@ declare module "events" { } declare module "http" { - import events = require("events"); - import net = require("net"); - import stream = require("stream"); + import * as events from "events"; + import * as net from "net"; + import * as stream from "stream"; export interface Server extends events.EventEmitter { listen(port: number, hostname?: string, backlog?: number, callback?: Function): Server; + listen(port: number, hostname?: string, callback?: Function): Server; listen(path: string, callback?: Function): Server; listen(handle: any, listeningListener?: Function): Server; close(cb?: any): Server; address(): { port: number; family: string; address: string; }; maxHeadersCount: number; } - export interface ServerRequest extends events.EventEmitter, stream.Readable { - method: string; - url: string; - headers: any; - trailers: string; - httpVersion: string; - setEncoding(encoding?: string): void; - pause(): void; - resume(): void; + /** + * @deprecated Use IncomingMessage + */ + export interface ServerRequest extends IncomingMessage { connection: net.Socket; } export interface ServerResponse extends events.EventEmitter, stream.Writable { @@ -305,6 +457,7 @@ declare module "http" { writeHead(statusCode: number, reasonPhrase?: string, headers?: any): void; writeHead(statusCode: number, headers?: any): void; statusCode: number; + statusMessage: string; setHeader(name: string, value: string): void; sendDate: boolean; getHeader(name: string): string; @@ -340,15 +493,35 @@ declare module "http" { end(str: string, encoding?: string, cb?: Function): void; end(data?: any, encoding?: string): void; } - export interface ClientResponse extends events.EventEmitter, stream.Readable { - statusCode: number; + export interface IncomingMessage extends events.EventEmitter, stream.Readable { httpVersion: string; headers: any; + rawHeaders: string[]; trailers: any; - setEncoding(encoding?: string): void; - pause(): void; - resume(): void; + rawTrailers: any; + setTimeout(msecs: number, callback: Function): NodeJS.Timer; + /** + * Only valid for request obtained from http.Server. + */ + method?: string; + /** + * Only valid for request obtained from http.Server. + */ + url?: string; + /** + * Only valid for response obtained from http.ClientRequest. + */ + statusCode?: number; + /** + * Only valid for response obtained from http.ClientRequest. + */ + statusMessage?: string; + socket: net.Socket; } + /** + * @deprecated Use IncomingMessage + */ + export interface ClientResponse extends IncomingMessage { } export interface AgentOptions { /** @@ -386,20 +559,22 @@ declare module "http" { destroy(): void; } + export var METHODS: string[]; + export var STATUS_CODES: { [errorCode: number]: string; [errorCode: string]: string; }; - export function createServer(requestListener?: (request: ServerRequest, response: ServerResponse) =>void ): Server; + export function createServer(requestListener?: (request: IncomingMessage, response: ServerResponse) =>void ): Server; export function createClient(port?: number, host?: string): any; - export function request(options: any, callback?: Function): ClientRequest; - export function get(options: any, callback?: Function): ClientRequest; + export function request(options: any, callback?: (res: IncomingMessage) => void): ClientRequest; + export function get(options: any, callback?: (res: IncomingMessage) => void): ClientRequest; export var globalAgent: Agent; } declare module "cluster" { - import child = require("child_process"); - import events = require("events"); + import * as child from "child_process"; + import * as events from "events"; export interface ClusterSettings { exec?: string; @@ -438,7 +613,7 @@ declare module "cluster" { } declare module "zlib" { - import stream = require("stream"); + import * as stream from "stream"; export interface ZlibOptions { chunkSize?: number; windowBits?: number; level?: number; memLevel?: number; strategy?: number; dictionary?: any; } export interface Gzip extends stream.Transform { } @@ -458,12 +633,19 @@ declare module "zlib" { export function createUnzip(options?: ZlibOptions): Unzip; export function deflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function deflateSync(buf: Buffer, options?: ZlibOptions): any; export function deflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function deflateRawSync(buf: Buffer, options?: ZlibOptions): any; export function gzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function gzipSync(buf: Buffer, options?: ZlibOptions): any; export function gunzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function gunzipSync(buf: Buffer, options?: ZlibOptions): any; export function inflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function inflateSync(buf: Buffer, options?: ZlibOptions): any; export function inflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function inflateRawSync(buf: Buffer, options?: ZlibOptions): any; export function unzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void; + export function unzipSync(buf: Buffer, options?: ZlibOptions): any; // Constants export var Z_NO_FLUSH: number; @@ -516,9 +698,9 @@ declare module "os" { } declare module "https" { - import tls = require("tls"); - import events = require("events"); - import http = require("http"); + import * as tls from "tls"; + import * as events from "events"; + import * as http from "http"; export interface ServerOptions { pfx?: any; @@ -563,8 +745,8 @@ declare module "https" { }; export interface Server extends tls.Server { } export function createServer(options: ServerOptions, requestListener?: Function): Server; - export function request(options: RequestOptions, callback?: (res: http.ClientResponse) =>void ): http.ClientRequest; - export function get(options: RequestOptions, callback?: (res: http.ClientResponse) =>void ): http.ClientRequest; + export function request(options: RequestOptions, callback?: (res: http.IncomingMessage) =>void ): http.ClientRequest; + export function get(options: RequestOptions, callback?: (res: http.IncomingMessage) =>void ): http.ClientRequest; export var globalAgent: Agent; } @@ -582,8 +764,8 @@ declare module "punycode" { } declare module "repl" { - import stream = require("stream"); - import events = require("events"); + import * as stream from "stream"; + import * as events from "events"; export interface ReplOptions { prompt?: string; @@ -600,11 +782,11 @@ declare module "repl" { } declare module "readline" { - import events = require("events"); - import stream = require("stream"); + import * as events from "events"; + import * as stream from "stream"; export interface ReadLine extends events.EventEmitter { - setPrompt(prompt: string, length: number): void; + setPrompt(prompt: string): void; prompt(preserveCursor?: boolean): void; question(query: string, callback: Function): void; pause(): void; @@ -635,8 +817,8 @@ declare module "vm" { } declare module "child_process" { - import events = require("events"); - import stream = require("stream"); + import * as events from "events"; + import * as stream from "stream"; export interface ChildProcess extends events.EventEmitter { stdin: stream.Writable; @@ -646,6 +828,7 @@ declare module "child_process" { kill(signal?: string): void; send(message: any, sendHandle?: any): void; disconnect(): void; + unref(): void; } export function spawn(command: string, args?: string[], options?: { @@ -664,8 +847,8 @@ declare module "child_process" { timeout?: number; maxBuffer?: number; killSignal?: string; - }, callback: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; - export function exec(command: string, callback: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; + }, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; + export function exec(command: string, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; export function execFile(file: string, callback?: (error: Error, stdout: Buffer, stderr: Buffer) =>void ): ChildProcess; export function execFile(file: string, args?: string[], @@ -697,6 +880,18 @@ declare module "child_process" { killSignal?: string; encoding?: string; }): ChildProcess; + export function execFileSync(command: string, args?: string[], options?: { + cwd?: string; + input?: string|Buffer; + stdio?: any; + env?: any; + uid?: number; + gid?: number; + timeout?: number; + maxBuffer?: number; + killSignal?: string; + encoding?: string; + }): ChildProcess; } declare module "url" { @@ -749,7 +944,7 @@ declare module "dns" { } declare module "net" { - import stream = require("stream"); + import * as stream from "stream"; export interface Socket extends stream.Duplex { // Extended base methods @@ -775,7 +970,10 @@ declare module "net" { ref(): void; remoteAddress: string; + remoteFamily: string; remotePort: number; + localAddress: string; + localPort: number; bytesRead: number; bytesWritten: number; @@ -814,7 +1012,7 @@ declare module "net" { } declare module "dgram" { - import events = require("events"); + import * as events from "events"; interface RemoteInfo { address: string; @@ -844,8 +1042,8 @@ declare module "dgram" { } declare module "fs" { - import stream = require("stream"); - import events = require("events"); + import * as stream from "stream"; + import * as events from "events"; interface Stats { isFile(): boolean; @@ -868,6 +1066,7 @@ declare module "fs" { atime: Date; mtime: Date; ctime: Date; + birthtime: Date; } interface FSWatcher extends events.EventEmitter { @@ -879,9 +1078,21 @@ declare module "fs" { } export interface WriteStream extends stream.Writable { close(): void; + bytesWritten: number; } + /** + * Asynchronous rename. + * @param oldPath + * @param newPath + * @param callback No arguments other than a possible exception are given to the completion callback. + */ export function rename(oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + /** + * Synchronous rename + * @param oldPath + * @param newPath + */ export function renameSync(oldPath: string, newPath: string): void; export function truncate(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; export function truncate(path: string, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void; @@ -921,15 +1132,71 @@ declare module "fs" { export function readlinkSync(path: string): string; export function realpath(path: string, callback?: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void; export function realpath(path: string, cache: {[path: string]: string}, callback: (err: NodeJS.ErrnoException, resolvedPath: string) =>any): void; - export function realpathSync(path: string, cache?: {[path: string]: string}): string; + export function realpathSync(path: string, cache?: { [path: string]: string }): string; + /* + * Asynchronous unlink - deletes the file specified in {path} + * + * @param path + * @param callback No arguments other than a possible exception are given to the completion callback. + */ export function unlink(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + /* + * Synchronous unlink - deletes the file specified in {path} + * + * @param path + */ export function unlinkSync(path: string): void; + /* + * Asynchronous rmdir - removes the directory specified in {path} + * + * @param path + * @param callback No arguments other than a possible exception are given to the completion callback. + */ export function rmdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + /* + * Synchronous rmdir - removes the directory specified in {path} + * + * @param path + */ export function rmdirSync(path: string): void; + /* + * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. + * + * @param path + * @param callback No arguments other than a possible exception are given to the completion callback. + */ export function mkdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + /* + * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. + * + * @param path + * @param mode + * @param callback No arguments other than a possible exception are given to the completion callback. + */ export function mkdir(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + /* + * Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. + * + * @param path + * @param mode + * @param callback No arguments other than a possible exception are given to the completion callback. + */ export function mkdir(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + /* + * Synchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. + * + * @param path + * @param mode + * @param callback No arguments other than a possible exception are given to the completion callback. + */ export function mkdirSync(path: string, mode?: number): void; + /* + * Synchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777. + * + * @param path + * @param mode + * @param callback No arguments other than a possible exception are given to the completion callback. + */ export function mkdirSync(path: string, mode?: string): void; export function readdir(path: string, callback?: (err: NodeJS.ErrnoException, files: string[]) => void): void; export function readdirSync(path: string): string[]; @@ -951,15 +1218,64 @@ declare module "fs" { export function fsync(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; export function fsyncSync(fd: number): void; export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; + export function write(fd: number, buffer: Buffer, offset: number, length: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; + export function write(fd: number, data: any, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; + export function write(fd: number, data: any, offset: number, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; + export function write(fd: number, data: any, offset: number, encoding: string, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number; export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void; export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number; + /* + * Asynchronous readFile - Asynchronously reads the entire contents of a file. + * + * @param fileName + * @param encoding + * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. + */ export function readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; + /* + * Asynchronous readFile - Asynchronously reads the entire contents of a file. + * + * @param fileName + * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFile returns a string; otherwise it returns a Buffer. + * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. + */ export function readFile(filename: string, options: { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: string) => void): void; + /* + * Asynchronous readFile - Asynchronously reads the entire contents of a file. + * + * @param fileName + * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFile returns a string; otherwise it returns a Buffer. + * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. + */ export function readFile(filename: string, options: { flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; - export function readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void ): void; + /* + * Asynchronous readFile - Asynchronously reads the entire contents of a file. + * + * @param fileName + * @param callback - The callback is passed two arguments (err, data), where data is the contents of the file. + */ + export function readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + /* + * Synchronous readFile - Synchronously reads the entire contents of a file. + * + * @param fileName + * @param encoding + */ export function readFileSync(filename: string, encoding: string): string; + /* + * Synchronous readFile - Synchronously reads the entire contents of a file. + * + * @param fileName + * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFileSync returns a string; otherwise it returns a Buffer. + */ export function readFileSync(filename: string, options: { encoding: string; flag?: string; }): string; + /* + * Synchronous readFile - Synchronously reads the entire contents of a file. + * + * @param fileName + * @param options An object with optional {encoding} and {flag} properties. If {encoding} is specified, readFileSync returns a string; otherwise it returns a Buffer. + */ export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; @@ -978,49 +1294,178 @@ declare module "fs" { export function watch(filename: string, options: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher; export function exists(path: string, callback?: (exists: boolean) => void): void; export function existsSync(path: string): boolean; + /** Constant for fs.access(). File is visible to the calling process. */ + export var F_OK: number; + /** Constant for fs.access(). File can be read by the calling process. */ + export var R_OK: number; + /** Constant for fs.access(). File can be written by the calling process. */ + export var W_OK: number; + /** Constant for fs.access(). File can be executed by the calling process. */ + export var X_OK: number; + /** Tests a user's permissions for the file specified by path. */ + export function access(path: string, callback: (err: NodeJS.ErrnoException) => void): void; + export function access(path: string, mode: number, callback: (err: NodeJS.ErrnoException) => void): void; + /** Synchronous version of fs.access. This throws if any accessibility checks fail, and does nothing otherwise. */ + export function accessSync(path: string, mode ?: number): void; export function createReadStream(path: string, options?: { flags?: string; encoding?: string; - fd?: string; + fd?: number; mode?: number; - bufferSize?: number; - }): ReadStream; - export function createReadStream(path: string, options?: { - flags?: string; - encoding?: string; - fd?: string; - mode?: string; - bufferSize?: number; + autoClose?: boolean; }): ReadStream; export function createWriteStream(path: string, options?: { flags?: string; encoding?: string; - string?: string; + fd?: number; + mode?: number; }): WriteStream; } declare module "path" { + /** + * A parsed path object generated by path.parse() or consumed by path.format(). + */ export interface ParsedPath { + /** + * The root of the path such as '/' or 'c:\' + */ root: string; + /** + * The full directory path such as '/home/user/dir' or 'c:\path\dir' + */ dir: string; + /** + * The file name including extension (if any) such as 'index.html' + */ base: string; + /** + * The file extension (if any) such as '.html' + */ ext: string; + /** + * The file name without extension (if any) such as 'index' + */ name: string; } + /** + * Normalize a string path, reducing '..' and '.' parts. + * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. + * + * @param p string path to normalize. + */ export function normalize(p: string): string; + /** + * Join all arguments together and normalize the resulting path. + * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown. + * + * @param paths string paths to join. + */ export function join(...paths: any[]): string; + /** + * Join all arguments together and normalize the resulting path. + * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown. + * + * @param paths string paths to join. + */ + export function join(...paths: string[]): string; + /** + * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. + * + * Starting from leftmost {from} paramter, resolves {to} to an absolute path. + * + * If {to} isn't already absolute, {from} arguments are prepended in right to left order, until an absolute path is found. If after using all {from} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory. + * + * @param pathSegments string paths to join. Non-string arguments are ignored. + */ export function resolve(...pathSegments: any[]): string; - export function isAbsolute(p: string): boolean; + /** + * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. + * + * @param path path to test. + */ + export function isAbsolute(path: string): boolean; + /** + * Solve the relative path from {from} to {to}. + * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve. + * + * @param from + * @param to + */ export function relative(from: string, to: string): string; + /** + * Return the directory name of a path. Similar to the Unix dirname command. + * + * @param p the path to evaluate. + */ export function dirname(p: string): string; + /** + * Return the last portion of a path. Similar to the Unix basename command. + * Often used to extract the file name from a fully qualified path. + * + * @param p the path to evaluate. + * @param ext optionally, an extension to remove from the result. + */ export function basename(p: string, ext?: string): string; + /** + * Return the extension of the path, from the last '.' to end of string in the last portion of the path. + * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string + * + * @param p the path to evaluate. + */ export function extname(p: string): string; + /** + * The platform-specific file separator. '\\' or '/'. + */ export var sep: string; + /** + * The platform-specific file delimiter. ';' or ':'. + */ export var delimiter: string; - export function parse(p: string): ParsedPath; - export function format(pP: ParsedPath): string; + /** + * Returns an object from a path string - the opposite of format(). + * + * @param pathString path to evaluate. + */ + export function parse(pathString: string): ParsedPath; + /** + * Returns a path string from an object - the opposite of parse(). + * + * @param pathString path to evaluate. + */ + export function format(pathObject: ParsedPath): string; + + export module posix { + export function normalize(p: string): string; + export function join(...paths: any[]): string; + export function resolve(...pathSegments: any[]): string; + export function isAbsolute(p: string): boolean; + export function relative(from: string, to: string): string; + export function dirname(p: string): string; + export function basename(p: string, ext?: string): string; + export function extname(p: string): string; + export var sep: string; + export var delimiter: string; + export function parse(p: string): ParsedPath; + export function format(pP: ParsedPath): string; + } + + export module win32 { + export function normalize(p: string): string; + export function join(...paths: any[]): string; + export function resolve(...pathSegments: any[]): string; + export function isAbsolute(p: string): boolean; + export function relative(from: string, to: string): string; + export function dirname(p: string): string; + export function basename(p: string, ext?: string): string; + export function extname(p: string): string; + export var sep: string; + export var delimiter: string; + export function parse(p: string): ParsedPath; + export function format(pP: ParsedPath): string; + } } declare module "string_decoder" { @@ -1034,9 +1479,9 @@ declare module "string_decoder" { } declare module "tls" { - import crypto = require("crypto"); - import net = require("net"); - import stream = require("stream"); + import * as crypto from "crypto"; + import * as net from "net"; + import * as stream from "stream"; var CLIENT_RENEG_LIMIT: number; var CLIENT_RENEG_WINDOW: number; @@ -1110,11 +1555,27 @@ declare module "tls" { cleartext: any; } + export interface SecureContextOptions { + pfx?: any; //string | buffer + key?: any; //string | buffer + passphrase?: string; + cert?: any; // string | buffer + ca?: any; // string | buffer + crl?: any; // string | string[] + ciphers?: string; + honorCipherOrder?: boolean; + } + + export interface SecureContext { + context: any; + } + export function createServer(options: TlsOptions, secureConnectionListener?: (cleartextStream: ClearTextStream) =>void ): Server; export function connect(options: TlsOptions, secureConnectionListener?: () =>void ): ClearTextStream; export function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream; export function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream; export function createSecurePair(credentials?: crypto.Credentials, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair; + export function createSecureContext(details: SecureContextOptions): SecureContext; } declare module "crypto" { @@ -1163,12 +1624,12 @@ declare module "crypto" { setAutoPadding(auto_padding: boolean): void; } export function createSign(algorithm: string): Signer; - interface Signer { + interface Signer extends NodeJS.WritableStream { update(data: any): void; sign(private_key: string, output_format: string): string; } export function createVerify(algorith: string): Verify; - interface Verify { + interface Verify extends NodeJS.WritableStream { update(data: any): void; verify(object: string, signature: string, signature_format?: string): boolean; } @@ -1186,7 +1647,9 @@ declare module "crypto" { } export function getDiffieHellman(group_name: string): DiffieHellman; export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; + export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void; export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number) : Buffer; + export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number, digest: string) : Buffer; export function randomBytes(size: number): Buffer; export function randomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void; export function pseudoRandomBytes(size: number): Buffer; @@ -1194,7 +1657,7 @@ declare module "crypto" { } declare module "stream" { - import events = require("events"); + import * as events from "events"; export interface Stream extends events.EventEmitter { pipe(destination: T, options?: { end?: boolean; }): T; @@ -1216,8 +1679,7 @@ declare module "stream" { resume(): void; pipe(destination: T, options?: { end?: boolean; }): T; unpipe(destination?: T): void; - unshift(chunk: string): void; - unshift(chunk: Buffer): void; + unshift(chunk: any): void; wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream; push(chunk: any, encoding?: string): boolean; } @@ -1225,20 +1687,18 @@ declare module "stream" { export interface WritableOptions { highWaterMark?: number; decodeStrings?: boolean; + objectMode?: boolean; } export class Writable extends events.EventEmitter implements NodeJS.WritableStream { writable: boolean; constructor(opts?: WritableOptions); - _write(data: Buffer, encoding: string, callback: Function): void; - _write(data: string, encoding: string, callback: Function): void; - write(buffer: Buffer, cb?: Function): boolean; - write(str: string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; + _write(chunk: any, encoding: string, callback: Function): void; + write(chunk: any, cb?: Function): boolean; + write(chunk: any, encoding?: string, cb?: Function): boolean; end(): void; - end(buffer: Buffer, cb?: Function): void; - end(str: string, cb?: Function): void; - end(str: string, encoding?: string, cb?: Function): void; + end(chunk: any, cb?: Function): void; + end(chunk: any, encoding?: string, cb?: Function): void; } export interface DuplexOptions extends ReadableOptions, WritableOptions { @@ -1249,15 +1709,12 @@ declare module "stream" { export class Duplex extends Readable implements NodeJS.ReadWriteStream { writable: boolean; constructor(opts?: DuplexOptions); - _write(data: Buffer, encoding: string, callback: Function): void; - _write(data: string, encoding: string, callback: Function): void; - write(buffer: Buffer, cb?: Function): boolean; - write(str: string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; + _write(chunk: any, encoding: string, callback: Function): void; + write(chunk: any, cb?: Function): boolean; + write(chunk: any, encoding?: string, cb?: Function): boolean; end(): void; - end(buffer: Buffer, cb?: Function): void; - end(str: string, cb?: Function): void; - end(str: string, encoding?: string, cb?: Function): void; + end(chunk: any, cb?: Function): void; + end(chunk: any, encoding?: string, cb?: Function): void; } export interface TransformOptions extends ReadableOptions, WritableOptions {} @@ -1267,8 +1724,7 @@ declare module "stream" { readable: boolean; writable: boolean; constructor(opts?: TransformOptions); - _transform(chunk: Buffer, encoding: string, callback: Function): void; - _transform(chunk: string, encoding: string, callback: Function): void; + _transform(chunk: any, encoding: string, callback: Function): void; _flush(callback: Function): void; read(size?: number): any; setEncoding(encoding: string): void; @@ -1276,17 +1732,14 @@ declare module "stream" { resume(): void; pipe(destination: T, options?: { end?: boolean; }): T; unpipe(destination?: T): void; - unshift(chunk: string): void; - unshift(chunk: Buffer): void; + unshift(chunk: any): void; wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream; push(chunk: any, encoding?: string): boolean; - write(buffer: Buffer, cb?: Function): boolean; - write(str: string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; + write(chunk: any, cb?: Function): boolean; + write(chunk: any, encoding?: string, cb?: Function): boolean; end(): void; - end(buffer: Buffer, cb?: Function): void; - end(str: string, cb?: Function): void; - end(str: string, encoding?: string, cb?: Function): void; + end(chunk: any, cb?: Function): void; + end(chunk: any, encoding?: string, cb?: Function): void; } export class PassThrough extends Transform {} @@ -1313,6 +1766,7 @@ declare module "util" { export function isDate(object: any): boolean; export function isError(object: any): boolean; export function inherits(constructor: any, superConstructor: any): void; + export function debuglog(key:string): (msg:string,...param: any[])=>void; } declare module "assert" { @@ -1359,7 +1813,7 @@ declare module "assert" { } declare module "tty" { - import net = require("net"); + import * as net from "net"; export function isatty(fd: number): boolean; export interface ReadStream extends net.Socket { @@ -1373,7 +1827,7 @@ declare module "tty" { } declare module "domain" { - import events = require("events"); + import * as events from "events"; export class Domain extends events.EventEmitter { run(fn: Function): void; @@ -1392,3 +1846,227 @@ declare module "domain" { export function create(): Domain; } + +declare module "constants" { + export var E2BIG: number; + export var EACCES: number; + export var EADDRINUSE: number; + export var EADDRNOTAVAIL: number; + export var EAFNOSUPPORT: number; + export var EAGAIN: number; + export var EALREADY: number; + export var EBADF: number; + export var EBADMSG: number; + export var EBUSY: number; + export var ECANCELED: number; + export var ECHILD: number; + export var ECONNABORTED: number; + export var ECONNREFUSED: number; + export var ECONNRESET: number; + export var EDEADLK: number; + export var EDESTADDRREQ: number; + export var EDOM: number; + export var EEXIST: number; + export var EFAULT: number; + export var EFBIG: number; + export var EHOSTUNREACH: number; + export var EIDRM: number; + export var EILSEQ: number; + export var EINPROGRESS: number; + export var EINTR: number; + export var EINVAL: number; + export var EIO: number; + export var EISCONN: number; + export var EISDIR: number; + export var ELOOP: number; + export var EMFILE: number; + export var EMLINK: number; + export var EMSGSIZE: number; + export var ENAMETOOLONG: number; + export var ENETDOWN: number; + export var ENETRESET: number; + export var ENETUNREACH: number; + export var ENFILE: number; + export var ENOBUFS: number; + export var ENODATA: number; + export var ENODEV: number; + export var ENOENT: number; + export var ENOEXEC: number; + export var ENOLCK: number; + export var ENOLINK: number; + export var ENOMEM: number; + export var ENOMSG: number; + export var ENOPROTOOPT: number; + export var ENOSPC: number; + export var ENOSR: number; + export var ENOSTR: number; + export var ENOSYS: number; + export var ENOTCONN: number; + export var ENOTDIR: number; + export var ENOTEMPTY: number; + export var ENOTSOCK: number; + export var ENOTSUP: number; + export var ENOTTY: number; + export var ENXIO: number; + export var EOPNOTSUPP: number; + export var EOVERFLOW: number; + export var EPERM: number; + export var EPIPE: number; + export var EPROTO: number; + export var EPROTONOSUPPORT: number; + export var EPROTOTYPE: number; + export var ERANGE: number; + export var EROFS: number; + export var ESPIPE: number; + export var ESRCH: number; + export var ETIME: number; + export var ETIMEDOUT: number; + export var ETXTBSY: number; + export var EWOULDBLOCK: number; + export var EXDEV: number; + export var WSAEINTR: number; + export var WSAEBADF: number; + export var WSAEACCES: number; + export var WSAEFAULT: number; + export var WSAEINVAL: number; + export var WSAEMFILE: number; + export var WSAEWOULDBLOCK: number; + export var WSAEINPROGRESS: number; + export var WSAEALREADY: number; + export var WSAENOTSOCK: number; + export var WSAEDESTADDRREQ: number; + export var WSAEMSGSIZE: number; + export var WSAEPROTOTYPE: number; + export var WSAENOPROTOOPT: number; + export var WSAEPROTONOSUPPORT: number; + export var WSAESOCKTNOSUPPORT: number; + export var WSAEOPNOTSUPP: number; + export var WSAEPFNOSUPPORT: number; + export var WSAEAFNOSUPPORT: number; + export var WSAEADDRINUSE: number; + export var WSAEADDRNOTAVAIL: number; + export var WSAENETDOWN: number; + export var WSAENETUNREACH: number; + export var WSAENETRESET: number; + export var WSAECONNABORTED: number; + export var WSAECONNRESET: number; + export var WSAENOBUFS: number; + export var WSAEISCONN: number; + export var WSAENOTCONN: number; + export var WSAESHUTDOWN: number; + export var WSAETOOMANYREFS: number; + export var WSAETIMEDOUT: number; + export var WSAECONNREFUSED: number; + export var WSAELOOP: number; + export var WSAENAMETOOLONG: number; + export var WSAEHOSTDOWN: number; + export var WSAEHOSTUNREACH: number; + export var WSAENOTEMPTY: number; + export var WSAEPROCLIM: number; + export var WSAEUSERS: number; + export var WSAEDQUOT: number; + export var WSAESTALE: number; + export var WSAEREMOTE: number; + export var WSASYSNOTREADY: number; + export var WSAVERNOTSUPPORTED: number; + export var WSANOTINITIALISED: number; + export var WSAEDISCON: number; + export var WSAENOMORE: number; + export var WSAECANCELLED: number; + export var WSAEINVALIDPROCTABLE: number; + export var WSAEINVALIDPROVIDER: number; + export var WSAEPROVIDERFAILEDINIT: number; + export var WSASYSCALLFAILURE: number; + export var WSASERVICE_NOT_FOUND: number; + export var WSATYPE_NOT_FOUND: number; + export var WSA_E_NO_MORE: number; + export var WSA_E_CANCELLED: number; + export var WSAEREFUSED: number; + export var SIGHUP: number; + export var SIGINT: number; + export var SIGILL: number; + export var SIGABRT: number; + export var SIGFPE: number; + export var SIGKILL: number; + export var SIGSEGV: number; + export var SIGTERM: number; + export var SIGBREAK: number; + export var SIGWINCH: number; + export var SSL_OP_ALL: number; + export var SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number; + export var SSL_OP_CIPHER_SERVER_PREFERENCE: number; + export var SSL_OP_CISCO_ANYCONNECT: number; + export var SSL_OP_COOKIE_EXCHANGE: number; + export var SSL_OP_CRYPTOPRO_TLSEXT_BUG: number; + export var SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number; + export var SSL_OP_EPHEMERAL_RSA: number; + export var SSL_OP_LEGACY_SERVER_CONNECT: number; + export var SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: number; + export var SSL_OP_MICROSOFT_SESS_ID_BUG: number; + export var SSL_OP_MSIE_SSLV2_RSA_PADDING: number; + export var SSL_OP_NETSCAPE_CA_DN_BUG: number; + export var SSL_OP_NETSCAPE_CHALLENGE_BUG: number; + export var SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG: number; + export var SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: number; + export var SSL_OP_NO_COMPRESSION: number; + export var SSL_OP_NO_QUERY_MTU: number; + export var SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number; + export var SSL_OP_NO_SSLv2: number; + export var SSL_OP_NO_SSLv3: number; + export var SSL_OP_NO_TICKET: number; + export var SSL_OP_NO_TLSv1: number; + export var SSL_OP_NO_TLSv1_1: number; + export var SSL_OP_NO_TLSv1_2: number; + export var SSL_OP_PKCS1_CHECK_1: number; + export var SSL_OP_PKCS1_CHECK_2: number; + export var SSL_OP_SINGLE_DH_USE: number; + export var SSL_OP_SINGLE_ECDH_USE: number; + export var SSL_OP_SSLEAY_080_CLIENT_DH_BUG: number; + export var SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG: number; + export var SSL_OP_TLS_BLOCK_PADDING_BUG: number; + export var SSL_OP_TLS_D5_BUG: number; + export var SSL_OP_TLS_ROLLBACK_BUG: number; + export var ENGINE_METHOD_DSA: number; + export var ENGINE_METHOD_DH: number; + export var ENGINE_METHOD_RAND: number; + export var ENGINE_METHOD_ECDH: number; + export var ENGINE_METHOD_ECDSA: number; + export var ENGINE_METHOD_CIPHERS: number; + export var ENGINE_METHOD_DIGESTS: number; + export var ENGINE_METHOD_STORE: number; + export var ENGINE_METHOD_PKEY_METHS: number; + export var ENGINE_METHOD_PKEY_ASN1_METHS: number; + export var ENGINE_METHOD_ALL: number; + export var ENGINE_METHOD_NONE: number; + export var DH_CHECK_P_NOT_SAFE_PRIME: number; + export var DH_CHECK_P_NOT_PRIME: number; + export var DH_UNABLE_TO_CHECK_GENERATOR: number; + export var DH_NOT_SUITABLE_GENERATOR: number; + export var NPN_ENABLED: number; + export var RSA_PKCS1_PADDING: number; + export var RSA_SSLV23_PADDING: number; + export var RSA_NO_PADDING: number; + export var RSA_PKCS1_OAEP_PADDING: number; + export var RSA_X931_PADDING: number; + export var RSA_PKCS1_PSS_PADDING: number; + export var POINT_CONVERSION_COMPRESSED: number; + export var POINT_CONVERSION_UNCOMPRESSED: number; + export var POINT_CONVERSION_HYBRID: number; + export var O_RDONLY: number; + export var O_WRONLY: number; + export var O_RDWR: number; + export var S_IFMT: number; + export var S_IFREG: number; + export var S_IFDIR: number; + export var S_IFCHR: number; + export var S_IFLNK: number; + export var O_CREAT: number; + export var O_EXCL: number; + export var O_TRUNC: number; + export var O_APPEND: number; + export var F_OK: number; + export var R_OK: number; + export var W_OK: number; + export var X_OK: number; + export var UV_UDP_REUSEADDR: number; +} diff --git a/lib/typings/q/Q.d.ts b/lib/typings/q/Q.d.ts index 590fd92ad..bd5a6f4bf 100644 --- a/lib/typings/q/Q.d.ts +++ b/lib/typings/q/Q.d.ts @@ -1,317 +1,317 @@ -// Type definitions for Q -// Project: https://github.com/kriskowal/q -// Definitions by: Barrie Nemetchek , Andrew Gaspar , John Reilly -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/** - * If value is a Q promise, returns the promise. - * If value is a promise from another library it is coerced into a Q promise (where possible). - */ -declare function Q(promise: Q.IPromise): Q.Promise; -/** - * If value is not a promise, returns a promise that is fulfilled with value. - */ -declare function Q(value: T): Q.Promise; - -declare module Q { - interface IPromise { - then(onFulfill?: (value: T) => U | IPromise, onReject?: (error: any) => U | IPromise): IPromise; - } - - interface Deferred { - promise: Promise; - resolve(value: T): void; - reject(reason: any): void; - notify(value: any): void; - makeNodeResolver(): (reason: any, value: T) => void; - } - - interface Promise { - /** - * Like a finally clause, allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful for collecting resources regardless of whether a job succeeded, like closing a database connection, shutting a server down, or deleting an unneeded key from an object. - - * finally returns a promise, which will become resolved with the same fulfillment value or rejection reason as promise. However, if callback returns a promise, the resolution of the returned promise will be delayed until the promise returned from callback is finished. - */ - fin(finallyCallback: () => any): Promise; - /** - * Like a finally clause, allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful for collecting resources regardless of whether a job succeeded, like closing a database connection, shutting a server down, or deleting an unneeded key from an object. - - * finally returns a promise, which will become resolved with the same fulfillment value or rejection reason as promise. However, if callback returns a promise, the resolution of the returned promise will be delayed until the promise returned from callback is finished. - */ - finally(finallyCallback: () => any): Promise; - - /** - * The then method from the Promises/A+ specification, with an additional progress handler. - */ - then(onFulfill?: (value: T) => U | IPromise, onReject?: (error: any) => U | IPromise, onProgress?: Function): Promise; - - /** - * Like then, but "spreads" the array into a variadic fulfillment handler. If any of the promises in the array are rejected, instead calls onRejected with the first rejected promise's rejection reason. - * - * This is especially useful in conjunction with all - */ - spread(onFulfilled: Function, onRejected?: Function): Promise; - - fail(onRejected: (reason: any) => U | IPromise): Promise; - - /** - * A sugar method, equivalent to promise.then(undefined, onRejected). - */ - catch(onRejected: (reason: any) => U | IPromise): Promise; - - /** - * A sugar method, equivalent to promise.then(undefined, undefined, onProgress). - */ - progress(onProgress: (progress: any) => any): Promise; - - /** - * Much like then, but with different behavior around unhandled rejection. If there is an unhandled rejection, either because promise is rejected and no onRejected callback was provided, or because onFulfilled or onRejected threw an error or returned a rejected promise, the resulting rejection reason is thrown as an exception in a future turn of the event loop. - * - * This method should be used to terminate chains of promises that will not be passed elsewhere. Since exceptions thrown in then callbacks are consumed and transformed into rejections, exceptions at the end of the chain are easy to accidentally, silently ignore. By arranging for the exception to be thrown in a future turn of the event loop, so that it won't be caught, it causes an onerror event on the browser window, or an uncaughtException event on Node.js's process object. - * - * Exceptions thrown by done will have long stack traces, if Q.longStackSupport is set to true. If Q.onerror is set, exceptions will be delivered there instead of thrown in a future turn. - * - * The Golden Rule of done vs. then usage is: either return your promise to someone else, or if the chain ends with you, call done to terminate it. - */ - done(onFulfilled?: (value: T) => any, onRejected?: (reason: any) => any, onProgress?: (progress: any) => any): void; - - /** - * If callback is a function, assumes it's a Node.js-style callback, and calls it as either callback(rejectionReason) when/if promise becomes rejected, or as callback(null, fulfillmentValue) when/if promise becomes fulfilled. If callback is not a function, simply returns promise. - */ - nodeify(callback: (reason: any, value: any) => void): Promise; - - /** - * Returns a promise to get the named property of an object. Essentially equivalent to - * - * promise.then(function (o) { - * return o[propertyName]; - * }); - */ - get(propertyName: String): Promise; - set(propertyName: String, value: any): Promise; - delete(propertyName: String): Promise; - /** - * Returns a promise for the result of calling the named method of an object with the given array of arguments. The object itself is this in the function, just like a synchronous method call. Essentially equivalent to - * - * promise.then(function (o) { - * return o[methodName].apply(o, args); - * }); - */ - post(methodName: String, args: any[]): Promise; - /** - * Returns a promise for the result of calling the named method of an object with the given variadic arguments. The object itself is this in the function, just like a synchronous method call. - */ - invoke(methodName: String, ...args: any[]): Promise; - fapply(args: any[]): Promise; - fcall(...args: any[]): Promise; - - /** - * Returns a promise for an array of the property names of an object. Essentially equivalent to - * - * promise.then(function (o) { - * return Object.keys(o); - * }); - */ - keys(): Promise; - - /** - * A sugar method, equivalent to promise.then(function () { return value; }). - */ - thenResolve(value: U): Promise; - /** - * A sugar method, equivalent to promise.then(function () { throw reason; }). - */ - thenReject(reason: any): Promise; - timeout(ms: number, message?: string): Promise; - /** - * Returns a promise that will have the same result as promise, but will only be fulfilled or rejected after at least ms milliseconds have passed. - */ - delay(ms: number): Promise; - - /** - * Returns whether a given promise is in the fulfilled state. When the static version is used on non-promises, the result is always true. - */ - isFulfilled(): boolean; - /** - * Returns whether a given promise is in the rejected state. When the static version is used on non-promises, the result is always false. - */ - isRejected(): boolean; - /** - * Returns whether a given promise is in the pending state. When the static version is used on non-promises, the result is always false. - */ - isPending(): boolean; - - valueOf(): any; - - /** - * Returns a "state snapshot" object, which will be in one of three forms: - * - * - { state: "pending" } - * - { state: "fulfilled", value: } - * - { state: "rejected", reason: } - */ - inspect(): PromiseState; - } - - interface PromiseState { - /** - * "fulfilled", "rejected", "pending" - */ - state: string; - value?: T; - reason?: any; - } - - // If no value provided, returned promise will be of void type - export function when(): Promise; - - // if no fulfill, reject, or progress provided, returned promise will be of same type - export function when(value: T | IPromise): Promise; - - // If a non-promise value is provided, it will not reject or progress - export function when(value: T | IPromise, onFulfilled: (val: T) => U | IPromise, onRejected?: (reason: any) => U | IPromise, onProgress?: (progress: any) => any): Promise; - - /** - * Currently "impossible" (and I use the term loosely) to implement due to TypeScript limitations as it is now. - * See: https://github.com/Microsoft/TypeScript/issues/1784 for discussion on it. - */ - // export function try(method: Function, ...args: any[]): Promise; - - export function fbind(method: (...args: any[]) => T | IPromise, ...args: any[]): (...args: any[]) => Promise; - - export function fcall(method: (...args: any[]) => T, ...args: any[]): Promise; - - export function send(obj: any, functionName: string, ...args: any[]): Promise; - export function invoke(obj: any, functionName: string, ...args: any[]): Promise; - export function mcall(obj: any, functionName: string, ...args: any[]): Promise; - - export function denodeify(nodeFunction: Function, ...args: any[]): (...args: any[]) => Promise; - export function nbind(nodeFunction: Function, thisArg: any, ...args: any[]): (...args: any[]) => Promise; - export function nfbind(nodeFunction: Function, ...args: any[]): (...args: any[]) => Promise; - export function nfcall(nodeFunction: Function, ...args: any[]): Promise; - export function nfapply(nodeFunction: Function, args: any[]): Promise; - - export function ninvoke(nodeModule: any, functionName: string, ...args: any[]): Promise; - export function npost(nodeModule: any, functionName: string, args: any[]): Promise; - export function nsend(nodeModule: any, functionName: string, ...args: any[]): Promise; - export function nmcall(nodeModule: any, functionName: string, ...args: any[]): Promise; - - /** - * Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected. - */ - export function all(promises: IPromise[]): Promise; - - /** - * Returns a promise that is fulfilled with an array of promise state snapshots, but only after all the original promises have settled, i.e. become either fulfilled or rejected. - */ - export function allSettled(promises: IPromise[]): Promise[]>; - - export function allResolved(promises: IPromise[]): Promise[]>; - - /** - * Like then, but "spreads" the array into a variadic fulfillment handler. If any of the promises in the array are rejected, instead calls onRejected with the first rejected promise's rejection reason. - * This is especially useful in conjunction with all. - */ - export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => U | IPromise, onRejected?: (reason: any) => U | IPromise): Promise; - - /** - * Returns a promise that will have the same result as promise, except that if promise is not fulfilled or rejected before ms milliseconds, the returned promise will be rejected with an Error with the given message. If message is not supplied, the message will be "Timed out after " + ms + " ms". - */ - export function timeout(promise: Promise, ms: number, message?: string): Promise; - - /** - * Returns a promise that will have the same result as promise, but will only be fulfilled or rejected after at least ms milliseconds have passed. - */ - export function delay(promise: Promise, ms: number): Promise; - /** - * Returns a promise that will have the same result as promise, but will only be fulfilled or rejected after at least ms milliseconds have passed. - */ - export function delay(value: T, ms: number): Promise; - /** - * Returns a promise that will be fulfilled with undefined after at least ms milliseconds have passed. - */ - export function delay(ms: number): Promise ; - /** - * Returns whether a given promise is in the fulfilled state. When the static version is used on non-promises, the result is always true. - */ - export function isFulfilled(promise: Promise): boolean; - /** - * Returns whether a given promise is in the rejected state. When the static version is used on non-promises, the result is always false. - */ - export function isRejected(promise: Promise): boolean; - /** - * Returns whether a given promise is in the pending state. When the static version is used on non-promises, the result is always false. - */ - export function isPending(promise: Promise): boolean; - - /** - * Returns a "deferred" object with a: - * promise property - * resolve(value) method - * reject(reason) method - * notify(value) method - * makeNodeResolver() method - */ - export function defer(): Deferred; - - /** - * Returns a promise that is rejected with reason. - */ - export function reject(reason?: any): Promise; - - export function Promise(resolver: (resolve: (val: T | IPromise) => void , reject: (reason: any) => void , notify: (progress: any) => void ) => void ): Promise; - - /** - * Creates a new version of func that accepts any combination of promise and non-promise values, converting them to their fulfillment values before calling the original func. The returned version also always returns a promise: if func does a return or throw, then Q.promised(func) will return fulfilled or rejected promise, respectively. - * - * This can be useful for creating functions that accept either promises or non-promise values, and for ensuring that the function always returns a promise even in the face of unintentional thrown exceptions. - */ - export function promised(callback: (...args: any[]) => T): (...args: any[]) => Promise; - - /** - * Returns whether the given value is a Q promise. - */ - export function isPromise(object: any): boolean; - /** - * Returns whether the given value is a promise (i.e. it's an object with a then function). - */ - export function isPromiseAlike(object: any): boolean; - /** - * Returns whether a given promise is in the pending state. When the static version is used on non-promises, the result is always false. - */ - export function isPending(object: any): boolean; - - /** - * This is an experimental tool for converting a generator function into a deferred function. This has the potential of reducing nested callbacks in engines that support yield. - */ - export function async(generatorFunction: any): (...args: any[]) => Promise; - export function nextTick(callback: Function): void; - - /** - * A settable property that will intercept any uncaught errors that would otherwise be thrown in the next tick of the event loop, usually as a result of done. Can be useful for getting the full stack trace of an error in browsers, which is not usually possible with window.onerror. - */ - export var onerror: (reason: any) => void; - /** - * A settable property that lets you turn on long stack trace support. If turned on, "stack jumps" will be tracked across asynchronous promise operations, so that if an uncaught error is thrown by done or a rejection reason's stack property is inspected in a rejection callback, a long stack trace is produced. - */ - export var longStackSupport: boolean; - - /** - * Calling resolve with a pending promise causes promise to wait on the passed promise, becoming fulfilled with its fulfillment value or rejected with its rejection reason (or staying pending forever, if the passed promise does). - * Calling resolve with a rejected promise causes promise to be rejected with the passed promise's rejection reason. - * Calling resolve with a fulfilled promise causes promise to be fulfilled with the passed promise's fulfillment value. - * Calling resolve with a non-promise value causes promise to be fulfilled with that value. - */ - export function resolve(object: IPromise): Promise; - /** - * Calling resolve with a pending promise causes promise to wait on the passed promise, becoming fulfilled with its fulfillment value or rejected with its rejection reason (or staying pending forever, if the passed promise does). - * Calling resolve with a rejected promise causes promise to be rejected with the passed promise's rejection reason. - * Calling resolve with a fulfilled promise causes promise to be fulfilled with the passed promise's fulfillment value. - * Calling resolve with a non-promise value causes promise to be fulfilled with that value. - */ - export function resolve(object: T): Promise; -} - -declare module "q" { - export = Q; -} +// Type definitions for Q +// Project: https://github.com/kriskowal/q +// Definitions by: Barrie Nemetchek , Andrew Gaspar , John Reilly +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** + * If value is a Q promise, returns the promise. + * If value is a promise from another library it is coerced into a Q promise (where possible). + */ +declare function Q(promise: Q.IPromise): Q.Promise; +/** + * If value is not a promise, returns a promise that is fulfilled with value. + */ +declare function Q(value: T): Q.Promise; + +declare module Q { + interface IPromise { + then(onFulfill?: (value: T) => U | IPromise, onReject?: (error: any) => U | IPromise): IPromise; + } + + interface Deferred { + promise: Promise; + resolve(value: T): void; + reject(reason: any): void; + notify(value: any): void; + makeNodeResolver(): (reason: any, value: T) => void; + } + + interface Promise { + /** + * Like a finally clause, allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful for collecting resources regardless of whether a job succeeded, like closing a database connection, shutting a server down, or deleting an unneeded key from an object. + + * finally returns a promise, which will become resolved with the same fulfillment value or rejection reason as promise. However, if callback returns a promise, the resolution of the returned promise will be delayed until the promise returned from callback is finished. + */ + fin(finallyCallback: () => any): Promise; + /** + * Like a finally clause, allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful for collecting resources regardless of whether a job succeeded, like closing a database connection, shutting a server down, or deleting an unneeded key from an object. + + * finally returns a promise, which will become resolved with the same fulfillment value or rejection reason as promise. However, if callback returns a promise, the resolution of the returned promise will be delayed until the promise returned from callback is finished. + */ + finally(finallyCallback: () => any): Promise; + + /** + * The then method from the Promises/A+ specification, with an additional progress handler. + */ + then(onFulfill?: (value: T) => U | IPromise, onReject?: (error: any) => U | IPromise, onProgress?: Function): Promise; + + /** + * Like then, but "spreads" the array into a variadic fulfillment handler. If any of the promises in the array are rejected, instead calls onRejected with the first rejected promise's rejection reason. + * + * This is especially useful in conjunction with all + */ + spread(onFulfilled: Function, onRejected?: Function): Promise; + + fail(onRejected: (reason: any) => U | IPromise): Promise; + + /** + * A sugar method, equivalent to promise.then(undefined, onRejected). + */ + catch(onRejected: (reason: any) => U | IPromise): Promise; + + /** + * A sugar method, equivalent to promise.then(undefined, undefined, onProgress). + */ + progress(onProgress: (progress: any) => any): Promise; + + /** + * Much like then, but with different behavior around unhandled rejection. If there is an unhandled rejection, either because promise is rejected and no onRejected callback was provided, or because onFulfilled or onRejected threw an error or returned a rejected promise, the resulting rejection reason is thrown as an exception in a future turn of the event loop. + * + * This method should be used to terminate chains of promises that will not be passed elsewhere. Since exceptions thrown in then callbacks are consumed and transformed into rejections, exceptions at the end of the chain are easy to accidentally, silently ignore. By arranging for the exception to be thrown in a future turn of the event loop, so that it won't be caught, it causes an onerror event on the browser window, or an uncaughtException event on Node.js's process object. + * + * Exceptions thrown by done will have long stack traces, if Q.longStackSupport is set to true. If Q.onerror is set, exceptions will be delivered there instead of thrown in a future turn. + * + * The Golden Rule of done vs. then usage is: either return your promise to someone else, or if the chain ends with you, call done to terminate it. + */ + done(onFulfilled?: (value: T) => any, onRejected?: (reason: any) => any, onProgress?: (progress: any) => any): void; + + /** + * If callback is a function, assumes it's a Node.js-style callback, and calls it as either callback(rejectionReason) when/if promise becomes rejected, or as callback(null, fulfillmentValue) when/if promise becomes fulfilled. If callback is not a function, simply returns promise. + */ + nodeify(callback: (reason: any, value: any) => void): Promise; + + /** + * Returns a promise to get the named property of an object. Essentially equivalent to + * + * promise.then(function (o) { + * return o[propertyName]; + * }); + */ + get(propertyName: String): Promise; + set(propertyName: String, value: any): Promise; + delete(propertyName: String): Promise; + /** + * Returns a promise for the result of calling the named method of an object with the given array of arguments. The object itself is this in the function, just like a synchronous method call. Essentially equivalent to + * + * promise.then(function (o) { + * return o[methodName].apply(o, args); + * }); + */ + post(methodName: String, args: any[]): Promise; + /** + * Returns a promise for the result of calling the named method of an object with the given variadic arguments. The object itself is this in the function, just like a synchronous method call. + */ + invoke(methodName: String, ...args: any[]): Promise; + fapply(args: any[]): Promise; + fcall(...args: any[]): Promise; + + /** + * Returns a promise for an array of the property names of an object. Essentially equivalent to + * + * promise.then(function (o) { + * return Object.keys(o); + * }); + */ + keys(): Promise; + + /** + * A sugar method, equivalent to promise.then(function () { return value; }). + */ + thenResolve(value: U): Promise; + /** + * A sugar method, equivalent to promise.then(function () { throw reason; }). + */ + thenReject(reason: any): Promise; + timeout(ms: number, message?: string): Promise; + /** + * Returns a promise that will have the same result as promise, but will only be fulfilled or rejected after at least ms milliseconds have passed. + */ + delay(ms: number): Promise; + + /** + * Returns whether a given promise is in the fulfilled state. When the static version is used on non-promises, the result is always true. + */ + isFulfilled(): boolean; + /** + * Returns whether a given promise is in the rejected state. When the static version is used on non-promises, the result is always false. + */ + isRejected(): boolean; + /** + * Returns whether a given promise is in the pending state. When the static version is used on non-promises, the result is always false. + */ + isPending(): boolean; + + valueOf(): any; + + /** + * Returns a "state snapshot" object, which will be in one of three forms: + * + * - { state: "pending" } + * - { state: "fulfilled", value: } + * - { state: "rejected", reason: } + */ + inspect(): PromiseState; + } + + interface PromiseState { + /** + * "fulfilled", "rejected", "pending" + */ + state: string; + value?: T; + reason?: any; + } + + // If no value provided, returned promise will be of void type + export function when(): Promise; + + // if no fulfill, reject, or progress provided, returned promise will be of same type + export function when(value: T | IPromise): Promise; + + // If a non-promise value is provided, it will not reject or progress + export function when(value: T | IPromise, onFulfilled: (val: T) => U | IPromise, onRejected?: (reason: any) => U | IPromise, onProgress?: (progress: any) => any): Promise; + + /** + * Currently "impossible" (and I use the term loosely) to implement due to TypeScript limitations as it is now. + * See: https://github.com/Microsoft/TypeScript/issues/1784 for discussion on it. + */ + // export function try(method: Function, ...args: any[]): Promise; + + export function fbind(method: (...args: any[]) => T | IPromise, ...args: any[]): (...args: any[]) => Promise; + + export function fcall(method: (...args: any[]) => T, ...args: any[]): Promise; + + export function send(obj: any, functionName: string, ...args: any[]): Promise; + export function invoke(obj: any, functionName: string, ...args: any[]): Promise; + export function mcall(obj: any, functionName: string, ...args: any[]): Promise; + + export function denodeify(nodeFunction: Function, ...args: any[]): (...args: any[]) => Promise; + export function nbind(nodeFunction: Function, thisArg: any, ...args: any[]): (...args: any[]) => Promise; + export function nfbind(nodeFunction: Function, ...args: any[]): (...args: any[]) => Promise; + export function nfcall(nodeFunction: Function, ...args: any[]): Promise; + export function nfapply(nodeFunction: Function, args: any[]): Promise; + + export function ninvoke(nodeModule: any, functionName: string, ...args: any[]): Promise; + export function npost(nodeModule: any, functionName: string, args: any[]): Promise; + export function nsend(nodeModule: any, functionName: string, ...args: any[]): Promise; + export function nmcall(nodeModule: any, functionName: string, ...args: any[]): Promise; + + /** + * Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected. + */ + export function all(promises: IPromise[]): Promise; + + /** + * Returns a promise that is fulfilled with an array of promise state snapshots, but only after all the original promises have settled, i.e. become either fulfilled or rejected. + */ + export function allSettled(promises: IPromise[]): Promise[]>; + + export function allResolved(promises: IPromise[]): Promise[]>; + + /** + * Like then, but "spreads" the array into a variadic fulfillment handler. If any of the promises in the array are rejected, instead calls onRejected with the first rejected promise's rejection reason. + * This is especially useful in conjunction with all. + */ + export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => U | IPromise, onRejected?: (reason: any) => U | IPromise): Promise; + + /** + * Returns a promise that will have the same result as promise, except that if promise is not fulfilled or rejected before ms milliseconds, the returned promise will be rejected with an Error with the given message. If message is not supplied, the message will be "Timed out after " + ms + " ms". + */ + export function timeout(promise: Promise, ms: number, message?: string): Promise; + + /** + * Returns a promise that will have the same result as promise, but will only be fulfilled or rejected after at least ms milliseconds have passed. + */ + export function delay(promise: Promise, ms: number): Promise; + /** + * Returns a promise that will have the same result as promise, but will only be fulfilled or rejected after at least ms milliseconds have passed. + */ + export function delay(value: T, ms: number): Promise; + /** + * Returns a promise that will be fulfilled with undefined after at least ms milliseconds have passed. + */ + export function delay(ms: number): Promise ; + /** + * Returns whether a given promise is in the fulfilled state. When the static version is used on non-promises, the result is always true. + */ + export function isFulfilled(promise: Promise): boolean; + /** + * Returns whether a given promise is in the rejected state. When the static version is used on non-promises, the result is always false. + */ + export function isRejected(promise: Promise): boolean; + /** + * Returns whether a given promise is in the pending state. When the static version is used on non-promises, the result is always false. + */ + export function isPending(promise: Promise): boolean; + + /** + * Returns a "deferred" object with a: + * promise property + * resolve(value) method + * reject(reason) method + * notify(value) method + * makeNodeResolver() method + */ + export function defer(): Deferred; + + /** + * Returns a promise that is rejected with reason. + */ + export function reject(reason?: any): Promise; + + export function Promise(resolver: (resolve: (val: T | IPromise) => void , reject: (reason: any) => void , notify: (progress: any) => void ) => void ): Promise; + + /** + * Creates a new version of func that accepts any combination of promise and non-promise values, converting them to their fulfillment values before calling the original func. The returned version also always returns a promise: if func does a return or throw, then Q.promised(func) will return fulfilled or rejected promise, respectively. + * + * This can be useful for creating functions that accept either promises or non-promise values, and for ensuring that the function always returns a promise even in the face of unintentional thrown exceptions. + */ + export function promised(callback: (...args: any[]) => T): (...args: any[]) => Promise; + + /** + * Returns whether the given value is a Q promise. + */ + export function isPromise(object: any): boolean; + /** + * Returns whether the given value is a promise (i.e. it's an object with a then function). + */ + export function isPromiseAlike(object: any): boolean; + /** + * Returns whether a given promise is in the pending state. When the static version is used on non-promises, the result is always false. + */ + export function isPending(object: any): boolean; + + /** + * This is an experimental tool for converting a generator function into a deferred function. This has the potential of reducing nested callbacks in engines that support yield. + */ + export function async(generatorFunction: any): (...args: any[]) => Promise; + export function nextTick(callback: Function): void; + + /** + * A settable property that will intercept any uncaught errors that would otherwise be thrown in the next tick of the event loop, usually as a result of done. Can be useful for getting the full stack trace of an error in browsers, which is not usually possible with window.onerror. + */ + export var onerror: (reason: any) => void; + /** + * A settable property that lets you turn on long stack trace support. If turned on, "stack jumps" will be tracked across asynchronous promise operations, so that if an uncaught error is thrown by done or a rejection reason's stack property is inspected in a rejection callback, a long stack trace is produced. + */ + export var longStackSupport: boolean; + + /** + * Calling resolve with a pending promise causes promise to wait on the passed promise, becoming fulfilled with its fulfillment value or rejected with its rejection reason (or staying pending forever, if the passed promise does). + * Calling resolve with a rejected promise causes promise to be rejected with the passed promise's rejection reason. + * Calling resolve with a fulfilled promise causes promise to be fulfilled with the passed promise's fulfillment value. + * Calling resolve with a non-promise value causes promise to be fulfilled with that value. + */ + export function resolve(object: IPromise): Promise; + /** + * Calling resolve with a pending promise causes promise to wait on the passed promise, becoming fulfilled with its fulfillment value or rejected with its rejection reason (or staying pending forever, if the passed promise does). + * Calling resolve with a rejected promise causes promise to be rejected with the passed promise's rejection reason. + * Calling resolve with a fulfilled promise causes promise to be fulfilled with the passed promise's fulfillment value. + * Calling resolve with a non-promise value causes promise to be fulfilled with that value. + */ + export function resolve(object: T): Promise; +} + +declare module "q" { + export = Q; +} diff --git a/lib/typings/source-map/source-map.d.ts b/lib/typings/source-map/source-map.d.ts deleted file mode 100644 index a1d8e208b..000000000 --- a/lib/typings/source-map/source-map.d.ts +++ /dev/null @@ -1,90 +0,0 @@ -// Type definitions for source-map v0.1.38 -// Project: https://github.com/mozilla/source-map -// Definitions by: Morten Houston Ludvigsen -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module SourceMap { - interface StartOfSourceMap { - file?: string; - sourceRoot?: string; - } - - interface RawSourceMap extends StartOfSourceMap { - version: string; - sources: Array; - names: Array; - sourcesContent?: string; - mappings: string; - } - - interface Position { - line: number; - column: number; - } - - interface MappedPosition extends Position { - source: string; - name?: string; - } - - interface MappingItem { - source: string; - generatedLine: number; - generatedColumn: number; - originalLine: number; - originalColumn: number; - name: string; - } - - interface Mapping { - generated: Position; - original: Position; - source: string; - name?: string; - } - - interface CodeWithSourceMap { - code: string; - map: SourceMapGenerator; - } - - class SourceMapConsumer { - public static GENERATED_ORDER: number; - public static ORIGINAL_ORDER: number; - - constructor(rawSourceMap: RawSourceMap); - public originalPositionFor(generatedPosition: Position): MappedPosition; - public generatedPositionFor(originalPosition: MappedPosition): Position; - public sourceContentFor(source: string): string; - public eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void; - } - - class SourceMapGenerator { - constructor(startOfSourceMap?: StartOfSourceMap); - public static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator; - public addMapping(mapping: Mapping): void; - public setSourceContent(sourceFile: string, sourceContent: string): void; - public applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void; - public toString(): string; - } - - class SourceNode { - constructor(); - constructor(line: number, column: number, source: string); - constructor(line: number, column: number, source: string, chunk?: string, name?: string); - public static fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode; - public add(chunk: string): void; - public prepend(chunk: string): void; - public setSourceContent(sourceFile: string, sourceContent: string): void; - public walk(fn: (chunk: string, mapping: MappedPosition) => void): void; - public walkSourceContents(fn: (file: string, content: string) => void): void; - public join(sep: string): SourceNode; - public replaceRight(pattern: string, replacement: string): SourceNode; - public toString(): string; - public toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap; - } -} - -declare module 'source-map' { - export = SourceMap; -} diff --git a/lib/typings/tsd.d.ts b/lib/typings/tsd.d.ts index e910f4627..ba950e8a3 100644 --- a/lib/typings/tsd.d.ts +++ b/lib/typings/tsd.d.ts @@ -8,10 +8,10 @@ /// /// /// -/// /// /// -/// /// /// /// +/// +/// diff --git a/lib/worker/lib/workerLib.ts b/lib/worker/lib/workerLib.ts index 50e46e887..bd24d6719 100644 --- a/lib/worker/lib/workerLib.ts +++ b/lib/worker/lib/workerLib.ts @@ -42,8 +42,6 @@ class RequesterResponder { protected getProcess: { (): { send?: (message: Message) => any } } - = () => { throw new Error('getProcess is abstract'); return null; } - ///////////////////////////////// REQUESTOR ///////////////////////// @@ -231,10 +229,19 @@ export class Parent extends RequesterResponder { /** start worker */ startWorker(childJsPath: string, terminalError: (e: Error) => any, customArguments: string[]) { try { + /** At least on NixOS, the environment must be preserved for + dynamic libraries to be properly linked. + On Windows/MacOS, it needs to be cleared, cf. atom/atom#2887 */ + var spawnEnv = (process.platform === 'linux') ? Object.create(process.env) : {}; + spawnEnv['ATOM_SHELL_INTERNAL_RUN_AS_NODE'] = '1'; this.child = spawn(this.node, [ // '--debug', // Uncomment if you want to debug the child process childJsPath - ].concat(customArguments), { cwd: path.dirname(childJsPath), env: { ATOM_SHELL_INTERNAL_RUN_AS_NODE: '1' }, stdio: ['ipc'] }); + ].concat(customArguments), { + cwd: path.dirname(childJsPath), + env: spawnEnv, + stdio: ['ipc'] + }); this.child.on('error', (err) => { if (err.code === "ENOENT" && err.path === this.node) { diff --git a/lib/worker/parent.ts b/lib/worker/parent.ts index 143abf3b4..0102aded0 100644 --- a/lib/worker/parent.ts +++ b/lib/worker/parent.ts @@ -24,11 +24,15 @@ if (debugSync) { } export function startWorker() { - parent.startWorker(__dirname + '/child.js', showError, atomConfig.typescriptServices ? [atomConfig.typescriptServices] : []); + if (!debugSync) { + parent.startWorker(__dirname + '/child.js', showError, atomConfig.typescriptServices ? [atomConfig.typescriptServices] : []); + } } export function stopWorker() { - parent.stopWorker(); + if (!debugSync) { + parent.stopWorker(); + } } function showError(error: Error) { diff --git a/node_modules/.bin/atbuild b/node_modules/.bin/atbuild deleted file mode 100644 index 9a812f149..000000000 --- a/node_modules/.bin/atbuild +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -basedir=`dirname "$0"` - -case `uname` in - *CYGWIN*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - "$basedir/node" "$basedir/../atom-typescript/dist/main/bin/atbuild" "$@" - ret=$? -else - node "$basedir/../atom-typescript/dist/main/bin/atbuild" "$@" - ret=$? -fi -exit $ret diff --git a/node_modules/.bin/atbuild.cmd b/node_modules/.bin/atbuild.cmd deleted file mode 100644 index ba03d9a00..000000000 --- a/node_modules/.bin/atbuild.cmd +++ /dev/null @@ -1,7 +0,0 @@ -@IF EXIST "%~dp0\node.exe" ( - "%~dp0\node.exe" "%~dp0\..\atom-typescript\dist\main\bin\atbuild" %* -) ELSE ( - @SETLOCAL - @SET PATHEXT=%PATHEXT:;.JS;=;% - node "%~dp0\..\atom-typescript\dist\main\bin\atbuild" %* -) \ No newline at end of file diff --git a/node_modules/.bin/csonc b/node_modules/.bin/csonc deleted file mode 100644 index a031f883e..000000000 --- a/node_modules/.bin/csonc +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -basedir=`dirname "$0"` - -case `uname` in - *CYGWIN*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - "$basedir/node" "$basedir/../season/bin/csonc" "$@" - ret=$? -else - node "$basedir/../season/bin/csonc" "$@" - ret=$? -fi -exit $ret diff --git a/node_modules/.bin/csonc.cmd b/node_modules/.bin/csonc.cmd deleted file mode 100644 index bfd397900..000000000 --- a/node_modules/.bin/csonc.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@IF EXIST "%~dp0\node.exe" ( - "%~dp0\node.exe" "%~dp0\..\season\bin\csonc" %* -) ELSE ( - node "%~dp0\..\season\bin\csonc" %* -) \ No newline at end of file diff --git a/node_modules/.bin/mkdirp b/node_modules/.bin/mkdirp deleted file mode 120000 index 017896ceb..000000000 --- a/node_modules/.bin/mkdirp +++ /dev/null @@ -1 +0,0 @@ -../mkdirp/bin/cmd.js \ No newline at end of file diff --git a/node_modules/atom-space-pen-views/LICENSE.md b/node_modules/atom-space-pen-views/LICENSE.md deleted file mode 100644 index 4d231b456..000000000 --- a/node_modules/atom-space-pen-views/LICENSE.md +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2014 GitHub Inc. - -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/atom-space-pen-views/README.md b/node_modules/atom-space-pen-views/README.md deleted file mode 100644 index de28e1b7a..000000000 --- a/node_modules/atom-space-pen-views/README.md +++ /dev/null @@ -1,212 +0,0 @@ -# Atom SpacePen Views [![Build Status](https://travis-ci.org/atom/atom-space-pen-views.svg?branch=master)](https://travis-ci.org/atom/atom-space-pen-views) - -This library contains SpacePen views that used to be provided as part of Atom -Core. `TextEditorView`, `SelectListView`, and `ScrollView` exports from the -`atom` module are now deprecated will soon be removed, but can still be used in -packages by depending on this library in your `package.json`. - -## TextEditorView - -A text editor can now be created in Atom by inserting an `` -tag in any location you want an editor. However, if you still want to use the -SpacePen view in order to conveniently convert packages off the deprecated -export, you can use this class. - -### Example - -```coffee -{View} = require 'space-pen' -{TextEditorView} = require 'atom-space-pen-views' - -class MyView extends View - @content: -> - @div => - @div "Type your answer:" - @subview 'answer', new TextEditorView(mini: true) -``` - -### Constructor Params - -Pass an optional params object to the constructor with the following keys: - -* `mini` If `true`, will construct a single-line editor for use as an input - field. -* `placeholderText` A string of placeholder text to appear in the editor when - empty - -### Methods - -#### `::getModel` - -Returns the underlying `TextEditor` model instance. - -## ScrollView - - Handles several core events to update scroll position: - - * `core:move-up` Scrolls the view up - * `core:move-down` Scrolls the view down - * `core:page-up` Scrolls the view up by the height of the page - * `core:page-down` Scrolls the view down by the height of the page - * `core:move-to-top` Scrolls the editor to the top - * `core:move-to-bottom` Scroll the editor to the bottom - - Subclasses must call `super` if overriding the `initialize` method. - -### Example - - ```coffee - {ScrollView} = require 'atom-space-pen-views' - - class MyView extends ScrollView - @content: -> - @div() - - initialize: -> - super - @text('super long content that will scroll') - ``` - -## SelectListView - -Essential: Provides a view that renders a list of items with an editor that -filters the items. Used by many packages such as the fuzzy-finder, -command-palette, symbols-view and autocomplete. - - -### Example - -```coffee -{SelectListView} = require 'atom-space-pen-views' - -class MySelectListView extends SelectListView - initialize: -> - super - @addClass('overlay from-top') - @setItems(['Hello', 'World']) - atom.workspaceView.append(this) - @focusFilterEditor() - - viewForItem: (item) -> - "
  • #{item}
  • " - - confirmed: (item) -> - console.log("#{item} was selected") -``` - -## Methods - -### Subclasses Must Implement - -#### `::viewForItem` - -Create a view for the given model item. This method must be overridden by -subclasses. Called when the item is about to appended to the list view. - -* `item` The model item being rendered. This will always be one of the items - previously passed to `::setItems`. - -Returns a String of HTML, DOM element, jQuery object, or View. - -#### `::confirmed` - -Callback function for when an item is selected. This method must -be overridden by subclasses. - -* `item` The selected model item. This will always be one of the items - previously passed to `::setItems`. - -Returns a DOM element, jQuery object, or {View}. - -### Managing the list of items - -#### `::setItems` - -Set the array of items to display in the list. This should be -model items, not actual views. `::viewForItem` will be called to render the -item when it is being appended to the list view. - -* `items` The array of model items to display in the list (default: []). - -#### `::getSelectedItem` - -Get the model item that is currently selected in the list view. - -#### `::getFilterKey` - -Get the property name to use when filtering items. - -This method may be overridden by classes to allow fuzzy filtering based -on a specific property of the item objects. - -For example if the objects you pass to {::setItems} are of the type -`{"id": 3, "name": "Atom"}` then you would return `"name"` from this method -to fuzzy filter by that property when text is entered into this view's -editor. - - -#### `::getFilterQuery` - -Get the filter query to use when fuzzy filtering the visible elements. - -By default this method returns the text in the mini editor but it can be -overridden by subclasses if needed. - -Returns a {String} to use when fuzzy filtering the elements to display. - - -#### `::setMaxItems` - -Set the maximum numbers of items to display in the list. - -* `maxItems` The maximum {Number} of items to display. - -#### `::populateList` - -Extended: Populate the list view with the model items previously set by calling -{::setItems}. - -Subclasses may override this method but should always call `super`. - -### Messages - -#### `::setError` - -Set the error message to display. - -* `message` A string with an error message (default: ''). - -#### `::setLoading` - -Set the loading message to display. - -* `message` A string with a loading message (default: ''). - -#### `::getEmptyMessage` - -Get the message to display when there are no items. - -Subclasses may override this method to customize the message. - -* `itemCount` The {Number} of items in the array specified to {::setItems} -* `filteredItemCount` The {Number} of items that pass the fuzzy filter test. - -Returns a {String} message (default: 'No matches found'). - -### View Actions - -#### `::cancel` - -Cancel and close this select list view. - -This restores focus to the previously focused element if `::storeFocusedElement` -was called prior to this view being attached. - -#### `::focusFilterEditor` - -Focus the fuzzy filter editor view. - -#### `::storeFocusedElement` - -Store the currently focused element. This element will be given back focus when -`::cancel` is called. diff --git a/node_modules/atom-space-pen-views/lib/main.js b/node_modules/atom-space-pen-views/lib/main.js deleted file mode 100644 index ebdf3649c..000000000 --- a/node_modules/atom-space-pen-views/lib/main.js +++ /dev/null @@ -1,22 +0,0 @@ -(function() { - var $, $$, $$$, View, jQuery, _ref; - - _ref = require('space-pen'), View = _ref.View, jQuery = _ref.jQuery, $ = _ref.$, $$ = _ref.$$, $$$ = _ref.$$$; - - exports.View = View; - - exports.jQuery = jQuery; - - exports.$ = $; - - exports.$$ = $$; - - exports.$$$ = $$$; - - exports.TextEditorView = require('./text-editor-view'); - - exports.SelectListView = require('./select-list-view'); - - exports.ScrollView = require('./scroll-view'); - -}).call(this); diff --git a/node_modules/atom-space-pen-views/lib/scroll-view.js b/node_modules/atom-space-pen-views/lib/scroll-view.js deleted file mode 100644 index b77ad49f4..000000000 --- a/node_modules/atom-space-pen-views/lib/scroll-view.js +++ /dev/null @@ -1,54 +0,0 @@ -(function() { - var ScrollView, View, - __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; }; - - View = require('space-pen').View; - - module.exports = ScrollView = (function(_super) { - __extends(ScrollView, _super); - - function ScrollView() { - return ScrollView.__super__.constructor.apply(this, arguments); - } - - ScrollView.prototype.initialize = function() { - return atom.commands.add(this.element, { - 'core:move-up': (function(_this) { - return function() { - return _this.scrollUp(); - }; - })(this), - 'core:move-down': (function(_this) { - return function() { - return _this.scrollDown(); - }; - })(this), - 'core:page-up': (function(_this) { - return function() { - return _this.pageUp(); - }; - })(this), - 'core:page-down': (function(_this) { - return function() { - return _this.pageDown(); - }; - })(this), - 'core:move-to-top': (function(_this) { - return function() { - return _this.scrollToTop(); - }; - })(this), - 'core:move-to-bottom': (function(_this) { - return function() { - return _this.scrollToBottom(); - }; - })(this) - }); - }; - - return ScrollView; - - })(View); - -}).call(this); diff --git a/node_modules/atom-space-pen-views/lib/select-list-view.js b/node_modules/atom-space-pen-views/lib/select-list-view.js deleted file mode 100644 index 152702abc..000000000 --- a/node_modules/atom-space-pen-views/lib/select-list-view.js +++ /dev/null @@ -1,361 +0,0 @@ -(function() { - var $, SelectListView, TextEditorView, View, fuzzyFilter, _ref, - __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; }; - - _ref = require('space-pen'), $ = _ref.$, View = _ref.View; - - TextEditorView = require('./text-editor-view'); - - fuzzyFilter = null; - - atom.themes.requireStylesheet(require.resolve('../stylesheets/select-list.less')); - - module.exports = SelectListView = (function(_super) { - __extends(SelectListView, _super); - - function SelectListView() { - return SelectListView.__super__.constructor.apply(this, arguments); - } - - SelectListView.content = function() { - return this.div({ - "class": 'select-list' - }, (function(_this) { - return function() { - _this.subview('filterEditorView', new TextEditorView({ - mini: true - })); - _this.div({ - "class": 'error-message', - outlet: 'error' - }); - _this.div({ - "class": 'loading', - outlet: 'loadingArea' - }, function() { - _this.span({ - "class": 'loading-message', - outlet: 'loading' - }); - return _this.span({ - "class": 'badge', - outlet: 'loadingBadge' - }); - }); - return _this.ol({ - "class": 'list-group', - outlet: 'list' - }); - }; - })(this)); - }; - - SelectListView.prototype.maxItems = Infinity; - - SelectListView.prototype.scheduleTimeout = null; - - SelectListView.prototype.inputThrottle = 50; - - SelectListView.prototype.cancelling = false; - - - /* - Section: Construction - */ - - SelectListView.prototype.initialize = function() { - this.filterEditorView.getModel().getBuffer().onDidChange((function(_this) { - return function() { - return _this.schedulePopulateList(); - }; - })(this)); - this.filterEditorView.on('blur', (function(_this) { - return function(e) { - if (!_this.cancelling) { - return _this.cancel(); - } - }; - })(this)); - atom.commands.add(this.element, { - 'core:move-up': (function(_this) { - return function(event) { - _this.selectPreviousItemView(); - return event.stopPropagation(); - }; - })(this), - 'core:move-down': (function(_this) { - return function(event) { - _this.selectNextItemView(); - return event.stopPropagation(); - }; - })(this), - 'core:move-to-top': (function(_this) { - return function(event) { - _this.selectItemView(_this.list.find('li:first')); - _this.list.scrollToTop(); - return event.stopPropagation(); - }; - })(this), - 'core:move-to-bottom': (function(_this) { - return function(event) { - _this.selectItemView(_this.list.find('li:last')); - _this.list.scrollToBottom(); - return event.stopPropagation(); - }; - })(this), - 'core:confirm': (function(_this) { - return function(event) { - _this.confirmSelection(); - return event.stopPropagation(); - }; - })(this), - 'core:cancel': (function(_this) { - return function(event) { - _this.cancel(); - return event.stopPropagation(); - }; - })(this) - }); - this.list.on('mousedown', (function(_this) { - return function(_arg) { - var target; - target = _arg.target; - if (target === _this.list[0]) { - return false; - } - }; - })(this)); - this.list.on('mousedown', 'li', (function(_this) { - return function(e) { - _this.selectItemView($(e.target).closest('li')); - e.preventDefault(); - return false; - }; - })(this)); - return this.list.on('mouseup', 'li', (function(_this) { - return function(e) { - if ($(e.target).closest('li').hasClass('selected')) { - _this.confirmSelection(); - } - e.preventDefault(); - return false; - }; - })(this)); - }; - - - /* - Section: Methods that must be overridden - */ - - SelectListView.prototype.viewForItem = function(item) { - throw new Error("Subclass must implement a viewForItem(item) method"); - }; - - SelectListView.prototype.confirmed = function(item) { - throw new Error("Subclass must implement a confirmed(item) method"); - }; - - - /* - Section: Managing the list of items - */ - - SelectListView.prototype.setItems = function(items) { - this.items = items != null ? items : []; - this.populateList(); - return this.setLoading(); - }; - - SelectListView.prototype.getSelectedItem = function() { - return this.getSelectedItemView().data('select-list-item'); - }; - - SelectListView.prototype.getFilterKey = function() {}; - - SelectListView.prototype.getFilterQuery = function() { - return this.filterEditorView.getText(); - }; - - SelectListView.prototype.setMaxItems = function(maxItems) { - this.maxItems = maxItems; - }; - - SelectListView.prototype.populateList = function() { - var filterQuery, filteredItems, i, item, itemView, _i, _ref1; - if (this.items == null) { - return; - } - filterQuery = this.getFilterQuery(); - if (filterQuery.length) { - if (fuzzyFilter == null) { - fuzzyFilter = require('fuzzaldrin').filter; - } - filteredItems = fuzzyFilter(this.items, filterQuery, { - key: this.getFilterKey() - }); - } else { - filteredItems = this.items; - } - this.list.empty(); - if (filteredItems.length) { - this.setError(null); - for (i = _i = 0, _ref1 = Math.min(filteredItems.length, this.maxItems); 0 <= _ref1 ? _i < _ref1 : _i > _ref1; i = 0 <= _ref1 ? ++_i : --_i) { - item = filteredItems[i]; - itemView = $(this.viewForItem(item)); - itemView.data('select-list-item', item); - this.list.append(itemView); - } - return this.selectItemView(this.list.find('li:first')); - } else { - return this.setError(this.getEmptyMessage(this.items.length, filteredItems.length)); - } - }; - - - /* - Section: Messages to the user - */ - - SelectListView.prototype.setError = function(message) { - if (message == null) { - message = ''; - } - if (message.length === 0) { - return this.error.text('').hide(); - } else { - this.setLoading(); - return this.error.text(message).show(); - } - }; - - SelectListView.prototype.setLoading = function(message) { - if (message == null) { - message = ''; - } - if (message.length === 0) { - this.loading.text(""); - this.loadingBadge.text(""); - return this.loadingArea.hide(); - } else { - this.setError(); - this.loading.text(message); - return this.loadingArea.show(); - } - }; - - SelectListView.prototype.getEmptyMessage = function(itemCount, filteredItemCount) { - return 'No matches found'; - }; - - - /* - Section: View Actions - */ - - SelectListView.prototype.cancel = function() { - var filterEditorViewFocused; - this.list.empty(); - this.cancelling = true; - filterEditorViewFocused = this.filterEditorView.hasFocus(); - if (typeof this.cancelled === "function") { - this.cancelled(); - } - this.filterEditorView.setText(''); - if (filterEditorViewFocused) { - this.restoreFocus(); - } - this.cancelling = false; - return clearTimeout(this.scheduleTimeout); - }; - - SelectListView.prototype.focusFilterEditor = function() { - return this.filterEditorView.focus(); - }; - - SelectListView.prototype.storeFocusedElement = function() { - return this.previouslyFocusedElement = $(document.activeElement); - }; - - - /* - Section: Private - */ - - SelectListView.prototype.selectPreviousItemView = function() { - var view; - view = this.getSelectedItemView().prev(); - if (!view.length) { - view = this.list.find('li:last'); - } - return this.selectItemView(view); - }; - - SelectListView.prototype.selectNextItemView = function() { - var view; - view = this.getSelectedItemView().next(); - if (!view.length) { - view = this.list.find('li:first'); - } - return this.selectItemView(view); - }; - - SelectListView.prototype.selectItemView = function(view) { - if (!view.length) { - return; - } - this.list.find('.selected').removeClass('selected'); - view.addClass('selected'); - return this.scrollToItemView(view); - }; - - SelectListView.prototype.scrollToItemView = function(view) { - var desiredBottom, desiredTop, scrollTop; - scrollTop = this.list.scrollTop(); - desiredTop = view.position().top + scrollTop; - desiredBottom = desiredTop + view.outerHeight(); - if (desiredTop < scrollTop) { - return this.list.scrollTop(desiredTop); - } else if (desiredBottom > this.list.scrollBottom()) { - return this.list.scrollBottom(desiredBottom); - } - }; - - SelectListView.prototype.restoreFocus = function() { - var _ref1; - return (_ref1 = this.previouslyFocusedElement) != null ? _ref1.focus() : void 0; - }; - - SelectListView.prototype.getSelectedItemView = function() { - return this.list.find('li.selected'); - }; - - SelectListView.prototype.confirmSelection = function() { - var item; - item = this.getSelectedItem(); - if (item != null) { - return this.confirmed(item); - } else { - return this.cancel(); - } - }; - - SelectListView.prototype.schedulePopulateList = function() { - var populateCallback; - clearTimeout(this.scheduleTimeout); - populateCallback = (function(_this) { - return function() { - if (_this.isOnDom()) { - return _this.populateList(); - } - }; - })(this); - return this.scheduleTimeout = setTimeout(populateCallback, this.inputThrottle); - }; - - return SelectListView; - - })(View); - -}).call(this); diff --git a/node_modules/atom-space-pen-views/lib/text-editor-view.js b/node_modules/atom-space-pen-views/lib/text-editor-view.js deleted file mode 100644 index e957a2bf0..000000000 --- a/node_modules/atom-space-pen-views/lib/text-editor-view.js +++ /dev/null @@ -1,63 +0,0 @@ -(function() { - var $, TextEditorView, View, _ref, - __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; }; - - _ref = require('space-pen'), View = _ref.View, $ = _ref.$; - - module.exports = TextEditorView = (function(_super) { - __extends(TextEditorView, _super); - - function TextEditorView(params) { - var attributes, mini, name, placeholderText, value; - if (params == null) { - params = {}; - } - mini = params.mini, placeholderText = params.placeholderText, attributes = params.attributes; - if (attributes == null) { - attributes = {}; - } - if (mini != null) { - attributes['mini'] = mini; - } - if (placeholderText != null) { - attributes['placeholder-text'] = placeholderText; - } - this.element = document.createElement('atom-text-editor'); - for (name in attributes) { - value = attributes[name]; - this.element.setAttribute(name, value); - } - if (this.element.__spacePenView != null) { - this.element.__spacePenView = this; - this.element.__allowViewAccess = true; - } - TextEditorView.__super__.constructor.apply(this, arguments); - this.setModel(this.element.getModel()); - } - - TextEditorView.prototype.setModel = function(model) { - this.model = model; - }; - - TextEditorView.prototype.getModel = function() { - return this.model; - }; - - TextEditorView.prototype.getText = function() { - return this.model.getText(); - }; - - TextEditorView.prototype.setText = function(text) { - return this.model.setText(text); - }; - - TextEditorView.prototype.hasFocus = function() { - return this.element.hasFocus(); - }; - - return TextEditorView; - - })(View); - -}).call(this); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/LICENSE.md b/node_modules/atom-space-pen-views/node_modules/grim/LICENSE.md deleted file mode 100644 index 4d231b456..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/LICENSE.md +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2014 GitHub Inc. - -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/atom-space-pen-views/node_modules/grim/README.md b/node_modules/atom-space-pen-views/node_modules/grim/README.md deleted file mode 100644 index c7a023c2a..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# Grim [![Build Status](https://travis-ci.org/atom/grim.svg)](https://travis-ci.org/atom/grim) - -Log deprecate calls - -## Installing - -```sh -npm install grim -``` - -## Usage - -```javascript -Grim = require('grim') - -function someOldMethod() { - Grim.deprecate("Use theNewMethod instead.") -} -``` - -To view all calls to deprecated methods use `Grim.logDeprecations()` or get direct access to the deprecated calls by using `Grim.getDeprecations()` diff --git a/node_modules/atom-space-pen-views/node_modules/grim/lib/deprecation.js b/node_modules/atom-space-pen-views/node_modules/grim/lib/deprecation.js deleted file mode 100644 index 0be0442e9..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/lib/deprecation.js +++ /dev/null @@ -1,150 +0,0 @@ -(function() { - var Deprecation, SourceMapCache, convertLine; - - convertLine = require('coffeestack').convertLine; - - SourceMapCache = {}; - - module.exports = Deprecation = (function() { - Deprecation.getFunctionNameFromCallsite = function(callsite) {}; - - Deprecation.deserialize = function(_arg) { - var deprecation, fileName, lineNumber, message, stack, stacks, _i, _len; - message = _arg.message, fileName = _arg.fileName, lineNumber = _arg.lineNumber, stacks = _arg.stacks; - deprecation = new Deprecation(message, fileName, lineNumber); - for (_i = 0, _len = stacks.length; _i < _len; _i++) { - stack = stacks[_i]; - deprecation.addStack(stack, stack.metadata); - } - return deprecation; - }; - - function Deprecation(message, fileName, lineNumber) { - this.message = message; - this.fileName = fileName; - this.lineNumber = lineNumber; - this.callCount = 0; - this.stacks = {}; - this.stackCallCounts = {}; - } - - Deprecation.prototype.getFunctionNameFromCallsite = function(callsite) { - var _ref, _ref1, _ref2; - if (callsite.functionName != null) { - return callsite.functionName; - } - if (callsite.isToplevel()) { - return (_ref = callsite.getFunctionName()) != null ? _ref : ''; - } else { - if (callsite.isConstructor()) { - return "new " + (callsite.getFunctionName()); - } else if (callsite.getMethodName() && !callsite.getFunctionName()) { - return callsite.getMethodName(); - } else { - return "" + (callsite.getTypeName()) + "." + ((_ref1 = (_ref2 = callsite.getMethodName()) != null ? _ref2 : callsite.getFunctionName()) != null ? _ref1 : ''); - } - } - }; - - Deprecation.prototype.getLocationFromCallsite = function(callsite) { - var column, converted, fileName, line; - if (callsite.location != null) { - return callsite.location; - } - if (callsite.isNative()) { - return "native"; - } else if (callsite.isEval()) { - return "eval at " + (this.getLocationFromCallsite(callsite.getEvalOrigin())); - } else { - fileName = callsite.getFileName(); - line = callsite.getLineNumber(); - column = callsite.getColumnNumber(); - if (/\.coffee$/.test(fileName)) { - if (converted = convertLine(fileName, line, column, SourceMapCache)) { - line = converted.line, column = converted.column; - } - } - return "" + fileName + ":" + line + ":" + column; - } - }; - - Deprecation.prototype.getFileNameFromCallSite = function(callsite) { - var _ref; - return (_ref = callsite.fileName) != null ? _ref : callsite.getFileName(); - }; - - Deprecation.prototype.getOriginName = function() { - return this.originName; - }; - - Deprecation.prototype.getMessage = function() { - return this.message; - }; - - Deprecation.prototype.getStacks = function() { - var location, parsedStack, parsedStacks, stack, _ref; - parsedStacks = []; - _ref = this.stacks; - for (location in _ref) { - stack = _ref[location]; - parsedStack = this.parseStack(stack); - parsedStack.callCount = this.stackCallCounts[location]; - parsedStack.metadata = stack.metadata; - parsedStacks.push(parsedStack); - } - return parsedStacks; - }; - - Deprecation.prototype.getCallCount = function() { - return this.callCount; - }; - - Deprecation.prototype.addStack = function(stack, metadata) { - var callerLocation, _base, _base1, _base2; - if (this.originName == null) { - this.originName = this.getFunctionNameFromCallsite(stack[0]); - } - if (this.fileName == null) { - this.fileName = this.getFileNameFromCallSite(stack[0]); - } - if (this.lineNumber == null) { - this.lineNumber = typeof (_base = stack[0]).getLineNumber === "function" ? _base.getLineNumber() : void 0; - } - this.callCount++; - stack.metadata = metadata; - callerLocation = this.getLocationFromCallsite(stack[1]); - if ((_base1 = this.stacks)[callerLocation] == null) { - _base1[callerLocation] = stack; - } - if ((_base2 = this.stackCallCounts)[callerLocation] == null) { - _base2[callerLocation] = 0; - } - return this.stackCallCounts[callerLocation]++; - }; - - Deprecation.prototype.parseStack = function(stack) { - return stack.map((function(_this) { - return function(callsite) { - return { - functionName: _this.getFunctionNameFromCallsite(callsite), - location: _this.getLocationFromCallsite(callsite), - fileName: _this.getFileNameFromCallSite(callsite) - }; - }; - })(this)); - }; - - Deprecation.prototype.serialize = function() { - return { - message: this.getMessage(), - lineNumber: this.lineNumber, - fileName: this.fileName, - stacks: this.getStacks() - }; - }; - - return Deprecation; - - })(); - -}).call(this); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/lib/grim.js b/node_modules/atom-space-pen-views/node_modules/grim/lib/grim.js deleted file mode 100644 index b90fa888c..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/lib/grim.js +++ /dev/null @@ -1,93 +0,0 @@ -(function() { - var Deprecation, Emitter, grim; - - Emitter = require('emissary').Emitter; - - Deprecation = require('./deprecation'); - - if (global.__grim__ == null) { - grim = global.__grim__ = { - deprecations: {}, - getDeprecations: function() { - var deprecation, deprecations, deprecationsByLineNumber, fileName, lineNumber, _ref; - deprecations = []; - _ref = grim.deprecations; - for (fileName in _ref) { - deprecationsByLineNumber = _ref[fileName]; - for (lineNumber in deprecationsByLineNumber) { - deprecation = deprecationsByLineNumber[lineNumber]; - deprecations.push(deprecation); - } - } - return deprecations; - }, - getDeprecationsLength: function() { - return this.getDeprecations().length; - }, - clearDeprecations: function() { - grim.deprecations = {}; - }, - logDeprecations: function() { - var deprecation, deprecations, _i, _len; - deprecations = this.getDeprecations(); - deprecations.sort(function(a, b) { - return b.getCallCount() - a.getCallCount(); - }); - console.warn("\nCalls to deprecated functions\n-----------------------------"); - for (_i = 0, _len = deprecations.length; _i < _len; _i++) { - deprecation = deprecations[_i]; - console.warn("(" + (deprecation.getCallCount()) + ") " + (deprecation.getOriginName()) + " : " + (deprecation.getMessage()), deprecation); - } - }, - deprecate: function(message, metadata) { - var deprecation, deprecationSite, error, fileName, lineNumber, originalPrepareStackTrace, originalStackTraceLimit, stack, _base, _base1; - originalStackTraceLimit = Error.stackTraceLimit; - Error.stackTraceLimit = 3; - error = new Error; - Error.captureStackTrace(error); - Error.stackTraceLimit = originalStackTraceLimit; - originalPrepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = function(error, stack) { - return stack; - }; - stack = error.stack.slice(1); - Error.prepareStackTrace = originalPrepareStackTrace; - deprecationSite = stack[0]; - fileName = deprecationSite.getFileName(); - lineNumber = deprecationSite.getLineNumber(); - if ((_base = grim.deprecations)[fileName] == null) { - _base[fileName] = {}; - } - if ((_base1 = grim.deprecations[fileName])[lineNumber] == null) { - _base1[lineNumber] = new Deprecation(message); - } - deprecation = grim.deprecations[fileName][lineNumber]; - deprecation.addStack(stack, metadata); - grim.emit("updated", deprecation); - }, - addSerializedDeprecation: function(serializedDeprecation) { - var deprecation, fileName, lineNumber, message, stack, stacks, _base, _base1, _i, _len; - deprecation = Deprecation.deserialize(serializedDeprecation); - message = deprecation.getMessage(); - fileName = deprecation.fileName, lineNumber = deprecation.lineNumber; - stacks = deprecation.getStacks(); - if ((_base = grim.deprecations)[fileName] == null) { - _base[fileName] = {}; - } - if ((_base1 = grim.deprecations[fileName])[lineNumber] == null) { - _base1[lineNumber] = new Deprecation(message, fileName, lineNumber); - } - deprecation = grim.deprecations[fileName][lineNumber]; - for (_i = 0, _len = stacks.length; _i < _len; _i++) { - stack = stacks[_i]; - deprecation.addStack(stack, stack.metadata); - } - grim.emit("updated", deprecation); - } - }; - Emitter.extend(grim); - } - - module.exports = global.__grim__; - -}).call(this); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/README.md b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/README.md deleted file mode 100644 index f3f64b708..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# CoffeeStack [![Build Status](https://travis-ci.org/kevinsawicki/coffeestack.png)](https://travis-ci.org/kevinsawicki/coffeestack) - -Module to convert JavaScript stack traces to CoffeeScript stack traces. - -## Installing - -```sh -npm install coffeestack -``` - -## Using - -```coffeescript -{convertStackTrace} = require 'coffeestack' - -try - throw new Error('this is an error') -catch error - console.error(convertStackTrace(error.stack)) -``` diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/index.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/index.js deleted file mode 100644 index 299875aba..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/index.js +++ /dev/null @@ -1,154 +0,0 @@ -(function() { - var CoffeeScript, CoffeeScriptVersion, SourceMapConsumer, cachePath, compileSourceMap, convertLine, convertStackTrace, crypto, fs, getCachePath, getCachedSourceMap, getSourceMapPosition, path, writeSourceMapToCache; - - crypto = require('crypto'); - - fs = require('fs-plus'); - - path = require('path'); - - CoffeeScriptVersion = null; - - CoffeeScript = null; - - SourceMapConsumer = null; - - cachePath = null; - - getCachePath = function(code) { - var digest; - if (!cachePath) { - return; - } - digest = crypto.createHash('sha1').update(code, 'utf8').digest('hex'); - if (CoffeeScriptVersion == null) { - CoffeeScriptVersion = require('coffee-script/package.json').version; - } - return path.join(cachePath, CoffeeScriptVersion, "" + digest + ".json"); - }; - - getCachedSourceMap = function(codeCachePath) { - if (fs.isFileSync(codeCachePath)) { - try { - return fs.readFileSync(codeCachePath, 'utf8'); - } catch (_error) {} - } - }; - - writeSourceMapToCache = function(codeCachePath, sourceMap) { - if (codeCachePath) { - try { - fs.writeFileSync(codeCachePath, sourceMap); - } catch (_error) {} - } - }; - - compileSourceMap = function(code, filePath, codeCachePath) { - var v3SourceMap; - if (CoffeeScript == null) { - CoffeeScript = require('coffee-script'); - } - v3SourceMap = CoffeeScript.compile(code, { - sourceMap: true, - filename: filePath - }).v3SourceMap; - writeSourceMapToCache(codeCachePath, v3SourceMap); - return v3SourceMap; - }; - - getSourceMapPosition = function(sourceMapContents, line, column) { - var sourceMap; - if (SourceMapConsumer == null) { - SourceMapConsumer = require('source-map').SourceMapConsumer; - } - sourceMap = new SourceMapConsumer(sourceMapContents); - return sourceMap.originalPositionFor({ - line: line, - column: column - }); - }; - - convertLine = function(filePath, line, column, sourceMaps) { - var code, codeCachePath, position, source, sourceMapContents, sourceMapPath; - if (sourceMaps == null) { - sourceMaps = {}; - } - try { - if (!(sourceMapContents = sourceMaps[filePath])) { - if (path.extname(filePath) === '.js') { - sourceMapPath = "" + filePath + ".map"; - sourceMapContents = fs.readFileSync(sourceMapPath, 'utf8'); - } else { - code = fs.readFileSync(filePath, 'utf8'); - codeCachePath = getCachePath(code); - sourceMapContents = getCachedSourceMap(codeCachePath); - if (sourceMapContents == null) { - sourceMapContents = compileSourceMap(code, filePath, codeCachePath); - } - } - } - if (sourceMapContents) { - sourceMaps[filePath] = sourceMapContents; - position = getSourceMapPosition(sourceMapContents, line, column); - if ((position.line != null) && (position.column != null)) { - if (position.source && position.source !== '.') { - source = path.resolve(filePath, '..', position.source); - } else { - source = filePath; - } - return { - line: position.line, - column: position.column, - source: source - }; - } - } - } catch (_error) {} - return null; - }; - - convertStackTrace = function(stackTrace, sourceMaps) { - var atLinePattern, column, convertedLines, filePath, line, mappedLine, match, stackTraceLine, _i, _len, _ref; - if (sourceMaps == null) { - sourceMaps = {}; - } - if (!stackTrace) { - return stackTrace; - } - convertedLines = []; - atLinePattern = /^(\s+at .* )\((.*):(\d+):(\d+)\)/; - _ref = stackTrace.split('\n'); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - stackTraceLine = _ref[_i]; - if (match = atLinePattern.exec(stackTraceLine)) { - filePath = match[2]; - line = match[3]; - column = match[4]; - if (path.extname(filePath) === '.js') { - mappedLine = convertLine(filePath, line, column, sourceMaps); - } - if (mappedLine != null) { - convertedLines.push("" + match[1] + "(" + mappedLine.source + ":" + mappedLine.line + ":" + mappedLine.column + ")"); - } else { - convertedLines.push(stackTraceLine); - } - } else { - convertedLines.push(stackTraceLine); - } - } - return convertedLines.join('\n'); - }; - - exports.convertLine = convertLine; - - exports.convertStackTrace = convertStackTrace; - - exports.setCacheDirectory = function(newCachePath) { - return cachePath = newCachePath; - }; - - exports.getCacheDirectory = function() { - return cachePath; - }; - -}).call(this); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/.bin/cake b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/.bin/cake deleted file mode 120000 index d95f32af4..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/.bin/cake +++ /dev/null @@ -1 +0,0 @@ -../coffee-script/bin/cake \ No newline at end of file diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/.bin/coffee b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/.bin/coffee deleted file mode 120000 index b57f275d7..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/.bin/coffee +++ /dev/null @@ -1 +0,0 @@ -../coffee-script/bin/coffee \ No newline at end of file diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/.npmignore b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/.npmignore deleted file mode 100644 index 21e430d2e..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/.npmignore +++ /dev/null @@ -1,11 +0,0 @@ -*.coffee -*.html -.DS_Store -.git* -Cakefile -documentation/ -examples/ -extras/coffee-script.js -raw/ -src/ -test/ diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/CNAME b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/CNAME deleted file mode 100644 index faadabe5f..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/CNAME +++ /dev/null @@ -1 +0,0 @@ -coffeescript.org \ No newline at end of file diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/CONTRIBUTING.md b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/CONTRIBUTING.md deleted file mode 100644 index 5ea4c5f3e..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/CONTRIBUTING.md +++ /dev/null @@ -1,9 +0,0 @@ -## How to contribute to CoffeeScript - -* Before you open a ticket or send a pull request, [search](https://github.com/jashkenas/coffeescript/issues) for previous discussions about the same feature or issue. Add to the earlier ticket if you find one. - -* Before sending a pull request for a feature, be sure to have [tests](https://github.com/jashkenas/coffeescript/tree/master/test). - -* Use the same coding style as the rest of the [codebase](https://github.com/jashkenas/coffeescript/tree/master/src). If you're just getting started with CoffeeScript, there's a nice [style guide](https://github.com/polarmobile/coffeescript-style-guide). - -* In your pull request, do not add documentation to `index.html` or re-build the minified `coffee-script.js` file. We'll do those things before cutting a new release. \ No newline at end of file diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/LICENSE b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/LICENSE deleted file mode 100644 index 4d09b4d96..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2009-2014 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. diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/README b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/README deleted file mode 100644 index 37d7bbfe1..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/README +++ /dev/null @@ -1,50 +0,0 @@ - { - } } { - { { } } - } }{ { - { }{ } } _____ __ __ - { }{ }{ { } / ____| / _|/ _| - .- { { } { }} -. | | ___ | |_| |_ ___ ___ - ( { } { } { } } ) | | / _ \| _| _/ _ \/ _ \ - |`-..________ ..-'| | |___| (_) | | | || __/ __/ - | | \_____\___/|_| |_| \___|\___| - | ;--. - | (__ \ _____ _ _ - | | ) ) / ____| (_) | | - | |/ / | (___ ___ _ __ _ _ __ | |_ - | ( / \___ \ / __| '__| | '_ \| __| - | |/ ____) | (__| | | | |_) | |_ - | | |_____/ \___|_| |_| .__/ \__| - `-.._________..-' | | - |_| - - - CoffeeScript is a little language that compiles into JavaScript. - - 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.) - - Or, if you don't wish to use npm: - sudo bin/cake install - - 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/coffeescript/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/coffeescript.git - - Top 100 contributors are listed here: - http://github.com/jashkenas/coffeescript/contributors diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/README.md b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/README.md deleted file mode 100644 index 90f6788c6..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/README.md +++ /dev/null @@ -1,60 +0,0 @@ - { - } } { - { { } } - } }{ { - { }{ } } _____ __ __ - { }{ }{ { } / ____| / _|/ _| - .- { { } { }} -. | | ___ | |_| |_ ___ ___ - ( { } { } { } } ) | | / _ \| _| _/ _ \/ _ \ - |`-..________ ..-'| | |___| (_) | | | || __/ __/ - | | \_____\___/|_| |_| \___|\___| - | ;--. - | (__ \ _____ _ _ - | | ) ) / ____| (_) | | - | |/ / | (___ ___ _ __ _ _ __ | |_ - | ( / \___ \ / __| '__| | '_ \| __| - | |/ ____) | (__| | | | |_) | |_ - | | |_____/ \___|_| |_| .__/ \__| - `-.._________..-' | | - |_| - -CoffeeScript is a little language that compiles into JavaScript. - -## Installation - -If you have the node package manager, npm, installed: - -```shell -npm install -g coffee-script -``` - -Leave off the `-g` if you don't wish to install globally. If you don't wish to use npm: - -```shell -git clone https://github.com/jashkenas/coffeescript.git -sudo coffeescript/bin/cake install -``` - -## Getting Started - -Execute a script: - -```shell -coffee /path/to/script.coffee -``` - -Compile a script: - -```shell -coffee -c /path/to/script.coffee -``` - -For documentation, usage, and examples, see: http://coffeescript.org/ - -To suggest a feature or report a bug: http://github.com/jashkenas/coffeescript/issues - -If you'd like to chat, drop by #coffeescript on Freenode IRC. - -The source repository: https://github.com/jashkenas/coffeescript.git - -Our lovely and talented contributors are listed here: http://github.com/jashkenas/coffeescript/contributors diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/bin/cake b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/bin/cake deleted file mode 100755 index 5965f4ee5..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/bin/cake +++ /dev/null @@ -1,7 +0,0 @@ -#!/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/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/bin/coffee b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/bin/coffee deleted file mode 100755 index 3d1d71c8c..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/bin/coffee +++ /dev/null @@ -1,7 +0,0 @@ -#!/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/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/browser.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/browser.js deleted file mode 100644 index da2830d98..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/browser.js +++ /dev/null @@ -1,134 +0,0 @@ -// Generated by CoffeeScript 1.8.0 -(function() { - var CoffeeScript, compile, runScripts, - __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; }; - - CoffeeScript = require('./coffee-script'); - - CoffeeScript.require = require; - - compile = CoffeeScript.compile; - - CoffeeScript["eval"] = function(code, options) { - if (options == null) { - options = {}; - } - if (options.bare == null) { - options.bare = true; - } - return eval(compile(code, options)); - }; - - CoffeeScript.run = function(code, options) { - if (options == null) { - options = {}; - } - options.bare = true; - options.shiftLine = true; - return Function(compile(code, options))(); - }; - - if (typeof window === "undefined" || window === null) { - return; - } - - if ((typeof btoa !== "undefined" && btoa !== null) && (typeof JSON !== "undefined" && JSON !== null) && (typeof unescape !== "undefined" && unescape !== null) && (typeof encodeURIComponent !== "undefined" && encodeURIComponent !== null)) { - compile = function(code, options) { - var js, v3SourceMap, _ref; - if (options == null) { - options = {}; - } - options.sourceMap = true; - options.inline = true; - _ref = CoffeeScript.compile(code, options), js = _ref.js, v3SourceMap = _ref.v3SourceMap; - return "" + js + "\n//# sourceMappingURL=data:application/json;base64," + (btoa(unescape(encodeURIComponent(v3SourceMap)))) + "\n//# sourceURL=coffeescript"; - }; - } - - CoffeeScript.load = function(url, callback, options, hold) { - var xhr; - if (options == null) { - options = {}; - } - if (hold == null) { - hold = false; - } - options.sourceFiles = [url]; - xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP') : new window.XMLHttpRequest(); - xhr.open('GET', url, true); - if ('overrideMimeType' in xhr) { - xhr.overrideMimeType('text/plain'); - } - xhr.onreadystatechange = function() { - var param, _ref; - if (xhr.readyState === 4) { - if ((_ref = xhr.status) === 0 || _ref === 200) { - param = [xhr.responseText, options]; - if (!hold) { - CoffeeScript.run.apply(CoffeeScript, param); - } - } else { - throw new Error("Could not load " + url); - } - if (callback) { - return callback(param); - } - } - }; - return xhr.send(null); - }; - - runScripts = function() { - var coffees, coffeetypes, execute, i, index, s, script, scripts, _fn, _i, _len; - scripts = window.document.getElementsByTagName('script'); - coffeetypes = ['text/coffeescript', 'text/literate-coffeescript']; - coffees = (function() { - var _i, _len, _ref, _results; - _results = []; - for (_i = 0, _len = scripts.length; _i < _len; _i++) { - s = scripts[_i]; - if (_ref = s.type, __indexOf.call(coffeetypes, _ref) >= 0) { - _results.push(s); - } - } - return _results; - })(); - index = 0; - execute = function() { - var param; - param = coffees[index]; - if (param instanceof Array) { - CoffeeScript.run.apply(CoffeeScript, param); - index++; - return execute(); - } - }; - _fn = function(script, i) { - var options; - options = { - literate: script.type === coffeetypes[1] - }; - if (script.src) { - return CoffeeScript.load(script.src, function(param) { - coffees[i] = param; - return execute(); - }, options, true); - } else { - options.sourceFiles = ['embedded']; - return coffees[i] = [script.innerHTML, options]; - } - }; - for (i = _i = 0, _len = coffees.length; _i < _len; i = ++_i) { - script = coffees[i]; - _fn(script, i); - } - return execute(); - }; - - if (window.addEventListener) { - window.addEventListener('DOMContentLoaded', runScripts, false); - } else { - window.attachEvent('onload', runScripts); - } - -}).call(this); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/cake.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/cake.js deleted file mode 100644 index 94ecd4c82..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/cake.js +++ /dev/null @@ -1,114 +0,0 @@ -// Generated by CoffeeScript 1.8.0 -(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'); - - CoffeeScript.register(); - - 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, e, _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 (_error) { - e = _error; - 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 (fs.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/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/coffee-script.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/coffee-script.js deleted file mode 100644 index 9061c7e81..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/coffee-script.js +++ /dev/null @@ -1,347 +0,0 @@ -// Generated by CoffeeScript 1.8.0 -(function() { - var Lexer, SourceMap, compile, ext, formatSourcePosition, fs, getSourceMap, helpers, lexer, parser, path, sourceMaps, vm, withPrettyErrors, _base, _i, _len, _ref, - __hasProp = {}.hasOwnProperty, - __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; }; - - fs = require('fs'); - - vm = require('vm'); - - path = require('path'); - - Lexer = require('./lexer').Lexer; - - parser = require('./parser').parser; - - helpers = require('./helpers'); - - SourceMap = require('./sourcemap'); - - exports.VERSION = '1.8.0'; - - exports.FILE_EXTENSIONS = ['.coffee', '.litcoffee', '.coffee.md']; - - exports.helpers = helpers; - - withPrettyErrors = function(fn) { - return function(code, options) { - var err; - if (options == null) { - options = {}; - } - try { - return fn.call(this, code, options); - } catch (_error) { - err = _error; - throw helpers.updateSyntaxError(err, code, options.filename); - } - }; - }; - - exports.compile = compile = withPrettyErrors(function(code, options) { - var answer, currentColumn, currentLine, extend, fragment, fragments, header, js, map, merge, newLines, _i, _len; - merge = helpers.merge, extend = helpers.extend; - options = extend({}, options); - if (options.sourceMap) { - map = new SourceMap; - } - fragments = parser.parse(lexer.tokenize(code, options)).compileToFragments(options); - currentLine = 0; - if (options.header) { - currentLine += 1; - } - if (options.shiftLine) { - currentLine += 1; - } - currentColumn = 0; - js = ""; - for (_i = 0, _len = fragments.length; _i < _len; _i++) { - fragment = fragments[_i]; - if (options.sourceMap) { - if (fragment.locationData) { - map.add([fragment.locationData.first_line, fragment.locationData.first_column], [currentLine, currentColumn], { - noReplace: true - }); - } - newLines = helpers.count(fragment.code, "\n"); - currentLine += newLines; - if (newLines) { - currentColumn = fragment.code.length - (fragment.code.lastIndexOf("\n") + 1); - } else { - currentColumn += fragment.code.length; - } - } - js += fragment.code; - } - if (options.header) { - header = "Generated by CoffeeScript " + this.VERSION; - js = "// " + header + "\n" + js; - } - if (options.sourceMap) { - answer = { - js: js - }; - answer.sourceMap = map; - answer.v3SourceMap = map.generate(options, code); - return answer; - } else { - return js; - } - }); - - exports.tokens = withPrettyErrors(function(code, options) { - return lexer.tokenize(code, options); - }); - - exports.nodes = withPrettyErrors(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 answer, dir, mainModule, _ref; - if (options == null) { - options = {}; - } - mainModule = require.main; - mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '.'; - mainModule.moduleCache && (mainModule.moduleCache = {}); - dir = options.filename ? path.dirname(fs.realpathSync(options.filename)) : fs.realpathSync('.'); - mainModule.paths = require('module')._nodeModulePaths(dir); - if (!helpers.isCoffee(mainModule.filename) || require.extensions) { - answer = compile(code, options); - code = (_ref = answer.js) != null ? _ref : answer; - } - return mainModule._compile(code, mainModule.filename); - }; - - exports["eval"] = function(code, options) { - var Module, Script, js, k, o, r, sandbox, v, _i, _len, _module, _ref, _ref1, _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(); - _ref = options.sandbox; - for (k in _ref) { - if (!__hasProp.call(_ref, k)) continue; - v = _ref[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; - _ref1 = Object.getOwnPropertyNames(require); - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - r = _ref1[_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); - } - }; - - exports.register = function() { - return require('./register'); - }; - - if (require.extensions) { - _ref = this.FILE_EXTENSIONS; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - ext = _ref[_i]; - if ((_base = require.extensions)[ext] == null) { - _base[ext] = function() { - throw new Error("Use CoffeeScript.register() or require the coffee-script/register module to require " + ext + " files."); - }; - } - } - } - - exports._compileFile = function(filename, sourceMap) { - var answer, err, raw, stripped; - if (sourceMap == null) { - sourceMap = false; - } - raw = fs.readFileSync(filename, 'utf8'); - stripped = raw.charCodeAt(0) === 0xFEFF ? raw.substring(1) : raw; - try { - answer = compile(stripped, { - filename: filename, - sourceMap: sourceMap, - literate: helpers.isLiterate(filename) - }); - } catch (_error) { - err = _error; - throw helpers.updateSyntaxError(err, stripped, filename); - } - return answer; - }; - - lexer = new Lexer; - - parser.lexer = { - lex: function() { - var tag, token; - token = this.tokens[this.pos++]; - if (token) { - tag = token[0], this.yytext = token[1], this.yylloc = token[2]; - this.errorToken = token.origin || token; - this.yylineno = this.yylloc.first_line; - } else { - tag = ''; - } - return tag; - }, - setInput: function(tokens) { - this.tokens = tokens; - return this.pos = 0; - }, - upcomingInput: function() { - return ""; - } - }; - - parser.yy = require('./nodes'); - - parser.yy.parseError = function(message, _arg) { - var errorLoc, errorTag, errorText, errorToken, token, tokens, _ref1; - token = _arg.token; - _ref1 = parser.lexer, errorToken = _ref1.errorToken, tokens = _ref1.tokens; - errorTag = errorToken[0], errorText = errorToken[1], errorLoc = errorToken[2]; - errorText = errorToken === tokens[tokens.length - 1] ? 'end of input' : errorTag === 'INDENT' || errorTag === 'OUTDENT' ? 'indentation' : helpers.nameWhitespaceCharacter(errorText); - return helpers.throwSyntaxError("unexpected " + errorText, errorLoc); - }; - - formatSourcePosition = function(frame, getSourceMapping) { - var as, column, fileLocation, fileName, functionName, isConstructor, isMethodCall, line, methodName, source, tp, typeName; - fileName = void 0; - fileLocation = ''; - if (frame.isNative()) { - fileLocation = "native"; - } else { - if (frame.isEval()) { - fileName = frame.getScriptNameOrSourceURL(); - if (!fileName) { - fileLocation = "" + (frame.getEvalOrigin()) + ", "; - } - } else { - fileName = frame.getFileName(); - } - fileName || (fileName = ""); - line = frame.getLineNumber(); - column = frame.getColumnNumber(); - source = getSourceMapping(fileName, line, column); - fileLocation = source ? "" + fileName + ":" + source[0] + ":" + source[1] : "" + fileName + ":" + line + ":" + column; - } - functionName = frame.getFunctionName(); - isConstructor = frame.isConstructor(); - isMethodCall = !(frame.isToplevel() || isConstructor); - if (isMethodCall) { - methodName = frame.getMethodName(); - typeName = frame.getTypeName(); - if (functionName) { - tp = as = ''; - if (typeName && functionName.indexOf(typeName)) { - tp = "" + typeName + "."; - } - if (methodName && functionName.indexOf("." + methodName) !== functionName.length - methodName.length - 1) { - as = " [as " + methodName + "]"; - } - return "" + tp + functionName + as + " (" + fileLocation + ")"; - } else { - return "" + typeName + "." + (methodName || '') + " (" + fileLocation + ")"; - } - } else if (isConstructor) { - return "new " + (functionName || '') + " (" + fileLocation + ")"; - } else if (functionName) { - return "" + functionName + " (" + fileLocation + ")"; - } else { - return fileLocation; - } - }; - - sourceMaps = {}; - - getSourceMap = function(filename) { - var answer, _ref1; - if (sourceMaps[filename]) { - return sourceMaps[filename]; - } - if (_ref1 = path != null ? path.extname(filename) : void 0, __indexOf.call(exports.FILE_EXTENSIONS, _ref1) < 0) { - return; - } - answer = exports._compileFile(filename, true); - return sourceMaps[filename] = answer.sourceMap; - }; - - Error.prepareStackTrace = function(err, stack) { - var frame, frames, getSourceMapping; - getSourceMapping = function(filename, line, column) { - var answer, sourceMap; - sourceMap = getSourceMap(filename); - if (sourceMap) { - answer = sourceMap.sourceLocation([line - 1, column - 1]); - } - if (answer) { - return [answer[0] + 1, answer[1] + 1]; - } else { - return null; - } - }; - frames = (function() { - var _j, _len1, _results; - _results = []; - for (_j = 0, _len1 = stack.length; _j < _len1; _j++) { - frame = stack[_j]; - if (frame.getFunction() === exports.run) { - break; - } - _results.push(" at " + (formatSourcePosition(frame, getSourceMapping))); - } - return _results; - })(); - return "" + (err.toString()) + "\n" + (frames.join('\n')) + "\n"; - }; - -}).call(this); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/command.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/command.js deleted file mode 100644 index 357653b74..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/command.js +++ /dev/null @@ -1,572 +0,0 @@ -// Generated by CoffeeScript 1.8.0 -(function() { - var BANNER, CoffeeScript, EventEmitter, SWITCHES, compileJoin, compileOptions, compilePath, compileScript, compileStdio, exec, findDirectoryIndex, forkNode, fs, helpers, hidden, joinTimeout, mkdirp, notSources, optionParser, optparse, opts, outputPath, parseOptions, path, printLine, printTokens, printWarn, removeSource, removeSourceDir, silentUnlink, sourceCode, sources, spawn, timeLog, usage, useWinPathSep, version, wait, watch, watchDir, watchedDirs, writeJs, _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; }; - - fs = require('fs'); - - path = require('path'); - - helpers = require('./helpers'); - - optparse = require('./optparse'); - - CoffeeScript = require('./coffee-script'); - - mkdirp = require('mkdirp'); - - _ref = require('child_process'), spawn = _ref.spawn, exec = _ref.exec; - - EventEmitter = require('events').EventEmitter; - - useWinPathSep = path.sep === '\\'; - - 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'], ['-m', '--map', 'generate source map and save as .js.map files'], ['-n', '--nodes', 'print out the parse tree that the parser produces'], ['--nodejs [ARGS]', 'pass options directly to the "node" binary'], ['--no-header', 'suppress the "Generated by" header'], ['-o', '--output [DIR]', 'set the output directory for compiled JavaScript'], ['-p', '--print', 'print out the compiled JavaScript'], ['-s', '--stdio', 'listen for and compile scripts over stdio'], ['-l', '--literate', 'treat stdio as literate style coffee-script'], ['-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 = {}; - - watchedDirs = {}; - - optionParser = null; - - exports.run = function() { - var literals, replCliOpts, source, _i, _len, _ref1, _results; - parseOptions(); - replCliOpts = { - useGlobal: true - }; - if (opts.nodejs) { - return forkNode(); - } - if (opts.help) { - return usage(); - } - if (opts.version) { - return version(); - } - if (opts.interactive) { - return require('./repl').start(replCliOpts); - } - if (opts.stdio) { - return compileStdio(); - } - if (opts["eval"]) { - return compileScript(null, opts["arguments"][0]); - } - if (!opts["arguments"].length) { - return require('./repl').start(replCliOpts); - } - literals = opts.run ? opts["arguments"].splice(1) : []; - process.argv = process.argv.slice(0, 2).concat(literals); - process.argv[0] = 'coffee'; - if (opts.output) { - opts.output = path.resolve(opts.output); - } - if (opts.join) { - opts.join = path.resolve(opts.join); - console.error('\nThe --join option is deprecated and will be removed in a future version.\n\nIf for some reason it\'s necessary to share local variables between files,\nreplace...\n\n $ coffee --compile --join bundle.js -- a.coffee b.coffee c.coffee\n\nwith...\n\n $ cat a.coffee b.coffee c.coffee | coffee --compile --stdio > bundle.js\n'); - } - _ref1 = opts["arguments"]; - _results = []; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - source = _ref1[_i]; - source = path.resolve(source); - _results.push(compilePath(source, true, source)); - } - return _results; - }; - - compilePath = function(source, topLevel, base) { - var code, err, file, files, stats, _i, _len, _results; - if (__indexOf.call(sources, source) >= 0 || watchedDirs[source] || !topLevel && (notSources[source] || hidden(source))) { - return; - } - try { - stats = fs.statSync(source); - } catch (_error) { - err = _error; - if (err.code === 'ENOENT') { - console.error("File not found: " + source); - process.exit(1); - } - throw err; - } - if (stats.isDirectory()) { - if (path.basename(source) === 'node_modules') { - notSources[source] = true; - return; - } - if (opts.run) { - compilePath(findDirectoryIndex(source), topLevel, base); - return; - } - if (opts.watch) { - watchDir(source, base); - } - try { - files = fs.readdirSync(source); - } catch (_error) { - err = _error; - if (err.code === 'ENOENT') { - return; - } else { - throw err; - } - } - _results = []; - for (_i = 0, _len = files.length; _i < _len; _i++) { - file = files[_i]; - _results.push(compilePath(path.join(source, file), false, base)); - } - return _results; - } else if (topLevel || helpers.isCoffee(source)) { - sources.push(source); - sourceCode.push(null); - delete notSources[source]; - if (opts.watch) { - watch(source, base); - } - try { - code = fs.readFileSync(source); - } catch (_error) { - err = _error; - if (err.code === 'ENOENT') { - return; - } else { - throw err; - } - } - return compileScript(source, code.toString(), base); - } else { - return notSources[source] = true; - } - }; - - findDirectoryIndex = function(source) { - var err, ext, index, _i, _len, _ref1; - _ref1 = CoffeeScript.FILE_EXTENSIONS; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - ext = _ref1[_i]; - index = path.join(source, "index" + ext); - try { - if ((fs.statSync(index)).isFile()) { - return index; - } - } catch (_error) { - err = _error; - if (err.code !== 'ENOENT') { - throw err; - } - } - } - console.error("Missing index.coffee or index.litcoffee in " + source); - return process.exit(1); - }; - - compileScript = function(file, input, base) { - var compiled, err, message, o, options, t, task; - if (base == null) { - base = null; - } - o = opts; - options = compileOptions(file, base); - try { - t = task = { - file: file, - input: input, - options: options - }; - CoffeeScript.emit('compile', task); - if (o.tokens) { - return printTokens(CoffeeScript.tokens(t.input, t.options)); - } else if (o.nodes) { - return printLine(CoffeeScript.nodes(t.input, t.options).toString().trim()); - } else if (o.run) { - CoffeeScript.register(); - return CoffeeScript.run(t.input, t.options); - } else if (o.join && t.file !== o.join) { - if (helpers.isLiterate(file)) { - t.input = helpers.invertLiterate(t.input); - } - sourceCode[sources.indexOf(t.file)] = t.input; - return compileJoin(); - } else { - compiled = CoffeeScript.compile(t.input, t.options); - t.output = compiled; - if (o.map) { - t.output = compiled.js; - t.sourceMap = compiled.v3SourceMap; - } - CoffeeScript.emit('success', task); - if (o.print) { - return printLine(t.output.trim()); - } else if (o.compile || o.map) { - return writeJs(base, t.file, t.output, options.jsPath, t.sourceMap); - } - } - } catch (_error) { - err = _error; - CoffeeScript.emit('failure', err, task); - if (CoffeeScript.listeners('failure').length) { - return; - } - message = err.stack || ("" + err); - if (o.watch) { - return printLine(message + '\x07'); - } else { - printWarn(message); - 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); - }); - } - }; - - watch = function(source, base) { - var compile, compileTimeout, err, prevStats, rewatch, startWatcher, watchErr, watcher; - watcher = null; - prevStats = null; - compileTimeout = null; - watchErr = function(err) { - if (err.code !== 'ENOENT') { - throw err; - } - if (__indexOf.call(sources, source) < 0) { - return; - } - try { - rewatch(); - return compile(); - } catch (_error) { - removeSource(source, base); - return compileJoin(); - } - }; - 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(); - }); - }); - }); - }; - startWatcher = function() { - return watcher = fs.watch(source).on('change', compile).on('error', function(err) { - if (err.code !== 'EPERM') { - throw err; - } - return removeSource(source, base); - }); - }; - rewatch = function() { - if (watcher != null) { - watcher.close(); - } - return startWatcher(); - }; - try { - return startWatcher(); - } catch (_error) { - err = _error; - return watchErr(err); - } - }; - - watchDir = function(source, base) { - var err, readdirTimeout, startWatcher, stopWatcher, watcher; - watcher = null; - readdirTimeout = null; - startWatcher = function() { - return watcher = fs.watch(source).on('error', function(err) { - if (err.code !== 'EPERM') { - throw err; - } - return stopWatcher(); - }).on('change', function() { - clearTimeout(readdirTimeout); - return readdirTimeout = wait(25, function() { - var err, file, files, _i, _len, _results; - try { - files = fs.readdirSync(source); - } catch (_error) { - err = _error; - if (err.code !== 'ENOENT') { - throw err; - } - return stopWatcher(); - } - _results = []; - for (_i = 0, _len = files.length; _i < _len; _i++) { - file = files[_i]; - _results.push(compilePath(path.join(source, file), false, base)); - } - return _results; - }); - }); - }; - stopWatcher = function() { - watcher.close(); - return removeSourceDir(source, base); - }; - watchedDirs[source] = true; - try { - return startWatcher(); - } catch (_error) { - err = _error; - if (err.code !== 'ENOENT') { - throw err; - } - } - }; - - removeSourceDir = function(source, base) { - var file, sourcesChanged, _i, _len; - delete watchedDirs[source]; - sourcesChanged = false; - for (_i = 0, _len = sources.length; _i < _len; _i++) { - file = sources[_i]; - if (!(source === path.dirname(file))) { - continue; - } - removeSource(file, base); - sourcesChanged = true; - } - if (sourcesChanged) { - return compileJoin(); - } - }; - - removeSource = function(source, base) { - var index; - index = sources.indexOf(source); - sources.splice(index, 1); - sourceCode.splice(index, 1); - if (!opts.join) { - silentUnlink(outputPath(source, base)); - silentUnlink(outputPath(source, base, '.js.map')); - return timeLog("removed " + source); - } - }; - - silentUnlink = function(path) { - var err, _ref1; - try { - return fs.unlinkSync(path); - } catch (_error) { - err = _error; - if ((_ref1 = err.code) !== 'ENOENT' && _ref1 !== 'EPERM') { - throw err; - } - } - }; - - outputPath = function(source, base, extension) { - var basename, dir, srcDir; - if (extension == null) { - extension = ".js"; - } - basename = helpers.baseFileName(source, true, useWinPathSep); - srcDir = path.dirname(source); - if (!opts.output) { - dir = srcDir; - } else if (source === base) { - dir = opts.output; - } else { - dir = path.join(opts.output, path.relative(base, srcDir)); - } - return path.join(dir, basename + extension); - }; - - writeJs = function(base, sourcePath, js, jsPath, generatedSourceMap) { - var compile, jsDir, sourceMapPath; - if (generatedSourceMap == null) { - generatedSourceMap = null; - } - sourceMapPath = outputPath(sourcePath, base, ".js.map"); - jsDir = path.dirname(jsPath); - compile = function() { - if (opts.compile) { - if (js.length <= 0) { - js = ' '; - } - if (generatedSourceMap) { - js = "" + js + "\n//# sourceMappingURL=" + (helpers.baseFileName(sourceMapPath, false, useWinPathSep)) + "\n"; - } - fs.writeFile(jsPath, js, function(err) { - if (err) { - printLine(err.message); - return process.exit(1); - } else if (opts.compile && opts.watch) { - return timeLog("compiled " + sourcePath); - } - }); - } - if (generatedSourceMap) { - return fs.writeFile(sourceMapPath, generatedSourceMap, function(err) { - if (err) { - printLine("Could not write source map: " + err.message); - return process.exit(1); - } - }); - } - }; - return fs.exists(jsDir, function(itExists) { - if (itExists) { - return compile(); - } else { - return mkdirp(jsDir, compile); - } - }); - }; - - wait = function(milliseconds, func) { - return setTimeout(func, milliseconds); - }; - - timeLog = function(message) { - return console.log("" + ((new Date).toLocaleTimeString()) + " - " + message); - }; - - printTokens = function(tokens) { - var strings, tag, token, value; - strings = (function() { - var _i, _len, _results; - _results = []; - for (_i = 0, _len = tokens.length; _i < _len; _i++) { - token = tokens[_i]; - tag = token[0]; - value = token[1].toString().replace(/\n/, '\\n'); - _results.push("[" + tag + " " + value + "]"); - } - return _results; - })(); - return printLine(strings.join(' ')); - }; - - parseOptions = function() { - var o; - 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.map); - return o.print = !!(o.print || (o["eval"] || o.stdio && o.compile)); - }; - - compileOptions = function(filename, base) { - var answer, cwd, jsDir, jsPath; - answer = { - filename: filename, - literate: opts.literate || helpers.isLiterate(filename), - bare: opts.bare, - header: opts.compile && !opts['no-header'], - sourceMap: opts.map - }; - if (filename) { - if (base) { - cwd = process.cwd(); - jsPath = outputPath(filename, base); - jsDir = path.dirname(jsPath); - answer = helpers.merge(answer, { - jsPath: jsPath, - sourceRoot: path.relative(jsDir, cwd), - sourceFiles: [path.relative(cwd, filename)], - generatedFile: helpers.baseFileName(jsPath, false, useWinPathSep) - }); - } else { - answer = helpers.merge(answer, { - sourceRoot: "", - sourceFiles: [helpers.baseFileName(filename, false, useWinPathSep)], - generatedFile: helpers.baseFileName(filename, true, useWinPathSep) + ".js" - }); - } - } - return answer; - }; - - forkNode = function() { - var args, nodeArgs, p; - nodeArgs = opts.nodejs.split(/\s+/); - args = process.argv.slice(1); - args.splice(args.indexOf('--nodejs'), 2); - p = spawn(process.execPath, nodeArgs.concat(args), { - cwd: process.cwd(), - env: process.env, - customFds: [0, 1, 2] - }); - return p.on('exit', function(code) { - return process.exit(code); - }); - }; - - 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/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/grammar.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/grammar.js deleted file mode 100644 index cfcab24cf..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/grammar.js +++ /dev/null @@ -1,631 +0,0 @@ -// Generated by CoffeeScript 1.8.0 -(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 addLocationDataFn, match, patternCount; - patternString = patternString.replace(/\s{2,}/g, ' '); - patternCount = patternString.split(' ').length; - 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.$&'); - addLocationDataFn = function(first, last) { - if (!last) { - return "yy.addLocationDataFn(@" + first + ")"; - } else { - return "yy.addLocationDataFn(@" + first + ", @" + last + ")"; - } - }; - action = action.replace(/LOC\(([0-9]*)\)/g, addLocationDataFn('$1')); - action = action.replace(/LOC\(([0-9]*),\s*([0-9]*)\)/g, addLocationDataFn('$1', '$2')); - return [patternString, "$$ = " + (addLocationDataFn(1, patternCount)) + "(" + action + ");", options]; - }; - - grammar = { - Root: [ - o('', function() { - return new Block; - }), o('Body') - ], - 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(LOC(1)(new Value($1)), $3, 'object'); - }), o('ObjAssignable : INDENT Expression OUTDENT', function() { - return new Assign(LOC(1)(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); - }), o('...', function() { - return new Expansion; - }) - ], - 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 [LOC(1)(new Access(new Literal('prototype'))), LOC(2)(new Access($2))]; - }), o('?:: Identifier', function() { - return [LOC(1)(new Access(new Literal('prototype'), 'soak')), LOC(2)(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(LOC(1)(new Literal('this')), [LOC(2)(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'), o('...', function() { - return new Expansion; - }) - ], - 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]; - }), o('CATCH Object Block', function() { - return [LOC(2)(new Value($2)), $3]; - }), o('CATCH Block', function() { - return [null, $2]; - }) - ], - 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(LOC(1)(Block.wrap([$1]))); - }), o('Expression WhileSource', function() { - return $2.addBody(LOC(1)(Block.wrap([$1]))); - }), o('Loop', function() { - return $1; - }) - ], - Loop: [ - o('LOOP Block', function() { - return new While(LOC(1)(new Literal('true'))).addBody($2); - }), o('LOOP Expression', function() { - return new While(LOC(1)(new Literal('true'))).addBody(LOC(2)(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: LOC(2)(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(LOC(3, 5)(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, LOC(1)(Block.wrap([$1])), { - type: $2, - statement: true - }); - }), o('Expression POST_IF Expression', function() { - return new If($3, LOC(1)(Block.wrap([$1])), { - type: $2, - statement: true - }); - }) - ], - Operation: [ - o('UNARY Expression', function() { - return new Op($1, $2); - }), o('UNARY_MATH Expression', function() { - return new Op($1, $2); - }), o('- Expression', (function() { - return new Op('-', $2); - }), { - prec: 'UNARY_MATH' - }), o('+ Expression', (function() { - return new Op('+', $2); - }), { - prec: 'UNARY_MATH' - }), 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 ** 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 COMPOUND_ASSIGN TERMINATOR Expression', 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'], ['right', '**'], ['right', 'UNARY_MATH'], ['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'], ['left', '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/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/helpers.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/helpers.js deleted file mode 100644 index 049f757f1..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/helpers.js +++ /dev/null @@ -1,252 +0,0 @@ -// Generated by CoffeeScript 1.8.0 -(function() { - var buildLocationData, extend, flatten, last, repeat, syntaxErrorToString, _ref; - - 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.repeat = repeat = function(str, n) { - var res; - res = ''; - while (n > 0) { - if (n & 1) { - res += str; - } - n >>>= 1; - str += str; - } - return res; - }; - - 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 = last = function(array, back) { - return array[array.length - (back || 0) - 1]; - }; - - exports.some = (_ref = Array.prototype.some) != null ? _ref : function(fn) { - var e, _i, _len; - for (_i = 0, _len = this.length; _i < _len; _i++) { - e = this[_i]; - if (fn(e)) { - return true; - } - } - return false; - }; - - exports.invertLiterate = function(code) { - var line, lines, maybe_code; - maybe_code = true; - lines = (function() { - var _i, _len, _ref1, _results; - _ref1 = code.split('\n'); - _results = []; - for (_i = 0, _len = _ref1.length; _i < _len; _i++) { - line = _ref1[_i]; - if (maybe_code && /^([ ]{4}|[ ]{0,3}\t)/.test(line)) { - _results.push(line); - } else if (maybe_code = /^\s*$/.test(line)) { - _results.push(line); - } else { - _results.push('# ' + line); - } - } - return _results; - })(); - return lines.join('\n'); - }; - - buildLocationData = function(first, last) { - if (!last) { - return first; - } else { - return { - first_line: first.first_line, - first_column: first.first_column, - last_line: last.last_line, - last_column: last.last_column - }; - } - }; - - exports.addLocationDataFn = function(first, last) { - return function(obj) { - if (((typeof obj) === 'object') && (!!obj['updateLocationDataIfMissing'])) { - obj.updateLocationDataIfMissing(buildLocationData(first, last)); - } - return obj; - }; - }; - - exports.locationDataToString = function(obj) { - var locationData; - if (("2" in obj) && ("first_line" in obj[2])) { - locationData = obj[2]; - } else if ("first_line" in obj) { - locationData = obj; - } - if (locationData) { - return ("" + (locationData.first_line + 1) + ":" + (locationData.first_column + 1) + "-") + ("" + (locationData.last_line + 1) + ":" + (locationData.last_column + 1)); - } else { - return "No location data"; - } - }; - - exports.baseFileName = function(file, stripExt, useWinPathSep) { - var parts, pathSep; - if (stripExt == null) { - stripExt = false; - } - if (useWinPathSep == null) { - useWinPathSep = false; - } - pathSep = useWinPathSep ? /\\|\// : /\//; - parts = file.split(pathSep); - file = parts[parts.length - 1]; - if (!(stripExt && file.indexOf('.') >= 0)) { - return file; - } - parts = file.split('.'); - parts.pop(); - if (parts[parts.length - 1] === 'coffee' && parts.length > 1) { - parts.pop(); - } - return parts.join('.'); - }; - - exports.isCoffee = function(file) { - return /\.((lit)?coffee|coffee\.md)$/.test(file); - }; - - exports.isLiterate = function(file) { - return /\.(litcoffee|coffee\.md)$/.test(file); - }; - - exports.throwSyntaxError = function(message, location) { - var error; - error = new SyntaxError(message); - error.location = location; - error.toString = syntaxErrorToString; - error.stack = error.toString(); - throw error; - }; - - exports.updateSyntaxError = function(error, code, filename) { - if (error.toString === syntaxErrorToString) { - error.code || (error.code = code); - error.filename || (error.filename = filename); - error.stack = error.toString(); - } - return error; - }; - - syntaxErrorToString = function() { - var codeLine, colorize, colorsEnabled, end, filename, first_column, first_line, last_column, last_line, marker, start, _ref1, _ref2; - if (!(this.code && this.location)) { - return Error.prototype.toString.call(this); - } - _ref1 = this.location, first_line = _ref1.first_line, first_column = _ref1.first_column, last_line = _ref1.last_line, last_column = _ref1.last_column; - if (last_line == null) { - last_line = first_line; - } - if (last_column == null) { - last_column = first_column; - } - filename = this.filename || '[stdin]'; - codeLine = this.code.split('\n')[first_line]; - start = first_column; - end = first_line === last_line ? last_column + 1 : codeLine.length; - marker = codeLine.slice(0, start).replace(/[^\s]/g, ' ') + repeat('^', end - start); - if (typeof process !== "undefined" && process !== null) { - colorsEnabled = process.stdout.isTTY && !process.env.NODE_DISABLE_COLORS; - } - if ((_ref2 = this.colorful) != null ? _ref2 : colorsEnabled) { - colorize = function(str) { - return "\x1B[1;31m" + str + "\x1B[0m"; - }; - codeLine = codeLine.slice(0, start) + colorize(codeLine.slice(start, end)) + codeLine.slice(end); - marker = colorize(marker); - } - return "" + filename + ":" + (first_line + 1) + ":" + (first_column + 1) + ": error: " + this.message + "\n" + codeLine + "\n" + marker; - }; - - exports.nameWhitespaceCharacter = function(string) { - switch (string) { - case ' ': - return 'space'; - case '\n': - return 'newline'; - case '\r': - return 'carriage return'; - case '\t': - return 'tab'; - default: - return string; - } - }; - -}).call(this); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/index.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/index.js deleted file mode 100644 index 46c97ea5f..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/index.js +++ /dev/null @@ -1,11 +0,0 @@ -// Generated by CoffeeScript 1.8.0 -(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/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/lexer.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/lexer.js deleted file mode 100644 index 0f3cef8e1..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/lexer.js +++ /dev/null @@ -1,934 +0,0 @@ -// Generated by CoffeeScript 1.8.0 -(function() { - var BOM, BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_ILLEGAL, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDENTABLE_CLOSERS, 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, UNARY_MATH, WHITESPACE, compact, count, invertLiterate, key, last, locationDataToString, repeat, starts, throwSyntaxError, _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, repeat = _ref1.repeat, invertLiterate = _ref1.invertLiterate, locationDataToString = _ref1.locationDataToString, throwSyntaxError = _ref1.throwSyntaxError; - - exports.Lexer = Lexer = (function() { - function Lexer() {} - - Lexer.prototype.tokenize = function(code, opts) { - var consumed, i, tag, _ref2; - if (opts == null) { - opts = {}; - } - this.literate = opts.literate; - this.indent = 0; - this.baseIndent = 0; - this.indebt = 0; - this.outdebt = 0; - this.indents = []; - this.ends = []; - this.tokens = []; - this.chunkLine = opts.line || 0; - this.chunkColumn = opts.column || 0; - code = this.clean(code); - i = 0; - while (this.chunk = code.slice(i)) { - consumed = this.identifierToken() || this.commentToken() || this.whitespaceToken() || this.lineToken() || this.heredocToken() || this.stringToken() || this.numberToken() || this.regexToken() || this.jsToken() || this.literalToken(); - _ref2 = this.getLineAndColumnFromChunk(consumed), this.chunkLine = _ref2[0], this.chunkColumn = _ref2[1]; - i += consumed; - } - 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.clean = function(code) { - if (code.charCodeAt(0) === BOM) { - code = code.slice(1); - } - code = code.replace(/\r/g, '').replace(TRAILING_SPACES, ''); - if (WHITESPACE.test(code)) { - code = "\n" + code; - this.chunkLine--; - } - if (this.literate) { - code = invertLiterate(code); - } - return code; - }; - - Lexer.prototype.identifierToken = function() { - var colon, colonOffset, forcedIdentifier, id, idLength, input, match, poppedToken, prev, tag, tagToken, _ref2, _ref3, _ref4; - if (!(match = IDENTIFIER.exec(this.chunk))) { - return 0; - } - input = match[0], id = match[1], colon = match[2]; - idLength = id.length; - poppedToken = void 0; - if (id === 'own' && this.tag() === 'FOR') { - this.token('OWN', id); - return id.length; - } - forcedIdentifier = colon || (prev = last(this.tokens)) && (((_ref2 = prev[0]) === '.' || _ref2 === '?.' || _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() === '!') { - poppedToken = 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; - } - })(); - } - tagToken = this.token(tag, id, 0, idLength); - if (poppedToken) { - _ref4 = [poppedToken[2].first_line, poppedToken[2].first_column], tagToken[2].first_line = _ref4[0], tagToken[2].first_column = _ref4[1]; - } - if (colon) { - colonOffset = input.lastIndexOf(':'); - this.token(':', ':', colonOffset, colon.length); - } - 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, 0, lexedLength); - return lexedLength; - }; - - Lexer.prototype.stringToken = function() { - var inner, innerLen, numBreak, octalEsc, pos, quote, string, trimmed; - switch (quote = this.chunk.charAt(0)) { - case "'": - string = (SIMPLESTR.exec(this.chunk) || [])[0]; - break; - case '"': - string = this.balancedString(this.chunk, '"'); - } - if (!string) { - return 0; - } - inner = string.slice(1, -1); - trimmed = this.removeNewlines(inner); - if (quote === '"' && 0 < string.indexOf('#{', 1)) { - numBreak = pos = 0; - innerLen = inner.length; - while (inner.charAt(pos++) === '\n' && pos < innerLen) { - numBreak++; - } - this.interpolateString(trimmed, { - strOffset: 1 + numBreak, - lexedLength: string.length - }); - } else { - this.token('STRING', quote + this.escapeLines(trimmed) + quote, 0, string.length); - } - if (octalEsc = /^(?:\\.|[^\\])*\\(?:0[0-7]|[1-7])/.test(string)) { - this.error("octal escape sequences " + string + " are not allowed"); - } - return string.length; - }; - - Lexer.prototype.heredocToken = function() { - var doc, heredoc, match, quote, strOffset; - 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('#{')) { - strOffset = match[2].charAt(0) === '\n' ? 4 : 3; - this.interpolateString(doc, { - heredoc: true, - strOffset: strOffset, - lexedLength: heredoc.length - }); - } else { - this.token('STRING', this.makeString(doc, quote, true), 0, heredoc.length); - } - 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: repeat(' ', this.indent) - }), 0, comment.length); - } - 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), 0, script.length); - return script.length; - }; - - Lexer.prototype.regexToken = function() { - var flags, length, match, prev, regex, _ref2, _ref3; - if (this.chunk.charAt(0) !== '/') { - return 0; - } - if (length = this.heregexToken()) { - 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 === '//') { - return 0; - } - if (regex.slice(0, 2) === '/*') { - this.error('regular expressions cannot begin with `*`'); - } - this.token('REGEX', "" + regex + flags, 0, match.length); - return match.length; - }; - - Lexer.prototype.heregexToken = function() { - var body, flags, flagsOffset, heregex, match, plusToken, prev, re, tag, token, tokens, value, _i, _len, _ref2, _ref3, _ref4; - if (!(match = HEREGEX.exec(this.chunk))) { - return 0; - } - heregex = match[0], body = match[1], flags = match[2]; - if (0 > body.indexOf('#{')) { - re = this.escapeLines(body.replace(HEREGEX_OMIT, '$1$2').replace(/\//g, '\\/'), true); - if (re.match(/^\*/)) { - this.error('regular expressions cannot begin with `*`'); - } - this.token('REGEX', "/" + (re || '(?:)') + "/" + flags, 0, heregex.length); - return heregex.length; - } - this.token('IDENTIFIER', 'RegExp', 0, 0); - this.token('CALL_START', '(', 0, 0); - tokens = []; - _ref2 = this.interpolateString(body, { - regex: true, - strOffset: 3 - }); - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - token = _ref2[_i]; - tag = token[0], value = token[1]; - if (tag === 'TOKENS') { - tokens.push.apply(tokens, value); - } else if (tag === 'NEOSTRING') { - if (!(value = value.replace(HEREGEX_OMIT, '$1$2'))) { - continue; - } - value = value.replace(/\\/g, '\\\\'); - token[0] = 'STRING'; - token[1] = this.makeString(value, '"', true); - tokens.push(token); - } else { - this.error("Unexpected " + tag); - } - prev = last(this.tokens); - plusToken = ['+', '+']; - plusToken[2] = prev[2]; - tokens.push(plusToken); - } - tokens.pop(); - if (((_ref3 = tokens[0]) != null ? _ref3[0] : void 0) !== 'STRING') { - this.token('STRING', '""', 0, 0); - this.token('+', '+', 0, 0); - } - (_ref4 = this.tokens).push.apply(_ref4, tokens); - if (flags) { - flagsOffset = heregex.lastIndexOf(flags); - this.token(',', ',', flagsOffset, 0); - this.token('STRING', '"' + flags + '"', flagsOffset, flags.length); - } - this.token(')', ')', heregex.length - 1, 0); - return heregex.length; - }; - - Lexer.prototype.lineToken = function() { - var diff, indent, match, noNewlines, size; - if (!(match = MULTI_DENT.exec(this.chunk))) { - return 0; - } - indent = match[0]; - this.seenFor = false; - size = indent.length - 1 - indent.lastIndexOf('\n'); - noNewlines = this.unfinished(); - if (size - this.indebt === this.indent) { - if (noNewlines) { - this.suppressNewlines(); - } else { - this.newlineToken(0); - } - return indent.length; - } - if (size > this.indent) { - if (noNewlines) { - this.indebt = size - this.indent; - this.suppressNewlines(); - return indent.length; - } - if (!this.tokens.length) { - this.baseIndent = this.indent = size; - return indent.length; - } - diff = size - this.indent + this.outdebt; - this.token('INDENT', diff, indent.length - size, size); - this.indents.push(diff); - this.ends.push('OUTDENT'); - this.outdebt = this.indebt = 0; - this.indent = size; - } else if (size < this.baseIndent) { - this.error('missing indentation', indent.length); - } else { - this.indebt = 0; - this.outdentToken(this.indent - size, noNewlines, indent.length); - } - return indent.length; - }; - - Lexer.prototype.outdentToken = function(moveOut, noNewlines, outdentLength) { - var decreasedIndent, dent, lastIndent, _ref2; - decreasedIndent = this.indent - moveOut; - while (moveOut > 0) { - lastIndent = this.indents[this.indents.length - 1]; - if (!lastIndent) { - moveOut = 0; - } else if (lastIndent === this.outdebt) { - moveOut -= this.outdebt; - this.outdebt = 0; - } else if (lastIndent < this.outdebt) { - this.outdebt -= lastIndent; - moveOut -= lastIndent; - } else { - dent = this.indents.pop() + this.outdebt; - if (outdentLength && (_ref2 = this.chunk[outdentLength], __indexOf.call(INDENTABLE_CLOSERS, _ref2) >= 0)) { - decreasedIndent -= dent - moveOut; - moveOut = dent; - } - this.outdebt = 0; - this.pair('OUTDENT'); - this.token('OUTDENT', moveOut, 0, outdentLength); - moveOut -= dent; - } - } - if (dent) { - this.outdebt -= moveOut; - } - while (this.value() === ';') { - this.tokens.pop(); - } - if (!(this.tag() === 'TERMINATOR' || noNewlines)) { - this.token('TERMINATOR', '\n', outdentLength, 0); - } - this.indent = decreasedIndent; - 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(offset) { - while (this.value() === ';') { - this.tokens.pop(); - } - if (this.tag() !== 'TERMINATOR') { - this.token('TERMINATOR', '\n', offset, 0); - } - 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(UNARY_MATH, value) >= 0) { - tag = 'UNARY_MATH'; - } 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 column, errorToken, expr, heredoc, i, inner, interpolated, len, letter, lexedLength, line, locationToken, nested, offsetInChunk, pi, plusToken, popped, regex, rparen, strOffset, tag, token, tokens, value, _i, _len, _ref2, _ref3, _ref4; - if (options == null) { - options = {}; - } - heredoc = options.heredoc, regex = options.regex, offsetInChunk = options.offsetInChunk, strOffset = options.strOffset, lexedLength = options.lexedLength; - offsetInChunk || (offsetInChunk = 0); - strOffset || (strOffset = 0); - lexedLength || (lexedLength = str.length); - 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(this.makeToken('NEOSTRING', str.slice(pi, i), strOffset + pi)); - } - if (!errorToken) { - errorToken = this.makeToken('', 'string interpolation', offsetInChunk + i + 1, 2); - } - inner = expr.slice(1, -1); - if (inner.length) { - _ref2 = this.getLineAndColumnFromChunk(strOffset + i + 2), line = _ref2[0], column = _ref2[1]; - nested = new Lexer().tokenize(inner, { - line: line, - column: column, - rewrite: false - }); - popped = nested.pop(); - if (((_ref3 = nested[0]) != null ? _ref3[0] : void 0) === 'TERMINATOR') { - popped = nested.shift(); - } - if (len = nested.length) { - if (len > 1) { - nested.unshift(this.makeToken('(', '(', strOffset + i + 1, 0)); - nested.push(this.makeToken(')', ')', strOffset + i + 1 + inner.length, 0)); - } - tokens.push(['TOKENS', nested]); - } - } - i += expr.length; - pi = i + 1; - } - if ((i > pi && pi < str.length)) { - tokens.push(this.makeToken('NEOSTRING', str.slice(pi), strOffset + pi)); - } - if (regex) { - return tokens; - } - if (!tokens.length) { - return this.token('STRING', '""', offsetInChunk, lexedLength); - } - if (tokens[0][0] !== 'NEOSTRING') { - tokens.unshift(this.makeToken('NEOSTRING', '', offsetInChunk)); - } - if (interpolated = tokens.length > 1) { - this.token('(', '(', offsetInChunk, 0, errorToken); - } - for (i = _i = 0, _len = tokens.length; _i < _len; i = ++_i) { - token = tokens[i]; - tag = token[0], value = token[1]; - if (i) { - if (i) { - plusToken = this.token('+', '+'); - } - locationToken = tag === 'TOKENS' ? value[0] : token; - plusToken[2] = { - first_line: locationToken[2].first_line, - first_column: locationToken[2].first_column, - last_line: locationToken[2].first_line, - last_column: locationToken[2].first_column - }; - } - if (tag === 'TOKENS') { - (_ref4 = this.tokens).push.apply(_ref4, value); - } else if (tag === 'NEOSTRING') { - token[0] = 'STRING'; - token[1] = this.makeString(value, '"', heredoc); - this.tokens.push(token); - } else { - this.error("Unexpected " + tag); - } - } - if (interpolated) { - rparen = this.makeToken(')', ')', offsetInChunk + lexedLength, 0); - rparen.stringEnd = true; - this.tokens.push(rparen); - } - return tokens; - }; - - Lexer.prototype.pair = function(tag) { - var wanted; - if (tag !== (wanted = last(this.ends))) { - if ('OUTDENT' !== wanted) { - this.error("unmatched " + tag); - } - this.outdentToken(last(this.indents), true); - return this.pair(tag); - } - return this.ends.pop(); - }; - - Lexer.prototype.getLineAndColumnFromChunk = function(offset) { - var column, lineCount, lines, string; - if (offset === 0) { - return [this.chunkLine, this.chunkColumn]; - } - if (offset >= this.chunk.length) { - string = this.chunk; - } else { - string = this.chunk.slice(0, +(offset - 1) + 1 || 9e9); - } - lineCount = count(string, '\n'); - column = this.chunkColumn; - if (lineCount > 0) { - lines = string.split('\n'); - column = last(lines).length; - } else { - column += string.length; - } - return [this.chunkLine + lineCount, column]; - }; - - Lexer.prototype.makeToken = function(tag, value, offsetInChunk, length) { - var lastCharacter, locationData, token, _ref2, _ref3; - if (offsetInChunk == null) { - offsetInChunk = 0; - } - if (length == null) { - length = value.length; - } - locationData = {}; - _ref2 = this.getLineAndColumnFromChunk(offsetInChunk), locationData.first_line = _ref2[0], locationData.first_column = _ref2[1]; - lastCharacter = Math.max(0, length - 1); - _ref3 = this.getLineAndColumnFromChunk(offsetInChunk + lastCharacter), locationData.last_line = _ref3[0], locationData.last_column = _ref3[1]; - token = [tag, value, locationData]; - return token; - }; - - Lexer.prototype.token = function(tag, value, offsetInChunk, length, origin) { - var token; - token = this.makeToken(tag, value, offsetInChunk, length); - if (origin) { - token.origin = origin; - } - this.tokens.push(token); - return token; - }; - - 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 === '?::' || _ref2 === 'UNARY' || _ref2 === 'MATH' || _ref2 === 'UNARY_MATH' || _ref2 === '+' || _ref2 === '-' || _ref2 === '**' || _ref2 === 'SHIFT' || _ref2 === 'RELATION' || _ref2 === 'COMPARE' || _ref2 === 'LOGIC' || _ref2 === 'THROW' || _ref2 === 'EXTENDS'); - }; - - Lexer.prototype.removeNewlines = function(str) { - return str.replace(/^\s*\n\s*/, '').replace(/([^\\]|\\\\)\s*\n\s*$/, '$1'); - }; - - Lexer.prototype.escapeLines = function(str, heredoc) { - str = str.replace(/\\[^\S\n]*(\n|\\)\s*/g, function(escaped, character) { - if (character === '\n') { - return ''; - } else { - return escaped; - } - }); - if (heredoc) { - return str.replace(MULTILINER, '\\n'); - } else { - return str.replace(/\s*\n\s*/g, ' '); - } - }; - - Lexer.prototype.makeString = function(body, quote, heredoc) { - if (!body) { - return quote + quote; - } - body = body.replace(RegExp("\\\\(" + quote + "|\\\\)", "g"), function(match, contents) { - if (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, offset) { - var first_column, first_line, _ref2; - if (offset == null) { - offset = 0; - } - _ref2 = this.getLineAndColumnFromChunk(offset), first_line = _ref2[0], first_column = _ref2[1]; - return throwSyntaxError(message, { - first_line: first_line, - first_column: first_column - }); - }; - - 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', '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; - - BOM = 65279; - - 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 = /^'[^\\']*(?:\\[\s\S][^\\']*)*'/; - - 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|\/)|\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']; - - UNARY_MATH = ['!', '~']; - - 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']; - - INDENTABLE_CLOSERS = [')', '}', ']']; - -}).call(this); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/nodes.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/nodes.js deleted file mode 100644 index 52c99a9f8..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/nodes.js +++ /dev/null @@ -1,3156 +0,0 @@ -// Generated by CoffeeScript 1.8.0 -(function() { - var Access, Arr, Assign, Base, Block, Call, Class, Code, CodeFragment, Comment, Existence, Expansion, Extends, For, HEXNUM, IDENTIFIER, IDENTIFIER_STR, IS_REGEX, IS_STRING, If, In, Index, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, METHOD_DEF, NEGATE, NO, NUMBER, Obj, Op, Param, Parens, RESERVED, Range, Return, SIMPLENUM, STRICT_PROSCRIBED, Scope, Slice, Splat, Switch, TAB, THIS, Throw, Try, UTILITIES, Value, While, YES, addLocationDataFn, compact, del, ends, extend, flatten, fragmentsToText, isLiteralArguments, isLiteralThis, last, locationDataToString, merge, multident, parseNum, some, starts, throwSyntaxError, 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; }, - __slice = [].slice; - - Error.stackTraceLimit = Infinity; - - 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, some = _ref1.some, addLocationDataFn = _ref1.addLocationDataFn, locationDataToString = _ref1.locationDataToString, throwSyntaxError = _ref1.throwSyntaxError; - - exports.extend = extend; - - exports.addLocationDataFn = addLocationDataFn; - - YES = function() { - return true; - }; - - NO = function() { - return false; - }; - - THIS = function() { - return this; - }; - - NEGATE = function() { - this.negated = !this.negated; - return this; - }; - - exports.CodeFragment = CodeFragment = (function() { - function CodeFragment(parent, code) { - var _ref2; - this.code = "" + code; - this.locationData = parent != null ? parent.locationData : void 0; - this.type = (parent != null ? (_ref2 = parent.constructor) != null ? _ref2.name : void 0 : void 0) || 'unknown'; - } - - CodeFragment.prototype.toString = function() { - return "" + this.code + (this.locationData ? ": " + locationDataToString(this.locationData) : ''); - }; - - return CodeFragment; - - })(); - - fragmentsToText = function(fragments) { - var fragment; - return ((function() { - var _i, _len, _results; - _results = []; - for (_i = 0, _len = fragments.length; _i < _len; _i++) { - fragment = fragments[_i]; - _results.push(fragment.code); - } - return _results; - })()).join(''); - }; - - exports.Base = Base = (function() { - function Base() {} - - Base.prototype.compile = function(o, lvl) { - return fragmentsToText(this.compileToFragments(o, lvl)); - }; - - Base.prototype.compileToFragments = 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) { - var args, argumentsNode, func, jumpNode, meth; - if (jumpNode = this.jumps()) { - jumpNode.error('cannot use a pure statement in an expression'); - } - o.sharedScope = true; - func = new Code([], Block.wrap([this])); - args = []; - if ((argumentsNode = this.contains(isLiteralArguments)) || this.contains(isLiteralThis)) { - args = [new Literal('this')]; - if (argumentsNode) { - meth = 'apply'; - args.push(new Literal('arguments')); - } else { - meth = 'call'; - } - func = new Value(func, [new Access(new Literal(meth))]); - } - return (new Call(func, args)).compileNode(o); - }; - - Base.prototype.cache = function(o, level, reused) { - var ref, sub; - if (!this.isComplex()) { - ref = level ? this.compileToFragments(o, level) : this; - return [ref, ref]; - } else { - ref = new Literal(reused || o.scope.freeVariable('ref')); - sub = new Assign(ref, this); - if (level) { - return [sub.compileToFragments(o, level), [this.makeCode(ref.value)]]; - } else { - return [sub, ref]; - } - } - }; - - Base.prototype.cacheToCodeFragments = function(cacheValues) { - return [fragmentsToText(cacheValues[0]), fragmentsToText(cacheValues[1])]; - }; - - 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 node; - node = void 0; - this.traverseChildren(false, function(n) { - if (pred(n)) { - node = n; - return false; - } - }); - return node; - }; - - 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) { - var recur; - recur = func(child); - if (recur !== 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; - - Base.prototype.updateLocationDataIfMissing = function(locationData) { - if (this.locationData) { - return this; - } - this.locationData = locationData; - return this.eachChild(function(child) { - return child.updateLocationDataIfMissing(locationData); - }); - }; - - Base.prototype.error = function(message) { - return throwSyntaxError(message, this.locationData); - }; - - Base.prototype.makeCode = function(code) { - return new CodeFragment(this, code); - }; - - Base.prototype.wrapInBraces = function(fragments) { - return [].concat(this.makeCode('('), fragments, this.makeCode(')')); - }; - - Base.prototype.joinFragmentArrays = function(fragmentsList, joinStr) { - var answer, fragments, i, _i, _len; - answer = []; - for (i = _i = 0, _len = fragmentsList.length; _i < _len; i = ++_i) { - fragments = fragmentsList[i]; - if (i) { - answer.push(this.makeCode(joinStr)); - } - answer = answer.concat(fragments); - } - return answer; - }; - - 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, jumpNode, _i, _len, _ref2; - _ref2 = this.expressions; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - exp = _ref2[_i]; - if (jumpNode = exp.jumps(o)) { - return jumpNode; - } - } - }; - - 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.compileToFragments = function(o, level) { - if (o == null) { - o = {}; - } - if (o.scope) { - return Block.__super__.compileToFragments.call(this, o, level); - } else { - return this.compileRoot(o); - } - }; - - Block.prototype.compileNode = function(o) { - var answer, compiledNodes, fragments, index, node, top, _i, _len, _ref2; - this.tab = o.indent; - top = o.level === LEVEL_TOP; - compiledNodes = []; - _ref2 = this.expressions; - for (index = _i = 0, _len = _ref2.length; _i < _len; index = ++_i) { - node = _ref2[index]; - node = node.unwrapAll(); - node = node.unfoldSoak(o) || node; - if (node instanceof Block) { - compiledNodes.push(node.compileNode(o)); - } else if (top) { - node.front = true; - fragments = node.compileToFragments(o); - if (!node.isStatement(o)) { - fragments.unshift(this.makeCode("" + this.tab)); - fragments.push(this.makeCode(";")); - } - compiledNodes.push(fragments); - } else { - compiledNodes.push(node.compileToFragments(o, LEVEL_LIST)); - } - } - if (top) { - if (this.spaced) { - return [].concat(this.joinFragmentArrays(compiledNodes, '\n\n'), this.makeCode("\n")); - } else { - return this.joinFragmentArrays(compiledNodes, '\n'); - } - } - if (compiledNodes.length) { - answer = this.joinFragmentArrays(compiledNodes, ', '); - } else { - answer = [this.makeCode("void 0")]; - } - if (compiledNodes.length > 1 && o.level >= LEVEL_LIST) { - return this.wrapInBraces(answer); - } else { - return answer; - } - }; - - Block.prototype.compileRoot = function(o) { - var exp, fragments, i, name, prelude, preludeExps, rest, _i, _len, _ref2; - o.indent = o.bare ? '' : TAB; - o.level = LEVEL_TOP; - this.spaced = true; - o.scope = new Scope(null, this, null); - _ref2 = o.locals || []; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - name = _ref2[_i]; - o.scope.parameter(name); - } - prelude = []; - if (!o.bare) { - preludeExps = (function() { - var _j, _len1, _ref3, _results; - _ref3 = this.expressions; - _results = []; - for (i = _j = 0, _len1 = _ref3.length; _j < _len1; i = ++_j) { - exp = _ref3[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: '' - })); - prelude.push(this.makeCode("\n")); - } - this.expressions = rest; - } - fragments = this.compileWithDeclarations(o); - if (o.bare) { - return fragments; - } - return [].concat(prelude, this.makeCode("(function() {\n"), fragments, this.makeCode("\n}).call(this);\n")); - }; - - Block.prototype.compileWithDeclarations = function(o) { - var assigns, declars, exp, fragments, i, post, rest, scope, spaced, _i, _len, _ref2, _ref3, _ref4; - fragments = []; - 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], fragments = _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) { - fragments.push(this.makeCode('\n')); - } - fragments.push(this.makeCode("" + this.tab + "var ")); - if (declars) { - fragments.push(this.makeCode(scope.declaredVariables().join(', '))); - } - if (assigns) { - if (declars) { - fragments.push(this.makeCode(",\n" + (this.tab + TAB))); - } - fragments.push(this.makeCode(scope.assignedVariables().join(",\n" + (this.tab + TAB)))); - } - fragments.push(this.makeCode(";\n" + (this.spaced ? '\n' : ''))); - } else if (fragments.length && post.length) { - fragments.push(this.makeCode("\n")); - } - } - return fragments.concat(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 answer, 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; - answer = this.isStatement() ? "" + this.tab + code + ";" : code; - return [this.makeCode(answer)]; - }; - - 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) { - return [this.makeCode(o.level >= LEVEL_ACCESS ? '(void 0)' : '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 [this.makeCode("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.makeCode(this.val)]; - }; - - function Bool(val) { - this.val = val; - } - - return Bool; - - })(Base); - - exports.Return = Return = (function(_super) { - __extends(Return, _super); - - function Return(expression) { - this.expression = expression; - } - - Return.prototype.children = ['expression']; - - Return.prototype.isStatement = YES; - - Return.prototype.makeReturn = THIS; - - Return.prototype.jumps = THIS; - - Return.prototype.compileToFragments = function(o, level) { - var expr, _ref2; - expr = (_ref2 = this.expression) != null ? _ref2.makeReturn() : void 0; - if (expr && !(expr instanceof Return)) { - return expr.compileToFragments(o, level); - } else { - return Return.__super__.compileToFragments.call(this, o, level); - } - }; - - Return.prototype.compileNode = function(o) { - var answer; - answer = []; - answer.push(this.makeCode(this.tab + ("return" + (this.expression ? " " : "")))); - if (this.expression) { - answer = answer.concat(this.expression.compileToFragments(o, LEVEL_PAREN)); - } - answer.push(this.makeCode(";")); - return answer; - }; - - 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.bareLiteral = function(type) { - return !this.properties.length && this.base instanceof type; - }; - - Value.prototype.isArray = function() { - return this.bareLiteral(Arr); - }; - - Value.prototype.isRange = function() { - return this.bareLiteral(Range); - }; - - 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.bareLiteral(Literal) && SIMPLENUM.test(this.base.value); - }; - - Value.prototype.isString = function() { - return this.bareLiteral(Literal) && IS_STRING.test(this.base.value); - }; - - Value.prototype.isRegex = function() { - return this.bareLiteral(Literal) && IS_REGEX.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.isNotCallable = function() { - return this.isSimpleNumber() || this.isString() || this.isRegex() || this.isArray() || this.isRange() || this.isSplice() || this.isObject(); - }; - - 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.looksStatic = function(className) { - var _ref2; - return this.base.value === className && this.properties.length && ((_ref2 = this.properties[0].name) != null ? _ref2.value : void 0) !== 'prototype'; - }; - - 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 fragments, prop, props, _i, _len; - this.base.front = this.front; - props = this.properties; - fragments = this.base.compileToFragments(o, (props.length ? LEVEL_ACCESS : null)); - if ((this.base instanceof Parens || props.length) && SIMPLENUM.test(fragmentsToText(fragments))) { - fragments.push(this.makeCode('.')); - } - for (_i = 0, _len = props.length; _i < _len; _i++) { - prop = props[_i]; - fragments.push.apply(fragments, prop.compileToFragments(o)); - } - return fragments; - }; - - Value.prototype.unfoldSoak = function(o) { - return this.unfoldedSoak != null ? this.unfoldedSoak : this.unfoldedSoak = (function(_this) { - return function() { - var fst, i, ifn, prop, ref, snd, _i, _len, _ref2, _ref3; - if (ifn = _this.base.unfoldSoak(o)) { - (_ref2 = ifn.body.properties).push.apply(_ref2, _this.properties); - return ifn; - } - _ref3 = _this.properties; - for (i = _i = 0, _len = _ref3.length; _i < _len; i = ++_i) { - prop = _ref3[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 false; - }; - })(this)(); - }; - - 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, comment; - comment = this.comment.replace(/^(\s*)#/gm, "$1 *"); - code = "/*" + (multident(comment, this.tab)) + (__indexOf.call(comment, '\n') >= 0 ? "\n" + this.tab : '') + " */"; - if ((level || o.level) === LEVEL_TOP) { - code = o.indent + code; - } - return [this.makeCode("\n"), this.makeCode(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; - if (variable instanceof Value && variable.isNotCallable()) { - variable.error("literal is not a function"); - } - } - - 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; - method = o.scope.namedMethod(); - if (method != null ? method.klass : void 0) { - accesses = [new Access(new Literal('__super__'))]; - if (method["static"]) { - accesses.push(new Access(new Literal('constructor'))); - } - accesses.push(new Access(new Literal(method.name))); - return (new Value(new Literal(method.klass), accesses)).compile(o); - } else if (method != null ? method.ctor : void 0) { - return "" + method.name + ".__super__.constructor"; - } else { - return this.error('cannot call super outside of an instance method.'); - } - }; - - 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.compileNode = function(o) { - var arg, argIndex, compiledArgs, compiledArray, fragments, preface, _i, _len, _ref2, _ref3; - if ((_ref2 = this.variable) != null) { - _ref2.front = this.front; - } - compiledArray = Splat.compileSplattedArray(o, this.args, true); - if (compiledArray.length) { - return this.compileSplat(o, compiledArray); - } - compiledArgs = []; - _ref3 = this.args; - for (argIndex = _i = 0, _len = _ref3.length; _i < _len; argIndex = ++_i) { - arg = _ref3[argIndex]; - if (argIndex) { - compiledArgs.push(this.makeCode(", ")); - } - compiledArgs.push.apply(compiledArgs, arg.compileToFragments(o, LEVEL_LIST)); - } - fragments = []; - if (this.isSuper) { - preface = this.superReference(o) + (".call(" + (this.superThis(o))); - if (compiledArgs.length) { - preface += ", "; - } - fragments.push(this.makeCode(preface)); - } else { - if (this.isNew) { - fragments.push(this.makeCode('new ')); - } - fragments.push.apply(fragments, this.variable.compileToFragments(o, LEVEL_ACCESS)); - fragments.push(this.makeCode("(")); - } - fragments.push.apply(fragments, compiledArgs); - fragments.push(this.makeCode(")")); - return fragments; - }; - - Call.prototype.compileSplat = function(o, splatArgs) { - var answer, base, fun, idt, name, ref; - if (this.isSuper) { - return [].concat(this.makeCode("" + (this.superReference(o)) + ".apply(" + (this.superThis(o)) + ", "), splatArgs, this.makeCode(")")); - } - if (this.isNew) { - idt = this.tab + TAB; - return [].concat(this.makeCode("(function(func, args, ctor) {\n" + idt + "ctor.prototype = func.prototype;\n" + idt + "var child = new ctor, result = func.apply(child, args);\n" + idt + "return Object(result) === result ? result : child;\n" + this.tab + "})("), this.variable.compileToFragments(o, LEVEL_LIST), this.makeCode(", "), splatArgs, this.makeCode(", function(){})")); - } - answer = []; - base = new Value(this.variable); - if ((name = base.properties.pop()) && base.isComplex()) { - ref = o.scope.freeVariable('ref'); - answer = answer.concat(this.makeCode("(" + ref + " = "), base.compileToFragments(o, LEVEL_LIST), this.makeCode(")"), name.compileToFragments(o)); - } else { - fun = base.compileToFragments(o, LEVEL_ACCESS); - if (SIMPLENUM.test(fragmentsToText(fun))) { - fun = this.wrapInBraces(fun); - } - if (name) { - ref = fragmentsToText(fun); - fun.push.apply(fun, name.compileToFragments(o)); - } else { - ref = 'null'; - } - answer = answer.concat(fun); - } - return answer = answer.concat(this.makeCode(".apply(" + ref + ", "), splatArgs, this.makeCode(")")); - }; - - 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.compileToFragments = function(o) { - return new Call(new Value(new Literal(utility('extends'))), [this.child, this.parent]).compileToFragments(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.compileToFragments = function(o) { - var name; - name = this.name.compileToFragments(o); - if (IDENTIFIER.test(fragmentsToText(name))) { - name.unshift(this.makeCode(".")); - } else { - name.unshift(this.makeCode("[")); - name.push(this.makeCode("]")); - } - 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.compileToFragments = function(o) { - return [].concat(this.makeCode("["), this.index.compileToFragments(o, LEVEL_PAREN), this.makeCode("]")); - }; - - 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.cacheToCodeFragments(this.from.cache(o, LEVEL_LIST)), this.fromC = _ref2[0], this.fromVar = _ref2[1]; - _ref3 = this.cacheToCodeFragments(this.to.cache(o, LEVEL_LIST)), this.toC = _ref3[0], this.toVar = _ref3[1]; - if (step = del(o, 'step')) { - _ref4 = this.cacheToCodeFragments(step.cache(o, LEVEL_LIST)), this.step = _ref4[0], this.stepVar = _ref4[1]; - } - _ref5 = [this.fromVar.match(NUMBER), this.toVar.match(NUMBER)], this.fromNum = _ref5[0], this.toNum = _ref5[1]; - if (this.stepVar) { - return this.stepNum = this.stepVar.match(NUMBER); - } - }; - - 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 ? parseNum(this.stepNum[0]) > 0 ? "" + lt + " " + this.toVar : "" + gt + " " + this.toVar : known ? ((_ref3 = [parseNum(this.fromNum[0]), parseNum(this.toNum[0])], from = _ref3[0], to = _ref3[1], _ref3), from <= to ? "" + lt + " " + to : "" + gt + " " + to) : (cond = this.stepVar ? "" + this.stepVar + " > 0" : "" + 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 [this.makeCode("" + 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 [this.makeCode("[" + (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 = fragmentsToText(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(isLiteralArguments) : void 0; - }; - if (hasArgs(this.from) || hasArgs(this.to)) { - args = ', arguments'; - } - return [this.makeCode("(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, compiledText, from, fromCompiled, to, toStr, _ref2; - _ref2 = this.range, to = _ref2.to, from = _ref2.from; - fromCompiled = from && from.compileToFragments(o, LEVEL_PAREN) || [this.makeCode('0')]; - if (to) { - compiled = to.compileToFragments(o, LEVEL_PAREN); - compiledText = fragmentsToText(compiled); - if (!(!this.range.exclusive && +compiledText === -1)) { - toStr = ', ' + (this.range.exclusive ? compiledText : SIMPLENUM.test(compiledText) ? "" + (+compiledText + 1) : (compiled = to.compileToFragments(o, LEVEL_ACCESS), "+" + (fragmentsToText(compiled)) + " + 1 || 9e9")); - } - } - return [this.makeCode(".slice(" + (fragmentsToText(fromCompiled)) + (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 answer, i, idt, indent, join, lastNoncom, node, prop, props, _i, _j, _len, _len1; - props = this.properties; - if (!props.length) { - return [this.makeCode(this.front ? '({})' : '{}')]; - } - if (this.generated) { - for (_i = 0, _len = props.length; _i < _len; _i++) { - node = props[_i]; - if (node instanceof Value) { - node.error('cannot have an implicit value in an implicit object'); - } - } - } - idt = o.indent += TAB; - lastNoncom = this.lastNonComment(this.properties); - answer = []; - for (i = _j = 0, _len1 = props.length; _j < _len1; i = ++_j) { - prop = props[i]; - join = i === props.length - 1 ? '' : prop === lastNoncom || prop instanceof Comment ? '\n' : ',\n'; - indent = prop instanceof Comment ? '' : idt; - if (prop instanceof Assign && prop.variable instanceof Value && prop.variable.hasProperties()) { - prop.variable.error('Invalid object key'); - } - 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; - } - if (indent) { - answer.push(this.makeCode(indent)); - } - answer.push.apply(answer, prop.compileToFragments(o, LEVEL_TOP)); - if (join) { - answer.push(this.makeCode(join)); - } - } - answer.unshift(this.makeCode("{" + (props.length && '\n'))); - answer.push(this.makeCode("" + (props.length && '\n' + this.tab) + "}")); - if (this.front) { - return this.wrapInBraces(answer); - } else { - return answer; - } - }; - - 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.compileNode = function(o) { - var answer, compiledObjs, fragments, index, obj, _i, _len; - if (!this.objects.length) { - return [this.makeCode('[]')]; - } - o.indent += TAB; - answer = Splat.compileSplattedArray(o, this.objects); - if (answer.length) { - return answer; - } - answer = []; - compiledObjs = (function() { - var _i, _len, _ref2, _results; - _ref2 = this.objects; - _results = []; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - obj = _ref2[_i]; - _results.push(obj.compileToFragments(o, LEVEL_LIST)); - } - return _results; - }).call(this); - for (index = _i = 0, _len = compiledObjs.length; _i < _len; index = ++_i) { - fragments = compiledObjs[index]; - if (index) { - answer.push(this.makeCode(", ")); - } - answer.push.apply(answer, fragments); - } - if (fragmentsToText(answer).indexOf('\n') >= 0) { - answer.unshift(this.makeCode("[\n" + o.indent)); - answer.push(this.makeCode("\n" + this.tab + "]")); - } else { - answer.unshift(this.makeCode("[")); - answer.push(this.makeCode("]")); - } - return answer; - }; - - 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) { - this.variable.error("class 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; - _ref2 = this.boundFuncs; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - bvar = _ref2[_i]; - lhs = (new Value(new Literal("this"), [new Access(bvar)])).compile(o); - this.ctor.body.unshift(new Literal("" + lhs + " = " + (utility('bind')) + "(" + lhs + ", this)")); - } - }; - - 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) { - assign.error('cannot define more than one constructor in a class'); - } - if (func.bound) { - assign.error('cannot define a constructor as a bound function'); - } - if (func instanceof Code) { - assign = this.ctor = func; - } else { - this.externalCtor = o.classScope.freeVariable('class'); - assign = new Assign(new Literal(this.externalCtor), func); - } - } else { - if (assign.variable["this"]) { - func["static"] = true; - } 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) { - return this.traverseChildren(false, (function(_this) { - return function(child) { - var cont, exps, i, node, _i, _len, _ref2; - cont = true; - 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 Assign && node.variable.looksStatic(name)) { - node.value["static"] = true; - } else if (node instanceof Value && node.isObject(true)) { - cont = false; - exps[i] = _this.addProperties(node, name, o); - } - } - child.expressions = exps = flatten(exps); - } - return cont && !(child instanceof Class); - }; - })(this)); - }; - - 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.externalCtor) { - this.ctor.body.push(new Literal("" + this.externalCtor + ".apply(this, arguments)")); - } else if (this.parent) { - this.ctor.body.push(new Literal("" + name + ".__super__.constructor.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 args, argumentsNode, func, jumpNode, klass, lname, name, superClass, _ref2; - if (jumpNode = this.body.jumps()) { - jumpNode.error('Class bodies cannot contain pure statements'); - } - if (argumentsNode = this.body.contains(isLiteralArguments)) { - argumentsNode.error("Class bodies shouldn't reference arguments"); - } - name = this.determineName() || '_Class'; - if (name.reserved) { - name = "_" + name; - } - lname = new Literal(name); - func = new Code([], Block.wrap([this.body])); - args = []; - o.classScope = func.makeScope(o.scope); - this.hoistDirectivePrologue(); - this.setContext(name); - this.walkBody(name, o); - this.ensureConstructor(name); - this.addBoundFunctions(o); - this.body.spaced = true; - this.body.expressions.push(lname); - if (this.parent) { - superClass = new Literal(o.classScope.freeVariable('super', false)); - this.body.expressions.unshift(new Extends(lname, superClass)); - func.params.push(new Param(superClass)); - args.push(this.parent); - } - (_ref2 = this.body.expressions).unshift.apply(_ref2, this.directives); - klass = new Parens(new Call(func, args)); - if (this.variable) { - klass = new Assign(this.variable, klass); - } - return klass.compileToFragments(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') { - this.variable.error("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 answer, compiledName, 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); - } - if ((_ref3 = this.context) === '**=' || _ref3 === '//=' || _ref3 === '%%=') { - return this.compileSpecialMath(o); - } - } - compiledName = this.variable.compileToFragments(o, LEVEL_LIST); - name = fragmentsToText(compiledName); - if (!this.context) { - varBase = this.variable.unwrapAll(); - if (!varBase.isAssignable()) { - this.variable.error("\"" + (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[2]) { - this.value.klass = match[1]; - } - this.value.name = (_ref4 = (_ref5 = match[3]) != null ? _ref5 : match[4]) != null ? _ref4 : match[5]; - } - val = this.value.compileToFragments(o, LEVEL_LIST); - if (this.context === 'object') { - return compiledName.concat(this.makeCode(": "), val); - } - answer = compiledName.concat(this.makeCode(" " + (this.context || '=') + " "), val); - if (o.level <= LEVEL_LIST) { - return answer; - } else { - return this.wrapInBraces(answer); - } - }; - - Assign.prototype.compilePatternMatch = function(o) { - var acc, assigns, code, expandedIdx, fragments, i, idx, isObject, ivar, name, obj, objects, olen, ref, rest, top, val, value, vvar, vvarText, _i, _len, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7; - top = o.level === LEVEL_TOP; - value = this.value; - objects = this.variable.base.objects; - if (!(olen = objects.length)) { - code = value.compileToFragments(o); - if (o.level >= LEVEL_OP) { - return this.wrapInBraces(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 { - 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 (_ref4 = obj.unwrap().value, __indexOf.call(RESERVED, _ref4) >= 0) { - obj.error("assignment to a reserved word: " + (obj.compile(o))); - } - return new Assign(obj, value, null, { - param: this.param - }).compileToFragments(o, LEVEL_TOP); - } - vvar = value.compileToFragments(o, LEVEL_LIST); - vvarText = fragmentsToText(vvar); - assigns = []; - expandedIdx = false; - if (!IDENTIFIER.test(vvarText) || this.variable.assigns(vvarText)) { - assigns.push([this.makeCode("" + (ref = o.scope.freeVariable('ref')) + " = ")].concat(__slice.call(vvar))); - vvar = [this.makeCode(ref)]; - vvarText = ref; - } - for (i = _i = 0, _len = objects.length; _i < _len; i = ++_i) { - obj = objects[i]; - idx = i; - if (isObject) { - if (obj instanceof Assign) { - _ref5 = obj, (_ref6 = _ref5.variable, idx = _ref6.base), obj = _ref5.value; - } else { - if (obj.base instanceof Parens) { - _ref7 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref7[0], idx = _ref7[1]; - } else { - idx = obj["this"] ? obj.properties[0].name : obj; - } - } - } - if (!expandedIdx && obj instanceof Splat) { - name = obj.name.unwrap().value; - obj = obj.unwrap(); - val = "" + olen + " <= " + vvarText + ".length ? " + (utility('slice')) + ".call(" + vvarText + ", " + i; - if (rest = olen - i - 1) { - ivar = o.scope.freeVariable('i'); - val += ", " + ivar + " = " + vvarText + ".length - " + rest + ") : (" + ivar + " = " + i + ", [])"; - } else { - val += ") : []"; - } - val = new Literal(val); - expandedIdx = "" + ivar + "++"; - } else if (!expandedIdx && obj instanceof Expansion) { - if (rest = olen - i - 1) { - if (rest === 1) { - expandedIdx = "" + vvarText + ".length - 1"; - } else { - ivar = o.scope.freeVariable('i'); - val = new Literal("" + ivar + " = " + vvarText + ".length - " + rest); - expandedIdx = "" + ivar + "++"; - assigns.push(val.compileToFragments(o, LEVEL_LIST)); - } - } - continue; - } else { - name = obj.unwrap().value; - if (obj instanceof Splat || obj instanceof Expansion) { - obj.error("multiple splats/expansions are disallowed in an assignment"); - } - if (typeof idx === 'number') { - idx = new Literal(expandedIdx || idx); - acc = false; - } else { - acc = isObject && IDENTIFIER.test(idx.unwrap().value || 0); - } - val = new Value(new Literal(vvarText), [new (acc ? Access : Index)(idx)]); - } - if ((name != null) && __indexOf.call(RESERVED, name) >= 0) { - obj.error("assignment to a reserved word: " + (obj.compile(o))); - } - assigns.push(new Assign(obj, val, null, { - param: this.param, - subpattern: true - }).compileToFragments(o, LEVEL_LIST)); - } - if (!(top || this.subpattern)) { - assigns.push(vvar); - } - fragments = this.joinFragmentArrays(assigns, ', '); - if (o.level < LEVEL_LIST) { - return fragments; - } else { - return this.wrapInBraces(fragments); - } - }; - - Assign.prototype.compileConditional = function(o) { - var fragments, 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)) { - this.variable.error("the variable \"" + left.base.value + "\" can't be assigned with " + this.context + " because it has not been declared before"); - } - if (__indexOf.call(this.context, "?") >= 0) { - o.isExistentialEquals = true; - return new If(new Existence(left), right, { - type: 'if' - }).addElse(new Assign(right, this.value, '=')).compileToFragments(o); - } else { - fragments = new Op(this.context.slice(0, -1), left, new Assign(right, this.value, '=')).compileToFragments(o); - if (o.level <= LEVEL_LIST) { - return fragments; - } else { - return this.wrapInBraces(fragments); - } - } - }; - - Assign.prototype.compileSpecialMath = function(o) { - var left, right, _ref2; - _ref2 = this.variable.cacheReference(o), left = _ref2[0], right = _ref2[1]; - return new Assign(left, new Op(this.context.slice(0, -1), right, this.value)).compileToFragments(o); - }; - - Assign.prototype.compileSplice = function(o) { - var answer, 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); - if (from) { - _ref3 = this.cacheToCodeFragments(from.cache(o, LEVEL_OP)), fromDecl = _ref3[0], fromRef = _ref3[1]; - } else { - fromDecl = fromRef = '0'; - } - if (to) { - if (from instanceof Value && from.isSimpleNumber() && to instanceof Value && 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]; - answer = [].concat(this.makeCode("[].splice.apply(" + name + ", [" + fromDecl + ", " + to + "].concat("), valDef, this.makeCode(")), "), valRef); - if (o.level > LEVEL_TOP) { - return this.wrapInBraces(answer); - } else { - return answer; - } - }; - - 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'; - } - - Code.prototype.children = ['params', 'body']; - - Code.prototype.isStatement = function() { - return !!this.ctor; - }; - - Code.prototype.jumps = NO; - - Code.prototype.makeScope = function(parentScope) { - return new Scope(parentScope, this.body, this); - }; - - Code.prototype.compileNode = function(o) { - var answer, boundfunc, code, exprs, i, lit, p, param, params, ref, splats, uniqs, val, wasEmpty, wrapper, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7; - if (this.bound && ((_ref2 = o.scope.method) != null ? _ref2.bound : void 0)) { - this.context = o.scope.method.context; - } - if (this.bound && !this.context) { - this.context = '_this'; - wrapper = new Code([new Param(new Literal(this.context))], new Block([this])); - boundfunc = new Call(wrapper, [new Literal('this')]); - boundfunc.updateLocationDataIfMissing(this.locationData); - return boundfunc.compileNode(o); - } - o.scope = del(o, 'classScope') || this.makeScope(o.scope); - o.scope.shared = del(o, 'sharedScope'); - o.indent += TAB; - delete o.bare; - delete o.isExistentialEquals; - params = []; - exprs = []; - _ref3 = this.params; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - param = _ref3[_i]; - if (!(param instanceof Expansion)) { - o.scope.parameter(param.asReference(o)); - } - } - _ref4 = this.params; - for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) { - param = _ref4[_j]; - if (!(param.splat || param instanceof Expansion)) { - continue; - } - _ref5 = this.params; - for (_k = 0, _len2 = _ref5.length; _k < _len2; _k++) { - p = _ref5[_k].name; - if (!(!(param instanceof Expansion))) { - continue; - } - 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, _ref6, _results; - _ref6 = this.params; - _results = []; - for (_l = 0, _len3 = _ref6.length; _l < _len3; _l++) { - p = _ref6[_l]; - _results.push(p.asReference(o)); - } - return _results; - }).call(this))), new Value(new Literal('arguments'))); - break; - } - _ref6 = this.params; - for (_l = 0, _len3 = _ref6.length; _l < _len3; _l++) { - param = _ref6[_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) { - (_ref7 = this.body.expressions).unshift.apply(_ref7, exprs); - } - for (i = _m = 0, _len4 = params.length; _m < _len4; i = ++_m) { - p = params[i]; - params[i] = p.compileToFragments(o); - o.scope.parameter(fragmentsToText(params[i])); - } - uniqs = []; - this.eachParamName(function(name, node) { - if (__indexOf.call(uniqs, name) >= 0) { - node.error("multiple parameters named '" + name + "'"); - } - return uniqs.push(name); - }); - if (!(wasEmpty || this.noReturn)) { - this.body.makeReturn(); - } - code = 'function'; - if (this.ctor) { - code += ' ' + this.name; - } - code += '('; - answer = [this.makeCode(code)]; - for (i = _n = 0, _len5 = params.length; _n < _len5; i = ++_n) { - p = params[i]; - if (i) { - answer.push(this.makeCode(", ")); - } - answer.push.apply(answer, p); - } - answer.push(this.makeCode(') {')); - if (!this.body.isEmpty()) { - answer = answer.concat(this.makeCode("\n"), this.body.compileWithDeclarations(o), this.makeCode("\n" + this.tab)); - } - answer.push(this.makeCode('}')); - if (this.ctor) { - return [this.makeCode(this.tab)].concat(__slice.call(answer)); - } - if (this.front || (o.level >= LEVEL_ACCESS)) { - return this.wrapInBraces(answer); - } else { - return answer; - } - }; - - Code.prototype.eachParamName = function(iterator) { - var param, _i, _len, _ref2, _results; - _ref2 = this.params; - _results = []; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - param = _ref2[_i]; - _results.push(param.eachName(iterator)); - } - return _results; - }; - - 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) { - this.name.error("parameter name \"" + name + "\" is not allowed"); - } - } - - Param.prototype.children = ['name', 'value']; - - Param.prototype.compileToFragments = function(o) { - return this.name.compileToFragments(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); - } - node.updateLocationDataIfMissing(this.locationData); - return this.reference = node; - }; - - Param.prototype.isComplex = function() { - return this.name.isComplex(); - }; - - Param.prototype.eachName = function(iterator, name) { - var atParam, node, obj, _i, _len, _ref2; - if (name == null) { - name = this.name; - } - atParam = function(obj) { - var node; - node = obj.properties[0].name; - if (!node.value.reserved) { - return iterator(node.value, node); - } - }; - if (name instanceof Literal) { - return iterator(name.value, name); - } - if (name instanceof Value) { - return atParam(name); - } - _ref2 = name.objects; - for (_i = 0, _len = _ref2.length; _i < _len; _i++) { - obj = _ref2[_i]; - if (obj instanceof Assign) { - this.eachName(iterator, obj.value.unwrap()); - } else if (obj instanceof Splat) { - node = obj.name.unwrap(); - iterator(node.value, node); - } else if (obj instanceof Value) { - if (obj.isArray() || obj.isObject()) { - this.eachName(iterator, obj.base); - } else if (obj["this"]) { - atParam(obj); - } else { - iterator(obj.base.value, obj.base); - } - } else if (!(obj instanceof Expansion)) { - obj.error("illegal parameter " + (obj.compile())); - } - } - }; - - 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.compileToFragments = function(o) { - return this.name.compileToFragments(o); - }; - - Splat.prototype.unwrap = function() { - return this.name; - }; - - Splat.compileSplattedArray = function(o, list, apply) { - var args, base, compiledNode, concatPart, fragments, i, index, node, _i, _len; - index = -1; - while ((node = list[++index]) && !(node instanceof Splat)) { - continue; - } - if (index >= list.length) { - return []; - } - if (list.length === 1) { - node = list[0]; - fragments = node.compileToFragments(o, LEVEL_LIST); - if (apply) { - return fragments; - } - return [].concat(node.makeCode("" + (utility('slice')) + ".call("), fragments, node.makeCode(")")); - } - args = list.slice(index); - for (i = _i = 0, _len = args.length; _i < _len; i = ++_i) { - node = args[i]; - compiledNode = node.compileToFragments(o, LEVEL_LIST); - args[i] = node instanceof Splat ? [].concat(node.makeCode("" + (utility('slice')) + ".call("), compiledNode, node.makeCode(")")) : [].concat(node.makeCode("["), compiledNode, node.makeCode("]")); - } - if (index === 0) { - node = list[0]; - concatPart = node.joinFragmentArrays(args.slice(1), ', '); - return args[0].concat(node.makeCode(".concat("), concatPart, node.makeCode(")")); - } - 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.compileToFragments(o, LEVEL_LIST)); - } - return _results; - })(); - base = list[0].joinFragmentArrays(base, ', '); - concatPart = list[index].joinFragmentArrays(args, ', '); - return [].concat(list[0].makeCode("["), base, list[index].makeCode("].concat("), concatPart, (last(list)).makeCode(")")); - }; - - return Splat; - - })(Base); - - exports.Expansion = Expansion = (function(_super) { - __extends(Expansion, _super); - - function Expansion() { - return Expansion.__super__.constructor.apply(this, arguments); - } - - Expansion.prototype.isComplex = NO; - - Expansion.prototype.compileNode = function(o) { - return this.error('Expansion must be used inside a destructuring assignment or parameter list'); - }; - - Expansion.prototype.asReference = function(o) { - return this; - }; - - Expansion.prototype.eachName = function(iterator) {}; - - return Expansion; - - })(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, jumpNode, 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 (jumpNode = node.jumps({ - loop: true - })) { - return jumpNode; - } - } - return false; - }; - - While.prototype.compileNode = function(o) { - var answer, body, rvar, set; - o.indent += TAB; - set = ''; - body = this.body; - if (body.isEmpty()) { - body = this.makeCode(''); - } 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 = [].concat(this.makeCode("\n"), body.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab)); - } - answer = [].concat(this.makeCode(set + this.tab + "while ("), this.condition.compileToFragments(o, LEVEL_PAREN), this.makeCode(") {"), body, this.makeCode("}")); - if (this.returns) { - answer.push(this.makeCode("\n" + this.tab + "return " + rvar + ";")); - } - return answer; - }; - - 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 answer, isChain, lhs, rhs, _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)) { - this.error('delete operand may not be argument or var'); - } - if (((_ref2 = this.operator) === '--' || _ref2 === '++') && (_ref3 = this.first.unwrapAll().value, __indexOf.call(STRICT_PROSCRIBED, _ref3) >= 0)) { - this.error("cannot increment/decrement \"" + (this.first.unwrapAll().value) + "\""); - } - if (this.isUnary()) { - return this.compileUnary(o); - } - if (isChain) { - return this.compileChain(o); - } - switch (this.operator) { - case '?': - return this.compileExistence(o); - case '**': - return this.compilePower(o); - case '//': - return this.compileFloorDivision(o); - case '%%': - return this.compileModulo(o); - default: - lhs = this.first.compileToFragments(o, LEVEL_OP); - rhs = this.second.compileToFragments(o, LEVEL_OP); - answer = [].concat(lhs, this.makeCode(" " + this.operator + " "), rhs); - if (o.level <= LEVEL_OP) { - return answer; - } else { - return this.wrapInBraces(answer); - } - } - }; - - Op.prototype.compileChain = function(o) { - var fragments, fst, shared, _ref2; - _ref2 = this.first.second.cache(o), this.first.second = _ref2[0], shared = _ref2[1]; - fst = this.first.compileToFragments(o, LEVEL_OP); - fragments = fst.concat(this.makeCode(" " + (this.invert ? '&&' : '||') + " "), shared.compileToFragments(o), this.makeCode(" " + this.operator + " "), this.second.compileToFragments(o, LEVEL_OP)); - return this.wrapInBraces(fragments); - }; - - 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).compileToFragments(o); - }; - - Op.prototype.compileUnary = function(o) { - var op, parts, plusMinus; - parts = []; - op = this.operator; - parts.push([this.makeCode(op)]); - if (op === '!' && this.first instanceof Existence) { - this.first.negated = !this.first.negated; - return this.first.compileToFragments(o); - } - if (o.level >= LEVEL_ACCESS) { - return (new Parens(this)).compileToFragments(o); - } - plusMinus = op === '+' || op === '-'; - if ((op === 'new' || op === 'typeof' || op === 'delete') || plusMinus && this.first instanceof Op && this.first.operator === op) { - parts.push([this.makeCode(' ')]); - } - if ((plusMinus && this.first instanceof Op) || (op === 'new' && this.first.isStatement(o))) { - this.first = new Parens(this.first); - } - parts.push(this.first.compileToFragments(o, LEVEL_OP)); - if (this.flip) { - parts.reverse(); - } - return this.joinFragmentArrays(parts, ''); - }; - - Op.prototype.compilePower = function(o) { - var pow; - pow = new Value(new Literal('Math'), [new Access(new Literal('pow'))]); - return new Call(pow, [this.first, this.second]).compileToFragments(o); - }; - - Op.prototype.compileFloorDivision = function(o) { - var div, floor; - floor = new Value(new Literal('Math'), [new Access(new Literal('floor'))]); - div = new Op('/', this.first, this.second); - return new Call(floor, [div]).compileToFragments(o); - }; - - Op.prototype.compileModulo = function(o) { - var mod; - mod = new Value(new Literal(utility('modulo'))); - return new Call(mod, [this.first, this.second]).compileToFragments(o); - }; - - 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() && this.array.base.objects.length) { - _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, _i, _len, _ref2, _ref3, _ref4; - _ref2 = this.object.cache(o, LEVEL_OP), sub = _ref2[0], ref = _ref2[1]; - _ref3 = this.negated ? [' !== ', ' && '] : [' === ', ' || '], cmp = _ref3[0], cnj = _ref3[1]; - tests = []; - _ref4 = this.array.base.objects; - for (i = _i = 0, _len = _ref4.length; _i < _len; i = ++_i) { - item = _ref4[i]; - if (i) { - tests.push(this.makeCode(cnj)); - } - tests = tests.concat((i ? ref : sub), this.makeCode(cmp), item.compileToFragments(o, LEVEL_ACCESS)); - } - if (o.level < LEVEL_OP) { - return tests; - } else { - return this.wrapInBraces(tests); - } - }; - - In.prototype.compileLoopTest = function(o) { - var fragments, ref, sub, _ref2; - _ref2 = this.object.cache(o, LEVEL_LIST), sub = _ref2[0], ref = _ref2[1]; - fragments = [].concat(this.makeCode(utility('indexOf') + ".call("), this.array.compileToFragments(o, LEVEL_LIST), this.makeCode(", "), ref, this.makeCode(") " + (this.negated ? '< 0' : '>= 0'))); - if (fragmentsToText(sub) === fragmentsToText(ref)) { - return fragments; - } - fragments = sub.concat(this.makeCode(', '), fragments); - if (o.level < LEVEL_LIST) { - return fragments; - } else { - return this.wrapInBraces(fragments); - } - }; - - 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, errorVariable, recovery, ensure) { - this.attempt = attempt; - this.errorVariable = errorVariable; - 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, placeholder, tryPart; - o.indent += TAB; - tryPart = this.attempt.compileToFragments(o, LEVEL_TOP); - catchPart = this.recovery ? (placeholder = new Literal('_error'), this.errorVariable ? this.recovery.unshift(new Assign(this.errorVariable, placeholder)) : void 0, [].concat(this.makeCode(" catch ("), placeholder.compileToFragments(o), this.makeCode(") {\n"), this.recovery.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab + "}"))) : !(this.ensure || this.recovery) ? [this.makeCode(' catch (_error) {}')] : []; - ensurePart = this.ensure ? [].concat(this.makeCode(" finally {\n"), this.ensure.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab + "}")) : []; - return [].concat(this.makeCode("" + this.tab + "try {\n"), tryPart, this.makeCode("\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 [].concat(this.makeCode(this.tab + "throw "), this.expression.compileToFragments(o), this.makeCode(";")); - }; - - 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"; - } - return [this.makeCode(o.level <= LEVEL_COND ? code : "(" + 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, expr, fragments; - expr = this.body.unwrap(); - if (expr instanceof Value && expr.isAtomic()) { - expr.front = this.front; - return expr.compileToFragments(o); - } - fragments = expr.compileToFragments(o, LEVEL_PAREN); - bare = o.level < LEVEL_OP && (expr instanceof Op || expr instanceof Call || (expr instanceof For && expr.returns)); - if (bare) { - return fragments; - } else { - return this.wrapInBraces(fragments); - } - }; - - 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) { - this.index.error('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) { - this.index.error('indexes do not apply to range loops'); - } - if (this.range && this.pattern) { - this.name.error('cannot pattern match over range loops'); - } - if (this.own && !this.object) { - this.name.error('cannot use own with for-in'); - } - this.returns = false; - } - - For.prototype.children = ['body', 'source', 'guard', 'step']; - - For.prototype.compileNode = function(o) { - var body, bodyFragments, compare, compareDown, declare, declareDown, defPart, defPartFragments, down, forPartFragments, guardPart, idt1, increment, index, ivar, kvar, kvarAssign, lastJumps, lvar, name, namePart, ref, resultPart, returnResult, rvar, scope, source, step, stepNum, stepVar, svar, varPart, _ref2, _ref3; - 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; - if (!this.pattern) { - 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) { - _ref3 = this.cacheToCodeFragments(this.step.cache(o, LEVEL_LIST)), step = _ref3[0], stepVar = _ref3[1]; - stepNum = stepVar.match(NUMBER); - } - if (this.pattern) { - name = ivar; - } - varPart = ''; - guardPart = ''; - defPart = ''; - idt1 = this.tab + TAB; - if (this.range) { - forPartFragments = source.compileToFragments(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) { - if (step !== stepVar) { - defPart += "" + this.tab + step + ";\n"; - } - if (!(this.step && stepNum && (down = parseNum(stepNum[0]) < 0))) { - lvar = scope.freeVariable('len'); - } - declare = "" + kvarAssign + ivar + " = 0, " + lvar + " = " + svar + ".length"; - declareDown = "" + kvarAssign + ivar + " = " + svar + ".length - 1"; - compare = "" + ivar + " < " + lvar; - compareDown = "" + ivar + " >= 0"; - if (this.step) { - if (stepNum) { - if (down) { - compare = compareDown; - declare = declareDown; - } - } else { - compare = "" + stepVar + " > 0 ? " + compare + " : " + compareDown; - declare = "(" + stepVar + " > 0 ? (" + declare + ") : " + declareDown + ")"; - } - increment = "" + ivar + " += " + stepVar; - } else { - increment = "" + (kvar !== ivar ? "++" + ivar : "" + ivar + "++"); - } - forPartFragments = [this.makeCode("" + declare + "; " + compare + "; " + kvarAssign + increment)]; - } - } - 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 + "]"))); - } - defPartFragments = [].concat(this.makeCode(defPart), this.pluckDirectCall(o, body)); - if (namePart) { - varPart = "\n" + idt1 + namePart + ";"; - } - if (this.object) { - forPartFragments = [this.makeCode("" + kvar + " in " + svar)]; - if (this.own) { - guardPart = "\n" + idt1 + "if (!" + (utility('hasProp')) + ".call(" + svar + ", " + kvar + ")) continue;"; - } - } - bodyFragments = body.compileToFragments(merge(o, { - indent: idt1 - }), LEVEL_TOP); - if (bodyFragments && (bodyFragments.length > 0)) { - bodyFragments = [].concat(this.makeCode("\n"), bodyFragments, this.makeCode("\n")); - } - return [].concat(defPartFragments, this.makeCode("" + (resultPart || '') + this.tab + "for ("), forPartFragments, this.makeCode(") {" + guardPart + varPart), bodyFragments, this.makeCode("" + 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, _ref8; - 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 = (_ref3 = expr.variable) != null ? _ref3.unwrapAll() : void 0; - if (!((val instanceof Code) || (val instanceof Value && ((_ref4 = val.base) != null ? _ref4.unwrapAll() : void 0) instanceof Code && val.properties.length === 1 && ((_ref5 = (_ref6 = val.properties[0].name) != null ? _ref6.value : void 0) === 'call' || _ref5 === 'apply')))) { - continue; - } - fn = ((_ref7 = val.base) != null ? _ref7.unwrapAll() : void 0) || val; - ref = new Literal(o.scope.freeVariable('fn')); - base = new Value(ref); - if (val.base) { - _ref8 = [base, val], val.base = _ref8[0], base = _ref8[1]; - } - body.expressions[idx] = new Call(base, expr.args); - defs = defs.concat(this.makeCode(this.tab), new Assign(ref, fn).compileToFragments(o, LEVEL_TOP), this.makeCode(';\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, jumpNode, _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 (jumpNode = block.jumps(o)) { - return jumpNode; - } - } - 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, cond, conditions, expr, fragments, i, idt1, idt2, _i, _j, _len, _len1, _ref2, _ref3, _ref4; - idt1 = o.indent + TAB; - idt2 = o.indent = idt1 + TAB; - fragments = [].concat(this.makeCode(this.tab + "switch ("), (this.subject ? this.subject.compileToFragments(o, LEVEL_PAREN) : this.makeCode("false")), this.makeCode(") {\n")); - _ref2 = this.cases; - for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) { - _ref3 = _ref2[i], conditions = _ref3[0], block = _ref3[1]; - _ref4 = flatten([conditions]); - for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) { - cond = _ref4[_j]; - if (!this.subject) { - cond = cond.invert(); - } - fragments = fragments.concat(this.makeCode(idt1 + "case "), cond.compileToFragments(o, LEVEL_PAREN), this.makeCode(":\n")); - } - if ((body = block.compileToFragments(o, LEVEL_TOP)).length > 0) { - fragments = fragments.concat(body, this.makeCode('\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; - } - fragments.push(cond.makeCode(idt2 + 'break;\n')); - } - if (this.otherwise && this.otherwise.expressions.length) { - fragments.push.apply(fragments, [this.makeCode(idt1 + "default:\n")].concat(__slice.call(this.otherwise.compileToFragments(o, LEVEL_TOP)), [this.makeCode("\n")])); - } - fragments.push(this.makeCode(this.tab + '}')); - return fragments; - }; - - 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); - this.elseBody.updateLocationDataIfMissing(elseBody.locationData); - } - 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 answer, body, child, cond, exeq, ifPart, indent; - child = del(o, 'chainChild'); - exeq = del(o, 'isExistentialEquals'); - if (exeq) { - return new If(this.condition.invert(), this.elseBodyNode(), { - type: 'if' - }).compileToFragments(o); - } - indent = o.indent + TAB; - cond = this.condition.compileToFragments(o, LEVEL_PAREN); - body = this.ensureBlock(this.body).compileToFragments(merge(o, { - indent: indent - })); - ifPart = [].concat(this.makeCode("if ("), cond, this.makeCode(") {\n"), body, this.makeCode("\n" + this.tab + "}")); - if (!child) { - ifPart.unshift(this.makeCode(this.tab)); - } - if (!this.elseBody) { - return ifPart; - } - answer = ifPart.concat(this.makeCode(' else ')); - if (this.isChain) { - o.chainChild = true; - answer = answer.concat(this.elseBody.unwrap().compileToFragments(o, LEVEL_TOP)); - } else { - answer = answer.concat(this.makeCode("{\n"), this.elseBody.compileToFragments(merge(o, { - indent: indent - }), LEVEL_TOP), this.makeCode("\n" + this.tab + "}")); - } - return answer; - }; - - If.prototype.compileExpression = function(o) { - var alt, body, cond, fragments; - cond = this.condition.compileToFragments(o, LEVEL_COND); - body = this.bodyNode().compileToFragments(o, LEVEL_LIST); - alt = this.elseBodyNode() ? this.elseBodyNode().compileToFragments(o, LEVEL_LIST) : [this.makeCode('void 0')]; - fragments = cond.concat(this.makeCode(" ? "), body, this.makeCode(" : "), alt); - if (o.level >= LEVEL_COND) { - return this.wrapInBraces(fragments); - } else { - return fragments; - } - }; - - If.prototype.unfoldSoak = function() { - return this.soak && this; - }; - - return If; - - })(Base); - - 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; }"; - }, - modulo: function() { - return "function(a, b) { return (+a % (b = +b) + b) % b; }"; - }, - 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+$/; - - HEXNUM = /^[+-]?0x[\da-f]+/i; - - NUMBER = /^[+-]?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)$/i; - - METHOD_DEF = RegExp("^(" + IDENTIFIER_STR + ")(\\.prototype)?(?:\\.(" + IDENTIFIER_STR + ")|\\[(\"(?:[^\\\\\"\\r\\n]|\\\\.)*\"|'(?:[^\\\\'\\r\\n]|\\\\.)*')\\]|\\[(0x[\\da-fA-F]+|\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\])$"); - - IS_STRING = /^['"]/; - - IS_REGEX = /^\//; - - 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+$/, ''); - }; - - parseNum = function(x) { - if (x == null) { - return 0; - } else if (x.match(HEXNUM)) { - return parseInt(x, 16); - } else { - return parseFloat(x); - } - }; - - isLiteralArguments = function(node) { - return node instanceof Literal && node.value === 'arguments' && !node.asKey; - }; - - isLiteralThis = 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; - }; - -}).call(this); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/optparse.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/optparse.js deleted file mode 100644 index 6ec360452..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/optparse.js +++ /dev/null @@ -1,139 +0,0 @@ -// Generated by CoffeeScript 1.8.0 -(function() { - var LONG_FLAG, MULTI_FLAG, OPTIONAL, OptionParser, SHORT_FLAG, buildRule, buildRules, normalizeArguments, repeat; - - repeat = require('./helpers').repeat; - - 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 ? repeat(' ', spaces) : ''; - 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/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/parser.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/parser.js deleted file mode 100755 index 724636b5a..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/parser.js +++ /dev/null @@ -1,724 +0,0 @@ -/* parser generated by jison 0.4.13 */ -/* - Returns a Parser object of the following structure: - - Parser: { - yy: {} - } - - Parser.prototype: { - yy: {}, - trace: function(), - symbols_: {associative list: name ==> number}, - terminals_: {associative list: number ==> name}, - productions_: [...], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), - table: [...], - defaultActions: {...}, - parseError: function(str, hash), - parse: function(input), - - lexer: { - EOF: 1, - parseError: function(str, hash), - setInput: function(input), - input: function(), - unput: function(str), - more: function(), - less: function(n), - pastInput: function(), - upcomingInput: function(), - showPosition: function(), - test_match: function(regex_match_array, rule_index), - next: function(), - lex: function(), - begin: function(condition), - popState: function(), - _currentRules: function(), - topState: function(), - pushState: function(condition), - - options: { - ranges: boolean (optional: true ==> token location info will include a .range[] member) - flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) - backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) - }, - - performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), - rules: [...], - conditions: {associative list: name ==> set}, - } - } - - - token location info (@$, _$, etc.): { - first_line: n, - last_line: n, - first_column: n, - last_column: n, - range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) - } - - - the parseError function receives a 'hash' object with these members for lexer and parser errors: { - text: (matched text) - token: (the produced terminal token, if any) - line: (yylineno) - } - while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { - loc: (yylloc) - expected: (string describing the set of expected tokens) - recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) - } -*/ -var parser = (function(){ -var parser = {trace: function trace() { }, -yy: {}, -symbols_: {"error":2,"Root":3,"Body":4,"Line":5,"TERMINATOR":6,"Expression":7,"Statement":8,"Return":9,"Comment":10,"STATEMENT":11,"Value":12,"Invocation":13,"Code":14,"Operation":15,"Assign":16,"If":17,"Try":18,"While":19,"For":20,"Switch":21,"Class":22,"Throw":23,"Block":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,"?::":69,"Index":70,"INDEX_START":71,"IndexValue":72,"INDEX_END":73,"INDEX_SOAK":74,"Slice":75,"{":76,"AssignList":77,"}":78,"CLASS":79,"EXTENDS":80,"OptFuncExist":81,"Arguments":82,"SUPER":83,"FUNC_EXIST":84,"CALL_START":85,"CALL_END":86,"ArgList":87,"THIS":88,"@":89,"[":90,"]":91,"RangeDots":92,"..":93,"Arg":94,"SimpleArgs":95,"TRY":96,"Catch":97,"FINALLY":98,"CATCH":99,"THROW":100,"(":101,")":102,"WhileSource":103,"WHILE":104,"WHEN":105,"UNTIL":106,"Loop":107,"LOOP":108,"ForBody":109,"FOR":110,"ForStart":111,"ForSource":112,"ForVariables":113,"OWN":114,"ForValue":115,"FORIN":116,"FOROF":117,"BY":118,"SWITCH":119,"Whens":120,"ELSE":121,"When":122,"LEADING_WHEN":123,"IfBlock":124,"IF":125,"POST_IF":126,"UNARY":127,"UNARY_MATH":128,"-":129,"+":130,"--":131,"++":132,"?":133,"MATH":134,"**":135,"SHIFT":136,"COMPARE":137,"LOGIC":138,"RELATION":139,"COMPOUND_ASSIGN":140,"$accept":0,"$end":1}, -terminals_: {2:"error",6:"TERMINATOR",11:"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:"::",69:"?::",71:"INDEX_START",73:"INDEX_END",74:"INDEX_SOAK",76:"{",78:"}",79:"CLASS",80:"EXTENDS",83:"SUPER",84:"FUNC_EXIST",85:"CALL_START",86:"CALL_END",88:"THIS",89:"@",90:"[",91:"]",93:"..",96:"TRY",98:"FINALLY",99:"CATCH",100:"THROW",101:"(",102:")",104:"WHILE",105:"WHEN",106:"UNTIL",108:"LOOP",110:"FOR",114:"OWN",116:"FORIN",117:"FOROF",118:"BY",119:"SWITCH",121:"ELSE",123:"LEADING_WHEN",125:"IF",126:"POST_IF",127:"UNARY",128:"UNARY_MATH",129:"-",130:"+",131:"--",132:"++",133:"?",134:"MATH",135:"**",136:"SHIFT",137:"COMPARE",138:"LOGIC",139:"RELATION",140:"COMPOUND_ASSIGN"}, -productions_: [0,[3,0],[3,1],[4,1],[4,3],[4,2],[5,1],[5,1],[8,1],[8,1],[8,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[24,2],[24,3],[27,1],[29,1],[29,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[16,3],[16,4],[16,5],[41,1],[41,3],[41,5],[41,1],[42,1],[42,1],[42,1],[9,2],[9,1],[10,1],[14,5],[14,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],[55,1],[56,1],[56,1],[56,1],[56,1],[60,2],[61,1],[61,2],[61,2],[61,1],[39,1],[39,1],[39,1],[12,1],[12,1],[12,1],[12,1],[12,1],[62,2],[62,2],[62,2],[62,2],[62,1],[62,1],[70,3],[70,2],[72,1],[72,1],[59,4],[77,0],[77,1],[77,3],[77,4],[77,6],[22,1],[22,2],[22,3],[22,4],[22,2],[22,3],[22,4],[22,5],[13,3],[13,3],[13,1],[13,2],[81,0],[81,1],[82,2],[82,4],[65,1],[65,1],[44,2],[58,2],[58,4],[92,1],[92,1],[64,5],[75,3],[75,2],[75,2],[75,1],[87,1],[87,3],[87,4],[87,4],[87,6],[94,1],[94,1],[94,1],[95,1],[95,3],[18,2],[18,3],[18,4],[18,5],[97,3],[97,3],[97,2],[23,2],[63,3],[63,5],[103,2],[103,4],[103,2],[103,4],[19,2],[19,2],[19,2],[19,1],[107,2],[107,2],[20,2],[20,2],[20,2],[109,2],[109,2],[111,2],[111,3],[115,1],[115,1],[115,1],[115,1],[113,1],[113,3],[112,2],[112,2],[112,4],[112,4],[112,4],[112,6],[112,6],[21,5],[21,7],[21,4],[21,6],[120,1],[120,2],[122,3],[122,4],[124,3],[124,5],[17,1],[17,3],[17,3],[17,3],[15,2],[15,2],[15,2],[15,2],[15,2],[15,2],[15,2],[15,2],[15,2],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,5],[15,4],[15,3]], -performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { -/* this == yyval */ - -var $0 = $$.length - 1; -switch (yystate) { -case 1:return this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Block); -break; -case 2:return this.$ = $$[$0]; -break; -case 3:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(yy.Block.wrap([$$[$0]])); -break; -case 4:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].push($$[$0])); -break; -case 5:this.$ = $$[$0-1]; -break; -case 6:this.$ = $$[$0]; -break; -case 7:this.$ = $$[$0]; -break; -case 8:this.$ = $$[$0]; -break; -case 9:this.$ = $$[$0]; -break; -case 10:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); -break; -case 11:this.$ = $$[$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.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Block); -break; -case 24:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-1]); -break; -case 25:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); -break; -case 26:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); -break; -case 27:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); -break; -case 28:this.$ = $$[$0]; -break; -case 29:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); -break; -case 30:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); -break; -case 31:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0])); -break; -case 32:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Undefined); -break; -case 33:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Null); -break; -case 34:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Bool($$[$0])); -break; -case 35:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Assign($$[$0-2], $$[$0])); -break; -case 36:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Assign($$[$0-3], $$[$0])); -break; -case 37:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Assign($$[$0-4], $$[$0-1])); -break; -case 38:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); -break; -case 39:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Assign(yy.addLocationDataFn(_$[$0-2])(new yy.Value($$[$0-2])), $$[$0], 'object')); -break; -case 40:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Assign(yy.addLocationDataFn(_$[$0-4])(new yy.Value($$[$0-4])), $$[$0-1], 'object')); -break; -case 41:this.$ = $$[$0]; -break; -case 42:this.$ = $$[$0]; -break; -case 43:this.$ = $$[$0]; -break; -case 44:this.$ = $$[$0]; -break; -case 45:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Return($$[$0])); -break; -case 46:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Return); -break; -case 47:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Comment($$[$0])); -break; -case 48:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Code($$[$0-3], $$[$0], $$[$0-1])); -break; -case 49:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Code([], $$[$0], $$[$0-1])); -break; -case 50:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('func'); -break; -case 51:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('boundfunc'); -break; -case 52:this.$ = $$[$0]; -break; -case 53:this.$ = $$[$0]; -break; -case 54:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([]); -break; -case 55:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]); -break; -case 56:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].concat($$[$0])); -break; -case 57:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-3].concat($$[$0])); -break; -case 58:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])($$[$0-5].concat($$[$0-2])); -break; -case 59:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Param($$[$0])); -break; -case 60:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Param($$[$0-1], null, true)); -break; -case 61:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Param($$[$0-2], $$[$0])); -break; -case 62:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Expansion); -break; -case 63:this.$ = $$[$0]; -break; -case 64:this.$ = $$[$0]; -break; -case 65:this.$ = $$[$0]; -break; -case 66:this.$ = $$[$0]; -break; -case 67:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Splat($$[$0-1])); -break; -case 68:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); -break; -case 69:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0-1].add($$[$0])); -break; -case 70:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Value($$[$0-1], [].concat($$[$0]))); -break; -case 71:this.$ = $$[$0]; -break; -case 72:this.$ = $$[$0]; -break; -case 73:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); -break; -case 74:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); -break; -case 75:this.$ = $$[$0]; -break; -case 76:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); -break; -case 77:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); -break; -case 78:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); -break; -case 79:this.$ = $$[$0]; -break; -case 80:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Access($$[$0])); -break; -case 81:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Access($$[$0], 'soak')); -break; -case 82:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([yy.addLocationDataFn(_$[$0-1])(new yy.Access(new yy.Literal('prototype'))), yy.addLocationDataFn(_$[$0])(new yy.Access($$[$0]))]); -break; -case 83:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([yy.addLocationDataFn(_$[$0-1])(new yy.Access(new yy.Literal('prototype'), 'soak')), yy.addLocationDataFn(_$[$0])(new yy.Access($$[$0]))]); -break; -case 84:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Access(new yy.Literal('prototype'))); -break; -case 85:this.$ = $$[$0]; -break; -case 86:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-1]); -break; -case 87:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(yy.extend($$[$0], { - soak: true - })); -break; -case 88:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Index($$[$0])); -break; -case 89:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Slice($$[$0])); -break; -case 90:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Obj($$[$0-2], $$[$0-3].generated)); -break; -case 91:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([]); -break; -case 92:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]); -break; -case 93:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].concat($$[$0])); -break; -case 94:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-3].concat($$[$0])); -break; -case 95:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])($$[$0-5].concat($$[$0-2])); -break; -case 96:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Class); -break; -case 97:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Class(null, null, $$[$0])); -break; -case 98:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Class(null, $$[$0])); -break; -case 99:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Class(null, $$[$0-1], $$[$0])); -break; -case 100:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Class($$[$0])); -break; -case 101:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Class($$[$0-1], null, $$[$0])); -break; -case 102:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Class($$[$0-2], $$[$0])); -break; -case 103:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Class($$[$0-3], $$[$0-1], $$[$0])); -break; -case 104:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Call($$[$0-2], $$[$0], $$[$0-1])); -break; -case 105:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Call($$[$0-2], $$[$0], $$[$0-1])); -break; -case 106:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Call('super', [new yy.Splat(new yy.Literal('arguments'))])); -break; -case 107:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Call('super', $$[$0])); -break; -case 108:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(false); -break; -case 109:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(true); -break; -case 110:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([]); -break; -case 111:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-2]); -break; -case 112:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value(new yy.Literal('this'))); -break; -case 113:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value(new yy.Literal('this'))); -break; -case 114:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Value(yy.addLocationDataFn(_$[$0-1])(new yy.Literal('this')), [yy.addLocationDataFn(_$[$0])(new yy.Access($$[$0]))], 'this')); -break; -case 115:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Arr([])); -break; -case 116:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Arr($$[$0-2])); -break; -case 117:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('inclusive'); -break; -case 118:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('exclusive'); -break; -case 119:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Range($$[$0-3], $$[$0-1], $$[$0-2])); -break; -case 120:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Range($$[$0-2], $$[$0], $$[$0-1])); -break; -case 121:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Range($$[$0-1], null, $$[$0])); -break; -case 122:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Range(null, $$[$0], $$[$0-1])); -break; -case 123:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Range(null, null, $$[$0])); -break; -case 124:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]); -break; -case 125:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].concat($$[$0])); -break; -case 126:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-3].concat($$[$0])); -break; -case 127:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-2]); -break; -case 128:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])($$[$0-5].concat($$[$0-2])); -break; -case 129:this.$ = $$[$0]; -break; -case 130:this.$ = $$[$0]; -break; -case 131:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Expansion); -break; -case 132:this.$ = $$[$0]; -break; -case 133:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([].concat($$[$0-2], $$[$0])); -break; -case 134:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Try($$[$0])); -break; -case 135:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Try($$[$0-1], $$[$0][0], $$[$0][1])); -break; -case 136:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Try($$[$0-2], null, null, $$[$0])); -break; -case 137:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Try($$[$0-3], $$[$0-2][0], $$[$0-2][1], $$[$0])); -break; -case 138:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([$$[$0-1], $$[$0]]); -break; -case 139:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([yy.addLocationDataFn(_$[$0-1])(new yy.Value($$[$0-1])), $$[$0]]); -break; -case 140:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([null, $$[$0]]); -break; -case 141:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Throw($$[$0])); -break; -case 142:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Parens($$[$0-1])); -break; -case 143:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Parens($$[$0-2])); -break; -case 144:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While($$[$0])); -break; -case 145:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.While($$[$0-2], { - guard: $$[$0] - })); -break; -case 146:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While($$[$0], { - invert: true - })); -break; -case 147:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.While($$[$0-2], { - invert: true, - guard: $$[$0] - })); -break; -case 148:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0-1].addBody($$[$0])); -break; -case 149:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0].addBody(yy.addLocationDataFn(_$[$0-1])(yy.Block.wrap([$$[$0-1]])))); -break; -case 150:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0].addBody(yy.addLocationDataFn(_$[$0-1])(yy.Block.wrap([$$[$0-1]])))); -break; -case 151:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])($$[$0]); -break; -case 152:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While(yy.addLocationDataFn(_$[$0-1])(new yy.Literal('true'))).addBody($$[$0])); -break; -case 153:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While(yy.addLocationDataFn(_$[$0-1])(new yy.Literal('true'))).addBody(yy.addLocationDataFn(_$[$0])(yy.Block.wrap([$$[$0]])))); -break; -case 154:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.For($$[$0-1], $$[$0])); -break; -case 155:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.For($$[$0-1], $$[$0])); -break; -case 156:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.For($$[$0], $$[$0-1])); -break; -case 157:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])({ - source: yy.addLocationDataFn(_$[$0])(new yy.Value($$[$0])) - }); -break; -case 158:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])((function () { - $$[$0].own = $$[$0-1].own; - $$[$0].name = $$[$0-1][0]; - $$[$0].index = $$[$0-1][1]; - return $$[$0]; - }())); -break; -case 159:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0]); -break; -case 160:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])((function () { - $$[$0].own = true; - return $$[$0]; - }())); -break; -case 161:this.$ = $$[$0]; -break; -case 162:this.$ = $$[$0]; -break; -case 163:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); -break; -case 164:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0])); -break; -case 165:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]); -break; -case 166:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([$$[$0-2], $$[$0]]); -break; -case 167:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])({ - source: $$[$0] - }); -break; -case 168:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])({ - source: $$[$0], - object: true - }); -break; -case 169:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])({ - source: $$[$0-2], - guard: $$[$0] - }); -break; -case 170:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])({ - source: $$[$0-2], - guard: $$[$0], - object: true - }); -break; -case 171:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])({ - source: $$[$0-2], - step: $$[$0] - }); -break; -case 172:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])({ - source: $$[$0-4], - guard: $$[$0-2], - step: $$[$0] - }); -break; -case 173:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])({ - source: $$[$0-4], - step: $$[$0-2], - guard: $$[$0] - }); -break; -case 174:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Switch($$[$0-3], $$[$0-1])); -break; -case 175:this.$ = yy.addLocationDataFn(_$[$0-6], _$[$0])(new yy.Switch($$[$0-5], $$[$0-3], $$[$0-1])); -break; -case 176:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Switch(null, $$[$0-1])); -break; -case 177:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])(new yy.Switch(null, $$[$0-3], $$[$0-1])); -break; -case 178:this.$ = $$[$0]; -break; -case 179:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0-1].concat($$[$0])); -break; -case 180:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([[$$[$0-1], $$[$0]]]); -break; -case 181:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])([[$$[$0-2], $$[$0-1]]]); -break; -case 182:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0-1], $$[$0], { - type: $$[$0-2] - })); -break; -case 183:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])($$[$0-4].addElse(yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0-1], $$[$0], { - type: $$[$0-2] - })))); -break; -case 184:this.$ = $$[$0]; -break; -case 185:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].addElse($$[$0])); -break; -case 186:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0], yy.addLocationDataFn(_$[$0-2])(yy.Block.wrap([$$[$0-2]])), { - type: $$[$0-1], - statement: true - })); -break; -case 187:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0], yy.addLocationDataFn(_$[$0-2])(yy.Block.wrap([$$[$0-2]])), { - type: $$[$0-1], - statement: true - })); -break; -case 188:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op($$[$0-1], $$[$0])); -break; -case 189:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op($$[$0-1], $$[$0])); -break; -case 190:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('-', $$[$0])); -break; -case 191:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('+', $$[$0])); -break; -case 192:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('--', $$[$0])); -break; -case 193:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('++', $$[$0])); -break; -case 194:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('--', $$[$0-1], null, true)); -break; -case 195:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('++', $$[$0-1], null, true)); -break; -case 196:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Existence($$[$0-1])); -break; -case 197:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op('+', $$[$0-2], $$[$0])); -break; -case 198:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op('-', $$[$0-2], $$[$0])); -break; -case 199:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0])); -break; -case 200:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0])); -break; -case 201:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0])); -break; -case 202:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0])); -break; -case 203:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0])); -break; -case 204:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])((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 205:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Assign($$[$0-2], $$[$0], $$[$0-1])); -break; -case 206:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Assign($$[$0-4], $$[$0-1], $$[$0-3])); -break; -case 207:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Assign($$[$0-3], $$[$0], $$[$0-2])); -break; -case 208:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Extends($$[$0-2], $$[$0])); -break; -} -}, -table: [{1:[2,1],3:1,4:2,5:3,7:4,8:5,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{1:[3]},{1:[2,2],6:[1,73]},{1:[2,3],6:[2,3],26:[2,3],102:[2,3]},{1:[2,6],6:[2,6],26:[2,6],102:[2,6],103:84,104:[1,64],106:[1,65],109:85,110:[1,67],111:68,126:[1,83],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{1:[2,7],6:[2,7],26:[2,7],102:[2,7],103:87,104:[1,64],106:[1,65],109:88,110:[1,67],111:68,126:[1,86]},{1:[2,11],6:[2,11],25:[2,11],26:[2,11],49:[2,11],54:[2,11],57:[2,11],62:90,66:[1,92],67:[1,93],68:[1,94],69:[1,95],70:96,71:[1,97],73:[2,11],74:[1,98],78:[2,11],81:89,84:[1,91],85:[2,108],86:[2,11],91:[2,11],93:[2,11],102:[2,11],104:[2,11],105:[2,11],106:[2,11],110:[2,11],118:[2,11],126:[2,11],129:[2,11],130:[2,11],133:[2,11],134:[2,11],135:[2,11],136:[2,11],137:[2,11],138:[2,11],139:[2,11]},{1:[2,12],6:[2,12],25:[2,12],26:[2,12],49:[2,12],54:[2,12],57:[2,12],62:100,66:[1,92],67:[1,93],68:[1,94],69:[1,95],70:96,71:[1,97],73:[2,12],74:[1,98],78:[2,12],81:99,84:[1,91],85:[2,108],86:[2,12],91:[2,12],93:[2,12],102:[2,12],104:[2,12],105:[2,12],106:[2,12],110:[2,12],118:[2,12],126:[2,12],129:[2,12],130:[2,12],133:[2,12],134:[2,12],135:[2,12],136:[2,12],137:[2,12],138:[2,12],139:[2,12]},{1:[2,13],6:[2,13],25:[2,13],26:[2,13],49:[2,13],54:[2,13],57:[2,13],73:[2,13],78:[2,13],86:[2,13],91:[2,13],93:[2,13],102:[2,13],104:[2,13],105:[2,13],106:[2,13],110:[2,13],118:[2,13],126:[2,13],129:[2,13],130:[2,13],133:[2,13],134:[2,13],135:[2,13],136:[2,13],137:[2,13],138:[2,13],139:[2,13]},{1:[2,14],6:[2,14],25:[2,14],26:[2,14],49:[2,14],54:[2,14],57:[2,14],73:[2,14],78:[2,14],86:[2,14],91:[2,14],93:[2,14],102:[2,14],104:[2,14],105:[2,14],106:[2,14],110:[2,14],118:[2,14],126:[2,14],129:[2,14],130:[2,14],133:[2,14],134:[2,14],135:[2,14],136:[2,14],137:[2,14],138:[2,14],139:[2,14]},{1:[2,15],6:[2,15],25:[2,15],26:[2,15],49:[2,15],54:[2,15],57:[2,15],73:[2,15],78:[2,15],86:[2,15],91:[2,15],93:[2,15],102:[2,15],104:[2,15],105:[2,15],106:[2,15],110:[2,15],118:[2,15],126:[2,15],129:[2,15],130:[2,15],133:[2,15],134:[2,15],135:[2,15],136:[2,15],137:[2,15],138:[2,15],139:[2,15]},{1:[2,16],6:[2,16],25:[2,16],26:[2,16],49:[2,16],54:[2,16],57:[2,16],73:[2,16],78:[2,16],86:[2,16],91:[2,16],93:[2,16],102:[2,16],104:[2,16],105:[2,16],106:[2,16],110:[2,16],118:[2,16],126:[2,16],129:[2,16],130:[2,16],133:[2,16],134:[2,16],135:[2,16],136:[2,16],137:[2,16],138:[2,16],139:[2,16]},{1:[2,17],6:[2,17],25:[2,17],26:[2,17],49:[2,17],54:[2,17],57:[2,17],73:[2,17],78:[2,17],86:[2,17],91:[2,17],93:[2,17],102:[2,17],104:[2,17],105:[2,17],106:[2,17],110:[2,17],118:[2,17],126:[2,17],129:[2,17],130:[2,17],133:[2,17],134:[2,17],135:[2,17],136:[2,17],137:[2,17],138:[2,17],139:[2,17]},{1:[2,18],6:[2,18],25:[2,18],26:[2,18],49:[2,18],54:[2,18],57:[2,18],73:[2,18],78:[2,18],86:[2,18],91:[2,18],93:[2,18],102:[2,18],104:[2,18],105:[2,18],106:[2,18],110:[2,18],118:[2,18],126:[2,18],129:[2,18],130:[2,18],133:[2,18],134:[2,18],135:[2,18],136:[2,18],137:[2,18],138:[2,18],139:[2,18]},{1:[2,19],6:[2,19],25:[2,19],26:[2,19],49:[2,19],54:[2,19],57:[2,19],73:[2,19],78:[2,19],86:[2,19],91:[2,19],93:[2,19],102:[2,19],104:[2,19],105:[2,19],106:[2,19],110:[2,19],118:[2,19],126:[2,19],129:[2,19],130:[2,19],133:[2,19],134:[2,19],135:[2,19],136:[2,19],137:[2,19],138:[2,19],139:[2,19]},{1:[2,20],6:[2,20],25:[2,20],26:[2,20],49:[2,20],54:[2,20],57:[2,20],73:[2,20],78:[2,20],86:[2,20],91:[2,20],93:[2,20],102:[2,20],104:[2,20],105:[2,20],106:[2,20],110:[2,20],118:[2,20],126:[2,20],129:[2,20],130:[2,20],133:[2,20],134:[2,20],135:[2,20],136:[2,20],137:[2,20],138:[2,20],139:[2,20]},{1:[2,21],6:[2,21],25:[2,21],26:[2,21],49:[2,21],54:[2,21],57:[2,21],73:[2,21],78:[2,21],86:[2,21],91:[2,21],93:[2,21],102:[2,21],104:[2,21],105:[2,21],106:[2,21],110:[2,21],118:[2,21],126:[2,21],129:[2,21],130:[2,21],133:[2,21],134:[2,21],135:[2,21],136:[2,21],137:[2,21],138:[2,21],139:[2,21]},{1:[2,22],6:[2,22],25:[2,22],26:[2,22],49:[2,22],54:[2,22],57:[2,22],73:[2,22],78:[2,22],86:[2,22],91:[2,22],93:[2,22],102:[2,22],104:[2,22],105:[2,22],106:[2,22],110:[2,22],118:[2,22],126:[2,22],129:[2,22],130:[2,22],133:[2,22],134:[2,22],135:[2,22],136:[2,22],137:[2,22],138:[2,22],139:[2,22]},{1:[2,8],6:[2,8],26:[2,8],102:[2,8],104:[2,8],106:[2,8],110:[2,8],126:[2,8]},{1:[2,9],6:[2,9],26:[2,9],102:[2,9],104:[2,9],106:[2,9],110:[2,9],126:[2,9]},{1:[2,10],6:[2,10],26:[2,10],102:[2,10],104:[2,10],106:[2,10],110:[2,10],126:[2,10]},{1:[2,75],6:[2,75],25:[2,75],26:[2,75],40:[1,101],49:[2,75],54:[2,75],57:[2,75],66:[2,75],67:[2,75],68:[2,75],69:[2,75],71:[2,75],73:[2,75],74:[2,75],78:[2,75],84:[2,75],85:[2,75],86:[2,75],91:[2,75],93:[2,75],102:[2,75],104:[2,75],105:[2,75],106:[2,75],110:[2,75],118:[2,75],126:[2,75],129:[2,75],130:[2,75],133:[2,75],134:[2,75],135:[2,75],136:[2,75],137:[2,75],138:[2,75],139:[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],69:[2,76],71:[2,76],73:[2,76],74:[2,76],78:[2,76],84:[2,76],85:[2,76],86:[2,76],91:[2,76],93:[2,76],102:[2,76],104:[2,76],105:[2,76],106:[2,76],110:[2,76],118:[2,76],126:[2,76],129:[2,76],130:[2,76],133:[2,76],134:[2,76],135:[2,76],136:[2,76],137:[2,76],138:[2,76],139:[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],69:[2,77],71:[2,77],73:[2,77],74:[2,77],78:[2,77],84:[2,77],85:[2,77],86:[2,77],91:[2,77],93:[2,77],102:[2,77],104:[2,77],105:[2,77],106:[2,77],110:[2,77],118:[2,77],126:[2,77],129:[2,77],130:[2,77],133:[2,77],134:[2,77],135:[2,77],136:[2,77],137:[2,77],138:[2,77],139:[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],69:[2,78],71:[2,78],73:[2,78],74:[2,78],78:[2,78],84:[2,78],85:[2,78],86:[2,78],91:[2,78],93:[2,78],102:[2,78],104:[2,78],105:[2,78],106:[2,78],110:[2,78],118:[2,78],126:[2,78],129:[2,78],130:[2,78],133:[2,78],134:[2,78],135:[2,78],136:[2,78],137:[2,78],138:[2,78],139:[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],69:[2,79],71:[2,79],73:[2,79],74:[2,79],78:[2,79],84:[2,79],85:[2,79],86:[2,79],91:[2,79],93:[2,79],102:[2,79],104:[2,79],105:[2,79],106:[2,79],110:[2,79],118:[2,79],126:[2,79],129:[2,79],130:[2,79],133:[2,79],134:[2,79],135:[2,79],136:[2,79],137:[2,79],138:[2,79],139:[2,79]},{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],69:[2,106],71:[2,106],73:[2,106],74:[2,106],78:[2,106],82:102,84:[2,106],85:[1,103],86:[2,106],91:[2,106],93:[2,106],102:[2,106],104:[2,106],105:[2,106],106:[2,106],110:[2,106],118:[2,106],126:[2,106],129:[2,106],130:[2,106],133:[2,106],134:[2,106],135:[2,106],136:[2,106],137:[2,106],138:[2,106],139:[2,106]},{6:[2,54],25:[2,54],27:108,28:[1,72],44:109,48:104,49:[2,54],54:[2,54],55:105,56:106,57:[1,107],58:110,59:111,76:[1,69],89:[1,112],90:[1,113]},{24:114,25:[1,115]},{7:116,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:118,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:119,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:120,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{12:122,13:123,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:124,44:62,58:46,59:47,61:121,63:23,64:24,65:25,76:[1,69],83:[1,26],88:[1,57],89:[1,58],90:[1,56],101:[1,55]},{12:122,13:123,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:124,44:62,58:46,59:47,61:125,63:23,64:24,65:25,76:[1,69],83:[1,26],88:[1,57],89:[1,58],90:[1,56],101:[1,55]},{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],69:[2,72],71:[2,72],73:[2,72],74:[2,72],78:[2,72],80:[1,129],84:[2,72],85:[2,72],86:[2,72],91:[2,72],93:[2,72],102:[2,72],104:[2,72],105:[2,72],106:[2,72],110:[2,72],118:[2,72],126:[2,72],129:[2,72],130:[2,72],131:[1,126],132:[1,127],133:[2,72],134:[2,72],135:[2,72],136:[2,72],137:[2,72],138:[2,72],139:[2,72],140:[1,128]},{1:[2,184],6:[2,184],25:[2,184],26:[2,184],49:[2,184],54:[2,184],57:[2,184],73:[2,184],78:[2,184],86:[2,184],91:[2,184],93:[2,184],102:[2,184],104:[2,184],105:[2,184],106:[2,184],110:[2,184],118:[2,184],121:[1,130],126:[2,184],129:[2,184],130:[2,184],133:[2,184],134:[2,184],135:[2,184],136:[2,184],137:[2,184],138:[2,184],139:[2,184]},{24:131,25:[1,115]},{24:132,25:[1,115]},{1:[2,151],6:[2,151],25:[2,151],26:[2,151],49:[2,151],54:[2,151],57:[2,151],73:[2,151],78:[2,151],86:[2,151],91:[2,151],93:[2,151],102:[2,151],104:[2,151],105:[2,151],106:[2,151],110:[2,151],118:[2,151],126:[2,151],129:[2,151],130:[2,151],133:[2,151],134:[2,151],135:[2,151],136:[2,151],137:[2,151],138:[2,151],139:[2,151]},{24:133,25:[1,115]},{7:134,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,135],27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{1:[2,96],6:[2,96],12:122,13:123,24:136,25:[1,115],26:[2,96],27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:124,44:62,49:[2,96],54:[2,96],57:[2,96],58:46,59:47,61:138,63:23,64:24,65:25,73:[2,96],76:[1,69],78:[2,96],80:[1,137],83:[1,26],86:[2,96],88:[1,57],89:[1,58],90:[1,56],91:[2,96],93:[2,96],101:[1,55],102:[2,96],104:[2,96],105:[2,96],106:[2,96],110:[2,96],118:[2,96],126:[2,96],129:[2,96],130:[2,96],133:[2,96],134:[2,96],135:[2,96],136:[2,96],137:[2,96],138:[2,96],139:[2,96]},{7:139,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{1:[2,46],6:[2,46],7:140,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,26:[2,46],27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],102:[2,46],103:38,104:[2,46],106:[2,46],107:39,108:[1,66],109:40,110:[2,46],111:68,119:[1,41],124:36,125:[1,63],126:[2,46],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{1:[2,47],6:[2,47],25:[2,47],26:[2,47],54:[2,47],78:[2,47],102:[2,47],104:[2,47],106:[2,47],110:[2,47],126:[2,47]},{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],69:[2,73],71:[2,73],73:[2,73],74:[2,73],78:[2,73],84:[2,73],85:[2,73],86:[2,73],91:[2,73],93:[2,73],102:[2,73],104:[2,73],105:[2,73],106:[2,73],110:[2,73],118:[2,73],126:[2,73],129:[2,73],130:[2,73],133:[2,73],134:[2,73],135:[2,73],136:[2,73],137:[2,73],138:[2,73],139:[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],69:[2,74],71:[2,74],73:[2,74],74:[2,74],78:[2,74],84:[2,74],85:[2,74],86:[2,74],91:[2,74],93:[2,74],102:[2,74],104:[2,74],105:[2,74],106:[2,74],110:[2,74],118:[2,74],126:[2,74],129:[2,74],130:[2,74],133:[2,74],134:[2,74],135:[2,74],136:[2,74],137:[2,74],138:[2,74],139:[2,74]},{1:[2,28],6:[2,28],25:[2,28],26:[2,28],49:[2,28],54:[2,28],57:[2,28],66:[2,28],67:[2,28],68:[2,28],69:[2,28],71:[2,28],73:[2,28],74:[2,28],78:[2,28],84:[2,28],85:[2,28],86:[2,28],91:[2,28],93:[2,28],102:[2,28],104:[2,28],105:[2,28],106:[2,28],110:[2,28],118:[2,28],126:[2,28],129:[2,28],130:[2,28],133:[2,28],134:[2,28],135:[2,28],136:[2,28],137:[2,28],138:[2,28],139:[2,28]},{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],69:[2,29],71:[2,29],73:[2,29],74:[2,29],78:[2,29],84:[2,29],85:[2,29],86:[2,29],91:[2,29],93:[2,29],102:[2,29],104:[2,29],105:[2,29],106:[2,29],110:[2,29],118:[2,29],126:[2,29],129:[2,29],130:[2,29],133:[2,29],134:[2,29],135:[2,29],136:[2,29],137:[2,29],138:[2,29],139:[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],69:[2,30],71:[2,30],73:[2,30],74:[2,30],78:[2,30],84:[2,30],85:[2,30],86:[2,30],91:[2,30],93:[2,30],102:[2,30],104:[2,30],105:[2,30],106:[2,30],110:[2,30],118:[2,30],126:[2,30],129:[2,30],130:[2,30],133:[2,30],134:[2,30],135:[2,30],136:[2,30],137:[2,30],138:[2,30],139:[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],69:[2,31],71:[2,31],73:[2,31],74:[2,31],78:[2,31],84:[2,31],85:[2,31],86:[2,31],91:[2,31],93:[2,31],102:[2,31],104:[2,31],105:[2,31],106:[2,31],110:[2,31],118:[2,31],126:[2,31],129:[2,31],130:[2,31],133:[2,31],134:[2,31],135:[2,31],136:[2,31],137:[2,31],138:[2,31],139:[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],69:[2,32],71:[2,32],73:[2,32],74:[2,32],78:[2,32],84:[2,32],85:[2,32],86:[2,32],91:[2,32],93:[2,32],102:[2,32],104:[2,32],105:[2,32],106:[2,32],110:[2,32],118:[2,32],126:[2,32],129:[2,32],130:[2,32],133:[2,32],134:[2,32],135:[2,32],136:[2,32],137:[2,32],138:[2,32],139:[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],69:[2,33],71:[2,33],73:[2,33],74:[2,33],78:[2,33],84:[2,33],85:[2,33],86:[2,33],91:[2,33],93:[2,33],102:[2,33],104:[2,33],105:[2,33],106:[2,33],110:[2,33],118:[2,33],126:[2,33],129:[2,33],130:[2,33],133:[2,33],134:[2,33],135:[2,33],136:[2,33],137:[2,33],138:[2,33],139:[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],69:[2,34],71:[2,34],73:[2,34],74:[2,34],78:[2,34],84:[2,34],85:[2,34],86:[2,34],91:[2,34],93:[2,34],102:[2,34],104:[2,34],105:[2,34],106:[2,34],110:[2,34],118:[2,34],126:[2,34],129:[2,34],130:[2,34],133:[2,34],134:[2,34],135:[2,34],136:[2,34],137:[2,34],138:[2,34],139:[2,34]},{4:141,5:3,7:4,8:5,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,142],27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:143,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,147],27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],57:[1,149],58:46,59:47,60:148,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],87:145,88:[1,57],89:[1,58],90:[1,56],91:[1,144],94:146,96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{1:[2,112],6:[2,112],25:[2,112],26:[2,112],49:[2,112],54:[2,112],57:[2,112],66:[2,112],67:[2,112],68:[2,112],69:[2,112],71:[2,112],73:[2,112],74:[2,112],78:[2,112],84:[2,112],85:[2,112],86:[2,112],91:[2,112],93:[2,112],102:[2,112],104:[2,112],105:[2,112],106:[2,112],110:[2,112],118:[2,112],126:[2,112],129:[2,112],130:[2,112],133:[2,112],134:[2,112],135:[2,112],136:[2,112],137:[2,112],138:[2,112],139:[2,112]},{1:[2,113],6:[2,113],25:[2,113],26:[2,113],27:150,28:[1,72],49:[2,113],54:[2,113],57:[2,113],66:[2,113],67:[2,113],68:[2,113],69:[2,113],71:[2,113],73:[2,113],74:[2,113],78:[2,113],84:[2,113],85:[2,113],86:[2,113],91:[2,113],93:[2,113],102:[2,113],104:[2,113],105:[2,113],106:[2,113],110:[2,113],118:[2,113],126:[2,113],129:[2,113],130:[2,113],133:[2,113],134:[2,113],135:[2,113],136:[2,113],137:[2,113],138:[2,113],139:[2,113]},{25:[2,50]},{25:[2,51]},{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],69:[2,68],71:[2,68],73:[2,68],74:[2,68],78:[2,68],80:[2,68],84:[2,68],85:[2,68],86:[2,68],91:[2,68],93:[2,68],102:[2,68],104:[2,68],105:[2,68],106:[2,68],110:[2,68],118:[2,68],126:[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],138:[2,68],139:[2,68],140:[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],69:[2,71],71:[2,71],73:[2,71],74:[2,71],78:[2,71],80:[2,71],84:[2,71],85:[2,71],86:[2,71],91:[2,71],93:[2,71],102:[2,71],104:[2,71],105:[2,71],106:[2,71],110:[2,71],118:[2,71],126:[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],138:[2,71],139:[2,71],140:[2,71]},{7:151,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:152,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:153,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:155,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:154,25:[1,115],27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{27:160,28:[1,72],44:161,58:162,59:163,64:156,76:[1,69],89:[1,112],90:[1,56],113:157,114:[1,158],115:159},{112:164,116:[1,165],117:[1,166]},{6:[2,91],10:170,25:[2,91],27:171,28:[1,72],29:172,30:[1,70],31:[1,71],41:168,42:169,44:173,46:[1,45],54:[2,91],77:167,78:[2,91],89:[1,112]},{1:[2,26],6:[2,26],25:[2,26],26:[2,26],43:[2,26],49:[2,26],54:[2,26],57:[2,26],66:[2,26],67:[2,26],68:[2,26],69:[2,26],71:[2,26],73:[2,26],74:[2,26],78:[2,26],84:[2,26],85:[2,26],86:[2,26],91:[2,26],93:[2,26],102:[2,26],104:[2,26],105:[2,26],106:[2,26],110:[2,26],118:[2,26],126:[2,26],129:[2,26],130:[2,26],133:[2,26],134:[2,26],135:[2,26],136:[2,26],137:[2,26],138:[2,26],139:[2,26]},{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],69:[2,27],71:[2,27],73:[2,27],74:[2,27],78:[2,27],84:[2,27],85:[2,27],86:[2,27],91:[2,27],93:[2,27],102:[2,27],104:[2,27],105:[2,27],106:[2,27],110:[2,27],118:[2,27],126:[2,27],129:[2,27],130:[2,27],133:[2,27],134:[2,27],135:[2,27],136:[2,27],137:[2,27],138:[2,27],139:[2,27]},{1:[2,25],6:[2,25],25:[2,25],26:[2,25],40:[2,25],43:[2,25],49:[2,25],54:[2,25],57:[2,25],66:[2,25],67:[2,25],68:[2,25],69:[2,25],71:[2,25],73:[2,25],74:[2,25],78:[2,25],80:[2,25],84:[2,25],85:[2,25],86:[2,25],91:[2,25],93:[2,25],102:[2,25],104:[2,25],105:[2,25],106:[2,25],110:[2,25],116:[2,25],117:[2,25],118:[2,25],126:[2,25],129:[2,25],130:[2,25],131:[2,25],132:[2,25],133:[2,25],134:[2,25],135:[2,25],136:[2,25],137:[2,25],138:[2,25],139:[2,25],140:[2,25]},{1:[2,5],5:174,6:[2,5],7:4,8:5,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,26:[2,5],27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],102:[2,5],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{1:[2,196],6:[2,196],25:[2,196],26:[2,196],49:[2,196],54:[2,196],57:[2,196],73:[2,196],78:[2,196],86:[2,196],91:[2,196],93:[2,196],102:[2,196],104:[2,196],105:[2,196],106:[2,196],110:[2,196],118:[2,196],126:[2,196],129:[2,196],130:[2,196],133:[2,196],134:[2,196],135:[2,196],136:[2,196],137:[2,196],138:[2,196],139:[2,196]},{7:175,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:176,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:177,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:178,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:179,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:180,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:181,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:182,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:183,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{1:[2,150],6:[2,150],25:[2,150],26:[2,150],49:[2,150],54:[2,150],57:[2,150],73:[2,150],78:[2,150],86:[2,150],91:[2,150],93:[2,150],102:[2,150],104:[2,150],105:[2,150],106:[2,150],110:[2,150],118:[2,150],126:[2,150],129:[2,150],130:[2,150],133:[2,150],134:[2,150],135:[2,150],136:[2,150],137:[2,150],138:[2,150],139:[2,150]},{1:[2,155],6:[2,155],25:[2,155],26:[2,155],49:[2,155],54:[2,155],57:[2,155],73:[2,155],78:[2,155],86:[2,155],91:[2,155],93:[2,155],102:[2,155],104:[2,155],105:[2,155],106:[2,155],110:[2,155],118:[2,155],126:[2,155],129:[2,155],130:[2,155],133:[2,155],134:[2,155],135:[2,155],136:[2,155],137:[2,155],138:[2,155],139:[2,155]},{7:184,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{1:[2,149],6:[2,149],25:[2,149],26:[2,149],49:[2,149],54:[2,149],57:[2,149],73:[2,149],78:[2,149],86:[2,149],91:[2,149],93:[2,149],102:[2,149],104:[2,149],105:[2,149],106:[2,149],110:[2,149],118:[2,149],126:[2,149],129:[2,149],130:[2,149],133:[2,149],134:[2,149],135:[2,149],136:[2,149],137:[2,149],138:[2,149],139:[2,149]},{1:[2,154],6:[2,154],25:[2,154],26:[2,154],49:[2,154],54:[2,154],57:[2,154],73:[2,154],78:[2,154],86:[2,154],91:[2,154],93:[2,154],102:[2,154],104:[2,154],105:[2,154],106:[2,154],110:[2,154],118:[2,154],126:[2,154],129:[2,154],130:[2,154],133:[2,154],134:[2,154],135:[2,154],136:[2,154],137:[2,154],138:[2,154],139:[2,154]},{82:185,85:[1,103]},{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],69:[2,69],71:[2,69],73:[2,69],74:[2,69],78:[2,69],80:[2,69],84:[2,69],85:[2,69],86:[2,69],91:[2,69],93:[2,69],102:[2,69],104:[2,69],105:[2,69],106:[2,69],110:[2,69],118:[2,69],126:[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],138:[2,69],139:[2,69],140:[2,69]},{85:[2,109]},{27:186,28:[1,72]},{27:187,28:[1,72]},{1:[2,84],6:[2,84],25:[2,84],26:[2,84],27:188,28:[1,72],40:[2,84],49:[2,84],54:[2,84],57:[2,84],66:[2,84],67:[2,84],68:[2,84],69:[2,84],71:[2,84],73:[2,84],74:[2,84],78:[2,84],80:[2,84],84:[2,84],85:[2,84],86:[2,84],91:[2,84],93:[2,84],102:[2,84],104:[2,84],105:[2,84],106:[2,84],110:[2,84],118:[2,84],126:[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],138:[2,84],139:[2,84],140:[2,84]},{27:189,28:[1,72]},{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],69:[2,85],71:[2,85],73:[2,85],74:[2,85],78:[2,85],80:[2,85],84:[2,85],85:[2,85],86:[2,85],91:[2,85],93:[2,85],102:[2,85],104:[2,85],105:[2,85],106:[2,85],110:[2,85],118:[2,85],126:[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],138:[2,85],139:[2,85],140:[2,85]},{7:191,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],57:[1,195],58:46,59:47,61:35,63:23,64:24,65:25,72:190,75:192,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],92:193,93:[1,194],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{70:196,71:[1,97],74:[1,98]},{82:197,85:[1,103]},{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],69:[2,70],71:[2,70],73:[2,70],74:[2,70],78:[2,70],80:[2,70],84:[2,70],85:[2,70],86:[2,70],91:[2,70],93:[2,70],102:[2,70],104:[2,70],105:[2,70],106:[2,70],110:[2,70],118:[2,70],126:[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],138:[2,70],139:[2,70],140:[2,70]},{6:[1,199],7:198,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,200],27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{1:[2,107],6:[2,107],25:[2,107],26:[2,107],49:[2,107],54:[2,107],57:[2,107],66:[2,107],67:[2,107],68:[2,107],69:[2,107],71:[2,107],73:[2,107],74:[2,107],78:[2,107],84:[2,107],85:[2,107],86:[2,107],91:[2,107],93:[2,107],102:[2,107],104:[2,107],105:[2,107],106:[2,107],110:[2,107],118:[2,107],126:[2,107],129:[2,107],130:[2,107],133:[2,107],134:[2,107],135:[2,107],136:[2,107],137:[2,107],138:[2,107],139:[2,107]},{7:203,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,147],27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],57:[1,149],58:46,59:47,60:148,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],86:[1,201],87:202,88:[1,57],89:[1,58],90:[1,56],94:146,96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{6:[2,52],25:[2,52],49:[1,204],53:206,54:[1,205]},{6:[2,55],25:[2,55],26:[2,55],49:[2,55],54:[2,55]},{6:[2,59],25:[2,59],26:[2,59],40:[1,208],49:[2,59],54:[2,59],57:[1,207]},{6:[2,62],25:[2,62],26:[2,62],49:[2,62],54:[2,62]},{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:150,28:[1,72]},{7:203,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,147],27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],57:[1,149],58:46,59:47,60:148,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],87:145,88:[1,57],89:[1,58],90:[1,56],91:[1,144],94:146,96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{1:[2,49],6:[2,49],25:[2,49],26:[2,49],49:[2,49],54:[2,49],57:[2,49],73:[2,49],78:[2,49],86:[2,49],91:[2,49],93:[2,49],102:[2,49],104:[2,49],105:[2,49],106:[2,49],110:[2,49],118:[2,49],126:[2,49],129:[2,49],130:[2,49],133:[2,49],134:[2,49],135:[2,49],136:[2,49],137:[2,49],138:[2,49],139:[2,49]},{4:210,5:3,7:4,8:5,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,26:[1,209],27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{1:[2,188],6:[2,188],25:[2,188],26:[2,188],49:[2,188],54:[2,188],57:[2,188],73:[2,188],78:[2,188],86:[2,188],91:[2,188],93:[2,188],102:[2,188],103:84,104:[2,188],105:[2,188],106:[2,188],109:85,110:[2,188],111:68,118:[2,188],126:[2,188],129:[2,188],130:[2,188],133:[1,74],134:[2,188],135:[2,188],136:[2,188],137:[2,188],138:[2,188],139:[2,188]},{103:87,104:[1,64],106:[1,65],109:88,110:[1,67],111:68,126:[1,86]},{1:[2,189],6:[2,189],25:[2,189],26:[2,189],49:[2,189],54:[2,189],57:[2,189],73:[2,189],78:[2,189],86:[2,189],91:[2,189],93:[2,189],102:[2,189],103:84,104:[2,189],105:[2,189],106:[2,189],109:85,110:[2,189],111:68,118:[2,189],126:[2,189],129:[2,189],130:[2,189],133:[1,74],134:[2,189],135:[1,78],136:[2,189],137:[2,189],138:[2,189],139:[2,189]},{1:[2,190],6:[2,190],25:[2,190],26:[2,190],49:[2,190],54:[2,190],57:[2,190],73:[2,190],78:[2,190],86:[2,190],91:[2,190],93:[2,190],102:[2,190],103:84,104:[2,190],105:[2,190],106:[2,190],109:85,110:[2,190],111:68,118:[2,190],126:[2,190],129:[2,190],130:[2,190],133:[1,74],134:[2,190],135:[1,78],136:[2,190],137:[2,190],138:[2,190],139:[2,190]},{1:[2,191],6:[2,191],25:[2,191],26:[2,191],49:[2,191],54:[2,191],57:[2,191],73:[2,191],78:[2,191],86:[2,191],91:[2,191],93:[2,191],102:[2,191],103:84,104:[2,191],105:[2,191],106:[2,191],109:85,110:[2,191],111:68,118:[2,191],126:[2,191],129:[2,191],130:[2,191],133:[1,74],134:[2,191],135:[1,78],136:[2,191],137:[2,191],138:[2,191],139:[2,191]},{1:[2,192],6:[2,192],25:[2,192],26:[2,192],49:[2,192],54:[2,192],57:[2,192],66:[2,72],67:[2,72],68:[2,72],69:[2,72],71:[2,72],73:[2,192],74:[2,72],78:[2,192],84:[2,72],85:[2,72],86:[2,192],91:[2,192],93:[2,192],102:[2,192],104:[2,192],105:[2,192],106:[2,192],110:[2,192],118:[2,192],126:[2,192],129:[2,192],130:[2,192],133:[2,192],134:[2,192],135:[2,192],136:[2,192],137:[2,192],138:[2,192],139:[2,192]},{62:90,66:[1,92],67:[1,93],68:[1,94],69:[1,95],70:96,71:[1,97],74:[1,98],81:89,84:[1,91],85:[2,108]},{62:100,66:[1,92],67:[1,93],68:[1,94],69:[1,95],70:96,71:[1,97],74:[1,98],81:99,84:[1,91],85:[2,108]},{66:[2,75],67:[2,75],68:[2,75],69:[2,75],71:[2,75],74:[2,75],84:[2,75],85:[2,75]},{1:[2,193],6:[2,193],25:[2,193],26:[2,193],49:[2,193],54:[2,193],57:[2,193],66:[2,72],67:[2,72],68:[2,72],69:[2,72],71:[2,72],73:[2,193],74:[2,72],78:[2,193],84:[2,72],85:[2,72],86:[2,193],91:[2,193],93:[2,193],102:[2,193],104:[2,193],105:[2,193],106:[2,193],110:[2,193],118:[2,193],126:[2,193],129:[2,193],130:[2,193],133:[2,193],134:[2,193],135:[2,193],136:[2,193],137:[2,193],138:[2,193],139:[2,193]},{1:[2,194],6:[2,194],25:[2,194],26:[2,194],49:[2,194],54:[2,194],57:[2,194],73:[2,194],78:[2,194],86:[2,194],91:[2,194],93:[2,194],102:[2,194],104:[2,194],105:[2,194],106:[2,194],110:[2,194],118:[2,194],126:[2,194],129:[2,194],130:[2,194],133:[2,194],134:[2,194],135:[2,194],136:[2,194],137:[2,194],138:[2,194],139:[2,194]},{1:[2,195],6:[2,195],25:[2,195],26:[2,195],49:[2,195],54:[2,195],57:[2,195],73:[2,195],78:[2,195],86:[2,195],91:[2,195],93:[2,195],102:[2,195],104:[2,195],105:[2,195],106:[2,195],110:[2,195],118:[2,195],126:[2,195],129:[2,195],130:[2,195],133:[2,195],134:[2,195],135:[2,195],136:[2,195],137:[2,195],138:[2,195],139:[2,195]},{6:[1,213],7:211,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,212],27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:214,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{24:215,25:[1,115],125:[1,216]},{1:[2,134],6:[2,134],25:[2,134],26:[2,134],49:[2,134],54:[2,134],57:[2,134],73:[2,134],78:[2,134],86:[2,134],91:[2,134],93:[2,134],97:217,98:[1,218],99:[1,219],102:[2,134],104:[2,134],105:[2,134],106:[2,134],110:[2,134],118:[2,134],126:[2,134],129:[2,134],130:[2,134],133:[2,134],134:[2,134],135:[2,134],136:[2,134],137:[2,134],138:[2,134],139:[2,134]},{1:[2,148],6:[2,148],25:[2,148],26:[2,148],49:[2,148],54:[2,148],57:[2,148],73:[2,148],78:[2,148],86:[2,148],91:[2,148],93:[2,148],102:[2,148],104:[2,148],105:[2,148],106:[2,148],110:[2,148],118:[2,148],126:[2,148],129:[2,148],130:[2,148],133:[2,148],134:[2,148],135:[2,148],136:[2,148],137:[2,148],138:[2,148],139:[2,148]},{1:[2,156],6:[2,156],25:[2,156],26:[2,156],49:[2,156],54:[2,156],57:[2,156],73:[2,156],78:[2,156],86:[2,156],91:[2,156],93:[2,156],102:[2,156],104:[2,156],105:[2,156],106:[2,156],110:[2,156],118:[2,156],126:[2,156],129:[2,156],130:[2,156],133:[2,156],134:[2,156],135:[2,156],136:[2,156],137:[2,156],138:[2,156],139:[2,156]},{25:[1,220],103:84,104:[1,64],106:[1,65],109:85,110:[1,67],111:68,126:[1,83],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{120:221,122:222,123:[1,223]},{1:[2,97],6:[2,97],25:[2,97],26:[2,97],49:[2,97],54:[2,97],57:[2,97],73:[2,97],78:[2,97],86:[2,97],91:[2,97],93:[2,97],102:[2,97],104:[2,97],105:[2,97],106:[2,97],110:[2,97],118:[2,97],126:[2,97],129:[2,97],130:[2,97],133:[2,97],134:[2,97],135:[2,97],136:[2,97],137:[2,97],138:[2,97],139:[2,97]},{7:224,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{1:[2,100],6:[2,100],24:225,25:[1,115],26:[2,100],49:[2,100],54:[2,100],57:[2,100],66:[2,72],67:[2,72],68:[2,72],69:[2,72],71:[2,72],73:[2,100],74:[2,72],78:[2,100],80:[1,226],84:[2,72],85:[2,72],86:[2,100],91:[2,100],93:[2,100],102:[2,100],104:[2,100],105:[2,100],106:[2,100],110:[2,100],118:[2,100],126:[2,100],129:[2,100],130:[2,100],133:[2,100],134:[2,100],135:[2,100],136:[2,100],137:[2,100],138:[2,100],139:[2,100]},{1:[2,141],6:[2,141],25:[2,141],26:[2,141],49:[2,141],54:[2,141],57:[2,141],73:[2,141],78:[2,141],86:[2,141],91:[2,141],93:[2,141],102:[2,141],103:84,104:[2,141],105:[2,141],106:[2,141],109:85,110:[2,141],111:68,118:[2,141],126:[2,141],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{1:[2,45],6:[2,45],26:[2,45],102:[2,45],103:84,104:[2,45],106:[2,45],109:85,110:[2,45],111:68,126:[2,45],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{6:[1,73],102:[1,227]},{4:228,5:3,7:4,8:5,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{6:[2,129],25:[2,129],54:[2,129],57:[1,230],91:[2,129],92:229,93:[1,194],103:84,104:[1,64],106:[1,65],109:85,110:[1,67],111:68,126:[1,83],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{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],69:[2,115],71:[2,115],73:[2,115],74:[2,115],78:[2,115],84:[2,115],85:[2,115],86:[2,115],91:[2,115],93:[2,115],102:[2,115],104:[2,115],105:[2,115],106:[2,115],110:[2,115],116:[2,115],117:[2,115],118:[2,115],126:[2,115],129:[2,115],130:[2,115],133:[2,115],134:[2,115],135:[2,115],136:[2,115],137:[2,115],138:[2,115],139:[2,115]},{6:[2,52],25:[2,52],53:231,54:[1,232],91:[2,52]},{6:[2,124],25:[2,124],26:[2,124],54:[2,124],86:[2,124],91:[2,124]},{7:203,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,147],27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],57:[1,149],58:46,59:47,60:148,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],87:233,88:[1,57],89:[1,58],90:[1,56],94:146,96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{6:[2,130],25:[2,130],26:[2,130],54:[2,130],86:[2,130],91:[2,130]},{6:[2,131],25:[2,131],26:[2,131],54:[2,131],86:[2,131],91:[2,131]},{1:[2,114],6:[2,114],25:[2,114],26:[2,114],40:[2,114],43:[2,114],49:[2,114],54:[2,114],57:[2,114],66:[2,114],67:[2,114],68:[2,114],69:[2,114],71:[2,114],73:[2,114],74:[2,114],78:[2,114],80:[2,114],84:[2,114],85:[2,114],86:[2,114],91:[2,114],93:[2,114],102:[2,114],104:[2,114],105:[2,114],106:[2,114],110:[2,114],116:[2,114],117:[2,114],118:[2,114],126:[2,114],129:[2,114],130:[2,114],131:[2,114],132:[2,114],133:[2,114],134:[2,114],135:[2,114],136:[2,114],137:[2,114],138:[2,114],139:[2,114],140:[2,114]},{24:234,25:[1,115],103:84,104:[1,64],106:[1,65],109:85,110:[1,67],111:68,126:[1,83],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{1:[2,144],6:[2,144],25:[2,144],26:[2,144],49:[2,144],54:[2,144],57:[2,144],73:[2,144],78:[2,144],86:[2,144],91:[2,144],93:[2,144],102:[2,144],103:84,104:[1,64],105:[1,235],106:[1,65],109:85,110:[1,67],111:68,118:[2,144],126:[2,144],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{1:[2,146],6:[2,146],25:[2,146],26:[2,146],49:[2,146],54:[2,146],57:[2,146],73:[2,146],78:[2,146],86:[2,146],91:[2,146],93:[2,146],102:[2,146],103:84,104:[1,64],105:[1,236],106:[1,65],109:85,110:[1,67],111:68,118:[2,146],126:[2,146],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{1:[2,152],6:[2,152],25:[2,152],26:[2,152],49:[2,152],54:[2,152],57:[2,152],73:[2,152],78:[2,152],86:[2,152],91:[2,152],93:[2,152],102:[2,152],104:[2,152],105:[2,152],106:[2,152],110:[2,152],118:[2,152],126:[2,152],129:[2,152],130:[2,152],133:[2,152],134:[2,152],135:[2,152],136:[2,152],137:[2,152],138:[2,152],139:[2,152]},{1:[2,153],6:[2,153],25:[2,153],26:[2,153],49:[2,153],54:[2,153],57:[2,153],73:[2,153],78:[2,153],86:[2,153],91:[2,153],93:[2,153],102:[2,153],103:84,104:[1,64],105:[2,153],106:[1,65],109:85,110:[1,67],111:68,118:[2,153],126:[2,153],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{1:[2,157],6:[2,157],25:[2,157],26:[2,157],49:[2,157],54:[2,157],57:[2,157],73:[2,157],78:[2,157],86:[2,157],91:[2,157],93:[2,157],102:[2,157],104:[2,157],105:[2,157],106:[2,157],110:[2,157],118:[2,157],126:[2,157],129:[2,157],130:[2,157],133:[2,157],134:[2,157],135:[2,157],136:[2,157],137:[2,157],138:[2,157],139:[2,157]},{116:[2,159],117:[2,159]},{27:160,28:[1,72],44:161,58:162,59:163,76:[1,69],89:[1,112],90:[1,113],113:237,115:159},{54:[1,238],116:[2,165],117:[2,165]},{54:[2,161],116:[2,161],117:[2,161]},{54:[2,162],116:[2,162],117:[2,162]},{54:[2,163],116:[2,163],117:[2,163]},{54:[2,164],116:[2,164],117:[2,164]},{1:[2,158],6:[2,158],25:[2,158],26:[2,158],49:[2,158],54:[2,158],57:[2,158],73:[2,158],78:[2,158],86:[2,158],91:[2,158],93:[2,158],102:[2,158],104:[2,158],105:[2,158],106:[2,158],110:[2,158],118:[2,158],126:[2,158],129:[2,158],130:[2,158],133:[2,158],134:[2,158],135:[2,158],136:[2,158],137:[2,158],138:[2,158],139:[2,158]},{7:239,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:240,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{6:[2,52],25:[2,52],53:241,54:[1,242],78:[2,52]},{6:[2,92],25:[2,92],26:[2,92],54:[2,92],78:[2,92]},{6:[2,38],25:[2,38],26:[2,38],43:[1,243],54:[2,38],78:[2,38]},{6:[2,41],25:[2,41],26:[2,41],54:[2,41],78:[2,41]},{6:[2,42],25:[2,42],26:[2,42],43:[2,42],54:[2,42],78:[2,42]},{6:[2,43],25:[2,43],26:[2,43],43:[2,43],54:[2,43],78:[2,43]},{6:[2,44],25:[2,44],26:[2,44],43:[2,44],54:[2,44],78:[2,44]},{1:[2,4],6:[2,4],26:[2,4],102:[2,4]},{1:[2,197],6:[2,197],25:[2,197],26:[2,197],49:[2,197],54:[2,197],57:[2,197],73:[2,197],78:[2,197],86:[2,197],91:[2,197],93:[2,197],102:[2,197],103:84,104:[2,197],105:[2,197],106:[2,197],109:85,110:[2,197],111:68,118:[2,197],126:[2,197],129:[2,197],130:[2,197],133:[1,74],134:[1,77],135:[1,78],136:[2,197],137:[2,197],138:[2,197],139:[2,197]},{1:[2,198],6:[2,198],25:[2,198],26:[2,198],49:[2,198],54:[2,198],57:[2,198],73:[2,198],78:[2,198],86:[2,198],91:[2,198],93:[2,198],102:[2,198],103:84,104:[2,198],105:[2,198],106:[2,198],109:85,110:[2,198],111:68,118:[2,198],126:[2,198],129:[2,198],130:[2,198],133:[1,74],134:[1,77],135:[1,78],136:[2,198],137:[2,198],138:[2,198],139:[2,198]},{1:[2,199],6:[2,199],25:[2,199],26:[2,199],49:[2,199],54:[2,199],57:[2,199],73:[2,199],78:[2,199],86:[2,199],91:[2,199],93:[2,199],102:[2,199],103:84,104:[2,199],105:[2,199],106:[2,199],109:85,110:[2,199],111:68,118:[2,199],126:[2,199],129:[2,199],130:[2,199],133:[1,74],134:[2,199],135:[1,78],136:[2,199],137:[2,199],138:[2,199],139:[2,199]},{1:[2,200],6:[2,200],25:[2,200],26:[2,200],49:[2,200],54:[2,200],57:[2,200],73:[2,200],78:[2,200],86:[2,200],91:[2,200],93:[2,200],102:[2,200],103:84,104:[2,200],105:[2,200],106:[2,200],109:85,110:[2,200],111:68,118:[2,200],126:[2,200],129:[2,200],130:[2,200],133:[1,74],134:[2,200],135:[1,78],136:[2,200],137:[2,200],138:[2,200],139:[2,200]},{1:[2,201],6:[2,201],25:[2,201],26:[2,201],49:[2,201],54:[2,201],57:[2,201],73:[2,201],78:[2,201],86:[2,201],91:[2,201],93:[2,201],102:[2,201],103:84,104:[2,201],105:[2,201],106:[2,201],109:85,110:[2,201],111:68,118:[2,201],126:[2,201],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[2,201],137:[2,201],138:[2,201],139:[2,201]},{1:[2,202],6:[2,202],25:[2,202],26:[2,202],49:[2,202],54:[2,202],57:[2,202],73:[2,202],78:[2,202],86:[2,202],91:[2,202],93:[2,202],102:[2,202],103:84,104:[2,202],105:[2,202],106:[2,202],109:85,110:[2,202],111:68,118:[2,202],126:[2,202],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[2,202],138:[2,202],139:[1,82]},{1:[2,203],6:[2,203],25:[2,203],26:[2,203],49:[2,203],54:[2,203],57:[2,203],73:[2,203],78:[2,203],86:[2,203],91:[2,203],93:[2,203],102:[2,203],103:84,104:[2,203],105:[2,203],106:[2,203],109:85,110:[2,203],111:68,118:[2,203],126:[2,203],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[2,203],139:[1,82]},{1:[2,204],6:[2,204],25:[2,204],26:[2,204],49:[2,204],54:[2,204],57:[2,204],73:[2,204],78:[2,204],86:[2,204],91:[2,204],93:[2,204],102:[2,204],103:84,104:[2,204],105:[2,204],106:[2,204],109:85,110:[2,204],111:68,118:[2,204],126:[2,204],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[2,204],138:[2,204],139:[2,204]},{1:[2,187],6:[2,187],25:[2,187],26:[2,187],49:[2,187],54:[2,187],57:[2,187],73:[2,187],78:[2,187],86:[2,187],91:[2,187],93:[2,187],102:[2,187],103:84,104:[1,64],105:[2,187],106:[1,65],109:85,110:[1,67],111:68,118:[2,187],126:[2,187],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{1:[2,186],6:[2,186],25:[2,186],26:[2,186],49:[2,186],54:[2,186],57:[2,186],73:[2,186],78:[2,186],86:[2,186],91:[2,186],93:[2,186],102:[2,186],103:84,104:[1,64],105:[2,186],106:[1,65],109:85,110:[1,67],111:68,118:[2,186],126:[2,186],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{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],69:[2,104],71:[2,104],73:[2,104],74:[2,104],78:[2,104],84:[2,104],85:[2,104],86:[2,104],91:[2,104],93:[2,104],102:[2,104],104:[2,104],105:[2,104],106:[2,104],110:[2,104],118:[2,104],126:[2,104],129:[2,104],130:[2,104],133:[2,104],134:[2,104],135:[2,104],136:[2,104],137:[2,104],138:[2,104],139:[2,104]},{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],69:[2,80],71:[2,80],73:[2,80],74:[2,80],78:[2,80],80:[2,80],84:[2,80],85:[2,80],86:[2,80],91:[2,80],93:[2,80],102:[2,80],104:[2,80],105:[2,80],106:[2,80],110:[2,80],118:[2,80],126:[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],138:[2,80],139:[2,80],140:[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],69:[2,81],71:[2,81],73:[2,81],74:[2,81],78:[2,81],80:[2,81],84:[2,81],85:[2,81],86:[2,81],91:[2,81],93:[2,81],102:[2,81],104:[2,81],105:[2,81],106:[2,81],110:[2,81],118:[2,81],126:[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],138:[2,81],139:[2,81],140:[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],69:[2,82],71:[2,82],73:[2,82],74:[2,82],78:[2,82],80:[2,82],84:[2,82],85:[2,82],86:[2,82],91:[2,82],93:[2,82],102:[2,82],104:[2,82],105:[2,82],106:[2,82],110:[2,82],118:[2,82],126:[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],138:[2,82],139:[2,82],140:[2,82]},{1:[2,83],6:[2,83],25:[2,83],26:[2,83],40:[2,83],49:[2,83],54:[2,83],57:[2,83],66:[2,83],67:[2,83],68:[2,83],69:[2,83],71:[2,83],73:[2,83],74:[2,83],78:[2,83],80:[2,83],84:[2,83],85:[2,83],86:[2,83],91:[2,83],93:[2,83],102:[2,83],104:[2,83],105:[2,83],106:[2,83],110:[2,83],118:[2,83],126:[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],138:[2,83],139:[2,83],140:[2,83]},{73:[1,244]},{57:[1,195],73:[2,88],92:245,93:[1,194],103:84,104:[1,64],106:[1,65],109:85,110:[1,67],111:68,126:[1,83],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{73:[2,89]},{7:246,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,73:[2,123],76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{11:[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],73:[2,117],76:[2,117],79:[2,117],83:[2,117],88:[2,117],89:[2,117],90:[2,117],96:[2,117],100:[2,117],101:[2,117],104:[2,117],106:[2,117],108:[2,117],110:[2,117],119:[2,117],125:[2,117],127:[2,117],128:[2,117],129:[2,117],130:[2,117],131:[2,117],132:[2,117]},{11:[2,118],28:[2,118],30:[2,118],31:[2,118],33:[2,118],34:[2,118],35:[2,118],36:[2,118],37:[2,118],38:[2,118],45:[2,118],46:[2,118],47:[2,118],51:[2,118],52:[2,118],73:[2,118],76:[2,118],79:[2,118],83:[2,118],88:[2,118],89:[2,118],90:[2,118],96:[2,118],100:[2,118],101:[2,118],104:[2,118],106:[2,118],108:[2,118],110:[2,118],119:[2,118],125:[2,118],127:[2,118],128:[2,118],129:[2,118],130:[2,118],131:[2,118],132:[2,118]},{1:[2,87],6:[2,87],25:[2,87],26:[2,87],40:[2,87],49:[2,87],54:[2,87],57:[2,87],66:[2,87],67:[2,87],68:[2,87],69:[2,87],71:[2,87],73:[2,87],74:[2,87],78:[2,87],80:[2,87],84:[2,87],85:[2,87],86:[2,87],91:[2,87],93:[2,87],102:[2,87],104:[2,87],105:[2,87],106:[2,87],110:[2,87],118:[2,87],126:[2,87],129:[2,87],130:[2,87],131:[2,87],132:[2,87],133:[2,87],134:[2,87],135:[2,87],136:[2,87],137:[2,87],138:[2,87],139:[2,87],140:[2,87]},{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],69:[2,105],71:[2,105],73:[2,105],74:[2,105],78:[2,105],84:[2,105],85:[2,105],86:[2,105],91:[2,105],93:[2,105],102:[2,105],104:[2,105],105:[2,105],106:[2,105],110:[2,105],118:[2,105],126:[2,105],129:[2,105],130:[2,105],133:[2,105],134:[2,105],135:[2,105],136:[2,105],137:[2,105],138:[2,105],139:[2,105]},{1:[2,35],6:[2,35],25:[2,35],26:[2,35],49:[2,35],54:[2,35],57:[2,35],73:[2,35],78:[2,35],86:[2,35],91:[2,35],93:[2,35],102:[2,35],103:84,104:[2,35],105:[2,35],106:[2,35],109:85,110:[2,35],111:68,118:[2,35],126:[2,35],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{7:247,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:248,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{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],69:[2,110],71:[2,110],73:[2,110],74:[2,110],78:[2,110],84:[2,110],85:[2,110],86:[2,110],91:[2,110],93:[2,110],102:[2,110],104:[2,110],105:[2,110],106:[2,110],110:[2,110],118:[2,110],126:[2,110],129:[2,110],130:[2,110],133:[2,110],134:[2,110],135:[2,110],136:[2,110],137:[2,110],138:[2,110],139:[2,110]},{6:[2,52],25:[2,52],53:249,54:[1,232],86:[2,52]},{6:[2,129],25:[2,129],26:[2,129],54:[2,129],57:[1,250],86:[2,129],91:[2,129],103:84,104:[1,64],106:[1,65],109:85,110:[1,67],111:68,126:[1,83],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{50:251,51:[1,59],52:[1,60]},{6:[2,53],25:[2,53],26:[2,53],27:108,28:[1,72],44:109,55:252,56:106,57:[1,107],58:110,59:111,76:[1,69],89:[1,112],90:[1,113]},{6:[1,253],25:[1,254]},{6:[2,60],25:[2,60],26:[2,60],49:[2,60],54:[2,60]},{7:255,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{1:[2,23],6:[2,23],25:[2,23],26:[2,23],49:[2,23],54:[2,23],57:[2,23],73:[2,23],78:[2,23],86:[2,23],91:[2,23],93:[2,23],98:[2,23],99:[2,23],102:[2,23],104:[2,23],105:[2,23],106:[2,23],110:[2,23],118:[2,23],121:[2,23],123:[2,23],126:[2,23],129:[2,23],130:[2,23],133:[2,23],134:[2,23],135:[2,23],136:[2,23],137:[2,23],138:[2,23],139:[2,23]},{6:[1,73],26:[1,256]},{1:[2,205],6:[2,205],25:[2,205],26:[2,205],49:[2,205],54:[2,205],57:[2,205],73:[2,205],78:[2,205],86:[2,205],91:[2,205],93:[2,205],102:[2,205],103:84,104:[2,205],105:[2,205],106:[2,205],109:85,110:[2,205],111:68,118:[2,205],126:[2,205],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{7:257,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:258,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{1:[2,208],6:[2,208],25:[2,208],26:[2,208],49:[2,208],54:[2,208],57:[2,208],73:[2,208],78:[2,208],86:[2,208],91:[2,208],93:[2,208],102:[2,208],103:84,104:[2,208],105:[2,208],106:[2,208],109:85,110:[2,208],111:68,118:[2,208],126:[2,208],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{1:[2,185],6:[2,185],25:[2,185],26:[2,185],49:[2,185],54:[2,185],57:[2,185],73:[2,185],78:[2,185],86:[2,185],91:[2,185],93:[2,185],102:[2,185],104:[2,185],105:[2,185],106:[2,185],110:[2,185],118:[2,185],126:[2,185],129:[2,185],130:[2,185],133:[2,185],134:[2,185],135:[2,185],136:[2,185],137:[2,185],138:[2,185],139:[2,185]},{7:259,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{1:[2,135],6:[2,135],25:[2,135],26:[2,135],49:[2,135],54:[2,135],57:[2,135],73:[2,135],78:[2,135],86:[2,135],91:[2,135],93:[2,135],98:[1,260],102:[2,135],104:[2,135],105:[2,135],106:[2,135],110:[2,135],118:[2,135],126:[2,135],129:[2,135],130:[2,135],133:[2,135],134:[2,135],135:[2,135],136:[2,135],137:[2,135],138:[2,135],139:[2,135]},{24:261,25:[1,115]},{24:264,25:[1,115],27:262,28:[1,72],59:263,76:[1,69]},{120:265,122:222,123:[1,223]},{26:[1,266],121:[1,267],122:268,123:[1,223]},{26:[2,178],121:[2,178],123:[2,178]},{7:270,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],95:269,96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{1:[2,98],6:[2,98],24:271,25:[1,115],26:[2,98],49:[2,98],54:[2,98],57:[2,98],73:[2,98],78:[2,98],86:[2,98],91:[2,98],93:[2,98],102:[2,98],103:84,104:[1,64],105:[2,98],106:[1,65],109:85,110:[1,67],111:68,118:[2,98],126:[2,98],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{1:[2,101],6:[2,101],25:[2,101],26:[2,101],49:[2,101],54:[2,101],57:[2,101],73:[2,101],78:[2,101],86:[2,101],91:[2,101],93:[2,101],102:[2,101],104:[2,101],105:[2,101],106:[2,101],110:[2,101],118:[2,101],126:[2,101],129:[2,101],130:[2,101],133:[2,101],134:[2,101],135:[2,101],136:[2,101],137:[2,101],138:[2,101],139:[2,101]},{7:272,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{1:[2,142],6:[2,142],25:[2,142],26:[2,142],49:[2,142],54:[2,142],57:[2,142],66:[2,142],67:[2,142],68:[2,142],69:[2,142],71:[2,142],73:[2,142],74:[2,142],78:[2,142],84:[2,142],85:[2,142],86:[2,142],91:[2,142],93:[2,142],102:[2,142],104:[2,142],105:[2,142],106:[2,142],110:[2,142],118:[2,142],126:[2,142],129:[2,142],130:[2,142],133:[2,142],134:[2,142],135:[2,142],136:[2,142],137:[2,142],138:[2,142],139:[2,142]},{6:[1,73],26:[1,273]},{7:274,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{6:[2,67],11:[2,118],25:[2,67],28:[2,118],30:[2,118],31:[2,118],33:[2,118],34:[2,118],35:[2,118],36:[2,118],37:[2,118],38:[2,118],45:[2,118],46:[2,118],47:[2,118],51:[2,118],52:[2,118],54:[2,67],76:[2,118],79:[2,118],83:[2,118],88:[2,118],89:[2,118],90:[2,118],91:[2,67],96:[2,118],100:[2,118],101:[2,118],104:[2,118],106:[2,118],108:[2,118],110:[2,118],119:[2,118],125:[2,118],127:[2,118],128:[2,118],129:[2,118],130:[2,118],131:[2,118],132:[2,118]},{6:[1,276],25:[1,277],91:[1,275]},{6:[2,53],7:203,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[2,53],26:[2,53],27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],57:[1,149],58:46,59:47,60:148,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],86:[2,53],88:[1,57],89:[1,58],90:[1,56],91:[2,53],94:278,96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{6:[2,52],25:[2,52],26:[2,52],53:279,54:[1,232]},{1:[2,182],6:[2,182],25:[2,182],26:[2,182],49:[2,182],54:[2,182],57:[2,182],73:[2,182],78:[2,182],86:[2,182],91:[2,182],93:[2,182],102:[2,182],104:[2,182],105:[2,182],106:[2,182],110:[2,182],118:[2,182],121:[2,182],126:[2,182],129:[2,182],130:[2,182],133:[2,182],134:[2,182],135:[2,182],136:[2,182],137:[2,182],138:[2,182],139:[2,182]},{7:280,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:281,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{116:[2,160],117:[2,160]},{27:160,28:[1,72],44:161,58:162,59:163,76:[1,69],89:[1,112],90:[1,113],115:282},{1:[2,167],6:[2,167],25:[2,167],26:[2,167],49:[2,167],54:[2,167],57:[2,167],73:[2,167],78:[2,167],86:[2,167],91:[2,167],93:[2,167],102:[2,167],103:84,104:[2,167],105:[1,283],106:[2,167],109:85,110:[2,167],111:68,118:[1,284],126:[2,167],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{1:[2,168],6:[2,168],25:[2,168],26:[2,168],49:[2,168],54:[2,168],57:[2,168],73:[2,168],78:[2,168],86:[2,168],91:[2,168],93:[2,168],102:[2,168],103:84,104:[2,168],105:[1,285],106:[2,168],109:85,110:[2,168],111:68,118:[2,168],126:[2,168],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{6:[1,287],25:[1,288],78:[1,286]},{6:[2,53],10:170,25:[2,53],26:[2,53],27:171,28:[1,72],29:172,30:[1,70],31:[1,71],41:289,42:169,44:173,46:[1,45],78:[2,53],89:[1,112]},{7:290,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,291],27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{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],69:[2,86],71:[2,86],73:[2,86],74:[2,86],78:[2,86],80:[2,86],84:[2,86],85:[2,86],86:[2,86],91:[2,86],93:[2,86],102:[2,86],104:[2,86],105:[2,86],106:[2,86],110:[2,86],118:[2,86],126:[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],138:[2,86],139:[2,86],140:[2,86]},{7:292,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,73:[2,121],76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{73:[2,122],103:84,104:[1,64],106:[1,65],109:85,110:[1,67],111:68,126:[1,83],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{1:[2,36],6:[2,36],25:[2,36],26:[2,36],49:[2,36],54:[2,36],57:[2,36],73:[2,36],78:[2,36],86:[2,36],91:[2,36],93:[2,36],102:[2,36],103:84,104:[2,36],105:[2,36],106:[2,36],109:85,110:[2,36],111:68,118:[2,36],126:[2,36],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{26:[1,293],103:84,104:[1,64],106:[1,65],109:85,110:[1,67],111:68,126:[1,83],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{6:[1,276],25:[1,277],86:[1,294]},{6:[2,67],25:[2,67],26:[2,67],54:[2,67],86:[2,67],91:[2,67]},{24:295,25:[1,115]},{6:[2,56],25:[2,56],26:[2,56],49:[2,56],54:[2,56]},{27:108,28:[1,72],44:109,55:296,56:106,57:[1,107],58:110,59:111,76:[1,69],89:[1,112],90:[1,113]},{6:[2,54],25:[2,54],26:[2,54],27:108,28:[1,72],44:109,48:297,54:[2,54],55:105,56:106,57:[1,107],58:110,59:111,76:[1,69],89:[1,112],90:[1,113]},{6:[2,61],25:[2,61],26:[2,61],49:[2,61],54:[2,61],103:84,104:[1,64],106:[1,65],109:85,110:[1,67],111:68,126:[1,83],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{1:[2,24],6:[2,24],25:[2,24],26:[2,24],49:[2,24],54:[2,24],57:[2,24],73:[2,24],78:[2,24],86:[2,24],91:[2,24],93:[2,24],98:[2,24],99:[2,24],102:[2,24],104:[2,24],105:[2,24],106:[2,24],110:[2,24],118:[2,24],121:[2,24],123:[2,24],126:[2,24],129:[2,24],130:[2,24],133:[2,24],134:[2,24],135:[2,24],136:[2,24],137:[2,24],138:[2,24],139:[2,24]},{26:[1,298],103:84,104:[1,64],106:[1,65],109:85,110:[1,67],111:68,126:[1,83],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{1:[2,207],6:[2,207],25:[2,207],26:[2,207],49:[2,207],54:[2,207],57:[2,207],73:[2,207],78:[2,207],86:[2,207],91:[2,207],93:[2,207],102:[2,207],103:84,104:[2,207],105:[2,207],106:[2,207],109:85,110:[2,207],111:68,118:[2,207],126:[2,207],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{24:299,25:[1,115],103:84,104:[1,64],106:[1,65],109:85,110:[1,67],111:68,126:[1,83],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{24:300,25:[1,115]},{1:[2,136],6:[2,136],25:[2,136],26:[2,136],49:[2,136],54:[2,136],57:[2,136],73:[2,136],78:[2,136],86:[2,136],91:[2,136],93:[2,136],102:[2,136],104:[2,136],105:[2,136],106:[2,136],110:[2,136],118:[2,136],126:[2,136],129:[2,136],130:[2,136],133:[2,136],134:[2,136],135:[2,136],136:[2,136],137:[2,136],138:[2,136],139:[2,136]},{24:301,25:[1,115]},{24:302,25:[1,115]},{1:[2,140],6:[2,140],25:[2,140],26:[2,140],49:[2,140],54:[2,140],57:[2,140],73:[2,140],78:[2,140],86:[2,140],91:[2,140],93:[2,140],98:[2,140],102:[2,140],104:[2,140],105:[2,140],106:[2,140],110:[2,140],118:[2,140],126:[2,140],129:[2,140],130:[2,140],133:[2,140],134:[2,140],135:[2,140],136:[2,140],137:[2,140],138:[2,140],139:[2,140]},{26:[1,303],121:[1,304],122:268,123:[1,223]},{1:[2,176],6:[2,176],25:[2,176],26:[2,176],49:[2,176],54:[2,176],57:[2,176],73:[2,176],78:[2,176],86:[2,176],91:[2,176],93:[2,176],102:[2,176],104:[2,176],105:[2,176],106:[2,176],110:[2,176],118:[2,176],126:[2,176],129:[2,176],130:[2,176],133:[2,176],134:[2,176],135:[2,176],136:[2,176],137:[2,176],138:[2,176],139:[2,176]},{24:305,25:[1,115]},{26:[2,179],121:[2,179],123:[2,179]},{24:306,25:[1,115],54:[1,307]},{25:[2,132],54:[2,132],103:84,104:[1,64],106:[1,65],109:85,110:[1,67],111:68,126:[1,83],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{1:[2,99],6:[2,99],25:[2,99],26:[2,99],49:[2,99],54:[2,99],57:[2,99],73:[2,99],78:[2,99],86:[2,99],91:[2,99],93:[2,99],102:[2,99],104:[2,99],105:[2,99],106:[2,99],110:[2,99],118:[2,99],126:[2,99],129:[2,99],130:[2,99],133:[2,99],134:[2,99],135:[2,99],136:[2,99],137:[2,99],138:[2,99],139:[2,99]},{1:[2,102],6:[2,102],24:308,25:[1,115],26:[2,102],49:[2,102],54:[2,102],57:[2,102],73:[2,102],78:[2,102],86:[2,102],91:[2,102],93:[2,102],102:[2,102],103:84,104:[1,64],105:[2,102],106:[1,65],109:85,110:[1,67],111:68,118:[2,102],126:[2,102],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{102:[1,309]},{91:[1,310],103:84,104:[1,64],106:[1,65],109:85,110:[1,67],111:68,126:[1,83],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{1:[2,116],6:[2,116],25:[2,116],26:[2,116],40:[2,116],49:[2,116],54:[2,116],57:[2,116],66:[2,116],67:[2,116],68:[2,116],69:[2,116],71:[2,116],73:[2,116],74:[2,116],78:[2,116],84:[2,116],85:[2,116],86:[2,116],91:[2,116],93:[2,116],102:[2,116],104:[2,116],105:[2,116],106:[2,116],110:[2,116],116:[2,116],117:[2,116],118:[2,116],126:[2,116],129:[2,116],130:[2,116],133:[2,116],134:[2,116],135:[2,116],136:[2,116],137:[2,116],138:[2,116],139:[2,116]},{7:203,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],57:[1,149],58:46,59:47,60:148,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],94:311,96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:203,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,147],27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],57:[1,149],58:46,59:47,60:148,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],87:312,88:[1,57],89:[1,58],90:[1,56],94:146,96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{6:[2,125],25:[2,125],26:[2,125],54:[2,125],86:[2,125],91:[2,125]},{6:[1,276],25:[1,277],26:[1,313]},{1:[2,145],6:[2,145],25:[2,145],26:[2,145],49:[2,145],54:[2,145],57:[2,145],73:[2,145],78:[2,145],86:[2,145],91:[2,145],93:[2,145],102:[2,145],103:84,104:[1,64],105:[2,145],106:[1,65],109:85,110:[1,67],111:68,118:[2,145],126:[2,145],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{1:[2,147],6:[2,147],25:[2,147],26:[2,147],49:[2,147],54:[2,147],57:[2,147],73:[2,147],78:[2,147],86:[2,147],91:[2,147],93:[2,147],102:[2,147],103:84,104:[1,64],105:[2,147],106:[1,65],109:85,110:[1,67],111:68,118:[2,147],126:[2,147],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{116:[2,166],117:[2,166]},{7:314,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:315,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:316,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{1:[2,90],6:[2,90],25:[2,90],26:[2,90],40:[2,90],49:[2,90],54:[2,90],57:[2,90],66:[2,90],67:[2,90],68:[2,90],69:[2,90],71:[2,90],73:[2,90],74:[2,90],78:[2,90],84:[2,90],85:[2,90],86:[2,90],91:[2,90],93:[2,90],102:[2,90],104:[2,90],105:[2,90],106:[2,90],110:[2,90],116:[2,90],117:[2,90],118:[2,90],126:[2,90],129:[2,90],130:[2,90],133:[2,90],134:[2,90],135:[2,90],136:[2,90],137:[2,90],138:[2,90],139:[2,90]},{10:170,27:171,28:[1,72],29:172,30:[1,70],31:[1,71],41:317,42:169,44:173,46:[1,45],89:[1,112]},{6:[2,91],10:170,25:[2,91],26:[2,91],27:171,28:[1,72],29:172,30:[1,70],31:[1,71],41:168,42:169,44:173,46:[1,45],54:[2,91],77:318,89:[1,112]},{6:[2,93],25:[2,93],26:[2,93],54:[2,93],78:[2,93]},{6:[2,39],25:[2,39],26:[2,39],54:[2,39],78:[2,39],103:84,104:[1,64],106:[1,65],109:85,110:[1,67],111:68,126:[1,83],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{7:319,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{73:[2,120],103:84,104:[1,64],106:[1,65],109:85,110:[1,67],111:68,126:[1,83],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{1:[2,37],6:[2,37],25:[2,37],26:[2,37],49:[2,37],54:[2,37],57:[2,37],73:[2,37],78:[2,37],86:[2,37],91:[2,37],93:[2,37],102:[2,37],104:[2,37],105:[2,37],106:[2,37],110:[2,37],118:[2,37],126:[2,37],129:[2,37],130:[2,37],133:[2,37],134:[2,37],135:[2,37],136:[2,37],137:[2,37],138:[2,37],139:[2,37]},{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],69:[2,111],71:[2,111],73:[2,111],74:[2,111],78:[2,111],84:[2,111],85:[2,111],86:[2,111],91:[2,111],93:[2,111],102:[2,111],104:[2,111],105:[2,111],106:[2,111],110:[2,111],118:[2,111],126:[2,111],129:[2,111],130:[2,111],133:[2,111],134:[2,111],135:[2,111],136:[2,111],137:[2,111],138:[2,111],139:[2,111]},{1:[2,48],6:[2,48],25:[2,48],26:[2,48],49:[2,48],54:[2,48],57:[2,48],73:[2,48],78:[2,48],86:[2,48],91:[2,48],93:[2,48],102:[2,48],104:[2,48],105:[2,48],106:[2,48],110:[2,48],118:[2,48],126:[2,48],129:[2,48],130:[2,48],133:[2,48],134:[2,48],135:[2,48],136:[2,48],137:[2,48],138:[2,48],139:[2,48]},{6:[2,57],25:[2,57],26:[2,57],49:[2,57],54:[2,57]},{6:[2,52],25:[2,52],26:[2,52],53:320,54:[1,205]},{1:[2,206],6:[2,206],25:[2,206],26:[2,206],49:[2,206],54:[2,206],57:[2,206],73:[2,206],78:[2,206],86:[2,206],91:[2,206],93:[2,206],102:[2,206],104:[2,206],105:[2,206],106:[2,206],110:[2,206],118:[2,206],126:[2,206],129:[2,206],130:[2,206],133:[2,206],134:[2,206],135:[2,206],136:[2,206],137:[2,206],138:[2,206],139:[2,206]},{1:[2,183],6:[2,183],25:[2,183],26:[2,183],49:[2,183],54:[2,183],57:[2,183],73:[2,183],78:[2,183],86:[2,183],91:[2,183],93:[2,183],102:[2,183],104:[2,183],105:[2,183],106:[2,183],110:[2,183],118:[2,183],121:[2,183],126:[2,183],129:[2,183],130:[2,183],133:[2,183],134:[2,183],135:[2,183],136:[2,183],137:[2,183],138:[2,183],139:[2,183]},{1:[2,137],6:[2,137],25:[2,137],26:[2,137],49:[2,137],54:[2,137],57:[2,137],73:[2,137],78:[2,137],86:[2,137],91:[2,137],93:[2,137],102:[2,137],104:[2,137],105:[2,137],106:[2,137],110:[2,137],118:[2,137],126:[2,137],129:[2,137],130:[2,137],133:[2,137],134:[2,137],135:[2,137],136:[2,137],137:[2,137],138:[2,137],139:[2,137]},{1:[2,138],6:[2,138],25:[2,138],26:[2,138],49:[2,138],54:[2,138],57:[2,138],73:[2,138],78:[2,138],86:[2,138],91:[2,138],93:[2,138],98:[2,138],102:[2,138],104:[2,138],105:[2,138],106:[2,138],110:[2,138],118:[2,138],126:[2,138],129:[2,138],130:[2,138],133:[2,138],134:[2,138],135:[2,138],136:[2,138],137:[2,138],138:[2,138],139:[2,138]},{1:[2,139],6:[2,139],25:[2,139],26:[2,139],49:[2,139],54:[2,139],57:[2,139],73:[2,139],78:[2,139],86:[2,139],91:[2,139],93:[2,139],98:[2,139],102:[2,139],104:[2,139],105:[2,139],106:[2,139],110:[2,139],118:[2,139],126:[2,139],129:[2,139],130:[2,139],133:[2,139],134:[2,139],135:[2,139],136:[2,139],137:[2,139],138:[2,139],139:[2,139]},{1:[2,174],6:[2,174],25:[2,174],26:[2,174],49:[2,174],54:[2,174],57:[2,174],73:[2,174],78:[2,174],86:[2,174],91:[2,174],93:[2,174],102:[2,174],104:[2,174],105:[2,174],106:[2,174],110:[2,174],118:[2,174],126:[2,174],129:[2,174],130:[2,174],133:[2,174],134:[2,174],135:[2,174],136:[2,174],137:[2,174],138:[2,174],139:[2,174]},{24:321,25:[1,115]},{26:[1,322]},{6:[1,323],26:[2,180],121:[2,180],123:[2,180]},{7:324,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{1:[2,103],6:[2,103],25:[2,103],26:[2,103],49:[2,103],54:[2,103],57:[2,103],73:[2,103],78:[2,103],86:[2,103],91:[2,103],93:[2,103],102:[2,103],104:[2,103],105:[2,103],106:[2,103],110:[2,103],118:[2,103],126:[2,103],129:[2,103],130:[2,103],133:[2,103],134:[2,103],135:[2,103],136:[2,103],137:[2,103],138:[2,103],139:[2,103]},{1:[2,143],6:[2,143],25:[2,143],26:[2,143],49:[2,143],54:[2,143],57:[2,143],66:[2,143],67:[2,143],68:[2,143],69:[2,143],71:[2,143],73:[2,143],74:[2,143],78:[2,143],84:[2,143],85:[2,143],86:[2,143],91:[2,143],93:[2,143],102:[2,143],104:[2,143],105:[2,143],106:[2,143],110:[2,143],118:[2,143],126:[2,143],129:[2,143],130:[2,143],133:[2,143],134:[2,143],135:[2,143],136:[2,143],137:[2,143],138:[2,143],139:[2,143]},{1:[2,119],6:[2,119],25:[2,119],26:[2,119],49:[2,119],54:[2,119],57:[2,119],66:[2,119],67:[2,119],68:[2,119],69:[2,119],71:[2,119],73:[2,119],74:[2,119],78:[2,119],84:[2,119],85:[2,119],86:[2,119],91:[2,119],93:[2,119],102:[2,119],104:[2,119],105:[2,119],106:[2,119],110:[2,119],118:[2,119],126:[2,119],129:[2,119],130:[2,119],133:[2,119],134:[2,119],135:[2,119],136:[2,119],137:[2,119],138:[2,119],139:[2,119]},{6:[2,126],25:[2,126],26:[2,126],54:[2,126],86:[2,126],91:[2,126]},{6:[2,52],25:[2,52],26:[2,52],53:325,54:[1,232]},{6:[2,127],25:[2,127],26:[2,127],54:[2,127],86:[2,127],91:[2,127]},{1:[2,169],6:[2,169],25:[2,169],26:[2,169],49:[2,169],54:[2,169],57:[2,169],73:[2,169],78:[2,169],86:[2,169],91:[2,169],93:[2,169],102:[2,169],103:84,104:[2,169],105:[2,169],106:[2,169],109:85,110:[2,169],111:68,118:[1,326],126:[2,169],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{1:[2,171],6:[2,171],25:[2,171],26:[2,171],49:[2,171],54:[2,171],57:[2,171],73:[2,171],78:[2,171],86:[2,171],91:[2,171],93:[2,171],102:[2,171],103:84,104:[2,171],105:[1,327],106:[2,171],109:85,110:[2,171],111:68,118:[2,171],126:[2,171],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{1:[2,170],6:[2,170],25:[2,170],26:[2,170],49:[2,170],54:[2,170],57:[2,170],73:[2,170],78:[2,170],86:[2,170],91:[2,170],93:[2,170],102:[2,170],103:84,104:[2,170],105:[2,170],106:[2,170],109:85,110:[2,170],111:68,118:[2,170],126:[2,170],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{6:[2,94],25:[2,94],26:[2,94],54:[2,94],78:[2,94]},{6:[2,52],25:[2,52],26:[2,52],53:328,54:[1,242]},{26:[1,329],103:84,104:[1,64],106:[1,65],109:85,110:[1,67],111:68,126:[1,83],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{6:[1,253],25:[1,254],26:[1,330]},{26:[1,331]},{1:[2,177],6:[2,177],25:[2,177],26:[2,177],49:[2,177],54:[2,177],57:[2,177],73:[2,177],78:[2,177],86:[2,177],91:[2,177],93:[2,177],102:[2,177],104:[2,177],105:[2,177],106:[2,177],110:[2,177],118:[2,177],126:[2,177],129:[2,177],130:[2,177],133:[2,177],134:[2,177],135:[2,177],136:[2,177],137:[2,177],138:[2,177],139:[2,177]},{26:[2,181],121:[2,181],123:[2,181]},{25:[2,133],54:[2,133],103:84,104:[1,64],106:[1,65],109:85,110:[1,67],111:68,126:[1,83],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{6:[1,276],25:[1,277],26:[1,332]},{7:333,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{7:334,8:117,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:61,28:[1,72],29:48,30:[1,70],31:[1,71],32:22,33:[1,49],34:[1,50],35:[1,51],36:[1,52],37:[1,53],38:[1,54],39:21,44:62,45:[1,44],46:[1,45],47:[1,27],50:28,51:[1,59],52:[1,60],58:46,59:47,61:35,63:23,64:24,65:25,76:[1,69],79:[1,42],83:[1,26],88:[1,57],89:[1,58],90:[1,56],96:[1,37],100:[1,43],101:[1,55],103:38,104:[1,64],106:[1,65],107:39,108:[1,66],109:40,110:[1,67],111:68,119:[1,41],124:36,125:[1,63],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33],132:[1,34]},{6:[1,287],25:[1,288],26:[1,335]},{6:[2,40],25:[2,40],26:[2,40],54:[2,40],78:[2,40]},{6:[2,58],25:[2,58],26:[2,58],49:[2,58],54:[2,58]},{1:[2,175],6:[2,175],25:[2,175],26:[2,175],49:[2,175],54:[2,175],57:[2,175],73:[2,175],78:[2,175],86:[2,175],91:[2,175],93:[2,175],102:[2,175],104:[2,175],105:[2,175],106:[2,175],110:[2,175],118:[2,175],126:[2,175],129:[2,175],130:[2,175],133:[2,175],134:[2,175],135:[2,175],136:[2,175],137:[2,175],138:[2,175],139:[2,175]},{6:[2,128],25:[2,128],26:[2,128],54:[2,128],86:[2,128],91:[2,128]},{1:[2,172],6:[2,172],25:[2,172],26:[2,172],49:[2,172],54:[2,172],57:[2,172],73:[2,172],78:[2,172],86:[2,172],91:[2,172],93:[2,172],102:[2,172],103:84,104:[2,172],105:[2,172],106:[2,172],109:85,110:[2,172],111:68,118:[2,172],126:[2,172],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{1:[2,173],6:[2,173],25:[2,173],26:[2,173],49:[2,173],54:[2,173],57:[2,173],73:[2,173],78:[2,173],86:[2,173],91:[2,173],93:[2,173],102:[2,173],103:84,104:[2,173],105:[2,173],106:[2,173],109:85,110:[2,173],111:68,118:[2,173],126:[2,173],129:[1,76],130:[1,75],133:[1,74],134:[1,77],135:[1,78],136:[1,79],137:[1,80],138:[1,81],139:[1,82]},{6:[2,95],25:[2,95],26:[2,95],54:[2,95],78:[2,95]}], -defaultActions: {59:[2,50],60:[2,51],91:[2,109],192:[2,89]}, -parseError: function parseError(str, hash) { - if (hash.recoverable) { - this.trace(str); - } else { - throw new Error(str); - } -}, -parse: function parse(input) { - var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; - var args = lstack.slice.call(arguments, 1); - this.lexer.setInput(input); - this.lexer.yy = this.yy; - this.yy.lexer = this.lexer; - this.yy.parser = this; - if (typeof this.lexer.yylloc == 'undefined') { - this.lexer.yylloc = {}; - } - var yyloc = this.lexer.yylloc; - lstack.push(yyloc); - var ranges = this.lexer.options && this.lexer.options.ranges; - if (typeof this.yy.parseError === 'function') { - this.parseError = this.yy.parseError; - } else { - this.parseError = Object.getPrototypeOf(this).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() || EOF; - 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) { - state = stack[stack.length - 1]; - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol === null || typeof symbol == 'undefined') { - symbol = lex(); - } - action = table[state] && table[state][symbol]; - } - if (typeof action === 'undefined' || !action.length || !action[0]) { - var errStr = ''; - expected = []; - for (p in table[state]) { - if (this.terminals_[p] && p > TERROR) { - expected.push('\'' + this.terminals_[p] + '\''); - } - } - if (this.lexer.showPosition) { - errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + this.lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; - } else { - errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == 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 - }); - } - 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: - stack.push(symbol); - vstack.push(this.lexer.yytext); - lstack.push(this.lexer.yylloc); - stack.push(action[1]); - symbol = null; - if (!preErrorSymbol) { - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - if (recovering > 0) { - recovering--; - } - } else { - symbol = preErrorSymbol; - preErrorSymbol = null; - } - break; - case 2: - len = this.productions_[action[1]][1]; - yyval.$ = vstack[vstack.length - len]; - 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 - }; - if (ranges) { - yyval._$.range = [ - lstack[lstack.length - (len || 1)].range[0], - lstack[lstack.length - 1].range[1] - ]; - } - r = this.performAction.apply(yyval, [ - yytext, - yyleng, - yylineno, - this.yy, - action[1], - vstack, - lstack - ].concat(args)); - if (typeof r !== 'undefined') { - return r; - } - 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]); - vstack.push(yyval.$); - lstack.push(yyval._$); - newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; - stack.push(newState); - break; - case 3: - return true; - } - } - return true; -}}; - -function Parser () { - this.yy = {}; -} -Parser.prototype = parser;parser.Parser = Parser; -return new Parser; -})(); - - -if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = parser; -exports.Parser = parser.Parser; -exports.parse = function () { return parser.parse.apply(parser, arguments); }; -exports.main = function commonjsMain(args) { - if (!args[1]) { - console.log('Usage: '+args[0]+' FILE'); - process.exit(1); - } - var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); - return exports.parser.parse(source); -}; -if (typeof module !== 'undefined' && require.main === module) { - exports.main(process.argv.slice(1)); -} -} \ No newline at end of file diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/register.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/register.js deleted file mode 100644 index b1d75ca41..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/register.js +++ /dev/null @@ -1,66 +0,0 @@ -// Generated by CoffeeScript 1.8.0 -(function() { - var CoffeeScript, Module, binary, child_process, ext, findExtension, fork, helpers, loadFile, path, _i, _len, _ref; - - CoffeeScript = require('./coffee-script'); - - child_process = require('child_process'); - - helpers = require('./helpers'); - - path = require('path'); - - loadFile = function(module, filename) { - var answer; - answer = CoffeeScript._compileFile(filename, false); - return module._compile(answer, filename); - }; - - if (require.extensions) { - _ref = CoffeeScript.FILE_EXTENSIONS; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - ext = _ref[_i]; - require.extensions[ext] = loadFile; - } - Module = require('module'); - findExtension = function(filename) { - var curExtension, extensions; - extensions = path.basename(filename).split('.'); - if (extensions[0] === '') { - extensions.shift(); - } - while (extensions.shift()) { - curExtension = '.' + extensions.join('.'); - if (Module._extensions[curExtension]) { - return curExtension; - } - } - return '.js'; - }; - Module.prototype.load = function(filename) { - var extension; - this.filename = filename; - this.paths = Module._nodeModulePaths(path.dirname(filename)); - extension = findExtension(filename); - Module._extensions[extension](this, filename); - return this.loaded = true; - }; - } - - if (child_process) { - fork = child_process.fork; - binary = require.resolve('../../bin/coffee'); - child_process.fork = function(path, args, options) { - if (helpers.isCoffee(path)) { - if (!Array.isArray(args)) { - options = args || {}; - args = []; - } - args = [path].concat(args); - path = binary; - } - return fork(path, args, options); - }; - } - -}).call(this); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/repl.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/repl.js deleted file mode 100644 index 9f0697750..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/repl.js +++ /dev/null @@ -1,176 +0,0 @@ -// Generated by CoffeeScript 1.8.0 -(function() { - var CoffeeScript, addHistory, addMultilineHandler, fs, getCommandId, merge, nodeREPL, path, replDefaults, updateSyntaxError, vm, _ref; - - fs = require('fs'); - - path = require('path'); - - vm = require('vm'); - - nodeREPL = require('repl'); - - CoffeeScript = require('./coffee-script'); - - _ref = require('./helpers'), merge = _ref.merge, updateSyntaxError = _ref.updateSyntaxError; - - replDefaults = { - prompt: 'coffee> ', - historyFile: process.env.HOME ? path.join(process.env.HOME, '.coffee_history') : void 0, - historyMaxInputSize: 10240, - "eval": function(input, context, filename, cb) { - var Assign, Block, Literal, Value, ast, err, js, result, _ref1; - input = input.replace(/\uFF00/g, '\n'); - input = input.replace(/^\(([\s\S]*)\n\)$/m, '$1'); - _ref1 = require('./nodes'), Block = _ref1.Block, Assign = _ref1.Assign, Value = _ref1.Value, Literal = _ref1.Literal; - try { - ast = CoffeeScript.nodes(input); - ast = new Block([new Assign(new Value(new Literal('_')), ast, '=')]); - js = ast.compile({ - bare: true, - locals: Object.keys(context) - }); - result = context === global ? vm.runInThisContext(js, filename) : vm.runInContext(js, context, filename); - return cb(null, result); - } catch (_error) { - err = _error; - updateSyntaxError(err, input); - return cb(err); - } - } - }; - - addMultilineHandler = function(repl) { - var inputStream, multiline, nodeLineListener, origPrompt, outputStream, rli, _ref1; - rli = repl.rli, inputStream = repl.inputStream, outputStream = repl.outputStream; - origPrompt = (_ref1 = repl._prompt) != null ? _ref1 : repl.prompt; - multiline = { - enabled: false, - initialPrompt: origPrompt.replace(/^[^> ]*/, function(x) { - return x.replace(/./g, '-'); - }), - prompt: origPrompt.replace(/^[^> ]*>?/, function(x) { - return x.replace(/./g, '.'); - }), - buffer: '' - }; - nodeLineListener = rli.listeners('line')[0]; - rli.removeListener('line', nodeLineListener); - rli.on('line', function(cmd) { - if (multiline.enabled) { - multiline.buffer += "" + cmd + "\n"; - rli.setPrompt(multiline.prompt); - rli.prompt(true); - } else { - rli.setPrompt(origPrompt); - nodeLineListener(cmd); - } - }); - return inputStream.on('keypress', function(char, key) { - if (!(key && key.ctrl && !key.meta && !key.shift && key.name === 'v')) { - return; - } - if (multiline.enabled) { - if (!multiline.buffer.match(/\n/)) { - multiline.enabled = !multiline.enabled; - rli.setPrompt(origPrompt); - rli.prompt(true); - return; - } - if ((rli.line != null) && !rli.line.match(/^\s*$/)) { - return; - } - multiline.enabled = !multiline.enabled; - rli.line = ''; - rli.cursor = 0; - rli.output.cursorTo(0); - rli.output.clearLine(1); - multiline.buffer = multiline.buffer.replace(/\n/g, '\uFF00'); - rli.emit('line', multiline.buffer); - multiline.buffer = ''; - } else { - multiline.enabled = !multiline.enabled; - rli.setPrompt(multiline.initialPrompt); - rli.prompt(true); - } - }); - }; - - addHistory = function(repl, filename, maxSize) { - var buffer, fd, lastLine, readFd, size, stat; - lastLine = null; - try { - stat = fs.statSync(filename); - size = Math.min(maxSize, stat.size); - readFd = fs.openSync(filename, 'r'); - buffer = new Buffer(size); - fs.readSync(readFd, buffer, 0, size, stat.size - size); - repl.rli.history = buffer.toString().split('\n').reverse(); - if (stat.size > maxSize) { - repl.rli.history.pop(); - } - if (repl.rli.history[0] === '') { - repl.rli.history.shift(); - } - repl.rli.historyIndex = -1; - lastLine = repl.rli.history[0]; - } catch (_error) {} - fd = fs.openSync(filename, 'a'); - repl.rli.addListener('line', function(code) { - if (code && code.length && code !== '.history' && lastLine !== code) { - fs.write(fd, "" + code + "\n"); - return lastLine = code; - } - }); - repl.rli.on('exit', function() { - return fs.close(fd); - }); - return repl.commands[getCommandId(repl, 'history')] = { - help: 'Show command history', - action: function() { - repl.outputStream.write("" + (repl.rli.history.slice(0).reverse().join('\n')) + "\n"); - return repl.displayPrompt(); - } - }; - }; - - getCommandId = function(repl, commandName) { - var commandsHaveLeadingDot; - commandsHaveLeadingDot = repl.commands['.help'] != null; - if (commandsHaveLeadingDot) { - return "." + commandName; - } else { - return commandName; - } - }; - - module.exports = { - start: function(opts) { - var build, major, minor, repl, _ref1; - if (opts == null) { - opts = {}; - } - _ref1 = process.versions.node.split('.').map(function(n) { - return parseInt(n); - }), major = _ref1[0], minor = _ref1[1], build = _ref1[2]; - if (major === 0 && minor < 8) { - console.warn("Node 0.8.0+ required for CoffeeScript REPL"); - process.exit(1); - } - CoffeeScript.register(); - process.argv = ['coffee'].concat(process.argv.slice(2)); - opts = merge(replDefaults, opts); - repl = nodeREPL.start(opts); - repl.on('exit', function() { - return repl.outputStream.write('\n'); - }); - addMultilineHandler(repl); - if (opts.historyFile) { - addHistory(repl, opts.historyFile, opts.historyMaxInputSize); - } - repl.commands[getCommandId(repl, 'load')].help = 'Load code from a file into this REPL session'; - return repl; - } - }; - -}).call(this); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/rewriter.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/rewriter.js deleted file mode 100644 index c5f228ad3..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/rewriter.js +++ /dev/null @@ -1,475 +0,0 @@ -// Generated by CoffeeScript 1.8.0 -(function() { - var BALANCED_PAIRS, CALL_CLOSERS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, generate, 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; - - generate = function(tag, value, origin) { - var tok; - tok = [tag, value]; - tok.generated = true; - if (origin) { - tok.origin = origin; - } - return tok; - }; - - exports.Rewriter = (function() { - function Rewriter() {} - - Rewriter.prototype.rewrite = function(tokens) { - this.tokens = tokens; - this.removeLeadingNewlines(); - this.closeOpenCalls(); - this.closeOpenIndexes(); - this.normalizeLines(); - this.tagPostfixConditionals(); - this.addImplicitBracesAndParens(); - this.addLocationDataToGeneratedTokens(); - 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.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.matchTags = function() { - var fuzz, i, j, pattern, _i, _ref, _ref1; - i = arguments[0], pattern = 2 <= arguments.length ? __slice.call(arguments, 1) : []; - fuzz = 0; - for (j = _i = 0, _ref = pattern.length; 0 <= _ref ? _i < _ref : _i > _ref; j = 0 <= _ref ? ++_i : --_i) { - while (this.tag(i + j + fuzz) === 'HERECOMMENT') { - fuzz += 2; - } - if (pattern[j] == null) { - continue; - } - if (typeof pattern[j] === 'string') { - pattern[j] = [pattern[j]]; - } - if (_ref1 = this.tag(i + j + fuzz), __indexOf.call(pattern[j], _ref1) < 0) { - return false; - } - } - return true; - }; - - Rewriter.prototype.looksObjectish = function(j) { - return this.matchTags(j, '@', null, ':') || this.matchTags(j, null, ':'); - }; - - Rewriter.prototype.findTagsBackwards = function(i, tags) { - var backStack, _ref, _ref1, _ref2, _ref3, _ref4, _ref5; - backStack = []; - while (i >= 0 && (backStack.length || (_ref2 = this.tag(i), __indexOf.call(tags, _ref2) < 0) && ((_ref3 = this.tag(i), __indexOf.call(EXPRESSION_START, _ref3) < 0) || this.tokens[i].generated) && (_ref4 = this.tag(i), __indexOf.call(LINEBREAKS, _ref4) < 0))) { - if (_ref = this.tag(i), __indexOf.call(EXPRESSION_END, _ref) >= 0) { - backStack.push(this.tag(i)); - } - if ((_ref1 = this.tag(i), __indexOf.call(EXPRESSION_START, _ref1) >= 0) && backStack.length) { - backStack.pop(); - } - i -= 1; - } - return _ref5 = this.tag(i), __indexOf.call(tags, _ref5) >= 0; - }; - - Rewriter.prototype.addImplicitBracesAndParens = function() { - var stack; - stack = []; - return this.scanTokens(function(token, i, tokens) { - var endImplicitCall, endImplicitObject, forward, inImplicit, inImplicitCall, inImplicitControl, inImplicitObject, newLine, nextTag, offset, prevTag, prevToken, s, sameLine, stackIdx, stackTag, stackTop, startIdx, startImplicitCall, startImplicitObject, startsLine, tag, _ref, _ref1, _ref2, _ref3, _ref4, _ref5; - tag = token[0]; - prevTag = (prevToken = i > 0 ? tokens[i - 1] : [])[0]; - nextTag = (i < tokens.length - 1 ? tokens[i + 1] : [])[0]; - stackTop = function() { - return stack[stack.length - 1]; - }; - startIdx = i; - forward = function(n) { - return i - startIdx + n; - }; - inImplicit = function() { - var _ref, _ref1; - return (_ref = stackTop()) != null ? (_ref1 = _ref[2]) != null ? _ref1.ours : void 0 : void 0; - }; - inImplicitCall = function() { - var _ref; - return inImplicit() && ((_ref = stackTop()) != null ? _ref[0] : void 0) === '('; - }; - inImplicitObject = function() { - var _ref; - return inImplicit() && ((_ref = stackTop()) != null ? _ref[0] : void 0) === '{'; - }; - inImplicitControl = function() { - var _ref; - return inImplicit && ((_ref = stackTop()) != null ? _ref[0] : void 0) === 'CONTROL'; - }; - startImplicitCall = function(j) { - var idx; - idx = j != null ? j : i; - stack.push([ - '(', idx, { - ours: true - } - ]); - tokens.splice(idx, 0, generate('CALL_START', '(')); - if (j == null) { - return i += 1; - } - }; - endImplicitCall = function() { - stack.pop(); - tokens.splice(i, 0, generate('CALL_END', ')')); - return i += 1; - }; - startImplicitObject = function(j, startsLine) { - var idx; - if (startsLine == null) { - startsLine = true; - } - idx = j != null ? j : i; - stack.push([ - '{', idx, { - sameLine: true, - startsLine: startsLine, - ours: true - } - ]); - tokens.splice(idx, 0, generate('{', generate(new String('{')), token)); - if (j == null) { - return i += 1; - } - }; - endImplicitObject = function(j) { - j = j != null ? j : i; - stack.pop(); - tokens.splice(j, 0, generate('}', '}', token)); - return i += 1; - }; - if (inImplicitCall() && (tag === 'IF' || tag === 'TRY' || tag === 'FINALLY' || tag === 'CATCH' || tag === 'CLASS' || tag === 'SWITCH')) { - stack.push([ - 'CONTROL', i, { - ours: true - } - ]); - return forward(1); - } - if (tag === 'INDENT' && inImplicit()) { - if (prevTag !== '=>' && prevTag !== '->' && prevTag !== '[' && prevTag !== '(' && prevTag !== ',' && prevTag !== '{' && prevTag !== 'TRY' && prevTag !== 'ELSE' && prevTag !== '=') { - while (inImplicitCall()) { - endImplicitCall(); - } - } - if (inImplicitControl()) { - stack.pop(); - } - stack.push([tag, i]); - return forward(1); - } - if (__indexOf.call(EXPRESSION_START, tag) >= 0) { - stack.push([tag, i]); - return forward(1); - } - if (__indexOf.call(EXPRESSION_END, tag) >= 0) { - while (inImplicit()) { - if (inImplicitCall()) { - endImplicitCall(); - } else if (inImplicitObject()) { - endImplicitObject(); - } else { - stack.pop(); - } - } - stack.pop(); - } - if ((__indexOf.call(IMPLICIT_FUNC, tag) >= 0 && token.spaced && !token.stringEnd || tag === '?' && i > 0 && !tokens[i - 1].spaced) && (__indexOf.call(IMPLICIT_CALL, nextTag) >= 0 || __indexOf.call(IMPLICIT_UNSPACED_CALL, nextTag) >= 0 && !((_ref = tokens[i + 1]) != null ? _ref.spaced : void 0) && !((_ref1 = tokens[i + 1]) != null ? _ref1.newLine : void 0))) { - if (tag === '?') { - tag = token[0] = 'FUNC_EXIST'; - } - startImplicitCall(i + 1); - return forward(2); - } - if (__indexOf.call(IMPLICIT_FUNC, tag) >= 0 && this.matchTags(i + 1, 'INDENT', null, ':') && !this.findTagsBackwards(i, ['CLASS', 'EXTENDS', 'IF', 'CATCH', 'SWITCH', 'LEADING_WHEN', 'FOR', 'WHILE', 'UNTIL'])) { - startImplicitCall(i + 1); - stack.push(['INDENT', i + 2]); - return forward(3); - } - if (tag === ':') { - if (this.tag(i - 2) === '@') { - s = i - 2; - } else { - s = i - 1; - } - while (this.tag(s - 2) === 'HERECOMMENT') { - s -= 2; - } - this.insideForDeclaration = nextTag === 'FOR'; - startsLine = s === 0 || (_ref2 = this.tag(s - 1), __indexOf.call(LINEBREAKS, _ref2) >= 0) || tokens[s - 1].newLine; - if (stackTop()) { - _ref3 = stackTop(), stackTag = _ref3[0], stackIdx = _ref3[1]; - if ((stackTag === '{' || stackTag === 'INDENT' && this.tag(stackIdx - 1) === '{') && (startsLine || this.tag(s - 1) === ',' || this.tag(s - 1) === '{')) { - return forward(1); - } - } - startImplicitObject(s, !!startsLine); - return forward(2); - } - if (inImplicitObject() && __indexOf.call(LINEBREAKS, tag) >= 0) { - stackTop()[2].sameLine = false; - } - newLine = prevTag === 'OUTDENT' || prevToken.newLine; - if (__indexOf.call(IMPLICIT_END, tag) >= 0 || __indexOf.call(CALL_CLOSERS, tag) >= 0 && newLine) { - while (inImplicit()) { - _ref4 = stackTop(), stackTag = _ref4[0], stackIdx = _ref4[1], (_ref5 = _ref4[2], sameLine = _ref5.sameLine, startsLine = _ref5.startsLine); - if (inImplicitCall() && prevTag !== ',') { - endImplicitCall(); - } else if (inImplicitObject() && !this.insideForDeclaration && sameLine && tag !== 'TERMINATOR' && prevTag !== ':' && endImplicitObject()) { - - } else if (inImplicitObject() && tag === 'TERMINATOR' && prevTag !== ',' && !(startsLine && this.looksObjectish(i + 1))) { - endImplicitObject(); - } else { - break; - } - } - } - if (tag === ',' && !this.looksObjectish(i + 1) && inImplicitObject() && !this.insideForDeclaration && (nextTag !== 'TERMINATOR' || !this.looksObjectish(i + 2))) { - offset = nextTag === 'OUTDENT' ? 1 : 0; - while (inImplicitObject()) { - endImplicitObject(i + offset); - } - } - return forward(1); - }); - }; - - Rewriter.prototype.addLocationDataToGeneratedTokens = function() { - return this.scanTokens(function(token, i, tokens) { - var column, line, nextLocation, prevLocation, _ref, _ref1; - if (token[2]) { - return 1; - } - if (!(token.generated || token.explicit)) { - return 1; - } - if (token[0] === '{' && (nextLocation = (_ref = tokens[i + 1]) != null ? _ref[2] : void 0)) { - line = nextLocation.first_line, column = nextLocation.first_column; - } else if (prevLocation = (_ref1 = tokens[i - 1]) != null ? _ref1[2] : void 0) { - line = prevLocation.last_line, column = prevLocation.last_column; - } else { - line = column = 0; - } - token[2] = { - first_line: line, - first_column: column, - last_line: line, - last_column: column - }; - return 1; - }); - }; - - Rewriter.prototype.normalizeLines = function() { - var action, condition, indent, outdent, starter; - starter = indent = outdent = null; - condition = function(token, i) { - var _ref, _ref1, _ref2, _ref3; - return token[1] !== ';' && (_ref = token[0], __indexOf.call(SINGLE_CLOSERS, _ref) >= 0) && !(token[0] === 'TERMINATOR' && (_ref1 = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref1) >= 0)) && !(token[0] === 'ELSE' && starter !== 'THEN') && !(((_ref2 = token[0]) === 'CATCH' || _ref2 === 'FINALLY') && (starter === '->' || starter === '=>')) || (_ref3 = token[0], __indexOf.call(CALL_CLOSERS, _ref3) >= 0) && this.tokens[i - 1].newLine; - }; - 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 j, tag, _i, _ref, _ref1, _ref2; - tag = token[0]; - if (tag === 'TERMINATOR') { - if (this.tag(i + 1) === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') { - tokens.splice.apply(tokens, [i, 1].concat(__slice.call(this.indentation()))); - return 1; - } - if (_ref = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref) >= 0) { - tokens.splice(i, 1); - return 0; - } - } - if (tag === 'CATCH') { - for (j = _i = 1; _i <= 2; j = ++_i) { - if (!((_ref1 = this.tag(i + j)) === 'OUTDENT' || _ref1 === 'TERMINATOR' || _ref1 === 'FINALLY')) { - continue; - } - tokens.splice.apply(tokens, [i + j, 0].concat(__slice.call(this.indentation()))); - return 2 + j; - } - } - if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) { - starter = tag; - _ref2 = this.indentation(tokens[i]), indent = _ref2[0], outdent = _ref2[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 prevTag, tag; - tag = token[0]; - prevTag = this.tokens[i - 1][0]; - return tag === 'TERMINATOR' || (tag === 'INDENT' && __indexOf.call(SINGLE_LINERS, prevTag) < 0); - }; - 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(origin) { - var indent, outdent; - indent = ['INDENT', 2]; - outdent = ['OUTDENT', 2]; - if (origin) { - indent.generated = outdent.generated = true; - indent.origin = outdent.origin = origin; - } else { - indent.explicit = outdent.explicit = true; - } - return [indent, outdent]; - }; - - Rewriter.prototype.generate = generate; - - 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', 'THEN', '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', 'UNARY_MATH', 'SUPER', 'THROW', '@', '->', '=>', '[', '(', '{', '--', '++']; - - IMPLICIT_UNSPACED_CALL = ['+', '-']; - - 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_CLOSERS = ['.', '?.', '::', '?::']; - -}).call(this); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/scope.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/scope.js deleted file mode 100644 index cb43b024f..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/scope.js +++ /dev/null @@ -1,146 +0,0 @@ -// Generated by CoffeeScript 1.8.0 -(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() { - var _ref1; - if (((_ref1 = this.method) != null ? _ref1.name : void 0) || !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/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/sourcemap.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/sourcemap.js deleted file mode 100644 index c94ebd170..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/lib/coffee-script/sourcemap.js +++ /dev/null @@ -1,161 +0,0 @@ -// Generated by CoffeeScript 1.8.0 -(function() { - var LineMap, SourceMap; - - LineMap = (function() { - function LineMap(line) { - this.line = line; - this.columns = []; - } - - LineMap.prototype.add = function(column, _arg, options) { - var sourceColumn, sourceLine; - sourceLine = _arg[0], sourceColumn = _arg[1]; - if (options == null) { - options = {}; - } - if (this.columns[column] && options.noReplace) { - return; - } - return this.columns[column] = { - line: this.line, - column: column, - sourceLine: sourceLine, - sourceColumn: sourceColumn - }; - }; - - LineMap.prototype.sourceLocation = function(column) { - var mapping; - while (!((mapping = this.columns[column]) || (column <= 0))) { - column--; - } - return mapping && [mapping.sourceLine, mapping.sourceColumn]; - }; - - return LineMap; - - })(); - - SourceMap = (function() { - var BASE64_CHARS, VLQ_CONTINUATION_BIT, VLQ_SHIFT, VLQ_VALUE_MASK; - - function SourceMap() { - this.lines = []; - } - - SourceMap.prototype.add = function(sourceLocation, generatedLocation, options) { - var column, line, lineMap, _base; - if (options == null) { - options = {}; - } - line = generatedLocation[0], column = generatedLocation[1]; - lineMap = ((_base = this.lines)[line] || (_base[line] = new LineMap(line))); - return lineMap.add(column, sourceLocation, options); - }; - - SourceMap.prototype.sourceLocation = function(_arg) { - var column, line, lineMap; - line = _arg[0], column = _arg[1]; - while (!((lineMap = this.lines[line]) || (line <= 0))) { - line--; - } - return lineMap && lineMap.sourceLocation(column); - }; - - SourceMap.prototype.generate = function(options, code) { - var buffer, lastColumn, lastSourceColumn, lastSourceLine, lineMap, lineNumber, mapping, needComma, v3, writingline, _i, _j, _len, _len1, _ref, _ref1; - if (options == null) { - options = {}; - } - if (code == null) { - code = null; - } - writingline = 0; - lastColumn = 0; - lastSourceLine = 0; - lastSourceColumn = 0; - needComma = false; - buffer = ""; - _ref = this.lines; - for (lineNumber = _i = 0, _len = _ref.length; _i < _len; lineNumber = ++_i) { - lineMap = _ref[lineNumber]; - if (lineMap) { - _ref1 = lineMap.columns; - for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { - mapping = _ref1[_j]; - if (!(mapping)) { - continue; - } - while (writingline < mapping.line) { - lastColumn = 0; - needComma = false; - buffer += ";"; - writingline++; - } - if (needComma) { - buffer += ","; - needComma = false; - } - buffer += this.encodeVlq(mapping.column - lastColumn); - lastColumn = mapping.column; - buffer += this.encodeVlq(0); - buffer += this.encodeVlq(mapping.sourceLine - lastSourceLine); - lastSourceLine = mapping.sourceLine; - buffer += this.encodeVlq(mapping.sourceColumn - lastSourceColumn); - lastSourceColumn = mapping.sourceColumn; - needComma = true; - } - } - } - v3 = { - version: 3, - file: options.generatedFile || '', - sourceRoot: options.sourceRoot || '', - sources: options.sourceFiles || [''], - names: [], - mappings: buffer - }; - if (options.inline) { - v3.sourcesContent = [code]; - } - return JSON.stringify(v3, null, 2); - }; - - VLQ_SHIFT = 5; - - VLQ_CONTINUATION_BIT = 1 << VLQ_SHIFT; - - VLQ_VALUE_MASK = VLQ_CONTINUATION_BIT - 1; - - SourceMap.prototype.encodeVlq = function(value) { - var answer, nextChunk, signBit, valueToEncode; - answer = ''; - signBit = value < 0 ? 1 : 0; - valueToEncode = (Math.abs(value) << 1) + signBit; - while (valueToEncode || !answer) { - nextChunk = valueToEncode & VLQ_VALUE_MASK; - valueToEncode = valueToEncode >> VLQ_SHIFT; - if (valueToEncode) { - nextChunk |= VLQ_CONTINUATION_BIT; - } - answer += this.encodeBase64(nextChunk); - } - return answer; - }; - - BASE64_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - - SourceMap.prototype.encodeBase64 = function(value) { - return BASE64_CHARS[value] || (function() { - throw new Error("Cannot Base64 encode value: " + value); - })(); - }; - - return SourceMap; - - })(); - - module.exports = SourceMap; - -}).call(this); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/.npmignore b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/.npmignore deleted file mode 100644 index 9303c347e..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -npm-debug.log \ No newline at end of file diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/.travis.yml b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/.travis.yml deleted file mode 100644 index 84fd7ca24..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.8 - - 0.9 diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/LICENSE b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/LICENSE deleted file mode 100644 index 432d1aeb0..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright 2010 James Halliday (mail@substack.net) - -This project is free software released under the MIT/X11 license: - -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/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/examples/pow.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/examples/pow.js deleted file mode 100644 index e6924212e..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/examples/pow.js +++ /dev/null @@ -1,6 +0,0 @@ -var mkdirp = require('mkdirp'); - -mkdirp('/tmp/foo/bar/baz', function (err) { - if (err) console.error(err) - else console.log('pow!') -}); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/index.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/index.js deleted file mode 100644 index fda6de8a2..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/index.js +++ /dev/null @@ -1,82 +0,0 @@ -var path = require('path'); -var fs = require('fs'); - -module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; - -function mkdirP (p, mode, f, made) { - if (typeof mode === 'function' || mode === undefined) { - f = mode; - mode = 0777 & (~process.umask()); - } - if (!made) made = null; - - var cb = f || function () {}; - if (typeof mode === 'string') mode = parseInt(mode, 8); - p = path.resolve(p); - - fs.mkdir(p, mode, function (er) { - if (!er) { - made = made || p; - return cb(null, made); - } - switch (er.code) { - case 'ENOENT': - mkdirP(path.dirname(p), mode, function (er, made) { - if (er) cb(er, made); - else mkdirP(p, mode, cb, made); - }); - break; - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - fs.stat(p, function (er2, stat) { - // if the stat fails, then that's super weird. - // let the original error be the failure reason. - if (er2 || !stat.isDirectory()) cb(er, made) - else cb(null, made); - }); - break; - } - }); -} - -mkdirP.sync = function sync (p, mode, made) { - if (mode === undefined) { - mode = 0777 & (~process.umask()); - } - if (!made) made = null; - - if (typeof mode === 'string') mode = parseInt(mode, 8); - p = path.resolve(p); - - try { - fs.mkdirSync(p, mode); - made = made || p; - } - catch (err0) { - switch (err0.code) { - case 'ENOENT' : - made = sync(path.dirname(p), mode, made); - sync(p, mode, made); - break; - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - var stat; - try { - stat = fs.statSync(p); - } - catch (err1) { - throw err0; - } - if (!stat.isDirectory()) throw err0; - break; - } - } - - return made; -}; diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/package.json b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/package.json deleted file mode 100644 index 1824b36e5..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/package.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "mkdirp", - "description": "Recursively mkdir, like `mkdir -p`", - "version": "0.3.5", - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "main": "./index", - "keywords": [ - "mkdir", - "directory" - ], - "repository": { - "type": "git", - "url": "http://github.com/substack/node-mkdirp.git" - }, - "scripts": { - "test": "tap test/*.js" - }, - "devDependencies": { - "tap": "~0.4.0" - }, - "license": "MIT", - "_id": "mkdirp@0.3.5", - "dist": { - "shasum": "de3e5f8961c88c787ee1368df849ac4413eca8d7", - "tarball": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz" - }, - "_from": "mkdirp@>=0.3.5 <0.4.0", - "_npmVersion": "1.2.2", - "_npmUser": { - "name": "substack", - "email": "mail@substack.net" - }, - "maintainers": [ - { - "name": "substack", - "email": "mail@substack.net" - } - ], - "directories": {}, - "_shasum": "de3e5f8961c88c787ee1368df849ac4413eca8d7", - "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz", - "bugs": { - "url": "https://github.com/substack/node-mkdirp/issues" - }, - "readme": "ERROR: No README data found!", - "homepage": "https://github.com/substack/node-mkdirp" -} diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/readme.markdown b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/readme.markdown deleted file mode 100644 index 83b0216ab..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/readme.markdown +++ /dev/null @@ -1,63 +0,0 @@ -# mkdirp - -Like `mkdir -p`, but in node.js! - -[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp) - -# example - -## pow.js - -```js -var mkdirp = require('mkdirp'); - -mkdirp('/tmp/foo/bar/baz', function (err) { - if (err) console.error(err) - else console.log('pow!') -}); -``` - -Output - -``` -pow! -``` - -And now /tmp/foo/bar/baz exists, huzzah! - -# methods - -```js -var mkdirp = require('mkdirp'); -``` - -## mkdirp(dir, mode, cb) - -Create a new directory and any necessary subdirectories at `dir` with octal -permission string `mode`. - -If `mode` isn't specified, it defaults to `0777 & (~process.umask())`. - -`cb(err, made)` fires with the error or the first directory `made` -that had to be created, if any. - -## mkdirp.sync(dir, mode) - -Synchronously create a new directory and any necessary subdirectories at `dir` -with octal permission string `mode`. - -If `mode` isn't specified, it defaults to `0777 & (~process.umask())`. - -Returns the first directory that had to be created, if any. - -# install - -With [npm](http://npmjs.org) do: - -``` -npm install mkdirp -``` - -# license - -MIT diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/chmod.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/chmod.js deleted file mode 100644 index 520dcb8e9..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/chmod.js +++ /dev/null @@ -1,38 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -var ps = [ '', 'tmp' ]; - -for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); -} - -var file = ps.join('/'); - -test('chmod-pre', function (t) { - var mode = 0744 - mkdirp(file, mode, function (er) { - t.ifError(er, 'should not error'); - fs.stat(file, function (er, stat) { - t.ifError(er, 'should exist'); - t.ok(stat && stat.isDirectory(), 'should be directory'); - t.equal(stat && stat.mode & 0777, mode, 'should be 0744'); - t.end(); - }); - }); -}); - -test('chmod', function (t) { - var mode = 0755 - mkdirp(file, mode, function (er) { - t.ifError(er, 'should not error'); - fs.stat(file, function (er, stat) { - t.ifError(er, 'should exist'); - t.ok(stat && stat.isDirectory(), 'should be directory'); - t.end(); - }); - }); -}); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/clobber.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/clobber.js deleted file mode 100644 index 0eb709987..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/clobber.js +++ /dev/null @@ -1,37 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -var ps = [ '', 'tmp' ]; - -for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); -} - -var file = ps.join('/'); - -// a file in the way -var itw = ps.slice(0, 3).join('/'); - - -test('clobber-pre', function (t) { - console.error("about to write to "+itw) - fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.'); - - fs.stat(itw, function (er, stat) { - t.ifError(er) - t.ok(stat && stat.isFile(), 'should be file') - t.end() - }) -}) - -test('clobber', function (t) { - t.plan(2); - mkdirp(file, 0755, function (err) { - t.ok(err); - t.equal(err.code, 'ENOTDIR'); - t.end(); - }); -}); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/mkdirp.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/mkdirp.js deleted file mode 100644 index b07cd70c1..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/mkdirp.js +++ /dev/null @@ -1,28 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('woo', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - mkdirp(file, 0755, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }) - }); -}); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/perm.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/perm.js deleted file mode 100644 index 23a7abbd2..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/perm.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('async perm', function (t) { - t.plan(2); - var file = '/tmp/' + (Math.random() * (1<<30)).toString(16); - - mkdirp(file, 0755, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }) - }); -}); - -test('async root perm', function (t) { - mkdirp('/tmp', 0755, function (err) { - if (err) t.fail(err); - t.end(); - }); - t.end(); -}); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/perm_sync.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/perm_sync.js deleted file mode 100644 index f685f6090..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/perm_sync.js +++ /dev/null @@ -1,39 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('sync perm', function (t) { - t.plan(2); - var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json'; - - mkdirp.sync(file, 0755); - path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }); -}); - -test('sync root perm', function (t) { - t.plan(1); - - var file = '/tmp'; - mkdirp.sync(file, 0755); - path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }); -}); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/race.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/race.js deleted file mode 100644 index 96a044763..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/race.js +++ /dev/null @@ -1,41 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('race', function (t) { - t.plan(4); - var ps = [ '', 'tmp' ]; - - for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); - } - var file = ps.join('/'); - - var res = 2; - mk(file, function () { - if (--res === 0) t.end(); - }); - - mk(file, function () { - if (--res === 0) t.end(); - }); - - function mk (file, cb) { - mkdirp(file, 0755, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - if (cb) cb(); - } - }) - }) - }); - } -}); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/rel.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/rel.js deleted file mode 100644 index 79858243a..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/rel.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('rel', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var cwd = process.cwd(); - process.chdir('/tmp'); - - var file = [x,y,z].join('/'); - - mkdirp(file, 0755, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - process.chdir(cwd); - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }) - }); -}); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/return.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/return.js deleted file mode 100644 index bce68e561..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/return.js +++ /dev/null @@ -1,25 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('return value', function (t) { - t.plan(4); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - // should return the first dir created. - // By this point, it would be profoundly surprising if /tmp didn't - // already exist, since every other test makes things in there. - mkdirp(file, function (err, made) { - t.ifError(err); - t.equal(made, '/tmp/' + x); - mkdirp(file, function (err, made) { - t.ifError(err); - t.equal(made, null); - }); - }); -}); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/return_sync.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/return_sync.js deleted file mode 100644 index 7c222d355..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/return_sync.js +++ /dev/null @@ -1,24 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('return value', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - // should return the first dir created. - // By this point, it would be profoundly surprising if /tmp didn't - // already exist, since every other test makes things in there. - // Note that this will throw on failure, which will fail the test. - var made = mkdirp.sync(file); - t.equal(made, '/tmp/' + x); - - // making the same file again should have no effect. - made = mkdirp.sync(file); - t.equal(made, null); -}); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/root.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/root.js deleted file mode 100644 index 97ad7a2f3..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/root.js +++ /dev/null @@ -1,18 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('root', function (t) { - // '/' on unix, 'c:/' on windows. - var file = path.resolve('/'); - - mkdirp(file, 0755, function (err) { - if (err) throw err - fs.stat(file, function (er, stat) { - if (er) throw er - t.ok(stat.isDirectory(), 'target is a directory'); - t.end(); - }) - }); -}); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/sync.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/sync.js deleted file mode 100644 index 7530cada8..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/sync.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('sync', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - try { - mkdirp.sync(file, 0755); - } catch (err) { - t.fail(err); - return t.end(); - } - - path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }); - }); -}); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/umask.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/umask.js deleted file mode 100644 index 64ccafe22..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/umask.js +++ /dev/null @@ -1,28 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('implicit mode from umask', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - mkdirp(file, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0777 & (~process.umask())); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }) - }); -}); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/umask_sync.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/umask_sync.js deleted file mode 100644 index 35bd5cbbf..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/umask_sync.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('umask sync modes', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - try { - mkdirp.sync(file); - } catch (err) { - t.fail(err); - return t.end(); - } - - path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, (0777 & (~process.umask()))); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }); - }); -}); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/package.json b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/package.json deleted file mode 100644 index 8792071d0..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "coffee-script", - "description": "Unfancy JavaScript", - "keywords": [ - "javascript", - "language", - "coffeescript", - "compiler" - ], - "author": { - "name": "Jeremy Ashkenas" - }, - "version": "1.8.0", - "license": "MIT", - "engines": { - "node": ">=0.8.0" - }, - "directories": { - "lib": "./lib/coffee-script" - }, - "main": "./lib/coffee-script/coffee-script", - "bin": { - "coffee": "./bin/coffee", - "cake": "./bin/cake" - }, - "preferGlobal": true, - "scripts": { - "test": "node ./bin/cake test" - }, - "homepage": "http://coffeescript.org", - "bugs": { - "url": "https://github.com/jashkenas/coffeescript/issues" - }, - "repository": { - "type": "git", - "url": "git://github.com/jashkenas/coffeescript.git" - }, - "devDependencies": { - "uglify-js": "~2.2", - "jison": ">=0.2.0", - "highlight.js": "~8.0.0", - "underscore": "~1.5.2", - "docco": "~0.6.2" - }, - "dependencies": { - "mkdirp": "~0.3.5" - }, - "_id": "coffee-script@1.8.0", - "dist": { - "shasum": "9c9f1d2b4a52a000ded15b659791703648263c1d", - "tarball": "http://registry.npmjs.org/coffee-script/-/coffee-script-1.8.0.tgz" - }, - "_from": "coffee-script@>=1.8.0 <1.9.0", - "_npmVersion": "1.3.21", - "_npmUser": { - "name": "jashkenas", - "email": "jashkenas@gmail.com" - }, - "maintainers": [ - { - "name": "jashkenas", - "email": "jashkenas@gmail.com" - }, - { - "name": "michaelficarra", - "email": "npm@michael.ficarra.me" - } - ], - "_shasum": "9c9f1d2b4a52a000ded15b659791703648263c1d", - "_resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.8.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/register.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/register.js deleted file mode 100644 index 97b33d729..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/register.js +++ /dev/null @@ -1 +0,0 @@ -require('./lib/coffee-script/register'); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/repl.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/repl.js deleted file mode 100644 index d2706a7a3..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/repl.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/coffee-script/repl'); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/LICENSE.md b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/LICENSE.md deleted file mode 100644 index 493db50ed..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/LICENSE.md +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2013 GitHub Inc. - -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/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/README.md b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/README.md deleted file mode 100644 index 377aa9194..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# fs plus [![Build Status](https://travis-ci.org/atom/fs-plus.svg?branch=master)](https://travis-ci.org/atom/fs-plus) - -Yet another filesystem helper based on node's [fs](http://nodejs.org/api/fs.html) -module. This library exports everything from node's fs module but with some -extra helpers. - -## Using - -```sh -npm install fs-plus -``` - -```coffee -fs = require 'fs-plus' -``` diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/lib/fs-plus.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/lib/fs-plus.js deleted file mode 100644 index 6a58ca751..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/lib/fs-plus.js +++ /dev/null @@ -1,532 +0,0 @@ -(function() { - var Module, async, fs, fsPlus, isPathValid, lstatSyncNoException, mkdirp, path, rimraf, statSyncNoException, _, - __slice = [].slice; - - fs = require('fs'); - - Module = require('module'); - - path = require('path'); - - _ = require('underscore-plus'); - - async = require('async'); - - mkdirp = require('mkdirp'); - - rimraf = require('rimraf'); - - fsPlus = { - getHomeDirectory: function() { - if (process.platform === 'win32') { - return process.env.USERPROFILE; - } else { - return process.env.HOME; - } - }, - absolute: function(relativePath) { - var e, homeDir; - if (relativePath == null) { - return null; - } - homeDir = fsPlus.getHomeDirectory(); - if (relativePath === '~') { - relativePath = homeDir; - } else if (relativePath.indexOf('~/') === 0) { - relativePath = "" + homeDir + (relativePath.substring(1)); - } - try { - return fs.realpathSync(relativePath); - } catch (_error) { - e = _error; - return relativePath; - } - }, - normalize: function(pathToNormalize) { - var home, normalizedPath; - if (pathToNormalize == null) { - return null; - } - normalizedPath = path.normalize(pathToNormalize.toString()); - if (home = fsPlus.getHomeDirectory()) { - if (normalizedPath === '~') { - normalizedPath = home; - } else if (normalizedPath.indexOf("~" + path.sep) === 0) { - normalizedPath = "" + home + (normalizedPath.substring(1)); - } - } - return normalizedPath; - }, - getAppDataDirectory: function() { - switch (process.platform) { - case 'darwin': - return fsPlus.absolute('~/Library/Application Support'); - case 'linux': - return '/var/lib'; - case 'win32': - return process.env.APPDATA; - default: - return null; - } - }, - isAbsolute: function(pathToCheck) { - if (pathToCheck == null) { - pathToCheck = ''; - } - if (process.platform === 'win32') { - if (pathToCheck[1] === ':') { - return true; - } - if (pathToCheck[0] === '\\' && pathToCheck[1] === '\\') { - return true; - } - } else { - return pathToCheck[0] === '/'; - } - return false; - }, - existsSync: function(pathToCheck) { - return isPathValid(pathToCheck) && (statSyncNoException(pathToCheck) !== false); - }, - isDirectorySync: function(directoryPath) { - var stat; - if (!isPathValid(directoryPath)) { - return false; - } - if (stat = statSyncNoException(directoryPath)) { - return stat.isDirectory(); - } else { - return false; - } - }, - isDirectory: function(directoryPath, done) { - if (!isPathValid(directoryPath)) { - return done(false); - } - return fs.exists(directoryPath, function(exists) { - if (exists) { - return fs.stat(directoryPath, function(error, stat) { - if (error != null) { - return done(false); - } else { - return done(stat.isDirectory()); - } - }); - } else { - return done(false); - } - }); - }, - isFileSync: function(filePath) { - var stat; - if (!isPathValid(filePath)) { - return false; - } - if (stat = statSyncNoException(filePath)) { - return stat.isFile(); - } else { - return false; - } - }, - isSymbolicLinkSync: function(symlinkPath) { - var stat; - if (!isPathValid(symlinkPath)) { - return false; - } - if (stat = lstatSyncNoException(symlinkPath)) { - return stat.isSymbolicLink(); - } else { - return false; - } - }, - isSymbolicLink: function(symlinkPath, callback) { - if (isPathValid(symlinkPath)) { - return fs.lstat(symlinkPath, function(error, stat) { - return typeof callback === "function" ? callback((stat != null) && stat.isSymbolicLink()) : void 0; - }); - } else { - return process.nextTick(function() { - return typeof callback === "function" ? callback(false) : void 0; - }); - } - }, - isExecutableSync: function(pathToCheck) { - var stat; - if (!isPathValid(pathToCheck)) { - return false; - } - if (stat = statSyncNoException(pathToCheck)) { - return (stat.mode & 0x1ff & 1) !== 0; - } else { - return false; - } - }, - getSizeSync: function(pathToCheck) { - var _ref; - if (isPathValid(pathToCheck)) { - return (_ref = statSyncNoException(pathToCheck).size) != null ? _ref : -1; - } else { - return -1; - } - }, - listSync: function(rootPath, extensions) { - var paths; - if (!fsPlus.isDirectorySync(rootPath)) { - return []; - } - paths = fs.readdirSync(rootPath); - if (extensions) { - paths = fsPlus.filterExtensions(paths, extensions); - } - paths = paths.sort(function(a, b) { - return a.toLowerCase().localeCompare(b.toLowerCase()); - }); - paths = paths.map(function(childPath) { - return path.join(rootPath, childPath); - }); - return paths; - }, - list: function() { - var done, extensions, rest, rootPath; - rootPath = arguments[0], rest = 2 <= arguments.length ? __slice.call(arguments, 1) : []; - if (rest.length > 1) { - extensions = rest.shift(); - } - done = rest.shift(); - return fs.readdir(rootPath, function(error, paths) { - if (error != null) { - return done(error); - } else { - if (extensions) { - paths = fsPlus.filterExtensions(paths, extensions); - } - paths = paths.sort(function(a, b) { - return a.toLowerCase().localeCompare(b.toLowerCase()); - }); - paths = paths.map(function(childPath) { - return path.join(rootPath, childPath); - }); - return done(null, paths); - } - }); - }, - filterExtensions: function(paths, extensions) { - extensions = extensions.map(function(ext) { - if (ext === '') { - return ext; - } else { - return '.' + ext.replace(/^\./, ''); - } - }); - return paths.filter(function(pathToCheck) { - return _.include(extensions, path.extname(pathToCheck)); - }); - }, - listTreeSync: function(rootPath) { - var onPath, paths; - paths = []; - onPath = function(childPath) { - paths.push(childPath); - return true; - }; - fsPlus.traverseTreeSync(rootPath, onPath, onPath); - return paths; - }, - moveSync: function(source, target) { - return fs.renameSync(source, target); - }, - removeSync: function(pathToRemove) { - return rimraf.sync(pathToRemove); - }, - writeFileSync: function(filePath, content, options) { - mkdirp.sync(path.dirname(filePath)); - return fs.writeFileSync(filePath, content, options); - }, - writeFile: function(filePath, content, options, callback) { - callback = _.last(arguments); - return mkdirp(path.dirname(filePath), function(error) { - if (error != null) { - return typeof callback === "function" ? callback(error) : void 0; - } else { - return fs.writeFile(filePath, content, options, callback); - } - }); - }, - copy: function(sourcePath, destinationPath, done) { - return mkdirp(path.dirname(destinationPath), function(error) { - var destinationStream, sourceStream; - if (error != null) { - if (typeof done === "function") { - done(error); - } - return; - } - sourceStream = fs.createReadStream(sourcePath); - sourceStream.on('error', function(error) { - if (typeof done === "function") { - done(error); - } - return done = null; - }); - destinationStream = fs.createWriteStream(destinationPath); - destinationStream.on('error', function(error) { - if (typeof done === "function") { - done(error); - } - return done = null; - }); - destinationStream.on('close', function() { - if (typeof done === "function") { - done(); - } - return done = null; - }); - return sourceStream.pipe(destinationStream); - }); - }, - copySync: function(sourcePath, destinationPath) { - var content, destinationFilePath, source, sourceFilePath, sources, _i, _len, _results; - sources = fs.readdirSync(sourcePath); - mkdirp.sync(destinationPath); - _results = []; - for (_i = 0, _len = sources.length; _i < _len; _i++) { - source = sources[_i]; - sourceFilePath = path.join(sourcePath, source); - destinationFilePath = path.join(destinationPath, source); - if (fsPlus.isDirectorySync(sourceFilePath)) { - _results.push(fsPlus.copySync(sourceFilePath, destinationFilePath)); - } else { - content = fs.readFileSync(sourceFilePath); - _results.push(fs.writeFileSync(destinationFilePath, content)); - } - } - return _results; - }, - makeTreeSync: function(directoryPath) { - if (!fsPlus.existsSync(directoryPath)) { - return mkdirp.sync(directoryPath); - } - }, - makeTree: function(directoryPath, callback) { - return fs.exists(directoryPath, function(exists) { - if (exists) { - return typeof callback === "function" ? callback() : void 0; - } - return mkdirp(directoryPath, function(error) { - return typeof callback === "function" ? callback(error) : void 0; - }); - }); - }, - traverseTreeSync: function(rootPath, onFile, onDirectory) { - var traverse; - if (onDirectory == null) { - onDirectory = onFile; - } - if (!fsPlus.isDirectorySync(rootPath)) { - return; - } - traverse = function(directoryPath, onFile, onDirectory) { - var childPath, file, linkStats, stats, _i, _len, _ref; - _ref = fs.readdirSync(directoryPath); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - file = _ref[_i]; - childPath = path.join(directoryPath, file); - stats = fs.lstatSync(childPath); - if (stats.isSymbolicLink()) { - if (linkStats = statSyncNoException(childPath)) { - stats = linkStats; - } - } - if (stats.isDirectory()) { - if (onDirectory(childPath)) { - traverse(childPath, onFile, onDirectory); - } - } else if (stats.isFile()) { - onFile(childPath); - } - } - return void 0; - }; - return traverse(rootPath, onFile, onDirectory); - }, - traverseTree: function(rootPath, onFile, onDirectory, onDone) { - return fs.readdir(rootPath, function(error, files) { - var file, queue, _i, _len, _results; - if (error) { - return typeof onDone === "function" ? onDone() : void 0; - } else { - queue = async.queue(function(childPath, callback) { - return fs.stat(childPath, function(error, stats) { - if (error) { - return callback(error); - } else if (stats.isFile()) { - onFile(childPath); - return callback(); - } else if (stats.isDirectory()) { - if (onDirectory(childPath)) { - return fs.readdir(childPath, function(error, files) { - var file, _i, _len; - if (error) { - return callback(error); - } else { - for (_i = 0, _len = files.length; _i < _len; _i++) { - file = files[_i]; - queue.unshift(path.join(childPath, file)); - } - return callback(); - } - }); - } else { - return callback(); - } - } - }); - }); - queue.concurrency = 1; - queue.drain = onDone; - _results = []; - for (_i = 0, _len = files.length; _i < _len; _i++) { - file = files[_i]; - _results.push(queue.push(path.join(rootPath, file))); - } - return _results; - } - }); - }, - md5ForPath: function(pathToDigest) { - var contents; - contents = fs.readFileSync(pathToDigest); - return require('crypto').createHash('md5').update(contents).digest('hex'); - }, - resolve: function() { - var args, candidatePath, extensions, loadPath, loadPaths, pathToResolve, resolvedPath, _i, _len, _ref; - args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; - if (_.isArray(_.last(args))) { - extensions = args.pop(); - } - pathToResolve = (_ref = args.pop()) != null ? _ref.toString() : void 0; - loadPaths = args; - if (!pathToResolve) { - return void 0; - } - if (fsPlus.isAbsolute(pathToResolve)) { - if (extensions && (resolvedPath = fsPlus.resolveExtension(pathToResolve, extensions))) { - return resolvedPath; - } else { - if (fsPlus.existsSync(pathToResolve)) { - return pathToResolve; - } - } - } - for (_i = 0, _len = loadPaths.length; _i < _len; _i++) { - loadPath = loadPaths[_i]; - candidatePath = path.join(loadPath, pathToResolve); - if (extensions) { - if (resolvedPath = fsPlus.resolveExtension(candidatePath, extensions)) { - return resolvedPath; - } - } else { - if (fsPlus.existsSync(candidatePath)) { - return fsPlus.absolute(candidatePath); - } - } - } - return void 0; - }, - resolveOnLoadPath: function() { - var args, loadPaths; - args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; - loadPaths = Module.globalPaths.concat(module.paths); - return fsPlus.resolve.apply(fsPlus, __slice.call(loadPaths).concat(__slice.call(args))); - }, - resolveExtension: function(pathToResolve, extensions) { - var extension, pathWithExtension, _i, _len; - for (_i = 0, _len = extensions.length; _i < _len; _i++) { - extension = extensions[_i]; - if (extension === "") { - if (fsPlus.existsSync(pathToResolve)) { - return fsPlus.absolute(pathToResolve); - } - } else { - pathWithExtension = pathToResolve + "." + extension.replace(/^\./, ""); - if (fsPlus.existsSync(pathWithExtension)) { - return fsPlus.absolute(pathWithExtension); - } - } - } - return void 0; - }, - isCompressedExtension: function(ext) { - return _.indexOf(['.bz2', '.epub', '.gz', '.jar', '.lz', '.lzma', '.lzo', '.tar', '.tgz', '.war', '.xz', '.z', '.zip'], ext, true) >= 0; - }, - isImageExtension: function(ext) { - return _.indexOf(['.gif', '.ico', '.jpeg', '.jpg', '.png', '.tiff', '.webp'], ext, true) >= 0; - }, - isPdfExtension: function(ext) { - return ext === '.pdf'; - }, - isBinaryExtension: function(ext) { - return _.indexOf(['.DS_Store', '.a', '.exe', '.o', '.pyc', '.pyo', '.so', '.woff'], ext, true) >= 0; - }, - isReadmePath: function(readmePath) { - var base, extension; - extension = path.extname(readmePath); - base = path.basename(readmePath, extension).toLowerCase(); - return base === 'readme' && (extension === '' || fsPlus.isMarkdownExtension(extension)); - }, - isMarkdownExtension: function(ext) { - return _.indexOf(['.markdown', '.md', '.mdown', '.mkd', '.mkdown', '.rmd', '.ron'], ext, true) >= 0; - }, - isCaseInsensitive: function() { - var lowerCaseStat, upperCaseStat; - if (fsPlus.caseInsensitiveFs == null) { - lowerCaseStat = statSyncNoException(__filename.toLowerCase()); - upperCaseStat = statSyncNoException(__filename.toUpperCase()); - if (lowerCaseStat && upperCaseStat) { - fsPlus.caseInsensitiveFs = lowerCaseStat.dev === upperCaseStat.dev && lowerCaseStat.ino === upperCaseStat.ino; - } else { - fsPlus.caseInsensitiveFs = false; - } - } - return fsPlus.caseInsensitiveFs; - }, - isCaseSensitive: function() { - return !fsPlus.isCaseInsensitive(); - } - }; - - statSyncNoException = fs.statSyncNoException, lstatSyncNoException = fs.lstatSyncNoException; - - if (statSyncNoException == null) { - statSyncNoException = function() { - var args, error; - args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; - try { - return fs.statSync.apply(fs, args); - } catch (_error) { - error = _error; - return false; - } - }; - } - - if (lstatSyncNoException == null) { - lstatSyncNoException = function() { - var args, error; - args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; - try { - return fs.lstatSync.apply(fs, args); - } catch (_error) { - error = _error; - return false; - } - }; - } - - isPathValid = function(pathToCheck) { - return (pathToCheck != null) && typeof pathToCheck === 'string' && pathToCheck.length > 0; - }; - - module.exports = _.extend({}, fs, fsPlus); - -}).call(this); diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/node_modules/.bin/rimraf b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/node_modules/.bin/rimraf deleted file mode 120000 index 4cd49a49d..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/node_modules/.bin/rimraf +++ /dev/null @@ -1 +0,0 @@ -../rimraf/bin.js \ No newline at end of file diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/node_modules/async/LICENSE b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/node_modules/async/LICENSE deleted file mode 100644 index b7f9d5001..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/node_modules/async/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Caolan McMahon - -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/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/node_modules/async/README.md b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/node_modules/async/README.md deleted file mode 100644 index 951f76e9f..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/node_modules/async/README.md +++ /dev/null @@ -1,1425 +0,0 @@ -# Async.js - -Async is a utility module which provides straight-forward, powerful functions -for working with asynchronous JavaScript. Although originally designed for -use with [node.js](http://nodejs.org), it can also be used directly in the -browser. Also supports [component](https://github.com/component/component). - -Async provides around 20 functions that include the usual 'functional' -suspects (map, reduce, filter, each…) as well as some common patterns -for asynchronous control flow (parallel, series, waterfall…). All these -functions assume you follow the node.js convention of providing a single -callback as the last argument of your async function. - - -## Quick Examples - -```javascript -async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file -}); - -async.filter(['file1','file2','file3'], fs.exists, function(results){ - // results now equals an array of the existing files -}); - -async.parallel([ - function(){ ... }, - function(){ ... } -], callback); - -async.series([ - function(){ ... }, - function(){ ... } -]); -``` - -There are many more functions available so take a look at the docs below for a -full list. This module aims to be comprehensive, so if you feel anything is -missing please create a GitHub issue for it. - -## Common Pitfalls - -### Binding a context to an iterator - -This section is really about bind, not about async. If you are wondering how to -make async execute your iterators in a given context, or are confused as to why -a method of another library isn't working as an iterator, study this example: - -```js -// Here is a simple object with an (unnecessarily roundabout) squaring method -var AsyncSquaringLibrary = { - squareExponent: 2, - square: function(number, callback){ - var result = Math.pow(number, this.squareExponent); - setTimeout(function(){ - callback(null, result); - }, 200); - } -}; - -async.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){ - // result is [NaN, NaN, NaN] - // This fails because the `this.squareExponent` expression in the square - // function is not evaluated in the context of AsyncSquaringLibrary, and is - // therefore undefined. -}); - -async.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){ - // result is [1, 4, 9] - // With the help of bind we can attach a context to the iterator before - // passing it to async. Now the square function will be executed in its - // 'home' AsyncSquaringLibrary context and the value of `this.squareExponent` - // will be as expected. -}); -``` - -## Download - -The source is available for download from -[GitHub](http://github.com/caolan/async). -Alternatively, you can install using Node Package Manager (npm): - - npm install async - -__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed - -## In the Browser - -So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage: - -```html - - -``` - -## Documentation - -### Collections - -* [each](#each) -* [eachSeries](#eachSeries) -* [eachLimit](#eachLimit) -* [map](#map) -* [mapSeries](#mapSeries) -* [mapLimit](#mapLimit) -* [filter](#filter) -* [filterSeries](#filterSeries) -* [reject](#reject) -* [rejectSeries](#rejectSeries) -* [reduce](#reduce) -* [reduceRight](#reduceRight) -* [detect](#detect) -* [detectSeries](#detectSeries) -* [sortBy](#sortBy) -* [some](#some) -* [every](#every) -* [concat](#concat) -* [concatSeries](#concatSeries) - -### Control Flow - -* [series](#series) -* [parallel](#parallel) -* [parallelLimit](#parallellimittasks-limit-callback) -* [whilst](#whilst) -* [doWhilst](#doWhilst) -* [until](#until) -* [doUntil](#doUntil) -* [forever](#forever) -* [waterfall](#waterfall) -* [compose](#compose) -* [applyEach](#applyEach) -* [applyEachSeries](#applyEachSeries) -* [queue](#queue) -* [cargo](#cargo) -* [auto](#auto) -* [iterator](#iterator) -* [apply](#apply) -* [nextTick](#nextTick) -* [times](#times) -* [timesSeries](#timesSeries) - -### Utils - -* [memoize](#memoize) -* [unmemoize](#unmemoize) -* [log](#log) -* [dir](#dir) -* [noConflict](#noConflict) - - -## Collections - - - -### each(arr, iterator, callback) - -Applies an iterator function to each item in an array, in parallel. -The iterator is called with an item from the list and a callback for when it -has finished. If the iterator passes an error to this callback, the main -callback for the each function is immediately called with the error. - -Note, that since this function applies the iterator to each item in parallel -there is no guarantee that the iterator functions will complete in order. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback(err) which must be called once it has - completed. If no error has occured, the callback should be run without - arguments or with an explicit null argument. -* callback(err) - A callback which is called after all the iterator functions - have finished, or an error has occurred. - -__Example__ - -```js -// assuming openFiles is an array of file names and saveFile is a function -// to save the modified contents of that file: - -async.each(openFiles, saveFile, function(err){ - // if any of the saves produced an error, err would equal that error -}); -``` - ---------------------------------------- - - - -### eachSeries(arr, iterator, callback) - -The same as each only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. This means the iterator functions will complete in order. - - ---------------------------------------- - - - -### eachLimit(arr, limit, iterator, callback) - -The same as each only no more than "limit" iterators will be simultaneously -running at any time. - -Note that the items are not processed in batches, so there is no guarantee that - the first "limit" iterator functions will complete before any others are -started. - -__Arguments__ - -* arr - An array to iterate over. -* limit - The maximum number of iterators to run at any time. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback(err) which must be called once it has - completed. If no error has occured, the callback should be run without - arguments or with an explicit null argument. -* callback(err) - A callback which is called after all the iterator functions - have finished, or an error has occurred. - -__Example__ - -```js -// Assume documents is an array of JSON objects and requestApi is a -// function that interacts with a rate-limited REST api. - -async.eachLimit(documents, 20, requestApi, function(err){ - // if any of the saves produced an error, err would equal that error -}); -``` - ---------------------------------------- - - -### map(arr, iterator, callback) - -Produces a new array of values by mapping each value in the given array through -the iterator function. The iterator is called with an item from the array and a -callback for when it has finished processing. The callback takes 2 arguments, -an error and the transformed item from the array. If the iterator passes an -error to this callback, the main callback for the map function is immediately -called with the error. - -Note, that since this function applies the iterator to each item in parallel -there is no guarantee that the iterator functions will complete in order, however -the results array will be in the same order as the original array. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback(err, transformed) which must be called once - it has completed with an error (which can be null) and a transformed item. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is an array of the - transformed items from the original array. - -__Example__ - -```js -async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file -}); -``` - ---------------------------------------- - - -### mapSeries(arr, iterator, callback) - -The same as map only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. The results array will be in the same order as the original. - - ---------------------------------------- - - -### mapLimit(arr, limit, iterator, callback) - -The same as map only no more than "limit" iterators will be simultaneously -running at any time. - -Note that the items are not processed in batches, so there is no guarantee that - the first "limit" iterator functions will complete before any others are -started. - -__Arguments__ - -* arr - An array to iterate over. -* limit - The maximum number of iterators to run at any time. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback(err, transformed) which must be called once - it has completed with an error (which can be null) and a transformed item. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is an array of the - transformed items from the original array. - -__Example__ - -```js -async.mapLimit(['file1','file2','file3'], 1, fs.stat, function(err, results){ - // results is now an array of stats for each file -}); -``` - ---------------------------------------- - - -### filter(arr, iterator, callback) - -__Alias:__ select - -Returns a new array of all the values which pass an async truth test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like fs.exists. This operation is -performed in parallel, but the results array will be in the same order as the -original. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback(truthValue) which must be called with a - boolean argument once it has completed. -* callback(results) - A callback which is called after all the iterator - functions have finished. - -__Example__ - -```js -async.filter(['file1','file2','file3'], fs.exists, function(results){ - // results now equals an array of the existing files -}); -``` - ---------------------------------------- - - -### filterSeries(arr, iterator, callback) - -__alias:__ selectSeries - -The same as filter only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. The results array will be in the same order as the original. - ---------------------------------------- - - -### reject(arr, iterator, callback) - -The opposite of filter. Removes values that pass an async truth test. - ---------------------------------------- - - -### rejectSeries(arr, iterator, callback) - -The same as reject, only the iterator is applied to each item in the array -in series. - - ---------------------------------------- - - -### reduce(arr, memo, iterator, callback) - -__aliases:__ inject, foldl - -Reduces a list of values into a single value using an async iterator to return -each successive step. Memo is the initial state of the reduction. This -function only operates in series. For performance reasons, it may make sense to -split a call to this function into a parallel map, then use the normal -Array.prototype.reduce on the results. This function is for situations where -each step in the reduction needs to be async, if you can get the data before -reducing it then it's probably a good idea to do so. - -__Arguments__ - -* arr - An array to iterate over. -* memo - The initial state of the reduction. -* iterator(memo, item, callback) - A function applied to each item in the - array to produce the next step in the reduction. The iterator is passed a - callback(err, reduction) which accepts an optional error as its first - argument, and the state of the reduction as the second. If an error is - passed to the callback, the reduction is stopped and the main callback is - immediately called with the error. -* callback(err, result) - A callback which is called after all the iterator - functions have finished. Result is the reduced value. - -__Example__ - -```js -async.reduce([1,2,3], 0, function(memo, item, callback){ - // pointless async: - process.nextTick(function(){ - callback(null, memo + item) - }); -}, function(err, result){ - // result is now equal to the last value of memo, which is 6 -}); -``` - ---------------------------------------- - - -### reduceRight(arr, memo, iterator, callback) - -__Alias:__ foldr - -Same as reduce, only operates on the items in the array in reverse order. - - ---------------------------------------- - - -### detect(arr, iterator, callback) - -Returns the first value in a list that passes an async truth test. The -iterator is applied in parallel, meaning the first iterator to return true will -fire the detect callback with that result. That means the result might not be -the first item in the original array (in terms of order) that passes the test. - -If order within the original array is important then look at detectSeries. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback(truthValue) which must be called with a - boolean argument once it has completed. -* callback(result) - A callback which is called as soon as any iterator returns - true, or after all the iterator functions have finished. Result will be - the first item in the array that passes the truth test (iterator) or the - value undefined if none passed. - -__Example__ - -```js -async.detect(['file1','file2','file3'], fs.exists, function(result){ - // result now equals the first file in the list that exists -}); -``` - ---------------------------------------- - - -### detectSeries(arr, iterator, callback) - -The same as detect, only the iterator is applied to each item in the array -in series. This means the result is always the first in the original array (in -terms of array order) that passes the truth test. - - ---------------------------------------- - - -### sortBy(arr, iterator, callback) - -Sorts a list by the results of running each value through an async iterator. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback(err, sortValue) which must be called once it - has completed with an error (which can be null) and a value to use as the sort - criteria. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is the items from - the original array sorted by the values returned by the iterator calls. - -__Example__ - -```js -async.sortBy(['file1','file2','file3'], function(file, callback){ - fs.stat(file, function(err, stats){ - callback(err, stats.mtime); - }); -}, function(err, results){ - // results is now the original array of files sorted by - // modified date -}); -``` - ---------------------------------------- - - -### some(arr, iterator, callback) - -__Alias:__ any - -Returns true if at least one element in the array satisfies an async test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like fs.exists. Once any iterator -call returns true, the main callback is immediately called. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback(truthValue) which must be called with a - boolean argument once it has completed. -* callback(result) - A callback which is called as soon as any iterator returns - true, or after all the iterator functions have finished. Result will be - either true or false depending on the values of the async tests. - -__Example__ - -```js -async.some(['file1','file2','file3'], fs.exists, function(result){ - // if result is true then at least one of the files exists -}); -``` - ---------------------------------------- - - -### every(arr, iterator, callback) - -__Alias:__ all - -Returns true if every element in the array satisfies an async test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like fs.exists. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback(truthValue) which must be called with a - boolean argument once it has completed. -* callback(result) - A callback which is called after all the iterator - functions have finished. Result will be either true or false depending on - the values of the async tests. - -__Example__ - -```js -async.every(['file1','file2','file3'], fs.exists, function(result){ - // if result is true then every file exists -}); -``` - ---------------------------------------- - - -### concat(arr, iterator, callback) - -Applies an iterator to each item in a list, concatenating the results. Returns the -concatenated list. The iterators are called in parallel, and the results are -concatenated as they return. There is no guarantee that the results array will -be returned in the original order of the arguments passed to the iterator function. - -__Arguments__ - -* arr - An array to iterate over -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback(err, results) which must be called once it - has completed with an error (which can be null) and an array of results. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is an array containing - the concatenated results of the iterator function. - -__Example__ - -```js -async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){ - // files is now a list of filenames that exist in the 3 directories -}); -``` - ---------------------------------------- - - -### concatSeries(arr, iterator, callback) - -Same as async.concat, but executes in series instead of parallel. - - -## Control Flow - - -### series(tasks, [callback]) - -Run an array of functions in series, each one running once the previous -function has completed. If any functions in the series pass an error to its -callback, no more functions are run and the callback for the series is -immediately called with the value of the error. Once the tasks have completed, -the results are passed to the final callback as an array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final callback as an object -instead of an array. This can be a more readable way of handling results from -async.series. - - -__Arguments__ - -* tasks - An array or object containing functions to run, each function is passed - a callback(err, result) it must call on completion with an error (which can - be null) and an optional result value. -* callback(err, results) - An optional callback to run once all the functions - have completed. This function gets a results array (or object) containing all - the result arguments passed to the task callbacks. - -__Example__ - -```js -async.series([ - function(callback){ - // do some stuff ... - callback(null, 'one'); - }, - function(callback){ - // do some more stuff ... - callback(null, 'two'); - } -], -// optional callback -function(err, results){ - // results is now equal to ['one', 'two'] -}); - - -// an example using an object instead of an array -async.series({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - } -}, -function(err, results) { - // results is now equal to: {one: 1, two: 2} -}); -``` - ---------------------------------------- - - -### parallel(tasks, [callback]) - -Run an array of functions in parallel, without waiting until the previous -function has completed. If any of the functions pass an error to its -callback, the main callback is immediately called with the value of the error. -Once the tasks have completed, the results are passed to the final callback as an -array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final callback as an object -instead of an array. This can be a more readable way of handling results from -async.parallel. - - -__Arguments__ - -* tasks - An array or object containing functions to run, each function is passed - a callback(err, result) it must call on completion with an error (which can - be null) and an optional result value. -* callback(err, results) - An optional callback to run once all the functions - have completed. This function gets a results array (or object) containing all - the result arguments passed to the task callbacks. - -__Example__ - -```js -async.parallel([ - function(callback){ - setTimeout(function(){ - callback(null, 'one'); - }, 200); - }, - function(callback){ - setTimeout(function(){ - callback(null, 'two'); - }, 100); - } -], -// optional callback -function(err, results){ - // the results array will equal ['one','two'] even though - // the second function had a shorter timeout. -}); - - -// an example using an object instead of an array -async.parallel({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - } -}, -function(err, results) { - // results is now equals to: {one: 1, two: 2} -}); -``` - ---------------------------------------- - - -### parallelLimit(tasks, limit, [callback]) - -The same as parallel only the tasks are executed in parallel with a maximum of "limit" -tasks executing at any time. - -Note that the tasks are not executed in batches, so there is no guarantee that -the first "limit" tasks will complete before any others are started. - -__Arguments__ - -* tasks - An array or object containing functions to run, each function is passed - a callback(err, result) it must call on completion with an error (which can - be null) and an optional result value. -* limit - The maximum number of tasks to run at any time. -* callback(err, results) - An optional callback to run once all the functions - have completed. This function gets a results array (or object) containing all - the result arguments passed to the task callbacks. - ---------------------------------------- - - -### whilst(test, fn, callback) - -Repeatedly call fn, while test returns true. Calls the callback when stopped, -or an error occurs. - -__Arguments__ - -* test() - synchronous truth test to perform before each execution of fn. -* fn(callback) - A function to call each time the test passes. The function is - passed a callback(err) which must be called once it has completed with an - optional error argument. -* callback(err) - A callback which is called after the test fails and repeated - execution of fn has stopped. - -__Example__ - -```js -var count = 0; - -async.whilst( - function () { return count < 5; }, - function (callback) { - count++; - setTimeout(callback, 1000); - }, - function (err) { - // 5 seconds have passed - } -); -``` - ---------------------------------------- - - -### doWhilst(fn, test, callback) - -The post check version of whilst. To reflect the difference in the order of operations `test` and `fn` arguments are switched. `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript. - ---------------------------------------- - - -### until(test, fn, callback) - -Repeatedly call fn, until test returns true. Calls the callback when stopped, -or an error occurs. - -The inverse of async.whilst. - ---------------------------------------- - - -### doUntil(fn, test, callback) - -Like doWhilst except the test is inverted. Note the argument ordering differs from `until`. - ---------------------------------------- - - -### forever(fn, callback) - -Calls the asynchronous function 'fn' repeatedly, in series, indefinitely. -If an error is passed to fn's callback then 'callback' is called with the -error, otherwise it will never be called. - ---------------------------------------- - - -### waterfall(tasks, [callback]) - -Runs an array of functions in series, each passing their results to the next in -the array. However, if any of the functions pass an error to the callback, the -next function is not executed and the main callback is immediately called with -the error. - -__Arguments__ - -* tasks - An array of functions to run, each function is passed a - callback(err, result1, result2, ...) it must call on completion. The first - argument is an error (which can be null) and any further arguments will be - passed as arguments in order to the next task. -* callback(err, [results]) - An optional callback to run once all the functions - have completed. This will be passed the results of the last task's callback. - - - -__Example__ - -```js -async.waterfall([ - function(callback){ - callback(null, 'one', 'two'); - }, - function(arg1, arg2, callback){ - callback(null, 'three'); - }, - function(arg1, callback){ - // arg1 now equals 'three' - callback(null, 'done'); - } -], function (err, result) { - // result now equals 'done' -}); -``` - ---------------------------------------- - -### compose(fn1, fn2...) - -Creates a function which is a composition of the passed asynchronous -functions. Each function consumes the return value of the function that -follows. Composing functions f(), g() and h() would produce the result of -f(g(h())), only this version uses callbacks to obtain the return values. - -Each function is executed with the `this` binding of the composed function. - -__Arguments__ - -* functions... - the asynchronous functions to compose - - -__Example__ - -```js -function add1(n, callback) { - setTimeout(function () { - callback(null, n + 1); - }, 10); -} - -function mul3(n, callback) { - setTimeout(function () { - callback(null, n * 3); - }, 10); -} - -var add1mul3 = async.compose(mul3, add1); - -add1mul3(4, function (err, result) { - // result now equals 15 -}); -``` - ---------------------------------------- - -### applyEach(fns, args..., callback) - -Applies the provided arguments to each function in the array, calling the -callback after all functions have completed. If you only provide the first -argument then it will return a function which lets you pass in the -arguments as if it were a single function call. - -__Arguments__ - -* fns - the asynchronous functions to all call with the same arguments -* args... - any number of separate arguments to pass to the function -* callback - the final argument should be the callback, called when all - functions have completed processing - - -__Example__ - -```js -async.applyEach([enableSearch, updateSchema], 'bucket', callback); - -// partial application example: -async.each( - buckets, - async.applyEach([enableSearch, updateSchema]), - callback -); -``` - ---------------------------------------- - - -### applyEachSeries(arr, iterator, callback) - -The same as applyEach only the functions are applied in series. - ---------------------------------------- - - -### queue(worker, concurrency) - -Creates a queue object with the specified concurrency. Tasks added to the -queue will be processed in parallel (up to the concurrency limit). If all -workers are in progress, the task is queued until one is available. Once -a worker has completed a task, the task's callback is called. - -__Arguments__ - -* worker(task, callback) - An asynchronous function for processing a queued - task, which must call its callback(err) argument when finished, with an - optional error as an argument. -* concurrency - An integer for determining how many worker functions should be - run in parallel. - -__Queue objects__ - -The queue object returned by this function has the following properties and -methods: - -* length() - a function returning the number of items waiting to be processed. -* concurrency - an integer for determining how many worker functions should be - run in parallel. This property can be changed after a queue is created to - alter the concurrency on-the-fly. -* push(task, [callback]) - add a new task to the queue, the callback is called - once the worker has finished processing the task. - instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list. -* unshift(task, [callback]) - add a new task to the front of the queue. -* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued -* empty - a callback that is called when the last item from the queue is given to a worker -* drain - a callback that is called when the last item from the queue has returned from the worker - -__Example__ - -```js -// create a queue object with concurrency 2 - -var q = async.queue(function (task, callback) { - console.log('hello ' + task.name); - callback(); -}, 2); - - -// assign a callback -q.drain = function() { - console.log('all items have been processed'); -} - -// add some items to the queue - -q.push({name: 'foo'}, function (err) { - console.log('finished processing foo'); -}); -q.push({name: 'bar'}, function (err) { - console.log('finished processing bar'); -}); - -// add some items to the queue (batch-wise) - -q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) { - console.log('finished processing bar'); -}); - -// add some items to the front of the queue - -q.unshift({name: 'bar'}, function (err) { - console.log('finished processing bar'); -}); -``` - ---------------------------------------- - - -### cargo(worker, [payload]) - -Creates a cargo object with the specified payload. Tasks added to the -cargo will be processed altogether (up to the payload limit). If the -worker is in progress, the task is queued until it is available. Once -the worker has completed some tasks, each callback of those tasks is called. - -__Arguments__ - -* worker(tasks, callback) - An asynchronous function for processing an array of - queued tasks, which must call its callback(err) argument when finished, with - an optional error as an argument. -* payload - An optional integer for determining how many tasks should be - processed per round; if omitted, the default is unlimited. - -__Cargo objects__ - -The cargo object returned by this function has the following properties and -methods: - -* length() - a function returning the number of items waiting to be processed. -* payload - an integer for determining how many tasks should be - process per round. This property can be changed after a cargo is created to - alter the payload on-the-fly. -* push(task, [callback]) - add a new task to the queue, the callback is called - once the worker has finished processing the task. - instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list. -* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued -* empty - a callback that is called when the last item from the queue is given to a worker -* drain - a callback that is called when the last item from the queue has returned from the worker - -__Example__ - -```js -// create a cargo object with payload 2 - -var cargo = async.cargo(function (tasks, callback) { - for(var i=0; i -### auto(tasks, [callback]) - -Determines the best order for running functions based on their requirements. -Each function can optionally depend on other functions being completed first, -and each function is run as soon as its requirements are satisfied. If any of -the functions pass an error to their callback, that function will not complete -(so any other functions depending on it will not run) and the main callback -will be called immediately with the error. Functions also receive an object -containing the results of functions which have completed so far. - -Note, all functions are called with a results object as a second argument, -so it is unsafe to pass functions in the tasks object which cannot handle the -extra argument. For example, this snippet of code: - -```js -async.auto({ - readData: async.apply(fs.readFile, 'data.txt', 'utf-8') -}, callback); -``` - -will have the effect of calling readFile with the results object as the last -argument, which will fail: - -```js -fs.readFile('data.txt', 'utf-8', cb, {}); -``` - -Instead, wrap the call to readFile in a function which does not forward the -results object: - -```js -async.auto({ - readData: function(cb, results){ - fs.readFile('data.txt', 'utf-8', cb); - } -}, callback); -``` - -__Arguments__ - -* tasks - An object literal containing named functions or an array of - requirements, with the function itself the last item in the array. The key - used for each function or array is used when specifying requirements. The - function receives two arguments: (1) a callback(err, result) which must be - called when finished, passing an error (which can be null) and the result of - the function's execution, and (2) a results object, containing the results of - the previously executed functions. -* callback(err, results) - An optional callback which is called when all the - tasks have been completed. The callback will receive an error as an argument - if any tasks pass an error to their callback. Results will always be passed - but if an error occurred, no other tasks will be performed, and the results - object will only contain partial results. - - -__Example__ - -```js -async.auto({ - get_data: function(callback){ - // async code to get some data - }, - make_folder: function(callback){ - // async code to create a directory to store a file in - // this is run at the same time as getting the data - }, - write_file: ['get_data', 'make_folder', function(callback){ - // once there is some data and the directory exists, - // write the data to a file in the directory - callback(null, filename); - }], - email_link: ['write_file', function(callback, results){ - // once the file is written let's email a link to it... - // results.write_file contains the filename returned by write_file. - }] -}); -``` - -This is a fairly trivial example, but to do this using the basic parallel and -series functions would look like this: - -```js -async.parallel([ - function(callback){ - // async code to get some data - }, - function(callback){ - // async code to create a directory to store a file in - // this is run at the same time as getting the data - } -], -function(err, results){ - async.series([ - function(callback){ - // once there is some data and the directory exists, - // write the data to a file in the directory - }, - function(callback){ - // once the file is written let's email a link to it... - } - ]); -}); -``` - -For a complicated series of async tasks using the auto function makes adding -new tasks much easier and makes the code more readable. - - ---------------------------------------- - - -### iterator(tasks) - -Creates an iterator function which calls the next function in the array, -returning a continuation to call the next one after that. It's also possible to -'peek' the next iterator by doing iterator.next(). - -This function is used internally by the async module but can be useful when -you want to manually control the flow of functions in series. - -__Arguments__ - -* tasks - An array of functions to run. - -__Example__ - -```js -var iterator = async.iterator([ - function(){ sys.p('one'); }, - function(){ sys.p('two'); }, - function(){ sys.p('three'); } -]); - -node> var iterator2 = iterator(); -'one' -node> var iterator3 = iterator2(); -'two' -node> iterator3(); -'three' -node> var nextfn = iterator2.next(); -node> nextfn(); -'three' -``` - ---------------------------------------- - - -### apply(function, arguments..) - -Creates a continuation function with some arguments already applied, a useful -shorthand when combined with other control flow functions. Any arguments -passed to the returned function are added to the arguments originally passed -to apply. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to automatically apply when the - continuation is called. - -__Example__ - -```js -// using apply - -async.parallel([ - async.apply(fs.writeFile, 'testfile1', 'test1'), - async.apply(fs.writeFile, 'testfile2', 'test2'), -]); - - -// the same process without using apply - -async.parallel([ - function(callback){ - fs.writeFile('testfile1', 'test1', callback); - }, - function(callback){ - fs.writeFile('testfile2', 'test2', callback); - } -]); -``` - -It's possible to pass any number of additional arguments when calling the -continuation: - -```js -node> var fn = async.apply(sys.puts, 'one'); -node> fn('two', 'three'); -one -two -three -``` - ---------------------------------------- - - -### nextTick(callback) - -Calls the callback on a later loop around the event loop. In node.js this just -calls process.nextTick, in the browser it falls back to setImmediate(callback) -if available, otherwise setTimeout(callback, 0), which means other higher priority -events may precede the execution of the callback. - -This is used internally for browser-compatibility purposes. - -__Arguments__ - -* callback - The function to call on a later loop around the event loop. - -__Example__ - -```js -var call_order = []; -async.nextTick(function(){ - call_order.push('two'); - // call_order now equals ['one','two'] -}); -call_order.push('one') -``` - - -### times(n, callback) - -Calls the callback n times and accumulates results in the same manner -you would use with async.map. - -__Arguments__ - -* n - The number of times to run the function. -* callback - The function to call n times. - -__Example__ - -```js -// Pretend this is some complicated async factory -var createUser = function(id, callback) { - callback(null, { - id: 'user' + id - }) -} -// generate 5 users -async.times(5, function(n, next){ - createUser(n, function(err, user) { - next(err, user) - }) -}, function(err, users) { - // we should now have 5 users -}); -``` - - -### timesSeries(n, callback) - -The same as times only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. The results array will be in the same order as the original. - - -## Utils - - -### memoize(fn, [hasher]) - -Caches the results of an async function. When creating a hash to store function -results against, the callback is omitted from the hash and an optional hash -function can be used. - -The cache of results is exposed as the `memo` property of the function returned -by `memoize`. - -__Arguments__ - -* fn - the function you to proxy and cache results from. -* hasher - an optional function for generating a custom hash for storing - results, it has all the arguments applied to it apart from the callback, and - must be synchronous. - -__Example__ - -```js -var slow_fn = function (name, callback) { - // do something - callback(null, result); -}; -var fn = async.memoize(slow_fn); - -// fn can now be used as if it were slow_fn -fn('some name', function () { - // callback -}); -``` - - -### unmemoize(fn) - -Undoes a memoized function, reverting it to the original, unmemoized -form. Comes handy in tests. - -__Arguments__ - -* fn - the memoized function - - -### log(function, arguments) - -Logs the result of an async function to the console. Only works in node.js or -in browsers that support console.log and console.error (such as FF and Chrome). -If multiple arguments are returned from the async function, console.log is -called on each argument in order. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to apply to the function. - -__Example__ - -```js -var hello = function(name, callback){ - setTimeout(function(){ - callback(null, 'hello ' + name); - }, 1000); -}; -``` -```js -node> async.log(hello, 'world'); -'hello world' -``` - ---------------------------------------- - - -### dir(function, arguments) - -Logs the result of an async function to the console using console.dir to -display the properties of the resulting object. Only works in node.js or -in browsers that support console.dir and console.error (such as FF and Chrome). -If multiple arguments are returned from the async function, console.dir is -called on each argument in order. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to apply to the function. - -__Example__ - -```js -var hello = function(name, callback){ - setTimeout(function(){ - callback(null, {hello: name}); - }, 1000); -}; -``` -```js -node> async.dir(hello, 'world'); -{hello: 'world'} -``` - ---------------------------------------- - - -### noConflict() - -Changes the value of async back to its original value, returning a reference to the -async object. diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/node_modules/async/component.json b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/node_modules/async/component.json deleted file mode 100644 index bbb011548..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/node_modules/async/component.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "async", - "repo": "caolan/async", - "description": "Higher-order functions and common patterns for asynchronous code", - "version": "0.1.23", - "keywords": [], - "dependencies": {}, - "development": {}, - "main": "lib/async.js", - "scripts": [ "lib/async.js" ] -} diff --git a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/node_modules/async/lib/async.js b/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/node_modules/async/lib/async.js deleted file mode 100755 index 1eebb153f..000000000 --- a/node_modules/atom-space-pen-views/node_modules/grim/node_modules/coffeestack/node_modules/fs-plus/node_modules/async/lib/async.js +++ /dev/null @@ -1,958 +0,0 @@ -/*global setImmediate: false, setTimeout: false, console: false */ -(function () { - - var async = {}; - - // global on the server, window in the browser - var root, previous_async; - - root = this; - if (root != null) { - previous_async = root.async; - } - - async.noConflict = function () { - root.async = previous_async; - return async; - }; - - function only_once(fn) { - var called = false; - return function() { - if (called) throw new Error("Callback was already called."); - called = true; - fn.apply(root, arguments); - } - } - - //// cross-browser compatiblity functions //// - - var _each = function (arr, iterator) { - if (arr.forEach) { - return arr.forEach(iterator); - } - for (var i = 0; i < arr.length; i += 1) { - iterator(arr[i], i, arr); - } - }; - - var _map = function (arr, iterator) { - if (arr.map) { - return arr.map(iterator); - } - var results = []; - _each(arr, function (x, i, a) { - results.push(iterator(x, i, a)); - }); - return results; - }; - - var _reduce = function (arr, iterator, memo) { - if (arr.reduce) { - return arr.reduce(iterator, memo); - } - _each(arr, function (x, i, a) { - memo = iterator(memo, x, i, a); - }); - return memo; - }; - - var _keys = function (obj) { - if (Object.keys) { - return Object.keys(obj); - } - var keys = []; - for (var k in obj) { - if (obj.hasOwnProperty(k)) { - keys.push(k); - } - } - return keys; - }; - - //// exported async module functions //// - - //// nextTick implementation with browser-compatible fallback //// - if (typeof process === 'undefined' || !(process.nextTick)) { - if (typeof setImmediate === 'function') { - async.nextTick = function (fn) { - // not a direct alias for IE10 compatibility - setImmediate(fn); - }; - async.setImmediate = async.nextTick; - } - else { - async.nextTick = function (fn) { - setTimeout(fn, 0); - }; - async.setImmediate = async.nextTick; - } - } - else { - async.nextTick = process.nextTick; - if (typeof setImmediate !== 'undefined') { - async.setImmediate = function (fn) { - // not a direct alias for IE10 compatibility - setImmediate(fn); - }; - } - else { - async.setImmediate = async.nextTick; - } - } - - async.each = function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length) { - return callback(); - } - var completed = 0; - _each(arr, function (x) { - iterator(x, only_once(function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed >= arr.length) { - callback(null); - } - } - })); - }); - }; - async.forEach = async.each; - - async.eachSeries = function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length) { - return callback(); - } - var completed = 0; - var iterate = function () { - iterator(arr[completed], function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed >= arr.length) { - callback(null); - } - else { - iterate(); - } - } - }); - }; - iterate(); - }; - async.forEachSeries = async.eachSeries; - - async.eachLimit = function (arr, limit, iterator, callback) { - var fn = _eachLimit(limit); - fn.apply(null, [arr, iterator, callback]); - }; - async.forEachLimit = async.eachLimit; - - var _eachLimit = function (limit) { - - return function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length || limit <= 0) { - return callback(); - } - var completed = 0; - var started = 0; - var running = 0; - - (function replenish () { - if (completed >= arr.length) { - return callback(); - } - - while (running < limit && started < arr.length) { - started += 1; - running += 1; - iterator(arr[started - 1], function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - running -= 1; - if (completed >= arr.length) { - callback(); - } - else { - replenish(); - } - } - }); - } - })(); - }; - }; - - - var doParallel = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.each].concat(args)); - }; - }; - var doParallelLimit = function(limit, fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [_eachLimit(limit)].concat(args)); - }; - }; - var doSeries = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.eachSeries].concat(args)); - }; - }; - - - var _asyncMap = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (err, v) { - results[x.index] = v; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - }; - async.map = doParallel(_asyncMap); - async.mapSeries = doSeries(_asyncMap); - async.mapLimit = function (arr, limit, iterator, callback) { - return _mapLimit(limit)(arr, iterator, callback); - }; - - var _mapLimit = function(limit) { - return doParallelLimit(limit, _asyncMap); - }; - - // reduce only has a series version, as doing reduce in parallel won't - // work in many situations. - async.reduce = function (arr, memo, iterator, callback) { - async.eachSeries(arr, function (x, callback) { - iterator(memo, x, function (err, v) { - memo = v; - callback(err); - }); - }, function (err) { - callback(err, memo); - }); - }; - // inject alias - async.inject = async.reduce; - // foldl alias - async.foldl = async.reduce; - - async.reduceRight = function (arr, memo, iterator, callback) { - var reversed = _map(arr, function (x) { - return x; - }).reverse(); - async.reduce(reversed, memo, iterator, callback); - }; - // foldr alias - async.foldr = async.reduceRight; - - var _filter = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.filter = doParallel(_filter); - async.filterSeries = doSeries(_filter); - // select alias - async.select = async.filter; - async.selectSeries = async.filterSeries; - - var _reject = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (!v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.reject = doParallel(_reject); - async.rejectSeries = doSeries(_reject); - - var _detect = function (eachfn, arr, iterator, main_callback) { - eachfn(arr, function (x, callback) { - iterator(x, function (result) { - if (result) { - main_callback(x); - main_callback = function () {}; - } - else { - callback(); - } - }); - }, function (err) { - main_callback(); - }); - }; - async.detect = doParallel(_detect); - async.detectSeries = doSeries(_detect); - - async.some = function (arr, iterator, main_callback) { - async.each(arr, function (x, callback) { - iterator(x, function (v) { - if (v) { - main_callback(true); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(false); - }); - }; - // any alias - async.any = async.some; - - async.every = function (arr, iterator, main_callback) { - async.each(arr, function (x, callback) { - iterator(x, function (v) { - if (!v) { - main_callback(false); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(true); - }); - }; - // all alias - async.all = async.every; - - async.sortBy = function (arr, iterator, callback) { - async.map(arr, function (x, callback) { - iterator(x, function (err, criteria) { - if (err) { - callback(err); - } - else { - callback(null, {value: x, criteria: criteria}); - } - }); - }, function (err, results) { - if (err) { - return callback(err); - } - else { - var fn = function (left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - }; - callback(null, _map(results.sort(fn), function (x) { - return x.value; - })); - } - }); - }; - - async.auto = function (tasks, callback) { - callback = callback || function () {}; - var keys = _keys(tasks); - if (!keys.length) { - return callback(null); - } - - var results = {}; - - var listeners = []; - var addListener = function (fn) { - listeners.unshift(fn); - }; - var removeListener = function (fn) { - for (var i = 0; i < listeners.length; i += 1) { - if (listeners[i] === fn) { - listeners.splice(i, 1); - return; - } - } - }; - var taskComplete = function () { - _each(listeners.slice(0), function (fn) { - fn(); - }); - }; - - addListener(function () { - if (_keys(results).length === keys.length) { - callback(null, results); - callback = function () {}; - } - }); - - _each(keys, function (k) { - var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k]; - var taskCallback = function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - if (err) { - var safeResults = {}; - _each(_keys(results), function(rkey) { - safeResults[rkey] = results[rkey]; - }); - safeResults[k] = args; - callback(err, safeResults); - // stop subsequent errors hitting callback multiple times - callback = function () {}; - } - else { - results[k] = args; - async.setImmediate(taskComplete); - } - }; - var requires = task.slice(0, Math.abs(task.length - 1)) || []; - var ready = function () { - return _reduce(requires, function (a, x) { - return (a && results.hasOwnProperty(x)); - }, true) && !results.hasOwnProperty(k); - }; - if (ready()) { - task[task.length - 1](taskCallback, results); - } - else { - var listener = function () { - if (ready()) { - removeListener(listener); - task[task.length - 1](taskCallback, results); - } - }; - addListener(listener); - } - }); - }; - - async.waterfall = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor !== Array) { - var err = new Error('First argument to waterfall must be an array of functions'); - return callback(err); - } - if (!tasks.length) { - return callback(); - } - var wrapIterator = function (iterator) { - return function (err) { - if (err) { - callback.apply(null, arguments); - callback = function () {}; - } - else { - var args = Array.prototype.slice.call(arguments, 1); - var next = iterator.next(); - if (next) { - args.push(wrapIterator(next)); - } - else { - args.push(callback); - } - async.setImmediate(function () { - iterator.apply(null, args); - }); - } - }; - }; - wrapIterator(async.iterator(tasks))(); - }; - - var _parallel = function(eachfn, tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - eachfn.map(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - eachfn.each(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.parallel = function (tasks, callback) { - _parallel({ map: async.map, each: async.each }, tasks, callback); - }; - - async.parallelLimit = function(tasks, limit, callback) { - _parallel({ map: _mapLimit(limit), each: _eachLimit(limit) }, tasks, callback); - }; - - async.series = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.mapSeries(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - async.eachSeries(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.iterator = function (tasks) { - var makeCallback = function (index) { - var fn = function () { - if (tasks.length) { - tasks[index].apply(null, arguments); - } - return fn.next(); - }; - fn.next = function () { - return (index < tasks.length - 1) ? makeCallback(index + 1): null; - }; - return fn; - }; - return makeCallback(0); - }; - - async.apply = function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - return function () { - return fn.apply( - null, args.concat(Array.prototype.slice.call(arguments)) - ); - }; - }; - - var _concat = function (eachfn, arr, fn, callback) { - var r = []; - eachfn(arr, function (x, cb) { - fn(x, function (err, y) { - r = r.concat(y || []); - cb(err); - }); - }, function (err) { - callback(err, r); - }); - }; - async.concat = doParallel(_concat); - async.concatSeries = doSeries(_concat); - - async.whilst = function (test, iterator, callback) { - if (test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.whilst(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.doWhilst = function (iterator, test, callback) { - iterator(function (err) { - if (err) { - return callback(err); - } - if (test()) { - async.doWhilst(iterator, test, callback); - } - else { - callback(); - } - }); - }; - - async.until = function (test, iterator, callback) { - if (!test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.until(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.doUntil = function (iterator, test, callback) { - iterator(function (err) { - if (err) { - return callback(err); - } - if (!test()) { - async.doUntil(iterator, test, callback); - } - else { - callback(); - } - }); - }; - - async.queue = function (worker, concurrency) { - if (concurrency === undefined) { - concurrency = 1; - } - function _insert(q, data, pos, callback) { - if(data.constructor !== Array) { - data = [data]; - } - _each(data, function(task) { - var item = { - data: task, - callback: typeof callback === 'function' ? callback : null - }; - - if (pos) { - q.tasks.unshift(item); - } else { - q.tasks.push(item); - } - - if (q.saturated && q.tasks.length === concurrency) { - q.saturated(); - } - async.setImmediate(q.process); - }); - } - - var workers = 0; - var q = { - tasks: [], - concurrency: concurrency, - saturated: null, - empty: null, - drain: null, - push: function (data, callback) { - _insert(q, data, false, callback); - }, - unshift: function (data, callback) { - _insert(q, data, true, callback); - }, - process: function () { - if (workers < q.concurrency && q.tasks.length) { - var task = q.tasks.shift(); - if (q.empty && q.tasks.length === 0) { - q.empty(); - } - workers += 1; - var next = function () { - workers -= 1; - if (task.callback) { - task.callback.apply(task, arguments); - } - if (q.drain && q.tasks.length + workers === 0) { - q.drain(); - } - q.process(); - }; - var cb = only_once(next); - worker(task.data, cb); - } - }, - length: function () { - return q.tasks.length; - }, - running: function () { - return workers; - } - }; - return q; - }; - - async.cargo = function (worker, payload) { - var working = false, - tasks = []; - - var cargo = { - tasks: tasks, - payload: payload, - saturated: null, - empty: null, - drain: null, - push: function (data, callback) { - if(data.constructor !== Array) { - data = [data]; - } - _each(data, function(task) { - tasks.push({ - data: task, - callback: typeof callback === 'function' ? callback : null - }); - if (cargo.saturated && tasks.length === payload) { - cargo.saturated(); - } - }); - async.setImmediate(cargo.process); - }, - process: function process() { - if (working) return; - if (tasks.length === 0) { - if(cargo.drain) cargo.drain(); - return; - } - - var ts = typeof payload === 'number' - ? tasks.splice(0, payload) - : tasks.splice(0); - - var ds = _map(ts, function (task) { - return task.data; - }); - - if(cargo.empty) cargo.empty(); - working = true; - worker(ds, function () { - working = false; - - var args = arguments; - _each(ts, function (data) { - if (data.callback) { - data.callback.apply(null, args); - } - }); - - process(); - }); - }, - length: function () { - return tasks.length; - }, - running: function () { - return working; - } - }; - return cargo; - }; - - var _console_fn = function (name) { - return function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - fn.apply(null, args.concat([function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (typeof console !== 'undefined') { - if (err) { - if (console.error) { - console.error(err); - } - } - else if (console[name]) { - _each(args, function (x) { - console[name](x); - }); - } - } - }])); - }; - }; - async.log = _console_fn('log'); - async.dir = _console_fn('dir'); - /*async.info = _console_fn('info'); - async.warn = _console_fn('warn'); - async.error = _console_fn('error');*/ - - async.memoize = function (fn, hasher) { - var memo = {}; - var queues = {}; - hasher = hasher || function (x) { - return x; - }; - var memoized = function () { - var args = Array.prototype.slice.call(arguments); - var callback = args.pop(); - var key = hasher.apply(null, args); - if (key in memo) { - callback.apply(null, memo[key]); - } - else if (key in queues) { - queues[key].push(callback); - } - else { - queues[key] = [callback]; - fn.apply(null, args.concat([function () { - memo[key] = arguments; - var q = queues[key]; - delete queues[key]; - for (var i = 0, l = q.length; i < l; i++) { - q[i].apply(null, arguments); - } - }])); - } - }; - memoized.memo = memo; - memoized.unmemoized = fn; - return memoized; - }; - - async.unmemoize = function (fn) { - return function () { - return (fn.unmemoized || fn).apply(null, arguments); - }; - }; - - async.times = function (count, iterator, callback) { - var counter = []; - for (var i = 0; i < count; i++) { - counter.push(i); - } - return async.map(counter, iterator, callback); - }; - - async.timesSeries = function (count, iterator, callback) { - var counter = []; - for (var i = 0; i < count; i++) { - counter.push(i); - } - return async.mapSeries(counter, iterator, callback); - }; - - async.compose = function (/* functions... */) { - var fns = Array.prototype.reverse.call(arguments); - return function () { - var that = this; - var args = Array.prototype.slice.call(arguments); - var callback = args.pop(); - async.reduce(fns, args, function (newargs, fn, cb) { - fn.apply(that, newargs.concat([function () { - var err = arguments[0]; - var nextargs = Array.prototype.slice.call(arguments, 1); - cb(err, nextargs); - }])) - }, - function (err, results) { - callback.apply(that, [err].concat(results)); - }); - }; - }; - - var _applyEach = function (eachfn, fns /*args...*/) { - var go = function () { - var that = this; - var args = Array.prototype.slice.call(arguments); - var callback = args.pop(); - return eachfn(fns, function (fn, cb) { - fn.apply(that, args.concat([cb])); - }, - callback); - }; - if (arguments.length > 2) { - var args = Array.prototype.slice.call(arguments, 2); - return go.apply(this, args); - } - else { - return go; - } - }; - async.applyEach = doParallel(_applyEach); - async.applyEachSeries = doSeries(_applyEach); - - async.forever = function (fn, callback) { - function next(err) { - if (err) { - if (callback) { - return callback(err); - } - throw err; - } - fn(next); - } - next(); - }; - - // AMD / RequireJS - if (typeof define !== 'undefined' && define.amd) { - define([], function () { - return async; - }); - } - // Node.js - else if (typeof module !== 'undefined' && module.exports) { - module.exports = async; - } - // included directly via - - - - - - - diff --git a/node_modules/atom-space-pen-views/node_modules/space-pen/node_modules/jquery/src/sizzle/test/data/testinit.js b/node_modules/atom-space-pen-views/node_modules/space-pen/node_modules/jquery/src/sizzle/test/data/testinit.js deleted file mode 100644 index 1c49c7aba..000000000 --- a/node_modules/atom-space-pen-views/node_modules/space-pen/node_modules/jquery/src/sizzle/test/data/testinit.js +++ /dev/null @@ -1,136 +0,0 @@ -var fireNative, - jQuery = this.jQuery || "jQuery", // For testing .noConflict() - $ = this.$ || "$", - originaljQuery = jQuery, - original$ = $; - -(function() { - // Config parameter to force basic code paths - QUnit.config.urlConfig.push({ - id: "basic", - label: "Bypass optimizations", - tooltip: "Force use of the most basic code by disabling native querySelectorAll; contains; compareDocumentPosition" - }); - if ( QUnit.urlParams.basic ) { - document.querySelectorAll = null; - document.documentElement.contains = null; - document.documentElement.compareDocumentPosition = null; - // Return array of length two to pass assertion - // But support should be false as its not native - document.getElementsByClassName = function() { return [ 0, 1 ]; }; - } -})(); - -/** - * Returns an array of elements with the given IDs - * @example q("main", "foo", "bar") - * @result [
    , , ] - */ -function q() { - var r = [], - i = 0; - - for ( ; i < arguments.length; i++ ) { - r.push( document.getElementById( arguments[i] ) ); - } - return r; -} - -/** - * Asserts that a select matches the given IDs - * @param {String} a - Assertion name - * @param {String} b - Sizzle selector - * @param {String} c - Array of ids to construct what is expected - * @example t("Check for something", "//[a]", ["foo", "baar"]); - * @result returns true if "//[a]" return two elements with the IDs 'foo' and 'baar' - */ -function t( a, b, c ) { - var f = Sizzle(b), - s = "", - i = 0; - - for ( ; i < f.length; i++ ) { - s += ( s && "," ) + '"' + f[ i ].id + '"'; - } - - deepEqual(f, q.apply( q, c ), a + " (" + b + ")"); -} - -/** - * Add random number to url to stop caching - * - * @example url("data/test.html") - * @result "data/test.html?10538358428943" - * - * @example url("data/test.php?foo=bar") - * @result "data/test.php?foo=bar&10538358345554" - */ -function url( value ) { - return value + (/\?/.test(value) ? "&" : "?") + new Date().getTime() + "" + parseInt(Math.random()*100000); -} - -var createWithFriesXML = function() { - var string = ' \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - 1 \ - \ - \ - \ - \ - foo \ - \ - \ - \ - \ - \ - \ - '; - - return jQuery.parseXML( string ); -}; - -fireNative = document.createEvent ? - function( node, type ) { - var event = document.createEvent("HTMLEvents"); - event.initEvent( type, true, true ); - node.dispatchEvent( event ); - } : - function( node, type ) { - var event = document.createEventObject(); - node.fireEvent( "on" + type, event ); - }; - -function testIframeWithCallback( title, fileName, func ) { - test( title, function() { - var iframe; - - stop(); - window.iframeCallback = function() { - var self = this, - args = arguments; - setTimeout(function() { - window.iframeCallback = undefined; - iframe.remove(); - func.apply( self, args ); - func = function() {}; - start(); - }, 0 ); - }; - iframe = jQuery( "
    " ).css({ position: "absolute", width: "500px", left: "-600px" }) - .append( jQuery( " -
    - - -
    -
    - -
    - - - - -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - -
    -
      -
    1. Rice
    2. -
    3. Beans
    4. -
    5. Blinis
    6. -
    7. Tofu
    8. -
    - -
    I'm hungry. I should...
    - ...Eat lots of food... | - ...Eat a little food... | - ...Eat no food... - ...Eat a burger... - ...Eat some funyuns... - ...Eat some funyuns... -
    - -
    - - -
    - -
    - 1 - 2 - - - - - - - - -
    ​ -
    - -
    - - diff --git a/node_modules/atom-space-pen-views/node_modules/space-pen/node_modules/jquery/src/sizzle/test/jquery.js b/node_modules/atom-space-pen-views/node_modules/space-pen/node_modules/jquery/src/sizzle/test/jquery.js deleted file mode 100644 index 86a330515..000000000 --- a/node_modules/atom-space-pen-views/node_modules/space-pen/node_modules/jquery/src/sizzle/test/jquery.js +++ /dev/null @@ -1,9597 +0,0 @@ -/*! - * jQuery JavaScript Library v1.9.1 - * http://jquery.com/ - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * - * Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2013-2-4 - */ -(function( window, undefined ) { - -// Can't do this because several apps including ASP.NET trace -// the stack via arguments.caller.callee and Firefox dies if -// you try to trace through "use strict" call chains. (#13335) -// Support: Firefox 18+ -//"use strict"; -var - // The deferred used on DOM ready - readyList, - - // A central reference to the root jQuery(document) - rootjQuery, - - // Support: IE<9 - // For `typeof node.method` instead of `node.method !== undefined` - core_strundefined = typeof undefined, - - // Use the correct document accordingly with window argument (sandbox) - document = window.document, - location = window.location, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // [[Class]] -> type pairs - class2type = {}, - - // List of deleted data cache ids, so we can reuse them - core_deletedIds = [], - - core_version = "1.9.1", - - // Save a reference to some core methods - core_concat = core_deletedIds.concat, - core_push = core_deletedIds.push, - core_slice = core_deletedIds.slice, - core_indexOf = core_deletedIds.indexOf, - core_toString = class2type.toString, - core_hasOwn = class2type.hasOwnProperty, - core_trim = core_version.trim, - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Used for matching numbers - core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, - - // Used for splitting on whitespace - core_rnotwhite = /\S+/g, - - // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) - rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, - - // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, - rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, - - // Matches dashed string for camelizing - rmsPrefix = /^-ms-/, - rdashAlpha = /-([\da-z])/gi, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return letter.toUpperCase(); - }, - - // The ready event handler - completed = function( event ) { - - // readyState === "complete" is good enough for us to call the dom ready in oldIE - if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { - detach(); - jQuery.ready(); - } - }, - // Clean-up method for dom ready events - detach = function() { - if ( document.addEventListener ) { - document.removeEventListener( "DOMContentLoaded", completed, false ); - window.removeEventListener( "load", completed, false ); - - } else { - document.detachEvent( "onreadystatechange", completed ); - window.detachEvent( "onload", completed ); - } - }; - -jQuery.fn = jQuery.prototype = { - // The current version of jQuery being used - jquery: core_version, - - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - - // scripts is true for back-compat - jQuery.merge( this, jQuery.parseHTML( - match[1], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - // Properties of context are called as methods if possible - if ( jQuery.isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return core_slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - ret.context = this.context; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Add the callback - jQuery.ready.promise().done( fn ); - - return this; - }, - - slice: function() { - return this.pushStack( core_slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: core_push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var src, copyIsArray, copy, name, options, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger("ready").off("ready"); - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - isWindow: function( obj ) { - return obj != null && obj == obj.window; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - if ( obj == null ) { - return String( obj ); - } - return typeof obj === "object" || typeof obj === "function" ? - class2type[ core_toString.call(obj) ] || "object" : - typeof obj; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !core_hasOwn.call(obj, "constructor") && - !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || core_hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - var name; - for ( name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - // data: string of html - // context (optional): If specified, the fragment will be created in this context, defaults to document - // keepScripts (optional): If true, will include scripts passed in the html string - parseHTML: function( data, context, keepScripts ) { - if ( !data || typeof data !== "string" ) { - return null; - } - if ( typeof context === "boolean" ) { - keepScripts = context; - context = false; - } - context = context || document; - - var parsed = rsingleTag.exec( data ), - scripts = !keepScripts && []; - - // Single tag - if ( parsed ) { - return [ context.createElement( parsed[1] ) ]; - } - - parsed = jQuery.buildFragment( [ data ], context, scripts ); - if ( scripts ) { - jQuery( scripts ).remove(); - } - return jQuery.merge( [], parsed.childNodes ); - }, - - parseJSON: function( data ) { - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - if ( data === null ) { - return data; - } - - if ( typeof data === "string" ) { - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - if ( data ) { - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - } - } - } - - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - if ( !data || typeof data !== "string" ) { - return null; - } - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && jQuery.trim( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - }, - - // args is for internal usage only - each: function( obj, callback, args ) { - var value, - i = 0, - length = obj.length, - isArray = isArraylike( obj ); - - if ( args ) { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } - } - - return obj; - }, - - // Use native String.trim function wherever possible - trim: core_trim && !core_trim.call("\uFEFF\xA0") ? - function( text ) { - return text == null ? - "" : - core_trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - ( text + "" ).replace( rtrim, "" ); - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArraylike( Object(arr) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - core_push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - var len; - - if ( arr ) { - if ( core_indexOf ) { - return core_indexOf.call( arr, elem, i ); - } - - len = arr.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in arr && arr[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var l = second.length, - i = first.length, - j = 0; - - if ( typeof l === "number" ) { - for ( ; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var retVal, - ret = [], - i = 0, - length = elems.length; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, - i = 0, - length = elems.length, - isArray = isArraylike( elems ), - ret = []; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return core_concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - var args, proxy, tmp; - - if ( typeof context === "string" ) { - tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - args = core_slice.call( arguments, 2 ); - proxy = function() { - return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || jQuery.guid++; - - return proxy; - }, - - // Multifunctional method to get and set values of a collection - // The value/s can optionally be executed if it's a function - access: function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - length = elems.length, - bulk = key == null; - - // Sets many values - if ( jQuery.type( key ) === "object" ) { - chainable = true; - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !jQuery.isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < length; i++ ) { - fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); - } - } - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; - }, - - now: function() { - return ( new Date() ).getTime(); - } -}); - -jQuery.ready.promise = function( obj ) { - if ( !readyList ) { - - readyList = jQuery.Deferred(); - - // Catch cases where $(document).ready() is called after the browser event has already occurred. - // we once tried to use readyState "interactive" here, but it caused issues like the one - // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - setTimeout( jQuery.ready ); - - // Standards-based browsers support DOMContentLoaded - } else if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed, false ); - - // If IE event model is used - } else { - // Ensure firing before onload, maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", completed ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", completed ); - - // If IE and not a frame - // continually check to see if the document is ready - var top = false; - - try { - top = window.frameElement == null && document.documentElement; - } catch(e) {} - - if ( top && top.doScroll ) { - (function doScrollCheck() { - if ( !jQuery.isReady ) { - - try { - // Use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - top.doScroll("left"); - } catch(e) { - return setTimeout( doScrollCheck, 50 ); - } - - // detach all dom ready events - detach(); - - // and execute any waiting functions - jQuery.ready(); - } - })(); - } - } - } - return readyList.promise( obj ); -}; - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -function isArraylike( obj ) { - var length = obj.length, - type = jQuery.type( obj ); - - if ( jQuery.isWindow( obj ) ) { - return false; - } - - if ( obj.nodeType === 1 && length ) { - return true; - } - - return type === "array" || type !== "function" && - ( length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj ); -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); -// String to Object options format cache -var optionsCache = {}; - -// Convert String-formatted options into Object-formatted ones and store in cache -function createOptions( options ) { - var object = optionsCache[ options ] = {}; - jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { - object[ flag ] = true; - }); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - ( optionsCache[ options ] || createOptions( options ) ) : - jQuery.extend( {}, options ); - - var // Flag to know if list is currently firing - firing, - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // First callback to fire (used internally by add and fireWith) - firingStart, - // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = !options.once && [], - // Fire callbacks - fire = function( data ) { - memory = options.memory && data; - fired = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - firing = true; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { - memory = false; // To prevent further calls using add - break; - } - } - firing = false; - if ( list ) { - if ( stack ) { - if ( stack.length ) { - fire( stack.shift() ); - } - } else if ( memory ) { - list = []; - } else { - self.disable(); - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - // First, we save the current length - var start = list.length; - (function add( args ) { - jQuery.each( args, function( _, arg ) { - var type = jQuery.type( arg ); - if ( type === "function" ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && type !== "string" ) { - // Inspect recursively - add( arg ); - } - }); - })( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away - } else if ( memory ) { - firingStart = start; - fire( memory ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - jQuery.each( arguments, function( _, arg ) { - var index; - while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - // Handle firing indexes - if ( firing ) { - if ( index <= firingLength ) { - firingLength--; - } - if ( index <= firingIndex ) { - firingIndex--; - } - } - } - }); - } - return this; - }, - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); - }, - // Remove all callbacks from the list - empty: function() { - list = []; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - if ( list && ( !fired || stack ) ) { - if ( firing ) { - stack.push( args ); - } else { - fire( args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; -jQuery.extend({ - - Deferred: function( func ) { - var tuples = [ - // action, add listener, listener list, final state - [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], - [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], - [ "notify", "progress", jQuery.Callbacks("memory") ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - then: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - return jQuery.Deferred(function( newDefer ) { - jQuery.each( tuples, function( i, tuple ) { - var action = tuple[ 0 ], - fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; - // deferred[ done | fail | progress ] for forwarding actions to newDefer - deferred[ tuple[1] ](function() { - var returned = fn && fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise() - .done( newDefer.resolve ) - .fail( newDefer.reject ) - .progress( newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); - } - }); - }); - fns = null; - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Keep pipe for back-compat - promise.pipe = promise.then; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 3 ]; - - // promise[ done | fail | progress ] = list.add - promise[ tuple[1] ] = list.add; - - // Handle state - if ( stateString ) { - list.add(function() { - // state = [ resolved | rejected ] - state = stateString; - - // [ reject_list | resolve_list ].disable; progress_list.lock - }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); - } - - // deferred[ resolve | reject | notify ] - deferred[ tuple[0] ] = function() { - deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); - return this; - }; - deferred[ tuple[0] + "With" ] = list.fireWith; - }); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( subordinate /* , ..., subordinateN */ ) { - var i = 0, - resolveValues = core_slice.call( arguments ), - length = resolveValues.length, - - // the count of uncompleted subordinates - remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, - - // the master Deferred. If resolveValues consist of only a single Deferred, just use that. - deferred = remaining === 1 ? subordinate : jQuery.Deferred(), - - // Update function for both resolve and progress values - updateFunc = function( i, contexts, values ) { - return function( value ) { - contexts[ i ] = this; - values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; - if( values === progressValues ) { - deferred.notifyWith( contexts, values ); - } else if ( !( --remaining ) ) { - deferred.resolveWith( contexts, values ); - } - }; - }, - - progressValues, progressContexts, resolveContexts; - - // add listeners to Deferred subordinates; treat others as resolved - if ( length > 1 ) { - progressValues = new Array( length ); - progressContexts = new Array( length ); - resolveContexts = new Array( length ); - for ( ; i < length; i++ ) { - if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { - resolveValues[ i ].promise() - .done( updateFunc( i, resolveContexts, resolveValues ) ) - .fail( deferred.reject ) - .progress( updateFunc( i, progressContexts, progressValues ) ); - } else { - --remaining; - } - } - } - - // if we're not waiting on anything, resolve the master - if ( !remaining ) { - deferred.resolveWith( resolveContexts, resolveValues ); - } - - return deferred.promise(); - } -}); -jQuery.support = (function() { - - var support, all, a, - input, select, fragment, - opt, eventName, isSupported, i, - div = document.createElement("div"); - - // Setup - div.setAttribute( "className", "t" ); - div.innerHTML = "
    a"; - - // Support tests won't run in some limited or non-browser environments - all = div.getElementsByTagName("*"); - a = div.getElementsByTagName("a")[ 0 ]; - if ( !all || !a || !all.length ) { - return {}; - } - - // First batch of tests - select = document.createElement("select"); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName("input")[ 0 ]; - - a.style.cssText = "top:1px;float:left;opacity:.5"; - support = { - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: div.firstChild.nodeType === 3, - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: a.getAttribute("href") === "/a", - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.5/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) - checkOn: !!input.value, - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Tests for enctype support on a form (#6743) - enctype: !!document.createElement("form").enctype, - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", - - // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode - boxModel: document.compatMode === "CSS1Compat", - - // Will be defined later - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true, - boxSizingReliable: true, - pixelPosition: false - }; - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Support: IE<9 - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - // Check if we can trust getAttribute("value") - input = document.createElement("input"); - input.setAttribute( "value", "" ); - support.input = input.getAttribute( "value" ) === ""; - - // Check if an input maintains its value after becoming a radio - input.value = "t"; - input.setAttribute( "type", "radio" ); - support.radioValue = input.value === "t"; - - // #11217 - WebKit loses check when the name is after the checked attribute - input.setAttribute( "checked", "t" ); - input.setAttribute( "name", "t" ); - - fragment = document.createDocumentFragment(); - fragment.appendChild( input ); - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: IE<9 - // Opera does not clone events (and typeof div.attachEvent === undefined). - // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() - if ( div.attachEvent ) { - div.attachEvent( "onclick", function() { - support.noCloneEvent = false; - }); - - div.cloneNode( true ).click(); - } - - // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event) - // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php - for ( i in { submit: true, change: true, focusin: true }) { - div.setAttribute( eventName = "on" + i, "t" ); - - support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false; - } - - div.style.backgroundClip = "content-box"; - div.cloneNode( true ).style.backgroundClip = ""; - support.clearCloneStyle = div.style.backgroundClip === "content-box"; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, marginDiv, tds, - divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - container = document.createElement("div"); - container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; - - body.appendChild( container ).appendChild( div ); - - // Support: IE8 - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - div.innerHTML = "
    t
    "; - tds = div.getElementsByTagName("td"); - tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Support: IE8 - // Check if empty table cells still have offsetWidth/Height - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Check box-sizing and margin behavior - div.innerHTML = ""; - div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; - support.boxSizing = ( div.offsetWidth === 4 ); - support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); - - // Use window.getComputedStyle because jsdom on node.js will break without it. - if ( window.getComputedStyle ) { - support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; - support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. (#3333) - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - marginDiv = div.appendChild( document.createElement("div") ); - marginDiv.style.cssText = div.style.cssText = divReset; - marginDiv.style.marginRight = marginDiv.style.width = "0"; - div.style.width = "1px"; - - support.reliableMarginRight = - !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); - } - - if ( typeof div.style.zoom !== core_strundefined ) { - // Support: IE<8 - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - div.innerHTML = ""; - div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); - - // Support: IE6 - // Check if elements with layout shrink-wrap their children - div.style.display = "block"; - div.innerHTML = "
    "; - div.firstChild.style.width = "5px"; - support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); - - if ( support.inlineBlockNeedsLayout ) { - // Prevent IE 6 from affecting layout for positioned elements #11048 - // Prevent IE from shrinking the body in IE 7 mode #12869 - // Support: IE<8 - body.style.zoom = 1; - } - } - - body.removeChild( container ); - - // Null elements to avoid leaks in IE - container = div = tds = marginDiv = null; - }); - - // Null elements to avoid leaks in IE - all = select = fragment = opt = a = input = null; - - return support; -})(); - -var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, - rmultiDash = /([A-Z])/g; - -function internalData( elem, name, data, pvt /* Internal Use Only */ ){ - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; -} - -function internalRemoveData( elem, name, pvt ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var i, l, thisCache, - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - id = isNode ? elem[ jQuery.expando ] : jQuery.expando; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split(" "); - } - } - } else { - // If "name" is an array of keys... - // When data is initially created, via ("key", "val") signature, - // keys will be converted to camelCase. - // Since there is no way to tell _how_ a key was added, remove - // both plain key and camelCase key. #12786 - // This will only penalize the array argument path. - name = name.concat( jQuery.map( name, jQuery.camelCase ) ); - } - - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject( cache[ id ] ) ) { - return; - } - } - - // Destroy the cache - if ( isNode ) { - jQuery.cleanData( [ elem ], true ); - - // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) - } else if ( jQuery.support.deleteExpando || cache != cache.window ) { - delete cache[ id ]; - - // When all else fails, null - } else { - cache[ id ] = null; - } -} - -jQuery.extend({ - cache: {}, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data ) { - return internalData( elem, name, data ); - }, - - removeData: function( elem, name ) { - return internalRemoveData( elem, name ); - }, - - // For internal use only. - _data: function( elem, name, data ) { - return internalData( elem, name, data, true ); - }, - - _removeData: function( elem, name ) { - return internalRemoveData( elem, name, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - // Do not set data on non-element because it will not be cleared (#8335). - if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) { - return false; - } - - var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; - - // nodes accept data unless otherwise specified; rejection can be conditional - return !noData || noData !== true && elem.getAttribute("classid") === noData; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var attrs, name, - elem = this[0], - i = 0, - data = null; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = jQuery.data( elem ); - - if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { - attrs = elem.attributes; - for ( ; i < attrs.length; i++ ) { - name = attrs[i].name; - - if ( !name.indexOf( "data-" ) ) { - name = jQuery.camelCase( name.slice(5) ); - - dataAttr( elem, name, data[ name ] ); - } - } - jQuery._data( elem, "parsedAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - return jQuery.access( this, function( value ) { - - if ( value === undefined ) { - // Try to fetch any internally stored data first - return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null; - } - - this.each(function() { - jQuery.data( this, key, value ); - }); - }, null, value, arguments.length > 1, null, true ); - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - // Only convert to a number if it doesn't change the string - +data + "" === data ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - var name; - for ( name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} -jQuery.extend({ - queue: function( elem, type, data ) { - var queue; - - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || jQuery.isArray(data) ) { - queue = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } - - hooks.cur = fn; - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - // clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, - - // not intended for public consumption - generates a queueHooks object, or returns the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return jQuery._data( elem, key ) || jQuery._data( elem, key, { - empty: jQuery.Callbacks("once memory").add(function() { - jQuery._removeData( elem, type + "queue" ); - jQuery._removeData( elem, key ); - }) - }); - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[0], type ); - } - - return data === undefined ? - this : - this.each(function() { - var queue = jQuery.queue( this, type, data ); - - // ensure a hooks for this queue - jQuery._queueHooks( this, type ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; - - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; - - while( i-- ) { - tmp = jQuery._data( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } -}); -var nodeHook, boolHook, - rclass = /[\t\r\n]/g, - rreturn = /\r/g, - rfocusable = /^(?:input|select|textarea|button|object)$/i, - rclickable = /^(?:a|area)$/i, - rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i, - ruseDefault = /^(?:checked|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - getSetInput = jQuery.support.input; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classes, elem, cur, clazz, j, - i = 0, - len = this.length, - proceed = typeof value === "string" && value; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call( this, j, this.className ) ); - }); - } - - if ( proceed ) { - // The disjunction here is for better compressibility (see removeClass) - classes = ( value || "" ).match( core_rnotwhite ) || []; - - for ( ; i < len; i++ ) { - elem = this[ i ]; - cur = elem.nodeType === 1 && ( elem.className ? - ( " " + elem.className + " " ).replace( rclass, " " ) : - " " - ); - - if ( cur ) { - j = 0; - while ( (clazz = classes[j++]) ) { - if ( cur.indexOf( " " + clazz + " " ) < 0 ) { - cur += clazz + " "; - } - } - elem.className = jQuery.trim( cur ); - - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classes, elem, cur, clazz, j, - i = 0, - len = this.length, - proceed = arguments.length === 0 || typeof value === "string" && value; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call( this, j, this.className ) ); - }); - } - if ( proceed ) { - classes = ( value || "" ).match( core_rnotwhite ) || []; - - for ( ; i < len; i++ ) { - elem = this[ i ]; - // This expression is here for better compressibility (see addClass) - cur = elem.nodeType === 1 && ( elem.className ? - ( " " + elem.className + " " ).replace( rclass, " " ) : - "" - ); - - if ( cur ) { - j = 0; - while ( (clazz = classes[j++]) ) { - // Remove *all* instances - while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { - cur = cur.replace( " " + clazz + " ", " " ); - } - } - elem.className = value ? jQuery.trim( cur ) : ""; - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.match( core_rnotwhite ) || []; - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space separated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - // Toggle whole class name - } else if ( type === core_strundefined || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // If the element has a class name or if we're passed "false", - // then remove the whole classname (if there was one, the above saved it). - // Otherwise bring back whatever was previously saved (if anything), - // falling back to the empty string if nothing was stored. - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var ret, hooks, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var val, - self = jQuery(this); - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, option, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one" || index < 0, - values = one ? null : [], - max = one ? index + 1 : options.length, - i = index < 0 ? - max : - one ? index : 0; - - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; - - // oldIE doesn't update selected after form reset (#2551) - if ( ( option.selected || i === index ) && - // Don't return options that are disabled or in a disabled optgroup - ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && - ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attr: function( elem, name, value ) { - var hooks, notxml, ret, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === core_strundefined ) { - return jQuery.prop( elem, name, value ); - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - - } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, value + "" ); - return value; - } - - } else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - // In IE9+, Flash objects don't have .getAttribute (#12945) - // Support: IE9+ - if ( typeof elem.getAttribute !== core_strundefined ) { - ret = elem.getAttribute( name ); - } - - // Non-existent attributes return null, we normalize to undefined - return ret == null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var name, propName, - i = 0, - attrNames = value && value.match( core_rnotwhite ); - - if ( attrNames && elem.nodeType === 1 ) { - while ( (name = attrNames[i++]) ) { - propName = jQuery.propFix[ name ] || name; - - // Boolean attributes get special treatment (#10870) - if ( rboolean.test( name ) ) { - // Set corresponding property to false for boolean attributes - // Also clear defaultChecked/defaultSelected (if appropriate) for IE<8 - if ( !getSetAttribute && ruseDefault.test( name ) ) { - elem[ jQuery.camelCase( "default-" + name ) ] = - elem[ propName ] = false; - } else { - elem[ propName ] = false; - } - - // See #9699 for explanation of this approach (setting first, then removal) - } else { - jQuery.attr( elem, name, "" ); - } - - elem.removeAttribute( getSetAttribute ? name : propName ); - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to default in case type is set after value during creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return ( elem[ name ] = value ); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } -}); - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - var - // Use .prop to determine if this attribute is understood as boolean - prop = jQuery.prop( elem, name ), - - // Fetch it accordingly - attr = typeof prop === "boolean" && elem.getAttribute( name ), - detail = typeof prop === "boolean" ? - - getSetInput && getSetAttribute ? - attr != null : - // oldIE fabricates an empty string for missing boolean attributes - // and conflates checked/selected into attroperties - ruseDefault.test( name ) ? - elem[ jQuery.camelCase( "default-" + name ) ] : - !!attr : - - // fetch an attribute node for properties not recognized as boolean - elem.getAttributeNode( name ); - - return detail && detail.value !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { - // IE<8 needs the *property* name - elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); - - // Use defaultChecked and defaultSelected for oldIE - } else { - elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; - } - - return name; - } -}; - -// fix oldIE value attroperty -if ( !getSetInput || !getSetAttribute ) { - jQuery.attrHooks.value = { - get: function( elem, name ) { - var ret = elem.getAttributeNode( name ); - return jQuery.nodeName( elem, "input" ) ? - - // Ignore the value *property* by using defaultValue - elem.defaultValue : - - ret && ret.specified ? ret.value : undefined; - }, - set: function( elem, value, name ) { - if ( jQuery.nodeName( elem, "input" ) ) { - // Does not return so that setAttribute is also used - elem.defaultValue = value; - } else { - // Use nodeHook if defined (#1954); otherwise setAttribute is fine - return nodeHook && nodeHook.set( elem, value, name ); - } - } - }; -} - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret = elem.getAttributeNode( name ); - return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ? - ret.value : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - elem.setAttributeNode( - (ret = elem.ownerDocument.createAttribute( name )) - ); - } - - ret.value = value += ""; - - // Break association with cloned elements by also using setAttribute (#9646) - return name === "value" || value === elem.getAttribute( name ) ? - value : - undefined; - } - }; - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - nodeHook.set( elem, value === "" ? false : value, name ); - } - }; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); -} - - -// Some attributes require a special call on IE -// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret == null ? undefined : ret; - } - }); - }); - - // href/src property should get the full normalized URL (#10299/#12915) - jQuery.each([ "href", "src" ], function( i, name ) { - jQuery.propHooks[ name ] = { - get: function( elem ) { - return elem.getAttribute( name, 4 ); - } - }; - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Note: IE uppercases css property names, but if we were to .toLowerCase() - // .cssText, that would destroy case senstitivity in URL's, like in "background" - return elem.style.cssText || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = value + "" ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }); -}); -var rformElems = /^(?:input|select|textarea)$/i, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - var tmp, events, t, handleObjIn, - special, eventHandle, handleObj, - handlers, type, namespaces, origType, - elemData = jQuery._data( elem ); - - // Don't attach events to noData or text/comment nodes (but allow plain objects) - if ( !elemData ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !(events = elemData.events) ) { - events = elemData.events = {}; - } - if ( !(eventHandle = elemData.handle) ) { - eventHandle = elemData.handle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = ( types || "" ).match( core_rnotwhite ) || [""]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !(handlers = events[ type ]) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - var j, handleObj, tmp, - origCount, t, events, - special, handlers, type, - namespaces, origType, - elemData = jQuery.hasData( elem ) && jQuery._data( elem ); - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( core_rnotwhite ) || [""]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - delete elemData.handle; - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery._removeData( elem, "events" ); - } - }, - - trigger: function( event, data, elem, onlyHandlers ) { - var handle, ontype, cur, - bubbleType, special, tmp, i, - eventPath = [ elem || document ], - type = core_hasOwn.call( event, "type" ) ? event.type : event, - namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; - - cur = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf(".") >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf(":") < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - event.isTrigger = true; - event.namespace = namespaces.join("."); - event.namespace_re = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === (elem.ownerDocument || document) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { - - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - try { - elem[ type ](); - } catch ( e ) { - // IE<9 dies on focus/blur to hidden element (#1486,#12518) - // only reproducible on winXP IE8 native, not IE9 in IE8 mode - } - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event ); - - var i, ret, handleObj, matched, j, - handlerQueue = [], - args = core_slice.call( arguments ), - handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { - - // Triggered event must either 1) have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - if ( (event.result = ret) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var sel, handleObj, matches, i, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - // Black-hole SVG instance trees (#13180) - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { - - for ( ; cur != this; cur = cur.parentNode || this ) { - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { - matches = []; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matches[ sel ] === undefined ) { - matches[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) >= 0 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matches[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, handlers: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( delegateCount < handlers.length ) { - handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); - } - - return handlerQueue; - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, copy, - type = event.type, - originalEvent = event, - fixHook = this.fixHooks[ type ]; - - if ( !fixHook ) { - this.fixHooks[ type ] = fixHook = - rmouseEvent.test( type ) ? this.mouseHooks : - rkeyEvent.test( type ) ? this.keyHooks : - {}; - } - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = new jQuery.Event( originalEvent ); - - i = copy.length; - while ( i-- ) { - prop = copy[ i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Support: IE<9 - // Fix target property (#1925) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Support: Chrome 23+, Safari? - // Target should not be a text node (#504, #13143) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // Support: IE<9 - // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) - event.metaKey = !!event.metaKey; - - return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var body, eventDoc, doc, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - special: { - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - click: { - // For checkbox, fire native event so checked state will be right - trigger: function() { - if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { - this.click(); - return false; - } - } - }, - focus: { - // Fire native event if possible so blur/focus sequence is correct - trigger: function() { - if ( this !== document.activeElement && this.focus ) { - try { - this.focus(); - return false; - } catch ( e ) { - // Support: IE<9 - // If we error on focus to hidden element (#1486, #12518), - // let .trigger() run the handlers - } - } - }, - delegateType: "focusin" - }, - blur: { - trigger: function() { - if ( this === document.activeElement && this.blur ) { - this.blur(); - return false; - } - }, - delegateType: "focusout" - }, - - beforeunload: { - postDispatch: function( event ) { - - // Even when returnValue equals to undefined Firefox will still show alert - if ( event.result !== undefined ) { - event.originalEvent.returnValue = event.result; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - var name = "on" + type; - - if ( elem.detachEvent ) { - - // #8545, #7054, preventing memory leaks for custom events in IE6-8 - // detachEvent needed property on element, by name of that event, to properly expose it to GC - if ( typeof elem[ name ] === core_strundefined ) { - elem[ name ] = null; - } - - elem.detachEvent( name, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - if ( !e ) { - return; - } - - // If preventDefault exists, run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // Support: IE - // Otherwise set the returnValue property of the original event to false - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - if ( !e ) { - return; - } - // If stopPropagation exists, run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - - // Support: IE - // Set the cancelBubble property of the original event to true - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - } -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !jQuery._data( form, "submitBubbles" ) ) { - jQuery.event.add( form, "submit._submit", function( event ) { - event._submit_bubble = true; - }); - jQuery._data( form, "submitBubbles", true ); - } - }); - // return undefined since we don't need an event listener - }, - - postDispatch: function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( event._submit_bubble ) { - delete event._submit_bubble; - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - } - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - } - // Allow triggered, simulated change events (#11500) - jQuery.event.simulate( "change", this, event, true ); - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - jQuery._data( elem, "changeBubbles", true ); - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return !rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var type, origFn; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - var elem = this[0]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -}); -/*! - * Sizzle CSS Selector Engine - * Copyright 2012 jQuery Foundation and other contributors - * Released under the MIT license - * http://sizzlejs.com/ - */ -(function( window, undefined ) { - -var i, - cachedruns, - Expr, - getText, - isXML, - compile, - hasDuplicate, - outermostContext, - - // Local document vars - setDocument, - document, - docElem, - documentIsXML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - sortOrder, - - // Instance-specific data - expando = "sizzle" + -(new Date()), - preferredDoc = window.document, - support = {}, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - - // General-purpose constants - strundefined = typeof undefined, - MAX_NEGATIVE = 1 << 31, - - // Array methods - arr = [], - pop = arr.pop, - push = arr.push, - slice = arr.slice, - // Use a stripped-down indexOf if we can't use a native one - indexOf = arr.indexOf || function( elem ) { - var i = 0, - len = this.length; - for ( ; i < len; i++ ) { - if ( this[i] === elem ) { - return i; - } - } - return -1; - }, - - - // Regular expressions - - // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - // http://www.w3.org/TR/css3-syntax/#characters - characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", - - // Loosely modeled on CSS identifier characters - // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors - // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = characterEncoding.replace( "w", "w#" ), - - // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors - operators = "([*^$|!~]?=)", - attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + - "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", - - // Prefer arguments quoted, - // then not containing pseudos/brackets, - // then attribute selectors/non-parenthetical expressions, - // then anything else - // These preferences are here to reduce the number of selectors - // needing tokenize in the PSEUDO preFilter - pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + characterEncoding + ")" ), - "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), - "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), - "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + - "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + - "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + - whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rsibling = /[\x20\t\r\n\f]*[+~]/, - - rnative = /^[^{]+\{\s*\[native code/, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rescape = /'|\\/g, - rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, - - // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g, - funescape = function( _, escaped ) { - var high = "0x" + escaped - 0x10000; - // NaN means non-codepoint - return high !== high ? - escaped : - // BMP codepoint - high < 0 ? - String.fromCharCode( high + 0x10000 ) : - // Supplemental Plane codepoint (surrogate pair) - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }; - -// Use a stripped-down slice if we can't use a native one -try { - slice.call( preferredDoc.documentElement.childNodes, 0 )[0].nodeType; -} catch ( e ) { - slice = function( i ) { - var elem, - results = []; - while ( (elem = this[i++]) ) { - results.push( elem ); - } - return results; - }; -} - -/** - * For feature detection - * @param {Function} fn The function to test for native support - */ -function isNative( fn ) { - return rnative.test( fn + "" ); -} - -/** - * Create key-value caches of limited size - * @returns {Function(string, Object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var cache, - keys = []; - - return (cache = function( key, value ) { - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key += " " ) > Expr.cacheLength ) { - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return (cache[ key ] = value); - }); -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created div and expects a boolean result - */ -function assert( fn ) { - var div = document.createElement("div"); - - try { - return fn( div ); - } catch (e) { - return false; - } finally { - // release memory in IE - div = null; - } -} - -function Sizzle( selector, context, results, seed ) { - var match, elem, m, nodeType, - // QSA vars - i, groups, old, nid, newContext, newSelector; - - if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { - setDocument( context ); - } - - context = context || document; - results = results || []; - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { - return []; - } - - if ( !documentIsXML && !seed ) { - - // Shortcuts - if ( (match = rquickExpr.exec( selector )) ) { - // Speed-up: Sizzle("#ID") - if ( (m = match[1]) ) { - if ( nodeType === 9 ) { - elem = context.getElementById( m ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE, Opera, and Webkit return items - // by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - } else { - // Context is not a document - if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && - contains( context, elem ) && elem.id === m ) { - results.push( elem ); - return results; - } - } - - // Speed-up: Sizzle("TAG") - } else if ( match[2] ) { - push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); - return results; - - // Speed-up: Sizzle(".CLASS") - } else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) { - push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); - return results; - } - } - - // QSA path - if ( support.qsa && !rbuggyQSA.test(selector) ) { - old = true; - nid = expando; - newContext = context; - newSelector = nodeType === 9 && selector; - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - groups = tokenize( selector ); - - if ( (old = context.getAttribute("id")) ) { - nid = old.replace( rescape, "\\$&" ); - } else { - context.setAttribute( "id", nid ); - } - nid = "[id='" + nid + "'] "; - - i = groups.length; - while ( i-- ) { - groups[i] = nid + toSelector( groups[i] ); - } - newContext = rsibling.test( selector ) && context.parentNode || context; - newSelector = groups.join(","); - } - - if ( newSelector ) { - try { - push.apply( results, slice.call( newContext.querySelectorAll( - newSelector - ), 0 ) ); - return results; - } catch(qsaError) { - } finally { - if ( !old ) { - context.removeAttribute("id"); - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * Detect xml - * @param {Element|Object} elem An element or a document - */ -isXML = Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -setDocument = Sizzle.setDocument = function( node ) { - var doc = node ? node.ownerDocument || node : preferredDoc; - - // If no document and documentElement is available, return - if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Set our document - document = doc; - docElem = doc.documentElement; - - // Support tests - documentIsXML = isXML( doc ); - - // Check if getElementsByTagName("*") returns only elements - support.tagNameNoComments = assert(function( div ) { - div.appendChild( doc.createComment("") ); - return !div.getElementsByTagName("*").length; - }); - - // Check if attributes should be retrieved by attribute nodes - support.attributes = assert(function( div ) { - div.innerHTML = ""; - var type = typeof div.lastChild.getAttribute("multiple"); - // IE8 returns a string for some attributes even when not present - return type !== "boolean" && type !== "string"; - }); - - // Check if getElementsByClassName can be trusted - support.getByClassName = assert(function( div ) { - // Opera can't find a second classname (in 9.6) - div.innerHTML = ""; - if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { - return false; - } - - // Safari 3.2 caches class attributes and doesn't catch changes - div.lastChild.className = "e"; - return div.getElementsByClassName("e").length === 2; - }); - - // Check if getElementById returns elements by name - // Check if getElementsByName privileges form controls or returns elements by ID - support.getByName = assert(function( div ) { - // Inject content - div.id = expando + 0; - div.innerHTML = "
    "; - docElem.insertBefore( div, docElem.firstChild ); - - // Test - var pass = doc.getElementsByName && - // buggy browsers will return fewer than the correct 2 - doc.getElementsByName( expando ).length === 2 + - // buggy browsers will return more than the correct 0 - doc.getElementsByName( expando + 0 ).length; - support.getIdNotName = !doc.getElementById( expando ); - - // Cleanup - docElem.removeChild( div ); - - return pass; - }); - - // IE6/7 return modified attributes - Expr.attrHandle = assert(function( div ) { - div.innerHTML = ""; - return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && - div.firstChild.getAttribute("href") === "#"; - }) ? - {} : - { - "href": function( elem ) { - return elem.getAttribute( "href", 2 ); - }, - "type": function( elem ) { - return elem.getAttribute("type"); - } - }; - - // ID find and filter - if ( support.getIdNotName ) { - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== strundefined && !documentIsXML ) { - var m = context.getElementById( id ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }; - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute("id") === attrId; - }; - }; - } else { - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== strundefined && !documentIsXML ) { - var m = context.getElementById( id ); - - return m ? - m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? - [m] : - undefined : - []; - } - }; - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); - return node && node.value === attrId; - }; - }; - } - - // Tag - Expr.find["TAG"] = support.tagNameNoComments ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== strundefined ) { - return context.getElementsByTagName( tag ); - } - } : - function( tag, context ) { - var elem, - tmp = [], - i = 0, - results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - while ( (elem = results[i++]) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - // Name - Expr.find["NAME"] = support.getByName && function( tag, context ) { - if ( typeof context.getElementsByName !== strundefined ) { - return context.getElementsByName( name ); - } - }; - - // Class - Expr.find["CLASS"] = support.getByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) { - return context.getElementsByClassName( className ); - } - }; - - // QSA and matchesSelector support - - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21), - // no need to also add to buggyMatches since matches checks buggyQSA - // A support test would require too much code (would include document ready) - rbuggyQSA = [ ":focus" ]; - - if ( (support.qsa = isNative(doc.querySelectorAll)) ) { - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert(function( div ) { - // Select is set to empty string on purpose - // This is to test IE's treatment of not explictly - // setting a boolean content attribute, - // since its presence should be enough - // http://bugs.jquery.com/ticket/12359 - div.innerHTML = ""; - - // IE8 - Some boolean attributes are not treated correctly - if ( !div.querySelectorAll("[selected]").length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":checked").length ) { - rbuggyQSA.push(":checked"); - } - }); - - assert(function( div ) { - - // Opera 10-12/IE8 - ^= $= *= and empty values - // Should not select anything - div.innerHTML = ""; - if ( div.querySelectorAll("[i^='']").length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":enabled").length ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Opera 10-11 does not throw on post-comma invalid pseudos - div.querySelectorAll("*,:x"); - rbuggyQSA.push(",.*:"); - }); - } - - if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector || - docElem.mozMatchesSelector || - docElem.webkitMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector) )) ) { - - assert(function( div ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( div, "div" ); - - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( div, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - }); - } - - rbuggyQSA = new RegExp( rbuggyQSA.join("|") ); - rbuggyMatches = new RegExp( rbuggyMatches.join("|") ); - - // Element contains another - // Purposefully does not implement inclusive descendent - // As in, an element does not contain itself - contains = isNative(docElem.contains) || docElem.compareDocumentPosition ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - )); - } : - function( a, b ) { - if ( b ) { - while ( (b = b.parentNode) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - // Document order sorting - sortOrder = docElem.compareDocumentPosition ? - function( a, b ) { - var compare; - - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) { - if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) { - if ( a === doc || contains( preferredDoc, a ) ) { - return -1; - } - if ( b === doc || contains( preferredDoc, b ) ) { - return 1; - } - return 0; - } - return compare & 4 ? -1 : 1; - } - - return a.compareDocumentPosition ? -1 : 1; - } : - function( a, b ) { - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Parentless nodes are either documents or disconnected - } else if ( !aup || !bup ) { - return a === doc ? -1 : - b === doc ? 1 : - aup ? -1 : - bup ? 1 : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( (cur = cur.parentNode) ) { - ap.unshift( cur ); - } - cur = b; - while ( (cur = cur.parentNode) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[i] === bp[i] ) { - i++; - } - - return i ? - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[i], bp[i] ) : - - // Otherwise nodes in our document sort first - ap[i] === preferredDoc ? -1 : - bp[i] === preferredDoc ? 1 : - 0; - }; - - // Always assume the presence of duplicates if sort doesn't - // pass them to our comparison function (as in Google Chrome). - hasDuplicate = false; - [0, 0].sort( sortOrder ); - support.detectDuplicates = hasDuplicate; - - return document; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - // Make sure that attribute selectors are quoted - expr = expr.replace( rattributeQuotes, "='$1']" ); - - // rbuggyQSA always contains :focus, so no need for an existence check - if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) { - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch(e) {} - } - - return Sizzle( expr, document, null, [elem] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - // Set document vars if needed - if ( ( context.ownerDocument || context ) !== document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - var val; - - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - if ( !documentIsXML ) { - name = name.toLowerCase(); - } - if ( (val = Expr.attrHandle[ name ]) ) { - return val( elem ); - } - if ( documentIsXML || support.attributes ) { - return elem.getAttribute( name ); - } - return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ? - name : - val && val.specified ? val.value : null; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -// Document sorting and removing duplicates -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - i = 1, - j = 0; - - // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( ; (elem = results[i]); i++ ) { - if ( elem === results[ i - 1 ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - return results; -}; - -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( (cur = cur.nextSibling) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -// Returns a function to use in pseudos for input types -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -// Returns a function to use in pseudos for buttons -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; -} - -// Returns a function to use in pseudos for positionals -function createPositionalPseudo( fn ) { - return markFunction(function( argument ) { - argument = +argument; - return markFunction(function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ (j = matchIndexes[i]) ] ) { - seed[j] = !(matches[j] = seed[j]); - } - } - }); - }); -} - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - // If no nodeType, this is expected to be an array - for ( ; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent for elements - // innerText usage removed for consistency of new lines (see #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - // Do not include comment or processing instruction nodes - - return ret; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[1] = match[1].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); - - if ( match[2] === "~=" ) { - match[3] = " " + match[3] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[1] = match[1].toLowerCase(); - - if ( match[1].slice( 0, 3 ) === "nth" ) { - // nth-* requires argument - if ( !match[3] ) { - Sizzle.error( match[0] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); - match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); - - // other types prohibit arguments - } else if ( match[3] ) { - Sizzle.error( match[0] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var excess, - unquoted = !match[5] && match[2]; - - if ( matchExpr["CHILD"].test( match[0] ) ) { - return null; - } - - // Accept quoted arguments as-is - if ( match[4] ) { - match[2] = match[4]; - - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && - // Get excess from tokenize (recursively) - (excess = tokenize( unquoted, true )) && - // advance to the next closing parenthesis - (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { - - // excess is a negative index - match[0] = match[0].slice( 0, excess ); - match[2] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeName ) { - if ( nodeName === "*" ) { - return function() { return true; }; - } - - nodeName = nodeName.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && - classCache( className, function( elem ) { - return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); - }); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - }; - }, - - "CHILD": function( type, what, argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, context, xml ) { - var cache, outerCache, node, diff, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( (node = node[ dir ]) ) { - if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { - return false; - } - } - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - // Seek `elem` from a previously-cached index - outerCache = parent[ expando ] || (parent[ expando ] = {}); - cache = outerCache[ type ] || []; - nodeIndex = cache[0] === dirruns && cache[1]; - diff = cache[0] === dirruns && cache[2]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( (node = ++nodeIndex && node && node[ dir ] || - - // Fallback to seeking `elem` from the start - (diff = nodeIndex = 0) || start.pop()) ) { - - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - outerCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - // Use previously-cached element index if available - } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { - diff = cache[1]; - - // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) - } else { - // Use the same loop as above to seek `elem` from the start - while ( (node = ++nodeIndex && node && node[ dir ] || - (diff = nodeIndex = 0) || start.pop()) ) { - - if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { - // Cache the index of each encountered element - if ( useCache ) { - (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction(function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf.call( seed, matched[i] ); - seed[ idx ] = !( matches[ idx ] = matched[i] ); - } - }) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - // Potentially complex pseudos - "not": markFunction(function( selector ) { - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction(function( seed, matches, context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( (elem = unmatched[i]) ) { - seed[i] = !(matches[i] = elem); - } - } - }) : - function( elem, context, xml ) { - input[0] = elem; - matcher( input, null, xml, results ); - return !results.pop(); - }; - }), - - "has": markFunction(function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - }), - - "contains": markFunction(function( text ) { - return function( elem ) { - return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; - }; - }), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { - // lang value must be a valid identifider - if ( !ridentifier.test(lang || "") ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( (elemLang = documentIsXML ? - elem.getAttribute("xml:lang") || elem.getAttribute("lang") : - elem.lang) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); - return false; - }; - }), - - // Miscellaneous - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); - }, - - // Boolean properties - "enabled": function( elem ) { - return elem.disabled === false; - }, - - "disabled": function( elem ) { - return elem.disabled === true; - }, - - "checked": function( elem ) { - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); - }, - - "selected": function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - "empty": function( elem ) { - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), - // not comment, processing instructions, or others - // Thanks to Diego Perini for the nodeName shortcut - // Greater than "@" means alpha characters (specifically not starting with "#" or "?") - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos["empty"]( elem ); - }, - - // Element/input types - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && - ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); - }, - - // Position-in-collection - "first": createPositionalPseudo(function() { - return [ 0 ]; - }), - - "last": createPositionalPseudo(function( matchIndexes, length ) { - return [ length - 1 ]; - }), - - "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - }), - - "even": createPositionalPseudo(function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "odd": createPositionalPseudo(function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }) - } -}; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -function tokenize( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || (match = rcomma.exec( soFar )) ) { - if ( match ) { - // Don't consume trailing commas as valid - soFar = soFar.slice( match[0].length ) || soFar; - } - groups.push( tokens = [] ); - } - - matched = false; - - // Combinators - if ( (match = rcombinators.exec( soFar )) ) { - matched = match.shift(); - tokens.push( { - value: matched, - // Cast descendant combinators to space - type: match[0].replace( rtrim, " " ) - } ); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || - (match = preFilters[ type ]( match ))) ) { - matched = match.shift(); - tokens.push( { - value: matched, - type: type, - matches: match - } ); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -} - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[i].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - checkNonElements = base && dir === "parentNode", - doneName = done++; - - return combinator.first ? - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var data, cache, outerCache, - dirkey = dirruns + " " + doneName; - - // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching - if ( xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || (elem[ expando ] = {}); - if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { - if ( (data = cache[1]) === true || data === cachedruns ) { - return data === true; - } - } else { - cache = outerCache[ dir ] = [ dirkey ]; - cache[1] = matcher( elem, context, xml ) || cachedruns; - if ( cache[1] === true ) { - return true; - } - } - } - } - } - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[i]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[0]; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( (elem = unmatched[i]) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction(function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( (elem = temp[i]) ) { - matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) ) { - // Restore matcherIn since elem is not yet a final match - temp.push( (matcherIn[i] = elem) ); - } - } - postFinder( null, (matcherOut = []), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) && - (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { - - seed[temp] = !(results[temp] = elem); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - }); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[0].type ], - implicitRelative = leadingRelative || Expr.relative[" "], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf.call( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - (checkContext = context).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - } ]; - - for ( ; i < len; i++ ) { - if ( (matcher = Expr.relative[ tokens[i].type ]) ) { - matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; - } else { - matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[j].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - // A counter to specify which element is currently being matched - var matcherCachedRuns = 0, - bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, expandContext ) { - var elem, j, matcher, - setMatched = [], - matchedCount = 0, - i = "0", - unmatched = seed && [], - outermost = expandContext != null, - contextBackup = outermostContext, - // We must always have either seed elements or context - elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); - - if ( outermost ) { - outermostContext = context !== document && context; - cachedruns = matcherCachedRuns; - } - - // Add elements passing elementMatchers directly to results - // Keep `i` a string if there are no elements so `matchedCount` will be "00" below - for ( ; (elem = elems[i]) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - while ( (matcher = elementMatchers[j++]) ) { - if ( matcher( elem, context, xml ) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - cachedruns = ++matcherCachedRuns; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - // They will have gone through all possible matchers - if ( (elem = !matcher && elem) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // Apply set filters to unmatched elements - matchedCount += i; - if ( bySet && i !== matchedCount ) { - j = 0; - while ( (matcher = setMatchers[j++]) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !(unmatched[i] || setMatched[i]) ) { - setMatched[i] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - Sizzle.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - // Generate a function of recursive functions that can be used to check each element - if ( !group ) { - group = tokenize( selector ); - } - i = group.length; - while ( i-- ) { - cached = matcherFromTokens( group[i] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); - } - return cached; -}; - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results ); - } - return results; -} - -function select( selector, context, results, seed ) { - var i, tokens, token, type, find, - match = tokenize( selector ); - - if ( !seed ) { - // Try to minimize operations if there is only one group - if ( match.length === 1 ) { - - // Take a shortcut and set the context if the root selector is an ID - tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - context.nodeType === 9 && !documentIsXML && - Expr.relative[ tokens[1].type ] ) { - - context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0]; - if ( !context ) { - return results; - } - - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[i]; - - // Abort if we hit a combinator - if ( Expr.relative[ (type = token.type) ] ) { - break; - } - if ( (find = Expr.find[ type ]) ) { - // Search, expanding context for leading sibling combinators - if ( (seed = find( - token.matches[0].replace( runescape, funescape ), - rsibling.test( tokens[0].type ) && context.parentNode || context - )) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, slice.call( seed, 0 ) ); - return results; - } - - break; - } - } - } - } - } - - // Compile and execute a filtering function - // Provide `match` to avoid retokenization if we modified the selector above - compile( selector, match )( - seed, - context, - documentIsXML, - results, - rsibling.test( selector ) - ); - return results; -} - -// Deprecated -Expr.pseudos["nth"] = Expr.pseudos["eq"]; - -// Easy API for creating new setFilters -function setFilters() {} -Expr.filters = setFilters.prototype = Expr.pseudos; -Expr.setFilters = new setFilters(); - -// Initialize with the default document -setDocument(); - -// Override sizzle attribute retrieval -Sizzle.attr = jQuery.attr; -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.pseudos; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})( window ); -var runtil = /Until$/, - rparentsprev = /^(?:parents|prev(?:Until|All))/, - isSimple = /^.[^:#\[\.,]*$/, - rneedsContext = jQuery.expr.match.needsContext, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var i, ret, self, - len = this.length; - - if ( typeof selector !== "string" ) { - self = this; - return this.pushStack( jQuery( selector ).filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }) ); - } - - ret = []; - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, this[ i ], ret ); - } - - // Needed because $( selector, context ) becomes $( context ).find( selector ) - ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); - ret.selector = ( this.selector ? this.selector + " " : "" ) + selector; - return ret; - }, - - has: function( target ) { - var i, - targets = jQuery( target, this ), - len = targets.length; - - return this.filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false) ); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true) ); - }, - - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - rneedsContext.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - ret = [], - pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( ; i < l; i++ ) { - cur = this[i]; - - while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - } - cur = cur.parentNode; - } - } - - return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( jQuery.unique(all) ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter(selector) - ); - } -}); - -jQuery.fn.andSelf = jQuery.fn.addBack; - -function sibling( cur, dir ) { - do { - cur = cur[ dir ]; - } while ( cur && cur.nodeType !== 1 ); - - return cur; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( this.length > 1 && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem ) { - return ( elem === qualifier ) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); -} -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, - rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, - rtagName = /<([\w:]+)/, - rtbody = /\s*$/g, - - // We have to close these tags to support XHTML (#13200) - wrapMap = { - option: [ 1, "" ], - legend: [ 1, "
    ", "
    " ], - area: [ 1, "", "" ], - param: [ 1, "", "" ], - thead: [ 1, "", "
    " ], - tr: [ 2, "", "
    " ], - col: [ 2, "", "
    " ], - td: [ 3, "", "
    " ], - - // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, - // unless wrapped in a div with non-breaking characters in front of it. - _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
    ", "
    " ] - }, - safeFragment = createSafeFragment( document ), - fragmentDiv = safeFragment.appendChild( document.createElement("div") ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -jQuery.fn.extend({ - text: function( value ) { - return jQuery.access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); - }, null, value, arguments.length ); - }, - - wrapAll: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapAll( html.call(this, i) ); - }); - } - - if ( this[0] ) { - // The elements to wrap the target around - var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); - - if ( this[0].parentNode ) { - wrap.insertBefore( this[0] ); - } - - wrap.map(function() { - var elem = this; - - while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { - elem = elem.firstChild; - } - - return elem; - }).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapInner( html.call(this, i) ); - }); - } - - return this.each(function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - }); - }, - - wrap: function( html ) { - var isFunction = jQuery.isFunction( html ); - - return this.each(function(i) { - jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); - }); - }, - - unwrap: function() { - return this.parent().each(function() { - if ( !jQuery.nodeName( this, "body" ) ) { - jQuery( this ).replaceWith( this.childNodes ); - } - }).end(); - }, - - append: function() { - return this.domManip(arguments, true, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - this.appendChild( elem ); - } - }); - }, - - prepend: function() { - return this.domManip(arguments, true, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - this.insertBefore( elem, this.firstChild ); - } - }); - }, - - before: function() { - return this.domManip( arguments, false, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - }); - }, - - after: function() { - return this.domManip( arguments, false, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - }); - }, - - // keepData is for internal use only--do not document - remove: function( selector, keepData ) { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) { - if ( !keepData && elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem ) ); - } - - if ( elem.parentNode ) { - if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { - setGlobalEval( getAll( elem, "script" ) ); - } - elem.parentNode.removeChild( elem ); - } - } - } - - return this; - }, - - empty: function() { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - } - - // Remove any remaining nodes - while ( elem.firstChild ) { - elem.removeChild( elem.firstChild ); - } - - // If this is a select, ensure that it displays empty (#12336) - // Support: IE<9 - if ( elem.options && jQuery.nodeName( elem, "select" ) ) { - elem.options.length = 0; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function () { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - }); - }, - - html: function( value ) { - return jQuery.access( this, function( value ) { - var elem = this[0] || {}, - i = 0, - l = this.length; - - if ( value === undefined ) { - return elem.nodeType === 1 ? - elem.innerHTML.replace( rinlinejQuery, "" ) : - undefined; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && - ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && - !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { - - value = value.replace( rxhtmlTag, "<$1>" ); - - try { - for (; i < l; i++ ) { - // Remove element nodes and prevent memory leaks - elem = this[i] || {}; - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch(e) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function( value ) { - var isFunc = jQuery.isFunction( value ); - - // Make sure that the elements are removed from the DOM before they are inserted - // this can help fix replacing a parent with child elements - if ( !isFunc && typeof value !== "string" ) { - value = jQuery( value ).not( this ).detach(); - } - - return this.domManip( [ value ], true, function( elem ) { - var next = this.nextSibling, - parent = this.parentNode; - - if ( parent ) { - jQuery( this ).remove(); - parent.insertBefore( elem, next ); - } - }); - }, - - detach: function( selector ) { - return this.remove( selector, true ); - }, - - domManip: function( args, table, callback ) { - - // Flatten any nested arrays - args = core_concat.apply( [], args ); - - var first, node, hasScripts, - scripts, doc, fragment, - i = 0, - l = this.length, - set = this, - iNoClone = l - 1, - value = args[0], - isFunction = jQuery.isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { - return this.each(function( index ) { - var self = set.eq( index ); - if ( isFunction ) { - args[0] = value.call( this, index, table ? self.html() : undefined ); - } - self.domManip( args, table, callback ); - }); - } - - if ( l ) { - fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - if ( first ) { - table = table && jQuery.nodeName( first, "tr" ); - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( - table && jQuery.nodeName( this[i], "table" ) ? - findOrAppend( this[i], "tbody" ) : - this[i], - node, - i - ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { - - if ( node.src ) { - // Hope ajax is available... - jQuery.ajax({ - url: node.src, - type: "GET", - dataType: "script", - async: false, - global: false, - "throws": true - }); - } else { - jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); - } - } - } - } - - // Fix #11809: Avoid leaking memory - fragment = first = null; - } - } - - return this; - } -}); - -function findOrAppend( elem, tag ) { - return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - var attr = elem.getAttributeNode("type"); - elem.type = ( attr && attr.specified ) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - var match = rscriptTypeMasked.exec( elem.type ); - if ( match ) { - elem.type = match[1]; - } else { - elem.removeAttribute("type"); - } - return elem; -} - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var elem, - i = 0; - for ( ; (elem = elems[i]) != null; i++ ) { - jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); - } -} - -function cloneCopyEvent( src, dest ) { - - if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { - return; - } - - var type, i, l, - oldData = jQuery._data( src ), - curData = jQuery._data( dest, oldData ), - events = oldData.events; - - if ( events ) { - delete curData.handle; - curData.events = {}; - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - - // make the cloned public data object a copy from the original - if ( curData.data ) { - curData.data = jQuery.extend( {}, curData.data ); - } -} - -function fixCloneNodeIssues( src, dest ) { - var nodeName, e, data; - - // We do not need to do anything for non-Elements - if ( dest.nodeType !== 1 ) { - return; - } - - nodeName = dest.nodeName.toLowerCase(); - - // IE6-8 copies events bound via attachEvent when using cloneNode. - if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) { - data = jQuery._data( dest ); - - for ( e in data.events ) { - jQuery.removeEvent( dest, e, data.handle ); - } - - // Event data gets referenced instead of copied if the expando gets copied too - dest.removeAttribute( jQuery.expando ); - } - - // IE blanks contents when cloning scripts, and tries to evaluate newly-set text - if ( nodeName === "script" && dest.text !== src.text ) { - disableScript( dest ).text = src.text; - restoreScript( dest ); - - // IE6-10 improperly clones children of object elements using classid. - // IE10 throws NoModificationAllowedError if parent is null, #12132. - } else if ( nodeName === "object" ) { - if ( dest.parentNode ) { - dest.outerHTML = src.outerHTML; - } - - // This path appears unavoidable for IE9. When cloning an object - // element in IE9, the outerHTML strategy above is not sufficient. - // If the src has innerHTML and the destination does not, - // copy the src.innerHTML into the dest.innerHTML. #10324 - if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { - dest.innerHTML = src.innerHTML; - } - - } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { - // IE6-8 fails to persist the checked state of a cloned checkbox - // or radio button. Worse, IE6-7 fail to give the cloned element - // a checked appearance if the defaultChecked value isn't also set - - dest.defaultChecked = dest.checked = src.checked; - - // IE6-7 get confused and end up setting the value of a cloned - // checkbox/radio button to an empty string instead of "on" - if ( dest.value !== src.value ) { - dest.value = src.value; - } - - // IE6-8 fails to return the selected option to the default selected - // state when cloning options - } else if ( nodeName === "option" ) { - dest.defaultSelected = dest.selected = src.defaultSelected; - - // IE6-8 fails to set the defaultValue to the correct value when - // cloning other types of input fields - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -jQuery.each({ - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - i = 0, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone(true); - jQuery( insert[i] )[ original ]( elems ); - - // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() - core_push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -}); - -function getAll( context, tag ) { - var elems, elem, - i = 0, - found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) : - typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) : - undefined; - - if ( !found ) { - for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { - if ( !tag || jQuery.nodeName( elem, tag ) ) { - found.push( elem ); - } else { - jQuery.merge( found, getAll( elem, tag ) ); - } - } - } - - return tag === undefined || tag && jQuery.nodeName( context, tag ) ? - jQuery.merge( [ context ], found ) : - found; -} - -// Used in buildFragment, fixes the defaultChecked property -function fixDefaultChecked( elem ) { - if ( manipulation_rcheckableType.test( elem.type ) ) { - elem.defaultChecked = elem.checked; - } -} - -jQuery.extend({ - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var destElements, node, clone, i, srcElements, - inPage = jQuery.contains( elem.ownerDocument, elem ); - - if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { - clone = elem.cloneNode( true ); - - // IE<=8 does not properly clone detached, unknown element nodes - } else { - fragmentDiv.innerHTML = elem.outerHTML; - fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); - } - - if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && - (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { - - // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - // Fix all IE cloning issues - for ( i = 0; (node = srcElements[i]) != null; ++i ) { - // Ensure that the destination node is not null; Fixes #9587 - if ( destElements[i] ) { - fixCloneNodeIssues( node, destElements[i] ); - } - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0; (node = srcElements[i]) != null; i++ ) { - cloneCopyEvent( node, destElements[i] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - destElements = srcElements = node = null; - - // Return the cloned set - return clone; - }, - - buildFragment: function( elems, context, scripts, selection ) { - var j, elem, contains, - tmp, tag, tbody, wrap, - l = elems.length, - - // Ensure a safe fragment - safe = createSafeFragment( context ), - - nodes = [], - i = 0; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( jQuery.type( elem ) === "object" ) { - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || safe.appendChild( context.createElement("div") ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - - tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2]; - - // Descend through wrappers to the right content - j = wrap[0]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Manually add leading whitespace removed by IE - if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { - nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); - } - - // Remove IE's autoinserted from table fragments - if ( !jQuery.support.tbody ) { - - // String was a , *may* have spurious - elem = tag === "table" && !rtbody.test( elem ) ? - tmp.firstChild : - - // String was a bare or - wrap[1] === "
    " && !rtbody.test( elem ) ? - tmp : - 0; - - j = elem && elem.childNodes.length; - while ( j-- ) { - if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { - elem.removeChild( tbody ); - } - } - } - - jQuery.merge( nodes, tmp.childNodes ); - - // Fix #12392 for WebKit and IE > 9 - tmp.textContent = ""; - - // Fix #12392 for oldIE - while ( tmp.firstChild ) { - tmp.removeChild( tmp.firstChild ); - } - - // Remember the top-level container for proper cleanup - tmp = safe.lastChild; - } - } - } - - // Fix #11356: Clear elements from fragment - if ( tmp ) { - safe.removeChild( tmp ); - } - - // Reset defaultChecked for any radios and checkboxes - // about to be appended to the DOM in IE 6/7 (#8060) - if ( !jQuery.support.appendChecked ) { - jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); - } - - i = 0; - while ( (elem = nodes[ i++ ]) ) { - - // #4087 - If origin and destination elements are the same, and this is - // that element, do not do anything - if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { - continue; - } - - contains = jQuery.contains( elem.ownerDocument, elem ); - - // Append to fragment - tmp = getAll( safe.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( contains ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( (elem = tmp[ j++ ]) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - tmp = null; - - return safe; - }, - - cleanData: function( elems, /* internal */ acceptData ) { - var elem, type, id, data, - i = 0, - internalKey = jQuery.expando, - cache = jQuery.cache, - deleteExpando = jQuery.support.deleteExpando, - special = jQuery.event.special; - - for ( ; (elem = elems[i]) != null; i++ ) { - - if ( acceptData || jQuery.acceptData( elem ) ) { - - id = elem[ internalKey ]; - data = id && cache[ id ]; - - if ( data ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Remove cache only if it was not already removed by jQuery.event.remove - if ( cache[ id ] ) { - - delete cache[ id ]; - - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( deleteExpando ) { - delete elem[ internalKey ]; - - } else if ( typeof elem.removeAttribute !== core_strundefined ) { - elem.removeAttribute( internalKey ); - - } else { - elem[ internalKey ] = null; - } - - core_deletedIds.push( id ); - } - } - } - } - } -}); -var iframe, getStyles, curCSS, - ralpha = /alpha\([^)]*\)/i, - ropacity = /opacity\s*=\s*([^)]*)/, - rposition = /^(top|right|bottom|left)$/, - // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" - // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rmargin = /^margin/, - rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), - rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), - rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), - elemdisplay = { BODY: "block" }, - - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: 0, - fontWeight: 400 - }, - - cssExpand = [ "Top", "Right", "Bottom", "Left" ], - cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; - -// return a css property mapped to a potentially vendor prefixed property -function vendorPropName( style, name ) { - - // shortcut for names that are not vendor prefixed - if ( name in style ) { - return name; - } - - // check for vendor prefixed names - var capName = name.charAt(0).toUpperCase() + name.slice(1), - origName = name, - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in style ) { - return name; - } - } - - return origName; -} - -function isHidden( elem, el ) { - // isHidden might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); -} - -function showHide( elements, show ) { - var display, elem, hidden, - values = [], - index = 0, - length = elements.length; - - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - - values[ index ] = jQuery._data( elem, "olddisplay" ); - display = elem.style.display; - if ( show ) { - // Reset the inline display of this element to learn if it is - // being hidden by cascaded rules or not - if ( !values[ index ] && display === "none" ) { - elem.style.display = ""; - } - - // Set elements which have been overridden with display: none - // in a stylesheet to whatever the default browser style is - // for such an element - if ( elem.style.display === "" && isHidden( elem ) ) { - values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); - } - } else { - - if ( !values[ index ] ) { - hidden = isHidden( elem ); - - if ( display && display !== "none" || !hidden ) { - jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); - } - } - } - } - - // Set the display of most of the elements in a second loop - // to avoid the constant reflow - for ( index = 0; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - if ( !show || elem.style.display === "none" || elem.style.display === "" ) { - elem.style.display = show ? values[ index ] || "" : "none"; - } - } - - return elements; -} - -jQuery.fn.extend({ - css: function( name, value ) { - return jQuery.access( this, function( elem, name, value ) { - var len, styles, - map = {}, - i = 0; - - if ( jQuery.isArray( name ) ) { - styles = getStyles( elem ); - len = name.length; - - for ( ; i < len; i++ ) { - map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); - } - - return map; - } - - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - }, - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); - }, - toggle: function( state ) { - var bool = typeof state === "boolean"; - - return this.each(function() { - if ( bool ? state : isHidden( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - }); - } -}); - -jQuery.extend({ - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - } - } - } - }, - - // Exclude the following css properties to add px - cssNumber: { - "columnCount": true, - "fillOpacity": true, - "fontWeight": true, - "lineHeight": true, - "opacity": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: { - // normalize float css property - "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" - }, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = jQuery.camelCase( name ), - style = elem.style; - - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // convert relative number strings (+= or -=) to relative numbers. #7345 - if ( type === "string" && (ret = rrelNum.exec( value )) ) { - value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); - // Fixes bug #9237 - type = "number"; - } - - // Make sure that NaN and null values aren't set. See: #7116 - if ( value == null || type === "number" && isNaN( value ) ) { - return; - } - - // If a number was passed in, add 'px' to the (except for certain CSS properties) - if ( type === "number" && !jQuery.cssNumber[ origName ] ) { - value += "px"; - } - - // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, - // but it would mean to define eight (for every problematic property) identical functions - if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { - style[ name ] = "inherit"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { - - // Wrapped to prevent IE from throwing errors when 'invalid' values are provided - // Fixes bug #5509 - try { - style[ name ] = value; - } catch(e) {} - } - - } else { - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra, styles ) { - var num, val, hooks, - origName = jQuery.camelCase( name ); - - // Make sure that we're working with the right name - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name, styles ); - } - - //convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Return, converting to number if forced or a qualifier was provided and val looks numeric - if ( extra === "" || extra ) { - num = parseFloat( val ); - return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; - } - return val; - }, - - // A method for quickly swapping in/out CSS properties to get correct calculations - swap: function( elem, options, callback, args ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.apply( elem, args || [] ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; - } -}); - -// NOTE: we've included the "window" in window.getComputedStyle -// because jsdom on node.js will break without it. -if ( window.getComputedStyle ) { - getStyles = function( elem ) { - return window.getComputedStyle( elem, null ); - }; - - curCSS = function( elem, name, _computed ) { - var width, minWidth, maxWidth, - computed = _computed || getStyles( elem ), - - // getPropertyValue is only needed for .css('filter') in IE9, see #12537 - ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, - style = elem.style; - - if ( computed ) { - - if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { - ret = jQuery.style( elem, name ); - } - - // A tribute to the "awesome hack by Dean Edwards" - // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right - // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels - // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values - if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { - - // Remember the original values - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - // Put in the new values to get a computed value out - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - // Revert the changed values - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret; - }; -} else if ( document.documentElement.currentStyle ) { - getStyles = function( elem ) { - return elem.currentStyle; - }; - - curCSS = function( elem, name, _computed ) { - var left, rs, rsLeft, - computed = _computed || getStyles( elem ), - ret = computed ? computed[ name ] : undefined, - style = elem.style; - - // Avoid setting ret to empty string here - // so we don't default to auto - if ( ret == null && style && style[ name ] ) { - ret = style[ name ]; - } - - // From the awesome hack by Dean Edwards - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - - // If we're not dealing with a regular pixel number - // but a number that has a weird ending, we need to convert it to pixels - // but not position css attributes, as those are proportional to the parent element instead - // and we can't measure the parent instead because it might trigger a "stacking dolls" problem - if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { - - // Remember the original values - left = style.left; - rs = elem.runtimeStyle; - rsLeft = rs && rs.left; - - // Put in the new values to get a computed value out - if ( rsLeft ) { - rs.left = elem.currentStyle.left; - } - style.left = name === "fontSize" ? "1em" : ret; - ret = style.pixelLeft + "px"; - - // Revert the changed values - style.left = left; - if ( rsLeft ) { - rs.left = rsLeft; - } - } - - return ret === "" ? "auto" : ret; - }; -} - -function setPositiveNumber( elem, value, subtract ) { - var matches = rnumsplit.exec( value ); - return matches ? - // Guard against undefined "subtract", e.g., when used as in cssHooks - Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : - value; -} - -function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { - var i = extra === ( isBorderBox ? "border" : "content" ) ? - // If we already have the right measurement, avoid augmentation - 4 : - // Otherwise initialize for horizontal or vertical properties - name === "width" ? 1 : 0, - - val = 0; - - for ( ; i < 4; i += 2 ) { - // both box models exclude margin, so add it if we want it - if ( extra === "margin" ) { - val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); - } - - if ( isBorderBox ) { - // border-box includes padding, so remove it if we want content - if ( extra === "content" ) { - val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } - - // at this point, extra isn't border nor margin, so remove border - if ( extra !== "margin" ) { - val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } else { - // at this point, extra isn't content, so add padding - val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - - // at this point, extra isn't content nor padding, so add border - if ( extra !== "padding" ) { - val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } - } - - return val; -} - -function getWidthOrHeight( elem, name, extra ) { - - // Start with offset property, which is equivalent to the border-box value - var valueIsBorderBox = true, - val = name === "width" ? elem.offsetWidth : elem.offsetHeight, - styles = getStyles( elem ), - isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; - - // some non-html elements return undefined for offsetWidth, so check for null/undefined - // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 - // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 - if ( val <= 0 || val == null ) { - // Fall back to computed then uncomputed css if necessary - val = curCSS( elem, name, styles ); - if ( val < 0 || val == null ) { - val = elem.style[ name ]; - } - - // Computed unit is not pixels. Stop here and return. - if ( rnumnonpx.test(val) ) { - return val; - } - - // we need the check for style in case a browser which returns unreliable values - // for getComputedStyle silently falls back to the reliable elem.style - valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); - - // Normalize "", auto, and prepare for extra - val = parseFloat( val ) || 0; - } - - // use the active box-sizing model to add/subtract irrelevant styles - return ( val + - augmentWidthOrHeight( - elem, - name, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox, - styles - ) - ) + "px"; -} - -// Try to determine the default display value of an element -function css_defaultDisplay( nodeName ) { - var doc = document, - display = elemdisplay[ nodeName ]; - - if ( !display ) { - display = actualDisplay( nodeName, doc ); - - // If the simple way fails, read from inside an iframe - if ( display === "none" || !display ) { - // Use the already-created iframe if possible - iframe = ( iframe || - jQuery("