From bd14f14709d986920ec08bb997e623ec6f24654f Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Fri, 24 Jun 2016 20:36:00 -0700 Subject: [PATCH 01/97] Rename @plugin to @use extensions --- .../importer.js} | 13 ++++++------ lib/less/import-manager.js | 8 ++++---- lib/less/index.js | 2 +- lib/less/parser/parser.js | 20 +++++++++++-------- lib/less/tree/import.js | 4 ++-- lib/less/visitors/import-visitor.js | 4 ++-- package.json | 2 +- test/less/errors/functions-1.less | 2 +- test/less/errors/functions-1.txt | 2 +- test/less/errors/functions-10-keyword.less | 2 +- test/less/errors/functions-10-keyword.txt | 2 +- test/less/errors/functions-11-operation.less | 2 +- test/less/errors/functions-11-operation.txt | 2 +- test/less/errors/functions-12-quoted.less | 2 +- test/less/errors/functions-12-quoted.txt | 2 +- test/less/errors/functions-13-selector.less | 2 +- test/less/errors/functions-13-selector.txt | 2 +- test/less/errors/functions-14-url.less | 2 +- test/less/errors/functions-14-url.txt | 2 +- test/less/errors/functions-15-value.less | 2 +- test/less/errors/functions-15-value.txt | 2 +- test/less/errors/functions-16-old-syntax.less | 1 + test/less/errors/functions-16-old-syntax.txt | 2 ++ test/less/errors/functions-2-alpha.less | 2 +- test/less/errors/functions-2-alpha.txt | 2 +- test/less/errors/functions-3-assignment.less | 2 +- test/less/errors/functions-3-assignment.txt | 2 +- test/less/errors/functions-4-call.less | 2 +- test/less/errors/functions-4-call.txt | 2 +- test/less/errors/functions-5-color.less | 2 +- test/less/errors/functions-5-color.txt | 2 +- test/less/errors/functions-6-condition.less | 2 +- test/less/errors/functions-6-condition.txt | 2 +- test/less/errors/functions-7-dimension.less | 2 +- test/less/errors/functions-7-dimension.txt | 2 +- test/less/errors/functions-8-element.less | 2 +- test/less/errors/functions-8-element.txt | 2 +- test/less/errors/functions-9-expression.less | 2 +- test/less/errors/functions-9-expression.txt | 2 +- test/less/errors/root-func-undefined-2.less | 2 +- test/less/errors/root-func-undefined-2.txt | 2 +- .../extension-global.js} | 0 .../extension-local.js} | 0 .../extension-transitive.js} | 0 .../extension-transitive.less} | 2 +- .../extension-tree-nodes.js} | 0 test/less/plugin.less | 16 +++++++-------- 47 files changed, 73 insertions(+), 65 deletions(-) rename lib/less/{plugins/function-importer.js => extension/importer.js} (56%) create mode 100644 test/less/errors/functions-16-old-syntax.less create mode 100644 test/less/errors/functions-16-old-syntax.txt rename test/less/{plugin/plugin-global.js => extension/extension-global.js} (100%) rename test/less/{plugin/plugin-local.js => extension/extension-local.js} (100%) rename test/less/{plugin/plugin-transitive.js => extension/extension-transitive.js} (100%) rename test/less/{plugin/plugin-transitive.less => extension/extension-transitive.less} (57%) rename test/less/{plugin/plugin-tree-nodes.js => extension/extension-tree-nodes.js} (100%) diff --git a/lib/less/plugins/function-importer.js b/lib/less/extension/importer.js similarity index 56% rename from lib/less/plugins/function-importer.js rename to lib/less/extension/importer.js index b863998b2..aba57f59a 100644 --- a/lib/less/plugins/function-importer.js +++ b/lib/less/extension/importer.js @@ -1,11 +1,12 @@ var LessError = require('../less-error'), - tree = require("../tree"); + tree = require("../tree"), + less = require("../."); -var FunctionImporter = module.exports = function FunctionImporter(context, fileInfo) { +var ExtensionImporter = module.exports = function ExtensionImporter(context, fileInfo) { this.fileInfo = fileInfo; }; -FunctionImporter.prototype.eval = function(contents, callback) { +ExtensionImporter.prototype.eval = function(contents, callback) { var loaded = {}, loader, registry; @@ -22,11 +23,11 @@ FunctionImporter.prototype.eval = function(contents, callback) { }; try { - loader = new Function("functions", "tree", "fileInfo", contents); - loader(registry, tree, this.fileInfo); + loader = new Function("functions", "tree", "fileInfo", "less", contents); + loader(registry, tree, this.fileInfo, less); } catch(e) { callback(new LessError({ - message: "Plugin evaluation error: '" + e.name + ': ' + e.message.replace(/["]/g, "'") + "'" , + message: "Extension evaluation error: '" + e.name + ': ' + e.message.replace(/["]/g, "'") + "'" , filename: this.fileInfo.filename }), null ); } diff --git a/lib/less/import-manager.js b/lib/less/import-manager.js index 79d2f3fec..b758a0d44 100644 --- a/lib/less/import-manager.js +++ b/lib/less/import-manager.js @@ -1,6 +1,6 @@ var contexts = require("./contexts"), Parser = require('./parser/parser'), - FunctionImporter = require('./plugins/function-importer'); + ExtensionImporter = require('./extension/importer'); module.exports = function(environment) { @@ -66,7 +66,7 @@ module.exports = function(environment) { } if (tryAppendLessExtension) { - path = fileManager.tryAppendExtension(path, importOptions.plugin ? ".js" : ".less"); + path = fileManager.tryAppendExtension(path, importOptions.isExtension ? ".js" : ".less"); } var loadFileCallback = function(loadedFile) { @@ -102,8 +102,8 @@ module.exports = function(environment) { newFileInfo.reference = true; } - if (importOptions.plugin) { - new FunctionImporter(newEnv, newFileInfo).eval(contents, function (e, root) { + if (importOptions.isExtension) { + new ExtensionImporter(newEnv, newFileInfo).eval(contents, function (e, root) { fileParsedFunc(e, root, resolvedFilename); }); } else if (importOptions.inline) { diff --git a/lib/less/index.js b/lib/less/index.js index b9574cabf..1ea563318 100644 --- a/lib/less/index.js +++ b/lib/less/index.js @@ -2,7 +2,7 @@ module.exports = function(environment, fileManagers) { var SourceMapOutput, SourceMapBuilder, ParseTree, ImportManager, Environment; var less = { - version: [2, 7, 1], + version: [2, 8, 0], data: require('./data'), tree: require('./tree'), Environment: (Environment = require("./environment/environment")), diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js index 02618d36f..e84f5fc63 100644 --- a/lib/less/parser/parser.js +++ b/lib/less/parser/parser.js @@ -1384,35 +1384,39 @@ var Parser = function Parser(context, imports, fileInfo) { }, // - // A @plugin directive, used to import compiler extensions dynamically. + // A @use directive, used to import scoped extensions dynamically. // - // @plugin "lib"; + // @use "lib"; // // Depending on our environment, importing is done differently: // In the browser, it's an XHR request, in Node, it would be a // file-system operation. The function used for importing is // stored in `import`, which we pass to the Import constructor. // - plugin: function () { + extension: function () { var path, index = parserInput.i, - dir = parserInput.$re(/^@plugin?\s+/); + dir = parserInput.$re(/^@use?|@plugin?\s+/); + if (dir && dir.indexOf("@p") > -1) { + parserInput.i -= dir.length; + return error('@plugin is deprecated. Use @use'); + } if (dir) { - var options = { plugin : true }; + var options = { isExtension : true }; if ((path = this.entities.quoted() || this.entities.url())) { if (!parserInput.$char(';')) { parserInput.i = index; - error("missing semi-colon on plugin"); + error("missing semi-colon on @use"); } return new(tree.Import)(path, null, options, index, fileInfo); } else { parserInput.i = index; - error("malformed plugin statement"); + error("malformed @use statement"); } } }, @@ -1428,7 +1432,7 @@ var Parser = function Parser(context, imports, fileInfo) { if (parserInput.currentChar() !== '@') { return; } - value = this['import']() || this.plugin() || this.media(); + value = this['import']() || this.extension() || this.media(); if (value) { return value; } diff --git a/lib/less/tree/import.js b/lib/less/tree/import.js index 3787b052b..4b53e61cd 100644 --- a/lib/less/tree/import.js +++ b/lib/less/tree/import.js @@ -52,7 +52,7 @@ Import.prototype.accept = function (visitor) { this.features = visitor.visit(this.features); } this.path = visitor.visit(this.path); - if (!this.options.plugin && !this.options.inline && this.root) { + if (!this.options.isExtension && !this.options.inline && this.root) { this.root = visitor.visit(this.root); } }; @@ -126,7 +126,7 @@ Import.prototype.doEval = function (context) { var ruleset, registry, features = this.features && this.features.eval(context); - if (this.options.plugin) { + if (this.options.isExtension) { registry = context.frames[0] && context.frames[0].functionRegistry; if ( registry && this.root && this.root.functions ) { registry.addMultiple( this.root.functions ); diff --git a/lib/less/visitors/import-visitor.js b/lib/less/visitors/import-visitor.js index 8af0b8928..99464522c 100644 --- a/lib/less/visitors/import-visitor.js +++ b/lib/less/visitors/import-visitor.js @@ -103,7 +103,7 @@ ImportVisitor.prototype = { var importVisitor = this, inlineCSS = importNode.options.inline, - isPlugin = importNode.options.plugin, + isExtension = importNode.options.isExtension, isOptional = importNode.options.optional, duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector; @@ -129,7 +129,7 @@ ImportVisitor.prototype = { importNode.root = root; importNode.importedFilename = fullPath; - if (!inlineCSS && !isPlugin && (context.importMultiple || !duplicateImport)) { + if (!inlineCSS && !isExtension && (context.importMultiple || !duplicateImport)) { importVisitor.recursionDetector[fullPath] = true; var oldContext = this.context; diff --git a/package.json b/package.json index 871a44745..b44a99934 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "less", - "version": "2.7.1", + "version": "2.8.0", "description": "Leaner CSS", "homepage": "http://lesscss.org", "author": { diff --git a/test/less/errors/functions-1.less b/test/less/errors/functions-1.less index f502aa276..942be1d06 100644 --- a/test/less/errors/functions-1.less +++ b/test/less/errors/functions-1.less @@ -1,2 +1,2 @@ -@plugin "../plugin/plugin-tree-nodes"; +@use "../extension/extension-tree-nodes"; test-undefined(); \ No newline at end of file diff --git a/test/less/errors/functions-1.txt b/test/less/errors/functions-1.txt index abeb4bda5..61227a2b0 100644 --- a/test/less/errors/functions-1.txt +++ b/test/less/errors/functions-1.txt @@ -1,3 +1,3 @@ SyntaxError: Function 'test-undefined' is undefined in {path}functions-1.less on line 2, column 1: -1 @plugin "../plugin/plugin-tree-nodes"; +1 @use "../extension/extension-tree-nodes"; 2 test-undefined(); diff --git a/test/less/errors/functions-10-keyword.less b/test/less/errors/functions-10-keyword.less index 16d0b9858..e85a35e1f 100644 --- a/test/less/errors/functions-10-keyword.less +++ b/test/less/errors/functions-10-keyword.less @@ -1,2 +1,2 @@ -@plugin "../plugin/plugin-tree-nodes"; +@use "../extension/extension-tree-nodes"; test-keyword(); \ No newline at end of file diff --git a/test/less/errors/functions-10-keyword.txt b/test/less/errors/functions-10-keyword.txt index dabe839d6..efadbeb01 100644 --- a/test/less/errors/functions-10-keyword.txt +++ b/test/less/errors/functions-10-keyword.txt @@ -1,3 +1,3 @@ SyntaxError: Keyword node returned by a function is not valid here in {path}functions-10-keyword.less on line 2, column 1: -1 @plugin "../plugin/plugin-tree-nodes"; +1 @use "../extension/extension-tree-nodes"; 2 test-keyword(); diff --git a/test/less/errors/functions-11-operation.less b/test/less/errors/functions-11-operation.less index 5695bdb91..e370c54a4 100644 --- a/test/less/errors/functions-11-operation.less +++ b/test/less/errors/functions-11-operation.less @@ -1,2 +1,2 @@ -@plugin "../plugin/plugin-tree-nodes"; +@use "../extension/extension-tree-nodes"; test-operation(); \ No newline at end of file diff --git a/test/less/errors/functions-11-operation.txt b/test/less/errors/functions-11-operation.txt index 27287179c..c8cba0cb3 100644 --- a/test/less/errors/functions-11-operation.txt +++ b/test/less/errors/functions-11-operation.txt @@ -1,3 +1,3 @@ SyntaxError: Operation node returned by a function is not valid here in {path}functions-11-operation.less on line 2, column 1: -1 @plugin "../plugin/plugin-tree-nodes"; +1 @use "../extension/extension-tree-nodes"; 2 test-operation(); diff --git a/test/less/errors/functions-12-quoted.less b/test/less/errors/functions-12-quoted.less index d35be8710..8ea74bb3b 100644 --- a/test/less/errors/functions-12-quoted.less +++ b/test/less/errors/functions-12-quoted.less @@ -1,2 +1,2 @@ -@plugin "../plugin/plugin-tree-nodes"; +@use "../extension/extension-tree-nodes"; test-quoted(); \ No newline at end of file diff --git a/test/less/errors/functions-12-quoted.txt b/test/less/errors/functions-12-quoted.txt index 45c62ea64..6be7951a8 100644 --- a/test/less/errors/functions-12-quoted.txt +++ b/test/less/errors/functions-12-quoted.txt @@ -1,3 +1,3 @@ SyntaxError: Quoted node returned by a function is not valid here in {path}functions-12-quoted.less on line 2, column 1: -1 @plugin "../plugin/plugin-tree-nodes"; +1 @use "../extension/extension-tree-nodes"; 2 test-quoted(); diff --git a/test/less/errors/functions-13-selector.less b/test/less/errors/functions-13-selector.less index 2fd879c60..b830054bd 100644 --- a/test/less/errors/functions-13-selector.less +++ b/test/less/errors/functions-13-selector.less @@ -1,2 +1,2 @@ -@plugin "../plugin/plugin-tree-nodes"; +@use "../extension/extension-tree-nodes"; test-selector(); \ No newline at end of file diff --git a/test/less/errors/functions-13-selector.txt b/test/less/errors/functions-13-selector.txt index 2f4b097f2..987868b61 100644 --- a/test/less/errors/functions-13-selector.txt +++ b/test/less/errors/functions-13-selector.txt @@ -1,3 +1,3 @@ SyntaxError: Selector node returned by a function is not valid here in {path}functions-13-selector.less on line 2, column 1: -1 @plugin "../plugin/plugin-tree-nodes"; +1 @use "../extension/extension-tree-nodes"; 2 test-selector(); diff --git a/test/less/errors/functions-14-url.less b/test/less/errors/functions-14-url.less index bed6dabff..b40af7dd7 100644 --- a/test/less/errors/functions-14-url.less +++ b/test/less/errors/functions-14-url.less @@ -1,2 +1,2 @@ -@plugin "../plugin/plugin-tree-nodes"; +@use "../extension/extension-tree-nodes"; test-url(); \ No newline at end of file diff --git a/test/less/errors/functions-14-url.txt b/test/less/errors/functions-14-url.txt index aeb275cab..11283de02 100644 --- a/test/less/errors/functions-14-url.txt +++ b/test/less/errors/functions-14-url.txt @@ -1,3 +1,3 @@ SyntaxError: Url node returned by a function is not valid here in {path}functions-14-url.less on line 2, column 1: -1 @plugin "../plugin/plugin-tree-nodes"; +1 @use "../extension/extension-tree-nodes"; 2 test-url(); diff --git a/test/less/errors/functions-15-value.less b/test/less/errors/functions-15-value.less index 189ce1967..6ec4a1ec1 100644 --- a/test/less/errors/functions-15-value.less +++ b/test/less/errors/functions-15-value.less @@ -1,2 +1,2 @@ -@plugin "../plugin/plugin-tree-nodes"; +@use "../extension/extension-tree-nodes"; test-value(); \ No newline at end of file diff --git a/test/less/errors/functions-15-value.txt b/test/less/errors/functions-15-value.txt index 41f6e6a17..8dee3692c 100644 --- a/test/less/errors/functions-15-value.txt +++ b/test/less/errors/functions-15-value.txt @@ -1,3 +1,3 @@ SyntaxError: Value node returned by a function is not valid here in {path}functions-15-value.less on line 2, column 1: -1 @plugin "../plugin/plugin-tree-nodes"; +1 @use "../extension/extension-tree-nodes"; 2 test-value(); diff --git a/test/less/errors/functions-16-old-syntax.less b/test/less/errors/functions-16-old-syntax.less new file mode 100644 index 000000000..2d05b37ec --- /dev/null +++ b/test/less/errors/functions-16-old-syntax.less @@ -0,0 +1 @@ +@plugin "../extension/extension-tree-nodes"; \ No newline at end of file diff --git a/test/less/errors/functions-16-old-syntax.txt b/test/less/errors/functions-16-old-syntax.txt new file mode 100644 index 000000000..d548c82bd --- /dev/null +++ b/test/less/errors/functions-16-old-syntax.txt @@ -0,0 +1,2 @@ +SyntaxError: @plugin is deprecated. Use @use in {path}functions-16-old-syntax.less on line 1, column 1: +1 @plugin "../extension/extension-tree-nodes"; diff --git a/test/less/errors/functions-2-alpha.less b/test/less/errors/functions-2-alpha.less index f00da0788..5f4271da7 100644 --- a/test/less/errors/functions-2-alpha.less +++ b/test/less/errors/functions-2-alpha.less @@ -1,2 +1,2 @@ -@plugin "../plugin/plugin-tree-nodes"; +@use "../extension/extension-tree-nodes"; test-alpha(); \ No newline at end of file diff --git a/test/less/errors/functions-2-alpha.txt b/test/less/errors/functions-2-alpha.txt index 38a172731..3e0935112 100644 --- a/test/less/errors/functions-2-alpha.txt +++ b/test/less/errors/functions-2-alpha.txt @@ -1,3 +1,3 @@ SyntaxError: Alpha node returned by a function is not valid here in {path}functions-2-alpha.less on line 2, column 1: -1 @plugin "../plugin/plugin-tree-nodes"; +1 @use "../extension/extension-tree-nodes"; 2 test-alpha(); diff --git a/test/less/errors/functions-3-assignment.less b/test/less/errors/functions-3-assignment.less index fe7f5ade4..b65dfc48b 100644 --- a/test/less/errors/functions-3-assignment.less +++ b/test/less/errors/functions-3-assignment.less @@ -1,2 +1,2 @@ -@plugin "../plugin/plugin-tree-nodes"; +@use "../extension/extension-tree-nodes"; test-assignment(); \ No newline at end of file diff --git a/test/less/errors/functions-3-assignment.txt b/test/less/errors/functions-3-assignment.txt index 35c199265..eb1c6591c 100644 --- a/test/less/errors/functions-3-assignment.txt +++ b/test/less/errors/functions-3-assignment.txt @@ -1,3 +1,3 @@ SyntaxError: Assignment node returned by a function is not valid here in {path}functions-3-assignment.less on line 2, column 1: -1 @plugin "../plugin/plugin-tree-nodes"; +1 @use "../extension/extension-tree-nodes"; 2 test-assignment(); diff --git a/test/less/errors/functions-4-call.less b/test/less/errors/functions-4-call.less index 6b55c88a7..071b8e6ee 100644 --- a/test/less/errors/functions-4-call.less +++ b/test/less/errors/functions-4-call.less @@ -1,2 +1,2 @@ -@plugin "../plugin/plugin-tree-nodes"; +@use "../extension/extension-tree-nodes"; test-call(); \ No newline at end of file diff --git a/test/less/errors/functions-4-call.txt b/test/less/errors/functions-4-call.txt index 338582d7c..56157ba9b 100644 --- a/test/less/errors/functions-4-call.txt +++ b/test/less/errors/functions-4-call.txt @@ -1,3 +1,3 @@ SyntaxError: Function 'foo' is undefined in {path}functions-4-call.less on line 2, column 1: -1 @plugin "../plugin/plugin-tree-nodes"; +1 @use "../extension/extension-tree-nodes"; 2 test-call(); diff --git a/test/less/errors/functions-5-color.less b/test/less/errors/functions-5-color.less index 700ec5b92..16789a42c 100644 --- a/test/less/errors/functions-5-color.less +++ b/test/less/errors/functions-5-color.less @@ -1,2 +1,2 @@ -@plugin "../plugin/plugin-tree-nodes"; +@use "../extension/extension-tree-nodes"; test-color(); \ No newline at end of file diff --git a/test/less/errors/functions-5-color.txt b/test/less/errors/functions-5-color.txt index fdcd1a08a..74beb7769 100644 --- a/test/less/errors/functions-5-color.txt +++ b/test/less/errors/functions-5-color.txt @@ -1,3 +1,3 @@ SyntaxError: Color node returned by a function is not valid here in {path}functions-5-color.less on line 2, column 1: -1 @plugin "../plugin/plugin-tree-nodes"; +1 @use "../extension/extension-tree-nodes"; 2 test-color(); diff --git a/test/less/errors/functions-6-condition.less b/test/less/errors/functions-6-condition.less index db1000b83..660eba1c0 100644 --- a/test/less/errors/functions-6-condition.less +++ b/test/less/errors/functions-6-condition.less @@ -1,2 +1,2 @@ -@plugin "../plugin/plugin-tree-nodes"; +@use "../extension/extension-tree-nodes"; test-condition(); \ No newline at end of file diff --git a/test/less/errors/functions-6-condition.txt b/test/less/errors/functions-6-condition.txt index 421bba5f5..b169714a7 100644 --- a/test/less/errors/functions-6-condition.txt +++ b/test/less/errors/functions-6-condition.txt @@ -1,3 +1,3 @@ SyntaxError: Condition node returned by a function is not valid here in {path}functions-6-condition.less on line 2, column 1: -1 @plugin "../plugin/plugin-tree-nodes"; +1 @use "../extension/extension-tree-nodes"; 2 test-condition(); diff --git a/test/less/errors/functions-7-dimension.less b/test/less/errors/functions-7-dimension.less index c399d33e2..f788151d7 100644 --- a/test/less/errors/functions-7-dimension.less +++ b/test/less/errors/functions-7-dimension.less @@ -1,2 +1,2 @@ -@plugin "../plugin/plugin-tree-nodes"; +@use "../extension/extension-tree-nodes"; test-dimension(); \ No newline at end of file diff --git a/test/less/errors/functions-7-dimension.txt b/test/less/errors/functions-7-dimension.txt index 3b1b7026c..6e7c584fb 100644 --- a/test/less/errors/functions-7-dimension.txt +++ b/test/less/errors/functions-7-dimension.txt @@ -1,3 +1,3 @@ SyntaxError: Dimension node returned by a function is not valid here in {path}functions-7-dimension.less on line 2, column 1: -1 @plugin "../plugin/plugin-tree-nodes"; +1 @use "../extension/extension-tree-nodes"; 2 test-dimension(); diff --git a/test/less/errors/functions-8-element.less b/test/less/errors/functions-8-element.less index c762aad81..16c9d3938 100644 --- a/test/less/errors/functions-8-element.less +++ b/test/less/errors/functions-8-element.less @@ -1,2 +1,2 @@ -@plugin "../plugin/plugin-tree-nodes"; +@use "../extension/extension-tree-nodes"; test-element(); \ No newline at end of file diff --git a/test/less/errors/functions-8-element.txt b/test/less/errors/functions-8-element.txt index b505d9543..c38a2bf8a 100644 --- a/test/less/errors/functions-8-element.txt +++ b/test/less/errors/functions-8-element.txt @@ -1,3 +1,3 @@ SyntaxError: Element node returned by a function is not valid here in {path}functions-8-element.less on line 2, column 1: -1 @plugin "../plugin/plugin-tree-nodes"; +1 @use "../extension/extension-tree-nodes"; 2 test-element(); diff --git a/test/less/errors/functions-9-expression.less b/test/less/errors/functions-9-expression.less index 5f0bf46c4..da66c89e4 100644 --- a/test/less/errors/functions-9-expression.less +++ b/test/less/errors/functions-9-expression.less @@ -1,2 +1,2 @@ -@plugin "../plugin/plugin-tree-nodes"; +@use "../extension/extension-tree-nodes"; test-expression(); \ No newline at end of file diff --git a/test/less/errors/functions-9-expression.txt b/test/less/errors/functions-9-expression.txt index 224db785e..d7d7d2c43 100644 --- a/test/less/errors/functions-9-expression.txt +++ b/test/less/errors/functions-9-expression.txt @@ -1,3 +1,3 @@ SyntaxError: Expression node returned by a function is not valid here in {path}functions-9-expression.less on line 2, column 1: -1 @plugin "../plugin/plugin-tree-nodes"; +1 @use "../extension/extension-tree-nodes"; 2 test-expression(); diff --git a/test/less/errors/root-func-undefined-2.less b/test/less/errors/root-func-undefined-2.less index ee34616e1..eb934f7ca 100644 --- a/test/less/errors/root-func-undefined-2.less +++ b/test/less/errors/root-func-undefined-2.less @@ -1,2 +1,2 @@ -@plugin "../plugin/plugin-tree-nodes.js"; +@use "../extension/extension-tree-nodes.js"; test-undefined(); \ No newline at end of file diff --git a/test/less/errors/root-func-undefined-2.txt b/test/less/errors/root-func-undefined-2.txt index 031385d01..fb7a39f6f 100644 --- a/test/less/errors/root-func-undefined-2.txt +++ b/test/less/errors/root-func-undefined-2.txt @@ -1,3 +1,3 @@ SyntaxError: Function 'test-undefined' is undefined in {path}root-func-undefined-2.less on line 2, column 1: -1 @plugin "../plugin/plugin-tree-nodes.js"; +1 @use "../extension/extension-tree-nodes.js"; 2 test-undefined(); diff --git a/test/less/plugin/plugin-global.js b/test/less/extension/extension-global.js similarity index 100% rename from test/less/plugin/plugin-global.js rename to test/less/extension/extension-global.js diff --git a/test/less/plugin/plugin-local.js b/test/less/extension/extension-local.js similarity index 100% rename from test/less/plugin/plugin-local.js rename to test/less/extension/extension-local.js diff --git a/test/less/plugin/plugin-transitive.js b/test/less/extension/extension-transitive.js similarity index 100% rename from test/less/plugin/plugin-transitive.js rename to test/less/extension/extension-transitive.js diff --git a/test/less/plugin/plugin-transitive.less b/test/less/extension/extension-transitive.less similarity index 57% rename from test/less/plugin/plugin-transitive.less rename to test/less/extension/extension-transitive.less index 8e4ca00bb..e3268f824 100644 --- a/test/less/plugin/plugin-transitive.less +++ b/test/less/extension/extension-transitive.less @@ -1,4 +1,4 @@ -@plugin "plugin-transitive"; +@use "extension-transitive"; .other { trans : test-transitive(); diff --git a/test/less/plugin/plugin-tree-nodes.js b/test/less/extension/extension-tree-nodes.js similarity index 100% rename from test/less/plugin/plugin-tree-nodes.js rename to test/less/extension/extension-tree-nodes.js diff --git a/test/less/plugin.less b/test/less/plugin.less index 66775ea9f..b7caa99ef 100644 --- a/test/less/plugin.less +++ b/test/less/plugin.less @@ -1,8 +1,8 @@ // importing plugin globally -@plugin "./plugin/plugin-global"; +@use "./extension/extension-global"; // transitively include plugins from importing another sheet -@import "./plugin/plugin-transitive"; +@import "./extension/extension-transitive"; // `test-global` function should be reachable @@ -18,7 +18,7 @@ // `test-local` function should be reachable // `test-shadow` function should return local version, shadowing global version .local { - @plugin "./plugin/plugin-local"; + @use "./extension/extension-local"; global : test-global(); local : test-local(); shadow : test-shadow(); @@ -28,19 +28,19 @@ // calling a mixin or detached ruleset should not bubble local plugins // imported inside either into the parent scope. .mixin() { - @plugin "./plugin/plugin-local"; + @use "./extension/extension-local"; mixin-local : test-local(); mixin-global : test-global(); mixin-shadow : test-shadow(); } @ruleset : { - @plugin "./plugin/plugin-local"; + @use "./extension/extension-local"; ruleset-local : test-local(); ruleset-global : test-global(); ruleset-shadow : test-shadow(); }; #ns { - @plugin "./plugin/plugin-local"; + @use "./extension/extension-local"; .mixin() { ns-mixin-global : test-global(); ns-mixin-local : test-local(); @@ -76,12 +76,12 @@ .test { @media screen { - @plugin "./plugin/plugin-local"; + @use "./extension/extension-local"; result : test-local(); } } -@plugin "./plugin/plugin-tree-nodes"; +@use "./extension/extension-tree-nodes"; @ruleset2: test-detached-ruleset(); .root { @ruleset2(); From a1c08857e446216faf24a3f55c7301c8fedf7443 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Fri, 1 Jul 2016 14:39:52 -0700 Subject: [PATCH 02/97] Add AbstractPluginLoader to create a cross-platform abstraction for loading plugins by name --- lib/less-browser/index.js | 1 + lib/less-browser/plugin-loader.js | 39 +++++ lib/less-node/plugin-loader.js | 109 +++++++------ .../environment/abstract-plugin-loader.js | 143 ++++++++++++++++++ 4 files changed, 234 insertions(+), 58 deletions(-) create mode 100644 lib/less-browser/plugin-loader.js create mode 100644 lib/less/environment/abstract-plugin-loader.js diff --git a/lib/less-browser/index.js b/lib/less-browser/index.js index 8bb411d23..6a1fbf492 100644 --- a/lib/less-browser/index.js +++ b/lib/less-browser/index.js @@ -16,6 +16,7 @@ module.exports = function(window, options) { fileManager = new FileManager(); environment.addFileManager(fileManager); less.FileManager = FileManager; + less.PluginLoader = require("./plugin-loader"); require("./log-listener")(less, options); var errors = require("./error-reporting")(window, less, options); diff --git a/lib/less-browser/plugin-loader.js b/lib/less-browser/plugin-loader.js new file mode 100644 index 000000000..e80828de9 --- /dev/null +++ b/lib/less-browser/plugin-loader.js @@ -0,0 +1,39 @@ +var path = require("path"), + AbstractPluginLoader = require("../less/environment/abstract-plugin-loader.js"); + +/** + * Browser Plugin Loader + */ +var PluginLoader = function(less) { + this.less = less; + this.require = require; +}; + +PluginLoader.prototype = new AbstractPluginLoader(); + +PluginLoader.prototype.tryLoadFromEnvironment = function(filename, basePath, callback) { + + if(basePath && !filename) { + filename = path.join(basePath, name); + } + if(filename) { + var fileManager = new this.less.FileManager(); + + filename = fileManager.tryAppendExtension(filename,'.js'); + fileManager.loadFile(filename).then( + function(data) { + callback(null, data); + }, + + function(err) { + callback(err); + } + ); + } + else { + callback({ message: 'Plugin could not be found.'}); + } +}; + +module.exports = PluginLoader; + diff --git a/lib/less-node/plugin-loader.js b/lib/less-node/plugin-loader.js index 29b28376d..90dd17ba4 100644 --- a/lib/less-node/plugin-loader.js +++ b/lib/less-node/plugin-loader.js @@ -1,91 +1,84 @@ -var path = require("path"); +var path = require("path"), + AbstractPluginLoader = require("../less/environment/abstract-plugin-loader.js"); + /** * Node Plugin Loader */ var PluginLoader = function(less) { this.less = less; -}; -PluginLoader.prototype.tryLoadPlugin = function(name, argument) { - var plugin = this.tryRequirePlugin(name); - if (plugin) { - // support plugins being a function - // so that the plugin can be more usable programmatically - if (typeof plugin === "function") { - plugin = new plugin(); - } - if (plugin.minVersion) { - if (this.compareVersion(plugin.minVersion, this.less.version) < 0) { - console.log("plugin " + name + " requires version " + this.versionToString(plugin.minVersion)); - return null; - } - } - if (argument) { - if (!plugin.setOptions) { - console.log("options have been provided but the plugin " + name + "does not support any options"); - return null; + this.require = require; + this.requireRelative = function(prefix) { + prefix = path.dirname(prefix); + return function(id) { + var str = id.substr(0, 2); + if(str === '..' || str === './') { + return require(path.join(prefix, id)); } - try { - plugin.setOptions(argument); + else { + return require(id); } - catch(e) { - console.log("Error setting options on plugin " + name); - console.log(e.message); - return null; - } - } - return plugin; - } - return null; -}; -PluginLoader.prototype.compareVersion = function(aVersion, bVersion) { - for (var i = 0; i < aVersion.length; i++) { - if (aVersion[i] !== bVersion[i]) { - return parseInt(aVersion[i]) > parseInt(bVersion[i]) ? -1 : 1; } - } - return 0; -}; -PluginLoader.prototype.versionToString = function(version) { - var versionString = ""; - for (var i = 0; i < version.length; i++) { - versionString += (versionString ? "." : "") + version[i]; - } - return versionString; + }; }; -PluginLoader.prototype.tryRequirePlugin = function(name) { - // is at the same level as the less.js module + +PluginLoader.prototype = new AbstractPluginLoader(); + +PluginLoader.prototype.tryLoadFromEnvironment = function(name, basePath, callback) { + var filename; + var self = this; + try { - return require("../../../" + name); + filename = require.resolve(path.join("../../../", name)); } catch(e) { } // is installed as a sub dependency of the current folder try { - return require(path.join(process.cwd(), "node_modules", name)); + filename = require.resolve(path.join(process.cwd(), "node_modules", name)); } catch(e) { } // is referenced relative to the current directory try { - return require(path.join(process.cwd(), name)); + filename = require.resolve(path.join(process.cwd(), name)); } catch(e) { } // unlikely - would have to be a dependency of where this code was running (less.js)... if (name[0] !== '.') { try { - return require(name); + filename = require.resolve(name); } catch(e) { } } -}; -PluginLoader.prototype.printUsage = function(plugins) { - for (var i = 0; i < plugins.length; i++) { - var plugin = plugins[i]; - if (plugin.printUsage) { - plugin.printUsage(); - } + if(basePath && !filename) { + filename = path.join(basePath, name); + } + if(filename) { + var fileManager = new this.less.FileManager(); + + filename = fileManager.tryAppendExtension(filename,'.js'); + fileManager.loadFile(filename).then( + function(data) { + try { + self.require = self.requireRelative(filename); + } + catch(e) { + console.log(e.stack.toString()); + } + callback(null, data); + }, + + function(err) { + callback(err); + } + ); + } + else { + callback({ message: 'Plugin could not be found.'}); } }; + module.exports = PluginLoader; + diff --git a/lib/less/environment/abstract-plugin-loader.js b/lib/less/environment/abstract-plugin-loader.js new file mode 100644 index 000000000..55858cb52 --- /dev/null +++ b/lib/less/environment/abstract-plugin-loader.js @@ -0,0 +1,143 @@ +var functionRegistry = require("../functions/function-registry"); +var AbstractPluginLoader = function() { +}; + +function error(msg, type) { + throw new LessError( + { + type: type || 'Syntax', + message: msg + } + ); +} +AbstractPluginLoader.prototype.evalPlugin = function(contents, context, fileInfo, callback) { + + var loader, + registry, + pluginObj, + localModule, + localExports; + + + pluginObj = context.pluginManager.get(fileInfo.filename); + + if(pluginObj) { + if(pluginObj.use) { + pluginObj.use(this.less); + } + return callback(null, pluginObj); + } + localModule = { + exports: {}, + pluginManager: context.pluginManager, + fileInfo: fileInfo + }; + localExports = localModule.exports; + registry = functionRegistry.create(); + + try { + loader = new Function("module", "require", "functions", "tree", "fileInfo", "less", contents); + pluginObj = loader(localModule, this.require, registry, this.less.tree, fileInfo, this.less); + + if(!pluginObj) { + pluginObj = localModule.exports; + } + + pluginObj = this.validatePlugin(pluginObj); + if(pluginObj) { + // Run on first load + context.pluginManager.addPlugin(pluginObj, fileInfo.filename); + pluginObj.functions = registry.getLocalFunctions(); + + // Run every @plugin call + if(pluginObj.use) { + pluginObj.use(this.less); + } + } + else { + throw new Error(); + } + + } catch(e) { + // TODO pass the error + console.log(e.stack.toString()); + callback(new this.less.LessError({ + message: "Plugin evaluation error: '" + e.name + ': ' + e.message.replace(/["]/g, "'") + "'" , + filename: this.fileInfo.filename, + line: this.line, + col: this.column + }), null ); + } + + callback(null, pluginObj); + +}; +AbstractPluginLoader.prototype.tryLoadPlugin = function(name, argument, basePath, callback) { + var self = this; + this.tryLoadFromEnvironment(name, basePath, function(err, data) { + if(!err) { + callback(null, data); + } + else { + self.tryLoadFromEnvironment('less-plugin-' + name, basePath, callback); + } + }); + +}; +AbstractPluginLoader.prototype.validatePlugin = function(plugin, argument) { + if (plugin) { + // support plugins being a function + // so that the plugin can be more usable programmatically + if (typeof plugin === "function") { + plugin = new plugin(); + } + if (plugin.minVersion) { + if (this.compareVersion(plugin.minVersion, this.less.version) < 0) { + error("plugin " + name + " requires version " + this.versionToString(plugin.minVersion)); + return null; + } + } + if (argument) { + if (!plugin.setOptions) { + error("options have been provided but the plugin " + name + "does not support any options"); + return null; + } + try { + plugin.setOptions(argument); + } + catch(e) { + error("Error setting options on plugin " + name + '\n' + e.message); + return null; + } + } + return plugin; + } + return null; +}; + +AbstractPluginLoader.prototype.compareVersion = function(aVersion, bVersion) { + for (var i = 0; i < aVersion.length; i++) { + if (aVersion[i] !== bVersion[i]) { + return parseInt(aVersion[i]) > parseInt(bVersion[i]) ? -1 : 1; + } + } + return 0; +}; +AbstractPluginLoader.prototype.versionToString = function(version) { + var versionString = ""; + for (var i = 0; i < version.length; i++) { + versionString += (versionString ? "." : "") + version[i]; + } + return versionString; +}; +AbstractPluginLoader.prototype.printUsage = function(plugins) { + for (var i = 0; i < plugins.length; i++) { + var plugin = plugins[i]; + if (plugin.printUsage) { + plugin.printUsage(); + } + } +}; + +module.exports = AbstractPluginLoader; + From 1df9443cf4567a4deef6f708d5f0ed0f8e3858da Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Fri, 1 Jul 2016 14:43:00 -0700 Subject: [PATCH 03/97] Add create() and getLocalFunctions() to function registry so it can be used for plugins --- lib/less/functions/function-registry.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/less/functions/function-registry.js b/lib/less/functions/function-registry.js index bc21bcc8e..d7f3f0f31 100644 --- a/lib/less/functions/function-registry.js +++ b/lib/less/functions/function-registry.js @@ -20,8 +20,14 @@ function makeRegistry( base ) { get: function(name) { return this._data[name] || ( base && base.get( name )); }, - inherit : function() { + getLocalFunctions: function() { + return this._data; + }, + inherit: function() { return makeRegistry( this ); + }, + create: function(base) { + return makeRegistry(base); } }; } From 27492a71efce12c39c58e52cdb096f72acd0ff15 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Fri, 1 Jul 2016 14:43:34 -0700 Subject: [PATCH 04/97] Rename extensions back to plugins --- lib/less/parser/parser.js | 20 ++++++++------------ lib/less/tree/import.js | 4 ++-- lib/less/visitors/import-visitor.js | 4 ++-- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js index e84f5fc63..761ee6f3d 100644 --- a/lib/less/parser/parser.js +++ b/lib/less/parser/parser.js @@ -1384,39 +1384,35 @@ var Parser = function Parser(context, imports, fileInfo) { }, // - // A @use directive, used to import scoped extensions dynamically. + // A @plugin directive, used to import scoped extensions dynamically. // - // @use "lib"; + // @plugin "lib"; // // Depending on our environment, importing is done differently: // In the browser, it's an XHR request, in Node, it would be a // file-system operation. The function used for importing is // stored in `import`, which we pass to the Import constructor. // - extension: function () { + plugin: function () { var path, index = parserInput.i, - dir = parserInput.$re(/^@use?|@plugin?\s+/); + dir = parserInput.$re(/^@plugin?\s+/); - if (dir && dir.indexOf("@p") > -1) { - parserInput.i -= dir.length; - return error('@plugin is deprecated. Use @use'); - } if (dir) { - var options = { isExtension : true }; + var options = { isPlugin : true }; if ((path = this.entities.quoted() || this.entities.url())) { if (!parserInput.$char(';')) { parserInput.i = index; - error("missing semi-colon on @use"); + error("missing semi-colon on @plugin"); } return new(tree.Import)(path, null, options, index, fileInfo); } else { parserInput.i = index; - error("malformed @use statement"); + error("malformed @plugin statement"); } } }, @@ -1432,7 +1428,7 @@ var Parser = function Parser(context, imports, fileInfo) { if (parserInput.currentChar() !== '@') { return; } - value = this['import']() || this.extension() || this.media(); + value = this['import']() || this.plugin() || this.media(); if (value) { return value; } diff --git a/lib/less/tree/import.js b/lib/less/tree/import.js index 4b53e61cd..e4e22422a 100644 --- a/lib/less/tree/import.js +++ b/lib/less/tree/import.js @@ -52,7 +52,7 @@ Import.prototype.accept = function (visitor) { this.features = visitor.visit(this.features); } this.path = visitor.visit(this.path); - if (!this.options.isExtension && !this.options.inline && this.root) { + if (!this.options.isPlugin && !this.options.inline && this.root) { this.root = visitor.visit(this.root); } }; @@ -126,7 +126,7 @@ Import.prototype.doEval = function (context) { var ruleset, registry, features = this.features && this.features.eval(context); - if (this.options.isExtension) { + if (this.options.isPlugin) { registry = context.frames[0] && context.frames[0].functionRegistry; if ( registry && this.root && this.root.functions ) { registry.addMultiple( this.root.functions ); diff --git a/lib/less/visitors/import-visitor.js b/lib/less/visitors/import-visitor.js index 99464522c..c0674569a 100644 --- a/lib/less/visitors/import-visitor.js +++ b/lib/less/visitors/import-visitor.js @@ -103,7 +103,7 @@ ImportVisitor.prototype = { var importVisitor = this, inlineCSS = importNode.options.inline, - isExtension = importNode.options.isExtension, + isPlugin = importNode.options.isPlugin, isOptional = importNode.options.optional, duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector; @@ -129,7 +129,7 @@ ImportVisitor.prototype = { importNode.root = root; importNode.importedFilename = fullPath; - if (!inlineCSS && !isExtension && (context.importMultiple || !duplicateImport)) { + if (!inlineCSS && !isPlugin && (context.importMultiple || !duplicateImport)) { importVisitor.recursionDetector[fullPath] = true; var oldContext = this.context; From 777d95f11be4a4aacb96c1ac5101b58a23b20bab Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Fri, 1 Jul 2016 14:44:54 -0700 Subject: [PATCH 05/97] Add plugin cache to plugin manager - Add visitor iterator so that visitors can be added while visiting (such as plugins in nested scope) --- lib/less/extension/importer.js | 36 -------------------------- lib/less/import-manager.js | 46 ++++++++++++++++++++++------------ lib/less/index.js | 1 + lib/less/parse.js | 5 ++-- lib/less/plugin-manager.js | 43 ++++++++++++++++++++++++++++--- lib/less/transform-tree.js | 35 ++++++++++++-------------- lib/less/tree/call.js | 13 +++++++--- lib/less/tree/ruleset.js | 35 +++++++++++++++----------- 8 files changed, 119 insertions(+), 95 deletions(-) delete mode 100644 lib/less/extension/importer.js diff --git a/lib/less/extension/importer.js b/lib/less/extension/importer.js deleted file mode 100644 index aba57f59a..000000000 --- a/lib/less/extension/importer.js +++ /dev/null @@ -1,36 +0,0 @@ -var LessError = require('../less-error'), - tree = require("../tree"), - less = require("../."); - -var ExtensionImporter = module.exports = function ExtensionImporter(context, fileInfo) { - this.fileInfo = fileInfo; -}; - -ExtensionImporter.prototype.eval = function(contents, callback) { - var loaded = {}, - loader, - registry; - - registry = { - add: function(name, func) { - loaded[name] = func; - }, - addMultiple: function(functions) { - Object.keys(functions).forEach(function(name) { - loaded[name] = functions[name]; - }); - } - }; - - try { - loader = new Function("functions", "tree", "fileInfo", "less", contents); - loader(registry, tree, this.fileInfo, less); - } catch(e) { - callback(new LessError({ - message: "Extension evaluation error: '" + e.name + ': ' + e.message.replace(/["]/g, "'") + "'" , - filename: this.fileInfo.filename - }), null ); - } - - callback(null, { functions: loaded }); -}; diff --git a/lib/less/import-manager.js b/lib/less/import-manager.js index b758a0d44..05ad8f001 100644 --- a/lib/less/import-manager.js +++ b/lib/less/import-manager.js @@ -1,6 +1,5 @@ var contexts = require("./contexts"), - Parser = require('./parser/parser'), - ExtensionImporter = require('./extension/importer'); + Parser = require('./parser/parser'); module.exports = function(environment) { @@ -13,7 +12,8 @@ module.exports = function(environment) { // 'entryPath' - absolute path to the entry file // 'reference' - whether the file should not be output and only output parts that are referenced - var ImportManager = function(context, rootFileInfo) { + var ImportManager = function(less, context, rootFileInfo) { + this.less = less; this.rootFilename = rootFileInfo.filename; this.paths = context.paths || []; // Search paths, when importing this.contents = {}; // map - filename to contents of all the files @@ -28,13 +28,15 @@ module.exports = function(environment) { /** * Add an import to be imported * @param path - the raw path - * @param tryAppendLessExtension - whether to try appending the less extension (if the path has no extension) + * @param tryAppendExtension - whether to try appending a file extension (.less or .js if the path has no extension) * @param currentFileInfo - the current file info (used for instance to work out relative paths) * @param importOptions - import options * @param callback - callback for when it is imported */ - ImportManager.prototype.push = function (path, tryAppendLessExtension, currentFileInfo, importOptions, callback) { - var importManager = this; + ImportManager.prototype.push = function (path, tryAppendExtension, currentFileInfo, importOptions, callback) { + var importManager = this, + pluginLoader = new this.less.PluginLoader(this.less); + this.queue.push(path); var fileParsedFunc = function (e, root, fullPath) { @@ -65,8 +67,8 @@ module.exports = function(environment) { return; } - if (tryAppendLessExtension) { - path = fileManager.tryAppendExtension(path, importOptions.isExtension ? ".js" : ".less"); + if (tryAppendExtension) { + path = importOptions.isPlugin ? path : fileManager.tryAppendExtension(path, ".less"); } var loadFileCallback = function(loadedFile) { @@ -102,8 +104,8 @@ module.exports = function(environment) { newFileInfo.reference = true; } - if (importOptions.isExtension) { - new ExtensionImporter(newEnv, newFileInfo).eval(contents, function (e, root) { + if (importOptions.isPlugin) { + pluginLoader.evalPlugin(contents, newEnv, newFileInfo, function (e, root) { fileParsedFunc(e, root, resolvedFilename); }); } else if (importOptions.inline) { @@ -114,18 +116,30 @@ module.exports = function(environment) { }); } }; - - var promise = fileManager.loadFile(path, currentFileInfo.currentDirectory, this.context, environment, - function(err, loadedFile) { + var promise; + var done = function(err, loadedFile) { if (err) { fileParsedFunc(err); } else { loadFileCallback(loadedFile); } - }); - if (promise) { - promise.then(loadFileCallback, fileParsedFunc); + }; + if(importOptions.isPlugin) { + // TODO: implement options for plugins + try { + pluginLoader.tryLoadPlugin(path, null, currentFileInfo.currentDirectory, done); + } + catch(e) { + callback(e); + } + } + else { + promise = fileManager.loadFile(path, currentFileInfo.currentDirectory, this.context, environment, done); + if (promise) { + promise.then(loadFileCallback, fileParsedFunc); + } } + }; return ImportManager; }; diff --git a/lib/less/index.js b/lib/less/index.js index 1ea563318..74a6c5f77 100644 --- a/lib/less/index.js +++ b/lib/less/index.js @@ -7,6 +7,7 @@ module.exports = function(environment, fileManagers) { tree: require('./tree'), Environment: (Environment = require("./environment/environment")), AbstractFileManager: require("./environment/abstract-file-manager"), + AbstractPluginLoader: require("./environment/abstract-plugin-loader"), environment: (environment = new Environment(environment, fileManagers)), visitors: require('./visitors'), Parser: require('./parser/parser'), diff --git a/lib/less/parse.js b/lib/less/parse.js index 6bc17f9ed..a6048aa0a 100644 --- a/lib/less/parse.js +++ b/lib/less/parse.js @@ -29,7 +29,8 @@ module.exports = function(environment, ParseTree, ImportManager) { } else { var context, rootFileInfo, - pluginManager = new PluginManager(this); + less = this, + pluginManager = new PluginManager(this, true); pluginManager.addPlugins(options.plugins); options.pluginManager = pluginManager; @@ -55,7 +56,7 @@ module.exports = function(environment, ParseTree, ImportManager) { } } - var imports = new ImportManager(context, rootFileInfo); + var imports = new ImportManager(this, context, rootFileInfo); new Parser(context, imports, rootFileInfo) .parse(input, function (e, root) { diff --git a/lib/less/plugin-manager.js b/lib/less/plugin-manager.js index 8f6df7c79..54e65654a 100644 --- a/lib/less/plugin-manager.js +++ b/lib/less/plugin-manager.js @@ -8,7 +8,17 @@ var PluginManager = function(less) { this.postProcessors = []; this.installedPlugins = []; this.fileManagers = []; + this.iterator = -1; + this.pluginCache = {}; }; + +var pm, PluginManagerFactory = function(less, newFactory) { + if (newFactory || !pm) { + pm = new PluginManager(less); + } + return pm; +}; + /** * Adds all the plugins in the array * @param {Array} plugins @@ -23,10 +33,21 @@ PluginManager.prototype.addPlugins = function(plugins) { /** * * @param plugin + * @param {String} filename */ -PluginManager.prototype.addPlugin = function(plugin) { +PluginManager.prototype.addPlugin = function(plugin, filename) { this.installedPlugins.push(plugin); - plugin.install(this.less, this); + this.pluginCache[filename] = plugin; + if(plugin.install) { + plugin.install(this.less, this); + } +}; +/** + * + * @param filename + */ +PluginManager.prototype.get = function(filename) { + return this.pluginCache[filename]; }; /** * Adds a visitor. The visitor object has options on itself to determine @@ -103,6 +124,20 @@ PluginManager.prototype.getPostProcessors = function() { PluginManager.prototype.getVisitors = function() { return this.visitors; }; + +PluginManager.prototype.visitor = function() { + var self = this; + return { + first: function() { + self.iterator = -1; + return self.visitors[self.iterator]; + }, + get: function() { + self.iterator+=1; + return self.visitors[self.iterator]; + } + } +}; /** * * @returns {Array} @@ -111,4 +146,6 @@ PluginManager.prototype.getVisitors = function() { PluginManager.prototype.getFileManagers = function() { return this.fileManagers; }; -module.exports = PluginManager; + +// +module.exports = PluginManagerFactory; diff --git a/lib/less/transform-tree.js b/lib/less/transform-tree.js index cac97dc62..941102745 100644 --- a/lib/less/transform-tree.js +++ b/lib/less/transform-tree.js @@ -36,39 +36,36 @@ module.exports = function(root, options) { evalEnv.frames = [new tree.Ruleset(null, variables)]; } - var preEvalVisitors = [], - visitors = [ + var visitors = [ new visitor.JoinSelectorVisitor(), new visitor.MarkVisibleSelectorsVisitor(true), new visitor.ExtendVisitor(), new visitor.ToCSSVisitor({compress: Boolean(options.compress)}) - ], i; + ], v, visitorIterator; + // first() / get() allows visitors to be added while visiting if (options.pluginManager) { - var pluginVisitors = options.pluginManager.getVisitors(); - for (i = 0; i < pluginVisitors.length; i++) { - var pluginVisitor = pluginVisitors[i]; - if (pluginVisitor.isPreEvalVisitor) { - preEvalVisitors.push(pluginVisitor); - } else { - if (pluginVisitor.isPreVisitor) { - visitors.splice(0, 0, pluginVisitor); - } else { - visitors.push(pluginVisitor); - } + visitorIterator = options.pluginManager.visitor(); + visitorIterator.first(); + while(v = visitorIterator.get()) { + if(v.isPreEvalVisitor) { + v.run(root); } } } - for (i = 0; i < preEvalVisitors.length; i++) { - preEvalVisitors[i].run(root); - } - evaldRoot = root.eval(evalEnv); - for (i = 0; i < visitors.length; i++) { + for (var i = 0; i < visitors.length; i++) { visitors[i].run(evaldRoot); } + if (options.pluginManager) { + visitorIterator.first(); + while(v = visitorIterator.get()) { + v.run(root); + } + } + return evaldRoot; }; diff --git a/lib/less/tree/call.js b/lib/less/tree/call.js index 12e183747..d95c9496d 100644 --- a/lib/less/tree/call.js +++ b/lib/less/tree/call.js @@ -35,10 +35,15 @@ Call.prototype.eval = function (context) { try { result = funcCaller.call(args); } catch (e) { - throw { type: e.type || "Runtime", - message: "error evaluating function `" + this.name + "`" + - (e.message ? ': ' + e.message : ''), - index: this.index, filename: this.currentFileInfo.filename }; + throw { + type: e.type || "Runtime", + message: "error evaluating function `" + this.name + "`" + + (e.message ? ': ' + e.message : ''), + index: this.index, + filename: this.currentFileInfo.filename, + line: e.lineNumber, + column: e.columnNumber + }; } if (result != null) { diff --git a/lib/less/tree/ruleset.js b/lib/less/tree/ruleset.js index dcf8ae843..bac6d6fbb 100644 --- a/lib/less/tree/ruleset.js +++ b/lib/less/tree/ruleset.js @@ -161,9 +161,11 @@ Ruleset.prototype.eval = function (context) { for (var j = 0; j < rule.rules.length; j++) { subRule = rule.rules[j]; - subRule.copyVisibilityInfo(rule.visibilityInfo()); - if (!(subRule instanceof Rule) || !subRule.variable) { - rsRules.splice(++i, 0, subRule); + if (subRule instanceof Node) { + subRule.copyVisibilityInfo(rule.visibilityInfo()); + if (!(subRule instanceof Rule) || !subRule.variable) { + rsRules.splice(++i, 0, subRule); + } } } } @@ -347,20 +349,23 @@ Ruleset.prototype.genCSS = function (context, output) { var importNodeIndex = 0; for (i = 0; i < this.rules.length; i++) { rule = this.rules[i]; - if (rule.type === "Comment") { - if (importNodeIndex === i) { + // Plugins may return something other than Nodes + if (rule instanceof Node) { + if (rule.type === "Comment") { + if (importNodeIndex === i) { + importNodeIndex++; + } + ruleNodes.push(rule); + } else if (rule.isCharset && rule.isCharset()) { + ruleNodes.splice(charsetNodeIndex, 0, rule); + charsetNodeIndex++; + importNodeIndex++; + } else if (rule.type === "Import") { + ruleNodes.splice(importNodeIndex, 0, rule); importNodeIndex++; + } else { + ruleNodes.push(rule); } - ruleNodes.push(rule); - } else if (rule.isCharset && rule.isCharset()) { - ruleNodes.splice(charsetNodeIndex, 0, rule); - charsetNodeIndex++; - importNodeIndex++; - } else if (rule.type === "Import") { - ruleNodes.splice(importNodeIndex, 0, rule); - importNodeIndex++; - } else { - ruleNodes.push(rule); } } ruleNodes = charsetRuleNodes.concat(ruleNodes); From c73f50e2c704f4180127572b14ac76a5f6194a18 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Fri, 1 Jul 2016 15:08:48 -0700 Subject: [PATCH 06/97] Added plugin function "setContext()". Allows the context from where the plugin is declared to be passed into the plugin after it is evaluated. (Useful for creating function calls / vars dynamically.) --- lib/less/tree/import.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/less/tree/import.js b/lib/less/tree/import.js index e4e22422a..10385141a 100644 --- a/lib/less/tree/import.js +++ b/lib/less/tree/import.js @@ -127,6 +127,9 @@ Import.prototype.doEval = function (context) { features = this.features && this.features.eval(context); if (this.options.isPlugin) { + if(this.root && this.root.setContext) { + this.root.setContext(context); + } registry = context.frames[0] && context.frames[0].functionRegistry; if ( registry && this.root && this.root.functions ) { registry.addMultiple( this.root.functions ); From 52e9b5e4fe5df4c972459b5740ef0b9a154a7b3c Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Fri, 1 Jul 2016 20:53:01 -0700 Subject: [PATCH 07/97] Rename Directive -> AtRule & Rule -> Declaration - Added tree shim for old node types and plugin visitor shim to upgrade node visitors to new node types --- lib/less/parser/parser.js | 38 +++--- lib/less/plugin-manager.js | 33 +++++ lib/less/transform-tree.js | 4 +- lib/less/tree/atrule.js | 134 ++++++++++++++++++++ lib/less/tree/declaration.js | 96 +++++++++++++++ lib/less/tree/directive.js | 137 ++------------------- lib/less/tree/index.js | 4 + lib/less/tree/media.js | 4 +- lib/less/tree/mixin-definition.js | 10 +- lib/less/tree/rule.js | 97 ++------------- lib/less/tree/ruleset.js | 12 +- lib/less/visitors/extend-visitor.js | 20 +-- lib/less/visitors/import-visitor.js | 16 +-- lib/less/visitors/join-selector-visitor.js | 8 +- lib/less/visitors/to-css-visitor.js | 62 +++++----- lib/less/visitors/visitor.js | 1 + 16 files changed, 370 insertions(+), 306 deletions(-) create mode 100644 lib/less/tree/atrule.js create mode 100644 lib/less/tree/declaration.js diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js index 761ee6f3d..ad9269fd5 100644 --- a/lib/less/parser/parser.js +++ b/lib/less/parser/parser.js @@ -197,7 +197,7 @@ var Parser = function Parser(context, imports, fileInfo) { // // The basic structure of the syntax tree generated is as follows: // - // Ruleset -> Rule -> Value -> Expression -> Entity + // Ruleset -> Declaration -> Value -> Expression -> Entity // // Here's some Less code: // @@ -211,9 +211,9 @@ var Parser = function Parser(context, imports, fileInfo) { // And here's what the parse tree might look like: // // Ruleset (Selector '.class', [ - // Rule ("color", Value ([Expression [Color #fff]])) - // Rule ("border", Value ([Expression [Dimension 1px][Keyword "solid"][Color #000]])) - // Rule ("width", Value ([Expression [Operation " + " [Variable "@w"][Dimension 4px]]])) + // Declaration ("color", Value ([Expression [Color #fff]])) + // Declaration ("border", Value ([Expression [Dimension 1px][Keyword "solid"][Color #000]])) + // Declaration ("width", Value ([Expression [Operation " + " [Variable "@w"][Dimension 4px]]])) // Ruleset (Selector [Element '>', '.child'], [...]) // ]) // @@ -230,7 +230,7 @@ var Parser = function Parser(context, imports, fileInfo) { // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule, // as represented by this simplified grammar: // - // primary → (ruleset | rule)+ + // primary → (ruleset | declaration)+ // ruleset → selector+ block // block → '{' primary '}' // @@ -260,8 +260,8 @@ var Parser = function Parser(context, imports, fileInfo) { continue; } - node = mixin.definition() || this.rule() || this.ruleset() || - mixin.call() || this.rulesetCall() || this.entities.call() || this.directive(); + node = mixin.definition() || this.declaration() || this.ruleset() || + mixin.call() || this.rulesetCall() || this.entities.call() || this.atrule(); if (node) { root.push(node); } else { @@ -929,7 +929,7 @@ var Parser = function Parser(context, imports, fileInfo) { }, // - // A Rule terminator. Note that we use `peek()` to check for '}', + // A Declaration terminator. Note that we use `peek()` to check for '}', // because the `block` rule will be expecting it, but we still need to make sure // it's there, if ';' was omitted. // @@ -1169,7 +1169,7 @@ var Parser = function Parser(context, imports, fileInfo) { parserInput.restore(); } }, - rule: function (tryAnonymous) { + declaration: function (tryAnonymous) { var name, value, startOfRule = parserInput.i, c = parserInput.currentChar(), important, merge, isVariable; if (c === '.' || c === '#' || c === '&' || c === ':') { return; } @@ -1203,7 +1203,7 @@ var Parser = function Parser(context, imports, fileInfo) { if (value) { parserInput.forget(); // anonymous values absorb the end ';' which is required for them to work - return new (tree.Rule)(name, value, false, merge, startOfRule, fileInfo); + return new (tree.Declaration)(name, value, false, merge, startOfRule, fileInfo); } } if (!tryValueFirst && !value) { @@ -1215,11 +1215,11 @@ var Parser = function Parser(context, imports, fileInfo) { if (value && this.end()) { parserInput.forget(); - return new (tree.Rule)(name, value, important, merge, startOfRule, fileInfo); + return new (tree.Declaration)(name, value, important, merge, startOfRule, fileInfo); } else { parserInput.restore(); if (value && !tryAnonymous) { - return this.rule(true); + return this.declaration(true); } } } else { @@ -1234,7 +1234,7 @@ var Parser = function Parser(context, imports, fileInfo) { }, // - // An @import directive + // An @import atrule // // @import "lib"; // @@ -1315,7 +1315,7 @@ var Parser = function Parser(context, imports, fileInfo) { e = this.value(); if (parserInput.$char(')')) { if (p && e) { - nodes.push(new(tree.Paren)(new(tree.Rule)(p, e, null, null, parserInput.i, fileInfo, true))); + nodes.push(new(tree.Paren)(new(tree.Declaration)(p, e, null, null, parserInput.i, fileInfo, true))); } else if (e) { nodes.push(new(tree.Paren)(e)); } else { @@ -1384,7 +1384,7 @@ var Parser = function Parser(context, imports, fileInfo) { }, // - // A @plugin directive, used to import scoped extensions dynamically. + // A @plugin atrule, used to import scoped extensions dynamically. // // @plugin "lib"; // @@ -1418,11 +1418,11 @@ var Parser = function Parser(context, imports, fileInfo) { }, // - // A CSS Directive + // A CSS AtRule // // @charset "utf-8"; // - directive: function () { + atrule: function () { var index = parserInput.i, name, value, rules, nonVendorSpecificName, hasIdentifier, hasExpression, hasUnknown, hasBlock = true, isRooted = true; @@ -1493,13 +1493,13 @@ var Parser = function Parser(context, imports, fileInfo) { if (rules || (!hasBlock && value && parserInput.$char(';'))) { parserInput.forget(); - return new (tree.Directive)(name, value, rules, index, fileInfo, + return new (tree.AtRule)(name, value, rules, index, fileInfo, context.dumpLineNumbers ? getDebugInfo(index) : null, isRooted ); } - parserInput.restore("directive options not recognised"); + parserInput.restore("atrule options not recognised"); }, // diff --git a/lib/less/plugin-manager.js b/lib/less/plugin-manager.js index 54e65654a..542d0f768 100644 --- a/lib/less/plugin-manager.js +++ b/lib/less/plugin-manager.js @@ -49,12 +49,45 @@ PluginManager.prototype.addPlugin = function(plugin, filename) { PluginManager.prototype.get = function(filename) { return this.pluginCache[filename]; }; + +// Object.getPrototypeOf shim for visitor upgrade +if(!Object.getPrototypeOf) { + if(({}).__proto__===Object.prototype&&([]).__proto__===Array.prototype) { + Object.getPrototypeOf=function getPrototypeOf(object) { + return object.__proto__; + }; + } else { + Object.getPrototypeOf=function getPrototypeOf(object) { + // May break if the constructor has been changed or removed + return object.constructor?object.constructor.prototype:void 0; + }; + } +} + +function upgradeVisitors(visitor, oldType, newType) { + + if (visitor['visit' + oldType] && !visitor['visit' + newType]) { + visitor['visit' + newType] = visitor['visit' + oldType]; + } + if (visitor['visit' + oldType + 'Out'] && !visitor['visit' + newType + 'Out']) { + visitor['visit' + newType + 'Out'] = visitor['visit' + oldType + 'Out']; + } +} /** * Adds a visitor. The visitor object has options on itself to determine * when it should run. * @param visitor */ PluginManager.prototype.addVisitor = function(visitor) { + var proto; + // 2.x to 3.x visitor compatibility + try { + proto = Object.getPrototypeOf(visitor); + upgradeVisitors(proto, 'Directive', 'AtRule'); + upgradeVisitors(proto, 'Rule', 'Declaration'); + } + catch(e) {} + this.visitors.push(visitor); }; /** diff --git a/lib/less/transform-tree.js b/lib/less/transform-tree.js index 941102745..e026a9db0 100644 --- a/lib/less/transform-tree.js +++ b/lib/less/transform-tree.js @@ -13,7 +13,7 @@ module.exports = function(root, options) { // // `{ color: new tree.Color('#f01') }` will become: // - // new tree.Rule('@color', + // new tree.Declaration('@color', // new tree.Value([ // new tree.Expression([ // new tree.Color('#f01') @@ -31,7 +31,7 @@ module.exports = function(root, options) { } value = new tree.Value([value]); } - return new tree.Rule('@' + k, value, false, null, 0); + return new tree.Declaration('@' + k, value, false, null, 0); }); evalEnv.frames = [new tree.Ruleset(null, variables)]; } diff --git a/lib/less/tree/atrule.js b/lib/less/tree/atrule.js new file mode 100644 index 000000000..4a512d4e0 --- /dev/null +++ b/lib/less/tree/atrule.js @@ -0,0 +1,134 @@ +var Node = require("./node"), + Selector = require("./selector"), + Ruleset = require("./ruleset"); + +var AtRule = function (name, value, rules, index, currentFileInfo, debugInfo, isRooted, visibilityInfo) { + var i; + + this.name = name; + this.value = value; + if (rules) { + if (Array.isArray(rules)) { + this.rules = rules; + } else { + this.rules = [rules]; + this.rules[0].selectors = (new Selector([], null, null, this.index, currentFileInfo)).createEmptySelectors(); + } + for (i = 0; i < this.rules.length; i++) { + this.rules[i].allowImports = true; + } + } + this.index = index; + this.currentFileInfo = currentFileInfo; + this.debugInfo = debugInfo; + this.isRooted = isRooted || false; + this.copyVisibilityInfo(visibilityInfo); + this.allowRoot = true; +}; + +AtRule.prototype = new Node(); +AtRule.prototype.type = "AtRule"; +AtRule.prototype.accept = function (visitor) { + var value = this.value, rules = this.rules; + if (rules) { + this.rules = visitor.visitArray(rules); + } + if (value) { + this.value = visitor.visit(value); + } +}; +AtRule.prototype.isRulesetLike = function() { + return this.rules || !this.isCharset(); +}; +AtRule.prototype.isCharset = function() { + return "@charset" === this.name; +}; +AtRule.prototype.genCSS = function (context, output) { + var value = this.value, rules = this.rules; + output.add(this.name, this.currentFileInfo, this.index); + if (value) { + output.add(' '); + value.genCSS(context, output); + } + if (rules) { + this.outputRuleset(context, output, rules); + } else { + output.add(';'); + } +}; +AtRule.prototype.eval = function (context) { + var mediaPathBackup, mediaBlocksBackup, value = this.value, rules = this.rules; + + //media stored inside other atrule should not bubble over it + //backpup media bubbling information + mediaPathBackup = context.mediaPath; + mediaBlocksBackup = context.mediaBlocks; + //deleted media bubbling information + context.mediaPath = []; + context.mediaBlocks = []; + + if (value) { + value = value.eval(context); + } + if (rules) { + // assuming that there is only one rule at this point - that is how parser constructs the rule + rules = [rules[0].eval(context)]; + rules[0].root = true; + } + //restore media bubbling information + context.mediaPath = mediaPathBackup; + context.mediaBlocks = mediaBlocksBackup; + + return new AtRule(this.name, value, rules, + this.index, this.currentFileInfo, this.debugInfo, this.isRooted, this.visibilityInfo()); +}; +AtRule.prototype.variable = function (name) { + if (this.rules) { + // assuming that there is only one rule at this point - that is how parser constructs the rule + return Ruleset.prototype.variable.call(this.rules[0], name); + } +}; +AtRule.prototype.find = function () { + if (this.rules) { + // assuming that there is only one rule at this point - that is how parser constructs the rule + return Ruleset.prototype.find.apply(this.rules[0], arguments); + } +}; +AtRule.prototype.rulesets = function () { + if (this.rules) { + // assuming that there is only one rule at this point - that is how parser constructs the rule + return Ruleset.prototype.rulesets.apply(this.rules[0]); + } +}; +AtRule.prototype.outputRuleset = function (context, output, rules) { + var ruleCnt = rules.length, i; + context.tabLevel = (context.tabLevel | 0) + 1; + + // Compressed + if (context.compress) { + output.add('{'); + for (i = 0; i < ruleCnt; i++) { + rules[i].genCSS(context, output); + } + output.add('}'); + context.tabLevel--; + return; + } + + // Non-compressed + var tabSetStr = '\n' + Array(context.tabLevel).join(" "), tabRuleStr = tabSetStr + " "; + if (!ruleCnt) { + output.add(" {" + tabSetStr + '}'); + } else { + output.add(" {" + tabRuleStr); + rules[0].genCSS(context, output); + for (i = 1; i < ruleCnt; i++) { + output.add(tabRuleStr); + rules[i].genCSS(context, output); + } + output.add(tabSetStr + '}'); + } + + context.tabLevel--; +}; +module.exports = AtRule; diff --git a/lib/less/tree/declaration.js b/lib/less/tree/declaration.js new file mode 100644 index 000000000..f8f063bfa --- /dev/null +++ b/lib/less/tree/declaration.js @@ -0,0 +1,96 @@ +var Node = require("./node"), + Value = require("./value"), + Keyword = require("./keyword"); + +var Declaration = function (name, value, important, merge, index, currentFileInfo, inline, variable) { + this.name = name; + this.value = (value instanceof Node) ? value : new Value([value]); //value instanceof tree.Value || value instanceof tree.Ruleset ?? + this.important = important ? ' ' + important.trim() : ''; + this.merge = merge; + this.index = index; + this.currentFileInfo = currentFileInfo; + this.inline = inline || false; + this.variable = (variable !== undefined) ? variable + : (name.charAt && (name.charAt(0) === '@')); + this.allowRoot = true; +}; + +function evalName(context, name) { + var value = "", i, n = name.length, + output = {add: function (s) {value += s;}}; + for (i = 0; i < n; i++) { + name[i].eval(context).genCSS(context, output); + } + return value; +} + +Declaration.prototype = new Node(); +Declaration.prototype.type = "Declaration"; +Declaration.prototype.genCSS = function (context, output) { + output.add(this.name + (context.compress ? ':' : ': '), this.currentFileInfo, this.index); + try { + this.value.genCSS(context, output); + } + catch(e) { + e.index = this.index; + e.filename = this.currentFileInfo.filename; + throw e; + } + output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? "" : ";"), this.currentFileInfo, this.index); +}; +Declaration.prototype.eval = function (context) { + var strictMathBypass = false, name = this.name, evaldValue, variable = this.variable; + if (typeof name !== "string") { + // expand 'primitive' name directly to get + // things faster (~10% for benchmark.less): + name = (name.length === 1) && (name[0] instanceof Keyword) ? + name[0].value : evalName(context, name); + variable = false; // never treat expanded interpolation as new variable name + } + if (name === "font" && !context.strictMath) { + strictMathBypass = true; + context.strictMath = true; + } + try { + context.importantScope.push({}); + evaldValue = this.value.eval(context); + + if (!this.variable && evaldValue.type === "DetachedRuleset") { + throw { message: "Rulesets cannot be evaluated on a property.", + index: this.index, filename: this.currentFileInfo.filename }; + } + var important = this.important, + importantResult = context.importantScope.pop(); + if (!important && importantResult.important) { + important = importantResult.important; + } + + return new Declaration(name, + evaldValue, + important, + this.merge, + this.index, this.currentFileInfo, this.inline, + variable); + } + catch(e) { + if (typeof e.index !== 'number') { + e.index = this.index; + e.filename = this.currentFileInfo.filename; + } + throw e; + } + finally { + if (strictMathBypass) { + context.strictMath = false; + } + } +}; +Declaration.prototype.makeImportant = function () { + return new Declaration(this.name, + this.value, + "!important", + this.merge, + this.index, this.currentFileInfo, this.inline); +}; + +module.exports = Declaration; \ No newline at end of file diff --git a/lib/less/tree/directive.js b/lib/less/tree/directive.js index 70be82c73..b6797fa95 100644 --- a/lib/less/tree/directive.js +++ b/lib/less/tree/directive.js @@ -1,134 +1,13 @@ -var Node = require("./node"), - Selector = require("./selector"), - Ruleset = require("./ruleset"); +// Backwards compatibility shim for Directive (AtRule) +var AtRule = require("./atrule"); -var Directive = function (name, value, rules, index, currentFileInfo, debugInfo, isRooted, visibilityInfo) { - var i; - - this.name = name; - this.value = value; - if (rules) { - if (Array.isArray(rules)) { - this.rules = rules; - } else { - this.rules = [rules]; - this.rules[0].selectors = (new Selector([], null, null, this.index, currentFileInfo)).createEmptySelectors(); - } - for (i = 0; i < this.rules.length; i++) { - this.rules[i].allowImports = true; - } - } - this.index = index; - this.currentFileInfo = currentFileInfo; - this.debugInfo = debugInfo; - this.isRooted = isRooted || false; - this.copyVisibilityInfo(visibilityInfo); - this.allowRoot = true; +var Directive = function () { + var args = Array.prototype.slice.call(arguments); + AtRule.call(this, args); }; -Directive.prototype = new Node(); +Directive.prototype = Object.create(AtRule.prototype); +Directive.prototype.constructor = Directive; Directive.prototype.type = "Directive"; -Directive.prototype.accept = function (visitor) { - var value = this.value, rules = this.rules; - if (rules) { - this.rules = visitor.visitArray(rules); - } - if (value) { - this.value = visitor.visit(value); - } -}; -Directive.prototype.isRulesetLike = function() { - return this.rules || !this.isCharset(); -}; -Directive.prototype.isCharset = function() { - return "@charset" === this.name; -}; -Directive.prototype.genCSS = function (context, output) { - var value = this.value, rules = this.rules; - output.add(this.name, this.currentFileInfo, this.index); - if (value) { - output.add(' '); - value.genCSS(context, output); - } - if (rules) { - this.outputRuleset(context, output, rules); - } else { - output.add(';'); - } -}; -Directive.prototype.eval = function (context) { - var mediaPathBackup, mediaBlocksBackup, value = this.value, rules = this.rules; - - //media stored inside other directive should not bubble over it - //backpup media bubbling information - mediaPathBackup = context.mediaPath; - mediaBlocksBackup = context.mediaBlocks; - //deleted media bubbling information - context.mediaPath = []; - context.mediaBlocks = []; - if (value) { - value = value.eval(context); - } - if (rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - rules = [rules[0].eval(context)]; - rules[0].root = true; - } - //restore media bubbling information - context.mediaPath = mediaPathBackup; - context.mediaBlocks = mediaBlocksBackup; - - return new Directive(this.name, value, rules, - this.index, this.currentFileInfo, this.debugInfo, this.isRooted, this.visibilityInfo()); -}; -Directive.prototype.variable = function (name) { - if (this.rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - return Ruleset.prototype.variable.call(this.rules[0], name); - } -}; -Directive.prototype.find = function () { - if (this.rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - return Ruleset.prototype.find.apply(this.rules[0], arguments); - } -}; -Directive.prototype.rulesets = function () { - if (this.rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - return Ruleset.prototype.rulesets.apply(this.rules[0]); - } -}; -Directive.prototype.outputRuleset = function (context, output, rules) { - var ruleCnt = rules.length, i; - context.tabLevel = (context.tabLevel | 0) + 1; - - // Compressed - if (context.compress) { - output.add('{'); - for (i = 0; i < ruleCnt; i++) { - rules[i].genCSS(context, output); - } - output.add('}'); - context.tabLevel--; - return; - } - - // Non-compressed - var tabSetStr = '\n' + Array(context.tabLevel).join(" "), tabRuleStr = tabSetStr + " "; - if (!ruleCnt) { - output.add(" {" + tabSetStr + '}'); - } else { - output.add(" {" + tabRuleStr); - rules[0].genCSS(context, output); - for (i = 1; i < ruleCnt; i++) { - output.add(tabRuleStr); - rules[i].genCSS(context, output); - } - output.add(tabSetStr + '}'); - } - - context.tabLevel--; -}; -module.exports = Directive; +module.exports = Directive; \ No newline at end of file diff --git a/lib/less/tree/index.js b/lib/less/tree/index.js index c4624dd69..b7e6d60f5 100644 --- a/lib/less/tree/index.js +++ b/lib/less/tree/index.js @@ -3,6 +3,8 @@ var tree = {}; tree.Node = require('./node'); tree.Alpha = require('./alpha'); tree.Color = require('./color'); +tree.AtRule = require('./atrule'); +// Backwards compatibility tree.Directive = require('./directive'); tree.DetachedRuleset = require('./detached-ruleset'); tree.Operation = require('./operation'); @@ -17,6 +19,8 @@ tree.Combinator = require('./combinator'); tree.Selector = require('./selector'); tree.Quoted = require('./quoted'); tree.Expression = require('./expression'); +tree.Declaration = require('./declaration'); +// Backwards compatibility tree.Rule = require('./rule'); tree.Call = require('./call'); tree.URL = require('./url'); diff --git a/lib/less/tree/media.js b/lib/less/tree/media.js index 0bbd23a65..bfba0e36f 100644 --- a/lib/less/tree/media.js +++ b/lib/less/tree/media.js @@ -3,7 +3,7 @@ var Ruleset = require("./ruleset"), Selector = require("./selector"), Anonymous = require("./anonymous"), Expression = require("./expression"), - Directive = require("./directive"); + AtRule = require("./atrule"); var Media = function (value, features, index, currentFileInfo, visibilityInfo) { this.index = index; @@ -17,7 +17,7 @@ var Media = function (value, features, index, currentFileInfo, visibilityInfo) { this.copyVisibilityInfo(visibilityInfo); this.allowRoot = true; }; -Media.prototype = new Directive(); +Media.prototype = new AtRule(); Media.prototype.type = "Media"; Media.prototype.isRulesetLike = true; Media.prototype.accept = function (visitor) { diff --git a/lib/less/tree/mixin-definition.js b/lib/less/tree/mixin-definition.js index b2e3413d0..d2c366c03 100644 --- a/lib/less/tree/mixin-definition.js +++ b/lib/less/tree/mixin-definition.js @@ -1,7 +1,7 @@ var Selector = require("./selector"), Element = require("./element"), Ruleset = require("./ruleset"), - Rule = require("./rule"), + Declaration = require("./declaration"), Expression = require("./expression"), contexts = require("../contexts"); @@ -64,7 +64,7 @@ Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArgume for (j = 0; j < params.length; j++) { if (!evaldArguments[j] && name === params[j].name) { evaldArguments[j] = arg.value.eval(context); - frame.prependRule(new Rule(name, arg.value.eval(context))); + frame.prependRule(new Declaration(name, arg.value.eval(context))); isNamedFound = true; break; } @@ -92,7 +92,7 @@ Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArgume for (j = argIndex; j < argsLength; j++) { varargs.push(args[j].value.eval(context)); } - frame.prependRule(new Rule(name, new Expression(varargs).eval(context))); + frame.prependRule(new Declaration(name, new Expression(varargs).eval(context))); } else { val = arg && arg.value; if (val) { @@ -105,7 +105,7 @@ Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArgume ' (' + argsLength + ' for ' + this.arity + ')' }; } - frame.prependRule(new Rule(name, val)); + frame.prependRule(new Declaration(name, val)); evaldArguments[i] = val; } } @@ -140,7 +140,7 @@ Definition.prototype.evalCall = function (context, args, important) { frame = this.evalParams(context, new contexts.Eval(context, mixinFrames), args, _arguments), rules, ruleset; - frame.prependRule(new Rule('@arguments', new Expression(_arguments).eval(context))); + frame.prependRule(new Declaration('@arguments', new Expression(_arguments).eval(context))); rules = this.rules.slice(0); diff --git a/lib/less/tree/rule.js b/lib/less/tree/rule.js index 99d168cff..16540a54c 100644 --- a/lib/less/tree/rule.js +++ b/lib/less/tree/rule.js @@ -1,96 +1,13 @@ -var Node = require("./node"), - Value = require("./value"), - Keyword = require("./keyword"); +// Backwards compatibility shim for Rule (Declaration) +var Declaration = require("./declaration"); -var Rule = function (name, value, important, merge, index, currentFileInfo, inline, variable) { - this.name = name; - this.value = (value instanceof Node) ? value : new Value([value]); //value instanceof tree.Value || value instanceof tree.Ruleset ?? - this.important = important ? ' ' + important.trim() : ''; - this.merge = merge; - this.index = index; - this.currentFileInfo = currentFileInfo; - this.inline = inline || false; - this.variable = (variable !== undefined) ? variable - : (name.charAt && (name.charAt(0) === '@')); - this.allowRoot = true; +var Rule = function () { + var args = Array.prototype.slice.call(arguments); + Declaration.call(this, args); }; -function evalName(context, name) { - var value = "", i, n = name.length, - output = {add: function (s) {value += s;}}; - for (i = 0; i < n; i++) { - name[i].eval(context).genCSS(context, output); - } - return value; -} - -Rule.prototype = new Node(); +Rule.prototype = Object.create(Declaration.prototype); +Rule.prototype.constructor = Rule; Rule.prototype.type = "Rule"; -Rule.prototype.genCSS = function (context, output) { - output.add(this.name + (context.compress ? ':' : ': '), this.currentFileInfo, this.index); - try { - this.value.genCSS(context, output); - } - catch(e) { - e.index = this.index; - e.filename = this.currentFileInfo.filename; - throw e; - } - output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? "" : ";"), this.currentFileInfo, this.index); -}; -Rule.prototype.eval = function (context) { - var strictMathBypass = false, name = this.name, evaldValue, variable = this.variable; - if (typeof name !== "string") { - // expand 'primitive' name directly to get - // things faster (~10% for benchmark.less): - name = (name.length === 1) && (name[0] instanceof Keyword) ? - name[0].value : evalName(context, name); - variable = false; // never treat expanded interpolation as new variable name - } - if (name === "font" && !context.strictMath) { - strictMathBypass = true; - context.strictMath = true; - } - try { - context.importantScope.push({}); - evaldValue = this.value.eval(context); - - if (!this.variable && evaldValue.type === "DetachedRuleset") { - throw { message: "Rulesets cannot be evaluated on a property.", - index: this.index, filename: this.currentFileInfo.filename }; - } - var important = this.important, - importantResult = context.importantScope.pop(); - if (!important && importantResult.important) { - important = importantResult.important; - } - - return new Rule(name, - evaldValue, - important, - this.merge, - this.index, this.currentFileInfo, this.inline, - variable); - } - catch(e) { - if (typeof e.index !== 'number') { - e.index = this.index; - e.filename = this.currentFileInfo.filename; - } - throw e; - } - finally { - if (strictMathBypass) { - context.strictMath = false; - } - } -}; -Rule.prototype.makeImportant = function () { - return new Rule(this.name, - this.value, - "!important", - this.merge, - this.index, this.currentFileInfo, this.inline); -}; module.exports = Rule; \ No newline at end of file diff --git a/lib/less/tree/ruleset.js b/lib/less/tree/ruleset.js index bac6d6fbb..08dc53b50 100644 --- a/lib/less/tree/ruleset.js +++ b/lib/less/tree/ruleset.js @@ -1,5 +1,5 @@ var Node = require("./node"), - Rule = require("./rule"), + Declaration = require("./declaration"), Selector = require("./selector"), Element = require("./element"), Paren = require("./paren"), @@ -114,7 +114,7 @@ Ruleset.prototype.eval = function (context) { if (rsRules[i].type === "MixinCall") { /*jshint loopfunc:true */ rules = rsRules[i].eval(context).filter(function(r) { - if ((r instanceof Rule) && r.variable) { + if ((r instanceof Declaration) && r.variable) { // do not pollute the scope if the variable is // already there. consider returning false here // but we need a way to "return" variable from mixins @@ -129,7 +129,7 @@ Ruleset.prototype.eval = function (context) { } else if (rsRules[i].type === "RulesetCall") { /*jshint loopfunc:true */ rules = rsRules[i].eval(context).rules.filter(function(r) { - if ((r instanceof Rule) && r.variable) { + if ((r instanceof Declaration) && r.variable) { // do not pollute the scope at all return false; } @@ -163,7 +163,7 @@ Ruleset.prototype.eval = function (context) { subRule = rule.rules[j]; if (subRule instanceof Node) { subRule.copyVisibilityInfo(rule.visibilityInfo()); - if (!(subRule instanceof Rule) || !subRule.variable) { + if (!(subRule instanceof Declaration) || !subRule.variable) { rsRules.splice(++i, 0, subRule); } } @@ -237,7 +237,7 @@ Ruleset.prototype.resetCache = function () { Ruleset.prototype.variables = function () { if (!this._variables) { this._variables = !this.rules ? {} : this.rules.reduce(function (hash, r) { - if (r instanceof Rule && r.variable === true) { + if (r instanceof Declaration && r.variable === true) { hash[r.name] = r; } // when evaluating variables in an import statement, imports have not been eval'd @@ -334,7 +334,7 @@ Ruleset.prototype.genCSS = function (context, output) { function isRulesetLikeNode(rule) { // if it has nested rules, then it should be treated like a ruleset // medias and comments do not have nested rules, but should be treated like rulesets anyway - // some directives and anonymous nodes are ruleset like, others are not + // some atrules and anonymous nodes are ruleset like, others are not if (typeof rule.isRulesetLike === "boolean") { return rule.isRulesetLike; } else if (typeof rule.isRulesetLike === "function") { diff --git a/lib/less/visitors/extend-visitor.js b/lib/less/visitors/extend-visitor.js index ff2b3c86e..1d757ddb1 100644 --- a/lib/less/visitors/extend-visitor.js +++ b/lib/less/visitors/extend-visitor.js @@ -16,7 +16,7 @@ ExtendFinderVisitor.prototype = { root.allExtends = this.allExtendsStack[0]; return root; }, - visitRule: function (ruleNode, visitArgs) { + visitDeclaration: function (declNode, visitArgs) { visitArgs.visitDeeper = false; }, visitMixinDefinition: function (mixinDefinitionNode, visitArgs) { @@ -79,11 +79,11 @@ ExtendFinderVisitor.prototype = { visitMediaOut: function (mediaNode) { this.allExtendsStack.length = this.allExtendsStack.length - 1; }, - visitDirective: function (directiveNode, visitArgs) { - directiveNode.allExtends = []; - this.allExtendsStack.push(directiveNode.allExtends); + visitAtRule: function (atRuleNode, visitArgs) { + atRuleNode.allExtends = []; + this.allExtendsStack.push(atRuleNode.allExtends); }, - visitDirectiveOut: function (directiveNode) { + visitAtRuleOut: function (atRuleNode) { this.allExtendsStack.length = this.allExtendsStack.length - 1; } }; @@ -214,7 +214,7 @@ ProcessExtendsVisitor.prototype = { return extendsToAdd; } }, - visitRule: function (ruleNode, visitArgs) { + visitDeclaration: function (ruleNode, visitArgs) { visitArgs.visitDeeper = false; }, visitMixinDefinition: function (mixinDefinitionNode, visitArgs) { @@ -446,12 +446,12 @@ ProcessExtendsVisitor.prototype = { var lastIndex = this.allExtendsStack.length - 1; this.allExtendsStack.length = lastIndex; }, - visitDirective: function (directiveNode, visitArgs) { - var newAllExtends = directiveNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]); - newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, directiveNode.allExtends)); + visitAtRule: function (atRuleNode, visitArgs) { + var newAllExtends = atRuleNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]); + newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, atRuleNode.allExtends)); this.allExtendsStack.push(newAllExtends); }, - visitDirectiveOut: function (directiveNode) { + visitAtRuleOut: function (atRuleNode) { var lastIndex = this.allExtendsStack.length - 1; this.allExtendsStack.length = lastIndex; } diff --git a/lib/less/visitors/import-visitor.js b/lib/less/visitors/import-visitor.js index c0674569a..803f89b43 100644 --- a/lib/less/visitors/import-visitor.js +++ b/lib/less/visitors/import-visitor.js @@ -149,22 +149,22 @@ ImportVisitor.prototype = { importVisitor._sequencer.tryRun(); } }, - visitRule: function (ruleNode, visitArgs) { - if (ruleNode.value.type === "DetachedRuleset") { - this.context.frames.unshift(ruleNode); + visitDeclaration: function (declNode, visitArgs) { + if (declNode.value.type === "DetachedRuleset") { + this.context.frames.unshift(declNode); } else { visitArgs.visitDeeper = false; } }, - visitRuleOut : function(ruleNode) { - if (ruleNode.value.type === "DetachedRuleset") { + visitDeclarationOut: function(declNode) { + if (declNode.value.type === "DetachedRuleset") { this.context.frames.shift(); } }, - visitDirective: function (directiveNode, visitArgs) { - this.context.frames.unshift(directiveNode); + visitAtRule: function (atRuleNode, visitArgs) { + this.context.frames.unshift(atRuleNode); }, - visitDirectiveOut: function (directiveNode) { + visitAtRuleOut: function (atRuleNode) { this.context.frames.shift(); }, visitMixinDefinition: function (mixinDefinitionNode, visitArgs) { diff --git a/lib/less/visitors/join-selector-visitor.js b/lib/less/visitors/join-selector-visitor.js index c75973c44..9d1df488b 100644 --- a/lib/less/visitors/join-selector-visitor.js +++ b/lib/less/visitors/join-selector-visitor.js @@ -9,7 +9,7 @@ JoinSelectorVisitor.prototype = { run: function (root) { return this._visitor.visit(root); }, - visitRule: function (ruleNode, visitArgs) { + visitDeclaration: function (declNode, visitArgs) { visitArgs.visitDeeper = false; }, visitMixinDefinition: function (mixinDefinitionNode, visitArgs) { @@ -40,10 +40,10 @@ JoinSelectorVisitor.prototype = { var context = this.contexts[this.contexts.length - 1]; mediaNode.rules[0].root = (context.length === 0 || context[0].multiMedia); }, - visitDirective: function (directiveNode, visitArgs) { + visitAtRule: function (atRuleNode, visitArgs) { var context = this.contexts[this.contexts.length - 1]; - if (directiveNode.rules && directiveNode.rules.length) { - directiveNode.rules[0].root = (directiveNode.isRooted || context.length === 0 || null); + if (atRuleNode.rules && atRuleNode.rules.length) { + atRuleNode.rules[0].root = (atRuleNode.isRooted || context.length === 0 || null); } } }; diff --git a/lib/less/visitors/to-css-visitor.js b/lib/less/visitors/to-css-visitor.js index ed6ed44d9..a4eefdc99 100644 --- a/lib/less/visitors/to-css-visitor.js +++ b/lib/less/visitors/to-css-visitor.js @@ -15,7 +15,7 @@ CSSVisitorUtils.prototype = { for (var r = 0; r < bodyRules.length; r++) { rule = bodyRules[r]; if (rule.isSilent && rule.isSilent(this._context) && !rule.blocksVisibility()) { - //the directive contains something that was referenced (likely by extend) + //the atrule contains something that was referenced (likely by extend) //therefore it needs to be shown in output too return true; } @@ -100,11 +100,11 @@ ToCSSVisitor.prototype = { return this._visitor.visit(root); }, - visitRule: function (ruleNode, visitArgs) { - if (ruleNode.blocksVisibility() || ruleNode.variable) { + visitDeclaration: function (declNode, visitArgs) { + if (declNode.blocksVisibility() || declNode.variable) { return; } - return ruleNode; + return declNode; }, visitMixinDefinition: function (mixinNode, visitArgs) { @@ -138,24 +138,24 @@ ToCSSVisitor.prototype = { return importNode; }, - visitDirective: function(directiveNode, visitArgs) { - if (directiveNode.rules && directiveNode.rules.length) { - return this.visitDirectiveWithBody(directiveNode, visitArgs); + visitAtRule: function(atRuleNode, visitArgs) { + if (atRuleNode.rules && atRuleNode.rules.length) { + return this.visitAtRuleWithBody(atRuleNode, visitArgs); } else { - return this.visitDirectiveWithoutBody(directiveNode, visitArgs); + return this.visitAtRuleWithoutBody(atRuleNode, visitArgs); } }, - visitDirectiveWithBody: function(directiveNode, visitArgs) { + visitAtRuleWithBody: function(atRuleNode, visitArgs) { //if there is only one nested ruleset and that one has no path, then it is //just fake ruleset - function hasFakeRuleset(directiveNode) { - var bodyRules = directiveNode.rules; + function hasFakeRuleset(atRuleNode) { + var bodyRules = atRuleNode.rules; return bodyRules.length === 1 && (!bodyRules[0].paths || bodyRules[0].paths.length === 0); } - function getBodyRules(directiveNode) { - var nodeRules = directiveNode.rules; - if (hasFakeRuleset(directiveNode)) { + function getBodyRules(atRuleNode) { + var nodeRules = atRuleNode.rules; + if (hasFakeRuleset(atRuleNode)) { return nodeRules[0].rules; } @@ -164,30 +164,30 @@ ToCSSVisitor.prototype = { //it is still true that it is only one ruleset in array //this is last such moment //process childs - var originalRules = getBodyRules(directiveNode); - directiveNode.accept(this._visitor); + var originalRules = getBodyRules(atRuleNode); + atRuleNode.accept(this._visitor); visitArgs.visitDeeper = false; - if (!this.utils.isEmpty(directiveNode)) { - this._mergeRules(directiveNode.rules[0].rules); + if (!this.utils.isEmpty(atRuleNode)) { + this._mergeRules(atRuleNode.rules[0].rules); } - return this.utils.resolveVisibility(directiveNode, originalRules); + return this.utils.resolveVisibility(atRuleNode, originalRules); }, - visitDirectiveWithoutBody: function(directiveNode, visitArgs) { - if (directiveNode.blocksVisibility()) { + visitAtRuleWithoutBody: function(atRuleNode, visitArgs) { + if (atRuleNode.blocksVisibility()) { return; } - if (directiveNode.name === "@charset") { + if (atRuleNode.name === "@charset") { // Only output the debug info together with subsequent @charset definitions - // a comment (or @media statement) before the actual @charset directive would + // a comment (or @media statement) before the actual @charset atrule would // be considered illegal css as it has to be on the first line if (this.charset) { - if (directiveNode.debugInfo) { - var comment = new tree.Comment("/* " + directiveNode.toCSS(this._context).replace(/\n/g, "") + " */\n"); - comment.debugInfo = directiveNode.debugInfo; + if (atRuleNode.debugInfo) { + var comment = new tree.Comment("/* " + atRuleNode.toCSS(this._context).replace(/\n/g, "") + " */\n"); + comment.debugInfo = atRuleNode.debugInfo; return this._visitor.visit(comment); } return; @@ -195,7 +195,7 @@ ToCSSVisitor.prototype = { this.charset = true; } - return directiveNode; + return atRuleNode; }, checkValidNodes: function(rules, isRoot) { @@ -205,7 +205,7 @@ ToCSSVisitor.prototype = { for (var i = 0; i < rules.length; i++) { var ruleNode = rules[i]; - if (isRoot && ruleNode instanceof tree.Rule && !ruleNode.variable) { + if (isRoot && ruleNode instanceof tree.Declaration && !ruleNode.variable) { throw { message: "Properties must be inside selector blocks. They cannot be in the root", index: ruleNode.index, filename: ruleNode.currentFileInfo && ruleNode.currentFileInfo.filename}; } @@ -302,12 +302,12 @@ ToCSSVisitor.prototype = { for (i = rules.length - 1; i >= 0 ; i--) { rule = rules[i]; - if (rule instanceof tree.Rule) { + if (rule instanceof tree.Declaration) { if (!ruleCache[rule.name]) { ruleCache[rule.name] = rule; } else { ruleList = ruleCache[rule.name]; - if (ruleList instanceof tree.Rule) { + if (ruleList instanceof tree.Declaration) { ruleList = ruleCache[rule.name] = [ruleCache[rule.name].toCSS(this._context)]; } var ruleCSS = rule.toCSS(this._context); @@ -332,7 +332,7 @@ ToCSSVisitor.prototype = { for (var i = 0; i < rules.length; i++) { rule = rules[i]; - if ((rule instanceof tree.Rule) && rule.merge) { + if ((rule instanceof tree.Declaration) && rule.merge) { key = [rule.name, rule.important ? "!" : ""].join(","); diff --git a/lib/less/visitors/visitor.js b/lib/less/visitors/visitor.js index afa05d704..f4d3fc5e6 100644 --- a/lib/less/visitors/visitor.js +++ b/lib/less/visitors/visitor.js @@ -30,6 +30,7 @@ function indexNodeTypes(parent, ticker) { return ticker; } + var Visitor = function(implementation) { this._implementation = implementation; this._visitFnCache = []; From 270fd097c99d9e3d4d7bcd090dd7a61197a29e40 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Wed, 6 Jul 2016 13:26:25 -0700 Subject: [PATCH 08/97] Plugin loader set up for lessc, node, and browser --- .jscsrc | 4 +- bin/lessc | 462 ++++++++++-------- lib/less-browser/index.js | 12 +- lib/less-browser/plugin-loader.js | 49 +- lib/less-node/index.js | 3 + lib/less-node/lessc-helper.js | 2 +- lib/less-node/plugin-loader.js | 105 ++-- .../environment/abstract-plugin-loader.js | 71 +-- lib/less/import-manager.js | 21 +- lib/less/parse.js | 27 +- lib/less/plugin-manager.js | 11 +- lib/less/transform-tree.js | 6 +- lib/less/tree/import.js | 2 +- lib/less/tree/js-eval-node.js | 2 +- test/less/errors/functions-1.less | 2 +- test/less/errors/functions-1.txt | 2 +- test/less/errors/functions-10-keyword.less | 2 +- test/less/errors/functions-10-keyword.txt | 2 +- test/less/errors/functions-11-operation.less | 2 +- test/less/errors/functions-11-operation.txt | 2 +- test/less/errors/functions-12-quoted.less | 2 +- test/less/errors/functions-12-quoted.txt | 2 +- test/less/errors/functions-13-selector.less | 2 +- test/less/errors/functions-13-selector.txt | 2 +- test/less/errors/functions-14-url.less | 2 +- test/less/errors/functions-14-url.txt | 2 +- test/less/errors/functions-15-value.less | 2 +- test/less/errors/functions-15-value.txt | 2 +- test/less/errors/functions-16-old-syntax.less | 1 - test/less/errors/functions-16-old-syntax.txt | 2 - test/less/errors/functions-2-alpha.less | 2 +- test/less/errors/functions-2-alpha.txt | 2 +- test/less/errors/functions-3-assignment.less | 2 +- test/less/errors/functions-3-assignment.txt | 2 +- test/less/errors/functions-4-call.less | 2 +- test/less/errors/functions-4-call.txt | 2 +- test/less/errors/functions-5-color.less | 2 +- test/less/errors/functions-5-color.txt | 2 +- test/less/errors/functions-6-condition.less | 2 +- test/less/errors/functions-6-condition.txt | 2 +- test/less/errors/functions-7-dimension.less | 2 +- test/less/errors/functions-7-dimension.txt | 2 +- test/less/errors/functions-8-element.less | 2 +- test/less/errors/functions-8-element.txt | 2 +- test/less/errors/functions-9-expression.less | 2 +- test/less/errors/functions-9-expression.txt | 2 +- test/less/errors/root-func-undefined-2.less | 2 +- test/less/errors/root-func-undefined-2.txt | 2 +- test/less/plugin.less | 16 +- .../plugin-global.js} | 0 .../plugin-local.js} | 0 .../plugin-transitive.js} | 0 .../plugin-transitive.less} | 2 +- .../plugin-tree-nodes.js} | 0 54 files changed, 494 insertions(+), 368 deletions(-) delete mode 100644 test/less/errors/functions-16-old-syntax.less delete mode 100644 test/less/errors/functions-16-old-syntax.txt rename test/less/{extension/extension-global.js => plugin/plugin-global.js} (100%) rename test/less/{extension/extension-local.js => plugin/plugin-local.js} (100%) rename test/less/{extension/extension-transitive.js => plugin/plugin-transitive.js} (100%) rename test/less/{extension/extension-transitive.less => plugin/plugin-transitive.less} (55%) rename test/less/{extension/extension-tree-nodes.js => plugin/plugin-tree-nodes.js} (100%) diff --git a/.jscsrc b/.jscsrc index a576705f2..d02315747 100644 --- a/.jscsrc +++ b/.jscsrc @@ -1,5 +1,5 @@ { - "disallowImplicitTypeConversion": ["numeric", "boolean", "binary", "string"], + "disallowImplicitTypeConversion": ["numeric", "binary", "string"], "disallowKeywords": ["with"], "disallowMixedSpacesAndTabs": true, "disallowMultipleLineBreaks": true, @@ -14,7 +14,7 @@ "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true}, "disallowTrailingComma": true, - "disallowTrailingWhitespace": true, + "disallowTrailingWhitespace": false, "maximumLineLength": 160, "requireCommaBeforeLineBreak": true, "requireCurlyBraces": [ "if", diff --git a/bin/lessc b/bin/lessc index d733323c7..e109ce08c 100755 --- a/bin/lessc +++ b/bin/lessc @@ -14,31 +14,43 @@ try { var less = require('../lib/less-node'), pluginLoader = new less.PluginLoader(less), - plugin, - plugins = []; - -var args = process.argv.slice(1); -var silent = false, + plugins = [], + queuePlugins = [], + args = process.argv.slice(1), + silent = false, verbose = false, options = { - depends: false, - compress: false, - max_line_len: -1, - lint: false, - paths: [], - color: true, - strictImports: false, - insecure: false, - rootpath: '', - relativeUrls: false, - ieCompat: true, - strictMath: false, - strictUnits: false, - globalVars: null, - modifyVars: null, - urlArgs: '', - plugins: plugins -}; + depends: false, + compress: false, + max_line_len: -1, + lint: false, + paths: [], + color: true, + strictImports: false, + insecure: false, + rootpath: '', + relativeUrls: false, + ieCompat: true, + strictMath: false, + strictUnits: false, + globalVars: null, + modifyVars: null, + urlArgs: '', + plugins: plugins + }; + +if (less.options) { + for (var i = 0, keys = Object.keys(options); i < keys.length; i++) { + if (!less.options[keys[i]]) { + less.options[keys[i]] = options[keys[i]]; + } + } + options = less.options; +} +else { + less.options = options; +} + var sourceMapOptions = {}; var continueProcessing = true; @@ -94,194 +106,7 @@ function printUsage() { pluginLoader.printUsage(plugins); continueProcessing = false; } - -// self executing function so we can return -(function() { - args = args.filter(function (arg) { - var match; - - match = arg.match(/^-I(.+)$/); - if (match) { - options.paths.push(match[1]); - return false; - } - - match = arg.match(/^--?([a-z][0-9a-z-]*)(?:=(.*))?$/i); - if (match) { - arg = match[1]; - } else { - return arg; - } - - switch (arg) { - case 'v': - case 'version': - console.log("lessc " + less.version.join('.') + " (Less Compiler) [JavaScript]"); - continueProcessing = false; - break; - case 'verbose': - verbose = true; - break; - case 's': - case 'silent': - silent = true; - break; - case 'l': - case 'lint': - options.lint = true; - break; - case 'strict-imports': - options.strictImports = true; - break; - case 'h': - case 'help': - printUsage(); - break; - case 'x': - case 'compress': - options.compress = true; - break; - case 'insecure': - options.insecure = true; - break; - case 'M': - case 'depends': - options.depends = true; - break; - case 'max-line-len': - if (checkArgFunc(arg, match[2])) { - options.maxLineLen = parseInt(match[2], 10); - if (options.maxLineLen <= 0) { - options.maxLineLen = -1; - } - } - break; - case 'no-color': - options.color = false; - break; - case 'no-ie-compat': - options.ieCompat = false; - break; - case 'no-js': - options.javascriptEnabled = false; - break; - case 'include-path': - if (checkArgFunc(arg, match[2])) { - // ; supported on windows. - // : supported on windows and linux, excluding a drive letter like C:\ so C:\file:D:\file parses to 2 - options.paths = match[2] - .split(os.type().match(/Windows/) ? /:(?!\\)|;/ : ':') - .map(function(p) { - if (p) { - return path.resolve(process.cwd(), p); - } - }); - } - break; - case 'line-numbers': - if (checkArgFunc(arg, match[2])) { - options.dumpLineNumbers = match[2]; - } - break; - case 'source-map': - options.sourceMap = true; - if (match[2]) { - sourceMapOptions.sourceMapFullFilename = match[2]; - } - break; - case 'source-map-rootpath': - if (checkArgFunc(arg, match[2])) { - sourceMapOptions.sourceMapRootpath = match[2]; - } - break; - case 'source-map-basepath': - if (checkArgFunc(arg, match[2])) { - sourceMapOptions.sourceMapBasepath = match[2]; - } - break; - case 'source-map-map-inline': - sourceMapFileInline = true; - options.sourceMap = true; - break; - case 'source-map-less-inline': - sourceMapOptions.outputSourceFiles = true; - break; - case 'source-map-url': - if (checkArgFunc(arg, match[2])) { - sourceMapOptions.sourceMapURL = match[2]; - } - break; - case 'rp': - case 'rootpath': - if (checkArgFunc(arg, match[2])) { - options.rootpath = match[2].replace(/\\/g, '/'); - } - break; - case "ru": - case "relative-urls": - options.relativeUrls = true; - break; - case "sm": - case "strict-math": - if (checkArgFunc(arg, match[2])) { - options.strictMath = checkBooleanArg(match[2]); - } - break; - case "su": - case "strict-units": - if (checkArgFunc(arg, match[2])) { - options.strictUnits = checkBooleanArg(match[2]); - } - break; - case "global-var": - if (checkArgFunc(arg, match[2])) { - if (!options.globalVars) { - options.globalVars = {}; - } - parseVariableOption(match[2], options.globalVars); - } - break; - case "modify-var": - if (checkArgFunc(arg, match[2])) { - if (!options.modifyVars) { - options.modifyVars = {}; - } - - parseVariableOption(match[2], options.modifyVars); - } - break; - case 'url-args': - if (checkArgFunc(arg, match[2])) { - options.urlArgs = match[2]; - } - break; - case 'plugin': - var splitupArg = match[2].match(/^([^=]+)(=(.*))?/), - name = splitupArg[1], - pluginOptions = splitupArg[3]; - - plugin = pluginLoader.tryLoadPlugin(name, pluginOptions); - if (plugin) { - plugins.push(plugin); - } else { - console.error("Unable to load plugin " + name + - " please make sure that it is installed under or at the same level as less"); - process.exitCode = 1; - } - break; - default: - plugin = pluginLoader.tryLoadPlugin("less-plugin-" + arg, match[2]); - if (plugin) { - plugins.push(plugin); - } else { - console.error("Unable to interpret argument " + arg + - " - if it is a plugin (less-plugin-" + arg + "), make sure that it is installed under or at" + - " the same level as less"); - process.exitCode = 1; - } - break; - } - }); +function render() { if (!continueProcessing) { return; @@ -505,4 +330,219 @@ function printUsage() { parseLessFile(false, buffer); }); } +} + +function processPluginQueue() { + var x = 0; + + function pluginError(name) { + console.error("Unable to load plugin " + name + + " please make sure that it is installed under or at the same level as less"); + process.exitCode = 1; + } + function pluginFinished(plugin) { + x++; + plugins.push(plugin); + if (x === queuePlugins.length) { + render(); + } + } + queuePlugins.forEach(function(queue) { + pluginLoader.tryLoadPlugin(queue.name, function(err, data) { + if (err) { + pluginError(queue.name); + } + else { + pluginFinished({ + fileContent: data.contents, + filename: data.filename, + options: queue.options + }); + } + }); + }); +} + +// self executing function so we can return +(function() { + args = args.filter(function (arg) { + var match; + + match = arg.match(/^-I(.+)$/); + if (match) { + options.paths.push(match[1]); + return false; + } + + match = arg.match(/^--?([a-z][0-9a-z-]*)(?:=(.*))?$/i); + if (match) { + arg = match[1]; + } else { + return arg; + } + + switch (arg) { + case 'v': + case 'version': + console.log("lessc " + less.version.join('.') + " (Less Compiler) [JavaScript]"); + continueProcessing = false; + break; + case 'verbose': + verbose = true; + break; + case 's': + case 'silent': + silent = true; + break; + case 'l': + case 'lint': + options.lint = true; + break; + case 'strict-imports': + options.strictImports = true; + break; + case 'h': + case 'help': + printUsage(); + break; + case 'x': + case 'compress': + options.compress = true; + break; + case 'insecure': + options.insecure = true; + break; + case 'M': + case 'depends': + options.depends = true; + break; + case 'max-line-len': + if (checkArgFunc(arg, match[2])) { + options.maxLineLen = parseInt(match[2], 10); + if (options.maxLineLen <= 0) { + options.maxLineLen = -1; + } + } + break; + case 'no-color': + options.color = false; + break; + case 'no-ie-compat': + options.ieCompat = false; + break; + case 'inline-js': + options.javascriptEnabled = true; + break; + case 'no-js': + console.error('The "--no-js" argument is deprecated. Use "--inline-js" to enable inline JavaScript.'); + break; + case 'include-path': + if (checkArgFunc(arg, match[2])) { + // ; supported on windows. + // : supported on windows and linux, excluding a drive letter like C:\ so C:\file:D:\file parses to 2 + options.paths = match[2] + .split(os.type().match(/Windows/) ? /:(?!\\)|;/ : ':') + .map(function(p) { + if (p) { + return path.resolve(process.cwd(), p); + } + }); + } + break; + case 'line-numbers': + if (checkArgFunc(arg, match[2])) { + options.dumpLineNumbers = match[2]; + } + break; + case 'source-map': + options.sourceMap = true; + if (match[2]) { + sourceMapOptions.sourceMapFullFilename = match[2]; + } + break; + case 'source-map-rootpath': + if (checkArgFunc(arg, match[2])) { + sourceMapOptions.sourceMapRootpath = match[2]; + } + break; + case 'source-map-basepath': + if (checkArgFunc(arg, match[2])) { + sourceMapOptions.sourceMapBasepath = match[2]; + } + break; + case 'source-map-map-inline': + sourceMapFileInline = true; + options.sourceMap = true; + break; + case 'source-map-less-inline': + sourceMapOptions.outputSourceFiles = true; + break; + case 'source-map-url': + if (checkArgFunc(arg, match[2])) { + sourceMapOptions.sourceMapURL = match[2]; + } + break; + case 'rp': + case 'rootpath': + if (checkArgFunc(arg, match[2])) { + options.rootpath = match[2].replace(/\\/g, '/'); + } + break; + case "ru": + case "relative-urls": + options.relativeUrls = true; + break; + case "sm": + case "strict-math": + if (checkArgFunc(arg, match[2])) { + options.strictMath = checkBooleanArg(match[2]); + } + break; + case "su": + case "strict-units": + if (checkArgFunc(arg, match[2])) { + options.strictUnits = checkBooleanArg(match[2]); + } + break; + case "global-var": + if (checkArgFunc(arg, match[2])) { + if (!options.globalVars) { + options.globalVars = {}; + } + parseVariableOption(match[2], options.globalVars); + } + break; + case "modify-var": + if (checkArgFunc(arg, match[2])) { + if (!options.modifyVars) { + options.modifyVars = {}; + } + + parseVariableOption(match[2], options.modifyVars); + } + break; + case 'url-args': + if (checkArgFunc(arg, match[2])) { + options.urlArgs = match[2]; + } + break; + case 'plugin': + var splitupArg = match[2].match(/^([^=]+)(=(.*))?/), + name = splitupArg[1], + pluginOptions = splitupArg[3]; + queuePlugins.push({ name: name, options: pluginOptions }); + break; + default: + queuePlugins.push({ name: arg, options: match[2], default: true }); + break; + } + }); + + if (queuePlugins.length > 0) { + processPluginQueue(); + } + else { + render(); + } + })(); diff --git a/lib/less-browser/index.js b/lib/less-browser/index.js index 6a1fbf492..c89671251 100644 --- a/lib/less-browser/index.js +++ b/lib/less-browser/index.js @@ -9,7 +9,7 @@ module.exports = function(window, options) { var document = window.document; var less = require('../less')(); - //module.exports = less; + options.javascriptEnabled = !!(options.javascriptEnabled || options.inlineJavaScript); less.options = options; var environment = less.environment, FileManager = require("./file-manager")(options, less.logger), @@ -23,20 +23,13 @@ module.exports = function(window, options) { var cache = less.cache = options.cache || require("./cache")(window, options, less.logger); require('./image-size')(less.environment); - //Setup user functions + //Setup user functions - Deprecate? if (options.functions) { less.functions.functionRegistry.addMultiple(options.functions); } var typePattern = /^text\/(x-)?less$/; - function postProcessCSS(styles) { // deprecated, use a plugin for postprocesstasks - if (options.postProcessor && typeof options.postProcessor === 'function') { - styles = options.postProcessor.call(styles, styles) || styles; - } - return styles; - } - function clone(obj) { var cloned = {}; for (var prop in obj) { @@ -133,7 +126,6 @@ module.exports = function(window, options) { e.href = path; callback(e); } else { - result.css = postProcessCSS(result.css); cache.setCSS(sheet.href, webInfo.lastModified, instanceOptions.modifyVars, result.css); callback(null, result.css, data, sheet, webInfo, path); } diff --git a/lib/less-browser/plugin-loader.js b/lib/less-browser/plugin-loader.js index e80828de9..9331f0887 100644 --- a/lib/less-browser/plugin-loader.js +++ b/lib/less-browser/plugin-loader.js @@ -11,24 +11,49 @@ var PluginLoader = function(less) { PluginLoader.prototype = new AbstractPluginLoader(); -PluginLoader.prototype.tryLoadFromEnvironment = function(filename, basePath, callback) { +PluginLoader.prototype.tryLoadPlugin = function(name, argument, basePath, callback) { + var self = this; + var prefix = name.slice(0, 1); + var explicit = prefix === "." || prefix === "/" || name.slice(-3).toLowerCase() === ".js"; + this.tryLoadFromEnvironment(name, basePath, explicit, function(err, data) { + if (explicit) { + callback(err, data); + } + else { + if (!err) { + callback(null, data); + } + else { + self.tryLoadFromEnvironment('less-plugin-' + name, basePath, explicit, function(err2, data) { + callback(err, data); + }); + } + } + }); + +}; - if(basePath && !filename) { - filename = path.join(basePath, name); +PluginLoader.prototype.tryLoadFromEnvironment = function(filename, basePath, explicit, callback) { + var fileManager; + + if (basePath) { + filename = path.join(basePath, filename); } - if(filename) { - var fileManager = new this.less.FileManager(); - filename = fileManager.tryAppendExtension(filename,'.js'); - fileManager.loadFile(filename).then( - function(data) { - callback(null, data); - }, + if (filename) { + fileManager = new this.less.FileManager(); - function(err) { + filename = fileManager.tryAppendExtension(filename, '.js'); + + var done = function(err, data) { + if (err) { callback(err); + } else { + callback(null, data); } - ); + }; + fileManager.loadFile(filename, null, null, null, done); + } else { callback({ message: 'Plugin could not be found.'}); diff --git a/lib/less-node/index.js b/lib/less-node/index.js index 9baaf8246..55da4b222 100644 --- a/lib/less-node/index.js +++ b/lib/less-node/index.js @@ -12,6 +12,9 @@ less.PluginLoader = require("./plugin-loader"); less.fs = require("./fs"); less.FileManager = FileManager; less.UrlFileManager = UrlFileManager; +less.options = less.options || {}; +less.options.javascriptEnabled = false; + less.formatError = function(ctx, options) { options = options || {}; diff --git a/lib/less-node/lessc-helper.js b/lib/less-node/lessc-helper.js index 7b57ce290..3aa84c99d 100644 --- a/lib/less-node/lessc-helper.js +++ b/lib/less-node/lessc-helper.js @@ -31,7 +31,7 @@ var lessc_helper = { console.log(" -M, --depends Outputs a makefile import dependency list to stdout."); console.log(" --no-color Disables colorized output."); console.log(" --no-ie-compat Disables IE compatibility checks."); - console.log(" --no-js Disables JavaScript in less files"); + console.log(" --inline-js Enables inline JavaScript in less files"); console.log(" -l, --lint Syntax check only (lint)."); console.log(" -s, --silent Suppresses output of error messages."); console.log(" --strict-imports Forces evaluation of imports."); diff --git a/lib/less-node/plugin-loader.js b/lib/less-node/plugin-loader.js index 90dd17ba4..8eaa19aec 100644 --- a/lib/less-node/plugin-loader.js +++ b/lib/less-node/plugin-loader.js @@ -11,54 +11,49 @@ var PluginLoader = function(less) { prefix = path.dirname(prefix); return function(id) { var str = id.substr(0, 2); - if(str === '..' || str === './') { + if (str === '..' || str === './') { return require(path.join(prefix, id)); } else { return require(id); } - } + }; }; }; PluginLoader.prototype = new AbstractPluginLoader(); -PluginLoader.prototype.tryLoadFromEnvironment = function(name, basePath, callback) { - var filename; +PluginLoader.prototype.tryLoadPlugin = function(name, basePath, callback) { var self = this; - - try { - filename = require.resolve(path.join("../../../", name)); - } - catch(e) { - } - // is installed as a sub dependency of the current folder - try { - filename = require.resolve(path.join(process.cwd(), "node_modules", name)); - } - catch(e) { + var prefix = name.slice(0, 1); + var explicit = prefix === "." || prefix === "/" || name.slice(-3).toLowerCase() === ".js"; + if (explicit) { + this.tryLoadFromEnvironment(name, basePath, explicit, callback); } - // is referenced relative to the current directory - try { - filename = require.resolve(path.join(process.cwd(), name)); - } - catch(e) { - } - // unlikely - would have to be a dependency of where this code was running (less.js)... - if (name[0] !== '.') { - try { - filename = require.resolve(name); - } - catch(e) { - } - } - if(basePath && !filename) { - filename = path.join(basePath, name); + else { + this.tryLoadFromEnvironment('less-plugin-' + name, basePath, explicit, function(err, data) { + if (!err) { + callback(null, data); + } + else { + self.tryLoadFromEnvironment(name, basePath, explicit, function(err2, data2) { + callback(err2, data2); + }); + } + }); } - if(filename) { - var fileManager = new this.less.FileManager(); - filename = fileManager.tryAppendExtension(filename,'.js'); +}; + +PluginLoader.prototype.tryLoadFromEnvironment = function(name, basePath, explicit, callback) { + var filename; + var self = this; + + function getFile(filename) { + + var fileManager = new self.less.FileManager(); + + filename = fileManager.tryAppendExtension(filename, '.js'); fileManager.loadFile(filename).then( function(data) { try { @@ -75,8 +70,48 @@ PluginLoader.prototype.tryLoadFromEnvironment = function(name, basePath, callbac } ); } + if (explicit) { + if (basePath) { + filename = path.join(basePath, name); + } + getFile(filename); + } else { - callback({ message: 'Plugin could not be found.'}); + // Search node_modules for a possible plugin name match + try { + filename = require.resolve(path.join("../../../", name)); + } + catch(e) { + } + // is installed as a sub dependency of the current folder + try { + filename = require.resolve(path.join(process.cwd(), "node_modules", name)); + } + catch(e) { + } + // is referenced relative to the current directory + try { + filename = require.resolve(path.join(process.cwd(), name)); + } + catch(e) { + } + // unlikely - would have to be a dependency of where this code was running (less.js)... + if (name[0] !== '.') { + try { + filename = require.resolve(name); + } + catch(e) { + } + } + if (basePath && !filename) { + filename = path.join(basePath, name); + } + if (filename) { + getFile(filename); + } + else { + callback({ message: 'Plugin could not be found.'}); + } } }; diff --git a/lib/less/environment/abstract-plugin-loader.js b/lib/less/environment/abstract-plugin-loader.js index 55858cb52..3f14be187 100644 --- a/lib/less/environment/abstract-plugin-loader.js +++ b/lib/less/environment/abstract-plugin-loader.js @@ -1,4 +1,6 @@ -var functionRegistry = require("../functions/function-registry"); +var functionRegistry = require("../functions/function-registry"), + LessError = require('../less-error'); + var AbstractPluginLoader = function() { }; @@ -10,26 +12,39 @@ function error(msg, type) { } ); } -AbstractPluginLoader.prototype.evalPlugin = function(contents, context, fileInfo, callback) { +AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOptions, fileInfo) { var loader, registry, pluginObj, localModule, - localExports; + localExports, + pluginManager, + filename; + pluginManager = context.pluginManager; - pluginObj = context.pluginManager.get(fileInfo.filename); + if (fileInfo) { + if (typeof fileInfo === "string") { + filename = fileInfo; + } + else { + filename = fileInfo.filename; + } + } + if (filename) { + pluginObj = pluginManager.get(filename); - if(pluginObj) { - if(pluginObj.use) { - pluginObj.use(this.less); + if (pluginObj) { + if (pluginObj.use) { + pluginObj.use(this.less); + } + return pluginObj; } - return callback(null, pluginObj); } - localModule = { + localModule = { exports: {}, - pluginManager: context.pluginManager, + pluginManager: pluginManager, fileInfo: fileInfo }; localExports = localModule.exports; @@ -39,18 +54,18 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, fileInfo loader = new Function("module", "require", "functions", "tree", "fileInfo", "less", contents); pluginObj = loader(localModule, this.require, registry, this.less.tree, fileInfo, this.less); - if(!pluginObj) { + if (!pluginObj) { pluginObj = localModule.exports; } - pluginObj = this.validatePlugin(pluginObj); - if(pluginObj) { + pluginObj = this.validatePlugin(pluginObj, filename, pluginOptions); + if (pluginObj) { // Run on first load - context.pluginManager.addPlugin(pluginObj, fileInfo.filename); + pluginManager.addPlugin(pluginObj, fileInfo.filename); pluginObj.functions = registry.getLocalFunctions(); // Run every @plugin call - if(pluginObj.use) { + if (pluginObj.use) { pluginObj.use(this.less); } } @@ -61,49 +76,39 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, fileInfo } catch(e) { // TODO pass the error console.log(e.stack.toString()); - callback(new this.less.LessError({ + return new this.less.LessError({ message: "Plugin evaluation error: '" + e.name + ': ' + e.message.replace(/["]/g, "'") + "'" , - filename: this.fileInfo.filename, + filename: filename, line: this.line, col: this.column - }), null ); + }); } - callback(null, pluginObj); + return pluginObj; }; -AbstractPluginLoader.prototype.tryLoadPlugin = function(name, argument, basePath, callback) { - var self = this; - this.tryLoadFromEnvironment(name, basePath, function(err, data) { - if(!err) { - callback(null, data); - } - else { - self.tryLoadFromEnvironment('less-plugin-' + name, basePath, callback); - } - }); -}; -AbstractPluginLoader.prototype.validatePlugin = function(plugin, argument) { +AbstractPluginLoader.prototype.validatePlugin = function(plugin, filename, options) { if (plugin) { // support plugins being a function // so that the plugin can be more usable programmatically if (typeof plugin === "function") { plugin = new plugin(); } + var name = require('path').basename(filename); if (plugin.minVersion) { if (this.compareVersion(plugin.minVersion, this.less.version) < 0) { error("plugin " + name + " requires version " + this.versionToString(plugin.minVersion)); return null; } } - if (argument) { + if (options) { if (!plugin.setOptions) { error("options have been provided but the plugin " + name + "does not support any options"); return null; } try { - plugin.setOptions(argument); + plugin.setOptions(options); } catch(e) { error("Error setting options on plugin " + name + '\n' + e.message); diff --git a/lib/less/import-manager.js b/lib/less/import-manager.js index 05ad8f001..7ef6171cf 100644 --- a/lib/less/import-manager.js +++ b/lib/less/import-manager.js @@ -1,5 +1,6 @@ var contexts = require("./contexts"), - Parser = require('./parser/parser'); + Parser = require('./parser/parser'), + LessError = require('./less-error'); module.exports = function(environment) { @@ -35,7 +36,7 @@ module.exports = function(environment) { */ ImportManager.prototype.push = function (path, tryAppendExtension, currentFileInfo, importOptions, callback) { var importManager = this, - pluginLoader = new this.less.PluginLoader(this.less); + pluginLoader = this.context.pluginManager.Loader; this.queue.push(path); @@ -72,7 +73,8 @@ module.exports = function(environment) { } var loadFileCallback = function(loadedFile) { - var resolvedFilename = loadedFile.filename, + var plugin, + resolvedFilename = loadedFile.filename, contents = loadedFile.contents.replace(/^\uFEFF/, ''); // Pass on an updated rootpath if path of imported file is relative and file @@ -105,9 +107,14 @@ module.exports = function(environment) { } if (importOptions.isPlugin) { - pluginLoader.evalPlugin(contents, newEnv, newFileInfo, function (e, root) { - fileParsedFunc(e, root, resolvedFilename); - }); + + plugin = pluginLoader.evalPlugin(contents, newEnv, importOptions, newFileInfo); + if (plugin instanceof LessError) { + fileParsedFunc(plugin, null, resolvedFilename); + } + else { + fileParsedFunc(null, plugin, resolvedFilename); + } } else if (importOptions.inline) { fileParsedFunc(null, contents, resolvedFilename); } else { @@ -124,7 +131,7 @@ module.exports = function(environment) { loadFileCallback(loadedFile); } }; - if(importOptions.isPlugin) { + if (importOptions.isPlugin) { // TODO: implement options for plugins try { pluginLoader.tryLoadPlugin(path, null, currentFileInfo.currentDirectory, done); diff --git a/lib/less/parse.js b/lib/less/parse.js index a6048aa0a..5dbad10ed 100644 --- a/lib/less/parse.js +++ b/lib/less/parse.js @@ -1,7 +1,8 @@ var PromiseConstructor, contexts = require("./contexts"), Parser = require('./parser/parser'), - PluginManager = require('./plugin-manager'); + PluginManager = require('./plugin-manager'), + LessError = require('./less-error'); module.exports = function(environment, ParseTree, ImportManager) { var parse = function (input, options, callback) { @@ -29,10 +30,8 @@ module.exports = function(environment, ParseTree, ImportManager) { } else { var context, rootFileInfo, - less = this, pluginManager = new PluginManager(this, true); - pluginManager.addPlugins(options.plugins); options.pluginManager = pluginManager; context = new contexts.Parse(options); @@ -57,7 +56,27 @@ module.exports = function(environment, ParseTree, ImportManager) { } var imports = new ImportManager(this, context, rootFileInfo); - + + if (options.plugins) { + options.plugins.forEach(function(plugin) { + var evalResult, contents; + if (plugin.fileContent) { + contents = plugin.fileContent.replace(/^\uFEFF/, ''); + evalResult = pluginManager.Loader.evalPlugin(contents, context, plugin.options, plugin.filename); + if (!(evalResult instanceof LessError)) { + pluginManager.addPlugin(plugin); + } + else { + return callback(evalResult); + } + + } + else { + pluginManager.addPlugin(plugin); + } + }); + } + new Parser(context, imports, rootFileInfo) .parse(input, function (e, root) { if (e) { return callback(e); } diff --git a/lib/less/plugin-manager.js b/lib/less/plugin-manager.js index 54e65654a..736930fc4 100644 --- a/lib/less/plugin-manager.js +++ b/lib/less/plugin-manager.js @@ -10,6 +10,7 @@ var PluginManager = function(less) { this.fileManagers = []; this.iterator = -1; this.pluginCache = {}; + this.Loader = new less.PluginLoader(less); }; var pm, PluginManagerFactory = function(less, newFactory) { @@ -37,8 +38,10 @@ PluginManager.prototype.addPlugins = function(plugins) { */ PluginManager.prototype.addPlugin = function(plugin, filename) { this.installedPlugins.push(plugin); - this.pluginCache[filename] = plugin; - if(plugin.install) { + if (filename) { + this.pluginCache[filename] = plugin; + } + if (plugin.install) { plugin.install(this.less, this); } }; @@ -133,10 +136,10 @@ PluginManager.prototype.visitor = function() { return self.visitors[self.iterator]; }, get: function() { - self.iterator+=1; + self.iterator += 1; return self.visitors[self.iterator]; } - } + }; }; /** * diff --git a/lib/less/transform-tree.js b/lib/less/transform-tree.js index 941102745..f1fc37c2e 100644 --- a/lib/less/transform-tree.js +++ b/lib/less/transform-tree.js @@ -47,8 +47,8 @@ module.exports = function(root, options) { if (options.pluginManager) { visitorIterator = options.pluginManager.visitor(); visitorIterator.first(); - while(v = visitorIterator.get()) { - if(v.isPreEvalVisitor) { + while ((v = visitorIterator.get())) { + if (v.isPreEvalVisitor) { v.run(root); } } @@ -62,7 +62,7 @@ module.exports = function(root, options) { if (options.pluginManager) { visitorIterator.first(); - while(v = visitorIterator.get()) { + while ((v = visitorIterator.get())) { v.run(root); } } diff --git a/lib/less/tree/import.js b/lib/less/tree/import.js index 10385141a..eeb280e1a 100644 --- a/lib/less/tree/import.js +++ b/lib/less/tree/import.js @@ -127,7 +127,7 @@ Import.prototype.doEval = function (context) { features = this.features && this.features.eval(context); if (this.options.isPlugin) { - if(this.root && this.root.setContext) { + if (this.root && this.root.setContext) { this.root.setContext(context); } registry = context.frames[0] && context.frames[0].functionRegistry; diff --git a/lib/less/tree/js-eval-node.js b/lib/less/tree/js-eval-node.js index 30fbbfae1..3b37378ed 100644 --- a/lib/less/tree/js-eval-node.js +++ b/lib/less/tree/js-eval-node.js @@ -11,7 +11,7 @@ JsEvalNode.prototype.evaluateJavaScript = function (expression, context) { evalContext = {}; if (context.javascriptEnabled !== undefined && !context.javascriptEnabled) { - throw { message: "You are using JavaScript, which has been disabled.", + throw { message: "Inline JavaScript is not enabled. Is it set in your options?", filename: this.currentFileInfo.filename, index: this.index }; } diff --git a/test/less/errors/functions-1.less b/test/less/errors/functions-1.less index 942be1d06..f502aa276 100644 --- a/test/less/errors/functions-1.less +++ b/test/less/errors/functions-1.less @@ -1,2 +1,2 @@ -@use "../extension/extension-tree-nodes"; +@plugin "../plugin/plugin-tree-nodes"; test-undefined(); \ No newline at end of file diff --git a/test/less/errors/functions-1.txt b/test/less/errors/functions-1.txt index 61227a2b0..abeb4bda5 100644 --- a/test/less/errors/functions-1.txt +++ b/test/less/errors/functions-1.txt @@ -1,3 +1,3 @@ SyntaxError: Function 'test-undefined' is undefined in {path}functions-1.less on line 2, column 1: -1 @use "../extension/extension-tree-nodes"; +1 @plugin "../plugin/plugin-tree-nodes"; 2 test-undefined(); diff --git a/test/less/errors/functions-10-keyword.less b/test/less/errors/functions-10-keyword.less index e85a35e1f..16d0b9858 100644 --- a/test/less/errors/functions-10-keyword.less +++ b/test/less/errors/functions-10-keyword.less @@ -1,2 +1,2 @@ -@use "../extension/extension-tree-nodes"; +@plugin "../plugin/plugin-tree-nodes"; test-keyword(); \ No newline at end of file diff --git a/test/less/errors/functions-10-keyword.txt b/test/less/errors/functions-10-keyword.txt index efadbeb01..dabe839d6 100644 --- a/test/less/errors/functions-10-keyword.txt +++ b/test/less/errors/functions-10-keyword.txt @@ -1,3 +1,3 @@ SyntaxError: Keyword node returned by a function is not valid here in {path}functions-10-keyword.less on line 2, column 1: -1 @use "../extension/extension-tree-nodes"; +1 @plugin "../plugin/plugin-tree-nodes"; 2 test-keyword(); diff --git a/test/less/errors/functions-11-operation.less b/test/less/errors/functions-11-operation.less index e370c54a4..5695bdb91 100644 --- a/test/less/errors/functions-11-operation.less +++ b/test/less/errors/functions-11-operation.less @@ -1,2 +1,2 @@ -@use "../extension/extension-tree-nodes"; +@plugin "../plugin/plugin-tree-nodes"; test-operation(); \ No newline at end of file diff --git a/test/less/errors/functions-11-operation.txt b/test/less/errors/functions-11-operation.txt index c8cba0cb3..27287179c 100644 --- a/test/less/errors/functions-11-operation.txt +++ b/test/less/errors/functions-11-operation.txt @@ -1,3 +1,3 @@ SyntaxError: Operation node returned by a function is not valid here in {path}functions-11-operation.less on line 2, column 1: -1 @use "../extension/extension-tree-nodes"; +1 @plugin "../plugin/plugin-tree-nodes"; 2 test-operation(); diff --git a/test/less/errors/functions-12-quoted.less b/test/less/errors/functions-12-quoted.less index 8ea74bb3b..d35be8710 100644 --- a/test/less/errors/functions-12-quoted.less +++ b/test/less/errors/functions-12-quoted.less @@ -1,2 +1,2 @@ -@use "../extension/extension-tree-nodes"; +@plugin "../plugin/plugin-tree-nodes"; test-quoted(); \ No newline at end of file diff --git a/test/less/errors/functions-12-quoted.txt b/test/less/errors/functions-12-quoted.txt index 6be7951a8..45c62ea64 100644 --- a/test/less/errors/functions-12-quoted.txt +++ b/test/less/errors/functions-12-quoted.txt @@ -1,3 +1,3 @@ SyntaxError: Quoted node returned by a function is not valid here in {path}functions-12-quoted.less on line 2, column 1: -1 @use "../extension/extension-tree-nodes"; +1 @plugin "../plugin/plugin-tree-nodes"; 2 test-quoted(); diff --git a/test/less/errors/functions-13-selector.less b/test/less/errors/functions-13-selector.less index b830054bd..2fd879c60 100644 --- a/test/less/errors/functions-13-selector.less +++ b/test/less/errors/functions-13-selector.less @@ -1,2 +1,2 @@ -@use "../extension/extension-tree-nodes"; +@plugin "../plugin/plugin-tree-nodes"; test-selector(); \ No newline at end of file diff --git a/test/less/errors/functions-13-selector.txt b/test/less/errors/functions-13-selector.txt index 987868b61..2f4b097f2 100644 --- a/test/less/errors/functions-13-selector.txt +++ b/test/less/errors/functions-13-selector.txt @@ -1,3 +1,3 @@ SyntaxError: Selector node returned by a function is not valid here in {path}functions-13-selector.less on line 2, column 1: -1 @use "../extension/extension-tree-nodes"; +1 @plugin "../plugin/plugin-tree-nodes"; 2 test-selector(); diff --git a/test/less/errors/functions-14-url.less b/test/less/errors/functions-14-url.less index b40af7dd7..bed6dabff 100644 --- a/test/less/errors/functions-14-url.less +++ b/test/less/errors/functions-14-url.less @@ -1,2 +1,2 @@ -@use "../extension/extension-tree-nodes"; +@plugin "../plugin/plugin-tree-nodes"; test-url(); \ No newline at end of file diff --git a/test/less/errors/functions-14-url.txt b/test/less/errors/functions-14-url.txt index 11283de02..aeb275cab 100644 --- a/test/less/errors/functions-14-url.txt +++ b/test/less/errors/functions-14-url.txt @@ -1,3 +1,3 @@ SyntaxError: Url node returned by a function is not valid here in {path}functions-14-url.less on line 2, column 1: -1 @use "../extension/extension-tree-nodes"; +1 @plugin "../plugin/plugin-tree-nodes"; 2 test-url(); diff --git a/test/less/errors/functions-15-value.less b/test/less/errors/functions-15-value.less index 6ec4a1ec1..189ce1967 100644 --- a/test/less/errors/functions-15-value.less +++ b/test/less/errors/functions-15-value.less @@ -1,2 +1,2 @@ -@use "../extension/extension-tree-nodes"; +@plugin "../plugin/plugin-tree-nodes"; test-value(); \ No newline at end of file diff --git a/test/less/errors/functions-15-value.txt b/test/less/errors/functions-15-value.txt index 8dee3692c..41f6e6a17 100644 --- a/test/less/errors/functions-15-value.txt +++ b/test/less/errors/functions-15-value.txt @@ -1,3 +1,3 @@ SyntaxError: Value node returned by a function is not valid here in {path}functions-15-value.less on line 2, column 1: -1 @use "../extension/extension-tree-nodes"; +1 @plugin "../plugin/plugin-tree-nodes"; 2 test-value(); diff --git a/test/less/errors/functions-16-old-syntax.less b/test/less/errors/functions-16-old-syntax.less deleted file mode 100644 index 2d05b37ec..000000000 --- a/test/less/errors/functions-16-old-syntax.less +++ /dev/null @@ -1 +0,0 @@ -@plugin "../extension/extension-tree-nodes"; \ No newline at end of file diff --git a/test/less/errors/functions-16-old-syntax.txt b/test/less/errors/functions-16-old-syntax.txt deleted file mode 100644 index d548c82bd..000000000 --- a/test/less/errors/functions-16-old-syntax.txt +++ /dev/null @@ -1,2 +0,0 @@ -SyntaxError: @plugin is deprecated. Use @use in {path}functions-16-old-syntax.less on line 1, column 1: -1 @plugin "../extension/extension-tree-nodes"; diff --git a/test/less/errors/functions-2-alpha.less b/test/less/errors/functions-2-alpha.less index 5f4271da7..f00da0788 100644 --- a/test/less/errors/functions-2-alpha.less +++ b/test/less/errors/functions-2-alpha.less @@ -1,2 +1,2 @@ -@use "../extension/extension-tree-nodes"; +@plugin "../plugin/plugin-tree-nodes"; test-alpha(); \ No newline at end of file diff --git a/test/less/errors/functions-2-alpha.txt b/test/less/errors/functions-2-alpha.txt index 3e0935112..38a172731 100644 --- a/test/less/errors/functions-2-alpha.txt +++ b/test/less/errors/functions-2-alpha.txt @@ -1,3 +1,3 @@ SyntaxError: Alpha node returned by a function is not valid here in {path}functions-2-alpha.less on line 2, column 1: -1 @use "../extension/extension-tree-nodes"; +1 @plugin "../plugin/plugin-tree-nodes"; 2 test-alpha(); diff --git a/test/less/errors/functions-3-assignment.less b/test/less/errors/functions-3-assignment.less index b65dfc48b..fe7f5ade4 100644 --- a/test/less/errors/functions-3-assignment.less +++ b/test/less/errors/functions-3-assignment.less @@ -1,2 +1,2 @@ -@use "../extension/extension-tree-nodes"; +@plugin "../plugin/plugin-tree-nodes"; test-assignment(); \ No newline at end of file diff --git a/test/less/errors/functions-3-assignment.txt b/test/less/errors/functions-3-assignment.txt index eb1c6591c..35c199265 100644 --- a/test/less/errors/functions-3-assignment.txt +++ b/test/less/errors/functions-3-assignment.txt @@ -1,3 +1,3 @@ SyntaxError: Assignment node returned by a function is not valid here in {path}functions-3-assignment.less on line 2, column 1: -1 @use "../extension/extension-tree-nodes"; +1 @plugin "../plugin/plugin-tree-nodes"; 2 test-assignment(); diff --git a/test/less/errors/functions-4-call.less b/test/less/errors/functions-4-call.less index 071b8e6ee..6b55c88a7 100644 --- a/test/less/errors/functions-4-call.less +++ b/test/less/errors/functions-4-call.less @@ -1,2 +1,2 @@ -@use "../extension/extension-tree-nodes"; +@plugin "../plugin/plugin-tree-nodes"; test-call(); \ No newline at end of file diff --git a/test/less/errors/functions-4-call.txt b/test/less/errors/functions-4-call.txt index 56157ba9b..338582d7c 100644 --- a/test/less/errors/functions-4-call.txt +++ b/test/less/errors/functions-4-call.txt @@ -1,3 +1,3 @@ SyntaxError: Function 'foo' is undefined in {path}functions-4-call.less on line 2, column 1: -1 @use "../extension/extension-tree-nodes"; +1 @plugin "../plugin/plugin-tree-nodes"; 2 test-call(); diff --git a/test/less/errors/functions-5-color.less b/test/less/errors/functions-5-color.less index 16789a42c..700ec5b92 100644 --- a/test/less/errors/functions-5-color.less +++ b/test/less/errors/functions-5-color.less @@ -1,2 +1,2 @@ -@use "../extension/extension-tree-nodes"; +@plugin "../plugin/plugin-tree-nodes"; test-color(); \ No newline at end of file diff --git a/test/less/errors/functions-5-color.txt b/test/less/errors/functions-5-color.txt index 74beb7769..fdcd1a08a 100644 --- a/test/less/errors/functions-5-color.txt +++ b/test/less/errors/functions-5-color.txt @@ -1,3 +1,3 @@ SyntaxError: Color node returned by a function is not valid here in {path}functions-5-color.less on line 2, column 1: -1 @use "../extension/extension-tree-nodes"; +1 @plugin "../plugin/plugin-tree-nodes"; 2 test-color(); diff --git a/test/less/errors/functions-6-condition.less b/test/less/errors/functions-6-condition.less index 660eba1c0..db1000b83 100644 --- a/test/less/errors/functions-6-condition.less +++ b/test/less/errors/functions-6-condition.less @@ -1,2 +1,2 @@ -@use "../extension/extension-tree-nodes"; +@plugin "../plugin/plugin-tree-nodes"; test-condition(); \ No newline at end of file diff --git a/test/less/errors/functions-6-condition.txt b/test/less/errors/functions-6-condition.txt index b169714a7..421bba5f5 100644 --- a/test/less/errors/functions-6-condition.txt +++ b/test/less/errors/functions-6-condition.txt @@ -1,3 +1,3 @@ SyntaxError: Condition node returned by a function is not valid here in {path}functions-6-condition.less on line 2, column 1: -1 @use "../extension/extension-tree-nodes"; +1 @plugin "../plugin/plugin-tree-nodes"; 2 test-condition(); diff --git a/test/less/errors/functions-7-dimension.less b/test/less/errors/functions-7-dimension.less index f788151d7..c399d33e2 100644 --- a/test/less/errors/functions-7-dimension.less +++ b/test/less/errors/functions-7-dimension.less @@ -1,2 +1,2 @@ -@use "../extension/extension-tree-nodes"; +@plugin "../plugin/plugin-tree-nodes"; test-dimension(); \ No newline at end of file diff --git a/test/less/errors/functions-7-dimension.txt b/test/less/errors/functions-7-dimension.txt index 6e7c584fb..3b1b7026c 100644 --- a/test/less/errors/functions-7-dimension.txt +++ b/test/less/errors/functions-7-dimension.txt @@ -1,3 +1,3 @@ SyntaxError: Dimension node returned by a function is not valid here in {path}functions-7-dimension.less on line 2, column 1: -1 @use "../extension/extension-tree-nodes"; +1 @plugin "../plugin/plugin-tree-nodes"; 2 test-dimension(); diff --git a/test/less/errors/functions-8-element.less b/test/less/errors/functions-8-element.less index 16c9d3938..c762aad81 100644 --- a/test/less/errors/functions-8-element.less +++ b/test/less/errors/functions-8-element.less @@ -1,2 +1,2 @@ -@use "../extension/extension-tree-nodes"; +@plugin "../plugin/plugin-tree-nodes"; test-element(); \ No newline at end of file diff --git a/test/less/errors/functions-8-element.txt b/test/less/errors/functions-8-element.txt index c38a2bf8a..b505d9543 100644 --- a/test/less/errors/functions-8-element.txt +++ b/test/less/errors/functions-8-element.txt @@ -1,3 +1,3 @@ SyntaxError: Element node returned by a function is not valid here in {path}functions-8-element.less on line 2, column 1: -1 @use "../extension/extension-tree-nodes"; +1 @plugin "../plugin/plugin-tree-nodes"; 2 test-element(); diff --git a/test/less/errors/functions-9-expression.less b/test/less/errors/functions-9-expression.less index da66c89e4..5f0bf46c4 100644 --- a/test/less/errors/functions-9-expression.less +++ b/test/less/errors/functions-9-expression.less @@ -1,2 +1,2 @@ -@use "../extension/extension-tree-nodes"; +@plugin "../plugin/plugin-tree-nodes"; test-expression(); \ No newline at end of file diff --git a/test/less/errors/functions-9-expression.txt b/test/less/errors/functions-9-expression.txt index d7d7d2c43..224db785e 100644 --- a/test/less/errors/functions-9-expression.txt +++ b/test/less/errors/functions-9-expression.txt @@ -1,3 +1,3 @@ SyntaxError: Expression node returned by a function is not valid here in {path}functions-9-expression.less on line 2, column 1: -1 @use "../extension/extension-tree-nodes"; +1 @plugin "../plugin/plugin-tree-nodes"; 2 test-expression(); diff --git a/test/less/errors/root-func-undefined-2.less b/test/less/errors/root-func-undefined-2.less index eb934f7ca..ee34616e1 100644 --- a/test/less/errors/root-func-undefined-2.less +++ b/test/less/errors/root-func-undefined-2.less @@ -1,2 +1,2 @@ -@use "../extension/extension-tree-nodes.js"; +@plugin "../plugin/plugin-tree-nodes.js"; test-undefined(); \ No newline at end of file diff --git a/test/less/errors/root-func-undefined-2.txt b/test/less/errors/root-func-undefined-2.txt index fb7a39f6f..031385d01 100644 --- a/test/less/errors/root-func-undefined-2.txt +++ b/test/less/errors/root-func-undefined-2.txt @@ -1,3 +1,3 @@ SyntaxError: Function 'test-undefined' is undefined in {path}root-func-undefined-2.less on line 2, column 1: -1 @use "../extension/extension-tree-nodes.js"; +1 @plugin "../plugin/plugin-tree-nodes.js"; 2 test-undefined(); diff --git a/test/less/plugin.less b/test/less/plugin.less index b7caa99ef..66775ea9f 100644 --- a/test/less/plugin.less +++ b/test/less/plugin.less @@ -1,8 +1,8 @@ // importing plugin globally -@use "./extension/extension-global"; +@plugin "./plugin/plugin-global"; // transitively include plugins from importing another sheet -@import "./extension/extension-transitive"; +@import "./plugin/plugin-transitive"; // `test-global` function should be reachable @@ -18,7 +18,7 @@ // `test-local` function should be reachable // `test-shadow` function should return local version, shadowing global version .local { - @use "./extension/extension-local"; + @plugin "./plugin/plugin-local"; global : test-global(); local : test-local(); shadow : test-shadow(); @@ -28,19 +28,19 @@ // calling a mixin or detached ruleset should not bubble local plugins // imported inside either into the parent scope. .mixin() { - @use "./extension/extension-local"; + @plugin "./plugin/plugin-local"; mixin-local : test-local(); mixin-global : test-global(); mixin-shadow : test-shadow(); } @ruleset : { - @use "./extension/extension-local"; + @plugin "./plugin/plugin-local"; ruleset-local : test-local(); ruleset-global : test-global(); ruleset-shadow : test-shadow(); }; #ns { - @use "./extension/extension-local"; + @plugin "./plugin/plugin-local"; .mixin() { ns-mixin-global : test-global(); ns-mixin-local : test-local(); @@ -76,12 +76,12 @@ .test { @media screen { - @use "./extension/extension-local"; + @plugin "./plugin/plugin-local"; result : test-local(); } } -@use "./extension/extension-tree-nodes"; +@plugin "./plugin/plugin-tree-nodes"; @ruleset2: test-detached-ruleset(); .root { @ruleset2(); diff --git a/test/less/extension/extension-global.js b/test/less/plugin/plugin-global.js similarity index 100% rename from test/less/extension/extension-global.js rename to test/less/plugin/plugin-global.js diff --git a/test/less/extension/extension-local.js b/test/less/plugin/plugin-local.js similarity index 100% rename from test/less/extension/extension-local.js rename to test/less/plugin/plugin-local.js diff --git a/test/less/extension/extension-transitive.js b/test/less/plugin/plugin-transitive.js similarity index 100% rename from test/less/extension/extension-transitive.js rename to test/less/plugin/plugin-transitive.js diff --git a/test/less/extension/extension-transitive.less b/test/less/plugin/plugin-transitive.less similarity index 55% rename from test/less/extension/extension-transitive.less rename to test/less/plugin/plugin-transitive.less index e3268f824..a0c202834 100644 --- a/test/less/extension/extension-transitive.less +++ b/test/less/plugin/plugin-transitive.less @@ -1,4 +1,4 @@ -@use "extension-transitive"; +@plugin "extension-transitive"; .other { trans : test-transitive(); diff --git a/test/less/extension/extension-tree-nodes.js b/test/less/plugin/plugin-tree-nodes.js similarity index 100% rename from test/less/extension/extension-tree-nodes.js rename to test/less/plugin/plugin-tree-nodes.js From ad57737ce0c7192ac734541294620679629038be Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Tue, 12 Jul 2016 22:26:39 -0700 Subject: [PATCH 09/97] All tests passing for @plugin - Inline JavaScript disabled by default - Deprecated "preprocessor" option removed (preprocessor plugins still valid) --- Gruntfile.js | 10 +-- lib/less-browser/add-default-options.js | 2 + lib/less-browser/index.js | 3 +- lib/less-browser/plugin-loader.js | 12 ++- lib/less-node/index.js | 1 - lib/less-node/plugin-loader.js | 11 +-- lib/less/contexts.js | 2 +- lib/less/environment/abstract-file-manager.js | 3 +- .../environment/abstract-plugin-loader.js | 44 +++++----- lib/less/import-manager.js | 6 +- lib/less/parser/parser.js | 42 +++++++--- lib/less/transform-tree.js | 4 +- lib/less/tree/import.js | 4 +- lib/less/tree/js-eval-node.js | 2 +- test/browser/common.js | 1 + test/browser/runner-browser-options.js | 2 +- test/browser/runner-errors-options.js | 4 +- test/browser/runner-postProcessor-options.js | 5 -- test/browser/runner-postProcessor.js | 3 - test/browser/test-runner-template.tmpl | 1 - test/index.js | 7 +- test/less-test.js | 80 ++++++++++--------- test/less/mixins-guards.less | 2 +- test/less/no-js-errors/no-js-errors.txt | 2 +- test/less/plugin.less | 2 +- test/less/plugin/plugin-local.js | 6 ++ test/less/plugin/plugin-transitive.less | 2 +- 27 files changed, 142 insertions(+), 121 deletions(-) delete mode 100644 test/browser/runner-postProcessor-options.js delete mode 100644 test/browser/runner-postProcessor.js diff --git a/Gruntfile.js b/Gruntfile.js index 5c2d00ad0..92fea0419 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -31,7 +31,7 @@ module.exports = function (grunt) { shell: { options: {stdout: true, failOnError: true}, test: { - command: 'node test' + command: 'node test/index.js' }, benchmark: { command: 'node benchmark/index.js' @@ -241,14 +241,6 @@ module.exports = function (grunt) { outfile: 'tmp/browser/test-runner-global-vars.html' } }, - postProcessor: { - src: ['test/browser/less/postProcessor/*.less'], - options: { - helpers: 'test/browser/runner-postProcessor-options.js', - specs: 'test/browser/runner-postProcessor.js', - outfile: 'tmp/browser/test-runner-post-processor.html' - } - }, postProcessorPlugin: { src: ['test/less/postProcessorPlugin/*.less'], options: { diff --git a/lib/less-browser/add-default-options.js b/lib/less-browser/add-default-options.js index b06c58f1b..27fcb9e27 100644 --- a/lib/less-browser/add-default-options.js +++ b/lib/less-browser/add-default-options.js @@ -43,4 +43,6 @@ module.exports = function(window, options) { options.onReady = true; } + options.javascriptEnabled = (options.javascriptEnabled || options.inlineJavaScript) ? true : false; + }; diff --git a/lib/less-browser/index.js b/lib/less-browser/index.js index c89671251..5fc2a2b44 100644 --- a/lib/less-browser/index.js +++ b/lib/less-browser/index.js @@ -8,8 +8,7 @@ var addDataAttr = require("./utils").addDataAttr, module.exports = function(window, options) { var document = window.document; var less = require('../less')(); - - options.javascriptEnabled = !!(options.javascriptEnabled || options.inlineJavaScript); + less.options = options; var environment = less.environment, FileManager = require("./file-manager")(options, less.logger), diff --git a/lib/less-browser/plugin-loader.js b/lib/less-browser/plugin-loader.js index 9331f0887..52bf6eb88 100644 --- a/lib/less-browser/plugin-loader.js +++ b/lib/less-browser/plugin-loader.js @@ -1,5 +1,4 @@ -var path = require("path"), - AbstractPluginLoader = require("../less/environment/abstract-plugin-loader.js"); +var AbstractPluginLoader = require("../less/environment/abstract-plugin-loader.js"); /** * Browser Plugin Loader @@ -11,7 +10,7 @@ var PluginLoader = function(less) { PluginLoader.prototype = new AbstractPluginLoader(); -PluginLoader.prototype.tryLoadPlugin = function(name, argument, basePath, callback) { +PluginLoader.prototype.tryLoadPlugin = function(name, basePath, callback) { var self = this; var prefix = name.slice(0, 1); var explicit = prefix === "." || prefix === "/" || name.slice(-3).toLowerCase() === ".js"; @@ -34,14 +33,13 @@ PluginLoader.prototype.tryLoadPlugin = function(name, argument, basePath, callba }; PluginLoader.prototype.tryLoadFromEnvironment = function(filename, basePath, explicit, callback) { - var fileManager; - + var fileManager = new this.less.FileManager(); + if (basePath) { - filename = path.join(basePath, filename); + filename = (fileManager.extractUrlParts(filename, basePath)).url; } if (filename) { - fileManager = new this.less.FileManager(); filename = fileManager.tryAppendExtension(filename, '.js'); diff --git a/lib/less-node/index.js b/lib/less-node/index.js index 55da4b222..ab2783364 100644 --- a/lib/less-node/index.js +++ b/lib/less-node/index.js @@ -13,7 +13,6 @@ less.fs = require("./fs"); less.FileManager = FileManager; less.UrlFileManager = UrlFileManager; less.options = less.options || {}; -less.options.javascriptEnabled = false; less.formatError = function(ctx, options) { options = options || {}; diff --git a/lib/less-node/plugin-loader.js b/lib/less-node/plugin-loader.js index 8eaa19aec..d65880c94 100644 --- a/lib/less-node/plugin-loader.js +++ b/lib/less-node/plugin-loader.js @@ -36,9 +36,7 @@ PluginLoader.prototype.tryLoadPlugin = function(name, basePath, callback) { callback(null, data); } else { - self.tryLoadFromEnvironment(name, basePath, explicit, function(err2, data2) { - callback(err2, data2); - }); + self.tryLoadFromEnvironment(name, basePath, explicit, callback); } }); } @@ -46,11 +44,10 @@ PluginLoader.prototype.tryLoadPlugin = function(name, basePath, callback) { }; PluginLoader.prototype.tryLoadFromEnvironment = function(name, basePath, explicit, callback) { - var filename; + var filename = name; var self = this; function getFile(filename) { - var fileManager = new self.less.FileManager(); filename = fileManager.tryAppendExtension(filename, '.js'); @@ -60,7 +57,7 @@ PluginLoader.prototype.tryLoadFromEnvironment = function(name, basePath, explici self.require = self.requireRelative(filename); } catch(e) { - console.log(e.stack.toString()); + callback(e); } callback(null, data); }, @@ -103,7 +100,7 @@ PluginLoader.prototype.tryLoadFromEnvironment = function(name, basePath, explici catch(e) { } } - if (basePath && !filename) { + if (basePath) { filename = path.join(basePath, name); } if (filename) { diff --git a/lib/less/contexts.js b/lib/less/contexts.js index 545280b34..c7f6bc0fc 100644 --- a/lib/less/contexts.js +++ b/lib/less/contexts.js @@ -48,7 +48,7 @@ var evalCopyProperties = [ 'sourceMap', // whether to output a source map 'importMultiple', // whether we are currently importing multiple copies 'urlArgs', // whether to add args into url tokens - 'javascriptEnabled',// option - whether JavaScript is enabled. if undefined, defaults to true + 'javascriptEnabled',// option - whether Inline JavaScript is enabled. if undefined, defaults to false 'pluginManager', // Used as the plugin manager for the session 'importantScope' // used to bubble up !important statements ]; diff --git a/lib/less/environment/abstract-file-manager.js b/lib/less/environment/abstract-file-manager.js index d9a2f90b2..7c0e2063c 100644 --- a/lib/less/environment/abstract-file-manager.js +++ b/lib/less/environment/abstract-file-manager.js @@ -35,13 +35,14 @@ abstractFileManager.prototype.alwaysMakePathsAbsolute = function() { abstractFileManager.prototype.isPathAbsolute = function(filename) { return (/^(?:[a-z-]+:|\/|\\|#)/i).test(filename); }; - +// TODO: pull out - this is part of Node & Browserify abstractFileManager.prototype.join = function(basePath, laterPath) { if (!basePath) { return laterPath; } return basePath + laterPath; }; + abstractFileManager.prototype.pathDiff = function pathDiff(url, baseUrl) { // diff between two paths to create a relative path diff --git a/lib/less/environment/abstract-plugin-loader.js b/lib/less/environment/abstract-plugin-loader.js index 3f14be187..9d86fcf2c 100644 --- a/lib/less/environment/abstract-plugin-loader.js +++ b/lib/less/environment/abstract-plugin-loader.js @@ -36,6 +36,7 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOp pluginObj = pluginManager.get(filename); if (pluginObj) { + this.trySetOptions(pluginObj, filename, pluginOptions); if (pluginObj.use) { pluginObj.use(this.less); } @@ -58,24 +59,27 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOp pluginObj = localModule.exports; } - pluginObj = this.validatePlugin(pluginObj, filename, pluginOptions); + pluginObj = this.validatePlugin(pluginObj, filename); + if (pluginObj) { // Run on first load pluginManager.addPlugin(pluginObj, fileInfo.filename); pluginObj.functions = registry.getLocalFunctions(); + this.trySetOptions(pluginObj, filename, pluginOptions); + // Run every @plugin call if (pluginObj.use) { pluginObj.use(this.less); } } else { - throw new Error(); + throw new SyntaxError("Not a valid plugin"); } } catch(e) { // TODO pass the error - console.log(e.stack.toString()); + console.log(e); return new this.less.LessError({ message: "Plugin evaluation error: '" + e.name + ': ' + e.message.replace(/["]/g, "'") + "'" , filename: filename, @@ -88,7 +92,24 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOp }; -AbstractPluginLoader.prototype.validatePlugin = function(plugin, filename, options) { +AbstractPluginLoader.prototype.trySetOptions = function(plugin, filename, options) { + var name = require('path').basename(filename); + if (options) { + if (!plugin.setOptions) { + error("Options have been provided but the plugin " + name + " does not support any options."); + return null; + } + try { + plugin.setOptions(options); + } + catch(e) { + error("Error setting options on plugin " + name + '\n' + e.message); + return null; + } + } +}; + +AbstractPluginLoader.prototype.validatePlugin = function(plugin, filename) { if (plugin) { // support plugins being a function // so that the plugin can be more usable programmatically @@ -98,20 +119,7 @@ AbstractPluginLoader.prototype.validatePlugin = function(plugin, filename, optio var name = require('path').basename(filename); if (plugin.minVersion) { if (this.compareVersion(plugin.minVersion, this.less.version) < 0) { - error("plugin " + name + " requires version " + this.versionToString(plugin.minVersion)); - return null; - } - } - if (options) { - if (!plugin.setOptions) { - error("options have been provided but the plugin " + name + "does not support any options"); - return null; - } - try { - plugin.setOptions(options); - } - catch(e) { - error("Error setting options on plugin " + name + '\n' + e.message); + error("Plugin " + name + " requires version " + this.versionToString(plugin.minVersion)); return null; } } diff --git a/lib/less/import-manager.js b/lib/less/import-manager.js index 7ef6171cf..3cbc4e214 100644 --- a/lib/less/import-manager.js +++ b/lib/less/import-manager.js @@ -107,8 +107,7 @@ module.exports = function(environment) { } if (importOptions.isPlugin) { - - plugin = pluginLoader.evalPlugin(contents, newEnv, importOptions, newFileInfo); + plugin = pluginLoader.evalPlugin(contents, newEnv, importOptions.pluginArgs, newFileInfo); if (plugin instanceof LessError) { fileParsedFunc(plugin, null, resolvedFilename); } @@ -132,9 +131,8 @@ module.exports = function(environment) { } }; if (importOptions.isPlugin) { - // TODO: implement options for plugins try { - pluginLoader.tryLoadPlugin(path, null, currentFileInfo.currentDirectory, done); + pluginLoader.tryLoadPlugin(path, currentFileInfo.currentDirectory, done); } catch(e) { callback(e); diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js index 761ee6f3d..11231e834 100644 --- a/lib/less/parser/parser.js +++ b/lib/less/parser/parser.js @@ -1384,22 +1384,27 @@ var Parser = function Parser(context, imports, fileInfo) { }, // - // A @plugin directive, used to import scoped extensions dynamically. + // A @plugin directive, used to import plugins dynamically. // - // @plugin "lib"; - // - // Depending on our environment, importing is done differently: - // In the browser, it's an XHR request, in Node, it would be a - // file-system operation. The function used for importing is - // stored in `import`, which we pass to the Import constructor. + // @plugin (args) "lib"; // plugin: function () { - var path, + var path, args, options, index = parserInput.i, dir = parserInput.$re(/^@plugin?\s+/); if (dir) { - var options = { isPlugin : true }; + args = this.pluginArgs(); + + if (args) { + options = { + pluginArgs: args, + isPlugin: true + }; + } + else { + options = { isPlugin: true }; + } if ((path = this.entities.quoted() || this.entities.url())) { @@ -1407,7 +1412,6 @@ var Parser = function Parser(context, imports, fileInfo) { parserInput.i = index; error("missing semi-colon on @plugin"); } - return new(tree.Import)(path, null, options, index, fileInfo); } else { @@ -1417,6 +1421,24 @@ var Parser = function Parser(context, imports, fileInfo) { } }, + pluginArgs: function() { + // list of options, surrounded by parens + parserInput.save(); + if (! parserInput.$char('(')) { + parserInput.restore(); + return null; + } + var args = parserInput.$re(/^\s*([^\);]+)\)\s*/); + if (args[1]) { + parserInput.forget(); + return args[1].trim(); + } + else { + parserInput.restore(); + return null; + } + }, + // // A CSS Directive // diff --git a/lib/less/transform-tree.js b/lib/less/transform-tree.js index f1fc37c2e..1835462a5 100644 --- a/lib/less/transform-tree.js +++ b/lib/less/transform-tree.js @@ -63,7 +63,9 @@ module.exports = function(root, options) { if (options.pluginManager) { visitorIterator.first(); while ((v = visitorIterator.get())) { - v.run(root); + if (!v.isPreEvalVisitor) { + v.run(evaldRoot); + } } } diff --git a/lib/less/tree/import.js b/lib/less/tree/import.js index eeb280e1a..ef9636a9e 100644 --- a/lib/less/tree/import.js +++ b/lib/less/tree/import.js @@ -127,8 +127,8 @@ Import.prototype.doEval = function (context) { features = this.features && this.features.eval(context); if (this.options.isPlugin) { - if (this.root && this.root.setContext) { - this.root.setContext(context); + if (this.root && this.root.eval) { + this.root.eval(context); } registry = context.frames[0] && context.frames[0].functionRegistry; if ( registry && this.root && this.root.functions ) { diff --git a/lib/less/tree/js-eval-node.js b/lib/less/tree/js-eval-node.js index 3b37378ed..a4410b232 100644 --- a/lib/less/tree/js-eval-node.js +++ b/lib/less/tree/js-eval-node.js @@ -10,7 +10,7 @@ JsEvalNode.prototype.evaluateJavaScript = function (expression, context) { that = this, evalContext = {}; - if (context.javascriptEnabled !== undefined && !context.javascriptEnabled) { + if (!context.javascriptEnabled) { throw { message: "Inline JavaScript is not enabled. Is it set in your options?", filename: this.currentFileInfo.filename, index: this.index }; diff --git a/test/browser/common.js b/test/browser/common.js index 887e9cc64..58ef50607 100644 --- a/test/browser/common.js +++ b/test/browser/common.js @@ -1,6 +1,7 @@ /* Add js reporter for sauce */ jasmine.getEnv().addReporter(new jasmine.JSReporter2()); +jasmine.getEnv().defaultTimeoutInterval = 3000; /* record log messages for testing */ diff --git a/test/browser/runner-browser-options.js b/test/browser/runner-browser-options.js index 64037bbb0..b90ec3b00 100644 --- a/test/browser/runner-browser-options.js +++ b/test/browser/runner-browser-options.js @@ -1,4 +1,4 @@ -var less = {logLevel: 4, errorReporting: "console"}; +var less = {logLevel: 4, errorReporting: "console", javascriptEnabled: true}; // There originally run inside describe method. However, since they have not // been inside it, they run at jasmine compile time (not runtime). It all diff --git a/test/browser/runner-errors-options.js b/test/browser/runner-errors-options.js index 8ba00e27d..97b211d93 100644 --- a/test/browser/runner-errors-options.js +++ b/test/browser/runner-errors-options.js @@ -1,4 +1,6 @@ var less = { strictUnits: true, strictMath: true, - logLevel: 4 }; + logLevel: 4, + javascriptEnabled: true +}; diff --git a/test/browser/runner-postProcessor-options.js b/test/browser/runner-postProcessor-options.js deleted file mode 100644 index fe7111b69..000000000 --- a/test/browser/runner-postProcessor-options.js +++ /dev/null @@ -1,5 +0,0 @@ -var less = {logLevel: 4, - errorReporting: "console"}; -less.postProcessor = function(styles) { - return 'hr {height:50px;}\n' + styles; -}; diff --git a/test/browser/runner-postProcessor.js b/test/browser/runner-postProcessor.js deleted file mode 100644 index 64937669f..000000000 --- a/test/browser/runner-postProcessor.js +++ /dev/null @@ -1,3 +0,0 @@ -describe("less.js postProcessor (deprecated)", function() { - testLessEqualsInDocument(); -}); diff --git a/test/browser/test-runner-template.tmpl b/test/browser/test-runner-template.tmpl index c02c38f30..9fef5680e 100644 --- a/test/browser/test-runner-template.tmpl +++ b/test/browser/test-runner-template.tmpl @@ -3,7 +3,6 @@ Jasmine Spec Runner - <% var generateScriptTags = function(allScripts) { allScripts.forEach(function(script){ %> diff --git a/test/index.js b/test/index.js index a7aab0eb1..c239e2fee 100644 --- a/test/index.js +++ b/test/index.js @@ -16,10 +16,11 @@ function getErrorPathReplacementFunction(dir) { } console.log("\n" + stylize("Less", 'underline') + "\n"); + lessTester.prepBomTest(); -lessTester.runTestSet({strictMath: true, relativeUrls: true, silent: true}); -lessTester.runTestSet({strictMath: true, strictUnits: true}, "errors/", - lessTester.testErrors, null, getErrorPathReplacementFunction("errors")); +lessTester.runTestSet({strictMath: true, relativeUrls: true, silent: true, javascriptEnabled: true}); +lessTester.runTestSet({strictMath: true, strictUnits: true, javascriptEnabled: true}, "errors/", + lessTester.testErrors, null, getErrorPathReplacementFunction("errors")); lessTester.runTestSet({strictMath: true, strictUnits: true, javascriptEnabled: false}, "no-js-errors/", lessTester.testErrors, null, getErrorPathReplacementFunction("no-js-errors")); lessTester.runTestSet({strictMath: true, dumpLineNumbers: 'comments'}, "debug/", null, diff --git a/test/less-test.js b/test/less-test.js index 7623a076d..0d71a37cb 100644 --- a/test/less-test.js +++ b/test/less-test.js @@ -58,7 +58,8 @@ module.exports = function() { var totalTests = 0, failedTests = 0, - passedTests = 0; + passedTests = 0, + finishTimer = setInterval(endTest, 500); less.functions.functionRegistry.addMultiple({ add: function (a, b) { @@ -221,48 +222,49 @@ module.exports = function() { var doubleCallCheck = false; queue(function() { toCSS(options, path.join(baseFolder, foldername + file), function (err, result) { - if (doubleCallCheck) { - totalTests++; - fail("less is calling back twice"); - process.stdout.write(doubleCallCheck + "\n"); - process.stdout.write((new Error()).stack + "\n"); - return; - } - doubleCallCheck = (new Error()).stack; + + if (doubleCallCheck) { + totalTests++; + fail("less is calling back twice"); + process.stdout.write(doubleCallCheck + "\n"); + process.stdout.write((new Error()).stack + "\n"); + return; + } + doubleCallCheck = (new Error()).stack; - if (verifyFunction) { - var verificationResult = verifyFunction(name, err, result && result.css, doReplacements, result && result.map, baseFolder); - release(); - return verificationResult; - } - if (err) { - fail("ERROR: " + (err && err.message)); - if (isVerbose) { - process.stdout.write("\n"); - if (err.stack) { - process.stdout.write(err.stack + "\n"); - } else { - //this sometimes happen - show the whole error object - console.log(err); - } + if (verifyFunction) { + var verificationResult = verifyFunction(name, err, result && result.css, doReplacements, result && result.map, baseFolder); + release(); + return verificationResult; } - release(); - return; - } - var css_name = name; - if (nameModifier) { css_name = nameModifier(name); } - fs.readFile(path.join('test/css', css_name) + '.css', 'utf8', function (e, css) { - process.stdout.write("- " + path.join(baseFolder, css_name) + ": "); - - css = css && doReplacements(css, path.join(baseFolder, foldername)); - if (result.css === css) { ok('OK'); } - else { - difference("FAIL", css, result.css); + if (err) { + fail("ERROR: " + (err && err.message)); + if (isVerbose) { + process.stdout.write("\n"); + if (err.stack) { + process.stdout.write(err.stack + "\n"); + } else { + //this sometimes happen - show the whole error object + console.log(err); + } + } + release(); + return; } - release(); + var css_name = name; + if (nameModifier) { css_name = nameModifier(name); } + fs.readFile(path.join('test/css', css_name) + '.css', 'utf8', function (e, css) { + process.stdout.write("- " + path.join(baseFolder, css_name) + ": "); + + css = css && doReplacements(css, path.join(baseFolder, foldername)); + if (result.css === css) { ok('OK'); } + else { + difference("FAIL", css, result.css); + } + release(); + }); }); }); - }); }); } @@ -305,8 +307,8 @@ module.exports = function() { function endTest() { if (isFinished && ((failedTests + passedTests) >= totalTests)) { + clearInterval(finishTimer); var leaked = checkGlobalLeaks(); - process.stdout.write("\n"); if (failedTests > 0) { process.stdout.write(failedTests + stylize(" Failed", "red") + ", " + passedTests + " passed\n"); diff --git a/test/less/mixins-guards.less b/test/less/mixins-guards.less index 883bb57a0..31ad088e4 100644 --- a/test/less/mixins-guards.less +++ b/test/less/mixins-guards.less @@ -150,7 +150,7 @@ .generic(abc, "abc"); .generic('abc', "abd"); .generic(6, e("6")); - .generic(`9`, 8); + .generic(9, 8); .generic(a, b); .generic(1 2, 3); } diff --git a/test/less/no-js-errors/no-js-errors.txt b/test/less/no-js-errors/no-js-errors.txt index d81dd2bdb..10b3cd157 100644 --- a/test/less/no-js-errors/no-js-errors.txt +++ b/test/less/no-js-errors/no-js-errors.txt @@ -1,4 +1,4 @@ -SyntaxError: You are using JavaScript, which has been disabled. in {path}no-js-errors.less on line 2, column 6: +SyntaxError: Inline JavaScript is not enabled. Is it set in your options? in {path}no-js-errors.less on line 2, column 6: 1 .a { 2 a: `1 + 1`; 3 } diff --git a/test/less/plugin.less b/test/less/plugin.less index 66775ea9f..d4dc01055 100644 --- a/test/less/plugin.less +++ b/test/less/plugin.less @@ -40,7 +40,7 @@ ruleset-shadow : test-shadow(); }; #ns { - @plugin "./plugin/plugin-local"; + @plugin (test=test) "./plugin/plugin-local"; .mixin() { ns-mixin-global : test-global(); ns-mixin-local : test-local(); diff --git a/test/less/plugin/plugin-local.js b/test/less/plugin/plugin-local.js index b54ca97a8..d074b56c8 100644 --- a/test/less/plugin/plugin-local.js +++ b/test/less/plugin/plugin-local.js @@ -6,3 +6,9 @@ functions.addMultiple({ return new tree.Anonymous( "local" ); } }); + +return { + setOptions: function(raw) { + // do nothing + } +} \ No newline at end of file diff --git a/test/less/plugin/plugin-transitive.less b/test/less/plugin/plugin-transitive.less index a0c202834..8e4ca00bb 100644 --- a/test/less/plugin/plugin-transitive.less +++ b/test/less/plugin/plugin-transitive.less @@ -1,4 +1,4 @@ -@plugin "extension-transitive"; +@plugin "plugin-transitive"; .other { trans : test-transitive(); From 16c80efa61ca42c8c72529cc4b145546f13d5617 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Wed, 13 Jul 2016 01:38:30 -0700 Subject: [PATCH 10/97] Fix directive / rule shims --- lib/less/plugin-manager.js | 13 +++---------- lib/less/tree/directive.js | 3 +-- lib/less/tree/rule.js | 3 +-- lib/less/visitors/visitor.js | 1 - package.json | 2 +- 5 files changed, 6 insertions(+), 16 deletions(-) diff --git a/lib/less/plugin-manager.js b/lib/less/plugin-manager.js index 423863983..3b3ae3cec 100644 --- a/lib/less/plugin-manager.js +++ b/lib/less/plugin-manager.js @@ -54,17 +54,10 @@ PluginManager.prototype.get = function(filename) { }; // Object.getPrototypeOf shim for visitor upgrade -if(!Object.getPrototypeOf) { - if(({}).__proto__===Object.prototype&&([]).__proto__===Array.prototype) { - Object.getPrototypeOf=function getPrototypeOf(object) { - return object.__proto__; +if (!Object.getPrototypeOf) { + Object.getPrototypeOf = function getPrototypeOf(object) { + return object.constructor ? object.constructor.prototype : void 0; }; - } else { - Object.getPrototypeOf=function getPrototypeOf(object) { - // May break if the constructor has been changed or removed - return object.constructor?object.constructor.prototype:void 0; - }; - } } function upgradeVisitors(visitor, oldType, newType) { diff --git a/lib/less/tree/directive.js b/lib/less/tree/directive.js index b6797fa95..3a9dd835f 100644 --- a/lib/less/tree/directive.js +++ b/lib/less/tree/directive.js @@ -3,11 +3,10 @@ var AtRule = require("./atrule"); var Directive = function () { var args = Array.prototype.slice.call(arguments); - AtRule.call(this, args); + AtRule.apply(this, args); }; Directive.prototype = Object.create(AtRule.prototype); Directive.prototype.constructor = Directive; -Directive.prototype.type = "Directive"; module.exports = Directive; \ No newline at end of file diff --git a/lib/less/tree/rule.js b/lib/less/tree/rule.js index 16540a54c..a6a4e12a9 100644 --- a/lib/less/tree/rule.js +++ b/lib/less/tree/rule.js @@ -3,11 +3,10 @@ var Declaration = require("./declaration"); var Rule = function () { var args = Array.prototype.slice.call(arguments); - Declaration.call(this, args); + Declaration.apply(this, args); }; Rule.prototype = Object.create(Declaration.prototype); Rule.prototype.constructor = Rule; -Rule.prototype.type = "Rule"; module.exports = Rule; \ No newline at end of file diff --git a/lib/less/visitors/visitor.js b/lib/less/visitors/visitor.js index f4d3fc5e6..afa05d704 100644 --- a/lib/less/visitors/visitor.js +++ b/lib/less/visitors/visitor.js @@ -30,7 +30,6 @@ function indexNodeTypes(parent, ticker) { return ticker; } - var Visitor = function(implementation) { this._implementation = implementation; this._visitFnCache = []; diff --git a/package.json b/package.json index b44a99934..238275026 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "less", - "version": "2.8.0", + "version": "3.0.0-alpha.1", "description": "Leaner CSS", "homepage": "http://lesscss.org", "author": { From d5803515d58cf8fc3e81dec9ac7552711b597e2b Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Wed, 13 Jul 2016 02:33:28 -0700 Subject: [PATCH 11/97] Allow minimum Less version for plugins to be a string --- dist/less.js | 1855 ++++++++++++----- dist/less.min.js | 12 +- .../environment/abstract-plugin-loader.js | 4 + lib/less/index.js | 2 +- lib/less/parser/parser.js | 2 +- 5 files changed, 1295 insertions(+), 580 deletions(-) diff --git a/dist/less.js b/dist/less.js index 556e2b564..5749a0362 100644 --- a/dist/less.js +++ b/dist/less.js @@ -1,5 +1,5 @@ /*! - * Less - Leaner CSS v2.7.1 + * Less - Leaner CSS v3.0.0-alpha.1 * http://lesscss.org * * Copyright (c) 2009-2016, Alexis Sellier @@ -56,9 +56,11 @@ module.exports = function(window, options) { options.onReady = true; } + options.javascriptEnabled = (options.javascriptEnabled || options.inlineJavaScript) ? true : false; + }; -},{"./browser":3,"./utils":10}],2:[function(require,module,exports){ +},{"./browser":3,"./utils":11}],2:[function(require,module,exports){ /** * Kicks off less and compiles any stylesheets * used in the browser distributed version of less @@ -111,7 +113,7 @@ if (options.onReady) { less.pageLoadFinished = less.refresh(less.env === 'development').then(resolveOrReject, resolveOrReject); } -},{"./add-default-options":1,"./index":8,"promise/polyfill.js":97}],3:[function(require,module,exports){ +},{"./add-default-options":1,"./index":8,"promise/polyfill.js":102}],3:[function(require,module,exports){ var utils = require("./utils"); module.exports = { createCSS: function (document, styles, sheet) { @@ -177,7 +179,7 @@ module.exports = { } }; -},{"./utils":10}],4:[function(require,module,exports){ +},{"./utils":11}],4:[function(require,module,exports){ // Cache system is a bit outdated and could do with work module.exports = function(window, options, logger) { @@ -393,7 +395,7 @@ module.exports = function(window, less, options) { }; }; -},{"./browser":3,"./utils":10}],6:[function(require,module,exports){ +},{"./browser":3,"./utils":11}],6:[function(require,module,exports){ /*global window, XMLHttpRequest */ module.exports = function(options, logger) { @@ -514,7 +516,7 @@ module.exports = function(options, logger) { return FileManager; }; -},{"../less/environment/abstract-file-manager.js":15}],7:[function(require,module,exports){ +},{"../less/environment/abstract-file-manager.js":16}],7:[function(require,module,exports){ module.exports = function() { var functionRegistry = require("./../less/functions/function-registry"); @@ -544,7 +546,7 @@ module.exports = function() { functionRegistry.addMultiple(imageFunctions); }; -},{"./../less/functions/function-registry":22}],8:[function(require,module,exports){ +},{"./../less/functions/function-registry":24}],8:[function(require,module,exports){ // // index.js // Should expose the additional browser functions on to the less object @@ -555,34 +557,27 @@ var addDataAttr = require("./utils").addDataAttr, module.exports = function(window, options) { var document = window.document; var less = require('../less')(); - - //module.exports = less; + less.options = options; var environment = less.environment, FileManager = require("./file-manager")(options, less.logger), fileManager = new FileManager(); environment.addFileManager(fileManager); less.FileManager = FileManager; + less.PluginLoader = require("./plugin-loader"); require("./log-listener")(less, options); var errors = require("./error-reporting")(window, less, options); var cache = less.cache = options.cache || require("./cache")(window, options, less.logger); require('./image-size')(less.environment); - //Setup user functions + //Setup user functions - Deprecate? if (options.functions) { less.functions.functionRegistry.addMultiple(options.functions); } var typePattern = /^text\/(x-)?less$/; - function postProcessCSS(styles) { // deprecated, use a plugin for postprocesstasks - if (options.postProcessor && typeof options.postProcessor === 'function') { - styles = options.postProcessor.call(styles, styles) || styles; - } - return styles; - } - function clone(obj) { var cloned = {}; for (var prop in obj) { @@ -679,7 +674,6 @@ module.exports = function(window, options) { e.href = path; callback(e); } else { - result.css = postProcessCSS(result.css); cache.setCSS(sheet.href, webInfo.lastModified, instanceOptions.modifyVars, result.css); callback(null, result.css, data, sheet, webInfo, path); } @@ -832,7 +826,7 @@ module.exports = function(window, options) { return less; }; -},{"../less":31,"./browser":3,"./cache":4,"./error-reporting":5,"./file-manager":6,"./image-size":7,"./log-listener":9,"./utils":10}],9:[function(require,module,exports){ +},{"../less":33,"./browser":3,"./cache":4,"./error-reporting":5,"./file-manager":6,"./image-size":7,"./log-listener":9,"./plugin-loader":10,"./utils":11}],9:[function(require,module,exports){ module.exports = function(less, options) { var logLevel_debug = 4, @@ -878,6 +872,70 @@ module.exports = function(less, options) { }; },{}],10:[function(require,module,exports){ +var AbstractPluginLoader = require("../less/environment/abstract-plugin-loader.js"); + +/** + * Browser Plugin Loader + */ +var PluginLoader = function(less) { + this.less = less; + this.require = require; +}; + +PluginLoader.prototype = new AbstractPluginLoader(); + +PluginLoader.prototype.tryLoadPlugin = function(name, basePath, callback) { + var self = this; + var prefix = name.slice(0, 1); + var explicit = prefix === "." || prefix === "/" || name.slice(-3).toLowerCase() === ".js"; + this.tryLoadFromEnvironment(name, basePath, explicit, function(err, data) { + if (explicit) { + callback(err, data); + } + else { + if (!err) { + callback(null, data); + } + else { + self.tryLoadFromEnvironment('less-plugin-' + name, basePath, explicit, function(err2, data) { + callback(err, data); + }); + } + } + }); + +}; + +PluginLoader.prototype.tryLoadFromEnvironment = function(filename, basePath, explicit, callback) { + var fileManager = new this.less.FileManager(); + + if (basePath) { + filename = (fileManager.extractUrlParts(filename, basePath)).url; + } + + if (filename) { + + filename = fileManager.tryAppendExtension(filename, '.js'); + + var done = function(err, data) { + if (err) { + callback(err); + } else { + callback(null, data); + } + }; + fileManager.loadFile(filename, null, null, null, done); + + } + else { + callback({ message: 'Plugin could not be found.'}); + } +}; + +module.exports = PluginLoader; + + +},{"../less/environment/abstract-plugin-loader.js":17}],11:[function(require,module,exports){ module.exports = { extractId: function(href) { return href.replace(/^[a-z-]+:\/+?[^\/]+/, '') // Remove protocol & domain @@ -903,7 +961,7 @@ module.exports = { } }; -},{}],11:[function(require,module,exports){ +},{}],12:[function(require,module,exports){ var contexts = {}; module.exports = contexts; @@ -954,7 +1012,7 @@ var evalCopyProperties = [ 'sourceMap', // whether to output a source map 'importMultiple', // whether we are currently importing multiple copies 'urlArgs', // whether to add args into url tokens - 'javascriptEnabled',// option - whether JavaScript is enabled. if undefined, defaults to true + 'javascriptEnabled',// option - whether Inline JavaScript is enabled. if undefined, defaults to false 'pluginManager', // Used as the plugin manager for the session 'importantScope' // used to bubble up !important statements ]; @@ -1016,7 +1074,7 @@ contexts.Eval.prototype.normalizePath = function( path ) { //todo - do the same for the toCSS ? -},{}],12:[function(require,module,exports){ +},{}],13:[function(require,module,exports){ module.exports = { 'aliceblue':'#f0f8ff', 'antiquewhite':'#faebd7', @@ -1167,13 +1225,13 @@ module.exports = { 'yellow':'#ffff00', 'yellowgreen':'#9acd32' }; -},{}],13:[function(require,module,exports){ +},{}],14:[function(require,module,exports){ module.exports = { colors: require("./colors"), unitConversions: require("./unit-conversions") }; -},{"./colors":12,"./unit-conversions":14}],14:[function(require,module,exports){ +},{"./colors":13,"./unit-conversions":15}],15:[function(require,module,exports){ module.exports = { length: { 'm': 1, @@ -1195,7 +1253,7 @@ module.exports = { 'turn': 1 } }; -},{}],15:[function(require,module,exports){ +},{}],16:[function(require,module,exports){ var abstractFileManager = function() { }; @@ -1233,13 +1291,14 @@ abstractFileManager.prototype.alwaysMakePathsAbsolute = function() { abstractFileManager.prototype.isPathAbsolute = function(filename) { return (/^(?:[a-z-]+:|\/|\\|#)/i).test(filename); }; - +// TODO: pull out - this is part of Node & Browserify abstractFileManager.prototype.join = function(basePath, laterPath) { if (!basePath) { return laterPath; } return basePath + laterPath; }; + abstractFileManager.prototype.pathDiff = function pathDiff(url, baseUrl) { // diff between two paths to create a relative path @@ -1320,7 +1379,169 @@ abstractFileManager.prototype.extractUrlParts = function extractUrlParts(url, ba module.exports = abstractFileManager; -},{}],16:[function(require,module,exports){ +},{}],17:[function(require,module,exports){ +var functionRegistry = require("../functions/function-registry"), + LessError = require('../less-error'); + +var AbstractPluginLoader = function() { +}; + +function error(msg, type) { + throw new LessError( + { + type: type || 'Syntax', + message: msg + } + ); +} +AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOptions, fileInfo) { + + var loader, + registry, + pluginObj, + localModule, + localExports, + pluginManager, + filename; + + pluginManager = context.pluginManager; + + if (fileInfo) { + if (typeof fileInfo === "string") { + filename = fileInfo; + } + else { + filename = fileInfo.filename; + } + } + if (filename) { + pluginObj = pluginManager.get(filename); + + if (pluginObj) { + this.trySetOptions(pluginObj, filename, pluginOptions); + if (pluginObj.use) { + pluginObj.use(this.less); + } + return pluginObj; + } + } + localModule = { + exports: {}, + pluginManager: pluginManager, + fileInfo: fileInfo + }; + localExports = localModule.exports; + registry = functionRegistry.create(); + + try { + loader = new Function("module", "require", "functions", "tree", "fileInfo", "less", contents); + pluginObj = loader(localModule, this.require, registry, this.less.tree, fileInfo, this.less); + + if (!pluginObj) { + pluginObj = localModule.exports; + } + + pluginObj = this.validatePlugin(pluginObj, filename); + + if (pluginObj) { + // Run on first load + pluginManager.addPlugin(pluginObj, fileInfo.filename); + pluginObj.functions = registry.getLocalFunctions(); + + this.trySetOptions(pluginObj, filename, pluginOptions); + + // Run every @plugin call + if (pluginObj.use) { + pluginObj.use(this.less); + } + } + else { + throw new SyntaxError("Not a valid plugin"); + } + + } catch(e) { + // TODO pass the error + console.log(e); + return new this.less.LessError({ + message: "Plugin evaluation error: '" + e.name + ': ' + e.message.replace(/["]/g, "'") + "'" , + filename: filename, + line: this.line, + col: this.column + }); + } + + return pluginObj; + +}; + +AbstractPluginLoader.prototype.trySetOptions = function(plugin, filename, options) { + var name = require('path').basename(filename); + if (options) { + if (!plugin.setOptions) { + error("Options have been provided but the plugin " + name + " does not support any options."); + return null; + } + try { + plugin.setOptions(options); + } + catch(e) { + error("Error setting options on plugin " + name + '\n' + e.message); + return null; + } + } +}; + +AbstractPluginLoader.prototype.validatePlugin = function(plugin, filename) { + if (plugin) { + // support plugins being a function + // so that the plugin can be more usable programmatically + if (typeof plugin === "function") { + plugin = new plugin(); + } + var name = require('path').basename(filename); + if (plugin.minVersion) { + if (this.compareVersion(plugin.minVersion, this.less.version) < 0) { + error("Plugin " + name + " requires version " + this.versionToString(plugin.minVersion)); + return null; + } + } + return plugin; + } + return null; +}; + +AbstractPluginLoader.prototype.compareVersion = function(aVersion, bVersion) { + if (typeof aVersion === "string") { + aVersion = aVersion.match(/^(\d+)\.?(\d+)?\.?(\d+)?/); + aVersion.shift(); + } + for (var i = 0; i < aVersion.length; i++) { + if (aVersion[i] !== bVersion[i]) { + return parseInt(aVersion[i]) > parseInt(bVersion[i]) ? -1 : 1; + } + } + return 0; +}; +AbstractPluginLoader.prototype.versionToString = function(version) { + var versionString = ""; + for (var i = 0; i < version.length; i++) { + versionString += (versionString ? "." : "") + version[i]; + } + return versionString; +}; +AbstractPluginLoader.prototype.printUsage = function(plugins) { + for (var i = 0; i < plugins.length; i++) { + var plugin = plugins[i]; + if (plugin.printUsage) { + plugin.printUsage(); + } + } +}; + +module.exports = AbstractPluginLoader; + + +},{"../functions/function-registry":24,"../less-error":34,"path":97}],18:[function(require,module,exports){ var logger = require("../logger"); var environment = function(externalEnvironment, fileManagers) { this.fileManagers = fileManagers || []; @@ -1373,7 +1594,7 @@ environment.prototype.clearFileManagers = function () { module.exports = environment; -},{"../logger":33}],17:[function(require,module,exports){ +},{"../logger":35}],19:[function(require,module,exports){ var Color = require("../tree/color"), functionRegistry = require("./function-registry"); @@ -1449,7 +1670,7 @@ for (var f in colorBlendModeFunctions) { functionRegistry.addMultiple(colorBlend); -},{"../tree/color":50,"./function-registry":22}],18:[function(require,module,exports){ +},{"../tree/color":52,"./function-registry":24}],20:[function(require,module,exports){ var Dimension = require("../tree/dimension"), Color = require("../tree/color"), Quoted = require("../tree/quoted"), @@ -1781,7 +2002,7 @@ colorFunctions = { }; functionRegistry.addMultiple(colorFunctions); -},{"../tree/anonymous":46,"../tree/color":50,"../tree/dimension":56,"../tree/quoted":73,"./function-registry":22}],19:[function(require,module,exports){ +},{"../tree/anonymous":47,"../tree/color":52,"../tree/dimension":59,"../tree/quoted":76,"./function-registry":24}],21:[function(require,module,exports){ module.exports = function(environment) { var Quoted = require("../tree/quoted"), URL = require("../tree/url"), @@ -1868,7 +2089,7 @@ module.exports = function(environment) { }); }; -},{"../logger":33,"../tree/quoted":73,"../tree/url":80,"./function-registry":22}],20:[function(require,module,exports){ +},{"../logger":35,"../tree/quoted":76,"../tree/url":83,"./function-registry":24}],22:[function(require,module,exports){ var Keyword = require("../tree/keyword"), functionRegistry = require("./function-registry"); @@ -1897,7 +2118,7 @@ functionRegistry.add("default", defaultFunc.eval.bind(defaultFunc)); module.exports = defaultFunc; -},{"../tree/keyword":65,"./function-registry":22}],21:[function(require,module,exports){ +},{"../tree/keyword":68,"./function-registry":24}],23:[function(require,module,exports){ var Expression = require("../tree/expression"); var functionCaller = function(name, context, index, currentFileInfo) { @@ -1945,7 +2166,7 @@ functionCaller.prototype.call = function(args) { module.exports = functionCaller; -},{"../tree/expression":59}],22:[function(require,module,exports){ +},{"../tree/expression":62}],24:[function(require,module,exports){ function makeRegistry( base ) { return { _data: {}, @@ -1968,14 +2189,20 @@ function makeRegistry( base ) { get: function(name) { return this._data[name] || ( base && base.get( name )); }, - inherit : function() { + getLocalFunctions: function() { + return this._data; + }, + inherit: function() { return makeRegistry( this ); + }, + create: function(base) { + return makeRegistry(base); } }; } module.exports = makeRegistry( null ); -},{}],23:[function(require,module,exports){ +},{}],25:[function(require,module,exports){ module.exports = function(environment) { var functions = { functionRegistry: require("./function-registry"), @@ -1996,7 +2223,7 @@ module.exports = function(environment) { return functions; }; -},{"./color":18,"./color-blending":17,"./data-uri":19,"./default":20,"./function-caller":21,"./function-registry":22,"./math":25,"./number":26,"./string":27,"./svg":28,"./types":29}],24:[function(require,module,exports){ +},{"./color":20,"./color-blending":19,"./data-uri":21,"./default":22,"./function-caller":23,"./function-registry":24,"./math":27,"./number":28,"./string":29,"./svg":30,"./types":31}],26:[function(require,module,exports){ var Dimension = require("../tree/dimension"); var MathHelper = function() { @@ -2013,7 +2240,7 @@ MathHelper._math = function (fn, unit, n) { return new Dimension(fn(parseFloat(n.value)), unit); }; module.exports = MathHelper; -},{"../tree/dimension":56}],25:[function(require,module,exports){ +},{"../tree/dimension":59}],27:[function(require,module,exports){ var functionRegistry = require("./function-registry"), mathHelper = require("./math-helper.js"); @@ -2044,7 +2271,7 @@ mathFunctions.round = function (n, f) { functionRegistry.addMultiple(mathFunctions); -},{"./function-registry":22,"./math-helper.js":24}],26:[function(require,module,exports){ +},{"./function-registry":24,"./math-helper.js":26}],28:[function(require,module,exports){ var Dimension = require("../tree/dimension"), Anonymous = require("../tree/anonymous"), functionRegistry = require("./function-registry"), @@ -2127,7 +2354,7 @@ functionRegistry.addMultiple({ } }); -},{"../tree/anonymous":46,"../tree/dimension":56,"./function-registry":22,"./math-helper.js":24}],27:[function(require,module,exports){ +},{"../tree/anonymous":47,"../tree/dimension":59,"./function-registry":24,"./math-helper.js":26}],29:[function(require,module,exports){ var Quoted = require("../tree/quoted"), Anonymous = require("../tree/anonymous"), JavaScript = require("../tree/javascript"), @@ -2166,7 +2393,7 @@ functionRegistry.addMultiple({ } }); -},{"../tree/anonymous":46,"../tree/javascript":63,"../tree/quoted":73,"./function-registry":22}],28:[function(require,module,exports){ +},{"../tree/anonymous":47,"../tree/javascript":66,"../tree/quoted":76,"./function-registry":24}],30:[function(require,module,exports){ module.exports = function(environment) { var Dimension = require("../tree/dimension"), Color = require("../tree/color"), @@ -2256,7 +2483,7 @@ module.exports = function(environment) { }); }; -},{"../tree/color":50,"../tree/dimension":56,"../tree/expression":59,"../tree/quoted":73,"../tree/url":80,"./function-registry":22}],29:[function(require,module,exports){ +},{"../tree/color":52,"../tree/dimension":59,"../tree/expression":62,"../tree/quoted":76,"../tree/url":83,"./function-registry":24}],31:[function(require,module,exports){ var Keyword = require("../tree/keyword"), DetachedRuleset = require("../tree/detached-ruleset"), Dimension = require("../tree/dimension"), @@ -2347,10 +2574,10 @@ functionRegistry.addMultiple({ } }); -},{"../tree/anonymous":46,"../tree/color":50,"../tree/detached-ruleset":55,"../tree/dimension":56,"../tree/keyword":65,"../tree/operation":71,"../tree/quoted":73,"../tree/url":80,"./function-registry":22}],30:[function(require,module,exports){ +},{"../tree/anonymous":47,"../tree/color":52,"../tree/detached-ruleset":58,"../tree/dimension":59,"../tree/keyword":68,"../tree/operation":74,"../tree/quoted":76,"../tree/url":83,"./function-registry":24}],32:[function(require,module,exports){ var contexts = require("./contexts"), Parser = require('./parser/parser'), - FunctionImporter = require('./plugins/function-importer'); + LessError = require('./less-error'); module.exports = function(environment) { @@ -2363,7 +2590,8 @@ module.exports = function(environment) { // 'entryPath' - absolute path to the entry file // 'reference' - whether the file should not be output and only output parts that are referenced - var ImportManager = function(context, rootFileInfo) { + var ImportManager = function(less, context, rootFileInfo) { + this.less = less; this.rootFilename = rootFileInfo.filename; this.paths = context.paths || []; // Search paths, when importing this.contents = {}; // map - filename to contents of all the files @@ -2378,13 +2606,15 @@ module.exports = function(environment) { /** * Add an import to be imported * @param path - the raw path - * @param tryAppendLessExtension - whether to try appending the less extension (if the path has no extension) + * @param tryAppendExtension - whether to try appending a file extension (.less or .js if the path has no extension) * @param currentFileInfo - the current file info (used for instance to work out relative paths) * @param importOptions - import options * @param callback - callback for when it is imported */ - ImportManager.prototype.push = function (path, tryAppendLessExtension, currentFileInfo, importOptions, callback) { - var importManager = this; + ImportManager.prototype.push = function (path, tryAppendExtension, currentFileInfo, importOptions, callback) { + var importManager = this, + pluginLoader = this.context.pluginManager.Loader; + this.queue.push(path); var fileParsedFunc = function (e, root, fullPath) { @@ -2415,12 +2645,13 @@ module.exports = function(environment) { return; } - if (tryAppendLessExtension) { - path = fileManager.tryAppendExtension(path, importOptions.plugin ? ".js" : ".less"); + if (tryAppendExtension) { + path = importOptions.isPlugin ? path : fileManager.tryAppendExtension(path, ".less"); } var loadFileCallback = function(loadedFile) { - var resolvedFilename = loadedFile.filename, + var plugin, + resolvedFilename = loadedFile.filename, contents = loadedFile.contents.replace(/^\uFEFF/, ''); // Pass on an updated rootpath if path of imported file is relative and file @@ -2452,10 +2683,14 @@ module.exports = function(environment) { newFileInfo.reference = true; } - if (importOptions.plugin) { - new FunctionImporter(newEnv, newFileInfo).eval(contents, function (e, root) { - fileParsedFunc(e, root, resolvedFilename); - }); + if (importOptions.isPlugin) { + plugin = pluginLoader.evalPlugin(contents, newEnv, importOptions.pluginArgs, newFileInfo); + if (plugin instanceof LessError) { + fileParsedFunc(plugin, null, resolvedFilename); + } + else { + fileParsedFunc(null, plugin, resolvedFilename); + } } else if (importOptions.inline) { fileParsedFunc(null, contents, resolvedFilename); } else { @@ -2464,32 +2699,44 @@ module.exports = function(environment) { }); } }; - - var promise = fileManager.loadFile(path, currentFileInfo.currentDirectory, this.context, environment, - function(err, loadedFile) { + var promise; + var done = function(err, loadedFile) { if (err) { fileParsedFunc(err); } else { loadFileCallback(loadedFile); } - }); - if (promise) { - promise.then(loadFileCallback, fileParsedFunc); + }; + if (importOptions.isPlugin) { + try { + pluginLoader.tryLoadPlugin(path, currentFileInfo.currentDirectory, done); + } + catch(e) { + callback(e); + } + } + else { + promise = fileManager.loadFile(path, currentFileInfo.currentDirectory, this.context, environment, done); + if (promise) { + promise.then(loadFileCallback, fileParsedFunc); + } } + }; return ImportManager; }; -},{"./contexts":11,"./parser/parser":38,"./plugins/function-importer":40}],31:[function(require,module,exports){ +},{"./contexts":12,"./less-error":34,"./parser/parser":40}],33:[function(require,module,exports){ module.exports = function(environment, fileManagers) { var SourceMapOutput, SourceMapBuilder, ParseTree, ImportManager, Environment; var less = { - version: [2, 7, 1], + version: [3, 0, 0], data: require('./data'), tree: require('./tree'), Environment: (Environment = require("./environment/environment")), AbstractFileManager: require("./environment/abstract-file-manager"), + AbstractPluginLoader: require("./environment/abstract-plugin-loader"), environment: (environment = new Environment(environment, fileManagers)), visitors: require('./visitors'), Parser: require('./parser/parser'), @@ -2511,7 +2758,7 @@ module.exports = function(environment, fileManagers) { return less; }; -},{"./contexts":11,"./data":13,"./environment/abstract-file-manager":15,"./environment/environment":16,"./functions":23,"./import-manager":30,"./less-error":32,"./logger":33,"./parse":35,"./parse-tree":34,"./parser/parser":38,"./plugin-manager":39,"./render":41,"./source-map-builder":42,"./source-map-output":43,"./transform-tree":44,"./tree":62,"./utils":83,"./visitors":87}],32:[function(require,module,exports){ +},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":16,"./environment/abstract-plugin-loader":17,"./environment/environment":18,"./functions":25,"./import-manager":32,"./less-error":34,"./logger":35,"./parse":37,"./parse-tree":36,"./parser/parser":40,"./plugin-manager":41,"./render":42,"./source-map-builder":43,"./source-map-output":44,"./transform-tree":45,"./tree":65,"./utils":86,"./visitors":90}],34:[function(require,module,exports){ var utils = require("./utils"); var LessError = module.exports = function LessError(e, importManager, currentFilename) { @@ -2555,7 +2802,7 @@ if (typeof Object.create === 'undefined') { LessError.prototype.constructor = LessError; -},{"./utils":83}],33:[function(require,module,exports){ +},{"./utils":86}],35:[function(require,module,exports){ module.exports = { error: function(msg) { this._fireEvent("error", msg); @@ -2591,7 +2838,7 @@ module.exports = { _listeners: [] }; -},{}],34:[function(require,module,exports){ +},{}],36:[function(require,module,exports){ var LessError = require('./less-error'), transformTree = require("./transform-tree"), logger = require("./logger"); @@ -2653,11 +2900,12 @@ module.exports = function(SourceMapBuilder) { return ParseTree; }; -},{"./less-error":32,"./logger":33,"./transform-tree":44}],35:[function(require,module,exports){ +},{"./less-error":34,"./logger":35,"./transform-tree":45}],37:[function(require,module,exports){ var PromiseConstructor, contexts = require("./contexts"), Parser = require('./parser/parser'), - PluginManager = require('./plugin-manager'); + PluginManager = require('./plugin-manager'), + LessError = require('./less-error'); module.exports = function(environment, ParseTree, ImportManager) { var parse = function (input, options, callback) { @@ -2685,9 +2933,8 @@ module.exports = function(environment, ParseTree, ImportManager) { } else { var context, rootFileInfo, - pluginManager = new PluginManager(this); + pluginManager = new PluginManager(this, true); - pluginManager.addPlugins(options.plugins); options.pluginManager = pluginManager; context = new contexts.Parse(options); @@ -2711,8 +2958,28 @@ module.exports = function(environment, ParseTree, ImportManager) { } } - var imports = new ImportManager(context, rootFileInfo); - + var imports = new ImportManager(this, context, rootFileInfo); + + if (options.plugins) { + options.plugins.forEach(function(plugin) { + var evalResult, contents; + if (plugin.fileContent) { + contents = plugin.fileContent.replace(/^\uFEFF/, ''); + evalResult = pluginManager.Loader.evalPlugin(contents, context, plugin.options, plugin.filename); + if (!(evalResult instanceof LessError)) { + pluginManager.addPlugin(plugin); + } + else { + return callback(evalResult); + } + + } + else { + pluginManager.addPlugin(plugin); + } + }); + } + new Parser(context, imports, rootFileInfo) .parse(input, function (e, root) { if (e) { return callback(e); } @@ -2723,7 +2990,7 @@ module.exports = function(environment, ParseTree, ImportManager) { return parse; }; -},{"./contexts":11,"./parser/parser":38,"./plugin-manager":39,"promise":undefined}],36:[function(require,module,exports){ +},{"./contexts":12,"./less-error":34,"./parser/parser":40,"./plugin-manager":41,"promise":undefined}],38:[function(require,module,exports){ // Split the input into chunks. module.exports = function (input, fail) { var len = input.length, level = 0, parenLevel = 0, @@ -2837,7 +3104,7 @@ module.exports = function (input, fail) { return chunks; }; -},{}],37:[function(require,module,exports){ +},{}],39:[function(require,module,exports){ var chunker = require('./chunker'); module.exports = function() { @@ -3098,7 +3365,7 @@ module.exports = function() { return parserInput; }; -},{"./chunker":36}],38:[function(require,module,exports){ +},{"./chunker":38}],40:[function(require,module,exports){ var LessError = require('../less-error'), tree = require("../tree"), visitors = require("../visitors"), @@ -3298,7 +3565,7 @@ var Parser = function Parser(context, imports, fileInfo) { // // The basic structure of the syntax tree generated is as follows: // - // Ruleset -> Rule -> Value -> Expression -> Entity + // Ruleset -> Declaration -> Value -> Expression -> Entity // // Here's some Less code: // @@ -3312,9 +3579,9 @@ var Parser = function Parser(context, imports, fileInfo) { // And here's what the parse tree might look like: // // Ruleset (Selector '.class', [ - // Rule ("color", Value ([Expression [Color #fff]])) - // Rule ("border", Value ([Expression [Dimension 1px][Keyword "solid"][Color #000]])) - // Rule ("width", Value ([Expression [Operation " + " [Variable "@w"][Dimension 4px]]])) + // Declaration ("color", Value ([Expression [Color #fff]])) + // Declaration ("border", Value ([Expression [Dimension 1px][Keyword "solid"][Color #000]])) + // Declaration ("width", Value ([Expression [Operation " + " [Variable "@w"][Dimension 4px]]])) // Ruleset (Selector [Element '>', '.child'], [...]) // ]) // @@ -3331,7 +3598,7 @@ var Parser = function Parser(context, imports, fileInfo) { // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule, // as represented by this simplified grammar: // - // primary → (ruleset | rule)+ + // primary → (ruleset | declaration)+ // ruleset → selector+ block // block → '{' primary '}' // @@ -3361,8 +3628,8 @@ var Parser = function Parser(context, imports, fileInfo) { continue; } - node = mixin.definition() || this.rule() || this.ruleset() || - mixin.call() || this.rulesetCall() || this.entities.call() || this.directive(); + node = mixin.definition() || this.declaration() || this.ruleset() || + mixin.call() || this.rulesetCall() || this.entities.call() || this.atrule(); if (node) { root.push(node); } else { @@ -4030,7 +4297,7 @@ var Parser = function Parser(context, imports, fileInfo) { }, // - // A Rule terminator. Note that we use `peek()` to check for '}', + // A Declaration terminator. Note that we use `peek()` to check for '}', // because the `block` rule will be expecting it, but we still need to make sure // it's there, if ';' was omitted. // @@ -4270,7 +4537,7 @@ var Parser = function Parser(context, imports, fileInfo) { parserInput.restore(); } }, - rule: function (tryAnonymous) { + declaration: function (tryAnonymous) { var name, value, startOfRule = parserInput.i, c = parserInput.currentChar(), important, merge, isVariable; if (c === '.' || c === '#' || c === '&' || c === ':') { return; } @@ -4304,7 +4571,7 @@ var Parser = function Parser(context, imports, fileInfo) { if (value) { parserInput.forget(); // anonymous values absorb the end ';' which is required for them to work - return new (tree.Rule)(name, value, false, merge, startOfRule, fileInfo); + return new (tree.Declaration)(name, value, false, merge, startOfRule, fileInfo); } } if (!tryValueFirst && !value) { @@ -4316,11 +4583,11 @@ var Parser = function Parser(context, imports, fileInfo) { if (value && this.end()) { parserInput.forget(); - return new (tree.Rule)(name, value, important, merge, startOfRule, fileInfo); + return new (tree.Declaration)(name, value, important, merge, startOfRule, fileInfo); } else { parserInput.restore(); if (value && !tryAnonymous) { - return this.rule(true); + return this.declaration(true); } } } else { @@ -4335,7 +4602,7 @@ var Parser = function Parser(context, imports, fileInfo) { }, // - // An @import directive + // An @import atrule // // @import "lib"; // @@ -4416,7 +4683,7 @@ var Parser = function Parser(context, imports, fileInfo) { e = this.value(); if (parserInput.$char(')')) { if (p && e) { - nodes.push(new(tree.Paren)(new(tree.Rule)(p, e, null, null, parserInput.i, fileInfo, true))); + nodes.push(new(tree.Paren)(new(tree.Declaration)(p, e, null, null, parserInput.i, fileInfo, true))); } else if (e) { nodes.push(new(tree.Paren)(e)); } else { @@ -4485,45 +4752,68 @@ var Parser = function Parser(context, imports, fileInfo) { }, // - // A @plugin directive, used to import compiler extensions dynamically. - // - // @plugin "lib"; + + // A @plugin directive, used to import plugins dynamically. // - // Depending on our environment, importing is done differently: - // In the browser, it's an XHR request, in Node, it would be a - // file-system operation. The function used for importing is - // stored in `import`, which we pass to the Import constructor. + // @plugin (args) "lib"; // plugin: function () { - var path, + var path, args, options, index = parserInput.i, dir = parserInput.$re(/^@plugin?\s+/); if (dir) { - var options = { plugin : true }; + args = this.pluginArgs(); + + if (args) { + options = { + pluginArgs: args, + isPlugin: true + }; + } + else { + options = { isPlugin: true }; + } if ((path = this.entities.quoted() || this.entities.url())) { if (!parserInput.$char(';')) { parserInput.i = index; - error("missing semi-colon on plugin"); + error("missing semi-colon on @plugin"); } - return new(tree.Import)(path, null, options, index, fileInfo); } else { parserInput.i = index; - error("malformed plugin statement"); + error("malformed @plugin statement"); } } }, + pluginArgs: function() { + // list of options, surrounded by parens + parserInput.save(); + if (! parserInput.$char('(')) { + parserInput.restore(); + return null; + } + var args = parserInput.$re(/^\s*([^\);]+)\)\s*/); + if (args[1]) { + parserInput.forget(); + return args[1].trim(); + } + else { + parserInput.restore(); + return null; + } + }, + // - // A CSS Directive + // A CSS AtRule // // @charset "utf-8"; // - directive: function () { + atrule: function () { var index = parserInput.i, name, value, rules, nonVendorSpecificName, hasIdentifier, hasExpression, hasUnknown, hasBlock = true, isRooted = true; @@ -4594,13 +4884,13 @@ var Parser = function Parser(context, imports, fileInfo) { if (rules || (!hasBlock && value && parserInput.$char(';'))) { parserInput.forget(); - return new (tree.Directive)(name, value, rules, index, fileInfo, + return new (tree.AtRule)(name, value, rules, index, fileInfo, context.dumpLineNumbers ? getDebugInfo(index) : null, isRooted ); } - parserInput.restore("directive options not recognised"); + parserInput.restore("at-rule options not recognised"); }, // @@ -4983,7 +5273,7 @@ Parser.serializeVars = function(vars) { module.exports = Parser; -},{"../less-error":32,"../tree":62,"../utils":83,"../visitors":87,"./parser-input":37}],39:[function(require,module,exports){ +},{"../less-error":34,"../tree":65,"../utils":86,"../visitors":90,"./parser-input":39}],41:[function(require,module,exports){ /** * Plugin Manager */ @@ -4994,7 +5284,18 @@ var PluginManager = function(less) { this.postProcessors = []; this.installedPlugins = []; this.fileManagers = []; + this.iterator = -1; + this.pluginCache = {}; + this.Loader = new less.PluginLoader(less); }; + +var pm, PluginManagerFactory = function(less, newFactory) { + if (newFactory || !pm) { + pm = new PluginManager(less); + } + return pm; +}; + /** * Adds all the plugins in the array * @param {Array} plugins @@ -5009,17 +5310,56 @@ PluginManager.prototype.addPlugins = function(plugins) { /** * * @param plugin + * @param {String} filename */ -PluginManager.prototype.addPlugin = function(plugin) { +PluginManager.prototype.addPlugin = function(plugin, filename) { this.installedPlugins.push(plugin); - plugin.install(this.less, this); + if (filename) { + this.pluginCache[filename] = plugin; + } + if (plugin.install) { + plugin.install(this.less, this); + } +}; +/** + * + * @param filename + */ +PluginManager.prototype.get = function(filename) { + return this.pluginCache[filename]; }; + +// Object.getPrototypeOf shim for visitor upgrade +if (!Object.getPrototypeOf) { + Object.getPrototypeOf = function getPrototypeOf(object) { + return object.constructor ? object.constructor.prototype : void 0; + }; +} + +function upgradeVisitors(visitor, oldType, newType) { + + if (visitor['visit' + oldType] && !visitor['visit' + newType]) { + visitor['visit' + newType] = visitor['visit' + oldType]; + } + if (visitor['visit' + oldType + 'Out'] && !visitor['visit' + newType + 'Out']) { + visitor['visit' + newType + 'Out'] = visitor['visit' + oldType + 'Out']; + } +} /** * Adds a visitor. The visitor object has options on itself to determine * when it should run. * @param visitor */ PluginManager.prototype.addVisitor = function(visitor) { + var proto; + // 2.x to 3.x visitor compatibility + try { + proto = Object.getPrototypeOf(visitor); + upgradeVisitors(proto, 'Directive', 'AtRule'); + upgradeVisitors(proto, 'Rule', 'Declaration'); + } + catch(e) {} + this.visitors.push(visitor); }; /** @@ -5089,6 +5429,20 @@ PluginManager.prototype.getPostProcessors = function() { PluginManager.prototype.getVisitors = function() { return this.visitors; }; + +PluginManager.prototype.visitor = function() { + var self = this; + return { + first: function() { + self.iterator = -1; + return self.visitors[self.iterator]; + }, + get: function() { + self.iterator += 1; + return self.visitors[self.iterator]; + } + }; +}; /** * * @returns {Array} @@ -5097,46 +5451,11 @@ PluginManager.prototype.getVisitors = function() { PluginManager.prototype.getFileManagers = function() { return this.fileManagers; }; -module.exports = PluginManager; - -},{}],40:[function(require,module,exports){ -var LessError = require('../less-error'), - tree = require("../tree"); - -var FunctionImporter = module.exports = function FunctionImporter(context, fileInfo) { - this.fileInfo = fileInfo; -}; - -FunctionImporter.prototype.eval = function(contents, callback) { - var loaded = {}, - loader, - registry; - - registry = { - add: function(name, func) { - loaded[name] = func; - }, - addMultiple: function(functions) { - Object.keys(functions).forEach(function(name) { - loaded[name] = functions[name]; - }); - } - }; - - try { - loader = new Function("functions", "tree", "fileInfo", contents); - loader(registry, tree, this.fileInfo); - } catch(e) { - callback(new LessError({ - message: "Plugin evaluation error: '" + e.name + ': ' + e.message.replace(/["]/g, "'") + "'" , - filename: this.fileInfo.filename - }), null ); - } - callback(null, { functions: loaded }); -}; +// +module.exports = PluginManagerFactory; -},{"../less-error":32,"../tree":62}],41:[function(require,module,exports){ +},{}],42:[function(require,module,exports){ var PromiseConstructor; module.exports = function(environment, ParseTree, ImportManager) { @@ -5179,7 +5498,7 @@ module.exports = function(environment, ParseTree, ImportManager) { return render; }; -},{"promise":undefined}],42:[function(require,module,exports){ +},{"promise":undefined}],43:[function(require,module,exports){ module.exports = function (SourceMapOutput, environment) { var SourceMapBuilder = function (options) { @@ -5250,7 +5569,7 @@ module.exports = function (SourceMapOutput, environment) { return SourceMapBuilder; }; -},{}],43:[function(require,module,exports){ +},{}],44:[function(require,module,exports){ module.exports = function (environment) { var SourceMapOutput = function (options) { @@ -5390,7 +5709,7 @@ module.exports = function (environment) { return SourceMapOutput; }; -},{}],44:[function(require,module,exports){ +},{}],45:[function(require,module,exports){ var contexts = require("./contexts"), visitor = require("./visitors"), tree = require("./tree"); @@ -5406,7 +5725,7 @@ module.exports = function(root, options) { // // `{ color: new tree.Color('#f01') }` will become: // - // new tree.Rule('@color', + // new tree.Declaration('@color', // new tree.Value([ // new tree.Expression([ // new tree.Color('#f01') @@ -5424,49 +5743,48 @@ module.exports = function(root, options) { } value = new tree.Value([value]); } - return new tree.Rule('@' + k, value, false, null, 0); + return new tree.Declaration('@' + k, value, false, null, 0); }); evalEnv.frames = [new tree.Ruleset(null, variables)]; } - var preEvalVisitors = [], - visitors = [ + var visitors = [ new visitor.JoinSelectorVisitor(), new visitor.MarkVisibleSelectorsVisitor(true), new visitor.ExtendVisitor(), new visitor.ToCSSVisitor({compress: Boolean(options.compress)}) - ], i; + ], v, visitorIterator; + // first() / get() allows visitors to be added while visiting if (options.pluginManager) { - var pluginVisitors = options.pluginManager.getVisitors(); - for (i = 0; i < pluginVisitors.length; i++) { - var pluginVisitor = pluginVisitors[i]; - if (pluginVisitor.isPreEvalVisitor) { - preEvalVisitors.push(pluginVisitor); - } else { - if (pluginVisitor.isPreVisitor) { - visitors.splice(0, 0, pluginVisitor); - } else { - visitors.push(pluginVisitor); - } + visitorIterator = options.pluginManager.visitor(); + visitorIterator.first(); + while ((v = visitorIterator.get())) { + if (v.isPreEvalVisitor) { + v.run(root); } } } - for (i = 0; i < preEvalVisitors.length; i++) { - preEvalVisitors[i].run(root); - } - evaldRoot = root.eval(evalEnv); - for (i = 0; i < visitors.length; i++) { + for (var i = 0; i < visitors.length; i++) { visitors[i].run(evaldRoot); } + if (options.pluginManager) { + visitorIterator.first(); + while ((v = visitorIterator.get())) { + if (!v.isPreEvalVisitor) { + v.run(evaldRoot); + } + } + } + return evaldRoot; }; -},{"./contexts":11,"./tree":62,"./visitors":87}],45:[function(require,module,exports){ +},{"./contexts":12,"./tree":65,"./visitors":90}],46:[function(require,module,exports){ var Node = require("./node"); var Alpha = function (val) { @@ -5496,7 +5814,7 @@ Alpha.prototype.genCSS = function (context, output) { module.exports = Alpha; -},{"./node":70}],46:[function(require,module,exports){ +},{"./node":73}],47:[function(require,module,exports){ var Node = require("./node"); var Anonymous = function (value, index, currentFileInfo, mapLines, rulesetLike, visibilityInfo) { @@ -5524,7 +5842,7 @@ Anonymous.prototype.genCSS = function (context, output) { }; module.exports = Anonymous; -},{"./node":70}],47:[function(require,module,exports){ +},{"./node":73}],48:[function(require,module,exports){ var Node = require("./node"); var Assignment = function (key, val) { @@ -5553,22 +5871,158 @@ Assignment.prototype.genCSS = function (context, output) { }; module.exports = Assignment; -},{"./node":70}],48:[function(require,module,exports){ -var Node = require("./node"); +},{"./node":73}],49:[function(require,module,exports){ +var Node = require("./node"), + Selector = require("./selector"), + Ruleset = require("./ruleset"); -var Attribute = function (key, op, value) { - this.key = key; - this.op = op; +var AtRule = function (name, value, rules, index, currentFileInfo, debugInfo, isRooted, visibilityInfo) { + var i; + + this.name = name; this.value = value; + if (rules) { + if (Array.isArray(rules)) { + this.rules = rules; + } else { + this.rules = [rules]; + this.rules[0].selectors = (new Selector([], null, null, this.index, currentFileInfo)).createEmptySelectors(); + } + for (i = 0; i < this.rules.length; i++) { + this.rules[i].allowImports = true; + } + } + this.index = index; + this.currentFileInfo = currentFileInfo; + this.debugInfo = debugInfo; + this.isRooted = isRooted || false; + this.copyVisibilityInfo(visibilityInfo); + this.allowRoot = true; }; -Attribute.prototype = new Node(); -Attribute.prototype.type = "Attribute"; -Attribute.prototype.eval = function (context) { - return new Attribute(this.key.eval ? this.key.eval(context) : this.key, - this.op, (this.value && this.value.eval) ? this.value.eval(context) : this.value); -}; -Attribute.prototype.genCSS = function (context, output) { - output.add(this.toCSS(context)); + +AtRule.prototype = new Node(); +AtRule.prototype.type = "AtRule"; +AtRule.prototype.accept = function (visitor) { + var value = this.value, rules = this.rules; + if (rules) { + this.rules = visitor.visitArray(rules); + } + if (value) { + this.value = visitor.visit(value); + } +}; +AtRule.prototype.isRulesetLike = function() { + return this.rules || !this.isCharset(); +}; +AtRule.prototype.isCharset = function() { + return "@charset" === this.name; +}; +AtRule.prototype.genCSS = function (context, output) { + var value = this.value, rules = this.rules; + output.add(this.name, this.currentFileInfo, this.index); + if (value) { + output.add(' '); + value.genCSS(context, output); + } + if (rules) { + this.outputRuleset(context, output, rules); + } else { + output.add(';'); + } +}; +AtRule.prototype.eval = function (context) { + var mediaPathBackup, mediaBlocksBackup, value = this.value, rules = this.rules; + + //media stored inside other atrule should not bubble over it + //backpup media bubbling information + mediaPathBackup = context.mediaPath; + mediaBlocksBackup = context.mediaBlocks; + //deleted media bubbling information + context.mediaPath = []; + context.mediaBlocks = []; + + if (value) { + value = value.eval(context); + } + if (rules) { + // assuming that there is only one rule at this point - that is how parser constructs the rule + rules = [rules[0].eval(context)]; + rules[0].root = true; + } + //restore media bubbling information + context.mediaPath = mediaPathBackup; + context.mediaBlocks = mediaBlocksBackup; + + return new AtRule(this.name, value, rules, + this.index, this.currentFileInfo, this.debugInfo, this.isRooted, this.visibilityInfo()); +}; +AtRule.prototype.variable = function (name) { + if (this.rules) { + // assuming that there is only one rule at this point - that is how parser constructs the rule + return Ruleset.prototype.variable.call(this.rules[0], name); + } +}; +AtRule.prototype.find = function () { + if (this.rules) { + // assuming that there is only one rule at this point - that is how parser constructs the rule + return Ruleset.prototype.find.apply(this.rules[0], arguments); + } +}; +AtRule.prototype.rulesets = function () { + if (this.rules) { + // assuming that there is only one rule at this point - that is how parser constructs the rule + return Ruleset.prototype.rulesets.apply(this.rules[0]); + } +}; +AtRule.prototype.outputRuleset = function (context, output, rules) { + var ruleCnt = rules.length, i; + context.tabLevel = (context.tabLevel | 0) + 1; + + // Compressed + if (context.compress) { + output.add('{'); + for (i = 0; i < ruleCnt; i++) { + rules[i].genCSS(context, output); + } + output.add('}'); + context.tabLevel--; + return; + } + + // Non-compressed + var tabSetStr = '\n' + Array(context.tabLevel).join(" "), tabRuleStr = tabSetStr + " "; + if (!ruleCnt) { + output.add(" {" + tabSetStr + '}'); + } else { + output.add(" {" + tabRuleStr); + rules[0].genCSS(context, output); + for (i = 1; i < ruleCnt; i++) { + output.add(tabRuleStr); + rules[i].genCSS(context, output); + } + output.add(tabSetStr + '}'); + } + + context.tabLevel--; +}; +module.exports = AtRule; + +},{"./node":73,"./ruleset":79,"./selector":80}],50:[function(require,module,exports){ +var Node = require("./node"); + +var Attribute = function (key, op, value) { + this.key = key; + this.op = op; + this.value = value; +}; +Attribute.prototype = new Node(); +Attribute.prototype.type = "Attribute"; +Attribute.prototype.eval = function (context) { + return new Attribute(this.key.eval ? this.key.eval(context) : this.key, + this.op, (this.value && this.value.eval) ? this.value.eval(context) : this.value); +}; +Attribute.prototype.genCSS = function (context, output) { + output.add(this.toCSS(context)); }; Attribute.prototype.toCSS = function (context) { var value = this.key.toCSS ? this.key.toCSS(context) : this.key; @@ -5582,7 +6036,7 @@ Attribute.prototype.toCSS = function (context) { }; module.exports = Attribute; -},{"./node":70}],49:[function(require,module,exports){ +},{"./node":73}],51:[function(require,module,exports){ var Node = require("./node"), FunctionCaller = require("../functions/function-caller"); // @@ -5620,10 +6074,15 @@ Call.prototype.eval = function (context) { try { result = funcCaller.call(args); } catch (e) { - throw { type: e.type || "Runtime", - message: "error evaluating function `" + this.name + "`" + - (e.message ? ': ' + e.message : ''), - index: this.index, filename: this.currentFileInfo.filename }; + throw { + type: e.type || "Runtime", + message: "error evaluating function `" + this.name + "`" + + (e.message ? ': ' + e.message : ''), + index: this.index, + filename: this.currentFileInfo.filename, + line: e.lineNumber, + column: e.columnNumber + }; } if (result != null) { @@ -5649,7 +6108,7 @@ Call.prototype.genCSS = function (context, output) { }; module.exports = Call; -},{"../functions/function-caller":21,"./node":70}],50:[function(require,module,exports){ +},{"../functions/function-caller":23,"./node":73}],52:[function(require,module,exports){ var Node = require("./node"), colors = require("../data/colors"); @@ -5840,7 +6299,7 @@ Color.fromKeyword = function(keyword) { }; module.exports = Color; -},{"../data/colors":12,"./node":70}],51:[function(require,module,exports){ +},{"../data/colors":13,"./node":73}],53:[function(require,module,exports){ var Node = require("./node"); var Combinator = function (value) { @@ -5865,13 +6324,14 @@ Combinator.prototype.genCSS = function (context, output) { }; module.exports = Combinator; -},{"./node":70}],52:[function(require,module,exports){ +},{"./node":73}],54:[function(require,module,exports){ var Node = require("./node"), getDebugInfo = require("./debug-info"); var Comment = function (value, isLineComment, index, currentFileInfo) { this.value = value; this.isLineComment = isLineComment; + this.index = index; this.currentFileInfo = currentFileInfo; this.allowRoot = true; }; @@ -5889,7 +6349,7 @@ Comment.prototype.isSilent = function(context) { }; module.exports = Comment; -},{"./debug-info":54,"./node":70}],53:[function(require,module,exports){ +},{"./debug-info":56,"./node":73}],55:[function(require,module,exports){ var Node = require("./node"); var Condition = function (op, l, r, i, negate) { @@ -5928,7 +6388,7 @@ Condition.prototype.eval = function (context) { }; module.exports = Condition; -},{"./node":70}],54:[function(require,module,exports){ +},{"./node":73}],56:[function(require,module,exports){ var debugInfo = function(context, ctx, lineSeparator) { var result = ""; if (context.dumpLineNumbers && !context.compress) { @@ -5968,7 +6428,104 @@ debugInfo.asMediaQuery = function(ctx) { module.exports = debugInfo; -},{}],55:[function(require,module,exports){ +},{}],57:[function(require,module,exports){ +var Node = require("./node"), + Value = require("./value"), + Keyword = require("./keyword"); + +var Declaration = function (name, value, important, merge, index, currentFileInfo, inline, variable) { + this.name = name; + this.value = (value instanceof Node) ? value : new Value([value]); //value instanceof tree.Value || value instanceof tree.Ruleset ?? + this.important = important ? ' ' + important.trim() : ''; + this.merge = merge; + this.index = index; + this.currentFileInfo = currentFileInfo; + this.inline = inline || false; + this.variable = (variable !== undefined) ? variable + : (name.charAt && (name.charAt(0) === '@')); + this.allowRoot = true; +}; + +function evalName(context, name) { + var value = "", i, n = name.length, + output = {add: function (s) {value += s;}}; + for (i = 0; i < n; i++) { + name[i].eval(context).genCSS(context, output); + } + return value; +} + +Declaration.prototype = new Node(); +Declaration.prototype.type = "Declaration"; +Declaration.prototype.genCSS = function (context, output) { + output.add(this.name + (context.compress ? ':' : ': '), this.currentFileInfo, this.index); + try { + this.value.genCSS(context, output); + } + catch(e) { + e.index = this.index; + e.filename = this.currentFileInfo.filename; + throw e; + } + output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? "" : ";"), this.currentFileInfo, this.index); +}; +Declaration.prototype.eval = function (context) { + var strictMathBypass = false, name = this.name, evaldValue, variable = this.variable; + if (typeof name !== "string") { + // expand 'primitive' name directly to get + // things faster (~10% for benchmark.less): + name = (name.length === 1) && (name[0] instanceof Keyword) ? + name[0].value : evalName(context, name); + variable = false; // never treat expanded interpolation as new variable name + } + if (name === "font" && !context.strictMath) { + strictMathBypass = true; + context.strictMath = true; + } + try { + context.importantScope.push({}); + evaldValue = this.value.eval(context); + + if (!this.variable && evaldValue.type === "DetachedRuleset") { + throw { message: "Rulesets cannot be evaluated on a property.", + index: this.index, filename: this.currentFileInfo.filename }; + } + var important = this.important, + importantResult = context.importantScope.pop(); + if (!important && importantResult.important) { + important = importantResult.important; + } + + return new Declaration(name, + evaldValue, + important, + this.merge, + this.index, this.currentFileInfo, this.inline, + variable); + } + catch(e) { + if (typeof e.index !== 'number') { + e.index = this.index; + e.filename = this.currentFileInfo.filename; + } + throw e; + } + finally { + if (strictMathBypass) { + context.strictMath = false; + } + } +}; +Declaration.prototype.makeImportant = function () { + return new Declaration(this.name, + this.value, + "!important", + this.merge, + this.index, this.currentFileInfo, this.inline); +}; + +module.exports = Declaration; +},{"./keyword":68,"./node":73,"./value":84}],58:[function(require,module,exports){ var Node = require("./node"), contexts = require("../contexts"); @@ -5991,7 +6548,7 @@ DetachedRuleset.prototype.callEval = function (context) { }; module.exports = DetachedRuleset; -},{"../contexts":11,"./node":70}],56:[function(require,module,exports){ +},{"../contexts":12,"./node":73}],59:[function(require,module,exports){ var Node = require("./node"), unitConversions = require("../data/unit-conversions"), Unit = require("./unit"), @@ -6120,173 +6677,50 @@ Dimension.prototype.convertTo = function (conversions) { } conversions = derivedConversions; } - applyUnit = function (atomicUnit, denominator) { - /* jshint loopfunc:true */ - if (group.hasOwnProperty(atomicUnit)) { - if (denominator) { - value = value / (group[atomicUnit] / group[targetUnit]); - } else { - value = value * (group[atomicUnit] / group[targetUnit]); - } - - return targetUnit; - } - - return atomicUnit; - }; - - for (groupName in conversions) { - if (conversions.hasOwnProperty(groupName)) { - targetUnit = conversions[groupName]; - group = unitConversions[groupName]; - - unit.map(applyUnit); - } - } - - unit.cancel(); - - return new Dimension(value, unit); -}; -module.exports = Dimension; - -},{"../data/unit-conversions":14,"./color":50,"./node":70,"./unit":79}],57:[function(require,module,exports){ -var Node = require("./node"), - Selector = require("./selector"), - Ruleset = require("./ruleset"); - -var Directive = function (name, value, rules, index, currentFileInfo, debugInfo, isRooted, visibilityInfo) { - var i; - - this.name = name; - this.value = value; - if (rules) { - if (Array.isArray(rules)) { - this.rules = rules; - } else { - this.rules = [rules]; - this.rules[0].selectors = (new Selector([], null, null, this.index, currentFileInfo)).createEmptySelectors(); - } - for (i = 0; i < this.rules.length; i++) { - this.rules[i].allowImports = true; - } - } - this.index = index; - this.currentFileInfo = currentFileInfo; - this.debugInfo = debugInfo; - this.isRooted = isRooted || false; - this.copyVisibilityInfo(visibilityInfo); - this.allowRoot = true; -}; - -Directive.prototype = new Node(); -Directive.prototype.type = "Directive"; -Directive.prototype.accept = function (visitor) { - var value = this.value, rules = this.rules; - if (rules) { - this.rules = visitor.visitArray(rules); - } - if (value) { - this.value = visitor.visit(value); - } -}; -Directive.prototype.isRulesetLike = function() { - return this.rules || !this.isCharset(); -}; -Directive.prototype.isCharset = function() { - return "@charset" === this.name; -}; -Directive.prototype.genCSS = function (context, output) { - var value = this.value, rules = this.rules; - output.add(this.name, this.currentFileInfo, this.index); - if (value) { - output.add(' '); - value.genCSS(context, output); - } - if (rules) { - this.outputRuleset(context, output, rules); - } else { - output.add(';'); - } -}; -Directive.prototype.eval = function (context) { - var mediaPathBackup, mediaBlocksBackup, value = this.value, rules = this.rules; - - //media stored inside other directive should not bubble over it - //backpup media bubbling information - mediaPathBackup = context.mediaPath; - mediaBlocksBackup = context.mediaBlocks; - //deleted media bubbling information - context.mediaPath = []; - context.mediaBlocks = []; - - if (value) { - value = value.eval(context); - } - if (rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - rules = [rules[0].eval(context)]; - rules[0].root = true; - } - //restore media bubbling information - context.mediaPath = mediaPathBackup; - context.mediaBlocks = mediaBlocksBackup; - - return new Directive(this.name, value, rules, - this.index, this.currentFileInfo, this.debugInfo, this.isRooted, this.visibilityInfo()); -}; -Directive.prototype.variable = function (name) { - if (this.rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - return Ruleset.prototype.variable.call(this.rules[0], name); - } -}; -Directive.prototype.find = function () { - if (this.rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - return Ruleset.prototype.find.apply(this.rules[0], arguments); - } -}; -Directive.prototype.rulesets = function () { - if (this.rules) { - // assuming that there is only one rule at this point - that is how parser constructs the rule - return Ruleset.prototype.rulesets.apply(this.rules[0]); - } -}; -Directive.prototype.outputRuleset = function (context, output, rules) { - var ruleCnt = rules.length, i; - context.tabLevel = (context.tabLevel | 0) + 1; + applyUnit = function (atomicUnit, denominator) { + /* jshint loopfunc:true */ + if (group.hasOwnProperty(atomicUnit)) { + if (denominator) { + value = value / (group[atomicUnit] / group[targetUnit]); + } else { + value = value * (group[atomicUnit] / group[targetUnit]); + } - // Compressed - if (context.compress) { - output.add('{'); - for (i = 0; i < ruleCnt; i++) { - rules[i].genCSS(context, output); + return targetUnit; } - output.add('}'); - context.tabLevel--; - return; - } - // Non-compressed - var tabSetStr = '\n' + Array(context.tabLevel).join(" "), tabRuleStr = tabSetStr + " "; - if (!ruleCnt) { - output.add(" {" + tabSetStr + '}'); - } else { - output.add(" {" + tabRuleStr); - rules[0].genCSS(context, output); - for (i = 1; i < ruleCnt; i++) { - output.add(tabRuleStr); - rules[i].genCSS(context, output); + return atomicUnit; + }; + + for (groupName in conversions) { + if (conversions.hasOwnProperty(groupName)) { + targetUnit = conversions[groupName]; + group = unitConversions[groupName]; + + unit.map(applyUnit); } - output.add(tabSetStr + '}'); } - context.tabLevel--; + unit.cancel(); + + return new Dimension(value, unit); }; -module.exports = Directive; +module.exports = Dimension; + +},{"../data/unit-conversions":15,"./color":52,"./node":73,"./unit":82}],60:[function(require,module,exports){ +// Backwards compatibility shim for Directive (AtRule) +var AtRule = require("./atrule"); -},{"./node":70,"./ruleset":76,"./selector":77}],58:[function(require,module,exports){ +var Directive = function () { + var args = Array.prototype.slice.call(arguments); + AtRule.apply(this, args); +}; + +Directive.prototype = Object.create(AtRule.prototype); +Directive.prototype.constructor = Directive; + +module.exports = Directive; +},{"./atrule":49}],61:[function(require,module,exports){ var Node = require("./node"), Paren = require("./paren"), Combinator = require("./combinator"); @@ -6348,7 +6782,7 @@ Element.prototype.toCSS = function (context) { }; module.exports = Element; -},{"./combinator":51,"./node":70,"./paren":72}],59:[function(require,module,exports){ +},{"./combinator":53,"./node":73,"./paren":75}],62:[function(require,module,exports){ var Node = require("./node"), Paren = require("./paren"), Comment = require("./comment"); @@ -6406,7 +6840,7 @@ Expression.prototype.throwAwayComments = function () { }; module.exports = Expression; -},{"./comment":52,"./node":70,"./paren":72}],60:[function(require,module,exports){ +},{"./comment":54,"./node":73,"./paren":75}],63:[function(require,module,exports){ var Node = require("./node"), Selector = require("./selector"); @@ -6465,7 +6899,7 @@ Extend.prototype.findSelfSelectors = function (selectors) { }; module.exports = Extend; -},{"./node":70,"./selector":77}],61:[function(require,module,exports){ +},{"./node":73,"./selector":80}],64:[function(require,module,exports){ var Node = require("./node"), Media = require("./media"), URL = require("./url"), @@ -6520,7 +6954,7 @@ Import.prototype.accept = function (visitor) { this.features = visitor.visit(this.features); } this.path = visitor.visit(this.path); - if (!this.options.plugin && !this.options.inline && this.root) { + if (!this.options.isPlugin && !this.options.inline && this.root) { this.root = visitor.visit(this.root); } }; @@ -6594,7 +7028,10 @@ Import.prototype.doEval = function (context) { var ruleset, registry, features = this.features && this.features.eval(context); - if (this.options.plugin) { + if (this.options.isPlugin) { + if (this.root && this.root.eval) { + this.root.eval(context); + } registry = context.frames[0] && context.frames[0].functionRegistry; if ( registry && this.root && this.root.functions ) { registry.addMultiple( this.root.functions ); @@ -6633,12 +7070,14 @@ Import.prototype.doEval = function (context) { }; module.exports = Import; -},{"./anonymous":46,"./media":66,"./node":70,"./quoted":73,"./ruleset":76,"./url":80}],62:[function(require,module,exports){ +},{"./anonymous":47,"./media":69,"./node":73,"./quoted":76,"./ruleset":79,"./url":83}],65:[function(require,module,exports){ var tree = {}; tree.Node = require('./node'); tree.Alpha = require('./alpha'); tree.Color = require('./color'); +tree.AtRule = require('./atrule'); +// Backwards compatibility tree.Directive = require('./directive'); tree.DetachedRuleset = require('./detached-ruleset'); tree.Operation = require('./operation'); @@ -6653,6 +7092,8 @@ tree.Combinator = require('./combinator'); tree.Selector = require('./selector'); tree.Quoted = require('./quoted'); tree.Expression = require('./expression'); +tree.Declaration = require('./declaration'); +// Backwards compatibility tree.Rule = require('./rule'); tree.Call = require('./call'); tree.URL = require('./url'); @@ -6676,7 +7117,7 @@ tree.RulesetCall = require('./ruleset-call'); module.exports = tree; -},{"./alpha":45,"./anonymous":46,"./assignment":47,"./attribute":48,"./call":49,"./color":50,"./combinator":51,"./comment":52,"./condition":53,"./detached-ruleset":55,"./dimension":56,"./directive":57,"./element":58,"./expression":59,"./extend":60,"./import":61,"./javascript":63,"./keyword":65,"./media":66,"./mixin-call":67,"./mixin-definition":68,"./negative":69,"./node":70,"./operation":71,"./paren":72,"./quoted":73,"./rule":74,"./ruleset":76,"./ruleset-call":75,"./selector":77,"./unicode-descriptor":78,"./unit":79,"./url":80,"./value":81,"./variable":82}],63:[function(require,module,exports){ +},{"./alpha":46,"./anonymous":47,"./assignment":48,"./atrule":49,"./attribute":50,"./call":51,"./color":52,"./combinator":53,"./comment":54,"./condition":55,"./declaration":57,"./detached-ruleset":58,"./dimension":59,"./directive":60,"./element":61,"./expression":62,"./extend":63,"./import":64,"./javascript":66,"./keyword":68,"./media":69,"./mixin-call":70,"./mixin-definition":71,"./negative":72,"./node":73,"./operation":74,"./paren":75,"./quoted":76,"./rule":77,"./ruleset":79,"./ruleset-call":78,"./selector":80,"./unicode-descriptor":81,"./unit":82,"./url":83,"./value":84,"./variable":85}],66:[function(require,module,exports){ var JsEvalNode = require("./js-eval-node"), Dimension = require("./dimension"), Quoted = require("./quoted"), @@ -6706,7 +7147,7 @@ JavaScript.prototype.eval = function(context) { module.exports = JavaScript; -},{"./anonymous":46,"./dimension":56,"./js-eval-node":64,"./quoted":73}],64:[function(require,module,exports){ +},{"./anonymous":47,"./dimension":59,"./js-eval-node":67,"./quoted":76}],67:[function(require,module,exports){ var Node = require("./node"), Variable = require("./variable"); @@ -6719,8 +7160,8 @@ JsEvalNode.prototype.evaluateJavaScript = function (expression, context) { that = this, evalContext = {}; - if (context.javascriptEnabled !== undefined && !context.javascriptEnabled) { - throw { message: "You are using JavaScript, which has been disabled.", + if (!context.javascriptEnabled) { + throw { message: "Inline JavaScript is not enabled. Is it set in your options?", filename: this.currentFileInfo.filename, index: this.index }; } @@ -6769,7 +7210,7 @@ JsEvalNode.prototype.jsify = function (obj) { module.exports = JsEvalNode; -},{"./node":70,"./variable":82}],65:[function(require,module,exports){ +},{"./node":73,"./variable":85}],68:[function(require,module,exports){ var Node = require("./node"); var Keyword = function (value) { this.value = value; }; @@ -6785,13 +7226,13 @@ Keyword.False = new Keyword('false'); module.exports = Keyword; -},{"./node":70}],66:[function(require,module,exports){ +},{"./node":73}],69:[function(require,module,exports){ var Ruleset = require("./ruleset"), Value = require("./value"), Selector = require("./selector"), Anonymous = require("./anonymous"), Expression = require("./expression"), - Directive = require("./directive"); + AtRule = require("./atrule"); var Media = function (value, features, index, currentFileInfo, visibilityInfo) { this.index = index; @@ -6805,7 +7246,7 @@ var Media = function (value, features, index, currentFileInfo, visibilityInfo) { this.copyVisibilityInfo(visibilityInfo); this.allowRoot = true; }; -Media.prototype = new Directive(); +Media.prototype = new AtRule(); Media.prototype.type = "Media"; Media.prototype.isRulesetLike = true; Media.prototype.accept = function (visitor) { @@ -6932,7 +7373,7 @@ Media.prototype.bubbleSelectors = function (selectors) { }; module.exports = Media; -},{"./anonymous":46,"./directive":57,"./expression":59,"./ruleset":76,"./selector":77,"./value":81}],67:[function(require,module,exports){ +},{"./anonymous":47,"./atrule":49,"./expression":62,"./ruleset":79,"./selector":80,"./value":84}],70:[function(require,module,exports){ var Node = require("./node"), Selector = require("./selector"), MixinDefinition = require("./mixin-definition"), @@ -7117,11 +7558,11 @@ MixinCall.prototype.format = function (args) { }; module.exports = MixinCall; -},{"../functions/default":20,"./mixin-definition":68,"./node":70,"./selector":77}],68:[function(require,module,exports){ +},{"../functions/default":22,"./mixin-definition":71,"./node":73,"./selector":80}],71:[function(require,module,exports){ var Selector = require("./selector"), Element = require("./element"), Ruleset = require("./ruleset"), - Rule = require("./rule"), + Declaration = require("./declaration"), Expression = require("./expression"), contexts = require("../contexts"); @@ -7184,7 +7625,7 @@ Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArgume for (j = 0; j < params.length; j++) { if (!evaldArguments[j] && name === params[j].name) { evaldArguments[j] = arg.value.eval(context); - frame.prependRule(new Rule(name, arg.value.eval(context))); + frame.prependRule(new Declaration(name, arg.value.eval(context))); isNamedFound = true; break; } @@ -7212,7 +7653,7 @@ Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArgume for (j = argIndex; j < argsLength; j++) { varargs.push(args[j].value.eval(context)); } - frame.prependRule(new Rule(name, new Expression(varargs).eval(context))); + frame.prependRule(new Declaration(name, new Expression(varargs).eval(context))); } else { val = arg && arg.value; if (val) { @@ -7225,7 +7666,7 @@ Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArgume ' (' + argsLength + ' for ' + this.arity + ')' }; } - frame.prependRule(new Rule(name, val)); + frame.prependRule(new Declaration(name, val)); evaldArguments[i] = val; } } @@ -7260,7 +7701,7 @@ Definition.prototype.evalCall = function (context, args, important) { frame = this.evalParams(context, new contexts.Eval(context, mixinFrames), args, _arguments), rules, ruleset; - frame.prependRule(new Rule('@arguments', new Expression(_arguments).eval(context))); + frame.prependRule(new Declaration('@arguments', new Expression(_arguments).eval(context))); rules = this.rules.slice(0); @@ -7320,7 +7761,7 @@ Definition.prototype.matchArgs = function (args, context) { }; module.exports = Definition; -},{"../contexts":11,"./element":58,"./expression":59,"./rule":74,"./ruleset":76,"./selector":77}],69:[function(require,module,exports){ +},{"../contexts":12,"./declaration":57,"./element":61,"./expression":62,"./ruleset":79,"./selector":80}],72:[function(require,module,exports){ var Node = require("./node"), Operation = require("./operation"), Dimension = require("./dimension"); @@ -7342,7 +7783,7 @@ Negative.prototype.eval = function (context) { }; module.exports = Negative; -},{"./dimension":56,"./node":70,"./operation":71}],70:[function(require,module,exports){ +},{"./dimension":59,"./node":73,"./operation":74}],73:[function(require,module,exports){ var Node = function() { }; Node.prototype.toCSS = function (context) { @@ -7467,7 +7908,7 @@ Node.prototype.copyVisibilityInfo = function(info) { }; module.exports = Node; -},{}],71:[function(require,module,exports){ +},{}],74:[function(require,module,exports){ var Node = require("./node"), Color = require("./color"), Dimension = require("./dimension"); @@ -7517,7 +7958,7 @@ Operation.prototype.genCSS = function (context, output) { module.exports = Operation; -},{"./color":50,"./dimension":56,"./node":70}],72:[function(require,module,exports){ +},{"./color":52,"./dimension":59,"./node":73}],75:[function(require,module,exports){ var Node = require("./node"); var Paren = function (node) { @@ -7535,7 +7976,7 @@ Paren.prototype.eval = function (context) { }; module.exports = Paren; -},{"./node":70}],73:[function(require,module,exports){ +},{"./node":73}],76:[function(require,module,exports){ var Node = require("./node"), JsEvalNode = require("./js-eval-node"), Variable = require("./variable"); @@ -7592,104 +8033,20 @@ Quoted.prototype.compare = function (other) { }; module.exports = Quoted; -},{"./js-eval-node":64,"./node":70,"./variable":82}],74:[function(require,module,exports){ -var Node = require("./node"), - Value = require("./value"), - Keyword = require("./keyword"); - -var Rule = function (name, value, important, merge, index, currentFileInfo, inline, variable) { - this.name = name; - this.value = (value instanceof Node) ? value : new Value([value]); //value instanceof tree.Value || value instanceof tree.Ruleset ?? - this.important = important ? ' ' + important.trim() : ''; - this.merge = merge; - this.index = index; - this.currentFileInfo = currentFileInfo; - this.inline = inline || false; - this.variable = (variable !== undefined) ? variable - : (name.charAt && (name.charAt(0) === '@')); - this.allowRoot = true; -}; - -function evalName(context, name) { - var value = "", i, n = name.length, - output = {add: function (s) {value += s;}}; - for (i = 0; i < n; i++) { - name[i].eval(context).genCSS(context, output); - } - return value; -} +},{"./js-eval-node":67,"./node":73,"./variable":85}],77:[function(require,module,exports){ +// Backwards compatibility shim for Rule (Declaration) +var Declaration = require("./declaration"); -Rule.prototype = new Node(); -Rule.prototype.type = "Rule"; -Rule.prototype.genCSS = function (context, output) { - output.add(this.name + (context.compress ? ':' : ': '), this.currentFileInfo, this.index); - try { - this.value.genCSS(context, output); - } - catch(e) { - e.index = this.index; - e.filename = this.currentFileInfo.filename; - throw e; - } - output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? "" : ";"), this.currentFileInfo, this.index); +var Rule = function () { + var args = Array.prototype.slice.call(arguments); + Declaration.apply(this, args); }; -Rule.prototype.eval = function (context) { - var strictMathBypass = false, name = this.name, evaldValue, variable = this.variable; - if (typeof name !== "string") { - // expand 'primitive' name directly to get - // things faster (~10% for benchmark.less): - name = (name.length === 1) && (name[0] instanceof Keyword) ? - name[0].value : evalName(context, name); - variable = false; // never treat expanded interpolation as new variable name - } - if (name === "font" && !context.strictMath) { - strictMathBypass = true; - context.strictMath = true; - } - try { - context.importantScope.push({}); - evaldValue = this.value.eval(context); - - if (!this.variable && evaldValue.type === "DetachedRuleset") { - throw { message: "Rulesets cannot be evaluated on a property.", - index: this.index, filename: this.currentFileInfo.filename }; - } - var important = this.important, - importantResult = context.importantScope.pop(); - if (!important && importantResult.important) { - important = importantResult.important; - } - return new Rule(name, - evaldValue, - important, - this.merge, - this.index, this.currentFileInfo, this.inline, - variable); - } - catch(e) { - if (typeof e.index !== 'number') { - e.index = this.index; - e.filename = this.currentFileInfo.filename; - } - throw e; - } - finally { - if (strictMathBypass) { - context.strictMath = false; - } - } -}; -Rule.prototype.makeImportant = function () { - return new Rule(this.name, - this.value, - "!important", - this.merge, - this.index, this.currentFileInfo, this.inline); -}; +Rule.prototype = Object.create(Declaration.prototype); +Rule.prototype.constructor = Rule; module.exports = Rule; -},{"./keyword":65,"./node":70,"./value":81}],75:[function(require,module,exports){ +},{"./declaration":57}],78:[function(require,module,exports){ var Node = require("./node"), Variable = require("./variable"); @@ -7705,9 +8062,9 @@ RulesetCall.prototype.eval = function (context) { }; module.exports = RulesetCall; -},{"./node":70,"./variable":82}],76:[function(require,module,exports){ +},{"./node":73,"./variable":85}],79:[function(require,module,exports){ var Node = require("./node"), - Rule = require("./rule"), + Declaration = require("./declaration"), Selector = require("./selector"), Element = require("./element"), Paren = require("./paren"), @@ -7822,7 +8179,7 @@ Ruleset.prototype.eval = function (context) { if (rsRules[i].type === "MixinCall") { /*jshint loopfunc:true */ rules = rsRules[i].eval(context).filter(function(r) { - if ((r instanceof Rule) && r.variable) { + if ((r instanceof Declaration) && r.variable) { // do not pollute the scope if the variable is // already there. consider returning false here // but we need a way to "return" variable from mixins @@ -7837,7 +8194,7 @@ Ruleset.prototype.eval = function (context) { } else if (rsRules[i].type === "RulesetCall") { /*jshint loopfunc:true */ rules = rsRules[i].eval(context).rules.filter(function(r) { - if ((r instanceof Rule) && r.variable) { + if ((r instanceof Declaration) && r.variable) { // do not pollute the scope at all return false; } @@ -7869,9 +8226,11 @@ Ruleset.prototype.eval = function (context) { for (var j = 0; j < rule.rules.length; j++) { subRule = rule.rules[j]; - subRule.copyVisibilityInfo(rule.visibilityInfo()); - if (!(subRule instanceof Rule) || !subRule.variable) { - rsRules.splice(++i, 0, subRule); + if (subRule instanceof Node) { + subRule.copyVisibilityInfo(rule.visibilityInfo()); + if (!(subRule instanceof Declaration) || !subRule.variable) { + rsRules.splice(++i, 0, subRule); + } } } } @@ -7943,7 +8302,7 @@ Ruleset.prototype.resetCache = function () { Ruleset.prototype.variables = function () { if (!this._variables) { this._variables = !this.rules ? {} : this.rules.reduce(function (hash, r) { - if (r instanceof Rule && r.variable === true) { + if (r instanceof Declaration && r.variable === true) { hash[r.name] = r; } // when evaluating variables in an import statement, imports have not been eval'd @@ -8040,7 +8399,7 @@ Ruleset.prototype.genCSS = function (context, output) { function isRulesetLikeNode(rule) { // if it has nested rules, then it should be treated like a ruleset // medias and comments do not have nested rules, but should be treated like rulesets anyway - // some directives and anonymous nodes are ruleset like, others are not + // some atrules and anonymous nodes are ruleset like, others are not if (typeof rule.isRulesetLike === "boolean") { return rule.isRulesetLike; } else if (typeof rule.isRulesetLike === "function") { @@ -8055,20 +8414,23 @@ Ruleset.prototype.genCSS = function (context, output) { var importNodeIndex = 0; for (i = 0; i < this.rules.length; i++) { rule = this.rules[i]; - if (rule.type === "Comment") { - if (importNodeIndex === i) { + // Plugins may return something other than Nodes + if (rule instanceof Node) { + if (rule.type === "Comment") { + if (importNodeIndex === i) { + importNodeIndex++; + } + ruleNodes.push(rule); + } else if (rule.isCharset && rule.isCharset()) { + ruleNodes.splice(charsetNodeIndex, 0, rule); + charsetNodeIndex++; + importNodeIndex++; + } else if (rule.type === "Import") { + ruleNodes.splice(importNodeIndex, 0, rule); importNodeIndex++; + } else { + ruleNodes.push(rule); } - ruleNodes.push(rule); - } else if (rule.isCharset && rule.isCharset()) { - ruleNodes.splice(charsetNodeIndex, 0, rule); - charsetNodeIndex++; - importNodeIndex++; - } else if (rule.type === "Import") { - ruleNodes.splice(importNodeIndex, 0, rule); - importNodeIndex++; - } else { - ruleNodes.push(rule); } } ruleNodes = charsetRuleNodes.concat(ruleNodes); @@ -8417,7 +8779,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { }; module.exports = Ruleset; -},{"../contexts":11,"../functions/default":20,"../functions/function-registry":22,"./debug-info":54,"./element":58,"./node":70,"./paren":72,"./rule":74,"./selector":77}],77:[function(require,module,exports){ +},{"../contexts":12,"../functions/default":22,"../functions/function-registry":24,"./debug-info":56,"./declaration":57,"./element":61,"./node":73,"./paren":75,"./selector":80}],80:[function(require,module,exports){ var Node = require("./node"), Element = require("./element"); @@ -8530,7 +8892,7 @@ Selector.prototype.getIsOutput = function() { }; module.exports = Selector; -},{"./element":58,"./node":70}],78:[function(require,module,exports){ +},{"./element":61,"./node":73}],81:[function(require,module,exports){ var Node = require("./node"); var UnicodeDescriptor = function (value) { @@ -8541,7 +8903,7 @@ UnicodeDescriptor.prototype.type = "UnicodeDescriptor"; module.exports = UnicodeDescriptor; -},{"./node":70}],79:[function(require,module,exports){ +},{"./node":73}],82:[function(require,module,exports){ var Node = require("./node"), unitConversions = require("../data/unit-conversions"); @@ -8663,7 +9025,7 @@ Unit.prototype.cancel = function () { }; module.exports = Unit; -},{"../data/unit-conversions":14,"./node":70}],80:[function(require,module,exports){ +},{"../data/unit-conversions":15,"./node":73}],83:[function(require,module,exports){ var Node = require("./node"); var URL = function (val, index, currentFileInfo, isEvald) { @@ -8719,7 +9081,7 @@ URL.prototype.eval = function (context) { }; module.exports = URL; -},{"./node":70}],81:[function(require,module,exports){ +},{"./node":73}],84:[function(require,module,exports){ var Node = require("./node"); var Value = function (value) { @@ -8755,7 +9117,7 @@ Value.prototype.genCSS = function (context, output) { }; module.exports = Value; -},{"./node":70}],82:[function(require,module,exports){ +},{"./node":73}],85:[function(require,module,exports){ var Node = require("./node"); var Variable = function (name, index, currentFileInfo) { @@ -8810,7 +9172,7 @@ Variable.prototype.find = function (obj, fun) { }; module.exports = Variable; -},{"./node":70}],83:[function(require,module,exports){ +},{"./node":73}],86:[function(require,module,exports){ module.exports = { getLocation: function(index, inputStream) { var n = index + 1, @@ -8832,7 +9194,7 @@ module.exports = { } }; -},{}],84:[function(require,module,exports){ +},{}],87:[function(require,module,exports){ var tree = require("../tree"), Visitor = require("./visitor"), logger = require("../logger"); @@ -8851,7 +9213,7 @@ ExtendFinderVisitor.prototype = { root.allExtends = this.allExtendsStack[0]; return root; }, - visitRule: function (ruleNode, visitArgs) { + visitDeclaration: function (declNode, visitArgs) { visitArgs.visitDeeper = false; }, visitMixinDefinition: function (mixinDefinitionNode, visitArgs) { @@ -8914,11 +9276,11 @@ ExtendFinderVisitor.prototype = { visitMediaOut: function (mediaNode) { this.allExtendsStack.length = this.allExtendsStack.length - 1; }, - visitDirective: function (directiveNode, visitArgs) { - directiveNode.allExtends = []; - this.allExtendsStack.push(directiveNode.allExtends); + visitAtRule: function (atRuleNode, visitArgs) { + atRuleNode.allExtends = []; + this.allExtendsStack.push(atRuleNode.allExtends); }, - visitDirectiveOut: function (directiveNode) { + visitAtRuleOut: function (atRuleNode) { this.allExtendsStack.length = this.allExtendsStack.length - 1; } }; @@ -9049,7 +9411,7 @@ ProcessExtendsVisitor.prototype = { return extendsToAdd; } }, - visitRule: function (ruleNode, visitArgs) { + visitDeclaration: function (ruleNode, visitArgs) { visitArgs.visitDeeper = false; }, visitMixinDefinition: function (mixinDefinitionNode, visitArgs) { @@ -9281,12 +9643,12 @@ ProcessExtendsVisitor.prototype = { var lastIndex = this.allExtendsStack.length - 1; this.allExtendsStack.length = lastIndex; }, - visitDirective: function (directiveNode, visitArgs) { - var newAllExtends = directiveNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]); - newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, directiveNode.allExtends)); + visitAtRule: function (atRuleNode, visitArgs) { + var newAllExtends = atRuleNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]); + newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, atRuleNode.allExtends)); this.allExtendsStack.push(newAllExtends); }, - visitDirectiveOut: function (directiveNode) { + visitAtRuleOut: function (atRuleNode) { var lastIndex = this.allExtendsStack.length - 1; this.allExtendsStack.length = lastIndex; } @@ -9294,7 +9656,7 @@ ProcessExtendsVisitor.prototype = { module.exports = ProcessExtendsVisitor; -},{"../logger":33,"../tree":62,"./visitor":91}],85:[function(require,module,exports){ +},{"../logger":35,"../tree":65,"./visitor":94}],88:[function(require,module,exports){ function ImportSequencer(onSequencerEmpty) { this.imports = []; this.variableImports = []; @@ -9350,7 +9712,7 @@ ImportSequencer.prototype.tryRun = function() { module.exports = ImportSequencer; -},{}],86:[function(require,module,exports){ +},{}],89:[function(require,module,exports){ var contexts = require("../contexts"), Visitor = require("./visitor"), ImportSequencer = require("./import-sequencer"); @@ -9456,7 +9818,7 @@ ImportVisitor.prototype = { var importVisitor = this, inlineCSS = importNode.options.inline, - isPlugin = importNode.options.plugin, + isPlugin = importNode.options.isPlugin, isOptional = importNode.options.optional, duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector; @@ -9502,22 +9864,22 @@ ImportVisitor.prototype = { importVisitor._sequencer.tryRun(); } }, - visitRule: function (ruleNode, visitArgs) { - if (ruleNode.value.type === "DetachedRuleset") { - this.context.frames.unshift(ruleNode); + visitDeclaration: function (declNode, visitArgs) { + if (declNode.value.type === "DetachedRuleset") { + this.context.frames.unshift(declNode); } else { visitArgs.visitDeeper = false; } }, - visitRuleOut : function(ruleNode) { - if (ruleNode.value.type === "DetachedRuleset") { + visitDeclarationOut: function(declNode) { + if (declNode.value.type === "DetachedRuleset") { this.context.frames.shift(); } }, - visitDirective: function (directiveNode, visitArgs) { - this.context.frames.unshift(directiveNode); + visitAtRule: function (atRuleNode, visitArgs) { + this.context.frames.unshift(atRuleNode); }, - visitDirectiveOut: function (directiveNode) { + visitAtRuleOut: function (atRuleNode) { this.context.frames.shift(); }, visitMixinDefinition: function (mixinDefinitionNode, visitArgs) { @@ -9541,7 +9903,7 @@ ImportVisitor.prototype = { }; module.exports = ImportVisitor; -},{"../contexts":11,"./import-sequencer":85,"./visitor":91}],87:[function(require,module,exports){ +},{"../contexts":12,"./import-sequencer":88,"./visitor":94}],90:[function(require,module,exports){ var visitors = { Visitor: require("./visitor"), ImportVisitor: require('./import-visitor'), @@ -9553,7 +9915,7 @@ var visitors = { module.exports = visitors; -},{"./extend-visitor":84,"./import-visitor":86,"./join-selector-visitor":88,"./set-tree-visibility-visitor":89,"./to-css-visitor":90,"./visitor":91}],88:[function(require,module,exports){ +},{"./extend-visitor":87,"./import-visitor":89,"./join-selector-visitor":91,"./set-tree-visibility-visitor":92,"./to-css-visitor":93,"./visitor":94}],91:[function(require,module,exports){ var Visitor = require("./visitor"); var JoinSelectorVisitor = function() { @@ -9565,7 +9927,7 @@ JoinSelectorVisitor.prototype = { run: function (root) { return this._visitor.visit(root); }, - visitRule: function (ruleNode, visitArgs) { + visitDeclaration: function (declNode, visitArgs) { visitArgs.visitDeeper = false; }, visitMixinDefinition: function (mixinDefinitionNode, visitArgs) { @@ -9596,17 +9958,17 @@ JoinSelectorVisitor.prototype = { var context = this.contexts[this.contexts.length - 1]; mediaNode.rules[0].root = (context.length === 0 || context[0].multiMedia); }, - visitDirective: function (directiveNode, visitArgs) { + visitAtRule: function (atRuleNode, visitArgs) { var context = this.contexts[this.contexts.length - 1]; - if (directiveNode.rules && directiveNode.rules.length) { - directiveNode.rules[0].root = (directiveNode.isRooted || context.length === 0 || null); + if (atRuleNode.rules && atRuleNode.rules.length) { + atRuleNode.rules[0].root = (atRuleNode.isRooted || context.length === 0 || null); } } }; module.exports = JoinSelectorVisitor; -},{"./visitor":91}],89:[function(require,module,exports){ +},{"./visitor":94}],92:[function(require,module,exports){ var SetTreeVisibilityVisitor = function(visible) { this.visible = visible; }; @@ -9645,7 +10007,7 @@ SetTreeVisibilityVisitor.prototype.visit = function(node) { return node; }; module.exports = SetTreeVisibilityVisitor; -},{}],90:[function(require,module,exports){ +},{}],93:[function(require,module,exports){ var tree = require("../tree"), Visitor = require("./visitor"); @@ -9663,7 +10025,7 @@ CSSVisitorUtils.prototype = { for (var r = 0; r < bodyRules.length; r++) { rule = bodyRules[r]; if (rule.isSilent && rule.isSilent(this._context) && !rule.blocksVisibility()) { - //the directive contains something that was referenced (likely by extend) + //the atrule contains something that was referenced (likely by extend) //therefore it needs to be shown in output too return true; } @@ -9748,11 +10110,11 @@ ToCSSVisitor.prototype = { return this._visitor.visit(root); }, - visitRule: function (ruleNode, visitArgs) { - if (ruleNode.blocksVisibility() || ruleNode.variable) { + visitDeclaration: function (declNode, visitArgs) { + if (declNode.blocksVisibility() || declNode.variable) { return; } - return ruleNode; + return declNode; }, visitMixinDefinition: function (mixinNode, visitArgs) { @@ -9786,24 +10148,24 @@ ToCSSVisitor.prototype = { return importNode; }, - visitDirective: function(directiveNode, visitArgs) { - if (directiveNode.rules && directiveNode.rules.length) { - return this.visitDirectiveWithBody(directiveNode, visitArgs); + visitAtRule: function(atRuleNode, visitArgs) { + if (atRuleNode.rules && atRuleNode.rules.length) { + return this.visitAtRuleWithBody(atRuleNode, visitArgs); } else { - return this.visitDirectiveWithoutBody(directiveNode, visitArgs); + return this.visitAtRuleWithoutBody(atRuleNode, visitArgs); } }, - visitDirectiveWithBody: function(directiveNode, visitArgs) { + visitAtRuleWithBody: function(atRuleNode, visitArgs) { //if there is only one nested ruleset and that one has no path, then it is //just fake ruleset - function hasFakeRuleset(directiveNode) { - var bodyRules = directiveNode.rules; + function hasFakeRuleset(atRuleNode) { + var bodyRules = atRuleNode.rules; return bodyRules.length === 1 && (!bodyRules[0].paths || bodyRules[0].paths.length === 0); } - function getBodyRules(directiveNode) { - var nodeRules = directiveNode.rules; - if (hasFakeRuleset(directiveNode)) { + function getBodyRules(atRuleNode) { + var nodeRules = atRuleNode.rules; + if (hasFakeRuleset(atRuleNode)) { return nodeRules[0].rules; } @@ -9812,30 +10174,30 @@ ToCSSVisitor.prototype = { //it is still true that it is only one ruleset in array //this is last such moment //process childs - var originalRules = getBodyRules(directiveNode); - directiveNode.accept(this._visitor); + var originalRules = getBodyRules(atRuleNode); + atRuleNode.accept(this._visitor); visitArgs.visitDeeper = false; - if (!this.utils.isEmpty(directiveNode)) { - this._mergeRules(directiveNode.rules[0].rules); + if (!this.utils.isEmpty(atRuleNode)) { + this._mergeRules(atRuleNode.rules[0].rules); } - return this.utils.resolveVisibility(directiveNode, originalRules); + return this.utils.resolveVisibility(atRuleNode, originalRules); }, - visitDirectiveWithoutBody: function(directiveNode, visitArgs) { - if (directiveNode.blocksVisibility()) { + visitAtRuleWithoutBody: function(atRuleNode, visitArgs) { + if (atRuleNode.blocksVisibility()) { return; } - if (directiveNode.name === "@charset") { + if (atRuleNode.name === "@charset") { // Only output the debug info together with subsequent @charset definitions - // a comment (or @media statement) before the actual @charset directive would + // a comment (or @media statement) before the actual @charset atrule would // be considered illegal css as it has to be on the first line if (this.charset) { - if (directiveNode.debugInfo) { - var comment = new tree.Comment("/* " + directiveNode.toCSS(this._context).replace(/\n/g, "") + " */\n"); - comment.debugInfo = directiveNode.debugInfo; + if (atRuleNode.debugInfo) { + var comment = new tree.Comment("/* " + atRuleNode.toCSS(this._context).replace(/\n/g, "") + " */\n"); + comment.debugInfo = atRuleNode.debugInfo; return this._visitor.visit(comment); } return; @@ -9843,7 +10205,7 @@ ToCSSVisitor.prototype = { this.charset = true; } - return directiveNode; + return atRuleNode; }, checkValidNodes: function(rules, isRoot) { @@ -9853,7 +10215,7 @@ ToCSSVisitor.prototype = { for (var i = 0; i < rules.length; i++) { var ruleNode = rules[i]; - if (isRoot && ruleNode instanceof tree.Rule && !ruleNode.variable) { + if (isRoot && ruleNode instanceof tree.Declaration && !ruleNode.variable) { throw { message: "Properties must be inside selector blocks. They cannot be in the root", index: ruleNode.index, filename: ruleNode.currentFileInfo && ruleNode.currentFileInfo.filename}; } @@ -9950,12 +10312,12 @@ ToCSSVisitor.prototype = { for (i = rules.length - 1; i >= 0 ; i--) { rule = rules[i]; - if (rule instanceof tree.Rule) { + if (rule instanceof tree.Declaration) { if (!ruleCache[rule.name]) { ruleCache[rule.name] = rule; } else { ruleList = ruleCache[rule.name]; - if (ruleList instanceof tree.Rule) { + if (ruleList instanceof tree.Declaration) { ruleList = ruleCache[rule.name] = [ruleCache[rule.name].toCSS(this._context)]; } var ruleCSS = rule.toCSS(this._context); @@ -9980,7 +10342,7 @@ ToCSSVisitor.prototype = { for (var i = 0; i < rules.length; i++) { rule = rules[i]; - if ((rule instanceof tree.Rule) && rule.merge) { + if ((rule instanceof tree.Declaration) && rule.merge) { key = [rule.name, rule.important ? "!" : ""].join(","); @@ -10040,7 +10402,7 @@ ToCSSVisitor.prototype = { module.exports = ToCSSVisitor; -},{"../tree":62,"./visitor":91}],91:[function(require,module,exports){ +},{"../tree":65,"./visitor":94}],94:[function(require,module,exports){ var tree = require("../tree"); var _visitArgs = { visitDeeper: true }, @@ -10194,7 +10556,7 @@ Visitor.prototype = { }; module.exports = Visitor; -},{"../tree":62}],92:[function(require,module,exports){ +},{"../tree":65}],95:[function(require,module,exports){ "use strict"; // rawAsap provides everything we need except exception management. @@ -10262,7 +10624,7 @@ RawTask.prototype.call = function () { } }; -},{"./raw":93}],93:[function(require,module,exports){ +},{"./raw":96}],96:[function(require,module,exports){ (function (global){ "use strict"; @@ -10486,7 +10848,356 @@ rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer; // https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],94:[function(require,module,exports){ +},{}],97:[function(require,module,exports){ +(function (process){ +// Copyright Joyent, Inc. and other Node contributors. +// +// 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. + +// resolves . and .. elements in a path array with directory names there +// must be no slashes, empty elements, or device names (c:\) in the array +// (so also no leading and trailing slashes - it does not distinguish +// relative and absolute paths) +function normalizeArray(parts, allowAboveRoot) { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (; up--; up) { + parts.unshift('..'); + } + } + + return parts; +} + +// Split a filename into [root, dir, basename, ext], unix version +// 'root' is just a slash, or nothing. +var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; +var splitPath = function(filename) { + return splitPathRe.exec(filename).slice(1); +}; + +// path.resolve([from ...], to) +// posix version +exports.resolve = function() { + var resolvedPath = '', + resolvedAbsolute = false; + + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? arguments[i] : process.cwd(); + + // Skip empty and invalid entries + if (typeof path !== 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + continue; + } + + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charAt(0) === '/'; + } + + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) + + // Normalize the path + resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { + return !!p; + }), !resolvedAbsolute).join('/'); + + return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; +}; + +// path.normalize(path) +// posix version +exports.normalize = function(path) { + var isAbsolute = exports.isAbsolute(path), + trailingSlash = substr(path, -1) === '/'; + + // Normalize the path + path = normalizeArray(filter(path.split('/'), function(p) { + return !!p; + }), !isAbsolute).join('/'); + + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + + return (isAbsolute ? '/' : '') + path; +}; + +// posix version +exports.isAbsolute = function(path) { + return path.charAt(0) === '/'; +}; + +// posix version +exports.join = function() { + var paths = Array.prototype.slice.call(arguments, 0); + return exports.normalize(filter(paths, function(p, index) { + if (typeof p !== 'string') { + throw new TypeError('Arguments to path.join must be strings'); + } + return p; + }).join('/')); +}; + + +// path.relative(from, to) +// posix version +exports.relative = function(from, to) { + from = exports.resolve(from).substr(1); + to = exports.resolve(to).substr(1); + + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } + + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } + + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); + + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + + return outputParts.join('/'); +}; + +exports.sep = '/'; +exports.delimiter = ':'; + +exports.dirname = function(path) { + var result = splitPath(path), + root = result[0], + dir = result[1]; + + if (!root && !dir) { + // No dirname whatsoever + return '.'; + } + + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.substr(0, dir.length - 1); + } + + return root + dir; +}; + + +exports.basename = function(path, ext) { + var f = splitPath(path)[2]; + // TODO: make this comparison case-insensitive on windows? + if (ext && f.substr(-1 * ext.length) === ext) { + f = f.substr(0, f.length - ext.length); + } + return f; +}; + + +exports.extname = function(path) { + return splitPath(path)[3]; +}; + +function filter (xs, f) { + if (xs.filter) return xs.filter(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + if (f(xs[i], i, xs)) res.push(xs[i]); + } + return res; +} + +// String.prototype.substr - negative index don't work in IE8 +var substr = 'ab'.substr(-1) === 'b' + ? function (str, start, len) { return str.substr(start, len) } + : function (str, start, len) { + if (start < 0) start = str.length + start; + return str.substr(start, len); + } +; + +}).call(this,require('_process')) +},{"_process":98}],98:[function(require,module,exports){ +// shim for using process in browser + +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +(function () { + try { + cachedSetTimeout = setTimeout; + } catch (e) { + cachedSetTimeout = function () { + throw new Error('setTimeout is not defined'); + } + } + try { + cachedClearTimeout = clearTimeout; + } catch (e) { + cachedClearTimeout = function () { + throw new Error('clearTimeout is not defined'); + } + } +} ()) +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = cachedSetTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + cachedClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + cachedSetTimeout(drainQueue, 0); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + +},{}],99:[function(require,module,exports){ 'use strict'; var asap = require('asap/raw'); @@ -10701,7 +11412,7 @@ function doResolve(fn, promise) { } } -},{"asap/raw":93}],95:[function(require,module,exports){ +},{"asap/raw":96}],100:[function(require,module,exports){ 'use strict'; //This file contains the ES6 extensions to the core Promises/A+ API @@ -10810,7 +11521,7 @@ Promise.prototype['catch'] = function (onRejected) { return this.then(null, onRejected); }; -},{"./core.js":94}],96:[function(require,module,exports){ +},{"./core.js":99}],101:[function(require,module,exports){ // should work in any browser without browserify if (typeof Promise.prototype.done !== 'function') { @@ -10823,7 +11534,7 @@ if (typeof Promise.prototype.done !== 'function') { }) } } -},{}],97:[function(require,module,exports){ +},{}],102:[function(require,module,exports){ // not "use strict" so we can declare global "Promise" var asap = require('asap'); @@ -10835,5 +11546,5 @@ if (typeof Promise === 'undefined') { require('./polyfill-done.js'); -},{"./lib/core.js":94,"./lib/es6-extensions.js":95,"./polyfill-done.js":96,"asap":92}]},{},[2])(2) +},{"./lib/core.js":99,"./lib/es6-extensions.js":100,"./polyfill-done.js":101,"asap":95}]},{},[2])(2) }); \ No newline at end of file diff --git a/dist/less.min.js b/dist/less.min.js index b271f4f32..2ca0306a2 100644 --- a/dist/less.min.js +++ b/dist/less.min.js @@ -1,5 +1,5 @@ /*! - * Less - Leaner CSS v2.7.1 + * Less - Leaner CSS v3.0.0-alpha.1 * http://lesscss.org * * Copyright (c) 2009-2016, Alexis Sellier @@ -10,8 +10,8 @@ /** * @license Apache-2.0 */ -!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.less=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;d.length>g;g++)e(d[g]);return e}({1:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(a,b){d(b,e.currentScript(a)),void 0===b.isFileProtocol&&(b.isFileProtocol=/^(file|(chrome|safari)(-extension)?|resource|qrc|app):/.test(a.location.protocol)),b.async=b.async||!1,b.fileAsync=b.fileAsync||!1,b.poll=b.poll||(b.isFileProtocol?1e3:1500),b.env=b.env||("127.0.0.1"==a.location.hostname||"0.0.0.0"==a.location.hostname||"localhost"==a.location.hostname||a.location.port&&a.location.port.length>0||b.isFileProtocol?"development":"production");var c=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(a.location.hash);c&&(b.dumpLineNumbers=c[1]),void 0===b.useFileCache&&(b.useFileCache=!0),void 0===b.onReady&&(b.onReady=!0)}},{"./browser":3,"./utils":10}],2:[function(a,b,c){function d(a){a.filename&&console.warn(a),e.async||h.removeChild(i)}a("promise/polyfill.js");var e=window.less||{};a("./add-default-options")(window,e);var f=b.exports=a("./index")(window,e);window.less=f;var g,h,i;e.onReady&&(/!watch/.test(window.location.hash)&&f.watch(),e.async||(g="body { display: none !important }",h=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),i.type="text/css",i.styleSheet?i.styleSheet.cssText=g:i.appendChild(document.createTextNode(g)),h.appendChild(i)),f.registerStylesheetsImmediately(),f.pageLoadFinished=f.refresh("development"===f.env).then(d,d))},{"./add-default-options":1,"./index":8,"promise/polyfill.js":97}],3:[function(a,b,c){var d=a("./utils");b.exports={createCSS:function(a,b,c){var e=c.href||"",f="less:"+(c.title||d.extractId(e)),g=a.getElementById(f),h=!1,i=a.createElement("style");i.setAttribute("type","text/css"),c.media&&i.setAttribute("media",c.media),i.id=f,i.styleSheet||(i.appendChild(a.createTextNode(b)),h=null!==g&&g.childNodes.length>0&&i.childNodes.length>0&&g.firstChild.nodeValue===i.firstChild.nodeValue);var j=a.getElementsByTagName("head")[0];if(null===g||h===!1){var k=c&&c.nextSibling||null;k?k.parentNode.insertBefore(i,k):j.appendChild(i)}if(g&&h===!1&&g.parentNode.removeChild(g),i.styleSheet)try{i.styleSheet.cssText=b}catch(l){throw new Error("Couldn't reassign styleSheet.cssText.")}},currentScript:function(a){var b=a.document;return b.currentScript||function(){var a=b.getElementsByTagName("script");return a[a.length-1]}()}}},{"./utils":10}],4:[function(a,b,c){b.exports=function(a,b,c){var d=null;if("development"!==b.env)try{d="undefined"==typeof a.localStorage?null:a.localStorage}catch(e){}return{setCSS:function(a,b,e,f){if(d){c.info("saving "+a+" to cache.");try{d.setItem(a,f),d.setItem(a+":timestamp",b),e&&d.setItem(a+":vars",JSON.stringify(e))}catch(g){c.error('failed to save "'+a+'" to local storage for caching.')}}},getCSS:function(a,b,c){var e=d&&d.getItem(a),f=d&&d.getItem(a+":timestamp"),g=d&&d.getItem(a+":vars");return c=c||{},f&&b.lastModified&&new Date(b.lastModified).valueOf()===new Date(f).valueOf()&&(!c&&!g||JSON.stringify(c)===g)?e:void 0}}}},{}],5:[function(a,b,c){var d=a("./utils"),e=a("./browser");b.exports=function(a,b,c){function f(b,f){var g,h,i="less-error-message:"+d.extractId(f||""),j='
  • {content}
  • ',k=a.document.createElement("div"),l=[],m=b.filename||f,n=m.match(/([^\/]+(\?.*)?)$/)[1];k.id=i,k.className="less-error-message",h="

    "+(b.type||"Syntax")+"Error: "+(b.message||"There is an error in your .less file")+'

    in '+n+" ";var o=function(a,b,c){void 0!==a.extract[b]&&l.push(j.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};b.extract&&(o(b,0,""),o(b,1,"line"),o(b,2,""),h+="on line "+b.line+", column "+(b.column+1)+":

      "+l.join("")+"
    "),b.stack&&(b.extract||c.logLevel>=4)&&(h+="
    Stack Trace
    "+b.stack.split("\n").slice(1).join("
    ")),k.innerHTML=h,e.createCSS(a.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),k.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===c.env&&(g=setInterval(function(){var b=a.document,c=b.body;c&&(b.getElementById(i)?c.replaceChild(k,b.getElementById(i)):c.insertBefore(k,c.firstChild),clearInterval(g))},10))}function g(b){var c=a.document.getElementById("less-error-message:"+d.extractId(b));c&&c.parentNode.removeChild(c)}function h(a){}function i(a){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?h(a):"function"==typeof c.errorReporting&&c.errorReporting("remove",a):g(a)}function j(a,d){var e="{line} {content}",f=a.filename||d,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f+" ",i=function(a,b,c){void 0!==a.extract[b]&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.extract&&(i(a,0,""),i(a,1,"line"),i(a,2,""),h+="on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")),a.stack&&(a.extract||c.logLevel>=4)&&(h+="\nStack Trace\n"+a.stack),b.logger.error(h)}function k(a,b){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?j(a,b):"function"==typeof c.errorReporting&&c.errorReporting("add",a,b):f(a,b)}return{add:k,remove:i}}},{"./browser":3,"./utils":10}],6:[function(a,b,c){b.exports=function(b,c){function d(){if(window.XMLHttpRequest&&!("file:"===window.location.protocol&&"ActiveXObject"in window))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){return c.error("browser doesn't support AJAX."),null}}var e=a("../less/environment/abstract-file-manager.js"),f={},g=function(){};return g.prototype=new e,g.prototype.alwaysMakePathsAbsolute=function(){return!0},g.prototype.join=function(a,b){return a?this.extractUrlParts(b,a).path:b},g.prototype.doXHR=function(a,e,f,g){function h(b,c,d){b.status>=200&&300>b.status?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var i=d(),j=b.isFileProtocol?b.fileAsync:!0;"function"==typeof i.overrideMimeType&&i.overrideMimeType("text/css"),c.debug("XHR: Getting '"+a+"'"),i.open("GET",a,j),i.setRequestHeader("Accept",e||"text/x-less, text/css; q=0.9, */*; q=0.5"),i.send(null),b.isFileProtocol&&!b.fileAsync?0===i.status||i.status>=200&&300>i.status?f(i.responseText):g(i.status,a):j?i.onreadystatechange=function(){4==i.readyState&&h(i,f,g)}:h(i,f,g)},g.prototype.supports=function(a,b,c,d){return!0},g.prototype.clearFileCache=function(){f={}},g.prototype.loadFile=function(a,b,c,d,e){b&&!this.isPathAbsolute(a)&&(a=b+a),c=c||{};var g=this.extractUrlParts(a,window.location.href),h=g.url;if(c.useFileCache&&f[h])try{var i=f[h];e(null,{contents:i,filename:h,webInfo:{lastModified:new Date}})}catch(j){e({filename:h,message:"Error loading file "+h+" error was "+j.message})}else this.doXHR(h,c.mime,function(a,b){f[h]=a,e(null,{contents:a,filename:h,webInfo:{lastModified:b}})},function(a,b){e({type:"File",message:"'"+b+"' wasn't found ("+a+")",href:h})})},g}},{"../less/environment/abstract-file-manager.js":15}],7:[function(a,b,c){b.exports=function(){function b(){throw{type:"Runtime",message:"Image size functions are not supported in browser version of less"}}var c=a("./../less/functions/function-registry"),d={"image-size":function(a){return b(this,a),-1},"image-width":function(a){return b(this,a),-1},"image-height":function(a){return b(this,a),-1}};c.addMultiple(d)}},{"./../less/functions/function-registry":22}],8:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(b,c){function f(a){return c.postProcessor&&"function"==typeof c.postProcessor&&(a=c.postProcessor.call(a,a)||a),a}function g(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function h(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}}function i(a){for(var b,d=m.getElementsByTagName("style"),e=0;d.length>e;e++)if(b=d[e],b.type.match(t)){var f=g(c);f.modifyVars=a;var i=b.innerHTML||"";f.filename=m.location.href.replace(/#.*$/,""),n.render(i,f,h(function(a,b,c){b?r.add(b,"inline"):(a.type="text/css",a.styleSheet?a.styleSheet.cssText=c.css:a.innerHTML=c.css)},null,b))}}function j(a,b,e,h,i){function j(c){var d=c.contents,g=c.filename,i=c.webInfo,j={currentDirectory:q.getPath(g),filename:g,rootFilename:g,relativeUrls:k.relativeUrls};if(j.entryPath=j.currentDirectory,j.rootpath=k.rootpath||j.currentDirectory,i){i.remaining=h;var l=s.getCSS(g,i,k.modifyVars);if(!e&&l)return i.local=!0,void b(null,l,d,a,i,g)}r.remove(g),k.rootFileInfo=j,n.render(d,k,function(c,e){c?(c.href=g,b(c)):(e.css=f(e.css),s.setCSS(a.href,i.lastModified,k.modifyVars,e.css),b(null,e.css,d,a,i,g))})}var k=g(c);d(k,a),k.mime=a.type,i&&(k.modifyVars=i),q.loadFile(a.href,null,k,o,function(a,c){return a?void b(a):void j(c)})}function k(a,b,c){for(var d=0;n.sheets.length>d;d++)j(n.sheets[d],a,b,n.sheets.length-(d+1),c)}function l(){"development"===n.env&&(n.watchTimer=setInterval(function(){n.watchMode&&(q.clearFileCache(),k(function(a,c,d,f,g){a?r.add(a,a.href||f.href):c&&e.createCSS(b.document,c,f)}))},c.poll))}var m=b.document,n=a("../less")();n.options=c;var o=n.environment,p=a("./file-manager")(c,n.logger),q=new p;o.addFileManager(q),n.FileManager=p,a("./log-listener")(n,c);var r=a("./error-reporting")(b,n,c),s=n.cache=c.cache||a("./cache")(b,c,n.logger);a("./image-size")(n.environment),c.functions&&n.functions.functionRegistry.addMultiple(c.functions);var t=/^text\/(x-)?less$/;return n.watch=function(){return n.watchMode||(n.env="development",l()),this.watchMode=!0,!0},n.unwatch=function(){return clearInterval(n.watchTimer),this.watchMode=!1,!1},n.registerStylesheetsImmediately=function(){var a=m.getElementsByTagName("link");n.sheets=[];for(var b=0;a.length>b;b++)("stylesheet/less"===a[b].rel||a[b].rel.match(/stylesheet/)&&a[b].type.match(t))&&n.sheets.push(a[b])},n.registerStylesheets=function(){return new Promise(function(a,b){n.registerStylesheetsImmediately(),a()})},n.modifyVars=function(a){return n.refresh(!0,a,!1)},n.refresh=function(a,c,d){return(a||d)&&d!==!1&&q.clearFileCache(),new Promise(function(d,f){var g,h,j,l;g=h=new Date,l=n.sheets.length,0===l?(h=new Date,j=h-g,n.logger.info("Less has finished and no sheets were loaded."),d({startTime:g,endTime:h,totalMilliseconds:j,sheets:n.sheets.length})):k(function(a,c,i,k,m){return a?(r.add(a,a.href||k.href),void f(a)):(n.logger.info(m.local?"Loading "+k.href+" from cache.":"Rendered "+k.href+" successfully."),e.createCSS(b.document,c,k),n.logger.info("CSS for "+k.href+" generated in "+(new Date-h)+"ms"),l--,0===l&&(j=new Date-g,n.logger.info("Less has finished. CSS generated in "+j+"ms"),d({startTime:g,endTime:h,totalMilliseconds:j,sheets:n.sheets.length})),void(h=new Date))},a,c),i(c)})},n.refreshStyles=i,n}},{"../less":31,"./browser":3,"./cache":4,"./error-reporting":5,"./file-manager":6,"./image-size":7,"./log-listener":9,"./utils":10}],9:[function(a,b,c){b.exports=function(a,b){var c=4,d=3,e=2,f=1;b.logLevel="undefined"!=typeof b.logLevel?b.logLevel:"development"===b.env?d:f,b.loggers||(b.loggers=[{debug:function(a){b.logLevel>=c&&console.log(a)},info:function(a){b.logLevel>=d&&console.log(a)},warn:function(a){b.logLevel>=e&&console.warn(a)},error:function(a){b.logLevel>=f&&console.error(a)}}]);for(var g=0;b.loggers.length>g;g++)a.logger.addListener(b.loggers[g])}},{}],10:[function(a,b,c){b.exports={extractId:function(a){return a.replace(/^[a-z-]+:\/+?[^\/]+/,"").replace(/[\?\&]livereload=\w+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^\.\w-]+/g,"-").replace(/\./g,":")},addDataAttr:function(a,b){for(var c in b.dataset)if(b.dataset.hasOwnProperty(c))if("env"===c||"dumpLineNumbers"===c||"rootpath"===c||"errorReporting"===c)a[c]=b.dataset[c];else try{a[c]=JSON.parse(b.dataset[c])}catch(d){}}}},{}],11:[function(a,b,c){var d={};b.exports=d;var e=function(a,b,c){if(a)for(var d=0;c.length>d;d++)a.hasOwnProperty(c[d])&&(b[c[d]]=a[c[d]])},f=["paths","relativeUrls","rootpath","strictImports","insecure","dumpLineNumbers","compress","syncImport","chunkInput","mime","useFileCache","processImports","pluginManager"];d.Parse=function(a){e(a,this,f),"string"==typeof this.paths&&(this.paths=[this.paths])};var g=["paths","compress","ieCompat","strictMath","strictUnits","sourceMap","importMultiple","urlArgs","javascriptEnabled","pluginManager","importantScope"];d.Eval=function(a,b){e(a,this,g),"string"==typeof this.paths&&(this.paths=[this.paths]),this.frames=b||[],this.importantScope=this.importantScope||[]},d.Eval.prototype.inParenthesis=function(){this.parensStack||(this.parensStack=[]),this.parensStack.push(!0)},d.Eval.prototype.outOfParenthesis=function(){this.parensStack.pop()},d.Eval.prototype.isMathOn=function(){return this.strictMath?this.parensStack&&this.parensStack.length:!0},d.Eval.prototype.isPathRelative=function(a){return!/^(?:[a-z-]+:|\/|#)/i.test(a)},d.Eval.prototype.normalizePath=function(a){var b,c=a.split("/").reverse();for(a=[];0!==c.length;)switch(b=c.pop()){case".":break;case"..":0===a.length||".."===a[a.length-1]?a.push(b):a.pop();break;default:a.push(b)}return a.join("/")}},{}],12:[function(a,b,c){b.exports={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}},{}],13:[function(a,b,c){b.exports={colors:a("./colors"),unitConversions:a("./unit-conversions")}},{"./colors":12,"./unit-conversions":14}],14:[function(a,b,c){b.exports={length:{m:1,cm:.01,mm:.001,"in":.0254,px:.0254/96,pt:.0254/72,pc:.0254/72*12},duration:{s:1,ms:.001},angle:{rad:1/(2*Math.PI),deg:1/360,grad:.0025,turn:1}}},{}],15:[function(a,b,c){var d=function(){};d.prototype.getPath=function(a){var b=a.lastIndexOf("?");return b>0&&(a=a.slice(0,b)),b=a.lastIndexOf("/"),0>b&&(b=a.lastIndexOf("\\")),0>b?"":a.slice(0,b+1)},d.prototype.tryAppendExtension=function(a,b){return/(\.[a-z]*$)|([\?;].*)$/.test(a)?a:a+b},d.prototype.tryAppendLessExtension=function(a){return this.tryAppendExtension(a,".less")},d.prototype.supportsSync=function(){return!1},d.prototype.alwaysMakePathsAbsolute=function(){return!1},d.prototype.isPathAbsolute=function(a){return/^(?:[a-z-]+:|\/|\\|#)/i.test(a)},d.prototype.join=function(a,b){return a?a+b:b},d.prototype.pathDiff=function(a,b){var c,d,e,f,g=this.extractUrlParts(a),h=this.extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;d>c&&h.directories[c]===g.directories[c];c++);for(f=h.directories.slice(c),e=g.directories.slice(c),c=0;f.length-1>c;c++)i+="../";for(c=0;e.length-1>c;c++)i+=e[c]+"/";return i},d.prototype.extractUrlParts=function(a,b){var c,d,e=/^((?:[a-z-]+:)?\/{2}(?:[^\/\?#]*\/)|([\/\\]))?((?:[^\/\\\?#]*[\/\\])*)([^\/\\\?#]*)([#\?].*)?$/i,f=a.match(e),g={},h=[];if(!f)throw new Error("Could not parse sheet href - '"+a+"'");if(b&&(!f[1]||f[2])){if(d=b.match(e),!d)throw new Error("Could not parse page url - '"+b+"'");f[1]=f[1]||d[1]||"",f[2]||(f[3]=d[3]+f[3])}if(f[3]){for(h=f[3].replace(/\\/g,"/").split("/"),c=0;h.length>c;c++)"."===h[c]&&(h.splice(c,1),c-=1);for(c=0;h.length>c;c++)".."===h[c]&&c>0&&(h.splice(c-1,2),c-=2)}return g.hostPart=f[1],g.directories=h,g.path=(f[1]||"")+h.join("/"),g.fileUrl=g.path+(f[4]||""),g.url=g.fileUrl+(f[5]||""),g},b.exports=d},{}],16:[function(a,b,c){var d=a("../logger"),e=function(a,b){this.fileManagers=b||[],a=a||{};for(var c=["encodeBase64","mimeLookup","charsetLookup","getSourceMapGenerator"],d=[],e=d.concat(c),f=0;e.length>f;f++){var g=e[f],h=a[g];h?this[g]=h.bind(a):d.length>f&&this.warn("missing required function in environment - "+g)}};e.prototype.getFileManager=function(a,b,c,e,f){a||d.warn("getFileManager called with no filename.. Please report this issue. continuing."),null==b&&d.warn("getFileManager called with null directory.. Please report this issue. continuing.");var g=this.fileManagers;c.pluginManager&&(g=[].concat(g).concat(c.pluginManager.getFileManagers()));for(var h=g.length-1;h>=0;h--){var i=g[h];if(i[f?"supportsSync":"supports"](a,b,c,e))return i}return null},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},b.exports=e},{"../logger":33}],17:[function(a,b,c){function d(a,b,c){var d,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;3>l;l++)d=b.rgb[l]/255,f=c.rgb[l]/255,h=a(d,f),g&&(h=(j*f+i*(d-j*(d+f-h)))/g),k[l]=255*h;return new e(k,g)}var e=a("../tree/color"),f=a("./function-registry"),g={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,1>=a?g.multiply(a,b):g.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return g.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};for(var h in g)g.hasOwnProperty(h)&&(d[h]=d.bind(null,g[h]));f.addMultiple(d)},{"../tree/color":50,"./function-registry":22}],18:[function(a,b,c){function d(a){return Math.min(1,Math.max(0,a))}function e(a){return h.hsla(a.h,a.s,a.l,a.a)}function f(a){if(a instanceof i)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{type:"Argument",message:"color functions take numbers as parameters"}}function g(a,b){return a instanceof i&&a.unit.is("%")?parseFloat(a.value*b/100):f(a)}var h,i=a("../tree/dimension"),j=a("../tree/color"),k=a("../tree/quoted"),l=a("../tree/anonymous"),m=a("./function-registry");h={rgb:function(a,b,c){return h.rgba(a,b,c,1)},rgba:function(a,b,c,d){var e=[a,b,c].map(function(a){return g(a,255)});return d=f(d),new j(e,d)},hsl:function(a,b,c){return h.hsla(a,b,c,1)},hsla:function(a,b,c,e){function g(a){return a=0>a?a+1:a>1?a-1:a,1>6*a?i+(j-i)*a*6:1>2*a?j:2>3*a?i+(j-i)*(2/3-a)*6:i}var i,j;return a=f(a)%360/360,b=d(f(b)),c=d(f(c)),e=d(f(e)),j=.5>=c?c*(b+1):c+b-c*b,i=2*c-j,h.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),e)},hsv:function(a,b,c){return h.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=f(a)%360/360*360,b=f(b),c=f(c),d=f(d);var e,g;e=Math.floor(a/60%6),g=a/60-e;var i=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],j=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return h.rgba(255*i[j[e][0]],255*i[j[e][1]],255*i[j[e][2]],d)},hue:function(a){return new i(a.toHSL().h)},saturation:function(a){return new i(100*a.toHSL().s,"%")},lightness:function(a){return new i(100*a.toHSL().l,"%")},hsvhue:function(a){return new i(a.toHSV().h)},hsvsaturation:function(a){return new i(100*a.toHSV().s,"%")},hsvvalue:function(a){return new i(100*a.toHSV().v,"%")},red:function(a){return new i(a.rgb[0])},green:function(a){return new i(a.rgb[1])},blue:function(a){return new i(a.rgb[2])},alpha:function(a){return new i(a.toHSL().a)},luma:function(a){return new i(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new i(b*a.alpha*100,"%")},saturate:function(a,b,c){if(!a.rgb)return null;var f=a.toHSL();return f.s+="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},desaturate:function(a,b,c){var f=a.toHSL();return f.s-="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},lighten:function(a,b,c){var f=a.toHSL();return f.l+="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},darken:function(a,b,c){var f=a.toHSL();return f.l-="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},fadein:function(a,b,c){var f=a.toHSL();return f.a+="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fadeout:function(a,b,c){var f=a.toHSL();return f.a-="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=d(c.a),e(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=0>d?360+d:d,e(c)},mix:function(a,b,c){a.toHSL&&b.toHSL||(console.log(b.type),console.dir(b)),c||(c=new i(50));var d=c.value/100,e=2*d-1,f=a.toHSL().a-b.toHSL().a,g=((e*f==-1?e:(e+f)/(1+e*f))+1)/2,h=1-g,k=[a.rgb[0]*g+b.rgb[0]*h,a.rgb[1]*g+b.rgb[1]*h,a.rgb[2]*g+b.rgb[2]*h],l=a.alpha*d+b.alpha*(1-d);return new j(k,l)},greyscale:function(a){return h.desaturate(a,new i(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;"undefined"==typeof b&&(b=h.rgba(0,0,0,1)),"undefined"==typeof c&&(c=h.rgba(255,255,255,1));var e,f,g=a.luma(),i=b.luma(),j=c.luma();return e=g>i?(g+.05)/(i+.05):(i+.05)/(g+.05),f=g>j?(g+.05)/(j+.05):(j+.05)/(g+.05),e>f?b:c},argb:function(a){return new l(a.toARGB())},color:function(a){if(a instanceof k&&/^#([a-f0-9]{6}|[a-f0-9]{3})$/i.test(a.value))return new j(a.value.slice(1));if(a instanceof j||(a=j.fromKeyword(a.value)))return a.value=void 0,a;throw{type:"Argument",message:"argument must be a color keyword or 3/6 digit hex e.g. #FFF"}},tint:function(a,b){return h.mix(h.rgb(255,255,255),a,b)},shade:function(a,b){return h.mix(h.rgb(0,0,0),a,b)}},m.addMultiple(h)},{"../tree/anonymous":46,"../tree/color":50,"../tree/dimension":56,"../tree/quoted":73,"./function-registry":22}],19:[function(a,b,c){b.exports=function(b){var c=a("../tree/quoted"),d=a("../tree/url"),e=a("./function-registry"),f=function(a,b){return new d(b,a.index,a.currentFileInfo).eval(a.context)},g=a("../logger");e.add("data-uri",function(a,e){e||(e=a,a=null);var h=a&&a.value,i=e.value,j=this.currentFileInfo,k=j.relativeUrls?j.currentDirectory:j.entryPath,l=i.indexOf("#"),m="";-1!==l&&(m=i.slice(l),i=i.slice(0,l));var n=b.getFileManager(i,k,this.context,b,!0);if(!n)return f(this,e);var o=!1;if(a)o=/;base64$/.test(h);else{if(h=b.mimeLookup(i),"image/svg+xml"===h)o=!1;else{var p=b.charsetLookup(h);o=["US-ASCII","UTF-8"].indexOf(p)<0}o&&(h+=";base64")}var q=n.loadFileSync(i,k,this.context,b);if(!q.contents)return g.warn("Skipped data-uri embedding of "+i+" because file not found"),f(this,e||a);var r=q.contents;if(o&&!b.encodeBase64)return f(this,e);r=o?b.encodeBase64(r):encodeURIComponent(r);var s="data:"+h+","+r+m,t=32768;return s.length>=t&&this.context.ieCompat!==!1?(g.warn("Skipped data-uri embedding of "+i+" because its size ("+s.length+" characters) exceeds IE8-safe "+t+" characters!"),f(this,e||a)):new d(new c('"'+s+'"',s,!1,this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../logger":33,"../tree/quoted":73,"../tree/url":80,"./function-registry":22}],20:[function(a,b,c){var d=a("../tree/keyword"),e=a("./function-registry"),f={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;return null!=a?a?d.True:d.False:void 0},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}};e.add("default",f.eval.bind(f)),b.exports=f},{"../tree/keyword":65,"./function-registry":22}],21:[function(a,b,c){var d=a("../tree/expression"),e=function(a,b,c,d){this.name=a.toLowerCase(),this.index=c,this.context=b,this.currentFileInfo=d,this.func=b.frames[0].functionRegistry.get(this.name)};e.prototype.isValid=function(){return Boolean(this.func)},e.prototype.call=function(a){return Array.isArray(a)&&(a=a.filter(function(a){return"Comment"!==a.type}).map(function(a){if("Expression"===a.type){var b=a.value.filter(function(a){return"Comment"!==a.type});return 1===b.length?b[0]:new d(b)}return a})),this.func.apply(this,a)},b.exports=e},{"../tree/expression":59}],22:[function(a,b,c){function d(a){return{_data:{},add:function(a,b){a=a.toLowerCase(),this._data.hasOwnProperty(a),this._data[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){this.add(b,a[b])}.bind(this))},get:function(b){return this._data[b]||a&&a.get(b)},inherit:function(){return d(this)}}}b.exports=d(null)},{}],23:[function(a,b,c){b.exports=function(b){var c={functionRegistry:a("./function-registry"),functionCaller:a("./function-caller")};return a("./default"),a("./color"),a("./color-blending"),a("./data-uri")(b),a("./math"),a("./number"),a("./string"),a("./svg")(b),a("./types"),c}},{"./color":18,"./color-blending":17,"./data-uri":19,"./default":20,"./function-caller":21,"./function-registry":22,"./math":25,"./number":26,"./string":27,"./svg":28,"./types":29}],24:[function(a,b,c){var d=a("../tree/dimension"),e=function(){};e._math=function(a,b,c){if(!(c instanceof d))throw{type:"Argument",message:"argument must be a number"};return null==b?b=c.unit:c=c.unify(),new d(a(parseFloat(c.value)),b)},b.exports=e},{"../tree/dimension":56}],25:[function(a,b,c){var d=a("./function-registry"),e=a("./math-helper.js"),f={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"};for(var g in f)f.hasOwnProperty(g)&&(f[g]=e._math.bind(null,Math[g],f[g]));f.round=function(a,b){var c="undefined"==typeof b?0:b.value;return e._math(function(a){return a.toFixed(c)},null,a)},d.addMultiple(f)},{"./function-registry":22,"./math-helper.js":24}],26:[function(a,b,c){var d=a("../tree/dimension"),e=a("../tree/anonymous"),f=a("./function-registry"),g=a("./math-helper.js"),h=function(a,b){switch(b=Array.prototype.slice.call(b),b.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var c,f,g,h,i,j,k,l,m=[],n={};for(c=0;b.length>c;c++)if(g=b[c],g instanceof d)if(h=""===g.unit.toString()&&void 0!==l?new d(g.value,l).unify():g.unify(),j=""===h.unit.toString()&&void 0!==k?k:h.unit.toString(),k=""!==j&&void 0===k||""!==j&&""===m[0].unify().unit.toString()?j:k,l=""!==j&&void 0===l?g.unit.toString():l,f=void 0!==n[""]&&""!==j&&j===k?n[""]:n[j],void 0!==f)i=""===m[f].unit.toString()&&void 0!==l?new d(m[f].value,l).unify():m[f].unify(),(a&&i.value>h.value||!a&&h.value>i.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(b[c].value)&&Array.prototype.push.apply(b,Array.prototype.slice.call(b[c].value));return 1==m.length?m[0]:(b=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new e((a?"min":"max")+"("+b+")"))};f.addMultiple({min:function(){return h(!0,arguments)},max:function(){return h(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new d(Math.PI)},mod:function(a,b){return new d(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d(a),b=new d(b);else if(!(a instanceof d&&b instanceof d))throw{type:"Argument",message:"arguments must be numbers"};return new d(Math.pow(a.value,b.value),a.unit)},percentage:function(a){var b=g._math(function(a){return 100*a},"%",a);return b}})},{"../tree/anonymous":46,"../tree/dimension":56,"./function-registry":22,"./math-helper.js":24}],27:[function(a,b,c){var d=a("../tree/quoted"),e=a("../tree/anonymous"),f=a("../tree/javascript"),g=a("./function-registry");g.addMultiple({e:function(a){return new e(a instanceof f?a.evaluated:a.value)},escape:function(a){return new e(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,b,c,e){var f=a.value;return c="Quoted"===c.type?c.value:c.toCSS(),f=f.replace(new RegExp(b.value,e?e.value:""),c),new d(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;b.length>e;e++)c=c.replace(/%[sda]/i,function(a){var c="Quoted"===b[e].type&&a.match(/s/i)?b[e].value:b[e].toCSS();return a.match(/[A-Z]$/)?encodeURIComponent(c):c});return c=c.replace(/%%/g,"%"),new d(a.quote||"",c,a.escaped); -}})},{"../tree/anonymous":46,"../tree/javascript":63,"../tree/quoted":73,"./function-registry":22}],28:[function(a,b,c){b.exports=function(b){var c=a("../tree/dimension"),d=a("../tree/color"),e=a("../tree/expression"),f=a("../tree/quoted"),g=a("../tree/url"),h=a("./function-registry");h.add("svg-gradient",function(a){function b(){throw{type:"Argument",message:"svg-gradient expects direction, start_color [start_position], [color position,]..., end_color [end_position] or direction, color list"}}var h,i,j,k,l,m,n,o,p="linear",q='x="0" y="0" width="1" height="1"',r={compress:!1},s=a.toCSS(r);switch(2==arguments.length?(2>arguments[1].value.length&&b(),h=arguments[1].value):3>arguments.length?b():h=Array.prototype.slice.call(arguments,1),s){case"to bottom":i='x1="0%" y1="0%" x2="0%" y2="100%"';break;case"to right":i='x1="0%" y1="0%" x2="100%" y2="0%"';break;case"to bottom right":i='x1="0%" y1="0%" x2="100%" y2="100%"';break;case"to top right":i='x1="0%" y1="100%" x2="100%" y2="0%"';break;case"ellipse":case"ellipse at center":p="radial",i='cx="50%" cy="50%" r="75%"',q='x="-50" y="-50" width="101" height="101"';break;default:throw{type:"Argument",message:"svg-gradient direction must be 'to bottom', 'to right', 'to bottom right', 'to top right' or 'ellipse at center'"}}for(j='<'+p+'Gradient id="gradient" gradientUnits="userSpaceOnUse" '+i+">",k=0;h.length>k;k+=1)h[k]instanceof e?(l=h[k].value[0],m=h[k].value[1]):(l=h[k],m=void 0),l instanceof d&&((0===k||k+1===h.length)&&void 0===m||m instanceof c)||b(),n=m?m.toCSS(r):0===k?"0%":"100%",o=l.alpha,j+='o?' stop-opacity="'+o+'"':"")+"/>";return j+="',j=encodeURIComponent(j),j="data:image/svg+xml,"+j,new g(new f("'"+j+"'",j,!1,this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":50,"../tree/dimension":56,"../tree/expression":59,"../tree/quoted":73,"../tree/url":80,"./function-registry":22}],29:[function(a,b,c){var d=a("../tree/keyword"),e=a("../tree/detached-ruleset"),f=a("../tree/dimension"),g=a("../tree/color"),h=a("../tree/quoted"),i=a("../tree/anonymous"),j=a("../tree/url"),k=a("../tree/operation"),l=a("./function-registry"),m=function(a,b){return a instanceof b?d.True:d.False},n=function(a,b){if(void 0===b)throw{type:"Argument",message:"missing the required second argument to isunit."};if(b="string"==typeof b.value?b.value:b,"string"!=typeof b)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof f&&a.unit.is(b)?d.True:d.False},o=function(a){var b=Array.isArray(a.value)?a.value:Array(a);return b};l.addMultiple({isruleset:function(a){return m(a,e)},iscolor:function(a){return m(a,g)},isnumber:function(a){return m(a,f)},isstring:function(a){return m(a,h)},iskeyword:function(a){return m(a,d)},isurl:function(a){return m(a,j)},ispixel:function(a){return n(a,"px")},ispercentage:function(a){return n(a,"%")},isem:function(a){return n(a,"em")},isunit:n,unit:function(a,b){if(!(a instanceof f))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof k?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d?b.value:b.toCSS():"",new f(a.value,b)},"get-unit":function(a){return new i(a.unit)},extract:function(a,b){return b=b.value-1,o(a)[b]},length:function(a){return new f(o(a).length)}})},{"../tree/anonymous":46,"../tree/color":50,"../tree/detached-ruleset":55,"../tree/dimension":56,"../tree/keyword":65,"../tree/operation":71,"../tree/quoted":73,"../tree/url":80,"./function-registry":22}],30:[function(a,b,c){var d=a("./contexts"),e=a("./parser/parser"),f=a("./plugins/function-importer");b.exports=function(a){var b=function(a,b){this.rootFilename=b.filename,this.paths=a.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=a.mime,this.error=null,this.context=a,this.queue=[],this.files={}};return b.prototype.push=function(b,c,g,h,i){var j=this;this.queue.push(b);var k=function(a,c,d){j.queue.splice(j.queue.indexOf(b),1);var e=d===j.rootFilename;h.optional&&a?i(null,{rules:[]},!1,null):(j.files[d]=c,a&&!j.error&&(j.error=a),i(a,c,e,d))},l={relativeUrls:this.context.relativeUrls,entryPath:g.entryPath,rootpath:g.rootpath,rootFilename:g.rootFilename},m=a.getFileManager(b,g.currentDirectory,this.context,a);if(!m)return void k({message:"Could not find a file-manager for "+b});c&&(b=m.tryAppendExtension(b,h.plugin?".js":".less"));var n=function(a){var b=a.filename,c=a.contents.replace(/^\uFEFF/,"");l.currentDirectory=m.getPath(b),l.relativeUrls&&(l.rootpath=m.join(j.context.rootpath||"",m.pathDiff(l.currentDirectory,l.entryPath)),!m.isPathAbsolute(l.rootpath)&&m.alwaysMakePathsAbsolute()&&(l.rootpath=m.join(l.entryPath,l.rootpath))),l.filename=b;var i=new d.Parse(j.context);i.processImports=!1,j.contents[b]=c,(g.reference||h.reference)&&(l.reference=!0),h.plugin?new f(i,l).eval(c,function(a,c){k(a,c,b)}):h.inline?k(null,c,b):new e(i,j,l).parse(c,function(a,c){k(a,c,b)})},o=m.loadFile(b,g.currentDirectory,this.context,a,function(a,b){a?k(a):n(b)});o&&o.then(n,k)},b}},{"./contexts":11,"./parser/parser":38,"./plugins/function-importer":40}],31:[function(a,b,c){b.exports=function(b,c){var d,e,f,g,h,i={version:[2,7,1],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")};return i}},{"./contexts":11,"./data":13,"./environment/abstract-file-manager":15,"./environment/environment":16,"./functions":23,"./import-manager":30,"./less-error":32,"./logger":33,"./parse":35,"./parse-tree":34,"./parser/parser":38,"./plugin-manager":39,"./render":41,"./source-map-builder":42,"./source-map-output":43,"./transform-tree":44,"./tree":62,"./utils":83,"./visitors":87}],32:[function(a,b,c){var d=a("./utils"),e=b.exports=function(a,b,c){Error.call(this);var e=a.filename||c;if(b&&e){var f=b.contents[e],g=d.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&d.getLocation(a.call,f).line,k=f.split("\n");this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.callLine=j+1,this.callExtract=k[j],this.column=i,this.extract=[k[h-1],k[h],k[h+1]]}this.message=a.message,this.stack=a.stack};if("undefined"==typeof Object.create){var f=function(){};f.prototype=Error.prototype,e.prototype=new f}else e.prototype=Object.create(Error.prototype);e.prototype.constructor=e},{"./utils":83}],33:[function(a,b,c){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;this._listeners.length>b;b++)if(this._listeners[b]===a)return void this._listeners.splice(b,1)},_fireEvent:function(a,b){for(var c=0;this._listeners.length>c;c++){var d=this._listeners[c][a];d&&d(b)}},_listeners:[]}},{}],34:[function(a,b,c){var d=a("./less-error"),e=a("./transform-tree"),f=a("./logger");b.exports=function(a){var b=function(a,b){this.root=a,this.imports=b};return b.prototype.toCSS=function(b){var c,g,h={};try{c=e(this.root,b)}catch(i){throw new d(i,this.imports)}try{var j=Boolean(b.compress);j&&f.warn("The compress option has been deprecated. We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css.");var k={compress:j,dumpLineNumbers:b.dumpLineNumbers,strictUnits:Boolean(b.strictUnits),numPrecision:8};b.sourceMap?(g=new a(b.sourceMap),h.css=g.toCSS(c,k,this.imports)):h.css=c.toCSS(k)}catch(i){throw new d(i,this.imports)}if(b.pluginManager)for(var l=b.pluginManager.getPostProcessors(),m=0;l.length>m;m++)h.css=l[m].process(h.css,{sourceMap:g,options:b,imports:this.imports});b.sourceMap&&(h.map=g.getExternalSourceMap()),h.imports=[];for(var n in this.imports.files)this.imports.files.hasOwnProperty(n)&&n!==this.imports.rootFilename&&h.imports.push(n);return h},b}},{"./less-error":32,"./logger":33,"./transform-tree":44}],35:[function(a,b,c){var d,e=a("./contexts"),f=a("./parser/parser"),g=a("./plugin-manager");b.exports=function(b,c,h){var i=function(b,c,j){if(c=c||{},"function"==typeof c&&(j=c,c={}),!j){d||(d="undefined"==typeof Promise?a("promise"):Promise);var k=this;return new d(function(a,d){i.call(k,b,c,function(b,c){b?d(b):a(c)})})}var l,m,n=new g(this);if(n.addPlugins(c.plugins),c.pluginManager=n,l=new e.Parse(c),c.rootFileInfo)m=c.rootFileInfo;else{var o=c.filename||"input",p=o.replace(/[^\/\\]*$/,"");m={filename:o,relativeUrls:l.relativeUrls,rootpath:l.rootpath||"",currentDirectory:p,entryPath:p,rootFilename:o},m.rootpath&&"/"!==m.rootpath.slice(-1)&&(m.rootpath+="/")}var q=new h(l,m);new f(l,q,m).parse(b,function(a,b){return a?j(a):void j(null,b,q,c)},c)};return i}},{"./contexts":11,"./parser/parser":38,"./plugin-manager":39,promise:void 0}],36:[function(a,b,c){b.exports=function(a,b){function c(b){var c=h-q;512>c&&!b||!c||(p.push(a.slice(q,h+1)),q=h+1)}var d,e,f,g,h,i,j,k,l,m=a.length,n=0,o=0,p=[],q=0;for(h=0;m>h;h++)if(j=a.charCodeAt(h),!(j>=97&&122>=j||34>j))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(m-1>h){h++;continue}return b("unescaped `\\`",h);case 34:case 39:case 96:for(l=0,i=h,h+=1;m>h;h++)if(k=a.charCodeAt(h),!(k>96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;m>h&&(k=a.charCodeAt(h),!(13>=k)||10!=k&&13!=k);h++);else if(42==k){for(f=i=h,h+=2;m-1>h&&(k=a.charCodeAt(h),125==k&&(g=h),42!=k||47!=a.charCodeAt(h+1));h++);if(h==m-1)return b("missing closing `*/`",i);h++}continue;case 42:if(m-1>h&&47==a.charCodeAt(h+1))return b("unmatched `/*`",h);continue}return 0!==n?f>d&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],37:[function(a,b,c){var d=a("./chunker");b.exports=function(){function a(d){for(var e,f,j,p=k.i,q=c,s=k.i-i,t=k.i+h.length-s,u=k.i+=d,v=b;t>k.i;k.i++){if(e=v.charCodeAt(k.i),k.autoCommentAbsorb&&e===r){if(f=v.charAt(k.i+1),"/"===f){j={index:k.i,isLineComment:!0};var w=v.indexOf("\n",k.i+2);0>w&&(w=t),k.i=w,j.text=v.substr(j.index,k.i-j.index),k.commentStore.push(j);continue}if("*"===f){var x=v.indexOf("*/",k.i+2);if(x>=0){j={index:k.i,text:v.substr(k.i,x+2-k.i),isLineComment:!1},k.i+=j.text.length-1,k.commentStore.push(j);continue}}break}if(e!==l&&e!==n&&e!==m&&e!==o)break}if(h=h.slice(d+k.i-u+s),i=k.i,!h.length){if(g.length-1>c)return h=g[++c],a(0),!0;k.finished=!0}return p!==k.i||q!==c}var b,c,e,f,g,h,i,j=[],k={},l=32,m=9,n=10,o=13,p=43,q=44,r=47,s=57;return k.save=function(){i=k.i,j.push({current:h,i:k.i,j:c})},k.restore=function(a){(k.i>e||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,c=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$re=function(b){k.i>i&&(h=h.slice(k.i-i),i=k.i);var c=b.exec(h);return c?(a(c[0].length),"string"==typeof c?c:1===c.length?c[0]:c):null},k.$char=function(c){return b.charAt(k.i)!==c?null:(a(1),c)},k.$str=function(c){for(var d=c.length,e=0;d>e;e++)if(b.charAt(k.i+e)!==c.charAt(e))return null;return a(d),c},k.$quoted=function(){var c=b.charAt(k.i);if("'"===c||'"'===c){for(var d=b.length,e=k.i,f=1;d>f+e;f++){var g=b.charAt(f+e);switch(g){case"\\":f++;continue;case"\r":case"\n":break;case c:var h=b.substr(e,f+1);return a(f+1),h}}return null}},k.autoCommentAbsorb=!0,k.commentStore=[],k.finished=!1,k.peek=function(a){if("string"==typeof a){for(var c=0;a.length>c;c++)if(b.charAt(k.i+c)!==a.charAt(c))return!1;return!0}return a.test(h)},k.peekChar=function(a){return b.charAt(k.i)===a},k.currentChar=function(){return b.charAt(k.i)},k.getInput=function(){return b},k.peekNotNumeric=function(){var a=b.charCodeAt(k.i);return a>s||p>a||a===r||a===q},k.start=function(f,j,l){b=f,k.i=c=i=e=0,g=j?d(f,l):[f],h=g[0],a(0)},k.end=function(){var a,c=k.i>=b.length;return e>k.i&&(a=f,k.i=e),{isFinished:c,furthest:k.i,furthestPossibleErrorMessage:a,furthestReachedEnd:k.i>=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":36}],38:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=function j(a,b,c){function i(a,e){throw new d({index:o.i,filename:c.filename,type:e||"Syntax",message:a},b)}function k(a,b,c){var d=a instanceof Function?a.call(n):o.$re(a);return d?d:void i(b||("string"==typeof a?"expected '"+a+"' got '"+o.currentChar()+"'":"unexpected token"))}function l(a,b){return o.$char(a)?a:void i(b||"expected '"+a+"' got '"+o.currentChar()+"'")}function m(a){var b=c.filename;return{lineNumber:h.getLocation(a,o.getInput()).line+1,fileName:b}}var n,o=g();return{parse:function(g,h,i){var k,l,m,n,p=null,q="";if(l=i&&i.globalVars?j.serializeVars(i.globalVars)+"\n":"",m=i&&i.modifyVars?"\n"+j.serializeVars(i.modifyVars):"",a.pluginManager)for(var r=a.pluginManager.getPreProcessors(),s=0;r.length>s;s++)g=r[s].process(g,{context:a,imports:b,fileInfo:c});(l||i&&i.banner)&&(q=(i&&i.banner?i.banner:"")+l,n=b.contentsIgnoredChars,n[c.filename]=n[c.filename]||0,n[c.filename]+=q.length),g=g.replace(/\r\n?/g,"\n"),g=q+g.replace(/^\uFEFF/,"")+m,b.contents[c.filename]=g;try{o.start(g,a.chunkInput,function(a,e){throw new d({index:e,type:"Parse",message:a,filename:c.filename},b)}),k=new e.Ruleset(null,this.parsers.primary()),k.root=!0,k.firstRoot=!0}catch(t){return h(new d(t,b,c.filename))}var u=o.end();if(!u.isFinished){var v=u.furthestPossibleErrorMessage;v||(v="Unrecognised input","}"===u.furthestChar?v+=". Possibly missing opening '{'":")"===u.furthestChar?v+=". Possibly missing opening '('":u.furthestReachedEnd&&(v+=". Possibly missing something")),p=new d({type:"Parse",message:v,index:u.furthest,filename:c.filename},b)}var w=function(a){return a=p||a||b.error,a?(a instanceof d||(a=new d(a,b,c.filename)),h(a)):h(null,k)};return a.processImports===!1?w():void new f.ImportVisitor(b,w).run(k)},parsers:n={primary:function(){for(var a,b=this.mixin,c=[];;){for(;;){if(a=this.comment(),!a)break;c.push(a)}if(o.finished)break;if(o.peek("}"))break;if(a=this.extendRule())c=c.concat(a);else if(a=b.definition()||this.rule()||this.ruleset()||b.call()||this.rulesetCall()||this.entities.call()||this.directive())c.push(a);else{for(var d=!1;o.$char(";");)d=!0;if(!d)break}}return c},comment:function(){if(o.commentStore.length){var a=o.commentStore.shift();return new e.Comment(a.text,a.isLineComment,a.index,c)}},entities:{quoted:function(){var a,b=o.i,d=!1;return o.save(),o.$char("~")&&(d=!0),(a=o.$quoted())?(o.forget(),new e.Quoted(a.charAt(0),a.substr(1,a.length-2),d,b,c)):void o.restore()},keyword:function(){var a=o.$char("%")||o.$re(/^[_A-Za-z-][_A-Za-z0-9-]*/);return a?e.Color.fromKeyword(a)||new e.Keyword(a):void 0},call:function(){var a,b,d,f,g=o.i;if(!o.peek(/^url\(/i))return o.save(),(a=o.$re(/^([\w-]+|%|progid:[\w\.]+)\(/))?(a=a[1],b=a.toLowerCase(),"alpha"===b&&(f=n.alpha())?(o.forget(),f):(d=this.arguments(),o.$char(")")?(o.forget(),new e.Call(a,d,g,c)):void o.restore("Could not parse call arguments or missing ')'"))):void o.forget()},arguments:function(){var a,b,c,d=[],f=[],g=[];for(o.save();;){if(c=n.detachedRuleset()||this.assignment()||n.expression(),!c)break;b=c,c.value&&1==c.value.length&&(b=c.value[0]),b&&g.push(b),f.push(b),o.$char(",")||(o.$char(";")||a)&&(a=!0,g.length>1&&(b=new e.Value(g)),d.push(b),g=[])}return o.forget(),a?d:f},literal:function(){return this.dimension()||this.color()||this.quoted()||this.unicodeDescriptor()},assignment:function(){var a,b;return o.save(),(a=o.$re(/^\w+(?=\s?=)/i))&&o.$char("=")&&(b=n.entity())?(o.forget(),new e.Assignment(a,b)):void o.restore()},url:function(){var a,b=o.i;return o.autoCommentAbsorb=!1,o.$str("url(")?(a=this.quoted()||this.variable()||o.$re(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",o.autoCommentAbsorb=!0,l(")"),new e.URL(null!=a.value||a instanceof e.Variable?a:new e.Anonymous(a),b,c)):void(o.autoCommentAbsorb=!0)},variable:function(){var a,b=o.i;return"@"===o.currentChar()&&(a=o.$re(/^@@?[\w-]+/))?new e.Variable(a,b,c):void 0},variableCurly:function(){var a,b=o.i;return"@"===o.currentChar()&&(a=o.$re(/^@\{([\w-]+)\}/))?new e.Variable("@"+a[1],b,c):void 0},color:function(){var a;if("#"===o.currentChar()&&(a=o.$re(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))){var b=a.input.match(/^#([\w]+).*/);return b=b[1],b.match(/^[A-Fa-f0-9]+$/)||i("Invalid HEX color code"),new e.Color(a[1],void 0,"#"+b)}},colorKeyword:function(){o.save();var a=o.autoCommentAbsorb;o.autoCommentAbsorb=!1;var b=o.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/);if(o.autoCommentAbsorb=a,!b)return void o.forget();o.restore();var c=e.Color.fromKeyword(b);return c?(o.$str(b),c):void 0},dimension:function(){if(!o.peekNotNumeric()){var a=o.$re(/^([+-]?\d*\.?\d+)(%|[a-z_]+)?/i);return a?new e.Dimension(a[1],a[2]):void 0}},unicodeDescriptor:function(){var a;return a=o.$re(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/),a?new e.UnicodeDescriptor(a[0]):void 0},javascript:function(){var a,b=o.i;o.save();var d=o.$char("~"),f=o.$char("`");return f?(a=o.$re(/^[^`]*`/))?(o.forget(),new e.JavaScript(a.substr(0,a.length-1),Boolean(d),b,c)):void o.restore("invalid javascript definition"):void o.restore()}},variable:function(){var a;return"@"===o.currentChar()&&(a=o.$re(/^(@[\w-]+)\s*:/))?a[1]:void 0},rulesetCall:function(){var a;return"@"===o.currentChar()&&(a=o.$re(/^(@[\w-]+)\(\s*\)\s*;/))?new e.RulesetCall(a[1]):void 0},extend:function(a){var b,d,f,g,h,j=o.i;if(o.$str(a?"&:extend(":":extend(")){do{for(f=null,b=null;!(f=o.$re(/^(all)(?=\s*(\)|,))/))&&(d=this.element());)b?b.push(d):b=[d];f=f&&f[1],b||i("Missing target selector for :extend()."),h=new e.Extend(new e.Selector(b),f,j,c),g?g.push(h):g=[h]}while(o.$char(","));return k(/^\)/),a&&k(/^;/),g}},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var a,b,d,f,g,h,i=o.currentChar(),j=!1,k=o.i;if("."===i||"#"===i){for(o.save();;){if(a=o.i,f=o.$re(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/),!f)break;d=new e.Element(g,f,a,c),b?b.push(d):b=[d],g=o.$char(">")}return b&&(o.$char("(")&&(h=this.args(!0).args,l(")")),n.important()&&(j=!0),n.end())?(o.forget(),new e.mixin.Call(b,h,k,c,j)):void o.restore()}},args:function(a){var b,c,d,f,g,h,j,k=n.entities,l={args:null,variadic:!1},m=[],p=[],q=[];for(o.save();;){if(a)h=n.detachedRuleset()||n.expression();else{if(o.commentStore.length=0,o.$str("...")){l.variadic=!0,o.$char(";")&&!b&&(b=!0),(b?p:q).push({variadic:!0});break}h=k.variable()||k.literal()||k.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var r=null;if(a?h.value&&1==h.value.length&&(r=h.value[0]):r=h,r&&r instanceof e.Variable)if(o.$char(":")){if(m.length>0&&(b&&i("Cannot mix ; and , as delimiter types"),c=!0),g=n.detachedRuleset()||n.expression(),!g){if(!a)return o.restore(),l.args=[],l;i("could not understand value for named argument")}f=d=r.name}else if(o.$str("...")){if(!a){l.variadic=!0,o.$char(";")&&!b&&(b=!0),(b?p:q).push({name:h.name,variadic:!0});break}j=!0}else a||(d=f=r.name,g=null);g&&m.push(g),q.push({name:f,value:g,expand:j}),o.$char(",")||(o.$char(";")||b)&&(c&&i("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),p.push({name:d,value:g,expand:j}),d=null,m=[],c=!1)}return o.forget(),l.args=b?p:q,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==o.currentChar()&&"#"!==o.currentChar()||o.peek(/^[^{]*\}/)))if(o.save(),b=o.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!o.$char(")"))return void o.restore("Missing closing ')'");if(o.commentStore.length=0,o.$str("when")&&(d=k(n.conditions,"expected condition")),c=n.block())return o.forget(),new e.mixin.Definition(a,f,c,d,g);o.restore()}else o.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.call()||a.keyword()||a.javascript()},end:function(){return o.$char(";")||o.peek("}")},alpha:function(){var a;if(o.$re(/^opacity=/i))return a=o.$re(/^\d+/),a||(a=k(this.entities.variable,"Could not parse alpha")),l(")"),new e.Alpha(a)},element:function(){var a,b,d,f=o.i;return b=this.combinator(),a=o.$re(/^(?:\d+\.\d+|\d+)%/)||o.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||o.$char("*")||o.$char("&")||this.attribute()||o.$re(/^\([^&()@]+\)/)||o.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(o.save(),o.$char("(")?(d=this.selector())&&o.$char(")")?(a=new e.Paren(d),o.forget()):o.restore("Missing closing ')'"):o.forget()),a?new e.Element(b,a,f,c):void 0},combinator:function(){var a=o.currentChar();if("/"===a){o.save();var b=o.$re(/^\/[a-z]+\//i);if(b)return o.forget(),new e.Combinator(b);o.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(o.i++,"^"===a&&"^"===o.currentChar()&&(a="^^",o.i++);o.isWhitespace();)o.i++;return new e.Combinator(a)}return new e.Combinator(o.isWhitespace(-1)?" ":null)},lessSelector:function(){return this.selector(!0)},selector:function(a){for(var b,d,f,g,h,j,l,m=o.i;(a&&(d=this.extend())||a&&(j=o.$str("when"))||(g=this.element()))&&(j?l=k(this.conditions,"expected condition"):l?i("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&i("Extend can only be used at the end of selector"),f=o.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,l,m,c):void(h&&i("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(o.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=k(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=o.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||o.$re(/^[0-9]+%/)||o.$re(/^[\w-]+/)||d.variableCurly()),l("]"),new e.Attribute(a,c,b)}},block:function(){var a;return o.$char("{")&&(a=this.primary())&&o.$char("}")?a:void 0},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();return a?new e.DetachedRuleset(a):void 0},ruleset:function(){var b,c,d,f;for(o.save(),a.dumpLineNumbers&&(f=m(o.i));;){if(c=this.lessSelector(),!c)break;if(b?b.push(c):b=[c],o.commentStore.length=0,c.condition&&b.length>1&&i("Guards are only currently allowed on a single selector."),!o.$char(","))break;c.condition&&i("Guards are only currently allowed on a single selector."),o.commentStore.length=0}if(b&&(d=this.block())){o.forget();var g=new e.Ruleset(b,d,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}o.restore()},rule:function(b){var d,f,g,h,i,j=o.i,k=o.currentChar();if("."!==k&&"#"!==k&&"&"!==k&&":"!==k)if(o.save(),d=this.variable()||this.ruleProperty()){if(i="string"==typeof d,i&&(f=this.detachedRuleset()),o.commentStore.length=0,!f){h=!i&&d.length>1&&d.pop().value;var l=!b&&(a.compress||i);if(l&&(f=this.value()),!f&&(f=this.anonymousValue()))return o.forget(),new e.Rule(d,f,!1,h,j,c);l||f||(f=this.value()),g=this.important()}if(f&&this.end())return o.forget(),new e.Rule(d,f,g,h,j,c);if(o.restore(),f&&!b)return this.rule(!0)}else o.forget()},anonymousValue:function(){var a=o.$re(/^([^@+\/'"*`(;{}-]*);/);return a?new e.Anonymous(a[1]):void 0},"import":function(){var a,b,d=o.i,f=o.$re(/^@import?\s+/);if(f){var g=(f?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),o.$char(";")||(o.i=d,i("missing semi-colon or unrecognised media features on import")),b=b&&new e.Value(b),new e.Import(a,b,g,d,c);o.i=d,i("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!o.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!o.$char(","))break}while(a);return l(")"),d},importOption:function(){var a=o.$re(/^(less|css|multiple|once|inline|reference|optional)/);return a?a[1]:void 0},mediaFeature:function(){var a,b,d=this.entities,f=[];o.save();do a=d.keyword()||d.variable(),a?f.push(a):o.$char("(")&&(b=this.property(),a=this.value(),o.$char(")")?b&&a?f.push(new e.Paren(new e.Rule(b,a,null,null,o.i,c,!0))):a?f.push(new e.Paren(a)):i("badly formed media feature definition"):i("Missing closing ')'","Parse"));while(a);return o.forget(),f.length>0?new e.Expression(f):void 0},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!o.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!o.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=o.i;return a.dumpLineNumbers&&(g=m(h)),o.save(),o.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||i("media definitions require block statements after any features"),o.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void o.restore()},plugin:function(){var a,b=o.i,d=o.$re(/^@plugin?\s+/);if(d){var f={plugin:!0};if(a=this.entities.quoted()||this.entities.url())return o.$char(";")||(o.i=b,i("missing semi-colon on plugin")),new e.Import(a,null,f,b,c);o.i=b,i("malformed plugin statement")}},directive:function(){var b,d,f,g,h,j,k,l=o.i,n=!0,p=!0;if("@"===o.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(o.save(),b=o.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,n=!1;break;case"@namespace":j=!0,n=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,p=!1;break;default:k=!0}return o.commentStore.length=0,h?(d=this.entity(),d||i("expected "+b+" identifier")):j?(d=this.expression(),d||i("expected "+b+" expression")):k&&(d=(o.$re(/^[^{;]+/)||"").trim(),n="{"==o.currentChar(),d&&(d=new e.Anonymous(d))),n&&(f=this.blockRuleset()),f||!n&&d&&o.$char(";")?(o.forget(),new e.Directive(b,d,f,l,c,a.dumpLineNumbers?m(l):null,p)):void o.restore("directive options not recognised")}}},value:function(){var a,b=[];do if(a=this.expression(),a&&(b.push(a),!o.$char(",")))break;while(a);return b.length>0?new e.Value(b):void 0},important:function(){return"!"===o.currentChar()?o.$re(/^! *important/):void 0},sub:function(){var a,b;return o.save(),o.$char("(")?(a=this.addition(),a&&o.$char(")")?(o.forget(),b=new e.Expression([a]),b.parens=!0,b):void o.restore("Expected ')'")):void o.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=o.isWhitespace(-1);;){if(o.peek(/^\/[*\/]/))break;if(o.save(),c=o.$char("/")||o.$char("*"),!c){o.forget();break}if(b=this.operand(),!b){o.restore();break}o.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=o.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=o.isWhitespace(-1);;){if(c=o.$re(/^[-+]\s+/)||!f&&(o.$char("+")||o.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=o.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=o.i;if(a=this.condition()){for(;;){if(!o.peek(/^,\s*(not\s*)?\(/)||!o.$char(","))break;if(b=this.condition(),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(){function a(){return o.$str("or")}var b,c,d;if(b=this.conditionAnd(this)){if(c=a()){if(d=this.condition(),!d)return;b=new e.Condition(c,b,d)}return b}},conditionAnd:function(){function a(a){return a.negatedCondition()||a.parenthesisCondition()}function b(){return o.$str("and")}var c,d,f;if(c=a(this)){if(d=b()){if(f=this.conditionAnd(),!f)return;c=new e.Condition(d,c,f)}return c}},negatedCondition:function(){if(o.$str("not")){var a=this.parenthesisCondition();return a&&(a.negate=!a.negate),a}},parenthesisCondition:function(){function a(a){var b;return o.save(),(b=a.condition())&&o.$char(")")?(o.forget(),b):void o.restore()}var b;return o.save(),o.$str("(")?(b=a(this))?(o.forget(),b):(b=this.atomicCondition())?o.$char(")")?(o.forget(),b):void o.restore("expected ')' got '"+o.currentChar()+"'"):void o.restore():void o.restore()},atomicCondition:function(){var a,b,c,d,f=this.entities,g=o.i;return a=this.addition()||f.keyword()||f.quoted(),a?(o.$char(">")?d=o.$char("=")?">=":">":o.$char("<")?d=o.$char("=")?"<=":"<":o.$char("=")&&(d=o.$char(">")?"=>":o.$char("<")?"=<":"="),d?(b=this.addition()||f.keyword()||f.quoted(),b?c=new e.Condition(d,a,b,g,!1):i("expected expression")):c=new e.Condition("=",a,new e.Keyword("true"),g,!1),c):void 0},operand:function(){var a,b=this.entities;o.peek(/^-[@\(]/)&&(a=o.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.call()||b.colorKeyword();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[];do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),o.peek(/^\/[\/*]/)||(b=o.$char("/"),b&&c.push(new e.Anonymous(b)))));while(a);return c.length>0?new e.Expression(c):void 0},property:function(){var a=o.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);return a?a[1]:void 0},ruleProperty:function(){function a(a){var b=o.i,c=o.$re(a);return c?(g.push(b),f.push(c[1])):void 0}var b,d,f=[],g=[];o.save();var h=o.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],o.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:@\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(o.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;f.length>d;d++)b=f[d],f[d]="@"!==b.charAt(0)?new e.Keyword(b):new e.Variable("@"+b.slice(2,-1),g[d],c);return f}o.restore()}}}};i.serializeVars=function(a){var b="";for(var c in a)if(Object.hasOwnProperty.call(a,c)){var d=a[c];b+=("@"===c[0]?"":"@")+c+": "+d+(";"===String(d).slice(-1)?"":";")}return b},b.exports=i},{"../less-error":32,"../tree":62,"../utils":83,"../visitors":87,"./parser-input":37}],39:[function(a,b,c){var d=function(a){this.less=a,this.visitors=[],this.preProcessors=[],this.postProcessors=[],this.installedPlugins=[],this.fileManagers=[]};d.prototype.addPlugins=function(a){if(a)for(var b=0;a.length>b;b++)this.addPlugin(a[b])},d.prototype.addPlugin=function(a){this.installedPlugins.push(a),a.install(this.less,this)},d.prototype.addVisitor=function(a){this.visitors.push(a)},d.prototype.addPreProcessor=function(a,b){var c;for(c=0;this.preProcessors.length>c&&!(this.preProcessors[c].priority>=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},d.prototype.addPostProcessor=function(a,b){var c;for(c=0;this.postProcessors.length>c&&!(this.postProcessors[c].priority>=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},d.prototype.addFileManager=function(a){this.fileManagers.push(a)},d.prototype.getPreProcessors=function(){for(var a=[],b=0;this.preProcessors.length>b;b++)a.push(this.preProcessors[b].preProcessor);return a},d.prototype.getPostProcessors=function(){for(var a=[],b=0;this.postProcessors.length>b;b++)a.push(this.postProcessors[b].postProcessor);return a},d.prototype.getVisitors=function(){return this.visitors},d.prototype.getFileManagers=function(){return this.fileManagers},b.exports=d},{}],40:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=b.exports=function(a,b){this.fileInfo=b};f.prototype.eval=function(a,b){var c,f,g={}; -f={add:function(a,b){g[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){g[b]=a[b]})}};try{c=new Function("functions","tree","fileInfo",a),c(f,e,this.fileInfo)}catch(h){b(new d({message:"Plugin evaluation error: '"+h.name+": "+h.message.replace(/["]/g,"'")+"'",filename:this.fileInfo.filename}),null)}b(null,{functions:g})}},{"../less-error":32,"../tree":62}],41:[function(a,b,c){var d;b.exports=function(b,c,e){var f=function(b,e,g){if("function"==typeof e&&(g=e,e={}),!g){d||(d="undefined"==typeof Promise?a("promise"):Promise);var h=this;return new d(function(a,c){f.call(h,b,e,function(b,d){b?c(b):a(d)})})}this.parse(b,e,function(a,b,d,e){if(a)return g(a);var f;try{var h=new c(b,d);f=h.toCSS(e)}catch(a){return g(a)}g(null,f)})};return f}},{promise:void 0}],42:[function(a,b,c){b.exports=function(a,b){var c=function(a){this.options=a};return c.prototype.toCSS=function(b,c,d){var e=new a({contentsIgnoredCharsMap:d.contentsIgnoredChars,rootNode:b,contentsMap:d.contents,sourceMapFilename:this.options.sourceMapFilename,sourceMapURL:this.options.sourceMapURL,outputFilename:this.options.sourceMapOutputFilename,sourceMapBasepath:this.options.sourceMapBasepath,sourceMapRootpath:this.options.sourceMapRootpath,outputSourceFiles:this.options.outputSourceFiles,sourceMapGenerator:this.options.sourceMapGenerator,sourceMapFileInline:this.options.sourceMapFileInline}),f=e.toCSS(c);return this.sourceMap=e.sourceMap,this.sourceMapURL=e.sourceMapURL,this.options.sourceMapInputFilename&&(this.sourceMapInputFilename=e.normalizeFilename(this.options.sourceMapInputFilename)),f+this.getCSSAppendage()},c.prototype.getCSSAppendage=function(){var a=this.sourceMapURL;if(this.options.sourceMapFileInline){if(void 0===this.sourceMap)return"";a="data:application/json;base64,"+b.encodeBase64(this.sourceMap)}return a?"/*# sourceMappingURL="+a+" */":""},c.prototype.getExternalSourceMap=function(){return this.sourceMap},c.prototype.setExternalSourceMap=function(a){this.sourceMap=a},c.prototype.isInline=function(){return this.options.sourceMapFileInline},c.prototype.getSourceMapURL=function(){return this.sourceMapURL},c.prototype.getOutputFilename=function(){return this.options.sourceMapOutputFilename},c.prototype.getInputFilename=function(){return this.sourceMapInputFilename},c}},{}],43:[function(a,b,c){b.exports=function(a){var b=function(b){this._css=[],this._rootNode=b.rootNode,this._contentsMap=b.contentsMap,this._contentsIgnoredCharsMap=b.contentsIgnoredCharsMap,b.sourceMapFilename&&(this._sourceMapFilename=b.sourceMapFilename.replace(/\\/g,"/")),this._outputFilename=b.outputFilename,this.sourceMapURL=b.sourceMapURL,b.sourceMapBasepath&&(this._sourceMapBasepath=b.sourceMapBasepath.replace(/\\/g,"/")),b.sourceMapRootpath?(this._sourceMapRootpath=b.sourceMapRootpath.replace(/\\/g,"/"),"/"!==this._sourceMapRootpath.charAt(this._sourceMapRootpath.length-1)&&(this._sourceMapRootpath+="/")):this._sourceMapRootpath="",this._outputSourceFiles=b.outputSourceFiles,this._sourceMapGeneratorConstructor=a.getSourceMapGenerator(),this._lineNumber=0,this._column=0};return b.prototype.normalizeFilename=function(a){return a=a.replace(/\\/g,"/"),this._sourceMapBasepath&&0===a.indexOf(this._sourceMapBasepath)&&(a=a.substring(this._sourceMapBasepath.length),"\\"!==a.charAt(0)&&"/"!==a.charAt(0)||(a=a.substring(1))),(this._sourceMapRootpath||"")+a},b.prototype.add=function(a,b,c,d){if(a){var e,f,g,h,i;if(b){var j=this._contentsMap[b.filename];this._contentsIgnoredCharsMap[b.filename]&&(c-=this._contentsIgnoredCharsMap[b.filename],0>c&&(c=0),j=j.slice(this._contentsIgnoredCharsMap[b.filename])),j=j.substring(0,c),f=j.split("\n"),h=f[f.length-1]}if(e=a.split("\n"),g=e[e.length-1],b)if(d)for(i=0;e.length>i;i++)this._sourceMapGenerator.addMapping({generated:{line:this._lineNumber+i+1,column:0===i?this._column:0},original:{line:f.length+i,column:0===i?h.length:0},source:this.normalizeFilename(b.filename)});else this._sourceMapGenerator.addMapping({generated:{line:this._lineNumber+1,column:this._column},original:{line:f.length,column:h.length},source:this.normalizeFilename(b.filename)});1===e.length?this._column+=g.length:(this._lineNumber+=e.length-1,this._column=g.length),this._css.push(a)}},b.prototype.isEmpty=function(){return 0===this._css.length},b.prototype.toCSS=function(a){if(this._sourceMapGenerator=new this._sourceMapGeneratorConstructor({file:this._outputFilename,sourceRoot:null}),this._outputSourceFiles)for(var b in this._contentsMap)if(this._contentsMap.hasOwnProperty(b)){var c=this._contentsMap[b];this._contentsIgnoredCharsMap[b]&&(c=c.slice(this._contentsIgnoredCharsMap[b])),this._sourceMapGenerator.setSourceContent(this.normalizeFilename(b),c)}if(this._rootNode.genCSS(a,this),this._css.length>0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],44:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Rule("@"+a,b,!1,null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j=[],k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor(!0),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager){var l=b.pluginManager.getVisitors();for(i=0;l.length>i;i++){var m=l[i];m.isPreEvalVisitor?j.push(m):m.isPreVisitor?k.splice(0,0,m):k.push(m)}}for(i=0;j.length>i;i++)j[i].run(a);for(c=a.eval(h),i=0;k.length>i;i++)k[i].run(c);return c}},{"./contexts":11,"./tree":62,"./visitors":87}],45:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Alpha",e.prototype.accept=function(a){this.value=a.visit(this.value)},e.prototype.eval=function(a){return this.value.eval?new e(this.value.eval(a)):this},e.prototype.genCSS=function(a,b){b.add("alpha(opacity="),this.value.genCSS?this.value.genCSS(a,b):b.add(this.value),b.add(")")},b.exports=e},{"./node":70}],46:[function(a,b,c){var d=a("./node"),e=function(a,b,c,d,e,f){this.value=a,this.index=b,this.mapLines=d,this.currentFileInfo=c,this.rulesetLike="undefined"==typeof e?!1:e,this.allowRoot=!0,this.copyVisibilityInfo(f)};e.prototype=new d,e.prototype.type="Anonymous",e.prototype.eval=function(){return new e(this.value,this.index,this.currentFileInfo,this.mapLines,this.rulesetLike,this.visibilityInfo())},e.prototype.compare=function(a){return a.toCSS&&this.toCSS()===a.toCSS()?0:void 0},e.prototype.isRulesetLike=function(){return this.rulesetLike},e.prototype.genCSS=function(a,b){b.add(this.value,this.currentFileInfo,this.index,this.mapLines)},b.exports=e},{"./node":70}],47:[function(a,b,c){var d=a("./node"),e=function(a,b){this.key=a,this.value=b};e.prototype=new d,e.prototype.type="Assignment",e.prototype.accept=function(a){this.value=a.visit(this.value)},e.prototype.eval=function(a){return this.value.eval?new e(this.key,this.value.eval(a)):this},e.prototype.genCSS=function(a,b){b.add(this.key+"="),this.value.genCSS?this.value.genCSS(a,b):b.add(this.value)},b.exports=e},{"./node":70}],48:[function(a,b,c){var d=a("./node"),e=function(a,b,c){this.key=a,this.op=b,this.value=c};e.prototype=new d,e.prototype.type="Attribute",e.prototype.eval=function(a){return new e(this.key.eval?this.key.eval(a):this.key,this.op,this.value&&this.value.eval?this.value.eval(a):this.value)},e.prototype.genCSS=function(a,b){b.add(this.toCSS(a))},e.prototype.toCSS=function(a){var b=this.key.toCSS?this.key.toCSS(a):this.key;return this.op&&(b+=this.op,b+=this.value.toCSS?this.value.toCSS(a):this.value),"["+b+"]"},b.exports=e},{"./node":70}],49:[function(a,b,c){var d=a("./node"),e=a("../functions/function-caller"),f=function(a,b,c,d){this.name=a,this.args=b,this.index=c,this.currentFileInfo=d};f.prototype=new d,f.prototype.type="Call",f.prototype.accept=function(a){this.args&&(this.args=a.visitArray(this.args))},f.prototype.eval=function(a){var b,c=this.args.map(function(b){return b.eval(a)}),d=new e(this.name,a,this.index,this.currentFileInfo);if(d.isValid()){try{b=d.call(c)}catch(g){throw{type:g.type||"Runtime",message:"error evaluating function `"+this.name+"`"+(g.message?": "+g.message:""),index:this.index,filename:this.currentFileInfo.filename}}if(null!=b)return b.index=this.index,b.currentFileInfo=this.currentFileInfo,b}return new f(this.name,c,this.index,this.currentFileInfo)},f.prototype.genCSS=function(a,b){b.add(this.name+"(",this.currentFileInfo,this.index);for(var c=0;this.args.length>c;c++)this.args[c].genCSS(a,b),this.args.length>c+1&&b.add(", ");b.add(")")},b.exports=f},{"../functions/function-caller":21,"./node":70}],50:[function(a,b,c){function d(a,b){return Math.min(Math.max(a,0),b)}function e(a){return"#"+a.map(function(a){return a=d(Math.round(a),255),(16>a?"0":"")+a.toString(16)}).join("")}var f=a("./node"),g=a("../data/colors"),h=function(a,b,c){this.rgb=Array.isArray(a)?a:6==a.length?a.match(/.{2}/g).map(function(a){return parseInt(a,16)}):a.split("").map(function(a){return parseInt(a+a,16)}),this.alpha="number"==typeof b?b:1,"undefined"!=typeof c&&(this.value=c)};h.prototype=new f,h.prototype.type="Color",h.prototype.luma=function(){var a=this.rgb[0]/255,b=this.rgb[1]/255,c=this.rgb[2]/255;return a=.03928>=a?a/12.92:Math.pow((a+.055)/1.055,2.4),b=.03928>=b?b/12.92:Math.pow((b+.055)/1.055,2.4),c=.03928>=c?c/12.92:Math.pow((c+.055)/1.055,2.4),.2126*a+.7152*b+.0722*c},h.prototype.genCSS=function(a,b){b.add(this.toCSS(a))},h.prototype.toCSS=function(a,b){var c,e,f=a&&a.compress&&!b;if(this.value)return this.value;if(e=this.fround(a,this.alpha),1>e)return"rgba("+this.rgb.map(function(a){return d(Math.round(a),255)}).concat(d(e,1)).join(","+(f?"":" "))+")";if(c=this.toRGB(),f){var g=c.split("");g[1]===g[2]&&g[3]===g[4]&&g[5]===g[6]&&(c="#"+g[1]+g[3]+g[5])}return c},h.prototype.operate=function(a,b,c){for(var d=[],e=this.alpha*(1-c.alpha)+c.alpha,f=0;3>f;f++)d[f]=this._operate(a,b,this.rgb[f],c.rgb[f]);return new h(d,e)},h.prototype.toRGB=function(){return e(this.rgb)},h.prototype.toHSL=function(){var a,b,c=this.rgb[0]/255,d=this.rgb[1]/255,e=this.rgb[2]/255,f=this.alpha,g=Math.max(c,d,e),h=Math.min(c,d,e),i=(g+h)/2,j=g-h;if(g===h)a=b=0;else{switch(b=i>.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(e>d?6:0);break;case d:a=(e-c)/j+2;break;case e:a=(c-d)/j+4}a/=6}return{h:360*a,s:b,l:i,a:f}},h.prototype.toHSV=function(){var a,b,c=this.rgb[0]/255,d=this.rgb[1]/255,e=this.rgb[2]/255,f=this.alpha,g=Math.max(c,d,e),h=Math.min(c,d,e),i=g,j=g-h;if(b=0===g?0:j/g,g===h)a=0;else{switch(g){case c:a=(d-e)/j+(e>d?6:0);break;case d:a=(e-c)/j+2;break;case e:a=(c-d)/j+4}a/=6}return{h:360*a,s:b,v:i,a:f}},h.prototype.toARGB=function(){return e([255*this.alpha].concat(this.rgb))},h.prototype.compare=function(a){return a.rgb&&a.rgb[0]===this.rgb[0]&&a.rgb[1]===this.rgb[1]&&a.rgb[2]===this.rgb[2]&&a.alpha===this.alpha?0:void 0},h.fromKeyword=function(a){var b,c=a.toLowerCase();return g.hasOwnProperty(c)?b=new h(g[c].slice(1)):"transparent"===c&&(b=new h([0,0,0],0)),b?(b.value=a,b):void 0},b.exports=h},{"../data/colors":12,"./node":70}],51:[function(a,b,c){var d=a("./node"),e=function(a){" "===a?(this.value=" ",this.emptyOrWhitespace=!0):(this.value=a?a.trim():"",this.emptyOrWhitespace=""===this.value)};e.prototype=new d,e.prototype.type="Combinator";var f={"":!0," ":!0,"|":!0};e.prototype.genCSS=function(a,b){var c=a.compress||f[this.value]?"":" ";b.add(c+this.value+c)},b.exports=e},{"./node":70}],52:[function(a,b,c){var d=a("./node"),e=a("./debug-info"),f=function(a,b,c,d){this.value=a,this.isLineComment=b,this.currentFileInfo=d,this.allowRoot=!0};f.prototype=new d,f.prototype.type="Comment",f.prototype.genCSS=function(a,b){this.debugInfo&&b.add(e(a,this),this.currentFileInfo,this.index),b.add(this.value)},f.prototype.isSilent=function(a){var b=a.compress&&"!"!==this.value[2];return this.isLineComment||b},b.exports=f},{"./debug-info":54,"./node":70}],53:[function(a,b,c){var d=a("./node"),e=function(a,b,c,d,e){this.op=a.trim(),this.lvalue=b,this.rvalue=c,this.index=d,this.negate=e};e.prototype=new d,e.prototype.type="Condition",e.prototype.accept=function(a){this.lvalue=a.visit(this.lvalue),this.rvalue=a.visit(this.rvalue)},e.prototype.eval=function(a){var b=function(a,b,c){switch(a){case"and":return b&&c;case"or":return b||c;default:switch(d.compare(b,c)){case-1:return"<"===a||"=<"===a||"<="===a;case 0:return"="===a||">="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":70}],54:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],55:[function(a,b,c){var d=a("./node"),e=a("../contexts"),f=function(a,b){this.ruleset=a,this.frames=b};f.prototype=new d,f.prototype.type="DetachedRuleset",f.prototype.evalFirst=!0,f.prototype.accept=function(a){this.ruleset=a.visit(this.ruleset)},f.prototype.eval=function(a){var b=this.frames||a.frames.slice(0);return new f(this.ruleset,b)},f.prototype.callEval=function(a){return this.ruleset.eval(this.frames?new e.Eval(a,this.frames.concat(a.frames)):a)},b.exports=f},{"../contexts":11,"./node":70}],56:[function(a,b,c){var d=a("./node"),e=a("../data/unit-conversions"),f=a("./unit"),g=a("./color"),h=function(a,b){this.value=parseFloat(a),this.unit=b&&b instanceof f?b:new f(b?[b]:void 0)};h.prototype=new d,h.prototype.type="Dimension",h.prototype.accept=function(a){this.unit=a.visit(this.unit)},h.prototype.eval=function(a){return this},h.prototype.toColor=function(){return new g([this.value,this.value,this.value])},h.prototype.genCSS=function(a,b){if(a&&a.strictUnits&&!this.unit.isSingular())throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: "+this.unit.toString());var c=this.fround(a,this.value),d=String(c);if(0!==c&&1e-6>c&&c>-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&1>c&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":14,"./color":50,"./node":70,"./unit":79}],57:[function(a,b,c){var d=a("./node"),e=a("./selector"),f=a("./ruleset"),g=function(a,b,c,d,f,g,h,i){var j;if(this.name=a,this.value=b,c)for(Array.isArray(c)?this.rules=c:(this.rules=[c],this.rules[0].selectors=new e([],null,null,this.index,f).createEmptySelectors()),j=0;this.rules.length>j;j++)this.rules[j].allowImports=!0;this.index=d,this.currentFileInfo=f,this.debugInfo=g,this.isRooted=h||!1,this.copyVisibilityInfo(i),this.allowRoot=!0};g.prototype=new d,g.prototype.type="Directive",g.prototype.accept=function(a){var b=this.value,c=this.rules;c&&(this.rules=a.visitArray(c)),b&&(this.value=a.visit(b))},g.prototype.isRulesetLike=function(){return this.rules||!this.isCharset()},g.prototype.isCharset=function(){return"@charset"===this.name},g.prototype.genCSS=function(a,b){var c=this.value,d=this.rules;b.add(this.name,this.currentFileInfo,this.index),c&&(b.add(" "),c.genCSS(a,b)),d?this.outputRuleset(a,b,d):b.add(";")},g.prototype.eval=function(a){var b,c,d=this.value,e=this.rules;return b=a.mediaPath,c=a.mediaBlocks,a.mediaPath=[],a.mediaBlocks=[],d&&(d=d.eval(a)),e&&(e=[e[0].eval(a)],e[0].root=!0),a.mediaPath=b,a.mediaBlocks=c,new g(this.name,d,e,this.index,this.currentFileInfo,this.debugInfo,this.isRooted,this.visibilityInfo())},g.prototype.variable=function(a){return this.rules?f.prototype.variable.call(this.rules[0],a):void 0},g.prototype.find=function(){return this.rules?f.prototype.find.apply(this.rules[0],arguments):void 0},g.prototype.rulesets=function(){return this.rules?f.prototype.rulesets.apply(this.rules[0]):void 0},g.prototype.outputRuleset=function(a,b,c){var d,e=c.length;if(a.tabLevel=(0|a.tabLevel)+1,a.compress){for(b.add("{"),d=0;e>d;d++)c[d].genCSS(a,b);return b.add("}"),void a.tabLevel--}var f="\n"+Array(a.tabLevel).join(" "),g=f+" ";if(e){for(b.add(" {"+g),c[0].genCSS(a,b),d=1;e>d;d++)b.add(g),c[d].genCSS(a,b);b.add(f+"}")}else b.add(" {"+f+"}");a.tabLevel--},b.exports=g},{"./node":70,"./ruleset":76,"./selector":77}],58:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./combinator"),g=function(a,b,c,d,e){this.combinator=a instanceof f?a:new f(a),this.value="string"==typeof b?b.trim():b?b:"",this.index=c,this.currentFileInfo=d,this.copyVisibilityInfo(e)};g.prototype=new d,g.prototype.type="Element",g.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},g.prototype.eval=function(a){return new g(this.combinator,this.value.eval?this.value.eval(a):this.value,this.index,this.currentFileInfo,this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.index,this.currentFileInfo,this.visibilityInfo())},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.currentFileInfo,this.index)},g.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof e&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=g},{"./combinator":51,"./node":70,"./paren":72}],59:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./comment"),g=function(a){if(this.value=a,!a)throw new Error("Expression requires an array parameter")};g.prototype=new d,g.prototype.type="Expression",g.prototype.accept=function(a){this.value=a.visitArray(this.value)},g.prototype.eval=function(a){var b,c=this.parens&&!this.parensInOp,d=!1;return c&&a.inParenthesis(),this.value.length>1?b=new g(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(d=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!d&&(b=new e(b)),b},g.prototype.genCSS=function(a,b){for(var c=0;this.value.length>c;c++)this.value[c].genCSS(a,b),this.value.length>c+1&&b.add(" ")},g.prototype.throwAwayComments=function(){this.value=this.value.filter(function(a){return!(a instanceof f)})},b.exports=g},{"./comment":52,"./node":70,"./paren":72}],60:[function(a,b,c){var d=a("./node"),e=a("./selector"),f=function g(a,b,c,d,e){switch(this.selector=a,this.option=b,this.index=c,this.object_id=g.next_id++,this.parent_ids=[this.object_id],this.currentFileInfo=d||{},this.copyVisibilityInfo(e),this.allowRoot=!0,b){case"all":this.allowBefore=!0,this.allowAfter=!0;break;default:this.allowBefore=!1,this.allowAfter=!1}};f.next_id=0,f.prototype=new d,f.prototype.type="Extend",f.prototype.accept=function(a){this.selector=a.visit(this.selector)},f.prototype.eval=function(a){return new f(this.selector.eval(a),this.option,this.index,this.currentFileInfo,this.visibilityInfo())},f.prototype.clone=function(a){return new f(this.selector,this.option,this.index,this.currentFileInfo,this.visibilityInfo())},f.prototype.findSelfSelectors=function(a){var b,c,d=[];for(b=0;a.length>b;b++)c=a[b].elements,b>0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":70,"./selector":77}],61:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=function(a,b,c,d,e,f){if(this.options=c,this.index=d,this.path=a,this.features=b,this.currentFileInfo=e,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?\/]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f)};j.prototype=new d,j.prototype.type="Import",j.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.plugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},j.prototype.genCSS=function(a,b){this.css&&void 0===this.path.currentFileInfo.reference&&(b.add("@import ",this.currentFileInfo,this.index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},j.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},j.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),a instanceof g?a.containsVariables():!0},j.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new j(b.eval(a),this.features,this.options,this.index,this.currentFileInfo,this.visibilityInfo())},j.prototype.evalPath=function(a){var b=this.path.eval(a),c=this.currentFileInfo&&this.currentFileInfo.rootpath;if(!(b instanceof f)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d)}b.value=a.normalizePath(b.value)}return b},j.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){a.addVisibilityBlock()}):b.addVisibilityBlock()),b},j.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a);if(this.options.plugin)return c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[];if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var f=new i(this.root,0,{filename:this.importedFilename,reference:this.path.currentFileInfo&&this.path.currentFileInfo.reference},!0,!0);return this.features?new e([f],this.features.value):[f]}if(this.css){var g=new j(this.evalPath(a),d,this.options,this.index);if(!g.css&&this.error)throw this.error;return g}return b=new h(null,this.root.rules.slice(0)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=j},{"./anonymous":46,"./media":66,"./node":70,"./quoted":73,"./ruleset":76,"./url":80}],62:[function(a,b,c){var d={};d.Node=a("./node"),d.Alpha=a("./alpha"),d.Color=a("./color"),d.Directive=a("./directive"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Rule=a("./rule"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.RulesetCall=a("./ruleset-call"),b.exports=d},{"./alpha":45,"./anonymous":46,"./assignment":47,"./attribute":48,"./call":49,"./color":50,"./combinator":51,"./comment":52,"./condition":53,"./detached-ruleset":55,"./dimension":56,"./directive":57,"./element":58,"./expression":59,"./extend":60,"./import":61,"./javascript":63,"./keyword":65,"./media":66,"./mixin-call":67,"./mixin-definition":68,"./negative":69,"./node":70,"./operation":71,"./paren":72,"./quoted":73,"./rule":74,"./ruleset":76,"./ruleset-call":75,"./selector":77,"./unicode-descriptor":78,"./unit":79,"./url":80,"./value":81,"./variable":82}],63:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this.index=c,this.currentFileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new e(b):"string"==typeof b?new f('"'+b+'"',b,this.escaped,this.index):new g(Array.isArray(b)?b.join(", "):b)},b.exports=h},{"./anonymous":46,"./dimension":56,"./js-eval-node":64,"./quoted":73}],64:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(void 0!==b.javascriptEnabled&&!b.javascriptEnabled)throw{message:"You are using JavaScript, which has been disabled.",filename:this.currentFileInfo.filename,index:this.index};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.index,d.currentFileInfo).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.currentFileInfo.filename,index:this.index}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.currentFileInfo.filename,index:this.index}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":70,"./variable":82}],65:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":70}],66:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./directive"),j=function(a,b,c,g,h){this.index=c,this.currentFileInfo=g;var i=new f([],null,null,this.index,this.currentFileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0};j.prototype=new i,j.prototype.type="Media",j.prototype.isRulesetLike=!0,j.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},j.prototype.genCSS=function(a,b){b.add("@media ",this.currentFileInfo,this.index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},j.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new j(null,[],this.index,this.currentFileInfo,this.visibilityInfo());this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo);var c=!1;a.strictMath||(c=!0,a.strictMath=!0);try{b.features=this.features.eval(a)}finally{c&&(a.strictMath=!1)}return a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},j.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.index,this.currentFileInfo).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo())}return delete a.mediaBlocks,delete a.mediaPath,b},j.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;f.length>b;b++)c=f[b].features instanceof e?f[b].features.value:f[b].features,f[b]=Array.isArray(c)?c:[c];return this.features=new e(this.permute(f).map(function(a){for(a=a.map(function(a){return a.toCSS?a:new g(a)}),b=a.length-1;b>0;b--)a.splice(b,0,new g("and"));return new h(a)})),new d([],[])},j.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;c.length>d;d++)for(var e=0;a[0].length>e;e++)b.push([a[0][e]].concat(c[d]));return b},j.prototype.bubbleSelectors=function(a){a&&(this.rules=[new d(a.slice(0),[this.rules[0]])])},b.exports=j},{"./anonymous":46,"./directive":57,"./expression":59,"./ruleset":76,"./selector":77,"./value":81}],67:[function(a,b,c){var d=a("./node"),e=a("./selector"),f=a("./mixin-definition"),g=a("../functions/default"),h=function(a,b,c,d,f){this.selector=new e(a),this.arguments=b||[],this.index=c,this.currentFileInfo=d,this.important=f,this.allowRoot=!0};h.prototype=new d,h.prototype.type="MixinCall",h.prototype.accept=function(a){this.selector&&(this.selector=a.visit(this.selector)),this.arguments.length&&(this.arguments=a.visitArray(this.arguments))},h.prototype.eval=function(a){function b(b,c){var d,e,f;for(d=0;2>d;d++){for(x[d]=!0,g.value(d),e=0;c.length>e&&x[d];e++)f=c[e],f.matchCondition&&(x[d]=x[d]&&f.matchCondition(null,a));b.matchCondition&&(x[d]=x[d]&&b.matchCondition(t,a))}return x[0]||x[1]?x[0]!=x[1]?x[1]?A:B:z:y}var c,d,e,h,i,j,k,l,m,n,o,p,q,r,s,t=[],u=[],v=!1,w=[],x=[],y=-1,z=0,A=1,B=2;for(j=0;this.arguments.length>j;j++)if(h=this.arguments[j],i=h.value.eval(a),h.expand&&Array.isArray(i.value))for(i=i.value,k=0;i.length>k;k++)t.push({value:i[k]});else t.push({name:h.name,value:i});for(s=function(b){return b.matchArgs(null,a)},j=0;a.frames.length>j;j++)if((c=a.frames[j].find(this.selector,null,s)).length>0){for(n=!0,k=0;c.length>k;k++){for(d=c[k].rule,e=c[k].path,m=!1,l=0;a.frames.length>l;l++)if(!(d instanceof f)&&d===(a.frames[l].originalRuleset||a.frames[l])){m=!0;break}m||d.matchArgs(t,a)&&(o={mixin:d,group:b(d,e)},o.group!==y&&w.push(o),v=!0)}for(g.reset(),q=[0,0,0],k=0;w.length>k;k++)q[w[k].group]++;if(q[z]>0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.index,filename:this.currentFileInfo.filename};for(k=0;w.length>k;k++)if(o=w[k].group,o===z||o===p)try{d=w[k].mixin,d instanceof f||(r=d.originalRuleset||d,d=new f("",[],d.rules,null,!1,null,r.visibilityInfo()),d.originalRuleset=r);var C=d.evalCall(a,t,this.important).rules; -this._setVisibilityToReplacement(C),Array.prototype.push.apply(u,C)}catch(D){throw{message:D.message,index:this.index,filename:this.currentFileInfo.filename,stack:D.stack}}if(v)return u}throw n?{type:"Runtime",message:"No matching definition was found for `"+this.format(t)+"`",index:this.index,filename:this.currentFileInfo.filename}:{type:"Name",message:this.selector.toCSS().trim()+" is undefined",index:this.index,filename:this.currentFileInfo.filename}},h.prototype._setVisibilityToReplacement=function(a){var b,c;if(this.blocksVisibility())for(b=0;a.length>b;b++)c=a[b],c.addVisibilityBlock()},h.prototype.format=function(a){return this.selector.toCSS().trim()+"("+(a?a.map(function(a){var b="";return a.name&&(b+=a.name+":"),b+=a.value.toCSS?a.value.toCSS():"???"}).join(", "):"")+")"},b.exports=h},{"../functions/default":20,"./mixin-definition":68,"./node":70,"./selector":77}],68:[function(a,b,c){var d=a("./selector"),e=a("./element"),f=a("./ruleset"),g=a("./rule"),h=a("./expression"),i=a("../contexts"),j=function(a,b,c,f,g,h,i){this.name=a,this.selectors=[new d([new e(null,a,this.index,this.currentFileInfo)])],this.params=b,this.condition=f,this.variadic=g,this.arity=b.length,this.rules=c,this._lookups={};var j=[];this.required=b.reduce(function(a,b){return!b.name||b.name&&!b.value?a+1:(j.push(b.name),a)},0),this.optionalParameters=j,this.frames=h,this.copyVisibilityInfo(i),this.allowRoot=!0};j.prototype=new f,j.prototype.type="MixinDefinition",j.prototype.evalFirst=!0,j.prototype.accept=function(a){this.params&&this.params.length&&(this.params=a.visitArray(this.params)),this.rules=a.visitArray(this.rules),this.condition&&(this.condition=a.visit(this.condition))},j.prototype.evalParams=function(a,b,c,d){var e,j,k,l,m,n,o,p,q=new f(null,null),r=this.params.slice(0),s=0;if(b.frames&&b.frames[0]&&b.frames[0].functionRegistry&&(q.functionRegistry=b.frames[0].functionRegistry.inherit()),b=new i.Eval(b,[q].concat(b.frames)),c)for(c=c.slice(0),s=c.length,k=0;s>k;k++)if(j=c[k],n=j&&j.name){for(o=!1,l=0;r.length>l;l++)if(!d[l]&&n===r[l].name){d[l]=j.value.eval(a),q.prependRule(new g(n,j.value.eval(a))),o=!0;break}if(o){c.splice(k,1),k--;continue}throw{type:"Runtime",message:"Named argument for "+this.name+" "+c[k].name+" not found"}}for(p=0,k=0;r.length>k;k++)if(!d[k]){if(j=c&&c[p],n=r[k].name)if(r[k].variadic){for(e=[],l=p;s>l;l++)e.push(c[l].value.eval(a));q.prependRule(new g(n,new h(e).eval(a)))}else{if(m=j&&j.value)m=m.eval(a);else{if(!r[k].value)throw{type:"Runtime",message:"wrong number of arguments for "+this.name+" ("+s+" for "+this.arity+")"};m=r[k].value.eval(b),q.resetCache()}q.prependRule(new g(n,m)),d[k]=m}if(r[k].variadic&&c)for(l=p;s>l;l++)d[l]=c[l].value.eval(a);p++}return q},j.prototype.makeImportant=function(){var a=this.rules?this.rules.map(function(a){return a.makeImportant?a.makeImportant(!0):a}):this.rules,b=new j(this.name,this.params,a,this.condition,this.variadic,this.frames);return b},j.prototype.eval=function(a){return new j(this.name,this.params,this.rules,this.condition,this.variadic,this.frames||a.frames.slice(0))},j.prototype.evalCall=function(a,b,c){var d,e,j=[],k=this.frames?this.frames.concat(a.frames):a.frames,l=this.evalParams(a,new i.Eval(a,k),b,j);return l.prependRule(new g("@arguments",new h(j).eval(a))),d=this.rules.slice(0),e=new f(null,d),e.originalRuleset=this,e=e.eval(new i.Eval(a,[this,l].concat(k))),c&&(e=e.makeImportant()),e},j.prototype.matchCondition=function(a,b){return!this.condition||this.condition.eval(new i.Eval(b,[this.evalParams(b,new i.Eval(b,this.frames?this.frames.concat(b.frames):b.frames),a,[])].concat(this.frames||[]).concat(b.frames)))},j.prototype.matchArgs=function(a,b){var c,d=a&&a.length||0,e=this.optionalParameters,f=a?a.reduce(function(a,b){return e.indexOf(b.name)<0?a+1:a},0):0;if(this.variadic){if(this.required-1>f)return!1}else{if(this.required>f)return!1;if(d>this.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;c>g;g++)if(!this.params[g].name&&!this.params[g].variadic&&a[g].value.eval(b).toCSS()!=this.params[g].value.eval(b).toCSS())return!1;return!0},b.exports=j},{"../contexts":11,"./element":58,"./expression":59,"./rule":74,"./ruleset":76,"./selector":77}],69:[function(a,b,c){var d=a("./node"),e=a("./operation"),f=a("./dimension"),g=function(a){this.value=a};g.prototype=new d,g.prototype.type="Negative",g.prototype.genCSS=function(a,b){b.add("-"),this.value.genCSS(a,b)},g.prototype.eval=function(a){return a.isMathOn()?new e("*",[new f(-1),this.value]).eval(a):new g(this.value.eval(a))},b.exports=g},{"./dimension":56,"./node":70,"./operation":71}],70:[function(a,b,c){var d=function(){};d.prototype.toCSS=function(a){var b=[];return this.genCSS(a,{add:function(a,c,d){b.push(a)},isEmpty:function(){return 0===b.length}}),b.join("")},d.prototype.genCSS=function(a,b){b.add(this.value)},d.prototype.accept=function(a){this.value=a.visit(this.value)},d.prototype.eval=function(){return this},d.prototype._operate=function(a,b,c,d){switch(b){case"+":return c+d;case"-":return c-d;case"*":return c*d;case"/":return c/d}},d.prototype.fround=function(a,b){var c=a&&a.numPrecision;return null==c?b:Number((b+2e-16).toFixed(c))},d.compare=function(a,b){if(a.compare&&"Quoted"!==b.type&&"Anonymous"!==b.type)return a.compare(b);if(b.compare)return-b.compare(a);if(a.type===b.type){if(a=a.value,b=b.value,!Array.isArray(a))return a===b?0:void 0;if(a.length===b.length){for(var c=0;a.length>c;c++)if(0!==d.compare(a[c],b[c]))return;return 0}}},d.numericCompare=function(a,b){return b>a?-1:a===b?0:a>b?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],71:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};g.prototype=new d,g.prototype.type="Operation",g.prototype.accept=function(a){this.operands=a.visit(this.operands)},g.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof f&&c instanceof e&&(b=b.toColor()),c instanceof f&&b instanceof e&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new g(this.op,[b,c],this.isSpaced)},g.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=g},{"./color":50,"./dimension":56,"./node":70}],72:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":70}],73:[function(a,b,c){var d=a("./node"),e=a("./js-eval-node"),f=a("./variable"),g=function(a,b,c,d,e){this.escaped=null==c?!0:c,this.value=b||"",this.quote=a.charAt(0),this.index=d,this.currentFileInfo=e};g.prototype=new e,g.prototype.type="Quoted",g.prototype.genCSS=function(a,b){this.escaped||b.add(this.quote,this.currentFileInfo,this.index),b.add(this.value),this.escaped||b.add(this.quote)},g.prototype.containsVariables=function(){return this.value.match(/(`([^`]+)`)|@\{([\w-]+)\}/)},g.prototype.eval=function(a){function b(a,b,c){var d=a;do a=d,d=a.replace(b,c);while(a!==d);return d}var c=this,d=this.value,e=function(b,d){return String(c.evaluateJavaScript(d,a))},h=function(b,d){var e=new f("@"+d,c.index,c.currentFileInfo).eval(a,!0);return e instanceof g?e.value:e.toCSS()};return d=b(d,/`([^`]+)`/g,e),d=b(d,/@\{([\w-]+)\}/g,h),new g(this.quote+d+this.quote,d,this.escaped,this.index,this.currentFileInfo)},g.prototype.compare=function(a){return"Quoted"!==a.type||this.escaped||a.escaped?a.toCSS&&this.toCSS()===a.toCSS()?0:void 0:d.numericCompare(this.value,a.value)},b.exports=g},{"./js-eval-node":64,"./node":70,"./variable":82}],74:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;e>c;c++)b[c].eval(a).genCSS(a,f);return d}var e=a("./node"),f=a("./value"),g=a("./keyword"),h=function(a,b,c,d,g,h,i,j){this.name=a,this.value=b instanceof e?b:new f([b]),this.important=c?" "+c.trim():"",this.merge=d,this.index=g,this.currentFileInfo=h,this.inline=i||!1,this.variable=void 0!==j?j:a.charAt&&"@"===a.charAt(0),this.allowRoot=!0};h.prototype=new e,h.prototype.type="Rule",h.prototype.genCSS=function(a,b){b.add(this.name+(a.compress?":":": "),this.currentFileInfo,this.index);try{this.value.genCSS(a,b)}catch(c){throw c.index=this.index,c.filename=this.currentFileInfo.filename,c}b.add(this.important+(this.inline||a.lastRule&&a.compress?"":";"),this.currentFileInfo,this.index)},h.prototype.eval=function(a){var b,c=!1,e=this.name,f=this.variable;"string"!=typeof e&&(e=1===e.length&&e[0]instanceof g?e[0].value:d(a,e),f=!1),"font"!==e||a.strictMath||(c=!0,a.strictMath=!0);try{if(a.importantScope.push({}),b=this.value.eval(a),!this.variable&&"DetachedRuleset"===b.type)throw{message:"Rulesets cannot be evaluated on a property.",index:this.index,filename:this.currentFileInfo.filename};var i=this.important,j=a.importantScope.pop();return!i&&j.important&&(i=j.important),new h(e,b,i,this.merge,this.index,this.currentFileInfo,this.inline,f)}catch(k){throw"number"!=typeof k.index&&(k.index=this.index,k.filename=this.currentFileInfo.filename),k}finally{c&&(a.strictMath=!1)}},h.prototype.makeImportant=function(){return new h(this.name,this.value,"!important",this.merge,this.index,this.currentFileInfo,this.inline)},b.exports=h},{"./keyword":65,"./node":70,"./value":81}],75:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(a){this.variable=a,this.allowRoot=!0};f.prototype=new d,f.prototype.type="RulesetCall",f.prototype.eval=function(a){var b=new e(this.variable).eval(a);return b.callEval(a)},b.exports=f},{"./node":70,"./variable":82}],76:[function(a,b,c){var d=a("./node"),e=a("./rule"),f=a("./selector"),g=a("./element"),h=a("./paren"),i=a("../contexts"),j=a("../functions/function-registry"),k=a("../functions/default"),l=a("./debug-info"),m=function(a,b,c,d){this.selectors=a,this.rules=b,this._lookups={},this.strictImports=c,this.copyVisibilityInfo(d),this.allowRoot=!0};m.prototype=new d,m.prototype.type="Ruleset",m.prototype.isRuleset=!0,m.prototype.isRulesetLike=!0,m.prototype.accept=function(a){this.paths?this.paths=a.visitArray(this.paths,!0):this.selectors&&(this.selectors=a.visitArray(this.selectors)),this.rules&&this.rules.length&&(this.rules=a.visitArray(this.rules))},m.prototype.eval=function(a){var b,c,d,f,g=this.selectors,h=!1;if(g&&(c=g.length)){for(b=[],k.error({type:"Syntax",message:"it is currently only allowed in parametric mixin guards,"}),f=0;c>f;f++)d=g[f].eval(a),b.push(d),d.evaldCondition&&(h=!0);k.reset()}else h=!0;var i,l,n=this.rules?this.rules.slice(0):null,o=new m(b,n,this.strictImports,this.visibilityInfo());o.originalRuleset=this,o.root=this.root,o.firstRoot=this.firstRoot,o.allowImports=this.allowImports,this.debugInfo&&(o.debugInfo=this.debugInfo),h||(n.length=0),o.functionRegistry=function(a){for(var b,c=0,d=a.length;c!==d;++c)if(b=a[c].functionRegistry)return b;return j}(a.frames).inherit();var p=a.frames;p.unshift(o);var q=a.selectors;q||(a.selectors=q=[]),q.unshift(this.selectors),(o.root||o.allowImports||!o.strictImports)&&o.evalImports(a);var r=o.rules,s=r?r.length:0;for(f=0;s>f;f++)r[f].evalFirst&&(r[f]=r[f].eval(a));var t=a.mediaBlocks&&a.mediaBlocks.length||0;for(f=0;s>f;f++)"MixinCall"===r[f].type?(n=r[f].eval(a).filter(function(a){return a instanceof e&&a.variable?!o.variable(a.name):!0}),r.splice.apply(r,[f,1].concat(n)),s+=n.length-1,f+=n.length-1,o.resetCache()):"RulesetCall"===r[f].type&&(n=r[f].eval(a).rules.filter(function(a){return!(a instanceof e&&a.variable)}),r.splice.apply(r,[f,1].concat(n)),s+=n.length-1,f+=n.length-1,o.resetCache());for(f=0;r.length>f;f++)i=r[f],i.evalFirst||(r[f]=i=i.eval?i.eval(a):i);for(f=0;r.length>f;f++)if(i=r[f],i instanceof m&&i.selectors&&1===i.selectors.length&&i.selectors[0].isJustParentSelector()){r.splice(f--,1);for(var u=0;i.rules.length>u;u++)l=i.rules[u],l.copyVisibilityInfo(i.visibilityInfo()),l instanceof e&&l.variable||r.splice(++f,0,l)}if(p.shift(),q.shift(),a.mediaBlocks)for(f=t;a.mediaBlocks.length>f;f++)a.mediaBlocks[f].bubbleSelectors(b);return o},m.prototype.evalImports=function(a){var b,c,d=this.rules;if(d)for(b=0;d.length>b;b++)"Import"===d[b].type&&(c=d[b].eval(a),c&&(c.length||0===c.length)?(d.splice.apply(d,[b,1].concat(c)),b+=c.length-1):d.splice(b,1,c),this.resetCache())},m.prototype.makeImportant=function(){var a=new m(this.selectors,this.rules.map(function(a){return a.makeImportant?a.makeImportant():a}),this.strictImports,this.visibilityInfo());return a},m.prototype.matchArgs=function(a){return!a||0===a.length},m.prototype.matchCondition=function(a,b){var c=this.selectors[this.selectors.length-1];return c.evaldCondition?!c.condition||c.condition.eval(new i.Eval(b,b.frames)):!1},m.prototype.resetCache=function(){this._rulesets=null,this._variables=null,this._lookups={}},m.prototype.variables=function(){return this._variables||(this._variables=this.rules?this.rules.reduce(function(a,b){if(b instanceof e&&b.variable===!0&&(a[b.name]=b),"Import"===b.type&&b.root&&b.root.variables){var c=b.root.variables();for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])}return a},{}):{}),this._variables},m.prototype.variable=function(a){return this.variables()[a]},m.prototype.rulesets=function(){if(!this.rules)return[];var a,b,c=[],d=this.rules,e=d.length;for(a=0;e>a;a++)b=d[a],b.isRuleset&&c.push(b);return c},m.prototype.prependRule=function(a){var b=this.rules;b?b.unshift(a):this.rules=[a]},m.prototype.find=function(a,b,c){b=b||this;var d,e,g=[],h=a.toCSS();return h in this._lookups?this._lookups[h]:(this.rulesets().forEach(function(h){if(h!==b)for(var i=0;h.selectors.length>i;i++)if(d=a.match(h.selectors[i])){if(a.elements.length>d){if(!c||c(h)){e=h.find(new f(a.elements.slice(d)),b,c);for(var j=0;e.length>j;++j)e[j].path.push(h);Array.prototype.push.apply(g,e)}}else g.push({rule:h,path:[]});break}}),this._lookups[h]=g,g)},m.prototype.genCSS=function(a,b){function c(a){return"boolean"==typeof a.isRulesetLike?a.isRulesetLike:"function"==typeof a.isRulesetLike?a.isRulesetLike():!1}var d,e,f,g,h,i=[],j=[];a.tabLevel=a.tabLevel||0,this.root||a.tabLevel++;var k,m=a.compress?"":Array(a.tabLevel+1).join(" "),n=a.compress?"":Array(a.tabLevel).join(" "),o=0,p=0;for(d=0;this.rules.length>d;d++)g=this.rules[d],"Comment"===g.type?(p===d&&p++,j.push(g)):g.isCharset&&g.isCharset()?(j.splice(o,0,g),o++,p++):"Import"===g.type?(j.splice(p,0,g),p++):j.push(g);if(j=i.concat(j),!this.root){f=l(a,this,n),f&&(b.add(f),b.add(n));var q,r=this.paths,s=r.length;for(k=a.compress?",":",\n"+n,d=0;s>d;d++)if(h=r[d],q=h.length)for(d>0&&b.add(k),a.firstSelector=!0,h[0].genCSS(a,b),a.firstSelector=!1,e=1;q>e;e++)h[e].genCSS(a,b);b.add((a.compress?"{":" {\n")+m)}for(d=0;j.length>d;d++){g=j[d],d+1===j.length&&(a.lastRule=!0);var t=a.lastRule;c(g)&&(a.lastRule=!1),g.genCSS?g.genCSS(a,b):g.value&&b.add(g.value.toString()),a.lastRule=t,a.lastRule?a.lastRule=!1:b.add(a.compress?"":"\n"+m)}this.root||(b.add(a.compress?"}":"\n"+n+"}"),a.tabLevel--),b.isEmpty()||a.compress||!this.firstRoot||b.add("\n")},m.prototype.joinSelectors=function(a,b,c){for(var d=0;c.length>d;d++)this.joinSelector(a,b,c[d])},m.prototype.joinSelector=function(a,b,c){function d(a,b){var c,d;if(0===a.length)c=new h(a[0]);else{var e=[];for(d=0;a.length>d;d++)e.push(new g(null,a[d],b.index,b.currentFileInfo));c=new h(new f(e))}return c}function e(a,b){var c,d;return c=new g(null,a,b.index,b.currentFileInfo),d=new f([c])}function i(a,b,c,d){var e,f,h;if(e=[],a.length>0?(e=a.slice(0),f=e.pop(),h=d.createDerived(f.elements.slice(0))):h=d.createDerived([]),b.length>0){var i=c.combinator,j=b[0].elements[0];i.emptyOrWhitespace&&!j.combinator.emptyOrWhitespace&&(i=j.combinator),h.elements.push(new g(i,j.value,c.index,c.currentFileInfo)),h.elements=h.elements.concat(b[0].elements.slice(1))}if(0!==h.elements.length&&e.push(h),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function j(a,b,c,d,e){var f;for(f=0;a.length>f;f++){var g=i(a[f],b,c,d);e.push(g)}return e}function k(a,b){var c,d;if(0!==a.length){if(0===b.length)return void b.push([new f(a)]);for(c=0;b.length>c;c++)d=b[c],d.length>0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new f(a))}}function l(a,b,c){function f(a){var b;return"Paren"!==a.value.type?null:(b=a.value.value,"Selector"!==b.type?null:b)}var h,m,n,o,p,q,r,s,t,u,v=!1;for(o=[],p=[[]],h=0;c.elements.length>h;h++)if(s=c.elements[h],"&"!==s.value){var w=f(s);if(null!=w){k(o,p);var x,y=[],z=[];for(x=l(y,b,w),v=v||x,n=0;y.length>n;n++){var A=e(d(y[n],s),s);j(p,[A],s,c,z)}p=z,o=[]}else o.push(s)}else{for(v=!0,q=[],k(o,p),m=0;p.length>m;m++)if(r=p[m],0===b.length)r.length>0&&r[0].elements.push(new g(s.combinator,"",s.index,s.currentFileInfo)),q.push(r);else for(n=0;b.length>n;n++){var B=i(r,b[n],s,c);q.push(B)}p=q,o=[]}for(k(o,p),h=0;p.length>h;h++)t=p[h].length,t>0&&(a.push(p[h]),u=p[h][t-1],p[h][t-1]=u.createDerived(u.elements,c.extendList));return v}function m(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var n,o,p;if(o=[],p=l(o,b,c),!p)if(b.length>0)for(o=[],n=0;b.length>n;n++){var q=b[n].map(m.bind(this,c.visibilityInfo()));q.push(c),o.push(q)}else o=[[c]];for(n=0;o.length>n;n++)a.push(o[n])},b.exports=m},{"../contexts":11,"../functions/default":20,"../functions/function-registry":22,"./debug-info":54,"./element":58,"./node":70,"./paren":72,"./rule":74,"./selector":77}],77:[function(a,b,c){var d=a("./node"),e=a("./element"),f=function(a,b,c,d,e,f){this.elements=a,this.extendList=b,this.condition=c,this.currentFileInfo=e||{},c||(this.evaldCondition=!0),this.copyVisibilityInfo(f)};f.prototype=new d,f.prototype.type="Selector",f.prototype.accept=function(a){this.elements&&(this.elements=a.visitArray(this.elements)),this.extendList&&(this.extendList=a.visitArray(this.extendList)),this.condition&&(this.condition=a.visit(this.condition))},f.prototype.createDerived=function(a,b,c){var d=this.visibilityInfo();c=null!=c?c:this.evaldCondition;var e=new f(a,b||this.extendList,null,this.index,this.currentFileInfo,d);return e.evaldCondition=c,e.mediaEmpty=this.mediaEmpty,e},f.prototype.createEmptySelectors=function(){var a=new e("","&",this.index,this.currentFileInfo),b=[new f([a],null,null,this.index,this.currentFileInfo)];return b[0].mediaEmpty=!0,b},f.prototype.match=function(a){var b,c,d=this.elements,e=d.length;if(a.CacheElements(),b=a._elements.length,0===b||b>e)return 0;for(c=0;b>c;c++)if(d[c].value!==a._elements[c])return 0;return b},f.prototype.CacheElements=function(){if(!this._elements){var a=this.elements.map(function(a){return a.combinator.value+(a.value.value||a.value)}).join("").match(/[,&#\*\.\w-]([\w-]|(\\.))*/g);a?"&"===a[0]&&a.shift():a=[],this._elements=a}},f.prototype.isJustParentSelector=function(){return!this.mediaEmpty&&1===this.elements.length&&"&"===this.elements[0].value&&(" "===this.elements[0].combinator.value||""===this.elements[0].combinator.value)},f.prototype.eval=function(a){var b=this.condition&&this.condition.eval(a),c=this.elements,d=this.extendList;return c=c&&c.map(function(b){return b.eval(a)}),d=d&&d.map(function(b){return b.eval(a)}),this.createDerived(c,d,b)},f.prototype.genCSS=function(a,b){var c,d;if(a&&a.firstSelector||""!==this.elements[0].combinator.value||b.add(" ",this.currentFileInfo,this.index),!this._css)for(c=0;this.elements.length>c;c++)d=this.elements[c],d.genCSS(a,b)},f.prototype.getIsOutput=function(){return this.evaldCondition},b.exports=f},{"./element":58,"./node":70}],78:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="UnicodeDescriptor",b.exports=e},{"./node":70}],79:[function(a,b,c){var d=a("./node"),e=a("../data/unit-conversions"),f=function(a,b,c){this.numerator=a?a.slice(0).sort():[],this.denominator=b?b.slice(0).sort():[],c?this.backupUnit=c:a&&a.length&&(this.backupUnit=a[0])};f.prototype=new d,f.prototype.type="Unit",f.prototype.clone=function(){return new f(this.numerator.slice(0),this.denominator.slice(0),this.backupUnit)},f.prototype.genCSS=function(a,b){var c=a&&a.strictUnits;1===this.numerator.length?b.add(this.numerator[0]):!c&&this.backupUnit?b.add(this.backupUnit):!c&&this.denominator.length&&b.add(this.denominator[0])},f.prototype.toString=function(){var a,b=this.numerator.join("*");for(a=0;this.denominator.length>a;a++)b+="/"+this.denominator[a];return b},f.prototype.compare=function(a){return this.is(a.toString())?0:void 0},f.prototype.is=function(a){return this.toString().toUpperCase()===a.toUpperCase()},f.prototype.isLength=function(){return Boolean(this.toCSS().match(/px|em|%|in|cm|mm|pc|pt|ex/))},f.prototype.isEmpty=function(){return 0===this.numerator.length&&0===this.denominator.length},f.prototype.isSingular=function(){return 1>=this.numerator.length&&0===this.denominator.length},f.prototype.map=function(a){var b;for(b=0;this.numerator.length>b;b++)this.numerator[b]=a(this.numerator[b],!1);for(b=0;this.denominator.length>b;b++)this.denominator[b]=a(this.denominator[b],!0)},f.prototype.usedUnits=function(){var a,b,c,d={};b=function(b){return a.hasOwnProperty(b)&&!d[c]&&(d[c]=b),b};for(c in e)e.hasOwnProperty(c)&&(a=e[c],this.map(b));return d},f.prototype.cancel=function(){var a,b,c={};for(b=0;this.numerator.length>b;b++)a=this.numerator[b],c[a]=(c[a]||0)+1;for(b=0;this.denominator.length>b;b++)a=this.denominator[b],c[a]=(c[a]||0)-1;this.numerator=[],this.denominator=[];for(a in c)if(c.hasOwnProperty(a)){var d=c[a];if(d>0)for(b=0;d>b;b++)this.numerator.push(a);else if(0>d)for(b=0;-d>b;b++)this.denominator.push(a)}this.numerator.sort(),this.denominator.sort()},b.exports=f},{"../data/unit-conversions":14,"./node":70}],80:[function(a,b,c){var d=a("./node"),e=function(a,b,c,d){this.value=a,this.currentFileInfo=c,this.index=b,this.isEvald=d};e.prototype=new d,e.prototype.type="Url",e.prototype.accept=function(a){this.value=a.visit(this.value)},e.prototype.genCSS=function(a,b){b.add("url("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){var b,c=this.value.eval(a);if(!this.isEvald&&(b=this.currentFileInfo&&this.currentFileInfo.rootpath,b&&"string"==typeof c.value&&a.isPathRelative(c.value)&&(c.quote||(b=b.replace(/[\(\)'"\s]/g,function(a){return"\\"+a})),c.value=b+c.value),c.value=a.normalizePath(c.value),a.urlArgs&&!c.value.match(/^\s*data:/))){var d=-1===c.value.indexOf("?")?"?":"&",f=d+a.urlArgs;-1!==c.value.indexOf("#")?c.value=c.value.replace("#",f+"#"):c.value+=f}return new e(c,this.index,this.currentFileInfo,!0)},b.exports=e},{"./node":70}],81:[function(a,b,c){var d=a("./node"),e=function(a){if(this.value=a,!a)throw new Error("Value requires an array argument")};e.prototype=new d,e.prototype.type="Value",e.prototype.accept=function(a){this.value&&(this.value=a.visitArray(this.value))},e.prototype.eval=function(a){return 1===this.value.length?this.value[0].eval(a):new e(this.value.map(function(b){return b.eval(a)}))},e.prototype.genCSS=function(a,b){var c;for(c=0;this.value.length>c;c++)this.value[c].genCSS(a,b),this.value.length>c+1&&b.add(a&&a.compress?",":", ")},b.exports=e},{"./node":70}],82:[function(a,b,c){var d=a("./node"),e=function(a,b,c){this.name=a,this.index=b,this.currentFileInfo=c||{}};e.prototype=new d,e.prototype.type="Variable",e.prototype.eval=function(a){var b,c=this.name;if(0===c.indexOf("@@")&&(c="@"+new e(c.slice(1),this.index,this.currentFileInfo).eval(a).value),this.evaluating)throw{type:"Name",message:"Recursive variable definition for "+c,filename:this.currentFileInfo.filename,index:this.index};if(this.evaluating=!0,b=this.find(a.frames,function(b){var d=b.variable(c);if(d){if(d.important){var e=a.importantScope[a.importantScope.length-1];e.important=d.important}return d.value.eval(a)}}))return this.evaluating=!1,b;throw{type:"Name",message:"variable "+c+" is undefined",filename:this.currentFileInfo.filename,index:this.index}},e.prototype.find=function(a,b){for(var c,d=0;a.length>d;d++)if(c=b.call(a,a[d]))return c;return null},b.exports=e},{"./node":70}],83:[function(a,b,c){b.exports={getLocation:function(a,b){for(var c=a+1,d=null,e=-1;--c>=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}}}},{}],84:[function(a,b,c){var d=a("../tree"),e=a("./visitor"),f=a("../logger"),g=function(){this._visitor=new e(this),this.contexts=[],this.allExtendsStack=[[]]};g.prototype={run:function(a){return a=this._visitor.visit(a),a.allExtends=this.allExtendsStack[0],a},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,e,f,g,h=[],i=a.rules,j=i?i.length:0;for(c=0;j>c;c++)a.rules[c]instanceof d.Extend&&(h.push(i[c]),a.extendOnEveryPath=!0);var k=a.paths;for(c=0;k.length>c;c++){var l=k[c],m=l[l.length-1],n=m.extendList;for(g=n?n.slice(0).concat(h):h,g&&(g=g.map(function(a){return a.clone()})),e=0;g.length>e;e++)this.foundExtends=!0,f=g[e],f.findSelfSelectors(l),f.ruleset=a,0===e&&(f.firstExtendOnThisSelectorPath=!0),this.allExtendsStack[this.allExtendsStack.length-1].push(f)}this.contexts.push(a.selectors)}},visitRulesetOut:function(a){a.root||(this.contexts.length=this.contexts.length-1)},visitMedia:function(a,b){a.allExtends=[],this.allExtendsStack.push(a.allExtends)},visitMediaOut:function(a){this.allExtendsStack.length=this.allExtendsStack.length-1},visitDirective:function(a,b){a.allExtends=[],this.allExtendsStack.push(a.allExtends)},visitDirectiveOut:function(a){this.allExtendsStack.length=this.allExtendsStack.length-1}};var h=function(){this._visitor=new e(this)};h.prototype={run:function(a){var b=new g;if(this.extendIndices={},b.run(a),!b.foundExtends)return a;a.allExtends=a.allExtends.concat(this.doExtendChaining(a.allExtends,a.allExtends)),this.allExtendsStack=[a.allExtends];var c=this._visitor.visit(a);return this.checkExtendsForNonMatched(a.allExtends),c},checkExtendsForNonMatched:function(a){var b=this.extendIndices;a.filter(function(a){return!a.hasFoundMatches&&1==a.parent_ids.length}).forEach(function(a){var c="_unknown_";try{c=a.selector.toCSS({})}catch(d){}b[a.index+" "+c]||(b[a.index+" "+c]=!0,f.warn("extend '"+c+"' has no matches"))})},doExtendChaining:function(a,b,c){var e,f,g,h,i,j,k,l,m=[],n=this;for(c=c||0,e=0;a.length>e;e++)for(f=0;b.length>f;f++)j=a[e],k=b[f],j.parent_ids.indexOf(k.object_id)>=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.currentFileInfo,b),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;g.length>e;e++)for(d=0;a.paths.length>d;d++)if(f=a.paths[d],!a.extendOnEveryPath){var j=f[f.length-1].extendList;j&&j.length||(c=this.findMatch(g[e],f),c.length&&(g[e].hasFoundMatches=!0,g[e].selfSelectors.forEach(function(a){var b;b=i.extendSelector(c,f,a,g[e].isVisible()),h.push(b)})))}a.paths=a.paths.concat(h)}},findMatch:function(a,b){var c,d,e,f,g,h,i,j=this,k=a.selector.elements,l=[],m=[];for(c=0;b.length>c;c++)for(d=b[c],e=0;d.elements.length>e;e++)for(f=d.elements[e],(a.allowBefore||0===c&&0===e)&&l.push({pathIndex:c,index:e,matched:0,initialCombinator:f.combinator}),h=0;l.length>h;h++)i=l[h],g=f.combinator.value,""===g&&0===e&&(g=" "),!j.isElementValuesEqual(k[i.matched].value,f.value)||i.matched>0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(d.elements.length>e+1||b.length>c+1)&&(i=null)),i?i.finished&&(i.length=k.length,i.endPathIndex=c,i.endPathElementIndex=e+1,l.length=0,m.push(i)):(l.splice(h,1),h--);return m},isElementValuesEqual:function(a,b){if("string"==typeof a||"string"==typeof b)return a===b;if(a instanceof d.Attribute)return a.op!==b.op||a.key!==b.key?!1:a.value&&b.value?(a=a.value.value||a.value,b=b.value.value||b.value,a===b):!a.value&&!b.value;if(a=a.value,b=b.value,a instanceof d.Selector){if(!(b instanceof d.Selector)||a.elements.length!==b.elements.length)return!1;for(var c=0;a.elements.length>c;c++){if(a.elements[c].combinator.value!==b.elements[c].combinator.value&&(0!==c||(a.elements[c].combinator.value||" ")!==(b.elements[c].combinator.value||" ")))return!1;if(!this.isElementValuesEqual(a.elements[c].value,b.elements[c].value))return!1}return!0}return!1},extendSelector:function(a,b,c,e){var f,g,h,i,j,k=0,l=0,m=[];for(f=0;a.length>f;f++)i=a[f],g=b[i.pathIndex],h=new d.Element(i.initialCombinator,c.elements[0].value,c.elements[0].index,c.elements[0].currentFileInfo),i.pathIndex>k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return b.length>k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitDirective:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitDirectiveOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=h},{"../logger":33,"../tree":62,"./visitor":91}],85:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){ -this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],86:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};g.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,this.context.frames.slice(0)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.index,f.filename=a.currentFileInfo.filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;c.rules.length>h;h++)if(c.rules[h]===a){c.rules[h]=d;break}var i=this.onImported.bind(this,d,b),j=this._sequencer.addImport(i);this._importer.push(d.getPath(),g,d.currentFileInfo,d.options,j)}},onImported:function(a,b,c,d,e,f){c&&(c.filename||(c.index=a.index,c.filename=a.currentFileInfo.filename),this.error=c);var g=this,h=a.options.inline,i=a.options.plugin,j=a.options.optional,k=e||f in g.recursionDetector;if(b.importMultiple||(a.skip=k?!0:function(){return f in g.onceFileDetectionMap?!0:(g.onceFileDetectionMap[f]=!0,!1)}),!f&&j&&(a.skip=!0),d&&(a.root=d,a.importedFilename=f,!h&&!i&&(b.importMultiple||!k))){g.recursionDetector[f]=!0;var l=this.context;this.context=b;try{this._visitor.visit(d)}catch(c){this.error=c}this.context=l}g.importCount--,g.isFinished&&g._sequencer.tryRun()},visitRule:function(a,b){"DetachedRuleset"===a.value.type?this.context.frames.unshift(a):b.visitDeeper=!1},visitRuleOut:function(a){"DetachedRuleset"===a.value.type&&this.context.frames.shift()},visitDirective:function(a,b){this.context.frames.unshift(a)},visitDirectiveOut:function(a){this.context.frames.shift()},visitMixinDefinition:function(a,b){this.context.frames.unshift(a)},visitMixinDefinitionOut:function(a){this.context.frames.shift()},visitRuleset:function(a,b){this.context.frames.unshift(a)},visitRulesetOut:function(a){this.context.frames.shift()},visitMedia:function(a,b){this.context.frames.unshift(a.rules[0])},visitMediaOut:function(a){this.context.frames.shift()}},b.exports=g},{"../contexts":11,"./import-sequencer":85,"./visitor":91}],87:[function(a,b,c){var d={Visitor:a("./visitor"),ImportVisitor:a("./import-visitor"),MarkVisibleSelectorsVisitor:a("./set-tree-visibility-visitor"),ExtendVisitor:a("./extend-visitor"),JoinSelectorVisitor:a("./join-selector-visitor"),ToCSSVisitor:a("./to-css-visitor")};b.exports=d},{"./extend-visitor":84,"./import-visitor":86,"./join-selector-visitor":88,"./set-tree-visibility-visitor":89,"./to-css-visitor":90,"./visitor":91}],88:[function(a,b,c){var d=a("./visitor"),e=function(){this.contexts=[[]],this._visitor=new d(this)};e.prototype={run:function(a){return this._visitor.visit(a)},visitRule:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){var c,d=this.contexts[this.contexts.length-1],e=[];this.contexts.push(e),a.root||(c=a.selectors,c&&(c=c.filter(function(a){return a.getIsOutput()}),a.selectors=c.length?c:c=null,c&&a.joinSelectors(e,d,c)),c||(a.rules=null),a.paths=e)},visitRulesetOut:function(a){this.contexts.length=this.contexts.length-1},visitMedia:function(a,b){var c=this.contexts[this.contexts.length-1];a.rules[0].root=0===c.length||c[0].multiMedia},visitDirective:function(a,b){var c=this.contexts[this.contexts.length-1];a.rules&&a.rules.length&&(a.rules[0].root=a.isRooted||0===c.length||null)}},b.exports=e},{"./visitor":91}],89:[function(a,b,c){var d=function(a){this.visible=a};d.prototype.run=function(a){this.visit(a)},d.prototype.visitArray=function(a){if(!a)return a;var b,c=a.length;for(b=0;c>b;b++)this.visit(a[b]);return a},d.prototype.visit=function(a){return a?a.constructor===Array?this.visitArray(a):!a.blocksVisibility||a.blocksVisibility()?a:(this.visible?a.ensureVisibility():a.ensureInvisibility(),a.accept(this),a):a},b.exports=d},{}],90:[function(a,b,c){var d=a("../tree"),e=a("./visitor"),f=function(a){this._visitor=new e(this),this._context=a};f.prototype={containsSilentNonBlockedChild:function(a){var b;if(null==a)return!1;for(var c=0;a.length>c;c++)if(b=a[c],b.isSilent&&b.isSilent(this._context)&&!b.blocksVisibility())return!0;return!1},keepOnlyVisibleChilds:function(a){null!=a&&null!=a.rules&&(a.rules=a.rules.filter(function(a){return a.isVisible()}))},isEmpty:function(a){return null==a||null==a.rules?!0:0===a.rules.length},hasVisibleSelector:function(a){return null==a||null==a.paths?!1:a.paths.length>0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];return this.keepOnlyVisibleChilds(c),this.isEmpty(c)?void 0:(a.ensureVisibility(),a.removeVisibilityBlock(),a)},isVisibleRuleset:function(a){return a.firstRoot?!0:this.isEmpty(a)?!1:!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitRule:function(a,b){return a.blocksVisibility()||a.variable?void 0:a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){return a.blocksVisibility()||a.isSilent(this._context)?void 0:a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){return a.blocksVisibility()?void 0:a},visitDirective:function(a,b){return a.rules&&a.rules.length?this.visitDirectiveWithBody(a,b):this.visitDirectiveWithoutBody(a,b)},visitDirectiveWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitDirectiveWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;a.length>c;c++){var e=a[c];if(b&&e instanceof d.Rule&&!e.variable)throw{message:"Properties must be inside selector blocks. They cannot be in the root",index:e.index,filename:e.currentFileInfo&&e.currentFileInfo.filename};if(e instanceof d.Call)throw{message:"Function '"+e.name+"' is undefined",index:e.index,filename:e.currentFileInfo&&e.currentFileInfo.filename};if(e.type&&!e.allowRoot)throw{message:e.type+" node returned by a function is not valid here",index:e.index,filename:e.currentFileInfo&&e.currentFileInfo.filename}}},visitRuleset:function(a,b){var c,d=[];if(this.checkValidNodes(a.rules,a.firstRoot),a.root)a.accept(this._visitor),b.visitDeeper=!1;else{this._compileRulesetPaths(a);for(var e=a.rules,f=e?e.length:0,g=0;f>g;)c=e[g],c&&c.rules?(d.push(this._visitor.visit(c)),e.splice(g,1),f--):g++;f>0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;a.length>b;b++)if(a[b].isVisible()&&a[b].getIsOutput())return!0;return!1}))},_removeDuplicateRules:function(a){if(a){var b,c,e,f={};for(e=a.length-1;e>=0;e--)if(c=a[e],c instanceof d.Rule)if(f[c.name]){b=f[c.name],b instanceof d.Rule&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);-1!==b.indexOf(g)?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b,c,e,f={},g=0;a.length>g;g++)c=a[g],c instanceof d.Rule&&c.merge&&(e=[c.name,c.important?"!":""].join(","),f[e]?a.splice(g--,1):f[e]=[],f[e].push(c));Object.keys(f).map(function(a){function e(a){return new d.Expression(a.map(function(a){return a.value}))}function g(a){return new d.Value(a.map(function(a){return a}))}if(b=f[a],b.length>1){c=b[0];var h=[],i=[];b.map(function(a){"+"===a.merge&&(i.length>0&&h.push(e(i)),i=[]),i.push(a)}),h.push(e(i)),c.value=g(h)}})}},visitAnonymous:function(a,b){return a.blocksVisibility()?void 0:(a.accept(this._visitor),a)}},b.exports=g},{"../tree":62,"./visitor":91}],91:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)if(a.hasOwnProperty(c))switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitFnCache=[],h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var c,e=this._visitFnCache,f=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=g;if(l.visitDeeper=!0,j||(c="visit"+a.type,j=f[c]||d,k=f[c+"Out"]||d,e[h]=j,e[i]=k),j!==d){var m=j.call(f,a,l);f.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=d&&k.call(f,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;d>c;c++)this.visit(a[c]);return a}var e=[];for(c=0;d>c;c++){var f=this.visit(a[c]);void 0!==f&&(f.splice?f.length&&this.flatten(f,e):e.push(f))}return e},flatten:function(a,b){b||(b=[]);var c,d,e,f,g,h;for(d=0,c=a.length;c>d;d++)if(e=a[d],void 0!==e)if(e.splice)for(g=0,f=e.length;f>g;g++)h=e[g],void 0!==h&&(h.splice?h.length&&this.flatten(h,b):b.push(h));else b.push(e);return b}},b.exports=i},{"../tree":62}],92:[function(a,b,c){"use strict";function d(){if(i.length)throw i.shift()}function e(a){var b;b=h.length?h.pop():new f,b.task=a,g(b)}function f(){this.task=null}var g=a("./raw"),h=[],i=[],j=g.makeRequestCallFromTimer(d);b.exports=e,f.prototype.call=function(){try{this.task.call()}catch(a){e.onerror?e.onerror(a):(i.push(a),j())}finally{this.task=null,h[h.length]=this}}},{"./raw":93}],93:[function(a,b,c){(function(a){"use strict";function c(a){h.length||(g(),i=!0),h[h.length]=a}function d(){for(;h.length>j;){var a=j;if(j+=1,h[a].call(),j>k){for(var b=0,c=h.length-j;c>b;b++)h[b]=h[b+j];h.length-=j,j=0}}h.length=0,j=0,i=!1}function e(a){var b=1,c=new l(a),d=document.createTextNode("");return c.observe(d,{characterData:!0}),function(){b=-b,d.data=b}}function f(a){return function(){function b(){clearTimeout(c),clearInterval(d),a()}var c=setTimeout(b,0),d=setInterval(b,50)}}b.exports=c;var g,h=[],i=!1,j=0,k=1024,l=a.MutationObserver||a.WebKitMutationObserver;g="function"==typeof l?e(d):f(d),c.requestFlush=g,c.makeRequestCallFromTimer=f}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],94:[function(a,b,c){"use strict";function d(){}function e(a){try{return a.then}catch(b){return r=b,s}}function f(a,b){try{return a(b)}catch(c){return r=c,s}}function g(a,b,c){try{a(b,c)}catch(d){return r=d,s}}function h(a){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof a)throw new TypeError("not a function");this._45=0,this._81=0,this._65=null,this._54=null,a!==d&&p(a,this)}function i(a,b,c){return new a.constructor(function(e,f){var g=new h(d);g.then(e,f),j(a,new o(b,c,g))})}function j(a,b){for(;3===a._81;)a=a._65;return h._10&&h._10(a),0===a._81?0===a._45?(a._45=1,void(a._54=b)):1===a._45?(a._45=2,void(a._54=[a._54,b])):void a._54.push(b):void k(a,b)}function k(a,b){q(function(){var c=1===a._81?b.onFulfilled:b.onRejected;if(null===c)return void(1===a._81?l(b.promise,a._65):m(b.promise,a._65));var d=f(c,a._65);d===s?m(b.promise,r):l(b.promise,d)})}function l(a,b){if(b===a)return m(a,new TypeError("A promise cannot be resolved with itself."));if(b&&("object"==typeof b||"function"==typeof b)){var c=e(b);if(c===s)return m(a,r);if(c===a.then&&b instanceof h)return a._81=3,a._65=b,void n(a);if("function"==typeof c)return void p(c.bind(b),a)}a._81=1,a._65=b,n(a)}function m(a,b){a._81=2,a._65=b,h._97&&h._97(a,b),n(a)}function n(a){if(1===a._45&&(j(a,a._54),a._54=null),2===a._45){for(var b=0;a._54.length>b;b++)j(a,a._54[b]);a._54=null}}function o(a,b,c){this.onFulfilled="function"==typeof a?a:null,this.onRejected="function"==typeof b?b:null,this.promise=c}function p(a,b){var c=!1,d=g(a,function(a){c||(c=!0,l(b,a))},function(a){c||(c=!0,m(b,a))});c||d!==s||(c=!0,m(b,r))}var q=a("asap/raw"),r=null,s={};b.exports=h,h._10=null,h._97=null,h._61=d,h.prototype.then=function(a,b){if(this.constructor!==h)return i(this,a,b);var c=new h(d);return j(this,new o(a,b,c)),c}},{"asap/raw":93}],95:[function(a,b,c){"use strict";function d(a){var b=new e(e._61);return b._81=1,b._65=a,b}var e=a("./core.js");b.exports=e;var f=d(!0),g=d(!1),h=d(null),i=d(void 0),j=d(0),k=d("");e.resolve=function(a){if(a instanceof e)return a;if(null===a)return h;if(void 0===a)return i;if(a===!0)return f;if(a===!1)return g;if(0===a)return j;if(""===a)return k;if("object"==typeof a||"function"==typeof a)try{var b=a.then;if("function"==typeof b)return new e(b.bind(a))}catch(c){return new e(function(a,b){b(c)})}return d(a)},e.all=function(a){var b=Array.prototype.slice.call(a);return new e(function(a,c){function d(g,h){if(h&&("object"==typeof h||"function"==typeof h)){if(h instanceof e&&h.then===e.prototype.then){for(;3===h._81;)h=h._65;return 1===h._81?d(g,h._65):(2===h._81&&c(h._65),void h.then(function(a){d(g,a)},c))}var i=h.then;if("function"==typeof i){var j=new e(i.bind(h));return void j.then(function(a){d(g,a)},c)}}b[g]=h,0===--f&&a(b)}if(0===b.length)return a([]);for(var f=b.length,g=0;b.length>g;g++)d(g,b[g])})},e.reject=function(a){return new e(function(b,c){c(a)})},e.race=function(a){return new e(function(b,c){a.forEach(function(a){e.resolve(a).then(b,c)})})},e.prototype["catch"]=function(a){return this.then(null,a)}},{"./core.js":94}],96:[function(a,b,c){"function"!=typeof Promise.prototype.done&&(Promise.prototype.done=function(a,b){var c=arguments.length?this.then.apply(this,arguments):this;c.then(null,function(a){setTimeout(function(){throw a},0)})})},{}],97:[function(a,b,c){a("asap");"undefined"==typeof Promise&&(Promise=a("./lib/core.js"),a("./lib/es6-extensions.js")),a("./polyfill-done.js")},{"./lib/core.js":94,"./lib/es6-extensions.js":95,"./polyfill-done.js":96,asap:92}]},{},[2])(2)}); \ No newline at end of file +!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.less=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0||b.isFileProtocol?"development":"production");var c=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(a.location.hash);c&&(b.dumpLineNumbers=c[1]),void 0===b.useFileCache&&(b.useFileCache=!0),void 0===b.onReady&&(b.onReady=!0),b.javascriptEnabled=!(!b.javascriptEnabled&&!b.inlineJavaScript)}},{"./browser":3,"./utils":11}],2:[function(a,b,c){function d(a){a.filename&&console.warn(a),e.async||h.removeChild(i)}a("promise/polyfill.js");var e=window.less||{};a("./add-default-options")(window,e);var f=b.exports=a("./index")(window,e);window.less=f;var g,h,i;e.onReady&&(/!watch/.test(window.location.hash)&&f.watch(),e.async||(g="body { display: none !important }",h=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),i.type="text/css",i.styleSheet?i.styleSheet.cssText=g:i.appendChild(document.createTextNode(g)),h.appendChild(i)),f.registerStylesheetsImmediately(),f.pageLoadFinished=f.refresh("development"===f.env).then(d,d))},{"./add-default-options":1,"./index":8,"promise/polyfill.js":102}],3:[function(a,b,c){var d=a("./utils");b.exports={createCSS:function(a,b,c){var e=c.href||"",f="less:"+(c.title||d.extractId(e)),g=a.getElementById(f),h=!1,i=a.createElement("style");i.setAttribute("type","text/css"),c.media&&i.setAttribute("media",c.media),i.id=f,i.styleSheet||(i.appendChild(a.createTextNode(b)),h=null!==g&&g.childNodes.length>0&&i.childNodes.length>0&&g.firstChild.nodeValue===i.firstChild.nodeValue);var j=a.getElementsByTagName("head")[0];if(null===g||h===!1){var k=c&&c.nextSibling||null;k?k.parentNode.insertBefore(i,k):j.appendChild(i)}if(g&&h===!1&&g.parentNode.removeChild(g),i.styleSheet)try{i.styleSheet.cssText=b}catch(l){throw new Error("Couldn't reassign styleSheet.cssText.")}},currentScript:function(a){var b=a.document;return b.currentScript||function(){var a=b.getElementsByTagName("script");return a[a.length-1]}()}}},{"./utils":11}],4:[function(a,b,c){b.exports=function(a,b,c){var d=null;if("development"!==b.env)try{d="undefined"==typeof a.localStorage?null:a.localStorage}catch(e){}return{setCSS:function(a,b,e,f){if(d){c.info("saving "+a+" to cache.");try{d.setItem(a,f),d.setItem(a+":timestamp",b),e&&d.setItem(a+":vars",JSON.stringify(e))}catch(g){c.error('failed to save "'+a+'" to local storage for caching.')}}},getCSS:function(a,b,c){var e=d&&d.getItem(a),f=d&&d.getItem(a+":timestamp"),g=d&&d.getItem(a+":vars");if(c=c||{},f&&b.lastModified&&new Date(b.lastModified).valueOf()===new Date(f).valueOf()&&(!c&&!g||JSON.stringify(c)===g))return e}}}},{}],5:[function(a,b,c){var d=a("./utils"),e=a("./browser");b.exports=function(a,b,c){function f(b,f){var g,h,i="less-error-message:"+d.extractId(f||""),j='
  • {content}
  • ',k=a.document.createElement("div"),l=[],m=b.filename||f,n=m.match(/([^\/]+(\?.*)?)$/)[1];k.id=i,k.className="less-error-message",h="

    "+(b.type||"Syntax")+"Error: "+(b.message||"There is an error in your .less file")+'

    in '+n+" ";var o=function(a,b,c){void 0!==a.extract[b]&&l.push(j.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};b.extract&&(o(b,0,""),o(b,1,"line"),o(b,2,""),h+="on line "+b.line+", column "+(b.column+1)+":

      "+l.join("")+"
    "),b.stack&&(b.extract||c.logLevel>=4)&&(h+="
    Stack Trace
    "+b.stack.split("\n").slice(1).join("
    ")),k.innerHTML=h,e.createCSS(a.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),k.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===c.env&&(g=setInterval(function(){var b=a.document,c=b.body;c&&(b.getElementById(i)?c.replaceChild(k,b.getElementById(i)):c.insertBefore(k,c.firstChild),clearInterval(g))},10))}function g(b){var c=a.document.getElementById("less-error-message:"+d.extractId(b));c&&c.parentNode.removeChild(c)}function h(a){}function i(a){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?h(a):"function"==typeof c.errorReporting&&c.errorReporting("remove",a):g(a)}function j(a,d){var e="{line} {content}",f=a.filename||d,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f+" ",i=function(a,b,c){void 0!==a.extract[b]&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.extract&&(i(a,0,""),i(a,1,"line"),i(a,2,""),h+="on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")),a.stack&&(a.extract||c.logLevel>=4)&&(h+="\nStack Trace\n"+a.stack),b.logger.error(h)}function k(a,b){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?j(a,b):"function"==typeof c.errorReporting&&c.errorReporting("add",a,b):f(a,b)}return{add:k,remove:i}}},{"./browser":3,"./utils":11}],6:[function(a,b,c){b.exports=function(b,c){function d(){if(window.XMLHttpRequest&&!("file:"===window.location.protocol&&"ActiveXObject"in window))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){return c.error("browser doesn't support AJAX."),null}}var e=a("../less/environment/abstract-file-manager.js"),f={},g=function(){};return g.prototype=new e,g.prototype.alwaysMakePathsAbsolute=function(){return!0},g.prototype.join=function(a,b){return a?this.extractUrlParts(b,a).path:b},g.prototype.doXHR=function(a,e,f,g){function h(b,c,d){b.status>=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var i=d(),j=!b.isFileProtocol||b.fileAsync;"function"==typeof i.overrideMimeType&&i.overrideMimeType("text/css"),c.debug("XHR: Getting '"+a+"'"),i.open("GET",a,j),i.setRequestHeader("Accept",e||"text/x-less, text/css; q=0.9, */*; q=0.5"),i.send(null),b.isFileProtocol&&!b.fileAsync?0===i.status||i.status>=200&&i.status<300?f(i.responseText):g(i.status,a):j?i.onreadystatechange=function(){4==i.readyState&&h(i,f,g)}:h(i,f,g)},g.prototype.supports=function(a,b,c,d){return!0},g.prototype.clearFileCache=function(){f={}},g.prototype.loadFile=function(a,b,c,d,e){b&&!this.isPathAbsolute(a)&&(a=b+a),c=c||{};var g=this.extractUrlParts(a,window.location.href),h=g.url;if(c.useFileCache&&f[h])try{var i=f[h];e(null,{contents:i,filename:h,webInfo:{lastModified:new Date}})}catch(j){e({filename:h,message:"Error loading file "+h+" error was "+j.message})}else this.doXHR(h,c.mime,function(a,b){f[h]=a,e(null,{contents:a,filename:h,webInfo:{lastModified:b}})},function(a,b){e({type:"File",message:"'"+b+"' wasn't found ("+a+")",href:h})})},g}},{"../less/environment/abstract-file-manager.js":16}],7:[function(a,b,c){b.exports=function(){function b(){throw{type:"Runtime",message:"Image size functions are not supported in browser version of less"}}var c=a("./../less/functions/function-registry"),d={"image-size":function(a){return b(this,a),-1},"image-width":function(a){return b(this,a),-1},"image-height":function(a){return b(this,a),-1}};c.addMultiple(d)}},{"./../less/functions/function-registry":24}],8:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(b,c){function f(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function g(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}}function h(a){for(var b,d=l.getElementsByTagName("style"),e=0;e=c&&console.log(a)},info:function(a){b.logLevel>=d&&console.log(a)},warn:function(a){b.logLevel>=e&&console.warn(a)},error:function(a){b.logLevel>=f&&console.error(a)}}]);for(var g=0;g0&&(a=a.slice(0,b)),b=a.lastIndexOf("/"),b<0&&(b=a.lastIndexOf("\\")),b<0?"":a.slice(0,b+1)},d.prototype.tryAppendExtension=function(a,b){return/(\.[a-z]*$)|([\?;].*)$/.test(a)?a:a+b},d.prototype.tryAppendLessExtension=function(a){return this.tryAppendExtension(a,".less")},d.prototype.supportsSync=function(){return!1},d.prototype.alwaysMakePathsAbsolute=function(){return!1},d.prototype.isPathAbsolute=function(a){return/^(?:[a-z-]+:|\/|\\|#)/i.test(a)},d.prototype.join=function(a,b){return a?a+b:b},d.prototype.pathDiff=function(a,b){var c,d,e,f,g=this.extractUrlParts(a),h=this.extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;c0&&(h.splice(c-1,2),c-=2)}return g.hostPart=f[1],g.directories=h,g.path=(f[1]||"")+h.join("/"),g.fileUrl=g.path+(f[4]||""),g.url=g.fileUrl+(f[5]||""),g},b.exports=d},{}],17:[function(a,b,c){function d(a,b){throw new f({type:b||"Syntax",message:a})}var e=a("../functions/function-registry"),f=a("../less-error"),g=function(){};g.prototype.evalPlugin=function(a,b,c,d){var f,g,h,i,j,k,l;if(k=b.pluginManager,d&&(l="string"==typeof d?d:d.filename),l&&(h=k.get(l)))return this.trySetOptions(h,l,c),h.use&&h.use(this.less),h;i={exports:{},pluginManager:k,fileInfo:d},j=i.exports,g=e.create();try{if(f=new Function("module","require","functions","tree","fileInfo","less",a),h=f(i,this.require,g,this.less.tree,d,this.less),h||(h=i.exports),h=this.validatePlugin(h,l),!h)throw new SyntaxError("Not a valid plugin");k.addPlugin(h,d.filename),h.functions=g.getLocalFunctions(),this.trySetOptions(h,l,c),h.use&&h.use(this.less)}catch(m){return console.log(m),new this.less.LessError({message:"Plugin evaluation error: '"+m.name+": "+m.message.replace(/["]/g,"'")+"'",filename:l,line:this.line,col:this.column})}return h},g.prototype.trySetOptions=function(b,c,e){var f=a("path").basename(c);if(e){if(!b.setOptions)return d("Options have been provided but the plugin "+f+" does not support any options."),null;try{b.setOptions(e)}catch(g){return d("Error setting options on plugin "+f+"\n"+g.message),null}}},g.prototype.validatePlugin=function(b,c){if(b){"function"==typeof b&&(b=new b);var e=a("path").basename(c);return b.minVersion&&this.compareVersion(b.minVersion,this.less.version)<0?(d("Plugin "+e+" requires version "+this.versionToString(b.minVersion)),null):b}return null},g.prototype.compareVersion=function(a,b){"string"==typeof a&&(a=a.match(/^(\d+)\.?(\d+)?\.?(\d+)?/),a.shift());for(var c=0;cparseInt(b[c])?-1:1;return 0},g.prototype.versionToString=function(a){for(var b="",c=0;c=0;h--){var i=g[h];if(i[f?"supportsSync":"supports"](a,b,c,e))return i}return null},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},b.exports=e},{"../logger":35}],19:[function(a,b,c){function d(a,b,c){var d,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;l<3;l++)d=b.rgb[l]/255,f=c.rgb[l]/255,h=a(d,f),g&&(h=(j*f+i*(d-j*(d+f-h)))/g),k[l]=255*h;return new e(k,g)}var e=a("../tree/color"),f=a("./function-registry"),g={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,a<=1?g.multiply(a,b):g.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return g.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};for(var h in g)g.hasOwnProperty(h)&&(d[h]=d.bind(null,g[h]));f.addMultiple(d)},{"../tree/color":52,"./function-registry":24}],20:[function(a,b,c){function d(a){return Math.min(1,Math.max(0,a))}function e(a){return h.hsla(a.h,a.s,a.l,a.a)}function f(a){if(a instanceof i)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{type:"Argument",message:"color functions take numbers as parameters"}}function g(a,b){return a instanceof i&&a.unit.is("%")?parseFloat(a.value*b/100):f(a)}var h,i=a("../tree/dimension"),j=a("../tree/color"),k=a("../tree/quoted"),l=a("../tree/anonymous"),m=a("./function-registry");h={rgb:function(a,b,c){return h.rgba(a,b,c,1)},rgba:function(a,b,c,d){var e=[a,b,c].map(function(a){return g(a,255)});return d=f(d),new j(e,d)},hsl:function(a,b,c){return h.hsla(a,b,c,1)},hsla:function(a,b,c,e){function g(a){return a=a<0?a+1:a>1?a-1:a,6*a<1?i+(j-i)*a*6:2*a<1?j:3*a<2?i+(j-i)*(2/3-a)*6:i}var i,j;return a=f(a)%360/360,b=d(f(b)),c=d(f(c)),e=d(f(e)),j=c<=.5?c*(b+1):c+b-c*b,i=2*c-j,h.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),e)},hsv:function(a,b,c){return h.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=f(a)%360/360*360,b=f(b),c=f(c),d=f(d);var e,g;e=Math.floor(a/60%6),g=a/60-e;var i=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],j=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return h.rgba(255*i[j[e][0]],255*i[j[e][1]],255*i[j[e][2]],d)},hue:function(a){return new i(a.toHSL().h)},saturation:function(a){return new i(100*a.toHSL().s,"%")},lightness:function(a){return new i(100*a.toHSL().l,"%")},hsvhue:function(a){return new i(a.toHSV().h)},hsvsaturation:function(a){return new i(100*a.toHSV().s,"%")},hsvvalue:function(a){return new i(100*a.toHSV().v,"%")},red:function(a){return new i(a.rgb[0])},green:function(a){return new i(a.rgb[1])},blue:function(a){return new i(a.rgb[2])},alpha:function(a){return new i(a.toHSL().a)},luma:function(a){return new i(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new i(b*a.alpha*100,"%")},saturate:function(a,b,c){if(!a.rgb)return null;var f=a.toHSL();return f.s+="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},desaturate:function(a,b,c){var f=a.toHSL();return f.s-="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},lighten:function(a,b,c){var f=a.toHSL();return f.l+="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},darken:function(a,b,c){var f=a.toHSL();return f.l-="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},fadein:function(a,b,c){var f=a.toHSL();return f.a+="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fadeout:function(a,b,c){var f=a.toHSL();return f.a-="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=d(c.a),e(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=d<0?360+d:d,e(c)},mix:function(a,b,c){a.toHSL&&b.toHSL||(console.log(b.type),console.dir(b)),c||(c=new i(50));var d=c.value/100,e=2*d-1,f=a.toHSL().a-b.toHSL().a,g=((e*f==-1?e:(e+f)/(1+e*f))+1)/2,h=1-g,k=[a.rgb[0]*g+b.rgb[0]*h,a.rgb[1]*g+b.rgb[1]*h,a.rgb[2]*g+b.rgb[2]*h],l=a.alpha*d+b.alpha*(1-d);return new j(k,l)},greyscale:function(a){return h.desaturate(a,new i(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;"undefined"==typeof b&&(b=h.rgba(0,0,0,1)),"undefined"==typeof c&&(c=h.rgba(255,255,255,1));var e,f,g=a.luma(),i=b.luma(),j=c.luma();return e=g>i?(g+.05)/(i+.05):(i+.05)/(g+.05),f=g>j?(g+.05)/(j+.05):(j+.05)/(g+.05),e>f?b:c},argb:function(a){return new l(a.toARGB())},color:function(a){if(a instanceof k&&/^#([a-f0-9]{6}|[a-f0-9]{3})$/i.test(a.value))return new j(a.value.slice(1));if(a instanceof j||(a=j.fromKeyword(a.value)))return a.value=void 0,a;throw{type:"Argument",message:"argument must be a color keyword or 3/6 digit hex e.g. #FFF"}},tint:function(a,b){return h.mix(h.rgb(255,255,255),a,b)},shade:function(a,b){return h.mix(h.rgb(0,0,0),a,b)}},m.addMultiple(h)},{"../tree/anonymous":47,"../tree/color":52,"../tree/dimension":59,"../tree/quoted":76,"./function-registry":24}],21:[function(a,b,c){b.exports=function(b){var c=a("../tree/quoted"),d=a("../tree/url"),e=a("./function-registry"),f=function(a,b){return new d(b,a.index,a.currentFileInfo).eval(a.context)},g=a("../logger");e.add("data-uri",function(a,e){e||(e=a,a=null);var h=a&&a.value,i=e.value,j=this.currentFileInfo,k=j.relativeUrls?j.currentDirectory:j.entryPath,l=i.indexOf("#"),m="";l!==-1&&(m=i.slice(l),i=i.slice(0,l));var n=b.getFileManager(i,k,this.context,b,!0);if(!n)return f(this,e);var o=!1;if(a)o=/;base64$/.test(h);else{if(h=b.mimeLookup(i),"image/svg+xml"===h)o=!1;else{var p=b.charsetLookup(h);o=["US-ASCII","UTF-8"].indexOf(p)<0}o&&(h+=";base64")}var q=n.loadFileSync(i,k,this.context,b);if(!q.contents)return g.warn("Skipped data-uri embedding of "+i+" because file not found"),f(this,e||a);var r=q.contents;if(o&&!b.encodeBase64)return f(this,e);r=o?b.encodeBase64(r):encodeURIComponent(r);var s="data:"+h+","+r+m,t=32768;return s.length>=t&&this.context.ieCompat!==!1?(g.warn("Skipped data-uri embedding of "+i+" because its size ("+s.length+" characters) exceeds IE8-safe "+t+" characters!"),f(this,e||a)):new d(new c('"'+s+'"',s,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../logger":35,"../tree/quoted":76,"../tree/url":83,"./function-registry":24}],22:[function(a,b,c){var d=a("../tree/keyword"),e=a("./function-registry"),f={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;if(null!=a)return a?d.True:d.False},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}};e.add("default",f.eval.bind(f)),b.exports=f},{"../tree/keyword":68,"./function-registry":24}],23:[function(a,b,c){var d=a("../tree/expression"),e=function(a,b,c,d){this.name=a.toLowerCase(),this.index=c,this.context=b,this.currentFileInfo=d,this.func=b.frames[0].functionRegistry.get(this.name)};e.prototype.isValid=function(){return Boolean(this.func)},e.prototype.call=function(a){return Array.isArray(a)&&(a=a.filter(function(a){return"Comment"!==a.type}).map(function(a){if("Expression"===a.type){var b=a.value.filter(function(a){return"Comment"!==a.type});return 1===b.length?b[0]:new d(b)}return a})),this.func.apply(this,a)},b.exports=e},{"../tree/expression":62}],24:[function(a,b,c){function d(a){return{_data:{},add:function(a,b){a=a.toLowerCase(),this._data.hasOwnProperty(a),this._data[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){this.add(b,a[b])}.bind(this))},get:function(b){return this._data[b]||a&&a.get(b)},getLocalFunctions:function(){return this._data},inherit:function(){return d(this)},create:function(a){return d(a)}}}b.exports=d(null)},{}],25:[function(a,b,c){b.exports=function(b){var c={functionRegistry:a("./function-registry"),functionCaller:a("./function-caller")};return a("./default"),a("./color"),a("./color-blending"),a("./data-uri")(b),a("./math"),a("./number"),a("./string"),a("./svg")(b),a("./types"),c}},{"./color":20,"./color-blending":19,"./data-uri":21,"./default":22,"./function-caller":23,"./function-registry":24,"./math":27,"./number":28,"./string":29,"./svg":30,"./types":31}],26:[function(a,b,c){var d=a("../tree/dimension"),e=function(){};e._math=function(a,b,c){if(!(c instanceof d))throw{type:"Argument",message:"argument must be a number"};return null==b?b=c.unit:c=c.unify(),new d(a(parseFloat(c.value)),b)},b.exports=e},{"../tree/dimension":59}],27:[function(a,b,c){var d=a("./function-registry"),e=a("./math-helper.js"),f={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"};for(var g in f)f.hasOwnProperty(g)&&(f[g]=e._math.bind(null,Math[g],f[g])); +f.round=function(a,b){var c="undefined"==typeof b?0:b.value;return e._math(function(a){return a.toFixed(c)},null,a)},d.addMultiple(f)},{"./function-registry":24,"./math-helper.js":26}],28:[function(a,b,c){var d=a("../tree/dimension"),e=a("../tree/anonymous"),f=a("./function-registry"),g=a("./math-helper.js"),h=function(a,b){switch(b=Array.prototype.slice.call(b),b.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var c,f,g,h,i,j,k,l,m=[],n={};for(c=0;ci.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(b[c].value)&&Array.prototype.push.apply(b,Array.prototype.slice.call(b[c].value));return 1==m.length?m[0]:(b=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new e((a?"min":"max")+"("+b+")"))};f.addMultiple({min:function(){return h(!0,arguments)},max:function(){return h(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new d(Math.PI)},mod:function(a,b){return new d(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d(a),b=new d(b);else if(!(a instanceof d&&b instanceof d))throw{type:"Argument",message:"arguments must be numbers"};return new d(Math.pow(a.value,b.value),a.unit)},percentage:function(a){var b=g._math(function(a){return 100*a},"%",a);return b}})},{"../tree/anonymous":47,"../tree/dimension":59,"./function-registry":24,"./math-helper.js":26}],29:[function(a,b,c){var d=a("../tree/quoted"),e=a("../tree/anonymous"),f=a("../tree/javascript"),g=a("./function-registry");g.addMultiple({e:function(a){return new e(a instanceof f?a.evaluated:a.value)},escape:function(a){return new e(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,b,c,e){var f=a.value;return c="Quoted"===c.type?c.value:c.toCSS(),f=f.replace(new RegExp(b.value,e?e.value:""),c),new d(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;e",k=0;k";return j+="',j=encodeURIComponent(j),j="data:image/svg+xml,"+j,new g(new f("'"+j+"'",j,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":52,"../tree/dimension":59,"../tree/expression":62,"../tree/quoted":76,"../tree/url":83,"./function-registry":24}],31:[function(a,b,c){var d=a("../tree/keyword"),e=a("../tree/detached-ruleset"),f=a("../tree/dimension"),g=a("../tree/color"),h=a("../tree/quoted"),i=a("../tree/anonymous"),j=a("../tree/url"),k=a("../tree/operation"),l=a("./function-registry"),m=function(a,b){return a instanceof b?d.True:d.False},n=function(a,b){if(void 0===b)throw{type:"Argument",message:"missing the required second argument to isunit."};if(b="string"==typeof b.value?b.value:b,"string"!=typeof b)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof f&&a.unit.is(b)?d.True:d.False},o=function(a){var b=Array.isArray(a.value)?a.value:Array(a);return b};l.addMultiple({isruleset:function(a){return m(a,e)},iscolor:function(a){return m(a,g)},isnumber:function(a){return m(a,f)},isstring:function(a){return m(a,h)},iskeyword:function(a){return m(a,d)},isurl:function(a){return m(a,j)},ispixel:function(a){return n(a,"px")},ispercentage:function(a){return n(a,"%")},isem:function(a){return n(a,"em")},isunit:n,unit:function(a,b){if(!(a instanceof f))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof k?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d?b.value:b.toCSS():"",new f(a.value,b)},"get-unit":function(a){return new i(a.unit)},extract:function(a,b){return b=b.value-1,o(a)[b]},length:function(a){return new f(o(a).length)}})},{"../tree/anonymous":47,"../tree/color":52,"../tree/detached-ruleset":58,"../tree/dimension":59,"../tree/keyword":68,"../tree/operation":74,"../tree/quoted":76,"../tree/url":83,"./function-registry":24}],32:[function(a,b,c){var d=a("./contexts"),e=a("./parser/parser"),f=a("./less-error");b.exports=function(a){var b=function(a,b,c){this.less=a,this.rootFilename=c.filename,this.paths=b.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=b.mime,this.error=null,this.context=b,this.queue=[],this.files={}};return b.prototype.push=function(b,c,g,h,i){var j=this,k=this.context.pluginManager.Loader;this.queue.push(b);var l=function(a,c,d){j.queue.splice(j.queue.indexOf(b),1);var e=d===j.rootFilename;h.optional&&a?i(null,{rules:[]},!1,null):(j.files[d]=c,a&&!j.error&&(j.error=a),i(a,c,e,d))},m={relativeUrls:this.context.relativeUrls,entryPath:g.entryPath,rootpath:g.rootpath,rootFilename:g.rootFilename},n=a.getFileManager(b,g.currentDirectory,this.context,a);if(!n)return void l({message:"Could not find a file-manager for "+b});c&&(b=h.isPlugin?b:n.tryAppendExtension(b,".less"));var o,p=function(a){var b,c=a.filename,i=a.contents.replace(/^\uFEFF/,"");m.currentDirectory=n.getPath(c),m.relativeUrls&&(m.rootpath=n.join(j.context.rootpath||"",n.pathDiff(m.currentDirectory,m.entryPath)),!n.isPathAbsolute(m.rootpath)&&n.alwaysMakePathsAbsolute()&&(m.rootpath=n.join(m.entryPath,m.rootpath))),m.filename=c;var o=new d.Parse(j.context);o.processImports=!1,j.contents[c]=i,(g.reference||h.reference)&&(m.reference=!0),h.isPlugin?(b=k.evalPlugin(i,o,h.pluginArgs,m),b instanceof f?l(b,null,c):l(null,b,c)):h.inline?l(null,i,c):new e(o,j,m).parse(i,function(a,b){l(a,b,c)})},q=function(a,b){a?l(a):p(b)};if(h.isPlugin)try{k.tryLoadPlugin(b,g.currentDirectory,q)}catch(r){i(r)}else o=n.loadFile(b,g.currentDirectory,this.context,a,q),o&&o.then(p,l)},b}},{"./contexts":12,"./less-error":34,"./parser/parser":40}],33:[function(a,b,c){b.exports=function(b,c){var d,e,f,g,h,i={version:[3,0,0],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),AbstractPluginLoader:a("./environment/abstract-plugin-loader"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")};return i}},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":16,"./environment/abstract-plugin-loader":17,"./environment/environment":18,"./functions":25,"./import-manager":32,"./less-error":34,"./logger":35,"./parse":37,"./parse-tree":36,"./parser/parser":40,"./plugin-manager":41,"./render":42,"./source-map-builder":43,"./source-map-output":44,"./transform-tree":45,"./tree":65,"./utils":86,"./visitors":90}],34:[function(a,b,c){var d=a("./utils"),e=b.exports=function(a,b,c){Error.call(this);var e=a.filename||c;if(b&&e){var f=b.contents[e],g=d.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&d.getLocation(a.call,f).line,k=f.split("\n");this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.callLine=j+1,this.callExtract=k[j],this.column=i,this.extract=[k[h-1],k[h],k[h+1]]}this.message=a.message,this.stack=a.stack};if("undefined"==typeof Object.create){var f=function(){};f.prototype=Error.prototype,e.prototype=new f}else e.prototype=Object.create(Error.prototype);e.prototype.constructor=e},{"./utils":86}],35:[function(a,b,c){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;b=97&&j<=122||j<34))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(h96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;hd&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],39:[function(a,b,c){var d=a("./chunker");b.exports=function(){function a(d){for(var e,f,j,p=k.i,q=c,s=k.i-i,t=k.i+h.length-s,u=k.i+=d,v=b;k.i=0){j={index:k.i,text:v.substr(k.i,x+2-k.i),isLineComment:!1},k.i+=j.text.length-1,k.commentStore.push(j);continue}}break}if(e!==l&&e!==n&&e!==m&&e!==o)break}if(h=h.slice(d+k.i-u+s),i=k.i,!h.length){if(ce||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,c=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$re=function(b){k.i>i&&(h=h.slice(k.i-i),i=k.i);var c=b.exec(h);return c?(a(c[0].length),"string"==typeof c?c:1===c.length?c[0]:c):null},k.$char=function(c){return b.charAt(k.i)!==c?null:(a(1),c)},k.$str=function(c){for(var d=c.length,e=0;es||a=b.length;return k.i=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":38}],40:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=function j(a,b,c){function i(a,e){throw new d({index:o.i,filename:c.filename,type:e||"Syntax",message:a},b)}function k(a,b,c){var d=a instanceof Function?a.call(n):o.$re(a);return d?d:void i(b||("string"==typeof a?"expected '"+a+"' got '"+o.currentChar()+"'":"unexpected token"))}function l(a,b){return o.$char(a)?a:void i(b||"expected '"+a+"' got '"+o.currentChar()+"'")}function m(a){var b=c.filename;return{lineNumber:h.getLocation(a,o.getInput()).line+1,fileName:b}}var n,o=g();return{parse:function(g,h,i){var k,l,m,n,p=null,q="";if(l=i&&i.globalVars?j.serializeVars(i.globalVars)+"\n":"",m=i&&i.modifyVars?"\n"+j.serializeVars(i.modifyVars):"",a.pluginManager)for(var r=a.pluginManager.getPreProcessors(),s=0;s1&&(b=new e.Value(g)),d.push(b),g=[])}return o.forget(),a?d:f},literal:function(){return this.dimension()||this.color()||this.quoted()||this.unicodeDescriptor()},assignment:function(){var a,b;return o.save(),(a=o.$re(/^\w+(?=\s?=)/i))&&o.$char("=")&&(b=n.entity())?(o.forget(),new e.Assignment(a,b)):void o.restore()},url:function(){var a,b=o.i;return o.autoCommentAbsorb=!1,o.$str("url(")?(a=this.quoted()||this.variable()||o.$re(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",o.autoCommentAbsorb=!0,l(")"),new e.URL(null!=a.value||a instanceof e.Variable?a:new e.Anonymous(a),b,c)):void(o.autoCommentAbsorb=!0)},variable:function(){var a,b=o.i;if("@"===o.currentChar()&&(a=o.$re(/^@@?[\w-]+/)))return new e.Variable(a,b,c)},variableCurly:function(){var a,b=o.i;if("@"===o.currentChar()&&(a=o.$re(/^@\{([\w-]+)\}/)))return new e.Variable("@"+a[1],b,c)},color:function(){var a;if("#"===o.currentChar()&&(a=o.$re(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))){var b=a.input.match(/^#([\w]+).*/);return b=b[1],b.match(/^[A-Fa-f0-9]+$/)||i("Invalid HEX color code"),new e.Color(a[1],(void 0),"#"+b)}},colorKeyword:function(){o.save();var a=o.autoCommentAbsorb;o.autoCommentAbsorb=!1;var b=o.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/);if(o.autoCommentAbsorb=a,!b)return void o.forget();o.restore();var c=e.Color.fromKeyword(b);return c?(o.$str(b),c):void 0},dimension:function(){if(!o.peekNotNumeric()){var a=o.$re(/^([+-]?\d*\.?\d+)(%|[a-z_]+)?/i);return a?new e.Dimension(a[1],a[2]):void 0}},unicodeDescriptor:function(){var a;if(a=o.$re(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/))return new e.UnicodeDescriptor(a[0])},javascript:function(){var a,b=o.i;o.save();var d=o.$char("~"),f=o.$char("`");return f?(a=o.$re(/^[^`]*`/))?(o.forget(),new e.JavaScript(a.substr(0,a.length-1),Boolean(d),b,c)):void o.restore("invalid javascript definition"):void o.restore()}},variable:function(){var a;if("@"===o.currentChar()&&(a=o.$re(/^(@[\w-]+)\s*:/)))return a[1]},rulesetCall:function(){var a;if("@"===o.currentChar()&&(a=o.$re(/^(@[\w-]+)\(\s*\)\s*;/)))return new e.RulesetCall(a[1])},extend:function(a){var b,d,f,g,h,j=o.i;if(o.$str(a?"&:extend(":":extend(")){do{for(f=null,b=null;!(f=o.$re(/^(all)(?=\s*(\)|,))/))&&(d=this.element());)b?b.push(d):b=[d];f=f&&f[1],b||i("Missing target selector for :extend()."),h=new e.Extend(new e.Selector(b),f,j,c),g?g.push(h):g=[h]}while(o.$char(","));return k(/^\)/),a&&k(/^;/),g}},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var a,b,d,f,g,h,i=o.currentChar(),j=!1,k=o.i;if("."===i||"#"===i){for(o.save();;){if(a=o.i,f=o.$re(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/),!f)break;d=new e.Element(g,f,a,c),b?b.push(d):b=[d],g=o.$char(">")}return b&&(o.$char("(")&&(h=this.args(!0).args,l(")")),n.important()&&(j=!0),n.end())?(o.forget(),new e.mixin.Call(b,h,k,c,j)):void o.restore()}},args:function(a){var b,c,d,f,g,h,j,k=n.entities,l={args:null,variadic:!1},m=[],p=[],q=[];for(o.save();;){if(a)h=n.detachedRuleset()||n.expression();else{if(o.commentStore.length=0,o.$str("...")){l.variadic=!0,o.$char(";")&&!b&&(b=!0),(b?p:q).push({variadic:!0});break}h=k.variable()||k.literal()||k.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var r=null;if(a?h.value&&1==h.value.length&&(r=h.value[0]):r=h,r&&r instanceof e.Variable)if(o.$char(":")){if(m.length>0&&(b&&i("Cannot mix ; and , as delimiter types"),c=!0),g=n.detachedRuleset()||n.expression(),!g){if(!a)return o.restore(),l.args=[],l;i("could not understand value for named argument")}f=d=r.name}else if(o.$str("...")){if(!a){l.variadic=!0,o.$char(";")&&!b&&(b=!0),(b?p:q).push({name:h.name,variadic:!0});break}j=!0}else a||(d=f=r.name,g=null);g&&m.push(g),q.push({name:f,value:g,expand:j}),o.$char(",")||(o.$char(";")||b)&&(c&&i("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),p.push({name:d,value:g,expand:j}),d=null,m=[],c=!1)}return o.forget(),l.args=b?p:q,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==o.currentChar()&&"#"!==o.currentChar()||o.peek(/^[^{]*\}/)))if(o.save(),b=o.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!o.$char(")"))return void o.restore("Missing closing ')'");if(o.commentStore.length=0,o.$str("when")&&(d=k(n.conditions,"expected condition")),c=n.block())return o.forget(),new e.mixin.Definition(a,f,c,d,g);o.restore()}else o.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.call()||a.keyword()||a.javascript()},end:function(){return o.$char(";")||o.peek("}")},alpha:function(){var a;if(o.$re(/^opacity=/i))return a=o.$re(/^\d+/),a||(a=k(this.entities.variable,"Could not parse alpha")),l(")"),new e.Alpha(a)},element:function(){var a,b,d,f=o.i;if(b=this.combinator(),a=o.$re(/^(?:\d+\.\d+|\d+)%/)||o.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||o.$char("*")||o.$char("&")||this.attribute()||o.$re(/^\([^&()@]+\)/)||o.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(o.save(),o.$char("(")?(d=this.selector())&&o.$char(")")?(a=new e.Paren(d),o.forget()):o.restore("Missing closing ')'"):o.forget()),a)return new e.Element(b,a,f,c)},combinator:function(){var a=o.currentChar();if("/"===a){o.save();var b=o.$re(/^\/[a-z]+\//i);if(b)return o.forget(),new e.Combinator(b);o.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(o.i++,"^"===a&&"^"===o.currentChar()&&(a="^^",o.i++);o.isWhitespace();)o.i++;return new e.Combinator(a)}return new e.Combinator(o.isWhitespace(-1)?" ":null)},lessSelector:function(){return this.selector(!0)},selector:function(a){for(var b,d,f,g,h,j,l,m=o.i;(a&&(d=this.extend())||a&&(j=o.$str("when"))||(g=this.element()))&&(j?l=k(this.conditions,"expected condition"):l?i("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&i("Extend can only be used at the end of selector"),f=o.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,l,m,c):void(h&&i("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(o.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=k(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=o.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||o.$re(/^[0-9]+%/)||o.$re(/^[\w-]+/)||d.variableCurly()),l("]"),new e.Attribute(a,c,b)}},block:function(){var a;if(o.$char("{")&&(a=this.primary())&&o.$char("}"))return a},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();if(a)return new e.DetachedRuleset(a)},ruleset:function(){var b,c,d,f;for(o.save(),a.dumpLineNumbers&&(f=m(o.i));;){if(c=this.lessSelector(),!c)break;if(b?b.push(c):b=[c],o.commentStore.length=0,c.condition&&b.length>1&&i("Guards are only currently allowed on a single selector."),!o.$char(","))break;c.condition&&i("Guards are only currently allowed on a single selector."),o.commentStore.length=0}if(b&&(d=this.block())){o.forget();var g=new e.Ruleset(b,d,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}o.restore()},declaration:function(b){var d,f,g,h,i,j=o.i,k=o.currentChar();if("."!==k&&"#"!==k&&"&"!==k&&":"!==k)if(o.save(),d=this.variable()||this.ruleProperty()){if(i="string"==typeof d,i&&(f=this.detachedRuleset()),o.commentStore.length=0,!f){h=!i&&d.length>1&&d.pop().value;var l=!b&&(a.compress||i);if(l&&(f=this.value()),!f&&(f=this.anonymousValue()))return o.forget(),new e.Declaration(d,f,(!1),h,j,c);l||f||(f=this.value()),g=this.important()}if(f&&this.end())return o.forget(),new e.Declaration(d,f,g,h,j,c);if(o.restore(),f&&!b)return this.declaration(!0)}else o.forget()},anonymousValue:function(){var a=o.$re(/^([^@+\/'"*`(;{}-]*);/);if(a)return new e.Anonymous(a[1])},"import":function(){var a,b,d=o.i,f=o.$re(/^@import?\s+/);if(f){var g=(f?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),o.$char(";")||(o.i=d,i("missing semi-colon or unrecognised media features on import")),b=b&&new e.Value(b),new e.Import(a,b,g,d,c);o.i=d,i("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!o.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!o.$char(","))break}while(a);return l(")"),d},importOption:function(){var a=o.$re(/^(less|css|multiple|once|inline|reference|optional)/);if(a)return a[1]},mediaFeature:function(){var a,b,d=this.entities,f=[];o.save();do a=d.keyword()||d.variable(),a?f.push(a):o.$char("(")&&(b=this.property(),a=this.value(),o.$char(")")?b&&a?f.push(new e.Paren(new e.Declaration(b,a,null,null,o.i,c,(!0)))):a?f.push(new e.Paren(a)):i("badly formed media feature definition"):i("Missing closing ')'","Parse"));while(a);if(o.forget(),f.length>0)return new e.Expression(f)},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!o.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!o.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=o.i;return a.dumpLineNumbers&&(g=m(h)),o.save(),o.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||i("media definitions require block statements after any features"),o.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void o.restore()},plugin:function(){var a,b,d,f=o.i,g=o.$re(/^@plugin?\s+/);if(g){if(b=this.pluginArgs(),d=b?{pluginArgs:b,isPlugin:!0}:{isPlugin:!0},a=this.entities.quoted()||this.entities.url())return o.$char(";")||(o.i=f,i("missing semi-colon on @plugin")),new e.Import(a,null,d,f,c);o.i=f,i("malformed @plugin statement")}},pluginArgs:function(){if(o.save(),!o.$char("("))return o.restore(),null;var a=o.$re(/^\s*([^\);]+)\)\s*/);return a[1]?(o.forget(),a[1].trim()):(o.restore(),null)},atrule:function(){var b,d,f,g,h,j,k,l=o.i,n=!0,p=!0;if("@"===o.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(o.save(),b=o.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,n=!1;break;case"@namespace":j=!0,n=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,p=!1;break;default:k=!0}return o.commentStore.length=0,h?(d=this.entity(),d||i("expected "+b+" identifier")):j?(d=this.expression(),d||i("expected "+b+" expression")):k&&(d=(o.$re(/^[^{;]+/)||"").trim(),n="{"==o.currentChar(),d&&(d=new e.Anonymous(d))),n&&(f=this.blockRuleset()),f||!n&&d&&o.$char(";")?(o.forget(),new e.AtRule(b,d,f,l,c,a.dumpLineNumbers?m(l):null,p)):void o.restore("at-rule options not recognised")}}},value:function(){var a,b=[];do if(a=this.expression(),a&&(b.push(a),!o.$char(",")))break;while(a);if(b.length>0)return new e.Value(b)},important:function(){if("!"===o.currentChar())return o.$re(/^! *important/)},sub:function(){var a,b;return o.save(),o.$char("(")?(a=this.addition(),a&&o.$char(")")?(o.forget(),b=new e.Expression([a]),b.parens=!0,b):void o.restore("Expected ')'")):void o.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=o.isWhitespace(-1);;){if(o.peek(/^\/[*\/]/))break;if(o.save(),c=o.$char("/")||o.$char("*"),!c){o.forget();break}if(b=this.operand(),!b){o.restore();break}o.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=o.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=o.isWhitespace(-1);;){if(c=o.$re(/^[-+]\s+/)||!f&&(o.$char("+")||o.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=o.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=o.i;if(a=this.condition()){for(;;){if(!o.peek(/^,\s*(not\s*)?\(/)||!o.$char(","))break;if(b=this.condition(),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(){function a(){return o.$str("or")}var b,c,d;if(b=this.conditionAnd(this)){if(c=a()){if(d=this.condition(),!d)return;b=new e.Condition(c,b,d)}return b}},conditionAnd:function(){function a(a){return a.negatedCondition()||a.parenthesisCondition()}function b(){return o.$str("and")}var c,d,f;if(c=a(this)){if(d=b()){if(f=this.conditionAnd(),!f)return;c=new e.Condition(d,c,f)}return c}},negatedCondition:function(){if(o.$str("not")){var a=this.parenthesisCondition();return a&&(a.negate=!a.negate), +a}},parenthesisCondition:function(){function a(a){var b;return o.save(),(b=a.condition())&&o.$char(")")?(o.forget(),b):void o.restore()}var b;return o.save(),o.$str("(")?(b=a(this))?(o.forget(),b):(b=this.atomicCondition())?o.$char(")")?(o.forget(),b):void o.restore("expected ')' got '"+o.currentChar()+"'"):void o.restore():void o.restore()},atomicCondition:function(){var a,b,c,d,f=this.entities,g=o.i;if(a=this.addition()||f.keyword()||f.quoted())return o.$char(">")?d=o.$char("=")?">=":">":o.$char("<")?d=o.$char("=")?"<=":"<":o.$char("=")&&(d=o.$char(">")?"=>":o.$char("<")?"=<":"="),d?(b=this.addition()||f.keyword()||f.quoted(),b?c=new e.Condition(d,a,b,g,(!1)):i("expected expression")):c=new e.Condition("=",a,new e.Keyword("true"),g,(!1)),c},operand:function(){var a,b=this.entities;o.peek(/^-[@\(]/)&&(a=o.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.call()||b.colorKeyword();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[];do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),o.peek(/^\/[\/*]/)||(b=o.$char("/"),b&&c.push(new e.Anonymous(b)))));while(a);if(c.length>0)return new e.Expression(c)},property:function(){var a=o.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(a)return a[1]},ruleProperty:function(){function a(a){var b=o.i,c=o.$re(a);if(c)return g.push(b),f.push(c[1])}var b,d,f=[],g=[];o.save();var h=o.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],o.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:@\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(o.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;d=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},f.prototype.addPostProcessor=function(a,b){var c;for(c=0;c=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},f.prototype.addFileManager=function(a){this.fileManagers.push(a)},f.prototype.getPreProcessors=function(){for(var a=[],b=0;b0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],45:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Declaration("@"+a,b,(!1),null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j,k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor((!0)),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager)for(j=b.pluginManager.visitor(),j.first();i=j.get();)i.isPreEvalVisitor&&i.run(a);c=a.eval(h);for(var l=0;l.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(d="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":73}],56:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],57:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;c-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&c<1&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":15,"./color":52,"./node":73,"./unit":82}],60:[function(a,b,c){var d=a("./atrule"),e=function(){var a=Array.prototype.slice.call(arguments);d.apply(this,a)};e.prototype=Object.create(d.prototype),e.prototype.constructor=e,b.exports=e},{"./atrule":49}],61:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./combinator"),g=function(a,b,c,d,e){this.combinator=a instanceof f?a:new f(a),this.value="string"==typeof b?b.trim():b?b:"",this.index=c,this.currentFileInfo=d,this.copyVisibilityInfo(e)};g.prototype=new d,g.prototype.type="Element",g.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},g.prototype.eval=function(a){return new g(this.combinator,this.value.eval?this.value.eval(a):this.value,this.index,this.currentFileInfo,this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.index,this.currentFileInfo,this.visibilityInfo())},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.currentFileInfo,this.index)},g.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof e&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=g},{"./combinator":53,"./node":73,"./paren":75}],62:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./comment"),g=function(a){if(this.value=a,!a)throw new Error("Expression requires an array parameter")};g.prototype=new d,g.prototype.type="Expression",g.prototype.accept=function(a){this.value=a.visitArray(this.value)},g.prototype.eval=function(a){var b,c=this.parens&&!this.parensInOp,d=!1;return c&&a.inParenthesis(),this.value.length>1?b=new g(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(d=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!d&&(b=new e(b)),b},g.prototype.genCSS=function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":73,"./selector":80}],64:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=function(a,b,c,d,e,f){if(this.options=c,this.index=d,this.path=a,this.features=b,this.currentFileInfo=e,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?\/]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f)};j.prototype=new d,j.prototype.type="Import",j.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.isPlugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},j.prototype.genCSS=function(a,b){this.css&&void 0===this.path.currentFileInfo.reference&&(b.add("@import ",this.currentFileInfo,this.index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},j.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},j.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),!(a instanceof g)||a.containsVariables()},j.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new j(b.eval(a),this.features,this.options,this.index,this.currentFileInfo,this.visibilityInfo())},j.prototype.evalPath=function(a){var b=this.path.eval(a),c=this.currentFileInfo&&this.currentFileInfo.rootpath;if(!(b instanceof f)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d)}b.value=a.normalizePath(b.value)}return b},j.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){a.addVisibilityBlock()}):b.addVisibilityBlock()),b},j.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a);if(this.options.isPlugin)return this.root&&this.root.eval&&this.root.eval(a),c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[];if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var f=new i(this.root,0,{filename:this.importedFilename,reference:this.path.currentFileInfo&&this.path.currentFileInfo.reference},(!0),(!0));return this.features?new e([f],this.features.value):[f]}if(this.css){var g=new j(this.evalPath(a),d,this.options,this.index);if(!g.css&&this.error)throw this.error;return g}return b=new h(null,this.root.rules.slice(0)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=j},{"./anonymous":47,"./media":69,"./node":73,"./quoted":76,"./ruleset":79,"./url":83}],65:[function(a,b,c){var d={};d.Node=a("./node"),d.Alpha=a("./alpha"),d.Color=a("./color"),d.AtRule=a("./atrule"),d.Directive=a("./directive"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Declaration=a("./declaration"),d.Rule=a("./rule"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.RulesetCall=a("./ruleset-call"),b.exports=d},{"./alpha":46,"./anonymous":47,"./assignment":48,"./atrule":49,"./attribute":50,"./call":51,"./color":52,"./combinator":53,"./comment":54,"./condition":55,"./declaration":57,"./detached-ruleset":58,"./dimension":59,"./directive":60,"./element":61,"./expression":62,"./extend":63,"./import":64,"./javascript":66,"./keyword":68,"./media":69,"./mixin-call":70,"./mixin-definition":71,"./negative":72,"./node":73,"./operation":74,"./paren":75,"./quoted":76,"./rule":77,"./ruleset":79,"./ruleset-call":78,"./selector":80,"./unicode-descriptor":81,"./unit":82,"./url":83,"./value":84,"./variable":85}],66:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this.index=c,this.currentFileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new e(b):"string"==typeof b?new f('"'+b+'"',b,this.escaped,this.index):new g(Array.isArray(b)?b.join(", "):b)},b.exports=h},{"./anonymous":47,"./dimension":59,"./js-eval-node":67,"./quoted":76 +}],67:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(!b.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.currentFileInfo.filename,index:this.index};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.index,d.currentFileInfo).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.currentFileInfo.filename,index:this.index}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.currentFileInfo.filename,index:this.index}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":73,"./variable":85}],68:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":73}],69:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./atrule"),j=function(a,b,c,g,h){this.index=c,this.currentFileInfo=g;var i=new f([],null,null,this.index,this.currentFileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0};j.prototype=new i,j.prototype.type="Media",j.prototype.isRulesetLike=!0,j.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},j.prototype.genCSS=function(a,b){b.add("@media ",this.currentFileInfo,this.index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},j.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new j(null,[],this.index,this.currentFileInfo,this.visibilityInfo());this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo);var c=!1;a.strictMath||(c=!0,a.strictMath=!0);try{b.features=this.features.eval(a)}finally{c&&(a.strictMath=!1)}return a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},j.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.index,this.currentFileInfo).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo())}return delete a.mediaBlocks,delete a.mediaPath,b},j.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;b0;b--)a.splice(b,0,new g("and"));return new h(a)})),new d([],[])},j.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(n=!0,k=0;k0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.index,filename:this.currentFileInfo.filename};for(k=0;kthis.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;gb?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],74:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};g.prototype=new d,g.prototype.type="Operation",g.prototype.accept=function(a){this.operands=a.visit(this.operands)},g.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof f&&c instanceof e&&(b=b.toColor()),c instanceof f&&b instanceof e&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new g(this.op,[b,c],this.isSpaced)},g.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=g},{"./color":52,"./dimension":59,"./node":73}],75:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":73}],76:[function(a,b,c){var d=a("./node"),e=a("./js-eval-node"),f=a("./variable"),g=function(a,b,c,d,e){this.escaped=null==c||c,this.value=b||"",this.quote=a.charAt(0),this.index=d,this.currentFileInfo=e};g.prototype=new e,g.prototype.type="Quoted",g.prototype.genCSS=function(a,b){this.escaped||b.add(this.quote,this.currentFileInfo,this.index),b.add(this.value),this.escaped||b.add(this.quote)},g.prototype.containsVariables=function(){return this.value.match(/(`([^`]+)`)|@\{([\w-]+)\}/)},g.prototype.eval=function(a){function b(a,b,c){var d=a;do a=d,d=a.replace(b,c);while(a!==d);return d}var c=this,d=this.value,e=function(b,d){return String(c.evaluateJavaScript(d,a))},h=function(b,d){var e=new f("@"+d,c.index,c.currentFileInfo).eval(a,!0);return e instanceof g?e.value:e.toCSS()};return d=b(d,/`([^`]+)`/g,e),d=b(d,/@\{([\w-]+)\}/g,h),new g(this.quote+d+this.quote,d,this.escaped,this.index,this.currentFileInfo)},g.prototype.compare=function(a){return"Quoted"!==a.type||this.escaped||a.escaped?a.toCSS&&this.toCSS()===a.toCSS()?0:void 0:d.numericCompare(this.value,a.value)},b.exports=g},{"./js-eval-node":67,"./node":73,"./variable":85}],77:[function(a,b,c){var d=a("./declaration"),e=function(){var a=Array.prototype.slice.call(arguments);d.apply(this,a)};e.prototype=Object.create(d.prototype),e.prototype.constructor=e,b.exports=e},{"./declaration":57}],78:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(a){this.variable=a,this.allowRoot=!0};f.prototype=new d,f.prototype.type="RulesetCall",f.prototype.eval=function(a){var b=new e(this.variable).eval(a);return b.callEval(a)},b.exports=f},{"./node":73,"./variable":85}],79:[function(a,b,c){var d=a("./node"),e=a("./declaration"),f=a("./selector"),g=a("./element"),h=a("./paren"),i=a("../contexts"),j=a("../functions/function-registry"),k=a("../functions/default"),l=a("./debug-info"),m=function(a,b,c,d){this.selectors=a,this.rules=b,this._lookups={},this.strictImports=c,this.copyVisibilityInfo(d),this.allowRoot=!0};m.prototype=new d,m.prototype.type="Ruleset",m.prototype.isRuleset=!0,m.prototype.isRulesetLike=!0,m.prototype.accept=function(a){this.paths?this.paths=a.visitArray(this.paths,!0):this.selectors&&(this.selectors=a.visitArray(this.selectors)),this.rules&&this.rules.length&&(this.rules=a.visitArray(this.rules))},m.prototype.eval=function(a){var b,c,f,g,h=this.selectors,i=!1;if(h&&(c=h.length)){for(b=[],k.error({type:"Syntax",message:"it is currently only allowed in parametric mixin guards,"}),g=0;gd){if(!c||c(h)){e=h.find(new f(a.elements.slice(d)),b,c);for(var j=0;j0&&b.add(m),a.firstSelector=!0,i[0].genCSS(a,b),a.firstSelector=!1,f=1;f0?(e=a.slice(0),f=e.pop(),h=d.createDerived(f.elements.slice(0))):h=d.createDerived([]),b.length>0){var i=c.combinator,j=b[0].elements[0];i.emptyOrWhitespace&&!j.combinator.emptyOrWhitespace&&(i=j.combinator),h.elements.push(new g(i,j.value,c.index,c.currentFileInfo)),h.elements=h.elements.concat(b[0].elements.slice(1))}if(0!==h.elements.length&&e.push(h),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function j(a,b,c,d,e){var f;for(f=0;f0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new f(a))}}function l(a,b,c){function f(a){var b;return"Paren"!==a.value.type?null:(b=a.value.value,"Selector"!==b.type?null:b)}var h,m,n,o,p,q,r,s,t,u,v=!1;for(o=[],p=[[]],h=0;h0&&r[0].elements.push(new g(s.combinator,"",s.index,s.currentFileInfo)),q.push(r);else for(n=0;n0&&(a.push(p[h]),u=p[h][t-1],p[h][t-1]=u.createDerived(u.elements,c.extendList));return v}function m(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var n,o,p;if(o=[],p=l(o,b,c),!p)if(b.length>0)for(o=[],n=0;n0)for(b=0;b=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}}}},{}],87:[function(a,b,c){var d=a("../tree"),e=a("./visitor"),f=a("../logger"),g=function(){this._visitor=new e(this),this.contexts=[],this.allExtendsStack=[[]]};g.prototype={run:function(a){return a=this._visitor.visit(a),a.allExtends=this.allExtendsStack[0],a},visitDeclaration:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,e,f,g,h=[],i=a.rules,j=i?i.length:0;for(c=0;c=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.currentFileInfo,b),l.selfSelectors=h, +h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitDeclaration:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;e0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return k0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitAtRule:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitAtRuleOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=h},{"../logger":35,"../tree":65,"./visitor":94}],88:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],89:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};g.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,this.context.frames.slice(0)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.index,f.filename=a.currentFileInfo.filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;h0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];if(this.keepOnlyVisibleChilds(c),!this.isEmpty(c))return a.ensureVisibility(),a.removeVisibilityBlock(),a},isVisibleRuleset:function(a){return!!a.firstRoot||!this.isEmpty(a)&&!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitDeclaration:function(a,b){if(!a.blocksVisibility()&&!a.variable)return a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){if(!a.blocksVisibility()&&!a.isSilent(this._context))return a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){if(!a.blocksVisibility())return a},visitAtRule:function(a,b){return a.rules&&a.rules.length?this.visitAtRuleWithBody(a,b):this.visitAtRuleWithoutBody(a,b)},visitAtRuleWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitAtRuleWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;c0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;b=0;e--)if(c=a[e],c instanceof d.Declaration)if(f[c.name]){b=f[c.name],b instanceof d.Declaration&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);b.indexOf(g)!==-1?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b,c,e,f={},g=0;g1){c=b[0];var h=[],i=[];b.map(function(a){"+"===a.merge&&(i.length>0&&h.push(e(i)),i=[]),i.push(a)}),h.push(e(i)),c.value=g(h)}})}},visitAnonymous:function(a,b){if(!a.blocksVisibility())return a.accept(this._visitor),a}},b.exports=g},{"../tree":65,"./visitor":94}],94:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)if(a.hasOwnProperty(c))switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitFnCache=[],h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var c,e=this._visitFnCache,f=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=g;if(l.visitDeeper=!0,j||(c="visit"+a.type,j=f[c]||d,k=f[c+"Out"]||d,e[h]=j,e[i]=k),j!==d){var m=j.call(f,a,l);f.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=d&&k.call(f,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;ck){for(var b=0,c=h.length-j;b=0;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c--;c)a.unshift("..");return a}function d(a,b){if(a.filter)return a.filter(b);for(var c=[],d=0;d=-1&&!e;f--){var g=f>=0?arguments[f]:a.cwd();if("string"!=typeof g)throw new TypeError("Arguments to path.resolve must be strings");g&&(c=g+"/"+c,e="/"===g.charAt(0))}return c=b(d(c.split("/"),function(a){return!!a}),!e).join("/"),(e?"/":"")+c||"."},c.normalize=function(a){var e=c.isAbsolute(a),f="/"===g(a,-1);return a=b(d(a.split("/"),function(a){return!!a}),!e).join("/"),a||e||(a="."),a&&f&&(a+="/"),(e?"/":"")+a},c.isAbsolute=function(a){return"/"===a.charAt(0)},c.join=function(){var a=Array.prototype.slice.call(arguments,0);return c.normalize(d(a,function(a,b){if("string"!=typeof a)throw new TypeError("Arguments to path.join must be strings");return a}).join("/"))},c.relative=function(a,b){function d(a){for(var b=0;b=0&&""===a[c];c--);return b>c?[]:a.slice(b,c-b+1)}a=c.resolve(a).substr(1),b=c.resolve(b).substr(1);for(var e=d(a.split("/")),f=d(b.split("/")),g=Math.min(e.length,f.length),h=g,i=0;i1)for(var c=1;c parseInt(bVersion[i]) ? -1 : 1; diff --git a/lib/less/index.js b/lib/less/index.js index 74a6c5f77..31ed76ab7 100644 --- a/lib/less/index.js +++ b/lib/less/index.js @@ -2,7 +2,7 @@ module.exports = function(environment, fileManagers) { var SourceMapOutput, SourceMapBuilder, ParseTree, ImportManager, Environment; var less = { - version: [2, 8, 0], + version: [3, 0, 0], data: require('./data'), tree: require('./tree'), Environment: (Environment = require("./environment/environment")), diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js index 53000487c..4384d3556 100644 --- a/lib/less/parser/parser.js +++ b/lib/less/parser/parser.js @@ -1522,7 +1522,7 @@ var Parser = function Parser(context, imports, fileInfo) { ); } - parserInput.restore("atrule options not recognised"); + parserInput.restore("at-rule options not recognised"); }, // From 2766d40479e3038deb8eb3afaf8d0ec8a6d6b988 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Wed, 13 Jul 2016 12:01:50 -0700 Subject: [PATCH 12/97] Rename version to pre-release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 238275026..24d429e20 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "less", - "version": "3.0.0-alpha.1", + "version": "3.0.0-pre.1", "description": "Leaner CSS", "homepage": "http://lesscss.org", "author": { From b39b36f7009d1825fd3d851d9a7bfe38c99db91a Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Wed, 13 Jul 2016 12:03:56 -0700 Subject: [PATCH 13/97] Update dist files --- dist/less.js | 2 +- dist/less.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/less.js b/dist/less.js index 5749a0362..77097edc4 100644 --- a/dist/less.js +++ b/dist/less.js @@ -1,5 +1,5 @@ /*! - * Less - Leaner CSS v3.0.0-alpha.1 + * Less - Leaner CSS v3.0.0-pre.1 * http://lesscss.org * * Copyright (c) 2009-2016, Alexis Sellier diff --git a/dist/less.min.js b/dist/less.min.js index 2ca0306a2..e120f29f2 100644 --- a/dist/less.min.js +++ b/dist/less.min.js @@ -1,5 +1,5 @@ /*! - * Less - Leaner CSS v3.0.0-alpha.1 + * Less - Leaner CSS v3.0.0-pre.1 * http://lesscss.org * * Copyright (c) 2009-2016, Alexis Sellier From e309bf67a28417205a7573c22602f03dc5f00cd0 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Thu, 14 Jul 2016 02:07:15 -0700 Subject: [PATCH 14/97] Added the concept of inherited index / fileInfo for nodes --- .../environment/abstract-plugin-loader.js | 4 +- lib/less/functions/function-caller.js | 2 +- lib/less/tree/anonymous.js | 8 ++-- lib/less/tree/atrule.js | 11 +++--- lib/less/tree/call.js | 20 +++++----- lib/less/tree/color.js | 2 +- lib/less/tree/comment.js | 6 +-- lib/less/tree/condition.js | 2 +- lib/less/tree/declaration.js | 23 ++++++------ lib/less/tree/detached-ruleset.js | 6 ++- lib/less/tree/dimension.js | 1 + lib/less/tree/element.js | 19 +++++----- lib/less/tree/extend.js | 9 +++-- lib/less/tree/import.js | 23 +++++++----- lib/less/tree/javascript.js | 6 +-- lib/less/tree/js-eval-node.js | 14 +++---- lib/less/tree/media.js | 23 ++++++++---- lib/less/tree/mixin-call.js | 13 ++++--- lib/less/tree/mixin-definition.js | 13 ++++--- lib/less/tree/node.js | 31 ++++++++++++++++ lib/less/tree/quoted.js | 10 ++--- lib/less/tree/ruleset.js | 37 ++++++++++--------- lib/less/tree/selector.js | 12 +++--- lib/less/tree/unit.js | 9 +++-- lib/less/tree/url.js | 8 ++-- lib/less/tree/variable.js | 14 +++---- lib/less/utils.js | 9 +++++ lib/less/visitors/extend-visitor.js | 11 +++--- lib/less/visitors/import-visitor.js | 11 +++--- lib/less/visitors/to-css-visitor.js | 6 +-- test/less/plugin/plugin-transitive.js | 3 +- 31 files changed, 216 insertions(+), 150 deletions(-) diff --git a/lib/less/environment/abstract-plugin-loader.js b/lib/less/environment/abstract-plugin-loader.js index 2a51d3549..09b361b77 100644 --- a/lib/less/environment/abstract-plugin-loader.js +++ b/lib/less/environment/abstract-plugin-loader.js @@ -52,8 +52,8 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOp registry = functionRegistry.create(); try { - loader = new Function("module", "require", "functions", "tree", "fileInfo", "less", contents); - pluginObj = loader(localModule, this.require, registry, this.less.tree, fileInfo, this.less); + loader = new Function("module", "require", "functions", "tree", "fileInfo", contents); + pluginObj = loader(localModule, this.require, registry, this.less.tree, fileInfo); if (!pluginObj) { pluginObj = localModule.exports; diff --git a/lib/less/functions/function-caller.js b/lib/less/functions/function-caller.js index d5358b3f5..ba8a9e987 100644 --- a/lib/less/functions/function-caller.js +++ b/lib/less/functions/function-caller.js @@ -11,8 +11,8 @@ var functionCaller = function(name, context, index, currentFileInfo) { functionCaller.prototype.isValid = function() { return Boolean(this.func); }; -functionCaller.prototype.call = function(args) { +functionCaller.prototype.call = function(args) { // This code is terrible and should be replaced as per this issue... // https://github.com/less/less.js/issues/2477 if (Array.isArray(args)) { diff --git a/lib/less/tree/anonymous.js b/lib/less/tree/anonymous.js index ec4f31304..3b013cd0b 100644 --- a/lib/less/tree/anonymous.js +++ b/lib/less/tree/anonymous.js @@ -2,9 +2,9 @@ var Node = require("./node"); var Anonymous = function (value, index, currentFileInfo, mapLines, rulesetLike, visibilityInfo) { this.value = value; - this.index = index; + this._index = index; + this._fileInfo = currentFileInfo; this.mapLines = mapLines; - this.currentFileInfo = currentFileInfo; this.rulesetLike = (typeof rulesetLike === 'undefined') ? false : rulesetLike; this.allowRoot = true; this.copyVisibilityInfo(visibilityInfo); @@ -12,7 +12,7 @@ var Anonymous = function (value, index, currentFileInfo, mapLines, rulesetLike, Anonymous.prototype = new Node(); Anonymous.prototype.type = "Anonymous"; Anonymous.prototype.eval = function () { - return new Anonymous(this.value, this.index, this.currentFileInfo, this.mapLines, this.rulesetLike, this.visibilityInfo()); + return new Anonymous(this.value, this._index, this._fileInfo, this.mapLines, this.rulesetLike, this.visibilityInfo()); }; Anonymous.prototype.compare = function (other) { return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined; @@ -21,6 +21,6 @@ Anonymous.prototype.isRulesetLike = function() { return this.rulesetLike; }; Anonymous.prototype.genCSS = function (context, output) { - output.add(this.value, this.currentFileInfo, this.index, this.mapLines); + output.add(this.value, this._fileInfo, this._index, this.mapLines); }; module.exports = Anonymous; diff --git a/lib/less/tree/atrule.js b/lib/less/tree/atrule.js index 4a512d4e0..178ce8dee 100644 --- a/lib/less/tree/atrule.js +++ b/lib/less/tree/atrule.js @@ -12,14 +12,15 @@ var AtRule = function (name, value, rules, index, currentFileInfo, debugInfo, is this.rules = rules; } else { this.rules = [rules]; - this.rules[0].selectors = (new Selector([], null, null, this.index, currentFileInfo)).createEmptySelectors(); + this.rules[0].selectors = (new Selector([], null, null, index, currentFileInfo)).createEmptySelectors(); } for (i = 0; i < this.rules.length; i++) { this.rules[i].allowImports = true; } + this.setParent(this.rules, this); } - this.index = index; - this.currentFileInfo = currentFileInfo; + this._index = index; + this._fileInfo = currentFileInfo; this.debugInfo = debugInfo; this.isRooted = isRooted || false; this.copyVisibilityInfo(visibilityInfo); @@ -45,7 +46,7 @@ AtRule.prototype.isCharset = function() { }; AtRule.prototype.genCSS = function (context, output) { var value = this.value, rules = this.rules; - output.add(this.name, this.currentFileInfo, this.index); + output.add(this.name, this.fileInfo(), this.getIndex()); if (value) { output.add(' '); value.genCSS(context, output); @@ -80,7 +81,7 @@ AtRule.prototype.eval = function (context) { context.mediaBlocks = mediaBlocksBackup; return new AtRule(this.name, value, rules, - this.index, this.currentFileInfo, this.debugInfo, this.isRooted, this.visibilityInfo()); + this.getIndex(), this.fileInfo(), this.debugInfo, this.isRooted, this.visibilityInfo()); }; AtRule.prototype.variable = function (name) { if (this.rules) { diff --git a/lib/less/tree/call.js b/lib/less/tree/call.js index d95c9496d..f6604e243 100644 --- a/lib/less/tree/call.js +++ b/lib/less/tree/call.js @@ -6,8 +6,8 @@ var Node = require("./node"), var Call = function (name, args, index, currentFileInfo) { this.name = name; this.args = args; - this.index = index; - this.currentFileInfo = currentFileInfo; + this._index = index; + this._fileInfo = currentFileInfo; }; Call.prototype = new Node(); Call.prototype.type = "Call"; @@ -29,8 +29,8 @@ Call.prototype.accept = function (visitor) { // Call.prototype.eval = function (context) { var args = this.args.map(function (a) { return a.eval(context); }), - result, funcCaller = new FunctionCaller(this.name, context, this.index, this.currentFileInfo); - + result, funcCaller = new FunctionCaller(this.name, context, this.getIndex(), this.fileInfo()); + if (funcCaller.isValid()) { try { result = funcCaller.call(args); @@ -39,24 +39,24 @@ Call.prototype.eval = function (context) { type: e.type || "Runtime", message: "error evaluating function `" + this.name + "`" + (e.message ? ': ' + e.message : ''), - index: this.index, - filename: this.currentFileInfo.filename, + index: this.getIndex(), + filename: this.fileInfo().filename, line: e.lineNumber, column: e.columnNumber }; } if (result != null) { - result.index = this.index; - result.currentFileInfo = this.currentFileInfo; + result._index = this._index; + result._fileInfo = this._fileInfo; return result; } } - return new Call(this.name, args, this.index, this.currentFileInfo); + return new Call(this.name, args, this.getIndex(), this.fileInfo()); }; Call.prototype.genCSS = function (context, output) { - output.add(this.name + "(", this.currentFileInfo, this.index); + output.add(this.name + "(", this.fileInfo(), this.getIndex()); for (var i = 0; i < this.args.length; i++) { this.args[i].genCSS(context, output); diff --git a/lib/less/tree/color.js b/lib/less/tree/color.js index a694d5ff1..4218b9500 100644 --- a/lib/less/tree/color.js +++ b/lib/less/tree/color.js @@ -99,7 +99,7 @@ Color.prototype.toCSS = function (context, doNotCompress) { // we create a new Color node to hold the result. // Color.prototype.operate = function (context, op, other) { - var rgb = []; + var rgb = new Array(3); var alpha = this.alpha * (1 - other.alpha) + other.alpha; for (var c = 0; c < 3; c++) { rgb[c] = this._operate(context, op, this.rgb[c], other.rgb[c]); diff --git a/lib/less/tree/comment.js b/lib/less/tree/comment.js index b08c422af..a3cbfdcad 100644 --- a/lib/less/tree/comment.js +++ b/lib/less/tree/comment.js @@ -4,15 +4,15 @@ var Node = require("./node"), var Comment = function (value, isLineComment, index, currentFileInfo) { this.value = value; this.isLineComment = isLineComment; - this.index = index; - this.currentFileInfo = currentFileInfo; + this._index = index; + this._fileInfo = currentFileInfo; this.allowRoot = true; }; Comment.prototype = new Node(); Comment.prototype.type = "Comment"; Comment.prototype.genCSS = function (context, output) { if (this.debugInfo) { - output.add(getDebugInfo(context, this), this.currentFileInfo, this.index); + output.add(getDebugInfo(context, this), this.fileInfo(), this.getIndex()); } output.add(this.value); }; diff --git a/lib/less/tree/condition.js b/lib/less/tree/condition.js index 6b2b5365a..4c893089e 100644 --- a/lib/less/tree/condition.js +++ b/lib/less/tree/condition.js @@ -4,7 +4,7 @@ var Condition = function (op, l, r, i, negate) { this.op = op.trim(); this.lvalue = l; this.rvalue = r; - this.index = i; + this._index = i; this.negate = negate; }; Condition.prototype = new Node(); diff --git a/lib/less/tree/declaration.js b/lib/less/tree/declaration.js index f8f063bfa..f4a4e3a88 100644 --- a/lib/less/tree/declaration.js +++ b/lib/less/tree/declaration.js @@ -7,12 +7,13 @@ var Declaration = function (name, value, important, merge, index, currentFileInf this.value = (value instanceof Node) ? value : new Value([value]); //value instanceof tree.Value || value instanceof tree.Ruleset ?? this.important = important ? ' ' + important.trim() : ''; this.merge = merge; - this.index = index; - this.currentFileInfo = currentFileInfo; + this._index = index; + this._fileInfo = currentFileInfo; this.inline = inline || false; this.variable = (variable !== undefined) ? variable : (name.charAt && (name.charAt(0) === '@')); this.allowRoot = true; + this.setParent(this.value, this); }; function evalName(context, name) { @@ -27,16 +28,16 @@ function evalName(context, name) { Declaration.prototype = new Node(); Declaration.prototype.type = "Declaration"; Declaration.prototype.genCSS = function (context, output) { - output.add(this.name + (context.compress ? ':' : ': '), this.currentFileInfo, this.index); + output.add(this.name + (context.compress ? ':' : ': '), this.fileInfo(), this.getIndex()); try { this.value.genCSS(context, output); } catch(e) { - e.index = this.index; - e.filename = this.currentFileInfo.filename; + e.index = this._index; + e.filename = this._fileInfo.filename; throw e; } - output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? "" : ";"), this.currentFileInfo, this.index); + output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? "" : ";"), this._fileInfo, this._index); }; Declaration.prototype.eval = function (context) { var strictMathBypass = false, name = this.name, evaldValue, variable = this.variable; @@ -57,7 +58,7 @@ Declaration.prototype.eval = function (context) { if (!this.variable && evaldValue.type === "DetachedRuleset") { throw { message: "Rulesets cannot be evaluated on a property.", - index: this.index, filename: this.currentFileInfo.filename }; + index: this.getIndex(), filename: this.fileInfo().filename }; } var important = this.important, importantResult = context.importantScope.pop(); @@ -69,13 +70,13 @@ Declaration.prototype.eval = function (context) { evaldValue, important, this.merge, - this.index, this.currentFileInfo, this.inline, + this.getIndex(), this.fileInfo(), this.inline, variable); } catch(e) { if (typeof e.index !== 'number') { - e.index = this.index; - e.filename = this.currentFileInfo.filename; + e.index = this.getIndex(); + e.filename = this.fileInfo().filename; } throw e; } @@ -90,7 +91,7 @@ Declaration.prototype.makeImportant = function () { this.value, "!important", this.merge, - this.index, this.currentFileInfo, this.inline); + this.getIndex(), this.fileInfo(), this.inline); }; module.exports = Declaration; \ No newline at end of file diff --git a/lib/less/tree/detached-ruleset.js b/lib/less/tree/detached-ruleset.js index 01bbbc759..2805809fc 100644 --- a/lib/less/tree/detached-ruleset.js +++ b/lib/less/tree/detached-ruleset.js @@ -1,9 +1,11 @@ var Node = require("./node"), - contexts = require("../contexts"); + contexts = require("../contexts"), + utils = require("../utils"); var DetachedRuleset = function (ruleset, frames) { this.ruleset = ruleset; this.frames = frames; + this.setParent(this.ruleset, this); }; DetachedRuleset.prototype = new Node(); DetachedRuleset.prototype.type = "DetachedRuleset"; @@ -12,7 +14,7 @@ DetachedRuleset.prototype.accept = function (visitor) { this.ruleset = visitor.visit(this.ruleset); }; DetachedRuleset.prototype.eval = function (context) { - var frames = this.frames || context.frames.slice(0); + var frames = this.frames || utils.copyArray(context.frames); return new DetachedRuleset(this.ruleset, frames); }; DetachedRuleset.prototype.callEval = function (context) { diff --git a/lib/less/tree/dimension.js b/lib/less/tree/dimension.js index e3ce27ef1..db979a93e 100644 --- a/lib/less/tree/dimension.js +++ b/lib/less/tree/dimension.js @@ -10,6 +10,7 @@ var Dimension = function (value, unit) { this.value = parseFloat(value); this.unit = (unit && unit instanceof Unit) ? unit : new Unit(unit ? [unit] : undefined); + this.setParent(this.unit, this); }; Dimension.prototype = new Node(); diff --git a/lib/less/tree/element.js b/lib/less/tree/element.js index 4daf52956..c759f97f0 100644 --- a/lib/less/tree/element.js +++ b/lib/less/tree/element.js @@ -2,7 +2,7 @@ var Node = require("./node"), Paren = require("./paren"), Combinator = require("./combinator"); -var Element = function (combinator, value, index, currentFileInfo, info) { +var Element = function (combinator, value, index, currentFileInfo, visibilityInfo) { this.combinator = combinator instanceof Combinator ? combinator : new Combinator(combinator); @@ -13,9 +13,10 @@ var Element = function (combinator, value, index, currentFileInfo, info) { } else { this.value = ""; } - this.index = index; - this.currentFileInfo = currentFileInfo; - this.copyVisibilityInfo(info); + this._index = index; + this._fileInfo = currentFileInfo; + this.copyVisibilityInfo(visibilityInfo); + this.setParent(this.combinator, this); }; Element.prototype = new Node(); Element.prototype.type = "Element"; @@ -29,17 +30,17 @@ Element.prototype.accept = function (visitor) { Element.prototype.eval = function (context) { return new Element(this.combinator, this.value.eval ? this.value.eval(context) : this.value, - this.index, - this.currentFileInfo, this.visibilityInfo()); + this.getIndex(), + this.fileInfo(), this.visibilityInfo()); }; Element.prototype.clone = function () { return new Element(this.combinator, this.value, - this.index, - this.currentFileInfo, this.visibilityInfo()); + this.getIndex(), + this.fileInfo(), this.visibilityInfo()); }; Element.prototype.genCSS = function (context, output) { - output.add(this.toCSS(context), this.currentFileInfo, this.index); + output.add(this.toCSS(context), this.fileInfo(), this.getIndex()); }; Element.prototype.toCSS = function (context) { context = context || {}; diff --git a/lib/less/tree/extend.js b/lib/less/tree/extend.js index e91fbf77d..b3e8d49cf 100644 --- a/lib/less/tree/extend.js +++ b/lib/less/tree/extend.js @@ -4,10 +4,10 @@ var Node = require("./node"), var Extend = function Extend(selector, option, index, currentFileInfo, visibilityInfo) { this.selector = selector; this.option = option; - this.index = index; this.object_id = Extend.next_id++; this.parent_ids = [this.object_id]; - this.currentFileInfo = currentFileInfo || {}; + this._index = index; + this._fileInfo = currentFileInfo; this.copyVisibilityInfo(visibilityInfo); this.allowRoot = true; @@ -21,6 +21,7 @@ var Extend = function Extend(selector, option, index, currentFileInfo, visibilit this.allowAfter = false; break; } + this.setParent(this.selector, this); }; Extend.next_id = 0; @@ -30,10 +31,10 @@ Extend.prototype.accept = function (visitor) { this.selector = visitor.visit(this.selector); }; Extend.prototype.eval = function (context) { - return new Extend(this.selector.eval(context), this.option, this.index, this.currentFileInfo, this.visibilityInfo()); + return new Extend(this.selector.eval(context), this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo()); }; Extend.prototype.clone = function (context) { - return new Extend(this.selector, this.option, this.index, this.currentFileInfo, this.visibilityInfo()); + return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo()); }; //it concatenates (joins) all selectors in selector array Extend.prototype.findSelfSelectors = function (selectors) { diff --git a/lib/less/tree/import.js b/lib/less/tree/import.js index ef9636a9e..03c122b04 100644 --- a/lib/less/tree/import.js +++ b/lib/less/tree/import.js @@ -3,7 +3,8 @@ var Node = require("./node"), URL = require("./url"), Quoted = require("./quoted"), Ruleset = require("./ruleset"), - Anonymous = require("./anonymous"); + Anonymous = require("./anonymous"), + utils = require("../utils"); // // CSS @import node @@ -19,10 +20,10 @@ var Node = require("./node"), // var Import = function (path, features, options, index, currentFileInfo, visibilityInfo) { this.options = options; - this.index = index; + this._index = index; + this._fileInfo = currentFileInfo; this.path = path; this.features = features; - this.currentFileInfo = currentFileInfo; this.allowRoot = true; if (this.options.less !== undefined || this.options.inline) { @@ -34,6 +35,8 @@ var Import = function (path, features, options, index, currentFileInfo, visibili } } this.copyVisibilityInfo(visibilityInfo); + this.setParent(this.features, this); + this.setParent(this.path, this); }; // @@ -57,8 +60,8 @@ Import.prototype.accept = function (visitor) { } }; Import.prototype.genCSS = function (context, output) { - if (this.css && this.path.currentFileInfo.reference === undefined) { - output.add("@import ", this.currentFileInfo, this.index); + if (this.css && this.path._fileInfo.reference === undefined) { + output.add("@import ", this._fileInfo, this._index); this.path.genCSS(context, output); if (this.features) { output.add(" "); @@ -89,11 +92,11 @@ Import.prototype.evalForImport = function (context) { path = path.value; } - return new Import(path.eval(context), this.features, this.options, this.index, this.currentFileInfo, this.visibilityInfo()); + return new Import(path.eval(context), this.features, this.options, this._index, this._fileInfo, this.visibilityInfo()); }; Import.prototype.evalPath = function (context) { var path = this.path.eval(context); - var rootpath = this.currentFileInfo && this.currentFileInfo.rootpath; + var rootpath = this._fileInfo && this._fileInfo.rootpath; if (!(path instanceof URL)) { if (rootpath) { @@ -149,18 +152,18 @@ Import.prototype.doEval = function (context) { var contents = new Anonymous(this.root, 0, { filename: this.importedFilename, - reference: this.path.currentFileInfo && this.path.currentFileInfo.reference + reference: this.path._fileInfo && this.path._fileInfo.reference }, true, true); return this.features ? new Media([contents], this.features.value) : [contents]; } else if (this.css) { - var newImport = new Import(this.evalPath(context), features, this.options, this.index); + var newImport = new Import(this.evalPath(context), features, this.options, this._index); if (!newImport.css && this.error) { throw this.error; } return newImport; } else { - ruleset = new Ruleset(null, this.root.rules.slice(0)); + ruleset = new Ruleset(null, utils.copyArray(this.root.rules)); ruleset.evalImports(context); return this.features ? new Media(ruleset.rules, this.features.value) : ruleset.rules; diff --git a/lib/less/tree/javascript.js b/lib/less/tree/javascript.js index 157738275..e2ee01371 100644 --- a/lib/less/tree/javascript.js +++ b/lib/less/tree/javascript.js @@ -6,8 +6,8 @@ var JsEvalNode = require("./js-eval-node"), var JavaScript = function (string, escaped, index, currentFileInfo) { this.escaped = escaped; this.expression = string; - this.index = index; - this.currentFileInfo = currentFileInfo; + this._index = index; + this._fileInfo = currentFileInfo; }; JavaScript.prototype = new JsEvalNode(); JavaScript.prototype.type = "JavaScript"; @@ -17,7 +17,7 @@ JavaScript.prototype.eval = function(context) { if (typeof result === 'number') { return new Dimension(result); } else if (typeof result === 'string') { - return new Quoted('"' + result + '"', result, this.escaped, this.index); + return new Quoted('"' + result + '"', result, this.escaped, this._index); } else if (Array.isArray(result)) { return new Anonymous(result.join(', ')); } else { diff --git a/lib/less/tree/js-eval-node.js b/lib/less/tree/js-eval-node.js index a4410b232..b5e37bbe0 100644 --- a/lib/less/tree/js-eval-node.js +++ b/lib/less/tree/js-eval-node.js @@ -12,20 +12,20 @@ JsEvalNode.prototype.evaluateJavaScript = function (expression, context) { if (!context.javascriptEnabled) { throw { message: "Inline JavaScript is not enabled. Is it set in your options?", - filename: this.currentFileInfo.filename, - index: this.index }; + filename: this.fileInfo().filename, + index: this.getIndex() }; } expression = expression.replace(/@\{([\w-]+)\}/g, function (_, name) { - return that.jsify(new Variable('@' + name, that.index, that.currentFileInfo).eval(context)); + return that.jsify(new Variable('@' + name, that.getIndex(), that.fileInfo()).eval(context)); }); try { expression = new Function('return (' + expression + ')'); } catch (e) { throw { message: "JavaScript evaluation error: " + e.message + " from `" + expression + "`" , - filename: this.currentFileInfo.filename, - index: this.index }; + filename: this.fileInfo().filename, + index: this.getIndex() }; } var variables = context.frames[0].variables(); @@ -45,8 +45,8 @@ JsEvalNode.prototype.evaluateJavaScript = function (expression, context) { result = expression.call(evalContext); } catch (e) { throw { message: "JavaScript evaluation error: '" + e.name + ': ' + e.message.replace(/["]/g, "'") + "'" , - filename: this.currentFileInfo.filename, - index: this.index }; + filename: this.fileInfo().filename, + index: this.getIndex() }; } return result; }; diff --git a/lib/less/tree/media.js b/lib/less/tree/media.js index bfba0e36f..0ef4db2c3 100644 --- a/lib/less/tree/media.js +++ b/lib/less/tree/media.js @@ -3,19 +3,23 @@ var Ruleset = require("./ruleset"), Selector = require("./selector"), Anonymous = require("./anonymous"), Expression = require("./expression"), - AtRule = require("./atrule"); + AtRule = require("./atrule"), + utils = require("../utils"); var Media = function (value, features, index, currentFileInfo, visibilityInfo) { - this.index = index; - this.currentFileInfo = currentFileInfo; + this._index = index; + this._fileInfo = currentFileInfo; - var selectors = (new Selector([], null, null, this.index, this.currentFileInfo)).createEmptySelectors(); + var selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors(); this.features = new Value(features); this.rules = [new Ruleset(selectors, value)]; this.rules[0].allowImports = true; this.copyVisibilityInfo(visibilityInfo); this.allowRoot = true; + this.setParent(selectors, this); + this.setParent(this.features, this); + this.setParent(this.rules, this); }; Media.prototype = new AtRule(); Media.prototype.type = "Media"; @@ -29,7 +33,7 @@ Media.prototype.accept = function (visitor) { } }; Media.prototype.genCSS = function (context, output) { - output.add('@media ', this.currentFileInfo, this.index); + output.add('@media ', this._fileInfo, this._index); this.features.genCSS(context, output); this.outputRuleset(context, output, this.rules); }; @@ -39,7 +43,7 @@ Media.prototype.eval = function (context) { context.mediaPath = []; } - var media = new Media(null, [], this.index, this.currentFileInfo, this.visibilityInfo()); + var media = new Media(null, [], this._index, this._fileInfo, this.visibilityInfo()); if (this.debugInfo) { this.rules[0].debugInfo = this.debugInfo; media.debugInfo = this.debugInfo; @@ -76,10 +80,11 @@ Media.prototype.evalTop = function (context) { // Render all dependent Media blocks. if (context.mediaBlocks.length > 1) { - var selectors = (new Selector([], null, null, this.index, this.currentFileInfo)).createEmptySelectors(); + var selectors = (new Selector([], null, null, this.getIndex(), this.fileInfo())).createEmptySelectors(); result = new Ruleset(selectors, context.mediaBlocks); result.multiMedia = true; result.copyVisibilityInfo(this.visibilityInfo()); + this.setParent(result, this); } delete context.mediaBlocks; @@ -116,6 +121,7 @@ Media.prototype.evalNested = function (context) { return new Expression(path); })); + this.setParent(this.features, this); // Fake a tree-node that doesn't output anything. return new Ruleset([], []); @@ -140,6 +146,7 @@ Media.prototype.bubbleSelectors = function (selectors) { if (!selectors) { return; } - this.rules = [new Ruleset(selectors.slice(0), [this.rules[0]])]; + this.rules = [new Ruleset(utils.copyArray(selectors), [this.rules[0]])]; + this.setParent(this.rules, this); }; module.exports = Media; diff --git a/lib/less/tree/mixin-call.js b/lib/less/tree/mixin-call.js index 5864a0c36..7b1d0c0bc 100644 --- a/lib/less/tree/mixin-call.js +++ b/lib/less/tree/mixin-call.js @@ -6,10 +6,11 @@ var Node = require("./node"), var MixinCall = function (elements, args, index, currentFileInfo, important) { this.selector = new Selector(elements); this.arguments = args || []; - this.index = index; - this.currentFileInfo = currentFileInfo; + this._index = index; + this._fileInfo = currentFileInfo; this.important = important; this.allowRoot = true; + this.setParent(this.selector, this); }; MixinCall.prototype = new Node(); MixinCall.prototype.type = "MixinCall"; @@ -117,7 +118,7 @@ MixinCall.prototype.eval = function (context) { if ((count[defTrue] + count[defFalse]) > 1) { throw { type: 'Runtime', message: 'Ambiguous use of `default()` found when matching for `' + this.format(args) + '`', - index: this.index, filename: this.currentFileInfo.filename }; + index: this.getIndex(), filename: this.fileInfo().filename }; } } @@ -135,7 +136,7 @@ MixinCall.prototype.eval = function (context) { this._setVisibilityToReplacement(newRules); Array.prototype.push.apply(rules, newRules); } catch (e) { - throw { message: e.message, index: this.index, filename: this.currentFileInfo.filename, stack: e.stack }; + throw { message: e.message, index: this.getIndex(), filename: this.fileInfo().filename, stack: e.stack }; } } } @@ -148,11 +149,11 @@ MixinCall.prototype.eval = function (context) { if (isOneFound) { throw { type: 'Runtime', message: 'No matching definition was found for `' + this.format(args) + '`', - index: this.index, filename: this.currentFileInfo.filename }; + index: this.getIndex(), filename: this.fileInfo().filename }; } else { throw { type: 'Name', message: this.selector.toCSS().trim() + " is undefined", - index: this.index, filename: this.currentFileInfo.filename }; + index: this.getIndex(), filename: this.fileInfo().filename }; } }; diff --git a/lib/less/tree/mixin-definition.js b/lib/less/tree/mixin-definition.js index d2c366c03..3437cec6b 100644 --- a/lib/less/tree/mixin-definition.js +++ b/lib/less/tree/mixin-definition.js @@ -3,11 +3,12 @@ var Selector = require("./selector"), Ruleset = require("./ruleset"), Declaration = require("./declaration"), Expression = require("./expression"), - contexts = require("../contexts"); + contexts = require("../contexts"), + utils = require("../utils"); var Definition = function (name, params, rules, condition, variadic, frames, visibilityInfo) { this.name = name; - this.selectors = [new Selector([new Element(null, name, this.index, this.currentFileInfo)])]; + this.selectors = [new Selector([new Element(null, name, this._index, this._fileInfo)])]; this.params = params; this.condition = condition; this.variadic = variadic; @@ -45,7 +46,7 @@ Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArgume /*jshint boss:true */ var frame = new Ruleset(null, null), varargs, arg, - params = this.params.slice(0), + params = utils.copyArray(this.params), i, j, val, name, isNamedFound, argIndex, argsLength = 0; if (mixinEnv.frames && mixinEnv.frames[0] && mixinEnv.frames[0].functionRegistry) { @@ -54,7 +55,7 @@ Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArgume mixinEnv = new contexts.Eval(mixinEnv, [frame].concat(mixinEnv.frames)); if (args) { - args = args.slice(0); + args = utils.copyArray(args); argsLength = args.length; for (i = 0; i < argsLength; i++) { @@ -132,7 +133,7 @@ Definition.prototype.makeImportant = function() { return result; }; Definition.prototype.eval = function (context) { - return new Definition(this.name, this.params, this.rules, this.condition, this.variadic, this.frames || context.frames.slice(0)); + return new Definition(this.name, this.params, this.rules, this.condition, this.variadic, this.frames || utils.copyArray(context.frames)); }; Definition.prototype.evalCall = function (context, args, important) { var _arguments = [], @@ -142,7 +143,7 @@ Definition.prototype.evalCall = function (context, args, important) { frame.prependRule(new Declaration('@arguments', new Expression(_arguments).eval(context))); - rules = this.rules.slice(0); + rules = utils.copyArray(this.rules); ruleset = new Ruleset(null, rules); ruleset.originalRuleset = this; diff --git a/lib/less/tree/node.js b/lib/less/tree/node.js index 50e122a25..2b89ea25a 100644 --- a/lib/less/tree/node.js +++ b/lib/less/tree/node.js @@ -1,4 +1,35 @@ var Node = function() { + this.parent = null; + this.visibilityBlocks = undefined; + this.nodeVisible = undefined; + + var self = this; + Object.defineProperty(this, "currentFileInfo", { + get: function() { return self.fileInfo(); } + }); + Object.defineProperty(this, "index", { + get: function() { return self.getIndex(); } + }); + +}; +Node.prototype.setParent = function(nodes, parent) { + function set(node) { + if (node && node instanceof Node) { + node.parent = parent; + } + } + if (Array.isArray(nodes)) { + nodes.forEach(set); + } + else { + set(nodes); + } +}; +Node.prototype.getIndex = function() { + return this._index || (this.parent && this.parent.getIndex()) || 0; +}; +Node.prototype.fileInfo = function() { + return this._fileInfo || (this.parent && this.parent.fileInfo()) || {}; }; Node.prototype.toCSS = function (context) { var strs = []; diff --git a/lib/less/tree/quoted.js b/lib/less/tree/quoted.js index e1be87d10..07d5d1bd4 100644 --- a/lib/less/tree/quoted.js +++ b/lib/less/tree/quoted.js @@ -6,14 +6,14 @@ var Quoted = function (str, content, escaped, index, currentFileInfo) { this.escaped = (escaped == null) ? true : escaped; this.value = content || ''; this.quote = str.charAt(0); - this.index = index; - this.currentFileInfo = currentFileInfo; + this._index = index; + this._fileInfo = currentFileInfo; }; Quoted.prototype = new JsEvalNode(); Quoted.prototype.type = "Quoted"; Quoted.prototype.genCSS = function (context, output) { if (!this.escaped) { - output.add(this.quote, this.currentFileInfo, this.index); + output.add(this.quote, this.fileInfo(), this.getIndex()); } output.add(this.value); if (!this.escaped) { @@ -29,7 +29,7 @@ Quoted.prototype.eval = function (context) { return String(that.evaluateJavaScript(exp, context)); }; var interpolationReplacement = function (_, name) { - var v = new Variable('@' + name, that.index, that.currentFileInfo).eval(context, true); + var v = new Variable('@' + name, that.getIndex(), that.fileInfo()).eval(context, true); return (v instanceof Quoted) ? v.value : v.toCSS(); }; function iterativeReplace(value, regexp, replacementFnc) { @@ -42,7 +42,7 @@ Quoted.prototype.eval = function (context) { } value = iterativeReplace(value, /`([^`]+)`/g, javascriptReplacement); value = iterativeReplace(value, /@\{([\w-]+)\}/g, interpolationReplacement); - return new Quoted(this.quote + value + this.quote, value, this.escaped, this.index, this.currentFileInfo); + return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo()); }; Quoted.prototype.compare = function (other) { // when comparing quoted strings allow the quote to differ diff --git a/lib/less/tree/ruleset.js b/lib/less/tree/ruleset.js index 08dc53b50..dc8a530bc 100644 --- a/lib/less/tree/ruleset.js +++ b/lib/less/tree/ruleset.js @@ -6,7 +6,8 @@ var Node = require("./node"), contexts = require("../contexts"), globalFunctionRegistry = require("../functions/function-registry"), defaultFunc = require("../functions/default"), - getDebugInfo = require("./debug-info"); + getDebugInfo = require("./debug-info"), + utils = require("../utils"); var Ruleset = function (selectors, rules, strictImports, visibilityInfo) { this.selectors = selectors; @@ -15,6 +16,11 @@ var Ruleset = function (selectors, rules, strictImports, visibilityInfo) { this.strictImports = strictImports; this.copyVisibilityInfo(visibilityInfo); this.allowRoot = true; + this.setParent(this.selectors, this); + this.setParent(this.rules, this); + + this.types = Object.create(null); + }; Ruleset.prototype = new Node(); Ruleset.prototype.type = "Ruleset"; @@ -35,14 +41,14 @@ Ruleset.prototype.eval = function (context) { selCnt, selector, i, hasOnePassingSelector = false; if (thisSelectors && (selCnt = thisSelectors.length)) { - selectors = []; + selectors = new Array(selCnt); defaultFunc.error({ type: "Syntax", message: "it is currently only allowed in parametric mixin guards," }); for (i = 0; i < selCnt; i++) { selector = thisSelectors[i].eval(context); - selectors.push(selector); + selectors[i] = selector; if (selector.evaldCondition) { hasOnePassingSelector = true; } @@ -52,7 +58,7 @@ Ruleset.prototype.eval = function (context) { hasOnePassingSelector = true; } - var rules = this.rules ? this.rules.slice(0) : null, + var rules = this.rules ? utils.copyArray(this.rules) : null, ruleset = new Ruleset(selectors, rules, this.strictImports, this.visibilityInfo()), rule, subRule; @@ -281,6 +287,7 @@ Ruleset.prototype.prependRule = function (rule) { } else { this.rules = [ rule ]; } + this.setParent(rule, this); }; Ruleset.prototype.find = function (selector, self, filter) { self = self || this; @@ -453,9 +460,9 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { if (elementsToPak.length === 0) { replacementParen = new Paren(elementsToPak[0]); } else { - var insideParent = []; + var insideParent = new Array(elementsToPak.length); for (j = 0; j < elementsToPak.length; j++) { - insideParent.push(new Element(null, elementsToPak[j], originalElement.index, originalElement.currentFileInfo)); + insideParent[j] = new Element(null, elementsToPak[j], originalElement._index, originalElement._fileInfo); } replacementParen = new Paren(new Selector(insideParent)); } @@ -464,7 +471,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { function createSelector(containedElement, originalElement) { var element, selector; - element = new Element(null, containedElement, originalElement.index, originalElement.currentFileInfo); + element = new Element(null, containedElement, originalElement._index, originalElement._fileInfo); selector = new Selector([element]); return selector; } @@ -480,9 +487,9 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { //construct the joined selector - if & is the first thing this will be empty, // if not newJoinedSelector will be the last set of elements in the selector if (beginningPath.length > 0) { - newSelectorPath = beginningPath.slice(0); + newSelectorPath = utils.copyArray(beginningPath); lastSelector = newSelectorPath.pop(); - newJoinedSelector = originalSelector.createDerived(lastSelector.elements.slice(0)); + newJoinedSelector = originalSelector.createDerived(utils.copyArray(lastSelector.elements)); } else { newJoinedSelector = originalSelector.createDerived([]); @@ -498,7 +505,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { combinator = parentEl.combinator; } // join the elements so far with the first part of the parent - newJoinedSelector.elements.push(new Element(combinator, parentEl.value, replacedElement.index, replacedElement.currentFileInfo)); + newJoinedSelector.elements.push(new Element(combinator, parentEl.value, replacedElement._index, replacedElement._fileInfo)); newJoinedSelector.elements = newJoinedSelector.elements.concat(addPath[0].elements.slice(1)); } @@ -635,7 +642,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { // the combinator used on el should now be applied to the next element instead so that // it is not lost if (sel.length > 0) { - sel[0].elements.push(new Element(el.combinator, '', el.index, el.currentFileInfo)); + sel[0].elements.push(new Element(el.combinator, '', el._index, el._fileInfo)); } selectorsMultiplied.push(sel); } @@ -667,7 +674,6 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { paths.push(newSelectors[i]); lastSelector = newSelectors[i][length - 1]; newSelectors[i][length - 1] = lastSelector.createDerived(lastSelector.elements, inSelector.extendList); - //newSelectors[i][length - 1].copyVisibilityInfo(inSelector.visibilityInfo()); } } @@ -690,12 +696,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { if (context.length > 0) { newPaths = []; for (i = 0; i < context.length; i++) { - //var concatenated = []; - //context[i].forEach(function(entry) { - // var newEntry = entry.createDerived(entry.elements, entry.extendList, entry.evaldCondition); - // newEntry.copyVisibilityInfo(selector.visibilityInfo()); - // concatenated.push(newEntry); - //}, this); + var concatenated = context[i].map(deriveSelector.bind(this, selector.visibilityInfo())); concatenated.push(selector); diff --git a/lib/less/tree/selector.js b/lib/less/tree/selector.js index cb5beee10..20bd9401c 100644 --- a/lib/less/tree/selector.js +++ b/lib/less/tree/selector.js @@ -5,11 +5,13 @@ var Selector = function (elements, extendList, condition, index, currentFileInfo this.elements = elements; this.extendList = extendList; this.condition = condition; - this.currentFileInfo = currentFileInfo || {}; + this._index = index; + this._fileInfo = currentFileInfo; if (!condition) { this.evaldCondition = true; } this.copyVisibilityInfo(visibilityInfo); + this.setParent(this.elements, this); }; Selector.prototype = new Node(); Selector.prototype.type = "Selector"; @@ -27,14 +29,14 @@ Selector.prototype.accept = function (visitor) { Selector.prototype.createDerived = function(elements, extendList, evaldCondition) { var info = this.visibilityInfo(); evaldCondition = (evaldCondition != null) ? evaldCondition : this.evaldCondition; - var newSelector = new Selector(elements, extendList || this.extendList, null, this.index, this.currentFileInfo, info); + var newSelector = new Selector(elements, extendList || this.extendList, null, this.getIndex(), this.fileInfo(), info); newSelector.evaldCondition = evaldCondition; newSelector.mediaEmpty = this.mediaEmpty; return newSelector; }; Selector.prototype.createEmptySelectors = function() { - var el = new Element('', '&', this.index, this.currentFileInfo), - sels = [new Selector([el], null, null, this.index, this.currentFileInfo)]; + var el = new Element('', '&', this._index, this._fileInfo), + sels = [new Selector([el], null, null, this._index, this._fileInfo)]; sels[0].mediaEmpty = true; return sels; }; @@ -95,7 +97,7 @@ Selector.prototype.eval = function (context) { Selector.prototype.genCSS = function (context, output) { var i, element; if ((!context || !context.firstSelector) && this.elements[0].combinator.value === "") { - output.add(' ', this.currentFileInfo, this.index); + output.add(' ', this.fileInfo(), this.getIndex()); } if (!this._css) { //TODO caching? speed comparison? diff --git a/lib/less/tree/unit.js b/lib/less/tree/unit.js index aa53124d0..b94a795be 100644 --- a/lib/less/tree/unit.js +++ b/lib/less/tree/unit.js @@ -1,9 +1,10 @@ var Node = require("./node"), - unitConversions = require("../data/unit-conversions"); + unitConversions = require("../data/unit-conversions"), + utils = require("../utils"); var Unit = function (numerator, denominator, backupUnit) { - this.numerator = numerator ? numerator.slice(0).sort() : []; - this.denominator = denominator ? denominator.slice(0).sort() : []; + this.numerator = numerator ? utils.copyArray(numerator).sort() : []; + this.denominator = denominator ? utils.copyArray(denominator).sort() : []; if (backupUnit) { this.backupUnit = backupUnit; } else if (numerator && numerator.length) { @@ -14,7 +15,7 @@ var Unit = function (numerator, denominator, backupUnit) { Unit.prototype = new Node(); Unit.prototype.type = "Unit"; Unit.prototype.clone = function () { - return new Unit(this.numerator.slice(0), this.denominator.slice(0), this.backupUnit); + return new Unit(utils.copyArray(this.numerator), utils.copyArray(this.denominator), this.backupUnit); }; Unit.prototype.genCSS = function (context, output) { // Dimension checks the unit is singular and throws an error if in strict math mode. diff --git a/lib/less/tree/url.js b/lib/less/tree/url.js index 65347af43..fa0d4c871 100644 --- a/lib/less/tree/url.js +++ b/lib/less/tree/url.js @@ -2,8 +2,8 @@ var Node = require("./node"); var URL = function (val, index, currentFileInfo, isEvald) { this.value = val; - this.currentFileInfo = currentFileInfo; - this.index = index; + this._index = index; + this._fileInfo = currentFileInfo; this.isEvald = isEvald; }; URL.prototype = new Node(); @@ -22,7 +22,7 @@ URL.prototype.eval = function (context) { if (!this.isEvald) { // Add the base path if the URL is relative - rootpath = this.currentFileInfo && this.currentFileInfo.rootpath; + rootpath = this.fileInfo() && this.fileInfo().rootpath; if (rootpath && typeof val.value === "string" && context.isPathRelative(val.value)) { @@ -49,6 +49,6 @@ URL.prototype.eval = function (context) { } } - return new URL(val, this.index, this.currentFileInfo, true); + return new URL(val, this.getIndex(), this.fileInfo(), true); }; module.exports = URL; diff --git a/lib/less/tree/variable.js b/lib/less/tree/variable.js index 9d1091920..553526e9a 100644 --- a/lib/less/tree/variable.js +++ b/lib/less/tree/variable.js @@ -2,8 +2,8 @@ var Node = require("./node"); var Variable = function (name, index, currentFileInfo) { this.name = name; - this.index = index; - this.currentFileInfo = currentFileInfo || {}; + this._index = index; + this._fileInfo = currentFileInfo; }; Variable.prototype = new Node(); Variable.prototype.type = "Variable"; @@ -11,14 +11,14 @@ Variable.prototype.eval = function (context) { var variable, name = this.name; if (name.indexOf('@@') === 0) { - name = '@' + new Variable(name.slice(1), this.index, this.currentFileInfo).eval(context).value; + name = '@' + new Variable(name.slice(1), this.getIndex(), this.fileInfo()).eval(context).value; } if (this.evaluating) { throw { type: 'Name', message: "Recursive variable definition for " + name, - filename: this.currentFileInfo.filename, - index: this.index }; + filename: this.fileInfo().filename, + index: this.getIndex() }; } this.evaluating = true; @@ -39,8 +39,8 @@ Variable.prototype.eval = function (context) { } else { throw { type: 'Name', message: "variable " + name + " is undefined", - filename: this.currentFileInfo.filename, - index: this.index }; + filename: this.fileInfo().filename, + index: this.getIndex() }; } }; Variable.prototype.find = function (obj, fun) { diff --git a/lib/less/utils.js b/lib/less/utils.js index 6efdb21bb..d32a7e92b 100644 --- a/lib/less/utils.js +++ b/lib/less/utils.js @@ -16,5 +16,14 @@ module.exports = { line: line, column: column }; + }, + copyArray: function(arr) { + var i, length = arr.length, + copy = new Array(length); + + for (i = 0; i < length; i++) { + copy[i] = arr[i]; + } + return copy; } }; diff --git a/lib/less/visitors/extend-visitor.js b/lib/less/visitors/extend-visitor.js index 1d757ddb1..37df534a0 100644 --- a/lib/less/visitors/extend-visitor.js +++ b/lib/less/visitors/extend-visitor.js @@ -1,6 +1,7 @@ var tree = require("../tree"), Visitor = require("./visitor"), - logger = require("../logger"); + logger = require("../logger"), + utils = require("../utils"); /*jshint loopfunc:true */ @@ -46,7 +47,7 @@ ExtendFinderVisitor.prototype = { selector = selectorPath[selectorPath.length - 1], selExtendList = selector.extendList; - extendList = selExtendList ? selExtendList.slice(0).concat(allSelectorsExtendList) + extendList = selExtendList ? utils.copyArray(selExtendList).concat(allSelectorsExtendList) : allSelectorsExtendList; if (extendList) { @@ -166,7 +167,7 @@ ProcessExtendsVisitor.prototype = { newSelector = extendVisitor.extendSelector(matches, selectorPath, selfSelector, extend.isVisible()); // but now we create a new extend from it - newExtend = new(tree.Extend)(targetExtend.selector, targetExtend.option, 0, targetExtend.currentFileInfo, info); + newExtend = new(tree.Extend)(targetExtend.selector, targetExtend.option, 0, targetExtend.fileInfo(), info); newExtend.selfSelectors = newSelector; // add the extend onto the list of extends for that selector @@ -384,8 +385,8 @@ ProcessExtendsVisitor.prototype = { firstElement = new tree.Element( match.initialCombinator, replacementSelector.elements[0].value, - replacementSelector.elements[0].index, - replacementSelector.elements[0].currentFileInfo + replacementSelector.elements[0].getIndex(), + replacementSelector.elements[0].fileInfo() ); if (match.pathIndex > currentSelectorPathIndex && currentSelectorPathElementIndex > 0) { diff --git a/lib/less/visitors/import-visitor.js b/lib/less/visitors/import-visitor.js index 803f89b43..7bbbc93b5 100644 --- a/lib/less/visitors/import-visitor.js +++ b/lib/less/visitors/import-visitor.js @@ -1,6 +1,7 @@ var contexts = require("../contexts"), Visitor = require("./visitor"), - ImportSequencer = require("./import-sequencer"); + ImportSequencer = require("./import-sequencer"), + utils = require("../utils"); var ImportVisitor = function(importer, finish) { @@ -39,7 +40,7 @@ ImportVisitor.prototype = { if (!importNode.css || inlineCSS) { - var context = new contexts.Eval(this.context, this.context.frames.slice(0)); + var context = new contexts.Eval(this.context, utils.copyArray(this.context.frames)); var importParent = context.frames[0]; this.importCount++; @@ -58,7 +59,7 @@ ImportVisitor.prototype = { try { evaldImportNode = importNode.evalForImport(context); } catch(e) { - if (!e.filename) { e.index = importNode.index; e.filename = importNode.currentFileInfo.filename; } + if (!e.filename) { e.index = importNode.getIndex(); e.filename = importNode.fileInfo().filename; } // attempt to eval properly and treat as css importNode.css = true; // if that fails, this error will be thrown @@ -84,7 +85,7 @@ ImportVisitor.prototype = { var onImported = this.onImported.bind(this, evaldImportNode, context), sequencedOnImported = this._sequencer.addImport(onImported); - this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.currentFileInfo, + this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.fileInfo(), evaldImportNode.options, sequencedOnImported); } else { this.importCount--; @@ -96,7 +97,7 @@ ImportVisitor.prototype = { onImported: function (importNode, context, e, root, importedAtRoot, fullPath) { if (e) { if (!e.filename) { - e.index = importNode.index; e.filename = importNode.currentFileInfo.filename; + e.index = importNode.getIndex(); e.filename = importNode.fileInfo().filename; } this.error = e; } diff --git a/lib/less/visitors/to-css-visitor.js b/lib/less/visitors/to-css-visitor.js index a4eefdc99..d418f6ca8 100644 --- a/lib/less/visitors/to-css-visitor.js +++ b/lib/less/visitors/to-css-visitor.js @@ -207,15 +207,15 @@ ToCSSVisitor.prototype = { var ruleNode = rules[i]; if (isRoot && ruleNode instanceof tree.Declaration && !ruleNode.variable) { throw { message: "Properties must be inside selector blocks. They cannot be in the root", - index: ruleNode.index, filename: ruleNode.currentFileInfo && ruleNode.currentFileInfo.filename}; + index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename}; } if (ruleNode instanceof tree.Call) { throw { message: "Function '" + ruleNode.name + "' is undefined", - index: ruleNode.index, filename: ruleNode.currentFileInfo && ruleNode.currentFileInfo.filename}; + index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename}; } if (ruleNode.type && !ruleNode.allowRoot) { throw { message: ruleNode.type + " node returned by a function is not valid here", - index: ruleNode.index, filename: ruleNode.currentFileInfo && ruleNode.currentFileInfo.filename}; + index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename}; } } }, diff --git a/test/less/plugin/plugin-transitive.js b/test/less/plugin/plugin-transitive.js index 1da1864c4..18d96c641 100644 --- a/test/less/plugin/plugin-transitive.js +++ b/test/less/plugin/plugin-transitive.js @@ -1,5 +1,6 @@ functions.addMultiple({ "test-transitive" : function() { - return new tree.Anonymous( "transitive" ); + var anon = new tree.Anonymous( "transitive" ); + return anon; } }); From 1136a9c050ea31544109cf4370fc08b7ff52fb7b Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Thu, 14 Jul 2016 12:29:11 -0700 Subject: [PATCH 15/97] 3.0.0-pre.2 --- lib/less/tree/ruleset.js | 2 -- package.json | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/less/tree/ruleset.js b/lib/less/tree/ruleset.js index dc8a530bc..e318140cc 100644 --- a/lib/less/tree/ruleset.js +++ b/lib/less/tree/ruleset.js @@ -19,8 +19,6 @@ var Ruleset = function (selectors, rules, strictImports, visibilityInfo) { this.setParent(this.selectors, this); this.setParent(this.rules, this); - this.types = Object.create(null); - }; Ruleset.prototype = new Node(); Ruleset.prototype.type = "Ruleset"; diff --git a/package.json b/package.json index 24d429e20..118980b55 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "less", - "version": "3.0.0-pre.1", + "version": "3.0.0-pre.2", "description": "Leaner CSS", "homepage": "http://lesscss.org", "author": { From 623bc2f8166302a0c7cd2ee7f1fe69ddb7d4cf63 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Thu, 14 Jul 2016 12:29:54 -0700 Subject: [PATCH 16/97] 3.0.0-pre.2 dist files --- dist/less.js | 379 +++++++++++++++++++++++++++-------------------- dist/less.min.js | 12 +- 2 files changed, 227 insertions(+), 164 deletions(-) diff --git a/dist/less.js b/dist/less.js index 77097edc4..ee30b3a5b 100644 --- a/dist/less.js +++ b/dist/less.js @@ -1,5 +1,5 @@ /*! - * Less - Leaner CSS v3.0.0-pre.1 + * Less - Leaner CSS v3.0.0-pre.2 * http://lesscss.org * * Copyright (c) 2009-2016, Alexis Sellier @@ -1434,8 +1434,8 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOp registry = functionRegistry.create(); try { - loader = new Function("module", "require", "functions", "tree", "fileInfo", "less", contents); - pluginObj = loader(localModule, this.require, registry, this.less.tree, fileInfo, this.less); + loader = new Function("module", "require", "functions", "tree", "fileInfo", contents); + pluginObj = loader(localModule, this.require, registry, this.less.tree, fileInfo); if (!pluginObj) { pluginObj = localModule.exports; @@ -2132,8 +2132,8 @@ var functionCaller = function(name, context, index, currentFileInfo) { functionCaller.prototype.isValid = function() { return Boolean(this.func); }; -functionCaller.prototype.call = function(args) { +functionCaller.prototype.call = function(args) { // This code is terrible and should be replaced as per this issue... // https://github.com/less/less.js/issues/2477 if (Array.isArray(args)) { @@ -5819,9 +5819,9 @@ var Node = require("./node"); var Anonymous = function (value, index, currentFileInfo, mapLines, rulesetLike, visibilityInfo) { this.value = value; - this.index = index; + this._index = index; + this._fileInfo = currentFileInfo; this.mapLines = mapLines; - this.currentFileInfo = currentFileInfo; this.rulesetLike = (typeof rulesetLike === 'undefined') ? false : rulesetLike; this.allowRoot = true; this.copyVisibilityInfo(visibilityInfo); @@ -5829,7 +5829,7 @@ var Anonymous = function (value, index, currentFileInfo, mapLines, rulesetLike, Anonymous.prototype = new Node(); Anonymous.prototype.type = "Anonymous"; Anonymous.prototype.eval = function () { - return new Anonymous(this.value, this.index, this.currentFileInfo, this.mapLines, this.rulesetLike, this.visibilityInfo()); + return new Anonymous(this.value, this._index, this._fileInfo, this.mapLines, this.rulesetLike, this.visibilityInfo()); }; Anonymous.prototype.compare = function (other) { return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined; @@ -5838,7 +5838,7 @@ Anonymous.prototype.isRulesetLike = function() { return this.rulesetLike; }; Anonymous.prototype.genCSS = function (context, output) { - output.add(this.value, this.currentFileInfo, this.index, this.mapLines); + output.add(this.value, this._fileInfo, this._index, this.mapLines); }; module.exports = Anonymous; @@ -5886,14 +5886,15 @@ var AtRule = function (name, value, rules, index, currentFileInfo, debugInfo, is this.rules = rules; } else { this.rules = [rules]; - this.rules[0].selectors = (new Selector([], null, null, this.index, currentFileInfo)).createEmptySelectors(); + this.rules[0].selectors = (new Selector([], null, null, index, currentFileInfo)).createEmptySelectors(); } for (i = 0; i < this.rules.length; i++) { this.rules[i].allowImports = true; } + this.setParent(this.rules, this); } - this.index = index; - this.currentFileInfo = currentFileInfo; + this._index = index; + this._fileInfo = currentFileInfo; this.debugInfo = debugInfo; this.isRooted = isRooted || false; this.copyVisibilityInfo(visibilityInfo); @@ -5919,7 +5920,7 @@ AtRule.prototype.isCharset = function() { }; AtRule.prototype.genCSS = function (context, output) { var value = this.value, rules = this.rules; - output.add(this.name, this.currentFileInfo, this.index); + output.add(this.name, this.fileInfo(), this.getIndex()); if (value) { output.add(' '); value.genCSS(context, output); @@ -5954,7 +5955,7 @@ AtRule.prototype.eval = function (context) { context.mediaBlocks = mediaBlocksBackup; return new AtRule(this.name, value, rules, - this.index, this.currentFileInfo, this.debugInfo, this.isRooted, this.visibilityInfo()); + this.getIndex(), this.fileInfo(), this.debugInfo, this.isRooted, this.visibilityInfo()); }; AtRule.prototype.variable = function (name) { if (this.rules) { @@ -6045,8 +6046,8 @@ var Node = require("./node"), var Call = function (name, args, index, currentFileInfo) { this.name = name; this.args = args; - this.index = index; - this.currentFileInfo = currentFileInfo; + this._index = index; + this._fileInfo = currentFileInfo; }; Call.prototype = new Node(); Call.prototype.type = "Call"; @@ -6068,8 +6069,8 @@ Call.prototype.accept = function (visitor) { // Call.prototype.eval = function (context) { var args = this.args.map(function (a) { return a.eval(context); }), - result, funcCaller = new FunctionCaller(this.name, context, this.index, this.currentFileInfo); - + result, funcCaller = new FunctionCaller(this.name, context, this.getIndex(), this.fileInfo()); + if (funcCaller.isValid()) { try { result = funcCaller.call(args); @@ -6078,24 +6079,24 @@ Call.prototype.eval = function (context) { type: e.type || "Runtime", message: "error evaluating function `" + this.name + "`" + (e.message ? ': ' + e.message : ''), - index: this.index, - filename: this.currentFileInfo.filename, + index: this.getIndex(), + filename: this.fileInfo().filename, line: e.lineNumber, column: e.columnNumber }; } if (result != null) { - result.index = this.index; - result.currentFileInfo = this.currentFileInfo; + result._index = this._index; + result._fileInfo = this._fileInfo; return result; } } - return new Call(this.name, args, this.index, this.currentFileInfo); + return new Call(this.name, args, this.getIndex(), this.fileInfo()); }; Call.prototype.genCSS = function (context, output) { - output.add(this.name + "(", this.currentFileInfo, this.index); + output.add(this.name + "(", this.fileInfo(), this.getIndex()); for (var i = 0; i < this.args.length; i++) { this.args[i].genCSS(context, output); @@ -6210,7 +6211,7 @@ Color.prototype.toCSS = function (context, doNotCompress) { // we create a new Color node to hold the result. // Color.prototype.operate = function (context, op, other) { - var rgb = []; + var rgb = new Array(3); var alpha = this.alpha * (1 - other.alpha) + other.alpha; for (var c = 0; c < 3; c++) { rgb[c] = this._operate(context, op, this.rgb[c], other.rgb[c]); @@ -6331,15 +6332,15 @@ var Node = require("./node"), var Comment = function (value, isLineComment, index, currentFileInfo) { this.value = value; this.isLineComment = isLineComment; - this.index = index; - this.currentFileInfo = currentFileInfo; + this._index = index; + this._fileInfo = currentFileInfo; this.allowRoot = true; }; Comment.prototype = new Node(); Comment.prototype.type = "Comment"; Comment.prototype.genCSS = function (context, output) { if (this.debugInfo) { - output.add(getDebugInfo(context, this), this.currentFileInfo, this.index); + output.add(getDebugInfo(context, this), this.fileInfo(), this.getIndex()); } output.add(this.value); }; @@ -6356,7 +6357,7 @@ var Condition = function (op, l, r, i, negate) { this.op = op.trim(); this.lvalue = l; this.rvalue = r; - this.index = i; + this._index = i; this.negate = negate; }; Condition.prototype = new Node(); @@ -6438,12 +6439,13 @@ var Declaration = function (name, value, important, merge, index, currentFileInf this.value = (value instanceof Node) ? value : new Value([value]); //value instanceof tree.Value || value instanceof tree.Ruleset ?? this.important = important ? ' ' + important.trim() : ''; this.merge = merge; - this.index = index; - this.currentFileInfo = currentFileInfo; + this._index = index; + this._fileInfo = currentFileInfo; this.inline = inline || false; this.variable = (variable !== undefined) ? variable : (name.charAt && (name.charAt(0) === '@')); this.allowRoot = true; + this.setParent(this.value, this); }; function evalName(context, name) { @@ -6458,16 +6460,16 @@ function evalName(context, name) { Declaration.prototype = new Node(); Declaration.prototype.type = "Declaration"; Declaration.prototype.genCSS = function (context, output) { - output.add(this.name + (context.compress ? ':' : ': '), this.currentFileInfo, this.index); + output.add(this.name + (context.compress ? ':' : ': '), this.fileInfo(), this.getIndex()); try { this.value.genCSS(context, output); } catch(e) { - e.index = this.index; - e.filename = this.currentFileInfo.filename; + e.index = this._index; + e.filename = this._fileInfo.filename; throw e; } - output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? "" : ";"), this.currentFileInfo, this.index); + output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? "" : ";"), this._fileInfo, this._index); }; Declaration.prototype.eval = function (context) { var strictMathBypass = false, name = this.name, evaldValue, variable = this.variable; @@ -6488,7 +6490,7 @@ Declaration.prototype.eval = function (context) { if (!this.variable && evaldValue.type === "DetachedRuleset") { throw { message: "Rulesets cannot be evaluated on a property.", - index: this.index, filename: this.currentFileInfo.filename }; + index: this.getIndex(), filename: this.fileInfo().filename }; } var important = this.important, importantResult = context.importantScope.pop(); @@ -6500,13 +6502,13 @@ Declaration.prototype.eval = function (context) { evaldValue, important, this.merge, - this.index, this.currentFileInfo, this.inline, + this.getIndex(), this.fileInfo(), this.inline, variable); } catch(e) { if (typeof e.index !== 'number') { - e.index = this.index; - e.filename = this.currentFileInfo.filename; + e.index = this.getIndex(); + e.filename = this.fileInfo().filename; } throw e; } @@ -6521,17 +6523,19 @@ Declaration.prototype.makeImportant = function () { this.value, "!important", this.merge, - this.index, this.currentFileInfo, this.inline); + this.getIndex(), this.fileInfo(), this.inline); }; module.exports = Declaration; },{"./keyword":68,"./node":73,"./value":84}],58:[function(require,module,exports){ var Node = require("./node"), - contexts = require("../contexts"); + contexts = require("../contexts"), + utils = require("../utils"); var DetachedRuleset = function (ruleset, frames) { this.ruleset = ruleset; this.frames = frames; + this.setParent(this.ruleset, this); }; DetachedRuleset.prototype = new Node(); DetachedRuleset.prototype.type = "DetachedRuleset"; @@ -6540,7 +6544,7 @@ DetachedRuleset.prototype.accept = function (visitor) { this.ruleset = visitor.visit(this.ruleset); }; DetachedRuleset.prototype.eval = function (context) { - var frames = this.frames || context.frames.slice(0); + var frames = this.frames || utils.copyArray(context.frames); return new DetachedRuleset(this.ruleset, frames); }; DetachedRuleset.prototype.callEval = function (context) { @@ -6548,7 +6552,7 @@ DetachedRuleset.prototype.callEval = function (context) { }; module.exports = DetachedRuleset; -},{"../contexts":12,"./node":73}],59:[function(require,module,exports){ +},{"../contexts":12,"../utils":86,"./node":73}],59:[function(require,module,exports){ var Node = require("./node"), unitConversions = require("../data/unit-conversions"), Unit = require("./unit"), @@ -6561,6 +6565,7 @@ var Dimension = function (value, unit) { this.value = parseFloat(value); this.unit = (unit && unit instanceof Unit) ? unit : new Unit(unit ? [unit] : undefined); + this.setParent(this.unit, this); }; Dimension.prototype = new Node(); @@ -6725,7 +6730,7 @@ var Node = require("./node"), Paren = require("./paren"), Combinator = require("./combinator"); -var Element = function (combinator, value, index, currentFileInfo, info) { +var Element = function (combinator, value, index, currentFileInfo, visibilityInfo) { this.combinator = combinator instanceof Combinator ? combinator : new Combinator(combinator); @@ -6736,9 +6741,10 @@ var Element = function (combinator, value, index, currentFileInfo, info) { } else { this.value = ""; } - this.index = index; - this.currentFileInfo = currentFileInfo; - this.copyVisibilityInfo(info); + this._index = index; + this._fileInfo = currentFileInfo; + this.copyVisibilityInfo(visibilityInfo); + this.setParent(this.combinator, this); }; Element.prototype = new Node(); Element.prototype.type = "Element"; @@ -6752,17 +6758,17 @@ Element.prototype.accept = function (visitor) { Element.prototype.eval = function (context) { return new Element(this.combinator, this.value.eval ? this.value.eval(context) : this.value, - this.index, - this.currentFileInfo, this.visibilityInfo()); + this.getIndex(), + this.fileInfo(), this.visibilityInfo()); }; Element.prototype.clone = function () { return new Element(this.combinator, this.value, - this.index, - this.currentFileInfo, this.visibilityInfo()); + this.getIndex(), + this.fileInfo(), this.visibilityInfo()); }; Element.prototype.genCSS = function (context, output) { - output.add(this.toCSS(context), this.currentFileInfo, this.index); + output.add(this.toCSS(context), this.fileInfo(), this.getIndex()); }; Element.prototype.toCSS = function (context) { context = context || {}; @@ -6847,10 +6853,10 @@ var Node = require("./node"), var Extend = function Extend(selector, option, index, currentFileInfo, visibilityInfo) { this.selector = selector; this.option = option; - this.index = index; this.object_id = Extend.next_id++; this.parent_ids = [this.object_id]; - this.currentFileInfo = currentFileInfo || {}; + this._index = index; + this._fileInfo = currentFileInfo; this.copyVisibilityInfo(visibilityInfo); this.allowRoot = true; @@ -6864,6 +6870,7 @@ var Extend = function Extend(selector, option, index, currentFileInfo, visibilit this.allowAfter = false; break; } + this.setParent(this.selector, this); }; Extend.next_id = 0; @@ -6873,10 +6880,10 @@ Extend.prototype.accept = function (visitor) { this.selector = visitor.visit(this.selector); }; Extend.prototype.eval = function (context) { - return new Extend(this.selector.eval(context), this.option, this.index, this.currentFileInfo, this.visibilityInfo()); + return new Extend(this.selector.eval(context), this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo()); }; Extend.prototype.clone = function (context) { - return new Extend(this.selector, this.option, this.index, this.currentFileInfo, this.visibilityInfo()); + return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo()); }; //it concatenates (joins) all selectors in selector array Extend.prototype.findSelfSelectors = function (selectors) { @@ -6905,7 +6912,8 @@ var Node = require("./node"), URL = require("./url"), Quoted = require("./quoted"), Ruleset = require("./ruleset"), - Anonymous = require("./anonymous"); + Anonymous = require("./anonymous"), + utils = require("../utils"); // // CSS @import node @@ -6921,10 +6929,10 @@ var Node = require("./node"), // var Import = function (path, features, options, index, currentFileInfo, visibilityInfo) { this.options = options; - this.index = index; + this._index = index; + this._fileInfo = currentFileInfo; this.path = path; this.features = features; - this.currentFileInfo = currentFileInfo; this.allowRoot = true; if (this.options.less !== undefined || this.options.inline) { @@ -6936,6 +6944,8 @@ var Import = function (path, features, options, index, currentFileInfo, visibili } } this.copyVisibilityInfo(visibilityInfo); + this.setParent(this.features, this); + this.setParent(this.path, this); }; // @@ -6959,8 +6969,8 @@ Import.prototype.accept = function (visitor) { } }; Import.prototype.genCSS = function (context, output) { - if (this.css && this.path.currentFileInfo.reference === undefined) { - output.add("@import ", this.currentFileInfo, this.index); + if (this.css && this.path._fileInfo.reference === undefined) { + output.add("@import ", this._fileInfo, this._index); this.path.genCSS(context, output); if (this.features) { output.add(" "); @@ -6991,11 +7001,11 @@ Import.prototype.evalForImport = function (context) { path = path.value; } - return new Import(path.eval(context), this.features, this.options, this.index, this.currentFileInfo, this.visibilityInfo()); + return new Import(path.eval(context), this.features, this.options, this._index, this._fileInfo, this.visibilityInfo()); }; Import.prototype.evalPath = function (context) { var path = this.path.eval(context); - var rootpath = this.currentFileInfo && this.currentFileInfo.rootpath; + var rootpath = this._fileInfo && this._fileInfo.rootpath; if (!(path instanceof URL)) { if (rootpath) { @@ -7051,18 +7061,18 @@ Import.prototype.doEval = function (context) { var contents = new Anonymous(this.root, 0, { filename: this.importedFilename, - reference: this.path.currentFileInfo && this.path.currentFileInfo.reference + reference: this.path._fileInfo && this.path._fileInfo.reference }, true, true); return this.features ? new Media([contents], this.features.value) : [contents]; } else if (this.css) { - var newImport = new Import(this.evalPath(context), features, this.options, this.index); + var newImport = new Import(this.evalPath(context), features, this.options, this._index); if (!newImport.css && this.error) { throw this.error; } return newImport; } else { - ruleset = new Ruleset(null, this.root.rules.slice(0)); + ruleset = new Ruleset(null, utils.copyArray(this.root.rules)); ruleset.evalImports(context); return this.features ? new Media(ruleset.rules, this.features.value) : ruleset.rules; @@ -7070,7 +7080,7 @@ Import.prototype.doEval = function (context) { }; module.exports = Import; -},{"./anonymous":47,"./media":69,"./node":73,"./quoted":76,"./ruleset":79,"./url":83}],65:[function(require,module,exports){ +},{"../utils":86,"./anonymous":47,"./media":69,"./node":73,"./quoted":76,"./ruleset":79,"./url":83}],65:[function(require,module,exports){ var tree = {}; tree.Node = require('./node'); @@ -7126,8 +7136,8 @@ var JsEvalNode = require("./js-eval-node"), var JavaScript = function (string, escaped, index, currentFileInfo) { this.escaped = escaped; this.expression = string; - this.index = index; - this.currentFileInfo = currentFileInfo; + this._index = index; + this._fileInfo = currentFileInfo; }; JavaScript.prototype = new JsEvalNode(); JavaScript.prototype.type = "JavaScript"; @@ -7137,7 +7147,7 @@ JavaScript.prototype.eval = function(context) { if (typeof result === 'number') { return new Dimension(result); } else if (typeof result === 'string') { - return new Quoted('"' + result + '"', result, this.escaped, this.index); + return new Quoted('"' + result + '"', result, this.escaped, this._index); } else if (Array.isArray(result)) { return new Anonymous(result.join(', ')); } else { @@ -7162,20 +7172,20 @@ JsEvalNode.prototype.evaluateJavaScript = function (expression, context) { if (!context.javascriptEnabled) { throw { message: "Inline JavaScript is not enabled. Is it set in your options?", - filename: this.currentFileInfo.filename, - index: this.index }; + filename: this.fileInfo().filename, + index: this.getIndex() }; } expression = expression.replace(/@\{([\w-]+)\}/g, function (_, name) { - return that.jsify(new Variable('@' + name, that.index, that.currentFileInfo).eval(context)); + return that.jsify(new Variable('@' + name, that.getIndex(), that.fileInfo()).eval(context)); }); try { expression = new Function('return (' + expression + ')'); } catch (e) { throw { message: "JavaScript evaluation error: " + e.message + " from `" + expression + "`" , - filename: this.currentFileInfo.filename, - index: this.index }; + filename: this.fileInfo().filename, + index: this.getIndex() }; } var variables = context.frames[0].variables(); @@ -7195,8 +7205,8 @@ JsEvalNode.prototype.evaluateJavaScript = function (expression, context) { result = expression.call(evalContext); } catch (e) { throw { message: "JavaScript evaluation error: '" + e.name + ': ' + e.message.replace(/["]/g, "'") + "'" , - filename: this.currentFileInfo.filename, - index: this.index }; + filename: this.fileInfo().filename, + index: this.getIndex() }; } return result; }; @@ -7232,19 +7242,23 @@ var Ruleset = require("./ruleset"), Selector = require("./selector"), Anonymous = require("./anonymous"), Expression = require("./expression"), - AtRule = require("./atrule"); + AtRule = require("./atrule"), + utils = require("../utils"); var Media = function (value, features, index, currentFileInfo, visibilityInfo) { - this.index = index; - this.currentFileInfo = currentFileInfo; + this._index = index; + this._fileInfo = currentFileInfo; - var selectors = (new Selector([], null, null, this.index, this.currentFileInfo)).createEmptySelectors(); + var selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors(); this.features = new Value(features); this.rules = [new Ruleset(selectors, value)]; this.rules[0].allowImports = true; this.copyVisibilityInfo(visibilityInfo); this.allowRoot = true; + this.setParent(selectors, this); + this.setParent(this.features, this); + this.setParent(this.rules, this); }; Media.prototype = new AtRule(); Media.prototype.type = "Media"; @@ -7258,7 +7272,7 @@ Media.prototype.accept = function (visitor) { } }; Media.prototype.genCSS = function (context, output) { - output.add('@media ', this.currentFileInfo, this.index); + output.add('@media ', this._fileInfo, this._index); this.features.genCSS(context, output); this.outputRuleset(context, output, this.rules); }; @@ -7268,7 +7282,7 @@ Media.prototype.eval = function (context) { context.mediaPath = []; } - var media = new Media(null, [], this.index, this.currentFileInfo, this.visibilityInfo()); + var media = new Media(null, [], this._index, this._fileInfo, this.visibilityInfo()); if (this.debugInfo) { this.rules[0].debugInfo = this.debugInfo; media.debugInfo = this.debugInfo; @@ -7305,10 +7319,11 @@ Media.prototype.evalTop = function (context) { // Render all dependent Media blocks. if (context.mediaBlocks.length > 1) { - var selectors = (new Selector([], null, null, this.index, this.currentFileInfo)).createEmptySelectors(); + var selectors = (new Selector([], null, null, this.getIndex(), this.fileInfo())).createEmptySelectors(); result = new Ruleset(selectors, context.mediaBlocks); result.multiMedia = true; result.copyVisibilityInfo(this.visibilityInfo()); + this.setParent(result, this); } delete context.mediaBlocks; @@ -7345,6 +7360,7 @@ Media.prototype.evalNested = function (context) { return new Expression(path); })); + this.setParent(this.features, this); // Fake a tree-node that doesn't output anything. return new Ruleset([], []); @@ -7369,11 +7385,12 @@ Media.prototype.bubbleSelectors = function (selectors) { if (!selectors) { return; } - this.rules = [new Ruleset(selectors.slice(0), [this.rules[0]])]; + this.rules = [new Ruleset(utils.copyArray(selectors), [this.rules[0]])]; + this.setParent(this.rules, this); }; module.exports = Media; -},{"./anonymous":47,"./atrule":49,"./expression":62,"./ruleset":79,"./selector":80,"./value":84}],70:[function(require,module,exports){ +},{"../utils":86,"./anonymous":47,"./atrule":49,"./expression":62,"./ruleset":79,"./selector":80,"./value":84}],70:[function(require,module,exports){ var Node = require("./node"), Selector = require("./selector"), MixinDefinition = require("./mixin-definition"), @@ -7382,10 +7399,11 @@ var Node = require("./node"), var MixinCall = function (elements, args, index, currentFileInfo, important) { this.selector = new Selector(elements); this.arguments = args || []; - this.index = index; - this.currentFileInfo = currentFileInfo; + this._index = index; + this._fileInfo = currentFileInfo; this.important = important; this.allowRoot = true; + this.setParent(this.selector, this); }; MixinCall.prototype = new Node(); MixinCall.prototype.type = "MixinCall"; @@ -7493,7 +7511,7 @@ MixinCall.prototype.eval = function (context) { if ((count[defTrue] + count[defFalse]) > 1) { throw { type: 'Runtime', message: 'Ambiguous use of `default()` found when matching for `' + this.format(args) + '`', - index: this.index, filename: this.currentFileInfo.filename }; + index: this.getIndex(), filename: this.fileInfo().filename }; } } @@ -7511,7 +7529,7 @@ MixinCall.prototype.eval = function (context) { this._setVisibilityToReplacement(newRules); Array.prototype.push.apply(rules, newRules); } catch (e) { - throw { message: e.message, index: this.index, filename: this.currentFileInfo.filename, stack: e.stack }; + throw { message: e.message, index: this.getIndex(), filename: this.fileInfo().filename, stack: e.stack }; } } } @@ -7524,11 +7542,11 @@ MixinCall.prototype.eval = function (context) { if (isOneFound) { throw { type: 'Runtime', message: 'No matching definition was found for `' + this.format(args) + '`', - index: this.index, filename: this.currentFileInfo.filename }; + index: this.getIndex(), filename: this.fileInfo().filename }; } else { throw { type: 'Name', message: this.selector.toCSS().trim() + " is undefined", - index: this.index, filename: this.currentFileInfo.filename }; + index: this.getIndex(), filename: this.fileInfo().filename }; } }; @@ -7564,11 +7582,12 @@ var Selector = require("./selector"), Ruleset = require("./ruleset"), Declaration = require("./declaration"), Expression = require("./expression"), - contexts = require("../contexts"); + contexts = require("../contexts"), + utils = require("../utils"); var Definition = function (name, params, rules, condition, variadic, frames, visibilityInfo) { this.name = name; - this.selectors = [new Selector([new Element(null, name, this.index, this.currentFileInfo)])]; + this.selectors = [new Selector([new Element(null, name, this._index, this._fileInfo)])]; this.params = params; this.condition = condition; this.variadic = variadic; @@ -7606,7 +7625,7 @@ Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArgume /*jshint boss:true */ var frame = new Ruleset(null, null), varargs, arg, - params = this.params.slice(0), + params = utils.copyArray(this.params), i, j, val, name, isNamedFound, argIndex, argsLength = 0; if (mixinEnv.frames && mixinEnv.frames[0] && mixinEnv.frames[0].functionRegistry) { @@ -7615,7 +7634,7 @@ Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArgume mixinEnv = new contexts.Eval(mixinEnv, [frame].concat(mixinEnv.frames)); if (args) { - args = args.slice(0); + args = utils.copyArray(args); argsLength = args.length; for (i = 0; i < argsLength; i++) { @@ -7693,7 +7712,7 @@ Definition.prototype.makeImportant = function() { return result; }; Definition.prototype.eval = function (context) { - return new Definition(this.name, this.params, this.rules, this.condition, this.variadic, this.frames || context.frames.slice(0)); + return new Definition(this.name, this.params, this.rules, this.condition, this.variadic, this.frames || utils.copyArray(context.frames)); }; Definition.prototype.evalCall = function (context, args, important) { var _arguments = [], @@ -7703,7 +7722,7 @@ Definition.prototype.evalCall = function (context, args, important) { frame.prependRule(new Declaration('@arguments', new Expression(_arguments).eval(context))); - rules = this.rules.slice(0); + rules = utils.copyArray(this.rules); ruleset = new Ruleset(null, rules); ruleset.originalRuleset = this; @@ -7761,7 +7780,7 @@ Definition.prototype.matchArgs = function (args, context) { }; module.exports = Definition; -},{"../contexts":12,"./declaration":57,"./element":61,"./expression":62,"./ruleset":79,"./selector":80}],72:[function(require,module,exports){ +},{"../contexts":12,"../utils":86,"./declaration":57,"./element":61,"./expression":62,"./ruleset":79,"./selector":80}],72:[function(require,module,exports){ var Node = require("./node"), Operation = require("./operation"), Dimension = require("./dimension"); @@ -7785,6 +7804,37 @@ module.exports = Negative; },{"./dimension":59,"./node":73,"./operation":74}],73:[function(require,module,exports){ var Node = function() { + this.parent = null; + this.visibilityBlocks = undefined; + this.nodeVisible = undefined; + + var self = this; + Object.defineProperty(this, "currentFileInfo", { + get: function() { return self.fileInfo(); } + }); + Object.defineProperty(this, "index", { + get: function() { return self.getIndex(); } + }); + +}; +Node.prototype.setParent = function(nodes, parent) { + function set(node) { + if (node && node instanceof Node) { + node.parent = parent; + } + } + if (Array.isArray(nodes)) { + nodes.forEach(set); + } + else { + set(nodes); + } +}; +Node.prototype.getIndex = function() { + return this._index || (this.parent && this.parent.getIndex()) || 0; +}; +Node.prototype.fileInfo = function() { + return this._fileInfo || (this.parent && this.parent.fileInfo()) || {}; }; Node.prototype.toCSS = function (context) { var strs = []; @@ -7985,14 +8035,14 @@ var Quoted = function (str, content, escaped, index, currentFileInfo) { this.escaped = (escaped == null) ? true : escaped; this.value = content || ''; this.quote = str.charAt(0); - this.index = index; - this.currentFileInfo = currentFileInfo; + this._index = index; + this._fileInfo = currentFileInfo; }; Quoted.prototype = new JsEvalNode(); Quoted.prototype.type = "Quoted"; Quoted.prototype.genCSS = function (context, output) { if (!this.escaped) { - output.add(this.quote, this.currentFileInfo, this.index); + output.add(this.quote, this.fileInfo(), this.getIndex()); } output.add(this.value); if (!this.escaped) { @@ -8008,7 +8058,7 @@ Quoted.prototype.eval = function (context) { return String(that.evaluateJavaScript(exp, context)); }; var interpolationReplacement = function (_, name) { - var v = new Variable('@' + name, that.index, that.currentFileInfo).eval(context, true); + var v = new Variable('@' + name, that.getIndex(), that.fileInfo()).eval(context, true); return (v instanceof Quoted) ? v.value : v.toCSS(); }; function iterativeReplace(value, regexp, replacementFnc) { @@ -8021,7 +8071,7 @@ Quoted.prototype.eval = function (context) { } value = iterativeReplace(value, /`([^`]+)`/g, javascriptReplacement); value = iterativeReplace(value, /@\{([\w-]+)\}/g, interpolationReplacement); - return new Quoted(this.quote + value + this.quote, value, this.escaped, this.index, this.currentFileInfo); + return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo()); }; Quoted.prototype.compare = function (other) { // when comparing quoted strings allow the quote to differ @@ -8071,7 +8121,8 @@ var Node = require("./node"), contexts = require("../contexts"), globalFunctionRegistry = require("../functions/function-registry"), defaultFunc = require("../functions/default"), - getDebugInfo = require("./debug-info"); + getDebugInfo = require("./debug-info"), + utils = require("../utils"); var Ruleset = function (selectors, rules, strictImports, visibilityInfo) { this.selectors = selectors; @@ -8080,6 +8131,9 @@ var Ruleset = function (selectors, rules, strictImports, visibilityInfo) { this.strictImports = strictImports; this.copyVisibilityInfo(visibilityInfo); this.allowRoot = true; + this.setParent(this.selectors, this); + this.setParent(this.rules, this); + }; Ruleset.prototype = new Node(); Ruleset.prototype.type = "Ruleset"; @@ -8100,14 +8154,14 @@ Ruleset.prototype.eval = function (context) { selCnt, selector, i, hasOnePassingSelector = false; if (thisSelectors && (selCnt = thisSelectors.length)) { - selectors = []; + selectors = new Array(selCnt); defaultFunc.error({ type: "Syntax", message: "it is currently only allowed in parametric mixin guards," }); for (i = 0; i < selCnt; i++) { selector = thisSelectors[i].eval(context); - selectors.push(selector); + selectors[i] = selector; if (selector.evaldCondition) { hasOnePassingSelector = true; } @@ -8117,7 +8171,7 @@ Ruleset.prototype.eval = function (context) { hasOnePassingSelector = true; } - var rules = this.rules ? this.rules.slice(0) : null, + var rules = this.rules ? utils.copyArray(this.rules) : null, ruleset = new Ruleset(selectors, rules, this.strictImports, this.visibilityInfo()), rule, subRule; @@ -8346,6 +8400,7 @@ Ruleset.prototype.prependRule = function (rule) { } else { this.rules = [ rule ]; } + this.setParent(rule, this); }; Ruleset.prototype.find = function (selector, self, filter) { self = self || this; @@ -8518,9 +8573,9 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { if (elementsToPak.length === 0) { replacementParen = new Paren(elementsToPak[0]); } else { - var insideParent = []; + var insideParent = new Array(elementsToPak.length); for (j = 0; j < elementsToPak.length; j++) { - insideParent.push(new Element(null, elementsToPak[j], originalElement.index, originalElement.currentFileInfo)); + insideParent[j] = new Element(null, elementsToPak[j], originalElement._index, originalElement._fileInfo); } replacementParen = new Paren(new Selector(insideParent)); } @@ -8529,7 +8584,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { function createSelector(containedElement, originalElement) { var element, selector; - element = new Element(null, containedElement, originalElement.index, originalElement.currentFileInfo); + element = new Element(null, containedElement, originalElement._index, originalElement._fileInfo); selector = new Selector([element]); return selector; } @@ -8545,9 +8600,9 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { //construct the joined selector - if & is the first thing this will be empty, // if not newJoinedSelector will be the last set of elements in the selector if (beginningPath.length > 0) { - newSelectorPath = beginningPath.slice(0); + newSelectorPath = utils.copyArray(beginningPath); lastSelector = newSelectorPath.pop(); - newJoinedSelector = originalSelector.createDerived(lastSelector.elements.slice(0)); + newJoinedSelector = originalSelector.createDerived(utils.copyArray(lastSelector.elements)); } else { newJoinedSelector = originalSelector.createDerived([]); @@ -8563,7 +8618,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { combinator = parentEl.combinator; } // join the elements so far with the first part of the parent - newJoinedSelector.elements.push(new Element(combinator, parentEl.value, replacedElement.index, replacedElement.currentFileInfo)); + newJoinedSelector.elements.push(new Element(combinator, parentEl.value, replacedElement._index, replacedElement._fileInfo)); newJoinedSelector.elements = newJoinedSelector.elements.concat(addPath[0].elements.slice(1)); } @@ -8700,7 +8755,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { // the combinator used on el should now be applied to the next element instead so that // it is not lost if (sel.length > 0) { - sel[0].elements.push(new Element(el.combinator, '', el.index, el.currentFileInfo)); + sel[0].elements.push(new Element(el.combinator, '', el._index, el._fileInfo)); } selectorsMultiplied.push(sel); } @@ -8732,7 +8787,6 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { paths.push(newSelectors[i]); lastSelector = newSelectors[i][length - 1]; newSelectors[i][length - 1] = lastSelector.createDerived(lastSelector.elements, inSelector.extendList); - //newSelectors[i][length - 1].copyVisibilityInfo(inSelector.visibilityInfo()); } } @@ -8755,12 +8809,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { if (context.length > 0) { newPaths = []; for (i = 0; i < context.length; i++) { - //var concatenated = []; - //context[i].forEach(function(entry) { - // var newEntry = entry.createDerived(entry.elements, entry.extendList, entry.evaldCondition); - // newEntry.copyVisibilityInfo(selector.visibilityInfo()); - // concatenated.push(newEntry); - //}, this); + var concatenated = context[i].map(deriveSelector.bind(this, selector.visibilityInfo())); concatenated.push(selector); @@ -8779,7 +8828,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { }; module.exports = Ruleset; -},{"../contexts":12,"../functions/default":22,"../functions/function-registry":24,"./debug-info":56,"./declaration":57,"./element":61,"./node":73,"./paren":75,"./selector":80}],80:[function(require,module,exports){ +},{"../contexts":12,"../functions/default":22,"../functions/function-registry":24,"../utils":86,"./debug-info":56,"./declaration":57,"./element":61,"./node":73,"./paren":75,"./selector":80}],80:[function(require,module,exports){ var Node = require("./node"), Element = require("./element"); @@ -8787,11 +8836,13 @@ var Selector = function (elements, extendList, condition, index, currentFileInfo this.elements = elements; this.extendList = extendList; this.condition = condition; - this.currentFileInfo = currentFileInfo || {}; + this._index = index; + this._fileInfo = currentFileInfo; if (!condition) { this.evaldCondition = true; } this.copyVisibilityInfo(visibilityInfo); + this.setParent(this.elements, this); }; Selector.prototype = new Node(); Selector.prototype.type = "Selector"; @@ -8809,14 +8860,14 @@ Selector.prototype.accept = function (visitor) { Selector.prototype.createDerived = function(elements, extendList, evaldCondition) { var info = this.visibilityInfo(); evaldCondition = (evaldCondition != null) ? evaldCondition : this.evaldCondition; - var newSelector = new Selector(elements, extendList || this.extendList, null, this.index, this.currentFileInfo, info); + var newSelector = new Selector(elements, extendList || this.extendList, null, this.getIndex(), this.fileInfo(), info); newSelector.evaldCondition = evaldCondition; newSelector.mediaEmpty = this.mediaEmpty; return newSelector; }; Selector.prototype.createEmptySelectors = function() { - var el = new Element('', '&', this.index, this.currentFileInfo), - sels = [new Selector([el], null, null, this.index, this.currentFileInfo)]; + var el = new Element('', '&', this._index, this._fileInfo), + sels = [new Selector([el], null, null, this._index, this._fileInfo)]; sels[0].mediaEmpty = true; return sels; }; @@ -8877,7 +8928,7 @@ Selector.prototype.eval = function (context) { Selector.prototype.genCSS = function (context, output) { var i, element; if ((!context || !context.firstSelector) && this.elements[0].combinator.value === "") { - output.add(' ', this.currentFileInfo, this.index); + output.add(' ', this.fileInfo(), this.getIndex()); } if (!this._css) { //TODO caching? speed comparison? @@ -8905,11 +8956,12 @@ module.exports = UnicodeDescriptor; },{"./node":73}],82:[function(require,module,exports){ var Node = require("./node"), - unitConversions = require("../data/unit-conversions"); + unitConversions = require("../data/unit-conversions"), + utils = require("../utils"); var Unit = function (numerator, denominator, backupUnit) { - this.numerator = numerator ? numerator.slice(0).sort() : []; - this.denominator = denominator ? denominator.slice(0).sort() : []; + this.numerator = numerator ? utils.copyArray(numerator).sort() : []; + this.denominator = denominator ? utils.copyArray(denominator).sort() : []; if (backupUnit) { this.backupUnit = backupUnit; } else if (numerator && numerator.length) { @@ -8920,7 +8972,7 @@ var Unit = function (numerator, denominator, backupUnit) { Unit.prototype = new Node(); Unit.prototype.type = "Unit"; Unit.prototype.clone = function () { - return new Unit(this.numerator.slice(0), this.denominator.slice(0), this.backupUnit); + return new Unit(utils.copyArray(this.numerator), utils.copyArray(this.denominator), this.backupUnit); }; Unit.prototype.genCSS = function (context, output) { // Dimension checks the unit is singular and throws an error if in strict math mode. @@ -9025,13 +9077,13 @@ Unit.prototype.cancel = function () { }; module.exports = Unit; -},{"../data/unit-conversions":15,"./node":73}],83:[function(require,module,exports){ +},{"../data/unit-conversions":15,"../utils":86,"./node":73}],83:[function(require,module,exports){ var Node = require("./node"); var URL = function (val, index, currentFileInfo, isEvald) { this.value = val; - this.currentFileInfo = currentFileInfo; - this.index = index; + this._index = index; + this._fileInfo = currentFileInfo; this.isEvald = isEvald; }; URL.prototype = new Node(); @@ -9050,7 +9102,7 @@ URL.prototype.eval = function (context) { if (!this.isEvald) { // Add the base path if the URL is relative - rootpath = this.currentFileInfo && this.currentFileInfo.rootpath; + rootpath = this.fileInfo() && this.fileInfo().rootpath; if (rootpath && typeof val.value === "string" && context.isPathRelative(val.value)) { @@ -9077,7 +9129,7 @@ URL.prototype.eval = function (context) { } } - return new URL(val, this.index, this.currentFileInfo, true); + return new URL(val, this.getIndex(), this.fileInfo(), true); }; module.exports = URL; @@ -9122,8 +9174,8 @@ var Node = require("./node"); var Variable = function (name, index, currentFileInfo) { this.name = name; - this.index = index; - this.currentFileInfo = currentFileInfo || {}; + this._index = index; + this._fileInfo = currentFileInfo; }; Variable.prototype = new Node(); Variable.prototype.type = "Variable"; @@ -9131,14 +9183,14 @@ Variable.prototype.eval = function (context) { var variable, name = this.name; if (name.indexOf('@@') === 0) { - name = '@' + new Variable(name.slice(1), this.index, this.currentFileInfo).eval(context).value; + name = '@' + new Variable(name.slice(1), this.getIndex(), this.fileInfo()).eval(context).value; } if (this.evaluating) { throw { type: 'Name', message: "Recursive variable definition for " + name, - filename: this.currentFileInfo.filename, - index: this.index }; + filename: this.fileInfo().filename, + index: this.getIndex() }; } this.evaluating = true; @@ -9159,8 +9211,8 @@ Variable.prototype.eval = function (context) { } else { throw { type: 'Name', message: "variable " + name + " is undefined", - filename: this.currentFileInfo.filename, - index: this.index }; + filename: this.fileInfo().filename, + index: this.getIndex() }; } }; Variable.prototype.find = function (obj, fun) { @@ -9191,13 +9243,23 @@ module.exports = { line: line, column: column }; + }, + copyArray: function(arr) { + var i, length = arr.length, + copy = new Array(length); + + for (i = 0; i < length; i++) { + copy[i] = arr[i]; + } + return copy; } }; },{}],87:[function(require,module,exports){ var tree = require("../tree"), Visitor = require("./visitor"), - logger = require("../logger"); + logger = require("../logger"), + utils = require("../utils"); /*jshint loopfunc:true */ @@ -9243,7 +9305,7 @@ ExtendFinderVisitor.prototype = { selector = selectorPath[selectorPath.length - 1], selExtendList = selector.extendList; - extendList = selExtendList ? selExtendList.slice(0).concat(allSelectorsExtendList) + extendList = selExtendList ? utils.copyArray(selExtendList).concat(allSelectorsExtendList) : allSelectorsExtendList; if (extendList) { @@ -9363,7 +9425,7 @@ ProcessExtendsVisitor.prototype = { newSelector = extendVisitor.extendSelector(matches, selectorPath, selfSelector, extend.isVisible()); // but now we create a new extend from it - newExtend = new(tree.Extend)(targetExtend.selector, targetExtend.option, 0, targetExtend.currentFileInfo, info); + newExtend = new(tree.Extend)(targetExtend.selector, targetExtend.option, 0, targetExtend.fileInfo(), info); newExtend.selfSelectors = newSelector; // add the extend onto the list of extends for that selector @@ -9581,8 +9643,8 @@ ProcessExtendsVisitor.prototype = { firstElement = new tree.Element( match.initialCombinator, replacementSelector.elements[0].value, - replacementSelector.elements[0].index, - replacementSelector.elements[0].currentFileInfo + replacementSelector.elements[0].getIndex(), + replacementSelector.elements[0].fileInfo() ); if (match.pathIndex > currentSelectorPathIndex && currentSelectorPathElementIndex > 0) { @@ -9656,7 +9718,7 @@ ProcessExtendsVisitor.prototype = { module.exports = ProcessExtendsVisitor; -},{"../logger":35,"../tree":65,"./visitor":94}],88:[function(require,module,exports){ +},{"../logger":35,"../tree":65,"../utils":86,"./visitor":94}],88:[function(require,module,exports){ function ImportSequencer(onSequencerEmpty) { this.imports = []; this.variableImports = []; @@ -9715,7 +9777,8 @@ module.exports = ImportSequencer; },{}],89:[function(require,module,exports){ var contexts = require("../contexts"), Visitor = require("./visitor"), - ImportSequencer = require("./import-sequencer"); + ImportSequencer = require("./import-sequencer"), + utils = require("../utils"); var ImportVisitor = function(importer, finish) { @@ -9754,7 +9817,7 @@ ImportVisitor.prototype = { if (!importNode.css || inlineCSS) { - var context = new contexts.Eval(this.context, this.context.frames.slice(0)); + var context = new contexts.Eval(this.context, utils.copyArray(this.context.frames)); var importParent = context.frames[0]; this.importCount++; @@ -9773,7 +9836,7 @@ ImportVisitor.prototype = { try { evaldImportNode = importNode.evalForImport(context); } catch(e) { - if (!e.filename) { e.index = importNode.index; e.filename = importNode.currentFileInfo.filename; } + if (!e.filename) { e.index = importNode.getIndex(); e.filename = importNode.fileInfo().filename; } // attempt to eval properly and treat as css importNode.css = true; // if that fails, this error will be thrown @@ -9799,7 +9862,7 @@ ImportVisitor.prototype = { var onImported = this.onImported.bind(this, evaldImportNode, context), sequencedOnImported = this._sequencer.addImport(onImported); - this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.currentFileInfo, + this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.fileInfo(), evaldImportNode.options, sequencedOnImported); } else { this.importCount--; @@ -9811,7 +9874,7 @@ ImportVisitor.prototype = { onImported: function (importNode, context, e, root, importedAtRoot, fullPath) { if (e) { if (!e.filename) { - e.index = importNode.index; e.filename = importNode.currentFileInfo.filename; + e.index = importNode.getIndex(); e.filename = importNode.fileInfo().filename; } this.error = e; } @@ -9903,7 +9966,7 @@ ImportVisitor.prototype = { }; module.exports = ImportVisitor; -},{"../contexts":12,"./import-sequencer":88,"./visitor":94}],90:[function(require,module,exports){ +},{"../contexts":12,"../utils":86,"./import-sequencer":88,"./visitor":94}],90:[function(require,module,exports){ var visitors = { Visitor: require("./visitor"), ImportVisitor: require('./import-visitor'), @@ -10217,15 +10280,15 @@ ToCSSVisitor.prototype = { var ruleNode = rules[i]; if (isRoot && ruleNode instanceof tree.Declaration && !ruleNode.variable) { throw { message: "Properties must be inside selector blocks. They cannot be in the root", - index: ruleNode.index, filename: ruleNode.currentFileInfo && ruleNode.currentFileInfo.filename}; + index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename}; } if (ruleNode instanceof tree.Call) { throw { message: "Function '" + ruleNode.name + "' is undefined", - index: ruleNode.index, filename: ruleNode.currentFileInfo && ruleNode.currentFileInfo.filename}; + index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename}; } if (ruleNode.type && !ruleNode.allowRoot) { throw { message: ruleNode.type + " node returned by a function is not valid here", - index: ruleNode.index, filename: ruleNode.currentFileInfo && ruleNode.currentFileInfo.filename}; + index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename}; } } }, diff --git a/dist/less.min.js b/dist/less.min.js index e120f29f2..0499ea1d3 100644 --- a/dist/less.min.js +++ b/dist/less.min.js @@ -1,5 +1,5 @@ /*! - * Less - Leaner CSS v3.0.0-pre.1 + * Less - Leaner CSS v3.0.0-pre.2 * http://lesscss.org * * Copyright (c) 2009-2016, Alexis Sellier @@ -10,8 +10,8 @@ /** * @license Apache-2.0 */ -!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.less=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0||b.isFileProtocol?"development":"production");var c=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(a.location.hash);c&&(b.dumpLineNumbers=c[1]),void 0===b.useFileCache&&(b.useFileCache=!0),void 0===b.onReady&&(b.onReady=!0),b.javascriptEnabled=!(!b.javascriptEnabled&&!b.inlineJavaScript)}},{"./browser":3,"./utils":11}],2:[function(a,b,c){function d(a){a.filename&&console.warn(a),e.async||h.removeChild(i)}a("promise/polyfill.js");var e=window.less||{};a("./add-default-options")(window,e);var f=b.exports=a("./index")(window,e);window.less=f;var g,h,i;e.onReady&&(/!watch/.test(window.location.hash)&&f.watch(),e.async||(g="body { display: none !important }",h=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),i.type="text/css",i.styleSheet?i.styleSheet.cssText=g:i.appendChild(document.createTextNode(g)),h.appendChild(i)),f.registerStylesheetsImmediately(),f.pageLoadFinished=f.refresh("development"===f.env).then(d,d))},{"./add-default-options":1,"./index":8,"promise/polyfill.js":102}],3:[function(a,b,c){var d=a("./utils");b.exports={createCSS:function(a,b,c){var e=c.href||"",f="less:"+(c.title||d.extractId(e)),g=a.getElementById(f),h=!1,i=a.createElement("style");i.setAttribute("type","text/css"),c.media&&i.setAttribute("media",c.media),i.id=f,i.styleSheet||(i.appendChild(a.createTextNode(b)),h=null!==g&&g.childNodes.length>0&&i.childNodes.length>0&&g.firstChild.nodeValue===i.firstChild.nodeValue);var j=a.getElementsByTagName("head")[0];if(null===g||h===!1){var k=c&&c.nextSibling||null;k?k.parentNode.insertBefore(i,k):j.appendChild(i)}if(g&&h===!1&&g.parentNode.removeChild(g),i.styleSheet)try{i.styleSheet.cssText=b}catch(l){throw new Error("Couldn't reassign styleSheet.cssText.")}},currentScript:function(a){var b=a.document;return b.currentScript||function(){var a=b.getElementsByTagName("script");return a[a.length-1]}()}}},{"./utils":11}],4:[function(a,b,c){b.exports=function(a,b,c){var d=null;if("development"!==b.env)try{d="undefined"==typeof a.localStorage?null:a.localStorage}catch(e){}return{setCSS:function(a,b,e,f){if(d){c.info("saving "+a+" to cache.");try{d.setItem(a,f),d.setItem(a+":timestamp",b),e&&d.setItem(a+":vars",JSON.stringify(e))}catch(g){c.error('failed to save "'+a+'" to local storage for caching.')}}},getCSS:function(a,b,c){var e=d&&d.getItem(a),f=d&&d.getItem(a+":timestamp"),g=d&&d.getItem(a+":vars");if(c=c||{},f&&b.lastModified&&new Date(b.lastModified).valueOf()===new Date(f).valueOf()&&(!c&&!g||JSON.stringify(c)===g))return e}}}},{}],5:[function(a,b,c){var d=a("./utils"),e=a("./browser");b.exports=function(a,b,c){function f(b,f){var g,h,i="less-error-message:"+d.extractId(f||""),j='
  • {content}
  • ',k=a.document.createElement("div"),l=[],m=b.filename||f,n=m.match(/([^\/]+(\?.*)?)$/)[1];k.id=i,k.className="less-error-message",h="

    "+(b.type||"Syntax")+"Error: "+(b.message||"There is an error in your .less file")+'

    in '+n+" ";var o=function(a,b,c){void 0!==a.extract[b]&&l.push(j.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};b.extract&&(o(b,0,""),o(b,1,"line"),o(b,2,""),h+="on line "+b.line+", column "+(b.column+1)+":

      "+l.join("")+"
    "),b.stack&&(b.extract||c.logLevel>=4)&&(h+="
    Stack Trace
    "+b.stack.split("\n").slice(1).join("
    ")),k.innerHTML=h,e.createCSS(a.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),k.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===c.env&&(g=setInterval(function(){var b=a.document,c=b.body;c&&(b.getElementById(i)?c.replaceChild(k,b.getElementById(i)):c.insertBefore(k,c.firstChild),clearInterval(g))},10))}function g(b){var c=a.document.getElementById("less-error-message:"+d.extractId(b));c&&c.parentNode.removeChild(c)}function h(a){}function i(a){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?h(a):"function"==typeof c.errorReporting&&c.errorReporting("remove",a):g(a)}function j(a,d){var e="{line} {content}",f=a.filename||d,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f+" ",i=function(a,b,c){void 0!==a.extract[b]&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.extract&&(i(a,0,""),i(a,1,"line"),i(a,2,""),h+="on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")),a.stack&&(a.extract||c.logLevel>=4)&&(h+="\nStack Trace\n"+a.stack),b.logger.error(h)}function k(a,b){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?j(a,b):"function"==typeof c.errorReporting&&c.errorReporting("add",a,b):f(a,b)}return{add:k,remove:i}}},{"./browser":3,"./utils":11}],6:[function(a,b,c){b.exports=function(b,c){function d(){if(window.XMLHttpRequest&&!("file:"===window.location.protocol&&"ActiveXObject"in window))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){return c.error("browser doesn't support AJAX."),null}}var e=a("../less/environment/abstract-file-manager.js"),f={},g=function(){};return g.prototype=new e,g.prototype.alwaysMakePathsAbsolute=function(){return!0},g.prototype.join=function(a,b){return a?this.extractUrlParts(b,a).path:b},g.prototype.doXHR=function(a,e,f,g){function h(b,c,d){b.status>=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var i=d(),j=!b.isFileProtocol||b.fileAsync;"function"==typeof i.overrideMimeType&&i.overrideMimeType("text/css"),c.debug("XHR: Getting '"+a+"'"),i.open("GET",a,j),i.setRequestHeader("Accept",e||"text/x-less, text/css; q=0.9, */*; q=0.5"),i.send(null),b.isFileProtocol&&!b.fileAsync?0===i.status||i.status>=200&&i.status<300?f(i.responseText):g(i.status,a):j?i.onreadystatechange=function(){4==i.readyState&&h(i,f,g)}:h(i,f,g)},g.prototype.supports=function(a,b,c,d){return!0},g.prototype.clearFileCache=function(){f={}},g.prototype.loadFile=function(a,b,c,d,e){b&&!this.isPathAbsolute(a)&&(a=b+a),c=c||{};var g=this.extractUrlParts(a,window.location.href),h=g.url;if(c.useFileCache&&f[h])try{var i=f[h];e(null,{contents:i,filename:h,webInfo:{lastModified:new Date}})}catch(j){e({filename:h,message:"Error loading file "+h+" error was "+j.message})}else this.doXHR(h,c.mime,function(a,b){f[h]=a,e(null,{contents:a,filename:h,webInfo:{lastModified:b}})},function(a,b){e({type:"File",message:"'"+b+"' wasn't found ("+a+")",href:h})})},g}},{"../less/environment/abstract-file-manager.js":16}],7:[function(a,b,c){b.exports=function(){function b(){throw{type:"Runtime",message:"Image size functions are not supported in browser version of less"}}var c=a("./../less/functions/function-registry"),d={"image-size":function(a){return b(this,a),-1},"image-width":function(a){return b(this,a),-1},"image-height":function(a){return b(this,a),-1}};c.addMultiple(d)}},{"./../less/functions/function-registry":24}],8:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(b,c){function f(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function g(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}}function h(a){for(var b,d=l.getElementsByTagName("style"),e=0;e=c&&console.log(a)},info:function(a){b.logLevel>=d&&console.log(a)},warn:function(a){b.logLevel>=e&&console.warn(a)},error:function(a){b.logLevel>=f&&console.error(a)}}]);for(var g=0;g0&&(a=a.slice(0,b)),b=a.lastIndexOf("/"),b<0&&(b=a.lastIndexOf("\\")),b<0?"":a.slice(0,b+1)},d.prototype.tryAppendExtension=function(a,b){return/(\.[a-z]*$)|([\?;].*)$/.test(a)?a:a+b},d.prototype.tryAppendLessExtension=function(a){return this.tryAppendExtension(a,".less")},d.prototype.supportsSync=function(){return!1},d.prototype.alwaysMakePathsAbsolute=function(){return!1},d.prototype.isPathAbsolute=function(a){return/^(?:[a-z-]+:|\/|\\|#)/i.test(a)},d.prototype.join=function(a,b){return a?a+b:b},d.prototype.pathDiff=function(a,b){var c,d,e,f,g=this.extractUrlParts(a),h=this.extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;c0&&(h.splice(c-1,2),c-=2)}return g.hostPart=f[1],g.directories=h,g.path=(f[1]||"")+h.join("/"),g.fileUrl=g.path+(f[4]||""),g.url=g.fileUrl+(f[5]||""),g},b.exports=d},{}],17:[function(a,b,c){function d(a,b){throw new f({type:b||"Syntax",message:a})}var e=a("../functions/function-registry"),f=a("../less-error"),g=function(){};g.prototype.evalPlugin=function(a,b,c,d){var f,g,h,i,j,k,l;if(k=b.pluginManager,d&&(l="string"==typeof d?d:d.filename),l&&(h=k.get(l)))return this.trySetOptions(h,l,c),h.use&&h.use(this.less),h;i={exports:{},pluginManager:k,fileInfo:d},j=i.exports,g=e.create();try{if(f=new Function("module","require","functions","tree","fileInfo","less",a),h=f(i,this.require,g,this.less.tree,d,this.less),h||(h=i.exports),h=this.validatePlugin(h,l),!h)throw new SyntaxError("Not a valid plugin");k.addPlugin(h,d.filename),h.functions=g.getLocalFunctions(),this.trySetOptions(h,l,c),h.use&&h.use(this.less)}catch(m){return console.log(m),new this.less.LessError({message:"Plugin evaluation error: '"+m.name+": "+m.message.replace(/["]/g,"'")+"'",filename:l,line:this.line,col:this.column})}return h},g.prototype.trySetOptions=function(b,c,e){var f=a("path").basename(c);if(e){if(!b.setOptions)return d("Options have been provided but the plugin "+f+" does not support any options."),null;try{b.setOptions(e)}catch(g){return d("Error setting options on plugin "+f+"\n"+g.message),null}}},g.prototype.validatePlugin=function(b,c){if(b){"function"==typeof b&&(b=new b);var e=a("path").basename(c);return b.minVersion&&this.compareVersion(b.minVersion,this.less.version)<0?(d("Plugin "+e+" requires version "+this.versionToString(b.minVersion)),null):b}return null},g.prototype.compareVersion=function(a,b){"string"==typeof a&&(a=a.match(/^(\d+)\.?(\d+)?\.?(\d+)?/),a.shift());for(var c=0;cparseInt(b[c])?-1:1;return 0},g.prototype.versionToString=function(a){for(var b="",c=0;c=0;h--){var i=g[h];if(i[f?"supportsSync":"supports"](a,b,c,e))return i}return null},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},b.exports=e},{"../logger":35}],19:[function(a,b,c){function d(a,b,c){var d,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;l<3;l++)d=b.rgb[l]/255,f=c.rgb[l]/255,h=a(d,f),g&&(h=(j*f+i*(d-j*(d+f-h)))/g),k[l]=255*h;return new e(k,g)}var e=a("../tree/color"),f=a("./function-registry"),g={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,a<=1?g.multiply(a,b):g.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return g.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};for(var h in g)g.hasOwnProperty(h)&&(d[h]=d.bind(null,g[h]));f.addMultiple(d)},{"../tree/color":52,"./function-registry":24}],20:[function(a,b,c){function d(a){return Math.min(1,Math.max(0,a))}function e(a){return h.hsla(a.h,a.s,a.l,a.a)}function f(a){if(a instanceof i)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{type:"Argument",message:"color functions take numbers as parameters"}}function g(a,b){return a instanceof i&&a.unit.is("%")?parseFloat(a.value*b/100):f(a)}var h,i=a("../tree/dimension"),j=a("../tree/color"),k=a("../tree/quoted"),l=a("../tree/anonymous"),m=a("./function-registry");h={rgb:function(a,b,c){return h.rgba(a,b,c,1)},rgba:function(a,b,c,d){var e=[a,b,c].map(function(a){return g(a,255)});return d=f(d),new j(e,d)},hsl:function(a,b,c){return h.hsla(a,b,c,1)},hsla:function(a,b,c,e){function g(a){return a=a<0?a+1:a>1?a-1:a,6*a<1?i+(j-i)*a*6:2*a<1?j:3*a<2?i+(j-i)*(2/3-a)*6:i}var i,j;return a=f(a)%360/360,b=d(f(b)),c=d(f(c)),e=d(f(e)),j=c<=.5?c*(b+1):c+b-c*b,i=2*c-j,h.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),e)},hsv:function(a,b,c){return h.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=f(a)%360/360*360,b=f(b),c=f(c),d=f(d);var e,g;e=Math.floor(a/60%6),g=a/60-e;var i=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],j=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return h.rgba(255*i[j[e][0]],255*i[j[e][1]],255*i[j[e][2]],d)},hue:function(a){return new i(a.toHSL().h)},saturation:function(a){return new i(100*a.toHSL().s,"%")},lightness:function(a){return new i(100*a.toHSL().l,"%")},hsvhue:function(a){return new i(a.toHSV().h)},hsvsaturation:function(a){return new i(100*a.toHSV().s,"%")},hsvvalue:function(a){return new i(100*a.toHSV().v,"%")},red:function(a){return new i(a.rgb[0])},green:function(a){return new i(a.rgb[1])},blue:function(a){return new i(a.rgb[2])},alpha:function(a){return new i(a.toHSL().a)},luma:function(a){return new i(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new i(b*a.alpha*100,"%")},saturate:function(a,b,c){if(!a.rgb)return null;var f=a.toHSL();return f.s+="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},desaturate:function(a,b,c){var f=a.toHSL();return f.s-="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},lighten:function(a,b,c){var f=a.toHSL();return f.l+="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},darken:function(a,b,c){var f=a.toHSL();return f.l-="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},fadein:function(a,b,c){var f=a.toHSL();return f.a+="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fadeout:function(a,b,c){var f=a.toHSL();return f.a-="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=d(c.a),e(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=d<0?360+d:d,e(c)},mix:function(a,b,c){a.toHSL&&b.toHSL||(console.log(b.type),console.dir(b)),c||(c=new i(50));var d=c.value/100,e=2*d-1,f=a.toHSL().a-b.toHSL().a,g=((e*f==-1?e:(e+f)/(1+e*f))+1)/2,h=1-g,k=[a.rgb[0]*g+b.rgb[0]*h,a.rgb[1]*g+b.rgb[1]*h,a.rgb[2]*g+b.rgb[2]*h],l=a.alpha*d+b.alpha*(1-d);return new j(k,l)},greyscale:function(a){return h.desaturate(a,new i(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;"undefined"==typeof b&&(b=h.rgba(0,0,0,1)),"undefined"==typeof c&&(c=h.rgba(255,255,255,1));var e,f,g=a.luma(),i=b.luma(),j=c.luma();return e=g>i?(g+.05)/(i+.05):(i+.05)/(g+.05),f=g>j?(g+.05)/(j+.05):(j+.05)/(g+.05),e>f?b:c},argb:function(a){return new l(a.toARGB())},color:function(a){if(a instanceof k&&/^#([a-f0-9]{6}|[a-f0-9]{3})$/i.test(a.value))return new j(a.value.slice(1));if(a instanceof j||(a=j.fromKeyword(a.value)))return a.value=void 0,a;throw{type:"Argument",message:"argument must be a color keyword or 3/6 digit hex e.g. #FFF"}},tint:function(a,b){return h.mix(h.rgb(255,255,255),a,b)},shade:function(a,b){return h.mix(h.rgb(0,0,0),a,b)}},m.addMultiple(h)},{"../tree/anonymous":47,"../tree/color":52,"../tree/dimension":59,"../tree/quoted":76,"./function-registry":24}],21:[function(a,b,c){b.exports=function(b){var c=a("../tree/quoted"),d=a("../tree/url"),e=a("./function-registry"),f=function(a,b){return new d(b,a.index,a.currentFileInfo).eval(a.context)},g=a("../logger");e.add("data-uri",function(a,e){e||(e=a,a=null);var h=a&&a.value,i=e.value,j=this.currentFileInfo,k=j.relativeUrls?j.currentDirectory:j.entryPath,l=i.indexOf("#"),m="";l!==-1&&(m=i.slice(l),i=i.slice(0,l));var n=b.getFileManager(i,k,this.context,b,!0);if(!n)return f(this,e);var o=!1;if(a)o=/;base64$/.test(h);else{if(h=b.mimeLookup(i),"image/svg+xml"===h)o=!1;else{var p=b.charsetLookup(h);o=["US-ASCII","UTF-8"].indexOf(p)<0}o&&(h+=";base64")}var q=n.loadFileSync(i,k,this.context,b);if(!q.contents)return g.warn("Skipped data-uri embedding of "+i+" because file not found"),f(this,e||a);var r=q.contents;if(o&&!b.encodeBase64)return f(this,e);r=o?b.encodeBase64(r):encodeURIComponent(r);var s="data:"+h+","+r+m,t=32768;return s.length>=t&&this.context.ieCompat!==!1?(g.warn("Skipped data-uri embedding of "+i+" because its size ("+s.length+" characters) exceeds IE8-safe "+t+" characters!"),f(this,e||a)):new d(new c('"'+s+'"',s,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../logger":35,"../tree/quoted":76,"../tree/url":83,"./function-registry":24}],22:[function(a,b,c){var d=a("../tree/keyword"),e=a("./function-registry"),f={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;if(null!=a)return a?d.True:d.False},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}};e.add("default",f.eval.bind(f)),b.exports=f},{"../tree/keyword":68,"./function-registry":24}],23:[function(a,b,c){var d=a("../tree/expression"),e=function(a,b,c,d){this.name=a.toLowerCase(),this.index=c,this.context=b,this.currentFileInfo=d,this.func=b.frames[0].functionRegistry.get(this.name)};e.prototype.isValid=function(){return Boolean(this.func)},e.prototype.call=function(a){return Array.isArray(a)&&(a=a.filter(function(a){return"Comment"!==a.type}).map(function(a){if("Expression"===a.type){var b=a.value.filter(function(a){return"Comment"!==a.type});return 1===b.length?b[0]:new d(b)}return a})),this.func.apply(this,a)},b.exports=e},{"../tree/expression":62}],24:[function(a,b,c){function d(a){return{_data:{},add:function(a,b){a=a.toLowerCase(),this._data.hasOwnProperty(a),this._data[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){this.add(b,a[b])}.bind(this))},get:function(b){return this._data[b]||a&&a.get(b)},getLocalFunctions:function(){return this._data},inherit:function(){return d(this)},create:function(a){return d(a)}}}b.exports=d(null)},{}],25:[function(a,b,c){b.exports=function(b){var c={functionRegistry:a("./function-registry"),functionCaller:a("./function-caller")};return a("./default"),a("./color"),a("./color-blending"),a("./data-uri")(b),a("./math"),a("./number"),a("./string"),a("./svg")(b),a("./types"),c}},{"./color":20,"./color-blending":19,"./data-uri":21,"./default":22,"./function-caller":23,"./function-registry":24,"./math":27,"./number":28,"./string":29,"./svg":30,"./types":31}],26:[function(a,b,c){var d=a("../tree/dimension"),e=function(){};e._math=function(a,b,c){if(!(c instanceof d))throw{type:"Argument",message:"argument must be a number"};return null==b?b=c.unit:c=c.unify(),new d(a(parseFloat(c.value)),b)},b.exports=e},{"../tree/dimension":59}],27:[function(a,b,c){var d=a("./function-registry"),e=a("./math-helper.js"),f={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"};for(var g in f)f.hasOwnProperty(g)&&(f[g]=e._math.bind(null,Math[g],f[g])); -f.round=function(a,b){var c="undefined"==typeof b?0:b.value;return e._math(function(a){return a.toFixed(c)},null,a)},d.addMultiple(f)},{"./function-registry":24,"./math-helper.js":26}],28:[function(a,b,c){var d=a("../tree/dimension"),e=a("../tree/anonymous"),f=a("./function-registry"),g=a("./math-helper.js"),h=function(a,b){switch(b=Array.prototype.slice.call(b),b.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var c,f,g,h,i,j,k,l,m=[],n={};for(c=0;ci.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(b[c].value)&&Array.prototype.push.apply(b,Array.prototype.slice.call(b[c].value));return 1==m.length?m[0]:(b=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new e((a?"min":"max")+"("+b+")"))};f.addMultiple({min:function(){return h(!0,arguments)},max:function(){return h(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new d(Math.PI)},mod:function(a,b){return new d(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d(a),b=new d(b);else if(!(a instanceof d&&b instanceof d))throw{type:"Argument",message:"arguments must be numbers"};return new d(Math.pow(a.value,b.value),a.unit)},percentage:function(a){var b=g._math(function(a){return 100*a},"%",a);return b}})},{"../tree/anonymous":47,"../tree/dimension":59,"./function-registry":24,"./math-helper.js":26}],29:[function(a,b,c){var d=a("../tree/quoted"),e=a("../tree/anonymous"),f=a("../tree/javascript"),g=a("./function-registry");g.addMultiple({e:function(a){return new e(a instanceof f?a.evaluated:a.value)},escape:function(a){return new e(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,b,c,e){var f=a.value;return c="Quoted"===c.type?c.value:c.toCSS(),f=f.replace(new RegExp(b.value,e?e.value:""),c),new d(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;e",k=0;k";return j+="',j=encodeURIComponent(j),j="data:image/svg+xml,"+j,new g(new f("'"+j+"'",j,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":52,"../tree/dimension":59,"../tree/expression":62,"../tree/quoted":76,"../tree/url":83,"./function-registry":24}],31:[function(a,b,c){var d=a("../tree/keyword"),e=a("../tree/detached-ruleset"),f=a("../tree/dimension"),g=a("../tree/color"),h=a("../tree/quoted"),i=a("../tree/anonymous"),j=a("../tree/url"),k=a("../tree/operation"),l=a("./function-registry"),m=function(a,b){return a instanceof b?d.True:d.False},n=function(a,b){if(void 0===b)throw{type:"Argument",message:"missing the required second argument to isunit."};if(b="string"==typeof b.value?b.value:b,"string"!=typeof b)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof f&&a.unit.is(b)?d.True:d.False},o=function(a){var b=Array.isArray(a.value)?a.value:Array(a);return b};l.addMultiple({isruleset:function(a){return m(a,e)},iscolor:function(a){return m(a,g)},isnumber:function(a){return m(a,f)},isstring:function(a){return m(a,h)},iskeyword:function(a){return m(a,d)},isurl:function(a){return m(a,j)},ispixel:function(a){return n(a,"px")},ispercentage:function(a){return n(a,"%")},isem:function(a){return n(a,"em")},isunit:n,unit:function(a,b){if(!(a instanceof f))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof k?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d?b.value:b.toCSS():"",new f(a.value,b)},"get-unit":function(a){return new i(a.unit)},extract:function(a,b){return b=b.value-1,o(a)[b]},length:function(a){return new f(o(a).length)}})},{"../tree/anonymous":47,"../tree/color":52,"../tree/detached-ruleset":58,"../tree/dimension":59,"../tree/keyword":68,"../tree/operation":74,"../tree/quoted":76,"../tree/url":83,"./function-registry":24}],32:[function(a,b,c){var d=a("./contexts"),e=a("./parser/parser"),f=a("./less-error");b.exports=function(a){var b=function(a,b,c){this.less=a,this.rootFilename=c.filename,this.paths=b.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=b.mime,this.error=null,this.context=b,this.queue=[],this.files={}};return b.prototype.push=function(b,c,g,h,i){var j=this,k=this.context.pluginManager.Loader;this.queue.push(b);var l=function(a,c,d){j.queue.splice(j.queue.indexOf(b),1);var e=d===j.rootFilename;h.optional&&a?i(null,{rules:[]},!1,null):(j.files[d]=c,a&&!j.error&&(j.error=a),i(a,c,e,d))},m={relativeUrls:this.context.relativeUrls,entryPath:g.entryPath,rootpath:g.rootpath,rootFilename:g.rootFilename},n=a.getFileManager(b,g.currentDirectory,this.context,a);if(!n)return void l({message:"Could not find a file-manager for "+b});c&&(b=h.isPlugin?b:n.tryAppendExtension(b,".less"));var o,p=function(a){var b,c=a.filename,i=a.contents.replace(/^\uFEFF/,"");m.currentDirectory=n.getPath(c),m.relativeUrls&&(m.rootpath=n.join(j.context.rootpath||"",n.pathDiff(m.currentDirectory,m.entryPath)),!n.isPathAbsolute(m.rootpath)&&n.alwaysMakePathsAbsolute()&&(m.rootpath=n.join(m.entryPath,m.rootpath))),m.filename=c;var o=new d.Parse(j.context);o.processImports=!1,j.contents[c]=i,(g.reference||h.reference)&&(m.reference=!0),h.isPlugin?(b=k.evalPlugin(i,o,h.pluginArgs,m),b instanceof f?l(b,null,c):l(null,b,c)):h.inline?l(null,i,c):new e(o,j,m).parse(i,function(a,b){l(a,b,c)})},q=function(a,b){a?l(a):p(b)};if(h.isPlugin)try{k.tryLoadPlugin(b,g.currentDirectory,q)}catch(r){i(r)}else o=n.loadFile(b,g.currentDirectory,this.context,a,q),o&&o.then(p,l)},b}},{"./contexts":12,"./less-error":34,"./parser/parser":40}],33:[function(a,b,c){b.exports=function(b,c){var d,e,f,g,h,i={version:[3,0,0],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),AbstractPluginLoader:a("./environment/abstract-plugin-loader"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")};return i}},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":16,"./environment/abstract-plugin-loader":17,"./environment/environment":18,"./functions":25,"./import-manager":32,"./less-error":34,"./logger":35,"./parse":37,"./parse-tree":36,"./parser/parser":40,"./plugin-manager":41,"./render":42,"./source-map-builder":43,"./source-map-output":44,"./transform-tree":45,"./tree":65,"./utils":86,"./visitors":90}],34:[function(a,b,c){var d=a("./utils"),e=b.exports=function(a,b,c){Error.call(this);var e=a.filename||c;if(b&&e){var f=b.contents[e],g=d.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&d.getLocation(a.call,f).line,k=f.split("\n");this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.callLine=j+1,this.callExtract=k[j],this.column=i,this.extract=[k[h-1],k[h],k[h+1]]}this.message=a.message,this.stack=a.stack};if("undefined"==typeof Object.create){var f=function(){};f.prototype=Error.prototype,e.prototype=new f}else e.prototype=Object.create(Error.prototype);e.prototype.constructor=e},{"./utils":86}],35:[function(a,b,c){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;b=97&&j<=122||j<34))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(h96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;hd&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],39:[function(a,b,c){var d=a("./chunker");b.exports=function(){function a(d){for(var e,f,j,p=k.i,q=c,s=k.i-i,t=k.i+h.length-s,u=k.i+=d,v=b;k.i=0){j={index:k.i,text:v.substr(k.i,x+2-k.i),isLineComment:!1},k.i+=j.text.length-1,k.commentStore.push(j);continue}}break}if(e!==l&&e!==n&&e!==m&&e!==o)break}if(h=h.slice(d+k.i-u+s),i=k.i,!h.length){if(ce||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,c=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$re=function(b){k.i>i&&(h=h.slice(k.i-i),i=k.i);var c=b.exec(h);return c?(a(c[0].length),"string"==typeof c?c:1===c.length?c[0]:c):null},k.$char=function(c){return b.charAt(k.i)!==c?null:(a(1),c)},k.$str=function(c){for(var d=c.length,e=0;es||a=b.length;return k.i=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":38}],40:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=function j(a,b,c){function i(a,e){throw new d({index:o.i,filename:c.filename,type:e||"Syntax",message:a},b)}function k(a,b,c){var d=a instanceof Function?a.call(n):o.$re(a);return d?d:void i(b||("string"==typeof a?"expected '"+a+"' got '"+o.currentChar()+"'":"unexpected token"))}function l(a,b){return o.$char(a)?a:void i(b||"expected '"+a+"' got '"+o.currentChar()+"'")}function m(a){var b=c.filename;return{lineNumber:h.getLocation(a,o.getInput()).line+1,fileName:b}}var n,o=g();return{parse:function(g,h,i){var k,l,m,n,p=null,q="";if(l=i&&i.globalVars?j.serializeVars(i.globalVars)+"\n":"",m=i&&i.modifyVars?"\n"+j.serializeVars(i.modifyVars):"",a.pluginManager)for(var r=a.pluginManager.getPreProcessors(),s=0;s1&&(b=new e.Value(g)),d.push(b),g=[])}return o.forget(),a?d:f},literal:function(){return this.dimension()||this.color()||this.quoted()||this.unicodeDescriptor()},assignment:function(){var a,b;return o.save(),(a=o.$re(/^\w+(?=\s?=)/i))&&o.$char("=")&&(b=n.entity())?(o.forget(),new e.Assignment(a,b)):void o.restore()},url:function(){var a,b=o.i;return o.autoCommentAbsorb=!1,o.$str("url(")?(a=this.quoted()||this.variable()||o.$re(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",o.autoCommentAbsorb=!0,l(")"),new e.URL(null!=a.value||a instanceof e.Variable?a:new e.Anonymous(a),b,c)):void(o.autoCommentAbsorb=!0)},variable:function(){var a,b=o.i;if("@"===o.currentChar()&&(a=o.$re(/^@@?[\w-]+/)))return new e.Variable(a,b,c)},variableCurly:function(){var a,b=o.i;if("@"===o.currentChar()&&(a=o.$re(/^@\{([\w-]+)\}/)))return new e.Variable("@"+a[1],b,c)},color:function(){var a;if("#"===o.currentChar()&&(a=o.$re(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))){var b=a.input.match(/^#([\w]+).*/);return b=b[1],b.match(/^[A-Fa-f0-9]+$/)||i("Invalid HEX color code"),new e.Color(a[1],(void 0),"#"+b)}},colorKeyword:function(){o.save();var a=o.autoCommentAbsorb;o.autoCommentAbsorb=!1;var b=o.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/);if(o.autoCommentAbsorb=a,!b)return void o.forget();o.restore();var c=e.Color.fromKeyword(b);return c?(o.$str(b),c):void 0},dimension:function(){if(!o.peekNotNumeric()){var a=o.$re(/^([+-]?\d*\.?\d+)(%|[a-z_]+)?/i);return a?new e.Dimension(a[1],a[2]):void 0}},unicodeDescriptor:function(){var a;if(a=o.$re(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/))return new e.UnicodeDescriptor(a[0])},javascript:function(){var a,b=o.i;o.save();var d=o.$char("~"),f=o.$char("`");return f?(a=o.$re(/^[^`]*`/))?(o.forget(),new e.JavaScript(a.substr(0,a.length-1),Boolean(d),b,c)):void o.restore("invalid javascript definition"):void o.restore()}},variable:function(){var a;if("@"===o.currentChar()&&(a=o.$re(/^(@[\w-]+)\s*:/)))return a[1]},rulesetCall:function(){var a;if("@"===o.currentChar()&&(a=o.$re(/^(@[\w-]+)\(\s*\)\s*;/)))return new e.RulesetCall(a[1])},extend:function(a){var b,d,f,g,h,j=o.i;if(o.$str(a?"&:extend(":":extend(")){do{for(f=null,b=null;!(f=o.$re(/^(all)(?=\s*(\)|,))/))&&(d=this.element());)b?b.push(d):b=[d];f=f&&f[1],b||i("Missing target selector for :extend()."),h=new e.Extend(new e.Selector(b),f,j,c),g?g.push(h):g=[h]}while(o.$char(","));return k(/^\)/),a&&k(/^;/),g}},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var a,b,d,f,g,h,i=o.currentChar(),j=!1,k=o.i;if("."===i||"#"===i){for(o.save();;){if(a=o.i,f=o.$re(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/),!f)break;d=new e.Element(g,f,a,c),b?b.push(d):b=[d],g=o.$char(">")}return b&&(o.$char("(")&&(h=this.args(!0).args,l(")")),n.important()&&(j=!0),n.end())?(o.forget(),new e.mixin.Call(b,h,k,c,j)):void o.restore()}},args:function(a){var b,c,d,f,g,h,j,k=n.entities,l={args:null,variadic:!1},m=[],p=[],q=[];for(o.save();;){if(a)h=n.detachedRuleset()||n.expression();else{if(o.commentStore.length=0,o.$str("...")){l.variadic=!0,o.$char(";")&&!b&&(b=!0),(b?p:q).push({variadic:!0});break}h=k.variable()||k.literal()||k.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var r=null;if(a?h.value&&1==h.value.length&&(r=h.value[0]):r=h,r&&r instanceof e.Variable)if(o.$char(":")){if(m.length>0&&(b&&i("Cannot mix ; and , as delimiter types"),c=!0),g=n.detachedRuleset()||n.expression(),!g){if(!a)return o.restore(),l.args=[],l;i("could not understand value for named argument")}f=d=r.name}else if(o.$str("...")){if(!a){l.variadic=!0,o.$char(";")&&!b&&(b=!0),(b?p:q).push({name:h.name,variadic:!0});break}j=!0}else a||(d=f=r.name,g=null);g&&m.push(g),q.push({name:f,value:g,expand:j}),o.$char(",")||(o.$char(";")||b)&&(c&&i("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),p.push({name:d,value:g,expand:j}),d=null,m=[],c=!1)}return o.forget(),l.args=b?p:q,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==o.currentChar()&&"#"!==o.currentChar()||o.peek(/^[^{]*\}/)))if(o.save(),b=o.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!o.$char(")"))return void o.restore("Missing closing ')'");if(o.commentStore.length=0,o.$str("when")&&(d=k(n.conditions,"expected condition")),c=n.block())return o.forget(),new e.mixin.Definition(a,f,c,d,g);o.restore()}else o.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.call()||a.keyword()||a.javascript()},end:function(){return o.$char(";")||o.peek("}")},alpha:function(){var a;if(o.$re(/^opacity=/i))return a=o.$re(/^\d+/),a||(a=k(this.entities.variable,"Could not parse alpha")),l(")"),new e.Alpha(a)},element:function(){var a,b,d,f=o.i;if(b=this.combinator(),a=o.$re(/^(?:\d+\.\d+|\d+)%/)||o.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||o.$char("*")||o.$char("&")||this.attribute()||o.$re(/^\([^&()@]+\)/)||o.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(o.save(),o.$char("(")?(d=this.selector())&&o.$char(")")?(a=new e.Paren(d),o.forget()):o.restore("Missing closing ')'"):o.forget()),a)return new e.Element(b,a,f,c)},combinator:function(){var a=o.currentChar();if("/"===a){o.save();var b=o.$re(/^\/[a-z]+\//i);if(b)return o.forget(),new e.Combinator(b);o.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(o.i++,"^"===a&&"^"===o.currentChar()&&(a="^^",o.i++);o.isWhitespace();)o.i++;return new e.Combinator(a)}return new e.Combinator(o.isWhitespace(-1)?" ":null)},lessSelector:function(){return this.selector(!0)},selector:function(a){for(var b,d,f,g,h,j,l,m=o.i;(a&&(d=this.extend())||a&&(j=o.$str("when"))||(g=this.element()))&&(j?l=k(this.conditions,"expected condition"):l?i("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&i("Extend can only be used at the end of selector"),f=o.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,l,m,c):void(h&&i("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(o.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=k(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=o.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||o.$re(/^[0-9]+%/)||o.$re(/^[\w-]+/)||d.variableCurly()),l("]"),new e.Attribute(a,c,b)}},block:function(){var a;if(o.$char("{")&&(a=this.primary())&&o.$char("}"))return a},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();if(a)return new e.DetachedRuleset(a)},ruleset:function(){var b,c,d,f;for(o.save(),a.dumpLineNumbers&&(f=m(o.i));;){if(c=this.lessSelector(),!c)break;if(b?b.push(c):b=[c],o.commentStore.length=0,c.condition&&b.length>1&&i("Guards are only currently allowed on a single selector."),!o.$char(","))break;c.condition&&i("Guards are only currently allowed on a single selector."),o.commentStore.length=0}if(b&&(d=this.block())){o.forget();var g=new e.Ruleset(b,d,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}o.restore()},declaration:function(b){var d,f,g,h,i,j=o.i,k=o.currentChar();if("."!==k&&"#"!==k&&"&"!==k&&":"!==k)if(o.save(),d=this.variable()||this.ruleProperty()){if(i="string"==typeof d,i&&(f=this.detachedRuleset()),o.commentStore.length=0,!f){h=!i&&d.length>1&&d.pop().value;var l=!b&&(a.compress||i);if(l&&(f=this.value()),!f&&(f=this.anonymousValue()))return o.forget(),new e.Declaration(d,f,(!1),h,j,c);l||f||(f=this.value()),g=this.important()}if(f&&this.end())return o.forget(),new e.Declaration(d,f,g,h,j,c);if(o.restore(),f&&!b)return this.declaration(!0)}else o.forget()},anonymousValue:function(){var a=o.$re(/^([^@+\/'"*`(;{}-]*);/);if(a)return new e.Anonymous(a[1])},"import":function(){var a,b,d=o.i,f=o.$re(/^@import?\s+/);if(f){var g=(f?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),o.$char(";")||(o.i=d,i("missing semi-colon or unrecognised media features on import")),b=b&&new e.Value(b),new e.Import(a,b,g,d,c);o.i=d,i("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!o.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!o.$char(","))break}while(a);return l(")"),d},importOption:function(){var a=o.$re(/^(less|css|multiple|once|inline|reference|optional)/);if(a)return a[1]},mediaFeature:function(){var a,b,d=this.entities,f=[];o.save();do a=d.keyword()||d.variable(),a?f.push(a):o.$char("(")&&(b=this.property(),a=this.value(),o.$char(")")?b&&a?f.push(new e.Paren(new e.Declaration(b,a,null,null,o.i,c,(!0)))):a?f.push(new e.Paren(a)):i("badly formed media feature definition"):i("Missing closing ')'","Parse"));while(a);if(o.forget(),f.length>0)return new e.Expression(f)},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!o.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!o.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=o.i;return a.dumpLineNumbers&&(g=m(h)),o.save(),o.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||i("media definitions require block statements after any features"),o.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void o.restore()},plugin:function(){var a,b,d,f=o.i,g=o.$re(/^@plugin?\s+/);if(g){if(b=this.pluginArgs(),d=b?{pluginArgs:b,isPlugin:!0}:{isPlugin:!0},a=this.entities.quoted()||this.entities.url())return o.$char(";")||(o.i=f,i("missing semi-colon on @plugin")),new e.Import(a,null,d,f,c);o.i=f,i("malformed @plugin statement")}},pluginArgs:function(){if(o.save(),!o.$char("("))return o.restore(),null;var a=o.$re(/^\s*([^\);]+)\)\s*/);return a[1]?(o.forget(),a[1].trim()):(o.restore(),null)},atrule:function(){var b,d,f,g,h,j,k,l=o.i,n=!0,p=!0;if("@"===o.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(o.save(),b=o.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,n=!1;break;case"@namespace":j=!0,n=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,p=!1;break;default:k=!0}return o.commentStore.length=0,h?(d=this.entity(),d||i("expected "+b+" identifier")):j?(d=this.expression(),d||i("expected "+b+" expression")):k&&(d=(o.$re(/^[^{;]+/)||"").trim(),n="{"==o.currentChar(),d&&(d=new e.Anonymous(d))),n&&(f=this.blockRuleset()),f||!n&&d&&o.$char(";")?(o.forget(),new e.AtRule(b,d,f,l,c,a.dumpLineNumbers?m(l):null,p)):void o.restore("at-rule options not recognised")}}},value:function(){var a,b=[];do if(a=this.expression(),a&&(b.push(a),!o.$char(",")))break;while(a);if(b.length>0)return new e.Value(b)},important:function(){if("!"===o.currentChar())return o.$re(/^! *important/)},sub:function(){var a,b;return o.save(),o.$char("(")?(a=this.addition(),a&&o.$char(")")?(o.forget(),b=new e.Expression([a]),b.parens=!0,b):void o.restore("Expected ')'")):void o.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=o.isWhitespace(-1);;){if(o.peek(/^\/[*\/]/))break;if(o.save(),c=o.$char("/")||o.$char("*"),!c){o.forget();break}if(b=this.operand(),!b){o.restore();break}o.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=o.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=o.isWhitespace(-1);;){if(c=o.$re(/^[-+]\s+/)||!f&&(o.$char("+")||o.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=o.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=o.i;if(a=this.condition()){for(;;){if(!o.peek(/^,\s*(not\s*)?\(/)||!o.$char(","))break;if(b=this.condition(),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(){function a(){return o.$str("or")}var b,c,d;if(b=this.conditionAnd(this)){if(c=a()){if(d=this.condition(),!d)return;b=new e.Condition(c,b,d)}return b}},conditionAnd:function(){function a(a){return a.negatedCondition()||a.parenthesisCondition()}function b(){return o.$str("and")}var c,d,f;if(c=a(this)){if(d=b()){if(f=this.conditionAnd(),!f)return;c=new e.Condition(d,c,f)}return c}},negatedCondition:function(){if(o.$str("not")){var a=this.parenthesisCondition();return a&&(a.negate=!a.negate), -a}},parenthesisCondition:function(){function a(a){var b;return o.save(),(b=a.condition())&&o.$char(")")?(o.forget(),b):void o.restore()}var b;return o.save(),o.$str("(")?(b=a(this))?(o.forget(),b):(b=this.atomicCondition())?o.$char(")")?(o.forget(),b):void o.restore("expected ')' got '"+o.currentChar()+"'"):void o.restore():void o.restore()},atomicCondition:function(){var a,b,c,d,f=this.entities,g=o.i;if(a=this.addition()||f.keyword()||f.quoted())return o.$char(">")?d=o.$char("=")?">=":">":o.$char("<")?d=o.$char("=")?"<=":"<":o.$char("=")&&(d=o.$char(">")?"=>":o.$char("<")?"=<":"="),d?(b=this.addition()||f.keyword()||f.quoted(),b?c=new e.Condition(d,a,b,g,(!1)):i("expected expression")):c=new e.Condition("=",a,new e.Keyword("true"),g,(!1)),c},operand:function(){var a,b=this.entities;o.peek(/^-[@\(]/)&&(a=o.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.call()||b.colorKeyword();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[];do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),o.peek(/^\/[\/*]/)||(b=o.$char("/"),b&&c.push(new e.Anonymous(b)))));while(a);if(c.length>0)return new e.Expression(c)},property:function(){var a=o.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(a)return a[1]},ruleProperty:function(){function a(a){var b=o.i,c=o.$re(a);if(c)return g.push(b),f.push(c[1])}var b,d,f=[],g=[];o.save();var h=o.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],o.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:@\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(o.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;d=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},f.prototype.addPostProcessor=function(a,b){var c;for(c=0;c=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},f.prototype.addFileManager=function(a){this.fileManagers.push(a)},f.prototype.getPreProcessors=function(){for(var a=[],b=0;b0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],45:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Declaration("@"+a,b,(!1),null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j,k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor((!0)),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager)for(j=b.pluginManager.visitor(),j.first();i=j.get();)i.isPreEvalVisitor&&i.run(a);c=a.eval(h);for(var l=0;l.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(d="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":73}],56:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],57:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;c-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&c<1&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":15,"./color":52,"./node":73,"./unit":82}],60:[function(a,b,c){var d=a("./atrule"),e=function(){var a=Array.prototype.slice.call(arguments);d.apply(this,a)};e.prototype=Object.create(d.prototype),e.prototype.constructor=e,b.exports=e},{"./atrule":49}],61:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./combinator"),g=function(a,b,c,d,e){this.combinator=a instanceof f?a:new f(a),this.value="string"==typeof b?b.trim():b?b:"",this.index=c,this.currentFileInfo=d,this.copyVisibilityInfo(e)};g.prototype=new d,g.prototype.type="Element",g.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},g.prototype.eval=function(a){return new g(this.combinator,this.value.eval?this.value.eval(a):this.value,this.index,this.currentFileInfo,this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.index,this.currentFileInfo,this.visibilityInfo())},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.currentFileInfo,this.index)},g.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof e&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=g},{"./combinator":53,"./node":73,"./paren":75}],62:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./comment"),g=function(a){if(this.value=a,!a)throw new Error("Expression requires an array parameter")};g.prototype=new d,g.prototype.type="Expression",g.prototype.accept=function(a){this.value=a.visitArray(this.value)},g.prototype.eval=function(a){var b,c=this.parens&&!this.parensInOp,d=!1;return c&&a.inParenthesis(),this.value.length>1?b=new g(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(d=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!d&&(b=new e(b)),b},g.prototype.genCSS=function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":73,"./selector":80}],64:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=function(a,b,c,d,e,f){if(this.options=c,this.index=d,this.path=a,this.features=b,this.currentFileInfo=e,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?\/]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f)};j.prototype=new d,j.prototype.type="Import",j.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.isPlugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},j.prototype.genCSS=function(a,b){this.css&&void 0===this.path.currentFileInfo.reference&&(b.add("@import ",this.currentFileInfo,this.index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},j.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},j.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),!(a instanceof g)||a.containsVariables()},j.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new j(b.eval(a),this.features,this.options,this.index,this.currentFileInfo,this.visibilityInfo())},j.prototype.evalPath=function(a){var b=this.path.eval(a),c=this.currentFileInfo&&this.currentFileInfo.rootpath;if(!(b instanceof f)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d)}b.value=a.normalizePath(b.value)}return b},j.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){a.addVisibilityBlock()}):b.addVisibilityBlock()),b},j.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a);if(this.options.isPlugin)return this.root&&this.root.eval&&this.root.eval(a),c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[];if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var f=new i(this.root,0,{filename:this.importedFilename,reference:this.path.currentFileInfo&&this.path.currentFileInfo.reference},(!0),(!0));return this.features?new e([f],this.features.value):[f]}if(this.css){var g=new j(this.evalPath(a),d,this.options,this.index);if(!g.css&&this.error)throw this.error;return g}return b=new h(null,this.root.rules.slice(0)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=j},{"./anonymous":47,"./media":69,"./node":73,"./quoted":76,"./ruleset":79,"./url":83}],65:[function(a,b,c){var d={};d.Node=a("./node"),d.Alpha=a("./alpha"),d.Color=a("./color"),d.AtRule=a("./atrule"),d.Directive=a("./directive"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Declaration=a("./declaration"),d.Rule=a("./rule"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.RulesetCall=a("./ruleset-call"),b.exports=d},{"./alpha":46,"./anonymous":47,"./assignment":48,"./atrule":49,"./attribute":50,"./call":51,"./color":52,"./combinator":53,"./comment":54,"./condition":55,"./declaration":57,"./detached-ruleset":58,"./dimension":59,"./directive":60,"./element":61,"./expression":62,"./extend":63,"./import":64,"./javascript":66,"./keyword":68,"./media":69,"./mixin-call":70,"./mixin-definition":71,"./negative":72,"./node":73,"./operation":74,"./paren":75,"./quoted":76,"./rule":77,"./ruleset":79,"./ruleset-call":78,"./selector":80,"./unicode-descriptor":81,"./unit":82,"./url":83,"./value":84,"./variable":85}],66:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this.index=c,this.currentFileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new e(b):"string"==typeof b?new f('"'+b+'"',b,this.escaped,this.index):new g(Array.isArray(b)?b.join(", "):b)},b.exports=h},{"./anonymous":47,"./dimension":59,"./js-eval-node":67,"./quoted":76 -}],67:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(!b.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.currentFileInfo.filename,index:this.index};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.index,d.currentFileInfo).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.currentFileInfo.filename,index:this.index}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.currentFileInfo.filename,index:this.index}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":73,"./variable":85}],68:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":73}],69:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./atrule"),j=function(a,b,c,g,h){this.index=c,this.currentFileInfo=g;var i=new f([],null,null,this.index,this.currentFileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0};j.prototype=new i,j.prototype.type="Media",j.prototype.isRulesetLike=!0,j.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},j.prototype.genCSS=function(a,b){b.add("@media ",this.currentFileInfo,this.index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},j.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new j(null,[],this.index,this.currentFileInfo,this.visibilityInfo());this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo);var c=!1;a.strictMath||(c=!0,a.strictMath=!0);try{b.features=this.features.eval(a)}finally{c&&(a.strictMath=!1)}return a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},j.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.index,this.currentFileInfo).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo())}return delete a.mediaBlocks,delete a.mediaPath,b},j.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;b0;b--)a.splice(b,0,new g("and"));return new h(a)})),new d([],[])},j.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(n=!0,k=0;k0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.index,filename:this.currentFileInfo.filename};for(k=0;kthis.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;gb?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],74:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};g.prototype=new d,g.prototype.type="Operation",g.prototype.accept=function(a){this.operands=a.visit(this.operands)},g.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof f&&c instanceof e&&(b=b.toColor()),c instanceof f&&b instanceof e&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new g(this.op,[b,c],this.isSpaced)},g.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=g},{"./color":52,"./dimension":59,"./node":73}],75:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":73}],76:[function(a,b,c){var d=a("./node"),e=a("./js-eval-node"),f=a("./variable"),g=function(a,b,c,d,e){this.escaped=null==c||c,this.value=b||"",this.quote=a.charAt(0),this.index=d,this.currentFileInfo=e};g.prototype=new e,g.prototype.type="Quoted",g.prototype.genCSS=function(a,b){this.escaped||b.add(this.quote,this.currentFileInfo,this.index),b.add(this.value),this.escaped||b.add(this.quote)},g.prototype.containsVariables=function(){return this.value.match(/(`([^`]+)`)|@\{([\w-]+)\}/)},g.prototype.eval=function(a){function b(a,b,c){var d=a;do a=d,d=a.replace(b,c);while(a!==d);return d}var c=this,d=this.value,e=function(b,d){return String(c.evaluateJavaScript(d,a))},h=function(b,d){var e=new f("@"+d,c.index,c.currentFileInfo).eval(a,!0);return e instanceof g?e.value:e.toCSS()};return d=b(d,/`([^`]+)`/g,e),d=b(d,/@\{([\w-]+)\}/g,h),new g(this.quote+d+this.quote,d,this.escaped,this.index,this.currentFileInfo)},g.prototype.compare=function(a){return"Quoted"!==a.type||this.escaped||a.escaped?a.toCSS&&this.toCSS()===a.toCSS()?0:void 0:d.numericCompare(this.value,a.value)},b.exports=g},{"./js-eval-node":67,"./node":73,"./variable":85}],77:[function(a,b,c){var d=a("./declaration"),e=function(){var a=Array.prototype.slice.call(arguments);d.apply(this,a)};e.prototype=Object.create(d.prototype),e.prototype.constructor=e,b.exports=e},{"./declaration":57}],78:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(a){this.variable=a,this.allowRoot=!0};f.prototype=new d,f.prototype.type="RulesetCall",f.prototype.eval=function(a){var b=new e(this.variable).eval(a);return b.callEval(a)},b.exports=f},{"./node":73,"./variable":85}],79:[function(a,b,c){var d=a("./node"),e=a("./declaration"),f=a("./selector"),g=a("./element"),h=a("./paren"),i=a("../contexts"),j=a("../functions/function-registry"),k=a("../functions/default"),l=a("./debug-info"),m=function(a,b,c,d){this.selectors=a,this.rules=b,this._lookups={},this.strictImports=c,this.copyVisibilityInfo(d),this.allowRoot=!0};m.prototype=new d,m.prototype.type="Ruleset",m.prototype.isRuleset=!0,m.prototype.isRulesetLike=!0,m.prototype.accept=function(a){this.paths?this.paths=a.visitArray(this.paths,!0):this.selectors&&(this.selectors=a.visitArray(this.selectors)),this.rules&&this.rules.length&&(this.rules=a.visitArray(this.rules))},m.prototype.eval=function(a){var b,c,f,g,h=this.selectors,i=!1;if(h&&(c=h.length)){for(b=[],k.error({type:"Syntax",message:"it is currently only allowed in parametric mixin guards,"}),g=0;gd){if(!c||c(h)){e=h.find(new f(a.elements.slice(d)),b,c);for(var j=0;j0&&b.add(m),a.firstSelector=!0,i[0].genCSS(a,b),a.firstSelector=!1,f=1;f0?(e=a.slice(0),f=e.pop(),h=d.createDerived(f.elements.slice(0))):h=d.createDerived([]),b.length>0){var i=c.combinator,j=b[0].elements[0];i.emptyOrWhitespace&&!j.combinator.emptyOrWhitespace&&(i=j.combinator),h.elements.push(new g(i,j.value,c.index,c.currentFileInfo)),h.elements=h.elements.concat(b[0].elements.slice(1))}if(0!==h.elements.length&&e.push(h),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function j(a,b,c,d,e){var f;for(f=0;f0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new f(a))}}function l(a,b,c){function f(a){var b;return"Paren"!==a.value.type?null:(b=a.value.value,"Selector"!==b.type?null:b)}var h,m,n,o,p,q,r,s,t,u,v=!1;for(o=[],p=[[]],h=0;h0&&r[0].elements.push(new g(s.combinator,"",s.index,s.currentFileInfo)),q.push(r);else for(n=0;n0&&(a.push(p[h]),u=p[h][t-1],p[h][t-1]=u.createDerived(u.elements,c.extendList));return v}function m(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var n,o,p;if(o=[],p=l(o,b,c),!p)if(b.length>0)for(o=[],n=0;n0)for(b=0;b=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}}}},{}],87:[function(a,b,c){var d=a("../tree"),e=a("./visitor"),f=a("../logger"),g=function(){this._visitor=new e(this),this.contexts=[],this.allExtendsStack=[[]]};g.prototype={run:function(a){return a=this._visitor.visit(a),a.allExtends=this.allExtendsStack[0],a},visitDeclaration:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,e,f,g,h=[],i=a.rules,j=i?i.length:0;for(c=0;c=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.currentFileInfo,b),l.selfSelectors=h, -h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitDeclaration:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;e0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return k0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitAtRule:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitAtRuleOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=h},{"../logger":35,"../tree":65,"./visitor":94}],88:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],89:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};g.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,this.context.frames.slice(0)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.index,f.filename=a.currentFileInfo.filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;h0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];if(this.keepOnlyVisibleChilds(c),!this.isEmpty(c))return a.ensureVisibility(),a.removeVisibilityBlock(),a},isVisibleRuleset:function(a){return!!a.firstRoot||!this.isEmpty(a)&&!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitDeclaration:function(a,b){if(!a.blocksVisibility()&&!a.variable)return a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){if(!a.blocksVisibility()&&!a.isSilent(this._context))return a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){if(!a.blocksVisibility())return a},visitAtRule:function(a,b){return a.rules&&a.rules.length?this.visitAtRuleWithBody(a,b):this.visitAtRuleWithoutBody(a,b)},visitAtRuleWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitAtRuleWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;c0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;b=0;e--)if(c=a[e],c instanceof d.Declaration)if(f[c.name]){b=f[c.name],b instanceof d.Declaration&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);b.indexOf(g)!==-1?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b,c,e,f={},g=0;g1){c=b[0];var h=[],i=[];b.map(function(a){"+"===a.merge&&(i.length>0&&h.push(e(i)),i=[]),i.push(a)}),h.push(e(i)),c.value=g(h)}})}},visitAnonymous:function(a,b){if(!a.blocksVisibility())return a.accept(this._visitor),a}},b.exports=g},{"../tree":65,"./visitor":94}],94:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)if(a.hasOwnProperty(c))switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitFnCache=[],h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var c,e=this._visitFnCache,f=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=g;if(l.visitDeeper=!0,j||(c="visit"+a.type,j=f[c]||d,k=f[c+"Out"]||d,e[h]=j,e[i]=k),j!==d){var m=j.call(f,a,l);f.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=d&&k.call(f,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;ck){for(var b=0,c=h.length-j;b=0;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c--;c)a.unshift("..");return a}function d(a,b){if(a.filter)return a.filter(b);for(var c=[],d=0;d=-1&&!e;f--){var g=f>=0?arguments[f]:a.cwd();if("string"!=typeof g)throw new TypeError("Arguments to path.resolve must be strings");g&&(c=g+"/"+c,e="/"===g.charAt(0))}return c=b(d(c.split("/"),function(a){return!!a}),!e).join("/"),(e?"/":"")+c||"."},c.normalize=function(a){var e=c.isAbsolute(a),f="/"===g(a,-1);return a=b(d(a.split("/"),function(a){return!!a}),!e).join("/"),a||e||(a="."),a&&f&&(a+="/"),(e?"/":"")+a},c.isAbsolute=function(a){return"/"===a.charAt(0)},c.join=function(){var a=Array.prototype.slice.call(arguments,0);return c.normalize(d(a,function(a,b){if("string"!=typeof a)throw new TypeError("Arguments to path.join must be strings");return a}).join("/"))},c.relative=function(a,b){function d(a){for(var b=0;b=0&&""===a[c];c--);return b>c?[]:a.slice(b,c-b+1)}a=c.resolve(a).substr(1),b=c.resolve(b).substr(1);for(var e=d(a.split("/")),f=d(b.split("/")),g=Math.min(e.length,f.length),h=g,i=0;i1)for(var c=1;c0||b.isFileProtocol?"development":"production");var c=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(a.location.hash);c&&(b.dumpLineNumbers=c[1]),void 0===b.useFileCache&&(b.useFileCache=!0),void 0===b.onReady&&(b.onReady=!0),b.javascriptEnabled=!(!b.javascriptEnabled&&!b.inlineJavaScript)}},{"./browser":3,"./utils":11}],2:[function(a,b,c){function d(a){a.filename&&console.warn(a),e.async||h.removeChild(i)}a("promise/polyfill.js");var e=window.less||{};a("./add-default-options")(window,e);var f=b.exports=a("./index")(window,e);window.less=f;var g,h,i;e.onReady&&(/!watch/.test(window.location.hash)&&f.watch(),e.async||(g="body { display: none !important }",h=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),i.type="text/css",i.styleSheet?i.styleSheet.cssText=g:i.appendChild(document.createTextNode(g)),h.appendChild(i)),f.registerStylesheetsImmediately(),f.pageLoadFinished=f.refresh("development"===f.env).then(d,d))},{"./add-default-options":1,"./index":8,"promise/polyfill.js":102}],3:[function(a,b,c){var d=a("./utils");b.exports={createCSS:function(a,b,c){var e=c.href||"",f="less:"+(c.title||d.extractId(e)),g=a.getElementById(f),h=!1,i=a.createElement("style");i.setAttribute("type","text/css"),c.media&&i.setAttribute("media",c.media),i.id=f,i.styleSheet||(i.appendChild(a.createTextNode(b)),h=null!==g&&g.childNodes.length>0&&i.childNodes.length>0&&g.firstChild.nodeValue===i.firstChild.nodeValue);var j=a.getElementsByTagName("head")[0];if(null===g||h===!1){var k=c&&c.nextSibling||null;k?k.parentNode.insertBefore(i,k):j.appendChild(i)}if(g&&h===!1&&g.parentNode.removeChild(g),i.styleSheet)try{i.styleSheet.cssText=b}catch(l){throw new Error("Couldn't reassign styleSheet.cssText.")}},currentScript:function(a){var b=a.document;return b.currentScript||function(){var a=b.getElementsByTagName("script");return a[a.length-1]}()}}},{"./utils":11}],4:[function(a,b,c){b.exports=function(a,b,c){var d=null;if("development"!==b.env)try{d="undefined"==typeof a.localStorage?null:a.localStorage}catch(e){}return{setCSS:function(a,b,e,f){if(d){c.info("saving "+a+" to cache.");try{d.setItem(a,f),d.setItem(a+":timestamp",b),e&&d.setItem(a+":vars",JSON.stringify(e))}catch(g){c.error('failed to save "'+a+'" to local storage for caching.')}}},getCSS:function(a,b,c){var e=d&&d.getItem(a),f=d&&d.getItem(a+":timestamp"),g=d&&d.getItem(a+":vars");if(c=c||{},f&&b.lastModified&&new Date(b.lastModified).valueOf()===new Date(f).valueOf()&&(!c&&!g||JSON.stringify(c)===g))return e}}}},{}],5:[function(a,b,c){var d=a("./utils"),e=a("./browser");b.exports=function(a,b,c){function f(b,f){var g,h,i="less-error-message:"+d.extractId(f||""),j='
  • {content}
  • ',k=a.document.createElement("div"),l=[],m=b.filename||f,n=m.match(/([^\/]+(\?.*)?)$/)[1];k.id=i,k.className="less-error-message",h="

    "+(b.type||"Syntax")+"Error: "+(b.message||"There is an error in your .less file")+'

    in '+n+" ";var o=function(a,b,c){void 0!==a.extract[b]&&l.push(j.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};b.extract&&(o(b,0,""),o(b,1,"line"),o(b,2,""),h+="on line "+b.line+", column "+(b.column+1)+":

      "+l.join("")+"
    "),b.stack&&(b.extract||c.logLevel>=4)&&(h+="
    Stack Trace
    "+b.stack.split("\n").slice(1).join("
    ")),k.innerHTML=h,e.createCSS(a.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),k.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===c.env&&(g=setInterval(function(){var b=a.document,c=b.body;c&&(b.getElementById(i)?c.replaceChild(k,b.getElementById(i)):c.insertBefore(k,c.firstChild),clearInterval(g))},10))}function g(b){var c=a.document.getElementById("less-error-message:"+d.extractId(b));c&&c.parentNode.removeChild(c)}function h(a){}function i(a){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?h(a):"function"==typeof c.errorReporting&&c.errorReporting("remove",a):g(a)}function j(a,d){var e="{line} {content}",f=a.filename||d,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f+" ",i=function(a,b,c){void 0!==a.extract[b]&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.extract&&(i(a,0,""),i(a,1,"line"),i(a,2,""),h+="on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")),a.stack&&(a.extract||c.logLevel>=4)&&(h+="\nStack Trace\n"+a.stack),b.logger.error(h)}function k(a,b){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?j(a,b):"function"==typeof c.errorReporting&&c.errorReporting("add",a,b):f(a,b)}return{add:k,remove:i}}},{"./browser":3,"./utils":11}],6:[function(a,b,c){b.exports=function(b,c){function d(){if(window.XMLHttpRequest&&!("file:"===window.location.protocol&&"ActiveXObject"in window))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){return c.error("browser doesn't support AJAX."),null}}var e=a("../less/environment/abstract-file-manager.js"),f={},g=function(){};return g.prototype=new e,g.prototype.alwaysMakePathsAbsolute=function(){return!0},g.prototype.join=function(a,b){return a?this.extractUrlParts(b,a).path:b},g.prototype.doXHR=function(a,e,f,g){function h(b,c,d){b.status>=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var i=d(),j=!b.isFileProtocol||b.fileAsync;"function"==typeof i.overrideMimeType&&i.overrideMimeType("text/css"),c.debug("XHR: Getting '"+a+"'"),i.open("GET",a,j),i.setRequestHeader("Accept",e||"text/x-less, text/css; q=0.9, */*; q=0.5"),i.send(null),b.isFileProtocol&&!b.fileAsync?0===i.status||i.status>=200&&i.status<300?f(i.responseText):g(i.status,a):j?i.onreadystatechange=function(){4==i.readyState&&h(i,f,g)}:h(i,f,g)},g.prototype.supports=function(a,b,c,d){return!0},g.prototype.clearFileCache=function(){f={}},g.prototype.loadFile=function(a,b,c,d,e){b&&!this.isPathAbsolute(a)&&(a=b+a),c=c||{};var g=this.extractUrlParts(a,window.location.href),h=g.url;if(c.useFileCache&&f[h])try{var i=f[h];e(null,{contents:i,filename:h,webInfo:{lastModified:new Date}})}catch(j){e({filename:h,message:"Error loading file "+h+" error was "+j.message})}else this.doXHR(h,c.mime,function(a,b){f[h]=a,e(null,{contents:a,filename:h,webInfo:{lastModified:b}})},function(a,b){e({type:"File",message:"'"+b+"' wasn't found ("+a+")",href:h})})},g}},{"../less/environment/abstract-file-manager.js":16}],7:[function(a,b,c){b.exports=function(){function b(){throw{type:"Runtime",message:"Image size functions are not supported in browser version of less"}}var c=a("./../less/functions/function-registry"),d={"image-size":function(a){return b(this,a),-1},"image-width":function(a){return b(this,a),-1},"image-height":function(a){return b(this,a),-1}};c.addMultiple(d)}},{"./../less/functions/function-registry":24}],8:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(b,c){function f(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function g(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}}function h(a){for(var b,d=l.getElementsByTagName("style"),e=0;e=c&&console.log(a)},info:function(a){b.logLevel>=d&&console.log(a)},warn:function(a){b.logLevel>=e&&console.warn(a)},error:function(a){b.logLevel>=f&&console.error(a)}}]);for(var g=0;g0&&(a=a.slice(0,b)),b=a.lastIndexOf("/"),b<0&&(b=a.lastIndexOf("\\")),b<0?"":a.slice(0,b+1)},d.prototype.tryAppendExtension=function(a,b){return/(\.[a-z]*$)|([\?;].*)$/.test(a)?a:a+b},d.prototype.tryAppendLessExtension=function(a){return this.tryAppendExtension(a,".less")},d.prototype.supportsSync=function(){return!1},d.prototype.alwaysMakePathsAbsolute=function(){return!1},d.prototype.isPathAbsolute=function(a){return/^(?:[a-z-]+:|\/|\\|#)/i.test(a)},d.prototype.join=function(a,b){return a?a+b:b},d.prototype.pathDiff=function(a,b){var c,d,e,f,g=this.extractUrlParts(a),h=this.extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;c0&&(h.splice(c-1,2),c-=2)}return g.hostPart=f[1],g.directories=h,g.path=(f[1]||"")+h.join("/"),g.fileUrl=g.path+(f[4]||""),g.url=g.fileUrl+(f[5]||""),g},b.exports=d},{}],17:[function(a,b,c){function d(a,b){throw new f({type:b||"Syntax",message:a})}var e=a("../functions/function-registry"),f=a("../less-error"),g=function(){};g.prototype.evalPlugin=function(a,b,c,d){var f,g,h,i,j,k,l;if(k=b.pluginManager,d&&(l="string"==typeof d?d:d.filename),l&&(h=k.get(l)))return this.trySetOptions(h,l,c),h.use&&h.use(this.less),h;i={exports:{},pluginManager:k,fileInfo:d},j=i.exports,g=e.create();try{if(f=new Function("module","require","functions","tree","fileInfo",a),h=f(i,this.require,g,this.less.tree,d),h||(h=i.exports),h=this.validatePlugin(h,l),!h)throw new SyntaxError("Not a valid plugin");k.addPlugin(h,d.filename),h.functions=g.getLocalFunctions(),this.trySetOptions(h,l,c),h.use&&h.use(this.less)}catch(m){return console.log(m),new this.less.LessError({message:"Plugin evaluation error: '"+m.name+": "+m.message.replace(/["]/g,"'")+"'",filename:l,line:this.line,col:this.column})}return h},g.prototype.trySetOptions=function(b,c,e){var f=a("path").basename(c);if(e){if(!b.setOptions)return d("Options have been provided but the plugin "+f+" does not support any options."),null;try{b.setOptions(e)}catch(g){return d("Error setting options on plugin "+f+"\n"+g.message),null}}},g.prototype.validatePlugin=function(b,c){if(b){"function"==typeof b&&(b=new b);var e=a("path").basename(c);return b.minVersion&&this.compareVersion(b.minVersion,this.less.version)<0?(d("Plugin "+e+" requires version "+this.versionToString(b.minVersion)),null):b}return null},g.prototype.compareVersion=function(a,b){"string"==typeof a&&(a=a.match(/^(\d+)\.?(\d+)?\.?(\d+)?/),a.shift());for(var c=0;cparseInt(b[c])?-1:1;return 0},g.prototype.versionToString=function(a){for(var b="",c=0;c=0;h--){var i=g[h];if(i[f?"supportsSync":"supports"](a,b,c,e))return i}return null},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},b.exports=e},{"../logger":35}],19:[function(a,b,c){function d(a,b,c){var d,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;l<3;l++)d=b.rgb[l]/255,f=c.rgb[l]/255,h=a(d,f),g&&(h=(j*f+i*(d-j*(d+f-h)))/g),k[l]=255*h;return new e(k,g)}var e=a("../tree/color"),f=a("./function-registry"),g={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,a<=1?g.multiply(a,b):g.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return g.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};for(var h in g)g.hasOwnProperty(h)&&(d[h]=d.bind(null,g[h]));f.addMultiple(d)},{"../tree/color":52,"./function-registry":24}],20:[function(a,b,c){function d(a){return Math.min(1,Math.max(0,a))}function e(a){return h.hsla(a.h,a.s,a.l,a.a)}function f(a){if(a instanceof i)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{type:"Argument",message:"color functions take numbers as parameters"}}function g(a,b){return a instanceof i&&a.unit.is("%")?parseFloat(a.value*b/100):f(a)}var h,i=a("../tree/dimension"),j=a("../tree/color"),k=a("../tree/quoted"),l=a("../tree/anonymous"),m=a("./function-registry");h={rgb:function(a,b,c){return h.rgba(a,b,c,1)},rgba:function(a,b,c,d){var e=[a,b,c].map(function(a){return g(a,255)});return d=f(d),new j(e,d)},hsl:function(a,b,c){return h.hsla(a,b,c,1)},hsla:function(a,b,c,e){function g(a){return a=a<0?a+1:a>1?a-1:a,6*a<1?i+(j-i)*a*6:2*a<1?j:3*a<2?i+(j-i)*(2/3-a)*6:i}var i,j;return a=f(a)%360/360,b=d(f(b)),c=d(f(c)),e=d(f(e)),j=c<=.5?c*(b+1):c+b-c*b,i=2*c-j,h.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),e)},hsv:function(a,b,c){return h.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=f(a)%360/360*360,b=f(b),c=f(c),d=f(d);var e,g;e=Math.floor(a/60%6),g=a/60-e;var i=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],j=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return h.rgba(255*i[j[e][0]],255*i[j[e][1]],255*i[j[e][2]],d)},hue:function(a){return new i(a.toHSL().h)},saturation:function(a){return new i(100*a.toHSL().s,"%")},lightness:function(a){return new i(100*a.toHSL().l,"%")},hsvhue:function(a){return new i(a.toHSV().h)},hsvsaturation:function(a){return new i(100*a.toHSV().s,"%")},hsvvalue:function(a){return new i(100*a.toHSV().v,"%")},red:function(a){return new i(a.rgb[0])},green:function(a){return new i(a.rgb[1])},blue:function(a){return new i(a.rgb[2])},alpha:function(a){return new i(a.toHSL().a)},luma:function(a){return new i(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new i(b*a.alpha*100,"%")},saturate:function(a,b,c){if(!a.rgb)return null;var f=a.toHSL();return f.s+="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},desaturate:function(a,b,c){var f=a.toHSL();return f.s-="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},lighten:function(a,b,c){var f=a.toHSL();return f.l+="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},darken:function(a,b,c){var f=a.toHSL();return f.l-="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},fadein:function(a,b,c){var f=a.toHSL();return f.a+="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fadeout:function(a,b,c){var f=a.toHSL();return f.a-="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=d(c.a),e(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=d<0?360+d:d,e(c)},mix:function(a,b,c){a.toHSL&&b.toHSL||(console.log(b.type),console.dir(b)),c||(c=new i(50));var d=c.value/100,e=2*d-1,f=a.toHSL().a-b.toHSL().a,g=((e*f==-1?e:(e+f)/(1+e*f))+1)/2,h=1-g,k=[a.rgb[0]*g+b.rgb[0]*h,a.rgb[1]*g+b.rgb[1]*h,a.rgb[2]*g+b.rgb[2]*h],l=a.alpha*d+b.alpha*(1-d);return new j(k,l)},greyscale:function(a){return h.desaturate(a,new i(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;"undefined"==typeof b&&(b=h.rgba(0,0,0,1)),"undefined"==typeof c&&(c=h.rgba(255,255,255,1));var e,f,g=a.luma(),i=b.luma(),j=c.luma();return e=g>i?(g+.05)/(i+.05):(i+.05)/(g+.05),f=g>j?(g+.05)/(j+.05):(j+.05)/(g+.05),e>f?b:c},argb:function(a){return new l(a.toARGB())},color:function(a){if(a instanceof k&&/^#([a-f0-9]{6}|[a-f0-9]{3})$/i.test(a.value))return new j(a.value.slice(1));if(a instanceof j||(a=j.fromKeyword(a.value)))return a.value=void 0,a;throw{type:"Argument",message:"argument must be a color keyword or 3/6 digit hex e.g. #FFF"}},tint:function(a,b){return h.mix(h.rgb(255,255,255),a,b)},shade:function(a,b){return h.mix(h.rgb(0,0,0),a,b)}},m.addMultiple(h)},{"../tree/anonymous":47,"../tree/color":52,"../tree/dimension":59,"../tree/quoted":76,"./function-registry":24}],21:[function(a,b,c){b.exports=function(b){var c=a("../tree/quoted"),d=a("../tree/url"),e=a("./function-registry"),f=function(a,b){return new d(b,a.index,a.currentFileInfo).eval(a.context)},g=a("../logger");e.add("data-uri",function(a,e){e||(e=a,a=null);var h=a&&a.value,i=e.value,j=this.currentFileInfo,k=j.relativeUrls?j.currentDirectory:j.entryPath,l=i.indexOf("#"),m="";l!==-1&&(m=i.slice(l),i=i.slice(0,l));var n=b.getFileManager(i,k,this.context,b,!0);if(!n)return f(this,e);var o=!1;if(a)o=/;base64$/.test(h);else{if(h=b.mimeLookup(i),"image/svg+xml"===h)o=!1;else{var p=b.charsetLookup(h);o=["US-ASCII","UTF-8"].indexOf(p)<0}o&&(h+=";base64")}var q=n.loadFileSync(i,k,this.context,b);if(!q.contents)return g.warn("Skipped data-uri embedding of "+i+" because file not found"),f(this,e||a);var r=q.contents;if(o&&!b.encodeBase64)return f(this,e);r=o?b.encodeBase64(r):encodeURIComponent(r);var s="data:"+h+","+r+m,t=32768;return s.length>=t&&this.context.ieCompat!==!1?(g.warn("Skipped data-uri embedding of "+i+" because its size ("+s.length+" characters) exceeds IE8-safe "+t+" characters!"),f(this,e||a)):new d(new c('"'+s+'"',s,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../logger":35,"../tree/quoted":76,"../tree/url":83,"./function-registry":24}],22:[function(a,b,c){var d=a("../tree/keyword"),e=a("./function-registry"),f={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;if(null!=a)return a?d.True:d.False},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}};e.add("default",f.eval.bind(f)),b.exports=f},{"../tree/keyword":68,"./function-registry":24}],23:[function(a,b,c){var d=a("../tree/expression"),e=function(a,b,c,d){this.name=a.toLowerCase(),this.index=c,this.context=b,this.currentFileInfo=d,this.func=b.frames[0].functionRegistry.get(this.name)};e.prototype.isValid=function(){return Boolean(this.func)},e.prototype.call=function(a){return Array.isArray(a)&&(a=a.filter(function(a){return"Comment"!==a.type}).map(function(a){if("Expression"===a.type){var b=a.value.filter(function(a){return"Comment"!==a.type});return 1===b.length?b[0]:new d(b)}return a})),this.func.apply(this,a)},b.exports=e},{"../tree/expression":62}],24:[function(a,b,c){function d(a){return{_data:{},add:function(a,b){a=a.toLowerCase(),this._data.hasOwnProperty(a),this._data[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){this.add(b,a[b])}.bind(this))},get:function(b){return this._data[b]||a&&a.get(b)},getLocalFunctions:function(){return this._data},inherit:function(){return d(this)},create:function(a){return d(a)}}}b.exports=d(null)},{}],25:[function(a,b,c){b.exports=function(b){var c={functionRegistry:a("./function-registry"),functionCaller:a("./function-caller")};return a("./default"),a("./color"),a("./color-blending"),a("./data-uri")(b),a("./math"),a("./number"),a("./string"),a("./svg")(b),a("./types"),c}},{"./color":20,"./color-blending":19,"./data-uri":21,"./default":22,"./function-caller":23,"./function-registry":24,"./math":27,"./number":28,"./string":29,"./svg":30,"./types":31}],26:[function(a,b,c){var d=a("../tree/dimension"),e=function(){};e._math=function(a,b,c){if(!(c instanceof d))throw{type:"Argument",message:"argument must be a number"};return null==b?b=c.unit:c=c.unify(),new d(a(parseFloat(c.value)),b)},b.exports=e},{"../tree/dimension":59}],27:[function(a,b,c){var d=a("./function-registry"),e=a("./math-helper.js"),f={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"};for(var g in f)f.hasOwnProperty(g)&&(f[g]=e._math.bind(null,Math[g],f[g]));f.round=function(a,b){ +var c="undefined"==typeof b?0:b.value;return e._math(function(a){return a.toFixed(c)},null,a)},d.addMultiple(f)},{"./function-registry":24,"./math-helper.js":26}],28:[function(a,b,c){var d=a("../tree/dimension"),e=a("../tree/anonymous"),f=a("./function-registry"),g=a("./math-helper.js"),h=function(a,b){switch(b=Array.prototype.slice.call(b),b.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var c,f,g,h,i,j,k,l,m=[],n={};for(c=0;ci.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(b[c].value)&&Array.prototype.push.apply(b,Array.prototype.slice.call(b[c].value));return 1==m.length?m[0]:(b=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new e((a?"min":"max")+"("+b+")"))};f.addMultiple({min:function(){return h(!0,arguments)},max:function(){return h(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new d(Math.PI)},mod:function(a,b){return new d(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d(a),b=new d(b);else if(!(a instanceof d&&b instanceof d))throw{type:"Argument",message:"arguments must be numbers"};return new d(Math.pow(a.value,b.value),a.unit)},percentage:function(a){var b=g._math(function(a){return 100*a},"%",a);return b}})},{"../tree/anonymous":47,"../tree/dimension":59,"./function-registry":24,"./math-helper.js":26}],29:[function(a,b,c){var d=a("../tree/quoted"),e=a("../tree/anonymous"),f=a("../tree/javascript"),g=a("./function-registry");g.addMultiple({e:function(a){return new e(a instanceof f?a.evaluated:a.value)},escape:function(a){return new e(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,b,c,e){var f=a.value;return c="Quoted"===c.type?c.value:c.toCSS(),f=f.replace(new RegExp(b.value,e?e.value:""),c),new d(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;e",k=0;k";return j+="',j=encodeURIComponent(j),j="data:image/svg+xml,"+j,new g(new f("'"+j+"'",j,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":52,"../tree/dimension":59,"../tree/expression":62,"../tree/quoted":76,"../tree/url":83,"./function-registry":24}],31:[function(a,b,c){var d=a("../tree/keyword"),e=a("../tree/detached-ruleset"),f=a("../tree/dimension"),g=a("../tree/color"),h=a("../tree/quoted"),i=a("../tree/anonymous"),j=a("../tree/url"),k=a("../tree/operation"),l=a("./function-registry"),m=function(a,b){return a instanceof b?d.True:d.False},n=function(a,b){if(void 0===b)throw{type:"Argument",message:"missing the required second argument to isunit."};if(b="string"==typeof b.value?b.value:b,"string"!=typeof b)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof f&&a.unit.is(b)?d.True:d.False},o=function(a){var b=Array.isArray(a.value)?a.value:Array(a);return b};l.addMultiple({isruleset:function(a){return m(a,e)},iscolor:function(a){return m(a,g)},isnumber:function(a){return m(a,f)},isstring:function(a){return m(a,h)},iskeyword:function(a){return m(a,d)},isurl:function(a){return m(a,j)},ispixel:function(a){return n(a,"px")},ispercentage:function(a){return n(a,"%")},isem:function(a){return n(a,"em")},isunit:n,unit:function(a,b){if(!(a instanceof f))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof k?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d?b.value:b.toCSS():"",new f(a.value,b)},"get-unit":function(a){return new i(a.unit)},extract:function(a,b){return b=b.value-1,o(a)[b]},length:function(a){return new f(o(a).length)}})},{"../tree/anonymous":47,"../tree/color":52,"../tree/detached-ruleset":58,"../tree/dimension":59,"../tree/keyword":68,"../tree/operation":74,"../tree/quoted":76,"../tree/url":83,"./function-registry":24}],32:[function(a,b,c){var d=a("./contexts"),e=a("./parser/parser"),f=a("./less-error");b.exports=function(a){var b=function(a,b,c){this.less=a,this.rootFilename=c.filename,this.paths=b.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=b.mime,this.error=null,this.context=b,this.queue=[],this.files={}};return b.prototype.push=function(b,c,g,h,i){var j=this,k=this.context.pluginManager.Loader;this.queue.push(b);var l=function(a,c,d){j.queue.splice(j.queue.indexOf(b),1);var e=d===j.rootFilename;h.optional&&a?i(null,{rules:[]},!1,null):(j.files[d]=c,a&&!j.error&&(j.error=a),i(a,c,e,d))},m={relativeUrls:this.context.relativeUrls,entryPath:g.entryPath,rootpath:g.rootpath,rootFilename:g.rootFilename},n=a.getFileManager(b,g.currentDirectory,this.context,a);if(!n)return void l({message:"Could not find a file-manager for "+b});c&&(b=h.isPlugin?b:n.tryAppendExtension(b,".less"));var o,p=function(a){var b,c=a.filename,i=a.contents.replace(/^\uFEFF/,"");m.currentDirectory=n.getPath(c),m.relativeUrls&&(m.rootpath=n.join(j.context.rootpath||"",n.pathDiff(m.currentDirectory,m.entryPath)),!n.isPathAbsolute(m.rootpath)&&n.alwaysMakePathsAbsolute()&&(m.rootpath=n.join(m.entryPath,m.rootpath))),m.filename=c;var o=new d.Parse(j.context);o.processImports=!1,j.contents[c]=i,(g.reference||h.reference)&&(m.reference=!0),h.isPlugin?(b=k.evalPlugin(i,o,h.pluginArgs,m),b instanceof f?l(b,null,c):l(null,b,c)):h.inline?l(null,i,c):new e(o,j,m).parse(i,function(a,b){l(a,b,c)})},q=function(a,b){a?l(a):p(b)};if(h.isPlugin)try{k.tryLoadPlugin(b,g.currentDirectory,q)}catch(r){i(r)}else o=n.loadFile(b,g.currentDirectory,this.context,a,q),o&&o.then(p,l)},b}},{"./contexts":12,"./less-error":34,"./parser/parser":40}],33:[function(a,b,c){b.exports=function(b,c){var d,e,f,g,h,i={version:[3,0,0],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),AbstractPluginLoader:a("./environment/abstract-plugin-loader"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")};return i}},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":16,"./environment/abstract-plugin-loader":17,"./environment/environment":18,"./functions":25,"./import-manager":32,"./less-error":34,"./logger":35,"./parse":37,"./parse-tree":36,"./parser/parser":40,"./plugin-manager":41,"./render":42,"./source-map-builder":43,"./source-map-output":44,"./transform-tree":45,"./tree":65,"./utils":86,"./visitors":90}],34:[function(a,b,c){var d=a("./utils"),e=b.exports=function(a,b,c){Error.call(this);var e=a.filename||c;if(b&&e){var f=b.contents[e],g=d.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&d.getLocation(a.call,f).line,k=f.split("\n");this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.callLine=j+1,this.callExtract=k[j],this.column=i,this.extract=[k[h-1],k[h],k[h+1]]}this.message=a.message,this.stack=a.stack};if("undefined"==typeof Object.create){var f=function(){};f.prototype=Error.prototype,e.prototype=new f}else e.prototype=Object.create(Error.prototype);e.prototype.constructor=e},{"./utils":86}],35:[function(a,b,c){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;b=97&&j<=122||j<34))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(h96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;hd&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],39:[function(a,b,c){var d=a("./chunker");b.exports=function(){function a(d){for(var e,f,j,p=k.i,q=c,s=k.i-i,t=k.i+h.length-s,u=k.i+=d,v=b;k.i=0){j={index:k.i,text:v.substr(k.i,x+2-k.i),isLineComment:!1},k.i+=j.text.length-1,k.commentStore.push(j);continue}}break}if(e!==l&&e!==n&&e!==m&&e!==o)break}if(h=h.slice(d+k.i-u+s),i=k.i,!h.length){if(ce||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,c=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$re=function(b){k.i>i&&(h=h.slice(k.i-i),i=k.i);var c=b.exec(h);return c?(a(c[0].length),"string"==typeof c?c:1===c.length?c[0]:c):null},k.$char=function(c){return b.charAt(k.i)!==c?null:(a(1),c)},k.$str=function(c){for(var d=c.length,e=0;es||a=b.length;return k.i=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":38}],40:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=function j(a,b,c){function i(a,e){throw new d({index:o.i,filename:c.filename,type:e||"Syntax",message:a},b)}function k(a,b,c){var d=a instanceof Function?a.call(n):o.$re(a);return d?d:void i(b||("string"==typeof a?"expected '"+a+"' got '"+o.currentChar()+"'":"unexpected token"))}function l(a,b){return o.$char(a)?a:void i(b||"expected '"+a+"' got '"+o.currentChar()+"'")}function m(a){var b=c.filename;return{lineNumber:h.getLocation(a,o.getInput()).line+1,fileName:b}}var n,o=g();return{parse:function(g,h,i){var k,l,m,n,p=null,q="";if(l=i&&i.globalVars?j.serializeVars(i.globalVars)+"\n":"",m=i&&i.modifyVars?"\n"+j.serializeVars(i.modifyVars):"",a.pluginManager)for(var r=a.pluginManager.getPreProcessors(),s=0;s1&&(b=new e.Value(g)),d.push(b),g=[])}return o.forget(),a?d:f},literal:function(){return this.dimension()||this.color()||this.quoted()||this.unicodeDescriptor()},assignment:function(){var a,b;return o.save(),(a=o.$re(/^\w+(?=\s?=)/i))&&o.$char("=")&&(b=n.entity())?(o.forget(),new e.Assignment(a,b)):void o.restore()},url:function(){var a,b=o.i;return o.autoCommentAbsorb=!1,o.$str("url(")?(a=this.quoted()||this.variable()||o.$re(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",o.autoCommentAbsorb=!0,l(")"),new e.URL(null!=a.value||a instanceof e.Variable?a:new e.Anonymous(a),b,c)):void(o.autoCommentAbsorb=!0)},variable:function(){var a,b=o.i;if("@"===o.currentChar()&&(a=o.$re(/^@@?[\w-]+/)))return new e.Variable(a,b,c)},variableCurly:function(){var a,b=o.i;if("@"===o.currentChar()&&(a=o.$re(/^@\{([\w-]+)\}/)))return new e.Variable("@"+a[1],b,c)},color:function(){var a;if("#"===o.currentChar()&&(a=o.$re(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))){var b=a.input.match(/^#([\w]+).*/);return b=b[1],b.match(/^[A-Fa-f0-9]+$/)||i("Invalid HEX color code"),new e.Color(a[1],(void 0),"#"+b)}},colorKeyword:function(){o.save();var a=o.autoCommentAbsorb;o.autoCommentAbsorb=!1;var b=o.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/);if(o.autoCommentAbsorb=a,!b)return void o.forget();o.restore();var c=e.Color.fromKeyword(b);return c?(o.$str(b),c):void 0},dimension:function(){if(!o.peekNotNumeric()){var a=o.$re(/^([+-]?\d*\.?\d+)(%|[a-z_]+)?/i);return a?new e.Dimension(a[1],a[2]):void 0}},unicodeDescriptor:function(){var a;if(a=o.$re(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/))return new e.UnicodeDescriptor(a[0])},javascript:function(){var a,b=o.i;o.save();var d=o.$char("~"),f=o.$char("`");return f?(a=o.$re(/^[^`]*`/))?(o.forget(),new e.JavaScript(a.substr(0,a.length-1),Boolean(d),b,c)):void o.restore("invalid javascript definition"):void o.restore()}},variable:function(){var a;if("@"===o.currentChar()&&(a=o.$re(/^(@[\w-]+)\s*:/)))return a[1]},rulesetCall:function(){var a;if("@"===o.currentChar()&&(a=o.$re(/^(@[\w-]+)\(\s*\)\s*;/)))return new e.RulesetCall(a[1])},extend:function(a){var b,d,f,g,h,j=o.i;if(o.$str(a?"&:extend(":":extend(")){do{for(f=null,b=null;!(f=o.$re(/^(all)(?=\s*(\)|,))/))&&(d=this.element());)b?b.push(d):b=[d];f=f&&f[1],b||i("Missing target selector for :extend()."),h=new e.Extend(new e.Selector(b),f,j,c),g?g.push(h):g=[h]}while(o.$char(","));return k(/^\)/),a&&k(/^;/),g}},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var a,b,d,f,g,h,i=o.currentChar(),j=!1,k=o.i;if("."===i||"#"===i){for(o.save();;){if(a=o.i,f=o.$re(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/),!f)break;d=new e.Element(g,f,a,c),b?b.push(d):b=[d],g=o.$char(">")}return b&&(o.$char("(")&&(h=this.args(!0).args,l(")")),n.important()&&(j=!0),n.end())?(o.forget(),new e.mixin.Call(b,h,k,c,j)):void o.restore()}},args:function(a){var b,c,d,f,g,h,j,k=n.entities,l={args:null,variadic:!1},m=[],p=[],q=[];for(o.save();;){if(a)h=n.detachedRuleset()||n.expression();else{if(o.commentStore.length=0,o.$str("...")){l.variadic=!0,o.$char(";")&&!b&&(b=!0),(b?p:q).push({variadic:!0});break}h=k.variable()||k.literal()||k.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var r=null;if(a?h.value&&1==h.value.length&&(r=h.value[0]):r=h,r&&r instanceof e.Variable)if(o.$char(":")){if(m.length>0&&(b&&i("Cannot mix ; and , as delimiter types"),c=!0),g=n.detachedRuleset()||n.expression(),!g){if(!a)return o.restore(),l.args=[],l;i("could not understand value for named argument")}f=d=r.name}else if(o.$str("...")){if(!a){l.variadic=!0,o.$char(";")&&!b&&(b=!0),(b?p:q).push({name:h.name,variadic:!0});break}j=!0}else a||(d=f=r.name,g=null);g&&m.push(g),q.push({name:f,value:g,expand:j}),o.$char(",")||(o.$char(";")||b)&&(c&&i("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),p.push({name:d,value:g,expand:j}),d=null,m=[],c=!1)}return o.forget(),l.args=b?p:q,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==o.currentChar()&&"#"!==o.currentChar()||o.peek(/^[^{]*\}/)))if(o.save(),b=o.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!o.$char(")"))return void o.restore("Missing closing ')'");if(o.commentStore.length=0,o.$str("when")&&(d=k(n.conditions,"expected condition")),c=n.block())return o.forget(),new e.mixin.Definition(a,f,c,d,g);o.restore()}else o.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.call()||a.keyword()||a.javascript()},end:function(){return o.$char(";")||o.peek("}")},alpha:function(){var a;if(o.$re(/^opacity=/i))return a=o.$re(/^\d+/),a||(a=k(this.entities.variable,"Could not parse alpha")),l(")"),new e.Alpha(a)},element:function(){var a,b,d,f=o.i;if(b=this.combinator(),a=o.$re(/^(?:\d+\.\d+|\d+)%/)||o.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||o.$char("*")||o.$char("&")||this.attribute()||o.$re(/^\([^&()@]+\)/)||o.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(o.save(),o.$char("(")?(d=this.selector())&&o.$char(")")?(a=new e.Paren(d),o.forget()):o.restore("Missing closing ')'"):o.forget()),a)return new e.Element(b,a,f,c)},combinator:function(){var a=o.currentChar();if("/"===a){o.save();var b=o.$re(/^\/[a-z]+\//i);if(b)return o.forget(),new e.Combinator(b);o.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(o.i++,"^"===a&&"^"===o.currentChar()&&(a="^^",o.i++);o.isWhitespace();)o.i++;return new e.Combinator(a)}return new e.Combinator(o.isWhitespace(-1)?" ":null)},lessSelector:function(){return this.selector(!0)},selector:function(a){for(var b,d,f,g,h,j,l,m=o.i;(a&&(d=this.extend())||a&&(j=o.$str("when"))||(g=this.element()))&&(j?l=k(this.conditions,"expected condition"):l?i("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&i("Extend can only be used at the end of selector"),f=o.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,l,m,c):void(h&&i("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(o.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=k(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=o.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||o.$re(/^[0-9]+%/)||o.$re(/^[\w-]+/)||d.variableCurly()),l("]"),new e.Attribute(a,c,b)}},block:function(){var a;if(o.$char("{")&&(a=this.primary())&&o.$char("}"))return a},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();if(a)return new e.DetachedRuleset(a)},ruleset:function(){var b,c,d,f;for(o.save(),a.dumpLineNumbers&&(f=m(o.i));;){if(c=this.lessSelector(),!c)break;if(b?b.push(c):b=[c],o.commentStore.length=0,c.condition&&b.length>1&&i("Guards are only currently allowed on a single selector."),!o.$char(","))break;c.condition&&i("Guards are only currently allowed on a single selector."),o.commentStore.length=0}if(b&&(d=this.block())){o.forget();var g=new e.Ruleset(b,d,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}o.restore()},declaration:function(b){var d,f,g,h,i,j=o.i,k=o.currentChar();if("."!==k&&"#"!==k&&"&"!==k&&":"!==k)if(o.save(),d=this.variable()||this.ruleProperty()){if(i="string"==typeof d,i&&(f=this.detachedRuleset()),o.commentStore.length=0,!f){h=!i&&d.length>1&&d.pop().value;var l=!b&&(a.compress||i);if(l&&(f=this.value()),!f&&(f=this.anonymousValue()))return o.forget(),new e.Declaration(d,f,(!1),h,j,c);l||f||(f=this.value()),g=this.important()}if(f&&this.end())return o.forget(),new e.Declaration(d,f,g,h,j,c);if(o.restore(),f&&!b)return this.declaration(!0)}else o.forget()},anonymousValue:function(){var a=o.$re(/^([^@+\/'"*`(;{}-]*);/);if(a)return new e.Anonymous(a[1])},"import":function(){var a,b,d=o.i,f=o.$re(/^@import?\s+/);if(f){var g=(f?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),o.$char(";")||(o.i=d,i("missing semi-colon or unrecognised media features on import")),b=b&&new e.Value(b),new e.Import(a,b,g,d,c);o.i=d,i("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!o.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!o.$char(","))break}while(a);return l(")"),d},importOption:function(){var a=o.$re(/^(less|css|multiple|once|inline|reference|optional)/);if(a)return a[1]},mediaFeature:function(){var a,b,d=this.entities,f=[];o.save();do a=d.keyword()||d.variable(),a?f.push(a):o.$char("(")&&(b=this.property(),a=this.value(),o.$char(")")?b&&a?f.push(new e.Paren(new e.Declaration(b,a,null,null,o.i,c,(!0)))):a?f.push(new e.Paren(a)):i("badly formed media feature definition"):i("Missing closing ')'","Parse"));while(a);if(o.forget(),f.length>0)return new e.Expression(f)},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!o.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!o.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=o.i;return a.dumpLineNumbers&&(g=m(h)),o.save(),o.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||i("media definitions require block statements after any features"),o.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void o.restore()},plugin:function(){var a,b,d,f=o.i,g=o.$re(/^@plugin?\s+/);if(g){if(b=this.pluginArgs(),d=b?{pluginArgs:b,isPlugin:!0}:{isPlugin:!0},a=this.entities.quoted()||this.entities.url())return o.$char(";")||(o.i=f,i("missing semi-colon on @plugin")),new e.Import(a,null,d,f,c);o.i=f,i("malformed @plugin statement")}},pluginArgs:function(){if(o.save(),!o.$char("("))return o.restore(),null;var a=o.$re(/^\s*([^\);]+)\)\s*/);return a[1]?(o.forget(),a[1].trim()):(o.restore(),null)},atrule:function(){var b,d,f,g,h,j,k,l=o.i,n=!0,p=!0;if("@"===o.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(o.save(),b=o.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,n=!1;break;case"@namespace":j=!0,n=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,p=!1;break;default:k=!0}return o.commentStore.length=0,h?(d=this.entity(),d||i("expected "+b+" identifier")):j?(d=this.expression(),d||i("expected "+b+" expression")):k&&(d=(o.$re(/^[^{;]+/)||"").trim(),n="{"==o.currentChar(),d&&(d=new e.Anonymous(d))),n&&(f=this.blockRuleset()),f||!n&&d&&o.$char(";")?(o.forget(),new e.AtRule(b,d,f,l,c,a.dumpLineNumbers?m(l):null,p)):void o.restore("at-rule options not recognised")}}},value:function(){var a,b=[];do if(a=this.expression(),a&&(b.push(a),!o.$char(",")))break;while(a);if(b.length>0)return new e.Value(b)},important:function(){if("!"===o.currentChar())return o.$re(/^! *important/)},sub:function(){var a,b;return o.save(),o.$char("(")?(a=this.addition(),a&&o.$char(")")?(o.forget(),b=new e.Expression([a]),b.parens=!0,b):void o.restore("Expected ')'")):void o.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=o.isWhitespace(-1);;){if(o.peek(/^\/[*\/]/))break;if(o.save(),c=o.$char("/")||o.$char("*"),!c){o.forget();break}if(b=this.operand(),!b){o.restore();break}o.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=o.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=o.isWhitespace(-1);;){if(c=o.$re(/^[-+]\s+/)||!f&&(o.$char("+")||o.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=o.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=o.i;if(a=this.condition()){for(;;){if(!o.peek(/^,\s*(not\s*)?\(/)||!o.$char(","))break;if(b=this.condition(),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(){function a(){return o.$str("or")}var b,c,d;if(b=this.conditionAnd(this)){if(c=a()){if(d=this.condition(),!d)return;b=new e.Condition(c,b,d)}return b}},conditionAnd:function(){function a(a){return a.negatedCondition()||a.parenthesisCondition()}function b(){return o.$str("and")}var c,d,f;if(c=a(this)){if(d=b()){if(f=this.conditionAnd(),!f)return;c=new e.Condition(d,c,f)}return c}},negatedCondition:function(){if(o.$str("not")){var a=this.parenthesisCondition();return a&&(a.negate=!a.negate),a}},parenthesisCondition:function(){ +function a(a){var b;return o.save(),(b=a.condition())&&o.$char(")")?(o.forget(),b):void o.restore()}var b;return o.save(),o.$str("(")?(b=a(this))?(o.forget(),b):(b=this.atomicCondition())?o.$char(")")?(o.forget(),b):void o.restore("expected ')' got '"+o.currentChar()+"'"):void o.restore():void o.restore()},atomicCondition:function(){var a,b,c,d,f=this.entities,g=o.i;if(a=this.addition()||f.keyword()||f.quoted())return o.$char(">")?d=o.$char("=")?">=":">":o.$char("<")?d=o.$char("=")?"<=":"<":o.$char("=")&&(d=o.$char(">")?"=>":o.$char("<")?"=<":"="),d?(b=this.addition()||f.keyword()||f.quoted(),b?c=new e.Condition(d,a,b,g,(!1)):i("expected expression")):c=new e.Condition("=",a,new e.Keyword("true"),g,(!1)),c},operand:function(){var a,b=this.entities;o.peek(/^-[@\(]/)&&(a=o.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.call()||b.colorKeyword();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[];do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),o.peek(/^\/[\/*]/)||(b=o.$char("/"),b&&c.push(new e.Anonymous(b)))));while(a);if(c.length>0)return new e.Expression(c)},property:function(){var a=o.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(a)return a[1]},ruleProperty:function(){function a(a){var b=o.i,c=o.$re(a);if(c)return g.push(b),f.push(c[1])}var b,d,f=[],g=[];o.save();var h=o.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],o.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:@\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(o.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;d=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},f.prototype.addPostProcessor=function(a,b){var c;for(c=0;c=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},f.prototype.addFileManager=function(a){this.fileManagers.push(a)},f.prototype.getPreProcessors=function(){for(var a=[],b=0;b0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],45:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Declaration("@"+a,b,(!1),null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j,k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor((!0)),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager)for(j=b.pluginManager.visitor(),j.first();i=j.get();)i.isPreEvalVisitor&&i.run(a);c=a.eval(h);for(var l=0;l.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(d="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":73}],56:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],57:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;c-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&c<1&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":15,"./color":52,"./node":73,"./unit":82}],60:[function(a,b,c){var d=a("./atrule"),e=function(){var a=Array.prototype.slice.call(arguments);d.apply(this,a)};e.prototype=Object.create(d.prototype),e.prototype.constructor=e,b.exports=e},{"./atrule":49}],61:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./combinator"),g=function(a,b,c,d,e){this.combinator=a instanceof f?a:new f(a),this.value="string"==typeof b?b.trim():b?b:"",this._index=c,this._fileInfo=d,this.copyVisibilityInfo(e),this.setParent(this.combinator,this)};g.prototype=new d,g.prototype.type="Element",g.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},g.prototype.eval=function(a){return new g(this.combinator,this.value.eval?this.value.eval(a):this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.fileInfo(),this.getIndex())},g.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof e&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=g},{"./combinator":53,"./node":73,"./paren":75}],62:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./comment"),g=function(a){if(this.value=a,!a)throw new Error("Expression requires an array parameter")};g.prototype=new d,g.prototype.type="Expression",g.prototype.accept=function(a){this.value=a.visitArray(this.value)},g.prototype.eval=function(a){var b,c=this.parens&&!this.parensInOp,d=!1;return c&&a.inParenthesis(),this.value.length>1?b=new g(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(d=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!d&&(b=new e(b)),b},g.prototype.genCSS=function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":73,"./selector":80}],64:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=a("../utils"),k=function(a,b,c,d,e,f){if(this.options=c,this._index=d,this._fileInfo=e,this.path=a,this.features=b,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?\/]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f),this.setParent(this.features,this),this.setParent(this.path,this)};k.prototype=new d,k.prototype.type="Import",k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.isPlugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},k.prototype.genCSS=function(a,b){this.css&&void 0===this.path._fileInfo.reference&&(b.add("@import ",this._fileInfo,this._index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},k.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},k.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),!(a instanceof g)||a.containsVariables()},k.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new k(b.eval(a),this.features,this.options,this._index,this._fileInfo,this.visibilityInfo())},k.prototype.evalPath=function(a){var b=this.path.eval(a),c=this._fileInfo&&this._fileInfo.rootpath;if(!(b instanceof f)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d)}b.value=a.normalizePath(b.value)}return b},k.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){a.addVisibilityBlock()}):b.addVisibilityBlock()),b},k.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a);if(this.options.isPlugin)return this.root&&this.root.eval&&this.root.eval(a),c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[];if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var f=new i(this.root,0,{filename:this.importedFilename,reference:this.path._fileInfo&&this.path._fileInfo.reference},(!0),(!0));return this.features?new e([f],this.features.value):[f]}if(this.css){var g=new k(this.evalPath(a),d,this.options,this._index);if(!g.css&&this.error)throw this.error;return g}return b=new h(null,j.copyArray(this.root.rules)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=k},{"../utils":86,"./anonymous":47,"./media":69,"./node":73,"./quoted":76,"./ruleset":79,"./url":83}],65:[function(a,b,c){var d={};d.Node=a("./node"),d.Alpha=a("./alpha"),d.Color=a("./color"),d.AtRule=a("./atrule"),d.Directive=a("./directive"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Declaration=a("./declaration"),d.Rule=a("./rule"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.RulesetCall=a("./ruleset-call"),b.exports=d},{"./alpha":46,"./anonymous":47,"./assignment":48,"./atrule":49,"./attribute":50,"./call":51,"./color":52,"./combinator":53,"./comment":54,"./condition":55,"./declaration":57,"./detached-ruleset":58,"./dimension":59,"./directive":60,"./element":61,"./expression":62,"./extend":63,"./import":64,"./javascript":66,"./keyword":68,"./media":69,"./mixin-call":70,"./mixin-definition":71,"./negative":72,"./node":73,"./operation":74,"./paren":75,"./quoted":76,"./rule":77,"./ruleset":79,"./ruleset-call":78,"./selector":80,"./unicode-descriptor":81,"./unit":82,"./url":83,"./value":84,"./variable":85}],66:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this._index=c,this._fileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new e(b):"string"==typeof b?new f('"'+b+'"',b,this.escaped,this._index):new g(Array.isArray(b)?b.join(", "):b); +},b.exports=h},{"./anonymous":47,"./dimension":59,"./js-eval-node":67,"./quoted":76}],67:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(!b.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.fileInfo().filename,index:this.getIndex()};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.getIndex(),d.fileInfo()).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.fileInfo().filename,index:this.getIndex()}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.fileInfo().filename,index:this.getIndex()}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":73,"./variable":85}],68:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":73}],69:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./atrule"),j=a("../utils"),k=function(a,b,c,g,h){this._index=c,this._fileInfo=g;var i=new f([],null,null,this._index,this._fileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0,this.setParent(i,this),this.setParent(this.features,this),this.setParent(this.rules,this)};k.prototype=new i,k.prototype.type="Media",k.prototype.isRulesetLike=!0,k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},k.prototype.genCSS=function(a,b){b.add("@media ",this._fileInfo,this._index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},k.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new k(null,[],this._index,this._fileInfo,this.visibilityInfo());this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo);var c=!1;a.strictMath||(c=!0,a.strictMath=!0);try{b.features=this.features.eval(a)}finally{c&&(a.strictMath=!1)}return a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},k.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo()),this.setParent(b,this)}return delete a.mediaBlocks,delete a.mediaPath,b},k.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;b0;b--)a.splice(b,0,new g("and"));return new h(a)})),this.setParent(this.features,this),new d([],[])},k.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(n=!0,k=0;k0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.getIndex(),filename:this.fileInfo().filename};for(k=0;kthis.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;gb?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],74:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};g.prototype=new d,g.prototype.type="Operation",g.prototype.accept=function(a){this.operands=a.visit(this.operands)},g.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof f&&c instanceof e&&(b=b.toColor()),c instanceof f&&b instanceof e&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new g(this.op,[b,c],this.isSpaced)},g.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=g},{"./color":52,"./dimension":59,"./node":73}],75:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":73}],76:[function(a,b,c){var d=a("./node"),e=a("./js-eval-node"),f=a("./variable"),g=function(a,b,c,d,e){this.escaped=null==c||c,this.value=b||"",this.quote=a.charAt(0),this._index=d,this._fileInfo=e};g.prototype=new e,g.prototype.type="Quoted",g.prototype.genCSS=function(a,b){this.escaped||b.add(this.quote,this.fileInfo(),this.getIndex()),b.add(this.value),this.escaped||b.add(this.quote)},g.prototype.containsVariables=function(){return this.value.match(/(`([^`]+)`)|@\{([\w-]+)\}/)},g.prototype.eval=function(a){function b(a,b,c){var d=a;do a=d,d=a.replace(b,c);while(a!==d);return d}var c=this,d=this.value,e=function(b,d){return String(c.evaluateJavaScript(d,a))},h=function(b,d){var e=new f("@"+d,c.getIndex(),c.fileInfo()).eval(a,!0);return e instanceof g?e.value:e.toCSS()};return d=b(d,/`([^`]+)`/g,e),d=b(d,/@\{([\w-]+)\}/g,h),new g(this.quote+d+this.quote,d,this.escaped,this.getIndex(),this.fileInfo())},g.prototype.compare=function(a){return"Quoted"!==a.type||this.escaped||a.escaped?a.toCSS&&this.toCSS()===a.toCSS()?0:void 0:d.numericCompare(this.value,a.value)},b.exports=g},{"./js-eval-node":67,"./node":73,"./variable":85}],77:[function(a,b,c){var d=a("./declaration"),e=function(){var a=Array.prototype.slice.call(arguments);d.apply(this,a)};e.prototype=Object.create(d.prototype),e.prototype.constructor=e,b.exports=e},{"./declaration":57}],78:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(a){this.variable=a,this.allowRoot=!0};f.prototype=new d,f.prototype.type="RulesetCall",f.prototype.eval=function(a){var b=new e(this.variable).eval(a);return b.callEval(a)},b.exports=f},{"./node":73,"./variable":85}],79:[function(a,b,c){var d=a("./node"),e=a("./declaration"),f=a("./selector"),g=a("./element"),h=a("./paren"),i=a("../contexts"),j=a("../functions/function-registry"),k=a("../functions/default"),l=a("./debug-info"),m=a("../utils"),n=function(a,b,c,d){this.selectors=a,this.rules=b,this._lookups={},this.strictImports=c,this.copyVisibilityInfo(d),this.allowRoot=!0,this.setParent(this.selectors,this),this.setParent(this.rules,this)};n.prototype=new d,n.prototype.type="Ruleset",n.prototype.isRuleset=!0,n.prototype.isRulesetLike=!0,n.prototype.accept=function(a){this.paths?this.paths=a.visitArray(this.paths,!0):this.selectors&&(this.selectors=a.visitArray(this.selectors)),this.rules&&this.rules.length&&(this.rules=a.visitArray(this.rules))},n.prototype.eval=function(a){var b,c,f,g,h=this.selectors,i=!1;if(h&&(c=h.length)){for(b=new Array(c),k.error({type:"Syntax",message:"it is currently only allowed in parametric mixin guards,"}),g=0;gd){if(!c||c(h)){e=h.find(new f(a.elements.slice(d)),b,c);for(var j=0;j0&&b.add(m),a.firstSelector=!0,i[0].genCSS(a,b),a.firstSelector=!1,f=1;f0?(e=m.copyArray(a),f=e.pop(),h=d.createDerived(m.copyArray(f.elements))):h=d.createDerived([]),b.length>0){var i=c.combinator,j=b[0].elements[0];i.emptyOrWhitespace&&!j.combinator.emptyOrWhitespace&&(i=j.combinator),h.elements.push(new g(i,j.value,c._index,c._fileInfo)),h.elements=h.elements.concat(b[0].elements.slice(1))}if(0!==h.elements.length&&e.push(h),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function j(a,b,c,d,e){var f;for(f=0;f0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new f(a))}}function l(a,b,c){function f(a){var b;return"Paren"!==a.value.type?null:(b=a.value.value,"Selector"!==b.type?null:b)}var h,m,n,o,p,q,r,s,t,u,v=!1;for(o=[],p=[[]],h=0;h0&&r[0].elements.push(new g(s.combinator,"",s._index,s._fileInfo)),q.push(r);else for(n=0;n0&&(a.push(p[h]),u=p[h][t-1],p[h][t-1]=u.createDerived(u.elements,c.extendList));return v}function n(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var o,p,q;if(p=[],q=l(p,b,c),!q)if(b.length>0)for(p=[],o=0;o0)for(b=0;b=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}},copyArray:function(a){var b,c=a.length,d=new Array(c);for(b=0;b=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.fileInfo(),b),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitDeclaration:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;e0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return k0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitAtRule:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitAtRuleOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=i},{"../logger":35,"../tree":65,"../utils":86,"./visitor":94}],88:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],89:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=a("../utils"),h=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};h.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,g.copyArray(this.context.frames)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.getIndex(),f.filename=a.fileInfo().filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;h0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];if(this.keepOnlyVisibleChilds(c),!this.isEmpty(c))return a.ensureVisibility(),a.removeVisibilityBlock(),a},isVisibleRuleset:function(a){return!!a.firstRoot||!this.isEmpty(a)&&!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitDeclaration:function(a,b){if(!a.blocksVisibility()&&!a.variable)return a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){if(!a.blocksVisibility()&&!a.isSilent(this._context))return a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){if(!a.blocksVisibility())return a},visitAtRule:function(a,b){return a.rules&&a.rules.length?this.visitAtRuleWithBody(a,b):this.visitAtRuleWithoutBody(a,b)},visitAtRuleWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitAtRuleWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;c0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;b=0;e--)if(c=a[e],c instanceof d.Declaration)if(f[c.name]){b=f[c.name],b instanceof d.Declaration&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);b.indexOf(g)!==-1?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b,c,e,f={},g=0;g1){c=b[0];var h=[],i=[];b.map(function(a){"+"===a.merge&&(i.length>0&&h.push(e(i)),i=[]),i.push(a)}),h.push(e(i)),c.value=g(h)}})}},visitAnonymous:function(a,b){if(!a.blocksVisibility())return a.accept(this._visitor),a}},b.exports=g},{"../tree":65,"./visitor":94}],94:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)if(a.hasOwnProperty(c))switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitFnCache=[],h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var c,e=this._visitFnCache,f=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=g;if(l.visitDeeper=!0,j||(c="visit"+a.type,j=f[c]||d,k=f[c+"Out"]||d,e[h]=j,e[i]=k),j!==d){var m=j.call(f,a,l);f.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=d&&k.call(f,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;ck){for(var b=0,c=h.length-j;b=0;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c--;c)a.unshift("..");return a}function d(a,b){if(a.filter)return a.filter(b);for(var c=[],d=0;d=-1&&!e;f--){var g=f>=0?arguments[f]:a.cwd();if("string"!=typeof g)throw new TypeError("Arguments to path.resolve must be strings");g&&(c=g+"/"+c,e="/"===g.charAt(0))}return c=b(d(c.split("/"),function(a){return!!a}),!e).join("/"),(e?"/":"")+c||"."},c.normalize=function(a){var e=c.isAbsolute(a),f="/"===g(a,-1);return a=b(d(a.split("/"),function(a){return!!a}),!e).join("/"),a||e||(a="."),a&&f&&(a+="/"),(e?"/":"")+a},c.isAbsolute=function(a){return"/"===a.charAt(0)},c.join=function(){var a=Array.prototype.slice.call(arguments,0);return c.normalize(d(a,function(a,b){if("string"!=typeof a)throw new TypeError("Arguments to path.join must be strings");return a}).join("/"))},c.relative=function(a,b){function d(a){for(var b=0;b=0&&""===a[c];c--);return b>c?[]:a.slice(b,c-b+1)}a=c.resolve(a).substr(1),b=c.resolve(b).substr(1);for(var e=d(a.split("/")),f=d(b.split("/")),g=Math.min(e.length,f.length),h=g,i=0;i1)for(var c=1;c Date: Thu, 14 Jul 2016 13:14:58 -0700 Subject: [PATCH 17/97] Added more accurate & detailed benchmark --- benchmark/index.js | 92 ++++++++++++++++++++++++++++++++-------------- package.json | 1 + 2 files changed, 66 insertions(+), 27 deletions(-) diff --git a/benchmark/index.js b/benchmark/index.js index f73c151d0..87b3da770 100644 --- a/benchmark/index.js +++ b/benchmark/index.js @@ -1,5 +1,6 @@ var path = require('path'), - fs = require('fs'); + fs = require('fs'), + now = require("performance-now"); var less = require('../lib/less-node'); var file = path.join(__dirname, 'benchmark.less'); @@ -7,49 +8,86 @@ var file = path.join(__dirname, 'benchmark.less'); if (process.argv[2]) { file = path.join(process.cwd(), process.argv[2]) } fs.readFile(file, 'utf8', function (e, data) { - var start, end, total; + var start, total; console.log("Benchmarking...\n", path.basename(file) + " (" + parseInt(data.length / 1024) + " KB)", ""); - var benchMarkData = []; + var renderBenchmark = [] + , parserBenchmark = [] + , evalBenchmark = []; - var totalruns = 100; - var ignoreruns = 30; + var totalruns = 30; + var ignoreruns = 5; - for(var i = 0; i < totalruns; i++) { - start = new Date(); + var i = 0; - less.render(data, function (err) { - end = new Date(); + nextRun(); - benchMarkData.push(end - start); + function nextRun() { + var start, renderEnd, parserEnd; + start = now(); + + less.parse(data, {}, function(err, root, imports, options) { if (err) { less.writeError(err); process.exit(3); } + parserEnd = now(); + + var tree, result; + tree = new less.ParseTree(root, imports); + result = tree.toCSS(options); + + renderEnd = now(); + + renderBenchmark.push(renderEnd - start); + parserBenchmark.push(parserEnd - start); + evalBenchmark.push(renderEnd - parserEnd); + + i += 1; + //console.log('Less Run #: ' + i); + if(i < totalruns) { + nextRun(); + } + else { + finish(); + } }); } - var totalTime = 0; - var mintime = Infinity; - var maxtime = 0; - for(var i = ignoreruns; i < totalruns; i++) { - totalTime += benchMarkData[i]; - mintime = Math.min(mintime, benchMarkData[i]); - maxtime = Math.max(maxtime, benchMarkData[i]); + function finish() { + function analyze(benchmark, benchMarkData) { + console.log('----------------------'); + console.log(benchmark); + console.log('----------------------'); + var totalTime = 0; + var mintime = Infinity; + var maxtime = 0; + for(var i = ignoreruns; i < totalruns; i++) { + totalTime += benchMarkData[i]; + mintime = Math.min(mintime, benchMarkData[i]); + maxtime = Math.max(maxtime, benchMarkData[i]); + } + var avgtime = totalTime / (totalruns - ignoreruns); + var variation = maxtime - mintime; + var variationperc = (variation / avgtime) * 100; + + console.log("Min. Time: " + Math.round(mintime) + " ms"); + console.log("Max. Time: " + Math.round(maxtime) + " ms"); + console.log("Total Average Time: " + Math.round(avgtime) + " ms (" + + parseInt(1000 / avgtime * + data.length / 1024) + " KB\/s)"); + console.log("+/- " + Math.round(variationperc) + "%"); + console.log(""); + } + + analyze('Parsing', parserBenchmark); + analyze('Evaluation', evalBenchmark); + analyze('Render Time', renderBenchmark); + } - var avgtime = totalTime / (totalruns - ignoreruns); - var variation = maxtime - mintime; - var variationperc = (variation / avgtime) * 100; - - console.log("Min. Time: "+mintime + " ms"); - console.log("Max. Time: "+maxtime + " ms"); - console.log("Total Average Time: " + avgtime + " ms (" + - parseInt(1000 / avgtime * - data.length / 1024) + " KB\/s)"); - console.log("+/- " + variationperc + "%"); }); diff --git a/package.json b/package.json index 118980b55..f7a706f98 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "grunt-saucelabs": "^8.6.2", "grunt-shell": "^1.3.0", "jit-grunt": "^0.10.0", + "performance-now": "^0.2.0", "phantomjs-prebuilt": "^2.1.7", "time-grunt": "^1.3.0" }, From 9b0c8abb5430d5e26299cba5b9864960183cdd2e Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Fri, 15 Jul 2016 16:03:02 -0700 Subject: [PATCH 18/97] Reduced lookups and type checking on object properties --- lib/less/tree/media.js | 2 +- lib/less/tree/node.js | 1 + lib/less/tree/ruleset.js | 101 ++++++++++++++------------------------- 3 files changed, 39 insertions(+), 65 deletions(-) diff --git a/lib/less/tree/media.js b/lib/less/tree/media.js index 0ef4db2c3..5acb76137 100644 --- a/lib/less/tree/media.js +++ b/lib/less/tree/media.js @@ -23,7 +23,7 @@ var Media = function (value, features, index, currentFileInfo, visibilityInfo) { }; Media.prototype = new AtRule(); Media.prototype.type = "Media"; -Media.prototype.isRulesetLike = true; +Media.prototype.isRulesetLike = function() { return true; }; Media.prototype.accept = function (visitor) { if (this.features) { this.features = visitor.visit(this.features); diff --git a/lib/less/tree/node.js b/lib/less/tree/node.js index 2b89ea25a..ceee12a5b 100644 --- a/lib/less/tree/node.js +++ b/lib/less/tree/node.js @@ -31,6 +31,7 @@ Node.prototype.getIndex = function() { Node.prototype.fileInfo = function() { return this._fileInfo || (this.parent && this.parent.fileInfo()) || {}; }; +Node.prototype.isRulesetLike = function() { return false; }; Node.prototype.toCSS = function (context) { var strs = []; this.genCSS(context, { diff --git a/lib/less/tree/ruleset.js b/lib/less/tree/ruleset.js index e318140cc..383d15c8b 100644 --- a/lib/less/tree/ruleset.js +++ b/lib/less/tree/ruleset.js @@ -1,8 +1,9 @@ var Node = require("./node"), Declaration = require("./declaration"), + Comment = require("./comment"), + Paren = require("./paren"), Selector = require("./selector"), Element = require("./element"), - Paren = require("./paren"), contexts = require("../contexts"), globalFunctionRegistry = require("../functions/function-registry"), defaultFunc = require("../functions/default"), @@ -23,7 +24,7 @@ var Ruleset = function (selectors, rules, strictImports, visibilityInfo) { Ruleset.prototype = new Node(); Ruleset.prototype.type = "Ruleset"; Ruleset.prototype.isRuleset = true; -Ruleset.prototype.isRulesetLike = true; +Ruleset.prototype.isRulesetLike = function() { return true; }; Ruleset.prototype.accept = function (visitor) { if (this.paths) { this.paths = visitor.visitArray(this.paths, true); @@ -104,20 +105,20 @@ Ruleset.prototype.eval = function (context) { // Store the frames around mixin definitions, // so they can be evaluated like closures when the time comes. - var rsRules = ruleset.rules, rsRuleCnt = rsRules ? rsRules.length : 0; - for (i = 0; i < rsRuleCnt; i++) { - if (rsRules[i].evalFirst) { - rsRules[i] = rsRules[i].eval(context); + var rsRules = ruleset.rules; + for (i = 0; (rule = rsRules[i]); i++) { + if (rule.evalFirst) { + rsRules[i] = rule.eval(context); } } var mediaBlockCount = (context.mediaBlocks && context.mediaBlocks.length) || 0; // Evaluate mixin calls. - for (i = 0; i < rsRuleCnt; i++) { - if (rsRules[i].type === "MixinCall") { + for (i = 0; (rule = rsRules[i]); i++) { + if (rule.type === "MixinCall") { /*jshint loopfunc:true */ - rules = rsRules[i].eval(context).filter(function(r) { + rules = rule.eval(context).filter(function(r) { if ((r instanceof Declaration) && r.variable) { // do not pollute the scope if the variable is // already there. consider returning false here @@ -127,12 +128,11 @@ Ruleset.prototype.eval = function (context) { return true; }); rsRules.splice.apply(rsRules, [i, 1].concat(rules)); - rsRuleCnt += rules.length - 1; i += rules.length - 1; ruleset.resetCache(); - } else if (rsRules[i].type === "RulesetCall") { + } else if (rule.type === "RulesetCall") { /*jshint loopfunc:true */ - rules = rsRules[i].eval(context).rules.filter(function(r) { + rules = rule.eval(context).rules.filter(function(r) { if ((r instanceof Declaration) && r.variable) { // do not pollute the scope at all return false; @@ -140,31 +140,27 @@ Ruleset.prototype.eval = function (context) { return true; }); rsRules.splice.apply(rsRules, [i, 1].concat(rules)); - rsRuleCnt += rules.length - 1; i += rules.length - 1; ruleset.resetCache(); } } // Evaluate everything else - for (i = 0; i < rsRules.length; i++) { - rule = rsRules[i]; + for (i = 0; (rule = rsRules[i]); i++) { if (!rule.evalFirst) { rsRules[i] = rule = rule.eval ? rule.eval(context) : rule; } } // Evaluate everything else - for (i = 0; i < rsRules.length; i++) { - rule = rsRules[i]; + for (i = 0; (rule = rsRules[i]); i++) { // for rulesets, check if it is a css guard and can be removed if (rule instanceof Ruleset && rule.selectors && rule.selectors.length === 1) { // check if it can be folded in (e.g. & where) if (rule.selectors[0].isJustParentSelector()) { rsRules.splice(i--, 1); - for (var j = 0; j < rule.rules.length; j++) { - subRule = rule.rules[j]; + for (var j = 0; (subRule = rule.rules[j]); j++) { if (subRule instanceof Node) { subRule.copyVisibilityInfo(rule.visibilityInfo()); if (!(subRule instanceof Declaration) || !subRule.variable) { @@ -266,11 +262,10 @@ Ruleset.prototype.variable = function (name) { Ruleset.prototype.rulesets = function () { if (!this.rules) { return []; } - var filtRules = [], rules = this.rules, cnt = rules.length, + var filtRules = [], rules = this.rules, i, rule; - for (i = 0; i < cnt; i++) { - rule = rules[i]; + for (i = 0; (rule = rules[i]); i++) { if (rule.isRuleset) { filtRules.push(rule); } @@ -336,41 +331,23 @@ Ruleset.prototype.genCSS = function (context, output) { tabSetStr = context.compress ? '' : Array(context.tabLevel).join(" "), sep; - function isRulesetLikeNode(rule) { - // if it has nested rules, then it should be treated like a ruleset - // medias and comments do not have nested rules, but should be treated like rulesets anyway - // some atrules and anonymous nodes are ruleset like, others are not - if (typeof rule.isRulesetLike === "boolean") { - return rule.isRulesetLike; - } else if (typeof rule.isRulesetLike === "function") { - return rule.isRulesetLike(); - } - - //anything else is assumed to be a rule - return false; - } - var charsetNodeIndex = 0; var importNodeIndex = 0; - for (i = 0; i < this.rules.length; i++) { - rule = this.rules[i]; - // Plugins may return something other than Nodes - if (rule instanceof Node) { - if (rule.type === "Comment") { - if (importNodeIndex === i) { - importNodeIndex++; - } - ruleNodes.push(rule); - } else if (rule.isCharset && rule.isCharset()) { - ruleNodes.splice(charsetNodeIndex, 0, rule); - charsetNodeIndex++; - importNodeIndex++; - } else if (rule.type === "Import") { - ruleNodes.splice(importNodeIndex, 0, rule); + for (i = 0; (rule = this.rules[i]); i++) { + if (rule instanceof Comment) { + if (importNodeIndex === i) { importNodeIndex++; - } else { - ruleNodes.push(rule); } + ruleNodes.push(rule); + } else if (rule.isCharset && rule.isCharset()) { + ruleNodes.splice(charsetNodeIndex, 0, rule); + charsetNodeIndex++; + importNodeIndex++; + } else if (rule.type === "Import") { + ruleNodes.splice(importNodeIndex, 0, rule); + importNodeIndex++; + } else { + ruleNodes.push(rule); } } ruleNodes = charsetRuleNodes.concat(ruleNodes); @@ -408,15 +385,14 @@ Ruleset.prototype.genCSS = function (context, output) { } // Compile rules and rulesets - for (i = 0; i < ruleNodes.length; i++) { - rule = ruleNodes[i]; + for (i = 0; (rule = ruleNodes[i]); i++) { if (i + 1 === ruleNodes.length) { context.lastRule = true; } var currentLastRule = context.lastRule; - if (isRulesetLikeNode(rule)) { + if (rule.isRulesetLike(rule)) { context.lastRule = false; } @@ -428,7 +404,7 @@ Ruleset.prototype.genCSS = function (context, output) { context.lastRule = currentLastRule; - if (!context.lastRule) { + if (!context.lastRule && rule.isVisible()) { output.add(context.compress ? '' : ('\n' + tabRuleStr)); } else { context.lastRule = false; @@ -546,9 +522,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { return; } - for (i = 0; i < selectors.length; i++) { - sel = selectors[i]; - + for (i = 0; (sel = selectors[i]); i++) { // if the previous thing in sel is a parent this needs to join on to it if (sel.length > 0) { sel[sel.length - 1] = sel[sel.length - 1].createDerived(sel[sel.length - 1].elements.concat(elements)); @@ -576,12 +550,12 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { var i, j, k, currentElements, newSelectors, selectorsMultiplied, sel, el, hadParentSelector = false, length, lastSelector; function findNestedSelector(element) { var maybeSelector; - if (element.value.type !== 'Paren') { + if (!(element.value instanceof Paren)) { return null; } maybeSelector = element.value.value; - if (maybeSelector.type !== 'Selector') { + if (!(maybeSelector instanceof Selector)) { return null; } @@ -597,8 +571,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { [] ]; - for (i = 0; i < inSelector.elements.length; i++) { - el = inSelector.elements[i]; + for (i = 0; (el = inSelector.elements[i]); i++) { // non parent reference elements just get added if (el.value !== "&") { var nestedSelector = findNestedSelector(el); From a3e43acb26d884a111b78be9a798e7831eb7790f Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Fri, 15 Jul 2016 16:05:20 -0700 Subject: [PATCH 19/97] Pass function registry to plugin install() - Create Anonymous nodes from non-null (but non-Node) function return values - Allow empty Anonymous nodes to collapse on output --- lib/less/environment/abstract-plugin-loader.js | 11 +++++------ lib/less/parse.js | 9 +++------ lib/less/plugin-manager.js | 4 ++-- lib/less/tree/anonymous.js | 5 ++++- lib/less/tree/call.js | 9 ++++++++- lib/less/tree/import.js | 1 + test/css/debug/linenumbers-all.css | 1 - test/css/debug/linenumbers-comments.css | 1 - test/css/debug/linenumbers-mediaquery.css | 1 - test/css/plugin.css | 4 ++++ test/less/plugin.less | 5 +++++ test/less/plugin/plugin-tree-nodes.js | 14 +++++++++----- 12 files changed, 41 insertions(+), 24 deletions(-) diff --git a/lib/less/environment/abstract-plugin-loader.js b/lib/less/environment/abstract-plugin-loader.js index 09b361b77..5840eab92 100644 --- a/lib/less/environment/abstract-plugin-loader.js +++ b/lib/less/environment/abstract-plugin-loader.js @@ -38,7 +38,7 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOp if (pluginObj) { this.trySetOptions(pluginObj, filename, pluginOptions); if (pluginObj.use) { - pluginObj.use(this.less); + pluginObj.use.call(this.context, pluginObj); } return pluginObj; } @@ -58,28 +58,27 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOp if (!pluginObj) { pluginObj = localModule.exports; } - pluginObj = this.validatePlugin(pluginObj, filename); if (pluginObj) { // Run on first load - pluginManager.addPlugin(pluginObj, fileInfo.filename); + pluginManager.addPlugin(pluginObj, fileInfo.filename, registry); pluginObj.functions = registry.getLocalFunctions(); this.trySetOptions(pluginObj, filename, pluginOptions); // Run every @plugin call if (pluginObj.use) { - pluginObj.use(this.less); + pluginObj.use.call(this.context, pluginObj); } } else { - throw new SyntaxError("Not a valid plugin"); + return new this.less.LessError({ message: "Not a valid plugin" }); } } catch(e) { // TODO pass the error - console.log(e); + console.log(e.stack); return new this.less.LessError({ message: "Plugin evaluation error: '" + e.name + ': ' + e.message.replace(/["]/g, "'") + "'" , filename: filename, diff --git a/lib/less/parse.js b/lib/less/parse.js index 5dbad10ed..320623a8b 100644 --- a/lib/less/parse.js +++ b/lib/less/parse.js @@ -56,20 +56,17 @@ module.exports = function(environment, ParseTree, ImportManager) { } var imports = new ImportManager(this, context, rootFileInfo); - + this.importManager = imports; + if (options.plugins) { options.plugins.forEach(function(plugin) { var evalResult, contents; if (plugin.fileContent) { contents = plugin.fileContent.replace(/^\uFEFF/, ''); evalResult = pluginManager.Loader.evalPlugin(contents, context, plugin.options, plugin.filename); - if (!(evalResult instanceof LessError)) { - pluginManager.addPlugin(plugin); - } - else { + if (evalResult instanceof LessError) { return callback(evalResult); } - } else { pluginManager.addPlugin(plugin); diff --git a/lib/less/plugin-manager.js b/lib/less/plugin-manager.js index 3b3ae3cec..dcbc0b0cf 100644 --- a/lib/less/plugin-manager.js +++ b/lib/less/plugin-manager.js @@ -36,13 +36,13 @@ PluginManager.prototype.addPlugins = function(plugins) { * @param plugin * @param {String} filename */ -PluginManager.prototype.addPlugin = function(plugin, filename) { +PluginManager.prototype.addPlugin = function(plugin, filename, functionRegistry) { this.installedPlugins.push(plugin); if (filename) { this.pluginCache[filename] = plugin; } if (plugin.install) { - plugin.install(this.less, this); + plugin.install(this.less, this, functionRegistry || this.less.functions.functionRegistry); } }; /** diff --git a/lib/less/tree/anonymous.js b/lib/less/tree/anonymous.js index 3b013cd0b..5775b2eae 100644 --- a/lib/less/tree/anonymous.js +++ b/lib/less/tree/anonymous.js @@ -21,6 +21,9 @@ Anonymous.prototype.isRulesetLike = function() { return this.rulesetLike; }; Anonymous.prototype.genCSS = function (context, output) { - output.add(this.value, this._fileInfo, this._index, this.mapLines); + this.nodeVisible = Boolean(this.value); + if (this.nodeVisible) { + output.add(this.value, this._fileInfo, this._index, this.mapLines); + } }; module.exports = Anonymous; diff --git a/lib/less/tree/call.js b/lib/less/tree/call.js index f6604e243..942436e64 100644 --- a/lib/less/tree/call.js +++ b/lib/less/tree/call.js @@ -1,4 +1,5 @@ var Node = require("./node"), + Anonymous = require("./anonymous"), FunctionCaller = require("../functions/function-caller"); // // A function call node. @@ -46,11 +47,17 @@ Call.prototype.eval = function (context) { }; } - if (result != null) { + if (result !== null && result !== undefined) { + // All returned results must be Nodes, + // so anything other than a Node is a null Node + if (!(result instanceof Node)) { + result = new Anonymous(null); + } result._index = this._index; result._fileInfo = this._fileInfo; return result; } + } return new Call(this.name, args, this.getIndex(), this.fileInfo()); diff --git a/lib/less/tree/import.js b/lib/less/tree/import.js index 03c122b04..e40ef1a23 100644 --- a/lib/less/tree/import.js +++ b/lib/less/tree/import.js @@ -137,6 +137,7 @@ Import.prototype.doEval = function (context) { if ( registry && this.root && this.root.functions ) { registry.addMultiple( this.root.functions ); } + return []; } diff --git a/test/css/debug/linenumbers-all.css b/test/css/debug/linenumbers-all.css index eabeb41fd..87022aecc 100644 --- a/test/css/debug/linenumbers-all.css +++ b/test/css/debug/linenumbers-all.css @@ -2,7 +2,6 @@ /* line 1, {pathimport}test.less */ @media -sass-debug-info{filename{font-family:file\:\/\/{pathimportesc}test\.less}line{font-family:\000031}} /* @charset "ISO-8859-1"; */ - /* line 23, {pathimport}test.less */ @media -sass-debug-info{filename{font-family:file\:\/\/{pathimportesc}test\.less}line{font-family:\0000323}} .tst3 { diff --git a/test/css/debug/linenumbers-comments.css b/test/css/debug/linenumbers-comments.css index a00fd7ffb..e5d6bb385 100644 --- a/test/css/debug/linenumbers-comments.css +++ b/test/css/debug/linenumbers-comments.css @@ -1,7 +1,6 @@ @charset "UTF-8"; /* line 1, {pathimport}test.less */ /* @charset "ISO-8859-1"; */ - /* line 23, {pathimport}test.less */ .tst3 { color: grey; diff --git a/test/css/debug/linenumbers-mediaquery.css b/test/css/debug/linenumbers-mediaquery.css index 11cdd24e6..e252ab3c2 100644 --- a/test/css/debug/linenumbers-mediaquery.css +++ b/test/css/debug/linenumbers-mediaquery.css @@ -1,7 +1,6 @@ @charset "UTF-8"; @media -sass-debug-info{filename{font-family:file\:\/\/{pathimportesc}test\.less}line{font-family:\000031}} /* @charset "ISO-8859-1"; */ - @media -sass-debug-info{filename{font-family:file\:\/\/{pathimportesc}test\.less}line{font-family:\0000323}} .tst3 { color: grey; diff --git a/test/css/plugin.css b/test/css/plugin.css index 0b6910754..71db68644 100644 --- a/test/css/plugin.css +++ b/test/css/plugin.css @@ -46,4 +46,8 @@ .root { prop: value; } +.test-empty { + val1: foo; + val2: foo; +} @arbitrary value after (); diff --git a/test/less/plugin.less b/test/less/plugin.less index d4dc01055..955a72684 100644 --- a/test/less/plugin.less +++ b/test/less/plugin.less @@ -86,6 +86,11 @@ .root { @ruleset2(); } +.test-empty { + val1: foo; + test-collapse(); + val2: foo; +} test-directive("@charset"; '"utf-8"'); test-directive("@arbitrary"; "value after ()"); diff --git a/test/less/plugin/plugin-tree-nodes.js b/test/less/plugin/plugin-tree-nodes.js index 442352d7f..b3fcf1809 100644 --- a/test/less/plugin/plugin-tree-nodes.js +++ b/test/less/plugin/plugin-tree-nodes.js @@ -24,9 +24,13 @@ functions.addMultiple({ "test-ruleset-call": function() { return new tree.Combinator(' '); }, - // Functions must return something. Must 'return true' if they produce no output. - "test-undefined": function() { }, - + // Functions must return something, even if it's false/true + "test-undefined": function() { + return; + }, + "test-collapse": function() { + return true; + }, // These cause root errors "test-alpha": function() { return new tree.Alpha(30); @@ -47,8 +51,8 @@ functions.addMultiple({ return new tree.Condition('<', new tree.Value([0]), new tree.Value([1])); }, "test-detached-ruleset" : function() { - var rule = new tree.Rule('prop', new tree.Anonymous('value')); - return new tree.DetachedRuleset(new tree.Ruleset("", [ rule ])); + var decl = new tree.Declaration('prop', new tree.Anonymous('value')); + return new tree.DetachedRuleset(new tree.Ruleset("", [ decl ])); }, "test-dimension": function() { return new tree.Dimension(1, 'px'); From ec3027242576d6876c94ce4f9c26e96b5d353d01 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Sat, 16 Jul 2016 14:22:19 -0700 Subject: [PATCH 20/97] Update Gruntfile.js with a more comprehensive (and up-to-date) browser testing list for Sauce Labs --- Gruntfile.js | 74 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 54 insertions(+), 20 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 92fea0419..1b130c892 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -278,54 +278,87 @@ module.exports = function (grunt) { 'saucelabs-jasmine': { all: { options: { - urls: ["filemanager-plugin","visitor-plugin","pre-processor-plugin","post-processor-plugin","post-processor", "global-vars", "modify-vars", "production", "rootpath-relative", + urls: ["filemanager-plugin","visitor-plugin","pre-processor-plugin","post-processor-plugin","global-vars", "modify-vars", "production", "rootpath-relative", "rootpath", "relative-urls", "browser", "no-js-errors", "legacy", "strict-units" ].map(function(testName) { return "http://localhost:8081/tmp/browser/test-runner-" + testName + ".html"; }), testname: 'Sauce Unit Test for less.js', - browsers: [{ + browsers: [ + // Desktop browsers + { browserName: "chrome", - version: '', - platform: 'Windows 8' + version: 'latest', + platform: 'Windows 7' }, { browserName: "firefox", - version: '33', + version: 'latest', platform: 'Linux' }, { - browserName: "iPad", - version: '8.0', - platform: 'OS X 10.9', - 'device-orientation': 'portrait' + browserName: 'safari', + version: '9.1', + platform: 'OS X 10.10' }, { - browserName: "internet explorer", + browserName: 'safari', version: '8', - platform: 'Windows XP' + platform: 'OS X 10.10' }, { browserName: "internet explorer", - version: '9', - platform: 'Windows 7' + version: '8', + platform: 'Windows XP' }, { browserName: "internet explorer", - version: '10', + version: '9', platform: 'Windows 7' }, { browserName: "internet explorer", version: '11', platform: 'Windows 8.1' - }], + }, + { + browserName: "edge", + version: '13', + platform: 'Windows 10' + }, + // Mobile browsers + { + browserName: "ipad", + version: '8.0', + platform: 'OS X 10.9', + 'device-orientation': 'portrait' + }, + { + browserName: 'iphone', + version: '7.1', + platform: 'OS X 10.9' + }, + { + browserName: 'iphone', + version: '9.3', + platform: 'OS X 10.10' + }, + { + browerName: 'android', + version: '4.2', + platform: 'Linux' + } + ], + public: 'public', + concurrency: 3, + recordVideo: false, + videoUploadOnPass: false, + recordScreenshots: process.env.TRAVIS_BRANCH !== "master", + build: process.env.TRAVIS_BRANCH === "master" ? process.env.TRAVIS_JOB_ID : undefined, + tags: [process.env.TRAVIS_BUILD_NUMBER, process.env.TRAVIS_PULL_REQUEST, process.env.TRAVIS_BRANCH], + 'max-duration': 120, sauceConfig: { - 'record-video': process.env.TRAVIS_BRANCH !== "master", - 'record-screenshots': process.env.TRAVIS_BRANCH !== "master", - 'idle-timeout': 100, 'max-duration': 120, - build: process.env.TRAVIS_BRANCH === "master" ? process.env.TRAVIS_JOB_ID : undefined, - tags: [process.env.TRAVIS_BUILD_NUMBER, process.env.TRAVIS_PULL_REQUEST, process.env.TRAVIS_BRANCH] + 'idle-timeout': 100 }, throttled: 3 } @@ -341,6 +374,7 @@ module.exports = function (grunt) { }); // Load these plugins to provide the necessary tasks + grunt.loadNpmTasks('grunt-saucelabs'); require('jit-grunt')(grunt); // Actually load this plugin's task(s). From 54affb852bc76f53eec4b34936eb3dce3898e760 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Sat, 16 Jul 2016 20:45:12 -0700 Subject: [PATCH 21/97] Faster Jasmine tests, Sauce Labs settings update / trying to fix Sauce Labs issues for specific browsers --- Gruntfile.js | 273 ++++++++++++++++++------- package.json | 2 + test/browser/common.js | 53 ++++- test/browser/test-runner-template.tmpl | 84 ++------ 4 files changed, 270 insertions(+), 142 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 1b130c892..9ae71a686 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -7,6 +7,174 @@ module.exports = function (grunt) { var COMPRESS_FOR_TESTS = true; + // Sauce Labs browser + var browsers = [ + // Desktop browsers + { + browserName: "chrome", + version: 'latest', + platform: 'Windows 7' + }, + { + browserName: "firefox", + version: 'latest', + platform: 'Linux' + }, + { + browserName: 'safari', + version: '9', + platform: 'OS X 10.11' + }, + { + browserName: 'safari', + version: '8', + platform: 'OS X 10.10' + }, + { + browserName: "internet explorer", + version: '8', + platform: 'Windows XP' + }, + { + browserName: "internet explorer", + version: '9', + platform: 'Windows 7' + }, + { + browserName: "internet explorer", + version: '11', + platform: 'Windows 8.1' + }, + { + browserName: "edge", + version: '13', + platform: 'Windows 10' + }, + // Mobile browsers + { + browserName: "ipad", + version: '8.0', + platform: 'OS X 10.9', + 'device-orientation': 'portrait' + }, + { + browserName: 'iphone', + version: '7.1', + platform: 'OS X 10.9' + }, + { + browserName: 'iphone', + version: '9.3', + platform: 'OS X 10.10' + }, + { + browerName: 'android', + version: '4.2', + platform: 'Linux' + } + ]; + var browsers = [ + // Desktop browsers + { + browserName: "chrome", + version: 'latest', + platform: 'Windows 7' + }, + { + browserName: "firefox", + version: 'latest', + platform: 'Linux' + }, + { + browserName: 'safari', + version: '9', + platform: 'OS X 10.11' + }, + { + browserName: 'safari', + version: '8', + platform: 'OS X 10.10' + }, + { + browserName: "internet explorer", + version: '8', + platform: 'Windows XP' + }, + { + browserName: "internet explorer", + version: '9', + platform: 'Windows 7' + }, + { + browserName: "internet explorer", + version: '11', + platform: 'Windows 8.1' + }, + { + browserName: "edge", + version: '13', + platform: 'Windows 10' + }, + // Mobile browsers + { + browserName: "ipad", + version: '8.0', + platform: 'OS X 10.9', + 'device-orientation': 'portrait' + }, + { + browserName: 'iphone', + version: '7.1', + platform: 'OS X 10.9' + }, + { + browserName: 'iphone', + version: '9.3', + platform: 'OS X 10.10' + }, + { + browerName: 'android', + version: '4.2', + platform: 'Linux' + } + ]; + + // var sauceJobs = {}; + + // [ "main", + // "filemanager-plugin", + // "visitor-plugin", + // "pre-processor-plugin", + // "post-processor-plugin", + // "global-vars", + // "modify-vars", + // "production", + // "rootpath-relative", + // "rootpath", + // "relative-urls", + // "browser", + // "no-js-errors", + // "legacy", + // "strict-units" + // ].map(function(testName) { + // sauceJobs[testName] = { + // options: { + // urls: ["http://localhost:8081/tmp/browser/test-runner-" + testName + ".html"], + // testname: 'Less.js test - ' + testName, + // browsers: browsers, + // public: 'public', + // recordVideo: false, + // videoUploadOnPass: false, + // recordScreenshots: process.env.TRAVIS_BRANCH !== "master", + // build: process.env.TRAVIS_BRANCH === "master" ? process.env.TRAVIS_JOB_ID : undefined, + // tags: [process.env.TRAVIS_BUILD_NUMBER, process.env.TRAVIS_PULL_REQUEST, process.env.TRAVIS_BRANCH], + // sauceConfig: { + // 'idle-timeout': 100 + // }, + // throttled: 5 + // } + // }; + // }); // Project configuration. grunt.initConfig({ @@ -278,89 +446,56 @@ module.exports = function (grunt) { 'saucelabs-jasmine': { all: { options: { - urls: ["filemanager-plugin","visitor-plugin","pre-processor-plugin","post-processor-plugin","global-vars", "modify-vars", "production", "rootpath-relative", + urls: ["main", "filemanager-plugin","visitor-plugin","pre-processor-plugin","post-processor-plugin","global-vars", "modify-vars", "production", "rootpath-relative", "rootpath", "relative-urls", "browser", "no-js-errors", "legacy", "strict-units" ].map(function(testName) { return "http://localhost:8081/tmp/browser/test-runner-" + testName + ".html"; }), testname: 'Sauce Unit Test for less.js', - browsers: [ - // Desktop browsers - { - browserName: "chrome", - version: 'latest', - platform: 'Windows 7' - }, - { - browserName: "firefox", - version: 'latest', - platform: 'Linux' - }, - { - browserName: 'safari', - version: '9.1', - platform: 'OS X 10.10' - }, - { - browserName: 'safari', - version: '8', - platform: 'OS X 10.10' - }, - { - browserName: "internet explorer", - version: '8', - platform: 'Windows XP' - }, - { - browserName: "internet explorer", - version: '9', - platform: 'Windows 7' - }, - { - browserName: "internet explorer", - version: '11', - platform: 'Windows 8.1' - }, - { - browserName: "edge", - version: '13', - platform: 'Windows 10' - }, - // Mobile browsers - { - browserName: "ipad", - version: '8.0', - platform: 'OS X 10.9', - 'device-orientation': 'portrait' - }, - { - browserName: 'iphone', - version: '7.1', - platform: 'OS X 10.9' - }, - { - browserName: 'iphone', - version: '9.3', - platform: 'OS X 10.10' - }, - { - browerName: 'android', - version: '4.2', - platform: 'Linux' - } - ], + browsers: browsers, public: 'public', - concurrency: 3, + pollInterval: 2000, + statusCheckAttempts: 30, recordVideo: false, videoUploadOnPass: false, recordScreenshots: process.env.TRAVIS_BRANCH !== "master", build: process.env.TRAVIS_BRANCH === "master" ? process.env.TRAVIS_JOB_ID : undefined, tags: [process.env.TRAVIS_BUILD_NUMBER, process.env.TRAVIS_PULL_REQUEST, process.env.TRAVIS_BRANCH], - 'max-duration': 120, sauceConfig: { 'idle-timeout': 100 }, - throttled: 3 + throttled: 5, + onTestComplete: function(result, callback) { + // Called after a unit test is done, per page, per browser + // 'result' param is the object returned by the test framework's reporter + // 'callback' is a Node.js style callback function. You must invoke it after you + // finish your work. + // Pass a non-null value as the callback's first parameter if you want to throw an + // exception. If your function is synchronous you can also throw exceptions + // directly. + // Passing true or false as the callback's second parameter passes or fails the + // test. Passing undefined does not alter the test result. Please note that this + // only affects the grunt task's result. You have to explicitly update the Sauce + // Labs job's status via its REST API, if you want so. + + // This should be the encrypted value in Travis + var user = process.env.SAUCE_USERNAME; + var pass = process.env.SAUCE_ACCESS_KEY; + + require('request').put({ + url: ['https://saucelabs.com/rest/v1', user, 'jobs', result.job_id].join('/'), + auth: { user: user, pass: pass }, + json: { passed: result.passed } + }, function (error, response, body) { + if (error) { + callback(error); + } else if (response.statusCode !== 200) { + callback(new Error('Unexpected response status')); + } else { + callback(null, result.passed); + } + }); + } } } }, diff --git a/package.json b/package.json index f7a706f98..420edac86 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,8 @@ "jit-grunt": "^0.10.0", "performance-now": "^0.2.0", "phantomjs-prebuilt": "^2.1.7", + "promise": "^7.1.1", + "request": "^2.73.0", "time-grunt": "^1.3.0" }, "keywords": [ diff --git a/test/browser/common.js b/test/browser/common.js index 58ef50607..6c9300dc0 100644 --- a/test/browser/common.js +++ b/test/browser/common.js @@ -3,6 +3,41 @@ jasmine.getEnv().addReporter(new jasmine.JSReporter2()); jasmine.getEnv().defaultTimeoutInterval = 3000; +// From https://github.com/axemclion/grunt-saucelabs/issues/109#issuecomment-166767282 +// (function () { +// var oldJSReport = window.jasmine.getJSReport; +// window.jasmine.getJSReport = function () { +// var results = oldJSReport(); +// if (results) { +// return { +// durationSec: results.durationSec, +// suites: removePassingTests(results.suites), +// passed: results.passed +// }; +// } else { +// return null; +// } +// }; + +// function removePassingTests (suites) { +// return suites.filter(specFailed) +// .map(mapSuite); +// } + +// function mapSuite (suite) { +// var result = {}; +// for (var s in suite) { +// result[s] = suite[s]; +// } +// result.specs = suite.specs.filter(specFailed); +// result.suites = removePassingTests(suite.suites); +// return result; +// } + +// function specFailed (item) { +// return !item.passed; +// } +// })(); /* record log messages for testing */ var logMessages = []; @@ -45,15 +80,15 @@ less.loggers = [ } ]; -var testLessEqualsInDocument = function () { +testLessEqualsInDocument = function () { testLessInDocument(testSheet); }; -var testLessErrorsInDocument = function (isConsole) { +testLessErrorsInDocument = function (isConsole) { testLessInDocument(isConsole ? testErrorSheetConsole : testErrorSheet); }; -var testLessInDocument = function (testFunc) { +testLessInDocument = function (testFunc) { var links = document.getElementsByTagName('link'), typePattern = /^text\/(x-)?less$/; @@ -65,7 +100,7 @@ var testLessInDocument = function (testFunc) { } }; -var ieFormat = function(text) { +ieFormat = function(text) { var styleNode = document.createElement('style'); styleNode.setAttribute('type', 'text/css'); var headNode = document.getElementsByTagName('head')[0]; @@ -84,7 +119,7 @@ var ieFormat = function(text) { return transformedText; }; -var testSheet = function (sheet) { +testSheet = function (sheet) { it(sheet.id + " should match the expected output", function (done) { var lessOutputId = sheet.id.replace("original-", ""), expectedOutputId = "expected-" + lessOutputId, @@ -123,7 +158,7 @@ function extractId(href) { .replace(/\./g, ':'); // Replace dots with colons(for valid id) } -var waitFor = function (waitFunc) { +waitFor = function (waitFunc) { return new Promise(function (resolve) { var timeoutId = setInterval(function () { if (waitFunc()) { @@ -134,7 +169,7 @@ var waitFor = function (waitFunc) { }); }; -var testErrorSheet = function (sheet) { +testErrorSheet = function (sheet) { it(sheet.id + " should match an error", function (done) { var lessHref = sheet.href, id = "less-error-message:" + extractId(lessHref), @@ -183,7 +218,7 @@ var testErrorSheet = function (sheet) { }); }; -var testErrorSheetConsole = function (sheet) { +testErrorSheetConsole = function (sheet) { it(sheet.id + " should match an error", function (done) { var lessHref = sheet.href, id = sheet.id.replace(/^original-less:/, "less-error-message:"), @@ -212,7 +247,7 @@ var testErrorSheetConsole = function (sheet) { }); }; -var loadFile = function (href) { +loadFile = function (href) { return new Promise(function (resolve, reject) { var request = new XMLHttpRequest(); request.open('GET', href, true); diff --git a/test/browser/test-runner-template.tmpl b/test/browser/test-runner-template.tmpl index 9fef5680e..6ef3e46fc 100644 --- a/test/browser/test-runner-template.tmpl +++ b/test/browser/test-runner-template.tmpl @@ -3,30 +3,22 @@ Jasmine Spec Runner - + + + + <% var generateScriptTags = function(allScripts) { allScripts.forEach(function(script){ %> - + <% }); }; %> - - <% var toArray = function(scripts) { - %>[<% - scripts.forEach(function(scriptUrl, index){ - %>"<%= scriptUrl %>"<% - if (index !== scripts.length -1) { - %>,<% - } - }); - %>]<% - }; %> - <% scripts.src.forEach(function(fullLessName) { var pathParts = fullLessName.split('/'); var fullCssName = fullLessName.replace(/less/g, 'css'); var lessName = pathParts[pathParts.length - 1]; var name = lessName.split('.')[0]; %> - <% }); %> @@ -35,60 +27,24 @@ <% css.forEach(function(style){ %> <% }) %> - + + <% + var jasmine = [].concat(scripts.polyfills, scripts.jasmine, scripts.boot), + helpers = scripts.helpers, + vendor = scripts.vendor, + reporters = [].concat(scripts.reporters), + specs = scripts.specs, + allScripts = jasmine.concat(helpers).concat(vendor).concat(specs).concat(reporters); + + generateScriptTags(allScripts); + %> + From 3d9f8433d14d16fd4af563e665dee7df6a1824bd Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Sat, 16 Jul 2016 20:45:46 -0700 Subject: [PATCH 22/97] Remove Node / Browserify 'path' module dependency --- lib/less/environment/abstract-file-manager.js | 1 + lib/less/environment/abstract-plugin-loader.js | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/less/environment/abstract-file-manager.js b/lib/less/environment/abstract-file-manager.js index 7c0e2063c..4a3845369 100644 --- a/lib/less/environment/abstract-file-manager.js +++ b/lib/less/environment/abstract-file-manager.js @@ -116,6 +116,7 @@ abstractFileManager.prototype.extractUrlParts = function extractUrlParts(url, ba returner.hostPart = urlParts[1]; returner.directories = directories; returner.path = (urlParts[1] || "") + directories.join("/"); + returner.filename = urlParts[4]; returner.fileUrl = returner.path + (urlParts[4] || ""); returner.url = returner.fileUrl + (urlParts[5] || ""); return returner; diff --git a/lib/less/environment/abstract-plugin-loader.js b/lib/less/environment/abstract-plugin-loader.js index 5840eab92..fba27a1b9 100644 --- a/lib/less/environment/abstract-plugin-loader.js +++ b/lib/less/environment/abstract-plugin-loader.js @@ -32,11 +32,13 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOp filename = fileInfo.filename; } } + var shortname = (new this.less.FileManager()).extractUrlParts(filename).filename; + if (filename) { pluginObj = pluginManager.get(filename); if (pluginObj) { - this.trySetOptions(pluginObj, filename, pluginOptions); + this.trySetOptions(pluginObj, filename, shortname, pluginOptions); if (pluginObj.use) { pluginObj.use.call(this.context, pluginObj); } @@ -58,14 +60,14 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOp if (!pluginObj) { pluginObj = localModule.exports; } - pluginObj = this.validatePlugin(pluginObj, filename); + pluginObj = this.validatePlugin(pluginObj, filename, shortname); if (pluginObj) { // Run on first load pluginManager.addPlugin(pluginObj, fileInfo.filename, registry); pluginObj.functions = registry.getLocalFunctions(); - this.trySetOptions(pluginObj, filename, pluginOptions); + this.trySetOptions(pluginObj, filename, shortname, pluginOptions); // Run every @plugin call if (pluginObj.use) { @@ -91,8 +93,7 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOp }; -AbstractPluginLoader.prototype.trySetOptions = function(plugin, filename, options) { - var name = require('path').basename(filename); +AbstractPluginLoader.prototype.trySetOptions = function(plugin, filename, name, options) { if (options) { if (!plugin.setOptions) { error("Options have been provided but the plugin " + name + " does not support any options."); @@ -108,14 +109,14 @@ AbstractPluginLoader.prototype.trySetOptions = function(plugin, filename, option } }; -AbstractPluginLoader.prototype.validatePlugin = function(plugin, filename) { +AbstractPluginLoader.prototype.validatePlugin = function(plugin, filename, name) { if (plugin) { // support plugins being a function // so that the plugin can be more usable programmatically if (typeof plugin === "function") { plugin = new plugin(); } - var name = require('path').basename(filename); + if (plugin.minVersion) { if (this.compareVersion(plugin.minVersion, this.less.version) < 0) { error("Plugin " + name + " requires version " + this.versionToString(plugin.minVersion)); From fcb670d5b4f56f6c5eca69cb756f9df27adac7e9 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Sat, 16 Jul 2016 20:46:47 -0700 Subject: [PATCH 23/97] Remove IE8-specific shims --- lib/less-browser/bootstrap.js | 5 +++-- lib/less-browser/file-manager.js | 17 +---------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/lib/less-browser/bootstrap.js b/lib/less-browser/bootstrap.js index 8f196c13e..3d4a57a32 100644 --- a/lib/less-browser/bootstrap.js +++ b/lib/less-browser/bootstrap.js @@ -5,8 +5,9 @@ */ /*global window, document */ -// shim Promise if required -require('promise/polyfill.js'); + +// Polyfill needed for IE8 - add this to sites targeting IE8 +// var options = window.less || {}; require("./add-default-options")(window, options); diff --git a/lib/less-browser/file-manager.js b/lib/less-browser/file-manager.js index d9727a1f8..65c1b8e89 100644 --- a/lib/less-browser/file-manager.js +++ b/lib/less-browser/file-manager.js @@ -7,21 +7,6 @@ module.exports = function(options, logger) { var fileCache = {}; //TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load - - function getXMLHttpRequest() { - if (window.XMLHttpRequest && (window.location.protocol !== "file:" || !("ActiveXObject" in window))) { - return new XMLHttpRequest(); - } else { - try { - /*global ActiveXObject */ - return new ActiveXObject("Microsoft.XMLHTTP"); - } catch (e) { - logger.error("browser doesn't support AJAX."); - return null; - } - } - } - var FileManager = function() { }; @@ -38,7 +23,7 @@ module.exports = function(options, logger) { }; FileManager.prototype.doXHR = function doXHR(url, type, callback, errback) { - var xhr = getXMLHttpRequest(); + var xhr = new XMLHttpRequest(); var async = options.isFileProtocol ? options.fileAsync : true; if (typeof xhr.overrideMimeType === 'function') { From 83c9ea4f3f4f965d8c5ef596744fda2bfb5794e1 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Sat, 16 Jul 2016 20:55:52 -0700 Subject: [PATCH 24/97] Run Sauce Labs testing for master or 3.x branch --- Gruntfile.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 9ae71a686..88936c4d0 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -591,8 +591,8 @@ module.exports = function (grunt) { ]; if (isNaN(Number(process.env.TRAVIS_PULL_REQUEST, 10)) && - Number(process.env.TRAVIS_NODE_VERSION) === 0.11 && - (process.env.TRAVIS_BRANCH === "master" || process.env.TRAVIS_BRANCH === "sauce")) { + Number(process.env.TRAVIS_NODE_VERSION) === 4 && + (process.env.TRAVIS_BRANCH === "master" || process.env.TRAVIS_BRANCH === "3.x")) { testTasks.push("force:on"); testTasks.push("sauce-after-setup"); testTasks.push("force:off"); From c17b2f0e647495050d2f23a74183a630d272349a Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Sun, 17 Jul 2016 11:53:51 -0700 Subject: [PATCH 25/97] Restore promise shim / fix JSCS Gruntfile error --- Gruntfile.js | 67 +---------------------------------- lib/less-browser/bootstrap.js | 4 +-- 2 files changed, 3 insertions(+), 68 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 88936c4d0..25891c4c5 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -73,72 +73,7 @@ module.exports = function (grunt) { platform: 'Linux' } ]; - var browsers = [ - // Desktop browsers - { - browserName: "chrome", - version: 'latest', - platform: 'Windows 7' - }, - { - browserName: "firefox", - version: 'latest', - platform: 'Linux' - }, - { - browserName: 'safari', - version: '9', - platform: 'OS X 10.11' - }, - { - browserName: 'safari', - version: '8', - platform: 'OS X 10.10' - }, - { - browserName: "internet explorer", - version: '8', - platform: 'Windows XP' - }, - { - browserName: "internet explorer", - version: '9', - platform: 'Windows 7' - }, - { - browserName: "internet explorer", - version: '11', - platform: 'Windows 8.1' - }, - { - browserName: "edge", - version: '13', - platform: 'Windows 10' - }, - // Mobile browsers - { - browserName: "ipad", - version: '8.0', - platform: 'OS X 10.9', - 'device-orientation': 'portrait' - }, - { - browserName: 'iphone', - version: '7.1', - platform: 'OS X 10.9' - }, - { - browserName: 'iphone', - version: '9.3', - platform: 'OS X 10.10' - }, - { - browerName: 'android', - version: '4.2', - platform: 'Linux' - } - ]; - + // var sauceJobs = {}; // [ "main", diff --git a/lib/less-browser/bootstrap.js b/lib/less-browser/bootstrap.js index 3d4a57a32..72b02c162 100644 --- a/lib/less-browser/bootstrap.js +++ b/lib/less-browser/bootstrap.js @@ -5,9 +5,9 @@ */ /*global window, document */ - -// Polyfill needed for IE8 - add this to sites targeting IE8 +// TODO - consider switching this out for a recommendation for this polyfill: // +require("promise/polyfill"); var options = window.less || {}; require("./add-default-options")(window, options); From a38f8a1eb7beed589d2fa734fcf411cf4461d231 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Mon, 18 Jul 2016 14:28:32 -0700 Subject: [PATCH 26/97] Added property accessors - performance issue solved by re-tooling value parsing i.e. All values are anonymous strings until "queried" - Unlike original PR, no change in existing test output for un-referenced properties - unused variables would theoretically result in a tiny improvement in parsing time --- Gruntfile.js | 226 +++-- dist/less.js | 896 +++++++----------- dist/less.min.js | 12 +- lib/less/parser/parser.js | 100 +- lib/less/tree/index.js | 1 + lib/less/tree/node.js | 2 + lib/less/tree/property.js | 70 ++ lib/less/tree/quoted.js | 12 +- lib/less/tree/ruleset.js | 79 +- package.json | 4 +- test/css/compression/compression.css | 2 +- test/css/property-accessors.css | 49 + test/less/errors/color-invalid-hex-code.less | 1 + test/less/errors/color-invalid-hex-code.txt | 2 +- test/less/errors/color-invalid-hex-code2.less | 1 + test/less/errors/color-invalid-hex-code2.txt | 2 +- test/less/property-accessors.less | 66 ++ 17 files changed, 827 insertions(+), 698 deletions(-) create mode 100644 lib/less/tree/property.js create mode 100644 test/css/property-accessors.css create mode 100644 test/less/property-accessors.less diff --git a/Gruntfile.js b/Gruntfile.js index 25891c4c5..ca6bad83f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -74,42 +74,73 @@ module.exports = function (grunt) { } ]; - // var sauceJobs = {}; - - // [ "main", - // "filemanager-plugin", - // "visitor-plugin", - // "pre-processor-plugin", - // "post-processor-plugin", - // "global-vars", - // "modify-vars", - // "production", - // "rootpath-relative", - // "rootpath", - // "relative-urls", - // "browser", - // "no-js-errors", - // "legacy", - // "strict-units" - // ].map(function(testName) { - // sauceJobs[testName] = { - // options: { - // urls: ["http://localhost:8081/tmp/browser/test-runner-" + testName + ".html"], - // testname: 'Less.js test - ' + testName, - // browsers: browsers, - // public: 'public', - // recordVideo: false, - // videoUploadOnPass: false, - // recordScreenshots: process.env.TRAVIS_BRANCH !== "master", - // build: process.env.TRAVIS_BRANCH === "master" ? process.env.TRAVIS_JOB_ID : undefined, - // tags: [process.env.TRAVIS_BUILD_NUMBER, process.env.TRAVIS_PULL_REQUEST, process.env.TRAVIS_BRANCH], - // sauceConfig: { - // 'idle-timeout': 100 - // }, - // throttled: 5 - // } - // }; - // }); + var sauceJobs = {}; + + var browserTests = [ "filemanager-plugin", + "visitor-plugin", + "global-vars", + "modify-vars", + "production", + "rootpath-relative", + "rootpath", + "relative-urls", + "browser", + "no-js-errors", + "legacy" + ]; + + browserTests.map(function(testName) { + sauceJobs[testName] = { + options: { + urls: ["http://localhost:8081/tmp/browser/test-runner-" + testName + ".html"], + testname: 'Less.js test - ' + testName, + browsers: browsers, + public: 'public', + recordVideo: false, + videoUploadOnPass: false, + recordScreenshots: process.env.TRAVIS_BRANCH !== "master", + build: process.env.TRAVIS_BRANCH === "master" ? process.env.TRAVIS_JOB_ID : undefined, + tags: [process.env.TRAVIS_BUILD_NUMBER, process.env.TRAVIS_PULL_REQUEST, process.env.TRAVIS_BRANCH], + sauceConfig: { + 'idle-timeout': 100 + }, + throttled: 5, + onTestComplete: function(result, callback) { + // Called after a unit test is done, per page, per browser + // 'result' param is the object returned by the test framework's reporter + // 'callback' is a Node.js style callback function. You must invoke it after you + // finish your work. + // Pass a non-null value as the callback's first parameter if you want to throw an + // exception. If your function is synchronous you can also throw exceptions + // directly. + // Passing true or false as the callback's second parameter passes or fails the + // test. Passing undefined does not alter the test result. Please note that this + // only affects the grunt task's result. You have to explicitly update the Sauce + // Labs job's status via its REST API, if you want so. + + // This should be the encrypted value in Travis + var user = process.env.SAUCE_USERNAME; + var pass = process.env.SAUCE_ACCESS_KEY; + + require('request').put({ + url: ['https://saucelabs.com/rest/v1', user, 'jobs', result.job_id].join('/'), + auth: { user: user, pass: pass }, + json: { passed: result.passed } + }, function (error, response, body) { + if (error) { + console.log(error); + callback(error); + } else if (response.statusCode !== 200) { + console.log(response); + callback(new Error('Unexpected response status')); + } else { + callback(null, result.passed); + } + }); + } + } + }; + }); // Project configuration. grunt.initConfig({ @@ -378,62 +409,64 @@ module.exports = function (grunt) { } }, - 'saucelabs-jasmine': { - all: { - options: { - urls: ["main", "filemanager-plugin","visitor-plugin","pre-processor-plugin","post-processor-plugin","global-vars", "modify-vars", "production", "rootpath-relative", - "rootpath", "relative-urls", "browser", "no-js-errors", "legacy", "strict-units" - ].map(function(testName) { - return "http://localhost:8081/tmp/browser/test-runner-" + testName + ".html"; - }), - testname: 'Sauce Unit Test for less.js', - browsers: browsers, - public: 'public', - pollInterval: 2000, - statusCheckAttempts: 30, - recordVideo: false, - videoUploadOnPass: false, - recordScreenshots: process.env.TRAVIS_BRANCH !== "master", - build: process.env.TRAVIS_BRANCH === "master" ? process.env.TRAVIS_JOB_ID : undefined, - tags: [process.env.TRAVIS_BUILD_NUMBER, process.env.TRAVIS_PULL_REQUEST, process.env.TRAVIS_BRANCH], - sauceConfig: { - 'idle-timeout': 100 - }, - throttled: 5, - onTestComplete: function(result, callback) { - // Called after a unit test is done, per page, per browser - // 'result' param is the object returned by the test framework's reporter - // 'callback' is a Node.js style callback function. You must invoke it after you - // finish your work. - // Pass a non-null value as the callback's first parameter if you want to throw an - // exception. If your function is synchronous you can also throw exceptions - // directly. - // Passing true or false as the callback's second parameter passes or fails the - // test. Passing undefined does not alter the test result. Please note that this - // only affects the grunt task's result. You have to explicitly update the Sauce - // Labs job's status via its REST API, if you want so. + 'saucelabs-jasmine': sauceJobs, + + // { + // all: { + // options: { + // urls: ["filemanager-plugin","visitor-plugin","pre-processor-plugin","post-processor-plugin","global-vars", "modify-vars", "production", "rootpath-relative", + // "rootpath", "relative-urls", "browser", "no-js-errors", "legacy", "strict-units" + // ].map(function(testName) { + // return "http://localhost:8081/tmp/browser/test-runner-" + testName + ".html"; + // }), + // testname: 'Sauce Unit Test for less.js', + // browsers: browsers, + // public: 'public', + // pollInterval: 2000, + // statusCheckAttempts: 30, + // recordVideo: false, + // videoUploadOnPass: false, + // recordScreenshots: process.env.TRAVIS_BRANCH !== "master", + // build: process.env.TRAVIS_BRANCH === "master" ? process.env.TRAVIS_JOB_ID : undefined, + // tags: [process.env.TRAVIS_BUILD_NUMBER, process.env.TRAVIS_PULL_REQUEST, process.env.TRAVIS_BRANCH], + // sauceConfig: { + // 'idle-timeout': 100 + // }, + // throttled: 5, + // onTestComplete: function(result, callback) { + // // Called after a unit test is done, per page, per browser + // // 'result' param is the object returned by the test framework's reporter + // // 'callback' is a Node.js style callback function. You must invoke it after you + // // finish your work. + // // Pass a non-null value as the callback's first parameter if you want to throw an + // // exception. If your function is synchronous you can also throw exceptions + // // directly. + // // Passing true or false as the callback's second parameter passes or fails the + // // test. Passing undefined does not alter the test result. Please note that this + // // only affects the grunt task's result. You have to explicitly update the Sauce + // // Labs job's status via its REST API, if you want so. - // This should be the encrypted value in Travis - var user = process.env.SAUCE_USERNAME; - var pass = process.env.SAUCE_ACCESS_KEY; - - require('request').put({ - url: ['https://saucelabs.com/rest/v1', user, 'jobs', result.job_id].join('/'), - auth: { user: user, pass: pass }, - json: { passed: result.passed } - }, function (error, response, body) { - if (error) { - callback(error); - } else if (response.statusCode !== 200) { - callback(new Error('Unexpected response status')); - } else { - callback(null, result.passed); - } - }); - } - } - } - }, + // // This should be the encrypted value in Travis + // var user = process.env.SAUCE_USERNAME; + // var pass = process.env.SAUCE_ACCESS_KEY; + + // require('request').put({ + // url: ['https://saucelabs.com/rest/v1', user, 'jobs', result.job_id].join('/'), + // auth: { user: user, pass: pass }, + // json: { passed: result.passed } + // }, function (error, response, body) { + // if (error) { + // callback(error); + // } else if (response.statusCode !== 200) { + // callback(new Error('Unexpected response status')); + // } else { + // callback(null, result.passed); + // } + // }); + // } + // } + // } + // }, // Clean the version of less built for the tests clean: { @@ -511,11 +544,12 @@ module.exports = function (grunt) { 'sauce-after-setup' ]); - // setup a web server to run the browser tests in a browser rather than phantom - grunt.registerTask('sauce-after-setup', [ - 'saucelabs-jasmine', - 'clean:sauce_log' - ]); + var sauceTests = []; + browserTests.map(function(testName) { + sauceTests.push('saucelabs-jasmine:' + testName); + }); + sauceTests.push('clean:sauce_log'); + grunt.registerTask('sauce-after-setup', sauceTests); var testTasks = [ 'clean', diff --git a/dist/less.js b/dist/less.js index ee30b3a5b..4661e90fc 100644 --- a/dist/less.js +++ b/dist/less.js @@ -1,5 +1,5 @@ /*! - * Less - Leaner CSS v3.0.0-pre.2 + * Less - Leaner CSS v3.0.0-pre.3 * http://lesscss.org * * Copyright (c) 2009-2016, Alexis Sellier @@ -68,8 +68,9 @@ module.exports = function(window, options) { */ /*global window, document */ -// shim Promise if required -require('promise/polyfill.js'); +// TODO - consider switching this out for a recommendation for this polyfill: +// +require("promise/polyfill"); var options = window.less || {}; require("./add-default-options")(window, options); @@ -113,7 +114,7 @@ if (options.onReady) { less.pageLoadFinished = less.refresh(less.env === 'development').then(resolveOrReject, resolveOrReject); } -},{"./add-default-options":1,"./index":8,"promise/polyfill.js":102}],3:[function(require,module,exports){ +},{"./add-default-options":1,"./index":8,"promise/polyfill":101}],3:[function(require,module,exports){ var utils = require("./utils"); module.exports = { createCSS: function (document, styles, sheet) { @@ -405,21 +406,6 @@ module.exports = function(options, logger) { var fileCache = {}; //TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load - - function getXMLHttpRequest() { - if (window.XMLHttpRequest && (window.location.protocol !== "file:" || !("ActiveXObject" in window))) { - return new XMLHttpRequest(); - } else { - try { - /*global ActiveXObject */ - return new ActiveXObject("Microsoft.XMLHTTP"); - } catch (e) { - logger.error("browser doesn't support AJAX."); - return null; - } - } - } - var FileManager = function() { }; @@ -436,7 +422,7 @@ module.exports = function(options, logger) { }; FileManager.prototype.doXHR = function doXHR(url, type, callback, errback) { - var xhr = getXMLHttpRequest(); + var xhr = new XMLHttpRequest(); var async = options.isFileProtocol ? options.fileAsync : true; if (typeof xhr.overrideMimeType === 'function') { @@ -1372,6 +1358,7 @@ abstractFileManager.prototype.extractUrlParts = function extractUrlParts(url, ba returner.hostPart = urlParts[1]; returner.directories = directories; returner.path = (urlParts[1] || "") + directories.join("/"); + returner.filename = urlParts[4]; returner.fileUrl = returner.path + (urlParts[4] || ""); returner.url = returner.fileUrl + (urlParts[5] || ""); return returner; @@ -1414,13 +1401,15 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOp filename = fileInfo.filename; } } + var shortname = (new this.less.FileManager()).extractUrlParts(filename).filename; + if (filename) { pluginObj = pluginManager.get(filename); if (pluginObj) { - this.trySetOptions(pluginObj, filename, pluginOptions); + this.trySetOptions(pluginObj, filename, shortname, pluginOptions); if (pluginObj.use) { - pluginObj.use(this.less); + pluginObj.use.call(this.context, pluginObj); } return pluginObj; } @@ -1440,28 +1429,27 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOp if (!pluginObj) { pluginObj = localModule.exports; } - - pluginObj = this.validatePlugin(pluginObj, filename); + pluginObj = this.validatePlugin(pluginObj, filename, shortname); if (pluginObj) { // Run on first load - pluginManager.addPlugin(pluginObj, fileInfo.filename); + pluginManager.addPlugin(pluginObj, fileInfo.filename, registry); pluginObj.functions = registry.getLocalFunctions(); - this.trySetOptions(pluginObj, filename, pluginOptions); + this.trySetOptions(pluginObj, filename, shortname, pluginOptions); // Run every @plugin call if (pluginObj.use) { - pluginObj.use(this.less); + pluginObj.use.call(this.context, pluginObj); } } else { - throw new SyntaxError("Not a valid plugin"); + return new this.less.LessError({ message: "Not a valid plugin" }); } } catch(e) { // TODO pass the error - console.log(e); + console.log(e.stack); return new this.less.LessError({ message: "Plugin evaluation error: '" + e.name + ': ' + e.message.replace(/["]/g, "'") + "'" , filename: filename, @@ -1474,8 +1462,7 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOp }; -AbstractPluginLoader.prototype.trySetOptions = function(plugin, filename, options) { - var name = require('path').basename(filename); +AbstractPluginLoader.prototype.trySetOptions = function(plugin, filename, name, options) { if (options) { if (!plugin.setOptions) { error("Options have been provided but the plugin " + name + " does not support any options."); @@ -1491,14 +1478,14 @@ AbstractPluginLoader.prototype.trySetOptions = function(plugin, filename, option } }; -AbstractPluginLoader.prototype.validatePlugin = function(plugin, filename) { +AbstractPluginLoader.prototype.validatePlugin = function(plugin, filename, name) { if (plugin) { // support plugins being a function // so that the plugin can be more usable programmatically if (typeof plugin === "function") { plugin = new plugin(); } - var name = require('path').basename(filename); + if (plugin.minVersion) { if (this.compareVersion(plugin.minVersion, this.less.version) < 0) { error("Plugin " + name + " requires version " + this.versionToString(plugin.minVersion)); @@ -1541,7 +1528,7 @@ AbstractPluginLoader.prototype.printUsage = function(plugins) { module.exports = AbstractPluginLoader; -},{"../functions/function-registry":24,"../less-error":34,"path":97}],18:[function(require,module,exports){ +},{"../functions/function-registry":24,"../less-error":34}],18:[function(require,module,exports){ var logger = require("../logger"); var environment = function(externalEnvironment, fileManagers) { this.fileManagers = fileManagers || []; @@ -2002,7 +1989,7 @@ colorFunctions = { }; functionRegistry.addMultiple(colorFunctions); -},{"../tree/anonymous":47,"../tree/color":52,"../tree/dimension":59,"../tree/quoted":76,"./function-registry":24}],21:[function(require,module,exports){ +},{"../tree/anonymous":47,"../tree/color":52,"../tree/dimension":59,"../tree/quoted":77,"./function-registry":24}],21:[function(require,module,exports){ module.exports = function(environment) { var Quoted = require("../tree/quoted"), URL = require("../tree/url"), @@ -2089,7 +2076,7 @@ module.exports = function(environment) { }); }; -},{"../logger":35,"../tree/quoted":76,"../tree/url":83,"./function-registry":24}],22:[function(require,module,exports){ +},{"../logger":35,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],22:[function(require,module,exports){ var Keyword = require("../tree/keyword"), functionRegistry = require("./function-registry"); @@ -2393,7 +2380,7 @@ functionRegistry.addMultiple({ } }); -},{"../tree/anonymous":47,"../tree/javascript":66,"../tree/quoted":76,"./function-registry":24}],30:[function(require,module,exports){ +},{"../tree/anonymous":47,"../tree/javascript":66,"../tree/quoted":77,"./function-registry":24}],30:[function(require,module,exports){ module.exports = function(environment) { var Dimension = require("../tree/dimension"), Color = require("../tree/color"), @@ -2483,7 +2470,7 @@ module.exports = function(environment) { }); }; -},{"../tree/color":52,"../tree/dimension":59,"../tree/expression":62,"../tree/quoted":76,"../tree/url":83,"./function-registry":24}],31:[function(require,module,exports){ +},{"../tree/color":52,"../tree/dimension":59,"../tree/expression":62,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],31:[function(require,module,exports){ var Keyword = require("../tree/keyword"), DetachedRuleset = require("../tree/detached-ruleset"), Dimension = require("../tree/dimension"), @@ -2574,7 +2561,7 @@ functionRegistry.addMultiple({ } }); -},{"../tree/anonymous":47,"../tree/color":52,"../tree/detached-ruleset":58,"../tree/dimension":59,"../tree/keyword":68,"../tree/operation":74,"../tree/quoted":76,"../tree/url":83,"./function-registry":24}],32:[function(require,module,exports){ +},{"../tree/anonymous":47,"../tree/color":52,"../tree/detached-ruleset":58,"../tree/dimension":59,"../tree/keyword":68,"../tree/operation":74,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],32:[function(require,module,exports){ var contexts = require("./contexts"), Parser = require('./parser/parser'), LessError = require('./less-error'); @@ -2758,7 +2745,7 @@ module.exports = function(environment, fileManagers) { return less; }; -},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":16,"./environment/abstract-plugin-loader":17,"./environment/environment":18,"./functions":25,"./import-manager":32,"./less-error":34,"./logger":35,"./parse":37,"./parse-tree":36,"./parser/parser":40,"./plugin-manager":41,"./render":42,"./source-map-builder":43,"./source-map-output":44,"./transform-tree":45,"./tree":65,"./utils":86,"./visitors":90}],34:[function(require,module,exports){ +},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":16,"./environment/abstract-plugin-loader":17,"./environment/environment":18,"./functions":25,"./import-manager":32,"./less-error":34,"./logger":35,"./parse":37,"./parse-tree":36,"./parser/parser":40,"./plugin-manager":41,"./render":42,"./source-map-builder":43,"./source-map-output":44,"./transform-tree":45,"./tree":65,"./utils":87,"./visitors":91}],34:[function(require,module,exports){ var utils = require("./utils"); var LessError = module.exports = function LessError(e, importManager, currentFilename) { @@ -2802,7 +2789,7 @@ if (typeof Object.create === 'undefined') { LessError.prototype.constructor = LessError; -},{"./utils":86}],35:[function(require,module,exports){ +},{"./utils":87}],35:[function(require,module,exports){ module.exports = { error: function(msg) { this._fireEvent("error", msg); @@ -2959,20 +2946,17 @@ module.exports = function(environment, ParseTree, ImportManager) { } var imports = new ImportManager(this, context, rootFileInfo); - + this.importManager = imports; + if (options.plugins) { options.plugins.forEach(function(plugin) { var evalResult, contents; if (plugin.fileContent) { contents = plugin.fileContent.replace(/^\uFEFF/, ''); evalResult = pluginManager.Loader.evalPlugin(contents, context, plugin.options, plugin.filename); - if (!(evalResult instanceof LessError)) { - pluginManager.addPlugin(plugin); - } - else { + if (evalResult instanceof LessError) { return callback(evalResult); } - } else { pluginManager.addPlugin(plugin); @@ -3452,7 +3436,9 @@ var Parser = function Parser(context, imports, fileInfo) { // The Parser // return { - + parserInput: parserInput, + imports: imports, + fileInfo: fileInfo, // // Parse an input string into an abstract syntax tree, // @param str A string containing 'less' markup @@ -3498,9 +3484,12 @@ var Parser = function Parser(context, imports, fileInfo) { }, imports); }); + tree.Node.prototype.parse = this; + root = new(tree.Ruleset)(null, this.parsers.primary()); root.root = true; root.firstRoot = true; + } catch (e) { return callback(new LessError(e, imports, fileInfo.filename)); } @@ -3835,15 +3824,17 @@ var Parser = function Parser(context, imports, fileInfo) { return; } - value = this.quoted() || this.variable() || + value = this.quoted() || this.variable() || this.property() || parserInput.$re(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/) || ""; parserInput.autoCommentAbsorb = true; expectChar(')'); - return new(tree.URL)((value.value != null || value instanceof tree.Variable) ? - value : new(tree.Anonymous)(value), index, fileInfo); + return new(tree.URL)((value.value != null || + value instanceof tree.Variable || + value instanceof tree.Property) ? + value : new(tree.Anonymous)(value, index), index, fileInfo); }, // @@ -3870,7 +3861,27 @@ var Parser = function Parser(context, imports, fileInfo) { return new(tree.Variable)("@" + curly[1], index, fileInfo); } }, + // + // A Property accessor, such as `$color`, in + // + // background-color: $color + // + property: function () { + var name, index = parserInput.i; + + if (parserInput.currentChar() === '$' && (name = parserInput.$re(/^\$[\w-]+/))) { + return new(tree.Property)(name, index, fileInfo); + } + }, + // A property entity useing the protective {} e.g. @{prop} + propertyCurly: function () { + var curly, index = parserInput.i; + + if (parserInput.currentChar() === '$' && (curly = parserInput.$re(/^\$\{([\w-]+)\}/))) { + return new(tree.Property)("$" + curly[1], index, fileInfo); + } + }, // // A Hexadecimal color // @@ -4124,7 +4135,7 @@ var Parser = function Parser(context, imports, fileInfo) { .push({ variadic: true }); break; } - arg = entities.variable() || entities.literal() || entities.keyword(); + arg = entities.variable() || entities.property() || entities.literal() || entities.keyword(); } if (!arg) { @@ -4147,7 +4158,7 @@ var Parser = function Parser(context, imports, fileInfo) { val = arg; } - if (val && val instanceof tree.Variable) { + if (val && (val instanceof tree.Variable || val instanceof tree.Property)) { if (parserInput.$char(':')) { if (expressions.length > 0) { if (isSemiColonSeparated) { @@ -4293,7 +4304,7 @@ var Parser = function Parser(context, imports, fileInfo) { var entities = this.entities; return this.comment() || entities.literal() || entities.variable() || entities.url() || - entities.call() || entities.keyword() || entities.javascript(); + entities.property() || entities.call() || entities.keyword() || entities.javascript(); }, // @@ -4537,7 +4548,7 @@ var Parser = function Parser(context, imports, fileInfo) { parserInput.restore(); } }, - declaration: function (tryAnonymous) { + declaration: function () { var name, value, startOfRule = parserInput.i, c = parserInput.currentChar(), important, merge, isVariable; if (c === '.' || c === '#' || c === '&' || c === ':') { return; } @@ -4559,22 +4570,16 @@ var Parser = function Parser(context, imports, fileInfo) { // where each item is a tree.Keyword or tree.Variable merge = !isVariable && name.length > 1 && name.pop().value; - // prefer to try to parse first if its a variable or we are compressing - // but always fallback on the other one - var tryValueFirst = !tryAnonymous && (context.compress || isVariable); - - if (tryValueFirst) { - value = this.value(); + // Try to store values as anonymous + // If we need the value later we'll re-parse it in ruleset.parseValue + value = this.anonymousValue(); + if (value) { + parserInput.forget(); + // anonymous values absorb the end ';' which is required for them to work + return new (tree.Declaration)(name, value, false, merge, startOfRule, fileInfo); } + if (!value) { - value = this.anonymousValue(); - if (value) { - parserInput.forget(); - // anonymous values absorb the end ';' which is required for them to work - return new (tree.Declaration)(name, value, false, merge, startOfRule, fileInfo); - } - } - if (!tryValueFirst && !value) { value = this.value(); } @@ -4584,20 +4589,19 @@ var Parser = function Parser(context, imports, fileInfo) { if (value && this.end()) { parserInput.forget(); return new (tree.Declaration)(name, value, important, merge, startOfRule, fileInfo); - } else { + } + else { parserInput.restore(); - if (value && !tryAnonymous) { - return this.declaration(true); - } } } else { - parserInput.forget(); + parserInput.restore(); } }, anonymousValue: function () { - var match = parserInput.$re(/^([^@+\/'"*`(;{}-]*);/); + var index = parserInput.i; + var match = parserInput.$re(/^([^@\$+\/'"*`(;{}-]*);/); if (match) { - return new(tree.Anonymous)(match[1]); + return new(tree.Anonymous)(match[1], index); } }, @@ -4902,7 +4906,7 @@ var Parser = function Parser(context, imports, fileInfo) { // and before the `;`. // value: function () { - var e, expressions = []; + var e, expressions = [], index = parserInput.i; do { e = this.expression(); @@ -4913,7 +4917,7 @@ var Parser = function Parser(context, imports, fileInfo) { } while (e); if (expressions.length > 0) { - return new(tree.Value)(expressions); + return new(tree.Value)(expressions, index); } }, important: function () { @@ -5152,13 +5156,14 @@ var Parser = function Parser(context, imports, fileInfo) { operand: function () { var entities = this.entities, negate; - if (parserInput.peek(/^-[@\(]/)) { + if (parserInput.peek(/^-[@\$\(]/)) { negate = parserInput.$char('-'); } var o = this.sub() || entities.dimension() || entities.color() || entities.variable() || - entities.call() || entities.colorKeyword(); + entities.property() || entities.call() || + entities.colorKeyword(); if (negate) { o.parensInOp = true; @@ -5176,7 +5181,7 @@ var Parser = function Parser(context, imports, fileInfo) { // @var * 2 // expression: function () { - var entities = [], e, delim; + var entities = [], e, delim, index = parserInput.i; do { e = this.comment(); @@ -5191,7 +5196,7 @@ var Parser = function Parser(context, imports, fileInfo) { if (!parserInput.peek(/^\/[\/*]/)) { delim = parserInput.$char('/'); if (delim) { - entities.push(new(tree.Anonymous)(delim)); + entities.push(new(tree.Anonymous)(delim, index)); } } } @@ -5229,7 +5234,7 @@ var Parser = function Parser(context, imports, fileInfo) { match(/^(\*?)/); while (true) { - if (!match(/^((?:[\w-]+)|(?:@\{[\w-]+\}))/)) { + if (!match(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/)) { break; } } @@ -5245,10 +5250,11 @@ var Parser = function Parser(context, imports, fileInfo) { } for (k = 0; k < name.length; k++) { s = name[k]; - name[k] = (s.charAt(0) !== '@') ? + name[k] = (s.charAt(0) !== '@' && s.charAt(0) !== '$') ? new(tree.Keyword)(s) : - new(tree.Variable)('@' + s.slice(2, -1), - index[k], fileInfo); + (s.charAt(0) === '@' ? + new(tree.Variable)('@' + s.slice(2, -1), index[k], fileInfo) : + new(tree.Property)('$' + s.slice(2, -1), index[k], fileInfo)); } return name; } @@ -5273,7 +5279,7 @@ Parser.serializeVars = function(vars) { module.exports = Parser; -},{"../less-error":34,"../tree":65,"../utils":86,"../visitors":90,"./parser-input":39}],41:[function(require,module,exports){ +},{"../less-error":34,"../tree":65,"../utils":87,"../visitors":91,"./parser-input":39}],41:[function(require,module,exports){ /** * Plugin Manager */ @@ -5312,13 +5318,13 @@ PluginManager.prototype.addPlugins = function(plugins) { * @param plugin * @param {String} filename */ -PluginManager.prototype.addPlugin = function(plugin, filename) { +PluginManager.prototype.addPlugin = function(plugin, filename, functionRegistry) { this.installedPlugins.push(plugin); if (filename) { this.pluginCache[filename] = plugin; } if (plugin.install) { - plugin.install(this.less, this); + plugin.install(this.less, this, functionRegistry || this.less.functions.functionRegistry); } }; /** @@ -5784,7 +5790,7 @@ module.exports = function(root, options) { return evaldRoot; }; -},{"./contexts":12,"./tree":65,"./visitors":90}],46:[function(require,module,exports){ +},{"./contexts":12,"./tree":65,"./visitors":91}],46:[function(require,module,exports){ var Node = require("./node"); var Alpha = function (val) { @@ -5838,7 +5844,10 @@ Anonymous.prototype.isRulesetLike = function() { return this.rulesetLike; }; Anonymous.prototype.genCSS = function (context, output) { - output.add(this.value, this._fileInfo, this._index, this.mapLines); + this.nodeVisible = Boolean(this.value); + if (this.nodeVisible) { + output.add(this.value, this._fileInfo, this._index, this.mapLines); + } }; module.exports = Anonymous; @@ -6008,7 +6017,7 @@ AtRule.prototype.outputRuleset = function (context, output, rules) { }; module.exports = AtRule; -},{"./node":73,"./ruleset":79,"./selector":80}],50:[function(require,module,exports){ +},{"./node":73,"./ruleset":80,"./selector":81}],50:[function(require,module,exports){ var Node = require("./node"); var Attribute = function (key, op, value) { @@ -6039,6 +6048,7 @@ module.exports = Attribute; },{"./node":73}],51:[function(require,module,exports){ var Node = require("./node"), + Anonymous = require("./anonymous"), FunctionCaller = require("../functions/function-caller"); // // A function call node. @@ -6086,11 +6096,17 @@ Call.prototype.eval = function (context) { }; } - if (result != null) { + if (result !== null && result !== undefined) { + // All returned results must be Nodes, + // so anything other than a Node is a null Node + if (!(result instanceof Node)) { + result = new Anonymous(null); + } result._index = this._index; result._fileInfo = this._fileInfo; return result; } + } return new Call(this.name, args, this.getIndex(), this.fileInfo()); @@ -6109,7 +6125,7 @@ Call.prototype.genCSS = function (context, output) { }; module.exports = Call; -},{"../functions/function-caller":23,"./node":73}],52:[function(require,module,exports){ +},{"../functions/function-caller":23,"./anonymous":47,"./node":73}],52:[function(require,module,exports){ var Node = require("./node"), colors = require("../data/colors"); @@ -6527,7 +6543,7 @@ Declaration.prototype.makeImportant = function () { }; module.exports = Declaration; -},{"./keyword":68,"./node":73,"./value":84}],58:[function(require,module,exports){ +},{"./keyword":68,"./node":73,"./value":85}],58:[function(require,module,exports){ var Node = require("./node"), contexts = require("../contexts"), utils = require("../utils"); @@ -6552,7 +6568,7 @@ DetachedRuleset.prototype.callEval = function (context) { }; module.exports = DetachedRuleset; -},{"../contexts":12,"../utils":86,"./node":73}],59:[function(require,module,exports){ +},{"../contexts":12,"../utils":87,"./node":73}],59:[function(require,module,exports){ var Node = require("./node"), unitConversions = require("../data/unit-conversions"), Unit = require("./unit"), @@ -6712,7 +6728,7 @@ Dimension.prototype.convertTo = function (conversions) { }; module.exports = Dimension; -},{"../data/unit-conversions":15,"./color":52,"./node":73,"./unit":82}],60:[function(require,module,exports){ +},{"../data/unit-conversions":15,"./color":52,"./node":73,"./unit":83}],60:[function(require,module,exports){ // Backwards compatibility shim for Directive (AtRule) var AtRule = require("./atrule"); @@ -6906,7 +6922,7 @@ Extend.prototype.findSelfSelectors = function (selectors) { }; module.exports = Extend; -},{"./node":73,"./selector":80}],64:[function(require,module,exports){ +},{"./node":73,"./selector":81}],64:[function(require,module,exports){ var Node = require("./node"), Media = require("./media"), URL = require("./url"), @@ -7046,6 +7062,7 @@ Import.prototype.doEval = function (context) { if ( registry && this.root && this.root.functions ) { registry.addMultiple( this.root.functions ); } + return []; } @@ -7080,7 +7097,7 @@ Import.prototype.doEval = function (context) { }; module.exports = Import; -},{"../utils":86,"./anonymous":47,"./media":69,"./node":73,"./quoted":76,"./ruleset":79,"./url":83}],65:[function(require,module,exports){ +},{"../utils":87,"./anonymous":47,"./media":69,"./node":73,"./quoted":77,"./ruleset":80,"./url":84}],65:[function(require,module,exports){ var tree = {}; tree.Node = require('./node'); @@ -7095,6 +7112,7 @@ tree.Dimension = require('./dimension'); tree.Unit = require('./unit'); tree.Keyword = require('./keyword'); tree.Variable = require('./variable'); +tree.Property = require('./property'); tree.Ruleset = require('./ruleset'); tree.Element = require('./element'); tree.Attribute = require('./attribute'); @@ -7127,7 +7145,7 @@ tree.RulesetCall = require('./ruleset-call'); module.exports = tree; -},{"./alpha":46,"./anonymous":47,"./assignment":48,"./atrule":49,"./attribute":50,"./call":51,"./color":52,"./combinator":53,"./comment":54,"./condition":55,"./declaration":57,"./detached-ruleset":58,"./dimension":59,"./directive":60,"./element":61,"./expression":62,"./extend":63,"./import":64,"./javascript":66,"./keyword":68,"./media":69,"./mixin-call":70,"./mixin-definition":71,"./negative":72,"./node":73,"./operation":74,"./paren":75,"./quoted":76,"./rule":77,"./ruleset":79,"./ruleset-call":78,"./selector":80,"./unicode-descriptor":81,"./unit":82,"./url":83,"./value":84,"./variable":85}],66:[function(require,module,exports){ +},{"./alpha":46,"./anonymous":47,"./assignment":48,"./atrule":49,"./attribute":50,"./call":51,"./color":52,"./combinator":53,"./comment":54,"./condition":55,"./declaration":57,"./detached-ruleset":58,"./dimension":59,"./directive":60,"./element":61,"./expression":62,"./extend":63,"./import":64,"./javascript":66,"./keyword":68,"./media":69,"./mixin-call":70,"./mixin-definition":71,"./negative":72,"./node":73,"./operation":74,"./paren":75,"./property":76,"./quoted":77,"./rule":78,"./ruleset":80,"./ruleset-call":79,"./selector":81,"./unicode-descriptor":82,"./unit":83,"./url":84,"./value":85,"./variable":86}],66:[function(require,module,exports){ var JsEvalNode = require("./js-eval-node"), Dimension = require("./dimension"), Quoted = require("./quoted"), @@ -7157,7 +7175,7 @@ JavaScript.prototype.eval = function(context) { module.exports = JavaScript; -},{"./anonymous":47,"./dimension":59,"./js-eval-node":67,"./quoted":76}],67:[function(require,module,exports){ +},{"./anonymous":47,"./dimension":59,"./js-eval-node":67,"./quoted":77}],67:[function(require,module,exports){ var Node = require("./node"), Variable = require("./variable"); @@ -7220,7 +7238,7 @@ JsEvalNode.prototype.jsify = function (obj) { module.exports = JsEvalNode; -},{"./node":73,"./variable":85}],68:[function(require,module,exports){ +},{"./node":73,"./variable":86}],68:[function(require,module,exports){ var Node = require("./node"); var Keyword = function (value) { this.value = value; }; @@ -7262,7 +7280,7 @@ var Media = function (value, features, index, currentFileInfo, visibilityInfo) { }; Media.prototype = new AtRule(); Media.prototype.type = "Media"; -Media.prototype.isRulesetLike = true; +Media.prototype.isRulesetLike = function() { return true; }; Media.prototype.accept = function (visitor) { if (this.features) { this.features = visitor.visit(this.features); @@ -7390,7 +7408,7 @@ Media.prototype.bubbleSelectors = function (selectors) { }; module.exports = Media; -},{"../utils":86,"./anonymous":47,"./atrule":49,"./expression":62,"./ruleset":79,"./selector":80,"./value":84}],70:[function(require,module,exports){ +},{"../utils":87,"./anonymous":47,"./atrule":49,"./expression":62,"./ruleset":80,"./selector":81,"./value":85}],70:[function(require,module,exports){ var Node = require("./node"), Selector = require("./selector"), MixinDefinition = require("./mixin-definition"), @@ -7576,7 +7594,7 @@ MixinCall.prototype.format = function (args) { }; module.exports = MixinCall; -},{"../functions/default":22,"./mixin-definition":71,"./node":73,"./selector":80}],71:[function(require,module,exports){ +},{"../functions/default":22,"./mixin-definition":71,"./node":73,"./selector":81}],71:[function(require,module,exports){ var Selector = require("./selector"), Element = require("./element"), Ruleset = require("./ruleset"), @@ -7780,7 +7798,7 @@ Definition.prototype.matchArgs = function (args, context) { }; module.exports = Definition; -},{"../contexts":12,"../utils":86,"./declaration":57,"./element":61,"./expression":62,"./ruleset":79,"./selector":80}],72:[function(require,module,exports){ +},{"../contexts":12,"../utils":87,"./declaration":57,"./element":61,"./expression":62,"./ruleset":80,"./selector":81}],72:[function(require,module,exports){ var Node = require("./node"), Operation = require("./operation"), Dimension = require("./dimension"); @@ -7807,6 +7825,8 @@ var Node = function() { this.parent = null; this.visibilityBlocks = undefined; this.nodeVisible = undefined; + this.rootNode = null; + this.parsed = null; var self = this; Object.defineProperty(this, "currentFileInfo", { @@ -7836,6 +7856,7 @@ Node.prototype.getIndex = function() { Node.prototype.fileInfo = function() { return this._fileInfo || (this.parent && this.parent.fileInfo()) || {}; }; +Node.prototype.isRulesetLike = function() { return false; }; Node.prototype.toCSS = function (context) { var strs = []; this.genCSS(context, { @@ -8027,9 +8048,82 @@ Paren.prototype.eval = function (context) { module.exports = Paren; },{"./node":73}],76:[function(require,module,exports){ +var Node = require("./node"), + Declaration = require("./declaration"); + +var Property = function (name, index, currentFileInfo) { + this.name = name; + this._index = index; + this._fileInfo = currentFileInfo; +}; +Property.prototype = new Node(); +Property.prototype.type = "Property"; +Property.prototype.eval = function (context) { + var property, name = this.name; + // TODO: shorten this reference + var mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules; + + if (this.evaluating) { + throw { type: 'Name', + message: "Recursive property reference for " + name, + filename: this.fileInfo().filename, + index: this.getIndex() }; + } + + this.evaluating = true; + + property = this.find(context.frames, function (frame) { + + var v, vArr = frame.property(name); + if (vArr) { + for (var i = 0; i < vArr.length; i++) { + v = vArr[i]; + + vArr[i] = new Declaration(v.name, + v.value, + v.important, + v.merge, + v.index, + v.currentFileInfo, + v.inline, + v.variable + ); + } + mergeRules(vArr); + + v = vArr[vArr.length - 1]; + if (v.important) { + var importantScope = context.importantScope[context.importantScope.length - 1]; + importantScope.important = v.important; + } + v = v.value.eval(context); + return v; + } + }); + if (property) { + this.evaluating = false; + return property; + } else { + throw { type: 'Name', + message: "Property '" + name + "' is undefined", + filename: this.currentFileInfo.filename, + index: this.index }; + } +}; +Property.prototype.find = function (obj, fun) { + for (var i = 0, r; i < obj.length; i++) { + r = fun.call(obj, obj[i]); + if (r) { return r; } + } + return null; +}; +module.exports = Property; + +},{"./declaration":57,"./node":73}],77:[function(require,module,exports){ var Node = require("./node"), JsEvalNode = require("./js-eval-node"), - Variable = require("./variable"); + Variable = require("./variable"), + Property = require("./property"); var Quoted = function (str, content, escaped, index, currentFileInfo) { this.escaped = (escaped == null) ? true : escaped; @@ -8057,10 +8151,14 @@ Quoted.prototype.eval = function (context) { var javascriptReplacement = function (_, exp) { return String(that.evaluateJavaScript(exp, context)); }; - var interpolationReplacement = function (_, name) { + var variableReplacement = function (_, name) { var v = new Variable('@' + name, that.getIndex(), that.fileInfo()).eval(context, true); return (v instanceof Quoted) ? v.value : v.toCSS(); }; + var propertyReplacement = function (_, name) { + var v = new Property('$' + name, that.getIndex(), that.fileInfo()).eval(context, true); + return (v instanceof Quoted) ? v.value : v.toCSS(); + }; function iterativeReplace(value, regexp, replacementFnc) { var evaluatedValue = value; do { @@ -8070,7 +8168,8 @@ Quoted.prototype.eval = function (context) { return evaluatedValue; } value = iterativeReplace(value, /`([^`]+)`/g, javascriptReplacement); - value = iterativeReplace(value, /@\{([\w-]+)\}/g, interpolationReplacement); + value = iterativeReplace(value, /@\{([\w-]+)\}/g, variableReplacement); + value = iterativeReplace(value, /\$\{([\w-]+)\}/g, propertyReplacement); return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo()); }; Quoted.prototype.compare = function (other) { @@ -8083,7 +8182,7 @@ Quoted.prototype.compare = function (other) { }; module.exports = Quoted; -},{"./js-eval-node":67,"./node":73,"./variable":85}],77:[function(require,module,exports){ +},{"./js-eval-node":67,"./node":73,"./property":76,"./variable":86}],78:[function(require,module,exports){ // Backwards compatibility shim for Rule (Declaration) var Declaration = require("./declaration"); @@ -8096,7 +8195,7 @@ Rule.prototype = Object.create(Declaration.prototype); Rule.prototype.constructor = Rule; module.exports = Rule; -},{"./declaration":57}],78:[function(require,module,exports){ +},{"./declaration":57}],79:[function(require,module,exports){ var Node = require("./node"), Variable = require("./variable"); @@ -8112,25 +8211,32 @@ RulesetCall.prototype.eval = function (context) { }; module.exports = RulesetCall; -},{"./node":73,"./variable":85}],79:[function(require,module,exports){ +},{"./node":73,"./variable":86}],80:[function(require,module,exports){ var Node = require("./node"), Declaration = require("./declaration"), + Keyword = require("./keyword"), + Comment = require("./comment"), + Paren = require("./paren"), Selector = require("./selector"), Element = require("./element"), - Paren = require("./paren"), + Anonymous = require("./anonymous"), contexts = require("../contexts"), globalFunctionRegistry = require("../functions/function-registry"), defaultFunc = require("../functions/default"), getDebugInfo = require("./debug-info"), + LessError = require("../less-error"), utils = require("../utils"); var Ruleset = function (selectors, rules, strictImports, visibilityInfo) { this.selectors = selectors; this.rules = rules; this._lookups = {}; + this._variables = null; + this._properties = null; this.strictImports = strictImports; this.copyVisibilityInfo(visibilityInfo); this.allowRoot = true; + this.setParent(this.selectors, this); this.setParent(this.rules, this); @@ -8138,7 +8244,7 @@ var Ruleset = function (selectors, rules, strictImports, visibilityInfo) { Ruleset.prototype = new Node(); Ruleset.prototype.type = "Ruleset"; Ruleset.prototype.isRuleset = true; -Ruleset.prototype.isRulesetLike = true; +Ruleset.prototype.isRulesetLike = function() { return true; }; Ruleset.prototype.accept = function (visitor) { if (this.paths) { this.paths = visitor.visitArray(this.paths, true); @@ -8219,20 +8325,20 @@ Ruleset.prototype.eval = function (context) { // Store the frames around mixin definitions, // so they can be evaluated like closures when the time comes. - var rsRules = ruleset.rules, rsRuleCnt = rsRules ? rsRules.length : 0; - for (i = 0; i < rsRuleCnt; i++) { - if (rsRules[i].evalFirst) { - rsRules[i] = rsRules[i].eval(context); + var rsRules = ruleset.rules; + for (i = 0; (rule = rsRules[i]); i++) { + if (rule.evalFirst) { + rsRules[i] = rule.eval(context); } } var mediaBlockCount = (context.mediaBlocks && context.mediaBlocks.length) || 0; // Evaluate mixin calls. - for (i = 0; i < rsRuleCnt; i++) { - if (rsRules[i].type === "MixinCall") { + for (i = 0; (rule = rsRules[i]); i++) { + if (rule.type === "MixinCall") { /*jshint loopfunc:true */ - rules = rsRules[i].eval(context).filter(function(r) { + rules = rule.eval(context).filter(function(r) { if ((r instanceof Declaration) && r.variable) { // do not pollute the scope if the variable is // already there. consider returning false here @@ -8242,12 +8348,11 @@ Ruleset.prototype.eval = function (context) { return true; }); rsRules.splice.apply(rsRules, [i, 1].concat(rules)); - rsRuleCnt += rules.length - 1; i += rules.length - 1; ruleset.resetCache(); - } else if (rsRules[i].type === "RulesetCall") { + } else if (rule.type === "RulesetCall") { /*jshint loopfunc:true */ - rules = rsRules[i].eval(context).rules.filter(function(r) { + rules = rule.eval(context).rules.filter(function(r) { if ((r instanceof Declaration) && r.variable) { // do not pollute the scope at all return false; @@ -8255,31 +8360,27 @@ Ruleset.prototype.eval = function (context) { return true; }); rsRules.splice.apply(rsRules, [i, 1].concat(rules)); - rsRuleCnt += rules.length - 1; i += rules.length - 1; ruleset.resetCache(); } } // Evaluate everything else - for (i = 0; i < rsRules.length; i++) { - rule = rsRules[i]; + for (i = 0; (rule = rsRules[i]); i++) { if (!rule.evalFirst) { rsRules[i] = rule = rule.eval ? rule.eval(context) : rule; } } // Evaluate everything else - for (i = 0; i < rsRules.length; i++) { - rule = rsRules[i]; + for (i = 0; (rule = rsRules[i]); i++) { // for rulesets, check if it is a css guard and can be removed if (rule instanceof Ruleset && rule.selectors && rule.selectors.length === 1) { // check if it can be folded in (e.g. & where) if (rule.selectors[0].isJustParentSelector()) { rsRules.splice(i--, 1); - for (var j = 0; j < rule.rules.length; j++) { - subRule = rule.rules[j]; + for (var j = 0; (subRule = rule.rules[j]); j++) { if (subRule instanceof Node) { subRule.copyVisibilityInfo(rule.visibilityInfo()); if (!(subRule instanceof Declaration) || !subRule.variable) { @@ -8351,6 +8452,7 @@ Ruleset.prototype.matchCondition = function (args, context) { Ruleset.prototype.resetCache = function () { this._rulesets = null; this._variables = null; + this._properties = null; this._lookups = {}; }; Ruleset.prototype.variables = function () { @@ -8375,17 +8477,86 @@ Ruleset.prototype.variables = function () { } return this._variables; }; +Ruleset.prototype.properties = function () { + if (!this._properties) { + this._properties = !this.rules ? {} : this.rules.reduce(function (hash, r) { + if (r instanceof Declaration && r.variable !== true) { + var name = (r.name.length === 1) && (r.name[0] instanceof Keyword) ? + r.name[0].value : r.name; + // Properties don't overwrite as they can merge + if (!hash['$' + name]) { + hash['$' + name] = [ r ]; + } + else { + hash['$' + name].push(r); + } + } + return hash; + }, {}); + } + return this._properties; +}; Ruleset.prototype.variable = function (name) { - return this.variables()[name]; + var decl = this.variables()[name]; + if (decl) { + return this.parseValue(decl); + } +}; +Ruleset.prototype.property = function (name) { + var decl = this.properties()[name]; + if (decl) { + return this.parseValue(decl); + } +}; +Ruleset.prototype.parseValue = function(toParse) { + var self = this; + function transformDeclaration(decl) { + if (decl.value instanceof Anonymous && !decl.parsed) { + try { + this.parse.parserInput.start(decl.value.value, false, function fail(msg, index) { + decl.parsed = true; + return decl; + }); + var result = this.parse.parsers.value(); + var important = this.parse.parsers.important(); + + var endInfo = this.parse.parserInput.end(); + if (endInfo.isFinished) { + decl.value = result; + decl.imporant = important; + decl.parsed = true; + } + } catch (e) { + throw new LessError({ + index: e.index + decl.value.getIndex(), + message: e.message + }, this.parse.imports, decl.fileInfo().filename); + } + + return decl; + } + else { + return decl; + } + } + if (!Array.isArray(toParse)) { + return transformDeclaration.call(self, toParse); + } + else { + var nodes = []; + toParse.forEach(function(n) { + nodes.push(transformDeclaration.call(self, n)); + }); + return nodes; + } }; Ruleset.prototype.rulesets = function () { if (!this.rules) { return []; } - var filtRules = [], rules = this.rules, cnt = rules.length, + var filtRules = [], rules = this.rules, i, rule; - for (i = 0; i < cnt; i++) { - rule = rules[i]; + for (i = 0; (rule = rules[i]); i++) { if (rule.isRuleset) { filtRules.push(rule); } @@ -8451,41 +8622,23 @@ Ruleset.prototype.genCSS = function (context, output) { tabSetStr = context.compress ? '' : Array(context.tabLevel).join(" "), sep; - function isRulesetLikeNode(rule) { - // if it has nested rules, then it should be treated like a ruleset - // medias and comments do not have nested rules, but should be treated like rulesets anyway - // some atrules and anonymous nodes are ruleset like, others are not - if (typeof rule.isRulesetLike === "boolean") { - return rule.isRulesetLike; - } else if (typeof rule.isRulesetLike === "function") { - return rule.isRulesetLike(); - } - - //anything else is assumed to be a rule - return false; - } - var charsetNodeIndex = 0; var importNodeIndex = 0; - for (i = 0; i < this.rules.length; i++) { - rule = this.rules[i]; - // Plugins may return something other than Nodes - if (rule instanceof Node) { - if (rule.type === "Comment") { - if (importNodeIndex === i) { - importNodeIndex++; - } - ruleNodes.push(rule); - } else if (rule.isCharset && rule.isCharset()) { - ruleNodes.splice(charsetNodeIndex, 0, rule); - charsetNodeIndex++; + for (i = 0; (rule = this.rules[i]); i++) { + if (rule instanceof Comment) { + if (importNodeIndex === i) { importNodeIndex++; - } else if (rule.type === "Import") { - ruleNodes.splice(importNodeIndex, 0, rule); - importNodeIndex++; - } else { - ruleNodes.push(rule); } + ruleNodes.push(rule); + } else if (rule.isCharset && rule.isCharset()) { + ruleNodes.splice(charsetNodeIndex, 0, rule); + charsetNodeIndex++; + importNodeIndex++; + } else if (rule.type === "Import") { + ruleNodes.splice(importNodeIndex, 0, rule); + importNodeIndex++; + } else { + ruleNodes.push(rule); } } ruleNodes = charsetRuleNodes.concat(ruleNodes); @@ -8523,15 +8676,14 @@ Ruleset.prototype.genCSS = function (context, output) { } // Compile rules and rulesets - for (i = 0; i < ruleNodes.length; i++) { - rule = ruleNodes[i]; + for (i = 0; (rule = ruleNodes[i]); i++) { if (i + 1 === ruleNodes.length) { context.lastRule = true; } var currentLastRule = context.lastRule; - if (isRulesetLikeNode(rule)) { + if (rule.isRulesetLike(rule)) { context.lastRule = false; } @@ -8543,7 +8695,7 @@ Ruleset.prototype.genCSS = function (context, output) { context.lastRule = currentLastRule; - if (!context.lastRule) { + if (!context.lastRule && rule.isVisible()) { output.add(context.compress ? '' : ('\n' + tabRuleStr)); } else { context.lastRule = false; @@ -8661,9 +8813,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { return; } - for (i = 0; i < selectors.length; i++) { - sel = selectors[i]; - + for (i = 0; (sel = selectors[i]); i++) { // if the previous thing in sel is a parent this needs to join on to it if (sel.length > 0) { sel[sel.length - 1] = sel[sel.length - 1].createDerived(sel[sel.length - 1].elements.concat(elements)); @@ -8691,12 +8841,12 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { var i, j, k, currentElements, newSelectors, selectorsMultiplied, sel, el, hadParentSelector = false, length, lastSelector; function findNestedSelector(element) { var maybeSelector; - if (element.value.type !== 'Paren') { + if (!(element.value instanceof Paren)) { return null; } maybeSelector = element.value.value; - if (maybeSelector.type !== 'Selector') { + if (!(maybeSelector instanceof Selector)) { return null; } @@ -8712,8 +8862,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { [] ]; - for (i = 0; i < inSelector.elements.length; i++) { - el = inSelector.elements[i]; + for (i = 0; (el = inSelector.elements[i]); i++) { // non parent reference elements just get added if (el.value !== "&") { var nestedSelector = findNestedSelector(el); @@ -8828,7 +8977,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { }; module.exports = Ruleset; -},{"../contexts":12,"../functions/default":22,"../functions/function-registry":24,"../utils":86,"./debug-info":56,"./declaration":57,"./element":61,"./node":73,"./paren":75,"./selector":80}],80:[function(require,module,exports){ +},{"../contexts":12,"../functions/default":22,"../functions/function-registry":24,"../less-error":34,"../utils":87,"./anonymous":47,"./comment":54,"./debug-info":56,"./declaration":57,"./element":61,"./keyword":68,"./node":73,"./paren":75,"./selector":81}],81:[function(require,module,exports){ var Node = require("./node"), Element = require("./element"); @@ -8943,7 +9092,7 @@ Selector.prototype.getIsOutput = function() { }; module.exports = Selector; -},{"./element":61,"./node":73}],81:[function(require,module,exports){ +},{"./element":61,"./node":73}],82:[function(require,module,exports){ var Node = require("./node"); var UnicodeDescriptor = function (value) { @@ -8954,7 +9103,7 @@ UnicodeDescriptor.prototype.type = "UnicodeDescriptor"; module.exports = UnicodeDescriptor; -},{"./node":73}],82:[function(require,module,exports){ +},{"./node":73}],83:[function(require,module,exports){ var Node = require("./node"), unitConversions = require("../data/unit-conversions"), utils = require("../utils"); @@ -9077,7 +9226,7 @@ Unit.prototype.cancel = function () { }; module.exports = Unit; -},{"../data/unit-conversions":15,"../utils":86,"./node":73}],83:[function(require,module,exports){ +},{"../data/unit-conversions":15,"../utils":87,"./node":73}],84:[function(require,module,exports){ var Node = require("./node"); var URL = function (val, index, currentFileInfo, isEvald) { @@ -9133,7 +9282,7 @@ URL.prototype.eval = function (context) { }; module.exports = URL; -},{"./node":73}],84:[function(require,module,exports){ +},{"./node":73}],85:[function(require,module,exports){ var Node = require("./node"); var Value = function (value) { @@ -9169,7 +9318,7 @@ Value.prototype.genCSS = function (context, output) { }; module.exports = Value; -},{"./node":73}],85:[function(require,module,exports){ +},{"./node":73}],86:[function(require,module,exports){ var Node = require("./node"); var Variable = function (name, index, currentFileInfo) { @@ -9224,7 +9373,7 @@ Variable.prototype.find = function (obj, fun) { }; module.exports = Variable; -},{"./node":73}],86:[function(require,module,exports){ +},{"./node":73}],87:[function(require,module,exports){ module.exports = { getLocation: function(index, inputStream) { var n = index + 1, @@ -9255,7 +9404,7 @@ module.exports = { } }; -},{}],87:[function(require,module,exports){ +},{}],88:[function(require,module,exports){ var tree = require("../tree"), Visitor = require("./visitor"), logger = require("../logger"), @@ -9718,7 +9867,7 @@ ProcessExtendsVisitor.prototype = { module.exports = ProcessExtendsVisitor; -},{"../logger":35,"../tree":65,"../utils":86,"./visitor":94}],88:[function(require,module,exports){ +},{"../logger":35,"../tree":65,"../utils":87,"./visitor":95}],89:[function(require,module,exports){ function ImportSequencer(onSequencerEmpty) { this.imports = []; this.variableImports = []; @@ -9774,7 +9923,7 @@ ImportSequencer.prototype.tryRun = function() { module.exports = ImportSequencer; -},{}],89:[function(require,module,exports){ +},{}],90:[function(require,module,exports){ var contexts = require("../contexts"), Visitor = require("./visitor"), ImportSequencer = require("./import-sequencer"), @@ -9966,7 +10115,7 @@ ImportVisitor.prototype = { }; module.exports = ImportVisitor; -},{"../contexts":12,"../utils":86,"./import-sequencer":88,"./visitor":94}],90:[function(require,module,exports){ +},{"../contexts":12,"../utils":87,"./import-sequencer":89,"./visitor":95}],91:[function(require,module,exports){ var visitors = { Visitor: require("./visitor"), ImportVisitor: require('./import-visitor'), @@ -9978,7 +10127,7 @@ var visitors = { module.exports = visitors; -},{"./extend-visitor":87,"./import-visitor":89,"./join-selector-visitor":91,"./set-tree-visibility-visitor":92,"./to-css-visitor":93,"./visitor":94}],91:[function(require,module,exports){ +},{"./extend-visitor":88,"./import-visitor":90,"./join-selector-visitor":92,"./set-tree-visibility-visitor":93,"./to-css-visitor":94,"./visitor":95}],92:[function(require,module,exports){ var Visitor = require("./visitor"); var JoinSelectorVisitor = function() { @@ -10031,7 +10180,7 @@ JoinSelectorVisitor.prototype = { module.exports = JoinSelectorVisitor; -},{"./visitor":94}],92:[function(require,module,exports){ +},{"./visitor":95}],93:[function(require,module,exports){ var SetTreeVisibilityVisitor = function(visible) { this.visible = visible; }; @@ -10070,7 +10219,7 @@ SetTreeVisibilityVisitor.prototype.visit = function(node) { return node; }; module.exports = SetTreeVisibilityVisitor; -},{}],93:[function(require,module,exports){ +},{}],94:[function(require,module,exports){ var tree = require("../tree"), Visitor = require("./visitor"); @@ -10465,7 +10614,7 @@ ToCSSVisitor.prototype = { module.exports = ToCSSVisitor; -},{"../tree":65,"./visitor":94}],94:[function(require,module,exports){ +},{"../tree":65,"./visitor":95}],95:[function(require,module,exports){ var tree = require("../tree"); var _visitArgs = { visitDeeper: true }, @@ -10619,7 +10768,7 @@ Visitor.prototype = { }; module.exports = Visitor; -},{"../tree":65}],95:[function(require,module,exports){ +},{"../tree":65}],96:[function(require,module,exports){ "use strict"; // rawAsap provides everything we need except exception management. @@ -10687,7 +10836,7 @@ RawTask.prototype.call = function () { } }; -},{"./raw":96}],96:[function(require,module,exports){ +},{"./raw":97}],97:[function(require,module,exports){ (function (global){ "use strict"; @@ -10911,356 +11060,7 @@ rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer; // https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],97:[function(require,module,exports){ -(function (process){ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// resolves . and .. elements in a path array with directory names there -// must be no slashes, empty elements, or device names (c:\) in the array -// (so also no leading and trailing slashes - it does not distinguish -// relative and absolute paths) -function normalizeArray(parts, allowAboveRoot) { - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = parts.length - 1; i >= 0; i--) { - var last = parts[i]; - if (last === '.') { - parts.splice(i, 1); - } else if (last === '..') { - parts.splice(i, 1); - up++; - } else if (up) { - parts.splice(i, 1); - up--; - } - } - - // if the path is allowed to go above the root, restore leading ..s - if (allowAboveRoot) { - for (; up--; up) { - parts.unshift('..'); - } - } - - return parts; -} - -// Split a filename into [root, dir, basename, ext], unix version -// 'root' is just a slash, or nothing. -var splitPathRe = - /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; -var splitPath = function(filename) { - return splitPathRe.exec(filename).slice(1); -}; - -// path.resolve([from ...], to) -// posix version -exports.resolve = function() { - var resolvedPath = '', - resolvedAbsolute = false; - - for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { - var path = (i >= 0) ? arguments[i] : process.cwd(); - - // Skip empty and invalid entries - if (typeof path !== 'string') { - throw new TypeError('Arguments to path.resolve must be strings'); - } else if (!path) { - continue; - } - - resolvedPath = path + '/' + resolvedPath; - resolvedAbsolute = path.charAt(0) === '/'; - } - - // At this point the path should be resolved to a full absolute path, but - // handle relative paths to be safe (might happen when process.cwd() fails) - - // Normalize the path - resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { - return !!p; - }), !resolvedAbsolute).join('/'); - - return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; -}; - -// path.normalize(path) -// posix version -exports.normalize = function(path) { - var isAbsolute = exports.isAbsolute(path), - trailingSlash = substr(path, -1) === '/'; - - // Normalize the path - path = normalizeArray(filter(path.split('/'), function(p) { - return !!p; - }), !isAbsolute).join('/'); - - if (!path && !isAbsolute) { - path = '.'; - } - if (path && trailingSlash) { - path += '/'; - } - - return (isAbsolute ? '/' : '') + path; -}; - -// posix version -exports.isAbsolute = function(path) { - return path.charAt(0) === '/'; -}; - -// posix version -exports.join = function() { - var paths = Array.prototype.slice.call(arguments, 0); - return exports.normalize(filter(paths, function(p, index) { - if (typeof p !== 'string') { - throw new TypeError('Arguments to path.join must be strings'); - } - return p; - }).join('/')); -}; - - -// path.relative(from, to) -// posix version -exports.relative = function(from, to) { - from = exports.resolve(from).substr(1); - to = exports.resolve(to).substr(1); - - function trim(arr) { - var start = 0; - for (; start < arr.length; start++) { - if (arr[start] !== '') break; - } - - var end = arr.length - 1; - for (; end >= 0; end--) { - if (arr[end] !== '') break; - } - - if (start > end) return []; - return arr.slice(start, end - start + 1); - } - - var fromParts = trim(from.split('/')); - var toParts = trim(to.split('/')); - - var length = Math.min(fromParts.length, toParts.length); - var samePartsLength = length; - for (var i = 0; i < length; i++) { - if (fromParts[i] !== toParts[i]) { - samePartsLength = i; - break; - } - } - - var outputParts = []; - for (var i = samePartsLength; i < fromParts.length; i++) { - outputParts.push('..'); - } - - outputParts = outputParts.concat(toParts.slice(samePartsLength)); - - return outputParts.join('/'); -}; - -exports.sep = '/'; -exports.delimiter = ':'; - -exports.dirname = function(path) { - var result = splitPath(path), - root = result[0], - dir = result[1]; - - if (!root && !dir) { - // No dirname whatsoever - return '.'; - } - - if (dir) { - // It has a dirname, strip trailing slash - dir = dir.substr(0, dir.length - 1); - } - - return root + dir; -}; - - -exports.basename = function(path, ext) { - var f = splitPath(path)[2]; - // TODO: make this comparison case-insensitive on windows? - if (ext && f.substr(-1 * ext.length) === ext) { - f = f.substr(0, f.length - ext.length); - } - return f; -}; - - -exports.extname = function(path) { - return splitPath(path)[3]; -}; - -function filter (xs, f) { - if (xs.filter) return xs.filter(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - if (f(xs[i], i, xs)) res.push(xs[i]); - } - return res; -} - -// String.prototype.substr - negative index don't work in IE8 -var substr = 'ab'.substr(-1) === 'b' - ? function (str, start, len) { return str.substr(start, len) } - : function (str, start, len) { - if (start < 0) start = str.length + start; - return str.substr(start, len); - } -; - -}).call(this,require('_process')) -},{"_process":98}],98:[function(require,module,exports){ -// shim for using process in browser - -var process = module.exports = {}; - -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. - -var cachedSetTimeout; -var cachedClearTimeout; - -(function () { - try { - cachedSetTimeout = setTimeout; - } catch (e) { - cachedSetTimeout = function () { - throw new Error('setTimeout is not defined'); - } - } - try { - cachedClearTimeout = clearTimeout; - } catch (e) { - cachedClearTimeout = function () { - throw new Error('clearTimeout is not defined'); - } - } -} ()) -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = cachedSetTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - cachedClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - cachedSetTimeout(drainQueue, 0); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; - -},{}],99:[function(require,module,exports){ +},{}],98:[function(require,module,exports){ 'use strict'; var asap = require('asap/raw'); @@ -11475,7 +11275,7 @@ function doResolve(fn, promise) { } } -},{"asap/raw":96}],100:[function(require,module,exports){ +},{"asap/raw":97}],99:[function(require,module,exports){ 'use strict'; //This file contains the ES6 extensions to the core Promises/A+ API @@ -11584,7 +11384,7 @@ Promise.prototype['catch'] = function (onRejected) { return this.then(null, onRejected); }; -},{"./core.js":99}],101:[function(require,module,exports){ +},{"./core.js":98}],100:[function(require,module,exports){ // should work in any browser without browserify if (typeof Promise.prototype.done !== 'function') { @@ -11597,7 +11397,7 @@ if (typeof Promise.prototype.done !== 'function') { }) } } -},{}],102:[function(require,module,exports){ +},{}],101:[function(require,module,exports){ // not "use strict" so we can declare global "Promise" var asap = require('asap'); @@ -11609,5 +11409,5 @@ if (typeof Promise === 'undefined') { require('./polyfill-done.js'); -},{"./lib/core.js":99,"./lib/es6-extensions.js":100,"./polyfill-done.js":101,"asap":95}]},{},[2])(2) +},{"./lib/core.js":98,"./lib/es6-extensions.js":99,"./polyfill-done.js":100,"asap":96}]},{},[2])(2) }); \ No newline at end of file diff --git a/dist/less.min.js b/dist/less.min.js index 0499ea1d3..b2e1f34dd 100644 --- a/dist/less.min.js +++ b/dist/less.min.js @@ -1,5 +1,5 @@ /*! - * Less - Leaner CSS v3.0.0-pre.2 + * Less - Leaner CSS v3.0.0-pre.3 * http://lesscss.org * * Copyright (c) 2009-2016, Alexis Sellier @@ -10,8 +10,8 @@ /** * @license Apache-2.0 */ -!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.less=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0||b.isFileProtocol?"development":"production");var c=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(a.location.hash);c&&(b.dumpLineNumbers=c[1]),void 0===b.useFileCache&&(b.useFileCache=!0),void 0===b.onReady&&(b.onReady=!0),b.javascriptEnabled=!(!b.javascriptEnabled&&!b.inlineJavaScript)}},{"./browser":3,"./utils":11}],2:[function(a,b,c){function d(a){a.filename&&console.warn(a),e.async||h.removeChild(i)}a("promise/polyfill.js");var e=window.less||{};a("./add-default-options")(window,e);var f=b.exports=a("./index")(window,e);window.less=f;var g,h,i;e.onReady&&(/!watch/.test(window.location.hash)&&f.watch(),e.async||(g="body { display: none !important }",h=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),i.type="text/css",i.styleSheet?i.styleSheet.cssText=g:i.appendChild(document.createTextNode(g)),h.appendChild(i)),f.registerStylesheetsImmediately(),f.pageLoadFinished=f.refresh("development"===f.env).then(d,d))},{"./add-default-options":1,"./index":8,"promise/polyfill.js":102}],3:[function(a,b,c){var d=a("./utils");b.exports={createCSS:function(a,b,c){var e=c.href||"",f="less:"+(c.title||d.extractId(e)),g=a.getElementById(f),h=!1,i=a.createElement("style");i.setAttribute("type","text/css"),c.media&&i.setAttribute("media",c.media),i.id=f,i.styleSheet||(i.appendChild(a.createTextNode(b)),h=null!==g&&g.childNodes.length>0&&i.childNodes.length>0&&g.firstChild.nodeValue===i.firstChild.nodeValue);var j=a.getElementsByTagName("head")[0];if(null===g||h===!1){var k=c&&c.nextSibling||null;k?k.parentNode.insertBefore(i,k):j.appendChild(i)}if(g&&h===!1&&g.parentNode.removeChild(g),i.styleSheet)try{i.styleSheet.cssText=b}catch(l){throw new Error("Couldn't reassign styleSheet.cssText.")}},currentScript:function(a){var b=a.document;return b.currentScript||function(){var a=b.getElementsByTagName("script");return a[a.length-1]}()}}},{"./utils":11}],4:[function(a,b,c){b.exports=function(a,b,c){var d=null;if("development"!==b.env)try{d="undefined"==typeof a.localStorage?null:a.localStorage}catch(e){}return{setCSS:function(a,b,e,f){if(d){c.info("saving "+a+" to cache.");try{d.setItem(a,f),d.setItem(a+":timestamp",b),e&&d.setItem(a+":vars",JSON.stringify(e))}catch(g){c.error('failed to save "'+a+'" to local storage for caching.')}}},getCSS:function(a,b,c){var e=d&&d.getItem(a),f=d&&d.getItem(a+":timestamp"),g=d&&d.getItem(a+":vars");if(c=c||{},f&&b.lastModified&&new Date(b.lastModified).valueOf()===new Date(f).valueOf()&&(!c&&!g||JSON.stringify(c)===g))return e}}}},{}],5:[function(a,b,c){var d=a("./utils"),e=a("./browser");b.exports=function(a,b,c){function f(b,f){var g,h,i="less-error-message:"+d.extractId(f||""),j='
  • {content}
  • ',k=a.document.createElement("div"),l=[],m=b.filename||f,n=m.match(/([^\/]+(\?.*)?)$/)[1];k.id=i,k.className="less-error-message",h="

    "+(b.type||"Syntax")+"Error: "+(b.message||"There is an error in your .less file")+'

    in '+n+" ";var o=function(a,b,c){void 0!==a.extract[b]&&l.push(j.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};b.extract&&(o(b,0,""),o(b,1,"line"),o(b,2,""),h+="on line "+b.line+", column "+(b.column+1)+":

      "+l.join("")+"
    "),b.stack&&(b.extract||c.logLevel>=4)&&(h+="
    Stack Trace
    "+b.stack.split("\n").slice(1).join("
    ")),k.innerHTML=h,e.createCSS(a.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),k.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===c.env&&(g=setInterval(function(){var b=a.document,c=b.body;c&&(b.getElementById(i)?c.replaceChild(k,b.getElementById(i)):c.insertBefore(k,c.firstChild),clearInterval(g))},10))}function g(b){var c=a.document.getElementById("less-error-message:"+d.extractId(b));c&&c.parentNode.removeChild(c)}function h(a){}function i(a){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?h(a):"function"==typeof c.errorReporting&&c.errorReporting("remove",a):g(a)}function j(a,d){var e="{line} {content}",f=a.filename||d,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f+" ",i=function(a,b,c){void 0!==a.extract[b]&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.extract&&(i(a,0,""),i(a,1,"line"),i(a,2,""),h+="on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")),a.stack&&(a.extract||c.logLevel>=4)&&(h+="\nStack Trace\n"+a.stack),b.logger.error(h)}function k(a,b){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?j(a,b):"function"==typeof c.errorReporting&&c.errorReporting("add",a,b):f(a,b)}return{add:k,remove:i}}},{"./browser":3,"./utils":11}],6:[function(a,b,c){b.exports=function(b,c){function d(){if(window.XMLHttpRequest&&!("file:"===window.location.protocol&&"ActiveXObject"in window))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){return c.error("browser doesn't support AJAX."),null}}var e=a("../less/environment/abstract-file-manager.js"),f={},g=function(){};return g.prototype=new e,g.prototype.alwaysMakePathsAbsolute=function(){return!0},g.prototype.join=function(a,b){return a?this.extractUrlParts(b,a).path:b},g.prototype.doXHR=function(a,e,f,g){function h(b,c,d){b.status>=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var i=d(),j=!b.isFileProtocol||b.fileAsync;"function"==typeof i.overrideMimeType&&i.overrideMimeType("text/css"),c.debug("XHR: Getting '"+a+"'"),i.open("GET",a,j),i.setRequestHeader("Accept",e||"text/x-less, text/css; q=0.9, */*; q=0.5"),i.send(null),b.isFileProtocol&&!b.fileAsync?0===i.status||i.status>=200&&i.status<300?f(i.responseText):g(i.status,a):j?i.onreadystatechange=function(){4==i.readyState&&h(i,f,g)}:h(i,f,g)},g.prototype.supports=function(a,b,c,d){return!0},g.prototype.clearFileCache=function(){f={}},g.prototype.loadFile=function(a,b,c,d,e){b&&!this.isPathAbsolute(a)&&(a=b+a),c=c||{};var g=this.extractUrlParts(a,window.location.href),h=g.url;if(c.useFileCache&&f[h])try{var i=f[h];e(null,{contents:i,filename:h,webInfo:{lastModified:new Date}})}catch(j){e({filename:h,message:"Error loading file "+h+" error was "+j.message})}else this.doXHR(h,c.mime,function(a,b){f[h]=a,e(null,{contents:a,filename:h,webInfo:{lastModified:b}})},function(a,b){e({type:"File",message:"'"+b+"' wasn't found ("+a+")",href:h})})},g}},{"../less/environment/abstract-file-manager.js":16}],7:[function(a,b,c){b.exports=function(){function b(){throw{type:"Runtime",message:"Image size functions are not supported in browser version of less"}}var c=a("./../less/functions/function-registry"),d={"image-size":function(a){return b(this,a),-1},"image-width":function(a){return b(this,a),-1},"image-height":function(a){return b(this,a),-1}};c.addMultiple(d)}},{"./../less/functions/function-registry":24}],8:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(b,c){function f(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function g(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}}function h(a){for(var b,d=l.getElementsByTagName("style"),e=0;e=c&&console.log(a)},info:function(a){b.logLevel>=d&&console.log(a)},warn:function(a){b.logLevel>=e&&console.warn(a)},error:function(a){b.logLevel>=f&&console.error(a)}}]);for(var g=0;g0&&(a=a.slice(0,b)),b=a.lastIndexOf("/"),b<0&&(b=a.lastIndexOf("\\")),b<0?"":a.slice(0,b+1)},d.prototype.tryAppendExtension=function(a,b){return/(\.[a-z]*$)|([\?;].*)$/.test(a)?a:a+b},d.prototype.tryAppendLessExtension=function(a){return this.tryAppendExtension(a,".less")},d.prototype.supportsSync=function(){return!1},d.prototype.alwaysMakePathsAbsolute=function(){return!1},d.prototype.isPathAbsolute=function(a){return/^(?:[a-z-]+:|\/|\\|#)/i.test(a)},d.prototype.join=function(a,b){return a?a+b:b},d.prototype.pathDiff=function(a,b){var c,d,e,f,g=this.extractUrlParts(a),h=this.extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;c0&&(h.splice(c-1,2),c-=2)}return g.hostPart=f[1],g.directories=h,g.path=(f[1]||"")+h.join("/"),g.fileUrl=g.path+(f[4]||""),g.url=g.fileUrl+(f[5]||""),g},b.exports=d},{}],17:[function(a,b,c){function d(a,b){throw new f({type:b||"Syntax",message:a})}var e=a("../functions/function-registry"),f=a("../less-error"),g=function(){};g.prototype.evalPlugin=function(a,b,c,d){var f,g,h,i,j,k,l;if(k=b.pluginManager,d&&(l="string"==typeof d?d:d.filename),l&&(h=k.get(l)))return this.trySetOptions(h,l,c),h.use&&h.use(this.less),h;i={exports:{},pluginManager:k,fileInfo:d},j=i.exports,g=e.create();try{if(f=new Function("module","require","functions","tree","fileInfo",a),h=f(i,this.require,g,this.less.tree,d),h||(h=i.exports),h=this.validatePlugin(h,l),!h)throw new SyntaxError("Not a valid plugin");k.addPlugin(h,d.filename),h.functions=g.getLocalFunctions(),this.trySetOptions(h,l,c),h.use&&h.use(this.less)}catch(m){return console.log(m),new this.less.LessError({message:"Plugin evaluation error: '"+m.name+": "+m.message.replace(/["]/g,"'")+"'",filename:l,line:this.line,col:this.column})}return h},g.prototype.trySetOptions=function(b,c,e){var f=a("path").basename(c);if(e){if(!b.setOptions)return d("Options have been provided but the plugin "+f+" does not support any options."),null;try{b.setOptions(e)}catch(g){return d("Error setting options on plugin "+f+"\n"+g.message),null}}},g.prototype.validatePlugin=function(b,c){if(b){"function"==typeof b&&(b=new b);var e=a("path").basename(c);return b.minVersion&&this.compareVersion(b.minVersion,this.less.version)<0?(d("Plugin "+e+" requires version "+this.versionToString(b.minVersion)),null):b}return null},g.prototype.compareVersion=function(a,b){"string"==typeof a&&(a=a.match(/^(\d+)\.?(\d+)?\.?(\d+)?/),a.shift());for(var c=0;cparseInt(b[c])?-1:1;return 0},g.prototype.versionToString=function(a){for(var b="",c=0;c=0;h--){var i=g[h];if(i[f?"supportsSync":"supports"](a,b,c,e))return i}return null},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},b.exports=e},{"../logger":35}],19:[function(a,b,c){function d(a,b,c){var d,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;l<3;l++)d=b.rgb[l]/255,f=c.rgb[l]/255,h=a(d,f),g&&(h=(j*f+i*(d-j*(d+f-h)))/g),k[l]=255*h;return new e(k,g)}var e=a("../tree/color"),f=a("./function-registry"),g={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,a<=1?g.multiply(a,b):g.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return g.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};for(var h in g)g.hasOwnProperty(h)&&(d[h]=d.bind(null,g[h]));f.addMultiple(d)},{"../tree/color":52,"./function-registry":24}],20:[function(a,b,c){function d(a){return Math.min(1,Math.max(0,a))}function e(a){return h.hsla(a.h,a.s,a.l,a.a)}function f(a){if(a instanceof i)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{type:"Argument",message:"color functions take numbers as parameters"}}function g(a,b){return a instanceof i&&a.unit.is("%")?parseFloat(a.value*b/100):f(a)}var h,i=a("../tree/dimension"),j=a("../tree/color"),k=a("../tree/quoted"),l=a("../tree/anonymous"),m=a("./function-registry");h={rgb:function(a,b,c){return h.rgba(a,b,c,1)},rgba:function(a,b,c,d){var e=[a,b,c].map(function(a){return g(a,255)});return d=f(d),new j(e,d)},hsl:function(a,b,c){return h.hsla(a,b,c,1)},hsla:function(a,b,c,e){function g(a){return a=a<0?a+1:a>1?a-1:a,6*a<1?i+(j-i)*a*6:2*a<1?j:3*a<2?i+(j-i)*(2/3-a)*6:i}var i,j;return a=f(a)%360/360,b=d(f(b)),c=d(f(c)),e=d(f(e)),j=c<=.5?c*(b+1):c+b-c*b,i=2*c-j,h.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),e)},hsv:function(a,b,c){return h.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=f(a)%360/360*360,b=f(b),c=f(c),d=f(d);var e,g;e=Math.floor(a/60%6),g=a/60-e;var i=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],j=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return h.rgba(255*i[j[e][0]],255*i[j[e][1]],255*i[j[e][2]],d)},hue:function(a){return new i(a.toHSL().h)},saturation:function(a){return new i(100*a.toHSL().s,"%")},lightness:function(a){return new i(100*a.toHSL().l,"%")},hsvhue:function(a){return new i(a.toHSV().h)},hsvsaturation:function(a){return new i(100*a.toHSV().s,"%")},hsvvalue:function(a){return new i(100*a.toHSV().v,"%")},red:function(a){return new i(a.rgb[0])},green:function(a){return new i(a.rgb[1])},blue:function(a){return new i(a.rgb[2])},alpha:function(a){return new i(a.toHSL().a)},luma:function(a){return new i(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new i(b*a.alpha*100,"%")},saturate:function(a,b,c){if(!a.rgb)return null;var f=a.toHSL();return f.s+="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},desaturate:function(a,b,c){var f=a.toHSL();return f.s-="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},lighten:function(a,b,c){var f=a.toHSL();return f.l+="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},darken:function(a,b,c){var f=a.toHSL();return f.l-="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},fadein:function(a,b,c){var f=a.toHSL();return f.a+="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fadeout:function(a,b,c){var f=a.toHSL();return f.a-="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=d(c.a),e(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=d<0?360+d:d,e(c)},mix:function(a,b,c){a.toHSL&&b.toHSL||(console.log(b.type),console.dir(b)),c||(c=new i(50));var d=c.value/100,e=2*d-1,f=a.toHSL().a-b.toHSL().a,g=((e*f==-1?e:(e+f)/(1+e*f))+1)/2,h=1-g,k=[a.rgb[0]*g+b.rgb[0]*h,a.rgb[1]*g+b.rgb[1]*h,a.rgb[2]*g+b.rgb[2]*h],l=a.alpha*d+b.alpha*(1-d);return new j(k,l)},greyscale:function(a){return h.desaturate(a,new i(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;"undefined"==typeof b&&(b=h.rgba(0,0,0,1)),"undefined"==typeof c&&(c=h.rgba(255,255,255,1));var e,f,g=a.luma(),i=b.luma(),j=c.luma();return e=g>i?(g+.05)/(i+.05):(i+.05)/(g+.05),f=g>j?(g+.05)/(j+.05):(j+.05)/(g+.05),e>f?b:c},argb:function(a){return new l(a.toARGB())},color:function(a){if(a instanceof k&&/^#([a-f0-9]{6}|[a-f0-9]{3})$/i.test(a.value))return new j(a.value.slice(1));if(a instanceof j||(a=j.fromKeyword(a.value)))return a.value=void 0,a;throw{type:"Argument",message:"argument must be a color keyword or 3/6 digit hex e.g. #FFF"}},tint:function(a,b){return h.mix(h.rgb(255,255,255),a,b)},shade:function(a,b){return h.mix(h.rgb(0,0,0),a,b)}},m.addMultiple(h)},{"../tree/anonymous":47,"../tree/color":52,"../tree/dimension":59,"../tree/quoted":76,"./function-registry":24}],21:[function(a,b,c){b.exports=function(b){var c=a("../tree/quoted"),d=a("../tree/url"),e=a("./function-registry"),f=function(a,b){return new d(b,a.index,a.currentFileInfo).eval(a.context)},g=a("../logger");e.add("data-uri",function(a,e){e||(e=a,a=null);var h=a&&a.value,i=e.value,j=this.currentFileInfo,k=j.relativeUrls?j.currentDirectory:j.entryPath,l=i.indexOf("#"),m="";l!==-1&&(m=i.slice(l),i=i.slice(0,l));var n=b.getFileManager(i,k,this.context,b,!0);if(!n)return f(this,e);var o=!1;if(a)o=/;base64$/.test(h);else{if(h=b.mimeLookup(i),"image/svg+xml"===h)o=!1;else{var p=b.charsetLookup(h);o=["US-ASCII","UTF-8"].indexOf(p)<0}o&&(h+=";base64")}var q=n.loadFileSync(i,k,this.context,b);if(!q.contents)return g.warn("Skipped data-uri embedding of "+i+" because file not found"),f(this,e||a);var r=q.contents;if(o&&!b.encodeBase64)return f(this,e);r=o?b.encodeBase64(r):encodeURIComponent(r);var s="data:"+h+","+r+m,t=32768;return s.length>=t&&this.context.ieCompat!==!1?(g.warn("Skipped data-uri embedding of "+i+" because its size ("+s.length+" characters) exceeds IE8-safe "+t+" characters!"),f(this,e||a)):new d(new c('"'+s+'"',s,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../logger":35,"../tree/quoted":76,"../tree/url":83,"./function-registry":24}],22:[function(a,b,c){var d=a("../tree/keyword"),e=a("./function-registry"),f={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;if(null!=a)return a?d.True:d.False},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}};e.add("default",f.eval.bind(f)),b.exports=f},{"../tree/keyword":68,"./function-registry":24}],23:[function(a,b,c){var d=a("../tree/expression"),e=function(a,b,c,d){this.name=a.toLowerCase(),this.index=c,this.context=b,this.currentFileInfo=d,this.func=b.frames[0].functionRegistry.get(this.name)};e.prototype.isValid=function(){return Boolean(this.func)},e.prototype.call=function(a){return Array.isArray(a)&&(a=a.filter(function(a){return"Comment"!==a.type}).map(function(a){if("Expression"===a.type){var b=a.value.filter(function(a){return"Comment"!==a.type});return 1===b.length?b[0]:new d(b)}return a})),this.func.apply(this,a)},b.exports=e},{"../tree/expression":62}],24:[function(a,b,c){function d(a){return{_data:{},add:function(a,b){a=a.toLowerCase(),this._data.hasOwnProperty(a),this._data[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){this.add(b,a[b])}.bind(this))},get:function(b){return this._data[b]||a&&a.get(b)},getLocalFunctions:function(){return this._data},inherit:function(){return d(this)},create:function(a){return d(a)}}}b.exports=d(null)},{}],25:[function(a,b,c){b.exports=function(b){var c={functionRegistry:a("./function-registry"),functionCaller:a("./function-caller")};return a("./default"),a("./color"),a("./color-blending"),a("./data-uri")(b),a("./math"),a("./number"),a("./string"),a("./svg")(b),a("./types"),c}},{"./color":20,"./color-blending":19,"./data-uri":21,"./default":22,"./function-caller":23,"./function-registry":24,"./math":27,"./number":28,"./string":29,"./svg":30,"./types":31}],26:[function(a,b,c){var d=a("../tree/dimension"),e=function(){};e._math=function(a,b,c){if(!(c instanceof d))throw{type:"Argument",message:"argument must be a number"};return null==b?b=c.unit:c=c.unify(),new d(a(parseFloat(c.value)),b)},b.exports=e},{"../tree/dimension":59}],27:[function(a,b,c){var d=a("./function-registry"),e=a("./math-helper.js"),f={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"};for(var g in f)f.hasOwnProperty(g)&&(f[g]=e._math.bind(null,Math[g],f[g]));f.round=function(a,b){ -var c="undefined"==typeof b?0:b.value;return e._math(function(a){return a.toFixed(c)},null,a)},d.addMultiple(f)},{"./function-registry":24,"./math-helper.js":26}],28:[function(a,b,c){var d=a("../tree/dimension"),e=a("../tree/anonymous"),f=a("./function-registry"),g=a("./math-helper.js"),h=function(a,b){switch(b=Array.prototype.slice.call(b),b.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var c,f,g,h,i,j,k,l,m=[],n={};for(c=0;ci.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(b[c].value)&&Array.prototype.push.apply(b,Array.prototype.slice.call(b[c].value));return 1==m.length?m[0]:(b=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new e((a?"min":"max")+"("+b+")"))};f.addMultiple({min:function(){return h(!0,arguments)},max:function(){return h(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new d(Math.PI)},mod:function(a,b){return new d(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d(a),b=new d(b);else if(!(a instanceof d&&b instanceof d))throw{type:"Argument",message:"arguments must be numbers"};return new d(Math.pow(a.value,b.value),a.unit)},percentage:function(a){var b=g._math(function(a){return 100*a},"%",a);return b}})},{"../tree/anonymous":47,"../tree/dimension":59,"./function-registry":24,"./math-helper.js":26}],29:[function(a,b,c){var d=a("../tree/quoted"),e=a("../tree/anonymous"),f=a("../tree/javascript"),g=a("./function-registry");g.addMultiple({e:function(a){return new e(a instanceof f?a.evaluated:a.value)},escape:function(a){return new e(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,b,c,e){var f=a.value;return c="Quoted"===c.type?c.value:c.toCSS(),f=f.replace(new RegExp(b.value,e?e.value:""),c),new d(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;e",k=0;k";return j+="',j=encodeURIComponent(j),j="data:image/svg+xml,"+j,new g(new f("'"+j+"'",j,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":52,"../tree/dimension":59,"../tree/expression":62,"../tree/quoted":76,"../tree/url":83,"./function-registry":24}],31:[function(a,b,c){var d=a("../tree/keyword"),e=a("../tree/detached-ruleset"),f=a("../tree/dimension"),g=a("../tree/color"),h=a("../tree/quoted"),i=a("../tree/anonymous"),j=a("../tree/url"),k=a("../tree/operation"),l=a("./function-registry"),m=function(a,b){return a instanceof b?d.True:d.False},n=function(a,b){if(void 0===b)throw{type:"Argument",message:"missing the required second argument to isunit."};if(b="string"==typeof b.value?b.value:b,"string"!=typeof b)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof f&&a.unit.is(b)?d.True:d.False},o=function(a){var b=Array.isArray(a.value)?a.value:Array(a);return b};l.addMultiple({isruleset:function(a){return m(a,e)},iscolor:function(a){return m(a,g)},isnumber:function(a){return m(a,f)},isstring:function(a){return m(a,h)},iskeyword:function(a){return m(a,d)},isurl:function(a){return m(a,j)},ispixel:function(a){return n(a,"px")},ispercentage:function(a){return n(a,"%")},isem:function(a){return n(a,"em")},isunit:n,unit:function(a,b){if(!(a instanceof f))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof k?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d?b.value:b.toCSS():"",new f(a.value,b)},"get-unit":function(a){return new i(a.unit)},extract:function(a,b){return b=b.value-1,o(a)[b]},length:function(a){return new f(o(a).length)}})},{"../tree/anonymous":47,"../tree/color":52,"../tree/detached-ruleset":58,"../tree/dimension":59,"../tree/keyword":68,"../tree/operation":74,"../tree/quoted":76,"../tree/url":83,"./function-registry":24}],32:[function(a,b,c){var d=a("./contexts"),e=a("./parser/parser"),f=a("./less-error");b.exports=function(a){var b=function(a,b,c){this.less=a,this.rootFilename=c.filename,this.paths=b.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=b.mime,this.error=null,this.context=b,this.queue=[],this.files={}};return b.prototype.push=function(b,c,g,h,i){var j=this,k=this.context.pluginManager.Loader;this.queue.push(b);var l=function(a,c,d){j.queue.splice(j.queue.indexOf(b),1);var e=d===j.rootFilename;h.optional&&a?i(null,{rules:[]},!1,null):(j.files[d]=c,a&&!j.error&&(j.error=a),i(a,c,e,d))},m={relativeUrls:this.context.relativeUrls,entryPath:g.entryPath,rootpath:g.rootpath,rootFilename:g.rootFilename},n=a.getFileManager(b,g.currentDirectory,this.context,a);if(!n)return void l({message:"Could not find a file-manager for "+b});c&&(b=h.isPlugin?b:n.tryAppendExtension(b,".less"));var o,p=function(a){var b,c=a.filename,i=a.contents.replace(/^\uFEFF/,"");m.currentDirectory=n.getPath(c),m.relativeUrls&&(m.rootpath=n.join(j.context.rootpath||"",n.pathDiff(m.currentDirectory,m.entryPath)),!n.isPathAbsolute(m.rootpath)&&n.alwaysMakePathsAbsolute()&&(m.rootpath=n.join(m.entryPath,m.rootpath))),m.filename=c;var o=new d.Parse(j.context);o.processImports=!1,j.contents[c]=i,(g.reference||h.reference)&&(m.reference=!0),h.isPlugin?(b=k.evalPlugin(i,o,h.pluginArgs,m),b instanceof f?l(b,null,c):l(null,b,c)):h.inline?l(null,i,c):new e(o,j,m).parse(i,function(a,b){l(a,b,c)})},q=function(a,b){a?l(a):p(b)};if(h.isPlugin)try{k.tryLoadPlugin(b,g.currentDirectory,q)}catch(r){i(r)}else o=n.loadFile(b,g.currentDirectory,this.context,a,q),o&&o.then(p,l)},b}},{"./contexts":12,"./less-error":34,"./parser/parser":40}],33:[function(a,b,c){b.exports=function(b,c){var d,e,f,g,h,i={version:[3,0,0],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),AbstractPluginLoader:a("./environment/abstract-plugin-loader"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")};return i}},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":16,"./environment/abstract-plugin-loader":17,"./environment/environment":18,"./functions":25,"./import-manager":32,"./less-error":34,"./logger":35,"./parse":37,"./parse-tree":36,"./parser/parser":40,"./plugin-manager":41,"./render":42,"./source-map-builder":43,"./source-map-output":44,"./transform-tree":45,"./tree":65,"./utils":86,"./visitors":90}],34:[function(a,b,c){var d=a("./utils"),e=b.exports=function(a,b,c){Error.call(this);var e=a.filename||c;if(b&&e){var f=b.contents[e],g=d.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&d.getLocation(a.call,f).line,k=f.split("\n");this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.callLine=j+1,this.callExtract=k[j],this.column=i,this.extract=[k[h-1],k[h],k[h+1]]}this.message=a.message,this.stack=a.stack};if("undefined"==typeof Object.create){var f=function(){};f.prototype=Error.prototype,e.prototype=new f}else e.prototype=Object.create(Error.prototype);e.prototype.constructor=e},{"./utils":86}],35:[function(a,b,c){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;b=97&&j<=122||j<34))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(h96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;hd&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],39:[function(a,b,c){var d=a("./chunker");b.exports=function(){function a(d){for(var e,f,j,p=k.i,q=c,s=k.i-i,t=k.i+h.length-s,u=k.i+=d,v=b;k.i=0){j={index:k.i,text:v.substr(k.i,x+2-k.i),isLineComment:!1},k.i+=j.text.length-1,k.commentStore.push(j);continue}}break}if(e!==l&&e!==n&&e!==m&&e!==o)break}if(h=h.slice(d+k.i-u+s),i=k.i,!h.length){if(ce||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,c=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$re=function(b){k.i>i&&(h=h.slice(k.i-i),i=k.i);var c=b.exec(h);return c?(a(c[0].length),"string"==typeof c?c:1===c.length?c[0]:c):null},k.$char=function(c){return b.charAt(k.i)!==c?null:(a(1),c)},k.$str=function(c){for(var d=c.length,e=0;es||a=b.length;return k.i=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":38}],40:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=function j(a,b,c){function i(a,e){throw new d({index:o.i,filename:c.filename,type:e||"Syntax",message:a},b)}function k(a,b,c){var d=a instanceof Function?a.call(n):o.$re(a);return d?d:void i(b||("string"==typeof a?"expected '"+a+"' got '"+o.currentChar()+"'":"unexpected token"))}function l(a,b){return o.$char(a)?a:void i(b||"expected '"+a+"' got '"+o.currentChar()+"'")}function m(a){var b=c.filename;return{lineNumber:h.getLocation(a,o.getInput()).line+1,fileName:b}}var n,o=g();return{parse:function(g,h,i){var k,l,m,n,p=null,q="";if(l=i&&i.globalVars?j.serializeVars(i.globalVars)+"\n":"",m=i&&i.modifyVars?"\n"+j.serializeVars(i.modifyVars):"",a.pluginManager)for(var r=a.pluginManager.getPreProcessors(),s=0;s1&&(b=new e.Value(g)),d.push(b),g=[])}return o.forget(),a?d:f},literal:function(){return this.dimension()||this.color()||this.quoted()||this.unicodeDescriptor()},assignment:function(){var a,b;return o.save(),(a=o.$re(/^\w+(?=\s?=)/i))&&o.$char("=")&&(b=n.entity())?(o.forget(),new e.Assignment(a,b)):void o.restore()},url:function(){var a,b=o.i;return o.autoCommentAbsorb=!1,o.$str("url(")?(a=this.quoted()||this.variable()||o.$re(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",o.autoCommentAbsorb=!0,l(")"),new e.URL(null!=a.value||a instanceof e.Variable?a:new e.Anonymous(a),b,c)):void(o.autoCommentAbsorb=!0)},variable:function(){var a,b=o.i;if("@"===o.currentChar()&&(a=o.$re(/^@@?[\w-]+/)))return new e.Variable(a,b,c)},variableCurly:function(){var a,b=o.i;if("@"===o.currentChar()&&(a=o.$re(/^@\{([\w-]+)\}/)))return new e.Variable("@"+a[1],b,c)},color:function(){var a;if("#"===o.currentChar()&&(a=o.$re(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))){var b=a.input.match(/^#([\w]+).*/);return b=b[1],b.match(/^[A-Fa-f0-9]+$/)||i("Invalid HEX color code"),new e.Color(a[1],(void 0),"#"+b)}},colorKeyword:function(){o.save();var a=o.autoCommentAbsorb;o.autoCommentAbsorb=!1;var b=o.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/);if(o.autoCommentAbsorb=a,!b)return void o.forget();o.restore();var c=e.Color.fromKeyword(b);return c?(o.$str(b),c):void 0},dimension:function(){if(!o.peekNotNumeric()){var a=o.$re(/^([+-]?\d*\.?\d+)(%|[a-z_]+)?/i);return a?new e.Dimension(a[1],a[2]):void 0}},unicodeDescriptor:function(){var a;if(a=o.$re(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/))return new e.UnicodeDescriptor(a[0])},javascript:function(){var a,b=o.i;o.save();var d=o.$char("~"),f=o.$char("`");return f?(a=o.$re(/^[^`]*`/))?(o.forget(),new e.JavaScript(a.substr(0,a.length-1),Boolean(d),b,c)):void o.restore("invalid javascript definition"):void o.restore()}},variable:function(){var a;if("@"===o.currentChar()&&(a=o.$re(/^(@[\w-]+)\s*:/)))return a[1]},rulesetCall:function(){var a;if("@"===o.currentChar()&&(a=o.$re(/^(@[\w-]+)\(\s*\)\s*;/)))return new e.RulesetCall(a[1])},extend:function(a){var b,d,f,g,h,j=o.i;if(o.$str(a?"&:extend(":":extend(")){do{for(f=null,b=null;!(f=o.$re(/^(all)(?=\s*(\)|,))/))&&(d=this.element());)b?b.push(d):b=[d];f=f&&f[1],b||i("Missing target selector for :extend()."),h=new e.Extend(new e.Selector(b),f,j,c),g?g.push(h):g=[h]}while(o.$char(","));return k(/^\)/),a&&k(/^;/),g}},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var a,b,d,f,g,h,i=o.currentChar(),j=!1,k=o.i;if("."===i||"#"===i){for(o.save();;){if(a=o.i,f=o.$re(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/),!f)break;d=new e.Element(g,f,a,c),b?b.push(d):b=[d],g=o.$char(">")}return b&&(o.$char("(")&&(h=this.args(!0).args,l(")")),n.important()&&(j=!0),n.end())?(o.forget(),new e.mixin.Call(b,h,k,c,j)):void o.restore()}},args:function(a){var b,c,d,f,g,h,j,k=n.entities,l={args:null,variadic:!1},m=[],p=[],q=[];for(o.save();;){if(a)h=n.detachedRuleset()||n.expression();else{if(o.commentStore.length=0,o.$str("...")){l.variadic=!0,o.$char(";")&&!b&&(b=!0),(b?p:q).push({variadic:!0});break}h=k.variable()||k.literal()||k.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var r=null;if(a?h.value&&1==h.value.length&&(r=h.value[0]):r=h,r&&r instanceof e.Variable)if(o.$char(":")){if(m.length>0&&(b&&i("Cannot mix ; and , as delimiter types"),c=!0),g=n.detachedRuleset()||n.expression(),!g){if(!a)return o.restore(),l.args=[],l;i("could not understand value for named argument")}f=d=r.name}else if(o.$str("...")){if(!a){l.variadic=!0,o.$char(";")&&!b&&(b=!0),(b?p:q).push({name:h.name,variadic:!0});break}j=!0}else a||(d=f=r.name,g=null);g&&m.push(g),q.push({name:f,value:g,expand:j}),o.$char(",")||(o.$char(";")||b)&&(c&&i("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),p.push({name:d,value:g,expand:j}),d=null,m=[],c=!1)}return o.forget(),l.args=b?p:q,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==o.currentChar()&&"#"!==o.currentChar()||o.peek(/^[^{]*\}/)))if(o.save(),b=o.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!o.$char(")"))return void o.restore("Missing closing ')'");if(o.commentStore.length=0,o.$str("when")&&(d=k(n.conditions,"expected condition")),c=n.block())return o.forget(),new e.mixin.Definition(a,f,c,d,g);o.restore()}else o.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.call()||a.keyword()||a.javascript()},end:function(){return o.$char(";")||o.peek("}")},alpha:function(){var a;if(o.$re(/^opacity=/i))return a=o.$re(/^\d+/),a||(a=k(this.entities.variable,"Could not parse alpha")),l(")"),new e.Alpha(a)},element:function(){var a,b,d,f=o.i;if(b=this.combinator(),a=o.$re(/^(?:\d+\.\d+|\d+)%/)||o.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||o.$char("*")||o.$char("&")||this.attribute()||o.$re(/^\([^&()@]+\)/)||o.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(o.save(),o.$char("(")?(d=this.selector())&&o.$char(")")?(a=new e.Paren(d),o.forget()):o.restore("Missing closing ')'"):o.forget()),a)return new e.Element(b,a,f,c)},combinator:function(){var a=o.currentChar();if("/"===a){o.save();var b=o.$re(/^\/[a-z]+\//i);if(b)return o.forget(),new e.Combinator(b);o.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(o.i++,"^"===a&&"^"===o.currentChar()&&(a="^^",o.i++);o.isWhitespace();)o.i++;return new e.Combinator(a)}return new e.Combinator(o.isWhitespace(-1)?" ":null)},lessSelector:function(){return this.selector(!0)},selector:function(a){for(var b,d,f,g,h,j,l,m=o.i;(a&&(d=this.extend())||a&&(j=o.$str("when"))||(g=this.element()))&&(j?l=k(this.conditions,"expected condition"):l?i("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&i("Extend can only be used at the end of selector"),f=o.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,l,m,c):void(h&&i("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(o.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=k(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=o.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||o.$re(/^[0-9]+%/)||o.$re(/^[\w-]+/)||d.variableCurly()),l("]"),new e.Attribute(a,c,b)}},block:function(){var a;if(o.$char("{")&&(a=this.primary())&&o.$char("}"))return a},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();if(a)return new e.DetachedRuleset(a)},ruleset:function(){var b,c,d,f;for(o.save(),a.dumpLineNumbers&&(f=m(o.i));;){if(c=this.lessSelector(),!c)break;if(b?b.push(c):b=[c],o.commentStore.length=0,c.condition&&b.length>1&&i("Guards are only currently allowed on a single selector."),!o.$char(","))break;c.condition&&i("Guards are only currently allowed on a single selector."),o.commentStore.length=0}if(b&&(d=this.block())){o.forget();var g=new e.Ruleset(b,d,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}o.restore()},declaration:function(b){var d,f,g,h,i,j=o.i,k=o.currentChar();if("."!==k&&"#"!==k&&"&"!==k&&":"!==k)if(o.save(),d=this.variable()||this.ruleProperty()){if(i="string"==typeof d,i&&(f=this.detachedRuleset()),o.commentStore.length=0,!f){h=!i&&d.length>1&&d.pop().value;var l=!b&&(a.compress||i);if(l&&(f=this.value()),!f&&(f=this.anonymousValue()))return o.forget(),new e.Declaration(d,f,(!1),h,j,c);l||f||(f=this.value()),g=this.important()}if(f&&this.end())return o.forget(),new e.Declaration(d,f,g,h,j,c);if(o.restore(),f&&!b)return this.declaration(!0)}else o.forget()},anonymousValue:function(){var a=o.$re(/^([^@+\/'"*`(;{}-]*);/);if(a)return new e.Anonymous(a[1])},"import":function(){var a,b,d=o.i,f=o.$re(/^@import?\s+/);if(f){var g=(f?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),o.$char(";")||(o.i=d,i("missing semi-colon or unrecognised media features on import")),b=b&&new e.Value(b),new e.Import(a,b,g,d,c);o.i=d,i("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!o.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!o.$char(","))break}while(a);return l(")"),d},importOption:function(){var a=o.$re(/^(less|css|multiple|once|inline|reference|optional)/);if(a)return a[1]},mediaFeature:function(){var a,b,d=this.entities,f=[];o.save();do a=d.keyword()||d.variable(),a?f.push(a):o.$char("(")&&(b=this.property(),a=this.value(),o.$char(")")?b&&a?f.push(new e.Paren(new e.Declaration(b,a,null,null,o.i,c,(!0)))):a?f.push(new e.Paren(a)):i("badly formed media feature definition"):i("Missing closing ')'","Parse"));while(a);if(o.forget(),f.length>0)return new e.Expression(f)},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!o.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!o.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=o.i;return a.dumpLineNumbers&&(g=m(h)),o.save(),o.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||i("media definitions require block statements after any features"),o.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void o.restore()},plugin:function(){var a,b,d,f=o.i,g=o.$re(/^@plugin?\s+/);if(g){if(b=this.pluginArgs(),d=b?{pluginArgs:b,isPlugin:!0}:{isPlugin:!0},a=this.entities.quoted()||this.entities.url())return o.$char(";")||(o.i=f,i("missing semi-colon on @plugin")),new e.Import(a,null,d,f,c);o.i=f,i("malformed @plugin statement")}},pluginArgs:function(){if(o.save(),!o.$char("("))return o.restore(),null;var a=o.$re(/^\s*([^\);]+)\)\s*/);return a[1]?(o.forget(),a[1].trim()):(o.restore(),null)},atrule:function(){var b,d,f,g,h,j,k,l=o.i,n=!0,p=!0;if("@"===o.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(o.save(),b=o.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,n=!1;break;case"@namespace":j=!0,n=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,p=!1;break;default:k=!0}return o.commentStore.length=0,h?(d=this.entity(),d||i("expected "+b+" identifier")):j?(d=this.expression(),d||i("expected "+b+" expression")):k&&(d=(o.$re(/^[^{;]+/)||"").trim(),n="{"==o.currentChar(),d&&(d=new e.Anonymous(d))),n&&(f=this.blockRuleset()),f||!n&&d&&o.$char(";")?(o.forget(),new e.AtRule(b,d,f,l,c,a.dumpLineNumbers?m(l):null,p)):void o.restore("at-rule options not recognised")}}},value:function(){var a,b=[];do if(a=this.expression(),a&&(b.push(a),!o.$char(",")))break;while(a);if(b.length>0)return new e.Value(b)},important:function(){if("!"===o.currentChar())return o.$re(/^! *important/)},sub:function(){var a,b;return o.save(),o.$char("(")?(a=this.addition(),a&&o.$char(")")?(o.forget(),b=new e.Expression([a]),b.parens=!0,b):void o.restore("Expected ')'")):void o.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=o.isWhitespace(-1);;){if(o.peek(/^\/[*\/]/))break;if(o.save(),c=o.$char("/")||o.$char("*"),!c){o.forget();break}if(b=this.operand(),!b){o.restore();break}o.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=o.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=o.isWhitespace(-1);;){if(c=o.$re(/^[-+]\s+/)||!f&&(o.$char("+")||o.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=o.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=o.i;if(a=this.condition()){for(;;){if(!o.peek(/^,\s*(not\s*)?\(/)||!o.$char(","))break;if(b=this.condition(),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(){function a(){return o.$str("or")}var b,c,d;if(b=this.conditionAnd(this)){if(c=a()){if(d=this.condition(),!d)return;b=new e.Condition(c,b,d)}return b}},conditionAnd:function(){function a(a){return a.negatedCondition()||a.parenthesisCondition()}function b(){return o.$str("and")}var c,d,f;if(c=a(this)){if(d=b()){if(f=this.conditionAnd(),!f)return;c=new e.Condition(d,c,f)}return c}},negatedCondition:function(){if(o.$str("not")){var a=this.parenthesisCondition();return a&&(a.negate=!a.negate),a}},parenthesisCondition:function(){ -function a(a){var b;return o.save(),(b=a.condition())&&o.$char(")")?(o.forget(),b):void o.restore()}var b;return o.save(),o.$str("(")?(b=a(this))?(o.forget(),b):(b=this.atomicCondition())?o.$char(")")?(o.forget(),b):void o.restore("expected ')' got '"+o.currentChar()+"'"):void o.restore():void o.restore()},atomicCondition:function(){var a,b,c,d,f=this.entities,g=o.i;if(a=this.addition()||f.keyword()||f.quoted())return o.$char(">")?d=o.$char("=")?">=":">":o.$char("<")?d=o.$char("=")?"<=":"<":o.$char("=")&&(d=o.$char(">")?"=>":o.$char("<")?"=<":"="),d?(b=this.addition()||f.keyword()||f.quoted(),b?c=new e.Condition(d,a,b,g,(!1)):i("expected expression")):c=new e.Condition("=",a,new e.Keyword("true"),g,(!1)),c},operand:function(){var a,b=this.entities;o.peek(/^-[@\(]/)&&(a=o.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.call()||b.colorKeyword();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[];do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),o.peek(/^\/[\/*]/)||(b=o.$char("/"),b&&c.push(new e.Anonymous(b)))));while(a);if(c.length>0)return new e.Expression(c)},property:function(){var a=o.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(a)return a[1]},ruleProperty:function(){function a(a){var b=o.i,c=o.$re(a);if(c)return g.push(b),f.push(c[1])}var b,d,f=[],g=[];o.save();var h=o.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],o.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:@\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(o.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;d=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},f.prototype.addPostProcessor=function(a,b){var c;for(c=0;c=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},f.prototype.addFileManager=function(a){this.fileManagers.push(a)},f.prototype.getPreProcessors=function(){for(var a=[],b=0;b0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],45:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Declaration("@"+a,b,(!1),null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j,k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor((!0)),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager)for(j=b.pluginManager.visitor(),j.first();i=j.get();)i.isPreEvalVisitor&&i.run(a);c=a.eval(h);for(var l=0;l.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(d="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":73}],56:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],57:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;c-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&c<1&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":15,"./color":52,"./node":73,"./unit":82}],60:[function(a,b,c){var d=a("./atrule"),e=function(){var a=Array.prototype.slice.call(arguments);d.apply(this,a)};e.prototype=Object.create(d.prototype),e.prototype.constructor=e,b.exports=e},{"./atrule":49}],61:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./combinator"),g=function(a,b,c,d,e){this.combinator=a instanceof f?a:new f(a),this.value="string"==typeof b?b.trim():b?b:"",this._index=c,this._fileInfo=d,this.copyVisibilityInfo(e),this.setParent(this.combinator,this)};g.prototype=new d,g.prototype.type="Element",g.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},g.prototype.eval=function(a){return new g(this.combinator,this.value.eval?this.value.eval(a):this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.fileInfo(),this.getIndex())},g.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof e&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=g},{"./combinator":53,"./node":73,"./paren":75}],62:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./comment"),g=function(a){if(this.value=a,!a)throw new Error("Expression requires an array parameter")};g.prototype=new d,g.prototype.type="Expression",g.prototype.accept=function(a){this.value=a.visitArray(this.value)},g.prototype.eval=function(a){var b,c=this.parens&&!this.parensInOp,d=!1;return c&&a.inParenthesis(),this.value.length>1?b=new g(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(d=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!d&&(b=new e(b)),b},g.prototype.genCSS=function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":73,"./selector":80}],64:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=a("../utils"),k=function(a,b,c,d,e,f){if(this.options=c,this._index=d,this._fileInfo=e,this.path=a,this.features=b,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?\/]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f),this.setParent(this.features,this),this.setParent(this.path,this)};k.prototype=new d,k.prototype.type="Import",k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.isPlugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},k.prototype.genCSS=function(a,b){this.css&&void 0===this.path._fileInfo.reference&&(b.add("@import ",this._fileInfo,this._index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},k.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},k.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),!(a instanceof g)||a.containsVariables()},k.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new k(b.eval(a),this.features,this.options,this._index,this._fileInfo,this.visibilityInfo())},k.prototype.evalPath=function(a){var b=this.path.eval(a),c=this._fileInfo&&this._fileInfo.rootpath;if(!(b instanceof f)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d)}b.value=a.normalizePath(b.value)}return b},k.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){a.addVisibilityBlock()}):b.addVisibilityBlock()),b},k.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a);if(this.options.isPlugin)return this.root&&this.root.eval&&this.root.eval(a),c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[];if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var f=new i(this.root,0,{filename:this.importedFilename,reference:this.path._fileInfo&&this.path._fileInfo.reference},(!0),(!0));return this.features?new e([f],this.features.value):[f]}if(this.css){var g=new k(this.evalPath(a),d,this.options,this._index);if(!g.css&&this.error)throw this.error;return g}return b=new h(null,j.copyArray(this.root.rules)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=k},{"../utils":86,"./anonymous":47,"./media":69,"./node":73,"./quoted":76,"./ruleset":79,"./url":83}],65:[function(a,b,c){var d={};d.Node=a("./node"),d.Alpha=a("./alpha"),d.Color=a("./color"),d.AtRule=a("./atrule"),d.Directive=a("./directive"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Declaration=a("./declaration"),d.Rule=a("./rule"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.RulesetCall=a("./ruleset-call"),b.exports=d},{"./alpha":46,"./anonymous":47,"./assignment":48,"./atrule":49,"./attribute":50,"./call":51,"./color":52,"./combinator":53,"./comment":54,"./condition":55,"./declaration":57,"./detached-ruleset":58,"./dimension":59,"./directive":60,"./element":61,"./expression":62,"./extend":63,"./import":64,"./javascript":66,"./keyword":68,"./media":69,"./mixin-call":70,"./mixin-definition":71,"./negative":72,"./node":73,"./operation":74,"./paren":75,"./quoted":76,"./rule":77,"./ruleset":79,"./ruleset-call":78,"./selector":80,"./unicode-descriptor":81,"./unit":82,"./url":83,"./value":84,"./variable":85}],66:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this._index=c,this._fileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new e(b):"string"==typeof b?new f('"'+b+'"',b,this.escaped,this._index):new g(Array.isArray(b)?b.join(", "):b); -},b.exports=h},{"./anonymous":47,"./dimension":59,"./js-eval-node":67,"./quoted":76}],67:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(!b.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.fileInfo().filename,index:this.getIndex()};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.getIndex(),d.fileInfo()).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.fileInfo().filename,index:this.getIndex()}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.fileInfo().filename,index:this.getIndex()}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":73,"./variable":85}],68:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":73}],69:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./atrule"),j=a("../utils"),k=function(a,b,c,g,h){this._index=c,this._fileInfo=g;var i=new f([],null,null,this._index,this._fileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0,this.setParent(i,this),this.setParent(this.features,this),this.setParent(this.rules,this)};k.prototype=new i,k.prototype.type="Media",k.prototype.isRulesetLike=!0,k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},k.prototype.genCSS=function(a,b){b.add("@media ",this._fileInfo,this._index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},k.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new k(null,[],this._index,this._fileInfo,this.visibilityInfo());this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo);var c=!1;a.strictMath||(c=!0,a.strictMath=!0);try{b.features=this.features.eval(a)}finally{c&&(a.strictMath=!1)}return a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},k.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo()),this.setParent(b,this)}return delete a.mediaBlocks,delete a.mediaPath,b},k.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;b0;b--)a.splice(b,0,new g("and"));return new h(a)})),this.setParent(this.features,this),new d([],[])},k.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(n=!0,k=0;k0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.getIndex(),filename:this.fileInfo().filename};for(k=0;kthis.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;gb?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],74:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};g.prototype=new d,g.prototype.type="Operation",g.prototype.accept=function(a){this.operands=a.visit(this.operands)},g.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof f&&c instanceof e&&(b=b.toColor()),c instanceof f&&b instanceof e&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new g(this.op,[b,c],this.isSpaced)},g.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=g},{"./color":52,"./dimension":59,"./node":73}],75:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":73}],76:[function(a,b,c){var d=a("./node"),e=a("./js-eval-node"),f=a("./variable"),g=function(a,b,c,d,e){this.escaped=null==c||c,this.value=b||"",this.quote=a.charAt(0),this._index=d,this._fileInfo=e};g.prototype=new e,g.prototype.type="Quoted",g.prototype.genCSS=function(a,b){this.escaped||b.add(this.quote,this.fileInfo(),this.getIndex()),b.add(this.value),this.escaped||b.add(this.quote)},g.prototype.containsVariables=function(){return this.value.match(/(`([^`]+)`)|@\{([\w-]+)\}/)},g.prototype.eval=function(a){function b(a,b,c){var d=a;do a=d,d=a.replace(b,c);while(a!==d);return d}var c=this,d=this.value,e=function(b,d){return String(c.evaluateJavaScript(d,a))},h=function(b,d){var e=new f("@"+d,c.getIndex(),c.fileInfo()).eval(a,!0);return e instanceof g?e.value:e.toCSS()};return d=b(d,/`([^`]+)`/g,e),d=b(d,/@\{([\w-]+)\}/g,h),new g(this.quote+d+this.quote,d,this.escaped,this.getIndex(),this.fileInfo())},g.prototype.compare=function(a){return"Quoted"!==a.type||this.escaped||a.escaped?a.toCSS&&this.toCSS()===a.toCSS()?0:void 0:d.numericCompare(this.value,a.value)},b.exports=g},{"./js-eval-node":67,"./node":73,"./variable":85}],77:[function(a,b,c){var d=a("./declaration"),e=function(){var a=Array.prototype.slice.call(arguments);d.apply(this,a)};e.prototype=Object.create(d.prototype),e.prototype.constructor=e,b.exports=e},{"./declaration":57}],78:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(a){this.variable=a,this.allowRoot=!0};f.prototype=new d,f.prototype.type="RulesetCall",f.prototype.eval=function(a){var b=new e(this.variable).eval(a);return b.callEval(a)},b.exports=f},{"./node":73,"./variable":85}],79:[function(a,b,c){var d=a("./node"),e=a("./declaration"),f=a("./selector"),g=a("./element"),h=a("./paren"),i=a("../contexts"),j=a("../functions/function-registry"),k=a("../functions/default"),l=a("./debug-info"),m=a("../utils"),n=function(a,b,c,d){this.selectors=a,this.rules=b,this._lookups={},this.strictImports=c,this.copyVisibilityInfo(d),this.allowRoot=!0,this.setParent(this.selectors,this),this.setParent(this.rules,this)};n.prototype=new d,n.prototype.type="Ruleset",n.prototype.isRuleset=!0,n.prototype.isRulesetLike=!0,n.prototype.accept=function(a){this.paths?this.paths=a.visitArray(this.paths,!0):this.selectors&&(this.selectors=a.visitArray(this.selectors)),this.rules&&this.rules.length&&(this.rules=a.visitArray(this.rules))},n.prototype.eval=function(a){var b,c,f,g,h=this.selectors,i=!1;if(h&&(c=h.length)){for(b=new Array(c),k.error({type:"Syntax",message:"it is currently only allowed in parametric mixin guards,"}),g=0;gd){if(!c||c(h)){e=h.find(new f(a.elements.slice(d)),b,c);for(var j=0;j0&&b.add(m),a.firstSelector=!0,i[0].genCSS(a,b),a.firstSelector=!1,f=1;f0?(e=m.copyArray(a),f=e.pop(),h=d.createDerived(m.copyArray(f.elements))):h=d.createDerived([]),b.length>0){var i=c.combinator,j=b[0].elements[0];i.emptyOrWhitespace&&!j.combinator.emptyOrWhitespace&&(i=j.combinator),h.elements.push(new g(i,j.value,c._index,c._fileInfo)),h.elements=h.elements.concat(b[0].elements.slice(1))}if(0!==h.elements.length&&e.push(h),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function j(a,b,c,d,e){var f;for(f=0;f0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new f(a))}}function l(a,b,c){function f(a){var b;return"Paren"!==a.value.type?null:(b=a.value.value,"Selector"!==b.type?null:b)}var h,m,n,o,p,q,r,s,t,u,v=!1;for(o=[],p=[[]],h=0;h0&&r[0].elements.push(new g(s.combinator,"",s._index,s._fileInfo)),q.push(r);else for(n=0;n0&&(a.push(p[h]),u=p[h][t-1],p[h][t-1]=u.createDerived(u.elements,c.extendList));return v}function n(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var o,p,q;if(p=[],q=l(p,b,c),!q)if(b.length>0)for(p=[],o=0;o0)for(b=0;b=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}},copyArray:function(a){var b,c=a.length,d=new Array(c);for(b=0;b=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.fileInfo(),b),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitDeclaration:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;e0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return k0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitAtRule:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitAtRuleOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=i},{"../logger":35,"../tree":65,"../utils":86,"./visitor":94}],88:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],89:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=a("../utils"),h=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};h.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,g.copyArray(this.context.frames)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.getIndex(),f.filename=a.fileInfo().filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;h0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];if(this.keepOnlyVisibleChilds(c),!this.isEmpty(c))return a.ensureVisibility(),a.removeVisibilityBlock(),a},isVisibleRuleset:function(a){return!!a.firstRoot||!this.isEmpty(a)&&!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitDeclaration:function(a,b){if(!a.blocksVisibility()&&!a.variable)return a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){if(!a.blocksVisibility()&&!a.isSilent(this._context))return a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){if(!a.blocksVisibility())return a},visitAtRule:function(a,b){return a.rules&&a.rules.length?this.visitAtRuleWithBody(a,b):this.visitAtRuleWithoutBody(a,b)},visitAtRuleWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitAtRuleWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;c0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;b=0;e--)if(c=a[e],c instanceof d.Declaration)if(f[c.name]){b=f[c.name],b instanceof d.Declaration&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);b.indexOf(g)!==-1?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b,c,e,f={},g=0;g1){c=b[0];var h=[],i=[];b.map(function(a){"+"===a.merge&&(i.length>0&&h.push(e(i)),i=[]),i.push(a)}),h.push(e(i)),c.value=g(h)}})}},visitAnonymous:function(a,b){if(!a.blocksVisibility())return a.accept(this._visitor),a}},b.exports=g},{"../tree":65,"./visitor":94}],94:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)if(a.hasOwnProperty(c))switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitFnCache=[],h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var c,e=this._visitFnCache,f=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=g;if(l.visitDeeper=!0,j||(c="visit"+a.type,j=f[c]||d,k=f[c+"Out"]||d,e[h]=j,e[i]=k),j!==d){var m=j.call(f,a,l);f.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=d&&k.call(f,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;ck){for(var b=0,c=h.length-j;b=0;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c--;c)a.unshift("..");return a}function d(a,b){if(a.filter)return a.filter(b);for(var c=[],d=0;d=-1&&!e;f--){var g=f>=0?arguments[f]:a.cwd();if("string"!=typeof g)throw new TypeError("Arguments to path.resolve must be strings");g&&(c=g+"/"+c,e="/"===g.charAt(0))}return c=b(d(c.split("/"),function(a){return!!a}),!e).join("/"),(e?"/":"")+c||"."},c.normalize=function(a){var e=c.isAbsolute(a),f="/"===g(a,-1);return a=b(d(a.split("/"),function(a){return!!a}),!e).join("/"),a||e||(a="."),a&&f&&(a+="/"),(e?"/":"")+a},c.isAbsolute=function(a){return"/"===a.charAt(0)},c.join=function(){var a=Array.prototype.slice.call(arguments,0);return c.normalize(d(a,function(a,b){if("string"!=typeof a)throw new TypeError("Arguments to path.join must be strings");return a}).join("/"))},c.relative=function(a,b){function d(a){for(var b=0;b=0&&""===a[c];c--);return b>c?[]:a.slice(b,c-b+1)}a=c.resolve(a).substr(1),b=c.resolve(b).substr(1);for(var e=d(a.split("/")),f=d(b.split("/")),g=Math.min(e.length,f.length),h=g,i=0;i1)for(var c=1;c0||b.isFileProtocol?"development":"production");var c=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(a.location.hash);c&&(b.dumpLineNumbers=c[1]),void 0===b.useFileCache&&(b.useFileCache=!0),void 0===b.onReady&&(b.onReady=!0),b.javascriptEnabled=!(!b.javascriptEnabled&&!b.inlineJavaScript)}},{"./browser":3,"./utils":11}],2:[function(a,b,c){function d(a){a.filename&&console.warn(a),e.async||h.removeChild(i)}a("promise/polyfill");var e=window.less||{};a("./add-default-options")(window,e);var f=b.exports=a("./index")(window,e);window.less=f;var g,h,i;e.onReady&&(/!watch/.test(window.location.hash)&&f.watch(),e.async||(g="body { display: none !important }",h=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),i.type="text/css",i.styleSheet?i.styleSheet.cssText=g:i.appendChild(document.createTextNode(g)),h.appendChild(i)),f.registerStylesheetsImmediately(),f.pageLoadFinished=f.refresh("development"===f.env).then(d,d))},{"./add-default-options":1,"./index":8,"promise/polyfill":101}],3:[function(a,b,c){var d=a("./utils");b.exports={createCSS:function(a,b,c){var e=c.href||"",f="less:"+(c.title||d.extractId(e)),g=a.getElementById(f),h=!1,i=a.createElement("style");i.setAttribute("type","text/css"),c.media&&i.setAttribute("media",c.media),i.id=f,i.styleSheet||(i.appendChild(a.createTextNode(b)),h=null!==g&&g.childNodes.length>0&&i.childNodes.length>0&&g.firstChild.nodeValue===i.firstChild.nodeValue);var j=a.getElementsByTagName("head")[0];if(null===g||h===!1){var k=c&&c.nextSibling||null;k?k.parentNode.insertBefore(i,k):j.appendChild(i)}if(g&&h===!1&&g.parentNode.removeChild(g),i.styleSheet)try{i.styleSheet.cssText=b}catch(l){throw new Error("Couldn't reassign styleSheet.cssText.")}},currentScript:function(a){var b=a.document;return b.currentScript||function(){var a=b.getElementsByTagName("script");return a[a.length-1]}()}}},{"./utils":11}],4:[function(a,b,c){b.exports=function(a,b,c){var d=null;if("development"!==b.env)try{d="undefined"==typeof a.localStorage?null:a.localStorage}catch(e){}return{setCSS:function(a,b,e,f){if(d){c.info("saving "+a+" to cache.");try{d.setItem(a,f),d.setItem(a+":timestamp",b),e&&d.setItem(a+":vars",JSON.stringify(e))}catch(g){c.error('failed to save "'+a+'" to local storage for caching.')}}},getCSS:function(a,b,c){var e=d&&d.getItem(a),f=d&&d.getItem(a+":timestamp"),g=d&&d.getItem(a+":vars");if(c=c||{},f&&b.lastModified&&new Date(b.lastModified).valueOf()===new Date(f).valueOf()&&(!c&&!g||JSON.stringify(c)===g))return e}}}},{}],5:[function(a,b,c){var d=a("./utils"),e=a("./browser");b.exports=function(a,b,c){function f(b,f){var g,h,i="less-error-message:"+d.extractId(f||""),j='
  • {content}
  • ',k=a.document.createElement("div"),l=[],m=b.filename||f,n=m.match(/([^\/]+(\?.*)?)$/)[1];k.id=i,k.className="less-error-message",h="

    "+(b.type||"Syntax")+"Error: "+(b.message||"There is an error in your .less file")+'

    in '+n+" ";var o=function(a,b,c){void 0!==a.extract[b]&&l.push(j.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};b.extract&&(o(b,0,""),o(b,1,"line"),o(b,2,""),h+="on line "+b.line+", column "+(b.column+1)+":

      "+l.join("")+"
    "),b.stack&&(b.extract||c.logLevel>=4)&&(h+="
    Stack Trace
    "+b.stack.split("\n").slice(1).join("
    ")),k.innerHTML=h,e.createCSS(a.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),k.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===c.env&&(g=setInterval(function(){var b=a.document,c=b.body;c&&(b.getElementById(i)?c.replaceChild(k,b.getElementById(i)):c.insertBefore(k,c.firstChild),clearInterval(g))},10))}function g(b){var c=a.document.getElementById("less-error-message:"+d.extractId(b));c&&c.parentNode.removeChild(c)}function h(a){}function i(a){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?h(a):"function"==typeof c.errorReporting&&c.errorReporting("remove",a):g(a)}function j(a,d){var e="{line} {content}",f=a.filename||d,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f+" ",i=function(a,b,c){void 0!==a.extract[b]&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.extract&&(i(a,0,""),i(a,1,"line"),i(a,2,""),h+="on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")),a.stack&&(a.extract||c.logLevel>=4)&&(h+="\nStack Trace\n"+a.stack),b.logger.error(h)}function k(a,b){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?j(a,b):"function"==typeof c.errorReporting&&c.errorReporting("add",a,b):f(a,b)}return{add:k,remove:i}}},{"./browser":3,"./utils":11}],6:[function(a,b,c){b.exports=function(b,c){var d=a("../less/environment/abstract-file-manager.js"),e={},f=function(){};return f.prototype=new d,f.prototype.alwaysMakePathsAbsolute=function(){return!0},f.prototype.join=function(a,b){return a?this.extractUrlParts(b,a).path:b},f.prototype.doXHR=function(a,d,e,f){function g(b,c,d){b.status>=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var h=new XMLHttpRequest,i=!b.isFileProtocol||b.fileAsync;"function"==typeof h.overrideMimeType&&h.overrideMimeType("text/css"),c.debug("XHR: Getting '"+a+"'"),h.open("GET",a,i),h.setRequestHeader("Accept",d||"text/x-less, text/css; q=0.9, */*; q=0.5"),h.send(null),b.isFileProtocol&&!b.fileAsync?0===h.status||h.status>=200&&h.status<300?e(h.responseText):f(h.status,a):i?h.onreadystatechange=function(){4==h.readyState&&g(h,e,f)}:g(h,e,f)},f.prototype.supports=function(a,b,c,d){return!0},f.prototype.clearFileCache=function(){e={}},f.prototype.loadFile=function(a,b,c,d,f){b&&!this.isPathAbsolute(a)&&(a=b+a),c=c||{};var g=this.extractUrlParts(a,window.location.href),h=g.url;if(c.useFileCache&&e[h])try{var i=e[h];f(null,{contents:i,filename:h,webInfo:{lastModified:new Date}})}catch(j){f({filename:h,message:"Error loading file "+h+" error was "+j.message})}else this.doXHR(h,c.mime,function(a,b){e[h]=a,f(null,{contents:a,filename:h,webInfo:{lastModified:b}})},function(a,b){f({type:"File",message:"'"+b+"' wasn't found ("+a+")",href:h})})},f}},{"../less/environment/abstract-file-manager.js":16}],7:[function(a,b,c){b.exports=function(){function b(){throw{type:"Runtime",message:"Image size functions are not supported in browser version of less"}}var c=a("./../less/functions/function-registry"),d={"image-size":function(a){return b(this,a),-1},"image-width":function(a){return b(this,a),-1},"image-height":function(a){return b(this,a),-1}};c.addMultiple(d)}},{"./../less/functions/function-registry":24}],8:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(b,c){function f(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function g(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}}function h(a){for(var b,d=l.getElementsByTagName("style"),e=0;e=c&&console.log(a)},info:function(a){b.logLevel>=d&&console.log(a)},warn:function(a){b.logLevel>=e&&console.warn(a)},error:function(a){b.logLevel>=f&&console.error(a)}}]);for(var g=0;g0&&(a=a.slice(0,b)),b=a.lastIndexOf("/"),b<0&&(b=a.lastIndexOf("\\")),b<0?"":a.slice(0,b+1)},d.prototype.tryAppendExtension=function(a,b){return/(\.[a-z]*$)|([\?;].*)$/.test(a)?a:a+b},d.prototype.tryAppendLessExtension=function(a){return this.tryAppendExtension(a,".less")},d.prototype.supportsSync=function(){return!1},d.prototype.alwaysMakePathsAbsolute=function(){return!1},d.prototype.isPathAbsolute=function(a){return/^(?:[a-z-]+:|\/|\\|#)/i.test(a)},d.prototype.join=function(a,b){return a?a+b:b},d.prototype.pathDiff=function(a,b){var c,d,e,f,g=this.extractUrlParts(a),h=this.extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;c0&&(h.splice(c-1,2),c-=2)}return g.hostPart=f[1],g.directories=h,g.path=(f[1]||"")+h.join("/"),g.filename=f[4],g.fileUrl=g.path+(f[4]||""),g.url=g.fileUrl+(f[5]||""),g},b.exports=d},{}],17:[function(a,b,c){function d(a,b){throw new f({type:b||"Syntax",message:a})}var e=a("../functions/function-registry"),f=a("../less-error"),g=function(){};g.prototype.evalPlugin=function(a,b,c,d){var f,g,h,i,j,k,l;k=b.pluginManager,d&&(l="string"==typeof d?d:d.filename);var m=(new this.less.FileManager).extractUrlParts(l).filename;if(l&&(h=k.get(l)))return this.trySetOptions(h,l,m,c),h.use&&h.use.call(this.context,h),h;i={exports:{},pluginManager:k,fileInfo:d},j=i.exports,g=e.create();try{if(f=new Function("module","require","functions","tree","fileInfo",a),h=f(i,this.require,g,this.less.tree,d),h||(h=i.exports),h=this.validatePlugin(h,l,m),!h)return new this.less.LessError({message:"Not a valid plugin"});k.addPlugin(h,d.filename,g),h.functions=g.getLocalFunctions(),this.trySetOptions(h,l,m,c),h.use&&h.use.call(this.context,h)}catch(n){return console.log(n.stack),new this.less.LessError({message:"Plugin evaluation error: '"+n.name+": "+n.message.replace(/["]/g,"'")+"'",filename:l,line:this.line,col:this.column})}return h},g.prototype.trySetOptions=function(a,b,c,e){if(e){if(!a.setOptions)return d("Options have been provided but the plugin "+c+" does not support any options."),null;try{a.setOptions(e)}catch(f){return d("Error setting options on plugin "+c+"\n"+f.message),null}}},g.prototype.validatePlugin=function(a,b,c){return a?("function"==typeof a&&(a=new a),a.minVersion&&this.compareVersion(a.minVersion,this.less.version)<0?(d("Plugin "+c+" requires version "+this.versionToString(a.minVersion)),null):a):null},g.prototype.compareVersion=function(a,b){"string"==typeof a&&(a=a.match(/^(\d+)\.?(\d+)?\.?(\d+)?/),a.shift());for(var c=0;cparseInt(b[c])?-1:1;return 0},g.prototype.versionToString=function(a){for(var b="",c=0;c=0;h--){var i=g[h];if(i[f?"supportsSync":"supports"](a,b,c,e))return i}return null},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},b.exports=e},{"../logger":35}],19:[function(a,b,c){function d(a,b,c){var d,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;l<3;l++)d=b.rgb[l]/255,f=c.rgb[l]/255,h=a(d,f),g&&(h=(j*f+i*(d-j*(d+f-h)))/g),k[l]=255*h;return new e(k,g)}var e=a("../tree/color"),f=a("./function-registry"),g={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,a<=1?g.multiply(a,b):g.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return g.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};for(var h in g)g.hasOwnProperty(h)&&(d[h]=d.bind(null,g[h]));f.addMultiple(d)},{"../tree/color":52,"./function-registry":24}],20:[function(a,b,c){function d(a){return Math.min(1,Math.max(0,a))}function e(a){return h.hsla(a.h,a.s,a.l,a.a)}function f(a){if(a instanceof i)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{type:"Argument",message:"color functions take numbers as parameters"}}function g(a,b){return a instanceof i&&a.unit.is("%")?parseFloat(a.value*b/100):f(a)}var h,i=a("../tree/dimension"),j=a("../tree/color"),k=a("../tree/quoted"),l=a("../tree/anonymous"),m=a("./function-registry");h={rgb:function(a,b,c){return h.rgba(a,b,c,1)},rgba:function(a,b,c,d){var e=[a,b,c].map(function(a){return g(a,255)});return d=f(d),new j(e,d)},hsl:function(a,b,c){return h.hsla(a,b,c,1)},hsla:function(a,b,c,e){function g(a){return a=a<0?a+1:a>1?a-1:a,6*a<1?i+(j-i)*a*6:2*a<1?j:3*a<2?i+(j-i)*(2/3-a)*6:i}var i,j;return a=f(a)%360/360,b=d(f(b)),c=d(f(c)),e=d(f(e)),j=c<=.5?c*(b+1):c+b-c*b,i=2*c-j,h.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),e)},hsv:function(a,b,c){return h.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=f(a)%360/360*360,b=f(b),c=f(c),d=f(d);var e,g;e=Math.floor(a/60%6),g=a/60-e;var i=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],j=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return h.rgba(255*i[j[e][0]],255*i[j[e][1]],255*i[j[e][2]],d)},hue:function(a){return new i(a.toHSL().h)},saturation:function(a){return new i(100*a.toHSL().s,"%")},lightness:function(a){return new i(100*a.toHSL().l,"%")},hsvhue:function(a){return new i(a.toHSV().h)},hsvsaturation:function(a){return new i(100*a.toHSV().s,"%")},hsvvalue:function(a){return new i(100*a.toHSV().v,"%")},red:function(a){return new i(a.rgb[0])},green:function(a){return new i(a.rgb[1])},blue:function(a){return new i(a.rgb[2])},alpha:function(a){return new i(a.toHSL().a)},luma:function(a){return new i(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new i(b*a.alpha*100,"%")},saturate:function(a,b,c){if(!a.rgb)return null;var f=a.toHSL();return f.s+="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},desaturate:function(a,b,c){var f=a.toHSL();return f.s-="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},lighten:function(a,b,c){var f=a.toHSL();return f.l+="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},darken:function(a,b,c){var f=a.toHSL();return f.l-="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},fadein:function(a,b,c){var f=a.toHSL();return f.a+="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fadeout:function(a,b,c){var f=a.toHSL();return f.a-="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=d(c.a),e(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=d<0?360+d:d,e(c)},mix:function(a,b,c){a.toHSL&&b.toHSL||(console.log(b.type),console.dir(b)),c||(c=new i(50));var d=c.value/100,e=2*d-1,f=a.toHSL().a-b.toHSL().a,g=((e*f==-1?e:(e+f)/(1+e*f))+1)/2,h=1-g,k=[a.rgb[0]*g+b.rgb[0]*h,a.rgb[1]*g+b.rgb[1]*h,a.rgb[2]*g+b.rgb[2]*h],l=a.alpha*d+b.alpha*(1-d);return new j(k,l)},greyscale:function(a){return h.desaturate(a,new i(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;"undefined"==typeof b&&(b=h.rgba(0,0,0,1)),"undefined"==typeof c&&(c=h.rgba(255,255,255,1));var e,f,g=a.luma(),i=b.luma(),j=c.luma();return e=g>i?(g+.05)/(i+.05):(i+.05)/(g+.05),f=g>j?(g+.05)/(j+.05):(j+.05)/(g+.05),e>f?b:c},argb:function(a){return new l(a.toARGB())},color:function(a){if(a instanceof k&&/^#([a-f0-9]{6}|[a-f0-9]{3})$/i.test(a.value))return new j(a.value.slice(1));if(a instanceof j||(a=j.fromKeyword(a.value)))return a.value=void 0,a;throw{type:"Argument",message:"argument must be a color keyword or 3/6 digit hex e.g. #FFF"}},tint:function(a,b){return h.mix(h.rgb(255,255,255),a,b)},shade:function(a,b){return h.mix(h.rgb(0,0,0),a,b)}},m.addMultiple(h)},{"../tree/anonymous":47,"../tree/color":52,"../tree/dimension":59,"../tree/quoted":77,"./function-registry":24}],21:[function(a,b,c){b.exports=function(b){var c=a("../tree/quoted"),d=a("../tree/url"),e=a("./function-registry"),f=function(a,b){return new d(b,a.index,a.currentFileInfo).eval(a.context)},g=a("../logger");e.add("data-uri",function(a,e){e||(e=a,a=null);var h=a&&a.value,i=e.value,j=this.currentFileInfo,k=j.relativeUrls?j.currentDirectory:j.entryPath,l=i.indexOf("#"),m="";l!==-1&&(m=i.slice(l),i=i.slice(0,l));var n=b.getFileManager(i,k,this.context,b,!0);if(!n)return f(this,e);var o=!1;if(a)o=/;base64$/.test(h);else{if(h=b.mimeLookup(i),"image/svg+xml"===h)o=!1;else{var p=b.charsetLookup(h);o=["US-ASCII","UTF-8"].indexOf(p)<0}o&&(h+=";base64")}var q=n.loadFileSync(i,k,this.context,b);if(!q.contents)return g.warn("Skipped data-uri embedding of "+i+" because file not found"),f(this,e||a);var r=q.contents;if(o&&!b.encodeBase64)return f(this,e);r=o?b.encodeBase64(r):encodeURIComponent(r);var s="data:"+h+","+r+m,t=32768;return s.length>=t&&this.context.ieCompat!==!1?(g.warn("Skipped data-uri embedding of "+i+" because its size ("+s.length+" characters) exceeds IE8-safe "+t+" characters!"),f(this,e||a)):new d(new c('"'+s+'"',s,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../logger":35,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],22:[function(a,b,c){var d=a("../tree/keyword"),e=a("./function-registry"),f={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;if(null!=a)return a?d.True:d.False},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}};e.add("default",f.eval.bind(f)),b.exports=f},{"../tree/keyword":68,"./function-registry":24}],23:[function(a,b,c){var d=a("../tree/expression"),e=function(a,b,c,d){this.name=a.toLowerCase(),this.index=c,this.context=b,this.currentFileInfo=d,this.func=b.frames[0].functionRegistry.get(this.name)};e.prototype.isValid=function(){return Boolean(this.func)},e.prototype.call=function(a){return Array.isArray(a)&&(a=a.filter(function(a){return"Comment"!==a.type}).map(function(a){if("Expression"===a.type){var b=a.value.filter(function(a){return"Comment"!==a.type});return 1===b.length?b[0]:new d(b)}return a})),this.func.apply(this,a)},b.exports=e},{"../tree/expression":62}],24:[function(a,b,c){function d(a){return{_data:{},add:function(a,b){a=a.toLowerCase(),this._data.hasOwnProperty(a),this._data[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){this.add(b,a[b])}.bind(this))},get:function(b){return this._data[b]||a&&a.get(b)},getLocalFunctions:function(){return this._data},inherit:function(){return d(this)},create:function(a){return d(a)}}}b.exports=d(null)},{}],25:[function(a,b,c){b.exports=function(b){var c={functionRegistry:a("./function-registry"),functionCaller:a("./function-caller")};return a("./default"),a("./color"),a("./color-blending"),a("./data-uri")(b),a("./math"),a("./number"),a("./string"),a("./svg")(b),a("./types"),c}},{"./color":20,"./color-blending":19,"./data-uri":21,"./default":22,"./function-caller":23,"./function-registry":24,"./math":27,"./number":28,"./string":29,"./svg":30,"./types":31}],26:[function(a,b,c){var d=a("../tree/dimension"),e=function(){};e._math=function(a,b,c){if(!(c instanceof d))throw{type:"Argument",message:"argument must be a number"};return null==b?b=c.unit:c=c.unify(),new d(a(parseFloat(c.value)),b)},b.exports=e},{"../tree/dimension":59}],27:[function(a,b,c){var d=a("./function-registry"),e=a("./math-helper.js"),f={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"};for(var g in f)f.hasOwnProperty(g)&&(f[g]=e._math.bind(null,Math[g],f[g]));f.round=function(a,b){var c="undefined"==typeof b?0:b.value;return e._math(function(a){return a.toFixed(c)},null,a)},d.addMultiple(f)},{"./function-registry":24,"./math-helper.js":26 +}],28:[function(a,b,c){var d=a("../tree/dimension"),e=a("../tree/anonymous"),f=a("./function-registry"),g=a("./math-helper.js"),h=function(a,b){switch(b=Array.prototype.slice.call(b),b.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var c,f,g,h,i,j,k,l,m=[],n={};for(c=0;ci.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(b[c].value)&&Array.prototype.push.apply(b,Array.prototype.slice.call(b[c].value));return 1==m.length?m[0]:(b=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new e((a?"min":"max")+"("+b+")"))};f.addMultiple({min:function(){return h(!0,arguments)},max:function(){return h(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new d(Math.PI)},mod:function(a,b){return new d(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d(a),b=new d(b);else if(!(a instanceof d&&b instanceof d))throw{type:"Argument",message:"arguments must be numbers"};return new d(Math.pow(a.value,b.value),a.unit)},percentage:function(a){var b=g._math(function(a){return 100*a},"%",a);return b}})},{"../tree/anonymous":47,"../tree/dimension":59,"./function-registry":24,"./math-helper.js":26}],29:[function(a,b,c){var d=a("../tree/quoted"),e=a("../tree/anonymous"),f=a("../tree/javascript"),g=a("./function-registry");g.addMultiple({e:function(a){return new e(a instanceof f?a.evaluated:a.value)},escape:function(a){return new e(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,b,c,e){var f=a.value;return c="Quoted"===c.type?c.value:c.toCSS(),f=f.replace(new RegExp(b.value,e?e.value:""),c),new d(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;e",k=0;k";return j+="',j=encodeURIComponent(j),j="data:image/svg+xml,"+j,new g(new f("'"+j+"'",j,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":52,"../tree/dimension":59,"../tree/expression":62,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],31:[function(a,b,c){var d=a("../tree/keyword"),e=a("../tree/detached-ruleset"),f=a("../tree/dimension"),g=a("../tree/color"),h=a("../tree/quoted"),i=a("../tree/anonymous"),j=a("../tree/url"),k=a("../tree/operation"),l=a("./function-registry"),m=function(a,b){return a instanceof b?d.True:d.False},n=function(a,b){if(void 0===b)throw{type:"Argument",message:"missing the required second argument to isunit."};if(b="string"==typeof b.value?b.value:b,"string"!=typeof b)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof f&&a.unit.is(b)?d.True:d.False},o=function(a){var b=Array.isArray(a.value)?a.value:Array(a);return b};l.addMultiple({isruleset:function(a){return m(a,e)},iscolor:function(a){return m(a,g)},isnumber:function(a){return m(a,f)},isstring:function(a){return m(a,h)},iskeyword:function(a){return m(a,d)},isurl:function(a){return m(a,j)},ispixel:function(a){return n(a,"px")},ispercentage:function(a){return n(a,"%")},isem:function(a){return n(a,"em")},isunit:n,unit:function(a,b){if(!(a instanceof f))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof k?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d?b.value:b.toCSS():"",new f(a.value,b)},"get-unit":function(a){return new i(a.unit)},extract:function(a,b){return b=b.value-1,o(a)[b]},length:function(a){return new f(o(a).length)}})},{"../tree/anonymous":47,"../tree/color":52,"../tree/detached-ruleset":58,"../tree/dimension":59,"../tree/keyword":68,"../tree/operation":74,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],32:[function(a,b,c){var d=a("./contexts"),e=a("./parser/parser"),f=a("./less-error");b.exports=function(a){var b=function(a,b,c){this.less=a,this.rootFilename=c.filename,this.paths=b.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=b.mime,this.error=null,this.context=b,this.queue=[],this.files={}};return b.prototype.push=function(b,c,g,h,i){var j=this,k=this.context.pluginManager.Loader;this.queue.push(b);var l=function(a,c,d){j.queue.splice(j.queue.indexOf(b),1);var e=d===j.rootFilename;h.optional&&a?i(null,{rules:[]},!1,null):(j.files[d]=c,a&&!j.error&&(j.error=a),i(a,c,e,d))},m={relativeUrls:this.context.relativeUrls,entryPath:g.entryPath,rootpath:g.rootpath,rootFilename:g.rootFilename},n=a.getFileManager(b,g.currentDirectory,this.context,a);if(!n)return void l({message:"Could not find a file-manager for "+b});c&&(b=h.isPlugin?b:n.tryAppendExtension(b,".less"));var o,p=function(a){var b,c=a.filename,i=a.contents.replace(/^\uFEFF/,"");m.currentDirectory=n.getPath(c),m.relativeUrls&&(m.rootpath=n.join(j.context.rootpath||"",n.pathDiff(m.currentDirectory,m.entryPath)),!n.isPathAbsolute(m.rootpath)&&n.alwaysMakePathsAbsolute()&&(m.rootpath=n.join(m.entryPath,m.rootpath))),m.filename=c;var o=new d.Parse(j.context);o.processImports=!1,j.contents[c]=i,(g.reference||h.reference)&&(m.reference=!0),h.isPlugin?(b=k.evalPlugin(i,o,h.pluginArgs,m),b instanceof f?l(b,null,c):l(null,b,c)):h.inline?l(null,i,c):new e(o,j,m).parse(i,function(a,b){l(a,b,c)})},q=function(a,b){a?l(a):p(b)};if(h.isPlugin)try{k.tryLoadPlugin(b,g.currentDirectory,q)}catch(r){i(r)}else o=n.loadFile(b,g.currentDirectory,this.context,a,q),o&&o.then(p,l)},b}},{"./contexts":12,"./less-error":34,"./parser/parser":40}],33:[function(a,b,c){b.exports=function(b,c){var d,e,f,g,h,i={version:[3,0,0],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),AbstractPluginLoader:a("./environment/abstract-plugin-loader"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")};return i}},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":16,"./environment/abstract-plugin-loader":17,"./environment/environment":18,"./functions":25,"./import-manager":32,"./less-error":34,"./logger":35,"./parse":37,"./parse-tree":36,"./parser/parser":40,"./plugin-manager":41,"./render":42,"./source-map-builder":43,"./source-map-output":44,"./transform-tree":45,"./tree":65,"./utils":87,"./visitors":91}],34:[function(a,b,c){var d=a("./utils"),e=b.exports=function(a,b,c){Error.call(this);var e=a.filename||c;if(b&&e){var f=b.contents[e],g=d.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&d.getLocation(a.call,f).line,k=f.split("\n");this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.callLine=j+1,this.callExtract=k[j],this.column=i,this.extract=[k[h-1],k[h],k[h+1]]}this.message=a.message,this.stack=a.stack};if("undefined"==typeof Object.create){var f=function(){};f.prototype=Error.prototype,e.prototype=new f}else e.prototype=Object.create(Error.prototype);e.prototype.constructor=e},{"./utils":87}],35:[function(a,b,c){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;b=97&&j<=122||j<34))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(h96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;hd&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],39:[function(a,b,c){var d=a("./chunker");b.exports=function(){function a(d){for(var e,f,j,p=k.i,q=c,s=k.i-i,t=k.i+h.length-s,u=k.i+=d,v=b;k.i=0){j={index:k.i,text:v.substr(k.i,x+2-k.i),isLineComment:!1},k.i+=j.text.length-1,k.commentStore.push(j);continue}}break}if(e!==l&&e!==n&&e!==m&&e!==o)break}if(h=h.slice(d+k.i-u+s),i=k.i,!h.length){if(ce||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,c=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$re=function(b){k.i>i&&(h=h.slice(k.i-i),i=k.i);var c=b.exec(h);return c?(a(c[0].length),"string"==typeof c?c:1===c.length?c[0]:c):null},k.$char=function(c){return b.charAt(k.i)!==c?null:(a(1),c)},k.$str=function(c){for(var d=c.length,e=0;es||a=b.length;return k.i=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":38}],40:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=function j(a,b,c){function i(a,e){throw new d({index:o.i,filename:c.filename,type:e||"Syntax",message:a},b)}function k(a,b,c){var d=a instanceof Function?a.call(n):o.$re(a);return d?d:void i(b||("string"==typeof a?"expected '"+a+"' got '"+o.currentChar()+"'":"unexpected token"))}function l(a,b){return o.$char(a)?a:void i(b||"expected '"+a+"' got '"+o.currentChar()+"'")}function m(a){var b=c.filename;return{lineNumber:h.getLocation(a,o.getInput()).line+1,fileName:b}}var n,o=g();return{parserInput:o,imports:b,fileInfo:c,parse:function(g,h,i){var k,l,m,n,p=null,q="";if(l=i&&i.globalVars?j.serializeVars(i.globalVars)+"\n":"",m=i&&i.modifyVars?"\n"+j.serializeVars(i.modifyVars):"",a.pluginManager)for(var r=a.pluginManager.getPreProcessors(),s=0;s1&&(b=new e.Value(g)),d.push(b),g=[])}return o.forget(),a?d:f},literal:function(){return this.dimension()||this.color()||this.quoted()||this.unicodeDescriptor()},assignment:function(){var a,b;return o.save(),(a=o.$re(/^\w+(?=\s?=)/i))&&o.$char("=")&&(b=n.entity())?(o.forget(),new e.Assignment(a,b)):void o.restore()},url:function(){var a,b=o.i;return o.autoCommentAbsorb=!1,o.$str("url(")?(a=this.quoted()||this.variable()||this.property()||o.$re(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",o.autoCommentAbsorb=!0,l(")"),new e.URL(null!=a.value||a instanceof e.Variable||a instanceof e.Property?a:new e.Anonymous(a,b),b,c)):void(o.autoCommentAbsorb=!0)},variable:function(){var a,b=o.i;if("@"===o.currentChar()&&(a=o.$re(/^@@?[\w-]+/)))return new e.Variable(a,b,c)},variableCurly:function(){var a,b=o.i;if("@"===o.currentChar()&&(a=o.$re(/^@\{([\w-]+)\}/)))return new e.Variable("@"+a[1],b,c)},property:function(){var a,b=o.i;if("$"===o.currentChar()&&(a=o.$re(/^\$[\w-]+/)))return new e.Property(a,b,c)},propertyCurly:function(){var a,b=o.i;if("$"===o.currentChar()&&(a=o.$re(/^\$\{([\w-]+)\}/)))return new e.Property("$"+a[1],b,c)},color:function(){var a;if("#"===o.currentChar()&&(a=o.$re(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))){var b=a.input.match(/^#([\w]+).*/);return b=b[1],b.match(/^[A-Fa-f0-9]+$/)||i("Invalid HEX color code"),new e.Color(a[1],(void 0),"#"+b)}},colorKeyword:function(){o.save();var a=o.autoCommentAbsorb;o.autoCommentAbsorb=!1;var b=o.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/);if(o.autoCommentAbsorb=a,!b)return void o.forget();o.restore();var c=e.Color.fromKeyword(b);return c?(o.$str(b),c):void 0},dimension:function(){if(!o.peekNotNumeric()){var a=o.$re(/^([+-]?\d*\.?\d+)(%|[a-z_]+)?/i);return a?new e.Dimension(a[1],a[2]):void 0}},unicodeDescriptor:function(){var a;if(a=o.$re(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/))return new e.UnicodeDescriptor(a[0])},javascript:function(){var a,b=o.i;o.save();var d=o.$char("~"),f=o.$char("`");return f?(a=o.$re(/^[^`]*`/))?(o.forget(),new e.JavaScript(a.substr(0,a.length-1),Boolean(d),b,c)):void o.restore("invalid javascript definition"):void o.restore()}},variable:function(){var a;if("@"===o.currentChar()&&(a=o.$re(/^(@[\w-]+)\s*:/)))return a[1]},rulesetCall:function(){var a;if("@"===o.currentChar()&&(a=o.$re(/^(@[\w-]+)\(\s*\)\s*;/)))return new e.RulesetCall(a[1])},extend:function(a){var b,d,f,g,h,j=o.i;if(o.$str(a?"&:extend(":":extend(")){do{for(f=null,b=null;!(f=o.$re(/^(all)(?=\s*(\)|,))/))&&(d=this.element());)b?b.push(d):b=[d];f=f&&f[1],b||i("Missing target selector for :extend()."),h=new e.Extend(new e.Selector(b),f,j,c),g?g.push(h):g=[h]}while(o.$char(","));return k(/^\)/),a&&k(/^;/),g}},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var a,b,d,f,g,h,i=o.currentChar(),j=!1,k=o.i;if("."===i||"#"===i){for(o.save();;){if(a=o.i,f=o.$re(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/),!f)break;d=new e.Element(g,f,a,c),b?b.push(d):b=[d],g=o.$char(">")}return b&&(o.$char("(")&&(h=this.args(!0).args,l(")")),n.important()&&(j=!0),n.end())?(o.forget(),new e.mixin.Call(b,h,k,c,j)):void o.restore()}},args:function(a){var b,c,d,f,g,h,j,k=n.entities,l={args:null,variadic:!1},m=[],p=[],q=[];for(o.save();;){if(a)h=n.detachedRuleset()||n.expression();else{if(o.commentStore.length=0,o.$str("...")){l.variadic=!0,o.$char(";")&&!b&&(b=!0),(b?p:q).push({variadic:!0});break}h=k.variable()||k.property()||k.literal()||k.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var r=null;if(a?h.value&&1==h.value.length&&(r=h.value[0]):r=h,r&&(r instanceof e.Variable||r instanceof e.Property))if(o.$char(":")){if(m.length>0&&(b&&i("Cannot mix ; and , as delimiter types"),c=!0),g=n.detachedRuleset()||n.expression(),!g){if(!a)return o.restore(),l.args=[],l;i("could not understand value for named argument")}f=d=r.name}else if(o.$str("...")){if(!a){l.variadic=!0,o.$char(";")&&!b&&(b=!0),(b?p:q).push({name:h.name,variadic:!0});break}j=!0}else a||(d=f=r.name,g=null);g&&m.push(g),q.push({name:f,value:g,expand:j}),o.$char(",")||(o.$char(";")||b)&&(c&&i("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),p.push({name:d,value:g,expand:j}),d=null,m=[],c=!1)}return o.forget(),l.args=b?p:q,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==o.currentChar()&&"#"!==o.currentChar()||o.peek(/^[^{]*\}/)))if(o.save(),b=o.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!o.$char(")"))return void o.restore("Missing closing ')'");if(o.commentStore.length=0,o.$str("when")&&(d=k(n.conditions,"expected condition")),c=n.block())return o.forget(),new e.mixin.Definition(a,f,c,d,g);o.restore()}else o.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.property()||a.call()||a.keyword()||a.javascript()},end:function(){return o.$char(";")||o.peek("}")},alpha:function(){var a;if(o.$re(/^opacity=/i))return a=o.$re(/^\d+/),a||(a=k(this.entities.variable,"Could not parse alpha")),l(")"),new e.Alpha(a)},element:function(){var a,b,d,f=o.i;if(b=this.combinator(),a=o.$re(/^(?:\d+\.\d+|\d+)%/)||o.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||o.$char("*")||o.$char("&")||this.attribute()||o.$re(/^\([^&()@]+\)/)||o.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(o.save(),o.$char("(")?(d=this.selector())&&o.$char(")")?(a=new e.Paren(d),o.forget()):o.restore("Missing closing ')'"):o.forget()),a)return new e.Element(b,a,f,c)},combinator:function(){var a=o.currentChar();if("/"===a){o.save();var b=o.$re(/^\/[a-z]+\//i);if(b)return o.forget(),new e.Combinator(b);o.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(o.i++,"^"===a&&"^"===o.currentChar()&&(a="^^",o.i++);o.isWhitespace();)o.i++;return new e.Combinator(a)}return new e.Combinator(o.isWhitespace(-1)?" ":null)},lessSelector:function(){return this.selector(!0)},selector:function(a){for(var b,d,f,g,h,j,l,m=o.i;(a&&(d=this.extend())||a&&(j=o.$str("when"))||(g=this.element()))&&(j?l=k(this.conditions,"expected condition"):l?i("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&i("Extend can only be used at the end of selector"),f=o.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,l,m,c):void(h&&i("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(o.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=k(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=o.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||o.$re(/^[0-9]+%/)||o.$re(/^[\w-]+/)||d.variableCurly()),l("]"),new e.Attribute(a,c,b)}},block:function(){var a;if(o.$char("{")&&(a=this.primary())&&o.$char("}"))return a},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();if(a)return new e.DetachedRuleset(a)},ruleset:function(){var b,c,d,f;for(o.save(),a.dumpLineNumbers&&(f=m(o.i));;){if(c=this.lessSelector(),!c)break;if(b?b.push(c):b=[c],o.commentStore.length=0,c.condition&&b.length>1&&i("Guards are only currently allowed on a single selector."),!o.$char(","))break;c.condition&&i("Guards are only currently allowed on a single selector."),o.commentStore.length=0}if(b&&(d=this.block())){o.forget();var g=new e.Ruleset(b,d,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}o.restore()},declaration:function(){var a,b,d,f,g,h=o.i,i=o.currentChar();if("."!==i&&"#"!==i&&"&"!==i&&":"!==i)if(o.save(),a=this.variable()||this.ruleProperty()){if(g="string"==typeof a,g&&(b=this.detachedRuleset()),o.commentStore.length=0,!b){if(f=!g&&a.length>1&&a.pop().value,b=this.anonymousValue())return o.forget(),new e.Declaration(a,b,(!1),f,h,c);b||(b=this.value()),d=this.important()}if(b&&this.end())return o.forget(),new e.Declaration(a,b,d,f,h,c);o.restore()}else o.restore()},anonymousValue:function(){var a=o.i,b=o.$re(/^([^@\$+\/'"*`(;{}-]*);/);if(b)return new e.Anonymous(b[1],a)},"import":function(){var a,b,d=o.i,f=o.$re(/^@import?\s+/);if(f){var g=(f?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),o.$char(";")||(o.i=d,i("missing semi-colon or unrecognised media features on import")),b=b&&new e.Value(b),new e.Import(a,b,g,d,c);o.i=d,i("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!o.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!o.$char(","))break}while(a);return l(")"),d},importOption:function(){var a=o.$re(/^(less|css|multiple|once|inline|reference|optional)/);if(a)return a[1]},mediaFeature:function(){var a,b,d=this.entities,f=[];o.save();do a=d.keyword()||d.variable(),a?f.push(a):o.$char("(")&&(b=this.property(),a=this.value(),o.$char(")")?b&&a?f.push(new e.Paren(new e.Declaration(b,a,null,null,o.i,c,(!0)))):a?f.push(new e.Paren(a)):i("badly formed media feature definition"):i("Missing closing ')'","Parse"));while(a);if(o.forget(),f.length>0)return new e.Expression(f)},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!o.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!o.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=o.i;return a.dumpLineNumbers&&(g=m(h)),o.save(),o.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||i("media definitions require block statements after any features"),o.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void o.restore()},plugin:function(){var a,b,d,f=o.i,g=o.$re(/^@plugin?\s+/);if(g){if(b=this.pluginArgs(),d=b?{pluginArgs:b,isPlugin:!0}:{isPlugin:!0},a=this.entities.quoted()||this.entities.url())return o.$char(";")||(o.i=f,i("missing semi-colon on @plugin")),new e.Import(a,null,d,f,c);o.i=f,i("malformed @plugin statement")}},pluginArgs:function(){if(o.save(),!o.$char("("))return o.restore(),null;var a=o.$re(/^\s*([^\);]+)\)\s*/);return a[1]?(o.forget(),a[1].trim()):(o.restore(),null)},atrule:function(){var b,d,f,g,h,j,k,l=o.i,n=!0,p=!0;if("@"===o.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(o.save(),b=o.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,n=!1;break;case"@namespace":j=!0,n=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,p=!1;break;default:k=!0}return o.commentStore.length=0,h?(d=this.entity(),d||i("expected "+b+" identifier")):j?(d=this.expression(),d||i("expected "+b+" expression")):k&&(d=(o.$re(/^[^{;]+/)||"").trim(),n="{"==o.currentChar(),d&&(d=new e.Anonymous(d))),n&&(f=this.blockRuleset()),f||!n&&d&&o.$char(";")?(o.forget(),new e.AtRule(b,d,f,l,c,a.dumpLineNumbers?m(l):null,p)):void o.restore("at-rule options not recognised")}}},value:function(){var a,b=[],c=o.i;do if(a=this.expression(),a&&(b.push(a),!o.$char(",")))break;while(a);if(b.length>0)return new e.Value(b,c)},important:function(){if("!"===o.currentChar())return o.$re(/^! *important/)},sub:function(){var a,b;return o.save(),o.$char("(")?(a=this.addition(),a&&o.$char(")")?(o.forget(),b=new e.Expression([a]),b.parens=!0,b):void o.restore("Expected ')'")):void o.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=o.isWhitespace(-1);;){if(o.peek(/^\/[*\/]/))break;if(o.save(),c=o.$char("/")||o.$char("*"),!c){o.forget();break}if(b=this.operand(),!b){o.restore();break}o.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=o.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=o.isWhitespace(-1);;){if(c=o.$re(/^[-+]\s+/)||!f&&(o.$char("+")||o.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=o.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=o.i;if(a=this.condition()){for(;;){if(!o.peek(/^,\s*(not\s*)?\(/)||!o.$char(","))break;if(b=this.condition(),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(){function a(){return o.$str("or")}var b,c,d;if(b=this.conditionAnd(this)){if(c=a()){if(d=this.condition(),!d)return;b=new e.Condition(c,b,d)}return b}},conditionAnd:function(){function a(a){return a.negatedCondition()||a.parenthesisCondition()}function b(){return o.$str("and")}var c,d,f;if(c=a(this)){if(d=b()){if(f=this.conditionAnd(), +!f)return;c=new e.Condition(d,c,f)}return c}},negatedCondition:function(){if(o.$str("not")){var a=this.parenthesisCondition();return a&&(a.negate=!a.negate),a}},parenthesisCondition:function(){function a(a){var b;return o.save(),(b=a.condition())&&o.$char(")")?(o.forget(),b):void o.restore()}var b;return o.save(),o.$str("(")?(b=a(this))?(o.forget(),b):(b=this.atomicCondition())?o.$char(")")?(o.forget(),b):void o.restore("expected ')' got '"+o.currentChar()+"'"):void o.restore():void o.restore()},atomicCondition:function(){var a,b,c,d,f=this.entities,g=o.i;if(a=this.addition()||f.keyword()||f.quoted())return o.$char(">")?d=o.$char("=")?">=":">":o.$char("<")?d=o.$char("=")?"<=":"<":o.$char("=")&&(d=o.$char(">")?"=>":o.$char("<")?"=<":"="),d?(b=this.addition()||f.keyword()||f.quoted(),b?c=new e.Condition(d,a,b,g,(!1)):i("expected expression")):c=new e.Condition("=",a,new e.Keyword("true"),g,(!1)),c},operand:function(){var a,b=this.entities;o.peek(/^-[@\$\(]/)&&(a=o.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.property()||b.call()||b.colorKeyword();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[],d=o.i;do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),o.peek(/^\/[\/*]/)||(b=o.$char("/"),b&&c.push(new e.Anonymous(b,d)))));while(a);if(c.length>0)return new e.Expression(c)},property:function(){var a=o.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(a)return a[1]},ruleProperty:function(){function a(a){var b=o.i,c=o.$re(a);if(c)return g.push(b),f.push(c[1])}var b,d,f=[],g=[];o.save();var h=o.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],o.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(o.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;d=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},f.prototype.addPostProcessor=function(a,b){var c;for(c=0;c=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},f.prototype.addFileManager=function(a){this.fileManagers.push(a)},f.prototype.getPreProcessors=function(){for(var a=[],b=0;b0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],45:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Declaration("@"+a,b,(!1),null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j,k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor((!0)),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager)for(j=b.pluginManager.visitor(),j.first();i=j.get();)i.isPreEvalVisitor&&i.run(a);c=a.eval(h);for(var l=0;l.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(d="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":73}],56:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],57:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;c-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&c<1&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":15,"./color":52,"./node":73,"./unit":83}],60:[function(a,b,c){var d=a("./atrule"),e=function(){var a=Array.prototype.slice.call(arguments);d.apply(this,a)};e.prototype=Object.create(d.prototype),e.prototype.constructor=e,b.exports=e},{"./atrule":49}],61:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./combinator"),g=function(a,b,c,d,e){this.combinator=a instanceof f?a:new f(a),this.value="string"==typeof b?b.trim():b?b:"",this._index=c,this._fileInfo=d,this.copyVisibilityInfo(e),this.setParent(this.combinator,this)};g.prototype=new d,g.prototype.type="Element",g.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},g.prototype.eval=function(a){return new g(this.combinator,this.value.eval?this.value.eval(a):this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.fileInfo(),this.getIndex())},g.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof e&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=g},{"./combinator":53,"./node":73,"./paren":75}],62:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./comment"),g=function(a){if(this.value=a,!a)throw new Error("Expression requires an array parameter")};g.prototype=new d,g.prototype.type="Expression",g.prototype.accept=function(a){this.value=a.visitArray(this.value)},g.prototype.eval=function(a){var b,c=this.parens&&!this.parensInOp,d=!1;return c&&a.inParenthesis(),this.value.length>1?b=new g(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(d=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!d&&(b=new e(b)),b},g.prototype.genCSS=function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":73,"./selector":81}],64:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=a("../utils"),k=function(a,b,c,d,e,f){if(this.options=c,this._index=d,this._fileInfo=e,this.path=a,this.features=b,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?\/]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f),this.setParent(this.features,this),this.setParent(this.path,this)};k.prototype=new d,k.prototype.type="Import",k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.isPlugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},k.prototype.genCSS=function(a,b){this.css&&void 0===this.path._fileInfo.reference&&(b.add("@import ",this._fileInfo,this._index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},k.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},k.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),!(a instanceof g)||a.containsVariables()},k.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new k(b.eval(a),this.features,this.options,this._index,this._fileInfo,this.visibilityInfo())},k.prototype.evalPath=function(a){var b=this.path.eval(a),c=this._fileInfo&&this._fileInfo.rootpath;if(!(b instanceof f)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d)}b.value=a.normalizePath(b.value)}return b},k.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){a.addVisibilityBlock()}):b.addVisibilityBlock()),b},k.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a);if(this.options.isPlugin)return this.root&&this.root.eval&&this.root.eval(a),c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[];if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var f=new i(this.root,0,{filename:this.importedFilename,reference:this.path._fileInfo&&this.path._fileInfo.reference},(!0),(!0));return this.features?new e([f],this.features.value):[f]}if(this.css){var g=new k(this.evalPath(a),d,this.options,this._index);if(!g.css&&this.error)throw this.error;return g}return b=new h(null,j.copyArray(this.root.rules)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=k},{"../utils":87,"./anonymous":47,"./media":69,"./node":73,"./quoted":77,"./ruleset":80,"./url":84}],65:[function(a,b,c){var d={};d.Node=a("./node"),d.Alpha=a("./alpha"),d.Color=a("./color"),d.AtRule=a("./atrule"),d.Directive=a("./directive"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Property=a("./property"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Declaration=a("./declaration"),d.Rule=a("./rule"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.RulesetCall=a("./ruleset-call"),b.exports=d},{"./alpha":46,"./anonymous":47,"./assignment":48,"./atrule":49,"./attribute":50,"./call":51,"./color":52,"./combinator":53,"./comment":54,"./condition":55,"./declaration":57,"./detached-ruleset":58,"./dimension":59,"./directive":60,"./element":61,"./expression":62,"./extend":63,"./import":64,"./javascript":66,"./keyword":68,"./media":69,"./mixin-call":70,"./mixin-definition":71,"./negative":72,"./node":73,"./operation":74,"./paren":75, +"./property":76,"./quoted":77,"./rule":78,"./ruleset":80,"./ruleset-call":79,"./selector":81,"./unicode-descriptor":82,"./unit":83,"./url":84,"./value":85,"./variable":86}],66:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this._index=c,this._fileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new e(b):"string"==typeof b?new f('"'+b+'"',b,this.escaped,this._index):new g(Array.isArray(b)?b.join(", "):b)},b.exports=h},{"./anonymous":47,"./dimension":59,"./js-eval-node":67,"./quoted":77}],67:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(!b.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.fileInfo().filename,index:this.getIndex()};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.getIndex(),d.fileInfo()).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.fileInfo().filename,index:this.getIndex()}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.fileInfo().filename,index:this.getIndex()}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":73,"./variable":86}],68:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":73}],69:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./atrule"),j=a("../utils"),k=function(a,b,c,g,h){this._index=c,this._fileInfo=g;var i=new f([],null,null,this._index,this._fileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0,this.setParent(i,this),this.setParent(this.features,this),this.setParent(this.rules,this)};k.prototype=new i,k.prototype.type="Media",k.prototype.isRulesetLike=function(){return!0},k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},k.prototype.genCSS=function(a,b){b.add("@media ",this._fileInfo,this._index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},k.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new k(null,[],this._index,this._fileInfo,this.visibilityInfo());this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo);var c=!1;a.strictMath||(c=!0,a.strictMath=!0);try{b.features=this.features.eval(a)}finally{c&&(a.strictMath=!1)}return a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},k.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo()),this.setParent(b,this)}return delete a.mediaBlocks,delete a.mediaPath,b},k.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;b0;b--)a.splice(b,0,new g("and"));return new h(a)})),this.setParent(this.features,this),new d([],[])},k.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(n=!0,k=0;k0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.getIndex(),filename:this.fileInfo().filename};for(k=0;kthis.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;gb?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],74:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};g.prototype=new d,g.prototype.type="Operation",g.prototype.accept=function(a){this.operands=a.visit(this.operands)},g.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof f&&c instanceof e&&(b=b.toColor()),c instanceof f&&b instanceof e&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new g(this.op,[b,c],this.isSpaced)},g.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=g},{"./color":52,"./dimension":59,"./node":73}],75:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":73}],76:[function(a,b,c){var d=a("./node"),e=a("./declaration"),f=function(a,b,c){this.name=a,this._index=b,this._fileInfo=c};f.prototype=new d,f.prototype.type="Property",f.prototype.eval=function(a){var b,c=this.name,d=a.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;if(this.evaluating)throw{type:"Name",message:"Recursive property reference for "+c,filename:this.fileInfo().filename,index:this.getIndex()};if(this.evaluating=!0,b=this.find(a.frames,function(b){var f,g=b.property(c);if(g){for(var h=0;hd){if(!c||c(g)){e=g.find(new i(a.elements.slice(d)),b,c);for(var j=0;j0&&b.add(k),a.firstSelector=!0,h[0].genCSS(a,b),a.firstSelector=!1,d=1;d0?(e=q.copyArray(a),f=e.pop(),g=d.createDerived(q.copyArray(f.elements))):g=d.createDerived([]),b.length>0){var h=c.combinator,i=b[0].elements[0];h.emptyOrWhitespace&&!i.combinator.emptyOrWhitespace&&(h=i.combinator),g.elements.push(new j(h,i.value,c._index,c._fileInfo)),g.elements=g.elements.concat(b[0].elements.slice(1))}if(0!==g.elements.length&&e.push(g),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function g(a,b,c,d,e){var g;for(g=0;g0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new i(a))}}function l(a,b,c){function m(a){var b;return a.value instanceof h?(b=a.value.value,b instanceof i?b:null):null}var n,o,p,q,r,s,t,u,v,w,x=!1;for(q=[],r=[[]],n=0;u=c.elements[n];n++)if("&"!==u.value){var y=m(u);if(null!=y){k(q,r);var z,A=[],B=[];for(z=l(A,b,y),x=x||z,p=0;p0&&t[0].elements.push(new j(u.combinator,"",u._index,u._fileInfo)),s.push(t);else for(p=0;p0&&(a.push(r[n]),w=r[n][v-1],r[n][v-1]=w.createDerived(w.elements,c.extendList));return x}function m(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var n,o,p;if(o=[],p=l(o,b,c),!p)if(b.length>0)for(o=[],n=0;n0)for(b=0;b=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}},copyArray:function(a){var b,c=a.length,d=new Array(c);for(b=0;b=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.fileInfo(),b),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitDeclaration:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;e0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return k0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitAtRule:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitAtRuleOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=i},{"../logger":35,"../tree":65,"../utils":87,"./visitor":95}],89:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],90:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=a("../utils"),h=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};h.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,g.copyArray(this.context.frames)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.getIndex(),f.filename=a.fileInfo().filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;h0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];if(this.keepOnlyVisibleChilds(c),!this.isEmpty(c))return a.ensureVisibility(),a.removeVisibilityBlock(),a},isVisibleRuleset:function(a){return!!a.firstRoot||!this.isEmpty(a)&&!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitDeclaration:function(a,b){if(!a.blocksVisibility()&&!a.variable)return a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){if(!a.blocksVisibility()&&!a.isSilent(this._context))return a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){if(!a.blocksVisibility())return a},visitAtRule:function(a,b){return a.rules&&a.rules.length?this.visitAtRuleWithBody(a,b):this.visitAtRuleWithoutBody(a,b)},visitAtRuleWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitAtRuleWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;c0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;b=0;e--)if(c=a[e],c instanceof d.Declaration)if(f[c.name]){b=f[c.name],b instanceof d.Declaration&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);b.indexOf(g)!==-1?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b,c,e,f={},g=0;g1){c=b[0];var h=[],i=[];b.map(function(a){"+"===a.merge&&(i.length>0&&h.push(e(i)),i=[]),i.push(a)}),h.push(e(i)),c.value=g(h)}})}},visitAnonymous:function(a,b){if(!a.blocksVisibility())return a.accept(this._visitor),a}},b.exports=g},{"../tree":65,"./visitor":95}],95:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)if(a.hasOwnProperty(c))switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitFnCache=[],h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var c,e=this._visitFnCache,f=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=g;if(l.visitDeeper=!0,j||(c="visit"+a.type,j=f[c]||d,k=f[c+"Out"]||d,e[h]=j,e[i]=k),j!==d){var m=j.call(f,a,l);f.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=d&&k.call(f,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;ck){for(var b=0,c=h.length-j;b 0) { if (isSemiColonSeparated) { @@ -925,7 +952,7 @@ var Parser = function Parser(context, imports, fileInfo) { var entities = this.entities; return this.comment() || entities.literal() || entities.variable() || entities.url() || - entities.call() || entities.keyword() || entities.javascript(); + entities.property() || entities.call() || entities.keyword() || entities.javascript(); }, // @@ -1169,7 +1196,7 @@ var Parser = function Parser(context, imports, fileInfo) { parserInput.restore(); } }, - declaration: function (tryAnonymous) { + declaration: function () { var name, value, startOfRule = parserInput.i, c = parserInput.currentChar(), important, merge, isVariable; if (c === '.' || c === '#' || c === '&' || c === ':') { return; } @@ -1191,22 +1218,16 @@ var Parser = function Parser(context, imports, fileInfo) { // where each item is a tree.Keyword or tree.Variable merge = !isVariable && name.length > 1 && name.pop().value; - // prefer to try to parse first if its a variable or we are compressing - // but always fallback on the other one - var tryValueFirst = !tryAnonymous && (context.compress || isVariable); - - if (tryValueFirst) { - value = this.value(); + // Try to store values as anonymous + // If we need the value later we'll re-parse it in ruleset.parseValue + value = this.anonymousValue(); + if (value) { + parserInput.forget(); + // anonymous values absorb the end ';' which is required for them to work + return new (tree.Declaration)(name, value, false, merge, startOfRule, fileInfo); } + if (!value) { - value = this.anonymousValue(); - if (value) { - parserInput.forget(); - // anonymous values absorb the end ';' which is required for them to work - return new (tree.Declaration)(name, value, false, merge, startOfRule, fileInfo); - } - } - if (!tryValueFirst && !value) { value = this.value(); } @@ -1216,20 +1237,19 @@ var Parser = function Parser(context, imports, fileInfo) { if (value && this.end()) { parserInput.forget(); return new (tree.Declaration)(name, value, important, merge, startOfRule, fileInfo); - } else { + } + else { parserInput.restore(); - if (value && !tryAnonymous) { - return this.declaration(true); - } } } else { - parserInput.forget(); + parserInput.restore(); } }, anonymousValue: function () { - var match = parserInput.$re(/^([^@+\/'"*`(;{}-]*);/); + var index = parserInput.i; + var match = parserInput.$re(/^([^@\$+\/'"*`(;{}-]*);/); if (match) { - return new(tree.Anonymous)(match[1]); + return new(tree.Anonymous)(match[1], index); } }, @@ -1534,7 +1554,7 @@ var Parser = function Parser(context, imports, fileInfo) { // and before the `;`. // value: function () { - var e, expressions = []; + var e, expressions = [], index = parserInput.i; do { e = this.expression(); @@ -1545,7 +1565,7 @@ var Parser = function Parser(context, imports, fileInfo) { } while (e); if (expressions.length > 0) { - return new(tree.Value)(expressions); + return new(tree.Value)(expressions, index); } }, important: function () { @@ -1784,13 +1804,14 @@ var Parser = function Parser(context, imports, fileInfo) { operand: function () { var entities = this.entities, negate; - if (parserInput.peek(/^-[@\(]/)) { + if (parserInput.peek(/^-[@\$\(]/)) { negate = parserInput.$char('-'); } var o = this.sub() || entities.dimension() || entities.color() || entities.variable() || - entities.call() || entities.colorKeyword(); + entities.property() || entities.call() || + entities.colorKeyword(); if (negate) { o.parensInOp = true; @@ -1808,7 +1829,7 @@ var Parser = function Parser(context, imports, fileInfo) { // @var * 2 // expression: function () { - var entities = [], e, delim; + var entities = [], e, delim, index = parserInput.i; do { e = this.comment(); @@ -1823,7 +1844,7 @@ var Parser = function Parser(context, imports, fileInfo) { if (!parserInput.peek(/^\/[\/*]/)) { delim = parserInput.$char('/'); if (delim) { - entities.push(new(tree.Anonymous)(delim)); + entities.push(new(tree.Anonymous)(delim, index)); } } } @@ -1861,7 +1882,7 @@ var Parser = function Parser(context, imports, fileInfo) { match(/^(\*?)/); while (true) { - if (!match(/^((?:[\w-]+)|(?:@\{[\w-]+\}))/)) { + if (!match(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/)) { break; } } @@ -1877,10 +1898,11 @@ var Parser = function Parser(context, imports, fileInfo) { } for (k = 0; k < name.length; k++) { s = name[k]; - name[k] = (s.charAt(0) !== '@') ? + name[k] = (s.charAt(0) !== '@' && s.charAt(0) !== '$') ? new(tree.Keyword)(s) : - new(tree.Variable)('@' + s.slice(2, -1), - index[k], fileInfo); + (s.charAt(0) === '@' ? + new(tree.Variable)('@' + s.slice(2, -1), index[k], fileInfo) : + new(tree.Property)('$' + s.slice(2, -1), index[k], fileInfo)); } return name; } diff --git a/lib/less/tree/index.js b/lib/less/tree/index.js index b7e6d60f5..858becf16 100644 --- a/lib/less/tree/index.js +++ b/lib/less/tree/index.js @@ -12,6 +12,7 @@ tree.Dimension = require('./dimension'); tree.Unit = require('./unit'); tree.Keyword = require('./keyword'); tree.Variable = require('./variable'); +tree.Property = require('./property'); tree.Ruleset = require('./ruleset'); tree.Element = require('./element'); tree.Attribute = require('./attribute'); diff --git a/lib/less/tree/node.js b/lib/less/tree/node.js index ceee12a5b..20245c7a6 100644 --- a/lib/less/tree/node.js +++ b/lib/less/tree/node.js @@ -2,6 +2,8 @@ var Node = function() { this.parent = null; this.visibilityBlocks = undefined; this.nodeVisible = undefined; + this.rootNode = null; + this.parsed = null; var self = this; Object.defineProperty(this, "currentFileInfo", { diff --git a/lib/less/tree/property.js b/lib/less/tree/property.js new file mode 100644 index 000000000..341a6db95 --- /dev/null +++ b/lib/less/tree/property.js @@ -0,0 +1,70 @@ +var Node = require("./node"), + Declaration = require("./declaration"); + +var Property = function (name, index, currentFileInfo) { + this.name = name; + this._index = index; + this._fileInfo = currentFileInfo; +}; +Property.prototype = new Node(); +Property.prototype.type = "Property"; +Property.prototype.eval = function (context) { + var property, name = this.name; + // TODO: shorten this reference + var mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules; + + if (this.evaluating) { + throw { type: 'Name', + message: "Recursive property reference for " + name, + filename: this.fileInfo().filename, + index: this.getIndex() }; + } + + this.evaluating = true; + + property = this.find(context.frames, function (frame) { + + var v, vArr = frame.property(name); + if (vArr) { + for (var i = 0; i < vArr.length; i++) { + v = vArr[i]; + + vArr[i] = new Declaration(v.name, + v.value, + v.important, + v.merge, + v.index, + v.currentFileInfo, + v.inline, + v.variable + ); + } + mergeRules(vArr); + + v = vArr[vArr.length - 1]; + if (v.important) { + var importantScope = context.importantScope[context.importantScope.length - 1]; + importantScope.important = v.important; + } + v = v.value.eval(context); + return v; + } + }); + if (property) { + this.evaluating = false; + return property; + } else { + throw { type: 'Name', + message: "Property '" + name + "' is undefined", + filename: this.currentFileInfo.filename, + index: this.index }; + } +}; +Property.prototype.find = function (obj, fun) { + for (var i = 0, r; i < obj.length; i++) { + r = fun.call(obj, obj[i]); + if (r) { return r; } + } + return null; +}; +module.exports = Property; diff --git a/lib/less/tree/quoted.js b/lib/less/tree/quoted.js index 07d5d1bd4..33fa3033d 100644 --- a/lib/less/tree/quoted.js +++ b/lib/less/tree/quoted.js @@ -1,6 +1,7 @@ var Node = require("./node"), JsEvalNode = require("./js-eval-node"), - Variable = require("./variable"); + Variable = require("./variable"), + Property = require("./property"); var Quoted = function (str, content, escaped, index, currentFileInfo) { this.escaped = (escaped == null) ? true : escaped; @@ -28,10 +29,14 @@ Quoted.prototype.eval = function (context) { var javascriptReplacement = function (_, exp) { return String(that.evaluateJavaScript(exp, context)); }; - var interpolationReplacement = function (_, name) { + var variableReplacement = function (_, name) { var v = new Variable('@' + name, that.getIndex(), that.fileInfo()).eval(context, true); return (v instanceof Quoted) ? v.value : v.toCSS(); }; + var propertyReplacement = function (_, name) { + var v = new Property('$' + name, that.getIndex(), that.fileInfo()).eval(context, true); + return (v instanceof Quoted) ? v.value : v.toCSS(); + }; function iterativeReplace(value, regexp, replacementFnc) { var evaluatedValue = value; do { @@ -41,7 +46,8 @@ Quoted.prototype.eval = function (context) { return evaluatedValue; } value = iterativeReplace(value, /`([^`]+)`/g, javascriptReplacement); - value = iterativeReplace(value, /@\{([\w-]+)\}/g, interpolationReplacement); + value = iterativeReplace(value, /@\{([\w-]+)\}/g, variableReplacement); + value = iterativeReplace(value, /\$\{([\w-]+)\}/g, propertyReplacement); return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo()); }; Quoted.prototype.compare = function (other) { diff --git a/lib/less/tree/ruleset.js b/lib/less/tree/ruleset.js index 383d15c8b..5ffbe0941 100644 --- a/lib/less/tree/ruleset.js +++ b/lib/less/tree/ruleset.js @@ -1,22 +1,28 @@ var Node = require("./node"), Declaration = require("./declaration"), + Keyword = require("./keyword"), Comment = require("./comment"), Paren = require("./paren"), Selector = require("./selector"), Element = require("./element"), + Anonymous = require("./anonymous"), contexts = require("../contexts"), globalFunctionRegistry = require("../functions/function-registry"), defaultFunc = require("../functions/default"), getDebugInfo = require("./debug-info"), + LessError = require("../less-error"), utils = require("../utils"); var Ruleset = function (selectors, rules, strictImports, visibilityInfo) { this.selectors = selectors; this.rules = rules; this._lookups = {}; + this._variables = null; + this._properties = null; this.strictImports = strictImports; this.copyVisibilityInfo(visibilityInfo); this.allowRoot = true; + this.setParent(this.selectors, this); this.setParent(this.rules, this); @@ -232,6 +238,7 @@ Ruleset.prototype.matchCondition = function (args, context) { Ruleset.prototype.resetCache = function () { this._rulesets = null; this._variables = null; + this._properties = null; this._lookups = {}; }; Ruleset.prototype.variables = function () { @@ -256,8 +263,78 @@ Ruleset.prototype.variables = function () { } return this._variables; }; +Ruleset.prototype.properties = function () { + if (!this._properties) { + this._properties = !this.rules ? {} : this.rules.reduce(function (hash, r) { + if (r instanceof Declaration && r.variable !== true) { + var name = (r.name.length === 1) && (r.name[0] instanceof Keyword) ? + r.name[0].value : r.name; + // Properties don't overwrite as they can merge + if (!hash['$' + name]) { + hash['$' + name] = [ r ]; + } + else { + hash['$' + name].push(r); + } + } + return hash; + }, {}); + } + return this._properties; +}; Ruleset.prototype.variable = function (name) { - return this.variables()[name]; + var decl = this.variables()[name]; + if (decl) { + return this.parseValue(decl); + } +}; +Ruleset.prototype.property = function (name) { + var decl = this.properties()[name]; + if (decl) { + return this.parseValue(decl); + } +}; +Ruleset.prototype.parseValue = function(toParse) { + var self = this; + function transformDeclaration(decl) { + if (decl.value instanceof Anonymous && !decl.parsed) { + try { + this.parse.parserInput.start(decl.value.value, false, function fail(msg, index) { + decl.parsed = true; + return decl; + }); + var result = this.parse.parsers.value(); + var important = this.parse.parsers.important(); + + var endInfo = this.parse.parserInput.end(); + if (endInfo.isFinished) { + decl.value = result; + decl.imporant = important; + decl.parsed = true; + } + } catch (e) { + throw new LessError({ + index: e.index + decl.value.getIndex(), + message: e.message + }, this.parse.imports, decl.fileInfo().filename); + } + + return decl; + } + else { + return decl; + } + } + if (!Array.isArray(toParse)) { + return transformDeclaration.call(self, toParse); + } + else { + var nodes = []; + toParse.forEach(function(n) { + nodes.push(transformDeclaration.call(self, n)); + }); + return nodes; + } }; Ruleset.prototype.rulesets = function () { if (!this.rules) { return []; } diff --git a/package.json b/package.json index 420edac86..95f5cedf4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "less", - "version": "3.0.0-pre.2", + "version": "3.0.0-pre.3", "description": "Leaner CSS", "homepage": "http://lesscss.org", "author": { @@ -59,7 +59,7 @@ "grunt-contrib-jshint": "^1.0.0", "grunt-contrib-uglify": "^1.0.1", "grunt-jscs": "^2.8.0", - "grunt-saucelabs": "^8.6.2", + "grunt-saucelabs": "^9.0.0", "grunt-shell": "^1.3.0", "jit-grunt": "^0.10.0", "performance-now": "^0.2.0", diff --git a/test/css/compression/compression.css b/test/css/compression/compression.css index 28fcd9e82..c1b58dc51 100644 --- a/test/css/compression/compression.css +++ b/test/css/compression/compression.css @@ -1,3 +1,3 @@ #colours{color1:#fea;color2:#ffeeaa;color3:rgba(255,238,170,0.1);string:"#fea";/*! but not this type Note preserved whitespace - */}dimensions{val:.1px;val:0;val:4cm;val:.2;val:5;angles-must-have-unit:0deg;durations-must-have-unit:0s;length-doesnt-have-unit:0;width:auto\9}@page{marks:none;@top-left-corner{vertical-align:top}@top-left{vertical-align:top}}.shadow^.dom,body^^.shadow{display:done} \ No newline at end of file + */}dimensions{val:0.1px;val:0em;val:4cm;val:0.2;val:5;angles-must-have-unit:0deg;durations-must-have-unit:0s;length-doesnt-have-unit:0px;width:auto\9}@page{marks:none;@top-left-corner{vertical-align:top}@top-left{vertical-align:top}}.shadow^.dom,body^^.shadow{display:done} \ No newline at end of file diff --git a/test/css/property-accessors.css b/test/css/property-accessors.css new file mode 100644 index 000000000..d48dfc24c --- /dev/null +++ b/test/css/property-accessors.css @@ -0,0 +1,49 @@ +.block_1 { + color: red; + background-color: red; + width: 50px; + height: 25px; + border: 1px solid #ff3333; + content: "red"; + prop: red; +} +.block_1:hover { + background-color: green; + color: green; +} +.block_1 .one { + background: red; +} +.block_2 { + color: red; + color: blue; +} +.block_2 .two { + background-color: blue; +} +.block_3 { + color: red; + color: yellow; + color: blue; +} +.block_3 .three { + background-color: blue; +} +.block_4 { + color: red; + color: blue; + color: yellow; +} +.block_4 .four { + background-color: yellow; +} +a { + background-color: red, foo; +} +ab { + background: red, foo; +} +.value_as_property { + prop1: color; + color: #FF0000; +} diff --git a/test/less/errors/color-invalid-hex-code.less b/test/less/errors/color-invalid-hex-code.less index 0e6c5debe..9a3fc0a34 100644 --- a/test/less/errors/color-invalid-hex-code.less +++ b/test/less/errors/color-invalid-hex-code.less @@ -1,3 +1,4 @@ .a { @wrongHEXColorCode: #DCALLB; + color: @wrongHEXColorCode; } \ No newline at end of file diff --git a/test/less/errors/color-invalid-hex-code.txt b/test/less/errors/color-invalid-hex-code.txt index 0f8a82ce4..0e6f688a2 100644 --- a/test/less/errors/color-invalid-hex-code.txt +++ b/test/less/errors/color-invalid-hex-code.txt @@ -1,4 +1,4 @@ SyntaxError: Invalid HEX color code in {path}color-invalid-hex-code.less on line 2, column 29: 1 .a { 2 @wrongHEXColorCode: #DCALLB; -3 } +3 color: @wrongHEXColorCode; diff --git a/test/less/errors/color-invalid-hex-code2.less b/test/less/errors/color-invalid-hex-code2.less index cb9a9b767..4ce9eb83e 100644 --- a/test/less/errors/color-invalid-hex-code2.less +++ b/test/less/errors/color-invalid-hex-code2.less @@ -1,3 +1,4 @@ .a { @wrongHEXColorCode: #fffblack; + color: @wrongHEXColorCode; } \ No newline at end of file diff --git a/test/less/errors/color-invalid-hex-code2.txt b/test/less/errors/color-invalid-hex-code2.txt index dd3996b1f..e307ff21a 100644 --- a/test/less/errors/color-invalid-hex-code2.txt +++ b/test/less/errors/color-invalid-hex-code2.txt @@ -1,4 +1,4 @@ SyntaxError: Invalid HEX color code in {path}color-invalid-hex-code2.less on line 2, column 29: 1 .a { 2 @wrongHEXColorCode: #fffblack; -3 } +3 color: @wrongHEXColorCode; diff --git a/test/less/property-accessors.less b/test/less/property-accessors.less new file mode 100644 index 000000000..24dbd604a --- /dev/null +++ b/test/less/property-accessors.less @@ -0,0 +1,66 @@ + +.block_1 { + color: red; + background-color: $color; + width: 50px; + height: ($width / 2); + @color: red; + border: 1px solid lighten($color, 10%); + &:hover { + color: $color; + background-color: $color; + .mixin1(); + } + .one { + background: $color; + } + content: "${color}"; + prop: $color; + +} + +.block_2 { + color: red; + .two { + background-color: $color; + } + color: blue; +} + +.block_3 { + color: red; + .three { + background-color: $color; + } + .mixin2(); + color: blue; +} +.block_4 { + color: red; + .four { + background-color: $color; + } + color: blue; + .mixin2(); +} +// property merging +a { + background-color+: red; + background-color+: foo; + + &b { + background: $background-color; + } +} + +.value_as_property { + prop1: color; + ${prop1}: #FF0000; // not sure why you'd want to do this, but ok +} + +.mixin1() { + color: green; +} +.mixin2() { + color: yellow; +} From 39150d513a774ec5cff42a8cfe91eb4550dcd514 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Tue, 19 Jul 2016 01:30:34 -0700 Subject: [PATCH 27/97] Simplified API on less object e.g. "less.Ruleset()" instead of "new less.tree.Ruleset()" Auto-casting of string values into nodes for AtRule, Declaration, Selector, Value e.g. "less.Selector('&.a')" instead of "new tree.Selector(new tree.Element(new tree.Combinator('&'), '.a'))" --- .../environment/abstract-plugin-loader.js | 4 +- lib/less/index.js | 27 +++++++- lib/less/parser/parser.js | 66 +++++++++++++++---- lib/less/plugin-manager.js | 10 +-- lib/less/tree/atrule.js | 6 +- lib/less/tree/declaration.js | 5 +- lib/less/tree/index.js | 2 +- lib/less/tree/ruleset.js | 33 ++++------ lib/less/tree/selector.js | 29 ++++++-- lib/less/tree/value.js | 11 +++- lib/less/utils.js | 13 ++++ lib/less/visitors/visitor.js | 29 ++++---- test/less/plugin.less | 4 +- test/less/plugin/plugin-tree-nodes.js | 43 ++++++------ test/less/property-accessors.less | 3 +- 15 files changed, 192 insertions(+), 93 deletions(-) diff --git a/lib/less/environment/abstract-plugin-loader.js b/lib/less/environment/abstract-plugin-loader.js index fba27a1b9..ab8b5c5b9 100644 --- a/lib/less/environment/abstract-plugin-loader.js +++ b/lib/less/environment/abstract-plugin-loader.js @@ -54,8 +54,8 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOp registry = functionRegistry.create(); try { - loader = new Function("module", "require", "functions", "tree", "fileInfo", contents); - pluginObj = loader(localModule, this.require, registry, this.less.tree, fileInfo); + loader = new Function("module", "require", "functions", "tree", "less", "fileInfo", contents); + pluginObj = loader(localModule, this.require, registry, this.less.tree, this.less, fileInfo); if (!pluginObj) { pluginObj = localModule.exports; diff --git a/lib/less/index.js b/lib/less/index.js index 31ed76ab7..1c3c00e3d 100644 --- a/lib/less/index.js +++ b/lib/less/index.js @@ -1,7 +1,7 @@ module.exports = function(environment, fileManagers) { var SourceMapOutput, SourceMapBuilder, ParseTree, ImportManager, Environment; - var less = { + var initial = { version: [3, 0, 0], data: require('./data'), tree: require('./tree'), @@ -26,5 +26,28 @@ module.exports = function(environment, fileManagers) { logger: require('./logger') }; - return less; + // Create a public API + + var ctor = function(t) { + return function() { + var obj = Object.create(t.prototype); + t.apply(obj, Array.prototype.slice.call(arguments, 0)); + return obj; + }; + }; + var t, api = Object.create(initial); + for (var n in initial.tree) { + t = initial.tree[n]; + if (typeof t === "function") { + api[n] = ctor(t); + } + else { + api[n] = Object.create(null); + for (var o in t) { + api[n][o] = ctor(t[o]); + } + } + } + + return api; }; diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js index 494927f19..13d50ac63 100644 --- a/lib/less/parser/parser.js +++ b/lib/less/parser/parser.js @@ -80,6 +80,53 @@ var Parser = function Parser(context, imports, fileInfo) { }; } + /** + * Used after initial parsing to create nodes on the fly + * + * @param {String} str - string to parse + * @param {Array} parseList - array of parsers to run input through e.g. ["value", "important"] + * @param {Number} currentIndex - start number to begin indexing + * @param {Object} fileInfo - fileInfo to attach to created nodes + */ + function parseNode(str, parseList, currentIndex, fileInfo, callback) { + var result, returnNodes = []; + var parser = parserInput; + + try { + parser.start(str, false, function fail(msg, index) { + callback({ + message: msg, + index: index + currentIndex + }); + }); + for(var x = 0, p, i; (p = parseList[x]); x++) { + i = parser.i; + result = parsers[p](); + if (result) { + result._index = i + currentIndex; + result._fileInfo = fileInfo; + returnNodes.push(result); + } + else { + returnNodes.push(null); + } + } + + var endInfo = parser.end(); + if (endInfo.isFinished) { + callback(null, returnNodes); + } + else { + callback(true, null); + } + } catch (e) { + throw new LessError({ + index: e.index + currentIndex, + message: e.message + }, imports, fileInfo.filename); + } + } + // // The Parser // @@ -87,6 +134,7 @@ var Parser = function Parser(context, imports, fileInfo) { parserInput: parserInput, imports: imports, fileInfo: fileInfo, + parseNode: parseNode, // // Parse an input string into an abstract syntax tree, // @param str A string containing 'less' markup @@ -133,8 +181,8 @@ var Parser = function Parser(context, imports, fileInfo) { }); tree.Node.prototype.parse = this; - - root = new(tree.Ruleset)(null, this.parsers.primary()); + root = new tree.Ruleset(null, this.parsers.primary()); + tree.Node.prototype.rootNode = root; root.root = true; root.firstRoot = true; @@ -1008,7 +1056,7 @@ var Parser = function Parser(context, imports, fileInfo) { if (! e) { parserInput.save(); if (parserInput.$char('(')) { - if ((v = this.selector()) && parserInput.$char(')')) { + if ((v = this.selector(false)) && parserInput.$char(')')) { e = new(tree.Paren)(v); parserInput.forget(); } else { @@ -1059,14 +1107,8 @@ var Parser = function Parser(context, imports, fileInfo) { } }, // - // A CSS selector (see selector below) - // with less extensions e.g. the ability to extend and guard - // - lessSelector: function () { - return this.selector(true); - }, - // // A CSS Selector + // with less extensions e.g. the ability to extend and guard // // .class > div + h1 // li a:hover @@ -1075,7 +1117,7 @@ var Parser = function Parser(context, imports, fileInfo) { // selector: function (isLess) { var index = parserInput.i, elements, extendList, c, e, allExtends, when, condition; - + isLess = isLess !== false; while ((isLess && (extendList = this.extend())) || (isLess && (when = parserInput.$str("when"))) || (e = this.element())) { if (when) { condition = expect(this.conditions, 'expected condition'); @@ -1165,7 +1207,7 @@ var Parser = function Parser(context, imports, fileInfo) { } while (true) { - s = this.lessSelector(); + s = this.selector(); if (!s) { break; } diff --git a/lib/less/plugin-manager.js b/lib/less/plugin-manager.js index dcbc0b0cf..bc338652f 100644 --- a/lib/less/plugin-manager.js +++ b/lib/less/plugin-manager.js @@ -1,3 +1,4 @@ +var utils = require('./utils'); /** * Plugin Manager */ @@ -53,13 +54,6 @@ PluginManager.prototype.get = function(filename) { return this.pluginCache[filename]; }; -// Object.getPrototypeOf shim for visitor upgrade -if (!Object.getPrototypeOf) { - Object.getPrototypeOf = function getPrototypeOf(object) { - return object.constructor ? object.constructor.prototype : void 0; - }; -} - function upgradeVisitors(visitor, oldType, newType) { if (visitor['visit' + oldType] && !visitor['visit' + newType]) { @@ -78,7 +72,7 @@ PluginManager.prototype.addVisitor = function(visitor) { var proto; // 2.x to 3.x visitor compatibility try { - proto = Object.getPrototypeOf(visitor); + proto = utils.getPrototype(visitor); upgradeVisitors(proto, 'Directive', 'AtRule'); upgradeVisitors(proto, 'Rule', 'Declaration'); } diff --git a/lib/less/tree/atrule.js b/lib/less/tree/atrule.js index 178ce8dee..480bfcefd 100644 --- a/lib/less/tree/atrule.js +++ b/lib/less/tree/atrule.js @@ -1,12 +1,14 @@ var Node = require("./node"), Selector = require("./selector"), - Ruleset = require("./ruleset"); + Ruleset = require("./ruleset"), + Value = require('./value'), + Anonymous = require('./anonymous'); var AtRule = function (name, value, rules, index, currentFileInfo, debugInfo, isRooted, visibilityInfo) { var i; this.name = name; - this.value = value; + this.value = (value instanceof Node) ? value : (value ? new Anonymous(value) : value); if (rules) { if (Array.isArray(rules)) { this.rules = rules; diff --git a/lib/less/tree/declaration.js b/lib/less/tree/declaration.js index f4a4e3a88..478b6702a 100644 --- a/lib/less/tree/declaration.js +++ b/lib/less/tree/declaration.js @@ -1,10 +1,11 @@ var Node = require("./node"), Value = require("./value"), - Keyword = require("./keyword"); + Keyword = require("./keyword"), + Anonymous = require("./anonymous"); var Declaration = function (name, value, important, merge, index, currentFileInfo, inline, variable) { this.name = name; - this.value = (value instanceof Node) ? value : new Value([value]); //value instanceof tree.Value || value instanceof tree.Ruleset ?? + this.value = (value instanceof Node) ? value : new Value([value ? new Anonymous(value) : null]); this.important = important ? ' ' + important.trim() : ''; this.merge = merge; this._index = index; diff --git a/lib/less/tree/index.js b/lib/less/tree/index.js index 858becf16..5c8f0ddf6 100644 --- a/lib/less/tree/index.js +++ b/lib/less/tree/index.js @@ -1,4 +1,4 @@ -var tree = {}; +var tree = Object.create(null); tree.Node = require('./node'); tree.Alpha = require('./alpha'); diff --git a/lib/less/tree/ruleset.js b/lib/less/tree/ruleset.js index 5ffbe0941..24b67f190 100644 --- a/lib/less/tree/ruleset.js +++ b/lib/less/tree/ruleset.js @@ -298,26 +298,21 @@ Ruleset.prototype.parseValue = function(toParse) { var self = this; function transformDeclaration(decl) { if (decl.value instanceof Anonymous && !decl.parsed) { - try { - this.parse.parserInput.start(decl.value.value, false, function fail(msg, index) { - decl.parsed = true; - return decl; + this.parse.parseNode( + decl.value.value, + ["value", "important"], + decl.value.getIndex(), + decl.fileInfo(), + function(err, result) { + if (err) { + decl.parsed = true; + } + if (result) { + decl.value = result[0]; + decl.important = result[1] || ''; + decl.parsed = true; + } }); - var result = this.parse.parsers.value(); - var important = this.parse.parsers.important(); - - var endInfo = this.parse.parserInput.end(); - if (endInfo.isFinished) { - decl.value = result; - decl.imporant = important; - decl.parsed = true; - } - } catch (e) { - throw new LessError({ - index: e.index + decl.value.getIndex(), - message: e.message - }, this.parse.imports, decl.fileInfo().filename); - } return decl; } diff --git a/lib/less/tree/selector.js b/lib/less/tree/selector.js index 20bd9401c..b263cd232 100644 --- a/lib/less/tree/selector.js +++ b/lib/less/tree/selector.js @@ -1,12 +1,13 @@ var Node = require("./node"), - Element = require("./element"); + Element = require("./element"), + LessError = require("../less-error"); var Selector = function (elements, extendList, condition, index, currentFileInfo, visibilityInfo) { - this.elements = elements; this.extendList = extendList; this.condition = condition; this._index = index; this._fileInfo = currentFileInfo; + this.elements = this.getElements(elements); if (!condition) { this.evaldCondition = true; } @@ -27,6 +28,7 @@ Selector.prototype.accept = function (visitor) { } }; Selector.prototype.createDerived = function(elements, extendList, evaldCondition) { + elements = this.getElements(elements); var info = this.visibilityInfo(); evaldCondition = (evaldCondition != null) ? evaldCondition : this.evaldCondition; var newSelector = new Selector(elements, extendList || this.extendList, null, this.getIndex(), this.fileInfo(), info); @@ -34,6 +36,25 @@ Selector.prototype.createDerived = function(elements, extendList, evaldCondition newSelector.mediaEmpty = this.mediaEmpty; return newSelector; }; +Selector.prototype.getElements = function(els) { + if (typeof els === "string") { + this.parse.parseNode( + els, + ["selector"], + this._index, + this._fileInfo, + function(err, result) { + if (err) { + throw new LessError({ + index: e.index + currentIndex, + message: e.message + }, this.parse.imports, this._fileInfo.filename); + } + els = result[0].elements; + }); + } + return els; +}; Selector.prototype.createEmptySelectors = function() { var el = new Element('', '&', this._index, this._fileInfo), sels = [new Selector([el], null, null, this._index, this._fileInfo)]; @@ -45,7 +66,7 @@ Selector.prototype.match = function (other) { len = elements.length, olen, i; - other.CacheElements(); + other.cacheElements(); olen = other._elements.length; if (olen === 0 || len < olen) { @@ -60,7 +81,7 @@ Selector.prototype.match = function (other) { return olen; // return number of matched elements }; -Selector.prototype.CacheElements = function() { +Selector.prototype.cacheElements = function() { if (this._elements) { return; } diff --git a/lib/less/tree/value.js b/lib/less/tree/value.js index 1a03886c3..1f849ebc5 100644 --- a/lib/less/tree/value.js +++ b/lib/less/tree/value.js @@ -1,10 +1,17 @@ -var Node = require("./node"); +var Node = require("./node"), + Anonymous = require("./anonymous"); + var Value = function (value) { - this.value = value; if (!value) { throw new Error("Value requires an array argument"); } + if (!Array.isArray(value)) { + this.value = [ value ]; + } + else { + this.value = value; + } }; Value.prototype = new Node(); Value.prototype.type = "Value"; diff --git a/lib/less/utils.js b/lib/less/utils.js index d32a7e92b..ade845daa 100644 --- a/lib/less/utils.js +++ b/lib/less/utils.js @@ -25,5 +25,18 @@ module.exports = { copy[i] = arr[i]; } return copy; + }, + getPrototype: function(obj) { + if (Object.getPrototypeOf) { + return Object.getPrototypeOf(obj); + } + else { + if ("".__proto__ === String.prototype) { + return obj.__proto__; + } + else if (obj.constructor) { + return obj.constructor.prototype; + } + } } }; diff --git a/lib/less/visitors/visitor.js b/lib/less/visitors/visitor.js index afa05d704..44491c1a4 100644 --- a/lib/less/visitors/visitor.js +++ b/lib/less/visitors/visitor.js @@ -10,21 +10,20 @@ function _noop(node) { function indexNodeTypes(parent, ticker) { // add .typeIndex to tree node types for lookup table var key, child; - for (key in parent) { - if (parent.hasOwnProperty(key)) { - child = parent[key]; - switch (typeof child) { - case "function": - // ignore bound functions directly on tree which do not have a prototype - // or aren't nodes - if (child.prototype && child.prototype.type) { - child.prototype.typeIndex = ticker++; - } - break; - case "object": - ticker = indexNodeTypes(child, ticker); - break; - } + for (key in parent) { + child = parent[key]; + switch (typeof child) { + case "function": + // ignore bound functions directly on tree which do not have a prototype + // or aren't nodes + if (child.prototype && child.prototype.type) { + child.prototype.typeIndex = ticker++; + } + break; + case "object": + ticker = indexNodeTypes(child, ticker); + break; + } } return ticker; diff --git a/test/less/plugin.less b/test/less/plugin.less index 955a72684..1089be4b5 100644 --- a/test/less/plugin.less +++ b/test/less/plugin.less @@ -92,7 +92,7 @@ val2: foo; } -test-directive("@charset"; '"utf-8"'); -test-directive("@arbitrary"; "value after ()"); +test-atrule("@charset"; '"utf-8"'); +test-atrule("@arbitrary"; "value after ()"); diff --git a/test/less/plugin/plugin-tree-nodes.js b/test/less/plugin/plugin-tree-nodes.js index b3fcf1809..11f5a1de5 100644 --- a/test/less/plugin/plugin-tree-nodes.js +++ b/test/less/plugin/plugin-tree-nodes.js @@ -1,10 +1,10 @@ functions.addMultiple({ "test-comment": function() { - return new tree.Combinator(' '); + return less.Combinator(' '); }, - "test-directive": function(arg1, arg2) { - return new tree.Directive(arg1.value, new tree.Anonymous(arg2.value)); + "test-atrule": function(arg1, arg2) { + return less.AtRule(arg1.value, arg2.value); }, "test-extend": function() { //TODO @@ -22,7 +22,7 @@ functions.addMultiple({ //TODO }, "test-ruleset-call": function() { - return new tree.Combinator(' '); + return less.Combinator(' '); }, // Functions must return something, even if it's false/true "test-undefined": function() { @@ -33,52 +33,53 @@ functions.addMultiple({ }, // These cause root errors "test-alpha": function() { - return new tree.Alpha(30); + return less.Alpha(30); }, "test-assignment": function() { - return new tree.Assignment("bird", "robin"); + return less.Assignment("bird", "robin"); }, "test-attribute": function() { - return new tree.Attribute("foo", "=", "bar"); + return less.Attribute("foo", "=", "bar"); }, "test-call": function() { - return new tree.Call("foo"); + return less.Call("foo"); }, "test-color": function() { - return new tree.Color([50, 50, 50]); + return less.Color([50, 50, 50]); }, "test-condition": function() { - return new tree.Condition('<', new tree.Value([0]), new tree.Value([1])); + return less.Condition('<', less.Value([0]), less.Value([1])); }, "test-detached-ruleset" : function() { - var decl = new tree.Declaration('prop', new tree.Anonymous('value')); - return new tree.DetachedRuleset(new tree.Ruleset("", [ decl ])); + var decl = less.Declaration('prop', 'value'); + return less.DetachedRuleset(less.Ruleset("", [ decl ])); }, "test-dimension": function() { - return new tree.Dimension(1, 'px'); + return less.Dimension(1, 'px'); }, "test-element": function() { - return new tree.Element('+', 'a'); + return less.Element('+', 'a'); }, "test-expression": function() { - return new tree.Expression([1, 2, 3]); + return less.Expression([1, 2, 3]); }, "test-keyword": function() { - return new tree.Keyword('foo'); + return less.Keyword('foo'); }, "test-operation": function() { - return new tree.Operation('+', [1, 2]); + return less.Operation('+', [1, 2]); }, "test-quoted": function() { - return new tree.Quoted('"', 'foo'); + return less.Quoted('"', 'foo'); }, "test-selector": function() { - return new tree.Selector([new tree.Element('a')]); + var sel = less.Selector('.a.b'); + return sel; }, "test-url": function() { - return new tree.URL('http://google.com'); + return less.URL('http://google.com'); }, "test-value": function() { - return new tree.Value([1]); + return less.Value([1]); } }); \ No newline at end of file diff --git a/test/less/property-accessors.less b/test/less/property-accessors.less index 24dbd604a..e679f0d2f 100644 --- a/test/less/property-accessors.less +++ b/test/less/property-accessors.less @@ -2,7 +2,8 @@ .block_1 { color: red; background-color: $color; - width: 50px; + @width: 50px; + width: @width; height: ($width / 2); @color: red; border: 1px solid lighten($color, 10%); From abb5375acb0358987ee9d77b64251bfd9c247e52 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Tue, 19 Jul 2016 01:38:54 -0700 Subject: [PATCH 28/97] Fix JSLint and JSCS errors --- lib/less/index.js | 2 ++ lib/less/parser/parser.js | 2 +- lib/less/tree/atrule.js | 1 - lib/less/tree/ruleset.js | 1 - lib/less/tree/selector.js | 4 ++-- lib/less/tree/value.js | 4 +--- lib/less/utils.js | 1 + lib/less/visitors/visitor.js | 1 + 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/less/index.js b/lib/less/index.js index 1c3c00e3d..de50d3332 100644 --- a/lib/less/index.js +++ b/lib/less/index.js @@ -37,6 +37,7 @@ module.exports = function(environment, fileManagers) { }; var t, api = Object.create(initial); for (var n in initial.tree) { + /*jshint forin: false */ t = initial.tree[n]; if (typeof t === "function") { api[n] = ctor(t); @@ -44,6 +45,7 @@ module.exports = function(environment, fileManagers) { else { api[n] = Object.create(null); for (var o in t) { + /*jshint forin: false */ api[n][o] = ctor(t[o]); } } diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js index 13d50ac63..9cc821969 100644 --- a/lib/less/parser/parser.js +++ b/lib/less/parser/parser.js @@ -99,7 +99,7 @@ var Parser = function Parser(context, imports, fileInfo) { index: index + currentIndex }); }); - for(var x = 0, p, i; (p = parseList[x]); x++) { + for (var x = 0, p, i; (p = parseList[x]); x++) { i = parser.i; result = parsers[p](); if (result) { diff --git a/lib/less/tree/atrule.js b/lib/less/tree/atrule.js index 480bfcefd..f173a414f 100644 --- a/lib/less/tree/atrule.js +++ b/lib/less/tree/atrule.js @@ -1,7 +1,6 @@ var Node = require("./node"), Selector = require("./selector"), Ruleset = require("./ruleset"), - Value = require('./value'), Anonymous = require('./anonymous'); var AtRule = function (name, value, rules, index, currentFileInfo, debugInfo, isRooted, visibilityInfo) { diff --git a/lib/less/tree/ruleset.js b/lib/less/tree/ruleset.js index 24b67f190..5a29b8819 100644 --- a/lib/less/tree/ruleset.js +++ b/lib/less/tree/ruleset.js @@ -10,7 +10,6 @@ var Node = require("./node"), globalFunctionRegistry = require("../functions/function-registry"), defaultFunc = require("../functions/default"), getDebugInfo = require("./debug-info"), - LessError = require("../less-error"), utils = require("../utils"); var Ruleset = function (selectors, rules, strictImports, visibilityInfo) { diff --git a/lib/less/tree/selector.js b/lib/less/tree/selector.js index b263cd232..0d811359d 100644 --- a/lib/less/tree/selector.js +++ b/lib/less/tree/selector.js @@ -46,8 +46,8 @@ Selector.prototype.getElements = function(els) { function(err, result) { if (err) { throw new LessError({ - index: e.index + currentIndex, - message: e.message + index: err.index, + message: err.message }, this.parse.imports, this._fileInfo.filename); } els = result[0].elements; diff --git a/lib/less/tree/value.js b/lib/less/tree/value.js index 1f849ebc5..1e2d9b0ba 100644 --- a/lib/less/tree/value.js +++ b/lib/less/tree/value.js @@ -1,6 +1,4 @@ -var Node = require("./node"), - Anonymous = require("./anonymous"); - +var Node = require("./node"); var Value = function (value) { if (!value) { diff --git a/lib/less/utils.js b/lib/less/utils.js index ade845daa..784158735 100644 --- a/lib/less/utils.js +++ b/lib/less/utils.js @@ -1,3 +1,4 @@ +/* jshint proto: true */ module.exports = { getLocation: function(index, inputStream) { var n = index + 1, diff --git a/lib/less/visitors/visitor.js b/lib/less/visitors/visitor.js index 44491c1a4..6086b5c6a 100644 --- a/lib/less/visitors/visitor.js +++ b/lib/less/visitors/visitor.js @@ -11,6 +11,7 @@ function indexNodeTypes(parent, ticker) { // add .typeIndex to tree node types for lookup table var key, child; for (key in parent) { + /*jshint forin: false */ child = parent[key]; switch (typeof child) { case "function": From 259d8b2feed9da5ec75de1ab3c29139ea677d184 Mon Sep 17 00:00:00 2001 From: Shahar Soel Date: Wed, 27 Jul 2016 23:01:13 +0300 Subject: [PATCH 29/97] CI Build Fixes. In Short: * Enable Travis Cache to mitigate phantomjs download issues. * Enable Travis & appveyor functionality to avoid race condition on CI builds and old node.js version (0.10/0.12) Details: Using to download phantom (on travis) instead of because Travis downloads from http://cnpmjs.org/downloads are horribly slow (30k/s) and seem courrpt most of the time (smells like throttling) Travis caching is by branch + build env (node version). But it has a fallback to using the cache from the default branch so it should help even with pull requests (which are new branches). Secondly using and for to workaround race condition on with npm install and older versions of node. mitigates #2898 --- .travis.yml | 21 ++++++++++++++++++++- appveyor.yml | 10 ++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 238fb88d7..a5d8e9bb3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,31 @@ language: node_js +cache: + directories: + - travis-phantomjs node_js: - "6" - "4" - "0.12" - "0.10" +before_install: + # from https://github.com/travis-ci/travis-ci/issues/3225#issuecomment-177592725 + # and also from https://github.com/travis-ci/travis-ci/issues/3225#issuecomment-200965782 + - phantomjs --version + - export PATH=$PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64/bin:$PATH + - phantomjs --version + # Clear cache and download new copy of PhantomJS if the current version doesn't match 2.1.1. + - "if [ $(phantomjs --version) != '2.1.1' ]; then rm -rf $PWD/travis-phantomjs; mkdir -p $PWD/travis-phantomjs; fi" + - "if [ $(phantomjs --version) != '2.1.1' ]; then wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 -O $PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2; fi" + - "if [ $(phantomjs --version) != '2.1.1' ]; then tar -xvf $PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C $PWD/travis-phantomjs; fi" + - phantomjs --version install: - npm install -g grunt-cli - - npm install + # node 0.10 & 0.12 have race condition issues when running custom install scripts + # this can cause phantomjs-prebuilt install script to fail with the error: + # + # Seems related to: https://github.com/npm/npm/issues/8152 + # using solves this. + - travis_retry npm install env: global: - PHANTOMJS_CDNURL=http://cnpmjs.org/downloads diff --git a/appveyor.yml b/appveyor.yml index 5739f95cf..372a479d9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,8 +14,14 @@ install: - npm -g install npm@2 - set PATH=%APPDATA%\npm;%PATH% - npm -v - # Typical npm stuff. - - npm install + + # node 0.10 & 0.12 have race condition issues when running custom install scripts + # this can cause phantomjs-prebuilt install script to fail with the error: + # + # Seems related to: https://github.com/npm/npm/issues/8152 + # using solves this. + - appveyor-retry call npm install + # Grunt-specific stuff. - npm install -g grunt-cli From efaec8370dc674f578472ba5cd63887d744b2701 Mon Sep 17 00:00:00 2001 From: Barnaby Colby Date: Thu, 4 Aug 2016 08:51:19 +0000 Subject: [PATCH 30/97] Fixed sourcMapBasepath bug as the option had no affect on the sourceMapURL. --- lib/less/source-map-builder.js | 3 +++ lib/less/source-map-output.js | 19 ++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/less/source-map-builder.js b/lib/less/source-map-builder.js index ee28041e8..62f7cf230 100644 --- a/lib/less/source-map-builder.js +++ b/lib/less/source-map-builder.js @@ -26,6 +26,9 @@ module.exports = function (SourceMapOutput, environment) { if (this.options.sourceMapInputFilename) { this.sourceMapInputFilename = sourceMapOutput.normalizeFilename(this.options.sourceMapInputFilename); } + if (this.options.sourceMapBasepath !== undefined && this.sourceMapURL !== undefined) { + this.sourceMapURL = sourceMapOutput.removeBasepath(this.sourceMapURL); + } return css + this.getCSSAppendage(); }; diff --git a/lib/less/source-map-output.js b/lib/less/source-map-output.js index 4e21e24cc..35e65cccc 100644 --- a/lib/less/source-map-output.js +++ b/lib/less/source-map-output.js @@ -28,15 +28,20 @@ module.exports = function (environment) { this._column = 0; }; - SourceMapOutput.prototype.normalizeFilename = function(filename) { - filename = filename.replace(/\\/g, '/'); - - if (this._sourceMapBasepath && filename.indexOf(this._sourceMapBasepath) === 0) { - filename = filename.substring(this._sourceMapBasepath.length); - if (filename.charAt(0) === '\\' || filename.charAt(0) === '/') { - filename = filename.substring(1); + SourceMapOutput.prototype.removeBasepath = function(path) { + if (this._sourceMapBasepath && path.indexOf(this._sourceMapBasepath) === 0) { + path = path.substring(this._sourceMapBasepath.length); + if (path.charAt(0) === '\\' || path.charAt(0) === '/') { + path = path.substring(1); } } + + return path; + }; + + SourceMapOutput.prototype.normalizeFilename = function(filename) { + filename = filename.replace(/\\/g, '/'); + filename = this.removeBasepath(filename); return (this._sourceMapRootpath || "") + filename; }; From 80c214d3c93a40e44159a49dff1c2e0a735487ff Mon Sep 17 00:00:00 2001 From: Barnaby Colby Date: Thu, 4 Aug 2016 21:20:15 +0000 Subject: [PATCH 31/97] Added code to the source map test function to check the presence and correctness of the sourceMappingURL CSS appendage. --- test/less-test.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/less-test.js b/test/less-test.js index 0d71a37cb..9584b908e 100644 --- a/test/less-test.js +++ b/test/less-test.js @@ -74,6 +74,25 @@ module.exports = function() { }); function testSourcemap(name, err, compiledLess, doReplacements, sourcemap, baseFolder) { + // Check the sourceMappingURL at the bottom of the file + var expectedSourceMapURL = name + ".css.map", + sourceMappingPrefix = "/*# sourceMappingURL=", + sourceMappingSuffix = " */", + expectedCSSAppendage = sourceMappingPrefix + expectedSourceMapURL + sourceMappingSuffix; + if (!compiledLess.endsWith(expectedCSSAppendage)) { + // To display a better error message, we need to figure out what the actual sourceMappingURL value was, if it was even present + var indexOfSourceMappingPrefix = compiledLess.indexOf(sourceMappingPrefix); + if (indexOfSourceMappingPrefix === -1) { + fail("ERROR: sourceMappingURL was not found in " + baseFolder + "/" + name + ".css."); + return; + } + + var startOfSourceMappingValue = indexOfSourceMappingPrefix + sourceMappingPrefix.length, + indexOfNextSpace = compiledLess.indexOf(" ", startOfSourceMappingValue), + actualSourceMapURL = compiledLess.substring(startOfSourceMappingValue, indexOfNextSpace === -1 ? compiledLess.length : indexOfNextSpace); + fail("ERROR: sourceMappingURL should be \"" + expectedSourceMapURL + "\" but is \"" + actualSourceMapURL + "\"."); + } + fs.readFile(path.join('test/', name) + '.json', 'utf8', function (e, expectedSourcemap) { process.stdout.write("- " + path.join(baseFolder, name) + ": "); if (sourcemap === expectedSourcemap) { @@ -213,6 +232,11 @@ module.exports = function() { options.sourceMapRootpath = "testweb/"; // TODO separate options? options.sourceMap = options; + + // This options is normally set by the bin/lessc script. Setting it causes the sourceMappingURL comment to be appended to the CSS + // output. The value is designed to allow the sourceMapBasepath option to be tested, as it should be removed by less before + // setting the sourceMappingURL value, leaving just the sourceMapOutputFilename and .map extension. + options.sourceMapFilename = options.sourceMapBasepath + "/" + options.sourceMapOutputFilename + ".map"; } options.getVars = function(file) { From 50efcdd7aa35c977398892ce6b456b946b1ba3e0 Mon Sep 17 00:00:00 2001 From: Barnaby Colby Date: Fri, 5 Aug 2016 18:07:52 +0100 Subject: [PATCH 32/97] Added code to ensure that String.prototype.endsWith is always defined, preventing a problem when testSourceMap is run on older versions of node. --- test/less-test.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/less-test.js b/test/less-test.js index 9584b908e..7a2a3e504 100644 --- a/test/less-test.js +++ b/test/less-test.js @@ -19,6 +19,14 @@ module.exports = function() { var normalFolder = 'test/less'; var bomFolder = 'test/less-bom'; + // Define String.prototype.endsWith if it doesn't exist (in older versions of node) + // This is required by the testSourceMap function below + if (typeof String.prototype.endsWith !== 'function') { + String.prototype.endsWith = function (str) { + return this.slice(-str.length) === str; + } + } + less.logger.addListener({ info: function(msg) { if (isVerbose) { From 77fde7eb7841d7e2d9c87fdc1dba511369f5a065 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 23 Aug 2016 14:03:26 -0700 Subject: [PATCH 33/97] Allow less imports of paths like 'dir/css' --- lib/less/tree/import.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/less/tree/import.js b/lib/less/tree/import.js index 3787b052b..750883d91 100644 --- a/lib/less/tree/import.js +++ b/lib/less/tree/import.js @@ -29,7 +29,7 @@ var Import = function (path, features, options, index, currentFileInfo, visibili this.css = !this.options.less || this.options.inline; } else { var pathValue = this.getPath(); - if (pathValue && /[#\.\&\?\/]css([\?;].*)?$/.test(pathValue)) { + if (pathValue && /[#\.\&\?]css([\?;].*)?$/.test(pathValue)) { this.css = true; } } From 26bb0d4405850ed8bb053f91437758436107fdb5 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 25 Aug 2016 17:02:34 -0700 Subject: [PATCH 34/97] Remove test for inferring css import based on path --- test/css/import.css | 1 - test/less/import.less | 2 -- 2 files changed, 3 deletions(-) diff --git a/test/css/import.css b/test/css/import.css index c39470c7d..c991ca4ce 100644 --- a/test/css/import.css +++ b/test/css/import.css @@ -1,6 +1,5 @@ @charset "UTF-8"; /** comment at the top**/ -@import url(http://fonts.googleapis.com/css?family=Open+Sans); @import url(/absolute/something.css) screen and (color) and (max-width: 600px); @import url("//ha.com/file.css") (min-width: 100px); #import-test { diff --git a/test/less/import.less b/test/less/import.less index 2beeab1b0..ea6db7c19 100644 --- a/test/less/import.less +++ b/test/less/import.less @@ -1,6 +1,4 @@ /** comment at the top**/ -@import url(http://fonts.googleapis.com/css?family=Open+Sans); - @import url(/absolute/something.css) screen and (color) and (max-width: 600px); @import (optional) "file-does-not-exist.does-not-exist"; From 6e6bb5d7c2f60b0b8705d779ecd8bd0da47a6867 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Sat, 1 Oct 2016 19:00:28 -0700 Subject: [PATCH 35/97] Reduce sauce tests --- Gruntfile.js | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index ca6bad83f..40d9e7c22 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -25,21 +25,11 @@ module.exports = function (grunt) { version: '9', platform: 'OS X 10.11' }, - { - browserName: 'safari', - version: '8', - platform: 'OS X 10.10' - }, { browserName: "internet explorer", version: '8', platform: 'Windows XP' }, - { - browserName: "internet explorer", - version: '9', - platform: 'Windows 7' - }, { browserName: "internet explorer", version: '11', @@ -53,15 +43,10 @@ module.exports = function (grunt) { // Mobile browsers { browserName: "ipad", - version: '8.0', + version: '8.4', platform: 'OS X 10.9', 'device-orientation': 'portrait' }, - { - browserName: 'iphone', - version: '7.1', - platform: 'OS X 10.9' - }, { browserName: 'iphone', version: '9.3', @@ -93,7 +78,7 @@ module.exports = function (grunt) { sauceJobs[testName] = { options: { urls: ["http://localhost:8081/tmp/browser/test-runner-" + testName + ".html"], - testname: 'Less.js test - ' + testName, + testname: testName, browsers: browsers, public: 'public', recordVideo: false, From b23ffe1e4bd76dee852d14f58ff0b2bf1a845e89 Mon Sep 17 00:00:00 2001 From: Kirill Rogovoy Date: Wed, 12 Oct 2016 11:15:31 +0300 Subject: [PATCH 36/97] Move error formatting logic to LessError --- bin/lessc | 8 +++- lib/less-node/index.js | 56 ---------------------------- lib/less/less-error.js | 83 ++++++++++++++++++++++++++++++++++++++++-- test/less-test.js | 12 +++--- 4 files changed, 92 insertions(+), 67 deletions(-) diff --git a/bin/lessc b/bin/lessc index e109ce08c..60b8ebc6c 100755 --- a/bin/lessc +++ b/bin/lessc @@ -37,7 +37,7 @@ var less = require('../lib/less-node'), modifyVars: null, urlArgs: '', plugins: plugins - }; + }; if (less.options) { for (var i = 0, keys = Object.keys(options); i < keys.length; i++) { @@ -310,7 +310,11 @@ function render() { } }, function(err) { - less.writeError(err, options); + if (!options.silent) { + console.error(err.toString({ + stylize: options.color && less.lesscHelper.stylize + })); + } process.exitCode = 1; }); }; diff --git a/lib/less-node/index.js b/lib/less-node/index.js index ab2783364..4e379845b 100644 --- a/lib/less-node/index.js +++ b/lib/less-node/index.js @@ -14,62 +14,6 @@ less.FileManager = FileManager; less.UrlFileManager = UrlFileManager; less.options = less.options || {}; -less.formatError = function(ctx, options) { - options = options || {}; - - var message = ""; - var extract = ctx.extract; - var error = []; - var stylize = options.color ? lesscHelper.stylize : function (str) { return str; }; - - // only output a stack if it isn't a less error - if (ctx.stack && !ctx.type) { return stylize(ctx.stack, 'red'); } - - if (!ctx.hasOwnProperty('index') || !extract) { - return ctx.stack || ctx.message; - } - - if (typeof extract[0] === 'string') { - error.push(stylize((ctx.line - 1) + ' ' + extract[0], 'grey')); - } - - if (typeof extract[1] === 'string') { - var errorTxt = ctx.line + ' '; - if (extract[1]) { - errorTxt += extract[1].slice(0, ctx.column) + - stylize(stylize(stylize(extract[1].substr(ctx.column, 1), 'bold') + - extract[1].slice(ctx.column + 1), 'red'), 'inverse'); - } - error.push(errorTxt); - } - - if (typeof extract[2] === 'string') { - error.push(stylize((ctx.line + 1) + ' ' + extract[2], 'grey')); - } - error = error.join('\n') + stylize('', 'reset') + '\n'; - - message += stylize(ctx.type + 'Error: ' + ctx.message, 'red'); - if (ctx.filename) { - message += stylize(' in ', 'red') + ctx.filename + - stylize(' on line ' + ctx.line + ', column ' + (ctx.column + 1) + ':', 'grey'); - } - - message += '\n' + error; - - if (ctx.callLine) { - message += stylize('from ', 'red') + (ctx.filename || '') + '/n'; - message += stylize(ctx.callLine, 'grey') + ' ' + ctx.callExtract + '/n'; - } - - return message; -}; - -less.writeError = function (ctx, options) { - options = options || {}; - if (options.silent) { return; } - console.error(less.formatError(ctx, options)); -}; - // provide image-size functionality require('./image-size')(less.environment); diff --git a/lib/less/less-error.js b/lib/less/less-error.js index acaac22b1..d4a2cca6b 100644 --- a/lib/less/less-error.js +++ b/lib/less/less-error.js @@ -1,7 +1,27 @@ -var utils = require("./utils"); - +var utils = require('./utils'); +/** + * This is a centralized class of any error that could be thrown internally (mostly by the parser). + * Besides standard .message it keeps some additional data like a path to the file where the error + * occurred along with line and column numbers. + * + * @class + * @extends Error + * @type {module.LessError} + * + * @prop {string} type + * @prop {string} filename + * @prop {number} index + * @prop {number} line + * @prop {number} column + * @prop {number} callLine + * @prop {number} callExtract + * @prop {string[]} extract + * + * @param {Object} e - An error object to wrap around or just a descriptive object + * @param {Object} importManager - An instance of ImportManager (see import-manager.js) + * @param {string} [currentFilename] + */ var LessError = module.exports = function LessError(e, importManager, currentFilename) { - Error.call(this); var filename = e.filename || currentFilename; @@ -40,3 +60,60 @@ if (typeof Object.create === 'undefined') { } LessError.prototype.constructor = LessError; + +/** + * An overridden version of the default Object.prototype.toString + * which uses additional information to create a helpful message. + * + * @param {Object} options + * @returns {string} + */ +LessError.prototype.toString = function(options) { + options = options || {}; + + var message = ''; + var extract = this.extract; + var error = []; + var stylize = function (str) { return str; }; + if (options.stylize) { + var type = typeof options.stylize; + if (type !== 'function') { + throw Error('options.stylize should be a function, got a ' + type + '!'); + } + stylize = options.stylize; + } + + if (typeof extract[0] === 'string') { + error.push(stylize((this.line - 1) + ' ' + extract[0], 'grey')); + } + + if (typeof extract[1] === 'string') { + var errorTxt = this.line + ' '; + if (extract[1]) { + errorTxt += extract[1].slice(0, this.column) + + stylize(stylize(stylize(extract[1].substr(this.column, 1), 'bold') + + extract[1].slice(this.column + 1), 'red'), 'inverse'); + } + error.push(errorTxt); + } + + if (typeof extract[2] === 'string') { + error.push(stylize((this.line + 1) + ' ' + extract[2], 'grey')); + } + error = error.join('\n') + stylize('', 'reset') + '\n'; + + message += stylize(this.type + 'Error: ' + this.message, 'red'); + if (this.filename) { + message += stylize(' in ', 'red') + this.filename + + stylize(' on line ' + this.line + ', column ' + (this.column + 1) + ':', 'grey'); + } + + message += '\n' + error; + + if (this.callLine) { + message += stylize('from ', 'red') + (this.filename || '') + '/n'; + message += stylize(this.callLine, 'grey') + ' ' + this.callExtract + '/n'; + } + + return message; +}; diff --git a/test/less-test.js b/test/less-test.js index 7a2a3e504..5b2be4718 100644 --- a/test/less-test.js +++ b/test/less-test.js @@ -136,20 +136,20 @@ module.exports = function() { function testErrors(name, err, compiledLess, doReplacements, sourcemap, baseFolder) { fs.readFile(path.join(baseFolder, name) + '.txt', 'utf8', function (e, expectedErr) { - process.stdout.write("- " + path.join(baseFolder, name) + ": "); + process.stdout.write('- ' + path.join(baseFolder, name) + ": "); expectedErr = doReplacements(expectedErr, baseFolder); if (!err) { if (compiledLess) { - fail("No Error", 'red'); + fail('No Error', 'red'); } else { - fail("No Error, No Output"); + fail('No Error, No Output'); } } else { - var errMessage = less.formatError(err); + var errMessage = err.toString(); if (errMessage === expectedErr) { ok('OK'); } else { - difference("FAIL", expectedErr, errMessage); + difference('FAIL', expectedErr, errMessage); } } }); @@ -254,7 +254,7 @@ module.exports = function() { var doubleCallCheck = false; queue(function() { toCSS(options, path.join(baseFolder, foldername + file), function (err, result) { - + if (doubleCallCheck) { totalTests++; fail("less is calling back twice"); From 068d6546037ba371f5b493c6ea0dba9f578325a0 Mon Sep 17 00:00:00 2001 From: Kirill Rogovoy Date: Wed, 12 Oct 2016 11:15:56 +0300 Subject: [PATCH 37/97] Refactor test/index.js removing code duplicates --- test/index.js | 79 ++++++++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 36 deletions(-) diff --git a/test/index.js b/test/index.js index c239e2fee..e2027f962 100644 --- a/test/index.js +++ b/test/index.js @@ -18,42 +18,49 @@ function getErrorPathReplacementFunction(dir) { console.log("\n" + stylize("Less", 'underline') + "\n"); lessTester.prepBomTest(); -lessTester.runTestSet({strictMath: true, relativeUrls: true, silent: true, javascriptEnabled: true}); -lessTester.runTestSet({strictMath: true, strictUnits: true, javascriptEnabled: true}, "errors/", - lessTester.testErrors, null, getErrorPathReplacementFunction("errors")); -lessTester.runTestSet({strictMath: true, strictUnits: true, javascriptEnabled: false}, "no-js-errors/", - lessTester.testErrors, null, getErrorPathReplacementFunction("no-js-errors")); -lessTester.runTestSet({strictMath: true, dumpLineNumbers: 'comments'}, "debug/", null, - function(name) { return name + '-comments'; }); -lessTester.runTestSet({strictMath: true, dumpLineNumbers: 'mediaquery'}, "debug/", null, - function(name) { return name + '-mediaquery'; }); -lessTester.runTestSet({strictMath: true, dumpLineNumbers: 'all'}, "debug/", null, - function(name) { return name + '-all'; }); -lessTester.runTestSet({strictMath: true, relativeUrls: false, rootpath: "folder (1)/"}, "static-urls/"); -lessTester.runTestSet({strictMath: true, compress: true}, "compression/"); -lessTester.runTestSet({strictMath: true, strictUnits: true}, "strict-units/"); -lessTester.runTestSet({}, "legacy/"); -lessTester.runTestSet({strictMath: true, strictUnits: true, sourceMap: true, globalVars: true }, "sourcemaps/", - lessTester.testSourcemap, null, null, - function(filename, type, baseFolder) { - if (type === "vars") { - return path.join(baseFolder, filename) + '.json'; - } - return path.join('test/sourcemaps', filename) + '.json'; - }); -lessTester.runTestSet({strictMath: true, strictUnits: true, sourceMap: {sourceMapFileInline: true}}, "sourcemaps-empty/", lessTester.testEmptySourcemap); -lessTester.runTestSet({globalVars: true, banner: "/**\n * Test\n */\n"}, "globalVars/", - null, null, null, function(name, type, baseFolder) { return path.join(baseFolder, name) + '.json'; }); -lessTester.runTestSet({modifyVars: true}, "modifyVars/", - null, null, null, function(name, type, baseFolder) { return path.join(baseFolder, name) + '.json'; }); -lessTester.runTestSet({urlArgs: '424242'}, "url-args/"); -lessTester.runTestSet({paths: ['test/data/', 'test/less/import/']}, "include-path/"); -lessTester.runTestSet({paths: 'test/data/'}, "include-path-string/"); -lessTester.runTestSet({plugin: 'test/plugins/postprocess/'}, "postProcessorPlugin/"); -lessTester.runTestSet({plugin: 'test/plugins/preprocess/'}, "preProcessorPlugin/"); -lessTester.runTestSet({plugin: 'test/plugins/visitor/'}, "visitorPlugin/"); -lessTester.runTestSet({plugin: 'test/plugins/filemanager/'}, "filemanagerPlugin/"); -lessTester.runTestSet({}, "no-strict-math/"); +var testMap = [ + [{strictMath: true, relativeUrls: true, silent: true, javascriptEnabled: true}], + [{strictMath: true, strictUnits: true, javascriptEnabled: true}, "errors/", + lessTester.testErrors, null, getErrorPathReplacementFunction("errors")], + [{strictMath: true, strictUnits: true, javascriptEnabled: false}, "no-js-errors/", + lessTester.testErrors, null, getErrorPathReplacementFunction("no-js-errors")], + [{strictMath: true, dumpLineNumbers: 'comments'}, "debug/", null, + function(name) { return name + '-comments'; }], + [{strictMath: true, dumpLineNumbers: 'mediaquery'}, "debug/", null, + function(name) { return name + '-mediaquery'; }], + [{strictMath: true, dumpLineNumbers: 'all'}, "debug/", null, + function(name) { return name + '-all'; }], + [{strictMath: true, relativeUrls: false, rootpath: "folder (1)/"}, "static-urls/"], + [{strictMath: true, compress: true}, "compression/"], + [{strictMath: true, strictUnits: true}, "strict-units/"], + [{}, "legacy/"], + [{strictMath: true, strictUnits: true, sourceMap: true, globalVars: true }, "sourcemaps/", + lessTester.testSourcemap, null, null, + function(filename, type, baseFolder) { + if (type === "vars") { + return path.join(baseFolder, filename) + '.json'; + } + return path.join('test/sourcemaps', filename) + '.json'; + }], + [{strictMath: true, strictUnits: true, sourceMap: {sourceMapFileInline: true}}, + "sourcemaps-empty/", lessTester.testEmptySourcemap], + [{globalVars: true, banner: "/**\n * Test\n */\n"}, "globalVars/", + null, null, null, function(name, type, baseFolder) { return path.join(baseFolder, name) + '.json'; }], + [{modifyVars: true}, "modifyVars/", + null, null, null, function(name, type, baseFolder) { return path.join(baseFolder, name) + '.json'; }], + [{urlArgs: '424242'}, "url-args/"], + [{paths: ['test/data/', 'test/less/import/']}, "include-path/"], + [{paths: 'test/data/'}, "include-path-string/"], + [{plugin: 'test/plugins/postprocess/'}, "postProcessorPlugin/"], + [{plugin: 'test/plugins/preprocess/'}, "preProcessorPlugin/"], + [{plugin: 'test/plugins/visitor/'}, "visitorPlugin/"], + [{plugin: 'test/plugins/filemanager/'}, "filemanagerPlugin/"], + [{}, "no-strict-math/"] +]; + +testMap.forEach(function(args) { + lessTester.runTestSet.apply(lessTester, args) +}); lessTester.testSyncronous({syncImport: true}, "import"); lessTester.testSyncronous({syncImport: true}, "css"); lessTester.testNoOptions(); From a45bef88dd09cc8527e48302143b9622e76384f3 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Fri, 21 Oct 2016 16:14:01 -0700 Subject: [PATCH 38/97] Change --inline-js to simplified --js option --- bin/lessc | 4 ++-- lib/less-node/lessc-helper.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/lessc b/bin/lessc index e109ce08c..3a65a415b 100755 --- a/bin/lessc +++ b/bin/lessc @@ -430,11 +430,11 @@ function processPluginQueue() { case 'no-ie-compat': options.ieCompat = false; break; - case 'inline-js': + case 'js': options.javascriptEnabled = true; break; case 'no-js': - console.error('The "--no-js" argument is deprecated. Use "--inline-js" to enable inline JavaScript.'); + console.error('The "--no-js" argument is deprecated, as inline JavaScript is disabled by default. Use "--js" to enable inline JavaScript (not recommended).'); break; case 'include-path': if (checkArgFunc(arg, match[2])) { diff --git a/lib/less-node/lessc-helper.js b/lib/less-node/lessc-helper.js index 3aa84c99d..e9fbd8437 100644 --- a/lib/less-node/lessc-helper.js +++ b/lib/less-node/lessc-helper.js @@ -31,7 +31,7 @@ var lessc_helper = { console.log(" -M, --depends Outputs a makefile import dependency list to stdout."); console.log(" --no-color Disables colorized output."); console.log(" --no-ie-compat Disables IE compatibility checks."); - console.log(" --inline-js Enables inline JavaScript in less files"); + console.log(" --js Enables inline JavaScript in less files"); console.log(" -l, --lint Syntax check only (lint)."); console.log(" -s, --silent Suppresses output of error messages."); console.log(" --strict-imports Forces evaluation of imports."); From 883b88ea134b1a6f32acb42fe5a3e9da842f942d Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Fri, 21 Oct 2016 16:15:04 -0700 Subject: [PATCH 39/97] Restore single "all" task for SauceLabs --- Gruntfile.js | 87 ++++++++++++---------------------------------------- 1 file changed, 20 insertions(+), 67 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 40d9e7c22..5a2a45247 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -74,11 +74,17 @@ module.exports = function (grunt) { "legacy" ]; - browserTests.map(function(testName) { + (['all'].concat(browserTests)).map(makeJob); + + function makeJob(testName) { sauceJobs[testName] = { options: { - urls: ["http://localhost:8081/tmp/browser/test-runner-" + testName + ".html"], - testname: testName, + urls: testName === 'all' + ? browserTests.map(function(name) { + return "http://localhost:8081/tmp/browser/test-runner-" + name + ".html"; + }) + : ["http://localhost:8081/tmp/browser/test-runner-" + testName + ".html"], + testname: testName === 'all' ? 'Unit Tests for Less.js' : testName, browsers: browsers, public: 'public', recordVideo: false, @@ -125,7 +131,7 @@ module.exports = function (grunt) { } } }; - }); + } // Project configuration. grunt.initConfig({ @@ -305,7 +311,7 @@ module.exports = function (grunt) { } }, browser: { - src: ['test/browser/less/*.less'], + src: ['test/browser/less/*.less', 'test/browser/less/plugin/*.less'], options: { helpers: 'test/browser/runner-browser-options.js', specs: 'test/browser/runner-browser-spec.js', @@ -396,62 +402,6 @@ module.exports = function (grunt) { 'saucelabs-jasmine': sauceJobs, - // { - // all: { - // options: { - // urls: ["filemanager-plugin","visitor-plugin","pre-processor-plugin","post-processor-plugin","global-vars", "modify-vars", "production", "rootpath-relative", - // "rootpath", "relative-urls", "browser", "no-js-errors", "legacy", "strict-units" - // ].map(function(testName) { - // return "http://localhost:8081/tmp/browser/test-runner-" + testName + ".html"; - // }), - // testname: 'Sauce Unit Test for less.js', - // browsers: browsers, - // public: 'public', - // pollInterval: 2000, - // statusCheckAttempts: 30, - // recordVideo: false, - // videoUploadOnPass: false, - // recordScreenshots: process.env.TRAVIS_BRANCH !== "master", - // build: process.env.TRAVIS_BRANCH === "master" ? process.env.TRAVIS_JOB_ID : undefined, - // tags: [process.env.TRAVIS_BUILD_NUMBER, process.env.TRAVIS_PULL_REQUEST, process.env.TRAVIS_BRANCH], - // sauceConfig: { - // 'idle-timeout': 100 - // }, - // throttled: 5, - // onTestComplete: function(result, callback) { - // // Called after a unit test is done, per page, per browser - // // 'result' param is the object returned by the test framework's reporter - // // 'callback' is a Node.js style callback function. You must invoke it after you - // // finish your work. - // // Pass a non-null value as the callback's first parameter if you want to throw an - // // exception. If your function is synchronous you can also throw exceptions - // // directly. - // // Passing true or false as the callback's second parameter passes or fails the - // // test. Passing undefined does not alter the test result. Please note that this - // // only affects the grunt task's result. You have to explicitly update the Sauce - // // Labs job's status via its REST API, if you want so. - - // // This should be the encrypted value in Travis - // var user = process.env.SAUCE_USERNAME; - // var pass = process.env.SAUCE_ACCESS_KEY; - - // require('request').put({ - // url: ['https://saucelabs.com/rest/v1', user, 'jobs', result.job_id].join('/'), - // auth: { user: user, pass: pass }, - // json: { passed: result.passed } - // }, function (error, response, body) { - // if (error) { - // callback(error); - // } else if (response.statusCode !== 200) { - // callback(new Error('Unexpected response status')); - // } else { - // callback(null, result.passed); - // } - // }); - // } - // } - // } - // }, // Clean the version of less built for the tests clean: { @@ -529,12 +479,15 @@ module.exports = function (grunt) { 'sauce-after-setup' ]); - var sauceTests = []; - browserTests.map(function(testName) { - sauceTests.push('saucelabs-jasmine:' + testName); - }); - sauceTests.push('clean:sauce_log'); - grunt.registerTask('sauce-after-setup', sauceTests); + // var sauceTests = []; + // browserTests.map(function(testName) { + // sauceTests.push('saucelabs-jasmine:' + testName); + // }); + + grunt.registerTask('sauce-after-setup', [ + 'saucelabs-jasmine:all', + 'clean:sauce_log' + ]); var testTasks = [ 'clean', From 96df3f4b7ed70229e63f9a72302963a0d16843f0 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Fri, 21 Oct 2016 16:23:19 -0700 Subject: [PATCH 40/97] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a589ea9f9..7c8977477 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![npm version](https://badge.fury.io/js/less.svg)](http://badge.fury.io/js/less) [![Build Status](https://travis-ci.org/less/less.js.svg?branch=master)](https://travis-ci.org/less/less.js) [![Dependencies](https://david-dm.org/less/less.js.svg)](https://david-dm.org/less/less.js) [![devDependency Status](https://david-dm.org/less/less.js/dev-status.svg)](https://david-dm.org/less/less.js#info=devDependencies) [![optionalDependency Status](https://david-dm.org/less/less.js/optional-status.svg)](https://david-dm.org/less/less.js#info=optionalDependencies) -[![Sauce Test Status](https://saucelabs.com/browser-matrix/less.svg)](https://saucelabs.com/u/less) [![Build status](https://ci.appveyor.com/api/projects/status/bx2qspy3qbuxpl9q/branch/master?svg=true)](https://ci.appveyor.com/project/lukeapage/less-js/branch/master) +[![Sauce Test Status](https://saucelabs.com/browser-matrix/less.svg)](https://saucelabs.com/u/less) [![Build status](https://ci.appveyor.com/api/projects/status/bx2qspy3qbuxpl9q/branch/3.x?svg=true)](https://ci.appveyor.com/project/lukeapage/less-js/branch/3.x) # [Less.js](http://lesscss.org) From 387b3899e03d4ce2d98306c68c3b950818471f7f Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Fri, 21 Oct 2016 16:31:10 -0700 Subject: [PATCH 41/97] Fix JShint errors --- Gruntfile.js | 14 ++++++++------ bin/lessc | 3 ++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 5a2a45247..d8179ce9e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -74,16 +74,14 @@ module.exports = function (grunt) { "legacy" ]; - (['all'].concat(browserTests)).map(makeJob); - function makeJob(testName) { sauceJobs[testName] = { options: { - urls: testName === 'all' - ? browserTests.map(function(name) { + urls: testName === 'all' ? + browserTests.map(function(name) { return "http://localhost:8081/tmp/browser/test-runner-" + name + ".html"; - }) - : ["http://localhost:8081/tmp/browser/test-runner-" + testName + ".html"], + }) : + ["http://localhost:8081/tmp/browser/test-runner-" + testName + ".html"], testname: testName === 'all' ? 'Unit Tests for Less.js' : testName, browsers: browsers, public: 'public', @@ -132,6 +130,10 @@ module.exports = function (grunt) { } }; } + + // Make the SauceLabs jobs + (['all'].concat(browserTests)).map(makeJob); + // Project configuration. grunt.initConfig({ diff --git a/bin/lessc b/bin/lessc index 3a65a415b..6d9dc2b8b 100755 --- a/bin/lessc +++ b/bin/lessc @@ -434,7 +434,8 @@ function processPluginQueue() { options.javascriptEnabled = true; break; case 'no-js': - console.error('The "--no-js" argument is deprecated, as inline JavaScript is disabled by default. Use "--js" to enable inline JavaScript (not recommended).'); + console.error('The "--no-js" argument is deprecated, as inline JavaScript ' + + 'is disabled by default. Use "--js" to enable inline JavaScript (not recommended).'); break; case 'include-path': if (checkArgFunc(arg, match[2])) { From 26041d9aa577688b27ed276dabf49fbf162a6429 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Fri, 21 Oct 2016 16:40:21 -0700 Subject: [PATCH 42/97] Bump version for lessc change --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 95f5cedf4..ce8ecfc35 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "less", - "version": "3.0.0-pre.3", + "version": "3.0.0-pre.4", "description": "Leaner CSS", "homepage": "http://lesscss.org", "author": { From d0fbadba2ec4c92d9871da5a1f282c67c96a995b Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Sun, 20 Nov 2016 18:07:19 -0800 Subject: [PATCH 43/97] Yes! Less.js tests now working for all browser platforms (except for local timeout error - to fix) --- Gruntfile.js | 54 ++++++++----- package.json | 1 + test/browser/test-runner-template.tmpl | 108 ++++++++++++++++++++----- 3 files changed, 123 insertions(+), 40 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index d8179ce9e..7d9dfd9e4 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -6,6 +6,7 @@ module.exports = function (grunt) { require('time-grunt')(grunt); var COMPRESS_FOR_TESTS = true; + var git = require('git-rev'); // Sauce Labs browser var browsers = [ @@ -42,19 +43,24 @@ module.exports = function (grunt) { }, // Mobile browsers { - browserName: "ipad", + browserName: 'ipad', + deviceName: 'iPad Air Simulator', + deviceOrientation: 'portrait', version: '8.4', - platform: 'OS X 10.9', - 'device-orientation': 'portrait' + platform: 'OS X 10.9' }, { browserName: 'iphone', + deviceName: 'iPhone 5 Simulator', + deviceOrientation: 'portrait', version: '9.3', - platform: 'OS X 10.10' + platform: 'OS X 10.11' }, { - browerName: 'android', - version: '4.2', + browserName: 'android', + deviceName: 'Google Nexus 7 HD Emulator', + deviceOrientation: 'portrait', + version: '4.4', platform: 'Linux' } ]; @@ -90,6 +96,7 @@ module.exports = function (grunt) { recordScreenshots: process.env.TRAVIS_BRANCH !== "master", build: process.env.TRAVIS_BRANCH === "master" ? process.env.TRAVIS_JOB_ID : undefined, tags: [process.env.TRAVIS_BUILD_NUMBER, process.env.TRAVIS_PULL_REQUEST, process.env.TRAVIS_BRANCH], + statusCheckAttempts: -1, sauceConfig: { 'idle-timeout': 100 }, @@ -111,21 +118,27 @@ module.exports = function (grunt) { var user = process.env.SAUCE_USERNAME; var pass = process.env.SAUCE_ACCESS_KEY; - require('request').put({ - url: ['https://saucelabs.com/rest/v1', user, 'jobs', result.job_id].join('/'), - auth: { user: user, pass: pass }, - json: { passed: result.passed } - }, function (error, response, body) { - if (error) { - console.log(error); - callback(error); - } else if (response.statusCode !== 200) { - console.log(response); - callback(new Error('Unexpected response status')); - } else { - callback(null, result.passed); - } + git.short(function(hash) { + require('request').put({ + url: ['https://saucelabs.com/rest/v1', user, 'jobs', result.job_id].join('/'), + auth: { user: user, pass: pass }, + json: { + passed: result.passed, + build: 'build-' + hash + } + }, function (error, response, body) { + if (error) { + console.log(error); + callback(error); + } else if (response.statusCode !== 200) { + console.log(response); + callback(new Error('Unexpected response status')); + } else { + callback(null, result.passed); + } + }); }); + } } }; @@ -415,6 +428,7 @@ module.exports = function (grunt) { // Load these plugins to provide the necessary tasks grunt.loadNpmTasks('grunt-saucelabs'); + require('jit-grunt')(grunt); // Actually load this plugin's task(s). diff --git a/package.json b/package.json index ce8ecfc35..d26f08758 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ }, "devDependencies": { "diff": "^2.2.2", + "git-rev": "^0.2.1", "grunt": "~0.4.5", "grunt-browserify": "^5.0.0", "grunt-contrib-clean": "^1.0.0", diff --git a/test/browser/test-runner-template.tmpl b/test/browser/test-runner-template.tmpl index 6ef3e46fc..ffaf05d9a 100644 --- a/test/browser/test-runner-template.tmpl +++ b/test/browser/test-runner-template.tmpl @@ -2,23 +2,53 @@ - Jasmine Spec Runner - - - + + Jasmine Spec Runner + + <% var generateScriptTags = function(allScripts) { allScripts.forEach(function(script){ %> - + <% }); }; %> + + <% var toArray = function(scripts) { + %>[<% + scripts.forEach(function(scriptUrl, index){ + %>"<%= scriptUrl %>"<% + if (index !== scripts.length -1) { + %>,<% + } + }); + %>]<% + }; %> + <% scripts.src.forEach(function(fullLessName) { var pathParts = fullLessName.split('/'); var fullCssName = fullLessName.replace(/less/g, 'css'); var lessName = pathParts[pathParts.length - 1]; var name = lessName.split('.')[0]; %> + <% }); %> @@ -27,24 +57,62 @@ <% css.forEach(function(style){ %> <% }) %> + - <% - var jasmine = [].concat(scripts.polyfills, scripts.jasmine, scripts.boot), - helpers = scripts.helpers, - vendor = scripts.vendor, - reporters = [].concat(scripts.reporters), - specs = scripts.specs, - allScripts = jasmine.concat(helpers).concat(vendor).concat(specs).concat(reporters); - - generateScriptTags(allScripts); - %> + function loadScript(url,callback){ + var script = document.createElement('script'); + + if(document.documentMode === 8){ + script.onreadystatechange = function(){ + if (script.readyState === 'loaded'){ + if (callback){callback()}; + }; + }; + } else { + script.onload = function(){ + if (callback){callback()}; + }; + }; + script.src = url; + document.body.appendChild(script); + }; + + var jasmine = <% toArray([].concat(scripts.polyfills, scripts.jasmine, scripts.boot)) %>, + helpers = <% toArray(scripts.helpers) %>, + vendor = <% toArray(scripts.vendor) %>, + specs = <% toArray(scripts.specs) %>, + reporters = <% toArray([].concat(scripts.reporters)) %>, + setupScripts = jasmine.concat(helpers).concat(vendor), + runScripts = specs.concat(reporters); + + + <% generateScriptTags(scripts.polyfills); %> + <% generateScriptTags(scripts.jasmine); %> + <% generateScriptTags(scripts.boot); %> + <% generateScriptTags(scripts.helpers); %> + <% generateScriptTags(scripts.vendor); %> + + - - + \ No newline at end of file From c82202cfb805931e46f11094ce91e5a9240ca43f Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Mon, 21 Nov 2016 13:57:59 -0800 Subject: [PATCH 44/97] Update inline comments --- lib/less/environment/abstract-file-manager.js | 2 +- lib/less/plugin-manager.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/less/environment/abstract-file-manager.js b/lib/less/environment/abstract-file-manager.js index 4a3845369..40b977921 100644 --- a/lib/less/environment/abstract-file-manager.js +++ b/lib/less/environment/abstract-file-manager.js @@ -35,7 +35,7 @@ abstractFileManager.prototype.alwaysMakePathsAbsolute = function() { abstractFileManager.prototype.isPathAbsolute = function(filename) { return (/^(?:[a-z-]+:|\/|\\|#)/i).test(filename); }; -// TODO: pull out - this is part of Node & Browserify +// TODO: pull out / replace? abstractFileManager.prototype.join = function(basePath, laterPath) { if (!basePath) { return laterPath; diff --git a/lib/less/plugin-manager.js b/lib/less/plugin-manager.js index bc338652f..a7e8b63d7 100644 --- a/lib/less/plugin-manager.js +++ b/lib/less/plugin-manager.js @@ -54,6 +54,9 @@ PluginManager.prototype.get = function(filename) { return this.pluginCache[filename]; }; +/** + * Deprecate eventually + */ function upgradeVisitors(visitor, oldType, newType) { if (visitor['visit' + oldType] && !visitor['visit' + newType]) { From 96c2ffbc0d02b55a32e763c79c590dc221611083 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Fri, 23 Dec 2016 23:12:32 -0800 Subject: [PATCH 45/97] Tests for plugin in-browser - Prevents XSS @plugin requests --- dist/less.js | 370 +++++++++++++++++------ dist/less.min.js | 12 +- lib/less-browser/plugin-loader.js | 11 +- package.json | 2 +- test/browser/css/plugin/plugin.css | 3 + test/browser/less/errors/plugin-xss.less | 4 + test/browser/less/errors/plugin-xss.txt | 3 + test/browser/less/plugin/plugin.js | 7 + test/browser/less/plugin/plugin.less | 4 + 9 files changed, 318 insertions(+), 98 deletions(-) create mode 100644 test/browser/css/plugin/plugin.css create mode 100644 test/browser/less/errors/plugin-xss.less create mode 100644 test/browser/less/errors/plugin-xss.txt create mode 100644 test/browser/less/plugin/plugin.js create mode 100644 test/browser/less/plugin/plugin.less diff --git a/dist/less.js b/dist/less.js index 4661e90fc..f34ff632e 100644 --- a/dist/less.js +++ b/dist/less.js @@ -1,5 +1,5 @@ /*! - * Less - Leaner CSS v3.0.0-pre.3 + * Less - Leaner CSS v3.0.0-pre.5 * http://lesscss.org * * Copyright (c) 2009-2016, Alexis Sellier @@ -858,6 +858,8 @@ module.exports = function(less, options) { }; },{}],10:[function(require,module,exports){ +/*global window */ + var AbstractPluginLoader = require("../less/environment/abstract-plugin-loader.js"); /** @@ -893,10 +895,15 @@ PluginLoader.prototype.tryLoadPlugin = function(name, basePath, callback) { }; PluginLoader.prototype.tryLoadFromEnvironment = function(filename, basePath, explicit, callback) { - var fileManager = new this.less.FileManager(); + var fileManager = new this.less.FileManager(), + extract = fileManager.extractUrlParts; if (basePath) { - filename = (fileManager.extractUrlParts(filename, basePath)).url; + filename = (extract(filename, basePath)).url; + } + + if (extract(filename).hostPart !== extract(window.location.href).hostPart) { + callback({ message: 'Cross Site Scripting (XSS) plugins are not allowed'}); } if (filename) { @@ -1277,7 +1284,7 @@ abstractFileManager.prototype.alwaysMakePathsAbsolute = function() { abstractFileManager.prototype.isPathAbsolute = function(filename) { return (/^(?:[a-z-]+:|\/|\\|#)/i).test(filename); }; -// TODO: pull out - this is part of Node & Browserify +// TODO: pull out / replace? abstractFileManager.prototype.join = function(basePath, laterPath) { if (!basePath) { return laterPath; @@ -1423,8 +1430,8 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOp registry = functionRegistry.create(); try { - loader = new Function("module", "require", "functions", "tree", "fileInfo", contents); - pluginObj = loader(localModule, this.require, registry, this.less.tree, fileInfo); + loader = new Function("module", "require", "functions", "tree", "less", "fileInfo", contents); + pluginObj = loader(localModule, this.require, registry, this.less.tree, this.less, fileInfo); if (!pluginObj) { pluginObj = localModule.exports; @@ -2717,7 +2724,7 @@ module.exports = function(environment) { module.exports = function(environment, fileManagers) { var SourceMapOutput, SourceMapBuilder, ParseTree, ImportManager, Environment; - var less = { + var initial = { version: [3, 0, 0], data: require('./data'), tree: require('./tree'), @@ -2742,14 +2749,59 @@ module.exports = function(environment, fileManagers) { logger: require('./logger') }; - return less; + // Create a public API + + var ctor = function(t) { + return function() { + var obj = Object.create(t.prototype); + t.apply(obj, Array.prototype.slice.call(arguments, 0)); + return obj; + }; + }; + var t, api = Object.create(initial); + for (var n in initial.tree) { + /*jshint forin: false */ + t = initial.tree[n]; + if (typeof t === "function") { + api[n] = ctor(t); + } + else { + api[n] = Object.create(null); + for (var o in t) { + /*jshint forin: false */ + api[n][o] = ctor(t[o]); + } + } + } + + return api; }; },{"./contexts":12,"./data":14,"./environment/abstract-file-manager":16,"./environment/abstract-plugin-loader":17,"./environment/environment":18,"./functions":25,"./import-manager":32,"./less-error":34,"./logger":35,"./parse":37,"./parse-tree":36,"./parser/parser":40,"./plugin-manager":41,"./render":42,"./source-map-builder":43,"./source-map-output":44,"./transform-tree":45,"./tree":65,"./utils":87,"./visitors":91}],34:[function(require,module,exports){ -var utils = require("./utils"); - +var utils = require('./utils'); +/** + * This is a centralized class of any error that could be thrown internally (mostly by the parser). + * Besides standard .message it keeps some additional data like a path to the file where the error + * occurred along with line and column numbers. + * + * @class + * @extends Error + * @type {module.LessError} + * + * @prop {string} type + * @prop {string} filename + * @prop {number} index + * @prop {number} line + * @prop {number} column + * @prop {number} callLine + * @prop {number} callExtract + * @prop {string[]} extract + * + * @param {Object} e - An error object to wrap around or just a descriptive object + * @param {Object} importManager - An instance of ImportManager (see import-manager.js) + * @param {string} [currentFilename] + */ var LessError = module.exports = function LessError(e, importManager, currentFilename) { - Error.call(this); var filename = e.filename || currentFilename; @@ -2789,6 +2841,63 @@ if (typeof Object.create === 'undefined') { LessError.prototype.constructor = LessError; +/** + * An overridden version of the default Object.prototype.toString + * which uses additional information to create a helpful message. + * + * @param {Object} options + * @returns {string} + */ +LessError.prototype.toString = function(options) { + options = options || {}; + + var message = ''; + var extract = this.extract; + var error = []; + var stylize = function (str) { return str; }; + if (options.stylize) { + var type = typeof options.stylize; + if (type !== 'function') { + throw Error('options.stylize should be a function, got a ' + type + '!'); + } + stylize = options.stylize; + } + + if (typeof extract[0] === 'string') { + error.push(stylize((this.line - 1) + ' ' + extract[0], 'grey')); + } + + if (typeof extract[1] === 'string') { + var errorTxt = this.line + ' '; + if (extract[1]) { + errorTxt += extract[1].slice(0, this.column) + + stylize(stylize(stylize(extract[1].substr(this.column, 1), 'bold') + + extract[1].slice(this.column + 1), 'red'), 'inverse'); + } + error.push(errorTxt); + } + + if (typeof extract[2] === 'string') { + error.push(stylize((this.line + 1) + ' ' + extract[2], 'grey')); + } + error = error.join('\n') + stylize('', 'reset') + '\n'; + + message += stylize(this.type + 'Error: ' + this.message, 'red'); + if (this.filename) { + message += stylize(' in ', 'red') + this.filename + + stylize(' on line ' + this.line + ', column ' + (this.column + 1) + ':', 'grey'); + } + + message += '\n' + error; + + if (this.callLine) { + message += stylize('from ', 'red') + (this.filename || '') + '/n'; + message += stylize(this.callLine, 'grey') + ' ' + this.callExtract + '/n'; + } + + return message; +}; + },{"./utils":87}],35:[function(require,module,exports){ module.exports = { error: function(msg) { @@ -3432,6 +3541,53 @@ var Parser = function Parser(context, imports, fileInfo) { }; } + /** + * Used after initial parsing to create nodes on the fly + * + * @param {String} str - string to parse + * @param {Array} parseList - array of parsers to run input through e.g. ["value", "important"] + * @param {Number} currentIndex - start number to begin indexing + * @param {Object} fileInfo - fileInfo to attach to created nodes + */ + function parseNode(str, parseList, currentIndex, fileInfo, callback) { + var result, returnNodes = []; + var parser = parserInput; + + try { + parser.start(str, false, function fail(msg, index) { + callback({ + message: msg, + index: index + currentIndex + }); + }); + for (var x = 0, p, i; (p = parseList[x]); x++) { + i = parser.i; + result = parsers[p](); + if (result) { + result._index = i + currentIndex; + result._fileInfo = fileInfo; + returnNodes.push(result); + } + else { + returnNodes.push(null); + } + } + + var endInfo = parser.end(); + if (endInfo.isFinished) { + callback(null, returnNodes); + } + else { + callback(true, null); + } + } catch (e) { + throw new LessError({ + index: e.index + currentIndex, + message: e.message + }, imports, fileInfo.filename); + } + } + // // The Parser // @@ -3439,6 +3595,7 @@ var Parser = function Parser(context, imports, fileInfo) { parserInput: parserInput, imports: imports, fileInfo: fileInfo, + parseNode: parseNode, // // Parse an input string into an abstract syntax tree, // @param str A string containing 'less' markup @@ -3485,8 +3642,8 @@ var Parser = function Parser(context, imports, fileInfo) { }); tree.Node.prototype.parse = this; - - root = new(tree.Ruleset)(null, this.parsers.primary()); + root = new tree.Ruleset(null, this.parsers.primary()); + tree.Node.prototype.rootNode = root; root.root = true; root.firstRoot = true; @@ -4360,7 +4517,7 @@ var Parser = function Parser(context, imports, fileInfo) { if (! e) { parserInput.save(); if (parserInput.$char('(')) { - if ((v = this.selector()) && parserInput.$char(')')) { + if ((v = this.selector(false)) && parserInput.$char(')')) { e = new(tree.Paren)(v); parserInput.forget(); } else { @@ -4411,14 +4568,8 @@ var Parser = function Parser(context, imports, fileInfo) { } }, // - // A CSS selector (see selector below) - // with less extensions e.g. the ability to extend and guard - // - lessSelector: function () { - return this.selector(true); - }, - // // A CSS Selector + // with less extensions e.g. the ability to extend and guard // // .class > div + h1 // li a:hover @@ -4427,7 +4578,7 @@ var Parser = function Parser(context, imports, fileInfo) { // selector: function (isLess) { var index = parserInput.i, elements, extendList, c, e, allExtends, when, condition; - + isLess = isLess !== false; while ((isLess && (extendList = this.extend())) || (isLess && (when = parserInput.$str("when"))) || (e = this.element())) { if (when) { condition = expect(this.conditions, 'expected condition'); @@ -4517,7 +4668,7 @@ var Parser = function Parser(context, imports, fileInfo) { } while (true) { - s = this.lessSelector(); + s = this.selector(); if (!s) { break; } @@ -5280,6 +5431,7 @@ Parser.serializeVars = function(vars) { module.exports = Parser; },{"../less-error":34,"../tree":65,"../utils":87,"../visitors":91,"./parser-input":39}],41:[function(require,module,exports){ +var utils = require('./utils'); /** * Plugin Manager */ @@ -5335,13 +5487,9 @@ PluginManager.prototype.get = function(filename) { return this.pluginCache[filename]; }; -// Object.getPrototypeOf shim for visitor upgrade -if (!Object.getPrototypeOf) { - Object.getPrototypeOf = function getPrototypeOf(object) { - return object.constructor ? object.constructor.prototype : void 0; - }; -} - +/** + * Deprecate eventually + */ function upgradeVisitors(visitor, oldType, newType) { if (visitor['visit' + oldType] && !visitor['visit' + newType]) { @@ -5360,7 +5508,7 @@ PluginManager.prototype.addVisitor = function(visitor) { var proto; // 2.x to 3.x visitor compatibility try { - proto = Object.getPrototypeOf(visitor); + proto = utils.getPrototype(visitor); upgradeVisitors(proto, 'Directive', 'AtRule'); upgradeVisitors(proto, 'Rule', 'Declaration'); } @@ -5461,7 +5609,7 @@ PluginManager.prototype.getFileManagers = function() { // module.exports = PluginManagerFactory; -},{}],42:[function(require,module,exports){ +},{"./utils":87}],42:[function(require,module,exports){ var PromiseConstructor; module.exports = function(environment, ParseTree, ImportManager) { @@ -5533,6 +5681,9 @@ module.exports = function (SourceMapOutput, environment) { if (this.options.sourceMapInputFilename) { this.sourceMapInputFilename = sourceMapOutput.normalizeFilename(this.options.sourceMapInputFilename); } + if (this.options.sourceMapBasepath !== undefined && this.sourceMapURL !== undefined) { + this.sourceMapURL = sourceMapOutput.removeBasepath(this.sourceMapURL); + } return css + this.getCSSAppendage(); }; @@ -5606,15 +5757,20 @@ module.exports = function (environment) { this._column = 0; }; - SourceMapOutput.prototype.normalizeFilename = function(filename) { - filename = filename.replace(/\\/g, '/'); - - if (this._sourceMapBasepath && filename.indexOf(this._sourceMapBasepath) === 0) { - filename = filename.substring(this._sourceMapBasepath.length); - if (filename.charAt(0) === '\\' || filename.charAt(0) === '/') { - filename = filename.substring(1); + SourceMapOutput.prototype.removeBasepath = function(path) { + if (this._sourceMapBasepath && path.indexOf(this._sourceMapBasepath) === 0) { + path = path.substring(this._sourceMapBasepath.length); + if (path.charAt(0) === '\\' || path.charAt(0) === '/') { + path = path.substring(1); } } + + return path; + }; + + SourceMapOutput.prototype.normalizeFilename = function(filename) { + filename = filename.replace(/\\/g, '/'); + filename = this.removeBasepath(filename); return (this._sourceMapRootpath || "") + filename; }; @@ -5883,13 +6039,14 @@ module.exports = Assignment; },{"./node":73}],49:[function(require,module,exports){ var Node = require("./node"), Selector = require("./selector"), - Ruleset = require("./ruleset"); + Ruleset = require("./ruleset"), + Anonymous = require('./anonymous'); var AtRule = function (name, value, rules, index, currentFileInfo, debugInfo, isRooted, visibilityInfo) { var i; this.name = name; - this.value = value; + this.value = (value instanceof Node) ? value : (value ? new Anonymous(value) : value); if (rules) { if (Array.isArray(rules)) { this.rules = rules; @@ -6017,7 +6174,7 @@ AtRule.prototype.outputRuleset = function (context, output, rules) { }; module.exports = AtRule; -},{"./node":73,"./ruleset":80,"./selector":81}],50:[function(require,module,exports){ +},{"./anonymous":47,"./node":73,"./ruleset":80,"./selector":81}],50:[function(require,module,exports){ var Node = require("./node"); var Attribute = function (key, op, value) { @@ -6448,11 +6605,12 @@ module.exports = debugInfo; },{}],57:[function(require,module,exports){ var Node = require("./node"), Value = require("./value"), - Keyword = require("./keyword"); + Keyword = require("./keyword"), + Anonymous = require("./anonymous"); var Declaration = function (name, value, important, merge, index, currentFileInfo, inline, variable) { this.name = name; - this.value = (value instanceof Node) ? value : new Value([value]); //value instanceof tree.Value || value instanceof tree.Ruleset ?? + this.value = (value instanceof Node) ? value : new Value([value ? new Anonymous(value) : null]); this.important = important ? ' ' + important.trim() : ''; this.merge = merge; this._index = index; @@ -6543,7 +6701,7 @@ Declaration.prototype.makeImportant = function () { }; module.exports = Declaration; -},{"./keyword":68,"./node":73,"./value":85}],58:[function(require,module,exports){ +},{"./anonymous":47,"./keyword":68,"./node":73,"./value":85}],58:[function(require,module,exports){ var Node = require("./node"), contexts = require("../contexts"), utils = require("../utils"); @@ -6955,7 +7113,7 @@ var Import = function (path, features, options, index, currentFileInfo, visibili this.css = !this.options.less || this.options.inline; } else { var pathValue = this.getPath(); - if (pathValue && /[#\.\&\?\/]css([\?;].*)?$/.test(pathValue)) { + if (pathValue && /[#\.\&\?]css([\?;].*)?$/.test(pathValue)) { this.css = true; } } @@ -7098,7 +7256,7 @@ Import.prototype.doEval = function (context) { module.exports = Import; },{"../utils":87,"./anonymous":47,"./media":69,"./node":73,"./quoted":77,"./ruleset":80,"./url":84}],65:[function(require,module,exports){ -var tree = {}; +var tree = Object.create(null); tree.Node = require('./node'); tree.Alpha = require('./alpha'); @@ -8224,7 +8382,6 @@ var Node = require("./node"), globalFunctionRegistry = require("../functions/function-registry"), defaultFunc = require("../functions/default"), getDebugInfo = require("./debug-info"), - LessError = require("../less-error"), utils = require("../utils"); var Ruleset = function (selectors, rules, strictImports, visibilityInfo) { @@ -8512,26 +8669,21 @@ Ruleset.prototype.parseValue = function(toParse) { var self = this; function transformDeclaration(decl) { if (decl.value instanceof Anonymous && !decl.parsed) { - try { - this.parse.parserInput.start(decl.value.value, false, function fail(msg, index) { - decl.parsed = true; - return decl; + this.parse.parseNode( + decl.value.value, + ["value", "important"], + decl.value.getIndex(), + decl.fileInfo(), + function(err, result) { + if (err) { + decl.parsed = true; + } + if (result) { + decl.value = result[0]; + decl.important = result[1] || ''; + decl.parsed = true; + } }); - var result = this.parse.parsers.value(); - var important = this.parse.parsers.important(); - - var endInfo = this.parse.parserInput.end(); - if (endInfo.isFinished) { - decl.value = result; - decl.imporant = important; - decl.parsed = true; - } - } catch (e) { - throw new LessError({ - index: e.index + decl.value.getIndex(), - message: e.message - }, this.parse.imports, decl.fileInfo().filename); - } return decl; } @@ -8977,16 +9129,17 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { }; module.exports = Ruleset; -},{"../contexts":12,"../functions/default":22,"../functions/function-registry":24,"../less-error":34,"../utils":87,"./anonymous":47,"./comment":54,"./debug-info":56,"./declaration":57,"./element":61,"./keyword":68,"./node":73,"./paren":75,"./selector":81}],81:[function(require,module,exports){ +},{"../contexts":12,"../functions/default":22,"../functions/function-registry":24,"../utils":87,"./anonymous":47,"./comment":54,"./debug-info":56,"./declaration":57,"./element":61,"./keyword":68,"./node":73,"./paren":75,"./selector":81}],81:[function(require,module,exports){ var Node = require("./node"), - Element = require("./element"); + Element = require("./element"), + LessError = require("../less-error"); var Selector = function (elements, extendList, condition, index, currentFileInfo, visibilityInfo) { - this.elements = elements; this.extendList = extendList; this.condition = condition; this._index = index; this._fileInfo = currentFileInfo; + this.elements = this.getElements(elements); if (!condition) { this.evaldCondition = true; } @@ -9007,6 +9160,7 @@ Selector.prototype.accept = function (visitor) { } }; Selector.prototype.createDerived = function(elements, extendList, evaldCondition) { + elements = this.getElements(elements); var info = this.visibilityInfo(); evaldCondition = (evaldCondition != null) ? evaldCondition : this.evaldCondition; var newSelector = new Selector(elements, extendList || this.extendList, null, this.getIndex(), this.fileInfo(), info); @@ -9014,6 +9168,25 @@ Selector.prototype.createDerived = function(elements, extendList, evaldCondition newSelector.mediaEmpty = this.mediaEmpty; return newSelector; }; +Selector.prototype.getElements = function(els) { + if (typeof els === "string") { + this.parse.parseNode( + els, + ["selector"], + this._index, + this._fileInfo, + function(err, result) { + if (err) { + throw new LessError({ + index: err.index, + message: err.message + }, this.parse.imports, this._fileInfo.filename); + } + els = result[0].elements; + }); + } + return els; +}; Selector.prototype.createEmptySelectors = function() { var el = new Element('', '&', this._index, this._fileInfo), sels = [new Selector([el], null, null, this._index, this._fileInfo)]; @@ -9025,7 +9198,7 @@ Selector.prototype.match = function (other) { len = elements.length, olen, i; - other.CacheElements(); + other.cacheElements(); olen = other._elements.length; if (olen === 0 || len < olen) { @@ -9040,7 +9213,7 @@ Selector.prototype.match = function (other) { return olen; // return number of matched elements }; -Selector.prototype.CacheElements = function() { +Selector.prototype.cacheElements = function() { if (this._elements) { return; } @@ -9092,7 +9265,7 @@ Selector.prototype.getIsOutput = function() { }; module.exports = Selector; -},{"./element":61,"./node":73}],82:[function(require,module,exports){ +},{"../less-error":34,"./element":61,"./node":73}],82:[function(require,module,exports){ var Node = require("./node"); var UnicodeDescriptor = function (value) { @@ -9286,10 +9459,15 @@ module.exports = URL; var Node = require("./node"); var Value = function (value) { - this.value = value; if (!value) { throw new Error("Value requires an array argument"); } + if (!Array.isArray(value)) { + this.value = [ value ]; + } + else { + this.value = value; + } }; Value.prototype = new Node(); Value.prototype.type = "Value"; @@ -9374,6 +9552,7 @@ Variable.prototype.find = function (obj, fun) { module.exports = Variable; },{"./node":73}],87:[function(require,module,exports){ +/* jshint proto: true */ module.exports = { getLocation: function(index, inputStream) { var n = index + 1, @@ -9401,6 +9580,19 @@ module.exports = { copy[i] = arr[i]; } return copy; + }, + getPrototype: function(obj) { + if (Object.getPrototypeOf) { + return Object.getPrototypeOf(obj); + } + else { + if ("".__proto__ === String.prototype) { + return obj.__proto__; + } + else if (obj.constructor) { + return obj.constructor.prototype; + } + } } }; @@ -10627,21 +10819,21 @@ function _noop(node) { function indexNodeTypes(parent, ticker) { // add .typeIndex to tree node types for lookup table var key, child; - for (key in parent) { - if (parent.hasOwnProperty(key)) { - child = parent[key]; - switch (typeof child) { - case "function": - // ignore bound functions directly on tree which do not have a prototype - // or aren't nodes - if (child.prototype && child.prototype.type) { - child.prototype.typeIndex = ticker++; - } - break; - case "object": - ticker = indexNodeTypes(child, ticker); - break; - } + for (key in parent) { + /*jshint forin: false */ + child = parent[key]; + switch (typeof child) { + case "function": + // ignore bound functions directly on tree which do not have a prototype + // or aren't nodes + if (child.prototype && child.prototype.type) { + child.prototype.typeIndex = ticker++; + } + break; + case "object": + ticker = indexNodeTypes(child, ticker); + break; + } } return ticker; diff --git a/dist/less.min.js b/dist/less.min.js index b2e1f34dd..3508992d5 100644 --- a/dist/less.min.js +++ b/dist/less.min.js @@ -1,5 +1,5 @@ /*! - * Less - Leaner CSS v3.0.0-pre.3 + * Less - Leaner CSS v3.0.0-pre.5 * http://lesscss.org * * Copyright (c) 2009-2016, Alexis Sellier @@ -10,8 +10,8 @@ /** * @license Apache-2.0 */ -!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.less=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0||b.isFileProtocol?"development":"production");var c=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(a.location.hash);c&&(b.dumpLineNumbers=c[1]),void 0===b.useFileCache&&(b.useFileCache=!0),void 0===b.onReady&&(b.onReady=!0),b.javascriptEnabled=!(!b.javascriptEnabled&&!b.inlineJavaScript)}},{"./browser":3,"./utils":11}],2:[function(a,b,c){function d(a){a.filename&&console.warn(a),e.async||h.removeChild(i)}a("promise/polyfill");var e=window.less||{};a("./add-default-options")(window,e);var f=b.exports=a("./index")(window,e);window.less=f;var g,h,i;e.onReady&&(/!watch/.test(window.location.hash)&&f.watch(),e.async||(g="body { display: none !important }",h=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),i.type="text/css",i.styleSheet?i.styleSheet.cssText=g:i.appendChild(document.createTextNode(g)),h.appendChild(i)),f.registerStylesheetsImmediately(),f.pageLoadFinished=f.refresh("development"===f.env).then(d,d))},{"./add-default-options":1,"./index":8,"promise/polyfill":101}],3:[function(a,b,c){var d=a("./utils");b.exports={createCSS:function(a,b,c){var e=c.href||"",f="less:"+(c.title||d.extractId(e)),g=a.getElementById(f),h=!1,i=a.createElement("style");i.setAttribute("type","text/css"),c.media&&i.setAttribute("media",c.media),i.id=f,i.styleSheet||(i.appendChild(a.createTextNode(b)),h=null!==g&&g.childNodes.length>0&&i.childNodes.length>0&&g.firstChild.nodeValue===i.firstChild.nodeValue);var j=a.getElementsByTagName("head")[0];if(null===g||h===!1){var k=c&&c.nextSibling||null;k?k.parentNode.insertBefore(i,k):j.appendChild(i)}if(g&&h===!1&&g.parentNode.removeChild(g),i.styleSheet)try{i.styleSheet.cssText=b}catch(l){throw new Error("Couldn't reassign styleSheet.cssText.")}},currentScript:function(a){var b=a.document;return b.currentScript||function(){var a=b.getElementsByTagName("script");return a[a.length-1]}()}}},{"./utils":11}],4:[function(a,b,c){b.exports=function(a,b,c){var d=null;if("development"!==b.env)try{d="undefined"==typeof a.localStorage?null:a.localStorage}catch(e){}return{setCSS:function(a,b,e,f){if(d){c.info("saving "+a+" to cache.");try{d.setItem(a,f),d.setItem(a+":timestamp",b),e&&d.setItem(a+":vars",JSON.stringify(e))}catch(g){c.error('failed to save "'+a+'" to local storage for caching.')}}},getCSS:function(a,b,c){var e=d&&d.getItem(a),f=d&&d.getItem(a+":timestamp"),g=d&&d.getItem(a+":vars");if(c=c||{},f&&b.lastModified&&new Date(b.lastModified).valueOf()===new Date(f).valueOf()&&(!c&&!g||JSON.stringify(c)===g))return e}}}},{}],5:[function(a,b,c){var d=a("./utils"),e=a("./browser");b.exports=function(a,b,c){function f(b,f){var g,h,i="less-error-message:"+d.extractId(f||""),j='
  • {content}
  • ',k=a.document.createElement("div"),l=[],m=b.filename||f,n=m.match(/([^\/]+(\?.*)?)$/)[1];k.id=i,k.className="less-error-message",h="

    "+(b.type||"Syntax")+"Error: "+(b.message||"There is an error in your .less file")+'

    in '+n+" ";var o=function(a,b,c){void 0!==a.extract[b]&&l.push(j.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};b.extract&&(o(b,0,""),o(b,1,"line"),o(b,2,""),h+="on line "+b.line+", column "+(b.column+1)+":

      "+l.join("")+"
    "),b.stack&&(b.extract||c.logLevel>=4)&&(h+="
    Stack Trace
    "+b.stack.split("\n").slice(1).join("
    ")),k.innerHTML=h,e.createCSS(a.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),k.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===c.env&&(g=setInterval(function(){var b=a.document,c=b.body;c&&(b.getElementById(i)?c.replaceChild(k,b.getElementById(i)):c.insertBefore(k,c.firstChild),clearInterval(g))},10))}function g(b){var c=a.document.getElementById("less-error-message:"+d.extractId(b));c&&c.parentNode.removeChild(c)}function h(a){}function i(a){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?h(a):"function"==typeof c.errorReporting&&c.errorReporting("remove",a):g(a)}function j(a,d){var e="{line} {content}",f=a.filename||d,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f+" ",i=function(a,b,c){void 0!==a.extract[b]&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.extract&&(i(a,0,""),i(a,1,"line"),i(a,2,""),h+="on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")),a.stack&&(a.extract||c.logLevel>=4)&&(h+="\nStack Trace\n"+a.stack),b.logger.error(h)}function k(a,b){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?j(a,b):"function"==typeof c.errorReporting&&c.errorReporting("add",a,b):f(a,b)}return{add:k,remove:i}}},{"./browser":3,"./utils":11}],6:[function(a,b,c){b.exports=function(b,c){var d=a("../less/environment/abstract-file-manager.js"),e={},f=function(){};return f.prototype=new d,f.prototype.alwaysMakePathsAbsolute=function(){return!0},f.prototype.join=function(a,b){return a?this.extractUrlParts(b,a).path:b},f.prototype.doXHR=function(a,d,e,f){function g(b,c,d){b.status>=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var h=new XMLHttpRequest,i=!b.isFileProtocol||b.fileAsync;"function"==typeof h.overrideMimeType&&h.overrideMimeType("text/css"),c.debug("XHR: Getting '"+a+"'"),h.open("GET",a,i),h.setRequestHeader("Accept",d||"text/x-less, text/css; q=0.9, */*; q=0.5"),h.send(null),b.isFileProtocol&&!b.fileAsync?0===h.status||h.status>=200&&h.status<300?e(h.responseText):f(h.status,a):i?h.onreadystatechange=function(){4==h.readyState&&g(h,e,f)}:g(h,e,f)},f.prototype.supports=function(a,b,c,d){return!0},f.prototype.clearFileCache=function(){e={}},f.prototype.loadFile=function(a,b,c,d,f){b&&!this.isPathAbsolute(a)&&(a=b+a),c=c||{};var g=this.extractUrlParts(a,window.location.href),h=g.url;if(c.useFileCache&&e[h])try{var i=e[h];f(null,{contents:i,filename:h,webInfo:{lastModified:new Date}})}catch(j){f({filename:h,message:"Error loading file "+h+" error was "+j.message})}else this.doXHR(h,c.mime,function(a,b){e[h]=a,f(null,{contents:a,filename:h,webInfo:{lastModified:b}})},function(a,b){f({type:"File",message:"'"+b+"' wasn't found ("+a+")",href:h})})},f}},{"../less/environment/abstract-file-manager.js":16}],7:[function(a,b,c){b.exports=function(){function b(){throw{type:"Runtime",message:"Image size functions are not supported in browser version of less"}}var c=a("./../less/functions/function-registry"),d={"image-size":function(a){return b(this,a),-1},"image-width":function(a){return b(this,a),-1},"image-height":function(a){return b(this,a),-1}};c.addMultiple(d)}},{"./../less/functions/function-registry":24}],8:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(b,c){function f(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function g(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}}function h(a){for(var b,d=l.getElementsByTagName("style"),e=0;e=c&&console.log(a)},info:function(a){b.logLevel>=d&&console.log(a)},warn:function(a){b.logLevel>=e&&console.warn(a)},error:function(a){b.logLevel>=f&&console.error(a)}}]);for(var g=0;g0&&(a=a.slice(0,b)),b=a.lastIndexOf("/"),b<0&&(b=a.lastIndexOf("\\")),b<0?"":a.slice(0,b+1)},d.prototype.tryAppendExtension=function(a,b){return/(\.[a-z]*$)|([\?;].*)$/.test(a)?a:a+b},d.prototype.tryAppendLessExtension=function(a){return this.tryAppendExtension(a,".less")},d.prototype.supportsSync=function(){return!1},d.prototype.alwaysMakePathsAbsolute=function(){return!1},d.prototype.isPathAbsolute=function(a){return/^(?:[a-z-]+:|\/|\\|#)/i.test(a)},d.prototype.join=function(a,b){return a?a+b:b},d.prototype.pathDiff=function(a,b){var c,d,e,f,g=this.extractUrlParts(a),h=this.extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;c0&&(h.splice(c-1,2),c-=2)}return g.hostPart=f[1],g.directories=h,g.path=(f[1]||"")+h.join("/"),g.filename=f[4],g.fileUrl=g.path+(f[4]||""),g.url=g.fileUrl+(f[5]||""),g},b.exports=d},{}],17:[function(a,b,c){function d(a,b){throw new f({type:b||"Syntax",message:a})}var e=a("../functions/function-registry"),f=a("../less-error"),g=function(){};g.prototype.evalPlugin=function(a,b,c,d){var f,g,h,i,j,k,l;k=b.pluginManager,d&&(l="string"==typeof d?d:d.filename);var m=(new this.less.FileManager).extractUrlParts(l).filename;if(l&&(h=k.get(l)))return this.trySetOptions(h,l,m,c),h.use&&h.use.call(this.context,h),h;i={exports:{},pluginManager:k,fileInfo:d},j=i.exports,g=e.create();try{if(f=new Function("module","require","functions","tree","fileInfo",a),h=f(i,this.require,g,this.less.tree,d),h||(h=i.exports),h=this.validatePlugin(h,l,m),!h)return new this.less.LessError({message:"Not a valid plugin"});k.addPlugin(h,d.filename,g),h.functions=g.getLocalFunctions(),this.trySetOptions(h,l,m,c),h.use&&h.use.call(this.context,h)}catch(n){return console.log(n.stack),new this.less.LessError({message:"Plugin evaluation error: '"+n.name+": "+n.message.replace(/["]/g,"'")+"'",filename:l,line:this.line,col:this.column})}return h},g.prototype.trySetOptions=function(a,b,c,e){if(e){if(!a.setOptions)return d("Options have been provided but the plugin "+c+" does not support any options."),null;try{a.setOptions(e)}catch(f){return d("Error setting options on plugin "+c+"\n"+f.message),null}}},g.prototype.validatePlugin=function(a,b,c){return a?("function"==typeof a&&(a=new a),a.minVersion&&this.compareVersion(a.minVersion,this.less.version)<0?(d("Plugin "+c+" requires version "+this.versionToString(a.minVersion)),null):a):null},g.prototype.compareVersion=function(a,b){"string"==typeof a&&(a=a.match(/^(\d+)\.?(\d+)?\.?(\d+)?/),a.shift());for(var c=0;cparseInt(b[c])?-1:1;return 0},g.prototype.versionToString=function(a){for(var b="",c=0;c=0;h--){var i=g[h];if(i[f?"supportsSync":"supports"](a,b,c,e))return i}return null},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},b.exports=e},{"../logger":35}],19:[function(a,b,c){function d(a,b,c){var d,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;l<3;l++)d=b.rgb[l]/255,f=c.rgb[l]/255,h=a(d,f),g&&(h=(j*f+i*(d-j*(d+f-h)))/g),k[l]=255*h;return new e(k,g)}var e=a("../tree/color"),f=a("./function-registry"),g={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,a<=1?g.multiply(a,b):g.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return g.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};for(var h in g)g.hasOwnProperty(h)&&(d[h]=d.bind(null,g[h]));f.addMultiple(d)},{"../tree/color":52,"./function-registry":24}],20:[function(a,b,c){function d(a){return Math.min(1,Math.max(0,a))}function e(a){return h.hsla(a.h,a.s,a.l,a.a)}function f(a){if(a instanceof i)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{type:"Argument",message:"color functions take numbers as parameters"}}function g(a,b){return a instanceof i&&a.unit.is("%")?parseFloat(a.value*b/100):f(a)}var h,i=a("../tree/dimension"),j=a("../tree/color"),k=a("../tree/quoted"),l=a("../tree/anonymous"),m=a("./function-registry");h={rgb:function(a,b,c){return h.rgba(a,b,c,1)},rgba:function(a,b,c,d){var e=[a,b,c].map(function(a){return g(a,255)});return d=f(d),new j(e,d)},hsl:function(a,b,c){return h.hsla(a,b,c,1)},hsla:function(a,b,c,e){function g(a){return a=a<0?a+1:a>1?a-1:a,6*a<1?i+(j-i)*a*6:2*a<1?j:3*a<2?i+(j-i)*(2/3-a)*6:i}var i,j;return a=f(a)%360/360,b=d(f(b)),c=d(f(c)),e=d(f(e)),j=c<=.5?c*(b+1):c+b-c*b,i=2*c-j,h.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),e)},hsv:function(a,b,c){return h.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=f(a)%360/360*360,b=f(b),c=f(c),d=f(d);var e,g;e=Math.floor(a/60%6),g=a/60-e;var i=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],j=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return h.rgba(255*i[j[e][0]],255*i[j[e][1]],255*i[j[e][2]],d)},hue:function(a){return new i(a.toHSL().h)},saturation:function(a){return new i(100*a.toHSL().s,"%")},lightness:function(a){return new i(100*a.toHSL().l,"%")},hsvhue:function(a){return new i(a.toHSV().h)},hsvsaturation:function(a){return new i(100*a.toHSV().s,"%")},hsvvalue:function(a){return new i(100*a.toHSV().v,"%")},red:function(a){return new i(a.rgb[0])},green:function(a){return new i(a.rgb[1])},blue:function(a){return new i(a.rgb[2])},alpha:function(a){return new i(a.toHSL().a)},luma:function(a){return new i(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new i(b*a.alpha*100,"%")},saturate:function(a,b,c){if(!a.rgb)return null;var f=a.toHSL();return f.s+="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},desaturate:function(a,b,c){var f=a.toHSL();return f.s-="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},lighten:function(a,b,c){var f=a.toHSL();return f.l+="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},darken:function(a,b,c){var f=a.toHSL();return f.l-="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},fadein:function(a,b,c){var f=a.toHSL();return f.a+="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fadeout:function(a,b,c){var f=a.toHSL();return f.a-="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=d(c.a),e(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=d<0?360+d:d,e(c)},mix:function(a,b,c){a.toHSL&&b.toHSL||(console.log(b.type),console.dir(b)),c||(c=new i(50));var d=c.value/100,e=2*d-1,f=a.toHSL().a-b.toHSL().a,g=((e*f==-1?e:(e+f)/(1+e*f))+1)/2,h=1-g,k=[a.rgb[0]*g+b.rgb[0]*h,a.rgb[1]*g+b.rgb[1]*h,a.rgb[2]*g+b.rgb[2]*h],l=a.alpha*d+b.alpha*(1-d);return new j(k,l)},greyscale:function(a){return h.desaturate(a,new i(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;"undefined"==typeof b&&(b=h.rgba(0,0,0,1)),"undefined"==typeof c&&(c=h.rgba(255,255,255,1));var e,f,g=a.luma(),i=b.luma(),j=c.luma();return e=g>i?(g+.05)/(i+.05):(i+.05)/(g+.05),f=g>j?(g+.05)/(j+.05):(j+.05)/(g+.05),e>f?b:c},argb:function(a){return new l(a.toARGB())},color:function(a){if(a instanceof k&&/^#([a-f0-9]{6}|[a-f0-9]{3})$/i.test(a.value))return new j(a.value.slice(1));if(a instanceof j||(a=j.fromKeyword(a.value)))return a.value=void 0,a;throw{type:"Argument",message:"argument must be a color keyword or 3/6 digit hex e.g. #FFF"}},tint:function(a,b){return h.mix(h.rgb(255,255,255),a,b)},shade:function(a,b){return h.mix(h.rgb(0,0,0),a,b)}},m.addMultiple(h)},{"../tree/anonymous":47,"../tree/color":52,"../tree/dimension":59,"../tree/quoted":77,"./function-registry":24}],21:[function(a,b,c){b.exports=function(b){var c=a("../tree/quoted"),d=a("../tree/url"),e=a("./function-registry"),f=function(a,b){return new d(b,a.index,a.currentFileInfo).eval(a.context)},g=a("../logger");e.add("data-uri",function(a,e){e||(e=a,a=null);var h=a&&a.value,i=e.value,j=this.currentFileInfo,k=j.relativeUrls?j.currentDirectory:j.entryPath,l=i.indexOf("#"),m="";l!==-1&&(m=i.slice(l),i=i.slice(0,l));var n=b.getFileManager(i,k,this.context,b,!0);if(!n)return f(this,e);var o=!1;if(a)o=/;base64$/.test(h);else{if(h=b.mimeLookup(i),"image/svg+xml"===h)o=!1;else{var p=b.charsetLookup(h);o=["US-ASCII","UTF-8"].indexOf(p)<0}o&&(h+=";base64")}var q=n.loadFileSync(i,k,this.context,b);if(!q.contents)return g.warn("Skipped data-uri embedding of "+i+" because file not found"),f(this,e||a);var r=q.contents;if(o&&!b.encodeBase64)return f(this,e);r=o?b.encodeBase64(r):encodeURIComponent(r);var s="data:"+h+","+r+m,t=32768;return s.length>=t&&this.context.ieCompat!==!1?(g.warn("Skipped data-uri embedding of "+i+" because its size ("+s.length+" characters) exceeds IE8-safe "+t+" characters!"),f(this,e||a)):new d(new c('"'+s+'"',s,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../logger":35,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],22:[function(a,b,c){var d=a("../tree/keyword"),e=a("./function-registry"),f={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;if(null!=a)return a?d.True:d.False},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}};e.add("default",f.eval.bind(f)),b.exports=f},{"../tree/keyword":68,"./function-registry":24}],23:[function(a,b,c){var d=a("../tree/expression"),e=function(a,b,c,d){this.name=a.toLowerCase(),this.index=c,this.context=b,this.currentFileInfo=d,this.func=b.frames[0].functionRegistry.get(this.name)};e.prototype.isValid=function(){return Boolean(this.func)},e.prototype.call=function(a){return Array.isArray(a)&&(a=a.filter(function(a){return"Comment"!==a.type}).map(function(a){if("Expression"===a.type){var b=a.value.filter(function(a){return"Comment"!==a.type});return 1===b.length?b[0]:new d(b)}return a})),this.func.apply(this,a)},b.exports=e},{"../tree/expression":62}],24:[function(a,b,c){function d(a){return{_data:{},add:function(a,b){a=a.toLowerCase(),this._data.hasOwnProperty(a),this._data[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){this.add(b,a[b])}.bind(this))},get:function(b){return this._data[b]||a&&a.get(b)},getLocalFunctions:function(){return this._data},inherit:function(){return d(this)},create:function(a){return d(a)}}}b.exports=d(null)},{}],25:[function(a,b,c){b.exports=function(b){var c={functionRegistry:a("./function-registry"),functionCaller:a("./function-caller")};return a("./default"),a("./color"),a("./color-blending"),a("./data-uri")(b),a("./math"),a("./number"),a("./string"),a("./svg")(b),a("./types"),c}},{"./color":20,"./color-blending":19,"./data-uri":21,"./default":22,"./function-caller":23,"./function-registry":24,"./math":27,"./number":28,"./string":29,"./svg":30,"./types":31}],26:[function(a,b,c){var d=a("../tree/dimension"),e=function(){};e._math=function(a,b,c){if(!(c instanceof d))throw{type:"Argument",message:"argument must be a number"};return null==b?b=c.unit:c=c.unify(),new d(a(parseFloat(c.value)),b)},b.exports=e},{"../tree/dimension":59}],27:[function(a,b,c){var d=a("./function-registry"),e=a("./math-helper.js"),f={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"};for(var g in f)f.hasOwnProperty(g)&&(f[g]=e._math.bind(null,Math[g],f[g]));f.round=function(a,b){var c="undefined"==typeof b?0:b.value;return e._math(function(a){return a.toFixed(c)},null,a)},d.addMultiple(f)},{"./function-registry":24,"./math-helper.js":26 -}],28:[function(a,b,c){var d=a("../tree/dimension"),e=a("../tree/anonymous"),f=a("./function-registry"),g=a("./math-helper.js"),h=function(a,b){switch(b=Array.prototype.slice.call(b),b.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var c,f,g,h,i,j,k,l,m=[],n={};for(c=0;ci.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(b[c].value)&&Array.prototype.push.apply(b,Array.prototype.slice.call(b[c].value));return 1==m.length?m[0]:(b=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new e((a?"min":"max")+"("+b+")"))};f.addMultiple({min:function(){return h(!0,arguments)},max:function(){return h(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new d(Math.PI)},mod:function(a,b){return new d(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d(a),b=new d(b);else if(!(a instanceof d&&b instanceof d))throw{type:"Argument",message:"arguments must be numbers"};return new d(Math.pow(a.value,b.value),a.unit)},percentage:function(a){var b=g._math(function(a){return 100*a},"%",a);return b}})},{"../tree/anonymous":47,"../tree/dimension":59,"./function-registry":24,"./math-helper.js":26}],29:[function(a,b,c){var d=a("../tree/quoted"),e=a("../tree/anonymous"),f=a("../tree/javascript"),g=a("./function-registry");g.addMultiple({e:function(a){return new e(a instanceof f?a.evaluated:a.value)},escape:function(a){return new e(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,b,c,e){var f=a.value;return c="Quoted"===c.type?c.value:c.toCSS(),f=f.replace(new RegExp(b.value,e?e.value:""),c),new d(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;e",k=0;k";return j+="',j=encodeURIComponent(j),j="data:image/svg+xml,"+j,new g(new f("'"+j+"'",j,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":52,"../tree/dimension":59,"../tree/expression":62,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],31:[function(a,b,c){var d=a("../tree/keyword"),e=a("../tree/detached-ruleset"),f=a("../tree/dimension"),g=a("../tree/color"),h=a("../tree/quoted"),i=a("../tree/anonymous"),j=a("../tree/url"),k=a("../tree/operation"),l=a("./function-registry"),m=function(a,b){return a instanceof b?d.True:d.False},n=function(a,b){if(void 0===b)throw{type:"Argument",message:"missing the required second argument to isunit."};if(b="string"==typeof b.value?b.value:b,"string"!=typeof b)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof f&&a.unit.is(b)?d.True:d.False},o=function(a){var b=Array.isArray(a.value)?a.value:Array(a);return b};l.addMultiple({isruleset:function(a){return m(a,e)},iscolor:function(a){return m(a,g)},isnumber:function(a){return m(a,f)},isstring:function(a){return m(a,h)},iskeyword:function(a){return m(a,d)},isurl:function(a){return m(a,j)},ispixel:function(a){return n(a,"px")},ispercentage:function(a){return n(a,"%")},isem:function(a){return n(a,"em")},isunit:n,unit:function(a,b){if(!(a instanceof f))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof k?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d?b.value:b.toCSS():"",new f(a.value,b)},"get-unit":function(a){return new i(a.unit)},extract:function(a,b){return b=b.value-1,o(a)[b]},length:function(a){return new f(o(a).length)}})},{"../tree/anonymous":47,"../tree/color":52,"../tree/detached-ruleset":58,"../tree/dimension":59,"../tree/keyword":68,"../tree/operation":74,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],32:[function(a,b,c){var d=a("./contexts"),e=a("./parser/parser"),f=a("./less-error");b.exports=function(a){var b=function(a,b,c){this.less=a,this.rootFilename=c.filename,this.paths=b.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=b.mime,this.error=null,this.context=b,this.queue=[],this.files={}};return b.prototype.push=function(b,c,g,h,i){var j=this,k=this.context.pluginManager.Loader;this.queue.push(b);var l=function(a,c,d){j.queue.splice(j.queue.indexOf(b),1);var e=d===j.rootFilename;h.optional&&a?i(null,{rules:[]},!1,null):(j.files[d]=c,a&&!j.error&&(j.error=a),i(a,c,e,d))},m={relativeUrls:this.context.relativeUrls,entryPath:g.entryPath,rootpath:g.rootpath,rootFilename:g.rootFilename},n=a.getFileManager(b,g.currentDirectory,this.context,a);if(!n)return void l({message:"Could not find a file-manager for "+b});c&&(b=h.isPlugin?b:n.tryAppendExtension(b,".less"));var o,p=function(a){var b,c=a.filename,i=a.contents.replace(/^\uFEFF/,"");m.currentDirectory=n.getPath(c),m.relativeUrls&&(m.rootpath=n.join(j.context.rootpath||"",n.pathDiff(m.currentDirectory,m.entryPath)),!n.isPathAbsolute(m.rootpath)&&n.alwaysMakePathsAbsolute()&&(m.rootpath=n.join(m.entryPath,m.rootpath))),m.filename=c;var o=new d.Parse(j.context);o.processImports=!1,j.contents[c]=i,(g.reference||h.reference)&&(m.reference=!0),h.isPlugin?(b=k.evalPlugin(i,o,h.pluginArgs,m),b instanceof f?l(b,null,c):l(null,b,c)):h.inline?l(null,i,c):new e(o,j,m).parse(i,function(a,b){l(a,b,c)})},q=function(a,b){a?l(a):p(b)};if(h.isPlugin)try{k.tryLoadPlugin(b,g.currentDirectory,q)}catch(r){i(r)}else o=n.loadFile(b,g.currentDirectory,this.context,a,q),o&&o.then(p,l)},b}},{"./contexts":12,"./less-error":34,"./parser/parser":40}],33:[function(a,b,c){b.exports=function(b,c){var d,e,f,g,h,i={version:[3,0,0],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),AbstractPluginLoader:a("./environment/abstract-plugin-loader"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")};return i}},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":16,"./environment/abstract-plugin-loader":17,"./environment/environment":18,"./functions":25,"./import-manager":32,"./less-error":34,"./logger":35,"./parse":37,"./parse-tree":36,"./parser/parser":40,"./plugin-manager":41,"./render":42,"./source-map-builder":43,"./source-map-output":44,"./transform-tree":45,"./tree":65,"./utils":87,"./visitors":91}],34:[function(a,b,c){var d=a("./utils"),e=b.exports=function(a,b,c){Error.call(this);var e=a.filename||c;if(b&&e){var f=b.contents[e],g=d.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&d.getLocation(a.call,f).line,k=f.split("\n");this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.callLine=j+1,this.callExtract=k[j],this.column=i,this.extract=[k[h-1],k[h],k[h+1]]}this.message=a.message,this.stack=a.stack};if("undefined"==typeof Object.create){var f=function(){};f.prototype=Error.prototype,e.prototype=new f}else e.prototype=Object.create(Error.prototype);e.prototype.constructor=e},{"./utils":87}],35:[function(a,b,c){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;b=97&&j<=122||j<34))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(h96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;hd&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],39:[function(a,b,c){var d=a("./chunker");b.exports=function(){function a(d){for(var e,f,j,p=k.i,q=c,s=k.i-i,t=k.i+h.length-s,u=k.i+=d,v=b;k.i=0){j={index:k.i,text:v.substr(k.i,x+2-k.i),isLineComment:!1},k.i+=j.text.length-1,k.commentStore.push(j);continue}}break}if(e!==l&&e!==n&&e!==m&&e!==o)break}if(h=h.slice(d+k.i-u+s),i=k.i,!h.length){if(ce||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,c=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$re=function(b){k.i>i&&(h=h.slice(k.i-i),i=k.i);var c=b.exec(h);return c?(a(c[0].length),"string"==typeof c?c:1===c.length?c[0]:c):null},k.$char=function(c){return b.charAt(k.i)!==c?null:(a(1),c)},k.$str=function(c){for(var d=c.length,e=0;es||a=b.length;return k.i=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":38}],40:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=function j(a,b,c){function i(a,e){throw new d({index:o.i,filename:c.filename,type:e||"Syntax",message:a},b)}function k(a,b,c){var d=a instanceof Function?a.call(n):o.$re(a);return d?d:void i(b||("string"==typeof a?"expected '"+a+"' got '"+o.currentChar()+"'":"unexpected token"))}function l(a,b){return o.$char(a)?a:void i(b||"expected '"+a+"' got '"+o.currentChar()+"'")}function m(a){var b=c.filename;return{lineNumber:h.getLocation(a,o.getInput()).line+1,fileName:b}}var n,o=g();return{parserInput:o,imports:b,fileInfo:c,parse:function(g,h,i){var k,l,m,n,p=null,q="";if(l=i&&i.globalVars?j.serializeVars(i.globalVars)+"\n":"",m=i&&i.modifyVars?"\n"+j.serializeVars(i.modifyVars):"",a.pluginManager)for(var r=a.pluginManager.getPreProcessors(),s=0;s1&&(b=new e.Value(g)),d.push(b),g=[])}return o.forget(),a?d:f},literal:function(){return this.dimension()||this.color()||this.quoted()||this.unicodeDescriptor()},assignment:function(){var a,b;return o.save(),(a=o.$re(/^\w+(?=\s?=)/i))&&o.$char("=")&&(b=n.entity())?(o.forget(),new e.Assignment(a,b)):void o.restore()},url:function(){var a,b=o.i;return o.autoCommentAbsorb=!1,o.$str("url(")?(a=this.quoted()||this.variable()||this.property()||o.$re(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",o.autoCommentAbsorb=!0,l(")"),new e.URL(null!=a.value||a instanceof e.Variable||a instanceof e.Property?a:new e.Anonymous(a,b),b,c)):void(o.autoCommentAbsorb=!0)},variable:function(){var a,b=o.i;if("@"===o.currentChar()&&(a=o.$re(/^@@?[\w-]+/)))return new e.Variable(a,b,c)},variableCurly:function(){var a,b=o.i;if("@"===o.currentChar()&&(a=o.$re(/^@\{([\w-]+)\}/)))return new e.Variable("@"+a[1],b,c)},property:function(){var a,b=o.i;if("$"===o.currentChar()&&(a=o.$re(/^\$[\w-]+/)))return new e.Property(a,b,c)},propertyCurly:function(){var a,b=o.i;if("$"===o.currentChar()&&(a=o.$re(/^\$\{([\w-]+)\}/)))return new e.Property("$"+a[1],b,c)},color:function(){var a;if("#"===o.currentChar()&&(a=o.$re(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))){var b=a.input.match(/^#([\w]+).*/);return b=b[1],b.match(/^[A-Fa-f0-9]+$/)||i("Invalid HEX color code"),new e.Color(a[1],(void 0),"#"+b)}},colorKeyword:function(){o.save();var a=o.autoCommentAbsorb;o.autoCommentAbsorb=!1;var b=o.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/);if(o.autoCommentAbsorb=a,!b)return void o.forget();o.restore();var c=e.Color.fromKeyword(b);return c?(o.$str(b),c):void 0},dimension:function(){if(!o.peekNotNumeric()){var a=o.$re(/^([+-]?\d*\.?\d+)(%|[a-z_]+)?/i);return a?new e.Dimension(a[1],a[2]):void 0}},unicodeDescriptor:function(){var a;if(a=o.$re(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/))return new e.UnicodeDescriptor(a[0])},javascript:function(){var a,b=o.i;o.save();var d=o.$char("~"),f=o.$char("`");return f?(a=o.$re(/^[^`]*`/))?(o.forget(),new e.JavaScript(a.substr(0,a.length-1),Boolean(d),b,c)):void o.restore("invalid javascript definition"):void o.restore()}},variable:function(){var a;if("@"===o.currentChar()&&(a=o.$re(/^(@[\w-]+)\s*:/)))return a[1]},rulesetCall:function(){var a;if("@"===o.currentChar()&&(a=o.$re(/^(@[\w-]+)\(\s*\)\s*;/)))return new e.RulesetCall(a[1])},extend:function(a){var b,d,f,g,h,j=o.i;if(o.$str(a?"&:extend(":":extend(")){do{for(f=null,b=null;!(f=o.$re(/^(all)(?=\s*(\)|,))/))&&(d=this.element());)b?b.push(d):b=[d];f=f&&f[1],b||i("Missing target selector for :extend()."),h=new e.Extend(new e.Selector(b),f,j,c),g?g.push(h):g=[h]}while(o.$char(","));return k(/^\)/),a&&k(/^;/),g}},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var a,b,d,f,g,h,i=o.currentChar(),j=!1,k=o.i;if("."===i||"#"===i){for(o.save();;){if(a=o.i,f=o.$re(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/),!f)break;d=new e.Element(g,f,a,c),b?b.push(d):b=[d],g=o.$char(">")}return b&&(o.$char("(")&&(h=this.args(!0).args,l(")")),n.important()&&(j=!0),n.end())?(o.forget(),new e.mixin.Call(b,h,k,c,j)):void o.restore()}},args:function(a){var b,c,d,f,g,h,j,k=n.entities,l={args:null,variadic:!1},m=[],p=[],q=[];for(o.save();;){if(a)h=n.detachedRuleset()||n.expression();else{if(o.commentStore.length=0,o.$str("...")){l.variadic=!0,o.$char(";")&&!b&&(b=!0),(b?p:q).push({variadic:!0});break}h=k.variable()||k.property()||k.literal()||k.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var r=null;if(a?h.value&&1==h.value.length&&(r=h.value[0]):r=h,r&&(r instanceof e.Variable||r instanceof e.Property))if(o.$char(":")){if(m.length>0&&(b&&i("Cannot mix ; and , as delimiter types"),c=!0),g=n.detachedRuleset()||n.expression(),!g){if(!a)return o.restore(),l.args=[],l;i("could not understand value for named argument")}f=d=r.name}else if(o.$str("...")){if(!a){l.variadic=!0,o.$char(";")&&!b&&(b=!0),(b?p:q).push({name:h.name,variadic:!0});break}j=!0}else a||(d=f=r.name,g=null);g&&m.push(g),q.push({name:f,value:g,expand:j}),o.$char(",")||(o.$char(";")||b)&&(c&&i("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),p.push({name:d,value:g,expand:j}),d=null,m=[],c=!1)}return o.forget(),l.args=b?p:q,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==o.currentChar()&&"#"!==o.currentChar()||o.peek(/^[^{]*\}/)))if(o.save(),b=o.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!o.$char(")"))return void o.restore("Missing closing ')'");if(o.commentStore.length=0,o.$str("when")&&(d=k(n.conditions,"expected condition")),c=n.block())return o.forget(),new e.mixin.Definition(a,f,c,d,g);o.restore()}else o.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.property()||a.call()||a.keyword()||a.javascript()},end:function(){return o.$char(";")||o.peek("}")},alpha:function(){var a;if(o.$re(/^opacity=/i))return a=o.$re(/^\d+/),a||(a=k(this.entities.variable,"Could not parse alpha")),l(")"),new e.Alpha(a)},element:function(){var a,b,d,f=o.i;if(b=this.combinator(),a=o.$re(/^(?:\d+\.\d+|\d+)%/)||o.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||o.$char("*")||o.$char("&")||this.attribute()||o.$re(/^\([^&()@]+\)/)||o.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(o.save(),o.$char("(")?(d=this.selector())&&o.$char(")")?(a=new e.Paren(d),o.forget()):o.restore("Missing closing ')'"):o.forget()),a)return new e.Element(b,a,f,c)},combinator:function(){var a=o.currentChar();if("/"===a){o.save();var b=o.$re(/^\/[a-z]+\//i);if(b)return o.forget(),new e.Combinator(b);o.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(o.i++,"^"===a&&"^"===o.currentChar()&&(a="^^",o.i++);o.isWhitespace();)o.i++;return new e.Combinator(a)}return new e.Combinator(o.isWhitespace(-1)?" ":null)},lessSelector:function(){return this.selector(!0)},selector:function(a){for(var b,d,f,g,h,j,l,m=o.i;(a&&(d=this.extend())||a&&(j=o.$str("when"))||(g=this.element()))&&(j?l=k(this.conditions,"expected condition"):l?i("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&i("Extend can only be used at the end of selector"),f=o.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,l,m,c):void(h&&i("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(o.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=k(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=o.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||o.$re(/^[0-9]+%/)||o.$re(/^[\w-]+/)||d.variableCurly()),l("]"),new e.Attribute(a,c,b)}},block:function(){var a;if(o.$char("{")&&(a=this.primary())&&o.$char("}"))return a},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();if(a)return new e.DetachedRuleset(a)},ruleset:function(){var b,c,d,f;for(o.save(),a.dumpLineNumbers&&(f=m(o.i));;){if(c=this.lessSelector(),!c)break;if(b?b.push(c):b=[c],o.commentStore.length=0,c.condition&&b.length>1&&i("Guards are only currently allowed on a single selector."),!o.$char(","))break;c.condition&&i("Guards are only currently allowed on a single selector."),o.commentStore.length=0}if(b&&(d=this.block())){o.forget();var g=new e.Ruleset(b,d,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}o.restore()},declaration:function(){var a,b,d,f,g,h=o.i,i=o.currentChar();if("."!==i&&"#"!==i&&"&"!==i&&":"!==i)if(o.save(),a=this.variable()||this.ruleProperty()){if(g="string"==typeof a,g&&(b=this.detachedRuleset()),o.commentStore.length=0,!b){if(f=!g&&a.length>1&&a.pop().value,b=this.anonymousValue())return o.forget(),new e.Declaration(a,b,(!1),f,h,c);b||(b=this.value()),d=this.important()}if(b&&this.end())return o.forget(),new e.Declaration(a,b,d,f,h,c);o.restore()}else o.restore()},anonymousValue:function(){var a=o.i,b=o.$re(/^([^@\$+\/'"*`(;{}-]*);/);if(b)return new e.Anonymous(b[1],a)},"import":function(){var a,b,d=o.i,f=o.$re(/^@import?\s+/);if(f){var g=(f?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),o.$char(";")||(o.i=d,i("missing semi-colon or unrecognised media features on import")),b=b&&new e.Value(b),new e.Import(a,b,g,d,c);o.i=d,i("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!o.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!o.$char(","))break}while(a);return l(")"),d},importOption:function(){var a=o.$re(/^(less|css|multiple|once|inline|reference|optional)/);if(a)return a[1]},mediaFeature:function(){var a,b,d=this.entities,f=[];o.save();do a=d.keyword()||d.variable(),a?f.push(a):o.$char("(")&&(b=this.property(),a=this.value(),o.$char(")")?b&&a?f.push(new e.Paren(new e.Declaration(b,a,null,null,o.i,c,(!0)))):a?f.push(new e.Paren(a)):i("badly formed media feature definition"):i("Missing closing ')'","Parse"));while(a);if(o.forget(),f.length>0)return new e.Expression(f)},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!o.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!o.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=o.i;return a.dumpLineNumbers&&(g=m(h)),o.save(),o.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||i("media definitions require block statements after any features"),o.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void o.restore()},plugin:function(){var a,b,d,f=o.i,g=o.$re(/^@plugin?\s+/);if(g){if(b=this.pluginArgs(),d=b?{pluginArgs:b,isPlugin:!0}:{isPlugin:!0},a=this.entities.quoted()||this.entities.url())return o.$char(";")||(o.i=f,i("missing semi-colon on @plugin")),new e.Import(a,null,d,f,c);o.i=f,i("malformed @plugin statement")}},pluginArgs:function(){if(o.save(),!o.$char("("))return o.restore(),null;var a=o.$re(/^\s*([^\);]+)\)\s*/);return a[1]?(o.forget(),a[1].trim()):(o.restore(),null)},atrule:function(){var b,d,f,g,h,j,k,l=o.i,n=!0,p=!0;if("@"===o.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(o.save(),b=o.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,n=!1;break;case"@namespace":j=!0,n=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,p=!1;break;default:k=!0}return o.commentStore.length=0,h?(d=this.entity(),d||i("expected "+b+" identifier")):j?(d=this.expression(),d||i("expected "+b+" expression")):k&&(d=(o.$re(/^[^{;]+/)||"").trim(),n="{"==o.currentChar(),d&&(d=new e.Anonymous(d))),n&&(f=this.blockRuleset()),f||!n&&d&&o.$char(";")?(o.forget(),new e.AtRule(b,d,f,l,c,a.dumpLineNumbers?m(l):null,p)):void o.restore("at-rule options not recognised")}}},value:function(){var a,b=[],c=o.i;do if(a=this.expression(),a&&(b.push(a),!o.$char(",")))break;while(a);if(b.length>0)return new e.Value(b,c)},important:function(){if("!"===o.currentChar())return o.$re(/^! *important/)},sub:function(){var a,b;return o.save(),o.$char("(")?(a=this.addition(),a&&o.$char(")")?(o.forget(),b=new e.Expression([a]),b.parens=!0,b):void o.restore("Expected ')'")):void o.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=o.isWhitespace(-1);;){if(o.peek(/^\/[*\/]/))break;if(o.save(),c=o.$char("/")||o.$char("*"),!c){o.forget();break}if(b=this.operand(),!b){o.restore();break}o.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=o.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=o.isWhitespace(-1);;){if(c=o.$re(/^[-+]\s+/)||!f&&(o.$char("+")||o.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=o.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=o.i;if(a=this.condition()){for(;;){if(!o.peek(/^,\s*(not\s*)?\(/)||!o.$char(","))break;if(b=this.condition(),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(){function a(){return o.$str("or")}var b,c,d;if(b=this.conditionAnd(this)){if(c=a()){if(d=this.condition(),!d)return;b=new e.Condition(c,b,d)}return b}},conditionAnd:function(){function a(a){return a.negatedCondition()||a.parenthesisCondition()}function b(){return o.$str("and")}var c,d,f;if(c=a(this)){if(d=b()){if(f=this.conditionAnd(), -!f)return;c=new e.Condition(d,c,f)}return c}},negatedCondition:function(){if(o.$str("not")){var a=this.parenthesisCondition();return a&&(a.negate=!a.negate),a}},parenthesisCondition:function(){function a(a){var b;return o.save(),(b=a.condition())&&o.$char(")")?(o.forget(),b):void o.restore()}var b;return o.save(),o.$str("(")?(b=a(this))?(o.forget(),b):(b=this.atomicCondition())?o.$char(")")?(o.forget(),b):void o.restore("expected ')' got '"+o.currentChar()+"'"):void o.restore():void o.restore()},atomicCondition:function(){var a,b,c,d,f=this.entities,g=o.i;if(a=this.addition()||f.keyword()||f.quoted())return o.$char(">")?d=o.$char("=")?">=":">":o.$char("<")?d=o.$char("=")?"<=":"<":o.$char("=")&&(d=o.$char(">")?"=>":o.$char("<")?"=<":"="),d?(b=this.addition()||f.keyword()||f.quoted(),b?c=new e.Condition(d,a,b,g,(!1)):i("expected expression")):c=new e.Condition("=",a,new e.Keyword("true"),g,(!1)),c},operand:function(){var a,b=this.entities;o.peek(/^-[@\$\(]/)&&(a=o.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.property()||b.call()||b.colorKeyword();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[],d=o.i;do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),o.peek(/^\/[\/*]/)||(b=o.$char("/"),b&&c.push(new e.Anonymous(b,d)))));while(a);if(c.length>0)return new e.Expression(c)},property:function(){var a=o.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(a)return a[1]},ruleProperty:function(){function a(a){var b=o.i,c=o.$re(a);if(c)return g.push(b),f.push(c[1])}var b,d,f=[],g=[];o.save();var h=o.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],o.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(o.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;d=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},f.prototype.addPostProcessor=function(a,b){var c;for(c=0;c=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},f.prototype.addFileManager=function(a){this.fileManagers.push(a)},f.prototype.getPreProcessors=function(){for(var a=[],b=0;b0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],45:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Declaration("@"+a,b,(!1),null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j,k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor((!0)),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager)for(j=b.pluginManager.visitor(),j.first();i=j.get();)i.isPreEvalVisitor&&i.run(a);c=a.eval(h);for(var l=0;l.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(d="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":73}],56:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],57:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;c-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&c<1&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":15,"./color":52,"./node":73,"./unit":83}],60:[function(a,b,c){var d=a("./atrule"),e=function(){var a=Array.prototype.slice.call(arguments);d.apply(this,a)};e.prototype=Object.create(d.prototype),e.prototype.constructor=e,b.exports=e},{"./atrule":49}],61:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./combinator"),g=function(a,b,c,d,e){this.combinator=a instanceof f?a:new f(a),this.value="string"==typeof b?b.trim():b?b:"",this._index=c,this._fileInfo=d,this.copyVisibilityInfo(e),this.setParent(this.combinator,this)};g.prototype=new d,g.prototype.type="Element",g.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},g.prototype.eval=function(a){return new g(this.combinator,this.value.eval?this.value.eval(a):this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.fileInfo(),this.getIndex())},g.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof e&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=g},{"./combinator":53,"./node":73,"./paren":75}],62:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./comment"),g=function(a){if(this.value=a,!a)throw new Error("Expression requires an array parameter")};g.prototype=new d,g.prototype.type="Expression",g.prototype.accept=function(a){this.value=a.visitArray(this.value)},g.prototype.eval=function(a){var b,c=this.parens&&!this.parensInOp,d=!1;return c&&a.inParenthesis(),this.value.length>1?b=new g(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(d=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!d&&(b=new e(b)),b},g.prototype.genCSS=function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":73,"./selector":81}],64:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=a("../utils"),k=function(a,b,c,d,e,f){if(this.options=c,this._index=d,this._fileInfo=e,this.path=a,this.features=b,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?\/]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f),this.setParent(this.features,this),this.setParent(this.path,this)};k.prototype=new d,k.prototype.type="Import",k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.isPlugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},k.prototype.genCSS=function(a,b){this.css&&void 0===this.path._fileInfo.reference&&(b.add("@import ",this._fileInfo,this._index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},k.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},k.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),!(a instanceof g)||a.containsVariables()},k.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new k(b.eval(a),this.features,this.options,this._index,this._fileInfo,this.visibilityInfo())},k.prototype.evalPath=function(a){var b=this.path.eval(a),c=this._fileInfo&&this._fileInfo.rootpath;if(!(b instanceof f)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d)}b.value=a.normalizePath(b.value)}return b},k.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){a.addVisibilityBlock()}):b.addVisibilityBlock()),b},k.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a);if(this.options.isPlugin)return this.root&&this.root.eval&&this.root.eval(a),c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[];if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var f=new i(this.root,0,{filename:this.importedFilename,reference:this.path._fileInfo&&this.path._fileInfo.reference},(!0),(!0));return this.features?new e([f],this.features.value):[f]}if(this.css){var g=new k(this.evalPath(a),d,this.options,this._index);if(!g.css&&this.error)throw this.error;return g}return b=new h(null,j.copyArray(this.root.rules)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=k},{"../utils":87,"./anonymous":47,"./media":69,"./node":73,"./quoted":77,"./ruleset":80,"./url":84}],65:[function(a,b,c){var d={};d.Node=a("./node"),d.Alpha=a("./alpha"),d.Color=a("./color"),d.AtRule=a("./atrule"),d.Directive=a("./directive"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Property=a("./property"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Declaration=a("./declaration"),d.Rule=a("./rule"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.RulesetCall=a("./ruleset-call"),b.exports=d},{"./alpha":46,"./anonymous":47,"./assignment":48,"./atrule":49,"./attribute":50,"./call":51,"./color":52,"./combinator":53,"./comment":54,"./condition":55,"./declaration":57,"./detached-ruleset":58,"./dimension":59,"./directive":60,"./element":61,"./expression":62,"./extend":63,"./import":64,"./javascript":66,"./keyword":68,"./media":69,"./mixin-call":70,"./mixin-definition":71,"./negative":72,"./node":73,"./operation":74,"./paren":75, -"./property":76,"./quoted":77,"./rule":78,"./ruleset":80,"./ruleset-call":79,"./selector":81,"./unicode-descriptor":82,"./unit":83,"./url":84,"./value":85,"./variable":86}],66:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this._index=c,this._fileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new e(b):"string"==typeof b?new f('"'+b+'"',b,this.escaped,this._index):new g(Array.isArray(b)?b.join(", "):b)},b.exports=h},{"./anonymous":47,"./dimension":59,"./js-eval-node":67,"./quoted":77}],67:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(!b.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.fileInfo().filename,index:this.getIndex()};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.getIndex(),d.fileInfo()).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.fileInfo().filename,index:this.getIndex()}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.fileInfo().filename,index:this.getIndex()}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":73,"./variable":86}],68:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":73}],69:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./atrule"),j=a("../utils"),k=function(a,b,c,g,h){this._index=c,this._fileInfo=g;var i=new f([],null,null,this._index,this._fileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0,this.setParent(i,this),this.setParent(this.features,this),this.setParent(this.rules,this)};k.prototype=new i,k.prototype.type="Media",k.prototype.isRulesetLike=function(){return!0},k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},k.prototype.genCSS=function(a,b){b.add("@media ",this._fileInfo,this._index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},k.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new k(null,[],this._index,this._fileInfo,this.visibilityInfo());this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo);var c=!1;a.strictMath||(c=!0,a.strictMath=!0);try{b.features=this.features.eval(a)}finally{c&&(a.strictMath=!1)}return a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},k.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo()),this.setParent(b,this)}return delete a.mediaBlocks,delete a.mediaPath,b},k.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;b0;b--)a.splice(b,0,new g("and"));return new h(a)})),this.setParent(this.features,this),new d([],[])},k.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(n=!0,k=0;k0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.getIndex(),filename:this.fileInfo().filename};for(k=0;kthis.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;gb?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],74:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};g.prototype=new d,g.prototype.type="Operation",g.prototype.accept=function(a){this.operands=a.visit(this.operands)},g.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof f&&c instanceof e&&(b=b.toColor()),c instanceof f&&b instanceof e&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new g(this.op,[b,c],this.isSpaced)},g.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=g},{"./color":52,"./dimension":59,"./node":73}],75:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":73}],76:[function(a,b,c){var d=a("./node"),e=a("./declaration"),f=function(a,b,c){this.name=a,this._index=b,this._fileInfo=c};f.prototype=new d,f.prototype.type="Property",f.prototype.eval=function(a){var b,c=this.name,d=a.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;if(this.evaluating)throw{type:"Name",message:"Recursive property reference for "+c,filename:this.fileInfo().filename,index:this.getIndex()};if(this.evaluating=!0,b=this.find(a.frames,function(b){var f,g=b.property(c);if(g){for(var h=0;hd){if(!c||c(g)){e=g.find(new i(a.elements.slice(d)),b,c);for(var j=0;j0&&b.add(k),a.firstSelector=!0,h[0].genCSS(a,b),a.firstSelector=!1,d=1;d0?(e=q.copyArray(a),f=e.pop(),g=d.createDerived(q.copyArray(f.elements))):g=d.createDerived([]),b.length>0){var h=c.combinator,i=b[0].elements[0];h.emptyOrWhitespace&&!i.combinator.emptyOrWhitespace&&(h=i.combinator),g.elements.push(new j(h,i.value,c._index,c._fileInfo)),g.elements=g.elements.concat(b[0].elements.slice(1))}if(0!==g.elements.length&&e.push(g),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function g(a,b,c,d,e){var g;for(g=0;g0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new i(a))}}function l(a,b,c){function m(a){var b;return a.value instanceof h?(b=a.value.value,b instanceof i?b:null):null}var n,o,p,q,r,s,t,u,v,w,x=!1;for(q=[],r=[[]],n=0;u=c.elements[n];n++)if("&"!==u.value){var y=m(u);if(null!=y){k(q,r);var z,A=[],B=[];for(z=l(A,b,y),x=x||z,p=0;p0&&t[0].elements.push(new j(u.combinator,"",u._index,u._fileInfo)),s.push(t);else for(p=0;p0&&(a.push(r[n]),w=r[n][v-1],r[n][v-1]=w.createDerived(w.elements,c.extendList));return x}function m(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var n,o,p;if(o=[],p=l(o,b,c),!p)if(b.length>0)for(o=[],n=0;n0)for(b=0;b=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}},copyArray:function(a){var b,c=a.length,d=new Array(c);for(b=0;b=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.fileInfo(),b),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitDeclaration:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;e0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return k0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitAtRule:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitAtRuleOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=i},{"../logger":35,"../tree":65,"../utils":87,"./visitor":95}],89:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],90:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=a("../utils"),h=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};h.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,g.copyArray(this.context.frames)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.getIndex(),f.filename=a.fileInfo().filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;h0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];if(this.keepOnlyVisibleChilds(c),!this.isEmpty(c))return a.ensureVisibility(),a.removeVisibilityBlock(),a},isVisibleRuleset:function(a){return!!a.firstRoot||!this.isEmpty(a)&&!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitDeclaration:function(a,b){if(!a.blocksVisibility()&&!a.variable)return a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){if(!a.blocksVisibility()&&!a.isSilent(this._context))return a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){if(!a.blocksVisibility())return a},visitAtRule:function(a,b){return a.rules&&a.rules.length?this.visitAtRuleWithBody(a,b):this.visitAtRuleWithoutBody(a,b)},visitAtRuleWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitAtRuleWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;c0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;b=0;e--)if(c=a[e],c instanceof d.Declaration)if(f[c.name]){b=f[c.name],b instanceof d.Declaration&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);b.indexOf(g)!==-1?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b,c,e,f={},g=0;g1){c=b[0];var h=[],i=[];b.map(function(a){"+"===a.merge&&(i.length>0&&h.push(e(i)),i=[]),i.push(a)}),h.push(e(i)),c.value=g(h)}})}},visitAnonymous:function(a,b){if(!a.blocksVisibility())return a.accept(this._visitor),a}},b.exports=g},{"../tree":65,"./visitor":95}],95:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)if(a.hasOwnProperty(c))switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitFnCache=[],h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var c,e=this._visitFnCache,f=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=g;if(l.visitDeeper=!0,j||(c="visit"+a.type,j=f[c]||d,k=f[c+"Out"]||d,e[h]=j,e[i]=k),j!==d){var m=j.call(f,a,l);f.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=d&&k.call(f,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;ck){for(var b=0,c=h.length-j;b0||b.isFileProtocol?"development":"production");var c=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(a.location.hash);c&&(b.dumpLineNumbers=c[1]),void 0===b.useFileCache&&(b.useFileCache=!0),void 0===b.onReady&&(b.onReady=!0),b.javascriptEnabled=!(!b.javascriptEnabled&&!b.inlineJavaScript)}},{"./browser":3,"./utils":11}],2:[function(a,b,c){function d(a){a.filename&&console.warn(a),e.async||h.removeChild(i)}a("promise/polyfill");var e=window.less||{};a("./add-default-options")(window,e);var f=b.exports=a("./index")(window,e);window.less=f;var g,h,i;e.onReady&&(/!watch/.test(window.location.hash)&&f.watch(),e.async||(g="body { display: none !important }",h=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),i.type="text/css",i.styleSheet?i.styleSheet.cssText=g:i.appendChild(document.createTextNode(g)),h.appendChild(i)),f.registerStylesheetsImmediately(),f.pageLoadFinished=f.refresh("development"===f.env).then(d,d))},{"./add-default-options":1,"./index":8,"promise/polyfill":101}],3:[function(a,b,c){var d=a("./utils");b.exports={createCSS:function(a,b,c){var e=c.href||"",f="less:"+(c.title||d.extractId(e)),g=a.getElementById(f),h=!1,i=a.createElement("style");i.setAttribute("type","text/css"),c.media&&i.setAttribute("media",c.media),i.id=f,i.styleSheet||(i.appendChild(a.createTextNode(b)),h=null!==g&&g.childNodes.length>0&&i.childNodes.length>0&&g.firstChild.nodeValue===i.firstChild.nodeValue);var j=a.getElementsByTagName("head")[0];if(null===g||h===!1){var k=c&&c.nextSibling||null;k?k.parentNode.insertBefore(i,k):j.appendChild(i)}if(g&&h===!1&&g.parentNode.removeChild(g),i.styleSheet)try{i.styleSheet.cssText=b}catch(l){throw new Error("Couldn't reassign styleSheet.cssText.")}},currentScript:function(a){var b=a.document;return b.currentScript||function(){var a=b.getElementsByTagName("script");return a[a.length-1]}()}}},{"./utils":11}],4:[function(a,b,c){b.exports=function(a,b,c){var d=null;if("development"!==b.env)try{d="undefined"==typeof a.localStorage?null:a.localStorage}catch(e){}return{setCSS:function(a,b,e,f){if(d){c.info("saving "+a+" to cache.");try{d.setItem(a,f),d.setItem(a+":timestamp",b),e&&d.setItem(a+":vars",JSON.stringify(e))}catch(g){c.error('failed to save "'+a+'" to local storage for caching.')}}},getCSS:function(a,b,c){var e=d&&d.getItem(a),f=d&&d.getItem(a+":timestamp"),g=d&&d.getItem(a+":vars");if(c=c||{},f&&b.lastModified&&new Date(b.lastModified).valueOf()===new Date(f).valueOf()&&(!c&&!g||JSON.stringify(c)===g))return e}}}},{}],5:[function(a,b,c){var d=a("./utils"),e=a("./browser");b.exports=function(a,b,c){function f(b,f){var g,h,i="less-error-message:"+d.extractId(f||""),j='
  • {content}
  • ',k=a.document.createElement("div"),l=[],m=b.filename||f,n=m.match(/([^\/]+(\?.*)?)$/)[1];k.id=i,k.className="less-error-message",h="

    "+(b.type||"Syntax")+"Error: "+(b.message||"There is an error in your .less file")+'

    in '+n+" ";var o=function(a,b,c){void 0!==a.extract[b]&&l.push(j.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};b.extract&&(o(b,0,""),o(b,1,"line"),o(b,2,""),h+="on line "+b.line+", column "+(b.column+1)+":

      "+l.join("")+"
    "),b.stack&&(b.extract||c.logLevel>=4)&&(h+="
    Stack Trace
    "+b.stack.split("\n").slice(1).join("
    ")),k.innerHTML=h,e.createCSS(a.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),k.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===c.env&&(g=setInterval(function(){var b=a.document,c=b.body;c&&(b.getElementById(i)?c.replaceChild(k,b.getElementById(i)):c.insertBefore(k,c.firstChild),clearInterval(g))},10))}function g(b){var c=a.document.getElementById("less-error-message:"+d.extractId(b));c&&c.parentNode.removeChild(c)}function h(a){}function i(a){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?h(a):"function"==typeof c.errorReporting&&c.errorReporting("remove",a):g(a)}function j(a,d){var e="{line} {content}",f=a.filename||d,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f+" ",i=function(a,b,c){void 0!==a.extract[b]&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.extract&&(i(a,0,""),i(a,1,"line"),i(a,2,""),h+="on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")),a.stack&&(a.extract||c.logLevel>=4)&&(h+="\nStack Trace\n"+a.stack),b.logger.error(h)}function k(a,b){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?j(a,b):"function"==typeof c.errorReporting&&c.errorReporting("add",a,b):f(a,b)}return{add:k,remove:i}}},{"./browser":3,"./utils":11}],6:[function(a,b,c){b.exports=function(b,c){var d=a("../less/environment/abstract-file-manager.js"),e={},f=function(){};return f.prototype=new d,f.prototype.alwaysMakePathsAbsolute=function(){return!0},f.prototype.join=function(a,b){return a?this.extractUrlParts(b,a).path:b},f.prototype.doXHR=function(a,d,e,f){function g(b,c,d){b.status>=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var h=new XMLHttpRequest,i=!b.isFileProtocol||b.fileAsync;"function"==typeof h.overrideMimeType&&h.overrideMimeType("text/css"),c.debug("XHR: Getting '"+a+"'"),h.open("GET",a,i),h.setRequestHeader("Accept",d||"text/x-less, text/css; q=0.9, */*; q=0.5"),h.send(null),b.isFileProtocol&&!b.fileAsync?0===h.status||h.status>=200&&h.status<300?e(h.responseText):f(h.status,a):i?h.onreadystatechange=function(){4==h.readyState&&g(h,e,f)}:g(h,e,f)},f.prototype.supports=function(a,b,c,d){return!0},f.prototype.clearFileCache=function(){e={}},f.prototype.loadFile=function(a,b,c,d,f){b&&!this.isPathAbsolute(a)&&(a=b+a),c=c||{};var g=this.extractUrlParts(a,window.location.href),h=g.url;if(c.useFileCache&&e[h])try{var i=e[h];f(null,{contents:i,filename:h,webInfo:{lastModified:new Date}})}catch(j){f({filename:h,message:"Error loading file "+h+" error was "+j.message})}else this.doXHR(h,c.mime,function(a,b){e[h]=a,f(null,{contents:a,filename:h,webInfo:{lastModified:b}})},function(a,b){f({type:"File",message:"'"+b+"' wasn't found ("+a+")",href:h})})},f}},{"../less/environment/abstract-file-manager.js":16}],7:[function(a,b,c){b.exports=function(){function b(){throw{type:"Runtime",message:"Image size functions are not supported in browser version of less"}}var c=a("./../less/functions/function-registry"),d={"image-size":function(a){return b(this,a),-1},"image-width":function(a){return b(this,a),-1},"image-height":function(a){return b(this,a),-1}};c.addMultiple(d)}},{"./../less/functions/function-registry":24}],8:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(b,c){function f(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function g(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}}function h(a){for(var b,d=l.getElementsByTagName("style"),e=0;e=c&&console.log(a)},info:function(a){b.logLevel>=d&&console.log(a)},warn:function(a){b.logLevel>=e&&console.warn(a)},error:function(a){b.logLevel>=f&&console.error(a)}}]);for(var g=0;g0&&(a=a.slice(0,b)),b=a.lastIndexOf("/"),b<0&&(b=a.lastIndexOf("\\")),b<0?"":a.slice(0,b+1)},d.prototype.tryAppendExtension=function(a,b){return/(\.[a-z]*$)|([\?;].*)$/.test(a)?a:a+b},d.prototype.tryAppendLessExtension=function(a){return this.tryAppendExtension(a,".less")},d.prototype.supportsSync=function(){return!1},d.prototype.alwaysMakePathsAbsolute=function(){return!1},d.prototype.isPathAbsolute=function(a){return/^(?:[a-z-]+:|\/|\\|#)/i.test(a)},d.prototype.join=function(a,b){return a?a+b:b},d.prototype.pathDiff=function(a,b){var c,d,e,f,g=this.extractUrlParts(a),h=this.extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;c0&&(h.splice(c-1,2),c-=2)}return g.hostPart=f[1],g.directories=h,g.path=(f[1]||"")+h.join("/"),g.filename=f[4],g.fileUrl=g.path+(f[4]||""),g.url=g.fileUrl+(f[5]||""),g},b.exports=d},{}],17:[function(a,b,c){function d(a,b){throw new f({type:b||"Syntax",message:a})}var e=a("../functions/function-registry"),f=a("../less-error"),g=function(){};g.prototype.evalPlugin=function(a,b,c,d){var f,g,h,i,j,k,l;k=b.pluginManager,d&&(l="string"==typeof d?d:d.filename);var m=(new this.less.FileManager).extractUrlParts(l).filename;if(l&&(h=k.get(l)))return this.trySetOptions(h,l,m,c),h.use&&h.use.call(this.context,h),h;i={exports:{},pluginManager:k,fileInfo:d},j=i.exports,g=e.create();try{if(f=new Function("module","require","functions","tree","less","fileInfo",a),h=f(i,this.require,g,this.less.tree,this.less,d),h||(h=i.exports),h=this.validatePlugin(h,l,m),!h)return new this.less.LessError({message:"Not a valid plugin"});k.addPlugin(h,d.filename,g),h.functions=g.getLocalFunctions(),this.trySetOptions(h,l,m,c),h.use&&h.use.call(this.context,h)}catch(n){return console.log(n.stack),new this.less.LessError({message:"Plugin evaluation error: '"+n.name+": "+n.message.replace(/["]/g,"'")+"'",filename:l,line:this.line,col:this.column})}return h},g.prototype.trySetOptions=function(a,b,c,e){if(e){if(!a.setOptions)return d("Options have been provided but the plugin "+c+" does not support any options."),null;try{a.setOptions(e)}catch(f){return d("Error setting options on plugin "+c+"\n"+f.message),null}}},g.prototype.validatePlugin=function(a,b,c){return a?("function"==typeof a&&(a=new a),a.minVersion&&this.compareVersion(a.minVersion,this.less.version)<0?(d("Plugin "+c+" requires version "+this.versionToString(a.minVersion)),null):a):null},g.prototype.compareVersion=function(a,b){"string"==typeof a&&(a=a.match(/^(\d+)\.?(\d+)?\.?(\d+)?/),a.shift());for(var c=0;cparseInt(b[c])?-1:1;return 0},g.prototype.versionToString=function(a){for(var b="",c=0;c=0;h--){var i=g[h];if(i[f?"supportsSync":"supports"](a,b,c,e))return i}return null},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},b.exports=e},{"../logger":35}],19:[function(a,b,c){function d(a,b,c){var d,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;l<3;l++)d=b.rgb[l]/255,f=c.rgb[l]/255,h=a(d,f),g&&(h=(j*f+i*(d-j*(d+f-h)))/g),k[l]=255*h;return new e(k,g)}var e=a("../tree/color"),f=a("./function-registry"),g={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,a<=1?g.multiply(a,b):g.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return g.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};for(var h in g)g.hasOwnProperty(h)&&(d[h]=d.bind(null,g[h]));f.addMultiple(d)},{"../tree/color":52,"./function-registry":24}],20:[function(a,b,c){function d(a){return Math.min(1,Math.max(0,a))}function e(a){return h.hsla(a.h,a.s,a.l,a.a)}function f(a){if(a instanceof i)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{type:"Argument",message:"color functions take numbers as parameters"}}function g(a,b){return a instanceof i&&a.unit.is("%")?parseFloat(a.value*b/100):f(a)}var h,i=a("../tree/dimension"),j=a("../tree/color"),k=a("../tree/quoted"),l=a("../tree/anonymous"),m=a("./function-registry");h={rgb:function(a,b,c){return h.rgba(a,b,c,1)},rgba:function(a,b,c,d){var e=[a,b,c].map(function(a){return g(a,255)});return d=f(d),new j(e,d)},hsl:function(a,b,c){return h.hsla(a,b,c,1)},hsla:function(a,b,c,e){function g(a){return a=a<0?a+1:a>1?a-1:a,6*a<1?i+(j-i)*a*6:2*a<1?j:3*a<2?i+(j-i)*(2/3-a)*6:i}var i,j;return a=f(a)%360/360,b=d(f(b)),c=d(f(c)),e=d(f(e)),j=c<=.5?c*(b+1):c+b-c*b,i=2*c-j,h.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),e)},hsv:function(a,b,c){return h.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=f(a)%360/360*360,b=f(b),c=f(c),d=f(d);var e,g;e=Math.floor(a/60%6),g=a/60-e;var i=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],j=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return h.rgba(255*i[j[e][0]],255*i[j[e][1]],255*i[j[e][2]],d)},hue:function(a){return new i(a.toHSL().h)},saturation:function(a){return new i(100*a.toHSL().s,"%")},lightness:function(a){return new i(100*a.toHSL().l,"%")},hsvhue:function(a){return new i(a.toHSV().h)},hsvsaturation:function(a){return new i(100*a.toHSV().s,"%")},hsvvalue:function(a){return new i(100*a.toHSV().v,"%")},red:function(a){return new i(a.rgb[0])},green:function(a){return new i(a.rgb[1])},blue:function(a){return new i(a.rgb[2])},alpha:function(a){return new i(a.toHSL().a)},luma:function(a){return new i(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new i(b*a.alpha*100,"%")},saturate:function(a,b,c){if(!a.rgb)return null;var f=a.toHSL();return f.s+="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},desaturate:function(a,b,c){var f=a.toHSL();return f.s-="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},lighten:function(a,b,c){var f=a.toHSL();return f.l+="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},darken:function(a,b,c){var f=a.toHSL();return f.l-="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},fadein:function(a,b,c){var f=a.toHSL();return f.a+="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fadeout:function(a,b,c){var f=a.toHSL();return f.a-="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=d(c.a),e(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=d<0?360+d:d,e(c)},mix:function(a,b,c){a.toHSL&&b.toHSL||(console.log(b.type),console.dir(b)),c||(c=new i(50));var d=c.value/100,e=2*d-1,f=a.toHSL().a-b.toHSL().a,g=((e*f==-1?e:(e+f)/(1+e*f))+1)/2,h=1-g,k=[a.rgb[0]*g+b.rgb[0]*h,a.rgb[1]*g+b.rgb[1]*h,a.rgb[2]*g+b.rgb[2]*h],l=a.alpha*d+b.alpha*(1-d);return new j(k,l)},greyscale:function(a){return h.desaturate(a,new i(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;"undefined"==typeof b&&(b=h.rgba(0,0,0,1)),"undefined"==typeof c&&(c=h.rgba(255,255,255,1));var e,f,g=a.luma(),i=b.luma(),j=c.luma();return e=g>i?(g+.05)/(i+.05):(i+.05)/(g+.05),f=g>j?(g+.05)/(j+.05):(j+.05)/(g+.05),e>f?b:c},argb:function(a){return new l(a.toARGB())},color:function(a){if(a instanceof k&&/^#([a-f0-9]{6}|[a-f0-9]{3})$/i.test(a.value))return new j(a.value.slice(1));if(a instanceof j||(a=j.fromKeyword(a.value)))return a.value=void 0,a;throw{type:"Argument",message:"argument must be a color keyword or 3/6 digit hex e.g. #FFF"}},tint:function(a,b){return h.mix(h.rgb(255,255,255),a,b)},shade:function(a,b){return h.mix(h.rgb(0,0,0),a,b)}},m.addMultiple(h)},{"../tree/anonymous":47,"../tree/color":52,"../tree/dimension":59,"../tree/quoted":77,"./function-registry":24}],21:[function(a,b,c){b.exports=function(b){var c=a("../tree/quoted"),d=a("../tree/url"),e=a("./function-registry"),f=function(a,b){return new d(b,a.index,a.currentFileInfo).eval(a.context)},g=a("../logger");e.add("data-uri",function(a,e){e||(e=a,a=null);var h=a&&a.value,i=e.value,j=this.currentFileInfo,k=j.relativeUrls?j.currentDirectory:j.entryPath,l=i.indexOf("#"),m="";l!==-1&&(m=i.slice(l),i=i.slice(0,l));var n=b.getFileManager(i,k,this.context,b,!0);if(!n)return f(this,e);var o=!1;if(a)o=/;base64$/.test(h);else{if(h=b.mimeLookup(i),"image/svg+xml"===h)o=!1;else{var p=b.charsetLookup(h);o=["US-ASCII","UTF-8"].indexOf(p)<0}o&&(h+=";base64")}var q=n.loadFileSync(i,k,this.context,b);if(!q.contents)return g.warn("Skipped data-uri embedding of "+i+" because file not found"),f(this,e||a);var r=q.contents;if(o&&!b.encodeBase64)return f(this,e);r=o?b.encodeBase64(r):encodeURIComponent(r);var s="data:"+h+","+r+m,t=32768;return s.length>=t&&this.context.ieCompat!==!1?(g.warn("Skipped data-uri embedding of "+i+" because its size ("+s.length+" characters) exceeds IE8-safe "+t+" characters!"),f(this,e||a)):new d(new c('"'+s+'"',s,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../logger":35,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],22:[function(a,b,c){var d=a("../tree/keyword"),e=a("./function-registry"),f={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;if(null!=a)return a?d.True:d.False},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}};e.add("default",f.eval.bind(f)),b.exports=f},{"../tree/keyword":68,"./function-registry":24}],23:[function(a,b,c){var d=a("../tree/expression"),e=function(a,b,c,d){this.name=a.toLowerCase(),this.index=c,this.context=b,this.currentFileInfo=d,this.func=b.frames[0].functionRegistry.get(this.name)};e.prototype.isValid=function(){return Boolean(this.func)},e.prototype.call=function(a){return Array.isArray(a)&&(a=a.filter(function(a){return"Comment"!==a.type}).map(function(a){if("Expression"===a.type){var b=a.value.filter(function(a){return"Comment"!==a.type});return 1===b.length?b[0]:new d(b)}return a})),this.func.apply(this,a)},b.exports=e},{"../tree/expression":62}],24:[function(a,b,c){function d(a){return{_data:{},add:function(a,b){a=a.toLowerCase(),this._data.hasOwnProperty(a),this._data[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){this.add(b,a[b])}.bind(this))},get:function(b){return this._data[b]||a&&a.get(b)},getLocalFunctions:function(){return this._data},inherit:function(){return d(this)},create:function(a){return d(a)}}}b.exports=d(null)},{}],25:[function(a,b,c){b.exports=function(b){var c={functionRegistry:a("./function-registry"),functionCaller:a("./function-caller")};return a("./default"),a("./color"),a("./color-blending"),a("./data-uri")(b),a("./math"),a("./number"),a("./string"),a("./svg")(b),a("./types"),c}},{"./color":20,"./color-blending":19,"./data-uri":21,"./default":22,"./function-caller":23,"./function-registry":24,"./math":27,"./number":28,"./string":29,"./svg":30,"./types":31}],26:[function(a,b,c){var d=a("../tree/dimension"),e=function(){};e._math=function(a,b,c){if(!(c instanceof d))throw{type:"Argument",message:"argument must be a number"};return null==b?b=c.unit:c=c.unify(),new d(a(parseFloat(c.value)),b)},b.exports=e},{"../tree/dimension":59}],27:[function(a,b,c){var d=a("./function-registry"),e=a("./math-helper.js"),f={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"};for(var g in f)f.hasOwnProperty(g)&&(f[g]=e._math.bind(null,Math[g],f[g]));f.round=function(a,b){var c="undefined"==typeof b?0:b.value; +return e._math(function(a){return a.toFixed(c)},null,a)},d.addMultiple(f)},{"./function-registry":24,"./math-helper.js":26}],28:[function(a,b,c){var d=a("../tree/dimension"),e=a("../tree/anonymous"),f=a("./function-registry"),g=a("./math-helper.js"),h=function(a,b){switch(b=Array.prototype.slice.call(b),b.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var c,f,g,h,i,j,k,l,m=[],n={};for(c=0;ci.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(b[c].value)&&Array.prototype.push.apply(b,Array.prototype.slice.call(b[c].value));return 1==m.length?m[0]:(b=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new e((a?"min":"max")+"("+b+")"))};f.addMultiple({min:function(){return h(!0,arguments)},max:function(){return h(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new d(Math.PI)},mod:function(a,b){return new d(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d(a),b=new d(b);else if(!(a instanceof d&&b instanceof d))throw{type:"Argument",message:"arguments must be numbers"};return new d(Math.pow(a.value,b.value),a.unit)},percentage:function(a){var b=g._math(function(a){return 100*a},"%",a);return b}})},{"../tree/anonymous":47,"../tree/dimension":59,"./function-registry":24,"./math-helper.js":26}],29:[function(a,b,c){var d=a("../tree/quoted"),e=a("../tree/anonymous"),f=a("../tree/javascript"),g=a("./function-registry");g.addMultiple({e:function(a){return new e(a instanceof f?a.evaluated:a.value)},escape:function(a){return new e(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,b,c,e){var f=a.value;return c="Quoted"===c.type?c.value:c.toCSS(),f=f.replace(new RegExp(b.value,e?e.value:""),c),new d(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;e",k=0;k";return j+="',j=encodeURIComponent(j),j="data:image/svg+xml,"+j,new g(new f("'"+j+"'",j,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":52,"../tree/dimension":59,"../tree/expression":62,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],31:[function(a,b,c){var d=a("../tree/keyword"),e=a("../tree/detached-ruleset"),f=a("../tree/dimension"),g=a("../tree/color"),h=a("../tree/quoted"),i=a("../tree/anonymous"),j=a("../tree/url"),k=a("../tree/operation"),l=a("./function-registry"),m=function(a,b){return a instanceof b?d.True:d.False},n=function(a,b){if(void 0===b)throw{type:"Argument",message:"missing the required second argument to isunit."};if(b="string"==typeof b.value?b.value:b,"string"!=typeof b)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof f&&a.unit.is(b)?d.True:d.False},o=function(a){var b=Array.isArray(a.value)?a.value:Array(a);return b};l.addMultiple({isruleset:function(a){return m(a,e)},iscolor:function(a){return m(a,g)},isnumber:function(a){return m(a,f)},isstring:function(a){return m(a,h)},iskeyword:function(a){return m(a,d)},isurl:function(a){return m(a,j)},ispixel:function(a){return n(a,"px")},ispercentage:function(a){return n(a,"%")},isem:function(a){return n(a,"em")},isunit:n,unit:function(a,b){if(!(a instanceof f))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof k?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d?b.value:b.toCSS():"",new f(a.value,b)},"get-unit":function(a){return new i(a.unit)},extract:function(a,b){return b=b.value-1,o(a)[b]},length:function(a){return new f(o(a).length)}})},{"../tree/anonymous":47,"../tree/color":52,"../tree/detached-ruleset":58,"../tree/dimension":59,"../tree/keyword":68,"../tree/operation":74,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],32:[function(a,b,c){var d=a("./contexts"),e=a("./parser/parser"),f=a("./less-error");b.exports=function(a){var b=function(a,b,c){this.less=a,this.rootFilename=c.filename,this.paths=b.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=b.mime,this.error=null,this.context=b,this.queue=[],this.files={}};return b.prototype.push=function(b,c,g,h,i){var j=this,k=this.context.pluginManager.Loader;this.queue.push(b);var l=function(a,c,d){j.queue.splice(j.queue.indexOf(b),1);var e=d===j.rootFilename;h.optional&&a?i(null,{rules:[]},!1,null):(j.files[d]=c,a&&!j.error&&(j.error=a),i(a,c,e,d))},m={relativeUrls:this.context.relativeUrls,entryPath:g.entryPath,rootpath:g.rootpath,rootFilename:g.rootFilename},n=a.getFileManager(b,g.currentDirectory,this.context,a);if(!n)return void l({message:"Could not find a file-manager for "+b});c&&(b=h.isPlugin?b:n.tryAppendExtension(b,".less"));var o,p=function(a){var b,c=a.filename,i=a.contents.replace(/^\uFEFF/,"");m.currentDirectory=n.getPath(c),m.relativeUrls&&(m.rootpath=n.join(j.context.rootpath||"",n.pathDiff(m.currentDirectory,m.entryPath)),!n.isPathAbsolute(m.rootpath)&&n.alwaysMakePathsAbsolute()&&(m.rootpath=n.join(m.entryPath,m.rootpath))),m.filename=c;var o=new d.Parse(j.context);o.processImports=!1,j.contents[c]=i,(g.reference||h.reference)&&(m.reference=!0),h.isPlugin?(b=k.evalPlugin(i,o,h.pluginArgs,m),b instanceof f?l(b,null,c):l(null,b,c)):h.inline?l(null,i,c):new e(o,j,m).parse(i,function(a,b){l(a,b,c)})},q=function(a,b){a?l(a):p(b)};if(h.isPlugin)try{k.tryLoadPlugin(b,g.currentDirectory,q)}catch(r){i(r)}else o=n.loadFile(b,g.currentDirectory,this.context,a,q),o&&o.then(p,l)},b}},{"./contexts":12,"./less-error":34,"./parser/parser":40}],33:[function(a,b,c){b.exports=function(b,c){var d,e,f,g,h,i,j={version:[3,0,0],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),AbstractPluginLoader:a("./environment/abstract-plugin-loader"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")},k=function(a){return function(){var b=Object.create(a.prototype);return a.apply(b,Array.prototype.slice.call(arguments,0)),b}},l=Object.create(j);for(var m in j.tree)if(i=j.tree[m],"function"==typeof i)l[m]=k(i);else{l[m]=Object.create(null);for(var n in i)l[m][n]=k(i[n])}return l}},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":16,"./environment/abstract-plugin-loader":17,"./environment/environment":18,"./functions":25,"./import-manager":32,"./less-error":34,"./logger":35,"./parse":37,"./parse-tree":36,"./parser/parser":40,"./plugin-manager":41,"./render":42,"./source-map-builder":43,"./source-map-output":44,"./transform-tree":45,"./tree":65,"./utils":87,"./visitors":91}],34:[function(a,b,c){var d=a("./utils"),e=b.exports=function(a,b,c){Error.call(this);var e=a.filename||c;if(b&&e){var f=b.contents[e],g=d.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&d.getLocation(a.call,f).line,k=f.split("\n");this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.callLine=j+1,this.callExtract=k[j],this.column=i,this.extract=[k[h-1],k[h],k[h+1]]}this.message=a.message,this.stack=a.stack};if("undefined"==typeof Object.create){var f=function(){};f.prototype=Error.prototype,e.prototype=new f}else e.prototype=Object.create(Error.prototype);e.prototype.constructor=e,e.prototype.toString=function(a){a=a||{};var b="",c=this.extract,d=[],e=function(a){return a};if(a.stylize){var f=typeof a.stylize;if("function"!==f)throw Error("options.stylize should be a function, got a "+f+"!");e=a.stylize}if("string"==typeof c[0]&&d.push(e(this.line-1+" "+c[0],"grey")),"string"==typeof c[1]){var g=this.line+" ";c[1]&&(g+=c[1].slice(0,this.column)+e(e(e(c[1].substr(this.column,1),"bold")+c[1].slice(this.column+1),"red"),"inverse")),d.push(g)}return"string"==typeof c[2]&&d.push(e(this.line+1+" "+c[2],"grey")),d=d.join("\n")+e("","reset")+"\n",b+=e(this.type+"Error: "+this.message,"red"),this.filename&&(b+=e(" in ","red")+this.filename+e(" on line "+this.line+", column "+(this.column+1)+":","grey")),b+="\n"+d,this.callLine&&(b+=e("from ","red")+(this.filename||"")+"/n",b+=e(this.callLine,"grey")+" "+this.callExtract+"/n"),b}},{"./utils":87}],35:[function(a,b,c){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;b=97&&j<=122||j<34))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(h96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;hd&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],39:[function(a,b,c){var d=a("./chunker");b.exports=function(){function a(d){for(var e,f,j,p=k.i,q=c,s=k.i-i,t=k.i+h.length-s,u=k.i+=d,v=b;k.i=0){j={index:k.i,text:v.substr(k.i,x+2-k.i),isLineComment:!1},k.i+=j.text.length-1,k.commentStore.push(j);continue}}break}if(e!==l&&e!==n&&e!==m&&e!==o)break}if(h=h.slice(d+k.i-u+s),i=k.i,!h.length){if(ce||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,c=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$re=function(b){k.i>i&&(h=h.slice(k.i-i),i=k.i);var c=b.exec(h);return c?(a(c[0].length),"string"==typeof c?c:1===c.length?c[0]:c):null},k.$char=function(c){return b.charAt(k.i)!==c?null:(a(1),c)},k.$str=function(c){for(var d=c.length,e=0;es||a=b.length;return k.i=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":38}],40:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=function j(a,b,c){function i(a,e){throw new d({index:p.i,filename:c.filename,type:e||"Syntax",message:a},b)}function k(a,b,c){var d=a instanceof Function?a.call(o):p.$re(a);return d?d:void i(b||("string"==typeof a?"expected '"+a+"' got '"+p.currentChar()+"'":"unexpected token"))}function l(a,b){return p.$char(a)?a:void i(b||"expected '"+a+"' got '"+p.currentChar()+"'")}function m(a){var b=c.filename;return{lineNumber:h.getLocation(a,p.getInput()).line+1,fileName:b}}function n(a,c,e,f,g){var h,i=[],j=p;try{j.start(a,!1,function(a,b){g({message:a,index:b+e})});for(var k,l,m=0;k=c[m];m++)l=j.i,h=o[k](),h?(h._index=l+e,h._fileInfo=f,i.push(h)):i.push(null);var n=j.end();n.isFinished?g(null,i):g(!0,null)}catch(q){throw new d({index:q.index+e,message:q.message},b,f.filename)}}var o,p=g();return{parserInput:p,imports:b,fileInfo:c,parseNode:n,parse:function(g,h,i){var k,l,m,n,o=null,q="";if(l=i&&i.globalVars?j.serializeVars(i.globalVars)+"\n":"",m=i&&i.modifyVars?"\n"+j.serializeVars(i.modifyVars):"",a.pluginManager)for(var r=a.pluginManager.getPreProcessors(),s=0;s1&&(b=new e.Value(g)),d.push(b),g=[])}return p.forget(),a?d:f},literal:function(){return this.dimension()||this.color()||this.quoted()||this.unicodeDescriptor()},assignment:function(){var a,b;return p.save(),(a=p.$re(/^\w+(?=\s?=)/i))&&p.$char("=")&&(b=o.entity())?(p.forget(),new e.Assignment(a,b)):void p.restore()},url:function(){var a,b=p.i;return p.autoCommentAbsorb=!1,p.$str("url(")?(a=this.quoted()||this.variable()||this.property()||p.$re(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",p.autoCommentAbsorb=!0,l(")"),new e.URL(null!=a.value||a instanceof e.Variable||a instanceof e.Property?a:new e.Anonymous(a,b),b,c)):void(p.autoCommentAbsorb=!0)},variable:function(){var a,b=p.i;if("@"===p.currentChar()&&(a=p.$re(/^@@?[\w-]+/)))return new e.Variable(a,b,c)},variableCurly:function(){var a,b=p.i;if("@"===p.currentChar()&&(a=p.$re(/^@\{([\w-]+)\}/)))return new e.Variable("@"+a[1],b,c)},property:function(){var a,b=p.i;if("$"===p.currentChar()&&(a=p.$re(/^\$[\w-]+/)))return new e.Property(a,b,c)},propertyCurly:function(){var a,b=p.i;if("$"===p.currentChar()&&(a=p.$re(/^\$\{([\w-]+)\}/)))return new e.Property("$"+a[1],b,c)},color:function(){var a;if("#"===p.currentChar()&&(a=p.$re(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))){var b=a.input.match(/^#([\w]+).*/);return b=b[1],b.match(/^[A-Fa-f0-9]+$/)||i("Invalid HEX color code"),new e.Color(a[1],(void 0),"#"+b)}},colorKeyword:function(){p.save();var a=p.autoCommentAbsorb;p.autoCommentAbsorb=!1;var b=p.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/);if(p.autoCommentAbsorb=a,!b)return void p.forget();p.restore();var c=e.Color.fromKeyword(b);return c?(p.$str(b),c):void 0},dimension:function(){if(!p.peekNotNumeric()){var a=p.$re(/^([+-]?\d*\.?\d+)(%|[a-z_]+)?/i);return a?new e.Dimension(a[1],a[2]):void 0}},unicodeDescriptor:function(){var a;if(a=p.$re(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/))return new e.UnicodeDescriptor(a[0])},javascript:function(){var a,b=p.i;p.save();var d=p.$char("~"),f=p.$char("`");return f?(a=p.$re(/^[^`]*`/))?(p.forget(),new e.JavaScript(a.substr(0,a.length-1),Boolean(d),b,c)):void p.restore("invalid javascript definition"):void p.restore()}},variable:function(){var a;if("@"===p.currentChar()&&(a=p.$re(/^(@[\w-]+)\s*:/)))return a[1]},rulesetCall:function(){var a;if("@"===p.currentChar()&&(a=p.$re(/^(@[\w-]+)\(\s*\)\s*;/)))return new e.RulesetCall(a[1])},extend:function(a){var b,d,f,g,h,j=p.i;if(p.$str(a?"&:extend(":":extend(")){do{for(f=null,b=null;!(f=p.$re(/^(all)(?=\s*(\)|,))/))&&(d=this.element());)b?b.push(d):b=[d];f=f&&f[1],b||i("Missing target selector for :extend()."),h=new e.Extend(new e.Selector(b),f,j,c),g?g.push(h):g=[h]}while(p.$char(","));return k(/^\)/),a&&k(/^;/),g}},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var a,b,d,f,g,h,i=p.currentChar(),j=!1,k=p.i;if("."===i||"#"===i){for(p.save();;){if(a=p.i,f=p.$re(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/),!f)break;d=new e.Element(g,f,a,c),b?b.push(d):b=[d],g=p.$char(">")}return b&&(p.$char("(")&&(h=this.args(!0).args,l(")")),o.important()&&(j=!0),o.end())?(p.forget(),new e.mixin.Call(b,h,k,c,j)):void p.restore()}},args:function(a){var b,c,d,f,g,h,j,k=o.entities,l={args:null,variadic:!1},m=[],n=[],q=[];for(p.save();;){if(a)h=o.detachedRuleset()||o.expression();else{if(p.commentStore.length=0,p.$str("...")){l.variadic=!0,p.$char(";")&&!b&&(b=!0),(b?n:q).push({variadic:!0});break}h=k.variable()||k.property()||k.literal()||k.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var r=null;if(a?h.value&&1==h.value.length&&(r=h.value[0]):r=h,r&&(r instanceof e.Variable||r instanceof e.Property))if(p.$char(":")){if(m.length>0&&(b&&i("Cannot mix ; and , as delimiter types"),c=!0),g=o.detachedRuleset()||o.expression(),!g){if(!a)return p.restore(),l.args=[],l;i("could not understand value for named argument")}f=d=r.name}else if(p.$str("...")){if(!a){l.variadic=!0,p.$char(";")&&!b&&(b=!0),(b?n:q).push({name:h.name,variadic:!0});break}j=!0}else a||(d=f=r.name,g=null);g&&m.push(g),q.push({name:f,value:g,expand:j}),p.$char(",")||(p.$char(";")||b)&&(c&&i("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),n.push({name:d,value:g,expand:j}),d=null,m=[],c=!1)}return p.forget(),l.args=b?n:q,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==p.currentChar()&&"#"!==p.currentChar()||p.peek(/^[^{]*\}/)))if(p.save(),b=p.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!p.$char(")"))return void p.restore("Missing closing ')'");if(p.commentStore.length=0,p.$str("when")&&(d=k(o.conditions,"expected condition")),c=o.block())return p.forget(),new e.mixin.Definition(a,f,c,d,g);p.restore()}else p.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.property()||a.call()||a.keyword()||a.javascript()},end:function(){return p.$char(";")||p.peek("}")},alpha:function(){var a;if(p.$re(/^opacity=/i))return a=p.$re(/^\d+/),a||(a=k(this.entities.variable,"Could not parse alpha")),l(")"),new e.Alpha(a)},element:function(){var a,b,d,f=p.i;if(b=this.combinator(),a=p.$re(/^(?:\d+\.\d+|\d+)%/)||p.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||p.$char("*")||p.$char("&")||this.attribute()||p.$re(/^\([^&()@]+\)/)||p.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(p.save(),p.$char("(")?(d=this.selector(!1))&&p.$char(")")?(a=new e.Paren(d),p.forget()):p.restore("Missing closing ')'"):p.forget()),a)return new e.Element(b,a,f,c)},combinator:function(){var a=p.currentChar();if("/"===a){p.save();var b=p.$re(/^\/[a-z]+\//i);if(b)return p.forget(),new e.Combinator(b);p.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(p.i++,"^"===a&&"^"===p.currentChar()&&(a="^^",p.i++);p.isWhitespace();)p.i++;return new e.Combinator(a)}return new e.Combinator(p.isWhitespace(-1)?" ":null)},selector:function(a){var b,d,f,g,h,j,l,m=p.i;for(a=a!==!1;(a&&(d=this.extend())||a&&(j=p.$str("when"))||(g=this.element()))&&(j?l=k(this.conditions,"expected condition"):l?i("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&i("Extend can only be used at the end of selector"),f=p.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,l,m,c):void(h&&i("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(p.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=k(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=p.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||p.$re(/^[0-9]+%/)||p.$re(/^[\w-]+/)||d.variableCurly()),l("]"),new e.Attribute(a,c,b)}},block:function(){var a;if(p.$char("{")&&(a=this.primary())&&p.$char("}"))return a},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();if(a)return new e.DetachedRuleset(a)},ruleset:function(){var b,c,d,f;for(p.save(),a.dumpLineNumbers&&(f=m(p.i));;){if(c=this.selector(),!c)break;if(b?b.push(c):b=[c],p.commentStore.length=0,c.condition&&b.length>1&&i("Guards are only currently allowed on a single selector."),!p.$char(","))break;c.condition&&i("Guards are only currently allowed on a single selector."),p.commentStore.length=0}if(b&&(d=this.block())){p.forget();var g=new e.Ruleset(b,d,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}p.restore()},declaration:function(){var a,b,d,f,g,h=p.i,i=p.currentChar();if("."!==i&&"#"!==i&&"&"!==i&&":"!==i)if(p.save(),a=this.variable()||this.ruleProperty()){if(g="string"==typeof a,g&&(b=this.detachedRuleset()),p.commentStore.length=0,!b){if(f=!g&&a.length>1&&a.pop().value,b=this.anonymousValue())return p.forget(),new e.Declaration(a,b,(!1),f,h,c);b||(b=this.value()),d=this.important()}if(b&&this.end())return p.forget(),new e.Declaration(a,b,d,f,h,c);p.restore()}else p.restore()},anonymousValue:function(){var a=p.i,b=p.$re(/^([^@\$+\/'"*`(;{}-]*);/);if(b)return new e.Anonymous(b[1],a)},"import":function(){var a,b,d=p.i,f=p.$re(/^@import?\s+/);if(f){var g=(f?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),p.$char(";")||(p.i=d,i("missing semi-colon or unrecognised media features on import")),b=b&&new e.Value(b),new e.Import(a,b,g,d,c);p.i=d,i("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!p.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!p.$char(","))break}while(a);return l(")"),d},importOption:function(){var a=p.$re(/^(less|css|multiple|once|inline|reference|optional)/);if(a)return a[1]},mediaFeature:function(){var a,b,d=this.entities,f=[];p.save();do a=d.keyword()||d.variable(),a?f.push(a):p.$char("(")&&(b=this.property(),a=this.value(),p.$char(")")?b&&a?f.push(new e.Paren(new e.Declaration(b,a,null,null,p.i,c,(!0)))):a?f.push(new e.Paren(a)):i("badly formed media feature definition"):i("Missing closing ')'","Parse"));while(a);if(p.forget(),f.length>0)return new e.Expression(f)},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!p.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!p.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=p.i;return a.dumpLineNumbers&&(g=m(h)),p.save(),p.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||i("media definitions require block statements after any features"),p.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void p.restore()},plugin:function(){var a,b,d,f=p.i,g=p.$re(/^@plugin?\s+/);if(g){if(b=this.pluginArgs(),d=b?{pluginArgs:b,isPlugin:!0}:{isPlugin:!0},a=this.entities.quoted()||this.entities.url())return p.$char(";")||(p.i=f,i("missing semi-colon on @plugin")),new e.Import(a,null,d,f,c);p.i=f,i("malformed @plugin statement")}},pluginArgs:function(){if(p.save(),!p.$char("("))return p.restore(),null;var a=p.$re(/^\s*([^\);]+)\)\s*/);return a[1]?(p.forget(),a[1].trim()):(p.restore(),null)},atrule:function(){var b,d,f,g,h,j,k,l=p.i,n=!0,o=!0;if("@"===p.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(p.save(),b=p.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,n=!1;break;case"@namespace":j=!0,n=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,o=!1;break;default:k=!0}return p.commentStore.length=0,h?(d=this.entity(),d||i("expected "+b+" identifier")):j?(d=this.expression(),d||i("expected "+b+" expression")):k&&(d=(p.$re(/^[^{;]+/)||"").trim(),n="{"==p.currentChar(),d&&(d=new e.Anonymous(d))),n&&(f=this.blockRuleset()),f||!n&&d&&p.$char(";")?(p.forget(),new e.AtRule(b,d,f,l,c,a.dumpLineNumbers?m(l):null,o)):void p.restore("at-rule options not recognised")}}},value:function(){ +var a,b=[],c=p.i;do if(a=this.expression(),a&&(b.push(a),!p.$char(",")))break;while(a);if(b.length>0)return new e.Value(b,c)},important:function(){if("!"===p.currentChar())return p.$re(/^! *important/)},sub:function(){var a,b;return p.save(),p.$char("(")?(a=this.addition(),a&&p.$char(")")?(p.forget(),b=new e.Expression([a]),b.parens=!0,b):void p.restore("Expected ')'")):void p.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=p.isWhitespace(-1);;){if(p.peek(/^\/[*\/]/))break;if(p.save(),c=p.$char("/")||p.$char("*"),!c){p.forget();break}if(b=this.operand(),!b){p.restore();break}p.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=p.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=p.isWhitespace(-1);;){if(c=p.$re(/^[-+]\s+/)||!f&&(p.$char("+")||p.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=p.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=p.i;if(a=this.condition()){for(;;){if(!p.peek(/^,\s*(not\s*)?\(/)||!p.$char(","))break;if(b=this.condition(),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(){function a(){return p.$str("or")}var b,c,d;if(b=this.conditionAnd(this)){if(c=a()){if(d=this.condition(),!d)return;b=new e.Condition(c,b,d)}return b}},conditionAnd:function(){function a(a){return a.negatedCondition()||a.parenthesisCondition()}function b(){return p.$str("and")}var c,d,f;if(c=a(this)){if(d=b()){if(f=this.conditionAnd(),!f)return;c=new e.Condition(d,c,f)}return c}},negatedCondition:function(){if(p.$str("not")){var a=this.parenthesisCondition();return a&&(a.negate=!a.negate),a}},parenthesisCondition:function(){function a(a){var b;return p.save(),(b=a.condition())&&p.$char(")")?(p.forget(),b):void p.restore()}var b;return p.save(),p.$str("(")?(b=a(this))?(p.forget(),b):(b=this.atomicCondition())?p.$char(")")?(p.forget(),b):void p.restore("expected ')' got '"+p.currentChar()+"'"):void p.restore():void p.restore()},atomicCondition:function(){var a,b,c,d,f=this.entities,g=p.i;if(a=this.addition()||f.keyword()||f.quoted())return p.$char(">")?d=p.$char("=")?">=":">":p.$char("<")?d=p.$char("=")?"<=":"<":p.$char("=")&&(d=p.$char(">")?"=>":p.$char("<")?"=<":"="),d?(b=this.addition()||f.keyword()||f.quoted(),b?c=new e.Condition(d,a,b,g,(!1)):i("expected expression")):c=new e.Condition("=",a,new e.Keyword("true"),g,(!1)),c},operand:function(){var a,b=this.entities;p.peek(/^-[@\$\(]/)&&(a=p.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.property()||b.call()||b.colorKeyword();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[],d=p.i;do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),p.peek(/^\/[\/*]/)||(b=p.$char("/"),b&&c.push(new e.Anonymous(b,d)))));while(a);if(c.length>0)return new e.Expression(c)},property:function(){var a=p.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(a)return a[1]},ruleProperty:function(){function a(a){var b=p.i,c=p.$re(a);if(c)return g.push(b),f.push(c[1])}var b,d,f=[],g=[];p.save();var h=p.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],p.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(p.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;d=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},g.prototype.addPostProcessor=function(a,b){var c;for(c=0;c=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},g.prototype.addFileManager=function(a){this.fileManagers.push(a)},g.prototype.getPreProcessors=function(){for(var a=[],b=0;b0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],45:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Declaration("@"+a,b,(!1),null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j,k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor((!0)),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager)for(j=b.pluginManager.visitor(),j.first();i=j.get();)i.isPreEvalVisitor&&i.run(a);c=a.eval(h);for(var l=0;l.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(d="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":73}],56:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],57:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;c-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&c<1&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":15,"./color":52,"./node":73,"./unit":83}],60:[function(a,b,c){var d=a("./atrule"),e=function(){var a=Array.prototype.slice.call(arguments);d.apply(this,a)};e.prototype=Object.create(d.prototype),e.prototype.constructor=e,b.exports=e},{"./atrule":49}],61:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./combinator"),g=function(a,b,c,d,e){this.combinator=a instanceof f?a:new f(a),this.value="string"==typeof b?b.trim():b?b:"",this._index=c,this._fileInfo=d,this.copyVisibilityInfo(e),this.setParent(this.combinator,this)};g.prototype=new d,g.prototype.type="Element",g.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},g.prototype.eval=function(a){return new g(this.combinator,this.value.eval?this.value.eval(a):this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.fileInfo(),this.getIndex())},g.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof e&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=g},{"./combinator":53,"./node":73,"./paren":75}],62:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./comment"),g=function(a){if(this.value=a,!a)throw new Error("Expression requires an array parameter")};g.prototype=new d,g.prototype.type="Expression",g.prototype.accept=function(a){this.value=a.visitArray(this.value)},g.prototype.eval=function(a){var b,c=this.parens&&!this.parensInOp,d=!1;return c&&a.inParenthesis(),this.value.length>1?b=new g(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(d=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!d&&(b=new e(b)),b},g.prototype.genCSS=function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":73,"./selector":81}],64:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=a("../utils"),k=function(a,b,c,d,e,f){if(this.options=c,this._index=d,this._fileInfo=e,this.path=a,this.features=b,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f),this.setParent(this.features,this),this.setParent(this.path,this)};k.prototype=new d,k.prototype.type="Import",k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.isPlugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},k.prototype.genCSS=function(a,b){this.css&&void 0===this.path._fileInfo.reference&&(b.add("@import ",this._fileInfo,this._index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},k.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},k.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),!(a instanceof g)||a.containsVariables()},k.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new k(b.eval(a),this.features,this.options,this._index,this._fileInfo,this.visibilityInfo())},k.prototype.evalPath=function(a){var b=this.path.eval(a),c=this._fileInfo&&this._fileInfo.rootpath;if(!(b instanceof f)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d)}b.value=a.normalizePath(b.value)}return b},k.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){a.addVisibilityBlock()}):b.addVisibilityBlock()),b},k.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a);if(this.options.isPlugin)return this.root&&this.root.eval&&this.root.eval(a),c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[];if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var f=new i(this.root,0,{filename:this.importedFilename,reference:this.path._fileInfo&&this.path._fileInfo.reference},(!0),(!0));return this.features?new e([f],this.features.value):[f]}if(this.css){var g=new k(this.evalPath(a),d,this.options,this._index); +if(!g.css&&this.error)throw this.error;return g}return b=new h(null,j.copyArray(this.root.rules)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=k},{"../utils":87,"./anonymous":47,"./media":69,"./node":73,"./quoted":77,"./ruleset":80,"./url":84}],65:[function(a,b,c){var d=Object.create(null);d.Node=a("./node"),d.Alpha=a("./alpha"),d.Color=a("./color"),d.AtRule=a("./atrule"),d.Directive=a("./directive"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Property=a("./property"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Declaration=a("./declaration"),d.Rule=a("./rule"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.RulesetCall=a("./ruleset-call"),b.exports=d},{"./alpha":46,"./anonymous":47,"./assignment":48,"./atrule":49,"./attribute":50,"./call":51,"./color":52,"./combinator":53,"./comment":54,"./condition":55,"./declaration":57,"./detached-ruleset":58,"./dimension":59,"./directive":60,"./element":61,"./expression":62,"./extend":63,"./import":64,"./javascript":66,"./keyword":68,"./media":69,"./mixin-call":70,"./mixin-definition":71,"./negative":72,"./node":73,"./operation":74,"./paren":75,"./property":76,"./quoted":77,"./rule":78,"./ruleset":80,"./ruleset-call":79,"./selector":81,"./unicode-descriptor":82,"./unit":83,"./url":84,"./value":85,"./variable":86}],66:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this._index=c,this._fileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new e(b):"string"==typeof b?new f('"'+b+'"',b,this.escaped,this._index):new g(Array.isArray(b)?b.join(", "):b)},b.exports=h},{"./anonymous":47,"./dimension":59,"./js-eval-node":67,"./quoted":77}],67:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(!b.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.fileInfo().filename,index:this.getIndex()};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.getIndex(),d.fileInfo()).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.fileInfo().filename,index:this.getIndex()}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.fileInfo().filename,index:this.getIndex()}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":73,"./variable":86}],68:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":73}],69:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./atrule"),j=a("../utils"),k=function(a,b,c,g,h){this._index=c,this._fileInfo=g;var i=new f([],null,null,this._index,this._fileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0,this.setParent(i,this),this.setParent(this.features,this),this.setParent(this.rules,this)};k.prototype=new i,k.prototype.type="Media",k.prototype.isRulesetLike=function(){return!0},k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},k.prototype.genCSS=function(a,b){b.add("@media ",this._fileInfo,this._index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},k.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new k(null,[],this._index,this._fileInfo,this.visibilityInfo());this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo);var c=!1;a.strictMath||(c=!0,a.strictMath=!0);try{b.features=this.features.eval(a)}finally{c&&(a.strictMath=!1)}return a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},k.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo()),this.setParent(b,this)}return delete a.mediaBlocks,delete a.mediaPath,b},k.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;b0;b--)a.splice(b,0,new g("and"));return new h(a)})),this.setParent(this.features,this),new d([],[])},k.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(n=!0,k=0;k0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.getIndex(),filename:this.fileInfo().filename};for(k=0;kthis.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;gb?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],74:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};g.prototype=new d,g.prototype.type="Operation",g.prototype.accept=function(a){this.operands=a.visit(this.operands)},g.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof f&&c instanceof e&&(b=b.toColor()),c instanceof f&&b instanceof e&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new g(this.op,[b,c],this.isSpaced)},g.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=g},{"./color":52,"./dimension":59,"./node":73}],75:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":73}],76:[function(a,b,c){var d=a("./node"),e=a("./declaration"),f=function(a,b,c){this.name=a,this._index=b,this._fileInfo=c};f.prototype=new d,f.prototype.type="Property",f.prototype.eval=function(a){var b,c=this.name,d=a.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;if(this.evaluating)throw{type:"Name",message:"Recursive property reference for "+c,filename:this.fileInfo().filename,index:this.getIndex()};if(this.evaluating=!0,b=this.find(a.frames,function(b){var f,g=b.property(c);if(g){for(var h=0;hd){if(!c||c(g)){e=g.find(new i(a.elements.slice(d)),b,c);for(var j=0;j0&&b.add(k),a.firstSelector=!0,h[0].genCSS(a,b),a.firstSelector=!1,d=1;d0?(e=p.copyArray(a),f=e.pop(),g=d.createDerived(p.copyArray(f.elements))):g=d.createDerived([]),b.length>0){var h=c.combinator,i=b[0].elements[0];h.emptyOrWhitespace&&!i.combinator.emptyOrWhitespace&&(h=i.combinator),g.elements.push(new j(h,i.value,c._index,c._fileInfo)),g.elements=g.elements.concat(b[0].elements.slice(1))}if(0!==g.elements.length&&e.push(g),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function g(a,b,c,d,e){var g;for(g=0;g0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new i(a))}}function l(a,b,c){function m(a){var b;return a.value instanceof h?(b=a.value.value,b instanceof i?b:null):null}var n,o,p,q,r,s,t,u,v,w,x=!1;for(q=[],r=[[]],n=0;u=c.elements[n];n++)if("&"!==u.value){var y=m(u);if(null!=y){k(q,r);var z,A=[],B=[];for(z=l(A,b,y),x=x||z,p=0;p0&&t[0].elements.push(new j(u.combinator,"",u._index,u._fileInfo)),s.push(t);else for(p=0;p0&&(a.push(r[n]),w=r[n][v-1],r[n][v-1]=w.createDerived(w.elements,c.extendList));return x}function m(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var n,o,q;if(o=[],q=l(o,b,c),!q)if(b.length>0)for(o=[],n=0;n0)for(b=0;b=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}},copyArray:function(a){var b,c=a.length,d=new Array(c);for(b=0;b=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.fileInfo(),b),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitDeclaration:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;e0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return k0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitAtRule:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitAtRuleOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=i},{"../logger":35,"../tree":65,"../utils":87,"./visitor":95}],89:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],90:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=a("../utils"),h=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};h.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,g.copyArray(this.context.frames)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.getIndex(),f.filename=a.fileInfo().filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;h0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];if(this.keepOnlyVisibleChilds(c),!this.isEmpty(c))return a.ensureVisibility(),a.removeVisibilityBlock(),a},isVisibleRuleset:function(a){return!!a.firstRoot||!this.isEmpty(a)&&!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitDeclaration:function(a,b){if(!a.blocksVisibility()&&!a.variable)return a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){if(!a.blocksVisibility()&&!a.isSilent(this._context))return a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){if(!a.blocksVisibility())return a},visitAtRule:function(a,b){return a.rules&&a.rules.length?this.visitAtRuleWithBody(a,b):this.visitAtRuleWithoutBody(a,b)},visitAtRuleWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitAtRuleWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;c0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;b=0;e--)if(c=a[e],c instanceof d.Declaration)if(f[c.name]){b=f[c.name],b instanceof d.Declaration&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);b.indexOf(g)!==-1?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b,c,e,f={},g=0;g1){c=b[0];var h=[],i=[];b.map(function(a){"+"===a.merge&&(i.length>0&&h.push(e(i)),i=[]),i.push(a)}),h.push(e(i)),c.value=g(h)}})}},visitAnonymous:function(a,b){if(!a.blocksVisibility())return a.accept(this._visitor),a}},b.exports=g},{"../tree":65,"./visitor":95}],95:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitFnCache=[],h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var c,e=this._visitFnCache,f=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=g;if(l.visitDeeper=!0,j||(c="visit"+a.type,j=f[c]||d,k=f[c+"Out"]||d,e[h]=j,e[i]=k),j!==d){var m=j.call(f,a,l);f.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=d&&k.call(f,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;ck){for(var b=0,c=h.length-j;b Date: Sat, 31 Dec 2016 11:53:53 -0800 Subject: [PATCH 46/97] Replace "return {}" statement in plugins with explicit registerPlugin() function (more logical) --- .../environment/abstract-plugin-loader.js | 22 ++++++++----------- test/browser/less/plugin/plugin.js | 4 ++-- test/less/errors/plugin-1.less | 1 + test/less/errors/plugin-1.txt | 1 + test/less/errors/plugin/plugin-error.js | 3 +++ test/less/plugin/plugin-local.js | 4 ++-- 6 files changed, 18 insertions(+), 17 deletions(-) create mode 100644 test/less/errors/plugin-1.less create mode 100644 test/less/errors/plugin-1.txt create mode 100644 test/less/errors/plugin/plugin-error.js diff --git a/lib/less/environment/abstract-plugin-loader.js b/lib/less/environment/abstract-plugin-loader.js index ab8b5c5b9..dc674391b 100644 --- a/lib/less/environment/abstract-plugin-loader.js +++ b/lib/less/environment/abstract-plugin-loader.js @@ -12,7 +12,7 @@ function error(msg, type) { } ); } -AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOptions, fileInfo) { +AbstractPluginLoader.prototype.evalPlugin = function(contents, context, imports, pluginOptions, fileInfo) { var loader, registry, @@ -54,8 +54,11 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOp registry = functionRegistry.create(); try { - loader = new Function("module", "require", "functions", "tree", "less", "fileInfo", contents); - pluginObj = loader(localModule, this.require, registry, this.less.tree, this.less, fileInfo); + var registerPlugin = function(obj) { + pluginObj = obj; + }; + loader = new Function("module", "require", "registerPlugin", "functions", "tree", "less", "fileInfo", contents); + loader(localModule, this.require, registerPlugin, registry, this.less.tree, this.less, fileInfo); if (!pluginObj) { pluginObj = localModule.exports; @@ -78,15 +81,8 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOp return new this.less.LessError({ message: "Not a valid plugin" }); } - } catch(e) { - // TODO pass the error - console.log(e.stack); - return new this.less.LessError({ - message: "Plugin evaluation error: '" + e.name + ': ' + e.message.replace(/["]/g, "'") + "'" , - filename: filename, - line: this.line, - col: this.column - }); + } catch (e) { + return new this.less.LessError(e, imports, filename); } return pluginObj; @@ -102,7 +98,7 @@ AbstractPluginLoader.prototype.trySetOptions = function(plugin, filename, name, try { plugin.setOptions(options); } - catch(e) { + catch (e) { error("Error setting options on plugin " + name + '\n' + e.message); return null; } diff --git a/test/browser/less/plugin/plugin.js b/test/browser/less/plugin/plugin.js index 1e931025a..78fa62b2b 100644 --- a/test/browser/less/plugin/plugin.js +++ b/test/browser/less/plugin/plugin.js @@ -1,7 +1,7 @@ -return { +registerPlugin({ install: function(less, pluginManager, functions) { functions.add('func', function() { return less.Anonymous(location.href); }); } -} \ No newline at end of file +}); \ No newline at end of file diff --git a/test/less/errors/plugin-1.less b/test/less/errors/plugin-1.less new file mode 100644 index 000000000..66813d30c --- /dev/null +++ b/test/less/errors/plugin-1.less @@ -0,0 +1 @@ +@plugin "plugin/plugin-error"; \ No newline at end of file diff --git a/test/less/errors/plugin-1.txt b/test/less/errors/plugin-1.txt new file mode 100644 index 000000000..9cfbe0b98 --- /dev/null +++ b/test/less/errors/plugin-1.txt @@ -0,0 +1 @@ +SyntaxError: Unexpected token ) in {path}plugin/plugin-error.js diff --git a/test/less/errors/plugin/plugin-error.js b/test/less/errors/plugin/plugin-error.js new file mode 100644 index 000000000..3b2d317f8 --- /dev/null +++ b/test/less/errors/plugin/plugin-error.js @@ -0,0 +1,3 @@ +// jscs:disable +functions.addMultiple({ + "test-parse-error" : function() { \ No newline at end of file diff --git a/test/less/plugin/plugin-local.js b/test/less/plugin/plugin-local.js index d074b56c8..30be79d11 100644 --- a/test/less/plugin/plugin-local.js +++ b/test/less/plugin/plugin-local.js @@ -7,8 +7,8 @@ functions.addMultiple({ } }); -return { +registerPlugin({ setOptions: function(raw) { // do nothing } -} \ No newline at end of file +}); \ No newline at end of file From 49cbe520f6b38b4b8797dcba491501c0c461c7f5 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Sat, 31 Dec 2016 20:03:46 -0800 Subject: [PATCH 47/97] Migrate JSCS and JSHint to ESLint and fix various ESLint styling errors --- .eslintrc.json | 87 +++++++++++++++++++ .jscsrc | 73 ---------------- .jshintrc | 11 --- Gruntfile.js | 71 +++++++-------- bin/lessc | 4 +- lib/less-browser/cache.js | 2 +- lib/less-browser/utils.js | 2 +- lib/less-node/file-manager.js | 2 +- lib/less-node/fs.js | 2 +- lib/less-node/image-size.js | 4 +- lib/less-node/plugin-loader.js | 10 +-- lib/less-node/url-file-manager.js | 2 +- lib/less/contexts.js | 8 +- lib/less/functions/number.js | 4 +- lib/less/functions/svg.js | 8 +- lib/less/index.js | 4 +- lib/less/parser/parser-input.js | 2 +- lib/less/parser/parser.js | 28 +++--- lib/less/plugin-manager.js | 12 +-- lib/less/transform-tree.js | 4 +- lib/less/tree/color.js | 2 +- lib/less/tree/debug-info.js | 2 +- lib/less/tree/declaration.js | 6 +- lib/less/tree/extend.js | 2 +- lib/less/tree/import.js | 12 +-- lib/less/tree/mixin-definition.js | 2 +- lib/less/tree/operation.js | 2 +- lib/less/tree/property.js | 12 +-- lib/less/tree/ruleset.js | 2 +- lib/less/tree/variable.js | 12 +-- lib/less/visitors/extend-visitor.js | 22 ++--- lib/less/visitors/import-visitor.js | 4 +- lib/less/visitors/join-selector-visitor.js | 2 +- lib/less/visitors/to-css-visitor.js | 6 +- lib/less/visitors/visitor.js | 2 +- package.json | 5 +- test/browser/jasmine-jsreporter.js | 8 +- .../runner-filemanagerPlugin-options.js | 5 +- test/browser/runner-modify-vars-spec.js | 4 +- test/modify-vars.js | 2 +- 40 files changed, 224 insertions(+), 230 deletions(-) create mode 100644 .eslintrc.json delete mode 100644 .jscsrc delete mode 100644 .jshintrc diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000..c6e0fd800 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,87 @@ +{ + "env": { + "node": true + }, + "globals": {}, + "rules": { + "no-eval": 2, + "no-use-before-define": [ + 2, + { + "functions": false + } + ], + "no-undef": 0, + "no-unused-vars": 1, + "no-caller": 2, + "no-eq-null": 1, + "guard-for-in": 2, + "no-implicit-coercion": [ + 2, + { + "boolean": false, + "string": true, + "number": true + } + ], + "no-with": 2, + "no-mixed-spaces-and-tabs": 2, + "no-multiple-empty-lines": 2, + "dot-location": [ + 2, + "property" + ], + "operator-linebreak": [ + 0, + "after" + ], + "keyword-spacing": [ + 2, + {} + ], + "space-unary-ops": [ + 2, + { + "words": false, + "nonwords": false + } + ], + "no-spaced-func": 2, + "space-before-function-paren": [ + 1, + { + "anonymous": "ignore", + "named": "never" + } + ], + "comma-dangle": [ + 2, + "never" + ], + "no-trailing-spaces": 0, + "max-len": [ + 2, + 160 + ], + "comma-style": [ + 2, + "last" + ], + "curly": [ + 2, + "all" + ], + "space-infix-ops": 2, + "space-before-blocks": [ + 2, + "always" + ], + "indent": [ + 2, + 4, + { + "SwitchCase": 1 + } + ] + } +} diff --git a/.jscsrc b/.jscsrc deleted file mode 100644 index d02315747..000000000 --- a/.jscsrc +++ /dev/null @@ -1,73 +0,0 @@ -{ - "disallowImplicitTypeConversion": ["numeric", "binary", "string"], - "disallowKeywords": ["with"], - "disallowMixedSpacesAndTabs": true, - "disallowMultipleLineBreaks": true, - "disallowOperatorBeforeLineBreak": ["."], - "disallowSpaceAfterKeywords": [ - "void"//, - //"typeof" - ], - "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~"], - "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], - "disallowSpacesInCallExpression": true, - "disallowSpacesInNamedFunctionExpression": { - "beforeOpeningRoundBrace": true}, - "disallowTrailingComma": true, - "disallowTrailingWhitespace": false, - "maximumLineLength": 160, - "requireCommaBeforeLineBreak": true, - "requireCurlyBraces": [ "if", - "else", - "for", - "while", - "do", - "try", - "catch"], - "requireOperatorBeforeLineBreak": [ "?", - "=", - "+", - "-", - "/", - "*", - "==", - "===", - "!=", - "!==", - ">", - ">=", - "<", - "<="], - "requireSpaceAfterBinaryOperators": true, - "requireSpaceAfterKeywords": [ - "else", - "case", - "try", - "typeof", - "return", - "if", - "for", - "while", - "do" - ], - "requireSpaceBeforeBlockStatements": true, - "requireSpaceBeforeBinaryOperators": [ - "=", - "+", - "-", - "/", - "*", - "==", - "===", - "!=", - "!==" - ], - "requireSpaceBeforeBlockStatements": true, - "requireSpaceBetweenArguments": true, - "requireSpacesInConditionalExpression": true, - "requireSpacesInForStatement": true, - "requireSpacesInNamedFunctionExpression": { - "beforeOpeningCurlyBrace": true - }, - "validateIndentation": 4 -} \ No newline at end of file diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index c189e87dc..000000000 --- a/.jshintrc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "evil": true, - "latedef": true, - "node": true, - "undef": true, - "unused": "vars", - "noarg": true, - "eqnull": true, - "forin": true, - "predef": ["Promise"] -} diff --git a/Gruntfile.js b/Gruntfile.js index 7d9dfd9e4..02fe46f9c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -68,17 +68,17 @@ module.exports = function (grunt) { var sauceJobs = {}; var browserTests = [ "filemanager-plugin", - "visitor-plugin", - "global-vars", - "modify-vars", - "production", - "rootpath-relative", - "rootpath", - "relative-urls", - "browser", - "no-js-errors", - "legacy" - ]; + "visitor-plugin", + "global-vars", + "modify-vars", + "production", + "rootpath-relative", + "rootpath", + "relative-urls", + "browser", + "no-js-errors", + "legacy" + ]; function makeJob(testName) { sauceJobs[testName] = { @@ -127,15 +127,15 @@ module.exports = function (grunt) { build: 'build-' + hash } }, function (error, response, body) { - if (error) { - console.log(error); - callback(error); - } else if (response.statusCode !== 200) { - console.log(response); - callback(new Error('Unexpected response status')); - } else { - callback(null, result.passed); - } + if (error) { + console.log(error); + callback(error); + } else if (response.statusCode !== 200) { + console.log(response); + callback(new Error('Unexpected response status')); + } else { + callback(null, result.passed); + } }); }); @@ -247,24 +247,16 @@ module.exports = function (grunt) { } }, - jshint: { - options: {jshintrc: '.jshintrc'}, - files: { - src: [ - 'Gruntfile.js', - 'lib/less/**/*.js', - 'lib/less-node/**/*.js', - 'lib/less-browser/**/*.js', - 'lib/less-rhino/**/*.js', - 'bin/lessc' - ] - } - }, - - jscs: { - src: ["test/**/*.js", "lib/less*/**/*.js", "bin/lessc"], + eslint: { + target: ["Gruntfile.js", + "test/**/*.js", + "lib/less*/**/*.js", + "bin/lessc", + "!test/browser/jasmine-jsreporter.js", + "!test/less/errors/plugin/plugin-error.js" + ], options: { - config: ".jscsrc" + configFile: ".eslintrc.json" } }, @@ -507,8 +499,7 @@ module.exports = function (grunt) { var testTasks = [ 'clean', - 'jshint', - 'jscs', + 'eslint', 'shell:test', 'browsertest' ]; @@ -525,7 +516,7 @@ module.exports = function (grunt) { grunt.registerTask('test', testTasks); // Run all tests - grunt.registerTask('quicktest', testTasks.slice(0, testTasks.length -1)); + grunt.registerTask('quicktest', testTasks.slice(0, testTasks.length - 1)); // generate a good test environment for testing sourcemaps grunt.registerTask('sourcemap-test', [ diff --git a/bin/lessc b/bin/lessc index 7833cd36f..4d3c190cb 100755 --- a/bin/lessc +++ b/bin/lessc @@ -161,7 +161,7 @@ function render() { sourceMapOptions.sourceMapRootpath = path.relative(pathToMap, pathToInput); } - if (! input) { + if (!input) { console.error("lessc: no input files"); console.error(""); printUsage(); @@ -176,7 +176,7 @@ function render() { if (!existsSync(dir)) { if (mkdirp === undefined) { try {mkdirp = require('mkdirp');} - catch(e) { mkdirp = null; } + catch (e) { mkdirp = null; } } cmd = mkdirp && mkdirp.sync || fs.mkdirSync; cmd(dir); diff --git a/lib/less-browser/cache.js b/lib/less-browser/cache.js index f3cf2b72d..3144cf4ed 100644 --- a/lib/less-browser/cache.js +++ b/lib/less-browser/cache.js @@ -17,7 +17,7 @@ module.exports = function(window, options, logger) { if (modifyVars) { cache.setItem(path + ':vars', JSON.stringify(modifyVars)); } - } catch(e) { + } catch (e) { //TODO - could do with adding more robust error handling logger.error('failed to save "' + path + '" to local storage for caching.'); } diff --git a/lib/less-browser/utils.js b/lib/less-browser/utils.js index 6276e1eba..4ee140585 100644 --- a/lib/less-browser/utils.js +++ b/lib/less-browser/utils.js @@ -16,7 +16,7 @@ module.exports = { try { options[opt] = JSON.parse(tag.dataset[opt]); } - catch(_) {} + catch (_) {} } } } diff --git a/lib/less-node/file-manager.js b/lib/less-node/file-manager.js index d924e228e..95387de73 100644 --- a/lib/less-node/file-manager.js +++ b/lib/less-node/file-manager.js @@ -5,7 +5,7 @@ var path = require('path'), try { PromiseConstructor = typeof Promise === 'undefined' ? require('promise') : Promise; -} catch(e) { +} catch (e) { } var FileManager = function() { diff --git a/lib/less-node/fs.js b/lib/less-node/fs.js index d124f8475..2a41c41aa 100644 --- a/lib/less-node/fs.js +++ b/lib/less-node/fs.js @@ -3,7 +3,7 @@ try { fs = require("graceful-fs"); } -catch(e) +catch (e) { fs = require("fs"); } diff --git a/lib/less-node/image-size.js b/lib/less-node/image-size.js index 660c4db34..01b963902 100644 --- a/lib/less-node/image-size.js +++ b/lib/less-node/image-size.js @@ -1,7 +1,7 @@ module.exports = function(environment) { var Dimension = require("../less/tree/dimension"), - Expression = require("../less/tree/expression"), - functionRegistry = require("./../less/functions/function-registry"); + Expression = require("../less/tree/expression"), + functionRegistry = require("./../less/functions/function-registry"); function imageSize(functionContext, filePathNode) { var filePath = filePathNode.value; diff --git a/lib/less-node/plugin-loader.js b/lib/less-node/plugin-loader.js index d65880c94..942719e7e 100644 --- a/lib/less-node/plugin-loader.js +++ b/lib/less-node/plugin-loader.js @@ -56,7 +56,7 @@ PluginLoader.prototype.tryLoadFromEnvironment = function(name, basePath, explici try { self.require = self.requireRelative(filename); } - catch(e) { + catch (e) { callback(e); } callback(null, data); @@ -78,26 +78,26 @@ PluginLoader.prototype.tryLoadFromEnvironment = function(name, basePath, explici try { filename = require.resolve(path.join("../../../", name)); } - catch(e) { + catch (e) { } // is installed as a sub dependency of the current folder try { filename = require.resolve(path.join(process.cwd(), "node_modules", name)); } - catch(e) { + catch (e) { } // is referenced relative to the current directory try { filename = require.resolve(path.join(process.cwd(), name)); } - catch(e) { + catch (e) { } // unlikely - would have to be a dependency of where this code was running (less.js)... if (name[0] !== '.') { try { filename = require.resolve(name); } - catch(e) { + catch (e) { } } if (basePath) { diff --git a/lib/less-node/url-file-manager.js b/lib/less-node/url-file-manager.js index 83a5653b2..d3884b4e2 100644 --- a/lib/less-node/url-file-manager.js +++ b/lib/less-node/url-file-manager.js @@ -21,7 +21,7 @@ UrlFileManager.prototype.loadFile = function(filename, currentDirectory, options return new PromiseConstructor(function(fulfill, reject) { if (request === undefined) { try { request = require('request'); } - catch(e) { request = null; } + catch (e) { request = null; } } if (!request) { reject({ type: 'File', message: "optional dependency 'request' required to import over http(s)\n" }); diff --git a/lib/less/contexts.js b/lib/less/contexts.js index c7f6bc0fc..06190edff 100644 --- a/lib/less/contexts.js +++ b/lib/less/contexts.js @@ -51,7 +51,7 @@ var evalCopyProperties = [ 'javascriptEnabled',// option - whether Inline JavaScript is enabled. if undefined, defaults to false 'pluginManager', // Used as the plugin manager for the session 'importantScope' // used to bubble up !important statements - ]; +]; contexts.Eval = function(options, frames) { copyFromOriginal(options, this, evalCopyProperties); @@ -83,13 +83,13 @@ contexts.Eval.prototype.isPathRelative = function (path) { contexts.Eval.prototype.normalizePath = function( path ) { var - segments = path.split("/").reverse(), - segment; + segments = path.split("/").reverse(), + segment; path = []; while (segments.length !== 0 ) { segment = segments.pop(); - switch( segment ) { + switch ( segment ) { case ".": break; case "..": diff --git a/lib/less/functions/number.js b/lib/less/functions/number.js index 359d1725e..355f4314a 100644 --- a/lib/less/functions/number.js +++ b/lib/less/functions/number.js @@ -5,7 +5,7 @@ var Dimension = require("../tree/dimension"), var minMax = function (isMin, args) { args = Array.prototype.slice.call(args); - switch(args.length) { + switch (args.length) { case 0: throw { type: "Argument", message: "one or more arguments required" }; } var i, j, current, currentUnified, referenceUnified, unit, unitStatic, unitClone, @@ -27,7 +27,7 @@ var minMax = function (isMin, args) { j = values[""] !== undefined && unit !== "" && unit === unitStatic ? values[""] : values[unit]; if (j === undefined) { if (unitStatic !== undefined && unit !== unitStatic) { - throw{ type: "Argument", message: "incompatible types" }; + throw { type: "Argument", message: "incompatible types" }; } values[unit] = order.length; order.push(current); diff --git a/lib/less/functions/svg.js b/lib/less/functions/svg.js index ef5e84b96..e5f0e357a 100644 --- a/lib/less/functions/svg.js +++ b/lib/less/functions/svg.js @@ -15,12 +15,12 @@ module.exports = function(environment) { renderEnv = {compress: false}, returner, directionValue = direction.toCSS(renderEnv), - i, color, position, positionValue, alpha; + i, color, position, positionValue, alpha; function throwArgumentDescriptor() { throw { type: "Argument", - message: "svg-gradient expects direction, start_color [start_position], [color position,]...," + - " end_color [end_position] or direction, color list" }; + message: "svg-gradient expects direction, start_color [start_position], [color position,]...," + + " end_color [end_position] or direction, color list" }; } if (arguments.length == 2) { @@ -61,7 +61,7 @@ module.exports = function(environment) { '' + '<' + gradientType + 'Gradient id="gradient" gradientUnits="userSpaceOnUse" ' + gradientDirectionSvg + '>'; - for (i = 0; i < stops.length; i+= 1) { + for (i = 0; i < stops.length; i += 1) { if (stops[i] instanceof Expression) { color = stops[i].value[0]; position = stops[i].value[1]; diff --git a/lib/less/index.js b/lib/less/index.js index de50d3332..84cd6c2e8 100644 --- a/lib/less/index.js +++ b/lib/less/index.js @@ -37,7 +37,7 @@ module.exports = function(environment, fileManagers) { }; var t, api = Object.create(initial); for (var n in initial.tree) { - /*jshint forin: false */ + /*eslint guard-for-in: 0 */ t = initial.tree[n]; if (typeof t === "function") { api[n] = ctor(t); @@ -45,7 +45,7 @@ module.exports = function(environment, fileManagers) { else { api[n] = Object.create(null); for (var o in t) { - /*jshint forin: false */ + /*eslint guard-for-in: 0 */ api[n][o] = ctor(t[o]); } } diff --git a/lib/less/parser/parser-input.js b/lib/less/parser/parser-input.js index 4b27f325e..4765d7404 100644 --- a/lib/less/parser/parser-input.js +++ b/lib/less/parser/parser-input.js @@ -156,7 +156,7 @@ module.exports = function() { for (var i = 1; i + currentPosition < length; i++) { var nextChar = input.charAt(i + currentPosition); - switch(nextChar) { + switch (nextChar) { case "\\": i++; continue; diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js index 9cc821969..71c155ed0 100644 --- a/lib/less/parser/parser.js +++ b/lib/less/parser/parser.js @@ -414,7 +414,7 @@ var Parser = function Parser(context, imports, fileInfo) { args = this.arguments(); - if (! parserInput.$char(')')) { + if (!parserInput.$char(')')) { parserInput.restore("Could not parse call arguments or missing ')'"); return; } @@ -712,7 +712,7 @@ var Parser = function Parser(context, imports, fileInfo) { do { option = null; elements = null; - while (! (option = parserInput.$re(/^(all)(?=\s*(\)|,))/))) { + while (!(option = parserInput.$re(/^(all)(?=\s*(\)|,))/))) { e = this.element(); if (!e) { break; @@ -1021,7 +1021,7 @@ var Parser = function Parser(context, imports, fileInfo) { var value; // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18 - if (! parserInput.$re(/^opacity=/i)) { return; } + if (!parserInput.$re(/^opacity=/i)) { return; } value = parserInput.$re(/^\d+/); if (!value) { value = expect(this.entities.variable, "Could not parse alpha"); @@ -1053,7 +1053,7 @@ var Parser = function Parser(context, imports, fileInfo) { parserInput.$re(/^\([^&()@]+\)/) || parserInput.$re(/^[\.#:](?=@)/) || this.entities.variableCurly(); - if (! e) { + if (!e) { parserInput.save(); if (parserInput.$char('(')) { if ((v = this.selector(false)) && parserInput.$char(')')) { @@ -1148,7 +1148,7 @@ var Parser = function Parser(context, imports, fileInfo) { if (allExtends) { error("Extend must be used to extend a selector, it cannot be used on its own"); } }, attribute: function () { - if (! parserInput.$char('[')) { return; } + if (!parserInput.$char('[')) { return; } var entities = this.entities, key, val, op; @@ -1220,7 +1220,7 @@ var Parser = function Parser(context, imports, fileInfo) { if (s.condition && selectors.length > 1) { error("Guards are only currently allowed on a single selector."); } - if (! parserInput.$char(',')) { break; } + if (!parserInput.$char(',')) { break; } if (s.condition) { error("Guards are only currently allowed on a single selector."); } @@ -1334,13 +1334,13 @@ var Parser = function Parser(context, imports, fileInfo) { var o, options = {}, optionName, value; // list of options, surrounded by parens - if (! parserInput.$char('(')) { return null; } + if (!parserInput.$char('(')) { return null; } do { o = this.importOption(); if (o) { optionName = o; value = true; - switch(optionName) { + switch (optionName) { case "css": optionName = "less"; value = false; @@ -1351,7 +1351,7 @@ var Parser = function Parser(context, imports, fileInfo) { break; } options[optionName] = value; - if (! parserInput.$char(',')) { break; } + if (!parserInput.$char(',')) { break; } } } while (o); expectChar(')'); @@ -1401,12 +1401,12 @@ var Parser = function Parser(context, imports, fileInfo) { e = this.mediaFeature(); if (e) { features.push(e); - if (! parserInput.$char(',')) { break; } + if (!parserInput.$char(',')) { break; } } else { e = entities.variable(); if (e) { features.push(e); - if (! parserInput.$char(',')) { break; } + if (!parserInput.$char(',')) { break; } } } } while (e); @@ -1487,7 +1487,7 @@ var Parser = function Parser(context, imports, fileInfo) { pluginArgs: function() { // list of options, surrounded by parens parserInput.save(); - if (! parserInput.$char('(')) { + if (!parserInput.$char('(')) { parserInput.restore(); return null; } @@ -1529,7 +1529,7 @@ var Parser = function Parser(context, imports, fileInfo) { nonVendorSpecificName = "@" + name.slice(name.indexOf('-', 2) + 1); } - switch(nonVendorSpecificName) { + switch (nonVendorSpecificName) { case "@charset": hasIdentifier = true; hasBlock = false; @@ -1602,7 +1602,7 @@ var Parser = function Parser(context, imports, fileInfo) { e = this.expression(); if (e) { expressions.push(e); - if (! parserInput.$char(',')) { break; } + if (!parserInput.$char(',')) { break; } } } while (e); diff --git a/lib/less/plugin-manager.js b/lib/less/plugin-manager.js index a7e8b63d7..dad1c2132 100644 --- a/lib/less/plugin-manager.js +++ b/lib/less/plugin-manager.js @@ -15,11 +15,11 @@ var PluginManager = function(less) { }; var pm, PluginManagerFactory = function(less, newFactory) { - if (newFactory || !pm) { - pm = new PluginManager(less); - } - return pm; -}; + if (newFactory || !pm) { + pm = new PluginManager(less); + } + return pm; + }; /** * Adds all the plugins in the array @@ -79,7 +79,7 @@ PluginManager.prototype.addVisitor = function(visitor) { upgradeVisitors(proto, 'Directive', 'AtRule'); upgradeVisitors(proto, 'Rule', 'Declaration'); } - catch(e) {} + catch (e) {} this.visitors.push(visitor); }; diff --git a/lib/less/transform-tree.js b/lib/less/transform-tree.js index 47510793f..d690d6930 100644 --- a/lib/less/transform-tree.js +++ b/lib/less/transform-tree.js @@ -25,8 +25,8 @@ module.exports = function(root, options) { variables = Object.keys(variables).map(function (k) { var value = variables[k]; - if (! (value instanceof tree.Value)) { - if (! (value instanceof tree.Expression)) { + if (!(value instanceof tree.Value)) { + if (!(value instanceof tree.Expression)) { value = new tree.Expression([value]); } value = new tree.Value([value]); diff --git a/lib/less/tree/color.js b/lib/less/tree/color.js index 4218b9500..b28f83858 100644 --- a/lib/less/tree/color.js +++ b/lib/less/tree/color.js @@ -152,7 +152,7 @@ Color.prototype.toHSV = function () { if (max === min) { h = 0; } else { - switch(max) { + switch (max) { case r: h = (g - b) / d + (g < b ? 6 : 0); break; case g: h = (b - r) / d + 2; break; case b: h = (r - g) / d + 4; break; diff --git a/lib/less/tree/debug-info.js b/lib/less/tree/debug-info.js index f169c2244..5b1db51fa 100644 --- a/lib/less/tree/debug-info.js +++ b/lib/less/tree/debug-info.js @@ -1,7 +1,7 @@ var debugInfo = function(context, ctx, lineSeparator) { var result = ""; if (context.dumpLineNumbers && !context.compress) { - switch(context.dumpLineNumbers) { + switch (context.dumpLineNumbers) { case 'comments': result = debugInfo.asComment(ctx); break; diff --git a/lib/less/tree/declaration.js b/lib/less/tree/declaration.js index 478b6702a..338a62124 100644 --- a/lib/less/tree/declaration.js +++ b/lib/less/tree/declaration.js @@ -33,7 +33,7 @@ Declaration.prototype.genCSS = function (context, output) { try { this.value.genCSS(context, output); } - catch(e) { + catch (e) { e.index = this._index; e.filename = this._fileInfo.filename; throw e; @@ -59,7 +59,7 @@ Declaration.prototype.eval = function (context) { if (!this.variable && evaldValue.type === "DetachedRuleset") { throw { message: "Rulesets cannot be evaluated on a property.", - index: this.getIndex(), filename: this.fileInfo().filename }; + index: this.getIndex(), filename: this.fileInfo().filename }; } var important = this.important, importantResult = context.importantScope.pop(); @@ -74,7 +74,7 @@ Declaration.prototype.eval = function (context) { this.getIndex(), this.fileInfo(), this.inline, variable); } - catch(e) { + catch (e) { if (typeof e.index !== 'number') { e.index = this.getIndex(); e.filename = this.fileInfo().filename; diff --git a/lib/less/tree/extend.js b/lib/less/tree/extend.js index b3e8d49cf..0729c5ce7 100644 --- a/lib/less/tree/extend.js +++ b/lib/less/tree/extend.js @@ -11,7 +11,7 @@ var Extend = function Extend(selector, option, index, currentFileInfo, visibilit this.copyVisibilityInfo(visibilityInfo); this.allowRoot = true; - switch(option) { + switch (option) { case "all": this.allowBefore = true; this.allowAfter = true; diff --git a/lib/less/tree/import.js b/lib/less/tree/import.js index 694666509..37ff55106 100644 --- a/lib/less/tree/import.js +++ b/lib/less/tree/import.js @@ -116,8 +116,8 @@ Import.prototype.eval = function (context) { if (this.options.reference || this.blocksVisibility()) { if (result.length || result.length === 0) { result.forEach(function (node) { - node.addVisibilityBlock(); - } + node.addVisibilityBlock(); + } ); } else { result.addVisibilityBlock(); @@ -151,10 +151,10 @@ Import.prototype.doEval = function (context) { } if (this.options.inline) { var contents = new Anonymous(this.root, 0, - { - filename: this.importedFilename, - reference: this.path._fileInfo && this.path._fileInfo.reference - }, true, true); + { + filename: this.importedFilename, + reference: this.path._fileInfo && this.path._fileInfo.reference + }, true, true); return this.features ? new Media([contents], this.features.value) : [contents]; } else if (this.css) { diff --git a/lib/less/tree/mixin-definition.js b/lib/less/tree/mixin-definition.js index 3437cec6b..6ad36d208 100644 --- a/lib/less/tree/mixin-definition.js +++ b/lib/less/tree/mixin-definition.js @@ -174,7 +174,7 @@ Definition.prototype.matchArgs = function (args, context) { } }, 0); - if (! this.variadic) { + if (!this.variadic) { if (requiredArgsCnt < this.required) { return false; } diff --git a/lib/less/tree/operation.js b/lib/less/tree/operation.js index ec40d3ce0..e3c225a9e 100644 --- a/lib/less/tree/operation.js +++ b/lib/less/tree/operation.js @@ -25,7 +25,7 @@ Operation.prototype.eval = function (context) { } if (!a.operate) { throw { type: "Operation", - message: "Operation on an invalid type" }; + message: "Operation on an invalid type" }; } return a.operate(context, this.op, b); diff --git a/lib/less/tree/property.js b/lib/less/tree/property.js index 341a6db95..86d5f4987 100644 --- a/lib/less/tree/property.js +++ b/lib/less/tree/property.js @@ -15,9 +15,9 @@ Property.prototype.eval = function (context) { if (this.evaluating) { throw { type: 'Name', - message: "Recursive property reference for " + name, - filename: this.fileInfo().filename, - index: this.getIndex() }; + message: "Recursive property reference for " + name, + filename: this.fileInfo().filename, + index: this.getIndex() }; } this.evaluating = true; @@ -55,9 +55,9 @@ Property.prototype.eval = function (context) { return property; } else { throw { type: 'Name', - message: "Property '" + name + "' is undefined", - filename: this.currentFileInfo.filename, - index: this.index }; + message: "Property '" + name + "' is undefined", + filename: this.currentFileInfo.filename, + index: this.index }; } }; Property.prototype.find = function (obj, fun) { diff --git a/lib/less/tree/ruleset.js b/lib/less/tree/ruleset.js index 5a29b8819..23577556c 100644 --- a/lib/less/tree/ruleset.js +++ b/lib/less/tree/ruleset.js @@ -198,7 +198,7 @@ Ruleset.prototype.evalImports = function(context) { importRules = rules[i].eval(context); if (importRules && (importRules.length || importRules.length === 0)) { rules.splice.apply(rules, [i, 1].concat(importRules)); - i+= importRules.length - 1; + i += importRules.length - 1; } else { rules.splice(i, 1, importRules); } diff --git a/lib/less/tree/variable.js b/lib/less/tree/variable.js index 553526e9a..f590711f2 100644 --- a/lib/less/tree/variable.js +++ b/lib/less/tree/variable.js @@ -16,9 +16,9 @@ Variable.prototype.eval = function (context) { if (this.evaluating) { throw { type: 'Name', - message: "Recursive variable definition for " + name, - filename: this.fileInfo().filename, - index: this.getIndex() }; + message: "Recursive variable definition for " + name, + filename: this.fileInfo().filename, + index: this.getIndex() }; } this.evaluating = true; @@ -38,9 +38,9 @@ Variable.prototype.eval = function (context) { return variable; } else { throw { type: 'Name', - message: "variable " + name + " is undefined", - filename: this.fileInfo().filename, - index: this.getIndex() }; + message: "variable " + name + " is undefined", + filename: this.fileInfo().filename, + index: this.getIndex() }; } }; Variable.prototype.find = function (obj, fun) { diff --git a/lib/less/visitors/extend-visitor.js b/lib/less/visitors/extend-visitor.js index 37df534a0..f4d94bf94 100644 --- a/lib/less/visitors/extend-visitor.js +++ b/lib/less/visitors/extend-visitor.js @@ -110,17 +110,17 @@ ProcessExtendsVisitor.prototype = { extendList.filter(function(extend) { return !extend.hasFoundMatches && extend.parent_ids.length == 1; }).forEach(function(extend) { - var selector = "_unknown_"; - try { - selector = extend.selector.toCSS({}); - } - catch(_) {} + var selector = "_unknown_"; + try { + selector = extend.selector.toCSS({}); + } + catch (_) {} - if (!indices[extend.index + ' ' + selector]) { - indices[extend.index + ' ' + selector] = true; - logger.warn("extend '" + selector + "' has no matches"); - } - }); + if (!indices[extend.index + ' ' + selector]) { + indices[extend.index + ' ' + selector] = true; + logger.warn("extend '" + selector + "' has no matches"); + } + }); }, doExtendChaining: function (extendsList, extendsListTarget, iterationCount) { // @@ -203,7 +203,7 @@ ProcessExtendsVisitor.prototype = { selectorOne = extendsToAdd[0].selfSelectors[0].toCSS(); selectorTwo = extendsToAdd[0].selector.toCSS(); } - catch(e) {} + catch (e) {} throw { message: "extend circular reference detected. One of the circular extends is currently:" + selectorOne + ":extend(" + selectorTwo + ")"}; } diff --git a/lib/less/visitors/import-visitor.js b/lib/less/visitors/import-visitor.js index 7bbbc93b5..9fe266b03 100644 --- a/lib/less/visitors/import-visitor.js +++ b/lib/less/visitors/import-visitor.js @@ -22,7 +22,7 @@ ImportVisitor.prototype = { // process the contents this._visitor.visit(root); } - catch(e) { + catch (e) { this.error = e; } @@ -58,7 +58,7 @@ ImportVisitor.prototype = { try { evaldImportNode = importNode.evalForImport(context); - } catch(e) { + } catch (e) { if (!e.filename) { e.index = importNode.getIndex(); e.filename = importNode.fileInfo().filename; } // attempt to eval properly and treat as css importNode.css = true; diff --git a/lib/less/visitors/join-selector-visitor.js b/lib/less/visitors/join-selector-visitor.js index 9d1df488b..c1fcd0cfa 100644 --- a/lib/less/visitors/join-selector-visitor.js +++ b/lib/less/visitors/join-selector-visitor.js @@ -22,7 +22,7 @@ JoinSelectorVisitor.prototype = { this.contexts.push(paths); - if (! rulesetNode.root) { + if (!rulesetNode.root) { selectors = rulesetNode.selectors; if (selectors) { selectors = selectors.filter(function(selector) { return selector.getIsOutput(); }); diff --git a/lib/less/visitors/to-css-visitor.js b/lib/less/visitors/to-css-visitor.js index d418f6ca8..009ac0569 100644 --- a/lib/less/visitors/to-css-visitor.js +++ b/lib/less/visitors/to-css-visitor.js @@ -29,8 +29,8 @@ CSSVisitorUtils.prototype = { } owner.rules = owner.rules.filter(function(thing) { - return thing.isVisible(); - } + return thing.isVisible(); + } ); }, @@ -226,7 +226,7 @@ ToCSSVisitor.prototype = { this.checkValidNodes(rulesetNode.rules, rulesetNode.firstRoot); - if (! rulesetNode.root) { + if (!rulesetNode.root) { //remove invisible paths this._compileRulesetPaths(rulesetNode); diff --git a/lib/less/visitors/visitor.js b/lib/less/visitors/visitor.js index 6086b5c6a..fc258108c 100644 --- a/lib/less/visitors/visitor.js +++ b/lib/less/visitors/visitor.js @@ -11,7 +11,7 @@ function indexNodeTypes(parent, ticker) { // add .typeIndex to tree node types for lookup table var key, child; for (key in parent) { - /*jshint forin: false */ + /*eslint guard-for-in: 0 */ child = parent[key]; switch (typeof child) { case "function": diff --git a/package.json b/package.json index e1b81f0a2..3327add6b 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "source-map": "^0.5.3" }, "devDependencies": { - "diff": "^2.2.2", + "diff": "^3.2.0", "git-rev": "^0.2.1", "grunt": "~0.4.5", "grunt-browserify": "^5.0.0", @@ -57,9 +57,8 @@ "grunt-contrib-concat": "^1.0.1", "grunt-contrib-connect": "^1.0.2", "grunt-contrib-jasmine": "^1.0.3", - "grunt-contrib-jshint": "^1.0.0", "grunt-contrib-uglify": "^1.0.1", - "grunt-jscs": "^2.8.0", + "grunt-eslint": "^19.0.0", "grunt-saucelabs": "^9.0.0", "grunt-shell": "^1.3.0", "jit-grunt": "^0.10.0", diff --git a/test/browser/jasmine-jsreporter.js b/test/browser/jasmine-jsreporter.js index 0d5562999..9a14e32c7 100644 --- a/test/browser/jasmine-jsreporter.js +++ b/test/browser/jasmine-jsreporter.js @@ -42,7 +42,7 @@ * @param startMs Start time in Milliseconds * @param finishMs Finish time in Milliseconds * @return Elapsed time in Seconds */ - function elapsedSec (startMs, finishMs) { + function elapsedSec(startMs, finishMs) { return (finishMs - startMs) / 1000; } @@ -52,7 +52,7 @@ * @param amount Amount to round * @param numOfDecDigits Number of Digits to round to. Default value is '2'. * @return Rounded amount */ - function round (amount, numOfDecDigits) { + function round(amount, numOfDecDigits) { numOfDecDigits = numOfDecDigits || 2; return Math.round(amount * Math.pow(10, numOfDecDigits)) / Math.pow(10, numOfDecDigits); } @@ -61,7 +61,7 @@ * Create a new array which contains only the failed items. * @param items Items which will be filtered * @returns {Array} of failed items */ - function failures (items) { + function failures(items) { var fs = [], i, v; for (i = 0; i < items.length; i += 1) { v = items[i]; @@ -76,7 +76,7 @@ * Collect information about a Suite, recursively, and return a JSON result. * @param suite The Jasmine Suite to get data from */ - function getSuiteData (suite) { + function getSuiteData(suite) { var suiteData = { description : suite.description, durationSec : 0, diff --git a/test/browser/runner-filemanagerPlugin-options.js b/test/browser/runner-filemanagerPlugin-options.js index 588fbb046..ecf54da68 100644 --- a/test/browser/runner-filemanagerPlugin-options.js +++ b/test/browser/runner-filemanagerPlugin-options.js @@ -1,4 +1,5 @@ -var less = {logLevel: 4, +var less = { + logLevel: 4, errorReporting: "console", plugins: [AddFilePlugin] - }; +}; diff --git a/test/browser/runner-modify-vars-spec.js b/test/browser/runner-modify-vars-spec.js index 09cfe7a2e..c7ed80bd8 100644 --- a/test/browser/runner-modify-vars-spec.js +++ b/test/browser/runner-modify-vars-spec.js @@ -17,8 +17,8 @@ describe("less.js modify vars", function () { var2: "purple", scale: 20 }).then(function () { - done(); - }); + done(); + }); }); }); diff --git a/test/modify-vars.js b/test/modify-vars.js index 4f73dce4a..8ee70629a 100644 --- a/test/modify-vars.js +++ b/test/modify-vars.js @@ -1,5 +1,5 @@ var less = require('../lib/less'), - fs = require('fs'); + fs = require('fs'); var input = fs.readFileSync("./test/less/modifyVars/extended.less", 'utf8'); var expectedCss = fs.readFileSync('./test/css/modifyVars/extended.css', 'utf8'); From 43ab0b872248ec34186bd8c245904d9a0f5d7825 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Sat, 31 Dec 2016 20:04:51 -0800 Subject: [PATCH 48/97] Added error test for unparseable `@plugin` with better error messaging --- lib/less-browser/error-reporting.js | 8 ++-- lib/less-rhino/index.js | 6 +-- .../environment/abstract-plugin-loader.js | 2 +- lib/less/import-manager.js | 4 +- lib/less/less-error.js | 39 +++++++++++-------- lib/less/parse.js | 8 ++-- test/browser/common.js | 14 ++++--- test/index.js | 16 +------- test/less-test.js | 16 +++++--- test/less/errors/plugin-1.txt | 2 +- test/less/errors/plugin/plugin-error.js | 1 - 11 files changed, 58 insertions(+), 58 deletions(-) diff --git a/lib/less-browser/error-reporting.js b/lib/less-browser/error-reporting.js index 264bf2a93..a3746ea5d 100644 --- a/lib/less-browser/error-reporting.js +++ b/lib/less-browser/error-reporting.js @@ -24,7 +24,7 @@ module.exports = function(window, less, options) { } }; - if (e.extract) { + if (e.line) { errorline(e, 0, ''); errorline(e, 1, 'line'); errorline(e, 2, ''); @@ -130,7 +130,7 @@ module.exports = function(window, less, options) { var filename = e.filename || rootHref; var errors = []; var content = (e.type || "Syntax") + "Error: " + (e.message || 'There is an error in your .less file') + - " in " + filename + " "; + " in " + filename; var errorline = function (e, i, classname) { if (e.extract[i] !== undefined) { @@ -140,11 +140,11 @@ module.exports = function(window, less, options) { } }; - if (e.extract) { + if (e.line) { errorline(e, 0, ''); errorline(e, 1, 'line'); errorline(e, 2, ''); - content += 'on line ' + e.line + ', column ' + (e.column + 1) + ':\n' + + content += ' on line ' + e.line + ', column ' + (e.column + 1) + ':\n' + errors.join('\n'); } if (e.stack && (e.extract || options.logLevel >= 4)) { diff --git a/lib/less-rhino/index.js b/lib/less-rhino/index.js index 9d0f2313b..b59fae516 100644 --- a/lib/less-rhino/index.js +++ b/lib/less-rhino/index.js @@ -81,7 +81,7 @@ function loadStyleSheet(sheet, callback, reload, remaining) { } try { callback(e, root, input, sheet, { local: false, lastModified: 0, remaining: remaining }, sheetName); - } catch(e) { + } catch (e) { writeError(e); } }); @@ -164,7 +164,7 @@ function writeFile(filename, content) { strictUnits: false }; var continueProcessing = true, - currentErrorcode; + currentErrorcode; var checkArgFunc = function(arg, option) { if (!option) { @@ -443,7 +443,7 @@ function writeFile(filename, content) { } }); } - catch(e) { + catch (e) { writeError(e, options); quit(1); } diff --git a/lib/less/environment/abstract-plugin-loader.js b/lib/less/environment/abstract-plugin-loader.js index dc674391b..abf50d33b 100644 --- a/lib/less/environment/abstract-plugin-loader.js +++ b/lib/less/environment/abstract-plugin-loader.js @@ -82,7 +82,7 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, imports, } } catch (e) { - return new this.less.LessError(e, imports, filename); + return new this.less.LessError({ message: 'Parse error' }, imports, filename); } return pluginObj; diff --git a/lib/less/import-manager.js b/lib/less/import-manager.js index 3cbc4e214..4d298b96a 100644 --- a/lib/less/import-manager.js +++ b/lib/less/import-manager.js @@ -107,7 +107,7 @@ module.exports = function(environment) { } if (importOptions.isPlugin) { - plugin = pluginLoader.evalPlugin(contents, newEnv, importOptions.pluginArgs, newFileInfo); + plugin = pluginLoader.evalPlugin(contents, newEnv, importManager, importOptions.pluginArgs, newFileInfo); if (plugin instanceof LessError) { fileParsedFunc(plugin, null, resolvedFilename); } @@ -134,7 +134,7 @@ module.exports = function(environment) { try { pluginLoader.tryLoadPlugin(path, currentFileInfo.currentDirectory, done); } - catch(e) { + catch (e) { callback(e); } } diff --git a/lib/less/less-error.js b/lib/less/less-error.js index d4a2cca6b..6d0cbe7be 100644 --- a/lib/less/less-error.js +++ b/lib/less/less-error.js @@ -49,6 +49,7 @@ var LessError = module.exports = function LessError(e, importManager, currentFil } this.message = e.message; this.stack = e.stack; + }; if (typeof Object.create === 'undefined') { @@ -72,7 +73,7 @@ LessError.prototype.toString = function(options) { options = options || {}; var message = ''; - var extract = this.extract; + var extract = this.extract || []; var error = []; var stylize = function (str) { return str; }; if (options.stylize) { @@ -83,29 +84,33 @@ LessError.prototype.toString = function(options) { stylize = options.stylize; } - if (typeof extract[0] === 'string') { - error.push(stylize((this.line - 1) + ' ' + extract[0], 'grey')); - } + if (this.line !== null) { + if (typeof extract[0] === 'string') { + error.push(stylize((this.line - 1) + ' ' + extract[0], 'grey')); + } - if (typeof extract[1] === 'string') { - var errorTxt = this.line + ' '; - if (extract[1]) { - errorTxt += extract[1].slice(0, this.column) + - stylize(stylize(stylize(extract[1].substr(this.column, 1), 'bold') + - extract[1].slice(this.column + 1), 'red'), 'inverse'); + if (typeof extract[1] === 'string') { + var errorTxt = this.line + ' '; + if (extract[1]) { + errorTxt += extract[1].slice(0, this.column) + + stylize(stylize(stylize(extract[1].substr(this.column, 1), 'bold') + + extract[1].slice(this.column + 1), 'red'), 'inverse'); + } + error.push(errorTxt); } - error.push(errorTxt); - } - if (typeof extract[2] === 'string') { - error.push(stylize((this.line + 1) + ' ' + extract[2], 'grey')); + if (typeof extract[2] === 'string') { + error.push(stylize((this.line + 1) + ' ' + extract[2], 'grey')); + } + error = error.join('\n') + stylize('', 'reset') + '\n'; } - error = error.join('\n') + stylize('', 'reset') + '\n'; message += stylize(this.type + 'Error: ' + this.message, 'red'); if (this.filename) { - message += stylize(' in ', 'red') + this.filename + - stylize(' on line ' + this.line + ', column ' + (this.column + 1) + ':', 'grey'); + message += stylize(' in ', 'red') + this.filename; + } + if (this.line) { + message += stylize(' on line ' + this.line + ', column ' + (this.column + 1) + ':', 'grey'); } message += '\n' + error; diff --git a/lib/less/parse.js b/lib/less/parse.js index 320623a8b..b83441e11 100644 --- a/lib/less/parse.js +++ b/lib/less/parse.js @@ -63,7 +63,7 @@ module.exports = function(environment, ParseTree, ImportManager) { var evalResult, contents; if (plugin.fileContent) { contents = plugin.fileContent.replace(/^\uFEFF/, ''); - evalResult = pluginManager.Loader.evalPlugin(contents, context, plugin.options, plugin.filename); + evalResult = pluginManager.Loader.evalPlugin(contents, context, imports, plugin.options, plugin.filename); if (evalResult instanceof LessError) { return callback(evalResult); } @@ -76,9 +76,9 @@ module.exports = function(environment, ParseTree, ImportManager) { new Parser(context, imports, rootFileInfo) .parse(input, function (e, root) { - if (e) { return callback(e); } - callback(null, root, imports, options); - }, options); + if (e) { return callback(e); } + callback(null, root, imports, options); + }, options); } }; return parse; diff --git a/test/browser/common.js b/test/browser/common.js index 6c9300dc0..5b2f748e0 100644 --- a/test/browser/common.js +++ b/test/browser/common.js @@ -183,7 +183,7 @@ testErrorSheet = function (sheet) { actualErrorElement = document.getElementById(id); return actualErrorElement !== null; }).then(function () { - var innerText = (actualErrorElement.innerHTML + var innerText = (actualErrorElement.innerHTML .replace(/

    |<\/?p>||<\/a>|
      |<\/?pre( class="?[^">]*"?)?>|<\/li>|<\/?label>/ig, "") .replace(/<\/h3>/ig, " ") .replace(/
    • |<\/ul>|
      /ig, "\n")) @@ -191,15 +191,16 @@ testErrorSheet = function (sheet) { // for IE8 .replace(/\r\n/g, "\n") .replace(/\. \nin/, ". in"); - actualErrorMsg = innerText + actualErrorMsg = innerText .replace(/\n\d+/g, function (lineNo) { return lineNo + " "; }) .replace(/\n\s*in /g, " in ") .replace(/\n{2,}/g, "\n") .replace(/\nStack Trace\n[\s\S]*/i, "") - .replace(/\n$/, ""); - errorFile + .replace(/\n$/, "") + .trim(); + errorFile .then(function (errorTxt) { errorTxt = errorTxt .replace(/\{path\}/g, "") @@ -207,14 +208,15 @@ testErrorSheet = function (sheet) { .replace(/\{pathhref\}/g, "http://localhost:8081/test/less/errors/") .replace(/\{404status\}/g, " (404)") .replace(/\{node\}.*\{\/node\}/g, "") - .replace(/\n$/, ""); + .replace(/\n$/, "") + .trim(); expect(actualErrorMsg).toEqual(errorTxt); if (errorTxt == actualErrorMsg) { actualErrorElement.style.display = "none"; } done(); }); - }); + }); }); }; diff --git a/test/index.js b/test/index.js index e2027f962..4e13259a6 100644 --- a/test/index.js +++ b/test/index.js @@ -3,27 +3,15 @@ var lessTest = require("./less-test"), path = require("path"), stylize = require('../lib/less-node/lessc-helper').stylize; -function getErrorPathReplacementFunction(dir) { - return function(input, baseDir) { - return input.replace(/\{path\}/g, path.join(process.cwd(), baseDir, dir + "/")) - .replace(/\{node\}/g, "") - .replace(/\{\/node\}/g, "") - .replace(/\{pathrel\}/g, path.join(baseDir, dir + "/")) - .replace(/\{pathhref\}/g, "") - .replace(/\{404status\}/g, "") - .replace(/\r\n/g, '\n'); - }; -} - console.log("\n" + stylize("Less", 'underline') + "\n"); lessTester.prepBomTest(); var testMap = [ [{strictMath: true, relativeUrls: true, silent: true, javascriptEnabled: true}], [{strictMath: true, strictUnits: true, javascriptEnabled: true}, "errors/", - lessTester.testErrors, null, getErrorPathReplacementFunction("errors")], + lessTester.testErrors, null], [{strictMath: true, strictUnits: true, javascriptEnabled: false}, "no-js-errors/", - lessTester.testErrors, null, getErrorPathReplacementFunction("no-js-errors")], + lessTester.testErrors, null], [{strictMath: true, dumpLineNumbers: 'comments'}, "debug/", null, function(name) { return name + '-comments'; }], [{strictMath: true, dumpLineNumbers: 'mediaquery'}, "debug/", null, diff --git a/test/less-test.js b/test/less-test.js index 5b2be4718..e7bf68936 100644 --- a/test/less-test.js +++ b/test/less-test.js @@ -137,7 +137,7 @@ module.exports = function() { function testErrors(name, err, compiledLess, doReplacements, sourcemap, baseFolder) { fs.readFile(path.join(baseFolder, name) + '.txt', 'utf8', function (e, expectedErr) { process.stdout.write('- ' + path.join(baseFolder, name) + ": "); - expectedErr = doReplacements(expectedErr, baseFolder); + expectedErr = doReplacements(expectedErr, baseFolder, err.filename); if (!err) { if (compiledLess) { fail('No Error', 'red'); @@ -155,13 +155,19 @@ module.exports = function() { }); } - function globalReplacements(input, directory) { - var p = path.join(process.cwd(), directory), + function globalReplacements(input, directory, filename) { + var path = require('path'); + var p = filename ? path.join(path.dirname(filename), '/') : path.join(process.cwd(), directory), pathimport = path.join(process.cwd(), directory + "import/"), pathesc = p.replace(/[.:/\\]/g, function(a) { return '\\' + (a == '\\' ? '\/' : a); }), pathimportesc = pathimport.replace(/[.:/\\]/g, function(a) { return '\\' + (a == '\\' ? '\/' : a); }); return input.replace(/\{path\}/g, p) + .replace(/\{node\}/g, "") + .replace(/\{\/node\}/g, "") + .replace(/\{pathhref\}/g, "") + .replace(/\{404status\}/g, "") + .replace(/\{pathrel\}/g, path.join(path.relative(process.cwd(), p), '/')) .replace(/\{pathesc\}/g, pathesc) .replace(/\{pathimport\}/g, pathimport) .replace(/\{pathimportesc\}/g, pathimportesc) @@ -224,7 +230,7 @@ module.exports = function() { } fs.readdirSync(path.join(baseFolder, foldername)).forEach(function (file) { - if (! /\.less/.test(file)) { return; } + if (!/\.less/.test(file)) { return; } var name = getBasename(file); @@ -399,7 +405,7 @@ module.exports = function() { try { process.stdout.write("- Integration - creating parser without options: "); less.render(""); - } catch(e) { + } catch (e) { fail(stylize("FAIL\n", "red")); return; } diff --git a/test/less/errors/plugin-1.txt b/test/less/errors/plugin-1.txt index 9cfbe0b98..112991af1 100644 --- a/test/less/errors/plugin-1.txt +++ b/test/less/errors/plugin-1.txt @@ -1 +1 @@ -SyntaxError: Unexpected token ) in {path}plugin/plugin-error.js +SyntaxError: Parse error in {path}plugin-error.js diff --git a/test/less/errors/plugin/plugin-error.js b/test/less/errors/plugin/plugin-error.js index 3b2d317f8..b751b63f6 100644 --- a/test/less/errors/plugin/plugin-error.js +++ b/test/less/errors/plugin/plugin-error.js @@ -1,3 +1,2 @@ -// jscs:disable functions.addMultiple({ "test-parse-error" : function() { \ No newline at end of file From 68ea31dc89c60efc403089a96f84fc97a2b2d945 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Sun, 1 Jan 2017 12:58:09 -0800 Subject: [PATCH 49/97] Line and column # reporting for Node errors --- .../environment/abstract-plugin-loader.js | 57 ++++++++++++------- lib/less/less-error.js | 29 ++++++++-- lib/less/tree/import.js | 11 +++- test/browser/common.js | 2 +- test/less-test.js | 2 +- test/less/errors/plugin-2.less | 1 + test/less/errors/plugin-2.txt | 5 ++ test/less/errors/plugin-3.less | 1 + test/less/errors/plugin-3.txt | 5 ++ test/less/errors/plugin/plugin-error-2.js | 5 ++ test/less/errors/plugin/plugin-error-3.js | 5 ++ 11 files changed, 92 insertions(+), 31 deletions(-) create mode 100644 test/less/errors/plugin-2.less create mode 100644 test/less/errors/plugin-2.txt create mode 100644 test/less/errors/plugin-3.less create mode 100644 test/less/errors/plugin-3.txt create mode 100644 test/less/errors/plugin/plugin-error-2.js create mode 100644 test/less/errors/plugin/plugin-error-3.js diff --git a/lib/less/environment/abstract-plugin-loader.js b/lib/less/environment/abstract-plugin-loader.js index abf50d33b..d1a5e1159 100644 --- a/lib/less/environment/abstract-plugin-loader.js +++ b/lib/less/environment/abstract-plugin-loader.js @@ -39,8 +39,14 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, imports, if (pluginObj) { this.trySetOptions(pluginObj, filename, shortname, pluginOptions); - if (pluginObj.use) { - pluginObj.use.call(this.context, pluginObj); + try { + if (pluginObj.use) { + pluginObj.use.call(this.context, pluginObj); + } + } + catch (e) { + e.message = 'Error during @plugin call'; + return new this.less.LessError(e, imports, filename); } return pluginObj; } @@ -52,37 +58,46 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, imports, }; localExports = localModule.exports; registry = functionRegistry.create(); + + var registerPlugin = function(obj) { + pluginObj = obj; + }; try { - var registerPlugin = function(obj) { - pluginObj = obj; - }; loader = new Function("module", "require", "registerPlugin", "functions", "tree", "less", "fileInfo", contents); loader(localModule, this.require, registerPlugin, registry, this.less.tree, this.less, fileInfo); + } catch (e) { + return new this.less.LessError({ message: 'Parse error' }, imports, filename); + } + + if (!pluginObj) { + pluginObj = localModule.exports; + } + pluginObj = this.validatePlugin(pluginObj, filename, shortname); - if (!pluginObj) { - pluginObj = localModule.exports; - } - pluginObj = this.validatePlugin(pluginObj, filename, shortname); + if (pluginObj) { + // Run on first load + pluginManager.addPlugin(pluginObj, fileInfo.filename, registry); + pluginObj.functions = registry.getLocalFunctions(); + pluginObj.imports = imports; + pluginObj.filename = filename; - if (pluginObj) { - // Run on first load - pluginManager.addPlugin(pluginObj, fileInfo.filename, registry); - pluginObj.functions = registry.getLocalFunctions(); + this.trySetOptions(pluginObj, filename, shortname, pluginOptions); - this.trySetOptions(pluginObj, filename, shortname, pluginOptions); - - // Run every @plugin call + // Run every @plugin call + try { if (pluginObj.use) { pluginObj.use.call(this.context, pluginObj); } } - else { - return new this.less.LessError({ message: "Not a valid plugin" }); + catch (e) { + e.message = 'Error during @plugin call'; + return new this.less.LessError(e, imports, filename); } - - } catch (e) { - return new this.less.LessError({ message: 'Parse error' }, imports, filename); + + } + else { + return new this.less.LessError({ message: "Not a valid plugin" }); } return pluginObj; diff --git a/lib/less/less-error.js b/lib/less/less-error.js index 6d0cbe7be..67172a7af 100644 --- a/lib/less/less-error.js +++ b/lib/less/less-error.js @@ -26,6 +26,9 @@ var LessError = module.exports = function LessError(e, importManager, currentFil var filename = e.filename || currentFilename; + this.message = e.message; + this.stack = e.stack; + if (importManager && filename) { var input = importManager.contents[filename], loc = utils.getLocation(e.index, input), @@ -38,17 +41,31 @@ var LessError = module.exports = function LessError(e, importManager, currentFil this.filename = filename; this.index = e.index; this.line = typeof line === 'number' ? line + 1 : null; + this.column = col; + + if (!this.line && this.stack) { + var found = this.stack.match(/(|Function):(\d+):(\d+)/); + + if (found) { + if (found[2]) { + this.line = parseInt(found[2]) - 2; + } + if (found[3]) { + this.column = parseInt(found[3]); + } + } + } + this.callLine = callLine + 1; this.callExtract = lines[callLine]; - this.column = col; + this.extract = [ - lines[line - 1], - lines[line], - lines[line + 1] + lines[this.line - 2], + lines[this.line - 1], + lines[this.line] ]; + } - this.message = e.message; - this.stack = e.stack; }; diff --git a/lib/less/tree/import.js b/lib/less/tree/import.js index 37ff55106..b459bb392 100644 --- a/lib/less/tree/import.js +++ b/lib/less/tree/import.js @@ -4,7 +4,8 @@ var Node = require("./node"), Quoted = require("./quoted"), Ruleset = require("./ruleset"), Anonymous = require("./anonymous"), - utils = require("../utils"); + utils = require("../utils"), + LessError = require("../less-error"); // // CSS @import node @@ -131,7 +132,13 @@ Import.prototype.doEval = function (context) { if (this.options.isPlugin) { if (this.root && this.root.eval) { - this.root.eval(context); + try { + this.root.eval(context); + } + catch (e) { + e.message = "Plugin error during evaluation"; + throw new LessError(e, this.root.imports, this.root.filename); + } } registry = context.frames[0] && context.frames[0].functionRegistry; if ( registry && this.root && this.root.functions ) { diff --git a/test/browser/common.js b/test/browser/common.js index 5b2f748e0..98a269947 100644 --- a/test/browser/common.js +++ b/test/browser/common.js @@ -207,7 +207,7 @@ testErrorSheet = function (sheet) { .replace(/\{pathrel\}/g, "") .replace(/\{pathhref\}/g, "http://localhost:8081/test/less/errors/") .replace(/\{404status\}/g, " (404)") - .replace(/\{node\}.*\{\/node\}/g, "") + .replace(/\{node\}[\s\S]*\{\/node\}/g, "") .replace(/\n$/, "") .trim(); expect(actualErrorMsg).toEqual(errorTxt); diff --git a/test/less-test.js b/test/less-test.js index e7bf68936..119027792 100644 --- a/test/less-test.js +++ b/test/less-test.js @@ -137,7 +137,7 @@ module.exports = function() { function testErrors(name, err, compiledLess, doReplacements, sourcemap, baseFolder) { fs.readFile(path.join(baseFolder, name) + '.txt', 'utf8', function (e, expectedErr) { process.stdout.write('- ' + path.join(baseFolder, name) + ": "); - expectedErr = doReplacements(expectedErr, baseFolder, err.filename); + expectedErr = doReplacements(expectedErr, baseFolder, err && err.filename); if (!err) { if (compiledLess) { fail('No Error', 'red'); diff --git a/test/less/errors/plugin-2.less b/test/less/errors/plugin-2.less new file mode 100644 index 000000000..f4bbe5da0 --- /dev/null +++ b/test/less/errors/plugin-2.less @@ -0,0 +1 @@ +@plugin "plugin/plugin-error-2"; \ No newline at end of file diff --git a/test/less/errors/plugin-2.txt b/test/less/errors/plugin-2.txt new file mode 100644 index 000000000..949fb2d0f --- /dev/null +++ b/test/less/errors/plugin-2.txt @@ -0,0 +1,5 @@ +SyntaxError: Error during @plugin call in {path}plugin-error-2.js{node} on line 3, column 16: +2 use: function() { +3 throw new Error("An error was here.") +4 } +{/node} \ No newline at end of file diff --git a/test/less/errors/plugin-3.less b/test/less/errors/plugin-3.less new file mode 100644 index 000000000..e01636a07 --- /dev/null +++ b/test/less/errors/plugin-3.less @@ -0,0 +1 @@ +@plugin "plugin/plugin-error-3"; \ No newline at end of file diff --git a/test/less/errors/plugin-3.txt b/test/less/errors/plugin-3.txt new file mode 100644 index 000000000..a2819b319 --- /dev/null +++ b/test/less/errors/plugin-3.txt @@ -0,0 +1,5 @@ +SyntaxError: Plugin error during evaluation in {path}plugin-error-3.js{node} on line 3, column 16: +2 eval: function() { +3 throw new Error("An error was here.") +4 } +{/node} \ No newline at end of file diff --git a/test/less/errors/plugin/plugin-error-2.js b/test/less/errors/plugin/plugin-error-2.js new file mode 100644 index 000000000..dbe4609ef --- /dev/null +++ b/test/less/errors/plugin/plugin-error-2.js @@ -0,0 +1,5 @@ +registerPlugin({ + use: function() { + throw new Error("An error was here.") + } +}); \ No newline at end of file diff --git a/test/less/errors/plugin/plugin-error-3.js b/test/less/errors/plugin/plugin-error-3.js new file mode 100644 index 000000000..755f099c6 --- /dev/null +++ b/test/less/errors/plugin/plugin-error-3.js @@ -0,0 +1,5 @@ +registerPlugin({ + eval: function() { + throw new Error("An error was here.") + } +}); \ No newline at end of file From c60c3225624da08cfa6937651a3160ef0ced5ba1 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Sun, 1 Jan 2017 12:59:17 -0800 Subject: [PATCH 50/97] 3.0.0-alpha.1 --- dist/less.js | 338 ++++++++++++++++++++++++++--------------------- dist/less.min.js | 14 +- package.json | 5 +- 3 files changed, 199 insertions(+), 158 deletions(-) diff --git a/dist/less.js b/dist/less.js index f34ff632e..91060dcd4 100644 --- a/dist/less.js +++ b/dist/less.js @@ -1,8 +1,8 @@ /*! - * Less - Leaner CSS v3.0.0-pre.5 + * Less - Leaner CSS v3.0.0-alpha.1 * http://lesscss.org * - * Copyright (c) 2009-2016, Alexis Sellier + * Copyright (c) 2009-2017, Alexis Sellier * Licensed under the Apache-2.0 License. * */ @@ -200,7 +200,7 @@ module.exports = function(window, options, logger) { if (modifyVars) { cache.setItem(path + ':vars', JSON.stringify(modifyVars)); } - } catch(e) { + } catch (e) { //TODO - could do with adding more robust error handling logger.error('failed to save "' + path + '" to local storage for caching.'); } @@ -251,7 +251,7 @@ module.exports = function(window, less, options) { } }; - if (e.extract) { + if (e.line) { errorline(e, 0, ''); errorline(e, 1, 'line'); errorline(e, 2, ''); @@ -357,7 +357,7 @@ module.exports = function(window, less, options) { var filename = e.filename || rootHref; var errors = []; var content = (e.type || "Syntax") + "Error: " + (e.message || 'There is an error in your .less file') + - " in " + filename + " "; + " in " + filename; var errorline = function (e, i, classname) { if (e.extract[i] !== undefined) { @@ -367,11 +367,11 @@ module.exports = function(window, less, options) { } }; - if (e.extract) { + if (e.line) { errorline(e, 0, ''); errorline(e, 1, 'line'); errorline(e, 2, ''); - content += 'on line ' + e.line + ', column ' + (e.column + 1) + ':\n' + + content += ' on line ' + e.line + ', column ' + (e.column + 1) + ':\n' + errors.join('\n'); } if (e.stack && (e.extract || options.logLevel >= 4)) { @@ -947,7 +947,7 @@ module.exports = { try { options[opt] = JSON.parse(tag.dataset[opt]); } - catch(_) {} + catch (_) {} } } } @@ -1008,7 +1008,7 @@ var evalCopyProperties = [ 'javascriptEnabled',// option - whether Inline JavaScript is enabled. if undefined, defaults to false 'pluginManager', // Used as the plugin manager for the session 'importantScope' // used to bubble up !important statements - ]; +]; contexts.Eval = function(options, frames) { copyFromOriginal(options, this, evalCopyProperties); @@ -1040,13 +1040,13 @@ contexts.Eval.prototype.isPathRelative = function (path) { contexts.Eval.prototype.normalizePath = function( path ) { var - segments = path.split("/").reverse(), - segment; + segments = path.split("/").reverse(), + segment; path = []; while (segments.length !== 0 ) { segment = segments.pop(); - switch( segment ) { + switch ( segment ) { case ".": break; case "..": @@ -1388,7 +1388,7 @@ function error(msg, type) { } ); } -AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOptions, fileInfo) { +AbstractPluginLoader.prototype.evalPlugin = function(contents, context, imports, pluginOptions, fileInfo) { var loader, registry, @@ -1415,8 +1415,14 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOp if (pluginObj) { this.trySetOptions(pluginObj, filename, shortname, pluginOptions); - if (pluginObj.use) { - pluginObj.use.call(this.context, pluginObj); + try { + if (pluginObj.use) { + pluginObj.use.call(this.context, pluginObj); + } + } + catch (e) { + e.message = 'Error during @plugin call'; + return new this.less.LessError(e, imports, filename); } return pluginObj; } @@ -1428,41 +1434,46 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, pluginOp }; localExports = localModule.exports; registry = functionRegistry.create(); + + var registerPlugin = function(obj) { + pluginObj = obj; + }; try { - loader = new Function("module", "require", "functions", "tree", "less", "fileInfo", contents); - pluginObj = loader(localModule, this.require, registry, this.less.tree, this.less, fileInfo); - - if (!pluginObj) { - pluginObj = localModule.exports; - } - pluginObj = this.validatePlugin(pluginObj, filename, shortname); + loader = new Function("module", "require", "registerPlugin", "functions", "tree", "less", "fileInfo", contents); + loader(localModule, this.require, registerPlugin, registry, this.less.tree, this.less, fileInfo); + } catch (e) { + return new this.less.LessError({ message: 'Parse error' }, imports, filename); + } + + if (!pluginObj) { + pluginObj = localModule.exports; + } + pluginObj = this.validatePlugin(pluginObj, filename, shortname); - if (pluginObj) { - // Run on first load - pluginManager.addPlugin(pluginObj, fileInfo.filename, registry); - pluginObj.functions = registry.getLocalFunctions(); + if (pluginObj) { + // Run on first load + pluginManager.addPlugin(pluginObj, fileInfo.filename, registry); + pluginObj.functions = registry.getLocalFunctions(); + pluginObj.imports = imports; + pluginObj.filename = filename; - this.trySetOptions(pluginObj, filename, shortname, pluginOptions); + this.trySetOptions(pluginObj, filename, shortname, pluginOptions); - // Run every @plugin call + // Run every @plugin call + try { if (pluginObj.use) { pluginObj.use.call(this.context, pluginObj); } } - else { - return new this.less.LessError({ message: "Not a valid plugin" }); + catch (e) { + e.message = 'Error during @plugin call'; + return new this.less.LessError(e, imports, filename); } - - } catch(e) { - // TODO pass the error - console.log(e.stack); - return new this.less.LessError({ - message: "Plugin evaluation error: '" + e.name + ': ' + e.message.replace(/["]/g, "'") + "'" , - filename: filename, - line: this.line, - col: this.column - }); + + } + else { + return new this.less.LessError({ message: "Not a valid plugin" }); } return pluginObj; @@ -1478,7 +1489,7 @@ AbstractPluginLoader.prototype.trySetOptions = function(plugin, filename, name, try { plugin.setOptions(options); } - catch(e) { + catch (e) { error("Error setting options on plugin " + name + '\n' + e.message); return null; } @@ -2273,7 +2284,7 @@ var Dimension = require("../tree/dimension"), var minMax = function (isMin, args) { args = Array.prototype.slice.call(args); - switch(args.length) { + switch (args.length) { case 0: throw { type: "Argument", message: "one or more arguments required" }; } var i, j, current, currentUnified, referenceUnified, unit, unitStatic, unitClone, @@ -2295,7 +2306,7 @@ var minMax = function (isMin, args) { j = values[""] !== undefined && unit !== "" && unit === unitStatic ? values[""] : values[unit]; if (j === undefined) { if (unitStatic !== undefined && unit !== unitStatic) { - throw{ type: "Argument", message: "incompatible types" }; + throw { type: "Argument", message: "incompatible types" }; } values[unit] = order.length; order.push(current); @@ -2405,12 +2416,12 @@ module.exports = function(environment) { renderEnv = {compress: false}, returner, directionValue = direction.toCSS(renderEnv), - i, color, position, positionValue, alpha; + i, color, position, positionValue, alpha; function throwArgumentDescriptor() { throw { type: "Argument", - message: "svg-gradient expects direction, start_color [start_position], [color position,]...," + - " end_color [end_position] or direction, color list" }; + message: "svg-gradient expects direction, start_color [start_position], [color position,]...," + + " end_color [end_position] or direction, color list" }; } if (arguments.length == 2) { @@ -2451,7 +2462,7 @@ module.exports = function(environment) { '' + '<' + gradientType + 'Gradient id="gradient" gradientUnits="userSpaceOnUse" ' + gradientDirectionSvg + '>'; - for (i = 0; i < stops.length; i+= 1) { + for (i = 0; i < stops.length; i += 1) { if (stops[i] instanceof Expression) { color = stops[i].value[0]; position = stops[i].value[1]; @@ -2678,7 +2689,7 @@ module.exports = function(environment) { } if (importOptions.isPlugin) { - plugin = pluginLoader.evalPlugin(contents, newEnv, importOptions.pluginArgs, newFileInfo); + plugin = pluginLoader.evalPlugin(contents, newEnv, importManager, importOptions.pluginArgs, newFileInfo); if (plugin instanceof LessError) { fileParsedFunc(plugin, null, resolvedFilename); } @@ -2705,7 +2716,7 @@ module.exports = function(environment) { try { pluginLoader.tryLoadPlugin(path, currentFileInfo.currentDirectory, done); } - catch(e) { + catch (e) { callback(e); } } @@ -2760,7 +2771,7 @@ module.exports = function(environment, fileManagers) { }; var t, api = Object.create(initial); for (var n in initial.tree) { - /*jshint forin: false */ + /*eslint guard-for-in: 0 */ t = initial.tree[n]; if (typeof t === "function") { api[n] = ctor(t); @@ -2768,7 +2779,7 @@ module.exports = function(environment, fileManagers) { else { api[n] = Object.create(null); for (var o in t) { - /*jshint forin: false */ + /*eslint guard-for-in: 0 */ api[n][o] = ctor(t[o]); } } @@ -2806,6 +2817,9 @@ var LessError = module.exports = function LessError(e, importManager, currentFil var filename = e.filename || currentFilename; + this.message = e.message; + this.stack = e.stack; + if (importManager && filename) { var input = importManager.contents[filename], loc = utils.getLocation(e.index, input), @@ -2818,17 +2832,32 @@ var LessError = module.exports = function LessError(e, importManager, currentFil this.filename = filename; this.index = e.index; this.line = typeof line === 'number' ? line + 1 : null; + this.column = col; + + if (!this.line && this.stack) { + var found = this.stack.match(/(|Function):(\d+):(\d+)/); + + if (found) { + if (found[2]) { + this.line = parseInt(found[2]) - 2; + } + if (found[3]) { + this.column = parseInt(found[3]); + } + } + } + this.callLine = callLine + 1; this.callExtract = lines[callLine]; - this.column = col; + this.extract = [ - lines[line - 1], - lines[line], - lines[line + 1] + lines[this.line - 2], + lines[this.line - 1], + lines[this.line] ]; + } - this.message = e.message; - this.stack = e.stack; + }; if (typeof Object.create === 'undefined') { @@ -2852,7 +2881,7 @@ LessError.prototype.toString = function(options) { options = options || {}; var message = ''; - var extract = this.extract; + var extract = this.extract || []; var error = []; var stylize = function (str) { return str; }; if (options.stylize) { @@ -2863,29 +2892,33 @@ LessError.prototype.toString = function(options) { stylize = options.stylize; } - if (typeof extract[0] === 'string') { - error.push(stylize((this.line - 1) + ' ' + extract[0], 'grey')); - } + if (this.line !== null) { + if (typeof extract[0] === 'string') { + error.push(stylize((this.line - 1) + ' ' + extract[0], 'grey')); + } - if (typeof extract[1] === 'string') { - var errorTxt = this.line + ' '; - if (extract[1]) { - errorTxt += extract[1].slice(0, this.column) + - stylize(stylize(stylize(extract[1].substr(this.column, 1), 'bold') + - extract[1].slice(this.column + 1), 'red'), 'inverse'); + if (typeof extract[1] === 'string') { + var errorTxt = this.line + ' '; + if (extract[1]) { + errorTxt += extract[1].slice(0, this.column) + + stylize(stylize(stylize(extract[1].substr(this.column, 1), 'bold') + + extract[1].slice(this.column + 1), 'red'), 'inverse'); + } + error.push(errorTxt); } - error.push(errorTxt); - } - if (typeof extract[2] === 'string') { - error.push(stylize((this.line + 1) + ' ' + extract[2], 'grey')); + if (typeof extract[2] === 'string') { + error.push(stylize((this.line + 1) + ' ' + extract[2], 'grey')); + } + error = error.join('\n') + stylize('', 'reset') + '\n'; } - error = error.join('\n') + stylize('', 'reset') + '\n'; message += stylize(this.type + 'Error: ' + this.message, 'red'); if (this.filename) { - message += stylize(' in ', 'red') + this.filename + - stylize(' on line ' + this.line + ', column ' + (this.column + 1) + ':', 'grey'); + message += stylize(' in ', 'red') + this.filename; + } + if (this.line) { + message += stylize(' on line ' + this.line + ', column ' + (this.column + 1) + ':', 'grey'); } message += '\n' + error; @@ -3062,7 +3095,7 @@ module.exports = function(environment, ParseTree, ImportManager) { var evalResult, contents; if (plugin.fileContent) { contents = plugin.fileContent.replace(/^\uFEFF/, ''); - evalResult = pluginManager.Loader.evalPlugin(contents, context, plugin.options, plugin.filename); + evalResult = pluginManager.Loader.evalPlugin(contents, context, imports, plugin.options, plugin.filename); if (evalResult instanceof LessError) { return callback(evalResult); } @@ -3075,9 +3108,9 @@ module.exports = function(environment, ParseTree, ImportManager) { new Parser(context, imports, rootFileInfo) .parse(input, function (e, root) { - if (e) { return callback(e); } - callback(null, root, imports, options); - }, options); + if (e) { return callback(e); } + callback(null, root, imports, options); + }, options); } }; return parse; @@ -3356,7 +3389,7 @@ module.exports = function() { for (var i = 1; i + currentPosition < length; i++) { var nextChar = input.charAt(i + currentPosition); - switch(nextChar) { + switch (nextChar) { case "\\": i++; continue; @@ -3875,7 +3908,7 @@ var Parser = function Parser(context, imports, fileInfo) { args = this.arguments(); - if (! parserInput.$char(')')) { + if (!parserInput.$char(')')) { parserInput.restore("Could not parse call arguments or missing ')'"); return; } @@ -4173,7 +4206,7 @@ var Parser = function Parser(context, imports, fileInfo) { do { option = null; elements = null; - while (! (option = parserInput.$re(/^(all)(?=\s*(\)|,))/))) { + while (!(option = parserInput.$re(/^(all)(?=\s*(\)|,))/))) { e = this.element(); if (!e) { break; @@ -4482,7 +4515,7 @@ var Parser = function Parser(context, imports, fileInfo) { var value; // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18 - if (! parserInput.$re(/^opacity=/i)) { return; } + if (!parserInput.$re(/^opacity=/i)) { return; } value = parserInput.$re(/^\d+/); if (!value) { value = expect(this.entities.variable, "Could not parse alpha"); @@ -4514,7 +4547,7 @@ var Parser = function Parser(context, imports, fileInfo) { parserInput.$re(/^\([^&()@]+\)/) || parserInput.$re(/^[\.#:](?=@)/) || this.entities.variableCurly(); - if (! e) { + if (!e) { parserInput.save(); if (parserInput.$char('(')) { if ((v = this.selector(false)) && parserInput.$char(')')) { @@ -4609,7 +4642,7 @@ var Parser = function Parser(context, imports, fileInfo) { if (allExtends) { error("Extend must be used to extend a selector, it cannot be used on its own"); } }, attribute: function () { - if (! parserInput.$char('[')) { return; } + if (!parserInput.$char('[')) { return; } var entities = this.entities, key, val, op; @@ -4681,7 +4714,7 @@ var Parser = function Parser(context, imports, fileInfo) { if (s.condition && selectors.length > 1) { error("Guards are only currently allowed on a single selector."); } - if (! parserInput.$char(',')) { break; } + if (!parserInput.$char(',')) { break; } if (s.condition) { error("Guards are only currently allowed on a single selector."); } @@ -4795,13 +4828,13 @@ var Parser = function Parser(context, imports, fileInfo) { var o, options = {}, optionName, value; // list of options, surrounded by parens - if (! parserInput.$char('(')) { return null; } + if (!parserInput.$char('(')) { return null; } do { o = this.importOption(); if (o) { optionName = o; value = true; - switch(optionName) { + switch (optionName) { case "css": optionName = "less"; value = false; @@ -4812,7 +4845,7 @@ var Parser = function Parser(context, imports, fileInfo) { break; } options[optionName] = value; - if (! parserInput.$char(',')) { break; } + if (!parserInput.$char(',')) { break; } } } while (o); expectChar(')'); @@ -4862,12 +4895,12 @@ var Parser = function Parser(context, imports, fileInfo) { e = this.mediaFeature(); if (e) { features.push(e); - if (! parserInput.$char(',')) { break; } + if (!parserInput.$char(',')) { break; } } else { e = entities.variable(); if (e) { features.push(e); - if (! parserInput.$char(',')) { break; } + if (!parserInput.$char(',')) { break; } } } } while (e); @@ -4948,7 +4981,7 @@ var Parser = function Parser(context, imports, fileInfo) { pluginArgs: function() { // list of options, surrounded by parens parserInput.save(); - if (! parserInput.$char('(')) { + if (!parserInput.$char('(')) { parserInput.restore(); return null; } @@ -4990,7 +5023,7 @@ var Parser = function Parser(context, imports, fileInfo) { nonVendorSpecificName = "@" + name.slice(name.indexOf('-', 2) + 1); } - switch(nonVendorSpecificName) { + switch (nonVendorSpecificName) { case "@charset": hasIdentifier = true; hasBlock = false; @@ -5063,7 +5096,7 @@ var Parser = function Parser(context, imports, fileInfo) { e = this.expression(); if (e) { expressions.push(e); - if (! parserInput.$char(',')) { break; } + if (!parserInput.$char(',')) { break; } } } while (e); @@ -5448,11 +5481,11 @@ var PluginManager = function(less) { }; var pm, PluginManagerFactory = function(less, newFactory) { - if (newFactory || !pm) { - pm = new PluginManager(less); - } - return pm; -}; + if (newFactory || !pm) { + pm = new PluginManager(less); + } + return pm; + }; /** * Adds all the plugins in the array @@ -5512,7 +5545,7 @@ PluginManager.prototype.addVisitor = function(visitor) { upgradeVisitors(proto, 'Directive', 'AtRule'); upgradeVisitors(proto, 'Rule', 'Declaration'); } - catch(e) {} + catch (e) {} this.visitors.push(visitor); }; @@ -5899,8 +5932,8 @@ module.exports = function(root, options) { variables = Object.keys(variables).map(function (k) { var value = variables[k]; - if (! (value instanceof tree.Value)) { - if (! (value instanceof tree.Expression)) { + if (!(value instanceof tree.Value)) { + if (!(value instanceof tree.Expression)) { value = new tree.Expression([value]); } value = new tree.Value([value]); @@ -6437,7 +6470,7 @@ Color.prototype.toHSV = function () { if (max === min) { h = 0; } else { - switch(max) { + switch (max) { case r: h = (g - b) / d + (g < b ? 6 : 0); break; case g: h = (b - r) / d + 2; break; case b: h = (r - g) / d + 4; break; @@ -6566,7 +6599,7 @@ module.exports = Condition; var debugInfo = function(context, ctx, lineSeparator) { var result = ""; if (context.dumpLineNumbers && !context.compress) { - switch(context.dumpLineNumbers) { + switch (context.dumpLineNumbers) { case 'comments': result = debugInfo.asComment(ctx); break; @@ -6638,7 +6671,7 @@ Declaration.prototype.genCSS = function (context, output) { try { this.value.genCSS(context, output); } - catch(e) { + catch (e) { e.index = this._index; e.filename = this._fileInfo.filename; throw e; @@ -6664,7 +6697,7 @@ Declaration.prototype.eval = function (context) { if (!this.variable && evaldValue.type === "DetachedRuleset") { throw { message: "Rulesets cannot be evaluated on a property.", - index: this.getIndex(), filename: this.fileInfo().filename }; + index: this.getIndex(), filename: this.fileInfo().filename }; } var important = this.important, importantResult = context.importantScope.pop(); @@ -6679,7 +6712,7 @@ Declaration.prototype.eval = function (context) { this.getIndex(), this.fileInfo(), this.inline, variable); } - catch(e) { + catch (e) { if (typeof e.index !== 'number') { e.index = this.getIndex(); e.filename = this.fileInfo().filename; @@ -7034,7 +7067,7 @@ var Extend = function Extend(selector, option, index, currentFileInfo, visibilit this.copyVisibilityInfo(visibilityInfo); this.allowRoot = true; - switch(option) { + switch (option) { case "all": this.allowBefore = true; this.allowAfter = true; @@ -7087,7 +7120,8 @@ var Node = require("./node"), Quoted = require("./quoted"), Ruleset = require("./ruleset"), Anonymous = require("./anonymous"), - utils = require("../utils"); + utils = require("../utils"), + LessError = require("../less-error"); // // CSS @import node @@ -7199,8 +7233,8 @@ Import.prototype.eval = function (context) { if (this.options.reference || this.blocksVisibility()) { if (result.length || result.length === 0) { result.forEach(function (node) { - node.addVisibilityBlock(); - } + node.addVisibilityBlock(); + } ); } else { result.addVisibilityBlock(); @@ -7214,7 +7248,13 @@ Import.prototype.doEval = function (context) { if (this.options.isPlugin) { if (this.root && this.root.eval) { - this.root.eval(context); + try { + this.root.eval(context); + } + catch (e) { + e.message = "Plugin error during evaluation"; + throw new LessError(e, this.root.imports, this.root.filename); + } } registry = context.frames[0] && context.frames[0].functionRegistry; if ( registry && this.root && this.root.functions ) { @@ -7234,10 +7274,10 @@ Import.prototype.doEval = function (context) { } if (this.options.inline) { var contents = new Anonymous(this.root, 0, - { - filename: this.importedFilename, - reference: this.path._fileInfo && this.path._fileInfo.reference - }, true, true); + { + filename: this.importedFilename, + reference: this.path._fileInfo && this.path._fileInfo.reference + }, true, true); return this.features ? new Media([contents], this.features.value) : [contents]; } else if (this.css) { @@ -7255,7 +7295,7 @@ Import.prototype.doEval = function (context) { }; module.exports = Import; -},{"../utils":87,"./anonymous":47,"./media":69,"./node":73,"./quoted":77,"./ruleset":80,"./url":84}],65:[function(require,module,exports){ +},{"../less-error":34,"../utils":87,"./anonymous":47,"./media":69,"./node":73,"./quoted":77,"./ruleset":80,"./url":84}],65:[function(require,module,exports){ var tree = Object.create(null); tree.Node = require('./node'); @@ -7929,7 +7969,7 @@ Definition.prototype.matchArgs = function (args, context) { } }, 0); - if (! this.variadic) { + if (!this.variadic) { if (requiredArgsCnt < this.required) { return false; } @@ -8165,7 +8205,7 @@ Operation.prototype.eval = function (context) { } if (!a.operate) { throw { type: "Operation", - message: "Operation on an invalid type" }; + message: "Operation on an invalid type" }; } return a.operate(context, this.op, b); @@ -8223,9 +8263,9 @@ Property.prototype.eval = function (context) { if (this.evaluating) { throw { type: 'Name', - message: "Recursive property reference for " + name, - filename: this.fileInfo().filename, - index: this.getIndex() }; + message: "Recursive property reference for " + name, + filename: this.fileInfo().filename, + index: this.getIndex() }; } this.evaluating = true; @@ -8263,9 +8303,9 @@ Property.prototype.eval = function (context) { return property; } else { throw { type: 'Name', - message: "Property '" + name + "' is undefined", - filename: this.currentFileInfo.filename, - index: this.index }; + message: "Property '" + name + "' is undefined", + filename: this.currentFileInfo.filename, + index: this.index }; } }; Property.prototype.find = function (obj, fun) { @@ -8570,7 +8610,7 @@ Ruleset.prototype.evalImports = function(context) { importRules = rules[i].eval(context); if (importRules && (importRules.length || importRules.length === 0)) { rules.splice.apply(rules, [i, 1].concat(importRules)); - i+= importRules.length - 1; + i += importRules.length - 1; } else { rules.splice(i, 1, importRules); } @@ -9515,9 +9555,9 @@ Variable.prototype.eval = function (context) { if (this.evaluating) { throw { type: 'Name', - message: "Recursive variable definition for " + name, - filename: this.fileInfo().filename, - index: this.getIndex() }; + message: "Recursive variable definition for " + name, + filename: this.fileInfo().filename, + index: this.getIndex() }; } this.evaluating = true; @@ -9537,9 +9577,9 @@ Variable.prototype.eval = function (context) { return variable; } else { throw { type: 'Name', - message: "variable " + name + " is undefined", - filename: this.fileInfo().filename, - index: this.getIndex() }; + message: "variable " + name + " is undefined", + filename: this.fileInfo().filename, + index: this.getIndex() }; } }; Variable.prototype.find = function (obj, fun) { @@ -9709,17 +9749,17 @@ ProcessExtendsVisitor.prototype = { extendList.filter(function(extend) { return !extend.hasFoundMatches && extend.parent_ids.length == 1; }).forEach(function(extend) { - var selector = "_unknown_"; - try { - selector = extend.selector.toCSS({}); - } - catch(_) {} + var selector = "_unknown_"; + try { + selector = extend.selector.toCSS({}); + } + catch (_) {} - if (!indices[extend.index + ' ' + selector]) { - indices[extend.index + ' ' + selector] = true; - logger.warn("extend '" + selector + "' has no matches"); - } - }); + if (!indices[extend.index + ' ' + selector]) { + indices[extend.index + ' ' + selector] = true; + logger.warn("extend '" + selector + "' has no matches"); + } + }); }, doExtendChaining: function (extendsList, extendsListTarget, iterationCount) { // @@ -9802,7 +9842,7 @@ ProcessExtendsVisitor.prototype = { selectorOne = extendsToAdd[0].selfSelectors[0].toCSS(); selectorTwo = extendsToAdd[0].selector.toCSS(); } - catch(e) {} + catch (e) {} throw { message: "extend circular reference detected. One of the circular extends is currently:" + selectorOne + ":extend(" + selectorTwo + ")"}; } @@ -10140,7 +10180,7 @@ ImportVisitor.prototype = { // process the contents this._visitor.visit(root); } - catch(e) { + catch (e) { this.error = e; } @@ -10176,7 +10216,7 @@ ImportVisitor.prototype = { try { evaldImportNode = importNode.evalForImport(context); - } catch(e) { + } catch (e) { if (!e.filename) { e.index = importNode.getIndex(); e.filename = importNode.fileInfo().filename; } // attempt to eval properly and treat as css importNode.css = true; @@ -10344,7 +10384,7 @@ JoinSelectorVisitor.prototype = { this.contexts.push(paths); - if (! rulesetNode.root) { + if (!rulesetNode.root) { selectors = rulesetNode.selectors; if (selectors) { selectors = selectors.filter(function(selector) { return selector.getIsOutput(); }); @@ -10443,8 +10483,8 @@ CSSVisitorUtils.prototype = { } owner.rules = owner.rules.filter(function(thing) { - return thing.isVisible(); - } + return thing.isVisible(); + } ); }, @@ -10640,7 +10680,7 @@ ToCSSVisitor.prototype = { this.checkValidNodes(rulesetNode.rules, rulesetNode.firstRoot); - if (! rulesetNode.root) { + if (!rulesetNode.root) { //remove invisible paths this._compileRulesetPaths(rulesetNode); @@ -10820,7 +10860,7 @@ function indexNodeTypes(parent, ticker) { // add .typeIndex to tree node types for lookup table var key, child; for (key in parent) { - /*jshint forin: false */ + /*eslint guard-for-in: 0 */ child = parent[key]; switch (typeof child) { case "function": diff --git a/dist/less.min.js b/dist/less.min.js index 3508992d5..a4ddf9e11 100644 --- a/dist/less.min.js +++ b/dist/less.min.js @@ -1,8 +1,8 @@ /*! - * Less - Leaner CSS v3.0.0-pre.5 + * Less - Leaner CSS v3.0.0-alpha.1 * http://lesscss.org * - * Copyright (c) 2009-2016, Alexis Sellier + * Copyright (c) 2009-2017, Alexis Sellier * Licensed under the Apache-2.0 License. * */ @@ -10,8 +10,8 @@ /** * @license Apache-2.0 */ -!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.less=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0||b.isFileProtocol?"development":"production");var c=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(a.location.hash);c&&(b.dumpLineNumbers=c[1]),void 0===b.useFileCache&&(b.useFileCache=!0),void 0===b.onReady&&(b.onReady=!0),b.javascriptEnabled=!(!b.javascriptEnabled&&!b.inlineJavaScript)}},{"./browser":3,"./utils":11}],2:[function(a,b,c){function d(a){a.filename&&console.warn(a),e.async||h.removeChild(i)}a("promise/polyfill");var e=window.less||{};a("./add-default-options")(window,e);var f=b.exports=a("./index")(window,e);window.less=f;var g,h,i;e.onReady&&(/!watch/.test(window.location.hash)&&f.watch(),e.async||(g="body { display: none !important }",h=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),i.type="text/css",i.styleSheet?i.styleSheet.cssText=g:i.appendChild(document.createTextNode(g)),h.appendChild(i)),f.registerStylesheetsImmediately(),f.pageLoadFinished=f.refresh("development"===f.env).then(d,d))},{"./add-default-options":1,"./index":8,"promise/polyfill":101}],3:[function(a,b,c){var d=a("./utils");b.exports={createCSS:function(a,b,c){var e=c.href||"",f="less:"+(c.title||d.extractId(e)),g=a.getElementById(f),h=!1,i=a.createElement("style");i.setAttribute("type","text/css"),c.media&&i.setAttribute("media",c.media),i.id=f,i.styleSheet||(i.appendChild(a.createTextNode(b)),h=null!==g&&g.childNodes.length>0&&i.childNodes.length>0&&g.firstChild.nodeValue===i.firstChild.nodeValue);var j=a.getElementsByTagName("head")[0];if(null===g||h===!1){var k=c&&c.nextSibling||null;k?k.parentNode.insertBefore(i,k):j.appendChild(i)}if(g&&h===!1&&g.parentNode.removeChild(g),i.styleSheet)try{i.styleSheet.cssText=b}catch(l){throw new Error("Couldn't reassign styleSheet.cssText.")}},currentScript:function(a){var b=a.document;return b.currentScript||function(){var a=b.getElementsByTagName("script");return a[a.length-1]}()}}},{"./utils":11}],4:[function(a,b,c){b.exports=function(a,b,c){var d=null;if("development"!==b.env)try{d="undefined"==typeof a.localStorage?null:a.localStorage}catch(e){}return{setCSS:function(a,b,e,f){if(d){c.info("saving "+a+" to cache.");try{d.setItem(a,f),d.setItem(a+":timestamp",b),e&&d.setItem(a+":vars",JSON.stringify(e))}catch(g){c.error('failed to save "'+a+'" to local storage for caching.')}}},getCSS:function(a,b,c){var e=d&&d.getItem(a),f=d&&d.getItem(a+":timestamp"),g=d&&d.getItem(a+":vars");if(c=c||{},f&&b.lastModified&&new Date(b.lastModified).valueOf()===new Date(f).valueOf()&&(!c&&!g||JSON.stringify(c)===g))return e}}}},{}],5:[function(a,b,c){var d=a("./utils"),e=a("./browser");b.exports=function(a,b,c){function f(b,f){var g,h,i="less-error-message:"+d.extractId(f||""),j='
    • {content}
    • ',k=a.document.createElement("div"),l=[],m=b.filename||f,n=m.match(/([^\/]+(\?.*)?)$/)[1];k.id=i,k.className="less-error-message",h="

      "+(b.type||"Syntax")+"Error: "+(b.message||"There is an error in your .less file")+'

      in '+n+" ";var o=function(a,b,c){void 0!==a.extract[b]&&l.push(j.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};b.extract&&(o(b,0,""),o(b,1,"line"),o(b,2,""),h+="on line "+b.line+", column "+(b.column+1)+":

        "+l.join("")+"
      "),b.stack&&(b.extract||c.logLevel>=4)&&(h+="
      Stack Trace
      "+b.stack.split("\n").slice(1).join("
      ")),k.innerHTML=h,e.createCSS(a.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),k.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===c.env&&(g=setInterval(function(){var b=a.document,c=b.body;c&&(b.getElementById(i)?c.replaceChild(k,b.getElementById(i)):c.insertBefore(k,c.firstChild),clearInterval(g))},10))}function g(b){var c=a.document.getElementById("less-error-message:"+d.extractId(b));c&&c.parentNode.removeChild(c)}function h(a){}function i(a){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?h(a):"function"==typeof c.errorReporting&&c.errorReporting("remove",a):g(a)}function j(a,d){var e="{line} {content}",f=a.filename||d,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f+" ",i=function(a,b,c){void 0!==a.extract[b]&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.extract&&(i(a,0,""),i(a,1,"line"),i(a,2,""),h+="on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")),a.stack&&(a.extract||c.logLevel>=4)&&(h+="\nStack Trace\n"+a.stack),b.logger.error(h)}function k(a,b){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?j(a,b):"function"==typeof c.errorReporting&&c.errorReporting("add",a,b):f(a,b)}return{add:k,remove:i}}},{"./browser":3,"./utils":11}],6:[function(a,b,c){b.exports=function(b,c){var d=a("../less/environment/abstract-file-manager.js"),e={},f=function(){};return f.prototype=new d,f.prototype.alwaysMakePathsAbsolute=function(){return!0},f.prototype.join=function(a,b){return a?this.extractUrlParts(b,a).path:b},f.prototype.doXHR=function(a,d,e,f){function g(b,c,d){b.status>=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var h=new XMLHttpRequest,i=!b.isFileProtocol||b.fileAsync;"function"==typeof h.overrideMimeType&&h.overrideMimeType("text/css"),c.debug("XHR: Getting '"+a+"'"),h.open("GET",a,i),h.setRequestHeader("Accept",d||"text/x-less, text/css; q=0.9, */*; q=0.5"),h.send(null),b.isFileProtocol&&!b.fileAsync?0===h.status||h.status>=200&&h.status<300?e(h.responseText):f(h.status,a):i?h.onreadystatechange=function(){4==h.readyState&&g(h,e,f)}:g(h,e,f)},f.prototype.supports=function(a,b,c,d){return!0},f.prototype.clearFileCache=function(){e={}},f.prototype.loadFile=function(a,b,c,d,f){b&&!this.isPathAbsolute(a)&&(a=b+a),c=c||{};var g=this.extractUrlParts(a,window.location.href),h=g.url;if(c.useFileCache&&e[h])try{var i=e[h];f(null,{contents:i,filename:h,webInfo:{lastModified:new Date}})}catch(j){f({filename:h,message:"Error loading file "+h+" error was "+j.message})}else this.doXHR(h,c.mime,function(a,b){e[h]=a,f(null,{contents:a,filename:h,webInfo:{lastModified:b}})},function(a,b){f({type:"File",message:"'"+b+"' wasn't found ("+a+")",href:h})})},f}},{"../less/environment/abstract-file-manager.js":16}],7:[function(a,b,c){b.exports=function(){function b(){throw{type:"Runtime",message:"Image size functions are not supported in browser version of less"}}var c=a("./../less/functions/function-registry"),d={"image-size":function(a){return b(this,a),-1},"image-width":function(a){return b(this,a),-1},"image-height":function(a){return b(this,a),-1}};c.addMultiple(d)}},{"./../less/functions/function-registry":24}],8:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(b,c){function f(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function g(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}}function h(a){for(var b,d=l.getElementsByTagName("style"),e=0;e=c&&console.log(a)},info:function(a){b.logLevel>=d&&console.log(a)},warn:function(a){b.logLevel>=e&&console.warn(a)},error:function(a){b.logLevel>=f&&console.error(a)}}]);for(var g=0;g0&&(a=a.slice(0,b)),b=a.lastIndexOf("/"),b<0&&(b=a.lastIndexOf("\\")),b<0?"":a.slice(0,b+1)},d.prototype.tryAppendExtension=function(a,b){return/(\.[a-z]*$)|([\?;].*)$/.test(a)?a:a+b},d.prototype.tryAppendLessExtension=function(a){return this.tryAppendExtension(a,".less")},d.prototype.supportsSync=function(){return!1},d.prototype.alwaysMakePathsAbsolute=function(){return!1},d.prototype.isPathAbsolute=function(a){return/^(?:[a-z-]+:|\/|\\|#)/i.test(a)},d.prototype.join=function(a,b){return a?a+b:b},d.prototype.pathDiff=function(a,b){var c,d,e,f,g=this.extractUrlParts(a),h=this.extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;c0&&(h.splice(c-1,2),c-=2)}return g.hostPart=f[1],g.directories=h,g.path=(f[1]||"")+h.join("/"),g.filename=f[4],g.fileUrl=g.path+(f[4]||""),g.url=g.fileUrl+(f[5]||""),g},b.exports=d},{}],17:[function(a,b,c){function d(a,b){throw new f({type:b||"Syntax",message:a})}var e=a("../functions/function-registry"),f=a("../less-error"),g=function(){};g.prototype.evalPlugin=function(a,b,c,d){var f,g,h,i,j,k,l;k=b.pluginManager,d&&(l="string"==typeof d?d:d.filename);var m=(new this.less.FileManager).extractUrlParts(l).filename;if(l&&(h=k.get(l)))return this.trySetOptions(h,l,m,c),h.use&&h.use.call(this.context,h),h;i={exports:{},pluginManager:k,fileInfo:d},j=i.exports,g=e.create();try{if(f=new Function("module","require","functions","tree","less","fileInfo",a),h=f(i,this.require,g,this.less.tree,this.less,d),h||(h=i.exports),h=this.validatePlugin(h,l,m),!h)return new this.less.LessError({message:"Not a valid plugin"});k.addPlugin(h,d.filename,g),h.functions=g.getLocalFunctions(),this.trySetOptions(h,l,m,c),h.use&&h.use.call(this.context,h)}catch(n){return console.log(n.stack),new this.less.LessError({message:"Plugin evaluation error: '"+n.name+": "+n.message.replace(/["]/g,"'")+"'",filename:l,line:this.line,col:this.column})}return h},g.prototype.trySetOptions=function(a,b,c,e){if(e){if(!a.setOptions)return d("Options have been provided but the plugin "+c+" does not support any options."),null;try{a.setOptions(e)}catch(f){return d("Error setting options on plugin "+c+"\n"+f.message),null}}},g.prototype.validatePlugin=function(a,b,c){return a?("function"==typeof a&&(a=new a),a.minVersion&&this.compareVersion(a.minVersion,this.less.version)<0?(d("Plugin "+c+" requires version "+this.versionToString(a.minVersion)),null):a):null},g.prototype.compareVersion=function(a,b){"string"==typeof a&&(a=a.match(/^(\d+)\.?(\d+)?\.?(\d+)?/),a.shift());for(var c=0;cparseInt(b[c])?-1:1;return 0},g.prototype.versionToString=function(a){for(var b="",c=0;c=0;h--){var i=g[h];if(i[f?"supportsSync":"supports"](a,b,c,e))return i}return null},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},b.exports=e},{"../logger":35}],19:[function(a,b,c){function d(a,b,c){var d,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;l<3;l++)d=b.rgb[l]/255,f=c.rgb[l]/255,h=a(d,f),g&&(h=(j*f+i*(d-j*(d+f-h)))/g),k[l]=255*h;return new e(k,g)}var e=a("../tree/color"),f=a("./function-registry"),g={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,a<=1?g.multiply(a,b):g.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return g.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};for(var h in g)g.hasOwnProperty(h)&&(d[h]=d.bind(null,g[h]));f.addMultiple(d)},{"../tree/color":52,"./function-registry":24}],20:[function(a,b,c){function d(a){return Math.min(1,Math.max(0,a))}function e(a){return h.hsla(a.h,a.s,a.l,a.a)}function f(a){if(a instanceof i)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{type:"Argument",message:"color functions take numbers as parameters"}}function g(a,b){return a instanceof i&&a.unit.is("%")?parseFloat(a.value*b/100):f(a)}var h,i=a("../tree/dimension"),j=a("../tree/color"),k=a("../tree/quoted"),l=a("../tree/anonymous"),m=a("./function-registry");h={rgb:function(a,b,c){return h.rgba(a,b,c,1)},rgba:function(a,b,c,d){var e=[a,b,c].map(function(a){return g(a,255)});return d=f(d),new j(e,d)},hsl:function(a,b,c){return h.hsla(a,b,c,1)},hsla:function(a,b,c,e){function g(a){return a=a<0?a+1:a>1?a-1:a,6*a<1?i+(j-i)*a*6:2*a<1?j:3*a<2?i+(j-i)*(2/3-a)*6:i}var i,j;return a=f(a)%360/360,b=d(f(b)),c=d(f(c)),e=d(f(e)),j=c<=.5?c*(b+1):c+b-c*b,i=2*c-j,h.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),e)},hsv:function(a,b,c){return h.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=f(a)%360/360*360,b=f(b),c=f(c),d=f(d);var e,g;e=Math.floor(a/60%6),g=a/60-e;var i=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],j=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return h.rgba(255*i[j[e][0]],255*i[j[e][1]],255*i[j[e][2]],d)},hue:function(a){return new i(a.toHSL().h)},saturation:function(a){return new i(100*a.toHSL().s,"%")},lightness:function(a){return new i(100*a.toHSL().l,"%")},hsvhue:function(a){return new i(a.toHSV().h)},hsvsaturation:function(a){return new i(100*a.toHSV().s,"%")},hsvvalue:function(a){return new i(100*a.toHSV().v,"%")},red:function(a){return new i(a.rgb[0])},green:function(a){return new i(a.rgb[1])},blue:function(a){return new i(a.rgb[2])},alpha:function(a){return new i(a.toHSL().a)},luma:function(a){return new i(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new i(b*a.alpha*100,"%")},saturate:function(a,b,c){if(!a.rgb)return null;var f=a.toHSL();return f.s+="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},desaturate:function(a,b,c){var f=a.toHSL();return f.s-="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},lighten:function(a,b,c){var f=a.toHSL();return f.l+="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},darken:function(a,b,c){var f=a.toHSL();return f.l-="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},fadein:function(a,b,c){var f=a.toHSL();return f.a+="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fadeout:function(a,b,c){var f=a.toHSL();return f.a-="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=d(c.a),e(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=d<0?360+d:d,e(c)},mix:function(a,b,c){a.toHSL&&b.toHSL||(console.log(b.type),console.dir(b)),c||(c=new i(50));var d=c.value/100,e=2*d-1,f=a.toHSL().a-b.toHSL().a,g=((e*f==-1?e:(e+f)/(1+e*f))+1)/2,h=1-g,k=[a.rgb[0]*g+b.rgb[0]*h,a.rgb[1]*g+b.rgb[1]*h,a.rgb[2]*g+b.rgb[2]*h],l=a.alpha*d+b.alpha*(1-d);return new j(k,l)},greyscale:function(a){return h.desaturate(a,new i(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;"undefined"==typeof b&&(b=h.rgba(0,0,0,1)),"undefined"==typeof c&&(c=h.rgba(255,255,255,1));var e,f,g=a.luma(),i=b.luma(),j=c.luma();return e=g>i?(g+.05)/(i+.05):(i+.05)/(g+.05),f=g>j?(g+.05)/(j+.05):(j+.05)/(g+.05),e>f?b:c},argb:function(a){return new l(a.toARGB())},color:function(a){if(a instanceof k&&/^#([a-f0-9]{6}|[a-f0-9]{3})$/i.test(a.value))return new j(a.value.slice(1));if(a instanceof j||(a=j.fromKeyword(a.value)))return a.value=void 0,a;throw{type:"Argument",message:"argument must be a color keyword or 3/6 digit hex e.g. #FFF"}},tint:function(a,b){return h.mix(h.rgb(255,255,255),a,b)},shade:function(a,b){return h.mix(h.rgb(0,0,0),a,b)}},m.addMultiple(h)},{"../tree/anonymous":47,"../tree/color":52,"../tree/dimension":59,"../tree/quoted":77,"./function-registry":24}],21:[function(a,b,c){b.exports=function(b){var c=a("../tree/quoted"),d=a("../tree/url"),e=a("./function-registry"),f=function(a,b){return new d(b,a.index,a.currentFileInfo).eval(a.context)},g=a("../logger");e.add("data-uri",function(a,e){e||(e=a,a=null);var h=a&&a.value,i=e.value,j=this.currentFileInfo,k=j.relativeUrls?j.currentDirectory:j.entryPath,l=i.indexOf("#"),m="";l!==-1&&(m=i.slice(l),i=i.slice(0,l));var n=b.getFileManager(i,k,this.context,b,!0);if(!n)return f(this,e);var o=!1;if(a)o=/;base64$/.test(h);else{if(h=b.mimeLookup(i),"image/svg+xml"===h)o=!1;else{var p=b.charsetLookup(h);o=["US-ASCII","UTF-8"].indexOf(p)<0}o&&(h+=";base64")}var q=n.loadFileSync(i,k,this.context,b);if(!q.contents)return g.warn("Skipped data-uri embedding of "+i+" because file not found"),f(this,e||a);var r=q.contents;if(o&&!b.encodeBase64)return f(this,e);r=o?b.encodeBase64(r):encodeURIComponent(r);var s="data:"+h+","+r+m,t=32768;return s.length>=t&&this.context.ieCompat!==!1?(g.warn("Skipped data-uri embedding of "+i+" because its size ("+s.length+" characters) exceeds IE8-safe "+t+" characters!"),f(this,e||a)):new d(new c('"'+s+'"',s,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../logger":35,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],22:[function(a,b,c){var d=a("../tree/keyword"),e=a("./function-registry"),f={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;if(null!=a)return a?d.True:d.False},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}};e.add("default",f.eval.bind(f)),b.exports=f},{"../tree/keyword":68,"./function-registry":24}],23:[function(a,b,c){var d=a("../tree/expression"),e=function(a,b,c,d){this.name=a.toLowerCase(),this.index=c,this.context=b,this.currentFileInfo=d,this.func=b.frames[0].functionRegistry.get(this.name)};e.prototype.isValid=function(){return Boolean(this.func)},e.prototype.call=function(a){return Array.isArray(a)&&(a=a.filter(function(a){return"Comment"!==a.type}).map(function(a){if("Expression"===a.type){var b=a.value.filter(function(a){return"Comment"!==a.type});return 1===b.length?b[0]:new d(b)}return a})),this.func.apply(this,a)},b.exports=e},{"../tree/expression":62}],24:[function(a,b,c){function d(a){return{_data:{},add:function(a,b){a=a.toLowerCase(),this._data.hasOwnProperty(a),this._data[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){this.add(b,a[b])}.bind(this))},get:function(b){return this._data[b]||a&&a.get(b)},getLocalFunctions:function(){return this._data},inherit:function(){return d(this)},create:function(a){return d(a)}}}b.exports=d(null)},{}],25:[function(a,b,c){b.exports=function(b){var c={functionRegistry:a("./function-registry"),functionCaller:a("./function-caller")};return a("./default"),a("./color"),a("./color-blending"),a("./data-uri")(b),a("./math"),a("./number"),a("./string"),a("./svg")(b),a("./types"),c}},{"./color":20,"./color-blending":19,"./data-uri":21,"./default":22,"./function-caller":23,"./function-registry":24,"./math":27,"./number":28,"./string":29,"./svg":30,"./types":31}],26:[function(a,b,c){var d=a("../tree/dimension"),e=function(){};e._math=function(a,b,c){if(!(c instanceof d))throw{type:"Argument",message:"argument must be a number"};return null==b?b=c.unit:c=c.unify(),new d(a(parseFloat(c.value)),b)},b.exports=e},{"../tree/dimension":59}],27:[function(a,b,c){var d=a("./function-registry"),e=a("./math-helper.js"),f={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"};for(var g in f)f.hasOwnProperty(g)&&(f[g]=e._math.bind(null,Math[g],f[g]));f.round=function(a,b){var c="undefined"==typeof b?0:b.value; -return e._math(function(a){return a.toFixed(c)},null,a)},d.addMultiple(f)},{"./function-registry":24,"./math-helper.js":26}],28:[function(a,b,c){var d=a("../tree/dimension"),e=a("../tree/anonymous"),f=a("./function-registry"),g=a("./math-helper.js"),h=function(a,b){switch(b=Array.prototype.slice.call(b),b.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var c,f,g,h,i,j,k,l,m=[],n={};for(c=0;ci.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(b[c].value)&&Array.prototype.push.apply(b,Array.prototype.slice.call(b[c].value));return 1==m.length?m[0]:(b=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new e((a?"min":"max")+"("+b+")"))};f.addMultiple({min:function(){return h(!0,arguments)},max:function(){return h(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new d(Math.PI)},mod:function(a,b){return new d(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d(a),b=new d(b);else if(!(a instanceof d&&b instanceof d))throw{type:"Argument",message:"arguments must be numbers"};return new d(Math.pow(a.value,b.value),a.unit)},percentage:function(a){var b=g._math(function(a){return 100*a},"%",a);return b}})},{"../tree/anonymous":47,"../tree/dimension":59,"./function-registry":24,"./math-helper.js":26}],29:[function(a,b,c){var d=a("../tree/quoted"),e=a("../tree/anonymous"),f=a("../tree/javascript"),g=a("./function-registry");g.addMultiple({e:function(a){return new e(a instanceof f?a.evaluated:a.value)},escape:function(a){return new e(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,b,c,e){var f=a.value;return c="Quoted"===c.type?c.value:c.toCSS(),f=f.replace(new RegExp(b.value,e?e.value:""),c),new d(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;e",k=0;k";return j+="',j=encodeURIComponent(j),j="data:image/svg+xml,"+j,new g(new f("'"+j+"'",j,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":52,"../tree/dimension":59,"../tree/expression":62,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],31:[function(a,b,c){var d=a("../tree/keyword"),e=a("../tree/detached-ruleset"),f=a("../tree/dimension"),g=a("../tree/color"),h=a("../tree/quoted"),i=a("../tree/anonymous"),j=a("../tree/url"),k=a("../tree/operation"),l=a("./function-registry"),m=function(a,b){return a instanceof b?d.True:d.False},n=function(a,b){if(void 0===b)throw{type:"Argument",message:"missing the required second argument to isunit."};if(b="string"==typeof b.value?b.value:b,"string"!=typeof b)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof f&&a.unit.is(b)?d.True:d.False},o=function(a){var b=Array.isArray(a.value)?a.value:Array(a);return b};l.addMultiple({isruleset:function(a){return m(a,e)},iscolor:function(a){return m(a,g)},isnumber:function(a){return m(a,f)},isstring:function(a){return m(a,h)},iskeyword:function(a){return m(a,d)},isurl:function(a){return m(a,j)},ispixel:function(a){return n(a,"px")},ispercentage:function(a){return n(a,"%")},isem:function(a){return n(a,"em")},isunit:n,unit:function(a,b){if(!(a instanceof f))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof k?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d?b.value:b.toCSS():"",new f(a.value,b)},"get-unit":function(a){return new i(a.unit)},extract:function(a,b){return b=b.value-1,o(a)[b]},length:function(a){return new f(o(a).length)}})},{"../tree/anonymous":47,"../tree/color":52,"../tree/detached-ruleset":58,"../tree/dimension":59,"../tree/keyword":68,"../tree/operation":74,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],32:[function(a,b,c){var d=a("./contexts"),e=a("./parser/parser"),f=a("./less-error");b.exports=function(a){var b=function(a,b,c){this.less=a,this.rootFilename=c.filename,this.paths=b.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=b.mime,this.error=null,this.context=b,this.queue=[],this.files={}};return b.prototype.push=function(b,c,g,h,i){var j=this,k=this.context.pluginManager.Loader;this.queue.push(b);var l=function(a,c,d){j.queue.splice(j.queue.indexOf(b),1);var e=d===j.rootFilename;h.optional&&a?i(null,{rules:[]},!1,null):(j.files[d]=c,a&&!j.error&&(j.error=a),i(a,c,e,d))},m={relativeUrls:this.context.relativeUrls,entryPath:g.entryPath,rootpath:g.rootpath,rootFilename:g.rootFilename},n=a.getFileManager(b,g.currentDirectory,this.context,a);if(!n)return void l({message:"Could not find a file-manager for "+b});c&&(b=h.isPlugin?b:n.tryAppendExtension(b,".less"));var o,p=function(a){var b,c=a.filename,i=a.contents.replace(/^\uFEFF/,"");m.currentDirectory=n.getPath(c),m.relativeUrls&&(m.rootpath=n.join(j.context.rootpath||"",n.pathDiff(m.currentDirectory,m.entryPath)),!n.isPathAbsolute(m.rootpath)&&n.alwaysMakePathsAbsolute()&&(m.rootpath=n.join(m.entryPath,m.rootpath))),m.filename=c;var o=new d.Parse(j.context);o.processImports=!1,j.contents[c]=i,(g.reference||h.reference)&&(m.reference=!0),h.isPlugin?(b=k.evalPlugin(i,o,h.pluginArgs,m),b instanceof f?l(b,null,c):l(null,b,c)):h.inline?l(null,i,c):new e(o,j,m).parse(i,function(a,b){l(a,b,c)})},q=function(a,b){a?l(a):p(b)};if(h.isPlugin)try{k.tryLoadPlugin(b,g.currentDirectory,q)}catch(r){i(r)}else o=n.loadFile(b,g.currentDirectory,this.context,a,q),o&&o.then(p,l)},b}},{"./contexts":12,"./less-error":34,"./parser/parser":40}],33:[function(a,b,c){b.exports=function(b,c){var d,e,f,g,h,i,j={version:[3,0,0],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),AbstractPluginLoader:a("./environment/abstract-plugin-loader"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")},k=function(a){return function(){var b=Object.create(a.prototype);return a.apply(b,Array.prototype.slice.call(arguments,0)),b}},l=Object.create(j);for(var m in j.tree)if(i=j.tree[m],"function"==typeof i)l[m]=k(i);else{l[m]=Object.create(null);for(var n in i)l[m][n]=k(i[n])}return l}},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":16,"./environment/abstract-plugin-loader":17,"./environment/environment":18,"./functions":25,"./import-manager":32,"./less-error":34,"./logger":35,"./parse":37,"./parse-tree":36,"./parser/parser":40,"./plugin-manager":41,"./render":42,"./source-map-builder":43,"./source-map-output":44,"./transform-tree":45,"./tree":65,"./utils":87,"./visitors":91}],34:[function(a,b,c){var d=a("./utils"),e=b.exports=function(a,b,c){Error.call(this);var e=a.filename||c;if(b&&e){var f=b.contents[e],g=d.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&d.getLocation(a.call,f).line,k=f.split("\n");this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.callLine=j+1,this.callExtract=k[j],this.column=i,this.extract=[k[h-1],k[h],k[h+1]]}this.message=a.message,this.stack=a.stack};if("undefined"==typeof Object.create){var f=function(){};f.prototype=Error.prototype,e.prototype=new f}else e.prototype=Object.create(Error.prototype);e.prototype.constructor=e,e.prototype.toString=function(a){a=a||{};var b="",c=this.extract,d=[],e=function(a){return a};if(a.stylize){var f=typeof a.stylize;if("function"!==f)throw Error("options.stylize should be a function, got a "+f+"!");e=a.stylize}if("string"==typeof c[0]&&d.push(e(this.line-1+" "+c[0],"grey")),"string"==typeof c[1]){var g=this.line+" ";c[1]&&(g+=c[1].slice(0,this.column)+e(e(e(c[1].substr(this.column,1),"bold")+c[1].slice(this.column+1),"red"),"inverse")),d.push(g)}return"string"==typeof c[2]&&d.push(e(this.line+1+" "+c[2],"grey")),d=d.join("\n")+e("","reset")+"\n",b+=e(this.type+"Error: "+this.message,"red"),this.filename&&(b+=e(" in ","red")+this.filename+e(" on line "+this.line+", column "+(this.column+1)+":","grey")),b+="\n"+d,this.callLine&&(b+=e("from ","red")+(this.filename||"")+"/n",b+=e(this.callLine,"grey")+" "+this.callExtract+"/n"),b}},{"./utils":87}],35:[function(a,b,c){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;b=97&&j<=122||j<34))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(h96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;hd&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],39:[function(a,b,c){var d=a("./chunker");b.exports=function(){function a(d){for(var e,f,j,p=k.i,q=c,s=k.i-i,t=k.i+h.length-s,u=k.i+=d,v=b;k.i=0){j={index:k.i,text:v.substr(k.i,x+2-k.i),isLineComment:!1},k.i+=j.text.length-1,k.commentStore.push(j);continue}}break}if(e!==l&&e!==n&&e!==m&&e!==o)break}if(h=h.slice(d+k.i-u+s),i=k.i,!h.length){if(ce||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,c=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$re=function(b){k.i>i&&(h=h.slice(k.i-i),i=k.i);var c=b.exec(h);return c?(a(c[0].length),"string"==typeof c?c:1===c.length?c[0]:c):null},k.$char=function(c){return b.charAt(k.i)!==c?null:(a(1),c)},k.$str=function(c){for(var d=c.length,e=0;es||a=b.length;return k.i=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":38}],40:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=function j(a,b,c){function i(a,e){throw new d({index:p.i,filename:c.filename,type:e||"Syntax",message:a},b)}function k(a,b,c){var d=a instanceof Function?a.call(o):p.$re(a);return d?d:void i(b||("string"==typeof a?"expected '"+a+"' got '"+p.currentChar()+"'":"unexpected token"))}function l(a,b){return p.$char(a)?a:void i(b||"expected '"+a+"' got '"+p.currentChar()+"'")}function m(a){var b=c.filename;return{lineNumber:h.getLocation(a,p.getInput()).line+1,fileName:b}}function n(a,c,e,f,g){var h,i=[],j=p;try{j.start(a,!1,function(a,b){g({message:a,index:b+e})});for(var k,l,m=0;k=c[m];m++)l=j.i,h=o[k](),h?(h._index=l+e,h._fileInfo=f,i.push(h)):i.push(null);var n=j.end();n.isFinished?g(null,i):g(!0,null)}catch(q){throw new d({index:q.index+e,message:q.message},b,f.filename)}}var o,p=g();return{parserInput:p,imports:b,fileInfo:c,parseNode:n,parse:function(g,h,i){var k,l,m,n,o=null,q="";if(l=i&&i.globalVars?j.serializeVars(i.globalVars)+"\n":"",m=i&&i.modifyVars?"\n"+j.serializeVars(i.modifyVars):"",a.pluginManager)for(var r=a.pluginManager.getPreProcessors(),s=0;s1&&(b=new e.Value(g)),d.push(b),g=[])}return p.forget(),a?d:f},literal:function(){return this.dimension()||this.color()||this.quoted()||this.unicodeDescriptor()},assignment:function(){var a,b;return p.save(),(a=p.$re(/^\w+(?=\s?=)/i))&&p.$char("=")&&(b=o.entity())?(p.forget(),new e.Assignment(a,b)):void p.restore()},url:function(){var a,b=p.i;return p.autoCommentAbsorb=!1,p.$str("url(")?(a=this.quoted()||this.variable()||this.property()||p.$re(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",p.autoCommentAbsorb=!0,l(")"),new e.URL(null!=a.value||a instanceof e.Variable||a instanceof e.Property?a:new e.Anonymous(a,b),b,c)):void(p.autoCommentAbsorb=!0)},variable:function(){var a,b=p.i;if("@"===p.currentChar()&&(a=p.$re(/^@@?[\w-]+/)))return new e.Variable(a,b,c)},variableCurly:function(){var a,b=p.i;if("@"===p.currentChar()&&(a=p.$re(/^@\{([\w-]+)\}/)))return new e.Variable("@"+a[1],b,c)},property:function(){var a,b=p.i;if("$"===p.currentChar()&&(a=p.$re(/^\$[\w-]+/)))return new e.Property(a,b,c)},propertyCurly:function(){var a,b=p.i;if("$"===p.currentChar()&&(a=p.$re(/^\$\{([\w-]+)\}/)))return new e.Property("$"+a[1],b,c)},color:function(){var a;if("#"===p.currentChar()&&(a=p.$re(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))){var b=a.input.match(/^#([\w]+).*/);return b=b[1],b.match(/^[A-Fa-f0-9]+$/)||i("Invalid HEX color code"),new e.Color(a[1],(void 0),"#"+b)}},colorKeyword:function(){p.save();var a=p.autoCommentAbsorb;p.autoCommentAbsorb=!1;var b=p.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/);if(p.autoCommentAbsorb=a,!b)return void p.forget();p.restore();var c=e.Color.fromKeyword(b);return c?(p.$str(b),c):void 0},dimension:function(){if(!p.peekNotNumeric()){var a=p.$re(/^([+-]?\d*\.?\d+)(%|[a-z_]+)?/i);return a?new e.Dimension(a[1],a[2]):void 0}},unicodeDescriptor:function(){var a;if(a=p.$re(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/))return new e.UnicodeDescriptor(a[0])},javascript:function(){var a,b=p.i;p.save();var d=p.$char("~"),f=p.$char("`");return f?(a=p.$re(/^[^`]*`/))?(p.forget(),new e.JavaScript(a.substr(0,a.length-1),Boolean(d),b,c)):void p.restore("invalid javascript definition"):void p.restore()}},variable:function(){var a;if("@"===p.currentChar()&&(a=p.$re(/^(@[\w-]+)\s*:/)))return a[1]},rulesetCall:function(){var a;if("@"===p.currentChar()&&(a=p.$re(/^(@[\w-]+)\(\s*\)\s*;/)))return new e.RulesetCall(a[1])},extend:function(a){var b,d,f,g,h,j=p.i;if(p.$str(a?"&:extend(":":extend(")){do{for(f=null,b=null;!(f=p.$re(/^(all)(?=\s*(\)|,))/))&&(d=this.element());)b?b.push(d):b=[d];f=f&&f[1],b||i("Missing target selector for :extend()."),h=new e.Extend(new e.Selector(b),f,j,c),g?g.push(h):g=[h]}while(p.$char(","));return k(/^\)/),a&&k(/^;/),g}},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var a,b,d,f,g,h,i=p.currentChar(),j=!1,k=p.i;if("."===i||"#"===i){for(p.save();;){if(a=p.i,f=p.$re(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/),!f)break;d=new e.Element(g,f,a,c),b?b.push(d):b=[d],g=p.$char(">")}return b&&(p.$char("(")&&(h=this.args(!0).args,l(")")),o.important()&&(j=!0),o.end())?(p.forget(),new e.mixin.Call(b,h,k,c,j)):void p.restore()}},args:function(a){var b,c,d,f,g,h,j,k=o.entities,l={args:null,variadic:!1},m=[],n=[],q=[];for(p.save();;){if(a)h=o.detachedRuleset()||o.expression();else{if(p.commentStore.length=0,p.$str("...")){l.variadic=!0,p.$char(";")&&!b&&(b=!0),(b?n:q).push({variadic:!0});break}h=k.variable()||k.property()||k.literal()||k.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var r=null;if(a?h.value&&1==h.value.length&&(r=h.value[0]):r=h,r&&(r instanceof e.Variable||r instanceof e.Property))if(p.$char(":")){if(m.length>0&&(b&&i("Cannot mix ; and , as delimiter types"),c=!0),g=o.detachedRuleset()||o.expression(),!g){if(!a)return p.restore(),l.args=[],l;i("could not understand value for named argument")}f=d=r.name}else if(p.$str("...")){if(!a){l.variadic=!0,p.$char(";")&&!b&&(b=!0),(b?n:q).push({name:h.name,variadic:!0});break}j=!0}else a||(d=f=r.name,g=null);g&&m.push(g),q.push({name:f,value:g,expand:j}),p.$char(",")||(p.$char(";")||b)&&(c&&i("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),n.push({name:d,value:g,expand:j}),d=null,m=[],c=!1)}return p.forget(),l.args=b?n:q,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==p.currentChar()&&"#"!==p.currentChar()||p.peek(/^[^{]*\}/)))if(p.save(),b=p.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!p.$char(")"))return void p.restore("Missing closing ')'");if(p.commentStore.length=0,p.$str("when")&&(d=k(o.conditions,"expected condition")),c=o.block())return p.forget(),new e.mixin.Definition(a,f,c,d,g);p.restore()}else p.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.property()||a.call()||a.keyword()||a.javascript()},end:function(){return p.$char(";")||p.peek("}")},alpha:function(){var a;if(p.$re(/^opacity=/i))return a=p.$re(/^\d+/),a||(a=k(this.entities.variable,"Could not parse alpha")),l(")"),new e.Alpha(a)},element:function(){var a,b,d,f=p.i;if(b=this.combinator(),a=p.$re(/^(?:\d+\.\d+|\d+)%/)||p.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||p.$char("*")||p.$char("&")||this.attribute()||p.$re(/^\([^&()@]+\)/)||p.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(p.save(),p.$char("(")?(d=this.selector(!1))&&p.$char(")")?(a=new e.Paren(d),p.forget()):p.restore("Missing closing ')'"):p.forget()),a)return new e.Element(b,a,f,c)},combinator:function(){var a=p.currentChar();if("/"===a){p.save();var b=p.$re(/^\/[a-z]+\//i);if(b)return p.forget(),new e.Combinator(b);p.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(p.i++,"^"===a&&"^"===p.currentChar()&&(a="^^",p.i++);p.isWhitespace();)p.i++;return new e.Combinator(a)}return new e.Combinator(p.isWhitespace(-1)?" ":null)},selector:function(a){var b,d,f,g,h,j,l,m=p.i;for(a=a!==!1;(a&&(d=this.extend())||a&&(j=p.$str("when"))||(g=this.element()))&&(j?l=k(this.conditions,"expected condition"):l?i("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&i("Extend can only be used at the end of selector"),f=p.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,l,m,c):void(h&&i("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(p.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=k(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=p.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||p.$re(/^[0-9]+%/)||p.$re(/^[\w-]+/)||d.variableCurly()),l("]"),new e.Attribute(a,c,b)}},block:function(){var a;if(p.$char("{")&&(a=this.primary())&&p.$char("}"))return a},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();if(a)return new e.DetachedRuleset(a)},ruleset:function(){var b,c,d,f;for(p.save(),a.dumpLineNumbers&&(f=m(p.i));;){if(c=this.selector(),!c)break;if(b?b.push(c):b=[c],p.commentStore.length=0,c.condition&&b.length>1&&i("Guards are only currently allowed on a single selector."),!p.$char(","))break;c.condition&&i("Guards are only currently allowed on a single selector."),p.commentStore.length=0}if(b&&(d=this.block())){p.forget();var g=new e.Ruleset(b,d,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}p.restore()},declaration:function(){var a,b,d,f,g,h=p.i,i=p.currentChar();if("."!==i&&"#"!==i&&"&"!==i&&":"!==i)if(p.save(),a=this.variable()||this.ruleProperty()){if(g="string"==typeof a,g&&(b=this.detachedRuleset()),p.commentStore.length=0,!b){if(f=!g&&a.length>1&&a.pop().value,b=this.anonymousValue())return p.forget(),new e.Declaration(a,b,(!1),f,h,c);b||(b=this.value()),d=this.important()}if(b&&this.end())return p.forget(),new e.Declaration(a,b,d,f,h,c);p.restore()}else p.restore()},anonymousValue:function(){var a=p.i,b=p.$re(/^([^@\$+\/'"*`(;{}-]*);/);if(b)return new e.Anonymous(b[1],a)},"import":function(){var a,b,d=p.i,f=p.$re(/^@import?\s+/);if(f){var g=(f?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),p.$char(";")||(p.i=d,i("missing semi-colon or unrecognised media features on import")),b=b&&new e.Value(b),new e.Import(a,b,g,d,c);p.i=d,i("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!p.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!p.$char(","))break}while(a);return l(")"),d},importOption:function(){var a=p.$re(/^(less|css|multiple|once|inline|reference|optional)/);if(a)return a[1]},mediaFeature:function(){var a,b,d=this.entities,f=[];p.save();do a=d.keyword()||d.variable(),a?f.push(a):p.$char("(")&&(b=this.property(),a=this.value(),p.$char(")")?b&&a?f.push(new e.Paren(new e.Declaration(b,a,null,null,p.i,c,(!0)))):a?f.push(new e.Paren(a)):i("badly formed media feature definition"):i("Missing closing ')'","Parse"));while(a);if(p.forget(),f.length>0)return new e.Expression(f)},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!p.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!p.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=p.i;return a.dumpLineNumbers&&(g=m(h)),p.save(),p.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||i("media definitions require block statements after any features"),p.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void p.restore()},plugin:function(){var a,b,d,f=p.i,g=p.$re(/^@plugin?\s+/);if(g){if(b=this.pluginArgs(),d=b?{pluginArgs:b,isPlugin:!0}:{isPlugin:!0},a=this.entities.quoted()||this.entities.url())return p.$char(";")||(p.i=f,i("missing semi-colon on @plugin")),new e.Import(a,null,d,f,c);p.i=f,i("malformed @plugin statement")}},pluginArgs:function(){if(p.save(),!p.$char("("))return p.restore(),null;var a=p.$re(/^\s*([^\);]+)\)\s*/);return a[1]?(p.forget(),a[1].trim()):(p.restore(),null)},atrule:function(){var b,d,f,g,h,j,k,l=p.i,n=!0,o=!0;if("@"===p.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(p.save(),b=p.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,n=!1;break;case"@namespace":j=!0,n=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,o=!1;break;default:k=!0}return p.commentStore.length=0,h?(d=this.entity(),d||i("expected "+b+" identifier")):j?(d=this.expression(),d||i("expected "+b+" expression")):k&&(d=(p.$re(/^[^{;]+/)||"").trim(),n="{"==p.currentChar(),d&&(d=new e.Anonymous(d))),n&&(f=this.blockRuleset()),f||!n&&d&&p.$char(";")?(p.forget(),new e.AtRule(b,d,f,l,c,a.dumpLineNumbers?m(l):null,o)):void p.restore("at-rule options not recognised")}}},value:function(){ -var a,b=[],c=p.i;do if(a=this.expression(),a&&(b.push(a),!p.$char(",")))break;while(a);if(b.length>0)return new e.Value(b,c)},important:function(){if("!"===p.currentChar())return p.$re(/^! *important/)},sub:function(){var a,b;return p.save(),p.$char("(")?(a=this.addition(),a&&p.$char(")")?(p.forget(),b=new e.Expression([a]),b.parens=!0,b):void p.restore("Expected ')'")):void p.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=p.isWhitespace(-1);;){if(p.peek(/^\/[*\/]/))break;if(p.save(),c=p.$char("/")||p.$char("*"),!c){p.forget();break}if(b=this.operand(),!b){p.restore();break}p.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=p.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=p.isWhitespace(-1);;){if(c=p.$re(/^[-+]\s+/)||!f&&(p.$char("+")||p.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=p.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=p.i;if(a=this.condition()){for(;;){if(!p.peek(/^,\s*(not\s*)?\(/)||!p.$char(","))break;if(b=this.condition(),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(){function a(){return p.$str("or")}var b,c,d;if(b=this.conditionAnd(this)){if(c=a()){if(d=this.condition(),!d)return;b=new e.Condition(c,b,d)}return b}},conditionAnd:function(){function a(a){return a.negatedCondition()||a.parenthesisCondition()}function b(){return p.$str("and")}var c,d,f;if(c=a(this)){if(d=b()){if(f=this.conditionAnd(),!f)return;c=new e.Condition(d,c,f)}return c}},negatedCondition:function(){if(p.$str("not")){var a=this.parenthesisCondition();return a&&(a.negate=!a.negate),a}},parenthesisCondition:function(){function a(a){var b;return p.save(),(b=a.condition())&&p.$char(")")?(p.forget(),b):void p.restore()}var b;return p.save(),p.$str("(")?(b=a(this))?(p.forget(),b):(b=this.atomicCondition())?p.$char(")")?(p.forget(),b):void p.restore("expected ')' got '"+p.currentChar()+"'"):void p.restore():void p.restore()},atomicCondition:function(){var a,b,c,d,f=this.entities,g=p.i;if(a=this.addition()||f.keyword()||f.quoted())return p.$char(">")?d=p.$char("=")?">=":">":p.$char("<")?d=p.$char("=")?"<=":"<":p.$char("=")&&(d=p.$char(">")?"=>":p.$char("<")?"=<":"="),d?(b=this.addition()||f.keyword()||f.quoted(),b?c=new e.Condition(d,a,b,g,(!1)):i("expected expression")):c=new e.Condition("=",a,new e.Keyword("true"),g,(!1)),c},operand:function(){var a,b=this.entities;p.peek(/^-[@\$\(]/)&&(a=p.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.property()||b.call()||b.colorKeyword();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[],d=p.i;do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),p.peek(/^\/[\/*]/)||(b=p.$char("/"),b&&c.push(new e.Anonymous(b,d)))));while(a);if(c.length>0)return new e.Expression(c)},property:function(){var a=p.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(a)return a[1]},ruleProperty:function(){function a(a){var b=p.i,c=p.$re(a);if(c)return g.push(b),f.push(c[1])}var b,d,f=[],g=[];p.save();var h=p.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],p.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(p.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;d=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},g.prototype.addPostProcessor=function(a,b){var c;for(c=0;c=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},g.prototype.addFileManager=function(a){this.fileManagers.push(a)},g.prototype.getPreProcessors=function(){for(var a=[],b=0;b0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],45:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Declaration("@"+a,b,(!1),null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j,k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor((!0)),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager)for(j=b.pluginManager.visitor(),j.first();i=j.get();)i.isPreEvalVisitor&&i.run(a);c=a.eval(h);for(var l=0;l.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(d="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":73}],56:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],57:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;c-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&c<1&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":15,"./color":52,"./node":73,"./unit":83}],60:[function(a,b,c){var d=a("./atrule"),e=function(){var a=Array.prototype.slice.call(arguments);d.apply(this,a)};e.prototype=Object.create(d.prototype),e.prototype.constructor=e,b.exports=e},{"./atrule":49}],61:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./combinator"),g=function(a,b,c,d,e){this.combinator=a instanceof f?a:new f(a),this.value="string"==typeof b?b.trim():b?b:"",this._index=c,this._fileInfo=d,this.copyVisibilityInfo(e),this.setParent(this.combinator,this)};g.prototype=new d,g.prototype.type="Element",g.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},g.prototype.eval=function(a){return new g(this.combinator,this.value.eval?this.value.eval(a):this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.fileInfo(),this.getIndex())},g.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof e&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=g},{"./combinator":53,"./node":73,"./paren":75}],62:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./comment"),g=function(a){if(this.value=a,!a)throw new Error("Expression requires an array parameter")};g.prototype=new d,g.prototype.type="Expression",g.prototype.accept=function(a){this.value=a.visitArray(this.value)},g.prototype.eval=function(a){var b,c=this.parens&&!this.parensInOp,d=!1;return c&&a.inParenthesis(),this.value.length>1?b=new g(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(d=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!d&&(b=new e(b)),b},g.prototype.genCSS=function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":73,"./selector":81}],64:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=a("../utils"),k=function(a,b,c,d,e,f){if(this.options=c,this._index=d,this._fileInfo=e,this.path=a,this.features=b,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f),this.setParent(this.features,this),this.setParent(this.path,this)};k.prototype=new d,k.prototype.type="Import",k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.isPlugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},k.prototype.genCSS=function(a,b){this.css&&void 0===this.path._fileInfo.reference&&(b.add("@import ",this._fileInfo,this._index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},k.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},k.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),!(a instanceof g)||a.containsVariables()},k.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new k(b.eval(a),this.features,this.options,this._index,this._fileInfo,this.visibilityInfo())},k.prototype.evalPath=function(a){var b=this.path.eval(a),c=this._fileInfo&&this._fileInfo.rootpath;if(!(b instanceof f)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d)}b.value=a.normalizePath(b.value)}return b},k.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){a.addVisibilityBlock()}):b.addVisibilityBlock()),b},k.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a);if(this.options.isPlugin)return this.root&&this.root.eval&&this.root.eval(a),c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[];if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var f=new i(this.root,0,{filename:this.importedFilename,reference:this.path._fileInfo&&this.path._fileInfo.reference},(!0),(!0));return this.features?new e([f],this.features.value):[f]}if(this.css){var g=new k(this.evalPath(a),d,this.options,this._index); -if(!g.css&&this.error)throw this.error;return g}return b=new h(null,j.copyArray(this.root.rules)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=k},{"../utils":87,"./anonymous":47,"./media":69,"./node":73,"./quoted":77,"./ruleset":80,"./url":84}],65:[function(a,b,c){var d=Object.create(null);d.Node=a("./node"),d.Alpha=a("./alpha"),d.Color=a("./color"),d.AtRule=a("./atrule"),d.Directive=a("./directive"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Property=a("./property"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Declaration=a("./declaration"),d.Rule=a("./rule"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.RulesetCall=a("./ruleset-call"),b.exports=d},{"./alpha":46,"./anonymous":47,"./assignment":48,"./atrule":49,"./attribute":50,"./call":51,"./color":52,"./combinator":53,"./comment":54,"./condition":55,"./declaration":57,"./detached-ruleset":58,"./dimension":59,"./directive":60,"./element":61,"./expression":62,"./extend":63,"./import":64,"./javascript":66,"./keyword":68,"./media":69,"./mixin-call":70,"./mixin-definition":71,"./negative":72,"./node":73,"./operation":74,"./paren":75,"./property":76,"./quoted":77,"./rule":78,"./ruleset":80,"./ruleset-call":79,"./selector":81,"./unicode-descriptor":82,"./unit":83,"./url":84,"./value":85,"./variable":86}],66:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this._index=c,this._fileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new e(b):"string"==typeof b?new f('"'+b+'"',b,this.escaped,this._index):new g(Array.isArray(b)?b.join(", "):b)},b.exports=h},{"./anonymous":47,"./dimension":59,"./js-eval-node":67,"./quoted":77}],67:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(!b.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.fileInfo().filename,index:this.getIndex()};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.getIndex(),d.fileInfo()).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.fileInfo().filename,index:this.getIndex()}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.fileInfo().filename,index:this.getIndex()}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":73,"./variable":86}],68:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":73}],69:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./atrule"),j=a("../utils"),k=function(a,b,c,g,h){this._index=c,this._fileInfo=g;var i=new f([],null,null,this._index,this._fileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0,this.setParent(i,this),this.setParent(this.features,this),this.setParent(this.rules,this)};k.prototype=new i,k.prototype.type="Media",k.prototype.isRulesetLike=function(){return!0},k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},k.prototype.genCSS=function(a,b){b.add("@media ",this._fileInfo,this._index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},k.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new k(null,[],this._index,this._fileInfo,this.visibilityInfo());this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo);var c=!1;a.strictMath||(c=!0,a.strictMath=!0);try{b.features=this.features.eval(a)}finally{c&&(a.strictMath=!1)}return a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},k.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo()),this.setParent(b,this)}return delete a.mediaBlocks,delete a.mediaPath,b},k.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;b0;b--)a.splice(b,0,new g("and"));return new h(a)})),this.setParent(this.features,this),new d([],[])},k.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(n=!0,k=0;k0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.getIndex(),filename:this.fileInfo().filename};for(k=0;kthis.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;gb?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],74:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};g.prototype=new d,g.prototype.type="Operation",g.prototype.accept=function(a){this.operands=a.visit(this.operands)},g.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof f&&c instanceof e&&(b=b.toColor()),c instanceof f&&b instanceof e&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new g(this.op,[b,c],this.isSpaced)},g.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=g},{"./color":52,"./dimension":59,"./node":73}],75:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":73}],76:[function(a,b,c){var d=a("./node"),e=a("./declaration"),f=function(a,b,c){this.name=a,this._index=b,this._fileInfo=c};f.prototype=new d,f.prototype.type="Property",f.prototype.eval=function(a){var b,c=this.name,d=a.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;if(this.evaluating)throw{type:"Name",message:"Recursive property reference for "+c,filename:this.fileInfo().filename,index:this.getIndex()};if(this.evaluating=!0,b=this.find(a.frames,function(b){var f,g=b.property(c);if(g){for(var h=0;hd){if(!c||c(g)){e=g.find(new i(a.elements.slice(d)),b,c);for(var j=0;j0&&b.add(k),a.firstSelector=!0,h[0].genCSS(a,b),a.firstSelector=!1,d=1;d0?(e=p.copyArray(a),f=e.pop(),g=d.createDerived(p.copyArray(f.elements))):g=d.createDerived([]),b.length>0){var h=c.combinator,i=b[0].elements[0];h.emptyOrWhitespace&&!i.combinator.emptyOrWhitespace&&(h=i.combinator),g.elements.push(new j(h,i.value,c._index,c._fileInfo)),g.elements=g.elements.concat(b[0].elements.slice(1))}if(0!==g.elements.length&&e.push(g),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function g(a,b,c,d,e){var g;for(g=0;g0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new i(a))}}function l(a,b,c){function m(a){var b;return a.value instanceof h?(b=a.value.value,b instanceof i?b:null):null}var n,o,p,q,r,s,t,u,v,w,x=!1;for(q=[],r=[[]],n=0;u=c.elements[n];n++)if("&"!==u.value){var y=m(u);if(null!=y){k(q,r);var z,A=[],B=[];for(z=l(A,b,y),x=x||z,p=0;p0&&t[0].elements.push(new j(u.combinator,"",u._index,u._fileInfo)),s.push(t);else for(p=0;p0&&(a.push(r[n]),w=r[n][v-1],r[n][v-1]=w.createDerived(w.elements,c.extendList));return x}function m(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var n,o,q;if(o=[],q=l(o,b,c),!q)if(b.length>0)for(o=[],n=0;n0)for(b=0;b=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}},copyArray:function(a){var b,c=a.length,d=new Array(c);for(b=0;b=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.fileInfo(),b),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitDeclaration:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;e0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return k0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitAtRule:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitAtRuleOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=i},{"../logger":35,"../tree":65,"../utils":87,"./visitor":95}],89:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],90:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=a("../utils"),h=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};h.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,g.copyArray(this.context.frames)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.getIndex(),f.filename=a.fileInfo().filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;h0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];if(this.keepOnlyVisibleChilds(c),!this.isEmpty(c))return a.ensureVisibility(),a.removeVisibilityBlock(),a},isVisibleRuleset:function(a){return!!a.firstRoot||!this.isEmpty(a)&&!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitDeclaration:function(a,b){if(!a.blocksVisibility()&&!a.variable)return a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){if(!a.blocksVisibility()&&!a.isSilent(this._context))return a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){if(!a.blocksVisibility())return a},visitAtRule:function(a,b){return a.rules&&a.rules.length?this.visitAtRuleWithBody(a,b):this.visitAtRuleWithoutBody(a,b)},visitAtRuleWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitAtRuleWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;c0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;b=0;e--)if(c=a[e],c instanceof d.Declaration)if(f[c.name]){b=f[c.name],b instanceof d.Declaration&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);b.indexOf(g)!==-1?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b,c,e,f={},g=0;g1){c=b[0];var h=[],i=[];b.map(function(a){"+"===a.merge&&(i.length>0&&h.push(e(i)),i=[]),i.push(a)}),h.push(e(i)),c.value=g(h)}})}},visitAnonymous:function(a,b){if(!a.blocksVisibility())return a.accept(this._visitor),a}},b.exports=g},{"../tree":65,"./visitor":95}],95:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitFnCache=[],h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var c,e=this._visitFnCache,f=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=g;if(l.visitDeeper=!0,j||(c="visit"+a.type,j=f[c]||d,k=f[c+"Out"]||d,e[h]=j,e[i]=k),j!==d){var m=j.call(f,a,l);f.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=d&&k.call(f,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;ck){for(var b=0,c=h.length-j;b0||b.isFileProtocol?"development":"production");var c=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(a.location.hash);c&&(b.dumpLineNumbers=c[1]),void 0===b.useFileCache&&(b.useFileCache=!0),void 0===b.onReady&&(b.onReady=!0),b.javascriptEnabled=!(!b.javascriptEnabled&&!b.inlineJavaScript)}},{"./browser":3,"./utils":11}],2:[function(a,b,c){function d(a){a.filename&&console.warn(a),e.async||h.removeChild(i)}a("promise/polyfill");var e=window.less||{};a("./add-default-options")(window,e);var f=b.exports=a("./index")(window,e);window.less=f;var g,h,i;e.onReady&&(/!watch/.test(window.location.hash)&&f.watch(),e.async||(g="body { display: none !important }",h=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),i.type="text/css",i.styleSheet?i.styleSheet.cssText=g:i.appendChild(document.createTextNode(g)),h.appendChild(i)),f.registerStylesheetsImmediately(),f.pageLoadFinished=f.refresh("development"===f.env).then(d,d))},{"./add-default-options":1,"./index":8,"promise/polyfill":101}],3:[function(a,b,c){var d=a("./utils");b.exports={createCSS:function(a,b,c){var e=c.href||"",f="less:"+(c.title||d.extractId(e)),g=a.getElementById(f),h=!1,i=a.createElement("style");i.setAttribute("type","text/css"),c.media&&i.setAttribute("media",c.media),i.id=f,i.styleSheet||(i.appendChild(a.createTextNode(b)),h=null!==g&&g.childNodes.length>0&&i.childNodes.length>0&&g.firstChild.nodeValue===i.firstChild.nodeValue);var j=a.getElementsByTagName("head")[0];if(null===g||h===!1){var k=c&&c.nextSibling||null;k?k.parentNode.insertBefore(i,k):j.appendChild(i)}if(g&&h===!1&&g.parentNode.removeChild(g),i.styleSheet)try{i.styleSheet.cssText=b}catch(l){throw new Error("Couldn't reassign styleSheet.cssText.")}},currentScript:function(a){var b=a.document;return b.currentScript||function(){var a=b.getElementsByTagName("script");return a[a.length-1]}()}}},{"./utils":11}],4:[function(a,b,c){b.exports=function(a,b,c){var d=null;if("development"!==b.env)try{d="undefined"==typeof a.localStorage?null:a.localStorage}catch(e){}return{setCSS:function(a,b,e,f){if(d){c.info("saving "+a+" to cache.");try{d.setItem(a,f),d.setItem(a+":timestamp",b),e&&d.setItem(a+":vars",JSON.stringify(e))}catch(g){c.error('failed to save "'+a+'" to local storage for caching.')}}},getCSS:function(a,b,c){var e=d&&d.getItem(a),f=d&&d.getItem(a+":timestamp"),g=d&&d.getItem(a+":vars");if(c=c||{},f&&b.lastModified&&new Date(b.lastModified).valueOf()===new Date(f).valueOf()&&(!c&&!g||JSON.stringify(c)===g))return e}}}},{}],5:[function(a,b,c){var d=a("./utils"),e=a("./browser");b.exports=function(a,b,c){function f(b,f){var g,h,i="less-error-message:"+d.extractId(f||""),j='
    • {content}
    • ',k=a.document.createElement("div"),l=[],m=b.filename||f,n=m.match(/([^\/]+(\?.*)?)$/)[1];k.id=i,k.className="less-error-message",h="

      "+(b.type||"Syntax")+"Error: "+(b.message||"There is an error in your .less file")+'

      in '+n+" ";var o=function(a,b,c){void 0!==a.extract[b]&&l.push(j.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};b.line&&(o(b,0,""),o(b,1,"line"),o(b,2,""),h+="on line "+b.line+", column "+(b.column+1)+":

        "+l.join("")+"
      "),b.stack&&(b.extract||c.logLevel>=4)&&(h+="
      Stack Trace
      "+b.stack.split("\n").slice(1).join("
      ")),k.innerHTML=h,e.createCSS(a.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),k.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===c.env&&(g=setInterval(function(){var b=a.document,c=b.body;c&&(b.getElementById(i)?c.replaceChild(k,b.getElementById(i)):c.insertBefore(k,c.firstChild),clearInterval(g))},10))}function g(b){var c=a.document.getElementById("less-error-message:"+d.extractId(b));c&&c.parentNode.removeChild(c)}function h(a){}function i(a){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?h(a):"function"==typeof c.errorReporting&&c.errorReporting("remove",a):g(a)}function j(a,d){var e="{line} {content}",f=a.filename||d,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f,i=function(a,b,c){void 0!==a.extract[b]&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.line&&(i(a,0,""),i(a,1,"line"),i(a,2,""),h+=" on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")),a.stack&&(a.extract||c.logLevel>=4)&&(h+="\nStack Trace\n"+a.stack),b.logger.error(h)}function k(a,b){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?j(a,b):"function"==typeof c.errorReporting&&c.errorReporting("add",a,b):f(a,b)}return{add:k,remove:i}}},{"./browser":3,"./utils":11}],6:[function(a,b,c){b.exports=function(b,c){var d=a("../less/environment/abstract-file-manager.js"),e={},f=function(){};return f.prototype=new d,f.prototype.alwaysMakePathsAbsolute=function(){return!0},f.prototype.join=function(a,b){return a?this.extractUrlParts(b,a).path:b},f.prototype.doXHR=function(a,d,e,f){function g(b,c,d){b.status>=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var h=new XMLHttpRequest,i=!b.isFileProtocol||b.fileAsync;"function"==typeof h.overrideMimeType&&h.overrideMimeType("text/css"),c.debug("XHR: Getting '"+a+"'"),h.open("GET",a,i),h.setRequestHeader("Accept",d||"text/x-less, text/css; q=0.9, */*; q=0.5"),h.send(null),b.isFileProtocol&&!b.fileAsync?0===h.status||h.status>=200&&h.status<300?e(h.responseText):f(h.status,a):i?h.onreadystatechange=function(){4==h.readyState&&g(h,e,f)}:g(h,e,f)},f.prototype.supports=function(a,b,c,d){return!0},f.prototype.clearFileCache=function(){e={}},f.prototype.loadFile=function(a,b,c,d,f){b&&!this.isPathAbsolute(a)&&(a=b+a),c=c||{};var g=this.extractUrlParts(a,window.location.href),h=g.url;if(c.useFileCache&&e[h])try{var i=e[h];f(null,{contents:i,filename:h,webInfo:{lastModified:new Date}})}catch(j){f({filename:h,message:"Error loading file "+h+" error was "+j.message})}else this.doXHR(h,c.mime,function(a,b){e[h]=a,f(null,{contents:a,filename:h,webInfo:{lastModified:b}})},function(a,b){f({type:"File",message:"'"+b+"' wasn't found ("+a+")",href:h})})},f}},{"../less/environment/abstract-file-manager.js":16}],7:[function(a,b,c){b.exports=function(){function b(){throw{type:"Runtime",message:"Image size functions are not supported in browser version of less"}}var c=a("./../less/functions/function-registry"),d={"image-size":function(a){return b(this,a),-1},"image-width":function(a){return b(this,a),-1},"image-height":function(a){return b(this,a),-1}};c.addMultiple(d)}},{"./../less/functions/function-registry":24}],8:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(b,c){function f(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function g(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}}function h(a){for(var b,d=l.getElementsByTagName("style"),e=0;e=c&&console.log(a)},info:function(a){b.logLevel>=d&&console.log(a)},warn:function(a){b.logLevel>=e&&console.warn(a)},error:function(a){b.logLevel>=f&&console.error(a)}}]);for(var g=0;g0&&(a=a.slice(0,b)),b=a.lastIndexOf("/"),b<0&&(b=a.lastIndexOf("\\")),b<0?"":a.slice(0,b+1)},d.prototype.tryAppendExtension=function(a,b){return/(\.[a-z]*$)|([\?;].*)$/.test(a)?a:a+b},d.prototype.tryAppendLessExtension=function(a){return this.tryAppendExtension(a,".less")},d.prototype.supportsSync=function(){return!1},d.prototype.alwaysMakePathsAbsolute=function(){return!1},d.prototype.isPathAbsolute=function(a){return/^(?:[a-z-]+:|\/|\\|#)/i.test(a)},d.prototype.join=function(a,b){return a?a+b:b},d.prototype.pathDiff=function(a,b){var c,d,e,f,g=this.extractUrlParts(a),h=this.extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;c0&&(h.splice(c-1,2),c-=2)}return g.hostPart=f[1],g.directories=h,g.path=(f[1]||"")+h.join("/"),g.filename=f[4],g.fileUrl=g.path+(f[4]||""),g.url=g.fileUrl+(f[5]||""),g},b.exports=d},{}],17:[function(a,b,c){function d(a,b){throw new f({type:b||"Syntax",message:a})}var e=a("../functions/function-registry"),f=a("../less-error"),g=function(){};g.prototype.evalPlugin=function(a,b,c,d,f){var g,h,i,j,k,l,m;l=b.pluginManager,f&&(m="string"==typeof f?f:f.filename);var n=(new this.less.FileManager).extractUrlParts(m).filename;if(m&&(i=l.get(m))){this.trySetOptions(i,m,n,d);try{i.use&&i.use.call(this.context,i)}catch(o){return o.message="Error during @plugin call",new this.less.LessError(o,c,m)}return i}j={exports:{},pluginManager:l,fileInfo:f},k=j.exports,h=e.create();var p=function(a){i=a};try{g=new Function("module","require","registerPlugin","functions","tree","less","fileInfo",a),g(j,this.require,p,h,this.less.tree,this.less,f)}catch(o){return new this.less.LessError({message:"Parse error"},c,m)}if(i||(i=j.exports),i=this.validatePlugin(i,m,n),!i)return new this.less.LessError({message:"Not a valid plugin"});l.addPlugin(i,f.filename,h),i.functions=h.getLocalFunctions(),i.imports=c,i.filename=m,this.trySetOptions(i,m,n,d);try{i.use&&i.use.call(this.context,i)}catch(o){return o.message="Error during @plugin call",new this.less.LessError(o,c,m)}return i},g.prototype.trySetOptions=function(a,b,c,e){if(e){if(!a.setOptions)return d("Options have been provided but the plugin "+c+" does not support any options."),null;try{a.setOptions(e)}catch(f){return d("Error setting options on plugin "+c+"\n"+f.message),null}}},g.prototype.validatePlugin=function(a,b,c){return a?("function"==typeof a&&(a=new a),a.minVersion&&this.compareVersion(a.minVersion,this.less.version)<0?(d("Plugin "+c+" requires version "+this.versionToString(a.minVersion)),null):a):null},g.prototype.compareVersion=function(a,b){"string"==typeof a&&(a=a.match(/^(\d+)\.?(\d+)?\.?(\d+)?/),a.shift());for(var c=0;cparseInt(b[c])?-1:1;return 0},g.prototype.versionToString=function(a){for(var b="",c=0;c=0;h--){var i=g[h];if(i[f?"supportsSync":"supports"](a,b,c,e))return i}return null},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},b.exports=e},{"../logger":35}],19:[function(a,b,c){function d(a,b,c){var d,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;l<3;l++)d=b.rgb[l]/255,f=c.rgb[l]/255,h=a(d,f),g&&(h=(j*f+i*(d-j*(d+f-h)))/g),k[l]=255*h;return new e(k,g)}var e=a("../tree/color"),f=a("./function-registry"),g={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,a<=1?g.multiply(a,b):g.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return g.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};for(var h in g)g.hasOwnProperty(h)&&(d[h]=d.bind(null,g[h]));f.addMultiple(d)},{"../tree/color":52,"./function-registry":24}],20:[function(a,b,c){function d(a){return Math.min(1,Math.max(0,a))}function e(a){return h.hsla(a.h,a.s,a.l,a.a)}function f(a){if(a instanceof i)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{type:"Argument",message:"color functions take numbers as parameters"}}function g(a,b){return a instanceof i&&a.unit.is("%")?parseFloat(a.value*b/100):f(a)}var h,i=a("../tree/dimension"),j=a("../tree/color"),k=a("../tree/quoted"),l=a("../tree/anonymous"),m=a("./function-registry");h={rgb:function(a,b,c){return h.rgba(a,b,c,1)},rgba:function(a,b,c,d){var e=[a,b,c].map(function(a){return g(a,255)});return d=f(d),new j(e,d)},hsl:function(a,b,c){return h.hsla(a,b,c,1)},hsla:function(a,b,c,e){function g(a){return a=a<0?a+1:a>1?a-1:a,6*a<1?i+(j-i)*a*6:2*a<1?j:3*a<2?i+(j-i)*(2/3-a)*6:i}var i,j;return a=f(a)%360/360,b=d(f(b)),c=d(f(c)),e=d(f(e)),j=c<=.5?c*(b+1):c+b-c*b,i=2*c-j,h.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),e)},hsv:function(a,b,c){return h.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=f(a)%360/360*360,b=f(b),c=f(c),d=f(d);var e,g;e=Math.floor(a/60%6),g=a/60-e;var i=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],j=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return h.rgba(255*i[j[e][0]],255*i[j[e][1]],255*i[j[e][2]],d)},hue:function(a){return new i(a.toHSL().h)},saturation:function(a){return new i(100*a.toHSL().s,"%")},lightness:function(a){return new i(100*a.toHSL().l,"%")},hsvhue:function(a){return new i(a.toHSV().h)},hsvsaturation:function(a){return new i(100*a.toHSV().s,"%")},hsvvalue:function(a){return new i(100*a.toHSV().v,"%")},red:function(a){return new i(a.rgb[0])},green:function(a){return new i(a.rgb[1])},blue:function(a){return new i(a.rgb[2])},alpha:function(a){return new i(a.toHSL().a)},luma:function(a){return new i(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new i(b*a.alpha*100,"%")},saturate:function(a,b,c){if(!a.rgb)return null;var f=a.toHSL();return f.s+="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},desaturate:function(a,b,c){var f=a.toHSL();return f.s-="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},lighten:function(a,b,c){var f=a.toHSL();return f.l+="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},darken:function(a,b,c){var f=a.toHSL();return f.l-="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},fadein:function(a,b,c){var f=a.toHSL();return f.a+="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fadeout:function(a,b,c){var f=a.toHSL();return f.a-="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=d(c.a),e(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=d<0?360+d:d,e(c)},mix:function(a,b,c){a.toHSL&&b.toHSL||(console.log(b.type),console.dir(b)),c||(c=new i(50));var d=c.value/100,e=2*d-1,f=a.toHSL().a-b.toHSL().a,g=((e*f==-1?e:(e+f)/(1+e*f))+1)/2,h=1-g,k=[a.rgb[0]*g+b.rgb[0]*h,a.rgb[1]*g+b.rgb[1]*h,a.rgb[2]*g+b.rgb[2]*h],l=a.alpha*d+b.alpha*(1-d);return new j(k,l)},greyscale:function(a){return h.desaturate(a,new i(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;"undefined"==typeof b&&(b=h.rgba(0,0,0,1)),"undefined"==typeof c&&(c=h.rgba(255,255,255,1));var e,f,g=a.luma(),i=b.luma(),j=c.luma();return e=g>i?(g+.05)/(i+.05):(i+.05)/(g+.05),f=g>j?(g+.05)/(j+.05):(j+.05)/(g+.05),e>f?b:c},argb:function(a){return new l(a.toARGB())},color:function(a){if(a instanceof k&&/^#([a-f0-9]{6}|[a-f0-9]{3})$/i.test(a.value))return new j(a.value.slice(1));if(a instanceof j||(a=j.fromKeyword(a.value)))return a.value=void 0,a;throw{type:"Argument",message:"argument must be a color keyword or 3/6 digit hex e.g. #FFF"}},tint:function(a,b){return h.mix(h.rgb(255,255,255),a,b)},shade:function(a,b){return h.mix(h.rgb(0,0,0),a,b)}},m.addMultiple(h)},{"../tree/anonymous":47,"../tree/color":52,"../tree/dimension":59,"../tree/quoted":77,"./function-registry":24}],21:[function(a,b,c){b.exports=function(b){var c=a("../tree/quoted"),d=a("../tree/url"),e=a("./function-registry"),f=function(a,b){return new d(b,a.index,a.currentFileInfo).eval(a.context)},g=a("../logger");e.add("data-uri",function(a,e){e||(e=a,a=null);var h=a&&a.value,i=e.value,j=this.currentFileInfo,k=j.relativeUrls?j.currentDirectory:j.entryPath,l=i.indexOf("#"),m="";l!==-1&&(m=i.slice(l),i=i.slice(0,l));var n=b.getFileManager(i,k,this.context,b,!0);if(!n)return f(this,e);var o=!1;if(a)o=/;base64$/.test(h);else{if(h=b.mimeLookup(i),"image/svg+xml"===h)o=!1;else{var p=b.charsetLookup(h);o=["US-ASCII","UTF-8"].indexOf(p)<0}o&&(h+=";base64")}var q=n.loadFileSync(i,k,this.context,b);if(!q.contents)return g.warn("Skipped data-uri embedding of "+i+" because file not found"),f(this,e||a);var r=q.contents;if(o&&!b.encodeBase64)return f(this,e);r=o?b.encodeBase64(r):encodeURIComponent(r);var s="data:"+h+","+r+m,t=32768;return s.length>=t&&this.context.ieCompat!==!1?(g.warn("Skipped data-uri embedding of "+i+" because its size ("+s.length+" characters) exceeds IE8-safe "+t+" characters!"),f(this,e||a)):new d(new c('"'+s+'"',s,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../logger":35,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],22:[function(a,b,c){var d=a("../tree/keyword"),e=a("./function-registry"),f={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;if(null!=a)return a?d.True:d.False},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}};e.add("default",f.eval.bind(f)),b.exports=f},{"../tree/keyword":68,"./function-registry":24}],23:[function(a,b,c){var d=a("../tree/expression"),e=function(a,b,c,d){this.name=a.toLowerCase(),this.index=c,this.context=b,this.currentFileInfo=d,this.func=b.frames[0].functionRegistry.get(this.name)};e.prototype.isValid=function(){return Boolean(this.func)},e.prototype.call=function(a){return Array.isArray(a)&&(a=a.filter(function(a){return"Comment"!==a.type}).map(function(a){if("Expression"===a.type){var b=a.value.filter(function(a){return"Comment"!==a.type});return 1===b.length?b[0]:new d(b)}return a})),this.func.apply(this,a)},b.exports=e},{"../tree/expression":62}],24:[function(a,b,c){function d(a){return{_data:{},add:function(a,b){a=a.toLowerCase(),this._data.hasOwnProperty(a),this._data[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){this.add(b,a[b])}.bind(this))},get:function(b){return this._data[b]||a&&a.get(b)},getLocalFunctions:function(){return this._data},inherit:function(){return d(this)},create:function(a){return d(a)}}}b.exports=d(null)},{}],25:[function(a,b,c){b.exports=function(b){var c={functionRegistry:a("./function-registry"),functionCaller:a("./function-caller")};return a("./default"),a("./color"),a("./color-blending"),a("./data-uri")(b),a("./math"),a("./number"),a("./string"),a("./svg")(b),a("./types"),c}},{"./color":20,"./color-blending":19,"./data-uri":21,"./default":22,"./function-caller":23,"./function-registry":24,"./math":27,"./number":28,"./string":29,"./svg":30,"./types":31}],26:[function(a,b,c){var d=a("../tree/dimension"),e=function(){};e._math=function(a,b,c){if(!(c instanceof d))throw{type:"Argument",message:"argument must be a number"};return null==b?b=c.unit:c=c.unify(),new d(a(parseFloat(c.value)),b)},b.exports=e},{"../tree/dimension":59}],27:[function(a,b,c){var d=a("./function-registry"),e=a("./math-helper.js"),f={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad" +};for(var g in f)f.hasOwnProperty(g)&&(f[g]=e._math.bind(null,Math[g],f[g]));f.round=function(a,b){var c="undefined"==typeof b?0:b.value;return e._math(function(a){return a.toFixed(c)},null,a)},d.addMultiple(f)},{"./function-registry":24,"./math-helper.js":26}],28:[function(a,b,c){var d=a("../tree/dimension"),e=a("../tree/anonymous"),f=a("./function-registry"),g=a("./math-helper.js"),h=function(a,b){switch(b=Array.prototype.slice.call(b),b.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var c,f,g,h,i,j,k,l,m=[],n={};for(c=0;ci.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(b[c].value)&&Array.prototype.push.apply(b,Array.prototype.slice.call(b[c].value));return 1==m.length?m[0]:(b=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new e((a?"min":"max")+"("+b+")"))};f.addMultiple({min:function(){return h(!0,arguments)},max:function(){return h(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new d(Math.PI)},mod:function(a,b){return new d(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d(a),b=new d(b);else if(!(a instanceof d&&b instanceof d))throw{type:"Argument",message:"arguments must be numbers"};return new d(Math.pow(a.value,b.value),a.unit)},percentage:function(a){var b=g._math(function(a){return 100*a},"%",a);return b}})},{"../tree/anonymous":47,"../tree/dimension":59,"./function-registry":24,"./math-helper.js":26}],29:[function(a,b,c){var d=a("../tree/quoted"),e=a("../tree/anonymous"),f=a("../tree/javascript"),g=a("./function-registry");g.addMultiple({e:function(a){return new e(a instanceof f?a.evaluated:a.value)},escape:function(a){return new e(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,b,c,e){var f=a.value;return c="Quoted"===c.type?c.value:c.toCSS(),f=f.replace(new RegExp(b.value,e?e.value:""),c),new d(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;e",k=0;k";return j+="',j=encodeURIComponent(j),j="data:image/svg+xml,"+j,new g(new f("'"+j+"'",j,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":52,"../tree/dimension":59,"../tree/expression":62,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],31:[function(a,b,c){var d=a("../tree/keyword"),e=a("../tree/detached-ruleset"),f=a("../tree/dimension"),g=a("../tree/color"),h=a("../tree/quoted"),i=a("../tree/anonymous"),j=a("../tree/url"),k=a("../tree/operation"),l=a("./function-registry"),m=function(a,b){return a instanceof b?d.True:d.False},n=function(a,b){if(void 0===b)throw{type:"Argument",message:"missing the required second argument to isunit."};if(b="string"==typeof b.value?b.value:b,"string"!=typeof b)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof f&&a.unit.is(b)?d.True:d.False},o=function(a){var b=Array.isArray(a.value)?a.value:Array(a);return b};l.addMultiple({isruleset:function(a){return m(a,e)},iscolor:function(a){return m(a,g)},isnumber:function(a){return m(a,f)},isstring:function(a){return m(a,h)},iskeyword:function(a){return m(a,d)},isurl:function(a){return m(a,j)},ispixel:function(a){return n(a,"px")},ispercentage:function(a){return n(a,"%")},isem:function(a){return n(a,"em")},isunit:n,unit:function(a,b){if(!(a instanceof f))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof k?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d?b.value:b.toCSS():"",new f(a.value,b)},"get-unit":function(a){return new i(a.unit)},extract:function(a,b){return b=b.value-1,o(a)[b]},length:function(a){return new f(o(a).length)}})},{"../tree/anonymous":47,"../tree/color":52,"../tree/detached-ruleset":58,"../tree/dimension":59,"../tree/keyword":68,"../tree/operation":74,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],32:[function(a,b,c){var d=a("./contexts"),e=a("./parser/parser"),f=a("./less-error");b.exports=function(a){var b=function(a,b,c){this.less=a,this.rootFilename=c.filename,this.paths=b.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=b.mime,this.error=null,this.context=b,this.queue=[],this.files={}};return b.prototype.push=function(b,c,g,h,i){var j=this,k=this.context.pluginManager.Loader;this.queue.push(b);var l=function(a,c,d){j.queue.splice(j.queue.indexOf(b),1);var e=d===j.rootFilename;h.optional&&a?i(null,{rules:[]},!1,null):(j.files[d]=c,a&&!j.error&&(j.error=a),i(a,c,e,d))},m={relativeUrls:this.context.relativeUrls,entryPath:g.entryPath,rootpath:g.rootpath,rootFilename:g.rootFilename},n=a.getFileManager(b,g.currentDirectory,this.context,a);if(!n)return void l({message:"Could not find a file-manager for "+b});c&&(b=h.isPlugin?b:n.tryAppendExtension(b,".less"));var o,p=function(a){var b,c=a.filename,i=a.contents.replace(/^\uFEFF/,"");m.currentDirectory=n.getPath(c),m.relativeUrls&&(m.rootpath=n.join(j.context.rootpath||"",n.pathDiff(m.currentDirectory,m.entryPath)),!n.isPathAbsolute(m.rootpath)&&n.alwaysMakePathsAbsolute()&&(m.rootpath=n.join(m.entryPath,m.rootpath))),m.filename=c;var o=new d.Parse(j.context);o.processImports=!1,j.contents[c]=i,(g.reference||h.reference)&&(m.reference=!0),h.isPlugin?(b=k.evalPlugin(i,o,j,h.pluginArgs,m),b instanceof f?l(b,null,c):l(null,b,c)):h.inline?l(null,i,c):new e(o,j,m).parse(i,function(a,b){l(a,b,c)})},q=function(a,b){a?l(a):p(b)};if(h.isPlugin)try{k.tryLoadPlugin(b,g.currentDirectory,q)}catch(r){i(r)}else o=n.loadFile(b,g.currentDirectory,this.context,a,q),o&&o.then(p,l)},b}},{"./contexts":12,"./less-error":34,"./parser/parser":40}],33:[function(a,b,c){b.exports=function(b,c){var d,e,f,g,h,i,j={version:[3,0,0],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),AbstractPluginLoader:a("./environment/abstract-plugin-loader"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")},k=function(a){return function(){var b=Object.create(a.prototype);return a.apply(b,Array.prototype.slice.call(arguments,0)),b}},l=Object.create(j);for(var m in j.tree)if(i=j.tree[m],"function"==typeof i)l[m]=k(i);else{l[m]=Object.create(null);for(var n in i)l[m][n]=k(i[n])}return l}},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":16,"./environment/abstract-plugin-loader":17,"./environment/environment":18,"./functions":25,"./import-manager":32,"./less-error":34,"./logger":35,"./parse":37,"./parse-tree":36,"./parser/parser":40,"./plugin-manager":41,"./render":42,"./source-map-builder":43,"./source-map-output":44,"./transform-tree":45,"./tree":65,"./utils":87,"./visitors":91}],34:[function(a,b,c){var d=a("./utils"),e=b.exports=function(a,b,c){Error.call(this);var e=a.filename||c;if(this.message=a.message,this.stack=a.stack,b&&e){var f=b.contents[e],g=d.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&d.getLocation(a.call,f).line,k=f.split("\n");if(this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.column=i,!this.line&&this.stack){var l=this.stack.match(/(|Function):(\d+):(\d+)/);l&&(l[2]&&(this.line=parseInt(l[2])-2),l[3]&&(this.column=parseInt(l[3])))}this.callLine=j+1,this.callExtract=k[j],this.extract=[k[this.line-2],k[this.line-1],k[this.line]]}};if("undefined"==typeof Object.create){var f=function(){};f.prototype=Error.prototype,e.prototype=new f}else e.prototype=Object.create(Error.prototype);e.prototype.constructor=e,e.prototype.toString=function(a){a=a||{};var b="",c=this.extract||[],d=[],e=function(a){return a};if(a.stylize){var f=typeof a.stylize;if("function"!==f)throw Error("options.stylize should be a function, got a "+f+"!");e=a.stylize}if(null!==this.line){if("string"==typeof c[0]&&d.push(e(this.line-1+" "+c[0],"grey")),"string"==typeof c[1]){var g=this.line+" ";c[1]&&(g+=c[1].slice(0,this.column)+e(e(e(c[1].substr(this.column,1),"bold")+c[1].slice(this.column+1),"red"),"inverse")),d.push(g)}"string"==typeof c[2]&&d.push(e(this.line+1+" "+c[2],"grey")),d=d.join("\n")+e("","reset")+"\n"}return b+=e(this.type+"Error: "+this.message,"red"),this.filename&&(b+=e(" in ","red")+this.filename),this.line&&(b+=e(" on line "+this.line+", column "+(this.column+1)+":","grey")),b+="\n"+d,this.callLine&&(b+=e("from ","red")+(this.filename||"")+"/n",b+=e(this.callLine,"grey")+" "+this.callExtract+"/n"),b}},{"./utils":87}],35:[function(a,b,c){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;b=97&&j<=122||j<34))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(h96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;hd&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],39:[function(a,b,c){var d=a("./chunker");b.exports=function(){function a(d){for(var e,f,j,p=k.i,q=c,s=k.i-i,t=k.i+h.length-s,u=k.i+=d,v=b;k.i=0){j={index:k.i,text:v.substr(k.i,x+2-k.i),isLineComment:!1},k.i+=j.text.length-1,k.commentStore.push(j);continue}}break}if(e!==l&&e!==n&&e!==m&&e!==o)break}if(h=h.slice(d+k.i-u+s),i=k.i,!h.length){if(ce||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,c=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$re=function(b){k.i>i&&(h=h.slice(k.i-i),i=k.i);var c=b.exec(h);return c?(a(c[0].length),"string"==typeof c?c:1===c.length?c[0]:c):null},k.$char=function(c){return b.charAt(k.i)!==c?null:(a(1),c)},k.$str=function(c){for(var d=c.length,e=0;es||a=b.length;return k.i=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":38}],40:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=function j(a,b,c){function i(a,e){throw new d({index:p.i,filename:c.filename,type:e||"Syntax",message:a},b)}function k(a,b,c){var d=a instanceof Function?a.call(o):p.$re(a);return d?d:void i(b||("string"==typeof a?"expected '"+a+"' got '"+p.currentChar()+"'":"unexpected token"))}function l(a,b){return p.$char(a)?a:void i(b||"expected '"+a+"' got '"+p.currentChar()+"'")}function m(a){var b=c.filename;return{lineNumber:h.getLocation(a,p.getInput()).line+1,fileName:b}}function n(a,c,e,f,g){var h,i=[],j=p;try{j.start(a,!1,function(a,b){g({message:a,index:b+e})});for(var k,l,m=0;k=c[m];m++)l=j.i,h=o[k](),h?(h._index=l+e,h._fileInfo=f,i.push(h)):i.push(null);var n=j.end();n.isFinished?g(null,i):g(!0,null)}catch(q){throw new d({index:q.index+e,message:q.message},b,f.filename)}}var o,p=g();return{parserInput:p,imports:b,fileInfo:c,parseNode:n,parse:function(g,h,i){var k,l,m,n,o=null,q="";if(l=i&&i.globalVars?j.serializeVars(i.globalVars)+"\n":"",m=i&&i.modifyVars?"\n"+j.serializeVars(i.modifyVars):"",a.pluginManager)for(var r=a.pluginManager.getPreProcessors(),s=0;s1&&(b=new e.Value(g)),d.push(b),g=[])}return p.forget(),a?d:f},literal:function(){return this.dimension()||this.color()||this.quoted()||this.unicodeDescriptor()},assignment:function(){var a,b;return p.save(),(a=p.$re(/^\w+(?=\s?=)/i))&&p.$char("=")&&(b=o.entity())?(p.forget(),new e.Assignment(a,b)):void p.restore()},url:function(){var a,b=p.i;return p.autoCommentAbsorb=!1,p.$str("url(")?(a=this.quoted()||this.variable()||this.property()||p.$re(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",p.autoCommentAbsorb=!0,l(")"),new e.URL(null!=a.value||a instanceof e.Variable||a instanceof e.Property?a:new e.Anonymous(a,b),b,c)):void(p.autoCommentAbsorb=!0)},variable:function(){var a,b=p.i;if("@"===p.currentChar()&&(a=p.$re(/^@@?[\w-]+/)))return new e.Variable(a,b,c)},variableCurly:function(){var a,b=p.i;if("@"===p.currentChar()&&(a=p.$re(/^@\{([\w-]+)\}/)))return new e.Variable("@"+a[1],b,c)},property:function(){var a,b=p.i;if("$"===p.currentChar()&&(a=p.$re(/^\$[\w-]+/)))return new e.Property(a,b,c)},propertyCurly:function(){var a,b=p.i;if("$"===p.currentChar()&&(a=p.$re(/^\$\{([\w-]+)\}/)))return new e.Property("$"+a[1],b,c)},color:function(){var a;if("#"===p.currentChar()&&(a=p.$re(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))){var b=a.input.match(/^#([\w]+).*/);return b=b[1],b.match(/^[A-Fa-f0-9]+$/)||i("Invalid HEX color code"),new e.Color(a[1],(void 0),"#"+b)}},colorKeyword:function(){p.save();var a=p.autoCommentAbsorb;p.autoCommentAbsorb=!1;var b=p.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/);if(p.autoCommentAbsorb=a,!b)return void p.forget();p.restore();var c=e.Color.fromKeyword(b);return c?(p.$str(b),c):void 0},dimension:function(){if(!p.peekNotNumeric()){var a=p.$re(/^([+-]?\d*\.?\d+)(%|[a-z_]+)?/i);return a?new e.Dimension(a[1],a[2]):void 0}},unicodeDescriptor:function(){var a;if(a=p.$re(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/))return new e.UnicodeDescriptor(a[0])},javascript:function(){var a,b=p.i;p.save();var d=p.$char("~"),f=p.$char("`");return f?(a=p.$re(/^[^`]*`/))?(p.forget(),new e.JavaScript(a.substr(0,a.length-1),Boolean(d),b,c)):void p.restore("invalid javascript definition"):void p.restore()}},variable:function(){var a;if("@"===p.currentChar()&&(a=p.$re(/^(@[\w-]+)\s*:/)))return a[1]},rulesetCall:function(){var a;if("@"===p.currentChar()&&(a=p.$re(/^(@[\w-]+)\(\s*\)\s*;/)))return new e.RulesetCall(a[1])},extend:function(a){var b,d,f,g,h,j=p.i;if(p.$str(a?"&:extend(":":extend(")){do{for(f=null,b=null;!(f=p.$re(/^(all)(?=\s*(\)|,))/))&&(d=this.element());)b?b.push(d):b=[d];f=f&&f[1],b||i("Missing target selector for :extend()."),h=new e.Extend(new e.Selector(b),f,j,c),g?g.push(h):g=[h]}while(p.$char(","));return k(/^\)/),a&&k(/^;/),g}},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var a,b,d,f,g,h,i=p.currentChar(),j=!1,k=p.i;if("."===i||"#"===i){for(p.save();;){if(a=p.i,f=p.$re(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/),!f)break;d=new e.Element(g,f,a,c),b?b.push(d):b=[d],g=p.$char(">")}return b&&(p.$char("(")&&(h=this.args(!0).args,l(")")),o.important()&&(j=!0),o.end())?(p.forget(),new e.mixin.Call(b,h,k,c,j)):void p.restore()}},args:function(a){var b,c,d,f,g,h,j,k=o.entities,l={args:null,variadic:!1},m=[],n=[],q=[];for(p.save();;){if(a)h=o.detachedRuleset()||o.expression();else{if(p.commentStore.length=0,p.$str("...")){l.variadic=!0,p.$char(";")&&!b&&(b=!0),(b?n:q).push({variadic:!0});break}h=k.variable()||k.property()||k.literal()||k.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var r=null;if(a?h.value&&1==h.value.length&&(r=h.value[0]):r=h,r&&(r instanceof e.Variable||r instanceof e.Property))if(p.$char(":")){if(m.length>0&&(b&&i("Cannot mix ; and , as delimiter types"),c=!0),g=o.detachedRuleset()||o.expression(),!g){if(!a)return p.restore(),l.args=[],l;i("could not understand value for named argument")}f=d=r.name}else if(p.$str("...")){if(!a){l.variadic=!0,p.$char(";")&&!b&&(b=!0),(b?n:q).push({name:h.name,variadic:!0});break}j=!0}else a||(d=f=r.name,g=null);g&&m.push(g),q.push({name:f,value:g,expand:j}),p.$char(",")||(p.$char(";")||b)&&(c&&i("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),n.push({name:d,value:g,expand:j}),d=null,m=[],c=!1)}return p.forget(),l.args=b?n:q,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==p.currentChar()&&"#"!==p.currentChar()||p.peek(/^[^{]*\}/)))if(p.save(),b=p.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!p.$char(")"))return void p.restore("Missing closing ')'");if(p.commentStore.length=0,p.$str("when")&&(d=k(o.conditions,"expected condition")),c=o.block())return p.forget(),new e.mixin.Definition(a,f,c,d,g);p.restore()}else p.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.property()||a.call()||a.keyword()||a.javascript()},end:function(){return p.$char(";")||p.peek("}")},alpha:function(){var a;if(p.$re(/^opacity=/i))return a=p.$re(/^\d+/),a||(a=k(this.entities.variable,"Could not parse alpha")),l(")"),new e.Alpha(a)},element:function(){var a,b,d,f=p.i;if(b=this.combinator(),a=p.$re(/^(?:\d+\.\d+|\d+)%/)||p.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||p.$char("*")||p.$char("&")||this.attribute()||p.$re(/^\([^&()@]+\)/)||p.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(p.save(),p.$char("(")?(d=this.selector(!1))&&p.$char(")")?(a=new e.Paren(d),p.forget()):p.restore("Missing closing ')'"):p.forget()),a)return new e.Element(b,a,f,c)},combinator:function(){var a=p.currentChar();if("/"===a){p.save();var b=p.$re(/^\/[a-z]+\//i);if(b)return p.forget(),new e.Combinator(b);p.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(p.i++,"^"===a&&"^"===p.currentChar()&&(a="^^",p.i++);p.isWhitespace();)p.i++;return new e.Combinator(a)}return new e.Combinator(p.isWhitespace(-1)?" ":null)},selector:function(a){var b,d,f,g,h,j,l,m=p.i;for(a=a!==!1;(a&&(d=this.extend())||a&&(j=p.$str("when"))||(g=this.element()))&&(j?l=k(this.conditions,"expected condition"):l?i("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&i("Extend can only be used at the end of selector"),f=p.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,l,m,c):void(h&&i("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(p.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=k(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=p.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||p.$re(/^[0-9]+%/)||p.$re(/^[\w-]+/)||d.variableCurly()),l("]"),new e.Attribute(a,c,b)}},block:function(){var a;if(p.$char("{")&&(a=this.primary())&&p.$char("}"))return a},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();if(a)return new e.DetachedRuleset(a)},ruleset:function(){var b,c,d,f;for(p.save(),a.dumpLineNumbers&&(f=m(p.i));;){if(c=this.selector(),!c)break;if(b?b.push(c):b=[c],p.commentStore.length=0,c.condition&&b.length>1&&i("Guards are only currently allowed on a single selector."),!p.$char(","))break;c.condition&&i("Guards are only currently allowed on a single selector."),p.commentStore.length=0}if(b&&(d=this.block())){p.forget();var g=new e.Ruleset(b,d,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}p.restore()},declaration:function(){var a,b,d,f,g,h=p.i,i=p.currentChar();if("."!==i&&"#"!==i&&"&"!==i&&":"!==i)if(p.save(),a=this.variable()||this.ruleProperty()){if(g="string"==typeof a,g&&(b=this.detachedRuleset()),p.commentStore.length=0,!b){if(f=!g&&a.length>1&&a.pop().value,b=this.anonymousValue())return p.forget(),new e.Declaration(a,b,(!1),f,h,c);b||(b=this.value()),d=this.important()}if(b&&this.end())return p.forget(),new e.Declaration(a,b,d,f,h,c);p.restore()}else p.restore()},anonymousValue:function(){var a=p.i,b=p.$re(/^([^@\$+\/'"*`(;{}-]*);/);if(b)return new e.Anonymous(b[1],a)},"import":function(){var a,b,d=p.i,f=p.$re(/^@import?\s+/);if(f){var g=(f?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),p.$char(";")||(p.i=d,i("missing semi-colon or unrecognised media features on import")),b=b&&new e.Value(b),new e.Import(a,b,g,d,c);p.i=d,i("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!p.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!p.$char(","))break}while(a);return l(")"),d},importOption:function(){var a=p.$re(/^(less|css|multiple|once|inline|reference|optional)/);if(a)return a[1]},mediaFeature:function(){var a,b,d=this.entities,f=[];p.save();do a=d.keyword()||d.variable(),a?f.push(a):p.$char("(")&&(b=this.property(),a=this.value(),p.$char(")")?b&&a?f.push(new e.Paren(new e.Declaration(b,a,null,null,p.i,c,(!0)))):a?f.push(new e.Paren(a)):i("badly formed media feature definition"):i("Missing closing ')'","Parse"));while(a);if(p.forget(),f.length>0)return new e.Expression(f)},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!p.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!p.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=p.i;return a.dumpLineNumbers&&(g=m(h)),p.save(),p.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||i("media definitions require block statements after any features"),p.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void p.restore()},plugin:function(){var a,b,d,f=p.i,g=p.$re(/^@plugin?\s+/);if(g){if(b=this.pluginArgs(),d=b?{pluginArgs:b,isPlugin:!0}:{isPlugin:!0},a=this.entities.quoted()||this.entities.url())return p.$char(";")||(p.i=f,i("missing semi-colon on @plugin")),new e.Import(a,null,d,f,c);p.i=f,i("malformed @plugin statement")}},pluginArgs:function(){if(p.save(),!p.$char("("))return p.restore(),null;var a=p.$re(/^\s*([^\);]+)\)\s*/);return a[1]?(p.forget(),a[1].trim()):(p.restore(),null)},atrule:function(){var b,d,f,g,h,j,k,l=p.i,n=!0,o=!0;if("@"===p.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(p.save(),b=p.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,n=!1;break;case"@namespace":j=!0,n=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,o=!1;break;default:k=!0}return p.commentStore.length=0,h?(d=this.entity(), +d||i("expected "+b+" identifier")):j?(d=this.expression(),d||i("expected "+b+" expression")):k&&(d=(p.$re(/^[^{;]+/)||"").trim(),n="{"==p.currentChar(),d&&(d=new e.Anonymous(d))),n&&(f=this.blockRuleset()),f||!n&&d&&p.$char(";")?(p.forget(),new e.AtRule(b,d,f,l,c,a.dumpLineNumbers?m(l):null,o)):void p.restore("at-rule options not recognised")}}},value:function(){var a,b=[],c=p.i;do if(a=this.expression(),a&&(b.push(a),!p.$char(",")))break;while(a);if(b.length>0)return new e.Value(b,c)},important:function(){if("!"===p.currentChar())return p.$re(/^! *important/)},sub:function(){var a,b;return p.save(),p.$char("(")?(a=this.addition(),a&&p.$char(")")?(p.forget(),b=new e.Expression([a]),b.parens=!0,b):void p.restore("Expected ')'")):void p.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=p.isWhitespace(-1);;){if(p.peek(/^\/[*\/]/))break;if(p.save(),c=p.$char("/")||p.$char("*"),!c){p.forget();break}if(b=this.operand(),!b){p.restore();break}p.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=p.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=p.isWhitespace(-1);;){if(c=p.$re(/^[-+]\s+/)||!f&&(p.$char("+")||p.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=p.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=p.i;if(a=this.condition()){for(;;){if(!p.peek(/^,\s*(not\s*)?\(/)||!p.$char(","))break;if(b=this.condition(),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(){function a(){return p.$str("or")}var b,c,d;if(b=this.conditionAnd(this)){if(c=a()){if(d=this.condition(),!d)return;b=new e.Condition(c,b,d)}return b}},conditionAnd:function(){function a(a){return a.negatedCondition()||a.parenthesisCondition()}function b(){return p.$str("and")}var c,d,f;if(c=a(this)){if(d=b()){if(f=this.conditionAnd(),!f)return;c=new e.Condition(d,c,f)}return c}},negatedCondition:function(){if(p.$str("not")){var a=this.parenthesisCondition();return a&&(a.negate=!a.negate),a}},parenthesisCondition:function(){function a(a){var b;return p.save(),(b=a.condition())&&p.$char(")")?(p.forget(),b):void p.restore()}var b;return p.save(),p.$str("(")?(b=a(this))?(p.forget(),b):(b=this.atomicCondition())?p.$char(")")?(p.forget(),b):void p.restore("expected ')' got '"+p.currentChar()+"'"):void p.restore():void p.restore()},atomicCondition:function(){var a,b,c,d,f=this.entities,g=p.i;if(a=this.addition()||f.keyword()||f.quoted())return p.$char(">")?d=p.$char("=")?">=":">":p.$char("<")?d=p.$char("=")?"<=":"<":p.$char("=")&&(d=p.$char(">")?"=>":p.$char("<")?"=<":"="),d?(b=this.addition()||f.keyword()||f.quoted(),b?c=new e.Condition(d,a,b,g,(!1)):i("expected expression")):c=new e.Condition("=",a,new e.Keyword("true"),g,(!1)),c},operand:function(){var a,b=this.entities;p.peek(/^-[@\$\(]/)&&(a=p.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.property()||b.call()||b.colorKeyword();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[],d=p.i;do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),p.peek(/^\/[\/*]/)||(b=p.$char("/"),b&&c.push(new e.Anonymous(b,d)))));while(a);if(c.length>0)return new e.Expression(c)},property:function(){var a=p.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(a)return a[1]},ruleProperty:function(){function a(a){var b=p.i,c=p.$re(a);if(c)return g.push(b),f.push(c[1])}var b,d,f=[],g=[];p.save();var h=p.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],p.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(p.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;d=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},g.prototype.addPostProcessor=function(a,b){var c;for(c=0;c=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},g.prototype.addFileManager=function(a){this.fileManagers.push(a)},g.prototype.getPreProcessors=function(){for(var a=[],b=0;b0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],45:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Declaration("@"+a,b,(!1),null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j,k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor((!0)),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager)for(j=b.pluginManager.visitor(),j.first();i=j.get();)i.isPreEvalVisitor&&i.run(a);c=a.eval(h);for(var l=0;l.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(d="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":73}],56:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],57:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;c-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&c<1&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":15,"./color":52,"./node":73,"./unit":83}],60:[function(a,b,c){var d=a("./atrule"),e=function(){var a=Array.prototype.slice.call(arguments);d.apply(this,a)};e.prototype=Object.create(d.prototype),e.prototype.constructor=e,b.exports=e},{"./atrule":49}],61:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./combinator"),g=function(a,b,c,d,e){this.combinator=a instanceof f?a:new f(a),this.value="string"==typeof b?b.trim():b?b:"",this._index=c,this._fileInfo=d,this.copyVisibilityInfo(e),this.setParent(this.combinator,this)};g.prototype=new d,g.prototype.type="Element",g.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},g.prototype.eval=function(a){return new g(this.combinator,this.value.eval?this.value.eval(a):this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.fileInfo(),this.getIndex())},g.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof e&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=g},{"./combinator":53,"./node":73,"./paren":75}],62:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./comment"),g=function(a){if(this.value=a,!a)throw new Error("Expression requires an array parameter")};g.prototype=new d,g.prototype.type="Expression",g.prototype.accept=function(a){this.value=a.visitArray(this.value)},g.prototype.eval=function(a){var b,c=this.parens&&!this.parensInOp,d=!1;return c&&a.inParenthesis(),this.value.length>1?b=new g(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(d=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!d&&(b=new e(b)),b},g.prototype.genCSS=function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":73,"./selector":81}],64:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=a("../utils"),k=a("../less-error"),l=function(a,b,c,d,e,f){if(this.options=c,this._index=d,this._fileInfo=e,this.path=a,this.features=b,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f),this.setParent(this.features,this),this.setParent(this.path,this)};l.prototype=new d,l.prototype.type="Import",l.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.isPlugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},l.prototype.genCSS=function(a,b){this.css&&void 0===this.path._fileInfo.reference&&(b.add("@import ",this._fileInfo,this._index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},l.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},l.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),!(a instanceof g)||a.containsVariables()},l.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new l(b.eval(a),this.features,this.options,this._index,this._fileInfo,this.visibilityInfo())},l.prototype.evalPath=function(a){var b=this.path.eval(a),c=this._fileInfo&&this._fileInfo.rootpath;if(!(b instanceof f)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d)}b.value=a.normalizePath(b.value)}return b},l.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){a.addVisibilityBlock()}):b.addVisibilityBlock()),b},l.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a);if(this.options.isPlugin){if(this.root&&this.root.eval)try{this.root.eval(a)}catch(f){throw f.message="Plugin error during evaluation",new k(f,this.root.imports,this.root.filename); +}return c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[]}if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var g=new i(this.root,0,{filename:this.importedFilename,reference:this.path._fileInfo&&this.path._fileInfo.reference},(!0),(!0));return this.features?new e([g],this.features.value):[g]}if(this.css){var m=new l(this.evalPath(a),d,this.options,this._index);if(!m.css&&this.error)throw this.error;return m}return b=new h(null,j.copyArray(this.root.rules)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=l},{"../less-error":34,"../utils":87,"./anonymous":47,"./media":69,"./node":73,"./quoted":77,"./ruleset":80,"./url":84}],65:[function(a,b,c){var d=Object.create(null);d.Node=a("./node"),d.Alpha=a("./alpha"),d.Color=a("./color"),d.AtRule=a("./atrule"),d.Directive=a("./directive"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Property=a("./property"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Declaration=a("./declaration"),d.Rule=a("./rule"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.RulesetCall=a("./ruleset-call"),b.exports=d},{"./alpha":46,"./anonymous":47,"./assignment":48,"./atrule":49,"./attribute":50,"./call":51,"./color":52,"./combinator":53,"./comment":54,"./condition":55,"./declaration":57,"./detached-ruleset":58,"./dimension":59,"./directive":60,"./element":61,"./expression":62,"./extend":63,"./import":64,"./javascript":66,"./keyword":68,"./media":69,"./mixin-call":70,"./mixin-definition":71,"./negative":72,"./node":73,"./operation":74,"./paren":75,"./property":76,"./quoted":77,"./rule":78,"./ruleset":80,"./ruleset-call":79,"./selector":81,"./unicode-descriptor":82,"./unit":83,"./url":84,"./value":85,"./variable":86}],66:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this._index=c,this._fileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new e(b):"string"==typeof b?new f('"'+b+'"',b,this.escaped,this._index):new g(Array.isArray(b)?b.join(", "):b)},b.exports=h},{"./anonymous":47,"./dimension":59,"./js-eval-node":67,"./quoted":77}],67:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(!b.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.fileInfo().filename,index:this.getIndex()};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.getIndex(),d.fileInfo()).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.fileInfo().filename,index:this.getIndex()}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.fileInfo().filename,index:this.getIndex()}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":73,"./variable":86}],68:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":73}],69:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./atrule"),j=a("../utils"),k=function(a,b,c,g,h){this._index=c,this._fileInfo=g;var i=new f([],null,null,this._index,this._fileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0,this.setParent(i,this),this.setParent(this.features,this),this.setParent(this.rules,this)};k.prototype=new i,k.prototype.type="Media",k.prototype.isRulesetLike=function(){return!0},k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},k.prototype.genCSS=function(a,b){b.add("@media ",this._fileInfo,this._index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},k.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new k(null,[],this._index,this._fileInfo,this.visibilityInfo());this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo);var c=!1;a.strictMath||(c=!0,a.strictMath=!0);try{b.features=this.features.eval(a)}finally{c&&(a.strictMath=!1)}return a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},k.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo()),this.setParent(b,this)}return delete a.mediaBlocks,delete a.mediaPath,b},k.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;b0;b--)a.splice(b,0,new g("and"));return new h(a)})),this.setParent(this.features,this),new d([],[])},k.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(n=!0,k=0;k0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.getIndex(),filename:this.fileInfo().filename};for(k=0;kthis.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;gb?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],74:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};g.prototype=new d,g.prototype.type="Operation",g.prototype.accept=function(a){this.operands=a.visit(this.operands)},g.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof f&&c instanceof e&&(b=b.toColor()),c instanceof f&&b instanceof e&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new g(this.op,[b,c],this.isSpaced)},g.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=g},{"./color":52,"./dimension":59,"./node":73}],75:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":73}],76:[function(a,b,c){var d=a("./node"),e=a("./declaration"),f=function(a,b,c){this.name=a,this._index=b,this._fileInfo=c};f.prototype=new d,f.prototype.type="Property",f.prototype.eval=function(a){var b,c=this.name,d=a.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;if(this.evaluating)throw{type:"Name",message:"Recursive property reference for "+c,filename:this.fileInfo().filename,index:this.getIndex()};if(this.evaluating=!0,b=this.find(a.frames,function(b){var f,g=b.property(c);if(g){for(var h=0;hd){if(!c||c(g)){e=g.find(new i(a.elements.slice(d)),b,c);for(var j=0;j0&&b.add(k),a.firstSelector=!0,h[0].genCSS(a,b),a.firstSelector=!1,d=1;d0?(e=p.copyArray(a),f=e.pop(),g=d.createDerived(p.copyArray(f.elements))):g=d.createDerived([]),b.length>0){var h=c.combinator,i=b[0].elements[0];h.emptyOrWhitespace&&!i.combinator.emptyOrWhitespace&&(h=i.combinator),g.elements.push(new j(h,i.value,c._index,c._fileInfo)),g.elements=g.elements.concat(b[0].elements.slice(1))}if(0!==g.elements.length&&e.push(g),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function g(a,b,c,d,e){var g;for(g=0;g0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new i(a))}}function l(a,b,c){function m(a){var b;return a.value instanceof h?(b=a.value.value,b instanceof i?b:null):null}var n,o,p,q,r,s,t,u,v,w,x=!1;for(q=[],r=[[]],n=0;u=c.elements[n];n++)if("&"!==u.value){var y=m(u);if(null!=y){k(q,r);var z,A=[],B=[];for(z=l(A,b,y),x=x||z,p=0;p0&&t[0].elements.push(new j(u.combinator,"",u._index,u._fileInfo)),s.push(t);else for(p=0;p0&&(a.push(r[n]),w=r[n][v-1],r[n][v-1]=w.createDerived(w.elements,c.extendList));return x}function m(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var n,o,q;if(o=[],q=l(o,b,c),!q)if(b.length>0)for(o=[],n=0;n0)for(b=0;b=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}},copyArray:function(a){var b,c=a.length,d=new Array(c);for(b=0;b=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.fileInfo(),b),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitDeclaration:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;e0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return k0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitAtRule:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitAtRuleOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=i},{"../logger":35,"../tree":65,"../utils":87,"./visitor":95}],89:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],90:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=a("../utils"),h=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};h.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,g.copyArray(this.context.frames)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.getIndex(),f.filename=a.fileInfo().filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;h0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];if(this.keepOnlyVisibleChilds(c),!this.isEmpty(c))return a.ensureVisibility(),a.removeVisibilityBlock(),a},isVisibleRuleset:function(a){return!!a.firstRoot||!this.isEmpty(a)&&!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitDeclaration:function(a,b){if(!a.blocksVisibility()&&!a.variable)return a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){if(!a.blocksVisibility()&&!a.isSilent(this._context))return a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){if(!a.blocksVisibility())return a},visitAtRule:function(a,b){return a.rules&&a.rules.length?this.visitAtRuleWithBody(a,b):this.visitAtRuleWithoutBody(a,b)},visitAtRuleWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitAtRuleWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;c0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;b=0;e--)if(c=a[e],c instanceof d.Declaration)if(f[c.name]){b=f[c.name],b instanceof d.Declaration&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);b.indexOf(g)!==-1?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b,c,e,f={},g=0;g1){c=b[0];var h=[],i=[];b.map(function(a){"+"===a.merge&&(i.length>0&&h.push(e(i)),i=[]),i.push(a)}),h.push(e(i)),c.value=g(h)}})}},visitAnonymous:function(a,b){if(!a.blocksVisibility())return a.accept(this._visitor),a}},b.exports=g},{"../tree":65,"./visitor":95}],95:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitFnCache=[],h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var c,e=this._visitFnCache,f=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=g;if(l.visitDeeper=!0,j||(c="visit"+a.type,j=f[c]||d,k=f[c+"Out"]||d,e[h]=j,e[i]=k),j!==d){var m=j.call(f,a,l);f.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=d&&k.call(f,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;ck){for(var b=0,c=h.length-j;b Date: Wed, 4 Jan 2017 17:50:59 -0800 Subject: [PATCH 51/97] Revert contrast changes in 2.7.1 --- lib/less/functions/color.js | 78 +++++++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 24 deletions(-) diff --git a/lib/less/functions/color.js b/lib/less/functions/color.js index 6b997b6b2..8e5569858 100644 --- a/lib/less/functions/color.js +++ b/lib/less/functions/color.js @@ -266,43 +266,73 @@ colorFunctions = { greyscale: function (color) { return colorFunctions.desaturate(color, new Dimension(100)); }, - contrast: function (color, color1, color2, threshold) { - // Return which of `color1` and `color2` has the greatest contrast with `color` - // according to the standard WCAG contrast ratio calculation. - // http://www.w3.org/TR/WCAG20/#contrast-ratiodef - // The threshold param is no longer used, in line with SASS. + contrast: function (color, dark, light, threshold) { // filter: contrast(3.2); // should be kept as is, so check for color if (!color.rgb) { return null; } - if (typeof color1 === 'undefined') { - color1 = colorFunctions.rgba(0, 0, 0, 1.0); + if (typeof light === 'undefined') { + light = colorFunctions.rgba(255, 255, 255, 1.0); } - if (typeof color2 === 'undefined') { - color2 = colorFunctions.rgba(255, 255, 255, 1.0); + if (typeof dark === 'undefined') { + dark = colorFunctions.rgba(0, 0, 0, 1.0); } - var contrast1, contrast2; - var luma = color.luma(); - var luma1 = color1.luma(); - var luma2 = color2.luma(); - // Calculate contrast ratios for each color - if (luma > luma1) { - contrast1 = (luma + 0.05) / (luma1 + 0.05); - } else { - contrast1 = (luma1 + 0.05) / (luma + 0.05); + //Figure out which is actually light and dark! + if (dark.luma() > light.luma()) { + var t = light; + light = dark; + dark = t; } - if (luma > luma2) { - contrast2 = (luma + 0.05) / (luma2 + 0.05); + if (typeof threshold === 'undefined') { + threshold = 0.43; } else { - contrast2 = (luma2 + 0.05) / (luma + 0.05); + threshold = number(threshold); } - if (contrast1 > contrast2) { - return color1; + if (color.luma() < threshold) { + return light; } else { - return color2; + return dark; } }, + // Changes made in 2.7.0 - Reverted in 3.0.0 + // contrast: function (color, color1, color2, threshold) { + // // Return which of `color1` and `color2` has the greatest contrast with `color` + // // according to the standard WCAG contrast ratio calculation. + // // http://www.w3.org/TR/WCAG20/#contrast-ratiodef + // // The threshold param is no longer used, in line with SASS. + // // filter: contrast(3.2); + // // should be kept as is, so check for color + // if (!color.rgb) { + // return null; + // } + // if (typeof color1 === 'undefined') { + // color1 = colorFunctions.rgba(0, 0, 0, 1.0); + // } + // if (typeof color2 === 'undefined') { + // color2 = colorFunctions.rgba(255, 255, 255, 1.0); + // } + // var contrast1, contrast2; + // var luma = color.luma(); + // var luma1 = color1.luma(); + // var luma2 = color2.luma(); + // // Calculate contrast ratios for each color + // if (luma > luma1) { + // contrast1 = (luma + 0.05) / (luma1 + 0.05); + // } else { + // contrast1 = (luma1 + 0.05) / (luma + 0.05); + // } + // if (luma > luma2) { + // contrast2 = (luma + 0.05) / (luma2 + 0.05); + // } else { + // contrast2 = (luma2 + 0.05) / (luma + 0.05); + // } + // if (contrast1 > contrast2) { + // return color1; + // } else { + // return color2; + // } + // }, argb: function (color) { return new Anonymous(color.toARGB()); }, From 809dc509f33652d8bcef9545dbade37bc4aef02a Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Fri, 6 Jan 2017 19:39:23 -0800 Subject: [PATCH 52/97] Arbitrary (non-falsey) values returned from functions are cast as Anonymous nodes --- lib/less/tree/call.js | 12 +++++++++--- test/css/functions.css | 6 +++--- test/css/plugin.css | 3 +++ test/less/plugin.less | 4 ++++ test/less/plugin/plugin-simple.js | 3 +++ 5 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 test/less/plugin/plugin-simple.js diff --git a/lib/less/tree/call.js b/lib/less/tree/call.js index 942436e64..4db9faf9c 100644 --- a/lib/less/tree/call.js +++ b/lib/less/tree/call.js @@ -48,10 +48,16 @@ Call.prototype.eval = function (context) { } if (result !== null && result !== undefined) { - // All returned results must be Nodes, - // so anything other than a Node is a null Node + // Results that that are not nodes are cast as Anonymous nodes + // Falsy values or booleans are returned as empty nodes if (!(result instanceof Node)) { - result = new Anonymous(null); + if (!result || result === true) { + result = new Anonymous(null); + } + else { + result = new Anonymous(result.toString()); + } + } result._index = this._index; result._fileInfo = this._fileInfo; diff --git a/test/css/functions.css b/test/css/functions.css index 4f8061225..ab5df5bb5 100644 --- a/test/css/functions.css +++ b/test/css/functions.css @@ -38,7 +38,7 @@ saturate-filter: saturate(5%); contrast-white: #000000; contrast-black: #ffffff; - contrast-red: #000000; + contrast-red: #ffffff; contrast-green: #000000; contrast-blue: #ffffff; contrast-yellow: #000000; @@ -49,11 +49,11 @@ contrast-light-thresh: #111111; contrast-dark-thresh: #eeeeee; contrast-high-thresh: #eeeeee; - contrast-low-thresh: #eeeeee; + contrast-low-thresh: #111111; contrast-light-thresh-per: #111111; contrast-dark-thresh-per: #eeeeee; contrast-high-thresh-per: #eeeeee; - contrast-low-thresh-per: #eeeeee; + contrast-low-thresh-per: #111111; replace: "Hello, World!"; replace-captured: "This is a new string."; replace-with-flags: "2 + 2 = 4"; diff --git a/test/css/plugin.css b/test/css/plugin.css index 71db68644..0c6ebe71c 100644 --- a/test/css/plugin.css +++ b/test/css/plugin.css @@ -50,4 +50,7 @@ val1: foo; val2: foo; } +.test-simple { + value: 3.141592653589793; +} @arbitrary value after (); diff --git a/test/less/plugin.less b/test/less/plugin.less index 1089be4b5..285c16496 100644 --- a/test/less/plugin.less +++ b/test/less/plugin.less @@ -91,6 +91,10 @@ test-collapse(); val2: foo; } +.test-simple { + @plugin "./plugin/plugin-simple"; + value: pi(); +} test-atrule("@charset"; '"utf-8"'); test-atrule("@arbitrary"; "value after ()"); diff --git a/test/less/plugin/plugin-simple.js b/test/less/plugin/plugin-simple.js new file mode 100644 index 000000000..340b9b3a0 --- /dev/null +++ b/test/less/plugin/plugin-simple.js @@ -0,0 +1,3 @@ +functions.add('pi', function() { + return Math.PI; +}); \ No newline at end of file From 8ba8c00a4209f1726193b91faa725dd55c9323cd Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Mon, 9 Jan 2017 07:12:46 -0800 Subject: [PATCH 53/97] Add UMD plugin format --- lib/less/plugin-api.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 lib/less/plugin-api.js diff --git a/lib/less/plugin-api.js b/lib/less/plugin-api.js new file mode 100644 index 000000000..214c36b05 --- /dev/null +++ b/lib/less/plugin-api.js @@ -0,0 +1,13 @@ +(function (root, registerPlugin) { +if (typeof define === 'function' && define.amd) { define([], registerPlugin); +} else if (typeof module === 'object' && module.exports) { module.exports = registerPlugin(); +} else { if (!root.less) { root.less = {}; } if (!root.less.plugins) { root.less.plugins = []; } +root.less.plugins.push(registerPlugin()); } } + +(this, function () { + return { + install: function(less, pluginManager, functions) { + // functions.add('') + } + }; +})); \ No newline at end of file From 1736ea5c37036903ae5ceed71f3f0771f84772db Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Mon, 9 Jan 2017 07:34:31 -0800 Subject: [PATCH 54/97] Update plugin API --- lib/less/plugin-api.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/less/plugin-api.js b/lib/less/plugin-api.js index 214c36b05..8ef84f149 100644 --- a/lib/less/plugin-api.js +++ b/lib/less/plugin-api.js @@ -1,10 +1,15 @@ (function (root, registerPlugin) { -if (typeof define === 'function' && define.amd) { define([], registerPlugin); -} else if (typeof module === 'object' && module.exports) { module.exports = registerPlugin(); -} else { if (!root.less) { root.less = {}; } if (!root.less.plugins) { root.less.plugins = []; } -root.less.plugins.push(registerPlugin()); } } - -(this, function () { + if (typeof define === 'function' && define.amd) { + define([], registerPlugin); + } else if (typeof module === 'object' && module.exports) { + module.exports = registerPlugin(); + } else { + if (!root.less) { root.less = {}; } + if (!root.less.plugins) { root.less.plugins = []; } + root.less.plugins.push(registerPlugin()); + } +}(this, function () { + // Less.js Plugin object return { install: function(less, pluginManager, functions) { // functions.add('') From b782411278a4916bec6ceaa4f6bb5cb56fd07620 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Tue, 10 Jan 2017 17:44:50 -0800 Subject: [PATCH 55/97] Sync default options across all Less.js environments - More tests for plugins --- bin/lessc | 28 +++-------- lib/less-browser/bootstrap.js | 20 ++++++-- lib/less-node/index.js | 2 +- lib/less-node/lessc-helper.js | 72 +++++++++++++-------------- lib/less-rhino/index.js | 19 +------ lib/less/default-options.js | 65 ++++++++++++++++++++++++ lib/less/parse.js | 3 ++ lib/less/plugin-api.js | 10 ++-- lib/less/tree/dimension.js | 3 ++ test/css/plugin.css | 13 +++++ test/index.js | 2 +- test/less/functions.less | 1 + test/less/plugin.less | 23 ++++++++- test/less/plugin/plugin-collection.js | 9 ++++ test/less/plugin/plugin-scope1.js | 3 ++ test/less/plugin/plugin-scope2.js | 3 ++ test/less/plugin/plugin-simple.js | 6 ++- 17 files changed, 195 insertions(+), 87 deletions(-) create mode 100644 lib/less/default-options.js create mode 100644 test/less/plugin/plugin-collection.js create mode 100644 test/less/plugin/plugin-scope1.js create mode 100644 test/less/plugin/plugin-scope2.js diff --git a/bin/lessc b/bin/lessc index 4d3c190cb..25cab56c7 100755 --- a/bin/lessc +++ b/bin/lessc @@ -19,25 +19,9 @@ var less = require('../lib/less-node'), args = process.argv.slice(1), silent = false, verbose = false, - options = { - depends: false, - compress: false, - max_line_len: -1, - lint: false, - paths: [], - color: true, - strictImports: false, - insecure: false, - rootpath: '', - relativeUrls: false, - ieCompat: true, - strictMath: false, - strictUnits: false, - globalVars: null, - modifyVars: null, - urlArgs: '', - plugins: plugins - }; + options = require('../lib/less/default-options')(); + +options.plugins = plugins; if (less.options) { for (var i = 0, keys = Object.keys(options); i < keys.length; i++) { @@ -431,8 +415,8 @@ function processPluginQueue() { case 'no-color': options.color = false; break; - case 'no-ie-compat': - options.ieCompat = false; + case 'ie-compat': + options.ieCompat = true; break; case 'js': options.javascriptEnabled = true; @@ -475,10 +459,12 @@ function processPluginQueue() { sourceMapOptions.sourceMapBasepath = match[2]; } break; + case 'source-map-inline': case 'source-map-map-inline': sourceMapFileInline = true; options.sourceMap = true; break; + case 'source-map-include-source': case 'source-map-less-inline': sourceMapOptions.outputSourceFiles = true; break; diff --git a/lib/less-browser/bootstrap.js b/lib/less-browser/bootstrap.js index 72b02c162..e1a35ba66 100644 --- a/lib/less-browser/bootstrap.js +++ b/lib/less-browser/bootstrap.js @@ -5,13 +5,27 @@ */ /*global window, document */ -// TODO - consider switching this out for a recommendation for this polyfill: +// TODO - consider switching this out for a recommendation for this polyfill? // require("promise/polyfill"); -var options = window.less || {}; +var options = require('../less/default-options'); + +if (window.less) { + for (key in window.less) { + if (window.less.hasOwnProperty(key)) { + options[key] = window.less[key]; + } + } +} require("./add-default-options")(window, options); +options.plugins = options.plugins || []; + +if (window.LESS_PLUGINS) { + options.plugins = options.plugins.concat(window.LESS_PLUGINS); +} + var less = module.exports = require("./index")(window, options); window.less = less; @@ -32,7 +46,7 @@ if (options.onReady) { if (/!watch/.test(window.location.hash)) { less.watch(); } - // Simulate synchronous stylesheet loading by blocking page rendering + // Simulate synchronous stylesheet loading by hiding page rendering if (!options.async) { css = 'body { display: none !important }'; head = document.head || document.getElementsByTagName('head')[0]; diff --git a/lib/less-node/index.js b/lib/less-node/index.js index 4e379845b..153f54b52 100644 --- a/lib/less-node/index.js +++ b/lib/less-node/index.js @@ -12,7 +12,7 @@ less.PluginLoader = require("./plugin-loader"); less.fs = require("./fs"); less.FileManager = FileManager; less.UrlFileManager = UrlFileManager; -less.options = less.options || {}; +less.options = require('../less/default-options'); // provide image-size functionality require('./image-size')(less.environment); diff --git a/lib/less-node/lessc-helper.js b/lib/less-node/lessc-helper.js index e9fbd8437..f283421c7 100644 --- a/lib/less-node/lessc-helper.js +++ b/lib/less-node/lessc-helper.js @@ -26,42 +26,42 @@ var lessc_helper = { console.log("If source is set to `-' (dash or hyphen-minus), input is read from stdin."); console.log(""); console.log("options:"); - console.log(" -h, --help Prints help (this message) and exit."); - console.log(" --include-path=PATHS Sets include paths. Separated by `:'. `;' also supported on windows."); - console.log(" -M, --depends Outputs a makefile import dependency list to stdout."); - console.log(" --no-color Disables colorized output."); - console.log(" --no-ie-compat Disables IE compatibility checks."); - console.log(" --js Enables inline JavaScript in less files"); - console.log(" -l, --lint Syntax check only (lint)."); - console.log(" -s, --silent Suppresses output of error messages."); - console.log(" --strict-imports Forces evaluation of imports."); - console.log(" --insecure Allows imports from insecure https hosts."); - console.log(" -v, --version Prints version number and exit."); - console.log(" --verbose Be verbose."); - console.log(" --source-map[=FILENAME] Outputs a v3 sourcemap to the filename (or output filename.map)."); - console.log(" --source-map-rootpath=X Adds this path onto the sourcemap filename and less file paths."); - console.log(" --source-map-basepath=X Sets sourcemap base path, defaults to current working directory."); - console.log(" --source-map-less-inline Puts the less files into the map instead of referencing them."); - console.log(" --source-map-map-inline Puts the map (and any less files) as a base64 data uri into the output css file."); - console.log(" --source-map-url=URL Sets a custom URL to map file, for sourceMappingURL comment"); - console.log(" in generated CSS file."); - console.log(" -rp, --rootpath=URL Sets rootpath for url rewriting in relative imports and urls"); - console.log(" Works with or without the relative-urls option."); - console.log(" -ru, --relative-urls Re-writes relative urls to the base less file."); - console.log(" -sm=on|off Turns on or off strict math, where in strict mode, math."); - console.log(" --strict-math=on|off Requires brackets. This option may default to on and then"); - console.log(" be removed in the future."); - console.log(" -su=on|off Allows mixed units, e.g. 1px+1em or 1px*1px which have units"); - console.log(" --strict-units=on|off that cannot be represented."); - console.log(" --global-var='VAR=VALUE' Defines a variable that can be referenced by the file."); - console.log(" --modify-var='VAR=VALUE' Modifies a variable already declared in the file."); - console.log(" --url-args='QUERYSTRING' Adds params into url tokens (e.g. 42, cb=42 or 'a=1&b=2')"); - console.log(" --plugin=PLUGIN=OPTIONS Loads a plugin. You can also omit the --plugin= if the plugin begins"); - console.log(" less-plugin. E.g. the clean css plugin is called less-plugin-clean-css"); - console.log(" once installed (npm install less-plugin-clean-css), use either with"); - console.log(" --plugin=less-plugin-clean-css or just --clean-css"); - console.log(" specify options afterwards e.g. --plugin=less-plugin-clean-css=\"advanced\""); - console.log(" or --clean-css=\"advanced\""); + console.log(" -h, --help Prints help (this message) and exit."); + console.log(" --include-path=PATHS Sets include paths. Separated by `:'. `;' also supported on windows."); + console.log(" -M, --depends Outputs a makefile import dependency list to stdout."); + console.log(" --no-color Disables colorized output."); + console.log(" --ie-compat Enables IE8 compatibility checks."); + console.log(" --js Enables inline JavaScript in less files"); + console.log(" -l, --lint Syntax check only (lint)."); + console.log(" -s, --silent Suppresses output of error messages."); + console.log(" --strict-imports Forces evaluation of imports."); + console.log(" --insecure Allows imports from insecure https hosts."); + console.log(" -v, --version Prints version number and exit."); + console.log(" --verbose Be verbose."); + console.log(" --source-map[=FILENAME] Outputs a v3 sourcemap to the filename (or output filename.map)."); + console.log(" --source-map-rootpath=X Adds this path onto the sourcemap filename and less file paths."); + console.log(" --source-map-basepath=X Sets sourcemap base path, defaults to current working directory."); + console.log(" --source-map-include-source Puts the less files into the map instead of referencing them."); + console.log(" --source-map-inline Puts the map (and any less files) as a base64 data uri into the output css file."); + console.log(" --source-map-url=URL Sets a custom URL to map file, for sourceMappingURL comment"); + console.log(" in generated CSS file."); + console.log(" -rp, --rootpath=URL Sets rootpath for url rewriting in relative imports and urls"); + console.log(" Works with or without the relative-urls option."); + console.log(" -ru, --relative-urls Re-writes relative urls to the base less file."); + console.log(" -sm=on|off Turns on or off strict math, where in strict mode, math."); + console.log(" --strict-math=on|off Requires brackets. This option may default to on and then"); + console.log(" be removed in the future."); + console.log(" -su=on|off Allows mixed units, e.g. 1px+1em or 1px*1px which have units"); + console.log(" --strict-units=on|off that cannot be represented."); + console.log(" --global-var='VAR=VALUE' Defines a variable that can be referenced by the file."); + console.log(" --modify-var='VAR=VALUE' Modifies a variable already declared in the file."); + console.log(" --url-args='QUERYSTRING' Adds params into url tokens (e.g. 42, cb=42 or 'a=1&b=2')"); + console.log(" --plugin=PLUGIN=OPTIONS Loads a plugin. You can also omit the --plugin= if the plugin begins"); + console.log(" less-plugin. E.g. the clean css plugin is called less-plugin-clean-css"); + console.log(" once installed (npm install less-plugin-clean-css), use either with"); + console.log(" --plugin=less-plugin-clean-css or just --clean-css"); + console.log(" specify options afterwards e.g. --plugin=less-plugin-clean-css=\"advanced\""); + console.log(" or --clean-css=\"advanced\""); console.log(""); console.log("-------------------------- Deprecated ----------------"); console.log(" --line-numbers=TYPE Outputs filename and line numbers."); diff --git a/lib/less-rhino/index.js b/lib/less-rhino/index.js index b59fae516..b0b745dc1 100644 --- a/lib/less-rhino/index.js +++ b/lib/less-rhino/index.js @@ -146,23 +146,8 @@ function writeFile(filename, content) { // Command line integration via Rhino (function (args) { - var options = { - depends: false, - compress: false, - cleancss: false, - max_line_len: -1, - silent: false, - verbose: false, - lint: false, - paths: [], - color: true, - strictImports: false, - rootpath: '', - relativeUrls: false, - ieCompat: true, - strictMath: false, - strictUnits: false - }; + var options = require('../default-options'); + var continueProcessing = true, currentErrorcode; diff --git a/lib/less/default-options.js b/lib/less/default-options.js new file mode 100644 index 000000000..09c0b3cfe --- /dev/null +++ b/lib/less/default-options.js @@ -0,0 +1,65 @@ +// Export a new default each time +module.exports = function() { + return { + /* Outputs a makefile import dependency list to stdout. */ + depends: false, + + /* Compress using less built-in compression. + * This does an okay job but does not utilise all the tricks of + * dedicated css compression. */ + compress: false, + + /* Runs the less parser and just reports errors without any output. */ + lint: false, + + /* Sets available include paths. + * If the file in an @import rule does not exist at that exact location, + * less will look for it at the location(s) passed to this option. + * You might use this for instance to specify a path to a library which + * you want to be referenced simply and relatively in the less files. */ + paths: [], + + /* color output in the terminal */ + color: true, + + /* The strictImports controls whether the compiler will allow an @import inside of either + * @media blocks or (a later addition) other selector blocks. + * See: https://github.com/less/less.js/issues/656 */ + strictImports: false, + + /* Allow Imports from Insecure HTTPS Hosts */ + insecure: false, + + /* Allows you to add a path to every generated import and url in your css. + * This does not affect less import statements that are processed, just ones + * that are left in the output css. */ + rootpath: '', + + /* By default URLs are kept as-is, so if you import a file in a sub-directory + * that references an image, exactly the same URL will be output in the css. + * This option allows you to re-write URL's in imported files so that the + * URL is always relative to the base imported file */ + relativeUrls: false, + + /* Compatibility with IE8. Used for limiting data-uri length */ + ieCompat: false, // true until 3.0 + + /* Without this option on, Less will try and process all math in your css */ + strictMath: false, + + /* Without this option, less attempts to guess at the output unit when it does maths. */ + strictUnits: false, + + /* Effectively the declaration is put at the top of your base Less file, + * meaning it can be used but it also can be overridden if this variable + * is defined in the file. */ + globalVars: null, + + /* As opposed to the global variable option, this puts the declaration at the + * end of your base file, meaning it will override anything defined in your Less file. */ + modifyVars: null, + + /* This option allows you to specify a argument to go on to every URL. */ + urlArgs: '' + } +} \ No newline at end of file diff --git a/lib/less/parse.js b/lib/less/parse.js index b83441e11..125bdff4f 100644 --- a/lib/less/parse.js +++ b/lib/less/parse.js @@ -58,6 +58,9 @@ module.exports = function(environment, ParseTree, ImportManager) { var imports = new ImportManager(this, context, rootFileInfo); this.importManager = imports; + // TODO: allow the plugins to be just a list of paths or names + // Do an async plugin queue like lessc + if (options.plugins) { options.plugins.forEach(function(plugin) { var evalResult, contents; diff --git a/lib/less/plugin-api.js b/lib/less/plugin-api.js index 8ef84f149..3338becfa 100644 --- a/lib/less/plugin-api.js +++ b/lib/less/plugin-api.js @@ -1,12 +1,10 @@ -(function (root, registerPlugin) { +(function (root, factory) { if (typeof define === 'function' && define.amd) { - define([], registerPlugin); + define([], factory); } else if (typeof module === 'object' && module.exports) { - module.exports = registerPlugin(); + module.exports = factory(); } else { - if (!root.less) { root.less = {}; } - if (!root.less.plugins) { root.less.plugins = []; } - root.less.plugins.push(registerPlugin()); + (root.LESS_PLUGINS = root.LESS_PLUGINS || []).push(factory()); } }(this, function () { // Less.js Plugin object diff --git a/lib/less/tree/dimension.js b/lib/less/tree/dimension.js index db979a93e..34b23a5b3 100644 --- a/lib/less/tree/dimension.js +++ b/lib/less/tree/dimension.js @@ -8,6 +8,9 @@ var Node = require("./node"), // var Dimension = function (value, unit) { this.value = parseFloat(value); + if (isNaN(this.value)) { + throw new Error("Dimension is not a number."); + } this.unit = (unit && unit instanceof Unit) ? unit : new Unit(unit ? [unit] : undefined); this.setParent(this.unit, this); diff --git a/test/css/plugin.css b/test/css/plugin.css index 0c6ebe71c..9dafc4390 100644 --- a/test/css/plugin.css +++ b/test/css/plugin.css @@ -52,5 +52,18 @@ } .test-simple { value: 3.141592653589793; + value: 6.28318531; +} +.test-conflicts { + value: foo; +} +.test-conflicts { + value: bar; +} +.test-conflicts { + value: foo; +} +.test-collection { + list: 32, 5, "bird"; } @arbitrary value after (); diff --git a/test/index.js b/test/index.js index 4e13259a6..09f24a146 100644 --- a/test/index.js +++ b/test/index.js @@ -20,7 +20,7 @@ var testMap = [ function(name) { return name + '-all'; }], [{strictMath: true, relativeUrls: false, rootpath: "folder (1)/"}, "static-urls/"], [{strictMath: true, compress: true}, "compression/"], - [{strictMath: true, strictUnits: true}, "strict-units/"], + [{strictMath: false, strictUnits: true}, "strict-units/"], [{}, "legacy/"], [{strictMath: true, strictUnits: true, sourceMap: true, globalVars: true }, "sourcemaps/", lessTester.testSourcemap, null, null, diff --git a/test/less/functions.less b/test/less/functions.less index 4866bdca7..74a2b2061 100644 --- a/test/less/functions.less +++ b/test/less/functions.less @@ -230,3 +230,4 @@ html { color: mix(blue, @color1, 50%); color: mix(blue, @color2, 50%); } + diff --git a/test/less/plugin.less b/test/less/plugin.less index 285c16496..1bf155d4b 100644 --- a/test/less/plugin.less +++ b/test/less/plugin.less @@ -93,7 +93,28 @@ } .test-simple { @plugin "./plugin/plugin-simple"; - value: pi(); + value: pi-anon(); + value: (pi() * 2); +} +.test-conflicts { + @plugin "./plugin/plugin-scope1"; + value: foo(); +} +.test-conflicts { + @plugin "./plugin/plugin-scope2"; + value: foo(); +} +.test-conflicts { + @plugin "./plugin/plugin-scope1"; + value: foo(); +} +.test-collection { + @plugin "./plugin/plugin-collection"; + @var: 32; + store(@var); + store(5); + store("bird"); + list: list(); } test-atrule("@charset"; '"utf-8"'); diff --git a/test/less/plugin/plugin-collection.js b/test/less/plugin/plugin-collection.js new file mode 100644 index 000000000..d8deb98c4 --- /dev/null +++ b/test/less/plugin/plugin-collection.js @@ -0,0 +1,9 @@ +var collection = []; + +functions.add('store', function(val) { + collection.push(val); // imma store this for later + return false; +}); +functions.add('list', function() { + return less.Value(collection); +}); \ No newline at end of file diff --git a/test/less/plugin/plugin-scope1.js b/test/less/plugin/plugin-scope1.js new file mode 100644 index 000000000..b9aa58048 --- /dev/null +++ b/test/less/plugin/plugin-scope1.js @@ -0,0 +1,3 @@ +functions.add('foo', function() { + return "foo"; +}); \ No newline at end of file diff --git a/test/less/plugin/plugin-scope2.js b/test/less/plugin/plugin-scope2.js new file mode 100644 index 000000000..a7faa74db --- /dev/null +++ b/test/less/plugin/plugin-scope2.js @@ -0,0 +1,3 @@ +functions.add('foo', function() { + return "bar"; +}); \ No newline at end of file diff --git a/test/less/plugin/plugin-simple.js b/test/less/plugin/plugin-simple.js index 340b9b3a0..6c059e35a 100644 --- a/test/less/plugin/plugin-simple.js +++ b/test/less/plugin/plugin-simple.js @@ -1,3 +1,7 @@ -functions.add('pi', function() { +functions.add('pi-anon', function() { return Math.PI; +}); + +functions.add('pi', function() { + return less.Dimension(Math.PI); }); \ No newline at end of file From ff5760e0994fd1ecc45bf50c242eaece9f109603 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Tue, 10 Jan 2017 17:46:25 -0800 Subject: [PATCH 56/97] v3.0.0-alpha.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ac9d28a32..0b1822dc9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "less", - "version": "3.0.0-alpha.1", + "version": "3.0.0-alpha.2", "description": "Leaner CSS", "homepage": "http://lesscss.org", "author": { From e5747a990a833a1b739439f14cf5173feca30bec Mon Sep 17 00:00:00 2001 From: Max Mikhailov Date: Mon, 24 Apr 2017 01:52:37 +0200 Subject: [PATCH 57/97] fix SO link in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c8977477..ac3f2c2ff 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,6 @@ Copyright (c) 2009-2016 [Alexis Sellier](http://cloudhead.io) & The Core Less Te Licensed under the [Apache License](LICENSE). -[so]: http://stackoverflow.com/questions/tagged/twitter-bootstrap+less "StackOverflow.com" +[so]: http://stackoverflow.com/questions/tagged/less "StackOverflow.com" [issues]: https://github.com/less/less.js/issues "GitHub Issues for Less.js" [download]: https://github.com/less/less.js/zipball/master "Download Less.js" From 39f9327b10b5280bba418e669314efead96473a1 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Mon, 15 May 2017 12:05:18 -0700 Subject: [PATCH 58/97] Update badges and add Twitter badge --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ac3f2c2ff..0c1338712 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -[![npm version](https://badge.fury.io/js/less.svg)](http://badge.fury.io/js/less) [![Build Status](https://travis-ci.org/less/less.js.svg?branch=master)](https://travis-ci.org/less/less.js) -[![Dependencies](https://david-dm.org/less/less.js.svg)](https://david-dm.org/less/less.js) [![devDependency Status](https://david-dm.org/less/less.js/dev-status.svg)](https://david-dm.org/less/less.js#info=devDependencies) [![optionalDependency Status](https://david-dm.org/less/less.js/optional-status.svg)](https://david-dm.org/less/less.js#info=optionalDependencies) -[![Sauce Test Status](https://saucelabs.com/browser-matrix/less.svg)](https://saucelabs.com/u/less) [![Build status](https://ci.appveyor.com/api/projects/status/bx2qspy3qbuxpl9q/branch/3.x?svg=true)](https://ci.appveyor.com/project/lukeapage/less-js/branch/3.x) +[![npm version](https://badge.fury.io/js/less.svg)](http://badge.fury.io/js/less) [![Build Status](https://travis-ci.org/less/less.js.svg?branch=master)](https://travis-ci.org/less/less.js) [![Build status](https://ci.appveyor.com/api/projects/status/bx2qspy3qbuxpl9q/branch/3.x?svg=true)](https://ci.appveyor.com/project/lukeapage/less-js/branch/3.x) [![Dependencies](https://david-dm.org/less/less.js.svg)](https://david-dm.org/less/less.js) [![devDependency Status](https://david-dm.org/less/less.js/dev-status.svg)](https://david-dm.org/less/less.js#info=devDependencies) [![optionalDependency Status](https://david-dm.org/less/less.js/optional-status.svg)](https://david-dm.org/less/less.js#info=optionalDependencies) [![Twitter Follow](https://img.shields.io/twitter/follow/lesstocss.svg?style=flat-square)](https://twitter.com/lesstocss) [![Join the chat at https://gitter.im/less/less.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/less/less.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) Chat with Less.js users + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/less.svg)](https://saucelabs.com/u/less) # [Less.js](http://lesscss.org) @@ -8,8 +8,6 @@ This is the JavaScript, official, stable version of Less. -###### :point_right: [![Join the chat at https://gitter.im/less/less.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/less/less.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) Chat with Less.js users - ## Getting Started From 312f741e4275e7cf45ca3d86563758deff4b5fe1 Mon Sep 17 00:00:00 2001 From: Max Mikhailov Date: Sun, 28 May 2017 15:53:57 +0300 Subject: [PATCH 59/97] minor Selector code clean-up --- Gruntfile.js | 2 +- lib/less/tree/selector.js | 36 +++++++++++++++--------------------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 02fe46f9c..0177ec9fb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -516,7 +516,7 @@ module.exports = function (grunt) { grunt.registerTask('test', testTasks); // Run all tests - grunt.registerTask('quicktest', testTasks.slice(0, testTasks.length - 1)); + grunt.registerTask('quicktest', testTasks.slice(0, -1)); // generate a good test environment for testing sourcemaps grunt.registerTask('sourcemap-test', [ diff --git a/lib/less/tree/selector.js b/lib/less/tree/selector.js index 0d811359d..fb866a9b3 100644 --- a/lib/less/tree/selector.js +++ b/lib/less/tree/selector.js @@ -5,12 +5,11 @@ var Node = require("./node"), var Selector = function (elements, extendList, condition, index, currentFileInfo, visibilityInfo) { this.extendList = extendList; this.condition = condition; + this.evaldCondition = !condition; this._index = index; this._fileInfo = currentFileInfo; this.elements = this.getElements(elements); - if (!condition) { - this.evaldCondition = true; - } + this.mixinElements_ = undefined; this.copyVisibilityInfo(visibilityInfo); this.setParent(this.elements, this); }; @@ -29,10 +28,9 @@ Selector.prototype.accept = function (visitor) { }; Selector.prototype.createDerived = function(elements, extendList, evaldCondition) { elements = this.getElements(elements); - var info = this.visibilityInfo(); - evaldCondition = (evaldCondition != null) ? evaldCondition : this.evaldCondition; - var newSelector = new Selector(elements, extendList || this.extendList, null, this.getIndex(), this.fileInfo(), info); - newSelector.evaldCondition = evaldCondition; + var newSelector = new Selector(elements, extendList || this.extendList, + null, this.getIndex(), this.fileInfo(), this.visibilityInfo()); + newSelector.evaldCondition = (evaldCondition != null) ? evaldCondition : this.evaldCondition; newSelector.mediaEmpty = this.mediaEmpty; return newSelector; }; @@ -66,14 +64,13 @@ Selector.prototype.match = function (other) { len = elements.length, olen, i; - other.cacheElements(); - - olen = other._elements.length; + other = other.mixinElements(); + olen = other.length; if (olen === 0 || len < olen) { return 0; } else { for (i = 0; i < olen; i++) { - if (elements[i].value !== other._elements[i]) { + if (elements[i].value !== other[i]) { return 0; } } @@ -81,9 +78,9 @@ Selector.prototype.match = function (other) { return olen; // return number of matched elements }; -Selector.prototype.cacheElements = function() { - if (this._elements) { - return; +Selector.prototype.mixinElements = function() { + if (this.mixinElements_) { + return this.mixinElements_; } var elements = this.elements.map( function(v) { @@ -98,7 +95,7 @@ Selector.prototype.cacheElements = function() { elements = []; } - this._elements = elements; + return (this.mixinElements_ = elements); }; Selector.prototype.isJustParentSelector = function() { return !this.mediaEmpty && @@ -120,12 +117,9 @@ Selector.prototype.genCSS = function (context, output) { if ((!context || !context.firstSelector) && this.elements[0].combinator.value === "") { output.add(' ', this.fileInfo(), this.getIndex()); } - if (!this._css) { - //TODO caching? speed comparison? - for (i = 0; i < this.elements.length; i++) { - element = this.elements[i]; - element.genCSS(context, output); - } + for (i = 0; i < this.elements.length; i++) { + element = this.elements[i]; + element.genCSS(context, output); } }; Selector.prototype.getIsOutput = function() { From a475cc4d8158bed4e53127c9e45e3e9f4e431ebe Mon Sep 17 00:00:00 2001 From: Max Mikhailov Date: Sun, 28 May 2017 18:03:37 +0300 Subject: [PATCH 60/97] fix lessc (less.options is a function and breaks less.render) --- bin/lessc | 14 +------------- lib/less-node/index.js | 2 +- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/bin/lessc b/bin/lessc index 25cab56c7..9a9c5f5d0 100755 --- a/bin/lessc +++ b/bin/lessc @@ -19,22 +19,10 @@ var less = require('../lib/less-node'), args = process.argv.slice(1), silent = false, verbose = false, - options = require('../lib/less/default-options')(); + options = less.options; options.plugins = plugins; -if (less.options) { - for (var i = 0, keys = Object.keys(options); i < keys.length; i++) { - if (!less.options[keys[i]]) { - less.options[keys[i]] = options[keys[i]]; - } - } - options = less.options; -} -else { - less.options = options; -} - var sourceMapOptions = {}; var continueProcessing = true; diff --git a/lib/less-node/index.js b/lib/less-node/index.js index 153f54b52..54e92fa17 100644 --- a/lib/less-node/index.js +++ b/lib/less-node/index.js @@ -12,7 +12,7 @@ less.PluginLoader = require("./plugin-loader"); less.fs = require("./fs"); less.FileManager = FileManager; less.UrlFileManager = UrlFileManager; -less.options = require('../less/default-options'); +less.options = require('../less/default-options')(); // provide image-size functionality require('./image-size')(less.environment); From 458b3975ea0c0de7c38df6998aa2b3facf6f730d Mon Sep 17 00:00:00 2001 From: Max Mikhailov Date: Wed, 31 May 2017 23:25:26 +0300 Subject: [PATCH 61/97] update mergeRules (no separate !important rules + cleanup) --- lib/less/visitors/to-css-visitor.js | 71 ++++++++++------------------- test/css/merge.css | 9 ++-- test/less/merge.less | 9 ++-- 3 files changed, 34 insertions(+), 55 deletions(-) diff --git a/lib/less/visitors/to-css-visitor.js b/lib/less/visitors/to-css-visitor.js index 009ac0569..74990bc91 100644 --- a/lib/less/visitors/to-css-visitor.js +++ b/lib/less/visitors/to-css-visitor.js @@ -321,62 +321,37 @@ ToCSSVisitor.prototype = { } }, - _mergeRules: function (rules) { - if (!rules) { return; } - - var groups = {}, - parts, - rule, - key; + _mergeRules: function(rules) { + if (!rules) { + return; + } + var groups = {}, + groupsArr = []; + for (var i = 0; i < rules.length; i++) { - rule = rules[i]; - - if ((rule instanceof tree.Declaration) && rule.merge) { - key = [rule.name, - rule.important ? "!" : ""].join(","); - - if (!groups[key]) { - groups[key] = []; - } else { - rules.splice(i--, 1); - } - + var rule = rules[i]; + if (rule.merge) { + var key = rule.name; + groups[key] ? rules.splice(i--, 1) : + groupsArr.push(groups[key] = []); groups[key].push(rule); } } - Object.keys(groups).map(function (k) { - - function toExpression(values) { - return new (tree.Expression)(values.map(function (p) { - return p.value; - })); - } - - function toValue(values) { - return new (tree.Value)(values.map(function (p) { - return p; - })); - } - - parts = groups[k]; - - if (parts.length > 1) { - rule = parts[0]; - var spacedGroups = []; - var lastSpacedGroup = []; - parts.map(function (p) { - if (p.merge === "+") { - if (lastSpacedGroup.length > 0) { - spacedGroups.push(toExpression(lastSpacedGroup)); - } - lastSpacedGroup = []; + groupsArr.forEach(function(group) { + if (group.length > 0) { + var result = group[0], + space = [], + comma = [new tree.Expression(space)]; + group.forEach(function(rule) { + if ((rule.merge === '+') && (space.length > 0)) { + comma.push(new tree.Expression(space = [])); } - lastSpacedGroup.push(p); + space.push(rule.value); + result.important = result.important || rule.important; }); - spacedGroups.push(toExpression(lastSpacedGroup)); - rule.value = toValue(spacedGroups); + result.value = new tree.Value(comma); } }); }, diff --git a/test/css/merge.css b/test/css/merge.css index fe29dc83b..b5d079b58 100644 --- a/test/css/merge.css +++ b/test/css/merge.css @@ -10,16 +10,17 @@ background: url(data://img1.png); } .test4 { - transform: rotate(90deg), skew(30deg); - transform: scale(2, 4) !important; + transform: rotate(90deg), skew(30deg), scale(2, 4) !important; } .test5 { - transform: rotate(90deg), skew(30deg); - transform: scale(2, 4) !important; + transform: rotate(90deg), skew(30deg), scale(2, 4) !important; } .test6 { transform: scale(2, 4); } +.test7 { + transform: scale(2, 4), scale(2, 4), scale(2, 4) !important; +} .test-interleaved { transform: t1, t2, t3; background: b1, b2, b3; diff --git a/test/less/merge.less b/test/less/merge.less index 9d37f67a1..7cac833b6 100644 --- a/test/less/merge.less +++ b/test/less/merge.less @@ -36,17 +36,20 @@ .first-background(); } .test4 { - // Won't merge values from sources that merked as !important, for backwards compatibility with css .first-transform(); .fifth-transform(); } .test5 { - // Won't merge values from mixins that merked as !important, for backwards compatibility with css .first-transform(); .second-transform() !important; } .test6 { - // Ignores !merge if no peers found + .second-transform(); +} +.test7 { + // inherit !important from merged subrules + .second-transform(); + .second-transform() !important; .second-transform(); } From f5591237d9c96448572bcbfebafbfb2816e9239c Mon Sep 17 00:00:00 2001 From: Max Mikhailov Date: Thu, 1 Jun 2017 01:23:33 +0300 Subject: [PATCH 62/97] clean to-css-visitor.js (eslint etc.) --- lib/less/visitors/to-css-visitor.js | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/lib/less/visitors/to-css-visitor.js b/lib/less/visitors/to-css-visitor.js index 74990bc91..4e0c7a9ce 100644 --- a/lib/less/visitors/to-css-visitor.js +++ b/lib/less/visitors/to-css-visitor.js @@ -9,7 +9,7 @@ var CSSVisitorUtils = function(context) { CSSVisitorUtils.prototype = { containsSilentNonBlockedChild: function(bodyRules) { var rule; - if (bodyRules == null) { + if (!bodyRules) { return false; } for (var r = 0; r < bodyRules.length; r++) { @@ -24,28 +24,21 @@ CSSVisitorUtils.prototype = { }, keepOnlyVisibleChilds: function(owner) { - if (owner == null || owner.rules == null) { - return ; - } - - owner.rules = owner.rules.filter(function(thing) { - return thing.isVisible(); + if (owner && owner.rules) { + owner.rules = owner.rules.filter(function(thing) { + return thing.isVisible(); + }); } - ); }, isEmpty: function(owner) { - if (owner == null || owner.rules == null) { - return true; - } - return owner.rules.length === 0; + return (owner && owner.rules) + ? (owner.rules.length === 0) : true; }, hasVisibleSelector: function(rulesetNode) { - if (rulesetNode == null || rulesetNode.paths == null) { - return false; - } - return rulesetNode.paths.length > 0; + return (rulesetNode && rulesetNode.paths) + ? (rulesetNode.paths.length > 0) : false; }, resolveVisibility: function (node, originalRules) { From 6a683eb62d0a3491be5c882d8b136fd1cd435b4f Mon Sep 17 00:00:00 2001 From: Max Mikhailov Date: Thu, 1 Jun 2017 02:27:55 +0300 Subject: [PATCH 63/97] eslint spaced-comment and corresponding changes --- .eslintrc.json | 1 + lib/less-browser/bootstrap.js | 2 +- lib/less-browser/cache.js | 2 +- lib/less-browser/error-reporting.js | 2 +- lib/less-browser/file-manager.js | 4 +-- lib/less-browser/index.js | 6 ++-- lib/less-browser/plugin-loader.js | 2 +- lib/less-node/lessc-helper.js | 4 +-- lib/less-rhino/index.js | 48 ++++++++++++------------- lib/less/contexts.js | 24 ++++++------- lib/less/functions/color.js | 2 +- lib/less/functions/function-registry.js | 2 +- lib/less/functions/index.js | 2 +- lib/less/functions/string.js | 4 +-- lib/less/index.js | 4 +-- lib/less/parser/parser-input.js | 6 ++-- lib/less/parser/parser.js | 2 +- lib/less/source-map-output.js | 2 +- lib/less/tree/atrule.js | 8 ++--- lib/less/tree/color.js | 2 +- lib/less/tree/dimension.js | 2 +- lib/less/tree/extend.js | 2 +- lib/less/tree/js-eval-node.js | 2 +- lib/less/tree/mixin-definition.js | 4 +-- lib/less/tree/node.js | 12 +++---- lib/less/tree/ruleset.js | 10 +++--- lib/less/tree/unit.js | 2 +- lib/less/visitors/extend-visitor.js | 6 ++-- lib/less/visitors/to-css-visitor.js | 37 ++++++++++--------- lib/less/visitors/visitor.js | 2 +- test/browser/common.js | 2 +- test/copy-bom.js | 2 +- test/less-test.js | 12 +++---- test/less/plugin/plugin-tree-nodes.js | 10 +++--- 34 files changed, 117 insertions(+), 117 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index c6e0fd800..9ddce209c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -72,6 +72,7 @@ "all" ], "space-infix-ops": 2, + "spaced-comment": 1, "space-before-blocks": [ 2, "always" diff --git a/lib/less-browser/bootstrap.js b/lib/less-browser/bootstrap.js index e1a35ba66..410cd717a 100644 --- a/lib/less-browser/bootstrap.js +++ b/lib/less-browser/bootstrap.js @@ -3,7 +3,7 @@ * used in the browser distributed version of less * to kick-start less using the browser api */ -/*global window, document */ +/* global window, document */ // TODO - consider switching this out for a recommendation for this polyfill? // diff --git a/lib/less-browser/cache.js b/lib/less-browser/cache.js index 3144cf4ed..2c8d6af34 100644 --- a/lib/less-browser/cache.js +++ b/lib/less-browser/cache.js @@ -18,7 +18,7 @@ module.exports = function(window, options, logger) { cache.setItem(path + ':vars', JSON.stringify(modifyVars)); } } catch (e) { - //TODO - could do with adding more robust error handling + // TODO - could do with adding more robust error handling logger.error('failed to save "' + path + '" to local storage for caching.'); } } diff --git a/lib/less-browser/error-reporting.js b/lib/less-browser/error-reporting.js index a3746ea5d..abf8e567a 100644 --- a/lib/less-browser/error-reporting.js +++ b/lib/less-browser/error-reporting.js @@ -112,7 +112,7 @@ module.exports = function(window, less, options) { } function removeErrorConsole(path) { - //no action + // no action } function removeError(path) { diff --git a/lib/less-browser/file-manager.js b/lib/less-browser/file-manager.js index 65c1b8e89..2f09f43fd 100644 --- a/lib/less-browser/file-manager.js +++ b/lib/less-browser/file-manager.js @@ -1,4 +1,4 @@ -/*global window, XMLHttpRequest */ +/* global window, XMLHttpRequest */ module.exports = function(options, logger) { @@ -6,7 +6,7 @@ module.exports = function(options, logger) { var fileCache = {}; - //TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load + // TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load var FileManager = function() { }; diff --git a/lib/less-browser/index.js b/lib/less-browser/index.js index 5fc2a2b44..6fc2f5987 100644 --- a/lib/less-browser/index.js +++ b/lib/less-browser/index.js @@ -22,7 +22,7 @@ module.exports = function(window, options) { var cache = less.cache = options.cache || require("./cache")(window, options, less.logger); require('./image-size')(less.environment); - //Setup user functions - Deprecate? + // Setup user functions - Deprecate? if (options.functions) { less.functions.functionRegistry.addMultiple(options.functions); } @@ -60,7 +60,7 @@ module.exports = function(window, options) { var lessText = style.innerHTML || ''; instanceOptions.filename = document.location.href.replace(/#.*$/, ''); - /*jshint loopfunc:true */ + /* jshint loopfunc:true */ // use closure to store current style less.render(lessText, instanceOptions, bind(function(style, e, result) { @@ -116,7 +116,7 @@ module.exports = function(window, options) { } - //TODO add tests around how this behaves when reloading + // TODO add tests around how this behaves when reloading errors.remove(path); instanceOptions.rootFileInfo = newFileInfo; diff --git a/lib/less-browser/plugin-loader.js b/lib/less-browser/plugin-loader.js index fbb19df4e..462a0e2ae 100644 --- a/lib/less-browser/plugin-loader.js +++ b/lib/less-browser/plugin-loader.js @@ -1,4 +1,4 @@ -/*global window */ +/* global window */ var AbstractPluginLoader = require("../less/environment/abstract-plugin-loader.js"); diff --git a/lib/less-node/lessc-helper.js b/lib/less-node/lessc-helper.js index f283421c7..6dedbe3ca 100644 --- a/lib/less-node/lessc-helper.js +++ b/lib/less-node/lessc-helper.js @@ -3,7 +3,7 @@ // helper functions for lessc var lessc_helper = { - //Stylize a string + // Stylize a string stylize : function(str, style) { var styles = { 'reset' : [0, 0], @@ -19,7 +19,7 @@ var lessc_helper = { '\x1b[' + styles[style][1] + 'm'; }, - //Print command line options + // Print command line options printUsage: function() { console.log("usage: lessc [option option=parameter ...] [destination]"); console.log(""); diff --git a/lib/less-rhino/index.js b/lib/less-rhino/index.js index b0b745dc1..e82132c8d 100644 --- a/lib/less-rhino/index.js +++ b/lib/less-rhino/index.js @@ -1,6 +1,5 @@ /* jshint rhino:true, unused: false */ -/* jscs:disable validateIndentation */ -/*global name:true, less, loadStyleSheet, os */ +/* global name:true, less, loadStyleSheet, os */ function formatError(ctx, options) { options = options || {}; @@ -9,7 +8,7 @@ function formatError(ctx, options) { var extract = ctx.extract; var error = []; -// var stylize = options.color ? require('./lessc_helper').stylize : function (str) { return str; }; + // var stylize = options.color ? require('./lessc_helper').stylize : function (str) { return str; }; var stylize = function (str) { return str; }; // only output a stack if it isn't a less error @@ -211,8 +210,8 @@ function writeFile(filename, content) { break; case 'h': case 'help': - //TODO -// require('../lib/less/lessc_helper').printUsage(); + // TODO + // require('../lib/less/lessc_helper').printUsage(); continueProcessing = false; break; case 'x': @@ -255,7 +254,7 @@ function writeFile(filename, content) { .split(os.type().match(/Windows/) ? /:(?!\\)|;/ : ':') .map(function(p) { if (p) { -// return path.resolve(process.cwd(), p); + // return path.resolve(process.cwd(), p); return p; } }); @@ -336,20 +335,20 @@ function writeFile(filename, content) { var name = args[0]; if (name && name != '-') { -// name = path.resolve(process.cwd(), name); + // name = path.resolve(process.cwd(), name); } var output = args[1]; var outputbase = args[1]; if (output) { options.sourceMapOutputFilename = output; -// output = path.resolve(process.cwd(), output); + // output = path.resolve(process.cwd(), output); if (warningMessages) { console.log(warningMessages); } } -// options.sourceMapBasepath = process.cwd(); -// options.sourceMapBasepath = ''; + // options.sourceMapBasepath = process.cwd(); + // options.sourceMapBasepath = ''; if (options.sourceMap === true) { console.log("output: " + output); @@ -367,24 +366,25 @@ function writeFile(filename, content) { console.log("lessc: no inout files"); console.log(""); // TODO -// require('../lib/less/lessc_helper').printUsage(); + // require('../lib/less/lessc_helper').printUsage(); currentErrorcode = 1; return; } -// var ensureDirectory = function (filepath) { -// var dir = path.dirname(filepath), -// cmd, -// existsSync = fs.existsSync || path.existsSync; -// if (!existsSync(dir)) { -// if (mkdirp === undefined) { -// try {mkdirp = require('mkdirp');} -// catch(e) { mkdirp = null; } -// } -// cmd = mkdirp && mkdirp.sync || fs.mkdirSync; -// cmd(dir); -// } -// }; + /* + var ensureDirectory = function (filepath) { + var dir = path.dirname(filepath), + cmd, + existsSync = fs.existsSync || path.existsSync; + if (!existsSync(dir)) { + if (mkdirp === undefined) { + try {mkdirp = require('mkdirp');} + catch(e) { mkdirp = null; } + } + cmd = mkdirp && mkdirp.sync || fs.mkdirSync; + cmd(dir); + } + }; */ if (options.depends) { if (!outputbase) { diff --git a/lib/less/contexts.js b/lib/less/contexts.js index 06190edff..e56f0d3e4 100644 --- a/lib/less/contexts.js +++ b/lib/less/contexts.js @@ -40,17 +40,17 @@ contexts.Parse = function(options) { }; var evalCopyProperties = [ - 'paths', // additional include paths - 'compress', // whether to compress - 'ieCompat', // whether to enforce IE compatibility (IE8 data-uri) - 'strictMath', // whether math has to be within parenthesis - 'strictUnits', // whether units need to evaluate correctly - 'sourceMap', // whether to output a source map - 'importMultiple', // whether we are currently importing multiple copies - 'urlArgs', // whether to add args into url tokens - 'javascriptEnabled',// option - whether Inline JavaScript is enabled. if undefined, defaults to false - 'pluginManager', // Used as the plugin manager for the session - 'importantScope' // used to bubble up !important statements + 'paths', // additional include paths + 'compress', // whether to compress + 'ieCompat', // whether to enforce IE compatibility (IE8 data-uri) + 'strictMath', // whether math has to be within parenthesis + 'strictUnits', // whether units need to evaluate correctly + 'sourceMap', // whether to output a source map + 'importMultiple', // whether we are currently importing multiple copies + 'urlArgs', // whether to add args into url tokens + 'javascriptEnabled', // option - whether Inline JavaScript is enabled. if undefined, defaults to false + 'pluginManager', // Used as the plugin manager for the session + 'importantScope' // used to bubble up !important statements ]; contexts.Eval = function(options, frames) { @@ -108,4 +108,4 @@ contexts.Eval.prototype.normalizePath = function( path ) { return path.join("/"); }; -//todo - do the same for the toCSS ? +// todo - do the same for the toCSS ? diff --git a/lib/less/functions/color.js b/lib/less/functions/color.js index 8e5569858..864ee9374 100644 --- a/lib/less/functions/color.js +++ b/lib/less/functions/color.js @@ -278,7 +278,7 @@ colorFunctions = { if (typeof dark === 'undefined') { dark = colorFunctions.rgba(0, 0, 0, 1.0); } - //Figure out which is actually light and dark! + // Figure out which is actually light and dark: if (dark.luma() > light.luma()) { var t = light; light = dark; diff --git a/lib/less/functions/function-registry.js b/lib/less/functions/function-registry.js index d7f3f0f31..d314355a4 100644 --- a/lib/less/functions/function-registry.js +++ b/lib/less/functions/function-registry.js @@ -7,7 +7,7 @@ function makeRegistry( base ) { name = name.toLowerCase(); if (this._data.hasOwnProperty(name)) { - //TODO warn + // TODO warn } this._data[name] = func; }, diff --git a/lib/less/functions/index.js b/lib/less/functions/index.js index 90703c0ee..4b17556d2 100644 --- a/lib/less/functions/index.js +++ b/lib/less/functions/index.js @@ -4,7 +4,7 @@ module.exports = function(environment) { functionCaller: require("./function-caller") }; - //register functions + // register functions require("./default"); require("./color"); require("./color-blending"); diff --git a/lib/less/functions/string.js b/lib/less/functions/string.js index 21150dc3f..5ae137596 100644 --- a/lib/less/functions/string.js +++ b/lib/less/functions/string.js @@ -19,12 +19,12 @@ functionRegistry.addMultiple({ result = result.replace(new RegExp(pattern.value, flags ? flags.value : ''), replacement); return new Quoted(string.quote || '', result, string.escaped); }, - '%': function (string /* arg, arg, ...*/) { + '%': function (string /* arg, arg, ... */) { var args = Array.prototype.slice.call(arguments, 1), result = string.value; for (var i = 0; i < args.length; i++) { - /*jshint loopfunc:true */ + /* jshint loopfunc:true */ result = result.replace(/%[sda]/i, function(token) { var value = ((args[i].type === "Quoted") && token.match(/s/i)) ? args[i].value : args[i].toCSS(); diff --git a/lib/less/index.js b/lib/less/index.js index 84cd6c2e8..62403bd0c 100644 --- a/lib/less/index.js +++ b/lib/less/index.js @@ -37,7 +37,7 @@ module.exports = function(environment, fileManagers) { }; var t, api = Object.create(initial); for (var n in initial.tree) { - /*eslint guard-for-in: 0 */ + /* eslint guard-for-in: 0 */ t = initial.tree[n]; if (typeof t === "function") { api[n] = ctor(t); @@ -45,7 +45,7 @@ module.exports = function(environment, fileManagers) { else { api[n] = Object.create(null); for (var o in t) { - /*eslint guard-for-in: 0 */ + /* eslint guard-for-in: 0 */ api[n][o] = ctor(t[o]); } } diff --git a/lib/less/parser/parser-input.js b/lib/less/parser/parser-input.js index 4765d7404..2394c9c3e 100644 --- a/lib/less/parser/parser-input.js +++ b/lib/less/parser/parser-input.js @@ -1,11 +1,11 @@ var chunker = require('./chunker'); module.exports = function() { - var input, // LeSS input string + var input, // Less input string j, // current chunk saveStack = [], // holds state for backtracking furthest, // furthest index the parser has gone to - furthestPossibleErrorMessage,// if this is furthest we got to, this is the probably cause + furthestPossibleErrorMessage, // if this is furthest we got to, this is the probably cause chunks, // chunkified input current, // current chunk currentPos, // index of current chunk, in `input` @@ -209,7 +209,7 @@ module.exports = function() { parserInput.peekNotNumeric = function() { var c = input.charCodeAt(parserInput.i); - //Is the first char of the dimension 0-9, '.', '+' or '-' + // Is the first char of the dimension 0-9, '.', '+' or '-' return (c > CHARCODE_9 || c < CHARCODE_PLUS) || c === CHARCODE_FORWARD_SLASH || c === CHARCODE_COMMA; }; diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js index 71c155ed0..46772b20a 100644 --- a/lib/less/parser/parser.js +++ b/lib/less/parser/parser.js @@ -35,8 +35,8 @@ var LessError = require('../less-error'), // Token matching is done with the `$` function, which either takes // a terminal string or regexp, or a non-terminal function to call. // It also takes care of moving all the indices forwards. -//` // + var Parser = function Parser(context, imports, fileInfo) { var parsers, parserInput = getParserInput(); diff --git a/lib/less/source-map-output.js b/lib/less/source-map-output.js index 35e65cccc..cf0b862ca 100644 --- a/lib/less/source-map-output.js +++ b/lib/less/source-map-output.js @@ -47,7 +47,7 @@ module.exports = function (environment) { SourceMapOutput.prototype.add = function(chunk, fileInfo, index, mapLines) { - //ignore adding empty strings + // ignore adding empty strings if (!chunk) { return; } diff --git a/lib/less/tree/atrule.js b/lib/less/tree/atrule.js index f173a414f..62386b818 100644 --- a/lib/less/tree/atrule.js +++ b/lib/less/tree/atrule.js @@ -61,11 +61,11 @@ AtRule.prototype.genCSS = function (context, output) { AtRule.prototype.eval = function (context) { var mediaPathBackup, mediaBlocksBackup, value = this.value, rules = this.rules; - //media stored inside other atrule should not bubble over it - //backpup media bubbling information + // media stored inside other atrule should not bubble over it + // backpup media bubbling information mediaPathBackup = context.mediaPath; mediaBlocksBackup = context.mediaBlocks; - //deleted media bubbling information + // deleted media bubbling information context.mediaPath = []; context.mediaBlocks = []; @@ -77,7 +77,7 @@ AtRule.prototype.eval = function (context) { rules = [rules[0].eval(context)]; rules[0].root = true; } - //restore media bubbling information + // restore media bubbling information context.mediaPath = mediaPathBackup; context.mediaBlocks = mediaBlocksBackup; diff --git a/lib/less/tree/color.js b/lib/less/tree/color.js index b28f83858..1910f4594 100644 --- a/lib/less/tree/color.js +++ b/lib/less/tree/color.js @@ -132,7 +132,7 @@ Color.prototype.toHSL = function () { } return { h: h * 360, s: s, l: l, a: a }; }; -//Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript +// Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript Color.prototype.toHSV = function () { var r = this.rgb[0] / 255, g = this.rgb[1] / 255, diff --git a/lib/less/tree/dimension.js b/lib/less/tree/dimension.js index 34b23a5b3..aead4df16 100644 --- a/lib/less/tree/dimension.js +++ b/lib/less/tree/dimension.js @@ -61,7 +61,7 @@ Dimension.prototype.genCSS = function (context, output) { // we default to the first Dimension's unit, // so `1px + 2` will yield `3px`. Dimension.prototype.operate = function (context, op, other) { - /*jshint noempty:false */ + /* jshint noempty:false */ var value = this._operate(context, op, this.value, other.value), unit = this.unit.clone(); diff --git a/lib/less/tree/extend.js b/lib/less/tree/extend.js index 0729c5ce7..8d2c37454 100644 --- a/lib/less/tree/extend.js +++ b/lib/less/tree/extend.js @@ -36,7 +36,7 @@ Extend.prototype.eval = function (context) { Extend.prototype.clone = function (context) { return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo()); }; -//it concatenates (joins) all selectors in selector array +// it concatenates (joins) all selectors in selector array Extend.prototype.findSelfSelectors = function (selectors) { var selfElements = [], i, diff --git a/lib/less/tree/js-eval-node.js b/lib/less/tree/js-eval-node.js index b5e37bbe0..24d6594de 100644 --- a/lib/less/tree/js-eval-node.js +++ b/lib/less/tree/js-eval-node.js @@ -31,7 +31,7 @@ JsEvalNode.prototype.evaluateJavaScript = function (expression, context) { var variables = context.frames[0].variables(); for (var k in variables) { if (variables.hasOwnProperty(k)) { - /*jshint loopfunc:true */ + /* jshint loopfunc:true */ evalContext[k.slice(1)] = { value: variables[k].value, toJS: function () { diff --git a/lib/less/tree/mixin-definition.js b/lib/less/tree/mixin-definition.js index 6ad36d208..31b3b39ad 100644 --- a/lib/less/tree/mixin-definition.js +++ b/lib/less/tree/mixin-definition.js @@ -43,7 +43,7 @@ Definition.prototype.accept = function (visitor) { } }; Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArguments) { - /*jshint boss:true */ + /* jshint boss:true */ var frame = new Ruleset(null, null), varargs, arg, params = utils.copyArray(this.params), @@ -156,7 +156,7 @@ Definition.prototype.evalCall = function (context, args, important) { Definition.prototype.matchCondition = function (args, context) { if (this.condition && !this.condition.eval( new contexts.Eval(context, - [this.evalParams(context, /* the parameter variables*/ + [this.evalParams(context, /* the parameter variables */ new contexts.Eval(context, this.frames ? this.frames.concat(context.frames) : context.frames), args, [])] .concat(this.frames || []) // the parent namespace/mixin frames .concat(context.frames)))) { // the current environment frames diff --git a/lib/less/tree/node.js b/lib/less/tree/node.js index 20245c7a6..2de98c6c0 100644 --- a/lib/less/tree/node.js +++ b/lib/less/tree/node.js @@ -63,8 +63,8 @@ Node.prototype._operate = function (context, op, a, b) { }; Node.prototype.fround = function(context, value) { var precision = context && context.numPrecision; - //add "epsilon" to ensure numbers like 1.000000005 (represented as 1.000000004999....) are properly rounded... - return (precision == null) ? value : Number((value + 2e-16).toFixed(precision)); + // add "epsilon" to ensure numbers like 1.000000005 (represented as 1.000000004999...) are properly rounded: + return (precision) ? Number((value + 2e-16).toFixed(precision)) : value; }; Node.compare = function (a, b) { /* returns: @@ -124,13 +124,13 @@ Node.prototype.removeVisibilityBlock = function () { } this.visibilityBlocks = this.visibilityBlocks - 1; }; -//Turns on node visibility - if called node will be shown in output regardless -//of whether it comes from import by reference or not +// Turns on node visibility - if called node will be shown in output regardless +// of whether it comes from import by reference or not Node.prototype.ensureVisibility = function () { this.nodeVisible = true; }; -//Turns off node visibility - if called node will NOT be shown in output regardless -//of whether it comes from import by reference or not +// Turns off node visibility - if called node will NOT be shown in output regardless +// of whether it comes from import by reference or not Node.prototype.ensureInvisibility = function () { this.nodeVisible = false; }; diff --git a/lib/less/tree/ruleset.js b/lib/less/tree/ruleset.js index 23577556c..b8e0c2222 100644 --- a/lib/less/tree/ruleset.js +++ b/lib/less/tree/ruleset.js @@ -122,7 +122,7 @@ Ruleset.prototype.eval = function (context) { // Evaluate mixin calls. for (i = 0; (rule = rsRules[i]); i++) { if (rule.type === "MixinCall") { - /*jshint loopfunc:true */ + /* jshint loopfunc:true */ rules = rule.eval(context).filter(function(r) { if ((r instanceof Declaration) && r.variable) { // do not pollute the scope if the variable is @@ -136,7 +136,7 @@ Ruleset.prototype.eval = function (context) { i += rules.length - 1; ruleset.resetCache(); } else if (rule.type === "RulesetCall") { - /*jshint loopfunc:true */ + /* jshint loopfunc:true */ rules = rule.eval(context).rules.filter(function(r) { if ((r instanceof Declaration) && r.variable) { // do not pollute the scope at all @@ -529,7 +529,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { // our new selector path newSelectorPath = []; - //construct the joined selector - if & is the first thing this will be empty, + // construct the joined selector - if & is the first thing this will be empty, // if not newJoinedSelector will be the last set of elements in the selector if (beginningPath.length > 0) { newSelectorPath = utils.copyArray(beginningPath); @@ -559,7 +559,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { newSelectorPath.push(newJoinedSelector); } - //put together the parent selectors after the join (e.g. the rest of the parent) + // put together the parent selectors after the join (e.g. the rest of the parent) if (addPath.length > 1) { var restOfPath = addPath.slice(1); restOfPath = restOfPath.map(function (selector) { @@ -654,7 +654,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { var nestedPaths = [], replaced, replacedNewSelectors = []; replaced = replaceParentSelector(nestedPaths, context, nestedSelector); hadParentSelector = hadParentSelector || replaced; - //the nestedPaths array should have only one member - replaceParentSelector does not multiply selectors + // the nestedPaths array should have only one member - replaceParentSelector does not multiply selectors for (k = 0; k < nestedPaths.length; k++) { var replacementSelector = createSelector(createParenthesis(nestedPaths[k], el), el); addAllReplacementsIntoPath(newSelectors, [replacementSelector], el, inSelector, replacedNewSelectors); diff --git a/lib/less/tree/unit.js b/lib/less/tree/unit.js index b94a795be..0e27daaad 100644 --- a/lib/less/tree/unit.js +++ b/lib/less/tree/unit.js @@ -65,7 +65,7 @@ Unit.prototype.usedUnits = function() { var group, result = {}, mapUnit, groupName; mapUnit = function (atomicUnit) { - /*jshint loopfunc:true */ + /* jshint loopfunc:true */ if (group.hasOwnProperty(atomicUnit) && !result[groupName]) { result[groupName] = atomicUnit; } diff --git a/lib/less/visitors/extend-visitor.js b/lib/less/visitors/extend-visitor.js index f4d94bf94..5c4128823 100644 --- a/lib/less/visitors/extend-visitor.js +++ b/lib/less/visitors/extend-visitor.js @@ -3,7 +3,7 @@ var tree = require("../tree"), logger = require("../logger"), utils = require("../utils"); -/*jshint loopfunc:true */ +/* jshint loopfunc:true */ var ExtendFinderVisitor = function() { this._visitor = new Visitor(this); @@ -137,7 +137,7 @@ ProcessExtendsVisitor.prototype = { iterationCount = iterationCount || 0; - //loop through comparing every extend with every target extend. + // loop through comparing every extend with every target extend. // a target extend is the one on the ruleset we are looking at copy/edit/pasting in place // e.g. .a:extend(.b) {} and .b:extend(.c) {} then the first extend extends the second one // and the second is the target. @@ -368,7 +368,7 @@ ProcessExtendsVisitor.prototype = { }, extendSelector:function (matches, selectorPath, replacementSelector, isVisible) { - //for a set of matches, replace each match with the replacement selector + // for a set of matches, replace each match with the replacement selector var currentSelectorPathIndex = 0, currentSelectorPathElementIndex = 0, diff --git a/lib/less/visitors/to-css-visitor.js b/lib/less/visitors/to-css-visitor.js index 4e0c7a9ce..861242b1a 100644 --- a/lib/less/visitors/to-css-visitor.js +++ b/lib/less/visitors/to-css-visitor.js @@ -15,8 +15,8 @@ CSSVisitorUtils.prototype = { for (var r = 0; r < bodyRules.length; r++) { rule = bodyRules[r]; if (rule.isSilent && rule.isSilent(this._context) && !rule.blocksVisibility()) { - //the atrule contains something that was referenced (likely by extend) - //therefore it needs to be shown in output too + // the atrule contains something that was referenced (likely by extend) + // therefore it needs to be shown in output too return true; } } @@ -139,9 +139,16 @@ ToCSSVisitor.prototype = { } }, + visitAnonymous: function(anonymousNode, visitArgs) { + if (!anonymousNode.blocksVisibility()) { + anonymousNode.accept(this._visitor); + return anonymousNode; + } + }, + visitAtRuleWithBody: function(atRuleNode, visitArgs) { - //if there is only one nested ruleset and that one has no path, then it is - //just fake ruleset + // if there is only one nested ruleset and that one has no path, then it is + // just fake ruleset function hasFakeRuleset(atRuleNode) { var bodyRules = atRuleNode.rules; return bodyRules.length === 1 && (!bodyRules[0].paths || bodyRules[0].paths.length === 0); @@ -154,9 +161,9 @@ ToCSSVisitor.prototype = { return nodeRules; } - //it is still true that it is only one ruleset in array - //this is last such moment - //process childs + // it is still true that it is only one ruleset in array + // this is last such moment + // process childs var originalRules = getBodyRules(atRuleNode); atRuleNode.accept(this._visitor); visitArgs.visitDeeper = false; @@ -214,13 +221,13 @@ ToCSSVisitor.prototype = { }, visitRuleset: function (rulesetNode, visitArgs) { - //at this point rulesets are nested into each other + // at this point rulesets are nested into each other var rule, rulesets = []; this.checkValidNodes(rulesetNode.rules, rulesetNode.firstRoot); if (!rulesetNode.root) { - //remove invisible paths + // remove invisible paths this._compileRulesetPaths(rulesetNode); // remove rulesets from this ruleset body and compile them separately @@ -246,7 +253,7 @@ ToCSSVisitor.prototype = { } visitArgs.visitDeeper = false; - } else { //if (! rulesetNode.root) { + } else { // if (! rulesetNode.root) { rulesetNode.accept(this._visitor); visitArgs.visitDeeper = false; } @@ -256,7 +263,7 @@ ToCSSVisitor.prototype = { this._removeDuplicateRules(rulesetNode.rules); } - //now decide whether we keep the ruleset + // now decide whether we keep the ruleset if (this.utils.isVisibleRuleset(rulesetNode)) { rulesetNode.ensureVisibility(); rulesets.splice(0, 0, rulesetNode); @@ -347,14 +354,6 @@ ToCSSVisitor.prototype = { result.value = new tree.Value(comma); } }); - }, - - visitAnonymous: function(anonymousNode, visitArgs) { - if (anonymousNode.blocksVisibility()) { - return ; - } - anonymousNode.accept(this._visitor); - return anonymousNode; } }; diff --git a/lib/less/visitors/visitor.js b/lib/less/visitors/visitor.js index fc258108c..cf67040c0 100644 --- a/lib/less/visitors/visitor.js +++ b/lib/less/visitors/visitor.js @@ -11,7 +11,7 @@ function indexNodeTypes(parent, ticker) { // add .typeIndex to tree node types for lookup table var key, child; for (key in parent) { - /*eslint guard-for-in: 0 */ + /* eslint guard-for-in: 0 */ child = parent[key]; switch (typeof child) { case "function": diff --git a/test/browser/common.js b/test/browser/common.js index 98a269947..000215dd7 100644 --- a/test/browser/common.js +++ b/test/browser/common.js @@ -148,7 +148,7 @@ testSheet = function (sheet) { }); }; -//TODO: do it cleaner - the same way as in css +// TODO: do it cleaner - the same way as in css function extractId(href) { return href.replace(/^[a-z-]+:\/+?[^\/]+/i, '') // Remove protocol & domain diff --git a/test/copy-bom.js b/test/copy-bom.js index c806381cd..c3941bf47 100644 --- a/test/copy-bom.js +++ b/test/copy-bom.js @@ -1,4 +1,4 @@ -/*jshint latedef: nofunc */ +/* jshint latedef: nofunc */ // This is used to copy a folder (the test/less/* files & sub-folders), adding a BOM to the start of each LESS and CSS file. // This is a based on the copySync method from fs-extra (https://github.com/jprichardson/node-fs-extra/). diff --git a/test/less-test.js b/test/less-test.js index 119027792..508a23c1d 100644 --- a/test/less-test.js +++ b/test/less-test.js @@ -1,4 +1,4 @@ -/*jshint latedef: nofunc */ +/* jshint latedef: nofunc */ module.exports = function() { var path = require('path'), @@ -45,21 +45,21 @@ module.exports = function() { queueRunning = false; function queue(func) { if (queueRunning) { - //console.log("adding to queue"); + // console.log("adding to queue"); queueList.push(func); } else { - //console.log("first in queue - starting"); + // console.log("first in queue - starting"); queueRunning = true; func(); } } function release() { if (queueList.length) { - //console.log("running next in queue"); + // console.log("running next in queue"); var func = queueList.shift(); setTimeout(func, 0); } else { - //console.log("stopping queue"); + // console.log("stopping queue"); queueRunning = false; } } @@ -282,7 +282,7 @@ module.exports = function() { if (err.stack) { process.stdout.write(err.stack + "\n"); } else { - //this sometimes happen - show the whole error object + // this sometimes happen - show the whole error object console.log(err); } } diff --git a/test/less/plugin/plugin-tree-nodes.js b/test/less/plugin/plugin-tree-nodes.js index 11f5a1de5..eec94adaa 100644 --- a/test/less/plugin/plugin-tree-nodes.js +++ b/test/less/plugin/plugin-tree-nodes.js @@ -7,19 +7,19 @@ functions.addMultiple({ return less.AtRule(arg1.value, arg2.value); }, "test-extend": function() { - //TODO + // TODO }, "test-import": function() { - //TODO + // TODO }, "test-media": function() { - //TODO + // TODO }, "test-mixin-call": function() { - //TODO + // TODO }, "test-mixin-definition": function() { - //TODO + // TODO }, "test-ruleset-call": function() { return less.Combinator(' '); From 632f96b55df5381937b68b57cb4bf0259d576ea5 Mon Sep 17 00:00:00 2001 From: Max Mikhailov Date: Thu, 1 Jun 2017 12:30:02 +0300 Subject: [PATCH 64/97] rename RulesetCall to VariableCall --- lib/less/parser/parser.js | 6 +++--- lib/less/tree/index.js | 2 +- lib/less/tree/ruleset.js | 2 +- lib/less/tree/{ruleset-call.js => variable-call.js} | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) rename lib/less/tree/{ruleset-call.js => variable-call.js} (54%) diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js index 46772b20a..9ee17efa5 100644 --- a/lib/less/parser/parser.js +++ b/lib/less/parser/parser.js @@ -314,7 +314,7 @@ var Parser = function Parser(context, imports, fileInfo) { } node = mixin.definition() || this.declaration() || this.ruleset() || - mixin.call() || this.rulesetCall() || this.entities.call() || this.atrule(); + mixin.call() || this.variableCall() || this.entities.call() || this.atrule(); if (node) { root.push(node); } else { @@ -691,11 +691,11 @@ var Parser = function Parser(context, imports, fileInfo) { // // @fink(); // - rulesetCall: function () { + variableCall: function () { var name; if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^(@[\w-]+)\(\s*\)\s*;/))) { - return new tree.RulesetCall(name[1]); + return new tree.VariableCall(name[1]); } }, diff --git a/lib/less/tree/index.js b/lib/less/tree/index.js index 5c8f0ddf6..f22cd4c35 100644 --- a/lib/less/tree/index.js +++ b/lib/less/tree/index.js @@ -41,6 +41,6 @@ tree.Media = require('./media'); tree.UnicodeDescriptor = require('./unicode-descriptor'); tree.Negative = require('./negative'); tree.Extend = require('./extend'); -tree.RulesetCall = require('./ruleset-call'); +tree.VariableCall = require('./variable-call'); module.exports = tree; diff --git a/lib/less/tree/ruleset.js b/lib/less/tree/ruleset.js index b8e0c2222..8c2ff3956 100644 --- a/lib/less/tree/ruleset.js +++ b/lib/less/tree/ruleset.js @@ -135,7 +135,7 @@ Ruleset.prototype.eval = function (context) { rsRules.splice.apply(rsRules, [i, 1].concat(rules)); i += rules.length - 1; ruleset.resetCache(); - } else if (rule.type === "RulesetCall") { + } else if (rule.type === "VariableCall") { /* jshint loopfunc:true */ rules = rule.eval(context).rules.filter(function(r) { if ((r instanceof Declaration) && r.variable) { diff --git a/lib/less/tree/ruleset-call.js b/lib/less/tree/variable-call.js similarity index 54% rename from lib/less/tree/ruleset-call.js rename to lib/less/tree/variable-call.js index d271c8ddd..b24fd7d53 100644 --- a/lib/less/tree/ruleset-call.js +++ b/lib/less/tree/variable-call.js @@ -1,14 +1,14 @@ var Node = require("./node"), Variable = require("./variable"); -var RulesetCall = function (variable) { +var VariableCall = function (variable) { this.variable = variable; this.allowRoot = true; }; -RulesetCall.prototype = new Node(); -RulesetCall.prototype.type = "RulesetCall"; -RulesetCall.prototype.eval = function (context) { +VariableCall.prototype = new Node(); +VariableCall.prototype.type = "VariableCall"; +VariableCall.prototype.eval = function (context) { var detachedRuleset = new Variable(this.variable).eval(context); return detachedRuleset.callEval(context); }; -module.exports = RulesetCall; +module.exports = VariableCall; From 10db21c3b52be72da2bee7344af076bcc2c83063 Mon Sep 17 00:00:00 2001 From: Max Mikhailov Date: Thu, 1 Jun 2017 13:06:58 +0300 Subject: [PATCH 65/97] optional ; after VariableCall at the end of {} block i.e. allow `div {@var()}` to become consistent with the rest of CSS/Less syntax --- lib/less/parser/parser.js | 8 +++++--- test/less/detached-rulesets.less | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js index 9ee17efa5..1b97560bb 100644 --- a/lib/less/parser/parser.js +++ b/lib/less/parser/parser.js @@ -687,14 +687,16 @@ var Parser = function Parser(context, imports, fileInfo) { }, // - // The variable part of a variable definition. Used in the `rule` parser + // Call a variable value // - // @fink(); + // @fink() // variableCall: function () { var name; - if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^(@[\w-]+)\(\s*\)\s*;/))) { + if (parserInput.currentChar() === '@' + && (name = parserInput.$re(/^(@[\w-]+)\(\s*\)/)) + && parsers.end()) { return new tree.VariableCall(name[1]); } }, diff --git a/test/less/detached-rulesets.less b/test/less/detached-rulesets.less index 0475f6354..be3ff3cab 100644 --- a/test/less/detached-rulesets.less +++ b/test/less/detached-rulesets.less @@ -31,8 +31,8 @@ .wrap-mixin(@ruleset); .desktop-and-old-ie(@rules) { - @media screen and (min-width: 1200) { @rules(); } - html.lt-ie9 & { @rules(); } + @media screen and (min-width: 1200) { @rules() } + html.lt-ie9 & { @rules() } } header { From 006ce2651dda6a808a7455ec1db079217792e1a9 Mon Sep 17 00:00:00 2001 From: Max Mikhailov Date: Wed, 7 Jun 2017 16:31:35 +0300 Subject: [PATCH 66/97] special functions: add `boolean` and `if`, clean up `alpha` --- lib/less/functions/boolean.js | 15 ++++ lib/less/functions/index.js | 1 + lib/less/parser/parser.js | 107 +++++++++++++++--------- lib/less/tree/alpha.js | 28 ------- lib/less/tree/index.js | 1 - test/css/functions.css | 13 +++ test/less/errors/functions-2-alpha.less | 2 - test/less/errors/functions-2-alpha.txt | 3 - test/less/functions.less | 17 ++++ test/less/plugin/plugin-tree-nodes.js | 3 - 10 files changed, 112 insertions(+), 78 deletions(-) create mode 100644 lib/less/functions/boolean.js delete mode 100644 lib/less/tree/alpha.js delete mode 100644 test/less/errors/functions-2-alpha.less delete mode 100644 test/less/errors/functions-2-alpha.txt diff --git a/lib/less/functions/boolean.js b/lib/less/functions/boolean.js new file mode 100644 index 000000000..21254bc3d --- /dev/null +++ b/lib/less/functions/boolean.js @@ -0,0 +1,15 @@ + +var functionRegistry = require("./function-registry"), + Anonymous = require("../tree/anonymous"), + Keyword = require("../tree/keyword"); + +functionRegistry.addMultiple({ + boolean: function(condition) { + return condition ? Keyword.True : Keyword.False; + }, + + 'if': function(condition, trueValue, falseValue) { + return condition ? trueValue + : (falseValue || new Anonymous); + } +}); diff --git a/lib/less/functions/index.js b/lib/less/functions/index.js index 4b17556d2..3b697d53b 100644 --- a/lib/less/functions/index.js +++ b/lib/less/functions/index.js @@ -5,6 +5,7 @@ module.exports = function(environment) { }; // register functions + require("./boolean"); require("./default"); require("./color"); require("./color-blending"); diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js index 1b97560bb..52cf6489f 100644 --- a/lib/less/parser/parser.js +++ b/lib/less/parser/parser.js @@ -383,13 +383,10 @@ var Parser = function Parser(context, imports, fileInfo) { // // rgb(255, 0, 255) // - // We also try to catch IE's `alpha()`, but let the `alpha` parser - // deal with the details. - // // The arguments are parsed with the `entities.arguments` parser. // call: function () { - var name, nameLC, args, alpha, index = parserInput.i; + var name, args, func, index = parserInput.i; // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18 if (parserInput.peek(/^url\(/i)) { @@ -399,20 +396,22 @@ var Parser = function Parser(context, imports, fileInfo) { parserInput.save(); name = parserInput.$re(/^([\w-]+|%|progid:[\w\.]+)\(/); - if (!name) { parserInput.forget(); return; } + if (!name) { + parserInput.forget(); + return; + } name = name[1]; - nameLC = name.toLowerCase(); - - if (nameLC === 'alpha') { - alpha = parsers.alpha(); - if (alpha) { + func = this.customFuncCall(name); + if (func) { + args = func.parse(); + if (args && func.stop) { parserInput.forget(); - return alpha; + return args; } } - args = this.arguments(); + args = this.arguments(args); if (!parserInput.$char(')')) { parserInput.restore("Could not parse call arguments or missing ')'"); @@ -422,47 +421,72 @@ var Parser = function Parser(context, imports, fileInfo) { parserInput.forget(); return new(tree.Call)(name, args, index, fileInfo); }, - arguments: function () { - var argsSemiColon = [], argsComma = [], - expressions = [], - isSemiColonSeparated, value, arg; - - parserInput.save(); + + // + // Parsing rules for functions with non-standard args, e.g.: + // + // boolean(not(2 > 1)) + // + // This is a quick prototype, to be modified/improved when + // more custom-parsed funcs come (e.g. `selector(...)`) + // - while (true) { + customFuncCall: function (name) { + /* Ideally the table is to be moved out of here for faster perf., + but it's quite tricky since it relies on all these `parsers` + and `expect` available only here */ + return { + alpha: f(parsers.ieAlpha, true), + boolean: f(condition), + 'if': f(condition) + }[name.toLowerCase()]; + + function f(parse, stop) { + return { + parse: parse, // parsing function + stop: stop // when true - stop after parse() and return its result, + // otherwise continue for plain args + }; + } + + function condition() { + return [expect(parsers.condition, 'expected condition')]; + } + }, - arg = parsers.detachedRuleset() || this.assignment() || parsers.expression(); + arguments: function (prevArgs) { + var argsComma = prevArgs || [], + argsSemiColon = [], + isSemiColonSeparated, value; - if (!arg) { - break; - } + parserInput.save(); - value = arg; + while (true) { + if (prevArgs) { + prevArgs = false; + } else { + value = parsers.detachedRuleset() || this.assignment() || parsers.expression(); + if (!value) { + break; + } - if (arg.value && arg.value.length == 1) { - value = arg.value[0]; - } + if (value.value && value.value.length == 1) { + value = value.value[0]; + } - if (value) { - expressions.push(value); + argsComma.push(value); } - argsComma.push(value); - if (parserInput.$char(',')) { continue; } if (parserInput.$char(';') || isSemiColonSeparated) { - isSemiColonSeparated = true; - - if (expressions.length > 1) { - value = new(tree.Value)(expressions); - } + value = (argsComma.length < 1) ? argsComma[0] + : new tree.Value(argsComma); argsSemiColon.push(value); - - expressions = []; + argsComma = []; } } @@ -1019,17 +1043,18 @@ var Parser = function Parser(context, imports, fileInfo) { // // alpha(opacity=88) // - alpha: function () { + ieAlpha: function () { var value; // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18 if (!parserInput.$re(/^opacity=/i)) { return; } value = parserInput.$re(/^\d+/); if (!value) { - value = expect(this.entities.variable, "Could not parse alpha"); + value = expect(parsers.entities.variable, "Could not parse alpha"); + value = '@{' + value.name.slice(1) + '}'; } expectChar(')'); - return new(tree.Alpha)(value); + return new tree.Quoted('', 'alpha(opacity=' + value + ')'); }, // diff --git a/lib/less/tree/alpha.js b/lib/less/tree/alpha.js deleted file mode 100644 index 82a4ce5e8..000000000 --- a/lib/less/tree/alpha.js +++ /dev/null @@ -1,28 +0,0 @@ -var Node = require("./node"); - -var Alpha = function (val) { - this.value = val; -}; -Alpha.prototype = new Node(); -Alpha.prototype.type = "Alpha"; - -Alpha.prototype.accept = function (visitor) { - this.value = visitor.visit(this.value); -}; -Alpha.prototype.eval = function (context) { - if (this.value.eval) { return new Alpha(this.value.eval(context)); } - return this; -}; -Alpha.prototype.genCSS = function (context, output) { - output.add("alpha(opacity="); - - if (this.value.genCSS) { - this.value.genCSS(context, output); - } else { - output.add(this.value); - } - - output.add(")"); -}; - -module.exports = Alpha; diff --git a/lib/less/tree/index.js b/lib/less/tree/index.js index f22cd4c35..7a6f46f0d 100644 --- a/lib/less/tree/index.js +++ b/lib/less/tree/index.js @@ -1,7 +1,6 @@ var tree = Object.create(null); tree.Node = require('./node'); -tree.Alpha = require('./alpha'); tree.Color = require('./color'); tree.AtRule = require('./atrule'); // Backwards compatibility diff --git a/test/css/functions.css b/test/css/functions.css index ab5df5bb5..f4144ea2c 100644 --- a/test/css/functions.css +++ b/test/css/functions.css @@ -199,3 +199,16 @@ html { color: #8080ff; } +#boolean { + a: true; + b: false; + c: false; +} +#if { + a: 1; + b: 2; + c: 3; + e: ; + f: 6; + /* results in void */ +} diff --git a/test/less/errors/functions-2-alpha.less b/test/less/errors/functions-2-alpha.less deleted file mode 100644 index f00da0788..000000000 --- a/test/less/errors/functions-2-alpha.less +++ /dev/null @@ -1,2 +0,0 @@ -@plugin "../plugin/plugin-tree-nodes"; -test-alpha(); \ No newline at end of file diff --git a/test/less/errors/functions-2-alpha.txt b/test/less/errors/functions-2-alpha.txt deleted file mode 100644 index 38a172731..000000000 --- a/test/less/errors/functions-2-alpha.txt +++ /dev/null @@ -1,3 +0,0 @@ -SyntaxError: Alpha node returned by a function is not valid here in {path}functions-2-alpha.less on line 2, column 1: -1 @plugin "../plugin/plugin-tree-nodes"; -2 test-alpha(); diff --git a/test/less/functions.less b/test/less/functions.less index 74a2b2061..ad8682931 100644 --- a/test/less/functions.less +++ b/test/less/functions.less @@ -231,3 +231,20 @@ html { color: mix(blue, @color2, 50%); } +#boolean { + a: boolean(not(2 < 1)); + b: boolean(not(2 > 1) and (true)); + c: boolean(not(boolean((true)))); +} + +#if { + a: if(not(false), 1, 2); + b: if(not(true), 1, 2); + @1: if(not(false), {c: 3}, {d: 4}); @1(); + + e: if(not(true), 5); + @f: boolean((3 = 4)); + f: if(not(@f), 6); + + if((false), {g: 7}); /* results in void */ +} diff --git a/test/less/plugin/plugin-tree-nodes.js b/test/less/plugin/plugin-tree-nodes.js index eec94adaa..96c7760f4 100644 --- a/test/less/plugin/plugin-tree-nodes.js +++ b/test/less/plugin/plugin-tree-nodes.js @@ -32,9 +32,6 @@ functions.addMultiple({ return true; }, // These cause root errors - "test-alpha": function() { - return less.Alpha(30); - }, "test-assignment": function() { return less.Assignment("bird", "robin"); }, From 3f353a8bfd737d95c823badc99fb2191566f5b25 Mon Sep 17 00:00:00 2001 From: Max Mikhailov Date: Thu, 8 Jun 2017 09:44:56 +0300 Subject: [PATCH 67/97] do not evaluate backticks in strings as inline-js --- lib/less/tree/quoted.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/less/tree/quoted.js b/lib/less/tree/quoted.js index 33fa3033d..aba6d60c0 100644 --- a/lib/less/tree/quoted.js +++ b/lib/less/tree/quoted.js @@ -10,7 +10,7 @@ var Quoted = function (str, content, escaped, index, currentFileInfo) { this._index = index; this._fileInfo = currentFileInfo; }; -Quoted.prototype = new JsEvalNode(); +Quoted.prototype = new Node(); Quoted.prototype.type = "Quoted"; Quoted.prototype.genCSS = function (context, output) { if (!this.escaped) { @@ -22,13 +22,10 @@ Quoted.prototype.genCSS = function (context, output) { } }; Quoted.prototype.containsVariables = function() { - return this.value.match(/(`([^`]+)`)|@\{([\w-]+)\}/); + return this.value.match(/@\{([\w-]+)\}/); }; Quoted.prototype.eval = function (context) { var that = this, value = this.value; - var javascriptReplacement = function (_, exp) { - return String(that.evaluateJavaScript(exp, context)); - }; var variableReplacement = function (_, name) { var v = new Variable('@' + name, that.getIndex(), that.fileInfo()).eval(context, true); return (v instanceof Quoted) ? v.value : v.toCSS(); @@ -45,7 +42,6 @@ Quoted.prototype.eval = function (context) { } while (value !== evaluatedValue); return evaluatedValue; } - value = iterativeReplace(value, /`([^`]+)`/g, javascriptReplacement); value = iterativeReplace(value, /@\{([\w-]+)\}/g, variableReplacement); value = iterativeReplace(value, /\$\{([\w-]+)\}/g, propertyReplacement); return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo()); From faafd33b561a627466e18a3a2b26eb96fa993c27 Mon Sep 17 00:00:00 2001 From: Max Mikhailov Date: Thu, 8 Jun 2017 10:00:26 +0300 Subject: [PATCH 68/97] do not ignore strict-math:off in media-features !breaking change, fixes #1480 --- lib/less/tree/media.js | 15 ++------------- test/css/legacy/legacy.css | 2 +- test/less/legacy/legacy.less | 2 +- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/lib/less/tree/media.js b/lib/less/tree/media.js index 5acb76137..6cd821436 100644 --- a/lib/less/tree/media.js +++ b/lib/less/tree/media.js @@ -48,19 +48,8 @@ Media.prototype.eval = function (context) { this.rules[0].debugInfo = this.debugInfo; media.debugInfo = this.debugInfo; } - var strictMathBypass = false; - if (!context.strictMath) { - strictMathBypass = true; - context.strictMath = true; - } - try { - media.features = this.features.eval(context); - } - finally { - if (strictMathBypass) { - context.strictMath = false; - } - } + + media.features = this.features.eval(context); context.mediaPath.push(media); context.mediaBlocks.push(media); diff --git a/test/css/legacy/legacy.css b/test/css/legacy/legacy.css index 24a6fa5fa..bd675a85b 100644 --- a/test/css/legacy/legacy.css +++ b/test/css/legacy/legacy.css @@ -1,4 +1,4 @@ -@media (-o-min-device-pixel-ratio: 2/1) { +@media (-o-min-device-pixel-ratio: 2) { .test-math-and-units { font: ignores 0/0 rules; test-division: 7em; diff --git a/test/less/legacy/legacy.less b/test/less/legacy/legacy.less index 4367423d2..654b2040d 100644 --- a/test/less/legacy/legacy.less +++ b/test/less/legacy/legacy.less @@ -1,4 +1,4 @@ -@media (-o-min-device-pixel-ratio: 2/1) { +@media (-o-min-device-pixel-ratio: 2) { .test-math-and-units { font: ignores 0/0 rules; test-division: 4 / 2 + 5em; From 9fd1ef5759f0c2db664c3818da24bcf557e27275 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Thu, 8 Jun 2017 12:50:40 -0700 Subject: [PATCH 69/97] Pushing WIP of changes to file manager to track changes --- Gruntfile.js | 5 +- lib/less-browser/index.js | 8 +- lib/less-node/file-manager.js | 126 ++++++++++++------ lib/less-node/index.js | 6 +- lib/less-node/plugin-loader.js | 41 +++--- lib/less/environment/abstract-file-manager.js | 25 ++-- lib/less/import-manager.js | 77 +++++++---- lib/less/parse.js | 9 +- lib/less/render.js | 8 +- lib/less/utils.js | 30 +++++ package.json | 1 + test/less/plugin-module.less | 3 + test/less/plugin.less | 2 +- 13 files changed, 231 insertions(+), 110 deletions(-) create mode 100644 test/less/plugin-module.less diff --git a/Gruntfile.js b/Gruntfile.js index 02fe46f9c..5dae96048 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -2,6 +2,9 @@ module.exports = function (grunt) { + + grunt.option('stack', true) + // Report the elapsed execution time of tasks. require('time-grunt')(grunt); @@ -438,7 +441,7 @@ module.exports = function (grunt) { 'uglify:dist' ]); - // Release Rhino Version + // Release Rhino Version (UNSUPPORTED) grunt.registerTask('rhino', [ 'browserify:rhino', 'concat:rhino', diff --git a/lib/less-browser/index.js b/lib/less-browser/index.js index 5fc2a2b44..348259180 100644 --- a/lib/less-browser/index.js +++ b/lib/less-browser/index.js @@ -30,13 +30,7 @@ module.exports = function(window, options) { var typePattern = /^text\/(x-)?less$/; function clone(obj) { - var cloned = {}; - for (var prop in obj) { - if (obj.hasOwnProperty(prop)) { - cloned[prop] = obj[prop]; - } - } - return cloned; + return JSON.parse(JSON.stringify(obj || {})); } // only really needed for phantom diff --git a/lib/less-node/file-manager.js b/lib/less-node/file-manager.js index 95387de73..39c3b04e4 100644 --- a/lib/less-node/file-manager.js +++ b/lib/less-node/file-manager.js @@ -1,14 +1,10 @@ var path = require('path'), fs = require('./fs'), - PromiseConstructor, + PromiseConstructor = typeof Promise === 'undefined' ? require('promise') : Promise, AbstractFileManager = require("../less/environment/abstract-file-manager.js"); -try { - PromiseConstructor = typeof Promise === 'undefined' ? require('promise') : Promise; -} catch (e) { -} - var FileManager = function() { + this.files = {}; }; FileManager.prototype = new AbstractFileManager(); @@ -20,46 +16,85 @@ FileManager.prototype.supportsSync = function(filename, currentDirectory, option return true; }; -FileManager.prototype.loadFile = function(filename, currentDirectory, options, environment, callback) { +FileManager.prototype.loadFile = function(filename, currentDirectory, options, environment) { + + // TODO refactor so isn't cut and paste between loadFileSync var fullFilename, data, isAbsoluteFilename = this.isPathAbsolute(filename), - filenamesTried = []; + filenamesTried = [], + self = this, + prefix = filename.slice(0, 1), + explicit = prefix === "." || prefix === "/"; options = options || {}; - if (options.syncImport || !PromiseConstructor) { - data = this.loadFileSync(filename, currentDirectory, options, environment, 'utf-8'); - callback(data.error, data); - return; - } + var paths = isAbsoluteFilename ? [''] : [currentDirectory]; - var paths = isAbsoluteFilename ? [""] : [currentDirectory]; if (options.paths) { paths.push.apply(paths, options.paths); } + + // Search node_modules + if (!explicit) { paths.push.apply(paths, this.modulePaths); } + if (!isAbsoluteFilename && paths.indexOf('.') === -1) { paths.push('.'); } + var prefixes = options.prefixes || ['']; + var fileParts = this.extractUrlParts(filename); + // promise is guaranteed to be asyncronous // which helps as it allows the file handle // to be closed before it continues with the next file return new PromiseConstructor(function(fulfill, reject) { + if (options.syncImport) { + data = this.loadFileSync(filename, currentDirectory, options, environment, 'utf-8'); + if (data.error) { + reject(data.error); + } + else { + fulfill(data); + } + return; + } (function tryPathIndex(i) { if (i < paths.length) { - fullFilename = filename; - if (paths[i]) { - fullFilename = path.join(paths[i], fullFilename); - } - fs.stat(fullFilename, function (err) { - if (err) { - filenamesTried.push(fullFilename); - tryPathIndex(i + 1); - } else { - fs.readFile(fullFilename, 'utf-8', function(e, data) { - if (e) { reject(e); return; } + (function tryPrefix(j) { + if (j < prefixes.length) { + + fullFilename = fileParts.rawPath + prefixes[j] + fileParts.filename; + + if (paths[i]) { + fullFilename = path.join(paths[i], fullFilename); + } + if (paths[i].indexOf('node_modules') > -1) { + try { + fullFilename = require.resolve(fullFilename); + } + catch (e) {} + } + else { + fullFilename = options.ext ? self.tryAppendExtension(fullFilename, options.ext) : fullFilename; + } + + if (self.files[fullFilename]) { + fulfill({ contents: self.files[fullFilename], filename: fullFilename}); + } + else { + + fs.readFile(fullFilename, 'utf-8', function(e, data) { + if (e) { + filenamesTried.push(fullFilename); + return tryPrefix(j + 1); + } + self.files[fullFilename] = data; + fulfill({ contents: data, filename: fullFilename}); + }); + } - fulfill({ contents: data, filename: fullFilename}); - }); } - }); + else { + tryPathIndex(i + 1); + } + })(0); } else { reject({ type: 'File', message: "'" + filename + "' wasn't found. Tried - " + filenamesTried.join(",") }); } @@ -79,26 +114,39 @@ FileManager.prototype.loadFileSync = function(filename, currentDirectory, option paths.push('.'); } - var err, result; + var prefixes = options.prefixes || ['']; + var fileParts = this.extractUrlParts(filename); + + var err, result, breakAll = false; for (var i = 0; i < paths.length; i++) { - try { - fullFilename = filename; - if (paths[i]) { - fullFilename = path.join(paths[i], fullFilename); + for (var j = 0; j < prefixes.length; j++) { + try { + fullFilename = fileParts.rawPath + prefixes[j] + fileParts.filename; + if (paths[i]) { + fullFilename = path.join(paths[i], fullFilename); + } + filenamesTried.push(fullFilename); + fs.statSync(fullFilename); + breakAll = true; + break; + } catch (e) { + fullFilename = null; } - filenamesTried.push(fullFilename); - fs.statSync(fullFilename); - break; - } catch (e) { - fullFilename = null; } + if (breakAll) { break; } } if (!fullFilename) { err = { type: 'File', message: "'" + filename + "' wasn't found. Tried - " + filenamesTried.join(",") }; result = { error: err }; } else { - data = fs.readFileSync(fullFilename, encoding); + if (this.files[fullFilename]) { + data = this.files[fullFilename]; + } + else { + data = fs.readFileSync(fullFilename, encoding); + this.files[fullFilename] = data; + } result = { contents: data, filename: fullFilename}; } diff --git a/lib/less-node/index.js b/lib/less-node/index.js index 153f54b52..b0d222b48 100644 --- a/lib/less-node/index.js +++ b/lib/less-node/index.js @@ -3,7 +3,8 @@ var environment = require("./environment"), UrlFileManager = require("./url-file-manager"), createFromEnvironment = require("../less"), less = createFromEnvironment(environment, [new FileManager(), new UrlFileManager()]), - lesscHelper = require('./lessc-helper'); + lesscHelper = require('./lessc-helper'), + path = require('path'); // allow people to create less with their own environment less.createFromEnvironment = createFromEnvironment; @@ -13,6 +14,9 @@ less.fs = require("./fs"); less.FileManager = FileManager; less.UrlFileManager = UrlFileManager; less.options = require('../less/default-options'); +less.options.paths = [ + path.join(process.cwd(), "node_modules") +]; // provide image-size functionality require('./image-size')(less.environment); diff --git a/lib/less-node/plugin-loader.js b/lib/less-node/plugin-loader.js index 942719e7e..7fb503499 100644 --- a/lib/less-node/plugin-loader.js +++ b/lib/less-node/plugin-loader.js @@ -1,4 +1,5 @@ var path = require("path"), + PromiseConstructor = typeof Promise === 'undefined' ? require('promise') : Promise, AbstractPluginLoader = require("../less/environment/abstract-plugin-loader.js"); /** @@ -6,8 +7,7 @@ var path = require("path"), */ var PluginLoader = function(less) { this.less = less; - this.require = require; - this.requireRelative = function(prefix) { + this.require = function(prefix) { prefix = path.dirname(prefix); return function(id) { var str = id.substr(0, 2); @@ -23,24 +23,31 @@ var PluginLoader = function(less) { PluginLoader.prototype = new AbstractPluginLoader(); -PluginLoader.prototype.tryLoadPlugin = function(name, basePath, callback) { +PluginLoader.prototype.loadPlugin = function(filename, basePath, context, environment, fileManager) { var self = this; - var prefix = name.slice(0, 1); - var explicit = prefix === "." || prefix === "/" || name.slice(-3).toLowerCase() === ".js"; - if (explicit) { - this.tryLoadFromEnvironment(name, basePath, explicit, callback); - } - else { - this.tryLoadFromEnvironment('less-plugin-' + name, basePath, explicit, function(err, data) { - if (!err) { - callback(null, data); - } - else { - self.tryLoadFromEnvironment(name, basePath, explicit, callback); - } - }); + var prefixes, prefix = filename.slice(0, 1); + var explicit = prefix === "." || prefix === "/" || filename.slice(-3).toLowerCase() === ".js"; + if (!explicit) { + context.prefixes = ['less-plugin-', '']; } + return fileManager.loadFile(filename, basePath, context, environment); + // return new PromiseConstructor(function(fulfill, reject) { + // fileManager.loadFile(filename, basePath, context, environment).then( + // function(data) { + // try { + // self.require = self.requireRelative(filename); + // fulfill(data); + // } + // catch (e) { + // reject(e); + // } + // } + // ).catch(function(err) { + // reject(err); + // }); + // }); + }; PluginLoader.prototype.tryLoadFromEnvironment = function(name, basePath, explicit, callback) { diff --git a/lib/less/environment/abstract-file-manager.js b/lib/less/environment/abstract-file-manager.js index 40b977921..81a8c4533 100644 --- a/lib/less/environment/abstract-file-manager.js +++ b/lib/less/environment/abstract-file-manager.js @@ -76,7 +76,7 @@ abstractFileManager.prototype.extractUrlParts = function extractUrlParts(url, ba var urlPartsRegex = /^((?:[a-z-]+:)?\/{2}(?:[^\/\?#]*\/)|([\/\\]))?((?:[^\/\\\?#]*[\/\\])*)([^\/\\\?#]*)([#\?].*)?$/i, urlParts = url.match(urlPartsRegex), - returner = {}, directories = [], i, baseUrlParts; + returner = {}, rawDirectories = [], directories = [], i, d, baseUrlParts; if (!urlParts) { throw new Error("Could not parse sheet href - '" + url + "'"); @@ -95,26 +95,25 @@ abstractFileManager.prototype.extractUrlParts = function extractUrlParts(url, ba } if (urlParts[3]) { - directories = urlParts[3].replace(/\\/g, "/").split("/"); + rawDirectories = urlParts[3].replace(/\\/g, "/").split("/"); - // extract out . before .. so .. doesn't absorb a non-directory - for (i = 0; i < directories.length; i++) { - if (directories[i] === ".") { - directories.splice(i, 1); - i -= 1; - } - } + // collapse '..' and skip '.' + for (d = 0, i = 0; i < rawDirectories.length; i++) { - for (i = 0; i < directories.length; i++) { - if (directories[i] === ".." && i > 0) { - directories.splice(i - 1, 2); - i -= 2; + if (rawDirectories[i] === ".." && d > 0) { + d -= 1; + } + else if (rawDirectories[i] !== ".") { + directories[d] = rawDirectories[i]; + d++; } + } } returner.hostPart = urlParts[1]; returner.directories = directories; + returner.rawPath = (urlParts[1] || "") + rawDirectories.join("/"); returner.path = (urlParts[1] || "") + directories.join("/"); returner.filename = urlParts[4]; returner.fileUrl = returner.path + (urlParts[4] || ""); diff --git a/lib/less/import-manager.js b/lib/less/import-manager.js index 4d298b96a..e2254b3db 100644 --- a/lib/less/import-manager.js +++ b/lib/less/import-manager.js @@ -26,6 +26,29 @@ module.exports = function(environment) { this.queue = []; // Files which haven't been imported yet this.files = {}; // Holds the imported parse trees. }; + + function clone(obj) { + var cloned = {}; + for (var prop in obj) { + if (obj.hasOwnProperty(prop)) { + cloned[prop] = obj[prop]; + } + } + return cloned; + } + function isEqual(obj1, obj2) { + var equal = true; + for (var prop in obj1) { + if (obj1.hasOwnProperty(prop)) { + if (obj1[prop] !== obj2[prop]) { + equal = false; + break; + } + } + } + return equal; + } + /** * Add an import to be imported * @param path - the raw path @@ -48,7 +71,9 @@ module.exports = function(environment) { callback(null, {rules:[]}, false, null); } else { - importManager.files[fullPath] = root; + if (!importManager.files[fullPath]) { + importManager.files[fullPath] = { root: root, options: importOptions }; + } if (e && !importManager.error) { importManager.error = e; } callback(e, root, importedEqualsRoot, fullPath); } @@ -68,10 +93,6 @@ module.exports = function(environment) { return; } - if (tryAppendExtension) { - path = importOptions.isPlugin ? path : fileManager.tryAppendExtension(path, ".less"); - } - var loadFileCallback = function(loadedFile) { var plugin, resolvedFilename = loadedFile.filename, @@ -117,34 +138,38 @@ module.exports = function(environment) { } else if (importOptions.inline) { fileParsedFunc(null, contents, resolvedFilename); } else { - new Parser(newEnv, importManager, newFileInfo).parse(contents, function (e, root) { - fileParsedFunc(e, root, resolvedFilename); - }); - } - }; - var promise; - var done = function(err, loadedFile) { - if (err) { - fileParsedFunc(err); - } else { - loadFileCallback(loadedFile); + + // import (multiple) parse trees apparently get altered and can't be cached. + // TODO: investigate why this is + if (importManager.files[resolvedFilename] + && !importManager.files[resolvedFilename].options.multiple + && !importOptions.multiple) { + + fileParsedFunc(null, importManager.files[resolvedFilename].root, resolvedFilename); + } + else { + new Parser(newEnv, importManager, newFileInfo).parse(contents, function (e, root) { + fileParsedFunc(e, root, resolvedFilename); + }); + } } }; + var promise, context = clone(this.context); + var prefix, explicit; + + if (tryAppendExtension) { + context.ext = importOptions.isPlugin ? ".js" : ".less"; + } + if (importOptions.isPlugin) { - try { - pluginLoader.tryLoadPlugin(path, currentFileInfo.currentDirectory, done); - } - catch (e) { - callback(e); - } + promise = pluginLoader.loadPlugin(path, currentFileInfo.currentDirectory, context, environment, fileManager); } else { - promise = fileManager.loadFile(path, currentFileInfo.currentDirectory, this.context, environment, done); - if (promise) { - promise.then(loadFileCallback, fileParsedFunc); - } + promise = fileManager.loadFile(path, currentFileInfo.currentDirectory, context, environment); } + promise.then(loadFileCallback).catch(fileParsedFunc); + }; return ImportManager; }; diff --git a/lib/less/parse.js b/lib/less/parse.js index 125bdff4f..c2ff30d88 100644 --- a/lib/less/parse.js +++ b/lib/less/parse.js @@ -2,15 +2,18 @@ var PromiseConstructor, contexts = require("./contexts"), Parser = require('./parser/parser'), PluginManager = require('./plugin-manager'), - LessError = require('./less-error'); + LessError = require('./less-error'), + utils = require('./utils'); module.exports = function(environment, ParseTree, ImportManager) { var parse = function (input, options, callback) { - options = options || {}; if (typeof options === 'function') { callback = options; - options = {}; + options = utils.defaults(this.options, {}); + } + else { + options = utils.defaults(this.options, options || {}); } if (!callback) { diff --git a/lib/less/render.js b/lib/less/render.js index 95a191dd4..1743f352e 100644 --- a/lib/less/render.js +++ b/lib/less/render.js @@ -1,10 +1,14 @@ -var PromiseConstructor; +var PromiseConstructor, + utils = require('./utils'); module.exports = function(environment, ParseTree, ImportManager) { var render = function (input, options, callback) { if (typeof options === 'function') { callback = options; - options = {}; + options = utils.defaults(this.options, {}); + } + else { + options = utils.defaults(this.options, options || {}); } if (!callback) { diff --git a/lib/less/utils.js b/lib/less/utils.js index 784158735..d1a97d8d9 100644 --- a/lib/less/utils.js +++ b/lib/less/utils.js @@ -27,6 +27,36 @@ module.exports = { } return copy; }, + defaults: function(obj1, obj2) { + if (!obj2._defaults || obj2._defaults !== obj1) { + for (var prop in obj1) { + if (obj1.hasOwnProperty(prop)) { + if (!obj2.hasOwnProperty(prop)) { + obj2[prop] = obj1[prop]; + } + else if (Array.isArray(obj1[prop]) + && Array.isArray(obj2[prop])) { + + obj1[prop].forEach(function(p) { + if (obj2[prop].indexOf(p) === -1) { + obj2[prop].push(p); + } + }); + } + } + } + } + obj2._defaults = obj1; + return obj2; + }, + merge: function(obj1, obj2) { + for (var prop in obj2) { + if (obj2.hasOwnProperty(prop)) { + obj1[prop] = obj2[prop]; + } + } + return obj1; + }, getPrototype: function(obj) { if (Object.getPrototypeOf) { return Object.getPrototypeOf(obj); diff --git a/package.json b/package.json index 0b1822dc9..e4950a695 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "grunt-saucelabs": "^9.0.0", "grunt-shell": "^1.3.0", "jit-grunt": "^0.10.0", + "less-plugin-clean-css": "^1.5.1", "performance-now": "^0.2.0", "phantomjs-prebuilt": "^2.1.7", "promise": "^7.1.1", diff --git a/test/less/plugin-module.less b/test/less/plugin-module.less new file mode 100644 index 000000000..d7c2ff1e8 --- /dev/null +++ b/test/less/plugin-module.less @@ -0,0 +1,3 @@ +// Test NPM import +@plugin "clean-css"; + diff --git a/test/less/plugin.less b/test/less/plugin.less index 1bf155d4b..df090a32f 100644 --- a/test/less/plugin.less +++ b/test/less/plugin.less @@ -1,5 +1,5 @@ // importing plugin globally -@plugin "./plugin/plugin-global"; +@plugin "plugin/plugin-global"; // transitively include plugins from importing another sheet @import "./plugin/plugin-transitive"; From 8b0b8da61d1f8f1f8feb5dec855df1266bc3e789 Mon Sep 17 00:00:00 2001 From: Ryuma Yoshida Date: Sun, 2 Jul 2017 19:26:50 +0900 Subject: [PATCH 70/97] Add Node.js v8 to Travis CI --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index a5d8e9bb3..5ecfa7641 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ cache: directories: - travis-phantomjs node_js: + - "8" - "6" - "4" - "0.12" From 33ba03fedf9b4fb2ed3f77f830cd0f0f44af0b72 Mon Sep 17 00:00:00 2001 From: Ryuma Yoshida Date: Sun, 2 Jul 2017 19:27:13 +0900 Subject: [PATCH 71/97] Add Node.js v8 to AppVeyor --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 372a479d9..9697ff2b2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,6 +5,7 @@ environment: - nodejs_version: "0.12" - nodejs_version: "4" - nodejs_version: "6" + - nodejs_version: "8" # Install scripts. (runs after repo cloning) install: From 3c8e1957ffefeb9872677975825a9489d193a1b4 Mon Sep 17 00:00:00 2001 From: Bennett Somerville Date: Tue, 15 Aug 2017 18:06:24 -0600 Subject: [PATCH 72/97] Switch from request to phin! --- Gruntfile.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 0177ec9fb..2ae907c70 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -119,14 +119,15 @@ module.exports = function (grunt) { var pass = process.env.SAUCE_ACCESS_KEY; git.short(function(hash) { - require('request').put({ + require('phin')({ + method: 'PUT', url: ['https://saucelabs.com/rest/v1', user, 'jobs', result.job_id].join('/'), auth: { user: user, pass: pass }, - json: { + data: { passed: result.passed, build: 'build-' + hash } - }, function (error, response, body) { + }, function (error, response) { if (error) { console.log(error); callback(error); From 5fa5494169b3f00a6a15044c0f6866fc9f817572 Mon Sep 17 00:00:00 2001 From: Bennett Somerville Date: Tue, 15 Aug 2017 18:11:11 -0600 Subject: [PATCH 73/97] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0b1822dc9..65e9e78d0 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "performance-now": "^0.2.0", "phantomjs-prebuilt": "^2.1.7", "promise": "^7.1.1", - "request": "^2.73.0", + "phin": "^2.2.3", "time-grunt": "^1.3.0" }, "keywords": [ From 26674fc86764ec0610ffc47d1088f121a5c3d859 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Sun, 8 Oct 2017 15:21:13 -0700 Subject: [PATCH 74/97] FIXES syncImport for less-node --- lib/less-browser/bootstrap.js | 1 + lib/less-browser/file-manager.js | 2 + lib/less-browser/plugin-loader.js | 63 +++------ lib/less-node/file-manager.js | 133 ++++++++---------- lib/less-node/plugin-loader.js | 95 ++----------- .../environment/abstract-plugin-loader.js | 4 +- lib/less/functions/data-uri.js | 7 +- lib/less/import-manager.js | 45 +++--- lib/less/utils.js | 9 ++ test/css/plugin-module.css | 1 + test/less-test.js | 1 + test/less/errors/import-missing.txt | 2 +- test/less/errors/plugin-1.txt | 2 +- test/less/plugin-module.less | 4 + 14 files changed, 129 insertions(+), 240 deletions(-) create mode 100644 test/css/plugin-module.css diff --git a/lib/less-browser/bootstrap.js b/lib/less-browser/bootstrap.js index e1a35ba66..32a1af109 100644 --- a/lib/less-browser/bootstrap.js +++ b/lib/less-browser/bootstrap.js @@ -7,6 +7,7 @@ // TODO - consider switching this out for a recommendation for this polyfill? // +// Browsers have good Promise support require("promise/polyfill"); var options = require('../less/default-options'); diff --git a/lib/less-browser/file-manager.js b/lib/less-browser/file-manager.js index 65c1b8e89..5cde0ff49 100644 --- a/lib/less-browser/file-manager.js +++ b/lib/less-browser/file-manager.js @@ -68,6 +68,8 @@ module.exports = function(options, logger) { }; FileManager.prototype.loadFile = function loadFile(filename, currentDirectory, options, environment, callback) { + // TODO: Add prefix support like less-node? + // What about multiple paths? if (currentDirectory && !this.isPathAbsolute(filename)) { filename = currentDirectory + filename; } diff --git a/lib/less-browser/plugin-loader.js b/lib/less-browser/plugin-loader.js index fbb19df4e..2f68a91da 100644 --- a/lib/less-browser/plugin-loader.js +++ b/lib/less-browser/plugin-loader.js @@ -1,3 +1,4 @@ +// TODO: Add tests for browser @plugin /*global window */ var AbstractPluginLoader = require("../less/environment/abstract-plugin-loader.js"); @@ -12,57 +13,25 @@ var PluginLoader = function(less) { PluginLoader.prototype = new AbstractPluginLoader(); -PluginLoader.prototype.tryLoadPlugin = function(name, basePath, callback) { +PluginLoader.prototype.loadPlugin = function(filename, basePath, context, environment, fileManager) { var self = this; - var prefix = name.slice(0, 1); - var explicit = prefix === "." || prefix === "/" || name.slice(-3).toLowerCase() === ".js"; - this.tryLoadFromEnvironment(name, basePath, explicit, function(err, data) { - if (explicit) { - callback(err, data); - } - else { - if (!err) { - callback(null, data); - } - else { - self.tryLoadFromEnvironment('less-plugin-' + name, basePath, explicit, function(err2, data) { - callback(err, data); - }); + + return new Promise(function(fulfill, reject) { + fileManager.loadFile(filename, basePath, context, environment).then( + function(data) { + try { + self.require = self.requireRelative(data.filename); + fulfill(data); + } + catch (e) { + reject(e); + } } - } + ).catch(function(err) { + reject(err); + }); }); - -}; - -PluginLoader.prototype.tryLoadFromEnvironment = function(filename, basePath, explicit, callback) { - var fileManager = new this.less.FileManager(), - extract = fileManager.extractUrlParts; - - if (basePath) { - filename = (extract(filename, basePath)).url; - } - - if (extract(filename).hostPart !== extract(window.location.href).hostPart) { - callback({ message: 'Cross Site Scripting (XSS) plugins are not allowed'}); - } - - if (filename) { - - filename = fileManager.tryAppendExtension(filename, '.js'); - var done = function(err, data) { - if (err) { - callback(err); - } else { - callback(null, data); - } - }; - fileManager.loadFile(filename, null, null, null, done); - - } - else { - callback({ message: 'Plugin could not be found.'}); - } }; module.exports = PluginLoader; diff --git a/lib/less-node/file-manager.js b/lib/less-node/file-manager.js index 39c3b04e4..afe556323 100644 --- a/lib/less-node/file-manager.js +++ b/lib/less-node/file-manager.js @@ -16,16 +16,15 @@ FileManager.prototype.supportsSync = function(filename, currentDirectory, option return true; }; -FileManager.prototype.loadFile = function(filename, currentDirectory, options, environment) { - - // TODO refactor so isn't cut and paste between loadFileSync +FileManager.prototype.loadFile = function(filename, currentDirectory, options, environment, callback) { + var fullFilename, - data, isAbsoluteFilename = this.isPathAbsolute(filename), filenamesTried = [], self = this, prefix = filename.slice(0, 1), - explicit = prefix === "." || prefix === "/"; + explicit = prefix === "." || prefix === "/", + result = null; options = options || {}; @@ -41,30 +40,42 @@ FileManager.prototype.loadFile = function(filename, currentDirectory, options, e var prefixes = options.prefixes || ['']; var fileParts = this.extractUrlParts(filename); - // promise is guaranteed to be asyncronous - // which helps as it allows the file handle - // to be closed before it continues with the next file - return new PromiseConstructor(function(fulfill, reject) { - if (options.syncImport) { - data = this.loadFileSync(filename, currentDirectory, options, environment, 'utf-8'); - if (data.error) { - reject(data.error); - } - else { - fulfill(data); - } - return; + if (options.syncImport) { + getFileData(returnData, returnData); + if (callback) { + callback(result.error, result); + } + else { + return result; + } + } + else { + // promise is guaranteed to be asyncronous + // which helps as it allows the file handle + // to be closed before it continues with the next file + return new PromiseConstructor(getFileData); + } + + function returnData(data) { + if (!data.filename) { + result = { error: data }; } + else { + result = data; + } + } + + function getFileData(fulfill, reject) { (function tryPathIndex(i) { if (i < paths.length) { (function tryPrefix(j) { if (j < prefixes.length) { - fullFilename = fileParts.rawPath + prefixes[j] + fileParts.filename; if (paths[i]) { fullFilename = path.join(paths[i], fullFilename); } + if (paths[i].indexOf('node_modules') > -1) { try { fullFilename = require.resolve(fullFilename); @@ -79,15 +90,33 @@ FileManager.prototype.loadFile = function(filename, currentDirectory, options, e fulfill({ contents: self.files[fullFilename], filename: fullFilename}); } else { - - fs.readFile(fullFilename, 'utf-8', function(e, data) { - if (e) { + var readFileArgs = [fullFilename]; + if (!options.rawBuffer) { + readFileArgs.push('utf-8'); + } + if (options.syncImport) { + try { + var data = fs.readFileSync.apply(this, readFileArgs); + self.files[fullFilename] = data; + fulfill({ contents: data, filename: fullFilename}); + } + catch (e) { filenamesTried.push(fullFilename); return tryPrefix(j + 1); } - self.files[fullFilename] = data; - fulfill({ contents: data, filename: fullFilename}); - }); + } + else { + readFileArgs.push(function(e, data) { + if (e) { + filenamesTried.push(fullFilename); + return tryPrefix(j + 1); + } + self.files[fullFilename] = data; + fulfill({ contents: data, filename: fullFilename}); + }); + fs.readFile.apply(this, readFileArgs); + } + } } @@ -99,58 +128,12 @@ FileManager.prototype.loadFile = function(filename, currentDirectory, options, e reject({ type: 'File', message: "'" + filename + "' wasn't found. Tried - " + filenamesTried.join(",") }); } }(0)); - }); -}; - -FileManager.prototype.loadFileSync = function(filename, currentDirectory, options, environment, encoding) { - var fullFilename, paths, filenamesTried = [], isAbsoluteFilename = this.isPathAbsolute(filename) , data; - options = options || {}; - - paths = isAbsoluteFilename ? [""] : [currentDirectory]; - if (options.paths) { - paths.push.apply(paths, options.paths); - } - if (!isAbsoluteFilename && paths.indexOf('.') === -1) { - paths.push('.'); - } - - var prefixes = options.prefixes || ['']; - var fileParts = this.extractUrlParts(filename); - - var err, result, breakAll = false; - for (var i = 0; i < paths.length; i++) { - for (var j = 0; j < prefixes.length; j++) { - try { - fullFilename = fileParts.rawPath + prefixes[j] + fileParts.filename; - if (paths[i]) { - fullFilename = path.join(paths[i], fullFilename); - } - filenamesTried.push(fullFilename); - fs.statSync(fullFilename); - breakAll = true; - break; - } catch (e) { - fullFilename = null; - } - } - if (breakAll) { break; } - } - - if (!fullFilename) { - err = { type: 'File', message: "'" + filename + "' wasn't found. Tried - " + filenamesTried.join(",") }; - result = { error: err }; - } else { - if (this.files[fullFilename]) { - data = this.files[fullFilename]; - } - else { - data = fs.readFileSync(fullFilename, encoding); - this.files[fullFilename] = data; - } - result = { contents: data, filename: fullFilename}; } +}; - return result; +FileManager.prototype.loadFileSync = function(filename, currentDirectory, options, environment) { + options.syncImport = true; + return this.loadFile(filename, currentDirectory, options, environment); }; module.exports = FileManager; diff --git a/lib/less-node/plugin-loader.js b/lib/less-node/plugin-loader.js index 7fb503499..6bbc62d1d 100644 --- a/lib/less-node/plugin-loader.js +++ b/lib/less-node/plugin-loader.js @@ -7,7 +7,8 @@ var path = require("path"), */ var PluginLoader = function(less) { this.less = less; - this.require = function(prefix) { + this.require = require; + this.requireRelative = function(prefix) { prefix = path.dirname(prefix); return function(id) { var str = id.substr(0, 2); @@ -25,98 +26,28 @@ PluginLoader.prototype = new AbstractPluginLoader(); PluginLoader.prototype.loadPlugin = function(filename, basePath, context, environment, fileManager) { var self = this; - var prefixes, prefix = filename.slice(0, 1); + var prefix = filename.slice(0, 1); var explicit = prefix === "." || prefix === "/" || filename.slice(-3).toLowerCase() === ".js"; if (!explicit) { context.prefixes = ['less-plugin-', '']; } - return fileManager.loadFile(filename, basePath, context, environment); - // return new PromiseConstructor(function(fulfill, reject) { - // fileManager.loadFile(filename, basePath, context, environment).then( - // function(data) { - // try { - // self.require = self.requireRelative(filename); - // fulfill(data); - // } - // catch (e) { - // reject(e); - // } - // } - // ).catch(function(err) { - // reject(err); - // }); - // }); - -}; - -PluginLoader.prototype.tryLoadFromEnvironment = function(name, basePath, explicit, callback) { - var filename = name; - var self = this; - - function getFile(filename) { - var fileManager = new self.less.FileManager(); - - filename = fileManager.tryAppendExtension(filename, '.js'); - fileManager.loadFile(filename).then( + return new PromiseConstructor(function(fulfill, reject) { + fileManager.loadFile(filename, basePath, context, environment).then( function(data) { try { - self.require = self.requireRelative(filename); + self.require = self.requireRelative(data.filename); + fulfill(data); } catch (e) { - callback(e); + reject(e); } - callback(null, data); - }, - - function(err) { - callback(err); } - ); - } - if (explicit) { - if (basePath) { - filename = path.join(basePath, name); - } - getFile(filename); - } - else { - // Search node_modules for a possible plugin name match - try { - filename = require.resolve(path.join("../../../", name)); - } - catch (e) { - } - // is installed as a sub dependency of the current folder - try { - filename = require.resolve(path.join(process.cwd(), "node_modules", name)); - } - catch (e) { - } - // is referenced relative to the current directory - try { - filename = require.resolve(path.join(process.cwd(), name)); - } - catch (e) { - } - // unlikely - would have to be a dependency of where this code was running (less.js)... - if (name[0] !== '.') { - try { - filename = require.resolve(name); - } - catch (e) { - } - } - if (basePath) { - filename = path.join(basePath, name); - } - if (filename) { - getFile(filename); - } - else { - callback({ message: 'Plugin could not be found.'}); - } - } + ).catch(function(err) { + reject(err); + }); + }); + }; module.exports = PluginLoader; diff --git a/lib/less/environment/abstract-plugin-loader.js b/lib/less/environment/abstract-plugin-loader.js index d1a5e1159..eba2413e0 100644 --- a/lib/less/environment/abstract-plugin-loader.js +++ b/lib/less/environment/abstract-plugin-loader.js @@ -18,7 +18,6 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, imports, registry, pluginObj, localModule, - localExports, pluginManager, filename; @@ -56,7 +55,6 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, imports, pluginManager: pluginManager, fileInfo: fileInfo }; - localExports = localModule.exports; registry = functionRegistry.create(); var registerPlugin = function(obj) { @@ -67,7 +65,7 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, imports, loader = new Function("module", "require", "registerPlugin", "functions", "tree", "less", "fileInfo", contents); loader(localModule, this.require, registerPlugin, registry, this.less.tree, this.less, fileInfo); } catch (e) { - return new this.less.LessError({ message: 'Parse error' }, imports, filename); + return new this.less.LessError(e, imports, filename); } if (!pluginObj) { diff --git a/lib/less/functions/data-uri.js b/lib/less/functions/data-uri.js index 2bd373828..070db9a85 100644 --- a/lib/less/functions/data-uri.js +++ b/lib/less/functions/data-uri.js @@ -1,6 +1,7 @@ module.exports = function(environment) { var Quoted = require("../tree/quoted"), URL = require("../tree/url"), + utils = require('../utils'), functionRegistry = require("./function-registry"), fallback = function(functionThis, node) { return new URL(node, functionThis.index, functionThis.currentFileInfo).eval(functionThis.context); @@ -26,8 +27,10 @@ module.exports = function(environment) { fragment = filePath.slice(fragmentStart); filePath = filePath.slice(0, fragmentStart); } + var context = utils.clone(this.context); + context.rawBuffer = true; - var fileManager = environment.getFileManager(filePath, currentDirectory, this.context, environment, true); + var fileManager = environment.getFileManager(filePath, currentDirectory, context, environment, true); if (!fileManager) { return fallback(this, filePathNode); @@ -53,7 +56,7 @@ module.exports = function(environment) { useBase64 = /;base64$/.test(mimetype); } - var fileSync = fileManager.loadFileSync(filePath, currentDirectory, this.context, environment); + var fileSync = fileManager.loadFileSync(filePath, currentDirectory, context, environment); if (!fileSync.contents) { logger.warn("Skipped data-uri embedding of " + filePath + " because file not found"); return fallback(this, filePathNode || mimetypeNode); diff --git a/lib/less/import-manager.js b/lib/less/import-manager.js index e2254b3db..2eb029013 100644 --- a/lib/less/import-manager.js +++ b/lib/less/import-manager.js @@ -1,6 +1,8 @@ var contexts = require("./contexts"), Parser = require('./parser/parser'), - LessError = require('./less-error'); + LessError = require('./less-error'), + utils = require('./utils'), + PromiseConstructor = typeof Promise === 'undefined' ? require('promise') : Promise; module.exports = function(environment) { @@ -26,28 +28,6 @@ module.exports = function(environment) { this.queue = []; // Files which haven't been imported yet this.files = {}; // Holds the imported parse trees. }; - - function clone(obj) { - var cloned = {}; - for (var prop in obj) { - if (obj.hasOwnProperty(prop)) { - cloned[prop] = obj[prop]; - } - } - return cloned; - } - function isEqual(obj1, obj2) { - var equal = true; - for (var prop in obj1) { - if (obj1.hasOwnProperty(prop)) { - if (obj1[prop] !== obj2[prop]) { - equal = false; - break; - } - } - } - return equal; - } /** * Add an import to be imported @@ -154,8 +134,7 @@ module.exports = function(environment) { } } }; - var promise, context = clone(this.context); - var prefix, explicit; + var promise, context = utils.clone(this.context); if (tryAppendExtension) { context.ext = importOptions.isPlugin ? ".js" : ".less"; @@ -165,11 +144,19 @@ module.exports = function(environment) { promise = pluginLoader.loadPlugin(path, currentFileInfo.currentDirectory, context, environment, fileManager); } else { - promise = fileManager.loadFile(path, currentFileInfo.currentDirectory, context, environment); + promise = fileManager.loadFile(path, currentFileInfo.currentDirectory, context, environment, + function(err, loadedFile) { + if (err) { + fileParsedFunc(err); + } else { + loadFileCallback(loadedFile); + } + }); } - - promise.then(loadFileCallback).catch(fileParsedFunc); - + if (promise) { + promise.then(loadFileCallback, fileParsedFunc); + } + }; return ImportManager; }; diff --git a/lib/less/utils.js b/lib/less/utils.js index d1a97d8d9..72b44e12f 100644 --- a/lib/less/utils.js +++ b/lib/less/utils.js @@ -27,6 +27,15 @@ module.exports = { } return copy; }, + clone: function (obj) { + var cloned = {}; + for (var prop in obj) { + if (obj.hasOwnProperty(prop)) { + cloned[prop] = obj[prop]; + } + } + return cloned; + }, defaults: function(obj1, obj2) { if (!obj2._defaults || obj2._defaults !== obj1) { for (var prop in obj1) { diff --git a/test/css/plugin-module.css b/test/css/plugin-module.css new file mode 100644 index 000000000..f13af217d --- /dev/null +++ b/test/css/plugin-module.css @@ -0,0 +1 @@ +a{background:0 0} \ No newline at end of file diff --git a/test/less-test.js b/test/less-test.js index 119027792..97b0d5655 100644 --- a/test/less-test.js +++ b/test/less-test.js @@ -167,6 +167,7 @@ module.exports = function() { .replace(/\{\/node\}/g, "") .replace(/\{pathhref\}/g, "") .replace(/\{404status\}/g, "") + .replace(/\{nodepath\}/g, path.join(process.cwd(), 'node_modules', '/')) .replace(/\{pathrel\}/g, path.join(path.relative(process.cwd(), p), '/')) .replace(/\{pathesc\}/g, pathesc) .replace(/\{pathimport\}/g, pathimport) diff --git a/test/less/errors/import-missing.txt b/test/less/errors/import-missing.txt index 5602b0f8b..5fe328c29 100644 --- a/test/less/errors/import-missing.txt +++ b/test/less/errors/import-missing.txt @@ -1,3 +1,3 @@ -FileError: '{pathhref}file-does-not-exist.less' wasn't found{404status}{node}. Tried - {path}file-does-not-exist.less,{pathrel}file-does-not-exist.less,file-does-not-exist.less{/node} in {path}import-missing.less on line 6, column 1: +FileError: '{pathhref}file-does-not-exist.less' wasn't found{404status}{node}. Tried - {path}file-does-not-exist.less,{pathrel}file-does-not-exist.less,{nodepath}file-does-not-exist.less,file-does-not-exist.less{/node} in {path}import-missing.less on line 6, column 1: 5 6 @import "file-does-not-exist.less"; diff --git a/test/less/errors/plugin-1.txt b/test/less/errors/plugin-1.txt index 112991af1..c43e0ff11 100644 --- a/test/less/errors/plugin-1.txt +++ b/test/less/errors/plugin-1.txt @@ -1 +1 @@ -SyntaxError: Parse error in {path}plugin-error.js +SyntaxError: Unexpected token ) in {path}plugin-error.js diff --git a/test/less/plugin-module.less b/test/less/plugin-module.less index d7c2ff1e8..dd1ace5e1 100644 --- a/test/less/plugin-module.less +++ b/test/less/plugin-module.less @@ -1,3 +1,7 @@ // Test NPM import @plugin "clean-css"; +a { + background: none; +} + From 55380d49e96a6ed561cac4d13a774830aa3c17a3 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Sun, 8 Oct 2017 18:31:41 -0700 Subject: [PATCH 75/97] All tests passing --- Gruntfile.js | 19 +++++++-- lib/less-browser/file-manager.js | 39 +++++++++++-------- lib/less-browser/index.js | 15 +++---- lib/less-browser/plugin-loader.js | 21 ++-------- lib/less/environment/abstract-file-manager.js | 11 +++--- test/browser/common.js | 1 - test/browser/less/errors/plugin-xss.less | 4 -- test/browser/less/errors/plugin-xss.txt | 3 -- test/browser/runner-browser-options.js | 7 +++- test/browser/runner-legacy-options.js | 3 +- test/index.js | 10 ++++- test/less/errors/plugin-1.txt | 3 +- test/less/errors/plugin/plugin-error.js | 3 +- 13 files changed, 74 insertions(+), 65 deletions(-) delete mode 100644 test/browser/less/errors/plugin-xss.less delete mode 100644 test/browser/less/errors/plugin-xss.txt diff --git a/Gruntfile.js b/Gruntfile.js index 7321985c9..c1980ee58 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -8,7 +8,7 @@ module.exports = function (grunt) { // Report the elapsed execution time of tasks. require('time-grunt')(grunt); - var COMPRESS_FOR_TESTS = true; + var COMPRESS_FOR_TESTS = false; var git = require('git-rev'); // Sauce Labs browser @@ -173,7 +173,13 @@ module.exports = function (grunt) { }, shell: { - options: {stdout: true, failOnError: true}, + options: { + stdout: true, + failOnError: true, + execOptions: { + maxBuffer: Infinity + } + }, test: { command: 'node test/index.js' }, @@ -281,7 +287,14 @@ module.exports = function (grunt) { }, main: { // src is used to build list of less files to compile - src: ['test/less/*.less', '!test/less/javascript.less', '!test/less/urls.less', '!test/less/empty.less'], + src: [ + 'test/less/*.less', + // Don't test NPM import, obviously + '!test/less/plugin-module.less', + '!test/less/javascript.less', + '!test/less/urls.less', + '!test/less/empty.less' + ], options: { helpers: 'test/browser/runner-main-options.js', specs: 'test/browser/runner-main-spec.js', diff --git a/lib/less-browser/file-manager.js b/lib/less-browser/file-manager.js index 846e43a47..5946afa43 100644 --- a/lib/less-browser/file-manager.js +++ b/lib/less-browser/file-manager.js @@ -67,38 +67,43 @@ module.exports = function(options, logger) { fileCache = {}; }; - FileManager.prototype.loadFile = function loadFile(filename, currentDirectory, options, environment, callback) { + FileManager.prototype.loadFile = function loadFile(filename, currentDirectory, options, environment) { // TODO: Add prefix support like less-node? // What about multiple paths? + if (currentDirectory && !this.isPathAbsolute(filename)) { filename = currentDirectory + filename; } + filename = options.ext ? this.tryAppendExtension(filename, options.ext) : filename; + options = options || {}; // sheet may be set to the stylesheet for the initial load or a collection of properties including // some context variables for imports var hrefParts = this.extractUrlParts(filename, window.location.href); var href = hrefParts.url; - - if (options.useFileCache && fileCache[href]) { - try { - var lessText = fileCache[href]; - callback(null, { contents: lessText, filename: href, webInfo: { lastModified: new Date() }}); - } catch (e) { - callback({filename: href, message: "Error loading file " + href + " error was " + e.message}); + var self = this; + + return new Promise(function(resolve, reject) { + if (options.useFileCache && fileCache[href]) { + try { + var lessText = fileCache[href]; + return resolve({ contents: lessText, filename: href, webInfo: { lastModified: new Date() }}); + } catch (e) { + return reject({ filename: href, message: "Error loading file " + href + " error was " + e.message }); + } } - return; - } - this.doXHR(href, options.mime, function doXHRCallback(data, lastModified) { - // per file cache - fileCache[href] = data; + self.doXHR(href, options.mime, function doXHRCallback(data, lastModified) { + // per file cache + fileCache[href] = data; - // Use remote copy (re-parse) - callback(null, { contents: data, filename: href, webInfo: { lastModified: lastModified }}); - }, function doXHRError(status, url) { - callback({ type: 'File', message: "'" + url + "' wasn't found (" + status + ")", href: href }); + // Use remote copy (re-parse) + resolve({ contents: data, filename: href, webInfo: { lastModified: lastModified }}); + }, function doXHRError(status, url) { + reject({ type: 'File', message: "'" + url + "' wasn't found (" + status + ")", href: href }); + }); }); }; diff --git a/lib/less-browser/index.js b/lib/less-browser/index.js index e2c442a81..425d02050 100644 --- a/lib/less-browser/index.js +++ b/lib/less-browser/index.js @@ -125,13 +125,14 @@ module.exports = function(window, options) { }); } - fileManager.loadFile(sheet.href, null, instanceOptions, environment, function(e, loadedFile) { - if (e) { - callback(e); - return; - } - loadInitialFileCallback(loadedFile); - }); + fileManager.loadFile(sheet.href, null, instanceOptions, environment) + .then(function(loadedFile) { + loadInitialFileCallback(loadedFile); + }).catch(function(err) { + console.log(err); + callback(err); + }); + } function loadStyleSheets(callback, reload, modifyVars) { diff --git a/lib/less-browser/plugin-loader.js b/lib/less-browser/plugin-loader.js index 2f68a91da..40ba6ebda 100644 --- a/lib/less-browser/plugin-loader.js +++ b/lib/less-browser/plugin-loader.js @@ -8,30 +8,17 @@ var AbstractPluginLoader = require("../less/environment/abstract-plugin-loader.j */ var PluginLoader = function(less) { this.less = less; + // shim for browser require? this.require = require; }; PluginLoader.prototype = new AbstractPluginLoader(); PluginLoader.prototype.loadPlugin = function(filename, basePath, context, environment, fileManager) { - var self = this; - return new Promise(function(fulfill, reject) { - fileManager.loadFile(filename, basePath, context, environment).then( - function(data) { - try { - self.require = self.requireRelative(data.filename); - fulfill(data); - } - catch (e) { - reject(e); - } - } - ).catch(function(err) { - reject(err); - }); - }); - + fileManager.loadFile(filename, basePath, context, environment) + .then(fulfill).catch(reject); + }); }; module.exports = PluginLoader; diff --git a/lib/less/environment/abstract-file-manager.js b/lib/less/environment/abstract-file-manager.js index 81a8c4533..05911492c 100644 --- a/lib/less/environment/abstract-file-manager.js +++ b/lib/less/environment/abstract-file-manager.js @@ -76,7 +76,7 @@ abstractFileManager.prototype.extractUrlParts = function extractUrlParts(url, ba var urlPartsRegex = /^((?:[a-z-]+:)?\/{2}(?:[^\/\?#]*\/)|([\/\\]))?((?:[^\/\\\?#]*[\/\\])*)([^\/\\\?#]*)([#\?].*)?$/i, urlParts = url.match(urlPartsRegex), - returner = {}, rawDirectories = [], directories = [], i, d, baseUrlParts; + returner = {}, rawDirectories = [], directories = [], i, baseUrlParts; if (!urlParts) { throw new Error("Could not parse sheet href - '" + url + "'"); @@ -98,14 +98,13 @@ abstractFileManager.prototype.extractUrlParts = function extractUrlParts(url, ba rawDirectories = urlParts[3].replace(/\\/g, "/").split("/"); // collapse '..' and skip '.' - for (d = 0, i = 0; i < rawDirectories.length; i++) { + for (i = 0; i < rawDirectories.length; i++) { - if (rawDirectories[i] === ".." && d > 0) { - d -= 1; + if (rawDirectories[i] === "..") { + directories.pop(); } else if (rawDirectories[i] !== ".") { - directories[d] = rawDirectories[i]; - d++; + directories.push(rawDirectories[i]); } } diff --git a/test/browser/common.js b/test/browser/common.js index 000215dd7..9fd69fffb 100644 --- a/test/browser/common.js +++ b/test/browser/common.js @@ -1,5 +1,4 @@ /* Add js reporter for sauce */ - jasmine.getEnv().addReporter(new jasmine.JSReporter2()); jasmine.getEnv().defaultTimeoutInterval = 3000; diff --git a/test/browser/less/errors/plugin-xss.less b/test/browser/less/errors/plugin-xss.less deleted file mode 100644 index a4af585d3..000000000 --- a/test/browser/less/errors/plugin-xss.less +++ /dev/null @@ -1,4 +0,0 @@ -@plugin "https://raw.githubusercontent.com/less/less.js/3.x/test/less/plugin/plugin-local.js"; -.test { - val: test-local(); -} diff --git a/test/browser/less/errors/plugin-xss.txt b/test/browser/less/errors/plugin-xss.txt deleted file mode 100644 index b741d8dd5..000000000 --- a/test/browser/less/errors/plugin-xss.txt +++ /dev/null @@ -1,3 +0,0 @@ -SyntaxError: Cross Site Scripting (XSS) plugins are not allowed in plugin-xss.less on line 1, column 1: -1 @plugin "https://raw.githubusercontent.com/less/less.js/3.x/test/less/plugin/plugin-local.js"; -2 .test { \ No newline at end of file diff --git a/test/browser/runner-browser-options.js b/test/browser/runner-browser-options.js index b90ec3b00..79daf6430 100644 --- a/test/browser/runner-browser-options.js +++ b/test/browser/runner-browser-options.js @@ -1,4 +1,9 @@ -var less = {logLevel: 4, errorReporting: "console", javascriptEnabled: true}; +var less = { + logLevel: 4, + errorReporting: "console", + javascriptEnabled: true, + strictMath: true +}; // There originally run inside describe method. However, since they have not // been inside it, they run at jasmine compile time (not runtime). It all diff --git a/test/browser/runner-legacy-options.js b/test/browser/runner-legacy-options.js index ed93fbd4c..4f8528d67 100644 --- a/test/browser/runner-legacy-options.js +++ b/test/browser/runner-legacy-options.js @@ -2,4 +2,5 @@ var less = { logLevel: 4, errorReporting: "console", strictMath: false, - strictUnits: false }; + strictUnits: false +}; diff --git a/test/index.js b/test/index.js index 09f24a146..0c2392bd3 100644 --- a/test/index.js +++ b/test/index.js @@ -7,7 +7,14 @@ console.log("\n" + stylize("Less", 'underline') + "\n"); lessTester.prepBomTest(); var testMap = [ - [{strictMath: true, relativeUrls: true, silent: true, javascriptEnabled: true}], + [{ + strictMath: true, + relativeUrls: true, + silent: true, + javascriptEnabled: true, + // Set explicitly for legacy tests for >3.0 + ieCompat: true + }], [{strictMath: true, strictUnits: true, javascriptEnabled: true}, "errors/", lessTester.testErrors, null], [{strictMath: true, strictUnits: true, javascriptEnabled: false}, "no-js-errors/", @@ -45,7 +52,6 @@ var testMap = [ [{plugin: 'test/plugins/filemanager/'}, "filemanagerPlugin/"], [{}, "no-strict-math/"] ]; - testMap.forEach(function(args) { lessTester.runTestSet.apply(lessTester, args) }); diff --git a/test/less/errors/plugin-1.txt b/test/less/errors/plugin-1.txt index c43e0ff11..bc4dae7bf 100644 --- a/test/less/errors/plugin-1.txt +++ b/test/less/errors/plugin-1.txt @@ -1 +1,2 @@ -SyntaxError: Unexpected token ) in {path}plugin-error.js +SyntaxError: Error in {path}plugin-error.js{node} on line 1, column 8: +1 throw new Error('Error');{/node} diff --git a/test/less/errors/plugin/plugin-error.js b/test/less/errors/plugin/plugin-error.js index b751b63f6..80dd1fac5 100644 --- a/test/less/errors/plugin/plugin-error.js +++ b/test/less/errors/plugin/plugin-error.js @@ -1,2 +1 @@ -functions.addMultiple({ - "test-parse-error" : function() { \ No newline at end of file +throw new Error('Error'); \ No newline at end of file From 488e0fcbdff2b7dc369837ee3baeaea18d855164 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Sun, 8 Oct 2017 18:34:00 -0700 Subject: [PATCH 76/97] Release 3.0.0-alpha.3 --- dist/less.js | 1261 +++++++++++++++++++++++++--------------------- dist/less.min.js | 12 +- package.json | 2 +- 3 files changed, 688 insertions(+), 587 deletions(-) diff --git a/dist/less.js b/dist/less.js index 91060dcd4..bf9da8976 100644 --- a/dist/less.js +++ b/dist/less.js @@ -1,5 +1,5 @@ /*! - * Less - Leaner CSS v3.0.0-alpha.1 + * Less - Leaner CSS v3.0.0-alpha.3 * http://lesscss.org * * Copyright (c) 2009-2017, Alexis Sellier @@ -66,15 +66,30 @@ module.exports = function(window, options) { * used in the browser distributed version of less * to kick-start less using the browser api */ -/*global window, document */ +/* global window, document */ -// TODO - consider switching this out for a recommendation for this polyfill: +// TODO - consider switching this out for a recommendation for this polyfill? // +// Browsers have good Promise support require("promise/polyfill"); -var options = window.less || {}; +var options = require('../less/default-options')(); + +if (window.less) { + for (key in window.less) { + if (window.less.hasOwnProperty(key)) { + options[key] = window.less[key]; + } + } +} require("./add-default-options")(window, options); +options.plugins = options.plugins || []; + +if (window.LESS_PLUGINS) { + options.plugins = options.plugins.concat(window.LESS_PLUGINS); +} + var less = module.exports = require("./index")(window, options); window.less = less; @@ -95,7 +110,7 @@ if (options.onReady) { if (/!watch/.test(window.location.hash)) { less.watch(); } - // Simulate synchronous stylesheet loading by blocking page rendering + // Simulate synchronous stylesheet loading by hiding page rendering if (!options.async) { css = 'body { display: none !important }'; head = document.head || document.getElementsByTagName('head')[0]; @@ -114,7 +129,7 @@ if (options.onReady) { less.pageLoadFinished = less.refresh(less.env === 'development').then(resolveOrReject, resolveOrReject); } -},{"./add-default-options":1,"./index":8,"promise/polyfill":101}],3:[function(require,module,exports){ +},{"../less/default-options":16,"./add-default-options":1,"./index":8,"promise/polyfill":102}],3:[function(require,module,exports){ var utils = require("./utils"); module.exports = { createCSS: function (document, styles, sheet) { @@ -201,7 +216,7 @@ module.exports = function(window, options, logger) { cache.setItem(path + ':vars', JSON.stringify(modifyVars)); } } catch (e) { - //TODO - could do with adding more robust error handling + // TODO - could do with adding more robust error handling logger.error('failed to save "' + path + '" to local storage for caching.'); } } @@ -339,7 +354,7 @@ module.exports = function(window, less, options) { } function removeErrorConsole(path) { - //no action + // no action } function removeError(path) { @@ -397,7 +412,7 @@ module.exports = function(window, less, options) { }; },{"./browser":3,"./utils":11}],6:[function(require,module,exports){ -/*global window, XMLHttpRequest */ +/* global window, XMLHttpRequest */ module.exports = function(options, logger) { @@ -405,7 +420,7 @@ module.exports = function(options, logger) { var fileCache = {}; - //TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load + // TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load var FileManager = function() { }; @@ -466,43 +481,50 @@ module.exports = function(options, logger) { fileCache = {}; }; - FileManager.prototype.loadFile = function loadFile(filename, currentDirectory, options, environment, callback) { + FileManager.prototype.loadFile = function loadFile(filename, currentDirectory, options, environment) { + // TODO: Add prefix support like less-node? + // What about multiple paths? + if (currentDirectory && !this.isPathAbsolute(filename)) { filename = currentDirectory + filename; } + filename = options.ext ? this.tryAppendExtension(filename, options.ext) : filename; + options = options || {}; // sheet may be set to the stylesheet for the initial load or a collection of properties including // some context variables for imports var hrefParts = this.extractUrlParts(filename, window.location.href); var href = hrefParts.url; - - if (options.useFileCache && fileCache[href]) { - try { - var lessText = fileCache[href]; - callback(null, { contents: lessText, filename: href, webInfo: { lastModified: new Date() }}); - } catch (e) { - callback({filename: href, message: "Error loading file " + href + " error was " + e.message}); + var self = this; + + return new Promise(function(resolve, reject) { + if (options.useFileCache && fileCache[href]) { + try { + var lessText = fileCache[href]; + return resolve({ contents: lessText, filename: href, webInfo: { lastModified: new Date() }}); + } catch (e) { + return reject({ filename: href, message: "Error loading file " + href + " error was " + e.message }); + } } - return; - } - this.doXHR(href, options.mime, function doXHRCallback(data, lastModified) { - // per file cache - fileCache[href] = data; + self.doXHR(href, options.mime, function doXHRCallback(data, lastModified) { + // per file cache + fileCache[href] = data; - // Use remote copy (re-parse) - callback(null, { contents: data, filename: href, webInfo: { lastModified: lastModified }}); - }, function doXHRError(status, url) { - callback({ type: 'File', message: "'" + url + "' wasn't found (" + status + ")", href: href }); + // Use remote copy (re-parse) + resolve({ contents: data, filename: href, webInfo: { lastModified: lastModified }}); + }, function doXHRError(status, url) { + reject({ type: 'File', message: "'" + url + "' wasn't found (" + status + ")", href: href }); + }); }); }; return FileManager; }; -},{"../less/environment/abstract-file-manager.js":16}],7:[function(require,module,exports){ +},{"../less/environment/abstract-file-manager.js":17}],7:[function(require,module,exports){ module.exports = function() { var functionRegistry = require("./../less/functions/function-registry"); @@ -532,7 +554,7 @@ module.exports = function() { functionRegistry.addMultiple(imageFunctions); }; -},{"./../less/functions/function-registry":24}],8:[function(require,module,exports){ +},{"./../less/functions/function-registry":26}],8:[function(require,module,exports){ // // index.js // Should expose the additional browser functions on to the less object @@ -557,7 +579,7 @@ module.exports = function(window, options) { var cache = less.cache = options.cache || require("./cache")(window, options, less.logger); require('./image-size')(less.environment); - //Setup user functions - Deprecate? + // Setup user functions - Deprecate? if (options.functions) { less.functions.functionRegistry.addMultiple(options.functions); } @@ -565,13 +587,7 @@ module.exports = function(window, options) { var typePattern = /^text\/(x-)?less$/; function clone(obj) { - var cloned = {}; - for (var prop in obj) { - if (obj.hasOwnProperty(prop)) { - cloned[prop] = obj[prop]; - } - } - return cloned; + return JSON.parse(JSON.stringify(obj || {})); } // only really needed for phantom @@ -595,7 +611,7 @@ module.exports = function(window, options) { var lessText = style.innerHTML || ''; instanceOptions.filename = document.location.href.replace(/#.*$/, ''); - /*jshint loopfunc:true */ + /* jshint loopfunc:true */ // use closure to store current style less.render(lessText, instanceOptions, bind(function(style, e, result) { @@ -651,7 +667,7 @@ module.exports = function(window, options) { } - //TODO add tests around how this behaves when reloading + // TODO add tests around how this behaves when reloading errors.remove(path); instanceOptions.rootFileInfo = newFileInfo; @@ -666,13 +682,14 @@ module.exports = function(window, options) { }); } - fileManager.loadFile(sheet.href, null, instanceOptions, environment, function(e, loadedFile) { - if (e) { - callback(e); - return; - } - loadInitialFileCallback(loadedFile); - }); + fileManager.loadFile(sheet.href, null, instanceOptions, environment) + .then(function(loadedFile) { + loadInitialFileCallback(loadedFile); + }).catch(function(err) { + console.log(err); + callback(err); + }); + } function loadStyleSheets(callback, reload, modifyVars) { @@ -812,7 +829,7 @@ module.exports = function(window, options) { return less; }; -},{"../less":33,"./browser":3,"./cache":4,"./error-reporting":5,"./file-manager":6,"./image-size":7,"./log-listener":9,"./plugin-loader":10,"./utils":11}],9:[function(require,module,exports){ +},{"../less":35,"./browser":3,"./cache":4,"./error-reporting":5,"./file-manager":6,"./image-size":7,"./log-listener":9,"./plugin-loader":10,"./utils":11}],9:[function(require,module,exports){ module.exports = function(less, options) { var logLevel_debug = 4, @@ -858,6 +875,7 @@ module.exports = function(less, options) { }; },{}],10:[function(require,module,exports){ +// TODO: Add tests for browser @plugin /*global window */ var AbstractPluginLoader = require("../less/environment/abstract-plugin-loader.js"); @@ -867,68 +885,23 @@ var AbstractPluginLoader = require("../less/environment/abstract-plugin-loader.j */ var PluginLoader = function(less) { this.less = less; + // shim for browser require? this.require = require; }; PluginLoader.prototype = new AbstractPluginLoader(); -PluginLoader.prototype.tryLoadPlugin = function(name, basePath, callback) { - var self = this; - var prefix = name.slice(0, 1); - var explicit = prefix === "." || prefix === "/" || name.slice(-3).toLowerCase() === ".js"; - this.tryLoadFromEnvironment(name, basePath, explicit, function(err, data) { - if (explicit) { - callback(err, data); - } - else { - if (!err) { - callback(null, data); - } - else { - self.tryLoadFromEnvironment('less-plugin-' + name, basePath, explicit, function(err2, data) { - callback(err, data); - }); - } - } - }); - -}; - -PluginLoader.prototype.tryLoadFromEnvironment = function(filename, basePath, explicit, callback) { - var fileManager = new this.less.FileManager(), - extract = fileManager.extractUrlParts; - - if (basePath) { - filename = (extract(filename, basePath)).url; - } - - if (extract(filename).hostPart !== extract(window.location.href).hostPart) { - callback({ message: 'Cross Site Scripting (XSS) plugins are not allowed'}); - } - - if (filename) { - - filename = fileManager.tryAppendExtension(filename, '.js'); - - var done = function(err, data) { - if (err) { - callback(err); - } else { - callback(null, data); - } - }; - fileManager.loadFile(filename, null, null, null, done); - - } - else { - callback({ message: 'Plugin could not be found.'}); - } +PluginLoader.prototype.loadPlugin = function(filename, basePath, context, environment, fileManager) { + return new Promise(function(fulfill, reject) { + fileManager.loadFile(filename, basePath, context, environment) + .then(fulfill).catch(reject); + }); }; module.exports = PluginLoader; -},{"../less/environment/abstract-plugin-loader.js":17}],11:[function(require,module,exports){ +},{"../less/environment/abstract-plugin-loader.js":18}],11:[function(require,module,exports){ module.exports = { extractId: function(href) { return href.replace(/^[a-z-]+:\/+?[^\/]+/, '') // Remove protocol & domain @@ -997,17 +970,17 @@ contexts.Parse = function(options) { }; var evalCopyProperties = [ - 'paths', // additional include paths - 'compress', // whether to compress - 'ieCompat', // whether to enforce IE compatibility (IE8 data-uri) - 'strictMath', // whether math has to be within parenthesis - 'strictUnits', // whether units need to evaluate correctly - 'sourceMap', // whether to output a source map - 'importMultiple', // whether we are currently importing multiple copies - 'urlArgs', // whether to add args into url tokens - 'javascriptEnabled',// option - whether Inline JavaScript is enabled. if undefined, defaults to false - 'pluginManager', // Used as the plugin manager for the session - 'importantScope' // used to bubble up !important statements + 'paths', // additional include paths + 'compress', // whether to compress + 'ieCompat', // whether to enforce IE compatibility (IE8 data-uri) + 'strictMath', // whether math has to be within parenthesis + 'strictUnits', // whether units need to evaluate correctly + 'sourceMap', // whether to output a source map + 'importMultiple', // whether we are currently importing multiple copies + 'urlArgs', // whether to add args into url tokens + 'javascriptEnabled', // option - whether Inline JavaScript is enabled. if undefined, defaults to false + 'pluginManager', // Used as the plugin manager for the session + 'importantScope' // used to bubble up !important statements ]; contexts.Eval = function(options, frames) { @@ -1065,7 +1038,7 @@ contexts.Eval.prototype.normalizePath = function( path ) { return path.join("/"); }; -//todo - do the same for the toCSS ? +// todo - do the same for the toCSS ? },{}],13:[function(require,module,exports){ module.exports = { @@ -1247,6 +1220,72 @@ module.exports = { } }; },{}],16:[function(require,module,exports){ +// Export a new default each time +module.exports = function() { + return { + /* Outputs a makefile import dependency list to stdout. */ + depends: false, + + /* Compress using less built-in compression. + * This does an okay job but does not utilise all the tricks of + * dedicated css compression. */ + compress: false, + + /* Runs the less parser and just reports errors without any output. */ + lint: false, + + /* Sets available include paths. + * If the file in an @import rule does not exist at that exact location, + * less will look for it at the location(s) passed to this option. + * You might use this for instance to specify a path to a library which + * you want to be referenced simply and relatively in the less files. */ + paths: [], + + /* color output in the terminal */ + color: true, + + /* The strictImports controls whether the compiler will allow an @import inside of either + * @media blocks or (a later addition) other selector blocks. + * See: https://github.com/less/less.js/issues/656 */ + strictImports: false, + + /* Allow Imports from Insecure HTTPS Hosts */ + insecure: false, + + /* Allows you to add a path to every generated import and url in your css. + * This does not affect less import statements that are processed, just ones + * that are left in the output css. */ + rootpath: '', + + /* By default URLs are kept as-is, so if you import a file in a sub-directory + * that references an image, exactly the same URL will be output in the css. + * This option allows you to re-write URL's in imported files so that the + * URL is always relative to the base imported file */ + relativeUrls: false, + + /* Compatibility with IE8. Used for limiting data-uri length */ + ieCompat: false, // true until 3.0 + + /* Without this option on, Less will try and process all math in your css */ + strictMath: false, + + /* Without this option, less attempts to guess at the output unit when it does maths. */ + strictUnits: false, + + /* Effectively the declaration is put at the top of your base Less file, + * meaning it can be used but it also can be overridden if this variable + * is defined in the file. */ + globalVars: null, + + /* As opposed to the global variable option, this puts the declaration at the + * end of your base file, meaning it will override anything defined in your Less file. */ + modifyVars: null, + + /* This option allows you to specify a argument to go on to every URL. */ + urlArgs: '' + } +} +},{}],17:[function(require,module,exports){ var abstractFileManager = function() { }; @@ -1325,7 +1364,7 @@ abstractFileManager.prototype.extractUrlParts = function extractUrlParts(url, ba var urlPartsRegex = /^((?:[a-z-]+:)?\/{2}(?:[^\/\?#]*\/)|([\/\\]))?((?:[^\/\\\?#]*[\/\\])*)([^\/\\\?#]*)([#\?].*)?$/i, urlParts = url.match(urlPartsRegex), - returner = {}, directories = [], i, baseUrlParts; + returner = {}, rawDirectories = [], directories = [], i, baseUrlParts; if (!urlParts) { throw new Error("Could not parse sheet href - '" + url + "'"); @@ -1344,26 +1383,24 @@ abstractFileManager.prototype.extractUrlParts = function extractUrlParts(url, ba } if (urlParts[3]) { - directories = urlParts[3].replace(/\\/g, "/").split("/"); + rawDirectories = urlParts[3].replace(/\\/g, "/").split("/"); - // extract out . before .. so .. doesn't absorb a non-directory - for (i = 0; i < directories.length; i++) { - if (directories[i] === ".") { - directories.splice(i, 1); - i -= 1; - } - } + // collapse '..' and skip '.' + for (i = 0; i < rawDirectories.length; i++) { - for (i = 0; i < directories.length; i++) { - if (directories[i] === ".." && i > 0) { - directories.splice(i - 1, 2); - i -= 2; + if (rawDirectories[i] === "..") { + directories.pop(); + } + else if (rawDirectories[i] !== ".") { + directories.push(rawDirectories[i]); } + } } returner.hostPart = urlParts[1]; returner.directories = directories; + returner.rawPath = (urlParts[1] || "") + rawDirectories.join("/"); returner.path = (urlParts[1] || "") + directories.join("/"); returner.filename = urlParts[4]; returner.fileUrl = returner.path + (urlParts[4] || ""); @@ -1373,7 +1410,7 @@ abstractFileManager.prototype.extractUrlParts = function extractUrlParts(url, ba module.exports = abstractFileManager; -},{}],17:[function(require,module,exports){ +},{}],18:[function(require,module,exports){ var functionRegistry = require("../functions/function-registry"), LessError = require('../less-error'); @@ -1394,7 +1431,6 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, imports, registry, pluginObj, localModule, - localExports, pluginManager, filename; @@ -1432,7 +1468,6 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, imports, pluginManager: pluginManager, fileInfo: fileInfo }; - localExports = localModule.exports; registry = functionRegistry.create(); var registerPlugin = function(obj) { @@ -1443,7 +1478,7 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, imports, loader = new Function("module", "require", "registerPlugin", "functions", "tree", "less", "fileInfo", contents); loader(localModule, this.require, registerPlugin, registry, this.less.tree, this.less, fileInfo); } catch (e) { - return new this.less.LessError({ message: 'Parse error' }, imports, filename); + return new this.less.LessError(e, imports, filename); } if (!pluginObj) { @@ -1546,7 +1581,7 @@ AbstractPluginLoader.prototype.printUsage = function(plugins) { module.exports = AbstractPluginLoader; -},{"../functions/function-registry":24,"../less-error":34}],18:[function(require,module,exports){ +},{"../functions/function-registry":26,"../less-error":36}],19:[function(require,module,exports){ var logger = require("../logger"); var environment = function(externalEnvironment, fileManagers) { this.fileManagers = fileManagers || []; @@ -1599,7 +1634,24 @@ environment.prototype.clearFileManagers = function () { module.exports = environment; -},{"../logger":35}],19:[function(require,module,exports){ +},{"../logger":37}],20:[function(require,module,exports){ + +var functionRegistry = require("./function-registry"), + Anonymous = require("../tree/anonymous"), + Keyword = require("../tree/keyword"); + +functionRegistry.addMultiple({ + boolean: function(condition) { + return condition ? Keyword.True : Keyword.False; + }, + + 'if': function(condition, trueValue, falseValue) { + return condition ? trueValue + : (falseValue || new Anonymous); + } +}); + +},{"../tree/anonymous":48,"../tree/keyword":69,"./function-registry":26}],21:[function(require,module,exports){ var Color = require("../tree/color"), functionRegistry = require("./function-registry"); @@ -1675,7 +1727,7 @@ for (var f in colorBlendModeFunctions) { functionRegistry.addMultiple(colorBlend); -},{"../tree/color":52,"./function-registry":24}],20:[function(require,module,exports){ +},{"../tree/color":53,"./function-registry":26}],22:[function(require,module,exports){ var Dimension = require("../tree/dimension"), Color = require("../tree/color"), Quoted = require("../tree/quoted"), @@ -1944,43 +1996,73 @@ colorFunctions = { greyscale: function (color) { return colorFunctions.desaturate(color, new Dimension(100)); }, - contrast: function (color, color1, color2, threshold) { - // Return which of `color1` and `color2` has the greatest contrast with `color` - // according to the standard WCAG contrast ratio calculation. - // http://www.w3.org/TR/WCAG20/#contrast-ratiodef - // The threshold param is no longer used, in line with SASS. + contrast: function (color, dark, light, threshold) { // filter: contrast(3.2); // should be kept as is, so check for color if (!color.rgb) { return null; } - if (typeof color1 === 'undefined') { - color1 = colorFunctions.rgba(0, 0, 0, 1.0); + if (typeof light === 'undefined') { + light = colorFunctions.rgba(255, 255, 255, 1.0); } - if (typeof color2 === 'undefined') { - color2 = colorFunctions.rgba(255, 255, 255, 1.0); + if (typeof dark === 'undefined') { + dark = colorFunctions.rgba(0, 0, 0, 1.0); } - var contrast1, contrast2; - var luma = color.luma(); - var luma1 = color1.luma(); - var luma2 = color2.luma(); - // Calculate contrast ratios for each color - if (luma > luma1) { - contrast1 = (luma + 0.05) / (luma1 + 0.05); - } else { - contrast1 = (luma1 + 0.05) / (luma + 0.05); + // Figure out which is actually light and dark: + if (dark.luma() > light.luma()) { + var t = light; + light = dark; + dark = t; } - if (luma > luma2) { - contrast2 = (luma + 0.05) / (luma2 + 0.05); + if (typeof threshold === 'undefined') { + threshold = 0.43; } else { - contrast2 = (luma2 + 0.05) / (luma + 0.05); + threshold = number(threshold); } - if (contrast1 > contrast2) { - return color1; + if (color.luma() < threshold) { + return light; } else { - return color2; - } - }, + return dark; + } + }, + // Changes made in 2.7.0 - Reverted in 3.0.0 + // contrast: function (color, color1, color2, threshold) { + // // Return which of `color1` and `color2` has the greatest contrast with `color` + // // according to the standard WCAG contrast ratio calculation. + // // http://www.w3.org/TR/WCAG20/#contrast-ratiodef + // // The threshold param is no longer used, in line with SASS. + // // filter: contrast(3.2); + // // should be kept as is, so check for color + // if (!color.rgb) { + // return null; + // } + // if (typeof color1 === 'undefined') { + // color1 = colorFunctions.rgba(0, 0, 0, 1.0); + // } + // if (typeof color2 === 'undefined') { + // color2 = colorFunctions.rgba(255, 255, 255, 1.0); + // } + // var contrast1, contrast2; + // var luma = color.luma(); + // var luma1 = color1.luma(); + // var luma2 = color2.luma(); + // // Calculate contrast ratios for each color + // if (luma > luma1) { + // contrast1 = (luma + 0.05) / (luma1 + 0.05); + // } else { + // contrast1 = (luma1 + 0.05) / (luma + 0.05); + // } + // if (luma > luma2) { + // contrast2 = (luma + 0.05) / (luma2 + 0.05); + // } else { + // contrast2 = (luma2 + 0.05) / (luma + 0.05); + // } + // if (contrast1 > contrast2) { + // return color1; + // } else { + // return color2; + // } + // }, argb: function (color) { return new Anonymous(color.toARGB()); }, @@ -2007,10 +2089,11 @@ colorFunctions = { }; functionRegistry.addMultiple(colorFunctions); -},{"../tree/anonymous":47,"../tree/color":52,"../tree/dimension":59,"../tree/quoted":77,"./function-registry":24}],21:[function(require,module,exports){ +},{"../tree/anonymous":48,"../tree/color":53,"../tree/dimension":60,"../tree/quoted":78,"./function-registry":26}],23:[function(require,module,exports){ module.exports = function(environment) { var Quoted = require("../tree/quoted"), URL = require("../tree/url"), + utils = require('../utils'), functionRegistry = require("./function-registry"), fallback = function(functionThis, node) { return new URL(node, functionThis.index, functionThis.currentFileInfo).eval(functionThis.context); @@ -2036,8 +2119,10 @@ module.exports = function(environment) { fragment = filePath.slice(fragmentStart); filePath = filePath.slice(0, fragmentStart); } + var context = utils.clone(this.context); + context.rawBuffer = true; - var fileManager = environment.getFileManager(filePath, currentDirectory, this.context, environment, true); + var fileManager = environment.getFileManager(filePath, currentDirectory, context, environment, true); if (!fileManager) { return fallback(this, filePathNode); @@ -2063,7 +2148,7 @@ module.exports = function(environment) { useBase64 = /;base64$/.test(mimetype); } - var fileSync = fileManager.loadFileSync(filePath, currentDirectory, this.context, environment); + var fileSync = fileManager.loadFileSync(filePath, currentDirectory, context, environment); if (!fileSync.contents) { logger.warn("Skipped data-uri embedding of " + filePath + " because file not found"); return fallback(this, filePathNode || mimetypeNode); @@ -2094,7 +2179,7 @@ module.exports = function(environment) { }); }; -},{"../logger":35,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],22:[function(require,module,exports){ +},{"../logger":37,"../tree/quoted":78,"../tree/url":84,"../utils":88,"./function-registry":26}],24:[function(require,module,exports){ var Keyword = require("../tree/keyword"), functionRegistry = require("./function-registry"); @@ -2123,7 +2208,7 @@ functionRegistry.add("default", defaultFunc.eval.bind(defaultFunc)); module.exports = defaultFunc; -},{"../tree/keyword":68,"./function-registry":24}],23:[function(require,module,exports){ +},{"../tree/keyword":69,"./function-registry":26}],25:[function(require,module,exports){ var Expression = require("../tree/expression"); var functionCaller = function(name, context, index, currentFileInfo) { @@ -2171,7 +2256,7 @@ functionCaller.prototype.call = function(args) { module.exports = functionCaller; -},{"../tree/expression":62}],24:[function(require,module,exports){ +},{"../tree/expression":63}],26:[function(require,module,exports){ function makeRegistry( base ) { return { _data: {}, @@ -2181,7 +2266,7 @@ function makeRegistry( base ) { name = name.toLowerCase(); if (this._data.hasOwnProperty(name)) { - //TODO warn + // TODO warn } this._data[name] = func; }, @@ -2207,14 +2292,15 @@ function makeRegistry( base ) { } module.exports = makeRegistry( null ); -},{}],25:[function(require,module,exports){ +},{}],27:[function(require,module,exports){ module.exports = function(environment) { var functions = { functionRegistry: require("./function-registry"), functionCaller: require("./function-caller") }; - //register functions + // register functions + require("./boolean"); require("./default"); require("./color"); require("./color-blending"); @@ -2228,7 +2314,7 @@ module.exports = function(environment) { return functions; }; -},{"./color":20,"./color-blending":19,"./data-uri":21,"./default":22,"./function-caller":23,"./function-registry":24,"./math":27,"./number":28,"./string":29,"./svg":30,"./types":31}],26:[function(require,module,exports){ +},{"./boolean":20,"./color":22,"./color-blending":21,"./data-uri":23,"./default":24,"./function-caller":25,"./function-registry":26,"./math":29,"./number":30,"./string":31,"./svg":32,"./types":33}],28:[function(require,module,exports){ var Dimension = require("../tree/dimension"); var MathHelper = function() { @@ -2245,7 +2331,7 @@ MathHelper._math = function (fn, unit, n) { return new Dimension(fn(parseFloat(n.value)), unit); }; module.exports = MathHelper; -},{"../tree/dimension":59}],27:[function(require,module,exports){ +},{"../tree/dimension":60}],29:[function(require,module,exports){ var functionRegistry = require("./function-registry"), mathHelper = require("./math-helper.js"); @@ -2276,7 +2362,7 @@ mathFunctions.round = function (n, f) { functionRegistry.addMultiple(mathFunctions); -},{"./function-registry":24,"./math-helper.js":26}],28:[function(require,module,exports){ +},{"./function-registry":26,"./math-helper.js":28}],30:[function(require,module,exports){ var Dimension = require("../tree/dimension"), Anonymous = require("../tree/anonymous"), functionRegistry = require("./function-registry"), @@ -2359,7 +2445,7 @@ functionRegistry.addMultiple({ } }); -},{"../tree/anonymous":47,"../tree/dimension":59,"./function-registry":24,"./math-helper.js":26}],29:[function(require,module,exports){ +},{"../tree/anonymous":48,"../tree/dimension":60,"./function-registry":26,"./math-helper.js":28}],31:[function(require,module,exports){ var Quoted = require("../tree/quoted"), Anonymous = require("../tree/anonymous"), JavaScript = require("../tree/javascript"), @@ -2381,12 +2467,12 @@ functionRegistry.addMultiple({ result = result.replace(new RegExp(pattern.value, flags ? flags.value : ''), replacement); return new Quoted(string.quote || '', result, string.escaped); }, - '%': function (string /* arg, arg, ...*/) { + '%': function (string /* arg, arg, ... */) { var args = Array.prototype.slice.call(arguments, 1), result = string.value; for (var i = 0; i < args.length; i++) { - /*jshint loopfunc:true */ + /* jshint loopfunc:true */ result = result.replace(/%[sda]/i, function(token) { var value = ((args[i].type === "Quoted") && token.match(/s/i)) ? args[i].value : args[i].toCSS(); @@ -2398,7 +2484,7 @@ functionRegistry.addMultiple({ } }); -},{"../tree/anonymous":47,"../tree/javascript":66,"../tree/quoted":77,"./function-registry":24}],30:[function(require,module,exports){ +},{"../tree/anonymous":48,"../tree/javascript":67,"../tree/quoted":78,"./function-registry":26}],32:[function(require,module,exports){ module.exports = function(environment) { var Dimension = require("../tree/dimension"), Color = require("../tree/color"), @@ -2488,7 +2574,7 @@ module.exports = function(environment) { }); }; -},{"../tree/color":52,"../tree/dimension":59,"../tree/expression":62,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],31:[function(require,module,exports){ +},{"../tree/color":53,"../tree/dimension":60,"../tree/expression":63,"../tree/quoted":78,"../tree/url":84,"./function-registry":26}],33:[function(require,module,exports){ var Keyword = require("../tree/keyword"), DetachedRuleset = require("../tree/detached-ruleset"), Dimension = require("../tree/dimension"), @@ -2579,10 +2665,12 @@ functionRegistry.addMultiple({ } }); -},{"../tree/anonymous":47,"../tree/color":52,"../tree/detached-ruleset":58,"../tree/dimension":59,"../tree/keyword":68,"../tree/operation":74,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],32:[function(require,module,exports){ +},{"../tree/anonymous":48,"../tree/color":53,"../tree/detached-ruleset":59,"../tree/dimension":60,"../tree/keyword":69,"../tree/operation":75,"../tree/quoted":78,"../tree/url":84,"./function-registry":26}],34:[function(require,module,exports){ var contexts = require("./contexts"), Parser = require('./parser/parser'), - LessError = require('./less-error'); + LessError = require('./less-error'), + utils = require('./utils'), + PromiseConstructor = typeof Promise === 'undefined' ? require('promise') : Promise; module.exports = function(environment) { @@ -2608,6 +2696,7 @@ module.exports = function(environment) { this.queue = []; // Files which haven't been imported yet this.files = {}; // Holds the imported parse trees. }; + /** * Add an import to be imported * @param path - the raw path @@ -2630,7 +2719,9 @@ module.exports = function(environment) { callback(null, {rules:[]}, false, null); } else { - importManager.files[fullPath] = root; + if (!importManager.files[fullPath]) { + importManager.files[fullPath] = { root: root, options: importOptions }; + } if (e && !importManager.error) { importManager.error = e; } callback(e, root, importedEqualsRoot, fullPath); } @@ -2650,10 +2741,6 @@ module.exports = function(environment) { return; } - if (tryAppendExtension) { - path = importOptions.isPlugin ? path : fileManager.tryAppendExtension(path, ".less"); - } - var loadFileCallback = function(loadedFile) { var plugin, resolvedFilename = loadedFile.filename, @@ -2699,39 +2786,50 @@ module.exports = function(environment) { } else if (importOptions.inline) { fileParsedFunc(null, contents, resolvedFilename); } else { - new Parser(newEnv, importManager, newFileInfo).parse(contents, function (e, root) { - fileParsedFunc(e, root, resolvedFilename); - }); - } - }; - var promise; - var done = function(err, loadedFile) { - if (err) { - fileParsedFunc(err); - } else { - loadFileCallback(loadedFile); + + // import (multiple) parse trees apparently get altered and can't be cached. + // TODO: investigate why this is + if (importManager.files[resolvedFilename] + && !importManager.files[resolvedFilename].options.multiple + && !importOptions.multiple) { + + fileParsedFunc(null, importManager.files[resolvedFilename].root, resolvedFilename); + } + else { + new Parser(newEnv, importManager, newFileInfo).parse(contents, function (e, root) { + fileParsedFunc(e, root, resolvedFilename); + }); + } } }; + var promise, context = utils.clone(this.context); + + if (tryAppendExtension) { + context.ext = importOptions.isPlugin ? ".js" : ".less"; + } + if (importOptions.isPlugin) { - try { - pluginLoader.tryLoadPlugin(path, currentFileInfo.currentDirectory, done); - } - catch (e) { - callback(e); - } + promise = pluginLoader.loadPlugin(path, currentFileInfo.currentDirectory, context, environment, fileManager); } else { - promise = fileManager.loadFile(path, currentFileInfo.currentDirectory, this.context, environment, done); - if (promise) { - promise.then(loadFileCallback, fileParsedFunc); - } + promise = fileManager.loadFile(path, currentFileInfo.currentDirectory, context, environment, + function(err, loadedFile) { + if (err) { + fileParsedFunc(err); + } else { + loadFileCallback(loadedFile); + } + }); } - + if (promise) { + promise.then(loadFileCallback, fileParsedFunc); + } + }; return ImportManager; }; -},{"./contexts":12,"./less-error":34,"./parser/parser":40}],33:[function(require,module,exports){ +},{"./contexts":12,"./less-error":36,"./parser/parser":42,"./utils":88,"promise":undefined}],35:[function(require,module,exports){ module.exports = function(environment, fileManagers) { var SourceMapOutput, SourceMapBuilder, ParseTree, ImportManager, Environment; @@ -2771,7 +2869,7 @@ module.exports = function(environment, fileManagers) { }; var t, api = Object.create(initial); for (var n in initial.tree) { - /*eslint guard-for-in: 0 */ + /* eslint guard-for-in: 0 */ t = initial.tree[n]; if (typeof t === "function") { api[n] = ctor(t); @@ -2779,7 +2877,7 @@ module.exports = function(environment, fileManagers) { else { api[n] = Object.create(null); for (var o in t) { - /*eslint guard-for-in: 0 */ + /* eslint guard-for-in: 0 */ api[n][o] = ctor(t[o]); } } @@ -2788,7 +2886,7 @@ module.exports = function(environment, fileManagers) { return api; }; -},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":16,"./environment/abstract-plugin-loader":17,"./environment/environment":18,"./functions":25,"./import-manager":32,"./less-error":34,"./logger":35,"./parse":37,"./parse-tree":36,"./parser/parser":40,"./plugin-manager":41,"./render":42,"./source-map-builder":43,"./source-map-output":44,"./transform-tree":45,"./tree":65,"./utils":87,"./visitors":91}],34:[function(require,module,exports){ +},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":17,"./environment/abstract-plugin-loader":18,"./environment/environment":19,"./functions":27,"./import-manager":34,"./less-error":36,"./logger":37,"./parse":39,"./parse-tree":38,"./parser/parser":42,"./plugin-manager":43,"./render":44,"./source-map-builder":45,"./source-map-output":46,"./transform-tree":47,"./tree":66,"./utils":88,"./visitors":92}],36:[function(require,module,exports){ var utils = require('./utils'); /** * This is a centralized class of any error that could be thrown internally (mostly by the parser). @@ -2931,7 +3029,7 @@ LessError.prototype.toString = function(options) { return message; }; -},{"./utils":87}],35:[function(require,module,exports){ +},{"./utils":88}],37:[function(require,module,exports){ module.exports = { error: function(msg) { this._fireEvent("error", msg); @@ -2967,7 +3065,7 @@ module.exports = { _listeners: [] }; -},{}],36:[function(require,module,exports){ +},{}],38:[function(require,module,exports){ var LessError = require('./less-error'), transformTree = require("./transform-tree"), logger = require("./logger"); @@ -3029,20 +3127,23 @@ module.exports = function(SourceMapBuilder) { return ParseTree; }; -},{"./less-error":34,"./logger":35,"./transform-tree":45}],37:[function(require,module,exports){ +},{"./less-error":36,"./logger":37,"./transform-tree":47}],39:[function(require,module,exports){ var PromiseConstructor, contexts = require("./contexts"), Parser = require('./parser/parser'), PluginManager = require('./plugin-manager'), - LessError = require('./less-error'); + LessError = require('./less-error'), + utils = require('./utils'); module.exports = function(environment, ParseTree, ImportManager) { var parse = function (input, options, callback) { - options = options || {}; if (typeof options === 'function') { callback = options; - options = {}; + options = utils.defaults(this.options, {}); + } + else { + options = utils.defaults(this.options, options || {}); } if (!callback) { @@ -3090,6 +3191,9 @@ module.exports = function(environment, ParseTree, ImportManager) { var imports = new ImportManager(this, context, rootFileInfo); this.importManager = imports; + // TODO: allow the plugins to be just a list of paths or names + // Do an async plugin queue like lessc + if (options.plugins) { options.plugins.forEach(function(plugin) { var evalResult, contents; @@ -3116,7 +3220,7 @@ module.exports = function(environment, ParseTree, ImportManager) { return parse; }; -},{"./contexts":12,"./less-error":34,"./parser/parser":40,"./plugin-manager":41,"promise":undefined}],38:[function(require,module,exports){ +},{"./contexts":12,"./less-error":36,"./parser/parser":42,"./plugin-manager":43,"./utils":88,"promise":undefined}],40:[function(require,module,exports){ // Split the input into chunks. module.exports = function (input, fail) { var len = input.length, level = 0, parenLevel = 0, @@ -3230,15 +3334,15 @@ module.exports = function (input, fail) { return chunks; }; -},{}],39:[function(require,module,exports){ +},{}],41:[function(require,module,exports){ var chunker = require('./chunker'); module.exports = function() { - var input, // LeSS input string + var input, // Less input string j, // current chunk saveStack = [], // holds state for backtracking furthest, // furthest index the parser has gone to - furthestPossibleErrorMessage,// if this is furthest we got to, this is the probably cause + furthestPossibleErrorMessage, // if this is furthest we got to, this is the probably cause chunks, // chunkified input current, // current chunk currentPos, // index of current chunk, in `input` @@ -3442,7 +3546,7 @@ module.exports = function() { parserInput.peekNotNumeric = function() { var c = input.charCodeAt(parserInput.i); - //Is the first char of the dimension 0-9, '.', '+' or '-' + // Is the first char of the dimension 0-9, '.', '+' or '-' return (c > CHARCODE_9 || c < CHARCODE_PLUS) || c === CHARCODE_FORWARD_SLASH || c === CHARCODE_COMMA; }; @@ -3491,7 +3595,7 @@ module.exports = function() { return parserInput; }; -},{"./chunker":38}],40:[function(require,module,exports){ +},{"./chunker":40}],42:[function(require,module,exports){ var LessError = require('../less-error'), tree = require("../tree"), visitors = require("../visitors"), @@ -3529,8 +3633,8 @@ var LessError = require('../less-error'), // Token matching is done with the `$` function, which either takes // a terminal string or regexp, or a non-terminal function to call. // It also takes care of moving all the indices forwards. -//` // + var Parser = function Parser(context, imports, fileInfo) { var parsers, parserInput = getParserInput(); @@ -3808,7 +3912,7 @@ var Parser = function Parser(context, imports, fileInfo) { } node = mixin.definition() || this.declaration() || this.ruleset() || - mixin.call() || this.rulesetCall() || this.entities.call() || this.atrule(); + mixin.call() || this.variableCall() || this.entities.call() || this.atrule(); if (node) { root.push(node); } else { @@ -3877,13 +3981,10 @@ var Parser = function Parser(context, imports, fileInfo) { // // rgb(255, 0, 255) // - // We also try to catch IE's `alpha()`, but let the `alpha` parser - // deal with the details. - // // The arguments are parsed with the `entities.arguments` parser. // call: function () { - var name, nameLC, args, alpha, index = parserInput.i; + var name, args, func, index = parserInput.i; // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18 if (parserInput.peek(/^url\(/i)) { @@ -3893,20 +3994,22 @@ var Parser = function Parser(context, imports, fileInfo) { parserInput.save(); name = parserInput.$re(/^([\w-]+|%|progid:[\w\.]+)\(/); - if (!name) { parserInput.forget(); return; } + if (!name) { + parserInput.forget(); + return; + } name = name[1]; - nameLC = name.toLowerCase(); - - if (nameLC === 'alpha') { - alpha = parsers.alpha(); - if (alpha) { + func = this.customFuncCall(name); + if (func) { + args = func.parse(); + if (args && func.stop) { parserInput.forget(); - return alpha; + return args; } } - args = this.arguments(); + args = this.arguments(args); if (!parserInput.$char(')')) { parserInput.restore("Could not parse call arguments or missing ')'"); @@ -3916,47 +4019,72 @@ var Parser = function Parser(context, imports, fileInfo) { parserInput.forget(); return new(tree.Call)(name, args, index, fileInfo); }, - arguments: function () { - var argsSemiColon = [], argsComma = [], - expressions = [], - isSemiColonSeparated, value, arg; - - parserInput.save(); + + // + // Parsing rules for functions with non-standard args, e.g.: + // + // boolean(not(2 > 1)) + // + // This is a quick prototype, to be modified/improved when + // more custom-parsed funcs come (e.g. `selector(...)`) + // - while (true) { + customFuncCall: function (name) { + /* Ideally the table is to be moved out of here for faster perf., + but it's quite tricky since it relies on all these `parsers` + and `expect` available only here */ + return { + alpha: f(parsers.ieAlpha, true), + boolean: f(condition), + 'if': f(condition) + }[name.toLowerCase()]; + + function f(parse, stop) { + return { + parse: parse, // parsing function + stop: stop // when true - stop after parse() and return its result, + // otherwise continue for plain args + }; + } + + function condition() { + return [expect(parsers.condition, 'expected condition')]; + } + }, - arg = parsers.detachedRuleset() || this.assignment() || parsers.expression(); + arguments: function (prevArgs) { + var argsComma = prevArgs || [], + argsSemiColon = [], + isSemiColonSeparated, value; - if (!arg) { - break; - } + parserInput.save(); - value = arg; + while (true) { + if (prevArgs) { + prevArgs = false; + } else { + value = parsers.detachedRuleset() || this.assignment() || parsers.expression(); + if (!value) { + break; + } - if (arg.value && arg.value.length == 1) { - value = arg.value[0]; - } + if (value.value && value.value.length == 1) { + value = value.value[0]; + } - if (value) { - expressions.push(value); + argsComma.push(value); } - argsComma.push(value); - if (parserInput.$char(',')) { continue; } if (parserInput.$char(';') || isSemiColonSeparated) { - isSemiColonSeparated = true; - - if (expressions.length > 1) { - value = new(tree.Value)(expressions); - } + value = (argsComma.length < 1) ? argsComma[0] + : new tree.Value(argsComma); argsSemiColon.push(value); - - expressions = []; + argsComma = []; } } @@ -4181,15 +4309,17 @@ var Parser = function Parser(context, imports, fileInfo) { }, // - // The variable part of a variable definition. Used in the `rule` parser + // Call a variable value // - // @fink(); + // @fink() // - rulesetCall: function () { + variableCall: function () { var name; - if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^(@[\w-]+)\(\s*\)\s*;/))) { - return new tree.RulesetCall(name[1]); + if (parserInput.currentChar() === '@' + && (name = parserInput.$re(/^(@[\w-]+)\(\s*\)/)) + && parsers.end()) { + return new tree.VariableCall(name[1]); } }, @@ -4511,17 +4641,18 @@ var Parser = function Parser(context, imports, fileInfo) { // // alpha(opacity=88) // - alpha: function () { + ieAlpha: function () { var value; // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18 if (!parserInput.$re(/^opacity=/i)) { return; } value = parserInput.$re(/^\d+/); if (!value) { - value = expect(this.entities.variable, "Could not parse alpha"); + value = expect(parsers.entities.variable, "Could not parse alpha"); + value = '@{' + value.name.slice(1) + '}'; } expectChar(')'); - return new(tree.Alpha)(value); + return new tree.Quoted('', 'alpha(opacity=' + value + ')'); }, // @@ -5463,7 +5594,7 @@ Parser.serializeVars = function(vars) { module.exports = Parser; -},{"../less-error":34,"../tree":65,"../utils":87,"../visitors":91,"./parser-input":39}],41:[function(require,module,exports){ +},{"../less-error":36,"../tree":66,"../utils":88,"../visitors":92,"./parser-input":41}],43:[function(require,module,exports){ var utils = require('./utils'); /** * Plugin Manager @@ -5642,14 +5773,18 @@ PluginManager.prototype.getFileManagers = function() { // module.exports = PluginManagerFactory; -},{"./utils":87}],42:[function(require,module,exports){ -var PromiseConstructor; +},{"./utils":88}],44:[function(require,module,exports){ +var PromiseConstructor, + utils = require('./utils'); module.exports = function(environment, ParseTree, ImportManager) { var render = function (input, options, callback) { if (typeof options === 'function') { callback = options; - options = {}; + options = utils.defaults(this.options, {}); + } + else { + options = utils.defaults(this.options, options || {}); } if (!callback) { @@ -5685,7 +5820,7 @@ module.exports = function(environment, ParseTree, ImportManager) { return render; }; -},{"promise":undefined}],43:[function(require,module,exports){ +},{"./utils":88,"promise":undefined}],45:[function(require,module,exports){ module.exports = function (SourceMapOutput, environment) { var SourceMapBuilder = function (options) { @@ -5759,7 +5894,7 @@ module.exports = function (SourceMapOutput, environment) { return SourceMapBuilder; }; -},{}],44:[function(require,module,exports){ +},{}],46:[function(require,module,exports){ module.exports = function (environment) { var SourceMapOutput = function (options) { @@ -5809,7 +5944,7 @@ module.exports = function (environment) { SourceMapOutput.prototype.add = function(chunk, fileInfo, index, mapLines) { - //ignore adding empty strings + // ignore adding empty strings if (!chunk) { return; } @@ -5904,7 +6039,7 @@ module.exports = function (environment) { return SourceMapOutput; }; -},{}],45:[function(require,module,exports){ +},{}],47:[function(require,module,exports){ var contexts = require("./contexts"), visitor = require("./visitors"), tree = require("./tree"); @@ -5979,37 +6114,7 @@ module.exports = function(root, options) { return evaldRoot; }; -},{"./contexts":12,"./tree":65,"./visitors":91}],46:[function(require,module,exports){ -var Node = require("./node"); - -var Alpha = function (val) { - this.value = val; -}; -Alpha.prototype = new Node(); -Alpha.prototype.type = "Alpha"; - -Alpha.prototype.accept = function (visitor) { - this.value = visitor.visit(this.value); -}; -Alpha.prototype.eval = function (context) { - if (this.value.eval) { return new Alpha(this.value.eval(context)); } - return this; -}; -Alpha.prototype.genCSS = function (context, output) { - output.add("alpha(opacity="); - - if (this.value.genCSS) { - this.value.genCSS(context, output); - } else { - output.add(this.value); - } - - output.add(")"); -}; - -module.exports = Alpha; - -},{"./node":73}],47:[function(require,module,exports){ +},{"./contexts":12,"./tree":66,"./visitors":92}],48:[function(require,module,exports){ var Node = require("./node"); var Anonymous = function (value, index, currentFileInfo, mapLines, rulesetLike, visibilityInfo) { @@ -6040,7 +6145,7 @@ Anonymous.prototype.genCSS = function (context, output) { }; module.exports = Anonymous; -},{"./node":73}],48:[function(require,module,exports){ +},{"./node":74}],49:[function(require,module,exports){ var Node = require("./node"); var Assignment = function (key, val) { @@ -6069,7 +6174,7 @@ Assignment.prototype.genCSS = function (context, output) { }; module.exports = Assignment; -},{"./node":73}],49:[function(require,module,exports){ +},{"./node":74}],50:[function(require,module,exports){ var Node = require("./node"), Selector = require("./selector"), Ruleset = require("./ruleset"), @@ -6133,11 +6238,11 @@ AtRule.prototype.genCSS = function (context, output) { AtRule.prototype.eval = function (context) { var mediaPathBackup, mediaBlocksBackup, value = this.value, rules = this.rules; - //media stored inside other atrule should not bubble over it - //backpup media bubbling information + // media stored inside other atrule should not bubble over it + // backpup media bubbling information mediaPathBackup = context.mediaPath; mediaBlocksBackup = context.mediaBlocks; - //deleted media bubbling information + // deleted media bubbling information context.mediaPath = []; context.mediaBlocks = []; @@ -6149,7 +6254,7 @@ AtRule.prototype.eval = function (context) { rules = [rules[0].eval(context)]; rules[0].root = true; } - //restore media bubbling information + // restore media bubbling information context.mediaPath = mediaPathBackup; context.mediaBlocks = mediaBlocksBackup; @@ -6207,7 +6312,7 @@ AtRule.prototype.outputRuleset = function (context, output, rules) { }; module.exports = AtRule; -},{"./anonymous":47,"./node":73,"./ruleset":80,"./selector":81}],50:[function(require,module,exports){ +},{"./anonymous":48,"./node":74,"./ruleset":80,"./selector":81}],51:[function(require,module,exports){ var Node = require("./node"); var Attribute = function (key, op, value) { @@ -6236,7 +6341,7 @@ Attribute.prototype.toCSS = function (context) { }; module.exports = Attribute; -},{"./node":73}],51:[function(require,module,exports){ +},{"./node":74}],52:[function(require,module,exports){ var Node = require("./node"), Anonymous = require("./anonymous"), FunctionCaller = require("../functions/function-caller"); @@ -6287,10 +6392,16 @@ Call.prototype.eval = function (context) { } if (result !== null && result !== undefined) { - // All returned results must be Nodes, - // so anything other than a Node is a null Node + // Results that that are not nodes are cast as Anonymous nodes + // Falsy values or booleans are returned as empty nodes if (!(result instanceof Node)) { - result = new Anonymous(null); + if (!result || result === true) { + result = new Anonymous(null); + } + else { + result = new Anonymous(result.toString()); + } + } result._index = this._index; result._fileInfo = this._fileInfo; @@ -6315,7 +6426,7 @@ Call.prototype.genCSS = function (context, output) { }; module.exports = Call; -},{"../functions/function-caller":23,"./anonymous":47,"./node":73}],52:[function(require,module,exports){ +},{"../functions/function-caller":25,"./anonymous":48,"./node":74}],53:[function(require,module,exports){ var Node = require("./node"), colors = require("../data/colors"); @@ -6450,7 +6561,7 @@ Color.prototype.toHSL = function () { } return { h: h * 360, s: s, l: l, a: a }; }; -//Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript +// Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript Color.prototype.toHSV = function () { var r = this.rgb[0] / 255, g = this.rgb[1] / 255, @@ -6506,7 +6617,7 @@ Color.fromKeyword = function(keyword) { }; module.exports = Color; -},{"../data/colors":13,"./node":73}],53:[function(require,module,exports){ +},{"../data/colors":13,"./node":74}],54:[function(require,module,exports){ var Node = require("./node"); var Combinator = function (value) { @@ -6531,7 +6642,7 @@ Combinator.prototype.genCSS = function (context, output) { }; module.exports = Combinator; -},{"./node":73}],54:[function(require,module,exports){ +},{"./node":74}],55:[function(require,module,exports){ var Node = require("./node"), getDebugInfo = require("./debug-info"); @@ -6556,7 +6667,7 @@ Comment.prototype.isSilent = function(context) { }; module.exports = Comment; -},{"./debug-info":56,"./node":73}],55:[function(require,module,exports){ +},{"./debug-info":57,"./node":74}],56:[function(require,module,exports){ var Node = require("./node"); var Condition = function (op, l, r, i, negate) { @@ -6595,7 +6706,7 @@ Condition.prototype.eval = function (context) { }; module.exports = Condition; -},{"./node":73}],56:[function(require,module,exports){ +},{"./node":74}],57:[function(require,module,exports){ var debugInfo = function(context, ctx, lineSeparator) { var result = ""; if (context.dumpLineNumbers && !context.compress) { @@ -6635,7 +6746,7 @@ debugInfo.asMediaQuery = function(ctx) { module.exports = debugInfo; -},{}],57:[function(require,module,exports){ +},{}],58:[function(require,module,exports){ var Node = require("./node"), Value = require("./value"), Keyword = require("./keyword"), @@ -6734,7 +6845,7 @@ Declaration.prototype.makeImportant = function () { }; module.exports = Declaration; -},{"./anonymous":47,"./keyword":68,"./node":73,"./value":85}],58:[function(require,module,exports){ +},{"./anonymous":48,"./keyword":69,"./node":74,"./value":85}],59:[function(require,module,exports){ var Node = require("./node"), contexts = require("../contexts"), utils = require("../utils"); @@ -6759,7 +6870,7 @@ DetachedRuleset.prototype.callEval = function (context) { }; module.exports = DetachedRuleset; -},{"../contexts":12,"../utils":87,"./node":73}],59:[function(require,module,exports){ +},{"../contexts":12,"../utils":88,"./node":74}],60:[function(require,module,exports){ var Node = require("./node"), unitConversions = require("../data/unit-conversions"), Unit = require("./unit"), @@ -6770,6 +6881,9 @@ var Node = require("./node"), // var Dimension = function (value, unit) { this.value = parseFloat(value); + if (isNaN(this.value)) { + throw new Error("Dimension is not a number."); + } this.unit = (unit && unit instanceof Unit) ? unit : new Unit(unit ? [unit] : undefined); this.setParent(this.unit, this); @@ -6820,7 +6934,7 @@ Dimension.prototype.genCSS = function (context, output) { // we default to the first Dimension's unit, // so `1px + 2` will yield `3px`. Dimension.prototype.operate = function (context, op, other) { - /*jshint noempty:false */ + /* jshint noempty:false */ var value = this._operate(context, op, this.value, other.value), unit = this.unit.clone(); @@ -6919,7 +7033,7 @@ Dimension.prototype.convertTo = function (conversions) { }; module.exports = Dimension; -},{"../data/unit-conversions":15,"./color":52,"./node":73,"./unit":83}],60:[function(require,module,exports){ +},{"../data/unit-conversions":15,"./color":53,"./node":74,"./unit":83}],61:[function(require,module,exports){ // Backwards compatibility shim for Directive (AtRule) var AtRule = require("./atrule"); @@ -6932,7 +7046,7 @@ Directive.prototype = Object.create(AtRule.prototype); Directive.prototype.constructor = Directive; module.exports = Directive; -},{"./atrule":49}],61:[function(require,module,exports){ +},{"./atrule":50}],62:[function(require,module,exports){ var Node = require("./node"), Paren = require("./paren"), Combinator = require("./combinator"); @@ -6995,7 +7109,7 @@ Element.prototype.toCSS = function (context) { }; module.exports = Element; -},{"./combinator":53,"./node":73,"./paren":75}],62:[function(require,module,exports){ +},{"./combinator":54,"./node":74,"./paren":76}],63:[function(require,module,exports){ var Node = require("./node"), Paren = require("./paren"), Comment = require("./comment"); @@ -7053,7 +7167,7 @@ Expression.prototype.throwAwayComments = function () { }; module.exports = Expression; -},{"./comment":54,"./node":73,"./paren":75}],63:[function(require,module,exports){ +},{"./comment":55,"./node":74,"./paren":76}],64:[function(require,module,exports){ var Node = require("./node"), Selector = require("./selector"); @@ -7092,7 +7206,7 @@ Extend.prototype.eval = function (context) { Extend.prototype.clone = function (context) { return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo()); }; -//it concatenates (joins) all selectors in selector array +// it concatenates (joins) all selectors in selector array Extend.prototype.findSelfSelectors = function (selectors) { var selfElements = [], i, @@ -7113,7 +7227,7 @@ Extend.prototype.findSelfSelectors = function (selectors) { }; module.exports = Extend; -},{"./node":73,"./selector":81}],64:[function(require,module,exports){ +},{"./node":74,"./selector":81}],65:[function(require,module,exports){ var Node = require("./node"), Media = require("./media"), URL = require("./url"), @@ -7295,11 +7409,10 @@ Import.prototype.doEval = function (context) { }; module.exports = Import; -},{"../less-error":34,"../utils":87,"./anonymous":47,"./media":69,"./node":73,"./quoted":77,"./ruleset":80,"./url":84}],65:[function(require,module,exports){ +},{"../less-error":36,"../utils":88,"./anonymous":48,"./media":70,"./node":74,"./quoted":78,"./ruleset":80,"./url":84}],66:[function(require,module,exports){ var tree = Object.create(null); tree.Node = require('./node'); -tree.Alpha = require('./alpha'); tree.Color = require('./color'); tree.AtRule = require('./atrule'); // Backwards compatibility @@ -7339,11 +7452,11 @@ tree.Media = require('./media'); tree.UnicodeDescriptor = require('./unicode-descriptor'); tree.Negative = require('./negative'); tree.Extend = require('./extend'); -tree.RulesetCall = require('./ruleset-call'); +tree.VariableCall = require('./variable-call'); module.exports = tree; -},{"./alpha":46,"./anonymous":47,"./assignment":48,"./atrule":49,"./attribute":50,"./call":51,"./color":52,"./combinator":53,"./comment":54,"./condition":55,"./declaration":57,"./detached-ruleset":58,"./dimension":59,"./directive":60,"./element":61,"./expression":62,"./extend":63,"./import":64,"./javascript":66,"./keyword":68,"./media":69,"./mixin-call":70,"./mixin-definition":71,"./negative":72,"./node":73,"./operation":74,"./paren":75,"./property":76,"./quoted":77,"./rule":78,"./ruleset":80,"./ruleset-call":79,"./selector":81,"./unicode-descriptor":82,"./unit":83,"./url":84,"./value":85,"./variable":86}],66:[function(require,module,exports){ +},{"./anonymous":48,"./assignment":49,"./atrule":50,"./attribute":51,"./call":52,"./color":53,"./combinator":54,"./comment":55,"./condition":56,"./declaration":58,"./detached-ruleset":59,"./dimension":60,"./directive":61,"./element":62,"./expression":63,"./extend":64,"./import":65,"./javascript":67,"./keyword":69,"./media":70,"./mixin-call":71,"./mixin-definition":72,"./negative":73,"./node":74,"./operation":75,"./paren":76,"./property":77,"./quoted":78,"./rule":79,"./ruleset":80,"./selector":81,"./unicode-descriptor":82,"./unit":83,"./url":84,"./value":85,"./variable":87,"./variable-call":86}],67:[function(require,module,exports){ var JsEvalNode = require("./js-eval-node"), Dimension = require("./dimension"), Quoted = require("./quoted"), @@ -7373,7 +7486,7 @@ JavaScript.prototype.eval = function(context) { module.exports = JavaScript; -},{"./anonymous":47,"./dimension":59,"./js-eval-node":67,"./quoted":77}],67:[function(require,module,exports){ +},{"./anonymous":48,"./dimension":60,"./js-eval-node":68,"./quoted":78}],68:[function(require,module,exports){ var Node = require("./node"), Variable = require("./variable"); @@ -7407,7 +7520,7 @@ JsEvalNode.prototype.evaluateJavaScript = function (expression, context) { var variables = context.frames[0].variables(); for (var k in variables) { if (variables.hasOwnProperty(k)) { - /*jshint loopfunc:true */ + /* jshint loopfunc:true */ evalContext[k.slice(1)] = { value: variables[k].value, toJS: function () { @@ -7436,7 +7549,7 @@ JsEvalNode.prototype.jsify = function (obj) { module.exports = JsEvalNode; -},{"./node":73,"./variable":86}],68:[function(require,module,exports){ +},{"./node":74,"./variable":87}],69:[function(require,module,exports){ var Node = require("./node"); var Keyword = function (value) { this.value = value; }; @@ -7452,7 +7565,7 @@ Keyword.False = new Keyword('false'); module.exports = Keyword; -},{"./node":73}],69:[function(require,module,exports){ +},{"./node":74}],70:[function(require,module,exports){ var Ruleset = require("./ruleset"), Value = require("./value"), Selector = require("./selector"), @@ -7503,19 +7616,8 @@ Media.prototype.eval = function (context) { this.rules[0].debugInfo = this.debugInfo; media.debugInfo = this.debugInfo; } - var strictMathBypass = false; - if (!context.strictMath) { - strictMathBypass = true; - context.strictMath = true; - } - try { - media.features = this.features.eval(context); - } - finally { - if (strictMathBypass) { - context.strictMath = false; - } - } + + media.features = this.features.eval(context); context.mediaPath.push(media); context.mediaBlocks.push(media); @@ -7606,7 +7708,7 @@ Media.prototype.bubbleSelectors = function (selectors) { }; module.exports = Media; -},{"../utils":87,"./anonymous":47,"./atrule":49,"./expression":62,"./ruleset":80,"./selector":81,"./value":85}],70:[function(require,module,exports){ +},{"../utils":88,"./anonymous":48,"./atrule":50,"./expression":63,"./ruleset":80,"./selector":81,"./value":85}],71:[function(require,module,exports){ var Node = require("./node"), Selector = require("./selector"), MixinDefinition = require("./mixin-definition"), @@ -7792,7 +7894,7 @@ MixinCall.prototype.format = function (args) { }; module.exports = MixinCall; -},{"../functions/default":22,"./mixin-definition":71,"./node":73,"./selector":81}],71:[function(require,module,exports){ +},{"../functions/default":24,"./mixin-definition":72,"./node":74,"./selector":81}],72:[function(require,module,exports){ var Selector = require("./selector"), Element = require("./element"), Ruleset = require("./ruleset"), @@ -7838,7 +7940,7 @@ Definition.prototype.accept = function (visitor) { } }; Definition.prototype.evalParams = function (context, mixinEnv, args, evaldArguments) { - /*jshint boss:true */ + /* jshint boss:true */ var frame = new Ruleset(null, null), varargs, arg, params = utils.copyArray(this.params), @@ -7951,7 +8053,7 @@ Definition.prototype.evalCall = function (context, args, important) { Definition.prototype.matchCondition = function (args, context) { if (this.condition && !this.condition.eval( new contexts.Eval(context, - [this.evalParams(context, /* the parameter variables*/ + [this.evalParams(context, /* the parameter variables */ new contexts.Eval(context, this.frames ? this.frames.concat(context.frames) : context.frames), args, [])] .concat(this.frames || []) // the parent namespace/mixin frames .concat(context.frames)))) { // the current environment frames @@ -7996,7 +8098,7 @@ Definition.prototype.matchArgs = function (args, context) { }; module.exports = Definition; -},{"../contexts":12,"../utils":87,"./declaration":57,"./element":61,"./expression":62,"./ruleset":80,"./selector":81}],72:[function(require,module,exports){ +},{"../contexts":12,"../utils":88,"./declaration":58,"./element":62,"./expression":63,"./ruleset":80,"./selector":81}],73:[function(require,module,exports){ var Node = require("./node"), Operation = require("./operation"), Dimension = require("./dimension"); @@ -8018,7 +8120,7 @@ Negative.prototype.eval = function (context) { }; module.exports = Negative; -},{"./dimension":59,"./node":73,"./operation":74}],73:[function(require,module,exports){ +},{"./dimension":60,"./node":74,"./operation":75}],74:[function(require,module,exports){ var Node = function() { this.parent = null; this.visibilityBlocks = undefined; @@ -8084,8 +8186,8 @@ Node.prototype._operate = function (context, op, a, b) { }; Node.prototype.fround = function(context, value) { var precision = context && context.numPrecision; - //add "epsilon" to ensure numbers like 1.000000005 (represented as 1.000000004999....) are properly rounded... - return (precision == null) ? value : Number((value + 2e-16).toFixed(precision)); + // add "epsilon" to ensure numbers like 1.000000005 (represented as 1.000000004999...) are properly rounded: + return (precision) ? Number((value + 2e-16).toFixed(precision)) : value; }; Node.compare = function (a, b) { /* returns: @@ -8145,13 +8247,13 @@ Node.prototype.removeVisibilityBlock = function () { } this.visibilityBlocks = this.visibilityBlocks - 1; }; -//Turns on node visibility - if called node will be shown in output regardless -//of whether it comes from import by reference or not +// Turns on node visibility - if called node will be shown in output regardless +// of whether it comes from import by reference or not Node.prototype.ensureVisibility = function () { this.nodeVisible = true; }; -//Turns off node visibility - if called node will NOT be shown in output regardless -//of whether it comes from import by reference or not +// Turns off node visibility - if called node will NOT be shown in output regardless +// of whether it comes from import by reference or not Node.prototype.ensureInvisibility = function () { this.nodeVisible = false; }; @@ -8177,7 +8279,7 @@ Node.prototype.copyVisibilityInfo = function(info) { }; module.exports = Node; -},{}],74:[function(require,module,exports){ +},{}],75:[function(require,module,exports){ var Node = require("./node"), Color = require("./color"), Dimension = require("./dimension"); @@ -8227,7 +8329,7 @@ Operation.prototype.genCSS = function (context, output) { module.exports = Operation; -},{"./color":52,"./dimension":59,"./node":73}],75:[function(require,module,exports){ +},{"./color":53,"./dimension":60,"./node":74}],76:[function(require,module,exports){ var Node = require("./node"); var Paren = function (node) { @@ -8245,7 +8347,7 @@ Paren.prototype.eval = function (context) { }; module.exports = Paren; -},{"./node":73}],76:[function(require,module,exports){ +},{"./node":74}],77:[function(require,module,exports){ var Node = require("./node"), Declaration = require("./declaration"); @@ -8317,7 +8419,7 @@ Property.prototype.find = function (obj, fun) { }; module.exports = Property; -},{"./declaration":57,"./node":73}],77:[function(require,module,exports){ +},{"./declaration":58,"./node":74}],78:[function(require,module,exports){ var Node = require("./node"), JsEvalNode = require("./js-eval-node"), Variable = require("./variable"), @@ -8330,7 +8432,7 @@ var Quoted = function (str, content, escaped, index, currentFileInfo) { this._index = index; this._fileInfo = currentFileInfo; }; -Quoted.prototype = new JsEvalNode(); +Quoted.prototype = new Node(); Quoted.prototype.type = "Quoted"; Quoted.prototype.genCSS = function (context, output) { if (!this.escaped) { @@ -8342,13 +8444,10 @@ Quoted.prototype.genCSS = function (context, output) { } }; Quoted.prototype.containsVariables = function() { - return this.value.match(/(`([^`]+)`)|@\{([\w-]+)\}/); + return this.value.match(/@\{([\w-]+)\}/); }; Quoted.prototype.eval = function (context) { var that = this, value = this.value; - var javascriptReplacement = function (_, exp) { - return String(that.evaluateJavaScript(exp, context)); - }; var variableReplacement = function (_, name) { var v = new Variable('@' + name, that.getIndex(), that.fileInfo()).eval(context, true); return (v instanceof Quoted) ? v.value : v.toCSS(); @@ -8365,7 +8464,6 @@ Quoted.prototype.eval = function (context) { } while (value !== evaluatedValue); return evaluatedValue; } - value = iterativeReplace(value, /`([^`]+)`/g, javascriptReplacement); value = iterativeReplace(value, /@\{([\w-]+)\}/g, variableReplacement); value = iterativeReplace(value, /\$\{([\w-]+)\}/g, propertyReplacement); return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo()); @@ -8380,7 +8478,7 @@ Quoted.prototype.compare = function (other) { }; module.exports = Quoted; -},{"./js-eval-node":67,"./node":73,"./property":76,"./variable":86}],78:[function(require,module,exports){ +},{"./js-eval-node":68,"./node":74,"./property":77,"./variable":87}],79:[function(require,module,exports){ // Backwards compatibility shim for Rule (Declaration) var Declaration = require("./declaration"); @@ -8393,23 +8491,7 @@ Rule.prototype = Object.create(Declaration.prototype); Rule.prototype.constructor = Rule; module.exports = Rule; -},{"./declaration":57}],79:[function(require,module,exports){ -var Node = require("./node"), - Variable = require("./variable"); - -var RulesetCall = function (variable) { - this.variable = variable; - this.allowRoot = true; -}; -RulesetCall.prototype = new Node(); -RulesetCall.prototype.type = "RulesetCall"; -RulesetCall.prototype.eval = function (context) { - var detachedRuleset = new Variable(this.variable).eval(context); - return detachedRuleset.callEval(context); -}; -module.exports = RulesetCall; - -},{"./node":73,"./variable":86}],80:[function(require,module,exports){ +},{"./declaration":58}],80:[function(require,module,exports){ var Node = require("./node"), Declaration = require("./declaration"), Keyword = require("./keyword"), @@ -8534,7 +8616,7 @@ Ruleset.prototype.eval = function (context) { // Evaluate mixin calls. for (i = 0; (rule = rsRules[i]); i++) { if (rule.type === "MixinCall") { - /*jshint loopfunc:true */ + /* jshint loopfunc:true */ rules = rule.eval(context).filter(function(r) { if ((r instanceof Declaration) && r.variable) { // do not pollute the scope if the variable is @@ -8547,8 +8629,8 @@ Ruleset.prototype.eval = function (context) { rsRules.splice.apply(rsRules, [i, 1].concat(rules)); i += rules.length - 1; ruleset.resetCache(); - } else if (rule.type === "RulesetCall") { - /*jshint loopfunc:true */ + } else if (rule.type === "VariableCall") { + /* jshint loopfunc:true */ rules = rule.eval(context).rules.filter(function(r) { if ((r instanceof Declaration) && r.variable) { // do not pollute the scope at all @@ -8941,7 +9023,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { // our new selector path newSelectorPath = []; - //construct the joined selector - if & is the first thing this will be empty, + // construct the joined selector - if & is the first thing this will be empty, // if not newJoinedSelector will be the last set of elements in the selector if (beginningPath.length > 0) { newSelectorPath = utils.copyArray(beginningPath); @@ -8971,7 +9053,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { newSelectorPath.push(newJoinedSelector); } - //put together the parent selectors after the join (e.g. the rest of the parent) + // put together the parent selectors after the join (e.g. the rest of the parent) if (addPath.length > 1) { var restOfPath = addPath.slice(1); restOfPath = restOfPath.map(function (selector) { @@ -9066,7 +9148,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { var nestedPaths = [], replaced, replacedNewSelectors = []; replaced = replaceParentSelector(nestedPaths, context, nestedSelector); hadParentSelector = hadParentSelector || replaced; - //the nestedPaths array should have only one member - replaceParentSelector does not multiply selectors + // the nestedPaths array should have only one member - replaceParentSelector does not multiply selectors for (k = 0; k < nestedPaths.length; k++) { var replacementSelector = createSelector(createParenthesis(nestedPaths[k], el), el); addAllReplacementsIntoPath(newSelectors, [replacementSelector], el, inSelector, replacedNewSelectors); @@ -9169,7 +9251,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { }; module.exports = Ruleset; -},{"../contexts":12,"../functions/default":22,"../functions/function-registry":24,"../utils":87,"./anonymous":47,"./comment":54,"./debug-info":56,"./declaration":57,"./element":61,"./keyword":68,"./node":73,"./paren":75,"./selector":81}],81:[function(require,module,exports){ +},{"../contexts":12,"../functions/default":24,"../functions/function-registry":26,"../utils":88,"./anonymous":48,"./comment":55,"./debug-info":57,"./declaration":58,"./element":62,"./keyword":69,"./node":74,"./paren":76,"./selector":81}],81:[function(require,module,exports){ var Node = require("./node"), Element = require("./element"), LessError = require("../less-error"); @@ -9177,12 +9259,11 @@ var Node = require("./node"), var Selector = function (elements, extendList, condition, index, currentFileInfo, visibilityInfo) { this.extendList = extendList; this.condition = condition; + this.evaldCondition = !condition; this._index = index; this._fileInfo = currentFileInfo; this.elements = this.getElements(elements); - if (!condition) { - this.evaldCondition = true; - } + this.mixinElements_ = undefined; this.copyVisibilityInfo(visibilityInfo); this.setParent(this.elements, this); }; @@ -9201,10 +9282,9 @@ Selector.prototype.accept = function (visitor) { }; Selector.prototype.createDerived = function(elements, extendList, evaldCondition) { elements = this.getElements(elements); - var info = this.visibilityInfo(); - evaldCondition = (evaldCondition != null) ? evaldCondition : this.evaldCondition; - var newSelector = new Selector(elements, extendList || this.extendList, null, this.getIndex(), this.fileInfo(), info); - newSelector.evaldCondition = evaldCondition; + var newSelector = new Selector(elements, extendList || this.extendList, + null, this.getIndex(), this.fileInfo(), this.visibilityInfo()); + newSelector.evaldCondition = (evaldCondition != null) ? evaldCondition : this.evaldCondition; newSelector.mediaEmpty = this.mediaEmpty; return newSelector; }; @@ -9238,14 +9318,13 @@ Selector.prototype.match = function (other) { len = elements.length, olen, i; - other.cacheElements(); - - olen = other._elements.length; + other = other.mixinElements(); + olen = other.length; if (olen === 0 || len < olen) { return 0; } else { for (i = 0; i < olen; i++) { - if (elements[i].value !== other._elements[i]) { + if (elements[i].value !== other[i]) { return 0; } } @@ -9253,9 +9332,9 @@ Selector.prototype.match = function (other) { return olen; // return number of matched elements }; -Selector.prototype.cacheElements = function() { - if (this._elements) { - return; +Selector.prototype.mixinElements = function() { + if (this.mixinElements_) { + return this.mixinElements_; } var elements = this.elements.map( function(v) { @@ -9270,7 +9349,7 @@ Selector.prototype.cacheElements = function() { elements = []; } - this._elements = elements; + return (this.mixinElements_ = elements); }; Selector.prototype.isJustParentSelector = function() { return !this.mediaEmpty && @@ -9292,12 +9371,9 @@ Selector.prototype.genCSS = function (context, output) { if ((!context || !context.firstSelector) && this.elements[0].combinator.value === "") { output.add(' ', this.fileInfo(), this.getIndex()); } - if (!this._css) { - //TODO caching? speed comparison? - for (i = 0; i < this.elements.length; i++) { - element = this.elements[i]; - element.genCSS(context, output); - } + for (i = 0; i < this.elements.length; i++) { + element = this.elements[i]; + element.genCSS(context, output); } }; Selector.prototype.getIsOutput = function() { @@ -9305,7 +9381,7 @@ Selector.prototype.getIsOutput = function() { }; module.exports = Selector; -},{"../less-error":34,"./element":61,"./node":73}],82:[function(require,module,exports){ +},{"../less-error":36,"./element":62,"./node":74}],82:[function(require,module,exports){ var Node = require("./node"); var UnicodeDescriptor = function (value) { @@ -9316,7 +9392,7 @@ UnicodeDescriptor.prototype.type = "UnicodeDescriptor"; module.exports = UnicodeDescriptor; -},{"./node":73}],83:[function(require,module,exports){ +},{"./node":74}],83:[function(require,module,exports){ var Node = require("./node"), unitConversions = require("../data/unit-conversions"), utils = require("../utils"); @@ -9384,7 +9460,7 @@ Unit.prototype.usedUnits = function() { var group, result = {}, mapUnit, groupName; mapUnit = function (atomicUnit) { - /*jshint loopfunc:true */ + /* jshint loopfunc:true */ if (group.hasOwnProperty(atomicUnit) && !result[groupName]) { result[groupName] = atomicUnit; } @@ -9439,7 +9515,7 @@ Unit.prototype.cancel = function () { }; module.exports = Unit; -},{"../data/unit-conversions":15,"../utils":87,"./node":73}],84:[function(require,module,exports){ +},{"../data/unit-conversions":15,"../utils":88,"./node":74}],84:[function(require,module,exports){ var Node = require("./node"); var URL = function (val, index, currentFileInfo, isEvald) { @@ -9495,7 +9571,7 @@ URL.prototype.eval = function (context) { }; module.exports = URL; -},{"./node":73}],85:[function(require,module,exports){ +},{"./node":74}],85:[function(require,module,exports){ var Node = require("./node"); var Value = function (value) { @@ -9536,7 +9612,23 @@ Value.prototype.genCSS = function (context, output) { }; module.exports = Value; -},{"./node":73}],86:[function(require,module,exports){ +},{"./node":74}],86:[function(require,module,exports){ +var Node = require("./node"), + Variable = require("./variable"); + +var VariableCall = function (variable) { + this.variable = variable; + this.allowRoot = true; +}; +VariableCall.prototype = new Node(); +VariableCall.prototype.type = "VariableCall"; +VariableCall.prototype.eval = function (context) { + var detachedRuleset = new Variable(this.variable).eval(context); + return detachedRuleset.callEval(context); +}; +module.exports = VariableCall; + +},{"./node":74,"./variable":87}],87:[function(require,module,exports){ var Node = require("./node"); var Variable = function (name, index, currentFileInfo) { @@ -9591,7 +9683,7 @@ Variable.prototype.find = function (obj, fun) { }; module.exports = Variable; -},{"./node":73}],87:[function(require,module,exports){ +},{"./node":74}],88:[function(require,module,exports){ /* jshint proto: true */ module.exports = { getLocation: function(index, inputStream) { @@ -9621,6 +9713,45 @@ module.exports = { } return copy; }, + clone: function (obj) { + var cloned = {}; + for (var prop in obj) { + if (obj.hasOwnProperty(prop)) { + cloned[prop] = obj[prop]; + } + } + return cloned; + }, + defaults: function(obj1, obj2) { + if (!obj2._defaults || obj2._defaults !== obj1) { + for (var prop in obj1) { + if (obj1.hasOwnProperty(prop)) { + if (!obj2.hasOwnProperty(prop)) { + obj2[prop] = obj1[prop]; + } + else if (Array.isArray(obj1[prop]) + && Array.isArray(obj2[prop])) { + + obj1[prop].forEach(function(p) { + if (obj2[prop].indexOf(p) === -1) { + obj2[prop].push(p); + } + }); + } + } + } + } + obj2._defaults = obj1; + return obj2; + }, + merge: function(obj1, obj2) { + for (var prop in obj2) { + if (obj2.hasOwnProperty(prop)) { + obj1[prop] = obj2[prop]; + } + } + return obj1; + }, getPrototype: function(obj) { if (Object.getPrototypeOf) { return Object.getPrototypeOf(obj); @@ -9636,13 +9767,13 @@ module.exports = { } }; -},{}],88:[function(require,module,exports){ +},{}],89:[function(require,module,exports){ var tree = require("../tree"), Visitor = require("./visitor"), logger = require("../logger"), utils = require("../utils"); -/*jshint loopfunc:true */ +/* jshint loopfunc:true */ var ExtendFinderVisitor = function() { this._visitor = new Visitor(this); @@ -9776,7 +9907,7 @@ ProcessExtendsVisitor.prototype = { iterationCount = iterationCount || 0; - //loop through comparing every extend with every target extend. + // loop through comparing every extend with every target extend. // a target extend is the one on the ruleset we are looking at copy/edit/pasting in place // e.g. .a:extend(.b) {} and .b:extend(.c) {} then the first extend extends the second one // and the second is the target. @@ -10007,7 +10138,7 @@ ProcessExtendsVisitor.prototype = { }, extendSelector:function (matches, selectorPath, replacementSelector, isVisible) { - //for a set of matches, replace each match with the replacement selector + // for a set of matches, replace each match with the replacement selector var currentSelectorPathIndex = 0, currentSelectorPathElementIndex = 0, @@ -10099,7 +10230,7 @@ ProcessExtendsVisitor.prototype = { module.exports = ProcessExtendsVisitor; -},{"../logger":35,"../tree":65,"../utils":87,"./visitor":95}],89:[function(require,module,exports){ +},{"../logger":37,"../tree":66,"../utils":88,"./visitor":96}],90:[function(require,module,exports){ function ImportSequencer(onSequencerEmpty) { this.imports = []; this.variableImports = []; @@ -10155,7 +10286,7 @@ ImportSequencer.prototype.tryRun = function() { module.exports = ImportSequencer; -},{}],90:[function(require,module,exports){ +},{}],91:[function(require,module,exports){ var contexts = require("../contexts"), Visitor = require("./visitor"), ImportSequencer = require("./import-sequencer"), @@ -10347,7 +10478,7 @@ ImportVisitor.prototype = { }; module.exports = ImportVisitor; -},{"../contexts":12,"../utils":87,"./import-sequencer":89,"./visitor":95}],91:[function(require,module,exports){ +},{"../contexts":12,"../utils":88,"./import-sequencer":90,"./visitor":96}],92:[function(require,module,exports){ var visitors = { Visitor: require("./visitor"), ImportVisitor: require('./import-visitor'), @@ -10359,7 +10490,7 @@ var visitors = { module.exports = visitors; -},{"./extend-visitor":88,"./import-visitor":90,"./join-selector-visitor":92,"./set-tree-visibility-visitor":93,"./to-css-visitor":94,"./visitor":95}],92:[function(require,module,exports){ +},{"./extend-visitor":89,"./import-visitor":91,"./join-selector-visitor":93,"./set-tree-visibility-visitor":94,"./to-css-visitor":95,"./visitor":96}],93:[function(require,module,exports){ var Visitor = require("./visitor"); var JoinSelectorVisitor = function() { @@ -10412,7 +10543,7 @@ JoinSelectorVisitor.prototype = { module.exports = JoinSelectorVisitor; -},{"./visitor":95}],93:[function(require,module,exports){ +},{"./visitor":96}],94:[function(require,module,exports){ var SetTreeVisibilityVisitor = function(visible) { this.visible = visible; }; @@ -10451,7 +10582,7 @@ SetTreeVisibilityVisitor.prototype.visit = function(node) { return node; }; module.exports = SetTreeVisibilityVisitor; -},{}],94:[function(require,module,exports){ +},{}],95:[function(require,module,exports){ var tree = require("../tree"), Visitor = require("./visitor"); @@ -10463,14 +10594,14 @@ var CSSVisitorUtils = function(context) { CSSVisitorUtils.prototype = { containsSilentNonBlockedChild: function(bodyRules) { var rule; - if (bodyRules == null) { + if (!bodyRules) { return false; } for (var r = 0; r < bodyRules.length; r++) { rule = bodyRules[r]; if (rule.isSilent && rule.isSilent(this._context) && !rule.blocksVisibility()) { - //the atrule contains something that was referenced (likely by extend) - //therefore it needs to be shown in output too + // the atrule contains something that was referenced (likely by extend) + // therefore it needs to be shown in output too return true; } } @@ -10478,28 +10609,21 @@ CSSVisitorUtils.prototype = { }, keepOnlyVisibleChilds: function(owner) { - if (owner == null || owner.rules == null) { - return ; - } - - owner.rules = owner.rules.filter(function(thing) { - return thing.isVisible(); + if (owner && owner.rules) { + owner.rules = owner.rules.filter(function(thing) { + return thing.isVisible(); + }); } - ); }, isEmpty: function(owner) { - if (owner == null || owner.rules == null) { - return true; - } - return owner.rules.length === 0; + return (owner && owner.rules) + ? (owner.rules.length === 0) : true; }, hasVisibleSelector: function(rulesetNode) { - if (rulesetNode == null || rulesetNode.paths == null) { - return false; - } - return rulesetNode.paths.length > 0; + return (rulesetNode && rulesetNode.paths) + ? (rulesetNode.paths.length > 0) : false; }, resolveVisibility: function (node, originalRules) { @@ -10600,9 +10724,16 @@ ToCSSVisitor.prototype = { } }, + visitAnonymous: function(anonymousNode, visitArgs) { + if (!anonymousNode.blocksVisibility()) { + anonymousNode.accept(this._visitor); + return anonymousNode; + } + }, + visitAtRuleWithBody: function(atRuleNode, visitArgs) { - //if there is only one nested ruleset and that one has no path, then it is - //just fake ruleset + // if there is only one nested ruleset and that one has no path, then it is + // just fake ruleset function hasFakeRuleset(atRuleNode) { var bodyRules = atRuleNode.rules; return bodyRules.length === 1 && (!bodyRules[0].paths || bodyRules[0].paths.length === 0); @@ -10615,9 +10746,9 @@ ToCSSVisitor.prototype = { return nodeRules; } - //it is still true that it is only one ruleset in array - //this is last such moment - //process childs + // it is still true that it is only one ruleset in array + // this is last such moment + // process childs var originalRules = getBodyRules(atRuleNode); atRuleNode.accept(this._visitor); visitArgs.visitDeeper = false; @@ -10675,13 +10806,13 @@ ToCSSVisitor.prototype = { }, visitRuleset: function (rulesetNode, visitArgs) { - //at this point rulesets are nested into each other + // at this point rulesets are nested into each other var rule, rulesets = []; this.checkValidNodes(rulesetNode.rules, rulesetNode.firstRoot); if (!rulesetNode.root) { - //remove invisible paths + // remove invisible paths this._compileRulesetPaths(rulesetNode); // remove rulesets from this ruleset body and compile them separately @@ -10707,7 +10838,7 @@ ToCSSVisitor.prototype = { } visitArgs.visitDeeper = false; - } else { //if (! rulesetNode.root) { + } else { // if (! rulesetNode.root) { rulesetNode.accept(this._visitor); visitArgs.visitDeeper = false; } @@ -10717,7 +10848,7 @@ ToCSSVisitor.prototype = { this._removeDuplicateRules(rulesetNode.rules); } - //now decide whether we keep the ruleset + // now decide whether we keep the ruleset if (this.utils.isVisibleRuleset(rulesetNode)) { rulesetNode.ensureVisibility(); rulesets.splice(0, 0, rulesetNode); @@ -10775,78 +10906,45 @@ ToCSSVisitor.prototype = { } }, - _mergeRules: function (rules) { - if (!rules) { return; } - - var groups = {}, - parts, - rule, - key; + _mergeRules: function(rules) { + if (!rules) { + return; + } + var groups = {}, + groupsArr = []; + for (var i = 0; i < rules.length; i++) { - rule = rules[i]; - - if ((rule instanceof tree.Declaration) && rule.merge) { - key = [rule.name, - rule.important ? "!" : ""].join(","); - - if (!groups[key]) { - groups[key] = []; - } else { - rules.splice(i--, 1); - } - + var rule = rules[i]; + if (rule.merge) { + var key = rule.name; + groups[key] ? rules.splice(i--, 1) : + groupsArr.push(groups[key] = []); groups[key].push(rule); } } - Object.keys(groups).map(function (k) { - - function toExpression(values) { - return new (tree.Expression)(values.map(function (p) { - return p.value; - })); - } - - function toValue(values) { - return new (tree.Value)(values.map(function (p) { - return p; - })); - } - - parts = groups[k]; - - if (parts.length > 1) { - rule = parts[0]; - var spacedGroups = []; - var lastSpacedGroup = []; - parts.map(function (p) { - if (p.merge === "+") { - if (lastSpacedGroup.length > 0) { - spacedGroups.push(toExpression(lastSpacedGroup)); - } - lastSpacedGroup = []; + groupsArr.forEach(function(group) { + if (group.length > 0) { + var result = group[0], + space = [], + comma = [new tree.Expression(space)]; + group.forEach(function(rule) { + if ((rule.merge === '+') && (space.length > 0)) { + comma.push(new tree.Expression(space = [])); } - lastSpacedGroup.push(p); + space.push(rule.value); + result.important = result.important || rule.important; }); - spacedGroups.push(toExpression(lastSpacedGroup)); - rule.value = toValue(spacedGroups); + result.value = new tree.Value(comma); } }); - }, - - visitAnonymous: function(anonymousNode, visitArgs) { - if (anonymousNode.blocksVisibility()) { - return ; - } - anonymousNode.accept(this._visitor); - return anonymousNode; } }; module.exports = ToCSSVisitor; -},{"../tree":65,"./visitor":95}],95:[function(require,module,exports){ +},{"../tree":66,"./visitor":96}],96:[function(require,module,exports){ var tree = require("../tree"); var _visitArgs = { visitDeeper: true }, @@ -10860,7 +10958,7 @@ function indexNodeTypes(parent, ticker) { // add .typeIndex to tree node types for lookup table var key, child; for (key in parent) { - /*eslint guard-for-in: 0 */ + /* eslint guard-for-in: 0 */ child = parent[key]; switch (typeof child) { case "function": @@ -11000,7 +11098,7 @@ Visitor.prototype = { }; module.exports = Visitor; -},{"../tree":65}],96:[function(require,module,exports){ +},{"../tree":66}],97:[function(require,module,exports){ "use strict"; // rawAsap provides everything we need except exception management. @@ -11068,7 +11166,7 @@ RawTask.prototype.call = function () { } }; -},{"./raw":97}],97:[function(require,module,exports){ +},{"./raw":98}],98:[function(require,module,exports){ (function (global){ "use strict"; @@ -11148,9 +11246,12 @@ function flush() { // Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that // have WebKitMutationObserver but not un-prefixed MutationObserver. -// Must use `global` instead of `window` to work in both frames and web +// Must use `global` or `self` instead of `window` to work in both frames and web // workers. `global` is a provision of Browserify, Mr, Mrs, or Mop. -var BrowserMutationObserver = global.MutationObserver || global.WebKitMutationObserver; + +/* globals self */ +var scope = typeof global !== "undefined" ? global : self; +var BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver; // MutationObservers are desirable because they have high priority and work // reliably everywhere they are implemented. @@ -11292,7 +11393,7 @@ rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer; // https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],98:[function(require,module,exports){ +},{}],99:[function(require,module,exports){ 'use strict'; var asap = require('asap/raw'); @@ -11351,17 +11452,17 @@ function Promise(fn) { throw new TypeError('Promises must be constructed via new'); } if (typeof fn !== 'function') { - throw new TypeError('not a function'); + throw new TypeError('Promise constructor\'s argument is not a function'); } - this._45 = 0; - this._81 = 0; - this._65 = null; - this._54 = null; + this._40 = 0; + this._65 = 0; + this._55 = null; + this._72 = null; if (fn === noop) return; doResolve(fn, this); } -Promise._10 = null; -Promise._97 = null; +Promise._37 = null; +Promise._87 = null; Promise._61 = noop; Promise.prototype.then = function(onFulfilled, onRejected) { @@ -11379,26 +11480,26 @@ function safeThen(self, onFulfilled, onRejected) { res.then(resolve, reject); handle(self, new Handler(onFulfilled, onRejected, res)); }); -}; +} function handle(self, deferred) { - while (self._81 === 3) { - self = self._65; + while (self._65 === 3) { + self = self._55; } - if (Promise._10) { - Promise._10(self); + if (Promise._37) { + Promise._37(self); } - if (self._81 === 0) { - if (self._45 === 0) { - self._45 = 1; - self._54 = deferred; + if (self._65 === 0) { + if (self._40 === 0) { + self._40 = 1; + self._72 = deferred; return; } - if (self._45 === 1) { - self._45 = 2; - self._54 = [self._54, deferred]; + if (self._40 === 1) { + self._40 = 2; + self._72 = [self._72, deferred]; return; } - self._54.push(deferred); + self._72.push(deferred); return; } handleResolved(self, deferred); @@ -11406,16 +11507,16 @@ function handle(self, deferred) { function handleResolved(self, deferred) { asap(function() { - var cb = self._81 === 1 ? deferred.onFulfilled : deferred.onRejected; + var cb = self._65 === 1 ? deferred.onFulfilled : deferred.onRejected; if (cb === null) { - if (self._81 === 1) { - resolve(deferred.promise, self._65); + if (self._65 === 1) { + resolve(deferred.promise, self._55); } else { - reject(deferred.promise, self._65); + reject(deferred.promise, self._55); } return; } - var ret = tryCallOne(cb, self._65); + var ret = tryCallOne(cb, self._55); if (ret === IS_ERROR) { reject(deferred.promise, LAST_ERROR); } else { @@ -11443,8 +11544,8 @@ function resolve(self, newValue) { then === self.then && newValue instanceof Promise ) { - self._81 = 3; - self._65 = newValue; + self._65 = 3; + self._55 = newValue; finale(self); return; } else if (typeof then === 'function') { @@ -11452,29 +11553,29 @@ function resolve(self, newValue) { return; } } - self._81 = 1; - self._65 = newValue; + self._65 = 1; + self._55 = newValue; finale(self); } function reject(self, newValue) { - self._81 = 2; - self._65 = newValue; - if (Promise._97) { - Promise._97(self, newValue); + self._65 = 2; + self._55 = newValue; + if (Promise._87) { + Promise._87(self, newValue); } finale(self); } function finale(self) { - if (self._45 === 1) { - handle(self, self._54); - self._54 = null; + if (self._40 === 1) { + handle(self, self._72); + self._72 = null; } - if (self._45 === 2) { - for (var i = 0; i < self._54.length; i++) { - handle(self, self._54[i]); + if (self._40 === 2) { + for (var i = 0; i < self._72.length; i++) { + handle(self, self._72[i]); } - self._54 = null; + self._72 = null; } } @@ -11500,14 +11601,14 @@ function doResolve(fn, promise) { if (done) return; done = true; reject(promise, reason); - }) + }); if (!done && res === IS_ERROR) { done = true; reject(promise, LAST_ERROR); } } -},{"asap/raw":97}],99:[function(require,module,exports){ +},{"asap/raw":98}],100:[function(require,module,exports){ 'use strict'; //This file contains the ES6 extensions to the core Promises/A+ API @@ -11527,8 +11628,8 @@ var EMPTYSTRING = valuePromise(''); function valuePromise(value) { var p = new Promise(Promise._61); - p._81 = 1; - p._65 = value; + p._65 = 1; + p._55 = value; return p; } Promise.resolve = function (value) { @@ -11565,11 +11666,11 @@ Promise.all = function (arr) { function res(i, val) { if (val && (typeof val === 'object' || typeof val === 'function')) { if (val instanceof Promise && val.then === Promise.prototype.then) { - while (val._81 === 3) { - val = val._65; + while (val._65 === 3) { + val = val._55; } - if (val._81 === 1) return res(i, val._65); - if (val._81 === 2) reject(val._65); + if (val._65 === 1) return res(i, val._55); + if (val._65 === 2) reject(val._55); val.then(function (val) { res(i, val); }, reject); @@ -11616,7 +11717,7 @@ Promise.prototype['catch'] = function (onRejected) { return this.then(null, onRejected); }; -},{"./core.js":98}],100:[function(require,module,exports){ +},{"./core.js":99}],101:[function(require,module,exports){ // should work in any browser without browserify if (typeof Promise.prototype.done !== 'function') { @@ -11629,7 +11730,7 @@ if (typeof Promise.prototype.done !== 'function') { }) } } -},{}],101:[function(require,module,exports){ +},{}],102:[function(require,module,exports){ // not "use strict" so we can declare global "Promise" var asap = require('asap'); @@ -11641,5 +11742,5 @@ if (typeof Promise === 'undefined') { require('./polyfill-done.js'); -},{"./lib/core.js":98,"./lib/es6-extensions.js":99,"./polyfill-done.js":100,"asap":96}]},{},[2])(2) +},{"./lib/core.js":99,"./lib/es6-extensions.js":100,"./polyfill-done.js":101,"asap":97}]},{},[2])(2) }); \ No newline at end of file diff --git a/dist/less.min.js b/dist/less.min.js index a4ddf9e11..0ab424693 100644 --- a/dist/less.min.js +++ b/dist/less.min.js @@ -1,5 +1,5 @@ /*! - * Less - Leaner CSS v3.0.0-alpha.1 + * Less - Leaner CSS v3.0.0-alpha.3 * http://lesscss.org * * Copyright (c) 2009-2017, Alexis Sellier @@ -10,8 +10,8 @@ /** * @license Apache-2.0 */ -!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.less=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0||b.isFileProtocol?"development":"production");var c=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(a.location.hash);c&&(b.dumpLineNumbers=c[1]),void 0===b.useFileCache&&(b.useFileCache=!0),void 0===b.onReady&&(b.onReady=!0),b.javascriptEnabled=!(!b.javascriptEnabled&&!b.inlineJavaScript)}},{"./browser":3,"./utils":11}],2:[function(a,b,c){function d(a){a.filename&&console.warn(a),e.async||h.removeChild(i)}a("promise/polyfill");var e=window.less||{};a("./add-default-options")(window,e);var f=b.exports=a("./index")(window,e);window.less=f;var g,h,i;e.onReady&&(/!watch/.test(window.location.hash)&&f.watch(),e.async||(g="body { display: none !important }",h=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),i.type="text/css",i.styleSheet?i.styleSheet.cssText=g:i.appendChild(document.createTextNode(g)),h.appendChild(i)),f.registerStylesheetsImmediately(),f.pageLoadFinished=f.refresh("development"===f.env).then(d,d))},{"./add-default-options":1,"./index":8,"promise/polyfill":101}],3:[function(a,b,c){var d=a("./utils");b.exports={createCSS:function(a,b,c){var e=c.href||"",f="less:"+(c.title||d.extractId(e)),g=a.getElementById(f),h=!1,i=a.createElement("style");i.setAttribute("type","text/css"),c.media&&i.setAttribute("media",c.media),i.id=f,i.styleSheet||(i.appendChild(a.createTextNode(b)),h=null!==g&&g.childNodes.length>0&&i.childNodes.length>0&&g.firstChild.nodeValue===i.firstChild.nodeValue);var j=a.getElementsByTagName("head")[0];if(null===g||h===!1){var k=c&&c.nextSibling||null;k?k.parentNode.insertBefore(i,k):j.appendChild(i)}if(g&&h===!1&&g.parentNode.removeChild(g),i.styleSheet)try{i.styleSheet.cssText=b}catch(l){throw new Error("Couldn't reassign styleSheet.cssText.")}},currentScript:function(a){var b=a.document;return b.currentScript||function(){var a=b.getElementsByTagName("script");return a[a.length-1]}()}}},{"./utils":11}],4:[function(a,b,c){b.exports=function(a,b,c){var d=null;if("development"!==b.env)try{d="undefined"==typeof a.localStorage?null:a.localStorage}catch(e){}return{setCSS:function(a,b,e,f){if(d){c.info("saving "+a+" to cache.");try{d.setItem(a,f),d.setItem(a+":timestamp",b),e&&d.setItem(a+":vars",JSON.stringify(e))}catch(g){c.error('failed to save "'+a+'" to local storage for caching.')}}},getCSS:function(a,b,c){var e=d&&d.getItem(a),f=d&&d.getItem(a+":timestamp"),g=d&&d.getItem(a+":vars");if(c=c||{},f&&b.lastModified&&new Date(b.lastModified).valueOf()===new Date(f).valueOf()&&(!c&&!g||JSON.stringify(c)===g))return e}}}},{}],5:[function(a,b,c){var d=a("./utils"),e=a("./browser");b.exports=function(a,b,c){function f(b,f){var g,h,i="less-error-message:"+d.extractId(f||""),j='
    • {content}
    • ',k=a.document.createElement("div"),l=[],m=b.filename||f,n=m.match(/([^\/]+(\?.*)?)$/)[1];k.id=i,k.className="less-error-message",h="

      "+(b.type||"Syntax")+"Error: "+(b.message||"There is an error in your .less file")+'

      in '+n+" ";var o=function(a,b,c){void 0!==a.extract[b]&&l.push(j.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};b.line&&(o(b,0,""),o(b,1,"line"),o(b,2,""),h+="on line "+b.line+", column "+(b.column+1)+":

        "+l.join("")+"
      "),b.stack&&(b.extract||c.logLevel>=4)&&(h+="
      Stack Trace
      "+b.stack.split("\n").slice(1).join("
      ")),k.innerHTML=h,e.createCSS(a.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),k.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===c.env&&(g=setInterval(function(){var b=a.document,c=b.body;c&&(b.getElementById(i)?c.replaceChild(k,b.getElementById(i)):c.insertBefore(k,c.firstChild),clearInterval(g))},10))}function g(b){var c=a.document.getElementById("less-error-message:"+d.extractId(b));c&&c.parentNode.removeChild(c)}function h(a){}function i(a){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?h(a):"function"==typeof c.errorReporting&&c.errorReporting("remove",a):g(a)}function j(a,d){var e="{line} {content}",f=a.filename||d,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f,i=function(a,b,c){void 0!==a.extract[b]&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.line&&(i(a,0,""),i(a,1,"line"),i(a,2,""),h+=" on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")),a.stack&&(a.extract||c.logLevel>=4)&&(h+="\nStack Trace\n"+a.stack),b.logger.error(h)}function k(a,b){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?j(a,b):"function"==typeof c.errorReporting&&c.errorReporting("add",a,b):f(a,b)}return{add:k,remove:i}}},{"./browser":3,"./utils":11}],6:[function(a,b,c){b.exports=function(b,c){var d=a("../less/environment/abstract-file-manager.js"),e={},f=function(){};return f.prototype=new d,f.prototype.alwaysMakePathsAbsolute=function(){return!0},f.prototype.join=function(a,b){return a?this.extractUrlParts(b,a).path:b},f.prototype.doXHR=function(a,d,e,f){function g(b,c,d){b.status>=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var h=new XMLHttpRequest,i=!b.isFileProtocol||b.fileAsync;"function"==typeof h.overrideMimeType&&h.overrideMimeType("text/css"),c.debug("XHR: Getting '"+a+"'"),h.open("GET",a,i),h.setRequestHeader("Accept",d||"text/x-less, text/css; q=0.9, */*; q=0.5"),h.send(null),b.isFileProtocol&&!b.fileAsync?0===h.status||h.status>=200&&h.status<300?e(h.responseText):f(h.status,a):i?h.onreadystatechange=function(){4==h.readyState&&g(h,e,f)}:g(h,e,f)},f.prototype.supports=function(a,b,c,d){return!0},f.prototype.clearFileCache=function(){e={}},f.prototype.loadFile=function(a,b,c,d,f){b&&!this.isPathAbsolute(a)&&(a=b+a),c=c||{};var g=this.extractUrlParts(a,window.location.href),h=g.url;if(c.useFileCache&&e[h])try{var i=e[h];f(null,{contents:i,filename:h,webInfo:{lastModified:new Date}})}catch(j){f({filename:h,message:"Error loading file "+h+" error was "+j.message})}else this.doXHR(h,c.mime,function(a,b){e[h]=a,f(null,{contents:a,filename:h,webInfo:{lastModified:b}})},function(a,b){f({type:"File",message:"'"+b+"' wasn't found ("+a+")",href:h})})},f}},{"../less/environment/abstract-file-manager.js":16}],7:[function(a,b,c){b.exports=function(){function b(){throw{type:"Runtime",message:"Image size functions are not supported in browser version of less"}}var c=a("./../less/functions/function-registry"),d={"image-size":function(a){return b(this,a),-1},"image-width":function(a){return b(this,a),-1},"image-height":function(a){return b(this,a),-1}};c.addMultiple(d)}},{"./../less/functions/function-registry":24}],8:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(b,c){function f(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function g(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}}function h(a){for(var b,d=l.getElementsByTagName("style"),e=0;e=c&&console.log(a)},info:function(a){b.logLevel>=d&&console.log(a)},warn:function(a){b.logLevel>=e&&console.warn(a)},error:function(a){b.logLevel>=f&&console.error(a)}}]);for(var g=0;g0&&(a=a.slice(0,b)),b=a.lastIndexOf("/"),b<0&&(b=a.lastIndexOf("\\")),b<0?"":a.slice(0,b+1)},d.prototype.tryAppendExtension=function(a,b){return/(\.[a-z]*$)|([\?;].*)$/.test(a)?a:a+b},d.prototype.tryAppendLessExtension=function(a){return this.tryAppendExtension(a,".less")},d.prototype.supportsSync=function(){return!1},d.prototype.alwaysMakePathsAbsolute=function(){return!1},d.prototype.isPathAbsolute=function(a){return/^(?:[a-z-]+:|\/|\\|#)/i.test(a)},d.prototype.join=function(a,b){return a?a+b:b},d.prototype.pathDiff=function(a,b){var c,d,e,f,g=this.extractUrlParts(a),h=this.extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;c0&&(h.splice(c-1,2),c-=2)}return g.hostPart=f[1],g.directories=h,g.path=(f[1]||"")+h.join("/"),g.filename=f[4],g.fileUrl=g.path+(f[4]||""),g.url=g.fileUrl+(f[5]||""),g},b.exports=d},{}],17:[function(a,b,c){function d(a,b){throw new f({type:b||"Syntax",message:a})}var e=a("../functions/function-registry"),f=a("../less-error"),g=function(){};g.prototype.evalPlugin=function(a,b,c,d,f){var g,h,i,j,k,l,m;l=b.pluginManager,f&&(m="string"==typeof f?f:f.filename);var n=(new this.less.FileManager).extractUrlParts(m).filename;if(m&&(i=l.get(m))){this.trySetOptions(i,m,n,d);try{i.use&&i.use.call(this.context,i)}catch(o){return o.message="Error during @plugin call",new this.less.LessError(o,c,m)}return i}j={exports:{},pluginManager:l,fileInfo:f},k=j.exports,h=e.create();var p=function(a){i=a};try{g=new Function("module","require","registerPlugin","functions","tree","less","fileInfo",a),g(j,this.require,p,h,this.less.tree,this.less,f)}catch(o){return new this.less.LessError({message:"Parse error"},c,m)}if(i||(i=j.exports),i=this.validatePlugin(i,m,n),!i)return new this.less.LessError({message:"Not a valid plugin"});l.addPlugin(i,f.filename,h),i.functions=h.getLocalFunctions(),i.imports=c,i.filename=m,this.trySetOptions(i,m,n,d);try{i.use&&i.use.call(this.context,i)}catch(o){return o.message="Error during @plugin call",new this.less.LessError(o,c,m)}return i},g.prototype.trySetOptions=function(a,b,c,e){if(e){if(!a.setOptions)return d("Options have been provided but the plugin "+c+" does not support any options."),null;try{a.setOptions(e)}catch(f){return d("Error setting options on plugin "+c+"\n"+f.message),null}}},g.prototype.validatePlugin=function(a,b,c){return a?("function"==typeof a&&(a=new a),a.minVersion&&this.compareVersion(a.minVersion,this.less.version)<0?(d("Plugin "+c+" requires version "+this.versionToString(a.minVersion)),null):a):null},g.prototype.compareVersion=function(a,b){"string"==typeof a&&(a=a.match(/^(\d+)\.?(\d+)?\.?(\d+)?/),a.shift());for(var c=0;cparseInt(b[c])?-1:1;return 0},g.prototype.versionToString=function(a){for(var b="",c=0;c=0;h--){var i=g[h];if(i[f?"supportsSync":"supports"](a,b,c,e))return i}return null},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},b.exports=e},{"../logger":35}],19:[function(a,b,c){function d(a,b,c){var d,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;l<3;l++)d=b.rgb[l]/255,f=c.rgb[l]/255,h=a(d,f),g&&(h=(j*f+i*(d-j*(d+f-h)))/g),k[l]=255*h;return new e(k,g)}var e=a("../tree/color"),f=a("./function-registry"),g={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,a<=1?g.multiply(a,b):g.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return g.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};for(var h in g)g.hasOwnProperty(h)&&(d[h]=d.bind(null,g[h]));f.addMultiple(d)},{"../tree/color":52,"./function-registry":24}],20:[function(a,b,c){function d(a){return Math.min(1,Math.max(0,a))}function e(a){return h.hsla(a.h,a.s,a.l,a.a)}function f(a){if(a instanceof i)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{type:"Argument",message:"color functions take numbers as parameters"}}function g(a,b){return a instanceof i&&a.unit.is("%")?parseFloat(a.value*b/100):f(a)}var h,i=a("../tree/dimension"),j=a("../tree/color"),k=a("../tree/quoted"),l=a("../tree/anonymous"),m=a("./function-registry");h={rgb:function(a,b,c){return h.rgba(a,b,c,1)},rgba:function(a,b,c,d){var e=[a,b,c].map(function(a){return g(a,255)});return d=f(d),new j(e,d)},hsl:function(a,b,c){return h.hsla(a,b,c,1)},hsla:function(a,b,c,e){function g(a){return a=a<0?a+1:a>1?a-1:a,6*a<1?i+(j-i)*a*6:2*a<1?j:3*a<2?i+(j-i)*(2/3-a)*6:i}var i,j;return a=f(a)%360/360,b=d(f(b)),c=d(f(c)),e=d(f(e)),j=c<=.5?c*(b+1):c+b-c*b,i=2*c-j,h.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),e)},hsv:function(a,b,c){return h.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=f(a)%360/360*360,b=f(b),c=f(c),d=f(d);var e,g;e=Math.floor(a/60%6),g=a/60-e;var i=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],j=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return h.rgba(255*i[j[e][0]],255*i[j[e][1]],255*i[j[e][2]],d)},hue:function(a){return new i(a.toHSL().h)},saturation:function(a){return new i(100*a.toHSL().s,"%")},lightness:function(a){return new i(100*a.toHSL().l,"%")},hsvhue:function(a){return new i(a.toHSV().h)},hsvsaturation:function(a){return new i(100*a.toHSV().s,"%")},hsvvalue:function(a){return new i(100*a.toHSV().v,"%")},red:function(a){return new i(a.rgb[0])},green:function(a){return new i(a.rgb[1])},blue:function(a){return new i(a.rgb[2])},alpha:function(a){return new i(a.toHSL().a)},luma:function(a){return new i(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new i(b*a.alpha*100,"%")},saturate:function(a,b,c){if(!a.rgb)return null;var f=a.toHSL();return f.s+="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},desaturate:function(a,b,c){var f=a.toHSL();return f.s-="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},lighten:function(a,b,c){var f=a.toHSL();return f.l+="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},darken:function(a,b,c){var f=a.toHSL();return f.l-="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},fadein:function(a,b,c){var f=a.toHSL();return f.a+="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fadeout:function(a,b,c){var f=a.toHSL();return f.a-="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=d(c.a),e(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=d<0?360+d:d,e(c)},mix:function(a,b,c){a.toHSL&&b.toHSL||(console.log(b.type),console.dir(b)),c||(c=new i(50));var d=c.value/100,e=2*d-1,f=a.toHSL().a-b.toHSL().a,g=((e*f==-1?e:(e+f)/(1+e*f))+1)/2,h=1-g,k=[a.rgb[0]*g+b.rgb[0]*h,a.rgb[1]*g+b.rgb[1]*h,a.rgb[2]*g+b.rgb[2]*h],l=a.alpha*d+b.alpha*(1-d);return new j(k,l)},greyscale:function(a){return h.desaturate(a,new i(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;"undefined"==typeof b&&(b=h.rgba(0,0,0,1)),"undefined"==typeof c&&(c=h.rgba(255,255,255,1));var e,f,g=a.luma(),i=b.luma(),j=c.luma();return e=g>i?(g+.05)/(i+.05):(i+.05)/(g+.05),f=g>j?(g+.05)/(j+.05):(j+.05)/(g+.05),e>f?b:c},argb:function(a){return new l(a.toARGB())},color:function(a){if(a instanceof k&&/^#([a-f0-9]{6}|[a-f0-9]{3})$/i.test(a.value))return new j(a.value.slice(1));if(a instanceof j||(a=j.fromKeyword(a.value)))return a.value=void 0,a;throw{type:"Argument",message:"argument must be a color keyword or 3/6 digit hex e.g. #FFF"}},tint:function(a,b){return h.mix(h.rgb(255,255,255),a,b)},shade:function(a,b){return h.mix(h.rgb(0,0,0),a,b)}},m.addMultiple(h)},{"../tree/anonymous":47,"../tree/color":52,"../tree/dimension":59,"../tree/quoted":77,"./function-registry":24}],21:[function(a,b,c){b.exports=function(b){var c=a("../tree/quoted"),d=a("../tree/url"),e=a("./function-registry"),f=function(a,b){return new d(b,a.index,a.currentFileInfo).eval(a.context)},g=a("../logger");e.add("data-uri",function(a,e){e||(e=a,a=null);var h=a&&a.value,i=e.value,j=this.currentFileInfo,k=j.relativeUrls?j.currentDirectory:j.entryPath,l=i.indexOf("#"),m="";l!==-1&&(m=i.slice(l),i=i.slice(0,l));var n=b.getFileManager(i,k,this.context,b,!0);if(!n)return f(this,e);var o=!1;if(a)o=/;base64$/.test(h);else{if(h=b.mimeLookup(i),"image/svg+xml"===h)o=!1;else{var p=b.charsetLookup(h);o=["US-ASCII","UTF-8"].indexOf(p)<0}o&&(h+=";base64")}var q=n.loadFileSync(i,k,this.context,b);if(!q.contents)return g.warn("Skipped data-uri embedding of "+i+" because file not found"),f(this,e||a);var r=q.contents;if(o&&!b.encodeBase64)return f(this,e);r=o?b.encodeBase64(r):encodeURIComponent(r);var s="data:"+h+","+r+m,t=32768;return s.length>=t&&this.context.ieCompat!==!1?(g.warn("Skipped data-uri embedding of "+i+" because its size ("+s.length+" characters) exceeds IE8-safe "+t+" characters!"),f(this,e||a)):new d(new c('"'+s+'"',s,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../logger":35,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],22:[function(a,b,c){var d=a("../tree/keyword"),e=a("./function-registry"),f={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;if(null!=a)return a?d.True:d.False},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}};e.add("default",f.eval.bind(f)),b.exports=f},{"../tree/keyword":68,"./function-registry":24}],23:[function(a,b,c){var d=a("../tree/expression"),e=function(a,b,c,d){this.name=a.toLowerCase(),this.index=c,this.context=b,this.currentFileInfo=d,this.func=b.frames[0].functionRegistry.get(this.name)};e.prototype.isValid=function(){return Boolean(this.func)},e.prototype.call=function(a){return Array.isArray(a)&&(a=a.filter(function(a){return"Comment"!==a.type}).map(function(a){if("Expression"===a.type){var b=a.value.filter(function(a){return"Comment"!==a.type});return 1===b.length?b[0]:new d(b)}return a})),this.func.apply(this,a)},b.exports=e},{"../tree/expression":62}],24:[function(a,b,c){function d(a){return{_data:{},add:function(a,b){a=a.toLowerCase(),this._data.hasOwnProperty(a),this._data[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){this.add(b,a[b])}.bind(this))},get:function(b){return this._data[b]||a&&a.get(b)},getLocalFunctions:function(){return this._data},inherit:function(){return d(this)},create:function(a){return d(a)}}}b.exports=d(null)},{}],25:[function(a,b,c){b.exports=function(b){var c={functionRegistry:a("./function-registry"),functionCaller:a("./function-caller")};return a("./default"),a("./color"),a("./color-blending"),a("./data-uri")(b),a("./math"),a("./number"),a("./string"),a("./svg")(b),a("./types"),c}},{"./color":20,"./color-blending":19,"./data-uri":21,"./default":22,"./function-caller":23,"./function-registry":24,"./math":27,"./number":28,"./string":29,"./svg":30,"./types":31}],26:[function(a,b,c){var d=a("../tree/dimension"),e=function(){};e._math=function(a,b,c){if(!(c instanceof d))throw{type:"Argument",message:"argument must be a number"};return null==b?b=c.unit:c=c.unify(),new d(a(parseFloat(c.value)),b)},b.exports=e},{"../tree/dimension":59}],27:[function(a,b,c){var d=a("./function-registry"),e=a("./math-helper.js"),f={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad" -};for(var g in f)f.hasOwnProperty(g)&&(f[g]=e._math.bind(null,Math[g],f[g]));f.round=function(a,b){var c="undefined"==typeof b?0:b.value;return e._math(function(a){return a.toFixed(c)},null,a)},d.addMultiple(f)},{"./function-registry":24,"./math-helper.js":26}],28:[function(a,b,c){var d=a("../tree/dimension"),e=a("../tree/anonymous"),f=a("./function-registry"),g=a("./math-helper.js"),h=function(a,b){switch(b=Array.prototype.slice.call(b),b.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var c,f,g,h,i,j,k,l,m=[],n={};for(c=0;ci.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(b[c].value)&&Array.prototype.push.apply(b,Array.prototype.slice.call(b[c].value));return 1==m.length?m[0]:(b=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new e((a?"min":"max")+"("+b+")"))};f.addMultiple({min:function(){return h(!0,arguments)},max:function(){return h(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new d(Math.PI)},mod:function(a,b){return new d(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d(a),b=new d(b);else if(!(a instanceof d&&b instanceof d))throw{type:"Argument",message:"arguments must be numbers"};return new d(Math.pow(a.value,b.value),a.unit)},percentage:function(a){var b=g._math(function(a){return 100*a},"%",a);return b}})},{"../tree/anonymous":47,"../tree/dimension":59,"./function-registry":24,"./math-helper.js":26}],29:[function(a,b,c){var d=a("../tree/quoted"),e=a("../tree/anonymous"),f=a("../tree/javascript"),g=a("./function-registry");g.addMultiple({e:function(a){return new e(a instanceof f?a.evaluated:a.value)},escape:function(a){return new e(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,b,c,e){var f=a.value;return c="Quoted"===c.type?c.value:c.toCSS(),f=f.replace(new RegExp(b.value,e?e.value:""),c),new d(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;e",k=0;k";return j+="',j=encodeURIComponent(j),j="data:image/svg+xml,"+j,new g(new f("'"+j+"'",j,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":52,"../tree/dimension":59,"../tree/expression":62,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],31:[function(a,b,c){var d=a("../tree/keyword"),e=a("../tree/detached-ruleset"),f=a("../tree/dimension"),g=a("../tree/color"),h=a("../tree/quoted"),i=a("../tree/anonymous"),j=a("../tree/url"),k=a("../tree/operation"),l=a("./function-registry"),m=function(a,b){return a instanceof b?d.True:d.False},n=function(a,b){if(void 0===b)throw{type:"Argument",message:"missing the required second argument to isunit."};if(b="string"==typeof b.value?b.value:b,"string"!=typeof b)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof f&&a.unit.is(b)?d.True:d.False},o=function(a){var b=Array.isArray(a.value)?a.value:Array(a);return b};l.addMultiple({isruleset:function(a){return m(a,e)},iscolor:function(a){return m(a,g)},isnumber:function(a){return m(a,f)},isstring:function(a){return m(a,h)},iskeyword:function(a){return m(a,d)},isurl:function(a){return m(a,j)},ispixel:function(a){return n(a,"px")},ispercentage:function(a){return n(a,"%")},isem:function(a){return n(a,"em")},isunit:n,unit:function(a,b){if(!(a instanceof f))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof k?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d?b.value:b.toCSS():"",new f(a.value,b)},"get-unit":function(a){return new i(a.unit)},extract:function(a,b){return b=b.value-1,o(a)[b]},length:function(a){return new f(o(a).length)}})},{"../tree/anonymous":47,"../tree/color":52,"../tree/detached-ruleset":58,"../tree/dimension":59,"../tree/keyword":68,"../tree/operation":74,"../tree/quoted":77,"../tree/url":84,"./function-registry":24}],32:[function(a,b,c){var d=a("./contexts"),e=a("./parser/parser"),f=a("./less-error");b.exports=function(a){var b=function(a,b,c){this.less=a,this.rootFilename=c.filename,this.paths=b.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=b.mime,this.error=null,this.context=b,this.queue=[],this.files={}};return b.prototype.push=function(b,c,g,h,i){var j=this,k=this.context.pluginManager.Loader;this.queue.push(b);var l=function(a,c,d){j.queue.splice(j.queue.indexOf(b),1);var e=d===j.rootFilename;h.optional&&a?i(null,{rules:[]},!1,null):(j.files[d]=c,a&&!j.error&&(j.error=a),i(a,c,e,d))},m={relativeUrls:this.context.relativeUrls,entryPath:g.entryPath,rootpath:g.rootpath,rootFilename:g.rootFilename},n=a.getFileManager(b,g.currentDirectory,this.context,a);if(!n)return void l({message:"Could not find a file-manager for "+b});c&&(b=h.isPlugin?b:n.tryAppendExtension(b,".less"));var o,p=function(a){var b,c=a.filename,i=a.contents.replace(/^\uFEFF/,"");m.currentDirectory=n.getPath(c),m.relativeUrls&&(m.rootpath=n.join(j.context.rootpath||"",n.pathDiff(m.currentDirectory,m.entryPath)),!n.isPathAbsolute(m.rootpath)&&n.alwaysMakePathsAbsolute()&&(m.rootpath=n.join(m.entryPath,m.rootpath))),m.filename=c;var o=new d.Parse(j.context);o.processImports=!1,j.contents[c]=i,(g.reference||h.reference)&&(m.reference=!0),h.isPlugin?(b=k.evalPlugin(i,o,j,h.pluginArgs,m),b instanceof f?l(b,null,c):l(null,b,c)):h.inline?l(null,i,c):new e(o,j,m).parse(i,function(a,b){l(a,b,c)})},q=function(a,b){a?l(a):p(b)};if(h.isPlugin)try{k.tryLoadPlugin(b,g.currentDirectory,q)}catch(r){i(r)}else o=n.loadFile(b,g.currentDirectory,this.context,a,q),o&&o.then(p,l)},b}},{"./contexts":12,"./less-error":34,"./parser/parser":40}],33:[function(a,b,c){b.exports=function(b,c){var d,e,f,g,h,i,j={version:[3,0,0],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),AbstractPluginLoader:a("./environment/abstract-plugin-loader"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")},k=function(a){return function(){var b=Object.create(a.prototype);return a.apply(b,Array.prototype.slice.call(arguments,0)),b}},l=Object.create(j);for(var m in j.tree)if(i=j.tree[m],"function"==typeof i)l[m]=k(i);else{l[m]=Object.create(null);for(var n in i)l[m][n]=k(i[n])}return l}},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":16,"./environment/abstract-plugin-loader":17,"./environment/environment":18,"./functions":25,"./import-manager":32,"./less-error":34,"./logger":35,"./parse":37,"./parse-tree":36,"./parser/parser":40,"./plugin-manager":41,"./render":42,"./source-map-builder":43,"./source-map-output":44,"./transform-tree":45,"./tree":65,"./utils":87,"./visitors":91}],34:[function(a,b,c){var d=a("./utils"),e=b.exports=function(a,b,c){Error.call(this);var e=a.filename||c;if(this.message=a.message,this.stack=a.stack,b&&e){var f=b.contents[e],g=d.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&d.getLocation(a.call,f).line,k=f.split("\n");if(this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.column=i,!this.line&&this.stack){var l=this.stack.match(/(|Function):(\d+):(\d+)/);l&&(l[2]&&(this.line=parseInt(l[2])-2),l[3]&&(this.column=parseInt(l[3])))}this.callLine=j+1,this.callExtract=k[j],this.extract=[k[this.line-2],k[this.line-1],k[this.line]]}};if("undefined"==typeof Object.create){var f=function(){};f.prototype=Error.prototype,e.prototype=new f}else e.prototype=Object.create(Error.prototype);e.prototype.constructor=e,e.prototype.toString=function(a){a=a||{};var b="",c=this.extract||[],d=[],e=function(a){return a};if(a.stylize){var f=typeof a.stylize;if("function"!==f)throw Error("options.stylize should be a function, got a "+f+"!");e=a.stylize}if(null!==this.line){if("string"==typeof c[0]&&d.push(e(this.line-1+" "+c[0],"grey")),"string"==typeof c[1]){var g=this.line+" ";c[1]&&(g+=c[1].slice(0,this.column)+e(e(e(c[1].substr(this.column,1),"bold")+c[1].slice(this.column+1),"red"),"inverse")),d.push(g)}"string"==typeof c[2]&&d.push(e(this.line+1+" "+c[2],"grey")),d=d.join("\n")+e("","reset")+"\n"}return b+=e(this.type+"Error: "+this.message,"red"),this.filename&&(b+=e(" in ","red")+this.filename),this.line&&(b+=e(" on line "+this.line+", column "+(this.column+1)+":","grey")),b+="\n"+d,this.callLine&&(b+=e("from ","red")+(this.filename||"")+"/n",b+=e(this.callLine,"grey")+" "+this.callExtract+"/n"),b}},{"./utils":87}],35:[function(a,b,c){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;b=97&&j<=122||j<34))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(h96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;hd&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],39:[function(a,b,c){var d=a("./chunker");b.exports=function(){function a(d){for(var e,f,j,p=k.i,q=c,s=k.i-i,t=k.i+h.length-s,u=k.i+=d,v=b;k.i=0){j={index:k.i,text:v.substr(k.i,x+2-k.i),isLineComment:!1},k.i+=j.text.length-1,k.commentStore.push(j);continue}}break}if(e!==l&&e!==n&&e!==m&&e!==o)break}if(h=h.slice(d+k.i-u+s),i=k.i,!h.length){if(ce||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,c=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$re=function(b){k.i>i&&(h=h.slice(k.i-i),i=k.i);var c=b.exec(h);return c?(a(c[0].length),"string"==typeof c?c:1===c.length?c[0]:c):null},k.$char=function(c){return b.charAt(k.i)!==c?null:(a(1),c)},k.$str=function(c){for(var d=c.length,e=0;es||a=b.length;return k.i=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":38}],40:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=function j(a,b,c){function i(a,e){throw new d({index:p.i,filename:c.filename,type:e||"Syntax",message:a},b)}function k(a,b,c){var d=a instanceof Function?a.call(o):p.$re(a);return d?d:void i(b||("string"==typeof a?"expected '"+a+"' got '"+p.currentChar()+"'":"unexpected token"))}function l(a,b){return p.$char(a)?a:void i(b||"expected '"+a+"' got '"+p.currentChar()+"'")}function m(a){var b=c.filename;return{lineNumber:h.getLocation(a,p.getInput()).line+1,fileName:b}}function n(a,c,e,f,g){var h,i=[],j=p;try{j.start(a,!1,function(a,b){g({message:a,index:b+e})});for(var k,l,m=0;k=c[m];m++)l=j.i,h=o[k](),h?(h._index=l+e,h._fileInfo=f,i.push(h)):i.push(null);var n=j.end();n.isFinished?g(null,i):g(!0,null)}catch(q){throw new d({index:q.index+e,message:q.message},b,f.filename)}}var o,p=g();return{parserInput:p,imports:b,fileInfo:c,parseNode:n,parse:function(g,h,i){var k,l,m,n,o=null,q="";if(l=i&&i.globalVars?j.serializeVars(i.globalVars)+"\n":"",m=i&&i.modifyVars?"\n"+j.serializeVars(i.modifyVars):"",a.pluginManager)for(var r=a.pluginManager.getPreProcessors(),s=0;s1&&(b=new e.Value(g)),d.push(b),g=[])}return p.forget(),a?d:f},literal:function(){return this.dimension()||this.color()||this.quoted()||this.unicodeDescriptor()},assignment:function(){var a,b;return p.save(),(a=p.$re(/^\w+(?=\s?=)/i))&&p.$char("=")&&(b=o.entity())?(p.forget(),new e.Assignment(a,b)):void p.restore()},url:function(){var a,b=p.i;return p.autoCommentAbsorb=!1,p.$str("url(")?(a=this.quoted()||this.variable()||this.property()||p.$re(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/)||"",p.autoCommentAbsorb=!0,l(")"),new e.URL(null!=a.value||a instanceof e.Variable||a instanceof e.Property?a:new e.Anonymous(a,b),b,c)):void(p.autoCommentAbsorb=!0)},variable:function(){var a,b=p.i;if("@"===p.currentChar()&&(a=p.$re(/^@@?[\w-]+/)))return new e.Variable(a,b,c)},variableCurly:function(){var a,b=p.i;if("@"===p.currentChar()&&(a=p.$re(/^@\{([\w-]+)\}/)))return new e.Variable("@"+a[1],b,c)},property:function(){var a,b=p.i;if("$"===p.currentChar()&&(a=p.$re(/^\$[\w-]+/)))return new e.Property(a,b,c)},propertyCurly:function(){var a,b=p.i;if("$"===p.currentChar()&&(a=p.$re(/^\$\{([\w-]+)\}/)))return new e.Property("$"+a[1],b,c)},color:function(){var a;if("#"===p.currentChar()&&(a=p.$re(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/))){var b=a.input.match(/^#([\w]+).*/);return b=b[1],b.match(/^[A-Fa-f0-9]+$/)||i("Invalid HEX color code"),new e.Color(a[1],(void 0),"#"+b)}},colorKeyword:function(){p.save();var a=p.autoCommentAbsorb;p.autoCommentAbsorb=!1;var b=p.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/);if(p.autoCommentAbsorb=a,!b)return void p.forget();p.restore();var c=e.Color.fromKeyword(b);return c?(p.$str(b),c):void 0},dimension:function(){if(!p.peekNotNumeric()){var a=p.$re(/^([+-]?\d*\.?\d+)(%|[a-z_]+)?/i);return a?new e.Dimension(a[1],a[2]):void 0}},unicodeDescriptor:function(){var a;if(a=p.$re(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/))return new e.UnicodeDescriptor(a[0])},javascript:function(){var a,b=p.i;p.save();var d=p.$char("~"),f=p.$char("`");return f?(a=p.$re(/^[^`]*`/))?(p.forget(),new e.JavaScript(a.substr(0,a.length-1),Boolean(d),b,c)):void p.restore("invalid javascript definition"):void p.restore()}},variable:function(){var a;if("@"===p.currentChar()&&(a=p.$re(/^(@[\w-]+)\s*:/)))return a[1]},rulesetCall:function(){var a;if("@"===p.currentChar()&&(a=p.$re(/^(@[\w-]+)\(\s*\)\s*;/)))return new e.RulesetCall(a[1])},extend:function(a){var b,d,f,g,h,j=p.i;if(p.$str(a?"&:extend(":":extend(")){do{for(f=null,b=null;!(f=p.$re(/^(all)(?=\s*(\)|,))/))&&(d=this.element());)b?b.push(d):b=[d];f=f&&f[1],b||i("Missing target selector for :extend()."),h=new e.Extend(new e.Selector(b),f,j,c),g?g.push(h):g=[h]}while(p.$char(","));return k(/^\)/),a&&k(/^;/),g}},extendRule:function(){return this.extend(!0)},mixin:{call:function(){var a,b,d,f,g,h,i=p.currentChar(),j=!1,k=p.i;if("."===i||"#"===i){for(p.save();;){if(a=p.i,f=p.$re(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/),!f)break;d=new e.Element(g,f,a,c),b?b.push(d):b=[d],g=p.$char(">")}return b&&(p.$char("(")&&(h=this.args(!0).args,l(")")),o.important()&&(j=!0),o.end())?(p.forget(),new e.mixin.Call(b,h,k,c,j)):void p.restore()}},args:function(a){var b,c,d,f,g,h,j,k=o.entities,l={args:null,variadic:!1},m=[],n=[],q=[];for(p.save();;){if(a)h=o.detachedRuleset()||o.expression();else{if(p.commentStore.length=0,p.$str("...")){l.variadic=!0,p.$char(";")&&!b&&(b=!0),(b?n:q).push({variadic:!0});break}h=k.variable()||k.property()||k.literal()||k.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var r=null;if(a?h.value&&1==h.value.length&&(r=h.value[0]):r=h,r&&(r instanceof e.Variable||r instanceof e.Property))if(p.$char(":")){if(m.length>0&&(b&&i("Cannot mix ; and , as delimiter types"),c=!0),g=o.detachedRuleset()||o.expression(),!g){if(!a)return p.restore(),l.args=[],l;i("could not understand value for named argument")}f=d=r.name}else if(p.$str("...")){if(!a){l.variadic=!0,p.$char(";")&&!b&&(b=!0),(b?n:q).push({name:h.name,variadic:!0});break}j=!0}else a||(d=f=r.name,g=null);g&&m.push(g),q.push({name:f,value:g,expand:j}),p.$char(",")||(p.$char(";")||b)&&(c&&i("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),n.push({name:d,value:g,expand:j}),d=null,m=[],c=!1)}return p.forget(),l.args=b?n:q,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==p.currentChar()&&"#"!==p.currentChar()||p.peek(/^[^{]*\}/)))if(p.save(),b=p.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!p.$char(")"))return void p.restore("Missing closing ')'");if(p.commentStore.length=0,p.$str("when")&&(d=k(o.conditions,"expected condition")),c=o.block())return p.forget(),new e.mixin.Definition(a,f,c,d,g);p.restore()}else p.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.property()||a.call()||a.keyword()||a.javascript()},end:function(){return p.$char(";")||p.peek("}")},alpha:function(){var a;if(p.$re(/^opacity=/i))return a=p.$re(/^\d+/),a||(a=k(this.entities.variable,"Could not parse alpha")),l(")"),new e.Alpha(a)},element:function(){var a,b,d,f=p.i;if(b=this.combinator(),a=p.$re(/^(?:\d+\.\d+|\d+)%/)||p.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||p.$char("*")||p.$char("&")||this.attribute()||p.$re(/^\([^&()@]+\)/)||p.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(p.save(),p.$char("(")?(d=this.selector(!1))&&p.$char(")")?(a=new e.Paren(d),p.forget()):p.restore("Missing closing ')'"):p.forget()),a)return new e.Element(b,a,f,c)},combinator:function(){var a=p.currentChar();if("/"===a){p.save();var b=p.$re(/^\/[a-z]+\//i);if(b)return p.forget(),new e.Combinator(b);p.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(p.i++,"^"===a&&"^"===p.currentChar()&&(a="^^",p.i++);p.isWhitespace();)p.i++;return new e.Combinator(a)}return new e.Combinator(p.isWhitespace(-1)?" ":null)},selector:function(a){var b,d,f,g,h,j,l,m=p.i;for(a=a!==!1;(a&&(d=this.extend())||a&&(j=p.$str("when"))||(g=this.element()))&&(j?l=k(this.conditions,"expected condition"):l?i("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&i("Extend can only be used at the end of selector"),f=p.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,l,m,c):void(h&&i("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(p.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=k(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=p.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||p.$re(/^[0-9]+%/)||p.$re(/^[\w-]+/)||d.variableCurly()),l("]"),new e.Attribute(a,c,b)}},block:function(){var a;if(p.$char("{")&&(a=this.primary())&&p.$char("}"))return a},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();if(a)return new e.DetachedRuleset(a)},ruleset:function(){var b,c,d,f;for(p.save(),a.dumpLineNumbers&&(f=m(p.i));;){if(c=this.selector(),!c)break;if(b?b.push(c):b=[c],p.commentStore.length=0,c.condition&&b.length>1&&i("Guards are only currently allowed on a single selector."),!p.$char(","))break;c.condition&&i("Guards are only currently allowed on a single selector."),p.commentStore.length=0}if(b&&(d=this.block())){p.forget();var g=new e.Ruleset(b,d,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}p.restore()},declaration:function(){var a,b,d,f,g,h=p.i,i=p.currentChar();if("."!==i&&"#"!==i&&"&"!==i&&":"!==i)if(p.save(),a=this.variable()||this.ruleProperty()){if(g="string"==typeof a,g&&(b=this.detachedRuleset()),p.commentStore.length=0,!b){if(f=!g&&a.length>1&&a.pop().value,b=this.anonymousValue())return p.forget(),new e.Declaration(a,b,(!1),f,h,c);b||(b=this.value()),d=this.important()}if(b&&this.end())return p.forget(),new e.Declaration(a,b,d,f,h,c);p.restore()}else p.restore()},anonymousValue:function(){var a=p.i,b=p.$re(/^([^@\$+\/'"*`(;{}-]*);/);if(b)return new e.Anonymous(b[1],a)},"import":function(){var a,b,d=p.i,f=p.$re(/^@import?\s+/);if(f){var g=(f?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),p.$char(";")||(p.i=d,i("missing semi-colon or unrecognised media features on import")),b=b&&new e.Value(b),new e.Import(a,b,g,d,c);p.i=d,i("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!p.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!p.$char(","))break}while(a);return l(")"),d},importOption:function(){var a=p.$re(/^(less|css|multiple|once|inline|reference|optional)/);if(a)return a[1]},mediaFeature:function(){var a,b,d=this.entities,f=[];p.save();do a=d.keyword()||d.variable(),a?f.push(a):p.$char("(")&&(b=this.property(),a=this.value(),p.$char(")")?b&&a?f.push(new e.Paren(new e.Declaration(b,a,null,null,p.i,c,(!0)))):a?f.push(new e.Paren(a)):i("badly formed media feature definition"):i("Missing closing ')'","Parse"));while(a);if(p.forget(),f.length>0)return new e.Expression(f)},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!p.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!p.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=p.i;return a.dumpLineNumbers&&(g=m(h)),p.save(),p.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||i("media definitions require block statements after any features"),p.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void p.restore()},plugin:function(){var a,b,d,f=p.i,g=p.$re(/^@plugin?\s+/);if(g){if(b=this.pluginArgs(),d=b?{pluginArgs:b,isPlugin:!0}:{isPlugin:!0},a=this.entities.quoted()||this.entities.url())return p.$char(";")||(p.i=f,i("missing semi-colon on @plugin")),new e.Import(a,null,d,f,c);p.i=f,i("malformed @plugin statement")}},pluginArgs:function(){if(p.save(),!p.$char("("))return p.restore(),null;var a=p.$re(/^\s*([^\);]+)\)\s*/);return a[1]?(p.forget(),a[1].trim()):(p.restore(),null)},atrule:function(){var b,d,f,g,h,j,k,l=p.i,n=!0,o=!0;if("@"===p.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(p.save(),b=p.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,n=!1;break;case"@namespace":j=!0,n=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,o=!1;break;default:k=!0}return p.commentStore.length=0,h?(d=this.entity(), -d||i("expected "+b+" identifier")):j?(d=this.expression(),d||i("expected "+b+" expression")):k&&(d=(p.$re(/^[^{;]+/)||"").trim(),n="{"==p.currentChar(),d&&(d=new e.Anonymous(d))),n&&(f=this.blockRuleset()),f||!n&&d&&p.$char(";")?(p.forget(),new e.AtRule(b,d,f,l,c,a.dumpLineNumbers?m(l):null,o)):void p.restore("at-rule options not recognised")}}},value:function(){var a,b=[],c=p.i;do if(a=this.expression(),a&&(b.push(a),!p.$char(",")))break;while(a);if(b.length>0)return new e.Value(b,c)},important:function(){if("!"===p.currentChar())return p.$re(/^! *important/)},sub:function(){var a,b;return p.save(),p.$char("(")?(a=this.addition(),a&&p.$char(")")?(p.forget(),b=new e.Expression([a]),b.parens=!0,b):void p.restore("Expected ')'")):void p.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=p.isWhitespace(-1);;){if(p.peek(/^\/[*\/]/))break;if(p.save(),c=p.$char("/")||p.$char("*"),!c){p.forget();break}if(b=this.operand(),!b){p.restore();break}p.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=p.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=p.isWhitespace(-1);;){if(c=p.$re(/^[-+]\s+/)||!f&&(p.$char("+")||p.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=p.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=p.i;if(a=this.condition()){for(;;){if(!p.peek(/^,\s*(not\s*)?\(/)||!p.$char(","))break;if(b=this.condition(),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(){function a(){return p.$str("or")}var b,c,d;if(b=this.conditionAnd(this)){if(c=a()){if(d=this.condition(),!d)return;b=new e.Condition(c,b,d)}return b}},conditionAnd:function(){function a(a){return a.negatedCondition()||a.parenthesisCondition()}function b(){return p.$str("and")}var c,d,f;if(c=a(this)){if(d=b()){if(f=this.conditionAnd(),!f)return;c=new e.Condition(d,c,f)}return c}},negatedCondition:function(){if(p.$str("not")){var a=this.parenthesisCondition();return a&&(a.negate=!a.negate),a}},parenthesisCondition:function(){function a(a){var b;return p.save(),(b=a.condition())&&p.$char(")")?(p.forget(),b):void p.restore()}var b;return p.save(),p.$str("(")?(b=a(this))?(p.forget(),b):(b=this.atomicCondition())?p.$char(")")?(p.forget(),b):void p.restore("expected ')' got '"+p.currentChar()+"'"):void p.restore():void p.restore()},atomicCondition:function(){var a,b,c,d,f=this.entities,g=p.i;if(a=this.addition()||f.keyword()||f.quoted())return p.$char(">")?d=p.$char("=")?">=":">":p.$char("<")?d=p.$char("=")?"<=":"<":p.$char("=")&&(d=p.$char(">")?"=>":p.$char("<")?"=<":"="),d?(b=this.addition()||f.keyword()||f.quoted(),b?c=new e.Condition(d,a,b,g,(!1)):i("expected expression")):c=new e.Condition("=",a,new e.Keyword("true"),g,(!1)),c},operand:function(){var a,b=this.entities;p.peek(/^-[@\$\(]/)&&(a=p.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.property()||b.call()||b.colorKeyword();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[],d=p.i;do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),p.peek(/^\/[\/*]/)||(b=p.$char("/"),b&&c.push(new e.Anonymous(b,d)))));while(a);if(c.length>0)return new e.Expression(c)},property:function(){var a=p.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(a)return a[1]},ruleProperty:function(){function a(a){var b=p.i,c=p.$re(a);if(c)return g.push(b),f.push(c[1])}var b,d,f=[],g=[];p.save();var h=p.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],p.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(p.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;d=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},g.prototype.addPostProcessor=function(a,b){var c;for(c=0;c=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},g.prototype.addFileManager=function(a){this.fileManagers.push(a)},g.prototype.getPreProcessors=function(){for(var a=[],b=0;b0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],45:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Declaration("@"+a,b,(!1),null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j,k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor((!0)),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager)for(j=b.pluginManager.visitor(),j.first();i=j.get();)i.isPreEvalVisitor&&i.run(a);c=a.eval(h);for(var l=0;l.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(d="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":73}],56:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],57:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;c-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&c<1&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":15,"./color":52,"./node":73,"./unit":83}],60:[function(a,b,c){var d=a("./atrule"),e=function(){var a=Array.prototype.slice.call(arguments);d.apply(this,a)};e.prototype=Object.create(d.prototype),e.prototype.constructor=e,b.exports=e},{"./atrule":49}],61:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./combinator"),g=function(a,b,c,d,e){this.combinator=a instanceof f?a:new f(a),this.value="string"==typeof b?b.trim():b?b:"",this._index=c,this._fileInfo=d,this.copyVisibilityInfo(e),this.setParent(this.combinator,this)};g.prototype=new d,g.prototype.type="Element",g.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},g.prototype.eval=function(a){return new g(this.combinator,this.value.eval?this.value.eval(a):this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.fileInfo(),this.getIndex())},g.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof e&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=g},{"./combinator":53,"./node":73,"./paren":75}],62:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./comment"),g=function(a){if(this.value=a,!a)throw new Error("Expression requires an array parameter")};g.prototype=new d,g.prototype.type="Expression",g.prototype.accept=function(a){this.value=a.visitArray(this.value)},g.prototype.eval=function(a){var b,c=this.parens&&!this.parensInOp,d=!1;return c&&a.inParenthesis(),this.value.length>1?b=new g(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(d=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!d&&(b=new e(b)),b},g.prototype.genCSS=function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":73,"./selector":81}],64:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=a("../utils"),k=a("../less-error"),l=function(a,b,c,d,e,f){if(this.options=c,this._index=d,this._fileInfo=e,this.path=a,this.features=b,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f),this.setParent(this.features,this),this.setParent(this.path,this)};l.prototype=new d,l.prototype.type="Import",l.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.isPlugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},l.prototype.genCSS=function(a,b){this.css&&void 0===this.path._fileInfo.reference&&(b.add("@import ",this._fileInfo,this._index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},l.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},l.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),!(a instanceof g)||a.containsVariables()},l.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new l(b.eval(a),this.features,this.options,this._index,this._fileInfo,this.visibilityInfo())},l.prototype.evalPath=function(a){var b=this.path.eval(a),c=this._fileInfo&&this._fileInfo.rootpath;if(!(b instanceof f)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d)}b.value=a.normalizePath(b.value)}return b},l.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){a.addVisibilityBlock()}):b.addVisibilityBlock()),b},l.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a);if(this.options.isPlugin){if(this.root&&this.root.eval)try{this.root.eval(a)}catch(f){throw f.message="Plugin error during evaluation",new k(f,this.root.imports,this.root.filename); -}return c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[]}if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var g=new i(this.root,0,{filename:this.importedFilename,reference:this.path._fileInfo&&this.path._fileInfo.reference},(!0),(!0));return this.features?new e([g],this.features.value):[g]}if(this.css){var m=new l(this.evalPath(a),d,this.options,this._index);if(!m.css&&this.error)throw this.error;return m}return b=new h(null,j.copyArray(this.root.rules)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=l},{"../less-error":34,"../utils":87,"./anonymous":47,"./media":69,"./node":73,"./quoted":77,"./ruleset":80,"./url":84}],65:[function(a,b,c){var d=Object.create(null);d.Node=a("./node"),d.Alpha=a("./alpha"),d.Color=a("./color"),d.AtRule=a("./atrule"),d.Directive=a("./directive"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Property=a("./property"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Declaration=a("./declaration"),d.Rule=a("./rule"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.RulesetCall=a("./ruleset-call"),b.exports=d},{"./alpha":46,"./anonymous":47,"./assignment":48,"./atrule":49,"./attribute":50,"./call":51,"./color":52,"./combinator":53,"./comment":54,"./condition":55,"./declaration":57,"./detached-ruleset":58,"./dimension":59,"./directive":60,"./element":61,"./expression":62,"./extend":63,"./import":64,"./javascript":66,"./keyword":68,"./media":69,"./mixin-call":70,"./mixin-definition":71,"./negative":72,"./node":73,"./operation":74,"./paren":75,"./property":76,"./quoted":77,"./rule":78,"./ruleset":80,"./ruleset-call":79,"./selector":81,"./unicode-descriptor":82,"./unit":83,"./url":84,"./value":85,"./variable":86}],66:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this._index=c,this._fileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new e(b):"string"==typeof b?new f('"'+b+'"',b,this.escaped,this._index):new g(Array.isArray(b)?b.join(", "):b)},b.exports=h},{"./anonymous":47,"./dimension":59,"./js-eval-node":67,"./quoted":77}],67:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(!b.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.fileInfo().filename,index:this.getIndex()};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.getIndex(),d.fileInfo()).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.fileInfo().filename,index:this.getIndex()}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.fileInfo().filename,index:this.getIndex()}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":73,"./variable":86}],68:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":73}],69:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./atrule"),j=a("../utils"),k=function(a,b,c,g,h){this._index=c,this._fileInfo=g;var i=new f([],null,null,this._index,this._fileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0,this.setParent(i,this),this.setParent(this.features,this),this.setParent(this.rules,this)};k.prototype=new i,k.prototype.type="Media",k.prototype.isRulesetLike=function(){return!0},k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},k.prototype.genCSS=function(a,b){b.add("@media ",this._fileInfo,this._index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},k.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new k(null,[],this._index,this._fileInfo,this.visibilityInfo());this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo);var c=!1;a.strictMath||(c=!0,a.strictMath=!0);try{b.features=this.features.eval(a)}finally{c&&(a.strictMath=!1)}return a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},k.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo()),this.setParent(b,this)}return delete a.mediaBlocks,delete a.mediaPath,b},k.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;b0;b--)a.splice(b,0,new g("and"));return new h(a)})),this.setParent(this.features,this),new d([],[])},k.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(n=!0,k=0;k0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.getIndex(),filename:this.fileInfo().filename};for(k=0;kthis.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;gb?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],74:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};g.prototype=new d,g.prototype.type="Operation",g.prototype.accept=function(a){this.operands=a.visit(this.operands)},g.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof f&&c instanceof e&&(b=b.toColor()),c instanceof f&&b instanceof e&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new g(this.op,[b,c],this.isSpaced)},g.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=g},{"./color":52,"./dimension":59,"./node":73}],75:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":73}],76:[function(a,b,c){var d=a("./node"),e=a("./declaration"),f=function(a,b,c){this.name=a,this._index=b,this._fileInfo=c};f.prototype=new d,f.prototype.type="Property",f.prototype.eval=function(a){var b,c=this.name,d=a.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;if(this.evaluating)throw{type:"Name",message:"Recursive property reference for "+c,filename:this.fileInfo().filename,index:this.getIndex()};if(this.evaluating=!0,b=this.find(a.frames,function(b){var f,g=b.property(c);if(g){for(var h=0;hd){if(!c||c(g)){e=g.find(new i(a.elements.slice(d)),b,c);for(var j=0;j0&&b.add(k),a.firstSelector=!0,h[0].genCSS(a,b),a.firstSelector=!1,d=1;d0?(e=p.copyArray(a),f=e.pop(),g=d.createDerived(p.copyArray(f.elements))):g=d.createDerived([]),b.length>0){var h=c.combinator,i=b[0].elements[0];h.emptyOrWhitespace&&!i.combinator.emptyOrWhitespace&&(h=i.combinator),g.elements.push(new j(h,i.value,c._index,c._fileInfo)),g.elements=g.elements.concat(b[0].elements.slice(1))}if(0!==g.elements.length&&e.push(g),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function g(a,b,c,d,e){var g;for(g=0;g0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new i(a))}}function l(a,b,c){function m(a){var b;return a.value instanceof h?(b=a.value.value,b instanceof i?b:null):null}var n,o,p,q,r,s,t,u,v,w,x=!1;for(q=[],r=[[]],n=0;u=c.elements[n];n++)if("&"!==u.value){var y=m(u);if(null!=y){k(q,r);var z,A=[],B=[];for(z=l(A,b,y),x=x||z,p=0;p0&&t[0].elements.push(new j(u.combinator,"",u._index,u._fileInfo)),s.push(t);else for(p=0;p0&&(a.push(r[n]),w=r[n][v-1],r[n][v-1]=w.createDerived(w.elements,c.extendList));return x}function m(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var n,o,q;if(o=[],q=l(o,b,c),!q)if(b.length>0)for(o=[],n=0;n0)for(b=0;b=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}},copyArray:function(a){var b,c=a.length,d=new Array(c);for(b=0;b=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.fileInfo(),b),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitDeclaration:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;e0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return k0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitAtRule:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitAtRuleOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=i},{"../logger":35,"../tree":65,"../utils":87,"./visitor":95}],89:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],90:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=a("../utils"),h=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};h.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,g.copyArray(this.context.frames)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.getIndex(),f.filename=a.fileInfo().filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;h0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];if(this.keepOnlyVisibleChilds(c),!this.isEmpty(c))return a.ensureVisibility(),a.removeVisibilityBlock(),a},isVisibleRuleset:function(a){return!!a.firstRoot||!this.isEmpty(a)&&!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitDeclaration:function(a,b){if(!a.blocksVisibility()&&!a.variable)return a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){if(!a.blocksVisibility()&&!a.isSilent(this._context))return a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){if(!a.blocksVisibility())return a},visitAtRule:function(a,b){return a.rules&&a.rules.length?this.visitAtRuleWithBody(a,b):this.visitAtRuleWithoutBody(a,b)},visitAtRuleWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitAtRuleWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;c0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;b=0;e--)if(c=a[e],c instanceof d.Declaration)if(f[c.name]){b=f[c.name],b instanceof d.Declaration&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);b.indexOf(g)!==-1?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b,c,e,f={},g=0;g1){c=b[0];var h=[],i=[];b.map(function(a){"+"===a.merge&&(i.length>0&&h.push(e(i)),i=[]),i.push(a)}),h.push(e(i)),c.value=g(h)}})}},visitAnonymous:function(a,b){if(!a.blocksVisibility())return a.accept(this._visitor),a}},b.exports=g},{"../tree":65,"./visitor":95}],95:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitFnCache=[],h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var c,e=this._visitFnCache,f=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=g;if(l.visitDeeper=!0,j||(c="visit"+a.type,j=f[c]||d,k=f[c+"Out"]||d,e[h]=j,e[i]=k),j!==d){var m=j.call(f,a,l);f.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=d&&k.call(f,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;ck){for(var b=0,c=h.length-j;b0||b.isFileProtocol?"development":"production");var c=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(a.location.hash);c&&(b.dumpLineNumbers=c[1]),void 0===b.useFileCache&&(b.useFileCache=!0),void 0===b.onReady&&(b.onReady=!0),b.javascriptEnabled=!(!b.javascriptEnabled&&!b.inlineJavaScript)}},{"./browser":3,"./utils":11}],2:[function(a,b,c){function d(a){a.filename&&console.warn(a),e.async||h.removeChild(i)}a("promise/polyfill");var e=a("../less/default-options")();if(window.less)for(key in window.less)window.less.hasOwnProperty(key)&&(e[key]=window.less[key]);a("./add-default-options")(window,e),e.plugins=e.plugins||[],window.LESS_PLUGINS&&(e.plugins=e.plugins.concat(window.LESS_PLUGINS));var f=b.exports=a("./index")(window,e);window.less=f;var g,h,i;e.onReady&&(/!watch/.test(window.location.hash)&&f.watch(),e.async||(g="body { display: none !important }",h=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),i.type="text/css",i.styleSheet?i.styleSheet.cssText=g:i.appendChild(document.createTextNode(g)),h.appendChild(i)),f.registerStylesheetsImmediately(),f.pageLoadFinished=f.refresh("development"===f.env).then(d,d))},{"../less/default-options":16,"./add-default-options":1,"./index":8,"promise/polyfill":102}],3:[function(a,b,c){var d=a("./utils");b.exports={createCSS:function(a,b,c){var e=c.href||"",f="less:"+(c.title||d.extractId(e)),g=a.getElementById(f),h=!1,i=a.createElement("style");i.setAttribute("type","text/css"),c.media&&i.setAttribute("media",c.media),i.id=f,i.styleSheet||(i.appendChild(a.createTextNode(b)),h=null!==g&&g.childNodes.length>0&&i.childNodes.length>0&&g.firstChild.nodeValue===i.firstChild.nodeValue);var j=a.getElementsByTagName("head")[0];if(null===g||h===!1){var k=c&&c.nextSibling||null;k?k.parentNode.insertBefore(i,k):j.appendChild(i)}if(g&&h===!1&&g.parentNode.removeChild(g),i.styleSheet)try{i.styleSheet.cssText=b}catch(l){throw new Error("Couldn't reassign styleSheet.cssText.")}},currentScript:function(a){var b=a.document;return b.currentScript||function(){var a=b.getElementsByTagName("script");return a[a.length-1]}()}}},{"./utils":11}],4:[function(a,b,c){b.exports=function(a,b,c){var d=null;if("development"!==b.env)try{d="undefined"==typeof a.localStorage?null:a.localStorage}catch(e){}return{setCSS:function(a,b,e,f){if(d){c.info("saving "+a+" to cache.");try{d.setItem(a,f),d.setItem(a+":timestamp",b),e&&d.setItem(a+":vars",JSON.stringify(e))}catch(g){c.error('failed to save "'+a+'" to local storage for caching.')}}},getCSS:function(a,b,c){var e=d&&d.getItem(a),f=d&&d.getItem(a+":timestamp"),g=d&&d.getItem(a+":vars");if(c=c||{},f&&b.lastModified&&new Date(b.lastModified).valueOf()===new Date(f).valueOf()&&(!c&&!g||JSON.stringify(c)===g))return e}}}},{}],5:[function(a,b,c){var d=a("./utils"),e=a("./browser");b.exports=function(a,b,c){function f(b,f){var g,h,i="less-error-message:"+d.extractId(f||""),j='
    • {content}
    • ',k=a.document.createElement("div"),l=[],m=b.filename||f,n=m.match(/([^\/]+(\?.*)?)$/)[1];k.id=i,k.className="less-error-message",h="

      "+(b.type||"Syntax")+"Error: "+(b.message||"There is an error in your .less file")+'

      in '+n+" ";var o=function(a,b,c){void 0!==a.extract[b]&&l.push(j.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};b.line&&(o(b,0,""),o(b,1,"line"),o(b,2,""),h+="on line "+b.line+", column "+(b.column+1)+":

        "+l.join("")+"
      "),b.stack&&(b.extract||c.logLevel>=4)&&(h+="
      Stack Trace
      "+b.stack.split("\n").slice(1).join("
      ")),k.innerHTML=h,e.createCSS(a.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),k.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===c.env&&(g=setInterval(function(){var b=a.document,c=b.body;c&&(b.getElementById(i)?c.replaceChild(k,b.getElementById(i)):c.insertBefore(k,c.firstChild),clearInterval(g))},10))}function g(b){var c=a.document.getElementById("less-error-message:"+d.extractId(b));c&&c.parentNode.removeChild(c)}function h(a){}function i(a){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?h(a):"function"==typeof c.errorReporting&&c.errorReporting("remove",a):g(a)}function j(a,d){var e="{line} {content}",f=a.filename||d,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f,i=function(a,b,c){void 0!==a.extract[b]&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.line&&(i(a,0,""),i(a,1,"line"),i(a,2,""),h+=" on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")),a.stack&&(a.extract||c.logLevel>=4)&&(h+="\nStack Trace\n"+a.stack),b.logger.error(h)}function k(a,b){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?j(a,b):"function"==typeof c.errorReporting&&c.errorReporting("add",a,b):f(a,b)}return{add:k,remove:i}}},{"./browser":3,"./utils":11}],6:[function(a,b,c){b.exports=function(b,c){var d=a("../less/environment/abstract-file-manager.js"),e={},f=function(){};return f.prototype=new d,f.prototype.alwaysMakePathsAbsolute=function(){return!0},f.prototype.join=function(a,b){return a?this.extractUrlParts(b,a).path:b},f.prototype.doXHR=function(a,d,e,f){function g(b,c,d){b.status>=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var h=new XMLHttpRequest,i=!b.isFileProtocol||b.fileAsync;"function"==typeof h.overrideMimeType&&h.overrideMimeType("text/css"),c.debug("XHR: Getting '"+a+"'"),h.open("GET",a,i),h.setRequestHeader("Accept",d||"text/x-less, text/css; q=0.9, */*; q=0.5"),h.send(null),b.isFileProtocol&&!b.fileAsync?0===h.status||h.status>=200&&h.status<300?e(h.responseText):f(h.status,a):i?h.onreadystatechange=function(){4==h.readyState&&g(h,e,f)}:g(h,e,f)},f.prototype.supports=function(a,b,c,d){return!0},f.prototype.clearFileCache=function(){e={}},f.prototype.loadFile=function(a,b,c,d){b&&!this.isPathAbsolute(a)&&(a=b+a),a=c.ext?this.tryAppendExtension(a,c.ext):a,c=c||{};var f=this.extractUrlParts(a,window.location.href),g=f.url,h=this;return new Promise(function(a,b){if(c.useFileCache&&e[g])try{var d=e[g];return a({contents:d,filename:g,webInfo:{lastModified:new Date}})}catch(f){return b({filename:g,message:"Error loading file "+g+" error was "+f.message})}h.doXHR(g,c.mime,function(b,c){e[g]=b,a({contents:b,filename:g,webInfo:{lastModified:c}})},function(a,c){b({type:"File",message:"'"+c+"' wasn't found ("+a+")",href:g})})})},f}},{"../less/environment/abstract-file-manager.js":17}],7:[function(a,b,c){b.exports=function(){function b(){throw{type:"Runtime",message:"Image size functions are not supported in browser version of less"}}var c=a("./../less/functions/function-registry"),d={"image-size":function(a){return b(this,a),-1},"image-width":function(a){return b(this,a),-1},"image-height":function(a){return b(this,a),-1}};c.addMultiple(d)}},{"./../less/functions/function-registry":26}],8:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(b,c){function f(a){return JSON.parse(JSON.stringify(a||{}))}function g(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}}function h(a){for(var b,d=l.getElementsByTagName("style"),e=0;e=c&&console.log(a)},info:function(a){b.logLevel>=d&&console.log(a)},warn:function(a){b.logLevel>=e&&console.warn(a)},error:function(a){b.logLevel>=f&&console.error(a)}}]);for(var g=0;g0&&(a=a.slice(0,b)),b=a.lastIndexOf("/"),b<0&&(b=a.lastIndexOf("\\")),b<0?"":a.slice(0,b+1)},d.prototype.tryAppendExtension=function(a,b){return/(\.[a-z]*$)|([\?;].*)$/.test(a)?a:a+b},d.prototype.tryAppendLessExtension=function(a){return this.tryAppendExtension(a,".less")},d.prototype.supportsSync=function(){return!1},d.prototype.alwaysMakePathsAbsolute=function(){return!1},d.prototype.isPathAbsolute=function(a){return/^(?:[a-z-]+:|\/|\\|#)/i.test(a)},d.prototype.join=function(a,b){return a?a+b:b},d.prototype.pathDiff=function(a,b){var c,d,e,f,g=this.extractUrlParts(a),h=this.extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;cparseInt(b[c])?-1:1;return 0},g.prototype.versionToString=function(a){for(var b="",c=0;c=0;h--){var i=g[h];if(i[f?"supportsSync":"supports"](a,b,c,e))return i}return null},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},b.exports=e},{"../logger":37}],20:[function(a,b,c){var d=a("./function-registry"),e=a("../tree/anonymous"),f=a("../tree/keyword");d.addMultiple({"boolean":function(a){return a?f.True:f.False},"if":function(a,b,c){return a?b:c||new e}})},{"../tree/anonymous":48,"../tree/keyword":69,"./function-registry":26}],21:[function(a,b,c){function d(a,b,c){var d,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;l<3;l++)d=b.rgb[l]/255,f=c.rgb[l]/255,h=a(d,f),g&&(h=(j*f+i*(d-j*(d+f-h)))/g),k[l]=255*h;return new e(k,g)}var e=a("../tree/color"),f=a("./function-registry"),g={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,a<=1?g.multiply(a,b):g.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return g.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};for(var h in g)g.hasOwnProperty(h)&&(d[h]=d.bind(null,g[h]));f.addMultiple(d)},{"../tree/color":53,"./function-registry":26}],22:[function(a,b,c){function d(a){return Math.min(1,Math.max(0,a))}function e(a){return h.hsla(a.h,a.s,a.l,a.a)}function f(a){if(a instanceof i)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{type:"Argument",message:"color functions take numbers as parameters"}}function g(a,b){return a instanceof i&&a.unit.is("%")?parseFloat(a.value*b/100):f(a)}var h,i=a("../tree/dimension"),j=a("../tree/color"),k=a("../tree/quoted"),l=a("../tree/anonymous"),m=a("./function-registry");h={rgb:function(a,b,c){return h.rgba(a,b,c,1)},rgba:function(a,b,c,d){var e=[a,b,c].map(function(a){return g(a,255)});return d=f(d),new j(e,d)},hsl:function(a,b,c){return h.hsla(a,b,c,1)},hsla:function(a,b,c,e){function g(a){return a=a<0?a+1:a>1?a-1:a,6*a<1?i+(j-i)*a*6:2*a<1?j:3*a<2?i+(j-i)*(2/3-a)*6:i}var i,j;return a=f(a)%360/360,b=d(f(b)),c=d(f(c)),e=d(f(e)),j=c<=.5?c*(b+1):c+b-c*b,i=2*c-j,h.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),e)},hsv:function(a,b,c){return h.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=f(a)%360/360*360,b=f(b),c=f(c),d=f(d);var e,g;e=Math.floor(a/60%6),g=a/60-e;var i=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],j=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return h.rgba(255*i[j[e][0]],255*i[j[e][1]],255*i[j[e][2]],d)},hue:function(a){return new i(a.toHSL().h)},saturation:function(a){return new i(100*a.toHSL().s,"%")},lightness:function(a){return new i(100*a.toHSL().l,"%")},hsvhue:function(a){return new i(a.toHSV().h)},hsvsaturation:function(a){return new i(100*a.toHSV().s,"%")},hsvvalue:function(a){return new i(100*a.toHSV().v,"%")},red:function(a){return new i(a.rgb[0])},green:function(a){return new i(a.rgb[1])},blue:function(a){return new i(a.rgb[2])},alpha:function(a){return new i(a.toHSL().a)},luma:function(a){return new i(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new i(b*a.alpha*100,"%")},saturate:function(a,b,c){if(!a.rgb)return null;var f=a.toHSL();return f.s+="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},desaturate:function(a,b,c){var f=a.toHSL();return f.s-="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},lighten:function(a,b,c){var f=a.toHSL();return f.l+="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},darken:function(a,b,c){var f=a.toHSL();return f.l-="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},fadein:function(a,b,c){var f=a.toHSL();return f.a+="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fadeout:function(a,b,c){var f=a.toHSL();return f.a-="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=d(c.a),e(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=d<0?360+d:d,e(c)},mix:function(a,b,c){a.toHSL&&b.toHSL||(console.log(b.type),console.dir(b)),c||(c=new i(50));var d=c.value/100,e=2*d-1,f=a.toHSL().a-b.toHSL().a,g=((e*f==-1?e:(e+f)/(1+e*f))+1)/2,h=1-g,k=[a.rgb[0]*g+b.rgb[0]*h,a.rgb[1]*g+b.rgb[1]*h,a.rgb[2]*g+b.rgb[2]*h],l=a.alpha*d+b.alpha*(1-d);return new j(k,l)},greyscale:function(a){return h.desaturate(a,new i(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;if("undefined"==typeof c&&(c=h.rgba(255,255,255,1)),"undefined"==typeof b&&(b=h.rgba(0,0,0,1)),b.luma()>c.luma()){var e=c;c=b,b=e}return d="undefined"==typeof d?.43:f(d),a.luma()=v&&this.context.ieCompat!==!1?(h.warn("Skipped data-uri embedding of "+j+" because its size ("+u.length+" characters) exceeds IE8-safe "+v+" characters!"),g(this,f||a)):new d(new c('"'+u+'"',u,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../logger":37,"../tree/quoted":78,"../tree/url":84,"../utils":88,"./function-registry":26}],24:[function(a,b,c){var d=a("../tree/keyword"),e=a("./function-registry"),f={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;if(null!=a)return a?d.True:d.False},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}};e.add("default",f.eval.bind(f)),b.exports=f},{"../tree/keyword":69,"./function-registry":26}],25:[function(a,b,c){var d=a("../tree/expression"),e=function(a,b,c,d){this.name=a.toLowerCase(),this.index=c,this.context=b,this.currentFileInfo=d,this.func=b.frames[0].functionRegistry.get(this.name)};e.prototype.isValid=function(){return Boolean(this.func)},e.prototype.call=function(a){return Array.isArray(a)&&(a=a.filter(function(a){return"Comment"!==a.type}).map(function(a){if("Expression"===a.type){var b=a.value.filter(function(a){return"Comment"!==a.type});return 1===b.length?b[0]:new d(b)}return a})),this.func.apply(this,a)},b.exports=e},{"../tree/expression":63}],26:[function(a,b,c){function d(a){return{_data:{},add:function(a,b){a=a.toLowerCase(),this._data.hasOwnProperty(a),this._data[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){this.add(b,a[b])}.bind(this))},get:function(b){return this._data[b]||a&&a.get(b)},getLocalFunctions:function(){return this._data},inherit:function(){return d(this)},create:function(a){return d(a)}}}b.exports=d(null)},{}],27:[function(a,b,c){b.exports=function(b){var c={functionRegistry:a("./function-registry"),functionCaller:a("./function-caller")};return a("./boolean"),a("./default"),a("./color"),a("./color-blending"),a("./data-uri")(b),a("./math"),a("./number"),a("./string"),a("./svg")(b),a("./types"),c}},{"./boolean":20,"./color":22,"./color-blending":21,"./data-uri":23,"./default":24,"./function-caller":25,"./function-registry":26,"./math":29,"./number":30,"./string":31,"./svg":32,"./types":33}],28:[function(a,b,c){var d=a("../tree/dimension"),e=function(){};e._math=function(a,b,c){if(!(c instanceof d))throw{type:"Argument",message:"argument must be a number" +};return null==b?b=c.unit:c=c.unify(),new d(a(parseFloat(c.value)),b)},b.exports=e},{"../tree/dimension":60}],29:[function(a,b,c){var d=a("./function-registry"),e=a("./math-helper.js"),f={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"};for(var g in f)f.hasOwnProperty(g)&&(f[g]=e._math.bind(null,Math[g],f[g]));f.round=function(a,b){var c="undefined"==typeof b?0:b.value;return e._math(function(a){return a.toFixed(c)},null,a)},d.addMultiple(f)},{"./function-registry":26,"./math-helper.js":28}],30:[function(a,b,c){var d=a("../tree/dimension"),e=a("../tree/anonymous"),f=a("./function-registry"),g=a("./math-helper.js"),h=function(a,b){switch(b=Array.prototype.slice.call(b),b.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var c,f,g,h,i,j,k,l,m=[],n={};for(c=0;ci.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(b[c].value)&&Array.prototype.push.apply(b,Array.prototype.slice.call(b[c].value));return 1==m.length?m[0]:(b=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new e((a?"min":"max")+"("+b+")"))};f.addMultiple({min:function(){return h(!0,arguments)},max:function(){return h(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new d(Math.PI)},mod:function(a,b){return new d(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d(a),b=new d(b);else if(!(a instanceof d&&b instanceof d))throw{type:"Argument",message:"arguments must be numbers"};return new d(Math.pow(a.value,b.value),a.unit)},percentage:function(a){var b=g._math(function(a){return 100*a},"%",a);return b}})},{"../tree/anonymous":48,"../tree/dimension":60,"./function-registry":26,"./math-helper.js":28}],31:[function(a,b,c){var d=a("../tree/quoted"),e=a("../tree/anonymous"),f=a("../tree/javascript"),g=a("./function-registry");g.addMultiple({e:function(a){return new e(a instanceof f?a.evaluated:a.value)},escape:function(a){return new e(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,b,c,e){var f=a.value;return c="Quoted"===c.type?c.value:c.toCSS(),f=f.replace(new RegExp(b.value,e?e.value:""),c),new d(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;e",k=0;k";return j+="',j=encodeURIComponent(j),j="data:image/svg+xml,"+j,new g(new f("'"+j+"'",j,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":53,"../tree/dimension":60,"../tree/expression":63,"../tree/quoted":78,"../tree/url":84,"./function-registry":26}],33:[function(a,b,c){var d=a("../tree/keyword"),e=a("../tree/detached-ruleset"),f=a("../tree/dimension"),g=a("../tree/color"),h=a("../tree/quoted"),i=a("../tree/anonymous"),j=a("../tree/url"),k=a("../tree/operation"),l=a("./function-registry"),m=function(a,b){return a instanceof b?d.True:d.False},n=function(a,b){if(void 0===b)throw{type:"Argument",message:"missing the required second argument to isunit."};if(b="string"==typeof b.value?b.value:b,"string"!=typeof b)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof f&&a.unit.is(b)?d.True:d.False},o=function(a){var b=Array.isArray(a.value)?a.value:Array(a);return b};l.addMultiple({isruleset:function(a){return m(a,e)},iscolor:function(a){return m(a,g)},isnumber:function(a){return m(a,f)},isstring:function(a){return m(a,h)},iskeyword:function(a){return m(a,d)},isurl:function(a){return m(a,j)},ispixel:function(a){return n(a,"px")},ispercentage:function(a){return n(a,"%")},isem:function(a){return n(a,"em")},isunit:n,unit:function(a,b){if(!(a instanceof f))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof k?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d?b.value:b.toCSS():"",new f(a.value,b)},"get-unit":function(a){return new i(a.unit)},extract:function(a,b){return b=b.value-1,o(a)[b]},length:function(a){return new f(o(a).length)}})},{"../tree/anonymous":48,"../tree/color":53,"../tree/detached-ruleset":59,"../tree/dimension":60,"../tree/keyword":69,"../tree/operation":75,"../tree/quoted":78,"../tree/url":84,"./function-registry":26}],34:[function(a,b,c){var d=a("./contexts"),e=a("./parser/parser"),f=a("./less-error"),g=a("./utils");"undefined"==typeof Promise?a("promise"):Promise;b.exports=function(a){var b=function(a,b,c){this.less=a,this.rootFilename=c.filename,this.paths=b.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=b.mime,this.error=null,this.context=b,this.queue=[],this.files={}};return b.prototype.push=function(b,c,h,i,j){var k=this,l=this.context.pluginManager.Loader;this.queue.push(b);var m=function(a,c,d){k.queue.splice(k.queue.indexOf(b),1);var e=d===k.rootFilename;i.optional&&a?j(null,{rules:[]},!1,null):(k.files[d]||(k.files[d]={root:c,options:i}),a&&!k.error&&(k.error=a),j(a,c,e,d))},n={relativeUrls:this.context.relativeUrls,entryPath:h.entryPath,rootpath:h.rootpath,rootFilename:h.rootFilename},o=a.getFileManager(b,h.currentDirectory,this.context,a);if(!o)return void m({message:"Could not find a file-manager for "+b});var p,q=function(a){var b,c=a.filename,g=a.contents.replace(/^\uFEFF/,"");n.currentDirectory=o.getPath(c),n.relativeUrls&&(n.rootpath=o.join(k.context.rootpath||"",o.pathDiff(n.currentDirectory,n.entryPath)),!o.isPathAbsolute(n.rootpath)&&o.alwaysMakePathsAbsolute()&&(n.rootpath=o.join(n.entryPath,n.rootpath))),n.filename=c;var j=new d.Parse(k.context);j.processImports=!1,k.contents[c]=g,(h.reference||i.reference)&&(n.reference=!0),i.isPlugin?(b=l.evalPlugin(g,j,k,i.pluginArgs,n),b instanceof f?m(b,null,c):m(null,b,c)):i.inline?m(null,g,c):!k.files[c]||k.files[c].options.multiple||i.multiple?new e(j,k,n).parse(g,function(a,b){m(a,b,c)}):m(null,k.files[c].root,c)},r=g.clone(this.context);c&&(r.ext=i.isPlugin?".js":".less"),p=i.isPlugin?l.loadPlugin(b,h.currentDirectory,r,a,o):o.loadFile(b,h.currentDirectory,r,a,function(a,b){a?m(a):q(b)}),p&&p.then(q,m)},b}},{"./contexts":12,"./less-error":36,"./parser/parser":42,"./utils":88,promise:void 0}],35:[function(a,b,c){b.exports=function(b,c){var d,e,f,g,h,i,j={version:[3,0,0],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),AbstractPluginLoader:a("./environment/abstract-plugin-loader"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")},k=function(a){return function(){var b=Object.create(a.prototype);return a.apply(b,Array.prototype.slice.call(arguments,0)),b}},l=Object.create(j);for(var m in j.tree)if(i=j.tree[m],"function"==typeof i)l[m]=k(i);else{l[m]=Object.create(null);for(var n in i)l[m][n]=k(i[n])}return l}},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":17,"./environment/abstract-plugin-loader":18,"./environment/environment":19,"./functions":27,"./import-manager":34,"./less-error":36,"./logger":37,"./parse":39,"./parse-tree":38,"./parser/parser":42,"./plugin-manager":43,"./render":44,"./source-map-builder":45,"./source-map-output":46,"./transform-tree":47,"./tree":66,"./utils":88,"./visitors":92}],36:[function(a,b,c){var d=a("./utils"),e=b.exports=function(a,b,c){Error.call(this);var e=a.filename||c;if(this.message=a.message,this.stack=a.stack,b&&e){var f=b.contents[e],g=d.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&d.getLocation(a.call,f).line,k=f.split("\n");if(this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.column=i,!this.line&&this.stack){var l=this.stack.match(/(|Function):(\d+):(\d+)/);l&&(l[2]&&(this.line=parseInt(l[2])-2),l[3]&&(this.column=parseInt(l[3])))}this.callLine=j+1,this.callExtract=k[j],this.extract=[k[this.line-2],k[this.line-1],k[this.line]]}};if("undefined"==typeof Object.create){var f=function(){};f.prototype=Error.prototype,e.prototype=new f}else e.prototype=Object.create(Error.prototype);e.prototype.constructor=e,e.prototype.toString=function(a){a=a||{};var b="",c=this.extract||[],d=[],e=function(a){return a};if(a.stylize){var f=typeof a.stylize;if("function"!==f)throw Error("options.stylize should be a function, got a "+f+"!");e=a.stylize}if(null!==this.line){if("string"==typeof c[0]&&d.push(e(this.line-1+" "+c[0],"grey")),"string"==typeof c[1]){var g=this.line+" ";c[1]&&(g+=c[1].slice(0,this.column)+e(e(e(c[1].substr(this.column,1),"bold")+c[1].slice(this.column+1),"red"),"inverse")),d.push(g)}"string"==typeof c[2]&&d.push(e(this.line+1+" "+c[2],"grey")),d=d.join("\n")+e("","reset")+"\n"}return b+=e(this.type+"Error: "+this.message,"red"),this.filename&&(b+=e(" in ","red")+this.filename),this.line&&(b+=e(" on line "+this.line+", column "+(this.column+1)+":","grey")),b+="\n"+d,this.callLine&&(b+=e("from ","red")+(this.filename||"")+"/n",b+=e(this.callLine,"grey")+" "+this.callExtract+"/n"),b}},{"./utils":88}],37:[function(a,b,c){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;b=97&&j<=122||j<34))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(h96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;hd&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],41:[function(a,b,c){var d=a("./chunker");b.exports=function(){function a(d){for(var e,f,j,p=k.i,q=c,s=k.i-i,t=k.i+h.length-s,u=k.i+=d,v=b;k.i=0){j={index:k.i,text:v.substr(k.i,x+2-k.i),isLineComment:!1},k.i+=j.text.length-1,k.commentStore.push(j);continue}}break}if(e!==l&&e!==n&&e!==m&&e!==o)break}if(h=h.slice(d+k.i-u+s),i=k.i,!h.length){if(ce||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,c=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$re=function(b){k.i>i&&(h=h.slice(k.i-i),i=k.i);var c=b.exec(h);return c?(a(c[0].length),"string"==typeof c?c:1===c.length?c[0]:c):null},k.$char=function(c){return b.charAt(k.i)!==c?null:(a(1),c)},k.$str=function(c){for(var d=c.length,e=0;es||a=b.length;return k.i=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":40}],42:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=function j(a,b,c){function i(a,e){throw new d({index:p.i,filename:c.filename,type:e||"Syntax",message:a},b)}function k(a,b,c){var d=a instanceof Function?a.call(o):p.$re(a);return d?d:void i(b||("string"==typeof a?"expected '"+a+"' got '"+p.currentChar()+"'":"unexpected token"))}function l(a,b){return p.$char(a)?a:void i(b||"expected '"+a+"' got '"+p.currentChar()+"'")}function m(a){var b=c.filename;return{lineNumber:h.getLocation(a,p.getInput()).line+1,fileName:b}}function n(a,c,e,f,g){var h,i=[],j=p;try{j.start(a,!1,function(a,b){g({message:a,index:b+e})});for(var k,l,m=0;k=c[m];m++)l=j.i,h=o[k](),h?(h._index=l+e,h._fileInfo=f,i.push(h)):i.push(null);var n=j.end();n.isFinished?g(null,i):g(!0,null)}catch(q){throw new d({index:q.index+e,message:q.message},b,f.filename)}}var o,p=g();return{parserInput:p,imports:b,fileInfo:c,parseNode:n,parse:function(g,h,i){var k,l,m,n,o=null,q="";if(l=i&&i.globalVars?j.serializeVars(i.globalVars)+"\n":"",m=i&&i.modifyVars?"\n"+j.serializeVars(i.modifyVars):"",a.pluginManager)for(var r=a.pluginManager.getPreProcessors(),s=0;s")}return b&&(p.$char("(")&&(h=this.args(!0).args,l(")")),o.important()&&(j=!0),o.end())?(p.forget(),new e.mixin.Call(b,h,k,c,j)):void p.restore()}},args:function(a){var b,c,d,f,g,h,j,k=o.entities,l={args:null,variadic:!1},m=[],n=[],q=[];for(p.save();;){if(a)h=o.detachedRuleset()||o.expression();else{if(p.commentStore.length=0,p.$str("...")){l.variadic=!0,p.$char(";")&&!b&&(b=!0),(b?n:q).push({variadic:!0});break}h=k.variable()||k.property()||k.literal()||k.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var r=null;if(a?h.value&&1==h.value.length&&(r=h.value[0]):r=h,r&&(r instanceof e.Variable||r instanceof e.Property))if(p.$char(":")){if(m.length>0&&(b&&i("Cannot mix ; and , as delimiter types"),c=!0),g=o.detachedRuleset()||o.expression(),!g){if(!a)return p.restore(),l.args=[],l;i("could not understand value for named argument")}f=d=r.name}else if(p.$str("...")){if(!a){l.variadic=!0,p.$char(";")&&!b&&(b=!0),(b?n:q).push({name:h.name,variadic:!0});break}j=!0}else a||(d=f=r.name,g=null);g&&m.push(g),q.push({name:f,value:g,expand:j}),p.$char(",")||(p.$char(";")||b)&&(c&&i("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),n.push({name:d,value:g,expand:j}),d=null,m=[],c=!1)}return p.forget(),l.args=b?n:q,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==p.currentChar()&&"#"!==p.currentChar()||p.peek(/^[^{]*\}/)))if(p.save(),b=p.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!p.$char(")"))return void p.restore("Missing closing ')'");if(p.commentStore.length=0,p.$str("when")&&(d=k(o.conditions,"expected condition")),c=o.block())return p.forget(),new e.mixin.Definition(a,f,c,d,g);p.restore()}else p.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.property()||a.call()||a.keyword()||a.javascript()},end:function(){return p.$char(";")||p.peek("}")},ieAlpha:function(){var a;if(p.$re(/^opacity=/i))return a=p.$re(/^\d+/),a||(a=k(o.entities.variable,"Could not parse alpha"),a="@{"+a.name.slice(1)+"}"),l(")"),new e.Quoted("","alpha(opacity="+a+")")},element:function(){var a,b,d,f=p.i;if(b=this.combinator(),a=p.$re(/^(?:\d+\.\d+|\d+)%/)||p.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||p.$char("*")||p.$char("&")||this.attribute()||p.$re(/^\([^&()@]+\)/)||p.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(p.save(),p.$char("(")?(d=this.selector(!1))&&p.$char(")")?(a=new e.Paren(d),p.forget()):p.restore("Missing closing ')'"):p.forget()),a)return new e.Element(b,a,f,c)},combinator:function(){var a=p.currentChar();if("/"===a){p.save();var b=p.$re(/^\/[a-z]+\//i);if(b)return p.forget(),new e.Combinator(b);p.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(p.i++,"^"===a&&"^"===p.currentChar()&&(a="^^",p.i++);p.isWhitespace();)p.i++;return new e.Combinator(a)}return new e.Combinator(p.isWhitespace(-1)?" ":null)},selector:function(a){var b,d,f,g,h,j,l,m=p.i;for(a=a!==!1;(a&&(d=this.extend())||a&&(j=p.$str("when"))||(g=this.element()))&&(j?l=k(this.conditions,"expected condition"):l?i("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&i("Extend can only be used at the end of selector"),f=p.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,l,m,c):void(h&&i("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(p.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=k(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=p.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||p.$re(/^[0-9]+%/)||p.$re(/^[\w-]+/)||d.variableCurly()),l("]"),new e.Attribute(a,c,b)}},block:function(){var a;if(p.$char("{")&&(a=this.primary())&&p.$char("}"))return a},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();if(a)return new e.DetachedRuleset(a)},ruleset:function(){var b,c,d,f;for(p.save(),a.dumpLineNumbers&&(f=m(p.i));;){if(c=this.selector(),!c)break;if(b?b.push(c):b=[c],p.commentStore.length=0,c.condition&&b.length>1&&i("Guards are only currently allowed on a single selector."),!p.$char(","))break;c.condition&&i("Guards are only currently allowed on a single selector."),p.commentStore.length=0}if(b&&(d=this.block())){p.forget();var g=new e.Ruleset(b,d,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}p.restore()},declaration:function(){var a,b,d,f,g,h=p.i,i=p.currentChar();if("."!==i&&"#"!==i&&"&"!==i&&":"!==i)if(p.save(),a=this.variable()||this.ruleProperty()){if(g="string"==typeof a,g&&(b=this.detachedRuleset()),p.commentStore.length=0,!b){if(f=!g&&a.length>1&&a.pop().value,b=this.anonymousValue())return p.forget(),new e.Declaration(a,b,(!1),f,h,c);b||(b=this.value()),d=this.important()}if(b&&this.end())return p.forget(),new e.Declaration(a,b,d,f,h,c);p.restore()}else p.restore()},anonymousValue:function(){var a=p.i,b=p.$re(/^([^@\$+\/'"*`(;{}-]*);/);if(b)return new e.Anonymous(b[1],a)},"import":function(){var a,b,d=p.i,f=p.$re(/^@import?\s+/);if(f){var g=(f?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),p.$char(";")||(p.i=d,i("missing semi-colon or unrecognised media features on import")),b=b&&new e.Value(b),new e.Import(a,b,g,d,c);p.i=d,i("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!p.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!p.$char(","))break}while(a);return l(")"),d},importOption:function(){var a=p.$re(/^(less|css|multiple|once|inline|reference|optional)/);if(a)return a[1]},mediaFeature:function(){var a,b,d=this.entities,f=[];p.save();do a=d.keyword()||d.variable(),a?f.push(a):p.$char("(")&&(b=this.property(),a=this.value(),p.$char(")")?b&&a?f.push(new e.Paren(new e.Declaration(b,a,null,null,p.i,c,(!0)))):a?f.push(new e.Paren(a)):i("badly formed media feature definition"):i("Missing closing ')'","Parse"));while(a);if(p.forget(),f.length>0)return new e.Expression(f)},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!p.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!p.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=p.i;return a.dumpLineNumbers&&(g=m(h)),p.save(),p.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||i("media definitions require block statements after any features"),p.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void p.restore()},plugin:function(){var a,b,d,f=p.i,g=p.$re(/^@plugin?\s+/);if(g){if(b=this.pluginArgs(),d=b?{pluginArgs:b,isPlugin:!0}:{isPlugin:!0},a=this.entities.quoted()||this.entities.url())return p.$char(";")||(p.i=f, +i("missing semi-colon on @plugin")),new e.Import(a,null,d,f,c);p.i=f,i("malformed @plugin statement")}},pluginArgs:function(){if(p.save(),!p.$char("("))return p.restore(),null;var a=p.$re(/^\s*([^\);]+)\)\s*/);return a[1]?(p.forget(),a[1].trim()):(p.restore(),null)},atrule:function(){var b,d,f,g,h,j,k,l=p.i,n=!0,o=!0;if("@"===p.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(p.save(),b=p.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,n=!1;break;case"@namespace":j=!0,n=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,o=!1;break;default:k=!0}return p.commentStore.length=0,h?(d=this.entity(),d||i("expected "+b+" identifier")):j?(d=this.expression(),d||i("expected "+b+" expression")):k&&(d=(p.$re(/^[^{;]+/)||"").trim(),n="{"==p.currentChar(),d&&(d=new e.Anonymous(d))),n&&(f=this.blockRuleset()),f||!n&&d&&p.$char(";")?(p.forget(),new e.AtRule(b,d,f,l,c,a.dumpLineNumbers?m(l):null,o)):void p.restore("at-rule options not recognised")}}},value:function(){var a,b=[],c=p.i;do if(a=this.expression(),a&&(b.push(a),!p.$char(",")))break;while(a);if(b.length>0)return new e.Value(b,c)},important:function(){if("!"===p.currentChar())return p.$re(/^! *important/)},sub:function(){var a,b;return p.save(),p.$char("(")?(a=this.addition(),a&&p.$char(")")?(p.forget(),b=new e.Expression([a]),b.parens=!0,b):void p.restore("Expected ')'")):void p.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=p.isWhitespace(-1);;){if(p.peek(/^\/[*\/]/))break;if(p.save(),c=p.$char("/")||p.$char("*"),!c){p.forget();break}if(b=this.operand(),!b){p.restore();break}p.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=p.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=p.isWhitespace(-1);;){if(c=p.$re(/^[-+]\s+/)||!f&&(p.$char("+")||p.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=p.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=p.i;if(a=this.condition()){for(;;){if(!p.peek(/^,\s*(not\s*)?\(/)||!p.$char(","))break;if(b=this.condition(),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(){function a(){return p.$str("or")}var b,c,d;if(b=this.conditionAnd(this)){if(c=a()){if(d=this.condition(),!d)return;b=new e.Condition(c,b,d)}return b}},conditionAnd:function(){function a(a){return a.negatedCondition()||a.parenthesisCondition()}function b(){return p.$str("and")}var c,d,f;if(c=a(this)){if(d=b()){if(f=this.conditionAnd(),!f)return;c=new e.Condition(d,c,f)}return c}},negatedCondition:function(){if(p.$str("not")){var a=this.parenthesisCondition();return a&&(a.negate=!a.negate),a}},parenthesisCondition:function(){function a(a){var b;return p.save(),(b=a.condition())&&p.$char(")")?(p.forget(),b):void p.restore()}var b;return p.save(),p.$str("(")?(b=a(this))?(p.forget(),b):(b=this.atomicCondition())?p.$char(")")?(p.forget(),b):void p.restore("expected ')' got '"+p.currentChar()+"'"):void p.restore():void p.restore()},atomicCondition:function(){var a,b,c,d,f=this.entities,g=p.i;if(a=this.addition()||f.keyword()||f.quoted())return p.$char(">")?d=p.$char("=")?">=":">":p.$char("<")?d=p.$char("=")?"<=":"<":p.$char("=")&&(d=p.$char(">")?"=>":p.$char("<")?"=<":"="),d?(b=this.addition()||f.keyword()||f.quoted(),b?c=new e.Condition(d,a,b,g,(!1)):i("expected expression")):c=new e.Condition("=",a,new e.Keyword("true"),g,(!1)),c},operand:function(){var a,b=this.entities;p.peek(/^-[@\$\(]/)&&(a=p.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.property()||b.call()||b.colorKeyword();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[],d=p.i;do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),p.peek(/^\/[\/*]/)||(b=p.$char("/"),b&&c.push(new e.Anonymous(b,d)))));while(a);if(c.length>0)return new e.Expression(c)},property:function(){var a=p.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(a)return a[1]},ruleProperty:function(){function a(a){var b=p.i,c=p.$re(a);if(c)return g.push(b),f.push(c[1])}var b,d,f=[],g=[];p.save();var h=p.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],p.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(p.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;d=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},g.prototype.addPostProcessor=function(a,b){var c;for(c=0;c=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},g.prototype.addFileManager=function(a){this.fileManagers.push(a)},g.prototype.getPreProcessors=function(){for(var a=[],b=0;b0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],47:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Declaration("@"+a,b,(!1),null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j,k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor((!0)),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager)for(j=b.pluginManager.visitor(),j.first();i=j.get();)i.isPreEvalVisitor&&i.run(a);c=a.eval(h);for(var l=0;l.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(d="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":74}],57:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],58:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;c-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&c<1&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":15,"./color":53,"./node":74,"./unit":83}],61:[function(a,b,c){var d=a("./atrule"),e=function(){var a=Array.prototype.slice.call(arguments);d.apply(this,a)};e.prototype=Object.create(d.prototype),e.prototype.constructor=e,b.exports=e},{"./atrule":50}],62:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./combinator"),g=function(a,b,c,d,e){this.combinator=a instanceof f?a:new f(a),this.value="string"==typeof b?b.trim():b?b:"",this._index=c,this._fileInfo=d,this.copyVisibilityInfo(e),this.setParent(this.combinator,this)};g.prototype=new d,g.prototype.type="Element",g.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},g.prototype.eval=function(a){return new g(this.combinator,this.value.eval?this.value.eval(a):this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.fileInfo(),this.getIndex())},g.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof e&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=g},{"./combinator":54,"./node":74,"./paren":76}],63:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./comment"),g=function(a){if(this.value=a,!a)throw new Error("Expression requires an array parameter")};g.prototype=new d,g.prototype.type="Expression",g.prototype.accept=function(a){this.value=a.visitArray(this.value)},g.prototype.eval=function(a){var b,c=this.parens&&!this.parensInOp,d=!1;return c&&a.inParenthesis(),this.value.length>1?b=new g(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(d=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!d&&(b=new e(b)),b},g.prototype.genCSS=function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":74,"./selector":81}],65:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=a("../utils"),k=a("../less-error"),l=function(a,b,c,d,e,f){if(this.options=c,this._index=d,this._fileInfo=e,this.path=a,this.features=b,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f),this.setParent(this.features,this),this.setParent(this.path,this)};l.prototype=new d,l.prototype.type="Import",l.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.isPlugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},l.prototype.genCSS=function(a,b){this.css&&void 0===this.path._fileInfo.reference&&(b.add("@import ",this._fileInfo,this._index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},l.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},l.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),!(a instanceof g)||a.containsVariables()},l.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new l(b.eval(a),this.features,this.options,this._index,this._fileInfo,this.visibilityInfo())},l.prototype.evalPath=function(a){var b=this.path.eval(a),c=this._fileInfo&&this._fileInfo.rootpath;if(!(b instanceof f)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d); +}b.value=a.normalizePath(b.value)}return b},l.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){a.addVisibilityBlock()}):b.addVisibilityBlock()),b},l.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a);if(this.options.isPlugin){if(this.root&&this.root.eval)try{this.root.eval(a)}catch(f){throw f.message="Plugin error during evaluation",new k(f,this.root.imports,this.root.filename)}return c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[]}if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var g=new i(this.root,0,{filename:this.importedFilename,reference:this.path._fileInfo&&this.path._fileInfo.reference},(!0),(!0));return this.features?new e([g],this.features.value):[g]}if(this.css){var m=new l(this.evalPath(a),d,this.options,this._index);if(!m.css&&this.error)throw this.error;return m}return b=new h(null,j.copyArray(this.root.rules)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=l},{"../less-error":36,"../utils":88,"./anonymous":48,"./media":70,"./node":74,"./quoted":78,"./ruleset":80,"./url":84}],66:[function(a,b,c){var d=Object.create(null);d.Node=a("./node"),d.Color=a("./color"),d.AtRule=a("./atrule"),d.Directive=a("./directive"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Property=a("./property"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Declaration=a("./declaration"),d.Rule=a("./rule"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.VariableCall=a("./variable-call"),b.exports=d},{"./anonymous":48,"./assignment":49,"./atrule":50,"./attribute":51,"./call":52,"./color":53,"./combinator":54,"./comment":55,"./condition":56,"./declaration":58,"./detached-ruleset":59,"./dimension":60,"./directive":61,"./element":62,"./expression":63,"./extend":64,"./import":65,"./javascript":67,"./keyword":69,"./media":70,"./mixin-call":71,"./mixin-definition":72,"./negative":73,"./node":74,"./operation":75,"./paren":76,"./property":77,"./quoted":78,"./rule":79,"./ruleset":80,"./selector":81,"./unicode-descriptor":82,"./unit":83,"./url":84,"./value":85,"./variable":87,"./variable-call":86}],67:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this._index=c,this._fileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new e(b):"string"==typeof b?new f('"'+b+'"',b,this.escaped,this._index):new g(Array.isArray(b)?b.join(", "):b)},b.exports=h},{"./anonymous":48,"./dimension":60,"./js-eval-node":68,"./quoted":78}],68:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(!b.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.fileInfo().filename,index:this.getIndex()};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.getIndex(),d.fileInfo()).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.fileInfo().filename,index:this.getIndex()}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.fileInfo().filename,index:this.getIndex()}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":74,"./variable":87}],69:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":74}],70:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./atrule"),j=a("../utils"),k=function(a,b,c,g,h){this._index=c,this._fileInfo=g;var i=new f([],null,null,this._index,this._fileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0,this.setParent(i,this),this.setParent(this.features,this),this.setParent(this.rules,this)};k.prototype=new i,k.prototype.type="Media",k.prototype.isRulesetLike=function(){return!0},k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},k.prototype.genCSS=function(a,b){b.add("@media ",this._fileInfo,this._index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},k.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new k(null,[],this._index,this._fileInfo,this.visibilityInfo());return this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo),b.features=this.features.eval(a),a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},k.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo()),this.setParent(b,this)}return delete a.mediaBlocks,delete a.mediaPath,b},k.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;b0;b--)a.splice(b,0,new g("and"));return new h(a)})),this.setParent(this.features,this),new d([],[])},k.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(n=!0,k=0;k0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.getIndex(),filename:this.fileInfo().filename};for(k=0;kthis.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;gb?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],75:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};g.prototype=new d,g.prototype.type="Operation",g.prototype.accept=function(a){this.operands=a.visit(this.operands)},g.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof f&&c instanceof e&&(b=b.toColor()),c instanceof f&&b instanceof e&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new g(this.op,[b,c],this.isSpaced)},g.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=g},{"./color":53,"./dimension":60,"./node":74}],76:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":74}],77:[function(a,b,c){var d=a("./node"),e=a("./declaration"),f=function(a,b,c){this.name=a,this._index=b,this._fileInfo=c};f.prototype=new d,f.prototype.type="Property",f.prototype.eval=function(a){var b,c=this.name,d=a.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;if(this.evaluating)throw{type:"Name",message:"Recursive property reference for "+c,filename:this.fileInfo().filename,index:this.getIndex()};if(this.evaluating=!0,b=this.find(a.frames,function(b){var f,g=b.property(c);if(g){for(var h=0;hd){if(!c||c(g)){e=g.find(new i(a.elements.slice(d)),b,c);for(var j=0;j0&&b.add(k),a.firstSelector=!0,h[0].genCSS(a,b),a.firstSelector=!1,d=1;d0?(e=p.copyArray(a),f=e.pop(),g=d.createDerived(p.copyArray(f.elements))):g=d.createDerived([]),b.length>0){var h=c.combinator,i=b[0].elements[0];h.emptyOrWhitespace&&!i.combinator.emptyOrWhitespace&&(h=i.combinator),g.elements.push(new j(h,i.value,c._index,c._fileInfo)),g.elements=g.elements.concat(b[0].elements.slice(1))}if(0!==g.elements.length&&e.push(g),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function g(a,b,c,d,e){var g;for(g=0;g0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new i(a))}}function l(a,b,c){function m(a){var b;return a.value instanceof h?(b=a.value.value,b instanceof i?b:null):null}var n,o,p,q,r,s,t,u,v,w,x=!1;for(q=[],r=[[]],n=0;u=c.elements[n];n++)if("&"!==u.value){var y=m(u);if(null!=y){k(q,r);var z,A=[],B=[];for(z=l(A,b,y),x=x||z,p=0;p0&&t[0].elements.push(new j(u.combinator,"",u._index,u._fileInfo)),s.push(t);else for(p=0;p0&&(a.push(r[n]),w=r[n][v-1],r[n][v-1]=w.createDerived(w.elements,c.extendList));return x}function m(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var n,o,q;if(o=[],q=l(o,b,c),!q)if(b.length>0)for(o=[],n=0;n0)for(b=0;b=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}},copyArray:function(a){var b,c=a.length,d=new Array(c);for(b=0;b=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.fileInfo(),b),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitDeclaration:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;e0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return k0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitAtRule:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitAtRuleOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=i},{"../logger":37,"../tree":66,"../utils":88,"./visitor":96}],90:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],91:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=a("../utils"),h=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};h.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,g.copyArray(this.context.frames)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.getIndex(),f.filename=a.fileInfo().filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;h0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];if(this.keepOnlyVisibleChilds(c),!this.isEmpty(c))return a.ensureVisibility(),a.removeVisibilityBlock(),a},isVisibleRuleset:function(a){return!!a.firstRoot||!this.isEmpty(a)&&!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitDeclaration:function(a,b){if(!a.blocksVisibility()&&!a.variable)return a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){if(!a.blocksVisibility()&&!a.isSilent(this._context))return a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){if(!a.blocksVisibility())return a},visitAtRule:function(a,b){return a.rules&&a.rules.length?this.visitAtRuleWithBody(a,b):this.visitAtRuleWithoutBody(a,b)},visitAnonymous:function(a,b){if(!a.blocksVisibility())return a.accept(this._visitor),a},visitAtRuleWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitAtRuleWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;c0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;b=0;e--)if(c=a[e],c instanceof d.Declaration)if(f[c.name]){b=f[c.name],b instanceof d.Declaration&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);b.indexOf(g)!==-1?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b={},c=[],e=0;e0){var b=a[0],c=[],e=[new d.Expression(c)];a.forEach(function(a){"+"===a.merge&&c.length>0&&e.push(new d.Expression(c=[])),c.push(a.value),b.important=b.important||a.important}),b.value=new d.Value(e)}})}}},b.exports=g},{"../tree":66,"./visitor":96}],96:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitFnCache=[],h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var c,e=this._visitFnCache,f=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=g;if(l.visitDeeper=!0,j||(c="visit"+a.type,j=f[c]||d,k=f[c+"Out"]||d,e[h]=j,e[i]=k),j!==d){var m=j.call(f,a,l);f.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=d&&k.call(f,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;ck){for(var b=0,c=h.length-j;b Date: Sun, 8 Oct 2017 18:43:10 -0700 Subject: [PATCH 77/97] Change API on less object to lowercase --- lib/less/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/less/index.js b/lib/less/index.js index 62403bd0c..bc3562ee5 100644 --- a/lib/less/index.js +++ b/lib/less/index.js @@ -40,13 +40,13 @@ module.exports = function(environment, fileManagers) { /* eslint guard-for-in: 0 */ t = initial.tree[n]; if (typeof t === "function") { - api[n] = ctor(t); + api[n.toLowerCase()] = ctor(t); } else { api[n] = Object.create(null); for (var o in t) { /* eslint guard-for-in: 0 */ - api[n][o] = ctor(t[o]); + api[n][o.toLowerCase()] = ctor(t[o]); } } } From af5656944a8b65e852b383e6ee28d5e78819473c Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Sun, 8 Oct 2017 18:46:01 -0700 Subject: [PATCH 78/97] Update tests for lowercase API --- test/less/plugin/plugin-collection.js | 2 +- test/less/plugin/plugin-simple.js | 2 +- test/less/plugin/plugin-tree-nodes.js | 38 +++++++++++++-------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/test/less/plugin/plugin-collection.js b/test/less/plugin/plugin-collection.js index d8deb98c4..8e15cc7b7 100644 --- a/test/less/plugin/plugin-collection.js +++ b/test/less/plugin/plugin-collection.js @@ -5,5 +5,5 @@ functions.add('store', function(val) { return false; }); functions.add('list', function() { - return less.Value(collection); + return less.value(collection); }); \ No newline at end of file diff --git a/test/less/plugin/plugin-simple.js b/test/less/plugin/plugin-simple.js index 6c059e35a..b0f230f98 100644 --- a/test/less/plugin/plugin-simple.js +++ b/test/less/plugin/plugin-simple.js @@ -3,5 +3,5 @@ functions.add('pi-anon', function() { }); functions.add('pi', function() { - return less.Dimension(Math.PI); + return less.dimension(Math.PI); }); \ No newline at end of file diff --git a/test/less/plugin/plugin-tree-nodes.js b/test/less/plugin/plugin-tree-nodes.js index 96c7760f4..400b99156 100644 --- a/test/less/plugin/plugin-tree-nodes.js +++ b/test/less/plugin/plugin-tree-nodes.js @@ -1,10 +1,10 @@ functions.addMultiple({ "test-comment": function() { - return less.Combinator(' '); + return less.combinator(' '); }, "test-atrule": function(arg1, arg2) { - return less.AtRule(arg1.value, arg2.value); + return less.atrule(arg1.value, arg2.value); }, "test-extend": function() { // TODO @@ -22,7 +22,7 @@ functions.addMultiple({ // TODO }, "test-ruleset-call": function() { - return less.Combinator(' '); + return less.combinator(' '); }, // Functions must return something, even if it's false/true "test-undefined": function() { @@ -33,50 +33,50 @@ functions.addMultiple({ }, // These cause root errors "test-assignment": function() { - return less.Assignment("bird", "robin"); + return less.assignment("bird", "robin"); }, "test-attribute": function() { - return less.Attribute("foo", "=", "bar"); + return less.attribute("foo", "=", "bar"); }, "test-call": function() { - return less.Call("foo"); + return less.call("foo"); }, "test-color": function() { - return less.Color([50, 50, 50]); + return less.color([50, 50, 50]); }, "test-condition": function() { - return less.Condition('<', less.Value([0]), less.Value([1])); + return less.condition('<', less.value([0]), less.value([1])); }, "test-detached-ruleset" : function() { - var decl = less.Declaration('prop', 'value'); - return less.DetachedRuleset(less.Ruleset("", [ decl ])); + var decl = less.declaration('prop', 'value'); + return less.detachedruleset(less.ruleset("", [ decl ])); }, "test-dimension": function() { - return less.Dimension(1, 'px'); + return less.dimension(1, 'px'); }, "test-element": function() { - return less.Element('+', 'a'); + return less.element('+', 'a'); }, "test-expression": function() { - return less.Expression([1, 2, 3]); + return less.expression([1, 2, 3]); }, "test-keyword": function() { - return less.Keyword('foo'); + return less.keyword('foo'); }, "test-operation": function() { - return less.Operation('+', [1, 2]); + return less.operation('+', [1, 2]); }, "test-quoted": function() { - return less.Quoted('"', 'foo'); + return less.quoted('"', 'foo'); }, "test-selector": function() { - var sel = less.Selector('.a.b'); + var sel = less.selector('.a.b'); return sel; }, "test-url": function() { - return less.URL('http://google.com'); + return less.url('http://google.com'); }, "test-value": function() { - return less.Value([1]); + return less.value([1]); } }); \ No newline at end of file From bad9be8a117a61942520059067833f13ddab9ef2 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Mon, 9 Oct 2017 22:11:19 -0700 Subject: [PATCH 79/97] Fixes #3112 - also fixes browser test broken with lowercase API change --- lib/less/parser/parser.js | 4 +++- test/browser/less/plugin/plugin.js | 2 +- test/index.js | 1 + test/less-test.js | 19 +++++++++++++++++++ test/less/root-registry/file.less | 1 + test/less/root-registry/root.less | 3 +++ 6 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 test/less/root-registry/file.less create mode 100644 test/less/root-registry/root.less diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js index 52cf6489f..1ebe6cd13 100644 --- a/lib/less/parser/parser.js +++ b/lib/less/parser/parser.js @@ -2,7 +2,8 @@ var LessError = require('../less-error'), tree = require("../tree"), visitors = require("../visitors"), getParserInput = require("./parser-input"), - utils = require("../utils"); + utils = require("../utils"), + functionRegistry = require('../functions/function-registry'); // // less.js - parser @@ -185,6 +186,7 @@ var Parser = function Parser(context, imports, fileInfo) { tree.Node.prototype.rootNode = root; root.root = true; root.firstRoot = true; + // root.functionRegistry = functionRegistry.inherit(); } catch (e) { return callback(new LessError(e, imports, fileInfo.filename)); diff --git a/test/browser/less/plugin/plugin.js b/test/browser/less/plugin/plugin.js index 78fa62b2b..8065d815c 100644 --- a/test/browser/less/plugin/plugin.js +++ b/test/browser/less/plugin/plugin.js @@ -1,7 +1,7 @@ registerPlugin({ install: function(less, pluginManager, functions) { functions.add('func', function() { - return less.Anonymous(location.href); + return less.anonymous(location.href); }); } }); \ No newline at end of file diff --git a/test/index.js b/test/index.js index 0c2392bd3..648d9c054 100644 --- a/test/index.js +++ b/test/index.js @@ -58,4 +58,5 @@ testMap.forEach(function(args) { lessTester.testSyncronous({syncImport: true}, "import"); lessTester.testSyncronous({syncImport: true}, "css"); lessTester.testNoOptions(); +lessTester.testJSImport(); lessTester.finished(); diff --git a/test/less-test.js b/test/less-test.js index 431fd039f..9ab051d7f 100644 --- a/test/less-test.js +++ b/test/less-test.js @@ -155,6 +155,24 @@ module.exports = function() { }); } + // https://github.com/less/less.js/issues/3112 + function testJSImport() { + process.stdout.write("- Testing root function registry"); + less.functions.functionRegistry.add('ext', function() { + return new less.tree.Anonymous('file'); + }); + var expected = "@charset \"utf-8\";\n"; + toCSS({}, require('path').join(process.cwd(), 'test/less/root-registry/root.less'), function(error, output) { + if (error) { + return fail("ERROR: " + error); + } + if (output.css === expected) { + return ok('OK'); + } + difference("FAIL", expected, output.css); + }); + } + function globalReplacements(input, directory, filename) { var path = require('path'); var p = filename ? path.join(path.dirname(filename), '/') : path.join(process.cwd(), directory), @@ -422,6 +440,7 @@ module.exports = function() { testEmptySourcemap: testEmptySourcemap, testNoOptions: testNoOptions, prepBomTest: prepBomTest, + testJSImport: testJSImport, finished: finished }; }; diff --git a/test/less/root-registry/file.less b/test/less/root-registry/file.less new file mode 100644 index 000000000..55cfd4ea2 --- /dev/null +++ b/test/less/root-registry/file.less @@ -0,0 +1 @@ +@charset "utf-8"; \ No newline at end of file diff --git a/test/less/root-registry/root.less b/test/less/root-registry/root.less new file mode 100644 index 000000000..a77c8c1e5 --- /dev/null +++ b/test/less/root-registry/root.less @@ -0,0 +1,3 @@ +// https://github.com/less/less.js/issues/3112 +@file: ext(); +@import '@{file}'; \ No newline at end of file From 94408424d6bd3e1dc85967094845ab1b8d420c30 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Mon, 9 Oct 2017 22:13:35 -0700 Subject: [PATCH 80/97] Fixes #3112 for real this time --- lib/less/parser/parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/less/parser/parser.js b/lib/less/parser/parser.js index 1ebe6cd13..f3116fd0d 100644 --- a/lib/less/parser/parser.js +++ b/lib/less/parser/parser.js @@ -186,7 +186,7 @@ var Parser = function Parser(context, imports, fileInfo) { tree.Node.prototype.rootNode = root; root.root = true; root.firstRoot = true; - // root.functionRegistry = functionRegistry.inherit(); + root.functionRegistry = functionRegistry.inherit(); } catch (e) { return callback(new LessError(e, imports, fileInfo.filename)); From ea6246e16d3f217a621f3c45f6944ae471dc1bce Mon Sep 17 00:00:00 2001 From: Rob Huzzey Date: Mon, 16 Oct 2017 12:36:33 +0100 Subject: [PATCH 81/97] Allows for inclusing of LESS files from node_modules without .less extension --- lib/less-node/file-manager.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/less-node/file-manager.js b/lib/less-node/file-manager.js index afe556323..542347c98 100644 --- a/lib/less-node/file-manager.js +++ b/lib/less-node/file-manager.js @@ -82,9 +82,8 @@ FileManager.prototype.loadFile = function(filename, currentDirectory, options, e } catch (e) {} } - else { - fullFilename = options.ext ? self.tryAppendExtension(fullFilename, options.ext) : fullFilename; - } + + fullFilename = options.ext ? self.tryAppendExtension(fullFilename, options.ext) : fullFilename; if (self.files[fullFilename]) { fulfill({ contents: self.files[fullFilename], filename: fullFilename}); From 637bbbd0c22dbf14d7cb6dc0f79dfb9f372b0cd4 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Tue, 17 Oct 2017 15:40:07 -0700 Subject: [PATCH 82/97] Update README.md with warning about alpha version --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 0c1338712..3be36d23a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +### This is the Less 3.0 Alpha branch (non-production ready). For the stable branch of Less, go [here](https://github.com/less/less.js/tree/master). + + [![npm version](https://badge.fury.io/js/less.svg)](http://badge.fury.io/js/less) [![Build Status](https://travis-ci.org/less/less.js.svg?branch=master)](https://travis-ci.org/less/less.js) [![Build status](https://ci.appveyor.com/api/projects/status/bx2qspy3qbuxpl9q/branch/3.x?svg=true)](https://ci.appveyor.com/project/lukeapage/less-js/branch/3.x) [![Dependencies](https://david-dm.org/less/less.js.svg)](https://david-dm.org/less/less.js) [![devDependency Status](https://david-dm.org/less/less.js/dev-status.svg)](https://david-dm.org/less/less.js#info=devDependencies) [![optionalDependency Status](https://david-dm.org/less/less.js/optional-status.svg)](https://david-dm.org/less/less.js#info=optionalDependencies) [![Twitter Follow](https://img.shields.io/twitter/follow/lesstocss.svg?style=flat-square)](https://twitter.com/lesstocss) [![Join the chat at https://gitter.im/less/less.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/less/less.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) Chat with Less.js users [![Sauce Test Status](https://saucelabs.com/browser-matrix/less.svg)](https://saucelabs.com/u/less) From 7be05d7a4df158c76ed6fe415100ddaf4afd1cc4 Mon Sep 17 00:00:00 2001 From: Rob Huzzey Date: Wed, 18 Oct 2017 11:37:40 +0300 Subject: [PATCH 83/97] Added test for import module fix --- package.json | 3 ++- test/import-module/one/1.less | 3 +++ test/import-module/one/two/2.less | 3 +++ test/import-module/one/two/three/3.less | 3 +++ test/import-module/package.json | 11 +++++++++++ test/less/import-module.less | 3 +++ 6 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 test/import-module/one/1.less create mode 100644 test/import-module/one/two/2.less create mode 100644 test/import-module/one/two/three/3.less create mode 100644 test/import-module/package.json create mode 100644 test/less/import-module.less diff --git a/package.json b/package.json index 7842a2723..fe705d7c8 100644 --- a/package.json +++ b/package.json @@ -61,12 +61,13 @@ "grunt-eslint": "^19.0.0", "grunt-saucelabs": "^9.0.0", "grunt-shell": "^1.3.0", + "import-module": "file:test/import-module", "jit-grunt": "^0.10.0", "less-plugin-clean-css": "^1.5.1", "performance-now": "^0.2.0", "phantomjs-prebuilt": "^2.1.7", - "promise": "^7.1.1", "phin": "^2.2.3", + "promise": "^7.1.1", "time-grunt": "^1.3.0" }, "keywords": [ diff --git a/test/import-module/one/1.less b/test/import-module/one/1.less new file mode 100644 index 000000000..7ee3e9d37 --- /dev/null +++ b/test/import-module/one/1.less @@ -0,0 +1,3 @@ +.one { + color: red; +} diff --git a/test/import-module/one/two/2.less b/test/import-module/one/two/2.less new file mode 100644 index 000000000..68036dbc5 --- /dev/null +++ b/test/import-module/one/two/2.less @@ -0,0 +1,3 @@ +.two { + color: blue; +} diff --git a/test/import-module/one/two/three/3.less b/test/import-module/one/two/three/3.less new file mode 100644 index 000000000..24cab7239 --- /dev/null +++ b/test/import-module/one/two/three/3.less @@ -0,0 +1,3 @@ +.three { + color: green; +} diff --git a/test/import-module/package.json b/test/import-module/package.json new file mode 100644 index 000000000..54adf9d4e --- /dev/null +++ b/test/import-module/package.json @@ -0,0 +1,11 @@ +{ + "name": "import-module", + "version": "1.0.0", + "description": "Less files to be included in node_modules directory for testing import from node_modules", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Rob Huzzey ", + "license": "ISC" +} diff --git a/test/less/import-module.less b/test/less/import-module.less new file mode 100644 index 000000000..68928f792 --- /dev/null +++ b/test/less/import-module.less @@ -0,0 +1,3 @@ +@import 'import-module/one/two/three/3.less'; +@import 'import-module/one/two/2.less'; +@import 'import-module/one/1.less'; From 1ea60cba203388a1f6f6251dcb2324214c5a19b3 Mon Sep 17 00:00:00 2001 From: Mardav Wala Date: Thu, 19 Oct 2017 13:39:06 -0400 Subject: [PATCH 84/97] =?UTF-8?q?Update=20=C2=A9=20year?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3be36d23a..901463abf 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ See the [changelog](CHANGELOG.md) ## [License](LICENSE) -Copyright (c) 2009-2016 [Alexis Sellier](http://cloudhead.io) & The Core Less Team +Copyright (c) 2009-2017 [Alexis Sellier](http://cloudhead.io) & The Core Less Team Licensed under the [Apache License](LICENSE). From 044aa24c4f6b0eb8ccd5fa91ca1bd5059b0b8965 Mon Sep 17 00:00:00 2001 From: Rob Huzzey Date: Fri, 20 Oct 2017 10:40:59 +0300 Subject: [PATCH 85/97] Added CSS to test the LESS --- test/css/import-module.css | 9 +++++++++ test/less/import-module.less | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 test/css/import-module.css diff --git a/test/css/import-module.css b/test/css/import-module.css new file mode 100644 index 000000000..c25cc8568 --- /dev/null +++ b/test/css/import-module.css @@ -0,0 +1,9 @@ +.three { + color: green; +} +.two { + color: blue; +} +.one { + color: red; +} diff --git a/test/less/import-module.less b/test/less/import-module.less index 68928f792..37dcf6674 100644 --- a/test/less/import-module.less +++ b/test/less/import-module.less @@ -1,3 +1,3 @@ -@import 'import-module/one/two/three/3.less'; -@import 'import-module/one/two/2.less'; -@import 'import-module/one/1.less'; +@import "import-module/one/two/three/3.less"; +@import "import-module/one/two/2"; +@import "import-module/one/1.less"; From 95536723e9223708b018cc9a0767d597da3a12b9 Mon Sep 17 00:00:00 2001 From: Rob Huzzey Date: Fri, 20 Oct 2017 10:50:13 +0300 Subject: [PATCH 86/97] Exclude import-module from browsert test as node_modules will not be in browser --- Gruntfile.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Gruntfile.js b/Gruntfile.js index c1980ee58..9af870a6b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -291,6 +291,7 @@ module.exports = function (grunt) { 'test/less/*.less', // Don't test NPM import, obviously '!test/less/plugin-module.less', + '!test/less/import-module.less', '!test/less/javascript.less', '!test/less/urls.less', '!test/less/empty.less' From 2f5d635708313107bf72258d99a6a799d1a6d736 Mon Sep 17 00:00:00 2001 From: Niklas Mollenhauer Date: Sat, 21 Oct 2017 22:19:21 +0200 Subject: [PATCH 87/97] Mime update --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fe705d7c8..52bbe9114 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "errno": "^0.1.1", "graceful-fs": "^4.1.2", "image-size": "~0.5.0", - "mime": "^1.2.11", + "mime": "^1.4.1", "mkdirp": "^0.5.0", "promise": "^7.1.1", "source-map": "^0.5.3" From 691f0f1aca76fa2c527fec6a34ebbb2556a3626e Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Mon, 23 Oct 2017 19:46:51 -0700 Subject: [PATCH 88/97] Deprecate Node 0.10 and 0.12 support --- .travis.yml | 4 ++-- appveyor.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5ecfa7641..3444a98bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,8 @@ node_js: - "8" - "6" - "4" - - "0.12" - - "0.10" + # - "0.12" + # - "0.10" before_install: # from https://github.com/travis-ci/travis-ci/issues/3225#issuecomment-177592725 # and also from https://github.com/travis-ci/travis-ci/issues/3225#issuecomment-200965782 diff --git a/appveyor.yml b/appveyor.yml index 9697ff2b2..523738ada 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,8 +1,8 @@ # Test against these versions of Node.js. environment: matrix: - - nodejs_version: "0.10" - - nodejs_version: "0.12" + # - nodejs_version: "0.10" + # - nodejs_version: "0.12" - nodejs_version: "4" - nodejs_version: "6" - nodejs_version: "8" From d384779edc049a81a976275678b66750759760d8 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Tue, 14 Nov 2017 10:25:16 -0800 Subject: [PATCH 89/97] Create stale.yml See: https://probot.github.io/apps/stale/ --- .github/stale.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 000000000..9220ae765 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,17 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 120 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 14 +# Issues with these labels will never be considered stale +exemptLabels: + - Up-For-Grabs + - Bug +# Label to use when marking an issue as stale +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false From 385da8ffda274c4508680982168a92ae061afaab Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Tue, 14 Nov 2017 10:52:01 -0800 Subject: [PATCH 90/97] Update stale.yml --- .github/stale.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/stale.yml b/.github/stale.yml index 9220ae765..329d49feb 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -4,8 +4,8 @@ daysUntilStale: 120 daysUntilClose: 14 # Issues with these labels will never be considered stale exemptLabels: - - Up-For-Grabs - - Bug + - up-for-grabs + - bug # Label to use when marking an issue as stale staleLabel: stale # Comment to post when marking an issue as stale. Set to `false` to disable From 5d230dd3013a57b039fd9d40d712c5d8ffb00471 Mon Sep 17 00:00:00 2001 From: Anton Shchekota Date: Fri, 5 Jan 2018 11:19:07 +0300 Subject: [PATCH 91/97] Drop node 0.10 and 0.12 and added node 9 matrix testing --- .travis.yml | 3 +-- appveyor.yml | 3 +-- package.json | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3444a98bc..b8b97f75f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,11 +3,10 @@ cache: directories: - travis-phantomjs node_js: + - "9" - "8" - "6" - "4" - # - "0.12" - # - "0.10" before_install: # from https://github.com/travis-ci/travis-ci/issues/3225#issuecomment-177592725 # and also from https://github.com/travis-ci/travis-ci/issues/3225#issuecomment-200965782 diff --git a/appveyor.yml b/appveyor.yml index 523738ada..ffc157e03 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,11 +1,10 @@ # Test against these versions of Node.js. environment: matrix: - # - nodejs_version: "0.10" - # - nodejs_version: "0.12" - nodejs_version: "4" - nodejs_version: "6" - nodejs_version: "8" + - nodejs_version: "9" # Install scripts. (runs after repo cloning) install: diff --git a/package.json b/package.json index 52bbe9114..2d84e733d 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ }, "browser": "./dist/less.js", "engines": { - "node": ">=0.12" + "node": ">=4" }, "scripts": { "test": "grunt test" From 0b7c81ccfb794ca4dd243c0fc73a4675d3b734e0 Mon Sep 17 00:00:00 2001 From: Anton Shchekota Date: Fri, 5 Jan 2018 11:43:50 +0300 Subject: [PATCH 92/97] Removed install npm 2 version for appveyor. It was hotfix for old node version. --- appveyor.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ffc157e03..e0bbf24cc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,13 +8,6 @@ environment: # Install scripts. (runs after repo cloning) install: - # Get the latest stable version of Node 0.STABLE.latest - - ps: Install-Product node $env:nodejs_version - # Use npm v2 - - npm -g install npm@2 - - set PATH=%APPDATA%\npm;%PATH% - - npm -v - # node 0.10 & 0.12 have race condition issues when running custom install scripts # this can cause phantomjs-prebuilt install script to fail with the error: # From 8b4524f644734c5c57c00ea0ce484bf49c886346 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Sun, 4 Feb 2018 09:48:39 -0800 Subject: [PATCH 93/97] Bump to 3.0.0-RC.1 - Remove UMD spec from plugins --- dist/less.js | 14 +- dist/less.min.js | 12 +- lib/less/plugin-api.js | 16 - package-lock.json | 5865 ++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 5 files changed, 5880 insertions(+), 29 deletions(-) delete mode 100644 lib/less/plugin-api.js create mode 100644 package-lock.json diff --git a/dist/less.js b/dist/less.js index bf9da8976..cf580f488 100644 --- a/dist/less.js +++ b/dist/less.js @@ -1,8 +1,8 @@ /*! - * Less - Leaner CSS v3.0.0-alpha.3 + * Less - Leaner CSS v3.0.0-RC.1 * http://lesscss.org * - * Copyright (c) 2009-2017, Alexis Sellier + * Copyright (c) 2009-2018, Alexis Sellier * Licensed under the Apache-2.0 License. * */ @@ -2872,13 +2872,13 @@ module.exports = function(environment, fileManagers) { /* eslint guard-for-in: 0 */ t = initial.tree[n]; if (typeof t === "function") { - api[n] = ctor(t); + api[n.toLowerCase()] = ctor(t); } else { api[n] = Object.create(null); for (var o in t) { /* eslint guard-for-in: 0 */ - api[n][o] = ctor(t[o]); + api[n][o.toLowerCase()] = ctor(t[o]); } } } @@ -3600,7 +3600,8 @@ var LessError = require('../less-error'), tree = require("../tree"), visitors = require("../visitors"), getParserInput = require("./parser-input"), - utils = require("../utils"); + utils = require("../utils"), + functionRegistry = require('../functions/function-registry'); // // less.js - parser @@ -3783,6 +3784,7 @@ var Parser = function Parser(context, imports, fileInfo) { tree.Node.prototype.rootNode = root; root.root = true; root.firstRoot = true; + root.functionRegistry = functionRegistry.inherit(); } catch (e) { return callback(new LessError(e, imports, fileInfo.filename)); @@ -5594,7 +5596,7 @@ Parser.serializeVars = function(vars) { module.exports = Parser; -},{"../less-error":36,"../tree":66,"../utils":88,"../visitors":92,"./parser-input":41}],43:[function(require,module,exports){ +},{"../functions/function-registry":26,"../less-error":36,"../tree":66,"../utils":88,"../visitors":92,"./parser-input":41}],43:[function(require,module,exports){ var utils = require('./utils'); /** * Plugin Manager diff --git a/dist/less.min.js b/dist/less.min.js index 0ab424693..9757c3e70 100644 --- a/dist/less.min.js +++ b/dist/less.min.js @@ -1,8 +1,8 @@ /*! - * Less - Leaner CSS v3.0.0-alpha.3 + * Less - Leaner CSS v3.0.0-RC.1 * http://lesscss.org * - * Copyright (c) 2009-2017, Alexis Sellier + * Copyright (c) 2009-2018, Alexis Sellier * Licensed under the Apache-2.0 License. * */ @@ -11,7 +11,7 @@ */ !function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.less=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0||b.isFileProtocol?"development":"production");var c=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(a.location.hash);c&&(b.dumpLineNumbers=c[1]),void 0===b.useFileCache&&(b.useFileCache=!0),void 0===b.onReady&&(b.onReady=!0),b.javascriptEnabled=!(!b.javascriptEnabled&&!b.inlineJavaScript)}},{"./browser":3,"./utils":11}],2:[function(a,b,c){function d(a){a.filename&&console.warn(a),e.async||h.removeChild(i)}a("promise/polyfill");var e=a("../less/default-options")();if(window.less)for(key in window.less)window.less.hasOwnProperty(key)&&(e[key]=window.less[key]);a("./add-default-options")(window,e),e.plugins=e.plugins||[],window.LESS_PLUGINS&&(e.plugins=e.plugins.concat(window.LESS_PLUGINS));var f=b.exports=a("./index")(window,e);window.less=f;var g,h,i;e.onReady&&(/!watch/.test(window.location.hash)&&f.watch(),e.async||(g="body { display: none !important }",h=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),i.type="text/css",i.styleSheet?i.styleSheet.cssText=g:i.appendChild(document.createTextNode(g)),h.appendChild(i)),f.registerStylesheetsImmediately(),f.pageLoadFinished=f.refresh("development"===f.env).then(d,d))},{"../less/default-options":16,"./add-default-options":1,"./index":8,"promise/polyfill":102}],3:[function(a,b,c){var d=a("./utils");b.exports={createCSS:function(a,b,c){var e=c.href||"",f="less:"+(c.title||d.extractId(e)),g=a.getElementById(f),h=!1,i=a.createElement("style");i.setAttribute("type","text/css"),c.media&&i.setAttribute("media",c.media),i.id=f,i.styleSheet||(i.appendChild(a.createTextNode(b)),h=null!==g&&g.childNodes.length>0&&i.childNodes.length>0&&g.firstChild.nodeValue===i.firstChild.nodeValue);var j=a.getElementsByTagName("head")[0];if(null===g||h===!1){var k=c&&c.nextSibling||null;k?k.parentNode.insertBefore(i,k):j.appendChild(i)}if(g&&h===!1&&g.parentNode.removeChild(g),i.styleSheet)try{i.styleSheet.cssText=b}catch(l){throw new Error("Couldn't reassign styleSheet.cssText.")}},currentScript:function(a){var b=a.document;return b.currentScript||function(){var a=b.getElementsByTagName("script");return a[a.length-1]}()}}},{"./utils":11}],4:[function(a,b,c){b.exports=function(a,b,c){var d=null;if("development"!==b.env)try{d="undefined"==typeof a.localStorage?null:a.localStorage}catch(e){}return{setCSS:function(a,b,e,f){if(d){c.info("saving "+a+" to cache.");try{d.setItem(a,f),d.setItem(a+":timestamp",b),e&&d.setItem(a+":vars",JSON.stringify(e))}catch(g){c.error('failed to save "'+a+'" to local storage for caching.')}}},getCSS:function(a,b,c){var e=d&&d.getItem(a),f=d&&d.getItem(a+":timestamp"),g=d&&d.getItem(a+":vars");if(c=c||{},f&&b.lastModified&&new Date(b.lastModified).valueOf()===new Date(f).valueOf()&&(!c&&!g||JSON.stringify(c)===g))return e}}}},{}],5:[function(a,b,c){var d=a("./utils"),e=a("./browser");b.exports=function(a,b,c){function f(b,f){var g,h,i="less-error-message:"+d.extractId(f||""),j='
    • {content}
    • ',k=a.document.createElement("div"),l=[],m=b.filename||f,n=m.match(/([^\/]+(\?.*)?)$/)[1];k.id=i,k.className="less-error-message",h="

      "+(b.type||"Syntax")+"Error: "+(b.message||"There is an error in your .less file")+'

      in '+n+" ";var o=function(a,b,c){void 0!==a.extract[b]&&l.push(j.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};b.line&&(o(b,0,""),o(b,1,"line"),o(b,2,""),h+="on line "+b.line+", column "+(b.column+1)+":

        "+l.join("")+"
      "),b.stack&&(b.extract||c.logLevel>=4)&&(h+="
      Stack Trace
      "+b.stack.split("\n").slice(1).join("
      ")),k.innerHTML=h,e.createCSS(a.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),k.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===c.env&&(g=setInterval(function(){var b=a.document,c=b.body;c&&(b.getElementById(i)?c.replaceChild(k,b.getElementById(i)):c.insertBefore(k,c.firstChild),clearInterval(g))},10))}function g(b){var c=a.document.getElementById("less-error-message:"+d.extractId(b));c&&c.parentNode.removeChild(c)}function h(a){}function i(a){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?h(a):"function"==typeof c.errorReporting&&c.errorReporting("remove",a):g(a)}function j(a,d){var e="{line} {content}",f=a.filename||d,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f,i=function(a,b,c){void 0!==a.extract[b]&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.line&&(i(a,0,""),i(a,1,"line"),i(a,2,""),h+=" on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")),a.stack&&(a.extract||c.logLevel>=4)&&(h+="\nStack Trace\n"+a.stack),b.logger.error(h)}function k(a,b){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?j(a,b):"function"==typeof c.errorReporting&&c.errorReporting("add",a,b):f(a,b)}return{add:k,remove:i}}},{"./browser":3,"./utils":11}],6:[function(a,b,c){b.exports=function(b,c){var d=a("../less/environment/abstract-file-manager.js"),e={},f=function(){};return f.prototype=new d,f.prototype.alwaysMakePathsAbsolute=function(){return!0},f.prototype.join=function(a,b){return a?this.extractUrlParts(b,a).path:b},f.prototype.doXHR=function(a,d,e,f){function g(b,c,d){b.status>=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var h=new XMLHttpRequest,i=!b.isFileProtocol||b.fileAsync;"function"==typeof h.overrideMimeType&&h.overrideMimeType("text/css"),c.debug("XHR: Getting '"+a+"'"),h.open("GET",a,i),h.setRequestHeader("Accept",d||"text/x-less, text/css; q=0.9, */*; q=0.5"),h.send(null),b.isFileProtocol&&!b.fileAsync?0===h.status||h.status>=200&&h.status<300?e(h.responseText):f(h.status,a):i?h.onreadystatechange=function(){4==h.readyState&&g(h,e,f)}:g(h,e,f)},f.prototype.supports=function(a,b,c,d){return!0},f.prototype.clearFileCache=function(){e={}},f.prototype.loadFile=function(a,b,c,d){b&&!this.isPathAbsolute(a)&&(a=b+a),a=c.ext?this.tryAppendExtension(a,c.ext):a,c=c||{};var f=this.extractUrlParts(a,window.location.href),g=f.url,h=this;return new Promise(function(a,b){if(c.useFileCache&&e[g])try{var d=e[g];return a({contents:d,filename:g,webInfo:{lastModified:new Date}})}catch(f){return b({filename:g,message:"Error loading file "+g+" error was "+f.message})}h.doXHR(g,c.mime,function(b,c){e[g]=b,a({contents:b,filename:g,webInfo:{lastModified:c}})},function(a,c){b({type:"File",message:"'"+c+"' wasn't found ("+a+")",href:g})})})},f}},{"../less/environment/abstract-file-manager.js":17}],7:[function(a,b,c){b.exports=function(){function b(){throw{type:"Runtime",message:"Image size functions are not supported in browser version of less"}}var c=a("./../less/functions/function-registry"),d={"image-size":function(a){return b(this,a),-1},"image-width":function(a){return b(this,a),-1},"image-height":function(a){return b(this,a),-1}};c.addMultiple(d)}},{"./../less/functions/function-registry":26}],8:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(b,c){function f(a){return JSON.parse(JSON.stringify(a||{}))}function g(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}}function h(a){for(var b,d=l.getElementsByTagName("style"),e=0;e=c&&console.log(a)},info:function(a){b.logLevel>=d&&console.log(a)},warn:function(a){b.logLevel>=e&&console.warn(a)},error:function(a){b.logLevel>=f&&console.error(a)}}]);for(var g=0;g0&&(a=a.slice(0,b)),b=a.lastIndexOf("/"),b<0&&(b=a.lastIndexOf("\\")),b<0?"":a.slice(0,b+1)},d.prototype.tryAppendExtension=function(a,b){return/(\.[a-z]*$)|([\?;].*)$/.test(a)?a:a+b},d.prototype.tryAppendLessExtension=function(a){return this.tryAppendExtension(a,".less")},d.prototype.supportsSync=function(){return!1},d.prototype.alwaysMakePathsAbsolute=function(){return!1},d.prototype.isPathAbsolute=function(a){return/^(?:[a-z-]+:|\/|\\|#)/i.test(a)},d.prototype.join=function(a,b){return a?a+b:b},d.prototype.pathDiff=function(a,b){var c,d,e,f,g=this.extractUrlParts(a),h=this.extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;cparseInt(b[c])?-1:1;return 0},g.prototype.versionToString=function(a){for(var b="",c=0;c=0;h--){var i=g[h];if(i[f?"supportsSync":"supports"](a,b,c,e))return i}return null},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},b.exports=e},{"../logger":37}],20:[function(a,b,c){var d=a("./function-registry"),e=a("../tree/anonymous"),f=a("../tree/keyword");d.addMultiple({"boolean":function(a){return a?f.True:f.False},"if":function(a,b,c){return a?b:c||new e}})},{"../tree/anonymous":48,"../tree/keyword":69,"./function-registry":26}],21:[function(a,b,c){function d(a,b,c){var d,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;l<3;l++)d=b.rgb[l]/255,f=c.rgb[l]/255,h=a(d,f),g&&(h=(j*f+i*(d-j*(d+f-h)))/g),k[l]=255*h;return new e(k,g)}var e=a("../tree/color"),f=a("./function-registry"),g={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,a<=1?g.multiply(a,b):g.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return g.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};for(var h in g)g.hasOwnProperty(h)&&(d[h]=d.bind(null,g[h]));f.addMultiple(d)},{"../tree/color":53,"./function-registry":26}],22:[function(a,b,c){function d(a){return Math.min(1,Math.max(0,a))}function e(a){return h.hsla(a.h,a.s,a.l,a.a)}function f(a){if(a instanceof i)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{type:"Argument",message:"color functions take numbers as parameters"}}function g(a,b){return a instanceof i&&a.unit.is("%")?parseFloat(a.value*b/100):f(a)}var h,i=a("../tree/dimension"),j=a("../tree/color"),k=a("../tree/quoted"),l=a("../tree/anonymous"),m=a("./function-registry");h={rgb:function(a,b,c){return h.rgba(a,b,c,1)},rgba:function(a,b,c,d){var e=[a,b,c].map(function(a){return g(a,255)});return d=f(d),new j(e,d)},hsl:function(a,b,c){return h.hsla(a,b,c,1)},hsla:function(a,b,c,e){function g(a){return a=a<0?a+1:a>1?a-1:a,6*a<1?i+(j-i)*a*6:2*a<1?j:3*a<2?i+(j-i)*(2/3-a)*6:i}var i,j;return a=f(a)%360/360,b=d(f(b)),c=d(f(c)),e=d(f(e)),j=c<=.5?c*(b+1):c+b-c*b,i=2*c-j,h.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),e)},hsv:function(a,b,c){return h.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=f(a)%360/360*360,b=f(b),c=f(c),d=f(d);var e,g;e=Math.floor(a/60%6),g=a/60-e;var i=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],j=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return h.rgba(255*i[j[e][0]],255*i[j[e][1]],255*i[j[e][2]],d)},hue:function(a){return new i(a.toHSL().h)},saturation:function(a){return new i(100*a.toHSL().s,"%")},lightness:function(a){return new i(100*a.toHSL().l,"%")},hsvhue:function(a){return new i(a.toHSV().h)},hsvsaturation:function(a){return new i(100*a.toHSV().s,"%")},hsvvalue:function(a){return new i(100*a.toHSV().v,"%")},red:function(a){return new i(a.rgb[0])},green:function(a){return new i(a.rgb[1])},blue:function(a){return new i(a.rgb[2])},alpha:function(a){return new i(a.toHSL().a)},luma:function(a){return new i(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new i(b*a.alpha*100,"%")},saturate:function(a,b,c){if(!a.rgb)return null;var f=a.toHSL();return f.s+="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},desaturate:function(a,b,c){var f=a.toHSL();return f.s-="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},lighten:function(a,b,c){var f=a.toHSL();return f.l+="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},darken:function(a,b,c){var f=a.toHSL();return f.l-="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},fadein:function(a,b,c){var f=a.toHSL();return f.a+="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fadeout:function(a,b,c){var f=a.toHSL();return f.a-="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=d(c.a),e(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=d<0?360+d:d,e(c)},mix:function(a,b,c){a.toHSL&&b.toHSL||(console.log(b.type),console.dir(b)),c||(c=new i(50));var d=c.value/100,e=2*d-1,f=a.toHSL().a-b.toHSL().a,g=((e*f==-1?e:(e+f)/(1+e*f))+1)/2,h=1-g,k=[a.rgb[0]*g+b.rgb[0]*h,a.rgb[1]*g+b.rgb[1]*h,a.rgb[2]*g+b.rgb[2]*h],l=a.alpha*d+b.alpha*(1-d);return new j(k,l)},greyscale:function(a){return h.desaturate(a,new i(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;if("undefined"==typeof c&&(c=h.rgba(255,255,255,1)),"undefined"==typeof b&&(b=h.rgba(0,0,0,1)),b.luma()>c.luma()){var e=c;c=b,b=e}return d="undefined"==typeof d?.43:f(d),a.luma()=v&&this.context.ieCompat!==!1?(h.warn("Skipped data-uri embedding of "+j+" because its size ("+u.length+" characters) exceeds IE8-safe "+v+" characters!"),g(this,f||a)):new d(new c('"'+u+'"',u,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../logger":37,"../tree/quoted":78,"../tree/url":84,"../utils":88,"./function-registry":26}],24:[function(a,b,c){var d=a("../tree/keyword"),e=a("./function-registry"),f={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;if(null!=a)return a?d.True:d.False},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}};e.add("default",f.eval.bind(f)),b.exports=f},{"../tree/keyword":69,"./function-registry":26}],25:[function(a,b,c){var d=a("../tree/expression"),e=function(a,b,c,d){this.name=a.toLowerCase(),this.index=c,this.context=b,this.currentFileInfo=d,this.func=b.frames[0].functionRegistry.get(this.name)};e.prototype.isValid=function(){return Boolean(this.func)},e.prototype.call=function(a){return Array.isArray(a)&&(a=a.filter(function(a){return"Comment"!==a.type}).map(function(a){if("Expression"===a.type){var b=a.value.filter(function(a){return"Comment"!==a.type});return 1===b.length?b[0]:new d(b)}return a})),this.func.apply(this,a)},b.exports=e},{"../tree/expression":63}],26:[function(a,b,c){function d(a){return{_data:{},add:function(a,b){a=a.toLowerCase(),this._data.hasOwnProperty(a),this._data[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){this.add(b,a[b])}.bind(this))},get:function(b){return this._data[b]||a&&a.get(b)},getLocalFunctions:function(){return this._data},inherit:function(){return d(this)},create:function(a){return d(a)}}}b.exports=d(null)},{}],27:[function(a,b,c){b.exports=function(b){var c={functionRegistry:a("./function-registry"),functionCaller:a("./function-caller")};return a("./boolean"),a("./default"),a("./color"),a("./color-blending"),a("./data-uri")(b),a("./math"),a("./number"),a("./string"),a("./svg")(b),a("./types"),c}},{"./boolean":20,"./color":22,"./color-blending":21,"./data-uri":23,"./default":24,"./function-caller":25,"./function-registry":26,"./math":29,"./number":30,"./string":31,"./svg":32,"./types":33}],28:[function(a,b,c){var d=a("../tree/dimension"),e=function(){};e._math=function(a,b,c){if(!(c instanceof d))throw{type:"Argument",message:"argument must be a number" -};return null==b?b=c.unit:c=c.unify(),new d(a(parseFloat(c.value)),b)},b.exports=e},{"../tree/dimension":60}],29:[function(a,b,c){var d=a("./function-registry"),e=a("./math-helper.js"),f={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"};for(var g in f)f.hasOwnProperty(g)&&(f[g]=e._math.bind(null,Math[g],f[g]));f.round=function(a,b){var c="undefined"==typeof b?0:b.value;return e._math(function(a){return a.toFixed(c)},null,a)},d.addMultiple(f)},{"./function-registry":26,"./math-helper.js":28}],30:[function(a,b,c){var d=a("../tree/dimension"),e=a("../tree/anonymous"),f=a("./function-registry"),g=a("./math-helper.js"),h=function(a,b){switch(b=Array.prototype.slice.call(b),b.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var c,f,g,h,i,j,k,l,m=[],n={};for(c=0;ci.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(b[c].value)&&Array.prototype.push.apply(b,Array.prototype.slice.call(b[c].value));return 1==m.length?m[0]:(b=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new e((a?"min":"max")+"("+b+")"))};f.addMultiple({min:function(){return h(!0,arguments)},max:function(){return h(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new d(Math.PI)},mod:function(a,b){return new d(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d(a),b=new d(b);else if(!(a instanceof d&&b instanceof d))throw{type:"Argument",message:"arguments must be numbers"};return new d(Math.pow(a.value,b.value),a.unit)},percentage:function(a){var b=g._math(function(a){return 100*a},"%",a);return b}})},{"../tree/anonymous":48,"../tree/dimension":60,"./function-registry":26,"./math-helper.js":28}],31:[function(a,b,c){var d=a("../tree/quoted"),e=a("../tree/anonymous"),f=a("../tree/javascript"),g=a("./function-registry");g.addMultiple({e:function(a){return new e(a instanceof f?a.evaluated:a.value)},escape:function(a){return new e(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,b,c,e){var f=a.value;return c="Quoted"===c.type?c.value:c.toCSS(),f=f.replace(new RegExp(b.value,e?e.value:""),c),new d(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;e",k=0;k";return j+="',j=encodeURIComponent(j),j="data:image/svg+xml,"+j,new g(new f("'"+j+"'",j,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":53,"../tree/dimension":60,"../tree/expression":63,"../tree/quoted":78,"../tree/url":84,"./function-registry":26}],33:[function(a,b,c){var d=a("../tree/keyword"),e=a("../tree/detached-ruleset"),f=a("../tree/dimension"),g=a("../tree/color"),h=a("../tree/quoted"),i=a("../tree/anonymous"),j=a("../tree/url"),k=a("../tree/operation"),l=a("./function-registry"),m=function(a,b){return a instanceof b?d.True:d.False},n=function(a,b){if(void 0===b)throw{type:"Argument",message:"missing the required second argument to isunit."};if(b="string"==typeof b.value?b.value:b,"string"!=typeof b)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof f&&a.unit.is(b)?d.True:d.False},o=function(a){var b=Array.isArray(a.value)?a.value:Array(a);return b};l.addMultiple({isruleset:function(a){return m(a,e)},iscolor:function(a){return m(a,g)},isnumber:function(a){return m(a,f)},isstring:function(a){return m(a,h)},iskeyword:function(a){return m(a,d)},isurl:function(a){return m(a,j)},ispixel:function(a){return n(a,"px")},ispercentage:function(a){return n(a,"%")},isem:function(a){return n(a,"em")},isunit:n,unit:function(a,b){if(!(a instanceof f))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof k?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d?b.value:b.toCSS():"",new f(a.value,b)},"get-unit":function(a){return new i(a.unit)},extract:function(a,b){return b=b.value-1,o(a)[b]},length:function(a){return new f(o(a).length)}})},{"../tree/anonymous":48,"../tree/color":53,"../tree/detached-ruleset":59,"../tree/dimension":60,"../tree/keyword":69,"../tree/operation":75,"../tree/quoted":78,"../tree/url":84,"./function-registry":26}],34:[function(a,b,c){var d=a("./contexts"),e=a("./parser/parser"),f=a("./less-error"),g=a("./utils");"undefined"==typeof Promise?a("promise"):Promise;b.exports=function(a){var b=function(a,b,c){this.less=a,this.rootFilename=c.filename,this.paths=b.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=b.mime,this.error=null,this.context=b,this.queue=[],this.files={}};return b.prototype.push=function(b,c,h,i,j){var k=this,l=this.context.pluginManager.Loader;this.queue.push(b);var m=function(a,c,d){k.queue.splice(k.queue.indexOf(b),1);var e=d===k.rootFilename;i.optional&&a?j(null,{rules:[]},!1,null):(k.files[d]||(k.files[d]={root:c,options:i}),a&&!k.error&&(k.error=a),j(a,c,e,d))},n={relativeUrls:this.context.relativeUrls,entryPath:h.entryPath,rootpath:h.rootpath,rootFilename:h.rootFilename},o=a.getFileManager(b,h.currentDirectory,this.context,a);if(!o)return void m({message:"Could not find a file-manager for "+b});var p,q=function(a){var b,c=a.filename,g=a.contents.replace(/^\uFEFF/,"");n.currentDirectory=o.getPath(c),n.relativeUrls&&(n.rootpath=o.join(k.context.rootpath||"",o.pathDiff(n.currentDirectory,n.entryPath)),!o.isPathAbsolute(n.rootpath)&&o.alwaysMakePathsAbsolute()&&(n.rootpath=o.join(n.entryPath,n.rootpath))),n.filename=c;var j=new d.Parse(k.context);j.processImports=!1,k.contents[c]=g,(h.reference||i.reference)&&(n.reference=!0),i.isPlugin?(b=l.evalPlugin(g,j,k,i.pluginArgs,n),b instanceof f?m(b,null,c):m(null,b,c)):i.inline?m(null,g,c):!k.files[c]||k.files[c].options.multiple||i.multiple?new e(j,k,n).parse(g,function(a,b){m(a,b,c)}):m(null,k.files[c].root,c)},r=g.clone(this.context);c&&(r.ext=i.isPlugin?".js":".less"),p=i.isPlugin?l.loadPlugin(b,h.currentDirectory,r,a,o):o.loadFile(b,h.currentDirectory,r,a,function(a,b){a?m(a):q(b)}),p&&p.then(q,m)},b}},{"./contexts":12,"./less-error":36,"./parser/parser":42,"./utils":88,promise:void 0}],35:[function(a,b,c){b.exports=function(b,c){var d,e,f,g,h,i,j={version:[3,0,0],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),AbstractPluginLoader:a("./environment/abstract-plugin-loader"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")},k=function(a){return function(){var b=Object.create(a.prototype);return a.apply(b,Array.prototype.slice.call(arguments,0)),b}},l=Object.create(j);for(var m in j.tree)if(i=j.tree[m],"function"==typeof i)l[m]=k(i);else{l[m]=Object.create(null);for(var n in i)l[m][n]=k(i[n])}return l}},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":17,"./environment/abstract-plugin-loader":18,"./environment/environment":19,"./functions":27,"./import-manager":34,"./less-error":36,"./logger":37,"./parse":39,"./parse-tree":38,"./parser/parser":42,"./plugin-manager":43,"./render":44,"./source-map-builder":45,"./source-map-output":46,"./transform-tree":47,"./tree":66,"./utils":88,"./visitors":92}],36:[function(a,b,c){var d=a("./utils"),e=b.exports=function(a,b,c){Error.call(this);var e=a.filename||c;if(this.message=a.message,this.stack=a.stack,b&&e){var f=b.contents[e],g=d.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&d.getLocation(a.call,f).line,k=f.split("\n");if(this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.column=i,!this.line&&this.stack){var l=this.stack.match(/(|Function):(\d+):(\d+)/);l&&(l[2]&&(this.line=parseInt(l[2])-2),l[3]&&(this.column=parseInt(l[3])))}this.callLine=j+1,this.callExtract=k[j],this.extract=[k[this.line-2],k[this.line-1],k[this.line]]}};if("undefined"==typeof Object.create){var f=function(){};f.prototype=Error.prototype,e.prototype=new f}else e.prototype=Object.create(Error.prototype);e.prototype.constructor=e,e.prototype.toString=function(a){a=a||{};var b="",c=this.extract||[],d=[],e=function(a){return a};if(a.stylize){var f=typeof a.stylize;if("function"!==f)throw Error("options.stylize should be a function, got a "+f+"!");e=a.stylize}if(null!==this.line){if("string"==typeof c[0]&&d.push(e(this.line-1+" "+c[0],"grey")),"string"==typeof c[1]){var g=this.line+" ";c[1]&&(g+=c[1].slice(0,this.column)+e(e(e(c[1].substr(this.column,1),"bold")+c[1].slice(this.column+1),"red"),"inverse")),d.push(g)}"string"==typeof c[2]&&d.push(e(this.line+1+" "+c[2],"grey")),d=d.join("\n")+e("","reset")+"\n"}return b+=e(this.type+"Error: "+this.message,"red"),this.filename&&(b+=e(" in ","red")+this.filename),this.line&&(b+=e(" on line "+this.line+", column "+(this.column+1)+":","grey")),b+="\n"+d,this.callLine&&(b+=e("from ","red")+(this.filename||"")+"/n",b+=e(this.callLine,"grey")+" "+this.callExtract+"/n"),b}},{"./utils":88}],37:[function(a,b,c){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;b=97&&j<=122||j<34))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(h96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;hd&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],41:[function(a,b,c){var d=a("./chunker");b.exports=function(){function a(d){for(var e,f,j,p=k.i,q=c,s=k.i-i,t=k.i+h.length-s,u=k.i+=d,v=b;k.i=0){j={index:k.i,text:v.substr(k.i,x+2-k.i),isLineComment:!1},k.i+=j.text.length-1,k.commentStore.push(j);continue}}break}if(e!==l&&e!==n&&e!==m&&e!==o)break}if(h=h.slice(d+k.i-u+s),i=k.i,!h.length){if(ce||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,c=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$re=function(b){k.i>i&&(h=h.slice(k.i-i),i=k.i);var c=b.exec(h);return c?(a(c[0].length),"string"==typeof c?c:1===c.length?c[0]:c):null},k.$char=function(c){return b.charAt(k.i)!==c?null:(a(1),c)},k.$str=function(c){for(var d=c.length,e=0;es||a=b.length;return k.i=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":40}],42:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=function j(a,b,c){function i(a,e){throw new d({index:p.i,filename:c.filename,type:e||"Syntax",message:a},b)}function k(a,b,c){var d=a instanceof Function?a.call(o):p.$re(a);return d?d:void i(b||("string"==typeof a?"expected '"+a+"' got '"+p.currentChar()+"'":"unexpected token"))}function l(a,b){return p.$char(a)?a:void i(b||"expected '"+a+"' got '"+p.currentChar()+"'")}function m(a){var b=c.filename;return{lineNumber:h.getLocation(a,p.getInput()).line+1,fileName:b}}function n(a,c,e,f,g){var h,i=[],j=p;try{j.start(a,!1,function(a,b){g({message:a,index:b+e})});for(var k,l,m=0;k=c[m];m++)l=j.i,h=o[k](),h?(h._index=l+e,h._fileInfo=f,i.push(h)):i.push(null);var n=j.end();n.isFinished?g(null,i):g(!0,null)}catch(q){throw new d({index:q.index+e,message:q.message},b,f.filename)}}var o,p=g();return{parserInput:p,imports:b,fileInfo:c,parseNode:n,parse:function(g,h,i){var k,l,m,n,o=null,q="";if(l=i&&i.globalVars?j.serializeVars(i.globalVars)+"\n":"",m=i&&i.modifyVars?"\n"+j.serializeVars(i.modifyVars):"",a.pluginManager)for(var r=a.pluginManager.getPreProcessors(),s=0;s")}return b&&(p.$char("(")&&(h=this.args(!0).args,l(")")),o.important()&&(j=!0),o.end())?(p.forget(),new e.mixin.Call(b,h,k,c,j)):void p.restore()}},args:function(a){var b,c,d,f,g,h,j,k=o.entities,l={args:null,variadic:!1},m=[],n=[],q=[];for(p.save();;){if(a)h=o.detachedRuleset()||o.expression();else{if(p.commentStore.length=0,p.$str("...")){l.variadic=!0,p.$char(";")&&!b&&(b=!0),(b?n:q).push({variadic:!0});break}h=k.variable()||k.property()||k.literal()||k.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var r=null;if(a?h.value&&1==h.value.length&&(r=h.value[0]):r=h,r&&(r instanceof e.Variable||r instanceof e.Property))if(p.$char(":")){if(m.length>0&&(b&&i("Cannot mix ; and , as delimiter types"),c=!0),g=o.detachedRuleset()||o.expression(),!g){if(!a)return p.restore(),l.args=[],l;i("could not understand value for named argument")}f=d=r.name}else if(p.$str("...")){if(!a){l.variadic=!0,p.$char(";")&&!b&&(b=!0),(b?n:q).push({name:h.name,variadic:!0});break}j=!0}else a||(d=f=r.name,g=null);g&&m.push(g),q.push({name:f,value:g,expand:j}),p.$char(",")||(p.$char(";")||b)&&(c&&i("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),n.push({name:d,value:g,expand:j}),d=null,m=[],c=!1)}return p.forget(),l.args=b?n:q,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==p.currentChar()&&"#"!==p.currentChar()||p.peek(/^[^{]*\}/)))if(p.save(),b=p.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!p.$char(")"))return void p.restore("Missing closing ')'");if(p.commentStore.length=0,p.$str("when")&&(d=k(o.conditions,"expected condition")),c=o.block())return p.forget(),new e.mixin.Definition(a,f,c,d,g);p.restore()}else p.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.property()||a.call()||a.keyword()||a.javascript()},end:function(){return p.$char(";")||p.peek("}")},ieAlpha:function(){var a;if(p.$re(/^opacity=/i))return a=p.$re(/^\d+/),a||(a=k(o.entities.variable,"Could not parse alpha"),a="@{"+a.name.slice(1)+"}"),l(")"),new e.Quoted("","alpha(opacity="+a+")")},element:function(){var a,b,d,f=p.i;if(b=this.combinator(),a=p.$re(/^(?:\d+\.\d+|\d+)%/)||p.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||p.$char("*")||p.$char("&")||this.attribute()||p.$re(/^\([^&()@]+\)/)||p.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(p.save(),p.$char("(")?(d=this.selector(!1))&&p.$char(")")?(a=new e.Paren(d),p.forget()):p.restore("Missing closing ')'"):p.forget()),a)return new e.Element(b,a,f,c)},combinator:function(){var a=p.currentChar();if("/"===a){p.save();var b=p.$re(/^\/[a-z]+\//i);if(b)return p.forget(),new e.Combinator(b);p.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(p.i++,"^"===a&&"^"===p.currentChar()&&(a="^^",p.i++);p.isWhitespace();)p.i++;return new e.Combinator(a)}return new e.Combinator(p.isWhitespace(-1)?" ":null)},selector:function(a){var b,d,f,g,h,j,l,m=p.i;for(a=a!==!1;(a&&(d=this.extend())||a&&(j=p.$str("when"))||(g=this.element()))&&(j?l=k(this.conditions,"expected condition"):l?i("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&i("Extend can only be used at the end of selector"),f=p.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,l,m,c):void(h&&i("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(p.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=k(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=p.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||p.$re(/^[0-9]+%/)||p.$re(/^[\w-]+/)||d.variableCurly()),l("]"),new e.Attribute(a,c,b)}},block:function(){var a;if(p.$char("{")&&(a=this.primary())&&p.$char("}"))return a},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();if(a)return new e.DetachedRuleset(a)},ruleset:function(){var b,c,d,f;for(p.save(),a.dumpLineNumbers&&(f=m(p.i));;){if(c=this.selector(),!c)break;if(b?b.push(c):b=[c],p.commentStore.length=0,c.condition&&b.length>1&&i("Guards are only currently allowed on a single selector."),!p.$char(","))break;c.condition&&i("Guards are only currently allowed on a single selector."),p.commentStore.length=0}if(b&&(d=this.block())){p.forget();var g=new e.Ruleset(b,d,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}p.restore()},declaration:function(){var a,b,d,f,g,h=p.i,i=p.currentChar();if("."!==i&&"#"!==i&&"&"!==i&&":"!==i)if(p.save(),a=this.variable()||this.ruleProperty()){if(g="string"==typeof a,g&&(b=this.detachedRuleset()),p.commentStore.length=0,!b){if(f=!g&&a.length>1&&a.pop().value,b=this.anonymousValue())return p.forget(),new e.Declaration(a,b,(!1),f,h,c);b||(b=this.value()),d=this.important()}if(b&&this.end())return p.forget(),new e.Declaration(a,b,d,f,h,c);p.restore()}else p.restore()},anonymousValue:function(){var a=p.i,b=p.$re(/^([^@\$+\/'"*`(;{}-]*);/);if(b)return new e.Anonymous(b[1],a)},"import":function(){var a,b,d=p.i,f=p.$re(/^@import?\s+/);if(f){var g=(f?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),p.$char(";")||(p.i=d,i("missing semi-colon or unrecognised media features on import")),b=b&&new e.Value(b),new e.Import(a,b,g,d,c);p.i=d,i("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!p.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!p.$char(","))break}while(a);return l(")"),d},importOption:function(){var a=p.$re(/^(less|css|multiple|once|inline|reference|optional)/);if(a)return a[1]},mediaFeature:function(){var a,b,d=this.entities,f=[];p.save();do a=d.keyword()||d.variable(),a?f.push(a):p.$char("(")&&(b=this.property(),a=this.value(),p.$char(")")?b&&a?f.push(new e.Paren(new e.Declaration(b,a,null,null,p.i,c,(!0)))):a?f.push(new e.Paren(a)):i("badly formed media feature definition"):i("Missing closing ')'","Parse"));while(a);if(p.forget(),f.length>0)return new e.Expression(f)},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!p.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!p.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=p.i;return a.dumpLineNumbers&&(g=m(h)),p.save(),p.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||i("media definitions require block statements after any features"),p.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void p.restore()},plugin:function(){var a,b,d,f=p.i,g=p.$re(/^@plugin?\s+/);if(g){if(b=this.pluginArgs(),d=b?{pluginArgs:b,isPlugin:!0}:{isPlugin:!0},a=this.entities.quoted()||this.entities.url())return p.$char(";")||(p.i=f, -i("missing semi-colon on @plugin")),new e.Import(a,null,d,f,c);p.i=f,i("malformed @plugin statement")}},pluginArgs:function(){if(p.save(),!p.$char("("))return p.restore(),null;var a=p.$re(/^\s*([^\);]+)\)\s*/);return a[1]?(p.forget(),a[1].trim()):(p.restore(),null)},atrule:function(){var b,d,f,g,h,j,k,l=p.i,n=!0,o=!0;if("@"===p.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(p.save(),b=p.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,n=!1;break;case"@namespace":j=!0,n=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,o=!1;break;default:k=!0}return p.commentStore.length=0,h?(d=this.entity(),d||i("expected "+b+" identifier")):j?(d=this.expression(),d||i("expected "+b+" expression")):k&&(d=(p.$re(/^[^{;]+/)||"").trim(),n="{"==p.currentChar(),d&&(d=new e.Anonymous(d))),n&&(f=this.blockRuleset()),f||!n&&d&&p.$char(";")?(p.forget(),new e.AtRule(b,d,f,l,c,a.dumpLineNumbers?m(l):null,o)):void p.restore("at-rule options not recognised")}}},value:function(){var a,b=[],c=p.i;do if(a=this.expression(),a&&(b.push(a),!p.$char(",")))break;while(a);if(b.length>0)return new e.Value(b,c)},important:function(){if("!"===p.currentChar())return p.$re(/^! *important/)},sub:function(){var a,b;return p.save(),p.$char("(")?(a=this.addition(),a&&p.$char(")")?(p.forget(),b=new e.Expression([a]),b.parens=!0,b):void p.restore("Expected ')'")):void p.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=p.isWhitespace(-1);;){if(p.peek(/^\/[*\/]/))break;if(p.save(),c=p.$char("/")||p.$char("*"),!c){p.forget();break}if(b=this.operand(),!b){p.restore();break}p.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=p.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=p.isWhitespace(-1);;){if(c=p.$re(/^[-+]\s+/)||!f&&(p.$char("+")||p.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=p.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=p.i;if(a=this.condition()){for(;;){if(!p.peek(/^,\s*(not\s*)?\(/)||!p.$char(","))break;if(b=this.condition(),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(){function a(){return p.$str("or")}var b,c,d;if(b=this.conditionAnd(this)){if(c=a()){if(d=this.condition(),!d)return;b=new e.Condition(c,b,d)}return b}},conditionAnd:function(){function a(a){return a.negatedCondition()||a.parenthesisCondition()}function b(){return p.$str("and")}var c,d,f;if(c=a(this)){if(d=b()){if(f=this.conditionAnd(),!f)return;c=new e.Condition(d,c,f)}return c}},negatedCondition:function(){if(p.$str("not")){var a=this.parenthesisCondition();return a&&(a.negate=!a.negate),a}},parenthesisCondition:function(){function a(a){var b;return p.save(),(b=a.condition())&&p.$char(")")?(p.forget(),b):void p.restore()}var b;return p.save(),p.$str("(")?(b=a(this))?(p.forget(),b):(b=this.atomicCondition())?p.$char(")")?(p.forget(),b):void p.restore("expected ')' got '"+p.currentChar()+"'"):void p.restore():void p.restore()},atomicCondition:function(){var a,b,c,d,f=this.entities,g=p.i;if(a=this.addition()||f.keyword()||f.quoted())return p.$char(">")?d=p.$char("=")?">=":">":p.$char("<")?d=p.$char("=")?"<=":"<":p.$char("=")&&(d=p.$char(">")?"=>":p.$char("<")?"=<":"="),d?(b=this.addition()||f.keyword()||f.quoted(),b?c=new e.Condition(d,a,b,g,(!1)):i("expected expression")):c=new e.Condition("=",a,new e.Keyword("true"),g,(!1)),c},operand:function(){var a,b=this.entities;p.peek(/^-[@\$\(]/)&&(a=p.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.property()||b.call()||b.colorKeyword();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[],d=p.i;do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),p.peek(/^\/[\/*]/)||(b=p.$char("/"),b&&c.push(new e.Anonymous(b,d)))));while(a);if(c.length>0)return new e.Expression(c)},property:function(){var a=p.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(a)return a[1]},ruleProperty:function(){function a(a){var b=p.i,c=p.$re(a);if(c)return g.push(b),f.push(c[1])}var b,d,f=[],g=[];p.save();var h=p.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],p.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(p.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;d=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},g.prototype.addPostProcessor=function(a,b){var c;for(c=0;c=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},g.prototype.addFileManager=function(a){this.fileManagers.push(a)},g.prototype.getPreProcessors=function(){for(var a=[],b=0;b0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],47:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Declaration("@"+a,b,(!1),null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j,k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor((!0)),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager)for(j=b.pluginManager.visitor(),j.first();i=j.get();)i.isPreEvalVisitor&&i.run(a);c=a.eval(h);for(var l=0;l.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(d="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":74}],57:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],58:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;c-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&c<1&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":15,"./color":53,"./node":74,"./unit":83}],61:[function(a,b,c){var d=a("./atrule"),e=function(){var a=Array.prototype.slice.call(arguments);d.apply(this,a)};e.prototype=Object.create(d.prototype),e.prototype.constructor=e,b.exports=e},{"./atrule":50}],62:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./combinator"),g=function(a,b,c,d,e){this.combinator=a instanceof f?a:new f(a),this.value="string"==typeof b?b.trim():b?b:"",this._index=c,this._fileInfo=d,this.copyVisibilityInfo(e),this.setParent(this.combinator,this)};g.prototype=new d,g.prototype.type="Element",g.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},g.prototype.eval=function(a){return new g(this.combinator,this.value.eval?this.value.eval(a):this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.fileInfo(),this.getIndex())},g.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof e&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=g},{"./combinator":54,"./node":74,"./paren":76}],63:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./comment"),g=function(a){if(this.value=a,!a)throw new Error("Expression requires an array parameter")};g.prototype=new d,g.prototype.type="Expression",g.prototype.accept=function(a){this.value=a.visitArray(this.value)},g.prototype.eval=function(a){var b,c=this.parens&&!this.parensInOp,d=!1;return c&&a.inParenthesis(),this.value.length>1?b=new g(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(d=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!d&&(b=new e(b)),b},g.prototype.genCSS=function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":74,"./selector":81}],65:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=a("../utils"),k=a("../less-error"),l=function(a,b,c,d,e,f){if(this.options=c,this._index=d,this._fileInfo=e,this.path=a,this.features=b,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f),this.setParent(this.features,this),this.setParent(this.path,this)};l.prototype=new d,l.prototype.type="Import",l.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.isPlugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},l.prototype.genCSS=function(a,b){this.css&&void 0===this.path._fileInfo.reference&&(b.add("@import ",this._fileInfo,this._index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},l.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},l.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),!(a instanceof g)||a.containsVariables()},l.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new l(b.eval(a),this.features,this.options,this._index,this._fileInfo,this.visibilityInfo())},l.prototype.evalPath=function(a){var b=this.path.eval(a),c=this._fileInfo&&this._fileInfo.rootpath;if(!(b instanceof f)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d); -}b.value=a.normalizePath(b.value)}return b},l.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){a.addVisibilityBlock()}):b.addVisibilityBlock()),b},l.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a);if(this.options.isPlugin){if(this.root&&this.root.eval)try{this.root.eval(a)}catch(f){throw f.message="Plugin error during evaluation",new k(f,this.root.imports,this.root.filename)}return c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[]}if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var g=new i(this.root,0,{filename:this.importedFilename,reference:this.path._fileInfo&&this.path._fileInfo.reference},(!0),(!0));return this.features?new e([g],this.features.value):[g]}if(this.css){var m=new l(this.evalPath(a),d,this.options,this._index);if(!m.css&&this.error)throw this.error;return m}return b=new h(null,j.copyArray(this.root.rules)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=l},{"../less-error":36,"../utils":88,"./anonymous":48,"./media":70,"./node":74,"./quoted":78,"./ruleset":80,"./url":84}],66:[function(a,b,c){var d=Object.create(null);d.Node=a("./node"),d.Color=a("./color"),d.AtRule=a("./atrule"),d.Directive=a("./directive"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Property=a("./property"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Declaration=a("./declaration"),d.Rule=a("./rule"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.VariableCall=a("./variable-call"),b.exports=d},{"./anonymous":48,"./assignment":49,"./atrule":50,"./attribute":51,"./call":52,"./color":53,"./combinator":54,"./comment":55,"./condition":56,"./declaration":58,"./detached-ruleset":59,"./dimension":60,"./directive":61,"./element":62,"./expression":63,"./extend":64,"./import":65,"./javascript":67,"./keyword":69,"./media":70,"./mixin-call":71,"./mixin-definition":72,"./negative":73,"./node":74,"./operation":75,"./paren":76,"./property":77,"./quoted":78,"./rule":79,"./ruleset":80,"./selector":81,"./unicode-descriptor":82,"./unit":83,"./url":84,"./value":85,"./variable":87,"./variable-call":86}],67:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this._index=c,this._fileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new e(b):"string"==typeof b?new f('"'+b+'"',b,this.escaped,this._index):new g(Array.isArray(b)?b.join(", "):b)},b.exports=h},{"./anonymous":48,"./dimension":60,"./js-eval-node":68,"./quoted":78}],68:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(!b.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.fileInfo().filename,index:this.getIndex()};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.getIndex(),d.fileInfo()).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.fileInfo().filename,index:this.getIndex()}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.fileInfo().filename,index:this.getIndex()}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":74,"./variable":87}],69:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":74}],70:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./atrule"),j=a("../utils"),k=function(a,b,c,g,h){this._index=c,this._fileInfo=g;var i=new f([],null,null,this._index,this._fileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0,this.setParent(i,this),this.setParent(this.features,this),this.setParent(this.rules,this)};k.prototype=new i,k.prototype.type="Media",k.prototype.isRulesetLike=function(){return!0},k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},k.prototype.genCSS=function(a,b){b.add("@media ",this._fileInfo,this._index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},k.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new k(null,[],this._index,this._fileInfo,this.visibilityInfo());return this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo),b.features=this.features.eval(a),a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},k.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo()),this.setParent(b,this)}return delete a.mediaBlocks,delete a.mediaPath,b},k.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;b0;b--)a.splice(b,0,new g("and"));return new h(a)})),this.setParent(this.features,this),new d([],[])},k.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(n=!0,k=0;k0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.getIndex(),filename:this.fileInfo().filename};for(k=0;kthis.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;gb?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],75:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};g.prototype=new d,g.prototype.type="Operation",g.prototype.accept=function(a){this.operands=a.visit(this.operands)},g.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof f&&c instanceof e&&(b=b.toColor()),c instanceof f&&b instanceof e&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new g(this.op,[b,c],this.isSpaced)},g.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=g},{"./color":53,"./dimension":60,"./node":74}],76:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":74}],77:[function(a,b,c){var d=a("./node"),e=a("./declaration"),f=function(a,b,c){this.name=a,this._index=b,this._fileInfo=c};f.prototype=new d,f.prototype.type="Property",f.prototype.eval=function(a){var b,c=this.name,d=a.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;if(this.evaluating)throw{type:"Name",message:"Recursive property reference for "+c,filename:this.fileInfo().filename,index:this.getIndex()};if(this.evaluating=!0,b=this.find(a.frames,function(b){var f,g=b.property(c);if(g){for(var h=0;hd){if(!c||c(g)){e=g.find(new i(a.elements.slice(d)),b,c);for(var j=0;j0&&b.add(k),a.firstSelector=!0,h[0].genCSS(a,b),a.firstSelector=!1,d=1;d0?(e=p.copyArray(a),f=e.pop(),g=d.createDerived(p.copyArray(f.elements))):g=d.createDerived([]),b.length>0){var h=c.combinator,i=b[0].elements[0];h.emptyOrWhitespace&&!i.combinator.emptyOrWhitespace&&(h=i.combinator),g.elements.push(new j(h,i.value,c._index,c._fileInfo)),g.elements=g.elements.concat(b[0].elements.slice(1))}if(0!==g.elements.length&&e.push(g),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function g(a,b,c,d,e){var g;for(g=0;g0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new i(a))}}function l(a,b,c){function m(a){var b;return a.value instanceof h?(b=a.value.value,b instanceof i?b:null):null}var n,o,p,q,r,s,t,u,v,w,x=!1;for(q=[],r=[[]],n=0;u=c.elements[n];n++)if("&"!==u.value){var y=m(u);if(null!=y){k(q,r);var z,A=[],B=[];for(z=l(A,b,y),x=x||z,p=0;p0&&t[0].elements.push(new j(u.combinator,"",u._index,u._fileInfo)),s.push(t);else for(p=0;p0&&(a.push(r[n]),w=r[n][v-1],r[n][v-1]=w.createDerived(w.elements,c.extendList));return x}function m(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var n,o,q;if(o=[],q=l(o,b,c),!q)if(b.length>0)for(o=[],n=0;n0)for(b=0;b=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}},copyArray:function(a){var b,c=a.length,d=new Array(c);for(b=0;b=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.fileInfo(),b),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitDeclaration:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;e0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return k0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitAtRule:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitAtRuleOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=i},{"../logger":37,"../tree":66,"../utils":88,"./visitor":96}],90:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],91:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=a("../utils"),h=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};h.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,g.copyArray(this.context.frames)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.getIndex(),f.filename=a.fileInfo().filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;h0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];if(this.keepOnlyVisibleChilds(c),!this.isEmpty(c))return a.ensureVisibility(),a.removeVisibilityBlock(),a},isVisibleRuleset:function(a){return!!a.firstRoot||!this.isEmpty(a)&&!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitDeclaration:function(a,b){if(!a.blocksVisibility()&&!a.variable)return a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){if(!a.blocksVisibility()&&!a.isSilent(this._context))return a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){if(!a.blocksVisibility())return a},visitAtRule:function(a,b){return a.rules&&a.rules.length?this.visitAtRuleWithBody(a,b):this.visitAtRuleWithoutBody(a,b)},visitAnonymous:function(a,b){if(!a.blocksVisibility())return a.accept(this._visitor),a},visitAtRuleWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitAtRuleWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;c0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;b=0;e--)if(c=a[e],c instanceof d.Declaration)if(f[c.name]){b=f[c.name],b instanceof d.Declaration&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);b.indexOf(g)!==-1?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b={},c=[],e=0;e0){var b=a[0],c=[],e=[new d.Expression(c)];a.forEach(function(a){"+"===a.merge&&c.length>0&&e.push(new d.Expression(c=[])),c.push(a.value),b.important=b.important||a.important}),b.value=new d.Value(e)}})}}},b.exports=g},{"../tree":66,"./visitor":96}],96:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitFnCache=[],h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var c,e=this._visitFnCache,f=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=g;if(l.visitDeeper=!0,j||(c="visit"+a.type,j=f[c]||d,k=f[c+"Out"]||d,e[h]=j,e[i]=k),j!==d){var m=j.call(f,a,l);f.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=d&&k.call(f,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;ck){for(var b=0,c=h.length-j;bi.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(b[c].value)&&Array.prototype.push.apply(b,Array.prototype.slice.call(b[c].value));return 1==m.length?m[0]:(b=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new e((a?"min":"max")+"("+b+")"))};f.addMultiple({min:function(){return h(!0,arguments)},max:function(){return h(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new d(Math.PI)},mod:function(a,b){return new d(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d(a),b=new d(b);else if(!(a instanceof d&&b instanceof d))throw{type:"Argument",message:"arguments must be numbers"};return new d(Math.pow(a.value,b.value),a.unit)},percentage:function(a){var b=g._math(function(a){return 100*a},"%",a);return b}})},{"../tree/anonymous":48,"../tree/dimension":60,"./function-registry":26,"./math-helper.js":28}],31:[function(a,b,c){var d=a("../tree/quoted"),e=a("../tree/anonymous"),f=a("../tree/javascript"),g=a("./function-registry");g.addMultiple({e:function(a){return new e(a instanceof f?a.evaluated:a.value)},escape:function(a){return new e(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,b,c,e){var f=a.value;return c="Quoted"===c.type?c.value:c.toCSS(),f=f.replace(new RegExp(b.value,e?e.value:""),c),new d(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;e",k=0;k";return j+="',j=encodeURIComponent(j),j="data:image/svg+xml,"+j,new g(new f("'"+j+"'",j,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":53,"../tree/dimension":60,"../tree/expression":63,"../tree/quoted":78,"../tree/url":84,"./function-registry":26}],33:[function(a,b,c){var d=a("../tree/keyword"),e=a("../tree/detached-ruleset"),f=a("../tree/dimension"),g=a("../tree/color"),h=a("../tree/quoted"),i=a("../tree/anonymous"),j=a("../tree/url"),k=a("../tree/operation"),l=a("./function-registry"),m=function(a,b){return a instanceof b?d.True:d.False},n=function(a,b){if(void 0===b)throw{type:"Argument",message:"missing the required second argument to isunit."};if(b="string"==typeof b.value?b.value:b,"string"!=typeof b)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof f&&a.unit.is(b)?d.True:d.False},o=function(a){var b=Array.isArray(a.value)?a.value:Array(a);return b};l.addMultiple({isruleset:function(a){return m(a,e)},iscolor:function(a){return m(a,g)},isnumber:function(a){return m(a,f)},isstring:function(a){return m(a,h)},iskeyword:function(a){return m(a,d)},isurl:function(a){return m(a,j)},ispixel:function(a){return n(a,"px")},ispercentage:function(a){return n(a,"%")},isem:function(a){return n(a,"em")},isunit:n,unit:function(a,b){if(!(a instanceof f))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof k?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d?b.value:b.toCSS():"",new f(a.value,b)},"get-unit":function(a){return new i(a.unit)},extract:function(a,b){return b=b.value-1,o(a)[b]},length:function(a){return new f(o(a).length)}})},{"../tree/anonymous":48,"../tree/color":53,"../tree/detached-ruleset":59,"../tree/dimension":60,"../tree/keyword":69,"../tree/operation":75,"../tree/quoted":78,"../tree/url":84,"./function-registry":26}],34:[function(a,b,c){var d=a("./contexts"),e=a("./parser/parser"),f=a("./less-error"),g=a("./utils");"undefined"==typeof Promise?a("promise"):Promise;b.exports=function(a){var b=function(a,b,c){this.less=a,this.rootFilename=c.filename,this.paths=b.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=b.mime,this.error=null,this.context=b,this.queue=[],this.files={}};return b.prototype.push=function(b,c,h,i,j){var k=this,l=this.context.pluginManager.Loader;this.queue.push(b);var m=function(a,c,d){k.queue.splice(k.queue.indexOf(b),1);var e=d===k.rootFilename;i.optional&&a?j(null,{rules:[]},!1,null):(k.files[d]||(k.files[d]={root:c,options:i}),a&&!k.error&&(k.error=a),j(a,c,e,d))},n={relativeUrls:this.context.relativeUrls,entryPath:h.entryPath,rootpath:h.rootpath,rootFilename:h.rootFilename},o=a.getFileManager(b,h.currentDirectory,this.context,a);if(!o)return void m({message:"Could not find a file-manager for "+b});var p,q=function(a){var b,c=a.filename,g=a.contents.replace(/^\uFEFF/,"");n.currentDirectory=o.getPath(c),n.relativeUrls&&(n.rootpath=o.join(k.context.rootpath||"",o.pathDiff(n.currentDirectory,n.entryPath)),!o.isPathAbsolute(n.rootpath)&&o.alwaysMakePathsAbsolute()&&(n.rootpath=o.join(n.entryPath,n.rootpath))),n.filename=c;var j=new d.Parse(k.context);j.processImports=!1,k.contents[c]=g,(h.reference||i.reference)&&(n.reference=!0),i.isPlugin?(b=l.evalPlugin(g,j,k,i.pluginArgs,n),b instanceof f?m(b,null,c):m(null,b,c)):i.inline?m(null,g,c):!k.files[c]||k.files[c].options.multiple||i.multiple?new e(j,k,n).parse(g,function(a,b){m(a,b,c)}):m(null,k.files[c].root,c)},r=g.clone(this.context);c&&(r.ext=i.isPlugin?".js":".less"),p=i.isPlugin?l.loadPlugin(b,h.currentDirectory,r,a,o):o.loadFile(b,h.currentDirectory,r,a,function(a,b){a?m(a):q(b)}),p&&p.then(q,m)},b}},{"./contexts":12,"./less-error":36,"./parser/parser":42,"./utils":88,promise:void 0}],35:[function(a,b,c){b.exports=function(b,c){var d,e,f,g,h,i,j={version:[3,0,0],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),AbstractPluginLoader:a("./environment/abstract-plugin-loader"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")},k=function(a){return function(){var b=Object.create(a.prototype);return a.apply(b,Array.prototype.slice.call(arguments,0)),b}},l=Object.create(j);for(var m in j.tree)if(i=j.tree[m],"function"==typeof i)l[m.toLowerCase()]=k(i);else{l[m]=Object.create(null);for(var n in i)l[m][n.toLowerCase()]=k(i[n])}return l}},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":17,"./environment/abstract-plugin-loader":18,"./environment/environment":19,"./functions":27,"./import-manager":34,"./less-error":36,"./logger":37,"./parse":39,"./parse-tree":38,"./parser/parser":42,"./plugin-manager":43,"./render":44,"./source-map-builder":45,"./source-map-output":46,"./transform-tree":47,"./tree":66,"./utils":88,"./visitors":92}],36:[function(a,b,c){var d=a("./utils"),e=b.exports=function(a,b,c){Error.call(this);var e=a.filename||c;if(this.message=a.message,this.stack=a.stack,b&&e){var f=b.contents[e],g=d.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&d.getLocation(a.call,f).line,k=f.split("\n");if(this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.column=i,!this.line&&this.stack){var l=this.stack.match(/(|Function):(\d+):(\d+)/);l&&(l[2]&&(this.line=parseInt(l[2])-2),l[3]&&(this.column=parseInt(l[3])))}this.callLine=j+1,this.callExtract=k[j],this.extract=[k[this.line-2],k[this.line-1],k[this.line]]}};if("undefined"==typeof Object.create){var f=function(){};f.prototype=Error.prototype,e.prototype=new f}else e.prototype=Object.create(Error.prototype);e.prototype.constructor=e,e.prototype.toString=function(a){a=a||{};var b="",c=this.extract||[],d=[],e=function(a){return a};if(a.stylize){var f=typeof a.stylize;if("function"!==f)throw Error("options.stylize should be a function, got a "+f+"!");e=a.stylize}if(null!==this.line){if("string"==typeof c[0]&&d.push(e(this.line-1+" "+c[0],"grey")),"string"==typeof c[1]){var g=this.line+" ";c[1]&&(g+=c[1].slice(0,this.column)+e(e(e(c[1].substr(this.column,1),"bold")+c[1].slice(this.column+1),"red"),"inverse")),d.push(g)}"string"==typeof c[2]&&d.push(e(this.line+1+" "+c[2],"grey")),d=d.join("\n")+e("","reset")+"\n"}return b+=e(this.type+"Error: "+this.message,"red"),this.filename&&(b+=e(" in ","red")+this.filename),this.line&&(b+=e(" on line "+this.line+", column "+(this.column+1)+":","grey")),b+="\n"+d,this.callLine&&(b+=e("from ","red")+(this.filename||"")+"/n",b+=e(this.callLine,"grey")+" "+this.callExtract+"/n"),b}},{"./utils":88}],37:[function(a,b,c){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;b=97&&j<=122||j<34))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(h96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;hd&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],41:[function(a,b,c){var d=a("./chunker");b.exports=function(){function a(d){for(var e,f,j,p=k.i,q=c,s=k.i-i,t=k.i+h.length-s,u=k.i+=d,v=b;k.i=0){j={index:k.i,text:v.substr(k.i,x+2-k.i),isLineComment:!1},k.i+=j.text.length-1,k.commentStore.push(j);continue}}break}if(e!==l&&e!==n&&e!==m&&e!==o)break}if(h=h.slice(d+k.i-u+s),i=k.i,!h.length){if(ce||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,c=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$re=function(b){k.i>i&&(h=h.slice(k.i-i),i=k.i);var c=b.exec(h);return c?(a(c[0].length),"string"==typeof c?c:1===c.length?c[0]:c):null},k.$char=function(c){return b.charAt(k.i)!==c?null:(a(1),c)},k.$str=function(c){for(var d=c.length,e=0;es||a=b.length;return k.i=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":40}],42:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=a("../functions/function-registry"),j=function k(a,b,c){function j(a,e){throw new d({index:q.i,filename:c.filename,type:e||"Syntax",message:a},b)}function l(a,b,c){var d=a instanceof Function?a.call(p):q.$re(a);return d?d:void j(b||("string"==typeof a?"expected '"+a+"' got '"+q.currentChar()+"'":"unexpected token"))}function m(a,b){return q.$char(a)?a:void j(b||"expected '"+a+"' got '"+q.currentChar()+"'")}function n(a){var b=c.filename;return{lineNumber:h.getLocation(a,q.getInput()).line+1,fileName:b}}function o(a,c,e,f,g){var h,i=[],j=q;try{j.start(a,!1,function(a,b){g({message:a,index:b+e})});for(var k,l,m=0;k=c[m];m++)l=j.i,h=p[k](),h?(h._index=l+e,h._fileInfo=f,i.push(h)):i.push(null);var n=j.end();n.isFinished?g(null,i):g(!0,null)}catch(o){throw new d({index:o.index+e,message:o.message},b,f.filename)}}var p,q=g();return{parserInput:q,imports:b,fileInfo:c,parseNode:o,parse:function(g,h,j){var l,m,n,o,p=null,r="";if(m=j&&j.globalVars?k.serializeVars(j.globalVars)+"\n":"",n=j&&j.modifyVars?"\n"+k.serializeVars(j.modifyVars):"",a.pluginManager)for(var s=a.pluginManager.getPreProcessors(),t=0;t")}return b&&(q.$char("(")&&(h=this.args(!0).args,m(")")),p.important()&&(j=!0),p.end())?(q.forget(),new e.mixin.Call(b,h,k,c,j)):void q.restore()}},args:function(a){var b,c,d,f,g,h,i,k=p.entities,l={args:null,variadic:!1},m=[],n=[],o=[];for(q.save();;){if(a)h=p.detachedRuleset()||p.expression();else{if(q.commentStore.length=0,q.$str("...")){l.variadic=!0,q.$char(";")&&!b&&(b=!0),(b?n:o).push({variadic:!0});break}h=k.variable()||k.property()||k.literal()||k.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var r=null;if(a?h.value&&1==h.value.length&&(r=h.value[0]):r=h,r&&(r instanceof e.Variable||r instanceof e.Property))if(q.$char(":")){if(m.length>0&&(b&&j("Cannot mix ; and , as delimiter types"),c=!0),g=p.detachedRuleset()||p.expression(),!g){if(!a)return q.restore(),l.args=[],l;j("could not understand value for named argument")}f=d=r.name}else if(q.$str("...")){if(!a){l.variadic=!0,q.$char(";")&&!b&&(b=!0),(b?n:o).push({name:h.name,variadic:!0});break}i=!0}else a||(d=f=r.name,g=null);g&&m.push(g),o.push({name:f,value:g,expand:i}),q.$char(",")||(q.$char(";")||b)&&(c&&j("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),n.push({name:d,value:g,expand:i}),d=null,m=[],c=!1)}return q.forget(),l.args=b?n:o,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==q.currentChar()&&"#"!==q.currentChar()||q.peek(/^[^{]*\}/)))if(q.save(),b=q.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!q.$char(")"))return void q.restore("Missing closing ')'");if(q.commentStore.length=0,q.$str("when")&&(d=l(p.conditions,"expected condition")),c=p.block())return q.forget(),new e.mixin.Definition(a,f,c,d,g);q.restore()}else q.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.property()||a.call()||a.keyword()||a.javascript()},end:function(){return q.$char(";")||q.peek("}")},ieAlpha:function(){var a;if(q.$re(/^opacity=/i))return a=q.$re(/^\d+/),a||(a=l(p.entities.variable,"Could not parse alpha"),a="@{"+a.name.slice(1)+"}"),m(")"),new e.Quoted("","alpha(opacity="+a+")")},element:function(){var a,b,d,f=q.i;if(b=this.combinator(),a=q.$re(/^(?:\d+\.\d+|\d+)%/)||q.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||q.$char("*")||q.$char("&")||this.attribute()||q.$re(/^\([^&()@]+\)/)||q.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(q.save(),q.$char("(")?(d=this.selector(!1))&&q.$char(")")?(a=new e.Paren(d),q.forget()):q.restore("Missing closing ')'"):q.forget()),a)return new e.Element(b,a,f,c)},combinator:function(){var a=q.currentChar();if("/"===a){q.save();var b=q.$re(/^\/[a-z]+\//i);if(b)return q.forget(),new e.Combinator(b);q.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(q.i++,"^"===a&&"^"===q.currentChar()&&(a="^^",q.i++);q.isWhitespace();)q.i++;return new e.Combinator(a)}return new e.Combinator(q.isWhitespace(-1)?" ":null)},selector:function(a){var b,d,f,g,h,i,k,m=q.i;for(a=a!==!1;(a&&(d=this.extend())||a&&(i=q.$str("when"))||(g=this.element()))&&(i?k=l(this.conditions,"expected condition"):k?j("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&j("Extend can only be used at the end of selector"),f=q.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,k,m,c):void(h&&j("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(q.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=l(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=q.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||q.$re(/^[0-9]+%/)||q.$re(/^[\w-]+/)||d.variableCurly()),m("]"),new e.Attribute(a,c,b)}},block:function(){var a;if(q.$char("{")&&(a=this.primary())&&q.$char("}"))return a},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();if(a)return new e.DetachedRuleset(a)},ruleset:function(){var b,c,d,f;for(q.save(),a.dumpLineNumbers&&(f=n(q.i));;){if(c=this.selector(),!c)break;if(b?b.push(c):b=[c],q.commentStore.length=0,c.condition&&b.length>1&&j("Guards are only currently allowed on a single selector."),!q.$char(","))break;c.condition&&j("Guards are only currently allowed on a single selector."),q.commentStore.length=0}if(b&&(d=this.block())){q.forget();var g=new e.Ruleset(b,d,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}q.restore()},declaration:function(){var a,b,d,f,g,h=q.i,i=q.currentChar();if("."!==i&&"#"!==i&&"&"!==i&&":"!==i)if(q.save(),a=this.variable()||this.ruleProperty()){if(g="string"==typeof a,g&&(b=this.detachedRuleset()),q.commentStore.length=0,!b){if(f=!g&&a.length>1&&a.pop().value,b=this.anonymousValue())return q.forget(),new e.Declaration(a,b,(!1),f,h,c);b||(b=this.value()),d=this.important()}if(b&&this.end())return q.forget(),new e.Declaration(a,b,d,f,h,c);q.restore()}else q.restore()},anonymousValue:function(){var a=q.i,b=q.$re(/^([^@\$+\/'"*`(;{}-]*);/);if(b)return new e.Anonymous(b[1],a)},"import":function(){var a,b,d=q.i,f=q.$re(/^@import?\s+/);if(f){var g=(f?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),q.$char(";")||(q.i=d,j("missing semi-colon or unrecognised media features on import")),b=b&&new e.Value(b),new e.Import(a,b,g,d,c);q.i=d,j("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!q.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!q.$char(","))break}while(a);return m(")"),d},importOption:function(){var a=q.$re(/^(less|css|multiple|once|inline|reference|optional)/);if(a)return a[1]},mediaFeature:function(){var a,b,d=this.entities,f=[];q.save();do a=d.keyword()||d.variable(),a?f.push(a):q.$char("(")&&(b=this.property(),a=this.value(),q.$char(")")?b&&a?f.push(new e.Paren(new e.Declaration(b,a,null,null,q.i,c,(!0)))):a?f.push(new e.Paren(a)):j("badly formed media feature definition"):j("Missing closing ')'","Parse"));while(a);if(q.forget(),f.length>0)return new e.Expression(f)},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!q.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!q.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=q.i;return a.dumpLineNumbers&&(g=n(h)),q.save(),q.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||j("media definitions require block statements after any features"),q.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void q.restore()},plugin:function(){var a,b,d,f=q.i,g=q.$re(/^@plugin?\s+/);if(g){ +if(b=this.pluginArgs(),d=b?{pluginArgs:b,isPlugin:!0}:{isPlugin:!0},a=this.entities.quoted()||this.entities.url())return q.$char(";")||(q.i=f,j("missing semi-colon on @plugin")),new e.Import(a,null,d,f,c);q.i=f,j("malformed @plugin statement")}},pluginArgs:function(){if(q.save(),!q.$char("("))return q.restore(),null;var a=q.$re(/^\s*([^\);]+)\)\s*/);return a[1]?(q.forget(),a[1].trim()):(q.restore(),null)},atrule:function(){var b,d,f,g,h,i,k,l=q.i,m=!0,o=!0;if("@"===q.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(q.save(),b=q.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,m=!1;break;case"@namespace":i=!0,m=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,o=!1;break;default:k=!0}return q.commentStore.length=0,h?(d=this.entity(),d||j("expected "+b+" identifier")):i?(d=this.expression(),d||j("expected "+b+" expression")):k&&(d=(q.$re(/^[^{;]+/)||"").trim(),m="{"==q.currentChar(),d&&(d=new e.Anonymous(d))),m&&(f=this.blockRuleset()),f||!m&&d&&q.$char(";")?(q.forget(),new e.AtRule(b,d,f,l,c,a.dumpLineNumbers?n(l):null,o)):void q.restore("at-rule options not recognised")}}},value:function(){var a,b=[],c=q.i;do if(a=this.expression(),a&&(b.push(a),!q.$char(",")))break;while(a);if(b.length>0)return new e.Value(b,c)},important:function(){if("!"===q.currentChar())return q.$re(/^! *important/)},sub:function(){var a,b;return q.save(),q.$char("(")?(a=this.addition(),a&&q.$char(")")?(q.forget(),b=new e.Expression([a]),b.parens=!0,b):void q.restore("Expected ')'")):void q.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=q.isWhitespace(-1);;){if(q.peek(/^\/[*\/]/))break;if(q.save(),c=q.$char("/")||q.$char("*"),!c){q.forget();break}if(b=this.operand(),!b){q.restore();break}q.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=q.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=q.isWhitespace(-1);;){if(c=q.$re(/^[-+]\s+/)||!f&&(q.$char("+")||q.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=q.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=q.i;if(a=this.condition()){for(;;){if(!q.peek(/^,\s*(not\s*)?\(/)||!q.$char(","))break;if(b=this.condition(),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(){function a(){return q.$str("or")}var b,c,d;if(b=this.conditionAnd(this)){if(c=a()){if(d=this.condition(),!d)return;b=new e.Condition(c,b,d)}return b}},conditionAnd:function(){function a(a){return a.negatedCondition()||a.parenthesisCondition()}function b(){return q.$str("and")}var c,d,f;if(c=a(this)){if(d=b()){if(f=this.conditionAnd(),!f)return;c=new e.Condition(d,c,f)}return c}},negatedCondition:function(){if(q.$str("not")){var a=this.parenthesisCondition();return a&&(a.negate=!a.negate),a}},parenthesisCondition:function(){function a(a){var b;return q.save(),(b=a.condition())&&q.$char(")")?(q.forget(),b):void q.restore()}var b;return q.save(),q.$str("(")?(b=a(this))?(q.forget(),b):(b=this.atomicCondition())?q.$char(")")?(q.forget(),b):void q.restore("expected ')' got '"+q.currentChar()+"'"):void q.restore():void q.restore()},atomicCondition:function(){var a,b,c,d,f=this.entities,g=q.i;if(a=this.addition()||f.keyword()||f.quoted())return q.$char(">")?d=q.$char("=")?">=":">":q.$char("<")?d=q.$char("=")?"<=":"<":q.$char("=")&&(d=q.$char(">")?"=>":q.$char("<")?"=<":"="),d?(b=this.addition()||f.keyword()||f.quoted(),b?c=new e.Condition(d,a,b,g,(!1)):j("expected expression")):c=new e.Condition("=",a,new e.Keyword("true"),g,(!1)),c},operand:function(){var a,b=this.entities;q.peek(/^-[@\$\(]/)&&(a=q.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.property()||b.call()||b.colorKeyword();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[],d=q.i;do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),q.peek(/^\/[\/*]/)||(b=q.$char("/"),b&&c.push(new e.Anonymous(b,d)))));while(a);if(c.length>0)return new e.Expression(c)},property:function(){var a=q.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(a)return a[1]},ruleProperty:function(){function a(a){var b=q.i,c=q.$re(a);if(c)return g.push(b),f.push(c[1])}var b,d,f=[],g=[];q.save();var h=q.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],q.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(q.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;d=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},g.prototype.addPostProcessor=function(a,b){var c;for(c=0;c=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},g.prototype.addFileManager=function(a){this.fileManagers.push(a)},g.prototype.getPreProcessors=function(){for(var a=[],b=0;b0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],47:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Declaration("@"+a,b,(!1),null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j,k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor((!0)),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager)for(j=b.pluginManager.visitor(),j.first();i=j.get();)i.isPreEvalVisitor&&i.run(a);c=a.eval(h);for(var l=0;l.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(d="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":74}],57:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],58:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;c-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&c<1&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":15,"./color":53,"./node":74,"./unit":83}],61:[function(a,b,c){var d=a("./atrule"),e=function(){var a=Array.prototype.slice.call(arguments);d.apply(this,a)};e.prototype=Object.create(d.prototype),e.prototype.constructor=e,b.exports=e},{"./atrule":50}],62:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./combinator"),g=function(a,b,c,d,e){this.combinator=a instanceof f?a:new f(a),this.value="string"==typeof b?b.trim():b?b:"",this._index=c,this._fileInfo=d,this.copyVisibilityInfo(e),this.setParent(this.combinator,this)};g.prototype=new d,g.prototype.type="Element",g.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},g.prototype.eval=function(a){return new g(this.combinator,this.value.eval?this.value.eval(a):this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.fileInfo(),this.getIndex())},g.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof e&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=g},{"./combinator":54,"./node":74,"./paren":76}],63:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./comment"),g=function(a){if(this.value=a,!a)throw new Error("Expression requires an array parameter")};g.prototype=new d,g.prototype.type="Expression",g.prototype.accept=function(a){this.value=a.visitArray(this.value)},g.prototype.eval=function(a){var b,c=this.parens&&!this.parensInOp,d=!1;return c&&a.inParenthesis(),this.value.length>1?b=new g(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(d=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!d&&(b=new e(b)),b},g.prototype.genCSS=function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":74,"./selector":81}],65:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=a("../utils"),k=a("../less-error"),l=function(a,b,c,d,e,f){if(this.options=c,this._index=d,this._fileInfo=e,this.path=a,this.features=b,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f),this.setParent(this.features,this),this.setParent(this.path,this)};l.prototype=new d,l.prototype.type="Import",l.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.isPlugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},l.prototype.genCSS=function(a,b){this.css&&void 0===this.path._fileInfo.reference&&(b.add("@import ",this._fileInfo,this._index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},l.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},l.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),!(a instanceof g)||a.containsVariables()},l.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new l(b.eval(a),this.features,this.options,this._index,this._fileInfo,this.visibilityInfo()); +},l.prototype.evalPath=function(a){var b=this.path.eval(a),c=this._fileInfo&&this._fileInfo.rootpath;if(!(b instanceof f)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d)}b.value=a.normalizePath(b.value)}return b},l.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){a.addVisibilityBlock()}):b.addVisibilityBlock()),b},l.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a);if(this.options.isPlugin){if(this.root&&this.root.eval)try{this.root.eval(a)}catch(f){throw f.message="Plugin error during evaluation",new k(f,this.root.imports,this.root.filename)}return c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[]}if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var g=new i(this.root,0,{filename:this.importedFilename,reference:this.path._fileInfo&&this.path._fileInfo.reference},(!0),(!0));return this.features?new e([g],this.features.value):[g]}if(this.css){var m=new l(this.evalPath(a),d,this.options,this._index);if(!m.css&&this.error)throw this.error;return m}return b=new h(null,j.copyArray(this.root.rules)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=l},{"../less-error":36,"../utils":88,"./anonymous":48,"./media":70,"./node":74,"./quoted":78,"./ruleset":80,"./url":84}],66:[function(a,b,c){var d=Object.create(null);d.Node=a("./node"),d.Color=a("./color"),d.AtRule=a("./atrule"),d.Directive=a("./directive"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Property=a("./property"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Declaration=a("./declaration"),d.Rule=a("./rule"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.VariableCall=a("./variable-call"),b.exports=d},{"./anonymous":48,"./assignment":49,"./atrule":50,"./attribute":51,"./call":52,"./color":53,"./combinator":54,"./comment":55,"./condition":56,"./declaration":58,"./detached-ruleset":59,"./dimension":60,"./directive":61,"./element":62,"./expression":63,"./extend":64,"./import":65,"./javascript":67,"./keyword":69,"./media":70,"./mixin-call":71,"./mixin-definition":72,"./negative":73,"./node":74,"./operation":75,"./paren":76,"./property":77,"./quoted":78,"./rule":79,"./ruleset":80,"./selector":81,"./unicode-descriptor":82,"./unit":83,"./url":84,"./value":85,"./variable":87,"./variable-call":86}],67:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this._index=c,this._fileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new e(b):"string"==typeof b?new f('"'+b+'"',b,this.escaped,this._index):new g(Array.isArray(b)?b.join(", "):b)},b.exports=h},{"./anonymous":48,"./dimension":60,"./js-eval-node":68,"./quoted":78}],68:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(!b.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.fileInfo().filename,index:this.getIndex()};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.getIndex(),d.fileInfo()).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.fileInfo().filename,index:this.getIndex()}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.fileInfo().filename,index:this.getIndex()}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":74,"./variable":87}],69:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":74}],70:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./atrule"),j=a("../utils"),k=function(a,b,c,g,h){this._index=c,this._fileInfo=g;var i=new f([],null,null,this._index,this._fileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0,this.setParent(i,this),this.setParent(this.features,this),this.setParent(this.rules,this)};k.prototype=new i,k.prototype.type="Media",k.prototype.isRulesetLike=function(){return!0},k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},k.prototype.genCSS=function(a,b){b.add("@media ",this._fileInfo,this._index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},k.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new k(null,[],this._index,this._fileInfo,this.visibilityInfo());return this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo),b.features=this.features.eval(a),a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},k.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo()),this.setParent(b,this)}return delete a.mediaBlocks,delete a.mediaPath,b},k.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;b0;b--)a.splice(b,0,new g("and"));return new h(a)})),this.setParent(this.features,this),new d([],[])},k.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(n=!0,k=0;k0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.getIndex(),filename:this.fileInfo().filename};for(k=0;kthis.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;gb?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],75:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};g.prototype=new d,g.prototype.type="Operation",g.prototype.accept=function(a){this.operands=a.visit(this.operands)},g.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof f&&c instanceof e&&(b=b.toColor()),c instanceof f&&b instanceof e&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new g(this.op,[b,c],this.isSpaced)},g.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=g},{"./color":53,"./dimension":60,"./node":74}],76:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":74}],77:[function(a,b,c){var d=a("./node"),e=a("./declaration"),f=function(a,b,c){this.name=a,this._index=b,this._fileInfo=c};f.prototype=new d,f.prototype.type="Property",f.prototype.eval=function(a){var b,c=this.name,d=a.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;if(this.evaluating)throw{type:"Name",message:"Recursive property reference for "+c,filename:this.fileInfo().filename,index:this.getIndex()};if(this.evaluating=!0,b=this.find(a.frames,function(b){var f,g=b.property(c);if(g){for(var h=0;hd){if(!c||c(g)){e=g.find(new i(a.elements.slice(d)),b,c);for(var j=0;j0&&b.add(k),a.firstSelector=!0,h[0].genCSS(a,b),a.firstSelector=!1,d=1;d0?(e=p.copyArray(a),f=e.pop(),g=d.createDerived(p.copyArray(f.elements))):g=d.createDerived([]),b.length>0){var h=c.combinator,i=b[0].elements[0];h.emptyOrWhitespace&&!i.combinator.emptyOrWhitespace&&(h=i.combinator),g.elements.push(new j(h,i.value,c._index,c._fileInfo)),g.elements=g.elements.concat(b[0].elements.slice(1))}if(0!==g.elements.length&&e.push(g),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function g(a,b,c,d,e){var g;for(g=0;g0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new i(a))}}function l(a,b,c){function m(a){var b;return a.value instanceof h?(b=a.value.value,b instanceof i?b:null):null}var n,o,p,q,r,s,t,u,v,w,x=!1;for(q=[],r=[[]],n=0;u=c.elements[n];n++)if("&"!==u.value){var y=m(u);if(null!=y){k(q,r);var z,A=[],B=[];for(z=l(A,b,y),x=x||z,p=0;p0&&t[0].elements.push(new j(u.combinator,"",u._index,u._fileInfo)),s.push(t);else for(p=0;p0&&(a.push(r[n]),w=r[n][v-1],r[n][v-1]=w.createDerived(w.elements,c.extendList));return x}function m(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var n,o,q;if(o=[],q=l(o,b,c),!q)if(b.length>0)for(o=[],n=0;n0)for(b=0;b=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}},copyArray:function(a){var b,c=a.length,d=new Array(c);for(b=0;b=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.fileInfo(),b),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitDeclaration:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;e0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return k0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitAtRule:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitAtRuleOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=i},{"../logger":37,"../tree":66,"../utils":88,"./visitor":96}],90:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],91:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=a("../utils"),h=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};h.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,g.copyArray(this.context.frames)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.getIndex(),f.filename=a.fileInfo().filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;h0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];if(this.keepOnlyVisibleChilds(c),!this.isEmpty(c))return a.ensureVisibility(),a.removeVisibilityBlock(),a},isVisibleRuleset:function(a){return!!a.firstRoot||!this.isEmpty(a)&&!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitDeclaration:function(a,b){if(!a.blocksVisibility()&&!a.variable)return a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){if(!a.blocksVisibility()&&!a.isSilent(this._context))return a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){if(!a.blocksVisibility())return a},visitAtRule:function(a,b){return a.rules&&a.rules.length?this.visitAtRuleWithBody(a,b):this.visitAtRuleWithoutBody(a,b)},visitAnonymous:function(a,b){if(!a.blocksVisibility())return a.accept(this._visitor),a},visitAtRuleWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitAtRuleWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;c0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;b=0;e--)if(c=a[e],c instanceof d.Declaration)if(f[c.name]){b=f[c.name],b instanceof d.Declaration&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);b.indexOf(g)!==-1?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b={},c=[],e=0;e0){var b=a[0],c=[],e=[new d.Expression(c)];a.forEach(function(a){"+"===a.merge&&c.length>0&&e.push(new d.Expression(c=[])),c.push(a.value),b.important=b.important||a.important}),b.value=new d.Value(e)}})}}},b.exports=g},{"../tree":66,"./visitor":96}],96:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitFnCache=[],h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var c,e=this._visitFnCache,f=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=g;if(l.visitDeeper=!0,j||(c="visit"+a.type,j=f[c]||d,k=f[c+"Out"]||d,e[h]=j,e[i]=k),j!==d){var m=j.call(f,a,l);f.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=d&&k.call(f,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;ck){for(var b=0,c=h.length-j;b Date: Sun, 4 Feb 2018 10:17:21 -0800 Subject: [PATCH 94/97] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 901463abf..d99eefb46 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -### This is the Less 3.0 Alpha branch (non-production ready). For the stable branch of Less, go [here](https://github.com/less/less.js/tree/master). +### This is the Less 3.0 Edge branch. For the stable (2.x) branch of Less, go [here](https://github.com/less/less.js/tree/master). [![npm version](https://badge.fury.io/js/less.svg)](http://badge.fury.io/js/less) [![Build Status](https://travis-ci.org/less/less.js.svg?branch=master)](https://travis-ci.org/less/less.js) [![Build status](https://ci.appveyor.com/api/projects/status/bx2qspy3qbuxpl9q/branch/3.x?svg=true)](https://ci.appveyor.com/project/lukeapage/less-js/branch/3.x) [![Dependencies](https://david-dm.org/less/less.js.svg)](https://david-dm.org/less/less.js) [![devDependency Status](https://david-dm.org/less/less.js/dev-status.svg)](https://david-dm.org/less/less.js#info=devDependencies) [![optionalDependency Status](https://david-dm.org/less/less.js/optional-status.svg)](https://david-dm.org/less/less.js#info=optionalDependencies) [![Twitter Follow](https://img.shields.io/twitter/follow/lesstocss.svg?style=flat-square)](https://twitter.com/lesstocss) [![Join the chat at https://gitter.im/less/less.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/less/less.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) Chat with Less.js users From 2a4a63afc8e3468ddb5f85012c625297284689dd Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Sun, 4 Feb 2018 10:41:51 -0800 Subject: [PATCH 95/97] Update CHANGELOG.md with 3.x list --- CHANGELOG.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f7cf17a3..e432ffd67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,29 @@ +# 3.0.0 +2018-02-04 + - Rename Directive -> AtRule & Rule -> Declaration + - Cross-platform `@plugin` loading! (Node & Browser) + - Numerous changes / improvements to plugin architecture + - Simplified API calls in plugins (`less.atrule()` vs `new less.tree.AtRule()`) + - Property accessors (`$width` to refer to `width: 300px` value) + - Inline JavaScript disabled by default for security reasons (use `@plugin`) + - Improvements in Less error reporting + - Added feature: returning `null` / `false` from Less functions will remove that line + - Simple `boolean()` and `if()` functions added + - Bug fixes + - Removal of unnecessary nodes from API (like IE's `alpha()`) + +# 2.7.3 +2017-10-23 + + - Bump `request` dependency + +# 2.7.2 +2017-01-04 + + - Revert breaking changes to contrast() function + - Fix error reporting of lessc executable + - Changed octals to hex for ES6 strict mode + # 2.7.1 HOTFIX 2016-05-09 From 4508495adb6bce74304a64807ef0e6ecac310c0c Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Fri, 9 Feb 2018 19:40:39 -0800 Subject: [PATCH 96/97] Remove legacy upgrade - Add simple grid syntax support --- dist/less.js | 207 ++++++++++++---------------------- dist/less.min.js | 12 +- lib/less/parser/parser.js | 2 +- lib/less/plugin-manager.js | 22 ---- lib/less/tree/index.js | 4 - lib/less/utils.js | 13 --- package.json | 2 +- test/css/css-grid.css | 11 ++ test/less/css-grid.less | 15 +++ test/plugins/visitor/index.js | 2 +- 10 files changed, 106 insertions(+), 184 deletions(-) create mode 100644 test/css/css-grid.css create mode 100644 test/less/css-grid.less diff --git a/dist/less.js b/dist/less.js index cf580f488..78199d99e 100644 --- a/dist/less.js +++ b/dist/less.js @@ -1,5 +1,5 @@ /*! - * Less - Leaner CSS v3.0.0-RC.1 + * Less - Leaner CSS v3.0.0-RC.2 * http://lesscss.org * * Copyright (c) 2009-2018, Alexis Sellier @@ -129,7 +129,7 @@ if (options.onReady) { less.pageLoadFinished = less.refresh(less.env === 'development').then(resolveOrReject, resolveOrReject); } -},{"../less/default-options":16,"./add-default-options":1,"./index":8,"promise/polyfill":102}],3:[function(require,module,exports){ +},{"../less/default-options":16,"./add-default-options":1,"./index":8,"promise/polyfill":100}],3:[function(require,module,exports){ var utils = require("./utils"); module.exports = { createCSS: function (document, styles, sheet) { @@ -1651,7 +1651,7 @@ functionRegistry.addMultiple({ } }); -},{"../tree/anonymous":48,"../tree/keyword":69,"./function-registry":26}],21:[function(require,module,exports){ +},{"../tree/anonymous":48,"../tree/keyword":68,"./function-registry":26}],21:[function(require,module,exports){ var Color = require("../tree/color"), functionRegistry = require("./function-registry"); @@ -2089,7 +2089,7 @@ colorFunctions = { }; functionRegistry.addMultiple(colorFunctions); -},{"../tree/anonymous":48,"../tree/color":53,"../tree/dimension":60,"../tree/quoted":78,"./function-registry":26}],23:[function(require,module,exports){ +},{"../tree/anonymous":48,"../tree/color":53,"../tree/dimension":60,"../tree/quoted":77,"./function-registry":26}],23:[function(require,module,exports){ module.exports = function(environment) { var Quoted = require("../tree/quoted"), URL = require("../tree/url"), @@ -2179,7 +2179,7 @@ module.exports = function(environment) { }); }; -},{"../logger":37,"../tree/quoted":78,"../tree/url":84,"../utils":88,"./function-registry":26}],24:[function(require,module,exports){ +},{"../logger":37,"../tree/quoted":77,"../tree/url":82,"../utils":86,"./function-registry":26}],24:[function(require,module,exports){ var Keyword = require("../tree/keyword"), functionRegistry = require("./function-registry"); @@ -2208,7 +2208,7 @@ functionRegistry.add("default", defaultFunc.eval.bind(defaultFunc)); module.exports = defaultFunc; -},{"../tree/keyword":69,"./function-registry":26}],25:[function(require,module,exports){ +},{"../tree/keyword":68,"./function-registry":26}],25:[function(require,module,exports){ var Expression = require("../tree/expression"); var functionCaller = function(name, context, index, currentFileInfo) { @@ -2256,7 +2256,7 @@ functionCaller.prototype.call = function(args) { module.exports = functionCaller; -},{"../tree/expression":63}],26:[function(require,module,exports){ +},{"../tree/expression":62}],26:[function(require,module,exports){ function makeRegistry( base ) { return { _data: {}, @@ -2484,7 +2484,7 @@ functionRegistry.addMultiple({ } }); -},{"../tree/anonymous":48,"../tree/javascript":67,"../tree/quoted":78,"./function-registry":26}],32:[function(require,module,exports){ +},{"../tree/anonymous":48,"../tree/javascript":66,"../tree/quoted":77,"./function-registry":26}],32:[function(require,module,exports){ module.exports = function(environment) { var Dimension = require("../tree/dimension"), Color = require("../tree/color"), @@ -2574,7 +2574,7 @@ module.exports = function(environment) { }); }; -},{"../tree/color":53,"../tree/dimension":60,"../tree/expression":63,"../tree/quoted":78,"../tree/url":84,"./function-registry":26}],33:[function(require,module,exports){ +},{"../tree/color":53,"../tree/dimension":60,"../tree/expression":62,"../tree/quoted":77,"../tree/url":82,"./function-registry":26}],33:[function(require,module,exports){ var Keyword = require("../tree/keyword"), DetachedRuleset = require("../tree/detached-ruleset"), Dimension = require("../tree/dimension"), @@ -2665,7 +2665,7 @@ functionRegistry.addMultiple({ } }); -},{"../tree/anonymous":48,"../tree/color":53,"../tree/detached-ruleset":59,"../tree/dimension":60,"../tree/keyword":69,"../tree/operation":75,"../tree/quoted":78,"../tree/url":84,"./function-registry":26}],34:[function(require,module,exports){ +},{"../tree/anonymous":48,"../tree/color":53,"../tree/detached-ruleset":59,"../tree/dimension":60,"../tree/keyword":68,"../tree/operation":74,"../tree/quoted":77,"../tree/url":82,"./function-registry":26}],34:[function(require,module,exports){ var contexts = require("./contexts"), Parser = require('./parser/parser'), LessError = require('./less-error'), @@ -2829,7 +2829,7 @@ module.exports = function(environment) { return ImportManager; }; -},{"./contexts":12,"./less-error":36,"./parser/parser":42,"./utils":88,"promise":undefined}],35:[function(require,module,exports){ +},{"./contexts":12,"./less-error":36,"./parser/parser":42,"./utils":86,"promise":undefined}],35:[function(require,module,exports){ module.exports = function(environment, fileManagers) { var SourceMapOutput, SourceMapBuilder, ParseTree, ImportManager, Environment; @@ -2886,7 +2886,7 @@ module.exports = function(environment, fileManagers) { return api; }; -},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":17,"./environment/abstract-plugin-loader":18,"./environment/environment":19,"./functions":27,"./import-manager":34,"./less-error":36,"./logger":37,"./parse":39,"./parse-tree":38,"./parser/parser":42,"./plugin-manager":43,"./render":44,"./source-map-builder":45,"./source-map-output":46,"./transform-tree":47,"./tree":66,"./utils":88,"./visitors":92}],36:[function(require,module,exports){ +},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":17,"./environment/abstract-plugin-loader":18,"./environment/environment":19,"./functions":27,"./import-manager":34,"./less-error":36,"./logger":37,"./parse":39,"./parse-tree":38,"./parser/parser":42,"./plugin-manager":43,"./render":44,"./source-map-builder":45,"./source-map-output":46,"./transform-tree":47,"./tree":65,"./utils":86,"./visitors":90}],36:[function(require,module,exports){ var utils = require('./utils'); /** * This is a centralized class of any error that could be thrown internally (mostly by the parser). @@ -3029,7 +3029,7 @@ LessError.prototype.toString = function(options) { return message; }; -},{"./utils":88}],37:[function(require,module,exports){ +},{"./utils":86}],37:[function(require,module,exports){ module.exports = { error: function(msg) { this._fireEvent("error", msg); @@ -3220,7 +3220,7 @@ module.exports = function(environment, ParseTree, ImportManager) { return parse; }; -},{"./contexts":12,"./less-error":36,"./parser/parser":42,"./plugin-manager":43,"./utils":88,"promise":undefined}],40:[function(require,module,exports){ +},{"./contexts":12,"./less-error":36,"./parser/parser":42,"./plugin-manager":43,"./utils":86,"promise":undefined}],40:[function(require,module,exports){ // Split the input into chunks. module.exports = function (input, fail) { var len = input.length, level = 0, parenLevel = 0, @@ -3972,7 +3972,7 @@ var Parser = function Parser(context, imports, fileInfo) { // black border-collapse // keyword: function () { - var k = parserInput.$char("%") || parserInput.$re(/^[_A-Za-z-][_A-Za-z0-9-]*/); + var k = parserInput.$char("%") || parserInput.$re(/^\[?[_A-Za-z-][_A-Za-z0-9-]*\]?/); if (k) { return tree.Color.fromKeyword(k) || new(tree.Keyword)(k); } @@ -5596,8 +5596,7 @@ Parser.serializeVars = function(vars) { module.exports = Parser; -},{"../functions/function-registry":26,"../less-error":36,"../tree":66,"../utils":88,"../visitors":92,"./parser-input":41}],43:[function(require,module,exports){ -var utils = require('./utils'); +},{"../functions/function-registry":26,"../less-error":36,"../tree":65,"../utils":86,"../visitors":90,"./parser-input":41}],43:[function(require,module,exports){ /** * Plugin Manager */ @@ -5653,33 +5652,12 @@ PluginManager.prototype.get = function(filename) { return this.pluginCache[filename]; }; -/** - * Deprecate eventually - */ -function upgradeVisitors(visitor, oldType, newType) { - - if (visitor['visit' + oldType] && !visitor['visit' + newType]) { - visitor['visit' + newType] = visitor['visit' + oldType]; - } - if (visitor['visit' + oldType + 'Out'] && !visitor['visit' + newType + 'Out']) { - visitor['visit' + newType + 'Out'] = visitor['visit' + oldType + 'Out']; - } -} /** * Adds a visitor. The visitor object has options on itself to determine * when it should run. * @param visitor */ PluginManager.prototype.addVisitor = function(visitor) { - var proto; - // 2.x to 3.x visitor compatibility - try { - proto = utils.getPrototype(visitor); - upgradeVisitors(proto, 'Directive', 'AtRule'); - upgradeVisitors(proto, 'Rule', 'Declaration'); - } - catch (e) {} - this.visitors.push(visitor); }; /** @@ -5775,7 +5753,7 @@ PluginManager.prototype.getFileManagers = function() { // module.exports = PluginManagerFactory; -},{"./utils":88}],44:[function(require,module,exports){ +},{}],44:[function(require,module,exports){ var PromiseConstructor, utils = require('./utils'); @@ -5822,7 +5800,7 @@ module.exports = function(environment, ParseTree, ImportManager) { return render; }; -},{"./utils":88,"promise":undefined}],45:[function(require,module,exports){ +},{"./utils":86,"promise":undefined}],45:[function(require,module,exports){ module.exports = function (SourceMapOutput, environment) { var SourceMapBuilder = function (options) { @@ -6116,7 +6094,7 @@ module.exports = function(root, options) { return evaldRoot; }; -},{"./contexts":12,"./tree":66,"./visitors":92}],48:[function(require,module,exports){ +},{"./contexts":12,"./tree":65,"./visitors":90}],48:[function(require,module,exports){ var Node = require("./node"); var Anonymous = function (value, index, currentFileInfo, mapLines, rulesetLike, visibilityInfo) { @@ -6147,7 +6125,7 @@ Anonymous.prototype.genCSS = function (context, output) { }; module.exports = Anonymous; -},{"./node":74}],49:[function(require,module,exports){ +},{"./node":73}],49:[function(require,module,exports){ var Node = require("./node"); var Assignment = function (key, val) { @@ -6176,7 +6154,7 @@ Assignment.prototype.genCSS = function (context, output) { }; module.exports = Assignment; -},{"./node":74}],50:[function(require,module,exports){ +},{"./node":73}],50:[function(require,module,exports){ var Node = require("./node"), Selector = require("./selector"), Ruleset = require("./ruleset"), @@ -6314,7 +6292,7 @@ AtRule.prototype.outputRuleset = function (context, output, rules) { }; module.exports = AtRule; -},{"./anonymous":48,"./node":74,"./ruleset":80,"./selector":81}],51:[function(require,module,exports){ +},{"./anonymous":48,"./node":73,"./ruleset":78,"./selector":79}],51:[function(require,module,exports){ var Node = require("./node"); var Attribute = function (key, op, value) { @@ -6343,7 +6321,7 @@ Attribute.prototype.toCSS = function (context) { }; module.exports = Attribute; -},{"./node":74}],52:[function(require,module,exports){ +},{"./node":73}],52:[function(require,module,exports){ var Node = require("./node"), Anonymous = require("./anonymous"), FunctionCaller = require("../functions/function-caller"); @@ -6428,7 +6406,7 @@ Call.prototype.genCSS = function (context, output) { }; module.exports = Call; -},{"../functions/function-caller":25,"./anonymous":48,"./node":74}],53:[function(require,module,exports){ +},{"../functions/function-caller":25,"./anonymous":48,"./node":73}],53:[function(require,module,exports){ var Node = require("./node"), colors = require("../data/colors"); @@ -6619,7 +6597,7 @@ Color.fromKeyword = function(keyword) { }; module.exports = Color; -},{"../data/colors":13,"./node":74}],54:[function(require,module,exports){ +},{"../data/colors":13,"./node":73}],54:[function(require,module,exports){ var Node = require("./node"); var Combinator = function (value) { @@ -6644,7 +6622,7 @@ Combinator.prototype.genCSS = function (context, output) { }; module.exports = Combinator; -},{"./node":74}],55:[function(require,module,exports){ +},{"./node":73}],55:[function(require,module,exports){ var Node = require("./node"), getDebugInfo = require("./debug-info"); @@ -6669,7 +6647,7 @@ Comment.prototype.isSilent = function(context) { }; module.exports = Comment; -},{"./debug-info":57,"./node":74}],56:[function(require,module,exports){ +},{"./debug-info":57,"./node":73}],56:[function(require,module,exports){ var Node = require("./node"); var Condition = function (op, l, r, i, negate) { @@ -6708,7 +6686,7 @@ Condition.prototype.eval = function (context) { }; module.exports = Condition; -},{"./node":74}],57:[function(require,module,exports){ +},{"./node":73}],57:[function(require,module,exports){ var debugInfo = function(context, ctx, lineSeparator) { var result = ""; if (context.dumpLineNumbers && !context.compress) { @@ -6847,7 +6825,7 @@ Declaration.prototype.makeImportant = function () { }; module.exports = Declaration; -},{"./anonymous":48,"./keyword":69,"./node":74,"./value":85}],59:[function(require,module,exports){ +},{"./anonymous":48,"./keyword":68,"./node":73,"./value":83}],59:[function(require,module,exports){ var Node = require("./node"), contexts = require("../contexts"), utils = require("../utils"); @@ -6872,7 +6850,7 @@ DetachedRuleset.prototype.callEval = function (context) { }; module.exports = DetachedRuleset; -},{"../contexts":12,"../utils":88,"./node":74}],60:[function(require,module,exports){ +},{"../contexts":12,"../utils":86,"./node":73}],60:[function(require,module,exports){ var Node = require("./node"), unitConversions = require("../data/unit-conversions"), Unit = require("./unit"), @@ -7035,20 +7013,7 @@ Dimension.prototype.convertTo = function (conversions) { }; module.exports = Dimension; -},{"../data/unit-conversions":15,"./color":53,"./node":74,"./unit":83}],61:[function(require,module,exports){ -// Backwards compatibility shim for Directive (AtRule) -var AtRule = require("./atrule"); - -var Directive = function () { - var args = Array.prototype.slice.call(arguments); - AtRule.apply(this, args); -}; - -Directive.prototype = Object.create(AtRule.prototype); -Directive.prototype.constructor = Directive; - -module.exports = Directive; -},{"./atrule":50}],62:[function(require,module,exports){ +},{"../data/unit-conversions":15,"./color":53,"./node":73,"./unit":81}],61:[function(require,module,exports){ var Node = require("./node"), Paren = require("./paren"), Combinator = require("./combinator"); @@ -7111,7 +7076,7 @@ Element.prototype.toCSS = function (context) { }; module.exports = Element; -},{"./combinator":54,"./node":74,"./paren":76}],63:[function(require,module,exports){ +},{"./combinator":54,"./node":73,"./paren":75}],62:[function(require,module,exports){ var Node = require("./node"), Paren = require("./paren"), Comment = require("./comment"); @@ -7169,7 +7134,7 @@ Expression.prototype.throwAwayComments = function () { }; module.exports = Expression; -},{"./comment":55,"./node":74,"./paren":76}],64:[function(require,module,exports){ +},{"./comment":55,"./node":73,"./paren":75}],63:[function(require,module,exports){ var Node = require("./node"), Selector = require("./selector"); @@ -7229,7 +7194,7 @@ Extend.prototype.findSelfSelectors = function (selectors) { }; module.exports = Extend; -},{"./node":74,"./selector":81}],65:[function(require,module,exports){ +},{"./node":73,"./selector":79}],64:[function(require,module,exports){ var Node = require("./node"), Media = require("./media"), URL = require("./url"), @@ -7411,14 +7376,12 @@ Import.prototype.doEval = function (context) { }; module.exports = Import; -},{"../less-error":36,"../utils":88,"./anonymous":48,"./media":70,"./node":74,"./quoted":78,"./ruleset":80,"./url":84}],66:[function(require,module,exports){ +},{"../less-error":36,"../utils":86,"./anonymous":48,"./media":69,"./node":73,"./quoted":77,"./ruleset":78,"./url":82}],65:[function(require,module,exports){ var tree = Object.create(null); tree.Node = require('./node'); tree.Color = require('./color'); tree.AtRule = require('./atrule'); -// Backwards compatibility -tree.Directive = require('./directive'); tree.DetachedRuleset = require('./detached-ruleset'); tree.Operation = require('./operation'); tree.Dimension = require('./dimension'); @@ -7434,8 +7397,6 @@ tree.Selector = require('./selector'); tree.Quoted = require('./quoted'); tree.Expression = require('./expression'); tree.Declaration = require('./declaration'); -// Backwards compatibility -tree.Rule = require('./rule'); tree.Call = require('./call'); tree.URL = require('./url'); tree.Import = require('./import'); @@ -7458,7 +7419,7 @@ tree.VariableCall = require('./variable-call'); module.exports = tree; -},{"./anonymous":48,"./assignment":49,"./atrule":50,"./attribute":51,"./call":52,"./color":53,"./combinator":54,"./comment":55,"./condition":56,"./declaration":58,"./detached-ruleset":59,"./dimension":60,"./directive":61,"./element":62,"./expression":63,"./extend":64,"./import":65,"./javascript":67,"./keyword":69,"./media":70,"./mixin-call":71,"./mixin-definition":72,"./negative":73,"./node":74,"./operation":75,"./paren":76,"./property":77,"./quoted":78,"./rule":79,"./ruleset":80,"./selector":81,"./unicode-descriptor":82,"./unit":83,"./url":84,"./value":85,"./variable":87,"./variable-call":86}],67:[function(require,module,exports){ +},{"./anonymous":48,"./assignment":49,"./atrule":50,"./attribute":51,"./call":52,"./color":53,"./combinator":54,"./comment":55,"./condition":56,"./declaration":58,"./detached-ruleset":59,"./dimension":60,"./element":61,"./expression":62,"./extend":63,"./import":64,"./javascript":66,"./keyword":68,"./media":69,"./mixin-call":70,"./mixin-definition":71,"./negative":72,"./node":73,"./operation":74,"./paren":75,"./property":76,"./quoted":77,"./ruleset":78,"./selector":79,"./unicode-descriptor":80,"./unit":81,"./url":82,"./value":83,"./variable":85,"./variable-call":84}],66:[function(require,module,exports){ var JsEvalNode = require("./js-eval-node"), Dimension = require("./dimension"), Quoted = require("./quoted"), @@ -7488,7 +7449,7 @@ JavaScript.prototype.eval = function(context) { module.exports = JavaScript; -},{"./anonymous":48,"./dimension":60,"./js-eval-node":68,"./quoted":78}],68:[function(require,module,exports){ +},{"./anonymous":48,"./dimension":60,"./js-eval-node":67,"./quoted":77}],67:[function(require,module,exports){ var Node = require("./node"), Variable = require("./variable"); @@ -7551,7 +7512,7 @@ JsEvalNode.prototype.jsify = function (obj) { module.exports = JsEvalNode; -},{"./node":74,"./variable":87}],69:[function(require,module,exports){ +},{"./node":73,"./variable":85}],68:[function(require,module,exports){ var Node = require("./node"); var Keyword = function (value) { this.value = value; }; @@ -7567,7 +7528,7 @@ Keyword.False = new Keyword('false'); module.exports = Keyword; -},{"./node":74}],70:[function(require,module,exports){ +},{"./node":73}],69:[function(require,module,exports){ var Ruleset = require("./ruleset"), Value = require("./value"), Selector = require("./selector"), @@ -7710,7 +7671,7 @@ Media.prototype.bubbleSelectors = function (selectors) { }; module.exports = Media; -},{"../utils":88,"./anonymous":48,"./atrule":50,"./expression":63,"./ruleset":80,"./selector":81,"./value":85}],71:[function(require,module,exports){ +},{"../utils":86,"./anonymous":48,"./atrule":50,"./expression":62,"./ruleset":78,"./selector":79,"./value":83}],70:[function(require,module,exports){ var Node = require("./node"), Selector = require("./selector"), MixinDefinition = require("./mixin-definition"), @@ -7896,7 +7857,7 @@ MixinCall.prototype.format = function (args) { }; module.exports = MixinCall; -},{"../functions/default":24,"./mixin-definition":72,"./node":74,"./selector":81}],72:[function(require,module,exports){ +},{"../functions/default":24,"./mixin-definition":71,"./node":73,"./selector":79}],71:[function(require,module,exports){ var Selector = require("./selector"), Element = require("./element"), Ruleset = require("./ruleset"), @@ -8100,7 +8061,7 @@ Definition.prototype.matchArgs = function (args, context) { }; module.exports = Definition; -},{"../contexts":12,"../utils":88,"./declaration":58,"./element":62,"./expression":63,"./ruleset":80,"./selector":81}],73:[function(require,module,exports){ +},{"../contexts":12,"../utils":86,"./declaration":58,"./element":61,"./expression":62,"./ruleset":78,"./selector":79}],72:[function(require,module,exports){ var Node = require("./node"), Operation = require("./operation"), Dimension = require("./dimension"); @@ -8122,7 +8083,7 @@ Negative.prototype.eval = function (context) { }; module.exports = Negative; -},{"./dimension":60,"./node":74,"./operation":75}],74:[function(require,module,exports){ +},{"./dimension":60,"./node":73,"./operation":74}],73:[function(require,module,exports){ var Node = function() { this.parent = null; this.visibilityBlocks = undefined; @@ -8281,7 +8242,7 @@ Node.prototype.copyVisibilityInfo = function(info) { }; module.exports = Node; -},{}],75:[function(require,module,exports){ +},{}],74:[function(require,module,exports){ var Node = require("./node"), Color = require("./color"), Dimension = require("./dimension"); @@ -8331,7 +8292,7 @@ Operation.prototype.genCSS = function (context, output) { module.exports = Operation; -},{"./color":53,"./dimension":60,"./node":74}],76:[function(require,module,exports){ +},{"./color":53,"./dimension":60,"./node":73}],75:[function(require,module,exports){ var Node = require("./node"); var Paren = function (node) { @@ -8349,7 +8310,7 @@ Paren.prototype.eval = function (context) { }; module.exports = Paren; -},{"./node":74}],77:[function(require,module,exports){ +},{"./node":73}],76:[function(require,module,exports){ var Node = require("./node"), Declaration = require("./declaration"); @@ -8421,7 +8382,7 @@ Property.prototype.find = function (obj, fun) { }; module.exports = Property; -},{"./declaration":58,"./node":74}],78:[function(require,module,exports){ +},{"./declaration":58,"./node":73}],77:[function(require,module,exports){ var Node = require("./node"), JsEvalNode = require("./js-eval-node"), Variable = require("./variable"), @@ -8480,20 +8441,7 @@ Quoted.prototype.compare = function (other) { }; module.exports = Quoted; -},{"./js-eval-node":68,"./node":74,"./property":77,"./variable":87}],79:[function(require,module,exports){ -// Backwards compatibility shim for Rule (Declaration) -var Declaration = require("./declaration"); - -var Rule = function () { - var args = Array.prototype.slice.call(arguments); - Declaration.apply(this, args); -}; - -Rule.prototype = Object.create(Declaration.prototype); -Rule.prototype.constructor = Rule; - -module.exports = Rule; -},{"./declaration":58}],80:[function(require,module,exports){ +},{"./js-eval-node":67,"./node":73,"./property":76,"./variable":85}],78:[function(require,module,exports){ var Node = require("./node"), Declaration = require("./declaration"), Keyword = require("./keyword"), @@ -9253,7 +9201,7 @@ Ruleset.prototype.joinSelector = function (paths, context, selector) { }; module.exports = Ruleset; -},{"../contexts":12,"../functions/default":24,"../functions/function-registry":26,"../utils":88,"./anonymous":48,"./comment":55,"./debug-info":57,"./declaration":58,"./element":62,"./keyword":69,"./node":74,"./paren":76,"./selector":81}],81:[function(require,module,exports){ +},{"../contexts":12,"../functions/default":24,"../functions/function-registry":26,"../utils":86,"./anonymous":48,"./comment":55,"./debug-info":57,"./declaration":58,"./element":61,"./keyword":68,"./node":73,"./paren":75,"./selector":79}],79:[function(require,module,exports){ var Node = require("./node"), Element = require("./element"), LessError = require("../less-error"); @@ -9383,7 +9331,7 @@ Selector.prototype.getIsOutput = function() { }; module.exports = Selector; -},{"../less-error":36,"./element":62,"./node":74}],82:[function(require,module,exports){ +},{"../less-error":36,"./element":61,"./node":73}],80:[function(require,module,exports){ var Node = require("./node"); var UnicodeDescriptor = function (value) { @@ -9394,7 +9342,7 @@ UnicodeDescriptor.prototype.type = "UnicodeDescriptor"; module.exports = UnicodeDescriptor; -},{"./node":74}],83:[function(require,module,exports){ +},{"./node":73}],81:[function(require,module,exports){ var Node = require("./node"), unitConversions = require("../data/unit-conversions"), utils = require("../utils"); @@ -9517,7 +9465,7 @@ Unit.prototype.cancel = function () { }; module.exports = Unit; -},{"../data/unit-conversions":15,"../utils":88,"./node":74}],84:[function(require,module,exports){ +},{"../data/unit-conversions":15,"../utils":86,"./node":73}],82:[function(require,module,exports){ var Node = require("./node"); var URL = function (val, index, currentFileInfo, isEvald) { @@ -9573,7 +9521,7 @@ URL.prototype.eval = function (context) { }; module.exports = URL; -},{"./node":74}],85:[function(require,module,exports){ +},{"./node":73}],83:[function(require,module,exports){ var Node = require("./node"); var Value = function (value) { @@ -9614,7 +9562,7 @@ Value.prototype.genCSS = function (context, output) { }; module.exports = Value; -},{"./node":74}],86:[function(require,module,exports){ +},{"./node":73}],84:[function(require,module,exports){ var Node = require("./node"), Variable = require("./variable"); @@ -9630,7 +9578,7 @@ VariableCall.prototype.eval = function (context) { }; module.exports = VariableCall; -},{"./node":74,"./variable":87}],87:[function(require,module,exports){ +},{"./node":73,"./variable":85}],85:[function(require,module,exports){ var Node = require("./node"); var Variable = function (name, index, currentFileInfo) { @@ -9685,7 +9633,7 @@ Variable.prototype.find = function (obj, fun) { }; module.exports = Variable; -},{"./node":74}],88:[function(require,module,exports){ +},{"./node":73}],86:[function(require,module,exports){ /* jshint proto: true */ module.exports = { getLocation: function(index, inputStream) { @@ -9753,23 +9701,10 @@ module.exports = { } } return obj1; - }, - getPrototype: function(obj) { - if (Object.getPrototypeOf) { - return Object.getPrototypeOf(obj); - } - else { - if ("".__proto__ === String.prototype) { - return obj.__proto__; - } - else if (obj.constructor) { - return obj.constructor.prototype; - } - } } }; -},{}],89:[function(require,module,exports){ +},{}],87:[function(require,module,exports){ var tree = require("../tree"), Visitor = require("./visitor"), logger = require("../logger"), @@ -10232,7 +10167,7 @@ ProcessExtendsVisitor.prototype = { module.exports = ProcessExtendsVisitor; -},{"../logger":37,"../tree":66,"../utils":88,"./visitor":96}],90:[function(require,module,exports){ +},{"../logger":37,"../tree":65,"../utils":86,"./visitor":94}],88:[function(require,module,exports){ function ImportSequencer(onSequencerEmpty) { this.imports = []; this.variableImports = []; @@ -10288,7 +10223,7 @@ ImportSequencer.prototype.tryRun = function() { module.exports = ImportSequencer; -},{}],91:[function(require,module,exports){ +},{}],89:[function(require,module,exports){ var contexts = require("../contexts"), Visitor = require("./visitor"), ImportSequencer = require("./import-sequencer"), @@ -10480,7 +10415,7 @@ ImportVisitor.prototype = { }; module.exports = ImportVisitor; -},{"../contexts":12,"../utils":88,"./import-sequencer":90,"./visitor":96}],92:[function(require,module,exports){ +},{"../contexts":12,"../utils":86,"./import-sequencer":88,"./visitor":94}],90:[function(require,module,exports){ var visitors = { Visitor: require("./visitor"), ImportVisitor: require('./import-visitor'), @@ -10492,7 +10427,7 @@ var visitors = { module.exports = visitors; -},{"./extend-visitor":89,"./import-visitor":91,"./join-selector-visitor":93,"./set-tree-visibility-visitor":94,"./to-css-visitor":95,"./visitor":96}],93:[function(require,module,exports){ +},{"./extend-visitor":87,"./import-visitor":89,"./join-selector-visitor":91,"./set-tree-visibility-visitor":92,"./to-css-visitor":93,"./visitor":94}],91:[function(require,module,exports){ var Visitor = require("./visitor"); var JoinSelectorVisitor = function() { @@ -10545,7 +10480,7 @@ JoinSelectorVisitor.prototype = { module.exports = JoinSelectorVisitor; -},{"./visitor":96}],94:[function(require,module,exports){ +},{"./visitor":94}],92:[function(require,module,exports){ var SetTreeVisibilityVisitor = function(visible) { this.visible = visible; }; @@ -10584,7 +10519,7 @@ SetTreeVisibilityVisitor.prototype.visit = function(node) { return node; }; module.exports = SetTreeVisibilityVisitor; -},{}],95:[function(require,module,exports){ +},{}],93:[function(require,module,exports){ var tree = require("../tree"), Visitor = require("./visitor"); @@ -10946,7 +10881,7 @@ ToCSSVisitor.prototype = { module.exports = ToCSSVisitor; -},{"../tree":66,"./visitor":96}],96:[function(require,module,exports){ +},{"../tree":65,"./visitor":94}],94:[function(require,module,exports){ var tree = require("../tree"); var _visitArgs = { visitDeeper: true }, @@ -11100,7 +11035,7 @@ Visitor.prototype = { }; module.exports = Visitor; -},{"../tree":66}],97:[function(require,module,exports){ +},{"../tree":65}],95:[function(require,module,exports){ "use strict"; // rawAsap provides everything we need except exception management. @@ -11168,7 +11103,7 @@ RawTask.prototype.call = function () { } }; -},{"./raw":98}],98:[function(require,module,exports){ +},{"./raw":96}],96:[function(require,module,exports){ (function (global){ "use strict"; @@ -11395,7 +11330,7 @@ rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer; // https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],99:[function(require,module,exports){ +},{}],97:[function(require,module,exports){ 'use strict'; var asap = require('asap/raw'); @@ -11610,7 +11545,7 @@ function doResolve(fn, promise) { } } -},{"asap/raw":98}],100:[function(require,module,exports){ +},{"asap/raw":96}],98:[function(require,module,exports){ 'use strict'; //This file contains the ES6 extensions to the core Promises/A+ API @@ -11719,7 +11654,7 @@ Promise.prototype['catch'] = function (onRejected) { return this.then(null, onRejected); }; -},{"./core.js":99}],101:[function(require,module,exports){ +},{"./core.js":97}],99:[function(require,module,exports){ // should work in any browser without browserify if (typeof Promise.prototype.done !== 'function') { @@ -11732,7 +11667,7 @@ if (typeof Promise.prototype.done !== 'function') { }) } } -},{}],102:[function(require,module,exports){ +},{}],100:[function(require,module,exports){ // not "use strict" so we can declare global "Promise" var asap = require('asap'); @@ -11744,5 +11679,5 @@ if (typeof Promise === 'undefined') { require('./polyfill-done.js'); -},{"./lib/core.js":99,"./lib/es6-extensions.js":100,"./polyfill-done.js":101,"asap":97}]},{},[2])(2) +},{"./lib/core.js":97,"./lib/es6-extensions.js":98,"./polyfill-done.js":99,"asap":95}]},{},[2])(2) }); \ No newline at end of file diff --git a/dist/less.min.js b/dist/less.min.js index 9757c3e70..d9c94e53e 100644 --- a/dist/less.min.js +++ b/dist/less.min.js @@ -1,5 +1,5 @@ /*! - * Less - Leaner CSS v3.0.0-RC.1 + * Less - Leaner CSS v3.0.0-RC.2 * http://lesscss.org * * Copyright (c) 2009-2018, Alexis Sellier @@ -10,8 +10,8 @@ /** * @license Apache-2.0 */ -!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.less=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0||b.isFileProtocol?"development":"production");var c=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(a.location.hash);c&&(b.dumpLineNumbers=c[1]),void 0===b.useFileCache&&(b.useFileCache=!0),void 0===b.onReady&&(b.onReady=!0),b.javascriptEnabled=!(!b.javascriptEnabled&&!b.inlineJavaScript)}},{"./browser":3,"./utils":11}],2:[function(a,b,c){function d(a){a.filename&&console.warn(a),e.async||h.removeChild(i)}a("promise/polyfill");var e=a("../less/default-options")();if(window.less)for(key in window.less)window.less.hasOwnProperty(key)&&(e[key]=window.less[key]);a("./add-default-options")(window,e),e.plugins=e.plugins||[],window.LESS_PLUGINS&&(e.plugins=e.plugins.concat(window.LESS_PLUGINS));var f=b.exports=a("./index")(window,e);window.less=f;var g,h,i;e.onReady&&(/!watch/.test(window.location.hash)&&f.watch(),e.async||(g="body { display: none !important }",h=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),i.type="text/css",i.styleSheet?i.styleSheet.cssText=g:i.appendChild(document.createTextNode(g)),h.appendChild(i)),f.registerStylesheetsImmediately(),f.pageLoadFinished=f.refresh("development"===f.env).then(d,d))},{"../less/default-options":16,"./add-default-options":1,"./index":8,"promise/polyfill":102}],3:[function(a,b,c){var d=a("./utils");b.exports={createCSS:function(a,b,c){var e=c.href||"",f="less:"+(c.title||d.extractId(e)),g=a.getElementById(f),h=!1,i=a.createElement("style");i.setAttribute("type","text/css"),c.media&&i.setAttribute("media",c.media),i.id=f,i.styleSheet||(i.appendChild(a.createTextNode(b)),h=null!==g&&g.childNodes.length>0&&i.childNodes.length>0&&g.firstChild.nodeValue===i.firstChild.nodeValue);var j=a.getElementsByTagName("head")[0];if(null===g||h===!1){var k=c&&c.nextSibling||null;k?k.parentNode.insertBefore(i,k):j.appendChild(i)}if(g&&h===!1&&g.parentNode.removeChild(g),i.styleSheet)try{i.styleSheet.cssText=b}catch(l){throw new Error("Couldn't reassign styleSheet.cssText.")}},currentScript:function(a){var b=a.document;return b.currentScript||function(){var a=b.getElementsByTagName("script");return a[a.length-1]}()}}},{"./utils":11}],4:[function(a,b,c){b.exports=function(a,b,c){var d=null;if("development"!==b.env)try{d="undefined"==typeof a.localStorage?null:a.localStorage}catch(e){}return{setCSS:function(a,b,e,f){if(d){c.info("saving "+a+" to cache.");try{d.setItem(a,f),d.setItem(a+":timestamp",b),e&&d.setItem(a+":vars",JSON.stringify(e))}catch(g){c.error('failed to save "'+a+'" to local storage for caching.')}}},getCSS:function(a,b,c){var e=d&&d.getItem(a),f=d&&d.getItem(a+":timestamp"),g=d&&d.getItem(a+":vars");if(c=c||{},f&&b.lastModified&&new Date(b.lastModified).valueOf()===new Date(f).valueOf()&&(!c&&!g||JSON.stringify(c)===g))return e}}}},{}],5:[function(a,b,c){var d=a("./utils"),e=a("./browser");b.exports=function(a,b,c){function f(b,f){var g,h,i="less-error-message:"+d.extractId(f||""),j='
    • {content}
    • ',k=a.document.createElement("div"),l=[],m=b.filename||f,n=m.match(/([^\/]+(\?.*)?)$/)[1];k.id=i,k.className="less-error-message",h="

      "+(b.type||"Syntax")+"Error: "+(b.message||"There is an error in your .less file")+'

      in '+n+" ";var o=function(a,b,c){void 0!==a.extract[b]&&l.push(j.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};b.line&&(o(b,0,""),o(b,1,"line"),o(b,2,""),h+="on line "+b.line+", column "+(b.column+1)+":

        "+l.join("")+"
      "),b.stack&&(b.extract||c.logLevel>=4)&&(h+="
      Stack Trace
      "+b.stack.split("\n").slice(1).join("
      ")),k.innerHTML=h,e.createCSS(a.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),k.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===c.env&&(g=setInterval(function(){var b=a.document,c=b.body;c&&(b.getElementById(i)?c.replaceChild(k,b.getElementById(i)):c.insertBefore(k,c.firstChild),clearInterval(g))},10))}function g(b){var c=a.document.getElementById("less-error-message:"+d.extractId(b));c&&c.parentNode.removeChild(c)}function h(a){}function i(a){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?h(a):"function"==typeof c.errorReporting&&c.errorReporting("remove",a):g(a)}function j(a,d){var e="{line} {content}",f=a.filename||d,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f,i=function(a,b,c){void 0!==a.extract[b]&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.line&&(i(a,0,""),i(a,1,"line"),i(a,2,""),h+=" on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")),a.stack&&(a.extract||c.logLevel>=4)&&(h+="\nStack Trace\n"+a.stack),b.logger.error(h)}function k(a,b){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?j(a,b):"function"==typeof c.errorReporting&&c.errorReporting("add",a,b):f(a,b)}return{add:k,remove:i}}},{"./browser":3,"./utils":11}],6:[function(a,b,c){b.exports=function(b,c){var d=a("../less/environment/abstract-file-manager.js"),e={},f=function(){};return f.prototype=new d,f.prototype.alwaysMakePathsAbsolute=function(){return!0},f.prototype.join=function(a,b){return a?this.extractUrlParts(b,a).path:b},f.prototype.doXHR=function(a,d,e,f){function g(b,c,d){b.status>=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var h=new XMLHttpRequest,i=!b.isFileProtocol||b.fileAsync;"function"==typeof h.overrideMimeType&&h.overrideMimeType("text/css"),c.debug("XHR: Getting '"+a+"'"),h.open("GET",a,i),h.setRequestHeader("Accept",d||"text/x-less, text/css; q=0.9, */*; q=0.5"),h.send(null),b.isFileProtocol&&!b.fileAsync?0===h.status||h.status>=200&&h.status<300?e(h.responseText):f(h.status,a):i?h.onreadystatechange=function(){4==h.readyState&&g(h,e,f)}:g(h,e,f)},f.prototype.supports=function(a,b,c,d){return!0},f.prototype.clearFileCache=function(){e={}},f.prototype.loadFile=function(a,b,c,d){b&&!this.isPathAbsolute(a)&&(a=b+a),a=c.ext?this.tryAppendExtension(a,c.ext):a,c=c||{};var f=this.extractUrlParts(a,window.location.href),g=f.url,h=this;return new Promise(function(a,b){if(c.useFileCache&&e[g])try{var d=e[g];return a({contents:d,filename:g,webInfo:{lastModified:new Date}})}catch(f){return b({filename:g,message:"Error loading file "+g+" error was "+f.message})}h.doXHR(g,c.mime,function(b,c){e[g]=b,a({contents:b,filename:g,webInfo:{lastModified:c}})},function(a,c){b({type:"File",message:"'"+c+"' wasn't found ("+a+")",href:g})})})},f}},{"../less/environment/abstract-file-manager.js":17}],7:[function(a,b,c){b.exports=function(){function b(){throw{type:"Runtime",message:"Image size functions are not supported in browser version of less"}}var c=a("./../less/functions/function-registry"),d={"image-size":function(a){return b(this,a),-1},"image-width":function(a){return b(this,a),-1},"image-height":function(a){return b(this,a),-1}};c.addMultiple(d)}},{"./../less/functions/function-registry":26}],8:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(b,c){function f(a){return JSON.parse(JSON.stringify(a||{}))}function g(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}}function h(a){for(var b,d=l.getElementsByTagName("style"),e=0;e=c&&console.log(a)},info:function(a){b.logLevel>=d&&console.log(a)},warn:function(a){b.logLevel>=e&&console.warn(a)},error:function(a){b.logLevel>=f&&console.error(a)}}]);for(var g=0;g0&&(a=a.slice(0,b)),b=a.lastIndexOf("/"),b<0&&(b=a.lastIndexOf("\\")),b<0?"":a.slice(0,b+1)},d.prototype.tryAppendExtension=function(a,b){return/(\.[a-z]*$)|([\?;].*)$/.test(a)?a:a+b},d.prototype.tryAppendLessExtension=function(a){return this.tryAppendExtension(a,".less")},d.prototype.supportsSync=function(){return!1},d.prototype.alwaysMakePathsAbsolute=function(){return!1},d.prototype.isPathAbsolute=function(a){return/^(?:[a-z-]+:|\/|\\|#)/i.test(a)},d.prototype.join=function(a,b){return a?a+b:b},d.prototype.pathDiff=function(a,b){var c,d,e,f,g=this.extractUrlParts(a),h=this.extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;cparseInt(b[c])?-1:1;return 0},g.prototype.versionToString=function(a){for(var b="",c=0;c=0;h--){var i=g[h];if(i[f?"supportsSync":"supports"](a,b,c,e))return i}return null},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},b.exports=e},{"../logger":37}],20:[function(a,b,c){var d=a("./function-registry"),e=a("../tree/anonymous"),f=a("../tree/keyword");d.addMultiple({"boolean":function(a){return a?f.True:f.False},"if":function(a,b,c){return a?b:c||new e}})},{"../tree/anonymous":48,"../tree/keyword":69,"./function-registry":26}],21:[function(a,b,c){function d(a,b,c){var d,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;l<3;l++)d=b.rgb[l]/255,f=c.rgb[l]/255,h=a(d,f),g&&(h=(j*f+i*(d-j*(d+f-h)))/g),k[l]=255*h;return new e(k,g)}var e=a("../tree/color"),f=a("./function-registry"),g={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,a<=1?g.multiply(a,b):g.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return g.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};for(var h in g)g.hasOwnProperty(h)&&(d[h]=d.bind(null,g[h]));f.addMultiple(d)},{"../tree/color":53,"./function-registry":26}],22:[function(a,b,c){function d(a){return Math.min(1,Math.max(0,a))}function e(a){return h.hsla(a.h,a.s,a.l,a.a)}function f(a){if(a instanceof i)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{type:"Argument",message:"color functions take numbers as parameters"}}function g(a,b){return a instanceof i&&a.unit.is("%")?parseFloat(a.value*b/100):f(a)}var h,i=a("../tree/dimension"),j=a("../tree/color"),k=a("../tree/quoted"),l=a("../tree/anonymous"),m=a("./function-registry");h={rgb:function(a,b,c){return h.rgba(a,b,c,1)},rgba:function(a,b,c,d){var e=[a,b,c].map(function(a){return g(a,255)});return d=f(d),new j(e,d)},hsl:function(a,b,c){return h.hsla(a,b,c,1)},hsla:function(a,b,c,e){function g(a){return a=a<0?a+1:a>1?a-1:a,6*a<1?i+(j-i)*a*6:2*a<1?j:3*a<2?i+(j-i)*(2/3-a)*6:i}var i,j;return a=f(a)%360/360,b=d(f(b)),c=d(f(c)),e=d(f(e)),j=c<=.5?c*(b+1):c+b-c*b,i=2*c-j,h.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),e)},hsv:function(a,b,c){return h.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=f(a)%360/360*360,b=f(b),c=f(c),d=f(d);var e,g;e=Math.floor(a/60%6),g=a/60-e;var i=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],j=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return h.rgba(255*i[j[e][0]],255*i[j[e][1]],255*i[j[e][2]],d)},hue:function(a){return new i(a.toHSL().h)},saturation:function(a){return new i(100*a.toHSL().s,"%")},lightness:function(a){return new i(100*a.toHSL().l,"%")},hsvhue:function(a){return new i(a.toHSV().h)},hsvsaturation:function(a){return new i(100*a.toHSV().s,"%")},hsvvalue:function(a){return new i(100*a.toHSV().v,"%")},red:function(a){return new i(a.rgb[0])},green:function(a){return new i(a.rgb[1])},blue:function(a){return new i(a.rgb[2])},alpha:function(a){return new i(a.toHSL().a)},luma:function(a){return new i(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new i(b*a.alpha*100,"%")},saturate:function(a,b,c){if(!a.rgb)return null;var f=a.toHSL();return f.s+="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},desaturate:function(a,b,c){var f=a.toHSL();return f.s-="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},lighten:function(a,b,c){var f=a.toHSL();return f.l+="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},darken:function(a,b,c){var f=a.toHSL();return f.l-="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},fadein:function(a,b,c){var f=a.toHSL();return f.a+="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fadeout:function(a,b,c){var f=a.toHSL();return f.a-="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=d(c.a),e(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=d<0?360+d:d,e(c)},mix:function(a,b,c){a.toHSL&&b.toHSL||(console.log(b.type),console.dir(b)),c||(c=new i(50));var d=c.value/100,e=2*d-1,f=a.toHSL().a-b.toHSL().a,g=((e*f==-1?e:(e+f)/(1+e*f))+1)/2,h=1-g,k=[a.rgb[0]*g+b.rgb[0]*h,a.rgb[1]*g+b.rgb[1]*h,a.rgb[2]*g+b.rgb[2]*h],l=a.alpha*d+b.alpha*(1-d);return new j(k,l)},greyscale:function(a){return h.desaturate(a,new i(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;if("undefined"==typeof c&&(c=h.rgba(255,255,255,1)),"undefined"==typeof b&&(b=h.rgba(0,0,0,1)),b.luma()>c.luma()){var e=c;c=b,b=e}return d="undefined"==typeof d?.43:f(d),a.luma()=v&&this.context.ieCompat!==!1?(h.warn("Skipped data-uri embedding of "+j+" because its size ("+u.length+" characters) exceeds IE8-safe "+v+" characters!"),g(this,f||a)):new d(new c('"'+u+'"',u,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../logger":37,"../tree/quoted":78,"../tree/url":84,"../utils":88,"./function-registry":26}],24:[function(a,b,c){var d=a("../tree/keyword"),e=a("./function-registry"),f={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;if(null!=a)return a?d.True:d.False},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}};e.add("default",f.eval.bind(f)),b.exports=f},{"../tree/keyword":69,"./function-registry":26}],25:[function(a,b,c){var d=a("../tree/expression"),e=function(a,b,c,d){this.name=a.toLowerCase(),this.index=c,this.context=b,this.currentFileInfo=d,this.func=b.frames[0].functionRegistry.get(this.name)};e.prototype.isValid=function(){return Boolean(this.func)},e.prototype.call=function(a){return Array.isArray(a)&&(a=a.filter(function(a){return"Comment"!==a.type}).map(function(a){if("Expression"===a.type){var b=a.value.filter(function(a){return"Comment"!==a.type});return 1===b.length?b[0]:new d(b)}return a})),this.func.apply(this,a)},b.exports=e},{"../tree/expression":63}],26:[function(a,b,c){function d(a){return{_data:{},add:function(a,b){a=a.toLowerCase(),this._data.hasOwnProperty(a),this._data[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){this.add(b,a[b])}.bind(this))},get:function(b){return this._data[b]||a&&a.get(b)},getLocalFunctions:function(){return this._data},inherit:function(){return d(this)},create:function(a){return d(a)}}}b.exports=d(null)},{}],27:[function(a,b,c){b.exports=function(b){var c={functionRegistry:a("./function-registry"),functionCaller:a("./function-caller")};return a("./boolean"),a("./default"),a("./color"),a("./color-blending"),a("./data-uri")(b),a("./math"),a("./number"),a("./string"),a("./svg")(b),a("./types"),c}},{"./boolean":20,"./color":22,"./color-blending":21,"./data-uri":23,"./default":24,"./function-caller":25,"./function-registry":26,"./math":29,"./number":30,"./string":31,"./svg":32,"./types":33}],28:[function(a,b,c){var d=a("../tree/dimension"),e=function(){};e._math=function(a,b,c){if(!(c instanceof d))throw{type:"Argument",message:"argument must be a number" -};return null==b?b=c.unit:c=c.unify(),new d(a(parseFloat(c.value)),b)},b.exports=e},{"../tree/dimension":60}],29:[function(a,b,c){var d=a("./function-registry"),e=a("./math-helper.js"),f={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"};for(var g in f)f.hasOwnProperty(g)&&(f[g]=e._math.bind(null,Math[g],f[g]));f.round=function(a,b){var c="undefined"==typeof b?0:b.value;return e._math(function(a){return a.toFixed(c)},null,a)},d.addMultiple(f)},{"./function-registry":26,"./math-helper.js":28}],30:[function(a,b,c){var d=a("../tree/dimension"),e=a("../tree/anonymous"),f=a("./function-registry"),g=a("./math-helper.js"),h=function(a,b){switch(b=Array.prototype.slice.call(b),b.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var c,f,g,h,i,j,k,l,m=[],n={};for(c=0;ci.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(b[c].value)&&Array.prototype.push.apply(b,Array.prototype.slice.call(b[c].value));return 1==m.length?m[0]:(b=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new e((a?"min":"max")+"("+b+")"))};f.addMultiple({min:function(){return h(!0,arguments)},max:function(){return h(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new d(Math.PI)},mod:function(a,b){return new d(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d(a),b=new d(b);else if(!(a instanceof d&&b instanceof d))throw{type:"Argument",message:"arguments must be numbers"};return new d(Math.pow(a.value,b.value),a.unit)},percentage:function(a){var b=g._math(function(a){return 100*a},"%",a);return b}})},{"../tree/anonymous":48,"../tree/dimension":60,"./function-registry":26,"./math-helper.js":28}],31:[function(a,b,c){var d=a("../tree/quoted"),e=a("../tree/anonymous"),f=a("../tree/javascript"),g=a("./function-registry");g.addMultiple({e:function(a){return new e(a instanceof f?a.evaluated:a.value)},escape:function(a){return new e(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,b,c,e){var f=a.value;return c="Quoted"===c.type?c.value:c.toCSS(),f=f.replace(new RegExp(b.value,e?e.value:""),c),new d(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;e",k=0;k";return j+="',j=encodeURIComponent(j),j="data:image/svg+xml,"+j,new g(new f("'"+j+"'",j,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":53,"../tree/dimension":60,"../tree/expression":63,"../tree/quoted":78,"../tree/url":84,"./function-registry":26}],33:[function(a,b,c){var d=a("../tree/keyword"),e=a("../tree/detached-ruleset"),f=a("../tree/dimension"),g=a("../tree/color"),h=a("../tree/quoted"),i=a("../tree/anonymous"),j=a("../tree/url"),k=a("../tree/operation"),l=a("./function-registry"),m=function(a,b){return a instanceof b?d.True:d.False},n=function(a,b){if(void 0===b)throw{type:"Argument",message:"missing the required second argument to isunit."};if(b="string"==typeof b.value?b.value:b,"string"!=typeof b)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof f&&a.unit.is(b)?d.True:d.False},o=function(a){var b=Array.isArray(a.value)?a.value:Array(a);return b};l.addMultiple({isruleset:function(a){return m(a,e)},iscolor:function(a){return m(a,g)},isnumber:function(a){return m(a,f)},isstring:function(a){return m(a,h)},iskeyword:function(a){return m(a,d)},isurl:function(a){return m(a,j)},ispixel:function(a){return n(a,"px")},ispercentage:function(a){return n(a,"%")},isem:function(a){return n(a,"em")},isunit:n,unit:function(a,b){if(!(a instanceof f))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof k?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d?b.value:b.toCSS():"",new f(a.value,b)},"get-unit":function(a){return new i(a.unit)},extract:function(a,b){return b=b.value-1,o(a)[b]},length:function(a){return new f(o(a).length)}})},{"../tree/anonymous":48,"../tree/color":53,"../tree/detached-ruleset":59,"../tree/dimension":60,"../tree/keyword":69,"../tree/operation":75,"../tree/quoted":78,"../tree/url":84,"./function-registry":26}],34:[function(a,b,c){var d=a("./contexts"),e=a("./parser/parser"),f=a("./less-error"),g=a("./utils");"undefined"==typeof Promise?a("promise"):Promise;b.exports=function(a){var b=function(a,b,c){this.less=a,this.rootFilename=c.filename,this.paths=b.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=b.mime,this.error=null,this.context=b,this.queue=[],this.files={}};return b.prototype.push=function(b,c,h,i,j){var k=this,l=this.context.pluginManager.Loader;this.queue.push(b);var m=function(a,c,d){k.queue.splice(k.queue.indexOf(b),1);var e=d===k.rootFilename;i.optional&&a?j(null,{rules:[]},!1,null):(k.files[d]||(k.files[d]={root:c,options:i}),a&&!k.error&&(k.error=a),j(a,c,e,d))},n={relativeUrls:this.context.relativeUrls,entryPath:h.entryPath,rootpath:h.rootpath,rootFilename:h.rootFilename},o=a.getFileManager(b,h.currentDirectory,this.context,a);if(!o)return void m({message:"Could not find a file-manager for "+b});var p,q=function(a){var b,c=a.filename,g=a.contents.replace(/^\uFEFF/,"");n.currentDirectory=o.getPath(c),n.relativeUrls&&(n.rootpath=o.join(k.context.rootpath||"",o.pathDiff(n.currentDirectory,n.entryPath)),!o.isPathAbsolute(n.rootpath)&&o.alwaysMakePathsAbsolute()&&(n.rootpath=o.join(n.entryPath,n.rootpath))),n.filename=c;var j=new d.Parse(k.context);j.processImports=!1,k.contents[c]=g,(h.reference||i.reference)&&(n.reference=!0),i.isPlugin?(b=l.evalPlugin(g,j,k,i.pluginArgs,n),b instanceof f?m(b,null,c):m(null,b,c)):i.inline?m(null,g,c):!k.files[c]||k.files[c].options.multiple||i.multiple?new e(j,k,n).parse(g,function(a,b){m(a,b,c)}):m(null,k.files[c].root,c)},r=g.clone(this.context);c&&(r.ext=i.isPlugin?".js":".less"),p=i.isPlugin?l.loadPlugin(b,h.currentDirectory,r,a,o):o.loadFile(b,h.currentDirectory,r,a,function(a,b){a?m(a):q(b)}),p&&p.then(q,m)},b}},{"./contexts":12,"./less-error":36,"./parser/parser":42,"./utils":88,promise:void 0}],35:[function(a,b,c){b.exports=function(b,c){var d,e,f,g,h,i,j={version:[3,0,0],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),AbstractPluginLoader:a("./environment/abstract-plugin-loader"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")},k=function(a){return function(){var b=Object.create(a.prototype);return a.apply(b,Array.prototype.slice.call(arguments,0)),b}},l=Object.create(j);for(var m in j.tree)if(i=j.tree[m],"function"==typeof i)l[m.toLowerCase()]=k(i);else{l[m]=Object.create(null);for(var n in i)l[m][n.toLowerCase()]=k(i[n])}return l}},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":17,"./environment/abstract-plugin-loader":18,"./environment/environment":19,"./functions":27,"./import-manager":34,"./less-error":36,"./logger":37,"./parse":39,"./parse-tree":38,"./parser/parser":42,"./plugin-manager":43,"./render":44,"./source-map-builder":45,"./source-map-output":46,"./transform-tree":47,"./tree":66,"./utils":88,"./visitors":92}],36:[function(a,b,c){var d=a("./utils"),e=b.exports=function(a,b,c){Error.call(this);var e=a.filename||c;if(this.message=a.message,this.stack=a.stack,b&&e){var f=b.contents[e],g=d.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&d.getLocation(a.call,f).line,k=f.split("\n");if(this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.column=i,!this.line&&this.stack){var l=this.stack.match(/(|Function):(\d+):(\d+)/);l&&(l[2]&&(this.line=parseInt(l[2])-2),l[3]&&(this.column=parseInt(l[3])))}this.callLine=j+1,this.callExtract=k[j],this.extract=[k[this.line-2],k[this.line-1],k[this.line]]}};if("undefined"==typeof Object.create){var f=function(){};f.prototype=Error.prototype,e.prototype=new f}else e.prototype=Object.create(Error.prototype);e.prototype.constructor=e,e.prototype.toString=function(a){a=a||{};var b="",c=this.extract||[],d=[],e=function(a){return a};if(a.stylize){var f=typeof a.stylize;if("function"!==f)throw Error("options.stylize should be a function, got a "+f+"!");e=a.stylize}if(null!==this.line){if("string"==typeof c[0]&&d.push(e(this.line-1+" "+c[0],"grey")),"string"==typeof c[1]){var g=this.line+" ";c[1]&&(g+=c[1].slice(0,this.column)+e(e(e(c[1].substr(this.column,1),"bold")+c[1].slice(this.column+1),"red"),"inverse")),d.push(g)}"string"==typeof c[2]&&d.push(e(this.line+1+" "+c[2],"grey")),d=d.join("\n")+e("","reset")+"\n"}return b+=e(this.type+"Error: "+this.message,"red"),this.filename&&(b+=e(" in ","red")+this.filename),this.line&&(b+=e(" on line "+this.line+", column "+(this.column+1)+":","grey")),b+="\n"+d,this.callLine&&(b+=e("from ","red")+(this.filename||"")+"/n",b+=e(this.callLine,"grey")+" "+this.callExtract+"/n"),b}},{"./utils":88}],37:[function(a,b,c){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;b=97&&j<=122||j<34))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(h96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;hd&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],41:[function(a,b,c){var d=a("./chunker");b.exports=function(){function a(d){for(var e,f,j,p=k.i,q=c,s=k.i-i,t=k.i+h.length-s,u=k.i+=d,v=b;k.i=0){j={index:k.i,text:v.substr(k.i,x+2-k.i),isLineComment:!1},k.i+=j.text.length-1,k.commentStore.push(j);continue}}break}if(e!==l&&e!==n&&e!==m&&e!==o)break}if(h=h.slice(d+k.i-u+s),i=k.i,!h.length){if(ce||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,c=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$re=function(b){k.i>i&&(h=h.slice(k.i-i),i=k.i);var c=b.exec(h);return c?(a(c[0].length),"string"==typeof c?c:1===c.length?c[0]:c):null},k.$char=function(c){return b.charAt(k.i)!==c?null:(a(1),c)},k.$str=function(c){for(var d=c.length,e=0;es||a=b.length;return k.i=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":40}],42:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=a("../functions/function-registry"),j=function k(a,b,c){function j(a,e){throw new d({index:q.i,filename:c.filename,type:e||"Syntax",message:a},b)}function l(a,b,c){var d=a instanceof Function?a.call(p):q.$re(a);return d?d:void j(b||("string"==typeof a?"expected '"+a+"' got '"+q.currentChar()+"'":"unexpected token"))}function m(a,b){return q.$char(a)?a:void j(b||"expected '"+a+"' got '"+q.currentChar()+"'")}function n(a){var b=c.filename;return{lineNumber:h.getLocation(a,q.getInput()).line+1,fileName:b}}function o(a,c,e,f,g){var h,i=[],j=q;try{j.start(a,!1,function(a,b){g({message:a,index:b+e})});for(var k,l,m=0;k=c[m];m++)l=j.i,h=p[k](),h?(h._index=l+e,h._fileInfo=f,i.push(h)):i.push(null);var n=j.end();n.isFinished?g(null,i):g(!0,null)}catch(o){throw new d({index:o.index+e,message:o.message},b,f.filename)}}var p,q=g();return{parserInput:q,imports:b,fileInfo:c,parseNode:o,parse:function(g,h,j){var l,m,n,o,p=null,r="";if(m=j&&j.globalVars?k.serializeVars(j.globalVars)+"\n":"",n=j&&j.modifyVars?"\n"+k.serializeVars(j.modifyVars):"",a.pluginManager)for(var s=a.pluginManager.getPreProcessors(),t=0;t")}return b&&(q.$char("(")&&(h=this.args(!0).args,m(")")),p.important()&&(j=!0),p.end())?(q.forget(),new e.mixin.Call(b,h,k,c,j)):void q.restore()}},args:function(a){var b,c,d,f,g,h,i,k=p.entities,l={args:null,variadic:!1},m=[],n=[],o=[];for(q.save();;){if(a)h=p.detachedRuleset()||p.expression();else{if(q.commentStore.length=0,q.$str("...")){l.variadic=!0,q.$char(";")&&!b&&(b=!0),(b?n:o).push({variadic:!0});break}h=k.variable()||k.property()||k.literal()||k.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var r=null;if(a?h.value&&1==h.value.length&&(r=h.value[0]):r=h,r&&(r instanceof e.Variable||r instanceof e.Property))if(q.$char(":")){if(m.length>0&&(b&&j("Cannot mix ; and , as delimiter types"),c=!0),g=p.detachedRuleset()||p.expression(),!g){if(!a)return q.restore(),l.args=[],l;j("could not understand value for named argument")}f=d=r.name}else if(q.$str("...")){if(!a){l.variadic=!0,q.$char(";")&&!b&&(b=!0),(b?n:o).push({name:h.name,variadic:!0});break}i=!0}else a||(d=f=r.name,g=null);g&&m.push(g),o.push({name:f,value:g,expand:i}),q.$char(",")||(q.$char(";")||b)&&(c&&j("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),n.push({name:d,value:g,expand:i}),d=null,m=[],c=!1)}return q.forget(),l.args=b?n:o,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==q.currentChar()&&"#"!==q.currentChar()||q.peek(/^[^{]*\}/)))if(q.save(),b=q.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!q.$char(")"))return void q.restore("Missing closing ')'");if(q.commentStore.length=0,q.$str("when")&&(d=l(p.conditions,"expected condition")),c=p.block())return q.forget(),new e.mixin.Definition(a,f,c,d,g);q.restore()}else q.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.property()||a.call()||a.keyword()||a.javascript()},end:function(){return q.$char(";")||q.peek("}")},ieAlpha:function(){var a;if(q.$re(/^opacity=/i))return a=q.$re(/^\d+/),a||(a=l(p.entities.variable,"Could not parse alpha"),a="@{"+a.name.slice(1)+"}"),m(")"),new e.Quoted("","alpha(opacity="+a+")")},element:function(){var a,b,d,f=q.i;if(b=this.combinator(),a=q.$re(/^(?:\d+\.\d+|\d+)%/)||q.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||q.$char("*")||q.$char("&")||this.attribute()||q.$re(/^\([^&()@]+\)/)||q.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(q.save(),q.$char("(")?(d=this.selector(!1))&&q.$char(")")?(a=new e.Paren(d),q.forget()):q.restore("Missing closing ')'"):q.forget()),a)return new e.Element(b,a,f,c)},combinator:function(){var a=q.currentChar();if("/"===a){q.save();var b=q.$re(/^\/[a-z]+\//i);if(b)return q.forget(),new e.Combinator(b);q.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(q.i++,"^"===a&&"^"===q.currentChar()&&(a="^^",q.i++);q.isWhitespace();)q.i++;return new e.Combinator(a)}return new e.Combinator(q.isWhitespace(-1)?" ":null)},selector:function(a){var b,d,f,g,h,i,k,m=q.i;for(a=a!==!1;(a&&(d=this.extend())||a&&(i=q.$str("when"))||(g=this.element()))&&(i?k=l(this.conditions,"expected condition"):k?j("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&j("Extend can only be used at the end of selector"),f=q.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,k,m,c):void(h&&j("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(q.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=l(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=q.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||q.$re(/^[0-9]+%/)||q.$re(/^[\w-]+/)||d.variableCurly()),m("]"),new e.Attribute(a,c,b)}},block:function(){var a;if(q.$char("{")&&(a=this.primary())&&q.$char("}"))return a},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();if(a)return new e.DetachedRuleset(a)},ruleset:function(){var b,c,d,f;for(q.save(),a.dumpLineNumbers&&(f=n(q.i));;){if(c=this.selector(),!c)break;if(b?b.push(c):b=[c],q.commentStore.length=0,c.condition&&b.length>1&&j("Guards are only currently allowed on a single selector."),!q.$char(","))break;c.condition&&j("Guards are only currently allowed on a single selector."),q.commentStore.length=0}if(b&&(d=this.block())){q.forget();var g=new e.Ruleset(b,d,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}q.restore()},declaration:function(){var a,b,d,f,g,h=q.i,i=q.currentChar();if("."!==i&&"#"!==i&&"&"!==i&&":"!==i)if(q.save(),a=this.variable()||this.ruleProperty()){if(g="string"==typeof a,g&&(b=this.detachedRuleset()),q.commentStore.length=0,!b){if(f=!g&&a.length>1&&a.pop().value,b=this.anonymousValue())return q.forget(),new e.Declaration(a,b,(!1),f,h,c);b||(b=this.value()),d=this.important()}if(b&&this.end())return q.forget(),new e.Declaration(a,b,d,f,h,c);q.restore()}else q.restore()},anonymousValue:function(){var a=q.i,b=q.$re(/^([^@\$+\/'"*`(;{}-]*);/);if(b)return new e.Anonymous(b[1],a)},"import":function(){var a,b,d=q.i,f=q.$re(/^@import?\s+/);if(f){var g=(f?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),q.$char(";")||(q.i=d,j("missing semi-colon or unrecognised media features on import")),b=b&&new e.Value(b),new e.Import(a,b,g,d,c);q.i=d,j("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!q.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!q.$char(","))break}while(a);return m(")"),d},importOption:function(){var a=q.$re(/^(less|css|multiple|once|inline|reference|optional)/);if(a)return a[1]},mediaFeature:function(){var a,b,d=this.entities,f=[];q.save();do a=d.keyword()||d.variable(),a?f.push(a):q.$char("(")&&(b=this.property(),a=this.value(),q.$char(")")?b&&a?f.push(new e.Paren(new e.Declaration(b,a,null,null,q.i,c,(!0)))):a?f.push(new e.Paren(a)):j("badly formed media feature definition"):j("Missing closing ')'","Parse"));while(a);if(q.forget(),f.length>0)return new e.Expression(f)},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!q.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!q.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=q.i;return a.dumpLineNumbers&&(g=n(h)),q.save(),q.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||j("media definitions require block statements after any features"),q.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void q.restore()},plugin:function(){var a,b,d,f=q.i,g=q.$re(/^@plugin?\s+/);if(g){ -if(b=this.pluginArgs(),d=b?{pluginArgs:b,isPlugin:!0}:{isPlugin:!0},a=this.entities.quoted()||this.entities.url())return q.$char(";")||(q.i=f,j("missing semi-colon on @plugin")),new e.Import(a,null,d,f,c);q.i=f,j("malformed @plugin statement")}},pluginArgs:function(){if(q.save(),!q.$char("("))return q.restore(),null;var a=q.$re(/^\s*([^\);]+)\)\s*/);return a[1]?(q.forget(),a[1].trim()):(q.restore(),null)},atrule:function(){var b,d,f,g,h,i,k,l=q.i,m=!0,o=!0;if("@"===q.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(q.save(),b=q.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,m=!1;break;case"@namespace":i=!0,m=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,o=!1;break;default:k=!0}return q.commentStore.length=0,h?(d=this.entity(),d||j("expected "+b+" identifier")):i?(d=this.expression(),d||j("expected "+b+" expression")):k&&(d=(q.$re(/^[^{;]+/)||"").trim(),m="{"==q.currentChar(),d&&(d=new e.Anonymous(d))),m&&(f=this.blockRuleset()),f||!m&&d&&q.$char(";")?(q.forget(),new e.AtRule(b,d,f,l,c,a.dumpLineNumbers?n(l):null,o)):void q.restore("at-rule options not recognised")}}},value:function(){var a,b=[],c=q.i;do if(a=this.expression(),a&&(b.push(a),!q.$char(",")))break;while(a);if(b.length>0)return new e.Value(b,c)},important:function(){if("!"===q.currentChar())return q.$re(/^! *important/)},sub:function(){var a,b;return q.save(),q.$char("(")?(a=this.addition(),a&&q.$char(")")?(q.forget(),b=new e.Expression([a]),b.parens=!0,b):void q.restore("Expected ')'")):void q.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=q.isWhitespace(-1);;){if(q.peek(/^\/[*\/]/))break;if(q.save(),c=q.$char("/")||q.$char("*"),!c){q.forget();break}if(b=this.operand(),!b){q.restore();break}q.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=q.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=q.isWhitespace(-1);;){if(c=q.$re(/^[-+]\s+/)||!f&&(q.$char("+")||q.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=q.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=q.i;if(a=this.condition()){for(;;){if(!q.peek(/^,\s*(not\s*)?\(/)||!q.$char(","))break;if(b=this.condition(),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(){function a(){return q.$str("or")}var b,c,d;if(b=this.conditionAnd(this)){if(c=a()){if(d=this.condition(),!d)return;b=new e.Condition(c,b,d)}return b}},conditionAnd:function(){function a(a){return a.negatedCondition()||a.parenthesisCondition()}function b(){return q.$str("and")}var c,d,f;if(c=a(this)){if(d=b()){if(f=this.conditionAnd(),!f)return;c=new e.Condition(d,c,f)}return c}},negatedCondition:function(){if(q.$str("not")){var a=this.parenthesisCondition();return a&&(a.negate=!a.negate),a}},parenthesisCondition:function(){function a(a){var b;return q.save(),(b=a.condition())&&q.$char(")")?(q.forget(),b):void q.restore()}var b;return q.save(),q.$str("(")?(b=a(this))?(q.forget(),b):(b=this.atomicCondition())?q.$char(")")?(q.forget(),b):void q.restore("expected ')' got '"+q.currentChar()+"'"):void q.restore():void q.restore()},atomicCondition:function(){var a,b,c,d,f=this.entities,g=q.i;if(a=this.addition()||f.keyword()||f.quoted())return q.$char(">")?d=q.$char("=")?">=":">":q.$char("<")?d=q.$char("=")?"<=":"<":q.$char("=")&&(d=q.$char(">")?"=>":q.$char("<")?"=<":"="),d?(b=this.addition()||f.keyword()||f.quoted(),b?c=new e.Condition(d,a,b,g,(!1)):j("expected expression")):c=new e.Condition("=",a,new e.Keyword("true"),g,(!1)),c},operand:function(){var a,b=this.entities;q.peek(/^-[@\$\(]/)&&(a=q.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.property()||b.call()||b.colorKeyword();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[],d=q.i;do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),q.peek(/^\/[\/*]/)||(b=q.$char("/"),b&&c.push(new e.Anonymous(b,d)))));while(a);if(c.length>0)return new e.Expression(c)},property:function(){var a=q.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(a)return a[1]},ruleProperty:function(){function a(a){var b=q.i,c=q.$re(a);if(c)return g.push(b),f.push(c[1])}var b,d,f=[],g=[];q.save();var h=q.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],q.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(q.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;d=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},g.prototype.addPostProcessor=function(a,b){var c;for(c=0;c=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},g.prototype.addFileManager=function(a){this.fileManagers.push(a)},g.prototype.getPreProcessors=function(){for(var a=[],b=0;b0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],47:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Declaration("@"+a,b,(!1),null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j,k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor((!0)),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager)for(j=b.pluginManager.visitor(),j.first();i=j.get();)i.isPreEvalVisitor&&i.run(a);c=a.eval(h);for(var l=0;l.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(d="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":74}],57:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],58:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;c-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&c<1&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":15,"./color":53,"./node":74,"./unit":83}],61:[function(a,b,c){var d=a("./atrule"),e=function(){var a=Array.prototype.slice.call(arguments);d.apply(this,a)};e.prototype=Object.create(d.prototype),e.prototype.constructor=e,b.exports=e},{"./atrule":50}],62:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./combinator"),g=function(a,b,c,d,e){this.combinator=a instanceof f?a:new f(a),this.value="string"==typeof b?b.trim():b?b:"",this._index=c,this._fileInfo=d,this.copyVisibilityInfo(e),this.setParent(this.combinator,this)};g.prototype=new d,g.prototype.type="Element",g.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},g.prototype.eval=function(a){return new g(this.combinator,this.value.eval?this.value.eval(a):this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.fileInfo(),this.getIndex())},g.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof e&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=g},{"./combinator":54,"./node":74,"./paren":76}],63:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./comment"),g=function(a){if(this.value=a,!a)throw new Error("Expression requires an array parameter")};g.prototype=new d,g.prototype.type="Expression",g.prototype.accept=function(a){this.value=a.visitArray(this.value)},g.prototype.eval=function(a){var b,c=this.parens&&!this.parensInOp,d=!1;return c&&a.inParenthesis(),this.value.length>1?b=new g(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(d=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!d&&(b=new e(b)),b},g.prototype.genCSS=function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":74,"./selector":81}],65:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=a("../utils"),k=a("../less-error"),l=function(a,b,c,d,e,f){if(this.options=c,this._index=d,this._fileInfo=e,this.path=a,this.features=b,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f),this.setParent(this.features,this),this.setParent(this.path,this)};l.prototype=new d,l.prototype.type="Import",l.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.isPlugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},l.prototype.genCSS=function(a,b){this.css&&void 0===this.path._fileInfo.reference&&(b.add("@import ",this._fileInfo,this._index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},l.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},l.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),!(a instanceof g)||a.containsVariables()},l.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new l(b.eval(a),this.features,this.options,this._index,this._fileInfo,this.visibilityInfo()); -},l.prototype.evalPath=function(a){var b=this.path.eval(a),c=this._fileInfo&&this._fileInfo.rootpath;if(!(b instanceof f)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d)}b.value=a.normalizePath(b.value)}return b},l.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){a.addVisibilityBlock()}):b.addVisibilityBlock()),b},l.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a);if(this.options.isPlugin){if(this.root&&this.root.eval)try{this.root.eval(a)}catch(f){throw f.message="Plugin error during evaluation",new k(f,this.root.imports,this.root.filename)}return c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[]}if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var g=new i(this.root,0,{filename:this.importedFilename,reference:this.path._fileInfo&&this.path._fileInfo.reference},(!0),(!0));return this.features?new e([g],this.features.value):[g]}if(this.css){var m=new l(this.evalPath(a),d,this.options,this._index);if(!m.css&&this.error)throw this.error;return m}return b=new h(null,j.copyArray(this.root.rules)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=l},{"../less-error":36,"../utils":88,"./anonymous":48,"./media":70,"./node":74,"./quoted":78,"./ruleset":80,"./url":84}],66:[function(a,b,c){var d=Object.create(null);d.Node=a("./node"),d.Color=a("./color"),d.AtRule=a("./atrule"),d.Directive=a("./directive"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Property=a("./property"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Declaration=a("./declaration"),d.Rule=a("./rule"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.VariableCall=a("./variable-call"),b.exports=d},{"./anonymous":48,"./assignment":49,"./atrule":50,"./attribute":51,"./call":52,"./color":53,"./combinator":54,"./comment":55,"./condition":56,"./declaration":58,"./detached-ruleset":59,"./dimension":60,"./directive":61,"./element":62,"./expression":63,"./extend":64,"./import":65,"./javascript":67,"./keyword":69,"./media":70,"./mixin-call":71,"./mixin-definition":72,"./negative":73,"./node":74,"./operation":75,"./paren":76,"./property":77,"./quoted":78,"./rule":79,"./ruleset":80,"./selector":81,"./unicode-descriptor":82,"./unit":83,"./url":84,"./value":85,"./variable":87,"./variable-call":86}],67:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this._index=c,this._fileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new e(b):"string"==typeof b?new f('"'+b+'"',b,this.escaped,this._index):new g(Array.isArray(b)?b.join(", "):b)},b.exports=h},{"./anonymous":48,"./dimension":60,"./js-eval-node":68,"./quoted":78}],68:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(!b.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.fileInfo().filename,index:this.getIndex()};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.getIndex(),d.fileInfo()).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.fileInfo().filename,index:this.getIndex()}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.fileInfo().filename,index:this.getIndex()}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":74,"./variable":87}],69:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":74}],70:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./atrule"),j=a("../utils"),k=function(a,b,c,g,h){this._index=c,this._fileInfo=g;var i=new f([],null,null,this._index,this._fileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0,this.setParent(i,this),this.setParent(this.features,this),this.setParent(this.rules,this)};k.prototype=new i,k.prototype.type="Media",k.prototype.isRulesetLike=function(){return!0},k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},k.prototype.genCSS=function(a,b){b.add("@media ",this._fileInfo,this._index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},k.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new k(null,[],this._index,this._fileInfo,this.visibilityInfo());return this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo),b.features=this.features.eval(a),a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},k.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo()),this.setParent(b,this)}return delete a.mediaBlocks,delete a.mediaPath,b},k.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;b0;b--)a.splice(b,0,new g("and"));return new h(a)})),this.setParent(this.features,this),new d([],[])},k.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(n=!0,k=0;k0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.getIndex(),filename:this.fileInfo().filename};for(k=0;kthis.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;gb?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],75:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};g.prototype=new d,g.prototype.type="Operation",g.prototype.accept=function(a){this.operands=a.visit(this.operands)},g.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof f&&c instanceof e&&(b=b.toColor()),c instanceof f&&b instanceof e&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new g(this.op,[b,c],this.isSpaced)},g.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=g},{"./color":53,"./dimension":60,"./node":74}],76:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":74}],77:[function(a,b,c){var d=a("./node"),e=a("./declaration"),f=function(a,b,c){this.name=a,this._index=b,this._fileInfo=c};f.prototype=new d,f.prototype.type="Property",f.prototype.eval=function(a){var b,c=this.name,d=a.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;if(this.evaluating)throw{type:"Name",message:"Recursive property reference for "+c,filename:this.fileInfo().filename,index:this.getIndex()};if(this.evaluating=!0,b=this.find(a.frames,function(b){var f,g=b.property(c);if(g){for(var h=0;hd){if(!c||c(g)){e=g.find(new i(a.elements.slice(d)),b,c);for(var j=0;j0&&b.add(k),a.firstSelector=!0,h[0].genCSS(a,b),a.firstSelector=!1,d=1;d0?(e=p.copyArray(a),f=e.pop(),g=d.createDerived(p.copyArray(f.elements))):g=d.createDerived([]),b.length>0){var h=c.combinator,i=b[0].elements[0];h.emptyOrWhitespace&&!i.combinator.emptyOrWhitespace&&(h=i.combinator),g.elements.push(new j(h,i.value,c._index,c._fileInfo)),g.elements=g.elements.concat(b[0].elements.slice(1))}if(0!==g.elements.length&&e.push(g),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function g(a,b,c,d,e){var g;for(g=0;g0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new i(a))}}function l(a,b,c){function m(a){var b;return a.value instanceof h?(b=a.value.value,b instanceof i?b:null):null}var n,o,p,q,r,s,t,u,v,w,x=!1;for(q=[],r=[[]],n=0;u=c.elements[n];n++)if("&"!==u.value){var y=m(u);if(null!=y){k(q,r);var z,A=[],B=[];for(z=l(A,b,y),x=x||z,p=0;p0&&t[0].elements.push(new j(u.combinator,"",u._index,u._fileInfo)),s.push(t);else for(p=0;p0&&(a.push(r[n]),w=r[n][v-1],r[n][v-1]=w.createDerived(w.elements,c.extendList));return x}function m(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var n,o,q;if(o=[],q=l(o,b,c),!q)if(b.length>0)for(o=[],n=0;n0)for(b=0;b=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}},copyArray:function(a){var b,c=a.length,d=new Array(c);for(b=0;b=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.fileInfo(),b),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitDeclaration:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;e0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return k0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitAtRule:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitAtRuleOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=i},{"../logger":37,"../tree":66,"../utils":88,"./visitor":96}],90:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],91:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=a("../utils"),h=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};h.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,g.copyArray(this.context.frames)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.getIndex(),f.filename=a.fileInfo().filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;h0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];if(this.keepOnlyVisibleChilds(c),!this.isEmpty(c))return a.ensureVisibility(),a.removeVisibilityBlock(),a},isVisibleRuleset:function(a){return!!a.firstRoot||!this.isEmpty(a)&&!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitDeclaration:function(a,b){if(!a.blocksVisibility()&&!a.variable)return a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){if(!a.blocksVisibility()&&!a.isSilent(this._context))return a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){if(!a.blocksVisibility())return a},visitAtRule:function(a,b){return a.rules&&a.rules.length?this.visitAtRuleWithBody(a,b):this.visitAtRuleWithoutBody(a,b)},visitAnonymous:function(a,b){if(!a.blocksVisibility())return a.accept(this._visitor),a},visitAtRuleWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitAtRuleWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;c0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;b=0;e--)if(c=a[e],c instanceof d.Declaration)if(f[c.name]){b=f[c.name],b instanceof d.Declaration&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);b.indexOf(g)!==-1?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b={},c=[],e=0;e0){var b=a[0],c=[],e=[new d.Expression(c)];a.forEach(function(a){"+"===a.merge&&c.length>0&&e.push(new d.Expression(c=[])),c.push(a.value),b.important=b.important||a.important}),b.value=new d.Value(e)}})}}},b.exports=g},{"../tree":66,"./visitor":96}],96:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitFnCache=[],h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var c,e=this._visitFnCache,f=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=g;if(l.visitDeeper=!0,j||(c="visit"+a.type,j=f[c]||d,k=f[c+"Out"]||d,e[h]=j,e[i]=k),j!==d){var m=j.call(f,a,l);f.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=d&&k.call(f,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;ck){for(var b=0,c=h.length-j;b0||b.isFileProtocol?"development":"production");var c=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(a.location.hash);c&&(b.dumpLineNumbers=c[1]),void 0===b.useFileCache&&(b.useFileCache=!0),void 0===b.onReady&&(b.onReady=!0),b.javascriptEnabled=!(!b.javascriptEnabled&&!b.inlineJavaScript)}},{"./browser":3,"./utils":11}],2:[function(a,b,c){function d(a){a.filename&&console.warn(a),e.async||h.removeChild(i)}a("promise/polyfill");var e=a("../less/default-options")();if(window.less)for(key in window.less)window.less.hasOwnProperty(key)&&(e[key]=window.less[key]);a("./add-default-options")(window,e),e.plugins=e.plugins||[],window.LESS_PLUGINS&&(e.plugins=e.plugins.concat(window.LESS_PLUGINS));var f=b.exports=a("./index")(window,e);window.less=f;var g,h,i;e.onReady&&(/!watch/.test(window.location.hash)&&f.watch(),e.async||(g="body { display: none !important }",h=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),i.type="text/css",i.styleSheet?i.styleSheet.cssText=g:i.appendChild(document.createTextNode(g)),h.appendChild(i)),f.registerStylesheetsImmediately(),f.pageLoadFinished=f.refresh("development"===f.env).then(d,d))},{"../less/default-options":16,"./add-default-options":1,"./index":8,"promise/polyfill":100}],3:[function(a,b,c){var d=a("./utils");b.exports={createCSS:function(a,b,c){var e=c.href||"",f="less:"+(c.title||d.extractId(e)),g=a.getElementById(f),h=!1,i=a.createElement("style");i.setAttribute("type","text/css"),c.media&&i.setAttribute("media",c.media),i.id=f,i.styleSheet||(i.appendChild(a.createTextNode(b)),h=null!==g&&g.childNodes.length>0&&i.childNodes.length>0&&g.firstChild.nodeValue===i.firstChild.nodeValue);var j=a.getElementsByTagName("head")[0];if(null===g||h===!1){var k=c&&c.nextSibling||null;k?k.parentNode.insertBefore(i,k):j.appendChild(i)}if(g&&h===!1&&g.parentNode.removeChild(g),i.styleSheet)try{i.styleSheet.cssText=b}catch(l){throw new Error("Couldn't reassign styleSheet.cssText.")}},currentScript:function(a){var b=a.document;return b.currentScript||function(){var a=b.getElementsByTagName("script");return a[a.length-1]}()}}},{"./utils":11}],4:[function(a,b,c){b.exports=function(a,b,c){var d=null;if("development"!==b.env)try{d="undefined"==typeof a.localStorage?null:a.localStorage}catch(e){}return{setCSS:function(a,b,e,f){if(d){c.info("saving "+a+" to cache.");try{d.setItem(a,f),d.setItem(a+":timestamp",b),e&&d.setItem(a+":vars",JSON.stringify(e))}catch(g){c.error('failed to save "'+a+'" to local storage for caching.')}}},getCSS:function(a,b,c){var e=d&&d.getItem(a),f=d&&d.getItem(a+":timestamp"),g=d&&d.getItem(a+":vars");if(c=c||{},f&&b.lastModified&&new Date(b.lastModified).valueOf()===new Date(f).valueOf()&&(!c&&!g||JSON.stringify(c)===g))return e}}}},{}],5:[function(a,b,c){var d=a("./utils"),e=a("./browser");b.exports=function(a,b,c){function f(b,f){var g,h,i="less-error-message:"+d.extractId(f||""),j='
    • {content}
    • ',k=a.document.createElement("div"),l=[],m=b.filename||f,n=m.match(/([^\/]+(\?.*)?)$/)[1];k.id=i,k.className="less-error-message",h="

      "+(b.type||"Syntax")+"Error: "+(b.message||"There is an error in your .less file")+'

      in '+n+" ";var o=function(a,b,c){void 0!==a.extract[b]&&l.push(j.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};b.line&&(o(b,0,""),o(b,1,"line"),o(b,2,""),h+="on line "+b.line+", column "+(b.column+1)+":

        "+l.join("")+"
      "),b.stack&&(b.extract||c.logLevel>=4)&&(h+="
      Stack Trace
      "+b.stack.split("\n").slice(1).join("
      ")),k.innerHTML=h,e.createCSS(a.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),k.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===c.env&&(g=setInterval(function(){var b=a.document,c=b.body;c&&(b.getElementById(i)?c.replaceChild(k,b.getElementById(i)):c.insertBefore(k,c.firstChild),clearInterval(g))},10))}function g(b){var c=a.document.getElementById("less-error-message:"+d.extractId(b));c&&c.parentNode.removeChild(c)}function h(a){}function i(a){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?h(a):"function"==typeof c.errorReporting&&c.errorReporting("remove",a):g(a)}function j(a,d){var e="{line} {content}",f=a.filename||d,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f,i=function(a,b,c){void 0!==a.extract[b]&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.line&&(i(a,0,""),i(a,1,"line"),i(a,2,""),h+=" on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")),a.stack&&(a.extract||c.logLevel>=4)&&(h+="\nStack Trace\n"+a.stack),b.logger.error(h)}function k(a,b){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?j(a,b):"function"==typeof c.errorReporting&&c.errorReporting("add",a,b):f(a,b)}return{add:k,remove:i}}},{"./browser":3,"./utils":11}],6:[function(a,b,c){b.exports=function(b,c){var d=a("../less/environment/abstract-file-manager.js"),e={},f=function(){};return f.prototype=new d,f.prototype.alwaysMakePathsAbsolute=function(){return!0},f.prototype.join=function(a,b){return a?this.extractUrlParts(b,a).path:b},f.prototype.doXHR=function(a,d,e,f){function g(b,c,d){b.status>=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var h=new XMLHttpRequest,i=!b.isFileProtocol||b.fileAsync;"function"==typeof h.overrideMimeType&&h.overrideMimeType("text/css"),c.debug("XHR: Getting '"+a+"'"),h.open("GET",a,i),h.setRequestHeader("Accept",d||"text/x-less, text/css; q=0.9, */*; q=0.5"),h.send(null),b.isFileProtocol&&!b.fileAsync?0===h.status||h.status>=200&&h.status<300?e(h.responseText):f(h.status,a):i?h.onreadystatechange=function(){4==h.readyState&&g(h,e,f)}:g(h,e,f)},f.prototype.supports=function(a,b,c,d){return!0},f.prototype.clearFileCache=function(){e={}},f.prototype.loadFile=function(a,b,c,d){b&&!this.isPathAbsolute(a)&&(a=b+a),a=c.ext?this.tryAppendExtension(a,c.ext):a,c=c||{};var f=this.extractUrlParts(a,window.location.href),g=f.url,h=this;return new Promise(function(a,b){if(c.useFileCache&&e[g])try{var d=e[g];return a({contents:d,filename:g,webInfo:{lastModified:new Date}})}catch(f){return b({filename:g,message:"Error loading file "+g+" error was "+f.message})}h.doXHR(g,c.mime,function(b,c){e[g]=b,a({contents:b,filename:g,webInfo:{lastModified:c}})},function(a,c){b({type:"File",message:"'"+c+"' wasn't found ("+a+")",href:g})})})},f}},{"../less/environment/abstract-file-manager.js":17}],7:[function(a,b,c){b.exports=function(){function b(){throw{type:"Runtime",message:"Image size functions are not supported in browser version of less"}}var c=a("./../less/functions/function-registry"),d={"image-size":function(a){return b(this,a),-1},"image-width":function(a){return b(this,a),-1},"image-height":function(a){return b(this,a),-1}};c.addMultiple(d)}},{"./../less/functions/function-registry":26}],8:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(b,c){function f(a){return JSON.parse(JSON.stringify(a||{}))}function g(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}}function h(a){for(var b,d=l.getElementsByTagName("style"),e=0;e=c&&console.log(a)},info:function(a){b.logLevel>=d&&console.log(a)},warn:function(a){b.logLevel>=e&&console.warn(a)},error:function(a){b.logLevel>=f&&console.error(a)}}]);for(var g=0;g0&&(a=a.slice(0,b)),b=a.lastIndexOf("/"),b<0&&(b=a.lastIndexOf("\\")),b<0?"":a.slice(0,b+1)},d.prototype.tryAppendExtension=function(a,b){return/(\.[a-z]*$)|([\?;].*)$/.test(a)?a:a+b},d.prototype.tryAppendLessExtension=function(a){return this.tryAppendExtension(a,".less")},d.prototype.supportsSync=function(){return!1},d.prototype.alwaysMakePathsAbsolute=function(){return!1},d.prototype.isPathAbsolute=function(a){return/^(?:[a-z-]+:|\/|\\|#)/i.test(a)},d.prototype.join=function(a,b){return a?a+b:b},d.prototype.pathDiff=function(a,b){var c,d,e,f,g=this.extractUrlParts(a),h=this.extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;cparseInt(b[c])?-1:1;return 0},g.prototype.versionToString=function(a){for(var b="",c=0;c=0;h--){var i=g[h];if(i[f?"supportsSync":"supports"](a,b,c,e))return i}return null},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},b.exports=e},{"../logger":37}],20:[function(a,b,c){var d=a("./function-registry"),e=a("../tree/anonymous"),f=a("../tree/keyword");d.addMultiple({"boolean":function(a){return a?f.True:f.False},"if":function(a,b,c){return a?b:c||new e}})},{"../tree/anonymous":48,"../tree/keyword":68,"./function-registry":26}],21:[function(a,b,c){function d(a,b,c){var d,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;l<3;l++)d=b.rgb[l]/255,f=c.rgb[l]/255,h=a(d,f),g&&(h=(j*f+i*(d-j*(d+f-h)))/g),k[l]=255*h;return new e(k,g)}var e=a("../tree/color"),f=a("./function-registry"),g={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,a<=1?g.multiply(a,b):g.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return g.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};for(var h in g)g.hasOwnProperty(h)&&(d[h]=d.bind(null,g[h]));f.addMultiple(d)},{"../tree/color":53,"./function-registry":26}],22:[function(a,b,c){function d(a){return Math.min(1,Math.max(0,a))}function e(a){return h.hsla(a.h,a.s,a.l,a.a)}function f(a){if(a instanceof i)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{type:"Argument",message:"color functions take numbers as parameters"}}function g(a,b){return a instanceof i&&a.unit.is("%")?parseFloat(a.value*b/100):f(a)}var h,i=a("../tree/dimension"),j=a("../tree/color"),k=a("../tree/quoted"),l=a("../tree/anonymous"),m=a("./function-registry");h={rgb:function(a,b,c){return h.rgba(a,b,c,1)},rgba:function(a,b,c,d){var e=[a,b,c].map(function(a){return g(a,255)});return d=f(d),new j(e,d)},hsl:function(a,b,c){return h.hsla(a,b,c,1)},hsla:function(a,b,c,e){function g(a){return a=a<0?a+1:a>1?a-1:a,6*a<1?i+(j-i)*a*6:2*a<1?j:3*a<2?i+(j-i)*(2/3-a)*6:i}var i,j;return a=f(a)%360/360,b=d(f(b)),c=d(f(c)),e=d(f(e)),j=c<=.5?c*(b+1):c+b-c*b,i=2*c-j,h.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),e)},hsv:function(a,b,c){return h.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=f(a)%360/360*360,b=f(b),c=f(c),d=f(d);var e,g;e=Math.floor(a/60%6),g=a/60-e;var i=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],j=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return h.rgba(255*i[j[e][0]],255*i[j[e][1]],255*i[j[e][2]],d)},hue:function(a){return new i(a.toHSL().h)},saturation:function(a){return new i(100*a.toHSL().s,"%")},lightness:function(a){return new i(100*a.toHSL().l,"%")},hsvhue:function(a){return new i(a.toHSV().h)},hsvsaturation:function(a){return new i(100*a.toHSV().s,"%")},hsvvalue:function(a){return new i(100*a.toHSV().v,"%")},red:function(a){return new i(a.rgb[0])},green:function(a){return new i(a.rgb[1])},blue:function(a){return new i(a.rgb[2])},alpha:function(a){return new i(a.toHSL().a)},luma:function(a){return new i(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new i(b*a.alpha*100,"%")},saturate:function(a,b,c){if(!a.rgb)return null;var f=a.toHSL();return f.s+="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},desaturate:function(a,b,c){var f=a.toHSL();return f.s-="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},lighten:function(a,b,c){var f=a.toHSL();return f.l+="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},darken:function(a,b,c){var f=a.toHSL();return f.l-="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},fadein:function(a,b,c){var f=a.toHSL();return f.a+="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fadeout:function(a,b,c){var f=a.toHSL();return f.a-="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=d(c.a),e(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=d<0?360+d:d,e(c)},mix:function(a,b,c){a.toHSL&&b.toHSL||(console.log(b.type),console.dir(b)),c||(c=new i(50));var d=c.value/100,e=2*d-1,f=a.toHSL().a-b.toHSL().a,g=((e*f==-1?e:(e+f)/(1+e*f))+1)/2,h=1-g,k=[a.rgb[0]*g+b.rgb[0]*h,a.rgb[1]*g+b.rgb[1]*h,a.rgb[2]*g+b.rgb[2]*h],l=a.alpha*d+b.alpha*(1-d);return new j(k,l)},greyscale:function(a){return h.desaturate(a,new i(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;if("undefined"==typeof c&&(c=h.rgba(255,255,255,1)),"undefined"==typeof b&&(b=h.rgba(0,0,0,1)),b.luma()>c.luma()){var e=c;c=b,b=e}return d="undefined"==typeof d?.43:f(d),a.luma()=v&&this.context.ieCompat!==!1?(h.warn("Skipped data-uri embedding of "+j+" because its size ("+u.length+" characters) exceeds IE8-safe "+v+" characters!"),g(this,f||a)):new d(new c('"'+u+'"',u,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../logger":37,"../tree/quoted":77,"../tree/url":82,"../utils":86,"./function-registry":26}],24:[function(a,b,c){var d=a("../tree/keyword"),e=a("./function-registry"),f={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;if(null!=a)return a?d.True:d.False},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}};e.add("default",f.eval.bind(f)),b.exports=f},{"../tree/keyword":68,"./function-registry":26}],25:[function(a,b,c){var d=a("../tree/expression"),e=function(a,b,c,d){this.name=a.toLowerCase(),this.index=c,this.context=b,this.currentFileInfo=d,this.func=b.frames[0].functionRegistry.get(this.name)};e.prototype.isValid=function(){return Boolean(this.func)},e.prototype.call=function(a){return Array.isArray(a)&&(a=a.filter(function(a){return"Comment"!==a.type}).map(function(a){if("Expression"===a.type){var b=a.value.filter(function(a){return"Comment"!==a.type});return 1===b.length?b[0]:new d(b)}return a})),this.func.apply(this,a)},b.exports=e},{"../tree/expression":62}],26:[function(a,b,c){function d(a){return{_data:{},add:function(a,b){a=a.toLowerCase(),this._data.hasOwnProperty(a),this._data[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){this.add(b,a[b])}.bind(this))},get:function(b){return this._data[b]||a&&a.get(b)},getLocalFunctions:function(){return this._data},inherit:function(){return d(this)},create:function(a){return d(a)}}}b.exports=d(null)},{}],27:[function(a,b,c){b.exports=function(b){var c={functionRegistry:a("./function-registry"),functionCaller:a("./function-caller")};return a("./boolean"),a("./default"),a("./color"),a("./color-blending"),a("./data-uri")(b),a("./math"),a("./number"),a("./string"),a("./svg")(b),a("./types"),c}},{"./boolean":20,"./color":22,"./color-blending":21,"./data-uri":23,"./default":24,"./function-caller":25,"./function-registry":26,"./math":29,"./number":30,"./string":31,"./svg":32,"./types":33}],28:[function(a,b,c){var d=a("../tree/dimension"),e=function(){};e._math=function(a,b,c){if(!(c instanceof d))throw{type:"Argument",message:"argument must be a number" +};return null==b?b=c.unit:c=c.unify(),new d(a(parseFloat(c.value)),b)},b.exports=e},{"../tree/dimension":60}],29:[function(a,b,c){var d=a("./function-registry"),e=a("./math-helper.js"),f={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"};for(var g in f)f.hasOwnProperty(g)&&(f[g]=e._math.bind(null,Math[g],f[g]));f.round=function(a,b){var c="undefined"==typeof b?0:b.value;return e._math(function(a){return a.toFixed(c)},null,a)},d.addMultiple(f)},{"./function-registry":26,"./math-helper.js":28}],30:[function(a,b,c){var d=a("../tree/dimension"),e=a("../tree/anonymous"),f=a("./function-registry"),g=a("./math-helper.js"),h=function(a,b){switch(b=Array.prototype.slice.call(b),b.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var c,f,g,h,i,j,k,l,m=[],n={};for(c=0;ci.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(b[c].value)&&Array.prototype.push.apply(b,Array.prototype.slice.call(b[c].value));return 1==m.length?m[0]:(b=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new e((a?"min":"max")+"("+b+")"))};f.addMultiple({min:function(){return h(!0,arguments)},max:function(){return h(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new d(Math.PI)},mod:function(a,b){return new d(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d(a),b=new d(b);else if(!(a instanceof d&&b instanceof d))throw{type:"Argument",message:"arguments must be numbers"};return new d(Math.pow(a.value,b.value),a.unit)},percentage:function(a){var b=g._math(function(a){return 100*a},"%",a);return b}})},{"../tree/anonymous":48,"../tree/dimension":60,"./function-registry":26,"./math-helper.js":28}],31:[function(a,b,c){var d=a("../tree/quoted"),e=a("../tree/anonymous"),f=a("../tree/javascript"),g=a("./function-registry");g.addMultiple({e:function(a){return new e(a instanceof f?a.evaluated:a.value)},escape:function(a){return new e(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,b,c,e){var f=a.value;return c="Quoted"===c.type?c.value:c.toCSS(),f=f.replace(new RegExp(b.value,e?e.value:""),c),new d(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;e",k=0;k";return j+="',j=encodeURIComponent(j),j="data:image/svg+xml,"+j,new g(new f("'"+j+"'",j,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":53,"../tree/dimension":60,"../tree/expression":62,"../tree/quoted":77,"../tree/url":82,"./function-registry":26}],33:[function(a,b,c){var d=a("../tree/keyword"),e=a("../tree/detached-ruleset"),f=a("../tree/dimension"),g=a("../tree/color"),h=a("../tree/quoted"),i=a("../tree/anonymous"),j=a("../tree/url"),k=a("../tree/operation"),l=a("./function-registry"),m=function(a,b){return a instanceof b?d.True:d.False},n=function(a,b){if(void 0===b)throw{type:"Argument",message:"missing the required second argument to isunit."};if(b="string"==typeof b.value?b.value:b,"string"!=typeof b)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof f&&a.unit.is(b)?d.True:d.False},o=function(a){var b=Array.isArray(a.value)?a.value:Array(a);return b};l.addMultiple({isruleset:function(a){return m(a,e)},iscolor:function(a){return m(a,g)},isnumber:function(a){return m(a,f)},isstring:function(a){return m(a,h)},iskeyword:function(a){return m(a,d)},isurl:function(a){return m(a,j)},ispixel:function(a){return n(a,"px")},ispercentage:function(a){return n(a,"%")},isem:function(a){return n(a,"em")},isunit:n,unit:function(a,b){if(!(a instanceof f))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof k?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d?b.value:b.toCSS():"",new f(a.value,b)},"get-unit":function(a){return new i(a.unit)},extract:function(a,b){return b=b.value-1,o(a)[b]},length:function(a){return new f(o(a).length)}})},{"../tree/anonymous":48,"../tree/color":53,"../tree/detached-ruleset":59,"../tree/dimension":60,"../tree/keyword":68,"../tree/operation":74,"../tree/quoted":77,"../tree/url":82,"./function-registry":26}],34:[function(a,b,c){var d=a("./contexts"),e=a("./parser/parser"),f=a("./less-error"),g=a("./utils");"undefined"==typeof Promise?a("promise"):Promise;b.exports=function(a){var b=function(a,b,c){this.less=a,this.rootFilename=c.filename,this.paths=b.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=b.mime,this.error=null,this.context=b,this.queue=[],this.files={}};return b.prototype.push=function(b,c,h,i,j){var k=this,l=this.context.pluginManager.Loader;this.queue.push(b);var m=function(a,c,d){k.queue.splice(k.queue.indexOf(b),1);var e=d===k.rootFilename;i.optional&&a?j(null,{rules:[]},!1,null):(k.files[d]||(k.files[d]={root:c,options:i}),a&&!k.error&&(k.error=a),j(a,c,e,d))},n={relativeUrls:this.context.relativeUrls,entryPath:h.entryPath,rootpath:h.rootpath,rootFilename:h.rootFilename},o=a.getFileManager(b,h.currentDirectory,this.context,a);if(!o)return void m({message:"Could not find a file-manager for "+b});var p,q=function(a){var b,c=a.filename,g=a.contents.replace(/^\uFEFF/,"");n.currentDirectory=o.getPath(c),n.relativeUrls&&(n.rootpath=o.join(k.context.rootpath||"",o.pathDiff(n.currentDirectory,n.entryPath)),!o.isPathAbsolute(n.rootpath)&&o.alwaysMakePathsAbsolute()&&(n.rootpath=o.join(n.entryPath,n.rootpath))),n.filename=c;var j=new d.Parse(k.context);j.processImports=!1,k.contents[c]=g,(h.reference||i.reference)&&(n.reference=!0),i.isPlugin?(b=l.evalPlugin(g,j,k,i.pluginArgs,n),b instanceof f?m(b,null,c):m(null,b,c)):i.inline?m(null,g,c):!k.files[c]||k.files[c].options.multiple||i.multiple?new e(j,k,n).parse(g,function(a,b){m(a,b,c)}):m(null,k.files[c].root,c)},r=g.clone(this.context);c&&(r.ext=i.isPlugin?".js":".less"),p=i.isPlugin?l.loadPlugin(b,h.currentDirectory,r,a,o):o.loadFile(b,h.currentDirectory,r,a,function(a,b){a?m(a):q(b)}),p&&p.then(q,m)},b}},{"./contexts":12,"./less-error":36,"./parser/parser":42,"./utils":86,promise:void 0}],35:[function(a,b,c){b.exports=function(b,c){var d,e,f,g,h,i,j={version:[3,0,0],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),AbstractPluginLoader:a("./environment/abstract-plugin-loader"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")},k=function(a){return function(){var b=Object.create(a.prototype);return a.apply(b,Array.prototype.slice.call(arguments,0)),b}},l=Object.create(j);for(var m in j.tree)if(i=j.tree[m],"function"==typeof i)l[m.toLowerCase()]=k(i);else{l[m]=Object.create(null);for(var n in i)l[m][n.toLowerCase()]=k(i[n])}return l}},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":17,"./environment/abstract-plugin-loader":18,"./environment/environment":19,"./functions":27,"./import-manager":34,"./less-error":36,"./logger":37,"./parse":39,"./parse-tree":38,"./parser/parser":42,"./plugin-manager":43,"./render":44,"./source-map-builder":45,"./source-map-output":46,"./transform-tree":47,"./tree":65,"./utils":86,"./visitors":90}],36:[function(a,b,c){var d=a("./utils"),e=b.exports=function(a,b,c){Error.call(this);var e=a.filename||c;if(this.message=a.message,this.stack=a.stack,b&&e){var f=b.contents[e],g=d.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&d.getLocation(a.call,f).line,k=f.split("\n");if(this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.column=i,!this.line&&this.stack){var l=this.stack.match(/(|Function):(\d+):(\d+)/);l&&(l[2]&&(this.line=parseInt(l[2])-2),l[3]&&(this.column=parseInt(l[3])))}this.callLine=j+1,this.callExtract=k[j],this.extract=[k[this.line-2],k[this.line-1],k[this.line]]}};if("undefined"==typeof Object.create){var f=function(){};f.prototype=Error.prototype,e.prototype=new f}else e.prototype=Object.create(Error.prototype);e.prototype.constructor=e,e.prototype.toString=function(a){a=a||{};var b="",c=this.extract||[],d=[],e=function(a){return a};if(a.stylize){var f=typeof a.stylize;if("function"!==f)throw Error("options.stylize should be a function, got a "+f+"!");e=a.stylize}if(null!==this.line){if("string"==typeof c[0]&&d.push(e(this.line-1+" "+c[0],"grey")),"string"==typeof c[1]){var g=this.line+" ";c[1]&&(g+=c[1].slice(0,this.column)+e(e(e(c[1].substr(this.column,1),"bold")+c[1].slice(this.column+1),"red"),"inverse")),d.push(g)}"string"==typeof c[2]&&d.push(e(this.line+1+" "+c[2],"grey")),d=d.join("\n")+e("","reset")+"\n"}return b+=e(this.type+"Error: "+this.message,"red"),this.filename&&(b+=e(" in ","red")+this.filename),this.line&&(b+=e(" on line "+this.line+", column "+(this.column+1)+":","grey")),b+="\n"+d,this.callLine&&(b+=e("from ","red")+(this.filename||"")+"/n",b+=e(this.callLine,"grey")+" "+this.callExtract+"/n"),b}},{"./utils":86}],37:[function(a,b,c){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;b=97&&j<=122||j<34))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(h96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;hd&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],41:[function(a,b,c){var d=a("./chunker");b.exports=function(){function a(d){for(var e,f,j,p=k.i,q=c,s=k.i-i,t=k.i+h.length-s,u=k.i+=d,v=b;k.i=0){j={index:k.i,text:v.substr(k.i,x+2-k.i),isLineComment:!1},k.i+=j.text.length-1,k.commentStore.push(j);continue}}break}if(e!==l&&e!==n&&e!==m&&e!==o)break}if(h=h.slice(d+k.i-u+s),i=k.i,!h.length){if(ce||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,c=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$re=function(b){k.i>i&&(h=h.slice(k.i-i),i=k.i);var c=b.exec(h);return c?(a(c[0].length),"string"==typeof c?c:1===c.length?c[0]:c):null},k.$char=function(c){return b.charAt(k.i)!==c?null:(a(1),c)},k.$str=function(c){for(var d=c.length,e=0;es||a=b.length;return k.i=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":40}],42:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=a("../functions/function-registry"),j=function k(a,b,c){function j(a,e){throw new d({index:q.i,filename:c.filename,type:e||"Syntax",message:a},b)}function l(a,b,c){var d=a instanceof Function?a.call(p):q.$re(a);return d?d:void j(b||("string"==typeof a?"expected '"+a+"' got '"+q.currentChar()+"'":"unexpected token"))}function m(a,b){return q.$char(a)?a:void j(b||"expected '"+a+"' got '"+q.currentChar()+"'")}function n(a){var b=c.filename;return{lineNumber:h.getLocation(a,q.getInput()).line+1,fileName:b}}function o(a,c,e,f,g){var h,i=[],j=q;try{j.start(a,!1,function(a,b){g({message:a,index:b+e})});for(var k,l,m=0;k=c[m];m++)l=j.i,h=p[k](),h?(h._index=l+e,h._fileInfo=f,i.push(h)):i.push(null);var n=j.end();n.isFinished?g(null,i):g(!0,null)}catch(o){throw new d({index:o.index+e,message:o.message},b,f.filename)}}var p,q=g();return{parserInput:q,imports:b,fileInfo:c,parseNode:o,parse:function(g,h,j){var l,m,n,o,p=null,r="";if(m=j&&j.globalVars?k.serializeVars(j.globalVars)+"\n":"",n=j&&j.modifyVars?"\n"+k.serializeVars(j.modifyVars):"",a.pluginManager)for(var s=a.pluginManager.getPreProcessors(),t=0;t")}return b&&(q.$char("(")&&(h=this.args(!0).args,m(")")),p.important()&&(j=!0),p.end())?(q.forget(),new e.mixin.Call(b,h,k,c,j)):void q.restore()}},args:function(a){var b,c,d,f,g,h,i,k=p.entities,l={args:null,variadic:!1},m=[],n=[],o=[];for(q.save();;){if(a)h=p.detachedRuleset()||p.expression();else{if(q.commentStore.length=0,q.$str("...")){l.variadic=!0,q.$char(";")&&!b&&(b=!0),(b?n:o).push({variadic:!0});break}h=k.variable()||k.property()||k.literal()||k.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var r=null;if(a?h.value&&1==h.value.length&&(r=h.value[0]):r=h,r&&(r instanceof e.Variable||r instanceof e.Property))if(q.$char(":")){if(m.length>0&&(b&&j("Cannot mix ; and , as delimiter types"),c=!0),g=p.detachedRuleset()||p.expression(),!g){if(!a)return q.restore(),l.args=[],l;j("could not understand value for named argument")}f=d=r.name}else if(q.$str("...")){if(!a){l.variadic=!0,q.$char(";")&&!b&&(b=!0),(b?n:o).push({name:h.name,variadic:!0});break}i=!0}else a||(d=f=r.name,g=null);g&&m.push(g),o.push({name:f,value:g,expand:i}),q.$char(",")||(q.$char(";")||b)&&(c&&j("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),n.push({name:d,value:g,expand:i}),d=null,m=[],c=!1)}return q.forget(),l.args=b?n:o,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==q.currentChar()&&"#"!==q.currentChar()||q.peek(/^[^{]*\}/)))if(q.save(),b=q.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!q.$char(")"))return void q.restore("Missing closing ')'");if(q.commentStore.length=0,q.$str("when")&&(d=l(p.conditions,"expected condition")),c=p.block())return q.forget(),new e.mixin.Definition(a,f,c,d,g);q.restore()}else q.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.property()||a.call()||a.keyword()||a.javascript()},end:function(){return q.$char(";")||q.peek("}")},ieAlpha:function(){var a;if(q.$re(/^opacity=/i))return a=q.$re(/^\d+/),a||(a=l(p.entities.variable,"Could not parse alpha"),a="@{"+a.name.slice(1)+"}"),m(")"),new e.Quoted("","alpha(opacity="+a+")")},element:function(){var a,b,d,f=q.i;if(b=this.combinator(),a=q.$re(/^(?:\d+\.\d+|\d+)%/)||q.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||q.$char("*")||q.$char("&")||this.attribute()||q.$re(/^\([^&()@]+\)/)||q.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(q.save(),q.$char("(")?(d=this.selector(!1))&&q.$char(")")?(a=new e.Paren(d),q.forget()):q.restore("Missing closing ')'"):q.forget()),a)return new e.Element(b,a,f,c)},combinator:function(){var a=q.currentChar();if("/"===a){q.save();var b=q.$re(/^\/[a-z]+\//i);if(b)return q.forget(),new e.Combinator(b);q.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(q.i++,"^"===a&&"^"===q.currentChar()&&(a="^^",q.i++);q.isWhitespace();)q.i++;return new e.Combinator(a)}return new e.Combinator(q.isWhitespace(-1)?" ":null)},selector:function(a){var b,d,f,g,h,i,k,m=q.i;for(a=a!==!1;(a&&(d=this.extend())||a&&(i=q.$str("when"))||(g=this.element()))&&(i?k=l(this.conditions,"expected condition"):k?j("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&j("Extend can only be used at the end of selector"),f=q.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,k,m,c):void(h&&j("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(q.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=l(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=q.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||q.$re(/^[0-9]+%/)||q.$re(/^[\w-]+/)||d.variableCurly()),m("]"),new e.Attribute(a,c,b)}},block:function(){var a;if(q.$char("{")&&(a=this.primary())&&q.$char("}"))return a},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();if(a)return new e.DetachedRuleset(a)},ruleset:function(){var b,c,d,f;for(q.save(),a.dumpLineNumbers&&(f=n(q.i));;){if(c=this.selector(),!c)break;if(b?b.push(c):b=[c],q.commentStore.length=0,c.condition&&b.length>1&&j("Guards are only currently allowed on a single selector."),!q.$char(","))break;c.condition&&j("Guards are only currently allowed on a single selector."),q.commentStore.length=0}if(b&&(d=this.block())){q.forget();var g=new e.Ruleset(b,d,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}q.restore()},declaration:function(){var a,b,d,f,g,h=q.i,i=q.currentChar();if("."!==i&&"#"!==i&&"&"!==i&&":"!==i)if(q.save(),a=this.variable()||this.ruleProperty()){if(g="string"==typeof a,g&&(b=this.detachedRuleset()),q.commentStore.length=0,!b){if(f=!g&&a.length>1&&a.pop().value,b=this.anonymousValue())return q.forget(),new e.Declaration(a,b,(!1),f,h,c);b||(b=this.value()),d=this.important()}if(b&&this.end())return q.forget(),new e.Declaration(a,b,d,f,h,c);q.restore()}else q.restore()},anonymousValue:function(){var a=q.i,b=q.$re(/^([^@\$+\/'"*`(;{}-]*);/);if(b)return new e.Anonymous(b[1],a)},"import":function(){var a,b,d=q.i,f=q.$re(/^@import?\s+/);if(f){var g=(f?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),q.$char(";")||(q.i=d,j("missing semi-colon or unrecognised media features on import")),b=b&&new e.Value(b),new e.Import(a,b,g,d,c);q.i=d,j("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!q.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!q.$char(","))break}while(a);return m(")"),d},importOption:function(){var a=q.$re(/^(less|css|multiple|once|inline|reference|optional)/);if(a)return a[1]},mediaFeature:function(){var a,b,d=this.entities,f=[];q.save();do a=d.keyword()||d.variable(),a?f.push(a):q.$char("(")&&(b=this.property(),a=this.value(),q.$char(")")?b&&a?f.push(new e.Paren(new e.Declaration(b,a,null,null,q.i,c,(!0)))):a?f.push(new e.Paren(a)):j("badly formed media feature definition"):j("Missing closing ')'","Parse"));while(a);if(q.forget(),f.length>0)return new e.Expression(f)},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!q.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!q.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=q.i;return a.dumpLineNumbers&&(g=n(h)),q.save(),q.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||j("media definitions require block statements after any features"),q.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void q.restore()},plugin:function(){var a,b,d,f=q.i,g=q.$re(/^@plugin?\s+/);if(g){ +if(b=this.pluginArgs(),d=b?{pluginArgs:b,isPlugin:!0}:{isPlugin:!0},a=this.entities.quoted()||this.entities.url())return q.$char(";")||(q.i=f,j("missing semi-colon on @plugin")),new e.Import(a,null,d,f,c);q.i=f,j("malformed @plugin statement")}},pluginArgs:function(){if(q.save(),!q.$char("("))return q.restore(),null;var a=q.$re(/^\s*([^\);]+)\)\s*/);return a[1]?(q.forget(),a[1].trim()):(q.restore(),null)},atrule:function(){var b,d,f,g,h,i,k,l=q.i,m=!0,o=!0;if("@"===q.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(q.save(),b=q.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,m=!1;break;case"@namespace":i=!0,m=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,o=!1;break;default:k=!0}return q.commentStore.length=0,h?(d=this.entity(),d||j("expected "+b+" identifier")):i?(d=this.expression(),d||j("expected "+b+" expression")):k&&(d=(q.$re(/^[^{;]+/)||"").trim(),m="{"==q.currentChar(),d&&(d=new e.Anonymous(d))),m&&(f=this.blockRuleset()),f||!m&&d&&q.$char(";")?(q.forget(),new e.AtRule(b,d,f,l,c,a.dumpLineNumbers?n(l):null,o)):void q.restore("at-rule options not recognised")}}},value:function(){var a,b=[],c=q.i;do if(a=this.expression(),a&&(b.push(a),!q.$char(",")))break;while(a);if(b.length>0)return new e.Value(b,c)},important:function(){if("!"===q.currentChar())return q.$re(/^! *important/)},sub:function(){var a,b;return q.save(),q.$char("(")?(a=this.addition(),a&&q.$char(")")?(q.forget(),b=new e.Expression([a]),b.parens=!0,b):void q.restore("Expected ')'")):void q.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=q.isWhitespace(-1);;){if(q.peek(/^\/[*\/]/))break;if(q.save(),c=q.$char("/")||q.$char("*"),!c){q.forget();break}if(b=this.operand(),!b){q.restore();break}q.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=q.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=q.isWhitespace(-1);;){if(c=q.$re(/^[-+]\s+/)||!f&&(q.$char("+")||q.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=q.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=q.i;if(a=this.condition()){for(;;){if(!q.peek(/^,\s*(not\s*)?\(/)||!q.$char(","))break;if(b=this.condition(),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(){function a(){return q.$str("or")}var b,c,d;if(b=this.conditionAnd(this)){if(c=a()){if(d=this.condition(),!d)return;b=new e.Condition(c,b,d)}return b}},conditionAnd:function(){function a(a){return a.negatedCondition()||a.parenthesisCondition()}function b(){return q.$str("and")}var c,d,f;if(c=a(this)){if(d=b()){if(f=this.conditionAnd(),!f)return;c=new e.Condition(d,c,f)}return c}},negatedCondition:function(){if(q.$str("not")){var a=this.parenthesisCondition();return a&&(a.negate=!a.negate),a}},parenthesisCondition:function(){function a(a){var b;return q.save(),(b=a.condition())&&q.$char(")")?(q.forget(),b):void q.restore()}var b;return q.save(),q.$str("(")?(b=a(this))?(q.forget(),b):(b=this.atomicCondition())?q.$char(")")?(q.forget(),b):void q.restore("expected ')' got '"+q.currentChar()+"'"):void q.restore():void q.restore()},atomicCondition:function(){var a,b,c,d,f=this.entities,g=q.i;if(a=this.addition()||f.keyword()||f.quoted())return q.$char(">")?d=q.$char("=")?">=":">":q.$char("<")?d=q.$char("=")?"<=":"<":q.$char("=")&&(d=q.$char(">")?"=>":q.$char("<")?"=<":"="),d?(b=this.addition()||f.keyword()||f.quoted(),b?c=new e.Condition(d,a,b,g,(!1)):j("expected expression")):c=new e.Condition("=",a,new e.Keyword("true"),g,(!1)),c},operand:function(){var a,b=this.entities;q.peek(/^-[@\$\(]/)&&(a=q.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.property()||b.call()||b.colorKeyword();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[],d=q.i;do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),q.peek(/^\/[\/*]/)||(b=q.$char("/"),b&&c.push(new e.Anonymous(b,d)))));while(a);if(c.length>0)return new e.Expression(c)},property:function(){var a=q.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(a)return a[1]},ruleProperty:function(){function a(a){var b=q.i,c=q.$re(a);if(c)return g.push(b),f.push(c[1])}var b,d,f=[],g=[];q.save();var h=q.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],q.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(q.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;d=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},e.prototype.addPostProcessor=function(a,b){var c;for(c=0;c=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.getPreProcessors=function(){for(var a=[],b=0;b0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],47:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Declaration("@"+a,b,(!1),null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j,k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor((!0)),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager)for(j=b.pluginManager.visitor(),j.first();i=j.get();)i.isPreEvalVisitor&&i.run(a);c=a.eval(h);for(var l=0;l.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(d="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":73}],57:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],58:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;c-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&c<1&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":15,"./color":53,"./node":73,"./unit":81}],61:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./combinator"),g=function(a,b,c,d,e){this.combinator=a instanceof f?a:new f(a),this.value="string"==typeof b?b.trim():b?b:"",this._index=c,this._fileInfo=d,this.copyVisibilityInfo(e),this.setParent(this.combinator,this)};g.prototype=new d,g.prototype.type="Element",g.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},g.prototype.eval=function(a){return new g(this.combinator,this.value.eval?this.value.eval(a):this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.fileInfo(),this.getIndex())},g.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof e&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=g},{"./combinator":54,"./node":73,"./paren":75}],62:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./comment"),g=function(a){if(this.value=a,!a)throw new Error("Expression requires an array parameter")};g.prototype=new d,g.prototype.type="Expression",g.prototype.accept=function(a){this.value=a.visitArray(this.value)},g.prototype.eval=function(a){var b,c=this.parens&&!this.parensInOp,d=!1;return c&&a.inParenthesis(),this.value.length>1?b=new g(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(d=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!d&&(b=new e(b)),b},g.prototype.genCSS=function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":73,"./selector":79}],64:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=a("../utils"),k=a("../less-error"),l=function(a,b,c,d,e,f){if(this.options=c,this._index=d,this._fileInfo=e,this.path=a,this.features=b,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f),this.setParent(this.features,this),this.setParent(this.path,this)};l.prototype=new d,l.prototype.type="Import",l.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.isPlugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},l.prototype.genCSS=function(a,b){this.css&&void 0===this.path._fileInfo.reference&&(b.add("@import ",this._fileInfo,this._index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},l.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},l.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),!(a instanceof g)||a.containsVariables()},l.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new l(b.eval(a),this.features,this.options,this._index,this._fileInfo,this.visibilityInfo())},l.prototype.evalPath=function(a){var b=this.path.eval(a),c=this._fileInfo&&this._fileInfo.rootpath;if(!(b instanceof f)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d)}b.value=a.normalizePath(b.value)}return b},l.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){a.addVisibilityBlock()}):b.addVisibilityBlock()),b},l.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a); +if(this.options.isPlugin){if(this.root&&this.root.eval)try{this.root.eval(a)}catch(f){throw f.message="Plugin error during evaluation",new k(f,this.root.imports,this.root.filename)}return c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[]}if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var g=new i(this.root,0,{filename:this.importedFilename,reference:this.path._fileInfo&&this.path._fileInfo.reference},(!0),(!0));return this.features?new e([g],this.features.value):[g]}if(this.css){var m=new l(this.evalPath(a),d,this.options,this._index);if(!m.css&&this.error)throw this.error;return m}return b=new h(null,j.copyArray(this.root.rules)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=l},{"../less-error":36,"../utils":86,"./anonymous":48,"./media":69,"./node":73,"./quoted":77,"./ruleset":78,"./url":82}],65:[function(a,b,c){var d=Object.create(null);d.Node=a("./node"),d.Color=a("./color"),d.AtRule=a("./atrule"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Property=a("./property"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Declaration=a("./declaration"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.VariableCall=a("./variable-call"),b.exports=d},{"./anonymous":48,"./assignment":49,"./atrule":50,"./attribute":51,"./call":52,"./color":53,"./combinator":54,"./comment":55,"./condition":56,"./declaration":58,"./detached-ruleset":59,"./dimension":60,"./element":61,"./expression":62,"./extend":63,"./import":64,"./javascript":66,"./keyword":68,"./media":69,"./mixin-call":70,"./mixin-definition":71,"./negative":72,"./node":73,"./operation":74,"./paren":75,"./property":76,"./quoted":77,"./ruleset":78,"./selector":79,"./unicode-descriptor":80,"./unit":81,"./url":82,"./value":83,"./variable":85,"./variable-call":84}],66:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this._index=c,this._fileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new e(b):"string"==typeof b?new f('"'+b+'"',b,this.escaped,this._index):new g(Array.isArray(b)?b.join(", "):b)},b.exports=h},{"./anonymous":48,"./dimension":60,"./js-eval-node":67,"./quoted":77}],67:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(!b.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.fileInfo().filename,index:this.getIndex()};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.getIndex(),d.fileInfo()).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.fileInfo().filename,index:this.getIndex()}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.fileInfo().filename,index:this.getIndex()}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":73,"./variable":85}],68:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":73}],69:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./atrule"),j=a("../utils"),k=function(a,b,c,g,h){this._index=c,this._fileInfo=g;var i=new f([],null,null,this._index,this._fileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0,this.setParent(i,this),this.setParent(this.features,this),this.setParent(this.rules,this)};k.prototype=new i,k.prototype.type="Media",k.prototype.isRulesetLike=function(){return!0},k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},k.prototype.genCSS=function(a,b){b.add("@media ",this._fileInfo,this._index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},k.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new k(null,[],this._index,this._fileInfo,this.visibilityInfo());return this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo),b.features=this.features.eval(a),a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},k.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo()),this.setParent(b,this)}return delete a.mediaBlocks,delete a.mediaPath,b},k.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;b0;b--)a.splice(b,0,new g("and"));return new h(a)})),this.setParent(this.features,this),new d([],[])},k.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(n=!0,k=0;k0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.getIndex(),filename:this.fileInfo().filename};for(k=0;kthis.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;gb?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],74:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};g.prototype=new d,g.prototype.type="Operation",g.prototype.accept=function(a){this.operands=a.visit(this.operands)},g.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof f&&c instanceof e&&(b=b.toColor()),c instanceof f&&b instanceof e&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new g(this.op,[b,c],this.isSpaced)},g.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=g},{"./color":53,"./dimension":60,"./node":73}],75:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":73}],76:[function(a,b,c){var d=a("./node"),e=a("./declaration"),f=function(a,b,c){this.name=a,this._index=b,this._fileInfo=c};f.prototype=new d,f.prototype.type="Property",f.prototype.eval=function(a){var b,c=this.name,d=a.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;if(this.evaluating)throw{type:"Name",message:"Recursive property reference for "+c,filename:this.fileInfo().filename,index:this.getIndex()};if(this.evaluating=!0,b=this.find(a.frames,function(b){var f,g=b.property(c);if(g){for(var h=0;hd){if(!c||c(g)){e=g.find(new i(a.elements.slice(d)),b,c);for(var j=0;j0&&b.add(k),a.firstSelector=!0,h[0].genCSS(a,b),a.firstSelector=!1,d=1;d0?(e=p.copyArray(a),f=e.pop(),g=d.createDerived(p.copyArray(f.elements))):g=d.createDerived([]),b.length>0){var h=c.combinator,i=b[0].elements[0];h.emptyOrWhitespace&&!i.combinator.emptyOrWhitespace&&(h=i.combinator),g.elements.push(new j(h,i.value,c._index,c._fileInfo)),g.elements=g.elements.concat(b[0].elements.slice(1))}if(0!==g.elements.length&&e.push(g),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function g(a,b,c,d,e){var g;for(g=0;g0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new i(a))}}function l(a,b,c){function m(a){var b;return a.value instanceof h?(b=a.value.value,b instanceof i?b:null):null}var n,o,p,q,r,s,t,u,v,w,x=!1;for(q=[],r=[[]],n=0;u=c.elements[n];n++)if("&"!==u.value){var y=m(u);if(null!=y){k(q,r);var z,A=[],B=[];for(z=l(A,b,y),x=x||z,p=0;p0&&t[0].elements.push(new j(u.combinator,"",u._index,u._fileInfo)),s.push(t);else for(p=0;p0&&(a.push(r[n]),w=r[n][v-1],r[n][v-1]=w.createDerived(w.elements,c.extendList));return x}function m(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var n,o,q;if(o=[],q=l(o,b,c),!q)if(b.length>0)for(o=[],n=0;n0)for(b=0;b=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}},copyArray:function(a){var b,c=a.length,d=new Array(c);for(b=0;b=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.fileInfo(),b),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitDeclaration:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;e0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return k0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitAtRule:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitAtRuleOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=i},{"../logger":37,"../tree":65,"../utils":86,"./visitor":94}],88:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],89:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=a("../utils"),h=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};h.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,g.copyArray(this.context.frames)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.getIndex(),f.filename=a.fileInfo().filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;h0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];if(this.keepOnlyVisibleChilds(c),!this.isEmpty(c))return a.ensureVisibility(),a.removeVisibilityBlock(),a},isVisibleRuleset:function(a){return!!a.firstRoot||!this.isEmpty(a)&&!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitDeclaration:function(a,b){if(!a.blocksVisibility()&&!a.variable)return a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){if(!a.blocksVisibility()&&!a.isSilent(this._context))return a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){if(!a.blocksVisibility())return a},visitAtRule:function(a,b){return a.rules&&a.rules.length?this.visitAtRuleWithBody(a,b):this.visitAtRuleWithoutBody(a,b)},visitAnonymous:function(a,b){if(!a.blocksVisibility())return a.accept(this._visitor),a},visitAtRuleWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitAtRuleWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;c0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;b=0;e--)if(c=a[e],c instanceof d.Declaration)if(f[c.name]){b=f[c.name],b instanceof d.Declaration&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);b.indexOf(g)!==-1?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b={},c=[],e=0;e0){var b=a[0],c=[],e=[new d.Expression(c)];a.forEach(function(a){"+"===a.merge&&c.length>0&&e.push(new d.Expression(c=[])),c.push(a.value),b.important=b.important||a.important}),b.value=new d.Value(e)}})}}},b.exports=g},{"../tree":65,"./visitor":94}],94:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitFnCache=[],h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var c,e=this._visitFnCache,f=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=g;if(l.visitDeeper=!0,j||(c="visit"+a.type,j=f[c]||d,k=f[c+"Out"]||d,e[h]=j,e[i]=k),j!==d){var m=j.call(f,a,l);f.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=d&&k.call(f,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;ck){for(var b=0,c=h.length-j;b Date: Sat, 10 Feb 2018 16:57:53 -0800 Subject: [PATCH 97/97] calc() fix - fixes #974 (partially #1880) --- dist/less.js | 23 +++++++++++++++----- dist/less.min.js | 10 ++++----- lib/less/contexts.js | 4 ++++ lib/less/parser/parser.js | 3 ++- lib/less/tree/call.js | 13 +++++++++-- lib/less/tree/directive.js | 12 ---------- lib/less/tree/quoted.js | 1 - lib/less/tree/rule.js | 12 ---------- test/browser/runner-browser-options.js | 2 +- test/browser/runner-main-options.js | 1 - test/css/calc.css | 5 +++++ test/css/comments2.css | 2 +- test/css/{ => strict-math}/css.css | 0 test/css/{ => strict-math}/mixins-args.css | 0 test/css/{ => strict-math}/parens.css | 0 test/index.js | 8 +++++-- test/less/calc.less | 7 ++++++ test/less/media.less | 4 ++-- test/less/{ => strict-math}/css.less | 0 test/less/{ => strict-math}/mixins-args.less | 0 test/less/{ => strict-math}/parens.less | 0 21 files changed, 62 insertions(+), 45 deletions(-) delete mode 100644 lib/less/tree/directive.js delete mode 100644 lib/less/tree/rule.js create mode 100644 test/css/calc.css rename test/css/{ => strict-math}/css.css (100%) rename test/css/{ => strict-math}/mixins-args.css (100%) rename test/css/{ => strict-math}/parens.css (100%) create mode 100644 test/less/calc.less rename test/less/{ => strict-math}/css.less (100%) rename test/less/{ => strict-math}/mixins-args.less (100%) rename test/less/{ => strict-math}/parens.less (100%) diff --git a/dist/less.js b/dist/less.js index 78199d99e..63e1680bb 100644 --- a/dist/less.js +++ b/dist/less.js @@ -1003,7 +1003,11 @@ contexts.Eval.prototype.outOfParenthesis = function () { this.parensStack.pop(); }; +contexts.Eval.prototype.mathOn = true; contexts.Eval.prototype.isMathOn = function () { + if (!this.mathOn) { + return false; + } return this.strictMath ? (this.parensStack && this.parensStack.length) : true; }; @@ -4019,6 +4023,7 @@ var Parser = function Parser(context, imports, fileInfo) { } parserInput.forget(); + return new(tree.Call)(name, args, index, fileInfo); }, @@ -4194,7 +4199,7 @@ var Parser = function Parser(context, imports, fileInfo) { } }, - // A property entity useing the protective {} e.g. @{prop} + // A property entity useing the protective {} e.g. ${prop} propertyCurly: function () { var curly, index = parserInput.i; @@ -6331,6 +6336,7 @@ var Node = require("./node"), var Call = function (name, args, index, currentFileInfo) { this.name = name; this.args = args; + this.mathOn = name === 'calc' ? false : true; this._index = index; this._fileInfo = currentFileInfo; }; @@ -6353,8 +6359,16 @@ Call.prototype.accept = function (visitor) { // The function should receive the value, not the variable. // Call.prototype.eval = function (context) { - var args = this.args.map(function (a) { return a.eval(context); }), - result, funcCaller = new FunctionCaller(this.name, context, this.getIndex(), this.fileInfo()); + + /** + * Turn off math for calc(), and switch back on for evaluating nested functions + */ + var currentMathContext = context.mathOn; + context.mathOn = this.mathOn; + var args = this.args.map(function (a) { return a.eval(context); }); + context.mathOn = currentMathContext; + + var result, funcCaller = new FunctionCaller(this.name, context, this.getIndex(), this.fileInfo()); if (funcCaller.isValid()) { try { @@ -8384,7 +8398,6 @@ module.exports = Property; },{"./declaration":58,"./node":73}],77:[function(require,module,exports){ var Node = require("./node"), - JsEvalNode = require("./js-eval-node"), Variable = require("./variable"), Property = require("./property"); @@ -8441,7 +8454,7 @@ Quoted.prototype.compare = function (other) { }; module.exports = Quoted; -},{"./js-eval-node":67,"./node":73,"./property":76,"./variable":85}],78:[function(require,module,exports){ +},{"./node":73,"./property":76,"./variable":85}],78:[function(require,module,exports){ var Node = require("./node"), Declaration = require("./declaration"), Keyword = require("./keyword"), diff --git a/dist/less.min.js b/dist/less.min.js index d9c94e53e..77c404cc5 100644 --- a/dist/less.min.js +++ b/dist/less.min.js @@ -10,8 +10,8 @@ /** * @license Apache-2.0 */ -!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.less=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0||b.isFileProtocol?"development":"production");var c=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(a.location.hash);c&&(b.dumpLineNumbers=c[1]),void 0===b.useFileCache&&(b.useFileCache=!0),void 0===b.onReady&&(b.onReady=!0),b.javascriptEnabled=!(!b.javascriptEnabled&&!b.inlineJavaScript)}},{"./browser":3,"./utils":11}],2:[function(a,b,c){function d(a){a.filename&&console.warn(a),e.async||h.removeChild(i)}a("promise/polyfill");var e=a("../less/default-options")();if(window.less)for(key in window.less)window.less.hasOwnProperty(key)&&(e[key]=window.less[key]);a("./add-default-options")(window,e),e.plugins=e.plugins||[],window.LESS_PLUGINS&&(e.plugins=e.plugins.concat(window.LESS_PLUGINS));var f=b.exports=a("./index")(window,e);window.less=f;var g,h,i;e.onReady&&(/!watch/.test(window.location.hash)&&f.watch(),e.async||(g="body { display: none !important }",h=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),i.type="text/css",i.styleSheet?i.styleSheet.cssText=g:i.appendChild(document.createTextNode(g)),h.appendChild(i)),f.registerStylesheetsImmediately(),f.pageLoadFinished=f.refresh("development"===f.env).then(d,d))},{"../less/default-options":16,"./add-default-options":1,"./index":8,"promise/polyfill":100}],3:[function(a,b,c){var d=a("./utils");b.exports={createCSS:function(a,b,c){var e=c.href||"",f="less:"+(c.title||d.extractId(e)),g=a.getElementById(f),h=!1,i=a.createElement("style");i.setAttribute("type","text/css"),c.media&&i.setAttribute("media",c.media),i.id=f,i.styleSheet||(i.appendChild(a.createTextNode(b)),h=null!==g&&g.childNodes.length>0&&i.childNodes.length>0&&g.firstChild.nodeValue===i.firstChild.nodeValue);var j=a.getElementsByTagName("head")[0];if(null===g||h===!1){var k=c&&c.nextSibling||null;k?k.parentNode.insertBefore(i,k):j.appendChild(i)}if(g&&h===!1&&g.parentNode.removeChild(g),i.styleSheet)try{i.styleSheet.cssText=b}catch(l){throw new Error("Couldn't reassign styleSheet.cssText.")}},currentScript:function(a){var b=a.document;return b.currentScript||function(){var a=b.getElementsByTagName("script");return a[a.length-1]}()}}},{"./utils":11}],4:[function(a,b,c){b.exports=function(a,b,c){var d=null;if("development"!==b.env)try{d="undefined"==typeof a.localStorage?null:a.localStorage}catch(e){}return{setCSS:function(a,b,e,f){if(d){c.info("saving "+a+" to cache.");try{d.setItem(a,f),d.setItem(a+":timestamp",b),e&&d.setItem(a+":vars",JSON.stringify(e))}catch(g){c.error('failed to save "'+a+'" to local storage for caching.')}}},getCSS:function(a,b,c){var e=d&&d.getItem(a),f=d&&d.getItem(a+":timestamp"),g=d&&d.getItem(a+":vars");if(c=c||{},f&&b.lastModified&&new Date(b.lastModified).valueOf()===new Date(f).valueOf()&&(!c&&!g||JSON.stringify(c)===g))return e}}}},{}],5:[function(a,b,c){var d=a("./utils"),e=a("./browser");b.exports=function(a,b,c){function f(b,f){var g,h,i="less-error-message:"+d.extractId(f||""),j='
    • {content}
    • ',k=a.document.createElement("div"),l=[],m=b.filename||f,n=m.match(/([^\/]+(\?.*)?)$/)[1];k.id=i,k.className="less-error-message",h="

      "+(b.type||"Syntax")+"Error: "+(b.message||"There is an error in your .less file")+'

      in '+n+" ";var o=function(a,b,c){void 0!==a.extract[b]&&l.push(j.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};b.line&&(o(b,0,""),o(b,1,"line"),o(b,2,""),h+="on line "+b.line+", column "+(b.column+1)+":

        "+l.join("")+"
      "),b.stack&&(b.extract||c.logLevel>=4)&&(h+="
      Stack Trace
      "+b.stack.split("\n").slice(1).join("
      ")),k.innerHTML=h,e.createCSS(a.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),k.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===c.env&&(g=setInterval(function(){var b=a.document,c=b.body;c&&(b.getElementById(i)?c.replaceChild(k,b.getElementById(i)):c.insertBefore(k,c.firstChild),clearInterval(g))},10))}function g(b){var c=a.document.getElementById("less-error-message:"+d.extractId(b));c&&c.parentNode.removeChild(c)}function h(a){}function i(a){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?h(a):"function"==typeof c.errorReporting&&c.errorReporting("remove",a):g(a)}function j(a,d){var e="{line} {content}",f=a.filename||d,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f,i=function(a,b,c){void 0!==a.extract[b]&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.line&&(i(a,0,""),i(a,1,"line"),i(a,2,""),h+=" on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")),a.stack&&(a.extract||c.logLevel>=4)&&(h+="\nStack Trace\n"+a.stack),b.logger.error(h)}function k(a,b){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?j(a,b):"function"==typeof c.errorReporting&&c.errorReporting("add",a,b):f(a,b)}return{add:k,remove:i}}},{"./browser":3,"./utils":11}],6:[function(a,b,c){b.exports=function(b,c){var d=a("../less/environment/abstract-file-manager.js"),e={},f=function(){};return f.prototype=new d,f.prototype.alwaysMakePathsAbsolute=function(){return!0},f.prototype.join=function(a,b){return a?this.extractUrlParts(b,a).path:b},f.prototype.doXHR=function(a,d,e,f){function g(b,c,d){b.status>=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var h=new XMLHttpRequest,i=!b.isFileProtocol||b.fileAsync;"function"==typeof h.overrideMimeType&&h.overrideMimeType("text/css"),c.debug("XHR: Getting '"+a+"'"),h.open("GET",a,i),h.setRequestHeader("Accept",d||"text/x-less, text/css; q=0.9, */*; q=0.5"),h.send(null),b.isFileProtocol&&!b.fileAsync?0===h.status||h.status>=200&&h.status<300?e(h.responseText):f(h.status,a):i?h.onreadystatechange=function(){4==h.readyState&&g(h,e,f)}:g(h,e,f)},f.prototype.supports=function(a,b,c,d){return!0},f.prototype.clearFileCache=function(){e={}},f.prototype.loadFile=function(a,b,c,d){b&&!this.isPathAbsolute(a)&&(a=b+a),a=c.ext?this.tryAppendExtension(a,c.ext):a,c=c||{};var f=this.extractUrlParts(a,window.location.href),g=f.url,h=this;return new Promise(function(a,b){if(c.useFileCache&&e[g])try{var d=e[g];return a({contents:d,filename:g,webInfo:{lastModified:new Date}})}catch(f){return b({filename:g,message:"Error loading file "+g+" error was "+f.message})}h.doXHR(g,c.mime,function(b,c){e[g]=b,a({contents:b,filename:g,webInfo:{lastModified:c}})},function(a,c){b({type:"File",message:"'"+c+"' wasn't found ("+a+")",href:g})})})},f}},{"../less/environment/abstract-file-manager.js":17}],7:[function(a,b,c){b.exports=function(){function b(){throw{type:"Runtime",message:"Image size functions are not supported in browser version of less"}}var c=a("./../less/functions/function-registry"),d={"image-size":function(a){return b(this,a),-1},"image-width":function(a){return b(this,a),-1},"image-height":function(a){return b(this,a),-1}};c.addMultiple(d)}},{"./../less/functions/function-registry":26}],8:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(b,c){function f(a){return JSON.parse(JSON.stringify(a||{}))}function g(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}}function h(a){for(var b,d=l.getElementsByTagName("style"),e=0;e=c&&console.log(a)},info:function(a){b.logLevel>=d&&console.log(a)},warn:function(a){b.logLevel>=e&&console.warn(a)},error:function(a){b.logLevel>=f&&console.error(a)}}]);for(var g=0;g0&&(a=a.slice(0,b)),b=a.lastIndexOf("/"),b<0&&(b=a.lastIndexOf("\\")),b<0?"":a.slice(0,b+1)},d.prototype.tryAppendExtension=function(a,b){return/(\.[a-z]*$)|([\?;].*)$/.test(a)?a:a+b},d.prototype.tryAppendLessExtension=function(a){return this.tryAppendExtension(a,".less")},d.prototype.supportsSync=function(){return!1},d.prototype.alwaysMakePathsAbsolute=function(){return!1},d.prototype.isPathAbsolute=function(a){return/^(?:[a-z-]+:|\/|\\|#)/i.test(a)},d.prototype.join=function(a,b){return a?a+b:b},d.prototype.pathDiff=function(a,b){var c,d,e,f,g=this.extractUrlParts(a),h=this.extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;cparseInt(b[c])?-1:1;return 0},g.prototype.versionToString=function(a){for(var b="",c=0;c=0;h--){var i=g[h];if(i[f?"supportsSync":"supports"](a,b,c,e))return i}return null},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},b.exports=e},{"../logger":37}],20:[function(a,b,c){var d=a("./function-registry"),e=a("../tree/anonymous"),f=a("../tree/keyword");d.addMultiple({"boolean":function(a){return a?f.True:f.False},"if":function(a,b,c){return a?b:c||new e}})},{"../tree/anonymous":48,"../tree/keyword":68,"./function-registry":26}],21:[function(a,b,c){function d(a,b,c){var d,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;l<3;l++)d=b.rgb[l]/255,f=c.rgb[l]/255,h=a(d,f),g&&(h=(j*f+i*(d-j*(d+f-h)))/g),k[l]=255*h;return new e(k,g)}var e=a("../tree/color"),f=a("./function-registry"),g={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,a<=1?g.multiply(a,b):g.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return g.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};for(var h in g)g.hasOwnProperty(h)&&(d[h]=d.bind(null,g[h]));f.addMultiple(d)},{"../tree/color":53,"./function-registry":26}],22:[function(a,b,c){function d(a){return Math.min(1,Math.max(0,a))}function e(a){return h.hsla(a.h,a.s,a.l,a.a)}function f(a){if(a instanceof i)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{type:"Argument",message:"color functions take numbers as parameters"}}function g(a,b){return a instanceof i&&a.unit.is("%")?parseFloat(a.value*b/100):f(a)}var h,i=a("../tree/dimension"),j=a("../tree/color"),k=a("../tree/quoted"),l=a("../tree/anonymous"),m=a("./function-registry");h={rgb:function(a,b,c){return h.rgba(a,b,c,1)},rgba:function(a,b,c,d){var e=[a,b,c].map(function(a){return g(a,255)});return d=f(d),new j(e,d)},hsl:function(a,b,c){return h.hsla(a,b,c,1)},hsla:function(a,b,c,e){function g(a){return a=a<0?a+1:a>1?a-1:a,6*a<1?i+(j-i)*a*6:2*a<1?j:3*a<2?i+(j-i)*(2/3-a)*6:i}var i,j;return a=f(a)%360/360,b=d(f(b)),c=d(f(c)),e=d(f(e)),j=c<=.5?c*(b+1):c+b-c*b,i=2*c-j,h.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),e)},hsv:function(a,b,c){return h.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=f(a)%360/360*360,b=f(b),c=f(c),d=f(d);var e,g;e=Math.floor(a/60%6),g=a/60-e;var i=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],j=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return h.rgba(255*i[j[e][0]],255*i[j[e][1]],255*i[j[e][2]],d)},hue:function(a){return new i(a.toHSL().h)},saturation:function(a){return new i(100*a.toHSL().s,"%")},lightness:function(a){return new i(100*a.toHSL().l,"%")},hsvhue:function(a){return new i(a.toHSV().h)},hsvsaturation:function(a){return new i(100*a.toHSV().s,"%")},hsvvalue:function(a){return new i(100*a.toHSV().v,"%")},red:function(a){return new i(a.rgb[0])},green:function(a){return new i(a.rgb[1])},blue:function(a){return new i(a.rgb[2])},alpha:function(a){return new i(a.toHSL().a)},luma:function(a){return new i(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new i(b*a.alpha*100,"%")},saturate:function(a,b,c){if(!a.rgb)return null;var f=a.toHSL();return f.s+="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},desaturate:function(a,b,c){var f=a.toHSL();return f.s-="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},lighten:function(a,b,c){var f=a.toHSL();return f.l+="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},darken:function(a,b,c){var f=a.toHSL();return f.l-="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},fadein:function(a,b,c){var f=a.toHSL();return f.a+="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fadeout:function(a,b,c){var f=a.toHSL();return f.a-="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=d(c.a),e(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=d<0?360+d:d,e(c)},mix:function(a,b,c){a.toHSL&&b.toHSL||(console.log(b.type),console.dir(b)),c||(c=new i(50));var d=c.value/100,e=2*d-1,f=a.toHSL().a-b.toHSL().a,g=((e*f==-1?e:(e+f)/(1+e*f))+1)/2,h=1-g,k=[a.rgb[0]*g+b.rgb[0]*h,a.rgb[1]*g+b.rgb[1]*h,a.rgb[2]*g+b.rgb[2]*h],l=a.alpha*d+b.alpha*(1-d);return new j(k,l)},greyscale:function(a){return h.desaturate(a,new i(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;if("undefined"==typeof c&&(c=h.rgba(255,255,255,1)),"undefined"==typeof b&&(b=h.rgba(0,0,0,1)),b.luma()>c.luma()){var e=c;c=b,b=e}return d="undefined"==typeof d?.43:f(d),a.luma()=v&&this.context.ieCompat!==!1?(h.warn("Skipped data-uri embedding of "+j+" because its size ("+u.length+" characters) exceeds IE8-safe "+v+" characters!"),g(this,f||a)):new d(new c('"'+u+'"',u,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../logger":37,"../tree/quoted":77,"../tree/url":82,"../utils":86,"./function-registry":26}],24:[function(a,b,c){var d=a("../tree/keyword"),e=a("./function-registry"),f={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;if(null!=a)return a?d.True:d.False},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}};e.add("default",f.eval.bind(f)),b.exports=f},{"../tree/keyword":68,"./function-registry":26}],25:[function(a,b,c){var d=a("../tree/expression"),e=function(a,b,c,d){this.name=a.toLowerCase(),this.index=c,this.context=b,this.currentFileInfo=d,this.func=b.frames[0].functionRegistry.get(this.name)};e.prototype.isValid=function(){return Boolean(this.func)},e.prototype.call=function(a){return Array.isArray(a)&&(a=a.filter(function(a){return"Comment"!==a.type}).map(function(a){if("Expression"===a.type){var b=a.value.filter(function(a){return"Comment"!==a.type});return 1===b.length?b[0]:new d(b)}return a})),this.func.apply(this,a)},b.exports=e},{"../tree/expression":62}],26:[function(a,b,c){function d(a){return{_data:{},add:function(a,b){a=a.toLowerCase(),this._data.hasOwnProperty(a),this._data[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){this.add(b,a[b])}.bind(this))},get:function(b){return this._data[b]||a&&a.get(b)},getLocalFunctions:function(){return this._data},inherit:function(){return d(this)},create:function(a){return d(a)}}}b.exports=d(null)},{}],27:[function(a,b,c){b.exports=function(b){var c={functionRegistry:a("./function-registry"),functionCaller:a("./function-caller")};return a("./boolean"),a("./default"),a("./color"),a("./color-blending"),a("./data-uri")(b),a("./math"),a("./number"),a("./string"),a("./svg")(b),a("./types"),c}},{"./boolean":20,"./color":22,"./color-blending":21,"./data-uri":23,"./default":24,"./function-caller":25,"./function-registry":26,"./math":29,"./number":30,"./string":31,"./svg":32,"./types":33}],28:[function(a,b,c){var d=a("../tree/dimension"),e=function(){};e._math=function(a,b,c){if(!(c instanceof d))throw{type:"Argument",message:"argument must be a number" -};return null==b?b=c.unit:c=c.unify(),new d(a(parseFloat(c.value)),b)},b.exports=e},{"../tree/dimension":60}],29:[function(a,b,c){var d=a("./function-registry"),e=a("./math-helper.js"),f={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"};for(var g in f)f.hasOwnProperty(g)&&(f[g]=e._math.bind(null,Math[g],f[g]));f.round=function(a,b){var c="undefined"==typeof b?0:b.value;return e._math(function(a){return a.toFixed(c)},null,a)},d.addMultiple(f)},{"./function-registry":26,"./math-helper.js":28}],30:[function(a,b,c){var d=a("../tree/dimension"),e=a("../tree/anonymous"),f=a("./function-registry"),g=a("./math-helper.js"),h=function(a,b){switch(b=Array.prototype.slice.call(b),b.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var c,f,g,h,i,j,k,l,m=[],n={};for(c=0;ci.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(b[c].value)&&Array.prototype.push.apply(b,Array.prototype.slice.call(b[c].value));return 1==m.length?m[0]:(b=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new e((a?"min":"max")+"("+b+")"))};f.addMultiple({min:function(){return h(!0,arguments)},max:function(){return h(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new d(Math.PI)},mod:function(a,b){return new d(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d(a),b=new d(b);else if(!(a instanceof d&&b instanceof d))throw{type:"Argument",message:"arguments must be numbers"};return new d(Math.pow(a.value,b.value),a.unit)},percentage:function(a){var b=g._math(function(a){return 100*a},"%",a);return b}})},{"../tree/anonymous":48,"../tree/dimension":60,"./function-registry":26,"./math-helper.js":28}],31:[function(a,b,c){var d=a("../tree/quoted"),e=a("../tree/anonymous"),f=a("../tree/javascript"),g=a("./function-registry");g.addMultiple({e:function(a){return new e(a instanceof f?a.evaluated:a.value)},escape:function(a){return new e(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,b,c,e){var f=a.value;return c="Quoted"===c.type?c.value:c.toCSS(),f=f.replace(new RegExp(b.value,e?e.value:""),c),new d(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;e",k=0;k";return j+="',j=encodeURIComponent(j),j="data:image/svg+xml,"+j,new g(new f("'"+j+"'",j,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":53,"../tree/dimension":60,"../tree/expression":62,"../tree/quoted":77,"../tree/url":82,"./function-registry":26}],33:[function(a,b,c){var d=a("../tree/keyword"),e=a("../tree/detached-ruleset"),f=a("../tree/dimension"),g=a("../tree/color"),h=a("../tree/quoted"),i=a("../tree/anonymous"),j=a("../tree/url"),k=a("../tree/operation"),l=a("./function-registry"),m=function(a,b){return a instanceof b?d.True:d.False},n=function(a,b){if(void 0===b)throw{type:"Argument",message:"missing the required second argument to isunit."};if(b="string"==typeof b.value?b.value:b,"string"!=typeof b)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof f&&a.unit.is(b)?d.True:d.False},o=function(a){var b=Array.isArray(a.value)?a.value:Array(a);return b};l.addMultiple({isruleset:function(a){return m(a,e)},iscolor:function(a){return m(a,g)},isnumber:function(a){return m(a,f)},isstring:function(a){return m(a,h)},iskeyword:function(a){return m(a,d)},isurl:function(a){return m(a,j)},ispixel:function(a){return n(a,"px")},ispercentage:function(a){return n(a,"%")},isem:function(a){return n(a,"em")},isunit:n,unit:function(a,b){if(!(a instanceof f))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof k?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d?b.value:b.toCSS():"",new f(a.value,b)},"get-unit":function(a){return new i(a.unit)},extract:function(a,b){return b=b.value-1,o(a)[b]},length:function(a){return new f(o(a).length)}})},{"../tree/anonymous":48,"../tree/color":53,"../tree/detached-ruleset":59,"../tree/dimension":60,"../tree/keyword":68,"../tree/operation":74,"../tree/quoted":77,"../tree/url":82,"./function-registry":26}],34:[function(a,b,c){var d=a("./contexts"),e=a("./parser/parser"),f=a("./less-error"),g=a("./utils");"undefined"==typeof Promise?a("promise"):Promise;b.exports=function(a){var b=function(a,b,c){this.less=a,this.rootFilename=c.filename,this.paths=b.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=b.mime,this.error=null,this.context=b,this.queue=[],this.files={}};return b.prototype.push=function(b,c,h,i,j){var k=this,l=this.context.pluginManager.Loader;this.queue.push(b);var m=function(a,c,d){k.queue.splice(k.queue.indexOf(b),1);var e=d===k.rootFilename;i.optional&&a?j(null,{rules:[]},!1,null):(k.files[d]||(k.files[d]={root:c,options:i}),a&&!k.error&&(k.error=a),j(a,c,e,d))},n={relativeUrls:this.context.relativeUrls,entryPath:h.entryPath,rootpath:h.rootpath,rootFilename:h.rootFilename},o=a.getFileManager(b,h.currentDirectory,this.context,a);if(!o)return void m({message:"Could not find a file-manager for "+b});var p,q=function(a){var b,c=a.filename,g=a.contents.replace(/^\uFEFF/,"");n.currentDirectory=o.getPath(c),n.relativeUrls&&(n.rootpath=o.join(k.context.rootpath||"",o.pathDiff(n.currentDirectory,n.entryPath)),!o.isPathAbsolute(n.rootpath)&&o.alwaysMakePathsAbsolute()&&(n.rootpath=o.join(n.entryPath,n.rootpath))),n.filename=c;var j=new d.Parse(k.context);j.processImports=!1,k.contents[c]=g,(h.reference||i.reference)&&(n.reference=!0),i.isPlugin?(b=l.evalPlugin(g,j,k,i.pluginArgs,n),b instanceof f?m(b,null,c):m(null,b,c)):i.inline?m(null,g,c):!k.files[c]||k.files[c].options.multiple||i.multiple?new e(j,k,n).parse(g,function(a,b){m(a,b,c)}):m(null,k.files[c].root,c)},r=g.clone(this.context);c&&(r.ext=i.isPlugin?".js":".less"),p=i.isPlugin?l.loadPlugin(b,h.currentDirectory,r,a,o):o.loadFile(b,h.currentDirectory,r,a,function(a,b){a?m(a):q(b)}),p&&p.then(q,m)},b}},{"./contexts":12,"./less-error":36,"./parser/parser":42,"./utils":86,promise:void 0}],35:[function(a,b,c){b.exports=function(b,c){var d,e,f,g,h,i,j={version:[3,0,0],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),AbstractPluginLoader:a("./environment/abstract-plugin-loader"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")},k=function(a){return function(){var b=Object.create(a.prototype);return a.apply(b,Array.prototype.slice.call(arguments,0)),b}},l=Object.create(j);for(var m in j.tree)if(i=j.tree[m],"function"==typeof i)l[m.toLowerCase()]=k(i);else{l[m]=Object.create(null);for(var n in i)l[m][n.toLowerCase()]=k(i[n])}return l}},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":17,"./environment/abstract-plugin-loader":18,"./environment/environment":19,"./functions":27,"./import-manager":34,"./less-error":36,"./logger":37,"./parse":39,"./parse-tree":38,"./parser/parser":42,"./plugin-manager":43,"./render":44,"./source-map-builder":45,"./source-map-output":46,"./transform-tree":47,"./tree":65,"./utils":86,"./visitors":90}],36:[function(a,b,c){var d=a("./utils"),e=b.exports=function(a,b,c){Error.call(this);var e=a.filename||c;if(this.message=a.message,this.stack=a.stack,b&&e){var f=b.contents[e],g=d.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&d.getLocation(a.call,f).line,k=f.split("\n");if(this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.column=i,!this.line&&this.stack){var l=this.stack.match(/(|Function):(\d+):(\d+)/);l&&(l[2]&&(this.line=parseInt(l[2])-2),l[3]&&(this.column=parseInt(l[3])))}this.callLine=j+1,this.callExtract=k[j],this.extract=[k[this.line-2],k[this.line-1],k[this.line]]}};if("undefined"==typeof Object.create){var f=function(){};f.prototype=Error.prototype,e.prototype=new f}else e.prototype=Object.create(Error.prototype);e.prototype.constructor=e,e.prototype.toString=function(a){a=a||{};var b="",c=this.extract||[],d=[],e=function(a){return a};if(a.stylize){var f=typeof a.stylize;if("function"!==f)throw Error("options.stylize should be a function, got a "+f+"!");e=a.stylize}if(null!==this.line){if("string"==typeof c[0]&&d.push(e(this.line-1+" "+c[0],"grey")),"string"==typeof c[1]){var g=this.line+" ";c[1]&&(g+=c[1].slice(0,this.column)+e(e(e(c[1].substr(this.column,1),"bold")+c[1].slice(this.column+1),"red"),"inverse")),d.push(g)}"string"==typeof c[2]&&d.push(e(this.line+1+" "+c[2],"grey")),d=d.join("\n")+e("","reset")+"\n"}return b+=e(this.type+"Error: "+this.message,"red"),this.filename&&(b+=e(" in ","red")+this.filename),this.line&&(b+=e(" on line "+this.line+", column "+(this.column+1)+":","grey")),b+="\n"+d,this.callLine&&(b+=e("from ","red")+(this.filename||"")+"/n",b+=e(this.callLine,"grey")+" "+this.callExtract+"/n"),b}},{"./utils":86}],37:[function(a,b,c){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;b=97&&j<=122||j<34))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(h96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;hd&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],41:[function(a,b,c){var d=a("./chunker");b.exports=function(){function a(d){for(var e,f,j,p=k.i,q=c,s=k.i-i,t=k.i+h.length-s,u=k.i+=d,v=b;k.i=0){j={index:k.i,text:v.substr(k.i,x+2-k.i),isLineComment:!1},k.i+=j.text.length-1,k.commentStore.push(j);continue}}break}if(e!==l&&e!==n&&e!==m&&e!==o)break}if(h=h.slice(d+k.i-u+s),i=k.i,!h.length){if(ce||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,c=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$re=function(b){k.i>i&&(h=h.slice(k.i-i),i=k.i);var c=b.exec(h);return c?(a(c[0].length),"string"==typeof c?c:1===c.length?c[0]:c):null},k.$char=function(c){return b.charAt(k.i)!==c?null:(a(1),c)},k.$str=function(c){for(var d=c.length,e=0;es||a=b.length;return k.i=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":40}],42:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=a("../functions/function-registry"),j=function k(a,b,c){function j(a,e){throw new d({index:q.i,filename:c.filename,type:e||"Syntax",message:a},b)}function l(a,b,c){var d=a instanceof Function?a.call(p):q.$re(a);return d?d:void j(b||("string"==typeof a?"expected '"+a+"' got '"+q.currentChar()+"'":"unexpected token"))}function m(a,b){return q.$char(a)?a:void j(b||"expected '"+a+"' got '"+q.currentChar()+"'")}function n(a){var b=c.filename;return{lineNumber:h.getLocation(a,q.getInput()).line+1,fileName:b}}function o(a,c,e,f,g){var h,i=[],j=q;try{j.start(a,!1,function(a,b){g({message:a,index:b+e})});for(var k,l,m=0;k=c[m];m++)l=j.i,h=p[k](),h?(h._index=l+e,h._fileInfo=f,i.push(h)):i.push(null);var n=j.end();n.isFinished?g(null,i):g(!0,null)}catch(o){throw new d({index:o.index+e,message:o.message},b,f.filename)}}var p,q=g();return{parserInput:q,imports:b,fileInfo:c,parseNode:o,parse:function(g,h,j){var l,m,n,o,p=null,r="";if(m=j&&j.globalVars?k.serializeVars(j.globalVars)+"\n":"",n=j&&j.modifyVars?"\n"+k.serializeVars(j.modifyVars):"",a.pluginManager)for(var s=a.pluginManager.getPreProcessors(),t=0;t")}return b&&(q.$char("(")&&(h=this.args(!0).args,m(")")),p.important()&&(j=!0),p.end())?(q.forget(),new e.mixin.Call(b,h,k,c,j)):void q.restore()}},args:function(a){var b,c,d,f,g,h,i,k=p.entities,l={args:null,variadic:!1},m=[],n=[],o=[];for(q.save();;){if(a)h=p.detachedRuleset()||p.expression();else{if(q.commentStore.length=0,q.$str("...")){l.variadic=!0,q.$char(";")&&!b&&(b=!0),(b?n:o).push({variadic:!0});break}h=k.variable()||k.property()||k.literal()||k.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var r=null;if(a?h.value&&1==h.value.length&&(r=h.value[0]):r=h,r&&(r instanceof e.Variable||r instanceof e.Property))if(q.$char(":")){if(m.length>0&&(b&&j("Cannot mix ; and , as delimiter types"),c=!0),g=p.detachedRuleset()||p.expression(),!g){if(!a)return q.restore(),l.args=[],l;j("could not understand value for named argument")}f=d=r.name}else if(q.$str("...")){if(!a){l.variadic=!0,q.$char(";")&&!b&&(b=!0),(b?n:o).push({name:h.name,variadic:!0});break}i=!0}else a||(d=f=r.name,g=null);g&&m.push(g),o.push({name:f,value:g,expand:i}),q.$char(",")||(q.$char(";")||b)&&(c&&j("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),n.push({name:d,value:g,expand:i}),d=null,m=[],c=!1)}return q.forget(),l.args=b?n:o,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==q.currentChar()&&"#"!==q.currentChar()||q.peek(/^[^{]*\}/)))if(q.save(),b=q.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!q.$char(")"))return void q.restore("Missing closing ')'");if(q.commentStore.length=0,q.$str("when")&&(d=l(p.conditions,"expected condition")),c=p.block())return q.forget(),new e.mixin.Definition(a,f,c,d,g);q.restore()}else q.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.property()||a.call()||a.keyword()||a.javascript()},end:function(){return q.$char(";")||q.peek("}")},ieAlpha:function(){var a;if(q.$re(/^opacity=/i))return a=q.$re(/^\d+/),a||(a=l(p.entities.variable,"Could not parse alpha"),a="@{"+a.name.slice(1)+"}"),m(")"),new e.Quoted("","alpha(opacity="+a+")")},element:function(){var a,b,d,f=q.i;if(b=this.combinator(),a=q.$re(/^(?:\d+\.\d+|\d+)%/)||q.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||q.$char("*")||q.$char("&")||this.attribute()||q.$re(/^\([^&()@]+\)/)||q.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(q.save(),q.$char("(")?(d=this.selector(!1))&&q.$char(")")?(a=new e.Paren(d),q.forget()):q.restore("Missing closing ')'"):q.forget()),a)return new e.Element(b,a,f,c)},combinator:function(){var a=q.currentChar();if("/"===a){q.save();var b=q.$re(/^\/[a-z]+\//i);if(b)return q.forget(),new e.Combinator(b);q.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(q.i++,"^"===a&&"^"===q.currentChar()&&(a="^^",q.i++);q.isWhitespace();)q.i++;return new e.Combinator(a)}return new e.Combinator(q.isWhitespace(-1)?" ":null)},selector:function(a){var b,d,f,g,h,i,k,m=q.i;for(a=a!==!1;(a&&(d=this.extend())||a&&(i=q.$str("when"))||(g=this.element()))&&(i?k=l(this.conditions,"expected condition"):k?j("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&j("Extend can only be used at the end of selector"),f=q.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,k,m,c):void(h&&j("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(q.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=l(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=q.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||q.$re(/^[0-9]+%/)||q.$re(/^[\w-]+/)||d.variableCurly()),m("]"),new e.Attribute(a,c,b)}},block:function(){var a;if(q.$char("{")&&(a=this.primary())&&q.$char("}"))return a},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();if(a)return new e.DetachedRuleset(a)},ruleset:function(){var b,c,d,f;for(q.save(),a.dumpLineNumbers&&(f=n(q.i));;){if(c=this.selector(),!c)break;if(b?b.push(c):b=[c],q.commentStore.length=0,c.condition&&b.length>1&&j("Guards are only currently allowed on a single selector."),!q.$char(","))break;c.condition&&j("Guards are only currently allowed on a single selector."),q.commentStore.length=0}if(b&&(d=this.block())){q.forget();var g=new e.Ruleset(b,d,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}q.restore()},declaration:function(){var a,b,d,f,g,h=q.i,i=q.currentChar();if("."!==i&&"#"!==i&&"&"!==i&&":"!==i)if(q.save(),a=this.variable()||this.ruleProperty()){if(g="string"==typeof a,g&&(b=this.detachedRuleset()),q.commentStore.length=0,!b){if(f=!g&&a.length>1&&a.pop().value,b=this.anonymousValue())return q.forget(),new e.Declaration(a,b,(!1),f,h,c);b||(b=this.value()),d=this.important()}if(b&&this.end())return q.forget(),new e.Declaration(a,b,d,f,h,c);q.restore()}else q.restore()},anonymousValue:function(){var a=q.i,b=q.$re(/^([^@\$+\/'"*`(;{}-]*);/);if(b)return new e.Anonymous(b[1],a)},"import":function(){var a,b,d=q.i,f=q.$re(/^@import?\s+/);if(f){var g=(f?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),q.$char(";")||(q.i=d,j("missing semi-colon or unrecognised media features on import")),b=b&&new e.Value(b),new e.Import(a,b,g,d,c);q.i=d,j("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!q.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!q.$char(","))break}while(a);return m(")"),d},importOption:function(){var a=q.$re(/^(less|css|multiple|once|inline|reference|optional)/);if(a)return a[1]},mediaFeature:function(){var a,b,d=this.entities,f=[];q.save();do a=d.keyword()||d.variable(),a?f.push(a):q.$char("(")&&(b=this.property(),a=this.value(),q.$char(")")?b&&a?f.push(new e.Paren(new e.Declaration(b,a,null,null,q.i,c,(!0)))):a?f.push(new e.Paren(a)):j("badly formed media feature definition"):j("Missing closing ')'","Parse"));while(a);if(q.forget(),f.length>0)return new e.Expression(f)},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!q.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!q.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=q.i;return a.dumpLineNumbers&&(g=n(h)),q.save(),q.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||j("media definitions require block statements after any features"),q.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void q.restore()},plugin:function(){var a,b,d,f=q.i,g=q.$re(/^@plugin?\s+/);if(g){ -if(b=this.pluginArgs(),d=b?{pluginArgs:b,isPlugin:!0}:{isPlugin:!0},a=this.entities.quoted()||this.entities.url())return q.$char(";")||(q.i=f,j("missing semi-colon on @plugin")),new e.Import(a,null,d,f,c);q.i=f,j("malformed @plugin statement")}},pluginArgs:function(){if(q.save(),!q.$char("("))return q.restore(),null;var a=q.$re(/^\s*([^\);]+)\)\s*/);return a[1]?(q.forget(),a[1].trim()):(q.restore(),null)},atrule:function(){var b,d,f,g,h,i,k,l=q.i,m=!0,o=!0;if("@"===q.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(q.save(),b=q.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,m=!1;break;case"@namespace":i=!0,m=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,o=!1;break;default:k=!0}return q.commentStore.length=0,h?(d=this.entity(),d||j("expected "+b+" identifier")):i?(d=this.expression(),d||j("expected "+b+" expression")):k&&(d=(q.$re(/^[^{;]+/)||"").trim(),m="{"==q.currentChar(),d&&(d=new e.Anonymous(d))),m&&(f=this.blockRuleset()),f||!m&&d&&q.$char(";")?(q.forget(),new e.AtRule(b,d,f,l,c,a.dumpLineNumbers?n(l):null,o)):void q.restore("at-rule options not recognised")}}},value:function(){var a,b=[],c=q.i;do if(a=this.expression(),a&&(b.push(a),!q.$char(",")))break;while(a);if(b.length>0)return new e.Value(b,c)},important:function(){if("!"===q.currentChar())return q.$re(/^! *important/)},sub:function(){var a,b;return q.save(),q.$char("(")?(a=this.addition(),a&&q.$char(")")?(q.forget(),b=new e.Expression([a]),b.parens=!0,b):void q.restore("Expected ')'")):void q.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=q.isWhitespace(-1);;){if(q.peek(/^\/[*\/]/))break;if(q.save(),c=q.$char("/")||q.$char("*"),!c){q.forget();break}if(b=this.operand(),!b){q.restore();break}q.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=q.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=q.isWhitespace(-1);;){if(c=q.$re(/^[-+]\s+/)||!f&&(q.$char("+")||q.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=q.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=q.i;if(a=this.condition()){for(;;){if(!q.peek(/^,\s*(not\s*)?\(/)||!q.$char(","))break;if(b=this.condition(),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(){function a(){return q.$str("or")}var b,c,d;if(b=this.conditionAnd(this)){if(c=a()){if(d=this.condition(),!d)return;b=new e.Condition(c,b,d)}return b}},conditionAnd:function(){function a(a){return a.negatedCondition()||a.parenthesisCondition()}function b(){return q.$str("and")}var c,d,f;if(c=a(this)){if(d=b()){if(f=this.conditionAnd(),!f)return;c=new e.Condition(d,c,f)}return c}},negatedCondition:function(){if(q.$str("not")){var a=this.parenthesisCondition();return a&&(a.negate=!a.negate),a}},parenthesisCondition:function(){function a(a){var b;return q.save(),(b=a.condition())&&q.$char(")")?(q.forget(),b):void q.restore()}var b;return q.save(),q.$str("(")?(b=a(this))?(q.forget(),b):(b=this.atomicCondition())?q.$char(")")?(q.forget(),b):void q.restore("expected ')' got '"+q.currentChar()+"'"):void q.restore():void q.restore()},atomicCondition:function(){var a,b,c,d,f=this.entities,g=q.i;if(a=this.addition()||f.keyword()||f.quoted())return q.$char(">")?d=q.$char("=")?">=":">":q.$char("<")?d=q.$char("=")?"<=":"<":q.$char("=")&&(d=q.$char(">")?"=>":q.$char("<")?"=<":"="),d?(b=this.addition()||f.keyword()||f.quoted(),b?c=new e.Condition(d,a,b,g,(!1)):j("expected expression")):c=new e.Condition("=",a,new e.Keyword("true"),g,(!1)),c},operand:function(){var a,b=this.entities;q.peek(/^-[@\$\(]/)&&(a=q.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.property()||b.call()||b.colorKeyword();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[],d=q.i;do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),q.peek(/^\/[\/*]/)||(b=q.$char("/"),b&&c.push(new e.Anonymous(b,d)))));while(a);if(c.length>0)return new e.Expression(c)},property:function(){var a=q.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(a)return a[1]},ruleProperty:function(){function a(a){var b=q.i,c=q.$re(a);if(c)return g.push(b),f.push(c[1])}var b,d,f=[],g=[];q.save();var h=q.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],q.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(q.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;d=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},e.prototype.addPostProcessor=function(a,b){var c;for(c=0;c=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.getPreProcessors=function(){for(var a=[],b=0;b0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],47:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Declaration("@"+a,b,(!1),null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j,k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor((!0)),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager)for(j=b.pluginManager.visitor(),j.first();i=j.get();)i.isPreEvalVisitor&&i.run(a);c=a.eval(h);for(var l=0;l.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(d="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":73}],57:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],58:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;c-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&c<1&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":15,"./color":53,"./node":73,"./unit":81}],61:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./combinator"),g=function(a,b,c,d,e){this.combinator=a instanceof f?a:new f(a),this.value="string"==typeof b?b.trim():b?b:"",this._index=c,this._fileInfo=d,this.copyVisibilityInfo(e),this.setParent(this.combinator,this)};g.prototype=new d,g.prototype.type="Element",g.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},g.prototype.eval=function(a){return new g(this.combinator,this.value.eval?this.value.eval(a):this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.fileInfo(),this.getIndex())},g.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof e&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=g},{"./combinator":54,"./node":73,"./paren":75}],62:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./comment"),g=function(a){if(this.value=a,!a)throw new Error("Expression requires an array parameter")};g.prototype=new d,g.prototype.type="Expression",g.prototype.accept=function(a){this.value=a.visitArray(this.value)},g.prototype.eval=function(a){var b,c=this.parens&&!this.parensInOp,d=!1;return c&&a.inParenthesis(),this.value.length>1?b=new g(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(d=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!d&&(b=new e(b)),b},g.prototype.genCSS=function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":73,"./selector":79}],64:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=a("../utils"),k=a("../less-error"),l=function(a,b,c,d,e,f){if(this.options=c,this._index=d,this._fileInfo=e,this.path=a,this.features=b,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f),this.setParent(this.features,this),this.setParent(this.path,this)};l.prototype=new d,l.prototype.type="Import",l.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.isPlugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},l.prototype.genCSS=function(a,b){this.css&&void 0===this.path._fileInfo.reference&&(b.add("@import ",this._fileInfo,this._index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},l.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},l.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),!(a instanceof g)||a.containsVariables()},l.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new l(b.eval(a),this.features,this.options,this._index,this._fileInfo,this.visibilityInfo())},l.prototype.evalPath=function(a){var b=this.path.eval(a),c=this._fileInfo&&this._fileInfo.rootpath;if(!(b instanceof f)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d)}b.value=a.normalizePath(b.value)}return b},l.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){a.addVisibilityBlock()}):b.addVisibilityBlock()),b},l.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a); -if(this.options.isPlugin){if(this.root&&this.root.eval)try{this.root.eval(a)}catch(f){throw f.message="Plugin error during evaluation",new k(f,this.root.imports,this.root.filename)}return c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[]}if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var g=new i(this.root,0,{filename:this.importedFilename,reference:this.path._fileInfo&&this.path._fileInfo.reference},(!0),(!0));return this.features?new e([g],this.features.value):[g]}if(this.css){var m=new l(this.evalPath(a),d,this.options,this._index);if(!m.css&&this.error)throw this.error;return m}return b=new h(null,j.copyArray(this.root.rules)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=l},{"../less-error":36,"../utils":86,"./anonymous":48,"./media":69,"./node":73,"./quoted":77,"./ruleset":78,"./url":82}],65:[function(a,b,c){var d=Object.create(null);d.Node=a("./node"),d.Color=a("./color"),d.AtRule=a("./atrule"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Property=a("./property"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Declaration=a("./declaration"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.VariableCall=a("./variable-call"),b.exports=d},{"./anonymous":48,"./assignment":49,"./atrule":50,"./attribute":51,"./call":52,"./color":53,"./combinator":54,"./comment":55,"./condition":56,"./declaration":58,"./detached-ruleset":59,"./dimension":60,"./element":61,"./expression":62,"./extend":63,"./import":64,"./javascript":66,"./keyword":68,"./media":69,"./mixin-call":70,"./mixin-definition":71,"./negative":72,"./node":73,"./operation":74,"./paren":75,"./property":76,"./quoted":77,"./ruleset":78,"./selector":79,"./unicode-descriptor":80,"./unit":81,"./url":82,"./value":83,"./variable":85,"./variable-call":84}],66:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this._index=c,this._fileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new e(b):"string"==typeof b?new f('"'+b+'"',b,this.escaped,this._index):new g(Array.isArray(b)?b.join(", "):b)},b.exports=h},{"./anonymous":48,"./dimension":60,"./js-eval-node":67,"./quoted":77}],67:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(!b.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.fileInfo().filename,index:this.getIndex()};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.getIndex(),d.fileInfo()).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.fileInfo().filename,index:this.getIndex()}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.fileInfo().filename,index:this.getIndex()}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":73,"./variable":85}],68:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":73}],69:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./atrule"),j=a("../utils"),k=function(a,b,c,g,h){this._index=c,this._fileInfo=g;var i=new f([],null,null,this._index,this._fileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0,this.setParent(i,this),this.setParent(this.features,this),this.setParent(this.rules,this)};k.prototype=new i,k.prototype.type="Media",k.prototype.isRulesetLike=function(){return!0},k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},k.prototype.genCSS=function(a,b){b.add("@media ",this._fileInfo,this._index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},k.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new k(null,[],this._index,this._fileInfo,this.visibilityInfo());return this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo),b.features=this.features.eval(a),a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},k.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo()),this.setParent(b,this)}return delete a.mediaBlocks,delete a.mediaPath,b},k.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;b0;b--)a.splice(b,0,new g("and"));return new h(a)})),this.setParent(this.features,this),new d([],[])},k.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(n=!0,k=0;k0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.getIndex(),filename:this.fileInfo().filename};for(k=0;kthis.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;gb?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],74:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};g.prototype=new d,g.prototype.type="Operation",g.prototype.accept=function(a){this.operands=a.visit(this.operands)},g.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof f&&c instanceof e&&(b=b.toColor()),c instanceof f&&b instanceof e&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new g(this.op,[b,c],this.isSpaced)},g.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=g},{"./color":53,"./dimension":60,"./node":73}],75:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":73}],76:[function(a,b,c){var d=a("./node"),e=a("./declaration"),f=function(a,b,c){this.name=a,this._index=b,this._fileInfo=c};f.prototype=new d,f.prototype.type="Property",f.prototype.eval=function(a){var b,c=this.name,d=a.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;if(this.evaluating)throw{type:"Name",message:"Recursive property reference for "+c,filename:this.fileInfo().filename,index:this.getIndex()};if(this.evaluating=!0,b=this.find(a.frames,function(b){var f,g=b.property(c);if(g){for(var h=0;hd){if(!c||c(g)){e=g.find(new i(a.elements.slice(d)),b,c);for(var j=0;j0&&b.add(k),a.firstSelector=!0,h[0].genCSS(a,b),a.firstSelector=!1,d=1;d0?(e=p.copyArray(a),f=e.pop(),g=d.createDerived(p.copyArray(f.elements))):g=d.createDerived([]),b.length>0){var h=c.combinator,i=b[0].elements[0];h.emptyOrWhitespace&&!i.combinator.emptyOrWhitespace&&(h=i.combinator),g.elements.push(new j(h,i.value,c._index,c._fileInfo)),g.elements=g.elements.concat(b[0].elements.slice(1))}if(0!==g.elements.length&&e.push(g),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function g(a,b,c,d,e){var g;for(g=0;g0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new i(a))}}function l(a,b,c){function m(a){var b;return a.value instanceof h?(b=a.value.value,b instanceof i?b:null):null}var n,o,p,q,r,s,t,u,v,w,x=!1;for(q=[],r=[[]],n=0;u=c.elements[n];n++)if("&"!==u.value){var y=m(u);if(null!=y){k(q,r);var z,A=[],B=[];for(z=l(A,b,y),x=x||z,p=0;p0&&t[0].elements.push(new j(u.combinator,"",u._index,u._fileInfo)),s.push(t);else for(p=0;p0&&(a.push(r[n]),w=r[n][v-1],r[n][v-1]=w.createDerived(w.elements,c.extendList));return x}function m(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var n,o,q;if(o=[],q=l(o,b,c),!q)if(b.length>0)for(o=[],n=0;n0)for(b=0;b=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}},copyArray:function(a){var b,c=a.length,d=new Array(c);for(b=0;b=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.fileInfo(),b),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitDeclaration:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;e0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return k0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitAtRule:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitAtRuleOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=i},{"../logger":37,"../tree":65,"../utils":86,"./visitor":94}],88:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],89:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=a("../utils"),h=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};h.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,g.copyArray(this.context.frames)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.getIndex(),f.filename=a.fileInfo().filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;h0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];if(this.keepOnlyVisibleChilds(c),!this.isEmpty(c))return a.ensureVisibility(),a.removeVisibilityBlock(),a},isVisibleRuleset:function(a){return!!a.firstRoot||!this.isEmpty(a)&&!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitDeclaration:function(a,b){if(!a.blocksVisibility()&&!a.variable)return a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){if(!a.blocksVisibility()&&!a.isSilent(this._context))return a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){if(!a.blocksVisibility())return a},visitAtRule:function(a,b){return a.rules&&a.rules.length?this.visitAtRuleWithBody(a,b):this.visitAtRuleWithoutBody(a,b)},visitAnonymous:function(a,b){if(!a.blocksVisibility())return a.accept(this._visitor),a},visitAtRuleWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitAtRuleWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;c0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;b=0;e--)if(c=a[e],c instanceof d.Declaration)if(f[c.name]){b=f[c.name],b instanceof d.Declaration&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);b.indexOf(g)!==-1?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b={},c=[],e=0;e0){var b=a[0],c=[],e=[new d.Expression(c)];a.forEach(function(a){"+"===a.merge&&c.length>0&&e.push(new d.Expression(c=[])),c.push(a.value),b.important=b.important||a.important}),b.value=new d.Value(e)}})}}},b.exports=g},{"../tree":65,"./visitor":94}],94:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitFnCache=[],h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var c,e=this._visitFnCache,f=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=g;if(l.visitDeeper=!0,j||(c="visit"+a.type,j=f[c]||d,k=f[c+"Out"]||d,e[h]=j,e[i]=k),j!==d){var m=j.call(f,a,l);f.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=d&&k.call(f,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;ck){for(var b=0,c=h.length-j;b0||b.isFileProtocol?"development":"production");var c=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(a.location.hash);c&&(b.dumpLineNumbers=c[1]),void 0===b.useFileCache&&(b.useFileCache=!0),void 0===b.onReady&&(b.onReady=!0),b.javascriptEnabled=!(!b.javascriptEnabled&&!b.inlineJavaScript)}},{"./browser":3,"./utils":11}],2:[function(a,b,c){function d(a){a.filename&&console.warn(a),e.async||h.removeChild(i)}a("promise/polyfill");var e=a("../less/default-options")();if(window.less)for(key in window.less)window.less.hasOwnProperty(key)&&(e[key]=window.less[key]);a("./add-default-options")(window,e),e.plugins=e.plugins||[],window.LESS_PLUGINS&&(e.plugins=e.plugins.concat(window.LESS_PLUGINS));var f=b.exports=a("./index")(window,e);window.less=f;var g,h,i;e.onReady&&(/!watch/.test(window.location.hash)&&f.watch(),e.async||(g="body { display: none !important }",h=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),i.type="text/css",i.styleSheet?i.styleSheet.cssText=g:i.appendChild(document.createTextNode(g)),h.appendChild(i)),f.registerStylesheetsImmediately(),f.pageLoadFinished=f.refresh("development"===f.env).then(d,d))},{"../less/default-options":16,"./add-default-options":1,"./index":8,"promise/polyfill":100}],3:[function(a,b,c){var d=a("./utils");b.exports={createCSS:function(a,b,c){var e=c.href||"",f="less:"+(c.title||d.extractId(e)),g=a.getElementById(f),h=!1,i=a.createElement("style");i.setAttribute("type","text/css"),c.media&&i.setAttribute("media",c.media),i.id=f,i.styleSheet||(i.appendChild(a.createTextNode(b)),h=null!==g&&g.childNodes.length>0&&i.childNodes.length>0&&g.firstChild.nodeValue===i.firstChild.nodeValue);var j=a.getElementsByTagName("head")[0];if(null===g||h===!1){var k=c&&c.nextSibling||null;k?k.parentNode.insertBefore(i,k):j.appendChild(i)}if(g&&h===!1&&g.parentNode.removeChild(g),i.styleSheet)try{i.styleSheet.cssText=b}catch(l){throw new Error("Couldn't reassign styleSheet.cssText.")}},currentScript:function(a){var b=a.document;return b.currentScript||function(){var a=b.getElementsByTagName("script");return a[a.length-1]}()}}},{"./utils":11}],4:[function(a,b,c){b.exports=function(a,b,c){var d=null;if("development"!==b.env)try{d="undefined"==typeof a.localStorage?null:a.localStorage}catch(e){}return{setCSS:function(a,b,e,f){if(d){c.info("saving "+a+" to cache.");try{d.setItem(a,f),d.setItem(a+":timestamp",b),e&&d.setItem(a+":vars",JSON.stringify(e))}catch(g){c.error('failed to save "'+a+'" to local storage for caching.')}}},getCSS:function(a,b,c){var e=d&&d.getItem(a),f=d&&d.getItem(a+":timestamp"),g=d&&d.getItem(a+":vars");if(c=c||{},f&&b.lastModified&&new Date(b.lastModified).valueOf()===new Date(f).valueOf()&&(!c&&!g||JSON.stringify(c)===g))return e}}}},{}],5:[function(a,b,c){var d=a("./utils"),e=a("./browser");b.exports=function(a,b,c){function f(b,f){var g,h,i="less-error-message:"+d.extractId(f||""),j='
    • {content}
    • ',k=a.document.createElement("div"),l=[],m=b.filename||f,n=m.match(/([^\/]+(\?.*)?)$/)[1];k.id=i,k.className="less-error-message",h="

      "+(b.type||"Syntax")+"Error: "+(b.message||"There is an error in your .less file")+'

      in '+n+" ";var o=function(a,b,c){void 0!==a.extract[b]&&l.push(j.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};b.line&&(o(b,0,""),o(b,1,"line"),o(b,2,""),h+="on line "+b.line+", column "+(b.column+1)+":

        "+l.join("")+"
      "),b.stack&&(b.extract||c.logLevel>=4)&&(h+="
      Stack Trace
      "+b.stack.split("\n").slice(1).join("
      ")),k.innerHTML=h,e.createCSS(a.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),k.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===c.env&&(g=setInterval(function(){var b=a.document,c=b.body;c&&(b.getElementById(i)?c.replaceChild(k,b.getElementById(i)):c.insertBefore(k,c.firstChild),clearInterval(g))},10))}function g(b){var c=a.document.getElementById("less-error-message:"+d.extractId(b));c&&c.parentNode.removeChild(c)}function h(a){}function i(a){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?h(a):"function"==typeof c.errorReporting&&c.errorReporting("remove",a):g(a)}function j(a,d){var e="{line} {content}",f=a.filename||d,g=[],h=(a.type||"Syntax")+"Error: "+(a.message||"There is an error in your .less file")+" in "+f,i=function(a,b,c){void 0!==a.extract[b]&&g.push(e.replace(/\{line\}/,(parseInt(a.line,10)||0)+(b-1)).replace(/\{class\}/,c).replace(/\{content\}/,a.extract[b]))};a.line&&(i(a,0,""),i(a,1,"line"),i(a,2,""),h+=" on line "+a.line+", column "+(a.column+1)+":\n"+g.join("\n")),a.stack&&(a.extract||c.logLevel>=4)&&(h+="\nStack Trace\n"+a.stack),b.logger.error(h)}function k(a,b){c.errorReporting&&"html"!==c.errorReporting?"console"===c.errorReporting?j(a,b):"function"==typeof c.errorReporting&&c.errorReporting("add",a,b):f(a,b)}return{add:k,remove:i}}},{"./browser":3,"./utils":11}],6:[function(a,b,c){b.exports=function(b,c){var d=a("../less/environment/abstract-file-manager.js"),e={},f=function(){};return f.prototype=new d,f.prototype.alwaysMakePathsAbsolute=function(){return!0},f.prototype.join=function(a,b){return a?this.extractUrlParts(b,a).path:b},f.prototype.doXHR=function(a,d,e,f){function g(b,c,d){b.status>=200&&b.status<300?c(b.responseText,b.getResponseHeader("Last-Modified")):"function"==typeof d&&d(b.status,a)}var h=new XMLHttpRequest,i=!b.isFileProtocol||b.fileAsync;"function"==typeof h.overrideMimeType&&h.overrideMimeType("text/css"),c.debug("XHR: Getting '"+a+"'"),h.open("GET",a,i),h.setRequestHeader("Accept",d||"text/x-less, text/css; q=0.9, */*; q=0.5"),h.send(null),b.isFileProtocol&&!b.fileAsync?0===h.status||h.status>=200&&h.status<300?e(h.responseText):f(h.status,a):i?h.onreadystatechange=function(){4==h.readyState&&g(h,e,f)}:g(h,e,f)},f.prototype.supports=function(a,b,c,d){return!0},f.prototype.clearFileCache=function(){e={}},f.prototype.loadFile=function(a,b,c,d){b&&!this.isPathAbsolute(a)&&(a=b+a),a=c.ext?this.tryAppendExtension(a,c.ext):a,c=c||{};var f=this.extractUrlParts(a,window.location.href),g=f.url,h=this;return new Promise(function(a,b){if(c.useFileCache&&e[g])try{var d=e[g];return a({contents:d,filename:g,webInfo:{lastModified:new Date}})}catch(f){return b({filename:g,message:"Error loading file "+g+" error was "+f.message})}h.doXHR(g,c.mime,function(b,c){e[g]=b,a({contents:b,filename:g,webInfo:{lastModified:c}})},function(a,c){b({type:"File",message:"'"+c+"' wasn't found ("+a+")",href:g})})})},f}},{"../less/environment/abstract-file-manager.js":17}],7:[function(a,b,c){b.exports=function(){function b(){throw{type:"Runtime",message:"Image size functions are not supported in browser version of less"}}var c=a("./../less/functions/function-registry"),d={"image-size":function(a){return b(this,a),-1},"image-width":function(a){return b(this,a),-1},"image-height":function(a){return b(this,a),-1}};c.addMultiple(d)}},{"./../less/functions/function-registry":26}],8:[function(a,b,c){var d=a("./utils").addDataAttr,e=a("./browser");b.exports=function(b,c){function f(a){return JSON.parse(JSON.stringify(a||{}))}function g(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));return a.apply(b,d)}}function h(a){for(var b,d=l.getElementsByTagName("style"),e=0;e=c&&console.log(a)},info:function(a){b.logLevel>=d&&console.log(a)},warn:function(a){b.logLevel>=e&&console.warn(a)},error:function(a){b.logLevel>=f&&console.error(a)}}]);for(var g=0;g0&&(a=a.slice(0,b)),b=a.lastIndexOf("/"),b<0&&(b=a.lastIndexOf("\\")),b<0?"":a.slice(0,b+1)},d.prototype.tryAppendExtension=function(a,b){return/(\.[a-z]*$)|([\?;].*)$/.test(a)?a:a+b},d.prototype.tryAppendLessExtension=function(a){return this.tryAppendExtension(a,".less")},d.prototype.supportsSync=function(){return!1},d.prototype.alwaysMakePathsAbsolute=function(){return!1},d.prototype.isPathAbsolute=function(a){return/^(?:[a-z-]+:|\/|\\|#)/i.test(a)},d.prototype.join=function(a,b){return a?a+b:b},d.prototype.pathDiff=function(a,b){var c,d,e,f,g=this.extractUrlParts(a),h=this.extractUrlParts(b),i="";if(g.hostPart!==h.hostPart)return"";for(d=Math.max(h.directories.length,g.directories.length),c=0;cparseInt(b[c])?-1:1;return 0},g.prototype.versionToString=function(a){for(var b="",c=0;c=0;h--){var i=g[h];if(i[f?"supportsSync":"supports"](a,b,c,e))return i}return null},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},b.exports=e},{"../logger":37}],20:[function(a,b,c){var d=a("./function-registry"),e=a("../tree/anonymous"),f=a("../tree/keyword");d.addMultiple({"boolean":function(a){return a?f.True:f.False},"if":function(a,b,c){return a?b:c||new e}})},{"../tree/anonymous":48,"../tree/keyword":68,"./function-registry":26}],21:[function(a,b,c){function d(a,b,c){var d,f,g,h,i=b.alpha,j=c.alpha,k=[];g=j+i*(1-j);for(var l=0;l<3;l++)d=b.rgb[l]/255,f=c.rgb[l]/255,h=a(d,f),g&&(h=(j*f+i*(d-j*(d+f-h)))/g),k[l]=255*h;return new e(k,g)}var e=a("../tree/color"),f=a("./function-registry"),g={multiply:function(a,b){return a*b},screen:function(a,b){return a+b-a*b},overlay:function(a,b){return a*=2,a<=1?g.multiply(a,b):g.screen(a-1,b)},softlight:function(a,b){var c=1,d=a;return b>.5&&(d=1,c=a>.25?Math.sqrt(a):((16*a-12)*a+4)*a),a-(1-2*b)*d*(c-a)},hardlight:function(a,b){return g.overlay(b,a)},difference:function(a,b){return Math.abs(a-b)},exclusion:function(a,b){return a+b-2*a*b},average:function(a,b){return(a+b)/2},negation:function(a,b){return 1-Math.abs(a+b-1)}};for(var h in g)g.hasOwnProperty(h)&&(d[h]=d.bind(null,g[h]));f.addMultiple(d)},{"../tree/color":53,"./function-registry":26}],22:[function(a,b,c){function d(a){return Math.min(1,Math.max(0,a))}function e(a){return h.hsla(a.h,a.s,a.l,a.a)}function f(a){if(a instanceof i)return parseFloat(a.unit.is("%")?a.value/100:a.value);if("number"==typeof a)return a;throw{type:"Argument",message:"color functions take numbers as parameters"}}function g(a,b){return a instanceof i&&a.unit.is("%")?parseFloat(a.value*b/100):f(a)}var h,i=a("../tree/dimension"),j=a("../tree/color"),k=a("../tree/quoted"),l=a("../tree/anonymous"),m=a("./function-registry");h={rgb:function(a,b,c){return h.rgba(a,b,c,1)},rgba:function(a,b,c,d){var e=[a,b,c].map(function(a){return g(a,255)});return d=f(d),new j(e,d)},hsl:function(a,b,c){return h.hsla(a,b,c,1)},hsla:function(a,b,c,e){function g(a){return a=a<0?a+1:a>1?a-1:a,6*a<1?i+(j-i)*a*6:2*a<1?j:3*a<2?i+(j-i)*(2/3-a)*6:i}var i,j;return a=f(a)%360/360,b=d(f(b)),c=d(f(c)),e=d(f(e)),j=c<=.5?c*(b+1):c+b-c*b,i=2*c-j,h.rgba(255*g(a+1/3),255*g(a),255*g(a-1/3),e)},hsv:function(a,b,c){return h.hsva(a,b,c,1)},hsva:function(a,b,c,d){a=f(a)%360/360*360,b=f(b),c=f(c),d=f(d);var e,g;e=Math.floor(a/60%6),g=a/60-e;var i=[c,c*(1-b),c*(1-g*b),c*(1-(1-g)*b)],j=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return h.rgba(255*i[j[e][0]],255*i[j[e][1]],255*i[j[e][2]],d)},hue:function(a){return new i(a.toHSL().h)},saturation:function(a){return new i(100*a.toHSL().s,"%")},lightness:function(a){return new i(100*a.toHSL().l,"%")},hsvhue:function(a){return new i(a.toHSV().h)},hsvsaturation:function(a){return new i(100*a.toHSV().s,"%")},hsvvalue:function(a){return new i(100*a.toHSV().v,"%")},red:function(a){return new i(a.rgb[0])},green:function(a){return new i(a.rgb[1])},blue:function(a){return new i(a.rgb[2])},alpha:function(a){return new i(a.toHSL().a)},luma:function(a){return new i(a.luma()*a.alpha*100,"%")},luminance:function(a){var b=.2126*a.rgb[0]/255+.7152*a.rgb[1]/255+.0722*a.rgb[2]/255;return new i(b*a.alpha*100,"%")},saturate:function(a,b,c){if(!a.rgb)return null;var f=a.toHSL();return f.s+="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},desaturate:function(a,b,c){var f=a.toHSL();return f.s-="undefined"!=typeof c&&"relative"===c.value?f.s*b.value/100:b.value/100,f.s=d(f.s),e(f)},lighten:function(a,b,c){var f=a.toHSL();return f.l+="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},darken:function(a,b,c){var f=a.toHSL();return f.l-="undefined"!=typeof c&&"relative"===c.value?f.l*b.value/100:b.value/100,f.l=d(f.l),e(f)},fadein:function(a,b,c){var f=a.toHSL();return f.a+="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fadeout:function(a,b,c){var f=a.toHSL();return f.a-="undefined"!=typeof c&&"relative"===c.value?f.a*b.value/100:b.value/100,f.a=d(f.a),e(f)},fade:function(a,b){var c=a.toHSL();return c.a=b.value/100,c.a=d(c.a),e(c)},spin:function(a,b){var c=a.toHSL(),d=(c.h+b.value)%360;return c.h=d<0?360+d:d,e(c)},mix:function(a,b,c){a.toHSL&&b.toHSL||(console.log(b.type),console.dir(b)),c||(c=new i(50));var d=c.value/100,e=2*d-1,f=a.toHSL().a-b.toHSL().a,g=((e*f==-1?e:(e+f)/(1+e*f))+1)/2,h=1-g,k=[a.rgb[0]*g+b.rgb[0]*h,a.rgb[1]*g+b.rgb[1]*h,a.rgb[2]*g+b.rgb[2]*h],l=a.alpha*d+b.alpha*(1-d);return new j(k,l)},greyscale:function(a){return h.desaturate(a,new i(100))},contrast:function(a,b,c,d){if(!a.rgb)return null;if("undefined"==typeof c&&(c=h.rgba(255,255,255,1)),"undefined"==typeof b&&(b=h.rgba(0,0,0,1)),b.luma()>c.luma()){var e=c;c=b,b=e}return d="undefined"==typeof d?.43:f(d),a.luma()=v&&this.context.ieCompat!==!1?(h.warn("Skipped data-uri embedding of "+j+" because its size ("+u.length+" characters) exceeds IE8-safe "+v+" characters!"),g(this,f||a)):new d(new c('"'+u+'"',u,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../logger":37,"../tree/quoted":77,"../tree/url":82,"../utils":86,"./function-registry":26}],24:[function(a,b,c){var d=a("../tree/keyword"),e=a("./function-registry"),f={eval:function(){var a=this.value_,b=this.error_;if(b)throw b;if(null!=a)return a?d.True:d.False},value:function(a){this.value_=a},error:function(a){this.error_=a},reset:function(){this.value_=this.error_=null}};e.add("default",f.eval.bind(f)),b.exports=f},{"../tree/keyword":68,"./function-registry":26}],25:[function(a,b,c){var d=a("../tree/expression"),e=function(a,b,c,d){this.name=a.toLowerCase(),this.index=c,this.context=b,this.currentFileInfo=d,this.func=b.frames[0].functionRegistry.get(this.name)};e.prototype.isValid=function(){return Boolean(this.func)},e.prototype.call=function(a){return Array.isArray(a)&&(a=a.filter(function(a){return"Comment"!==a.type}).map(function(a){if("Expression"===a.type){var b=a.value.filter(function(a){return"Comment"!==a.type});return 1===b.length?b[0]:new d(b)}return a})),this.func.apply(this,a)},b.exports=e},{"../tree/expression":62}],26:[function(a,b,c){function d(a){return{_data:{},add:function(a,b){a=a.toLowerCase(),this._data.hasOwnProperty(a),this._data[a]=b},addMultiple:function(a){Object.keys(a).forEach(function(b){this.add(b,a[b])}.bind(this))},get:function(b){return this._data[b]||a&&a.get(b)},getLocalFunctions:function(){return this._data},inherit:function(){return d(this)},create:function(a){return d(a)}}}b.exports=d(null)},{}],27:[function(a,b,c){b.exports=function(b){var c={functionRegistry:a("./function-registry"),functionCaller:a("./function-caller")};return a("./boolean"),a("./default"),a("./color"),a("./color-blending"),a("./data-uri")(b),a("./math"),a("./number"),a("./string"),a("./svg")(b),a("./types"),c}},{"./boolean":20,"./color":22,"./color-blending":21,"./data-uri":23,"./default":24,"./function-caller":25,"./function-registry":26,"./math":29,"./number":30,"./string":31,"./svg":32,"./types":33}],28:[function(a,b,c){var d=a("../tree/dimension"),e=function(){};e._math=function(a,b,c){if(!(c instanceof d))throw{ +type:"Argument",message:"argument must be a number"};return null==b?b=c.unit:c=c.unify(),new d(a(parseFloat(c.value)),b)},b.exports=e},{"../tree/dimension":60}],29:[function(a,b,c){var d=a("./function-registry"),e=a("./math-helper.js"),f={ceil:null,floor:null,sqrt:null,abs:null,tan:"",sin:"",cos:"",atan:"rad",asin:"rad",acos:"rad"};for(var g in f)f.hasOwnProperty(g)&&(f[g]=e._math.bind(null,Math[g],f[g]));f.round=function(a,b){var c="undefined"==typeof b?0:b.value;return e._math(function(a){return a.toFixed(c)},null,a)},d.addMultiple(f)},{"./function-registry":26,"./math-helper.js":28}],30:[function(a,b,c){var d=a("../tree/dimension"),e=a("../tree/anonymous"),f=a("./function-registry"),g=a("./math-helper.js"),h=function(a,b){switch(b=Array.prototype.slice.call(b),b.length){case 0:throw{type:"Argument",message:"one or more arguments required"}}var c,f,g,h,i,j,k,l,m=[],n={};for(c=0;ci.value)&&(m[f]=g);else{if(void 0!==k&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}else Array.isArray(b[c].value)&&Array.prototype.push.apply(b,Array.prototype.slice.call(b[c].value));return 1==m.length?m[0]:(b=m.map(function(a){return a.toCSS(this.context)}).join(this.context.compress?",":", "),new e((a?"min":"max")+"("+b+")"))};f.addMultiple({min:function(){return h(!0,arguments)},max:function(){return h(!1,arguments)},convert:function(a,b){return a.convertTo(b.value)},pi:function(){return new d(Math.PI)},mod:function(a,b){return new d(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeof a&&"number"==typeof b)a=new d(a),b=new d(b);else if(!(a instanceof d&&b instanceof d))throw{type:"Argument",message:"arguments must be numbers"};return new d(Math.pow(a.value,b.value),a.unit)},percentage:function(a){var b=g._math(function(a){return 100*a},"%",a);return b}})},{"../tree/anonymous":48,"../tree/dimension":60,"./function-registry":26,"./math-helper.js":28}],31:[function(a,b,c){var d=a("../tree/quoted"),e=a("../tree/anonymous"),f=a("../tree/javascript"),g=a("./function-registry");g.addMultiple({e:function(a){return new e(a instanceof f?a.evaluated:a.value)},escape:function(a){return new e(encodeURI(a.value).replace(/=/g,"%3D").replace(/:/g,"%3A").replace(/#/g,"%23").replace(/;/g,"%3B").replace(/\(/g,"%28").replace(/\)/g,"%29"))},replace:function(a,b,c,e){var f=a.value;return c="Quoted"===c.type?c.value:c.toCSS(),f=f.replace(new RegExp(b.value,e?e.value:""),c),new d(a.quote||"",f,a.escaped)},"%":function(a){for(var b=Array.prototype.slice.call(arguments,1),c=a.value,e=0;e",k=0;k";return j+="',j=encodeURIComponent(j),j="data:image/svg+xml,"+j,new g(new f("'"+j+"'",j,(!1),this.index,this.currentFileInfo),this.index,this.currentFileInfo)})}},{"../tree/color":53,"../tree/dimension":60,"../tree/expression":62,"../tree/quoted":77,"../tree/url":82,"./function-registry":26}],33:[function(a,b,c){var d=a("../tree/keyword"),e=a("../tree/detached-ruleset"),f=a("../tree/dimension"),g=a("../tree/color"),h=a("../tree/quoted"),i=a("../tree/anonymous"),j=a("../tree/url"),k=a("../tree/operation"),l=a("./function-registry"),m=function(a,b){return a instanceof b?d.True:d.False},n=function(a,b){if(void 0===b)throw{type:"Argument",message:"missing the required second argument to isunit."};if(b="string"==typeof b.value?b.value:b,"string"!=typeof b)throw{type:"Argument",message:"Second argument to isunit should be a unit or a string."};return a instanceof f&&a.unit.is(b)?d.True:d.False},o=function(a){var b=Array.isArray(a.value)?a.value:Array(a);return b};l.addMultiple({isruleset:function(a){return m(a,e)},iscolor:function(a){return m(a,g)},isnumber:function(a){return m(a,f)},isstring:function(a){return m(a,h)},iskeyword:function(a){return m(a,d)},isurl:function(a){return m(a,j)},ispixel:function(a){return n(a,"px")},ispercentage:function(a){return n(a,"%")},isem:function(a){return n(a,"em")},isunit:n,unit:function(a,b){if(!(a instanceof f))throw{type:"Argument",message:"the first argument to unit must be a number"+(a instanceof k?". Have you forgotten parenthesis?":"")};return b=b?b instanceof d?b.value:b.toCSS():"",new f(a.value,b)},"get-unit":function(a){return new i(a.unit)},extract:function(a,b){return b=b.value-1,o(a)[b]},length:function(a){return new f(o(a).length)}})},{"../tree/anonymous":48,"../tree/color":53,"../tree/detached-ruleset":59,"../tree/dimension":60,"../tree/keyword":68,"../tree/operation":74,"../tree/quoted":77,"../tree/url":82,"./function-registry":26}],34:[function(a,b,c){var d=a("./contexts"),e=a("./parser/parser"),f=a("./less-error"),g=a("./utils");"undefined"==typeof Promise?a("promise"):Promise;b.exports=function(a){var b=function(a,b,c){this.less=a,this.rootFilename=c.filename,this.paths=b.paths||[],this.contents={},this.contentsIgnoredChars={},this.mime=b.mime,this.error=null,this.context=b,this.queue=[],this.files={}};return b.prototype.push=function(b,c,h,i,j){var k=this,l=this.context.pluginManager.Loader;this.queue.push(b);var m=function(a,c,d){k.queue.splice(k.queue.indexOf(b),1);var e=d===k.rootFilename;i.optional&&a?j(null,{rules:[]},!1,null):(k.files[d]||(k.files[d]={root:c,options:i}),a&&!k.error&&(k.error=a),j(a,c,e,d))},n={relativeUrls:this.context.relativeUrls,entryPath:h.entryPath,rootpath:h.rootpath,rootFilename:h.rootFilename},o=a.getFileManager(b,h.currentDirectory,this.context,a);if(!o)return void m({message:"Could not find a file-manager for "+b});var p,q=function(a){var b,c=a.filename,g=a.contents.replace(/^\uFEFF/,"");n.currentDirectory=o.getPath(c),n.relativeUrls&&(n.rootpath=o.join(k.context.rootpath||"",o.pathDiff(n.currentDirectory,n.entryPath)),!o.isPathAbsolute(n.rootpath)&&o.alwaysMakePathsAbsolute()&&(n.rootpath=o.join(n.entryPath,n.rootpath))),n.filename=c;var j=new d.Parse(k.context);j.processImports=!1,k.contents[c]=g,(h.reference||i.reference)&&(n.reference=!0),i.isPlugin?(b=l.evalPlugin(g,j,k,i.pluginArgs,n),b instanceof f?m(b,null,c):m(null,b,c)):i.inline?m(null,g,c):!k.files[c]||k.files[c].options.multiple||i.multiple?new e(j,k,n).parse(g,function(a,b){m(a,b,c)}):m(null,k.files[c].root,c)},r=g.clone(this.context);c&&(r.ext=i.isPlugin?".js":".less"),p=i.isPlugin?l.loadPlugin(b,h.currentDirectory,r,a,o):o.loadFile(b,h.currentDirectory,r,a,function(a,b){a?m(a):q(b)}),p&&p.then(q,m)},b}},{"./contexts":12,"./less-error":36,"./parser/parser":42,"./utils":86,promise:void 0}],35:[function(a,b,c){b.exports=function(b,c){var d,e,f,g,h,i,j={version:[3,0,0],data:a("./data"),tree:a("./tree"),Environment:h=a("./environment/environment"),AbstractFileManager:a("./environment/abstract-file-manager"),AbstractPluginLoader:a("./environment/abstract-plugin-loader"),environment:b=new h(b,c),visitors:a("./visitors"),Parser:a("./parser/parser"),functions:a("./functions")(b),contexts:a("./contexts"),SourceMapOutput:d=a("./source-map-output")(b),SourceMapBuilder:e=a("./source-map-builder")(d,b),ParseTree:f=a("./parse-tree")(e),ImportManager:g=a("./import-manager")(b),render:a("./render")(b,f,g),parse:a("./parse")(b,f,g),LessError:a("./less-error"),transformTree:a("./transform-tree"),utils:a("./utils"),PluginManager:a("./plugin-manager"),logger:a("./logger")},k=function(a){return function(){var b=Object.create(a.prototype);return a.apply(b,Array.prototype.slice.call(arguments,0)),b}},l=Object.create(j);for(var m in j.tree)if(i=j.tree[m],"function"==typeof i)l[m.toLowerCase()]=k(i);else{l[m]=Object.create(null);for(var n in i)l[m][n.toLowerCase()]=k(i[n])}return l}},{"./contexts":12,"./data":14,"./environment/abstract-file-manager":17,"./environment/abstract-plugin-loader":18,"./environment/environment":19,"./functions":27,"./import-manager":34,"./less-error":36,"./logger":37,"./parse":39,"./parse-tree":38,"./parser/parser":42,"./plugin-manager":43,"./render":44,"./source-map-builder":45,"./source-map-output":46,"./transform-tree":47,"./tree":65,"./utils":86,"./visitors":90}],36:[function(a,b,c){var d=a("./utils"),e=b.exports=function(a,b,c){Error.call(this);var e=a.filename||c;if(this.message=a.message,this.stack=a.stack,b&&e){var f=b.contents[e],g=d.getLocation(a.index,f),h=g.line,i=g.column,j=a.call&&d.getLocation(a.call,f).line,k=f.split("\n");if(this.type=a.type||"Syntax",this.filename=e,this.index=a.index,this.line="number"==typeof h?h+1:null,this.column=i,!this.line&&this.stack){var l=this.stack.match(/(|Function):(\d+):(\d+)/);l&&(l[2]&&(this.line=parseInt(l[2])-2),l[3]&&(this.column=parseInt(l[3])))}this.callLine=j+1,this.callExtract=k[j],this.extract=[k[this.line-2],k[this.line-1],k[this.line]]}};if("undefined"==typeof Object.create){var f=function(){};f.prototype=Error.prototype,e.prototype=new f}else e.prototype=Object.create(Error.prototype);e.prototype.constructor=e,e.prototype.toString=function(a){a=a||{};var b="",c=this.extract||[],d=[],e=function(a){return a};if(a.stylize){var f=typeof a.stylize;if("function"!==f)throw Error("options.stylize should be a function, got a "+f+"!");e=a.stylize}if(null!==this.line){if("string"==typeof c[0]&&d.push(e(this.line-1+" "+c[0],"grey")),"string"==typeof c[1]){var g=this.line+" ";c[1]&&(g+=c[1].slice(0,this.column)+e(e(e(c[1].substr(this.column,1),"bold")+c[1].slice(this.column+1),"red"),"inverse")),d.push(g)}"string"==typeof c[2]&&d.push(e(this.line+1+" "+c[2],"grey")),d=d.join("\n")+e("","reset")+"\n"}return b+=e(this.type+"Error: "+this.message,"red"),this.filename&&(b+=e(" in ","red")+this.filename),this.line&&(b+=e(" on line "+this.line+", column "+(this.column+1)+":","grey")),b+="\n"+d,this.callLine&&(b+=e("from ","red")+(this.filename||"")+"/n",b+=e(this.callLine,"grey")+" "+this.callExtract+"/n"),b}},{"./utils":86}],37:[function(a,b,c){b.exports={error:function(a){this._fireEvent("error",a)},warn:function(a){this._fireEvent("warn",a)},info:function(a){this._fireEvent("info",a)},debug:function(a){this._fireEvent("debug",a)},addListener:function(a){this._listeners.push(a)},removeListener:function(a){for(var b=0;b=97&&j<=122||j<34))switch(j){case 40:o++,e=h;continue;case 41:if(--o<0)return b("missing opening `(`",h);continue;case 59:o||c();continue;case 123:n++,d=h;continue;case 125:if(--n<0)return b("missing opening `{`",h);n||o||c();continue;case 92:if(h96)){if(k==j){l=1;break}if(92==k){if(h==m-1)return b("unescaped `\\`",h);h++}}if(l)continue;return b("unmatched `"+String.fromCharCode(j)+"`",i);case 47:if(o||h==m-1)continue;if(k=a.charCodeAt(h+1),47==k)for(h+=2;hd&&g>f?b("missing closing `}` or `*/`",d):b("missing closing `}`",d):0!==o?b("missing closing `)`",e):(c(!0),p)}},{}],41:[function(a,b,c){var d=a("./chunker");b.exports=function(){function a(d){for(var e,f,j,p=k.i,q=c,s=k.i-i,t=k.i+h.length-s,u=k.i+=d,v=b;k.i=0){j={index:k.i,text:v.substr(k.i,x+2-k.i),isLineComment:!1},k.i+=j.text.length-1,k.commentStore.push(j);continue}}break}if(e!==l&&e!==n&&e!==m&&e!==o)break}if(h=h.slice(d+k.i-u+s),i=k.i,!h.length){if(ce||k.i===e&&a&&!f)&&(e=k.i,f=a);var b=j.pop();h=b.current,i=k.i=b.i,c=b.j},k.forget=function(){j.pop()},k.isWhitespace=function(a){var c=k.i+(a||0),d=b.charCodeAt(c);return d===l||d===o||d===m||d===n},k.$re=function(b){k.i>i&&(h=h.slice(k.i-i),i=k.i);var c=b.exec(h);return c?(a(c[0].length),"string"==typeof c?c:1===c.length?c[0]:c):null},k.$char=function(c){return b.charAt(k.i)!==c?null:(a(1),c)},k.$str=function(c){for(var d=c.length,e=0;es||a=b.length;return k.i=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":40}],42:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=a("../functions/function-registry"),j=function k(a,b,c){function j(a,e){throw new d({index:q.i,filename:c.filename,type:e||"Syntax",message:a},b)}function l(a,b,c){var d=a instanceof Function?a.call(p):q.$re(a);return d?d:void j(b||("string"==typeof a?"expected '"+a+"' got '"+q.currentChar()+"'":"unexpected token"))}function m(a,b){return q.$char(a)?a:void j(b||"expected '"+a+"' got '"+q.currentChar()+"'")}function n(a){var b=c.filename;return{lineNumber:h.getLocation(a,q.getInput()).line+1,fileName:b}}function o(a,c,e,f,g){var h,i=[],j=q;try{j.start(a,!1,function(a,b){g({message:a,index:b+e})});for(var k,l,m=0;k=c[m];m++)l=j.i,h=p[k](),h?(h._index=l+e,h._fileInfo=f,i.push(h)):i.push(null);var n=j.end();n.isFinished?g(null,i):g(!0,null)}catch(o){throw new d({index:o.index+e,message:o.message},b,f.filename)}}var p,q=g();return{parserInput:q,imports:b,fileInfo:c,parseNode:o,parse:function(g,h,j){var l,m,n,o,p=null,r="";if(m=j&&j.globalVars?k.serializeVars(j.globalVars)+"\n":"",n=j&&j.modifyVars?"\n"+k.serializeVars(j.modifyVars):"",a.pluginManager)for(var s=a.pluginManager.getPreProcessors(),t=0;t")}return b&&(q.$char("(")&&(h=this.args(!0).args,m(")")),p.important()&&(j=!0),p.end())?(q.forget(),new e.mixin.Call(b,h,k,c,j)):void q.restore()}},args:function(a){var b,c,d,f,g,h,i,k=p.entities,l={args:null,variadic:!1},m=[],n=[],o=[];for(q.save();;){if(a)h=p.detachedRuleset()||p.expression();else{if(q.commentStore.length=0,q.$str("...")){l.variadic=!0,q.$char(";")&&!b&&(b=!0),(b?n:o).push({variadic:!0});break}h=k.variable()||k.property()||k.literal()||k.keyword()}if(!h)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var r=null;if(a?h.value&&1==h.value.length&&(r=h.value[0]):r=h,r&&(r instanceof e.Variable||r instanceof e.Property))if(q.$char(":")){if(m.length>0&&(b&&j("Cannot mix ; and , as delimiter types"),c=!0),g=p.detachedRuleset()||p.expression(),!g){if(!a)return q.restore(),l.args=[],l;j("could not understand value for named argument")}f=d=r.name}else if(q.$str("...")){if(!a){l.variadic=!0,q.$char(";")&&!b&&(b=!0),(b?n:o).push({name:h.name,variadic:!0});break}i=!0}else a||(d=f=r.name,g=null);g&&m.push(g),o.push({name:f,value:g,expand:i}),q.$char(",")||(q.$char(";")||b)&&(c&&j("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),n.push({name:d,value:g,expand:i}),d=null,m=[],c=!1)}return q.forget(),l.args=b?n:o,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==q.currentChar()&&"#"!==q.currentChar()||q.peek(/^[^{]*\}/)))if(q.save(),b=q.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!q.$char(")"))return void q.restore("Missing closing ')'");if(q.commentStore.length=0,q.$str("when")&&(d=l(p.conditions,"expected condition")),c=p.block())return q.forget(),new e.mixin.Definition(a,f,c,d,g);q.restore()}else q.forget()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.property()||a.call()||a.keyword()||a.javascript()},end:function(){return q.$char(";")||q.peek("}")},ieAlpha:function(){var a;if(q.$re(/^opacity=/i))return a=q.$re(/^\d+/),a||(a=l(p.entities.variable,"Could not parse alpha"),a="@{"+a.name.slice(1)+"}"),m(")"),new e.Quoted("","alpha(opacity="+a+")")},element:function(){var a,b,d,f=q.i;if(b=this.combinator(),a=q.$re(/^(?:\d+\.\d+|\d+)%/)||q.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||q.$char("*")||q.$char("&")||this.attribute()||q.$re(/^\([^&()@]+\)/)||q.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),a||(q.save(),q.$char("(")?(d=this.selector(!1))&&q.$char(")")?(a=new e.Paren(d),q.forget()):q.restore("Missing closing ')'"):q.forget()),a)return new e.Element(b,a,f,c)},combinator:function(){var a=q.currentChar();if("/"===a){q.save();var b=q.$re(/^\/[a-z]+\//i);if(b)return q.forget(),new e.Combinator(b);q.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(q.i++,"^"===a&&"^"===q.currentChar()&&(a="^^",q.i++);q.isWhitespace();)q.i++;return new e.Combinator(a)}return new e.Combinator(q.isWhitespace(-1)?" ":null)},selector:function(a){var b,d,f,g,h,i,k,m=q.i;for(a=a!==!1;(a&&(d=this.extend())||a&&(i=q.$str("when"))||(g=this.element()))&&(i?k=l(this.conditions,"expected condition"):k?j("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&j("Extend can only be used at the end of selector"),f=q.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,k,m,c):void(h&&j("Extend must be used to extend a selector, it cannot be used on its own"))},attribute:function(){if(q.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=l(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=q.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||q.$re(/^[0-9]+%/)||q.$re(/^[\w-]+/)||d.variableCurly()),m("]"),new e.Attribute(a,c,b)}},block:function(){var a;if(q.$char("{")&&(a=this.primary())&&q.$char("}"))return a},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a=this.blockRuleset();if(a)return new e.DetachedRuleset(a)},ruleset:function(){var b,c,d,f;for(q.save(),a.dumpLineNumbers&&(f=n(q.i));;){if(c=this.selector(),!c)break;if(b?b.push(c):b=[c],q.commentStore.length=0,c.condition&&b.length>1&&j("Guards are only currently allowed on a single selector."),!q.$char(","))break;c.condition&&j("Guards are only currently allowed on a single selector."),q.commentStore.length=0}if(b&&(d=this.block())){q.forget();var g=new e.Ruleset(b,d,a.strictImports);return a.dumpLineNumbers&&(g.debugInfo=f),g}q.restore()},declaration:function(){var a,b,d,f,g,h=q.i,i=q.currentChar();if("."!==i&&"#"!==i&&"&"!==i&&":"!==i)if(q.save(),a=this.variable()||this.ruleProperty()){if(g="string"==typeof a,g&&(b=this.detachedRuleset()),q.commentStore.length=0,!b){if(f=!g&&a.length>1&&a.pop().value,b=this.anonymousValue())return q.forget(),new e.Declaration(a,b,(!1),f,h,c);b||(b=this.value()),d=this.important()}if(b&&this.end())return q.forget(),new e.Declaration(a,b,d,f,h,c);q.restore()}else q.restore()},anonymousValue:function(){var a=q.i,b=q.$re(/^([^@\$+\/'"*`(;{}-]*);/);if(b)return new e.Anonymous(b[1],a)},"import":function(){var a,b,d=q.i,f=q.$re(/^@import?\s+/);if(f){var g=(f?this.importOptions():null)||{};if(a=this.entities.quoted()||this.entities.url())return b=this.mediaFeatures(),q.$char(";")||(q.i=d,j("missing semi-colon or unrecognised media features on import")),b=b&&new e.Value(b),new e.Import(a,b,g,d,c);q.i=d,j("malformed import statement")}},importOptions:function(){var a,b,c,d={};if(!q.$char("("))return null;do if(a=this.importOption()){switch(b=a,c=!0,b){case"css":b="less",c=!1;break;case"once":b="multiple",c=!1}if(d[b]=c,!q.$char(","))break}while(a);return m(")"),d},importOption:function(){var a=q.$re(/^(less|css|multiple|once|inline|reference|optional)/);if(a)return a[1]},mediaFeature:function(){var a,b,d=this.entities,f=[];q.save();do a=d.keyword()||d.variable(),a?f.push(a):q.$char("(")&&(b=this.property(),a=this.value(),q.$char(")")?b&&a?f.push(new e.Paren(new e.Declaration(b,a,null,null,q.i,c,(!0)))):a?f.push(new e.Paren(a)):j("badly formed media feature definition"):j("Missing closing ')'","Parse"));while(a);if(q.forget(),f.length>0)return new e.Expression(f)},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!q.$char(","))break}else if(a=b.variable(),a&&(c.push(a),!q.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=q.i;return a.dumpLineNumbers&&(g=n(h)),q.save(),q.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||j("media definitions require block statements after any features"),q.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void q.restore()},plugin:function(){ +var a,b,d,f=q.i,g=q.$re(/^@plugin?\s+/);if(g){if(b=this.pluginArgs(),d=b?{pluginArgs:b,isPlugin:!0}:{isPlugin:!0},a=this.entities.quoted()||this.entities.url())return q.$char(";")||(q.i=f,j("missing semi-colon on @plugin")),new e.Import(a,null,d,f,c);q.i=f,j("malformed @plugin statement")}},pluginArgs:function(){if(q.save(),!q.$char("("))return q.restore(),null;var a=q.$re(/^\s*([^\);]+)\)\s*/);return a[1]?(q.forget(),a[1].trim()):(q.restore(),null)},atrule:function(){var b,d,f,g,h,i,k,l=q.i,m=!0,o=!0;if("@"===q.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(q.save(),b=q.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,m=!1;break;case"@namespace":i=!0,m=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,o=!1;break;default:k=!0}return q.commentStore.length=0,h?(d=this.entity(),d||j("expected "+b+" identifier")):i?(d=this.expression(),d||j("expected "+b+" expression")):k&&(d=(q.$re(/^[^{;]+/)||"").trim(),m="{"==q.currentChar(),d&&(d=new e.Anonymous(d))),m&&(f=this.blockRuleset()),f||!m&&d&&q.$char(";")?(q.forget(),new e.AtRule(b,d,f,l,c,a.dumpLineNumbers?n(l):null,o)):void q.restore("at-rule options not recognised")}}},value:function(){var a,b=[],c=q.i;do if(a=this.expression(),a&&(b.push(a),!q.$char(",")))break;while(a);if(b.length>0)return new e.Value(b,c)},important:function(){if("!"===q.currentChar())return q.$re(/^! *important/)},sub:function(){var a,b;return q.save(),q.$char("(")?(a=this.addition(),a&&q.$char(")")?(q.forget(),b=new e.Expression([a]),b.parens=!0,b):void q.restore("Expected ')'")):void q.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=q.isWhitespace(-1);;){if(q.peek(/^\/[*\/]/))break;if(q.save(),c=q.$char("/")||q.$char("*"),!c){q.forget();break}if(b=this.operand(),!b){q.restore();break}q.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=q.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=q.isWhitespace(-1);;){if(c=q.$re(/^[-+]\s+/)||!f&&(q.$char("+")||q.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=q.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=q.i;if(a=this.condition()){for(;;){if(!q.peek(/^,\s*(not\s*)?\(/)||!q.$char(","))break;if(b=this.condition(),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(){function a(){return q.$str("or")}var b,c,d;if(b=this.conditionAnd(this)){if(c=a()){if(d=this.condition(),!d)return;b=new e.Condition(c,b,d)}return b}},conditionAnd:function(){function a(a){return a.negatedCondition()||a.parenthesisCondition()}function b(){return q.$str("and")}var c,d,f;if(c=a(this)){if(d=b()){if(f=this.conditionAnd(),!f)return;c=new e.Condition(d,c,f)}return c}},negatedCondition:function(){if(q.$str("not")){var a=this.parenthesisCondition();return a&&(a.negate=!a.negate),a}},parenthesisCondition:function(){function a(a){var b;return q.save(),(b=a.condition())&&q.$char(")")?(q.forget(),b):void q.restore()}var b;return q.save(),q.$str("(")?(b=a(this))?(q.forget(),b):(b=this.atomicCondition())?q.$char(")")?(q.forget(),b):void q.restore("expected ')' got '"+q.currentChar()+"'"):void q.restore():void q.restore()},atomicCondition:function(){var a,b,c,d,f=this.entities,g=q.i;if(a=this.addition()||f.keyword()||f.quoted())return q.$char(">")?d=q.$char("=")?">=":">":q.$char("<")?d=q.$char("=")?"<=":"<":q.$char("=")&&(d=q.$char(">")?"=>":q.$char("<")?"=<":"="),d?(b=this.addition()||f.keyword()||f.quoted(),b?c=new e.Condition(d,a,b,g,(!1)):j("expected expression")):c=new e.Condition("=",a,new e.Keyword("true"),g,(!1)),c},operand:function(){var a,b=this.entities;q.peek(/^-[@\$\(]/)&&(a=q.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.property()||b.call()||b.colorKeyword();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[],d=q.i;do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),q.peek(/^\/[\/*]/)||(b=q.$char("/"),b&&c.push(new e.Anonymous(b,d)))));while(a);if(c.length>0)return new e.Expression(c)},property:function(){var a=q.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(a)return a[1]},ruleProperty:function(){function a(a){var b=q.i,c=q.$re(a);if(c)return g.push(b),f.push(c[1])}var b,d,f=[],g=[];q.save();var h=q.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],q.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(q.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;d=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},e.prototype.addPostProcessor=function(a,b){var c;for(c=0;c=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.getPreProcessors=function(){for(var a=[],b=0;b0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],47:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Declaration("@"+a,b,(!1),null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j,k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor((!0)),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})];if(b.pluginManager)for(j=b.pluginManager.visitor(),j.first();i=j.get();)i.isPreEvalVisitor&&i.run(a);c=a.eval(h);for(var l=0;l.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(d="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":73}],57:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],58:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;c-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&c<1&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":15,"./color":53,"./node":73,"./unit":81}],61:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./combinator"),g=function(a,b,c,d,e){this.combinator=a instanceof f?a:new f(a),this.value="string"==typeof b?b.trim():b?b:"",this._index=c,this._fileInfo=d,this.copyVisibilityInfo(e),this.setParent(this.combinator,this)};g.prototype=new d,g.prototype.type="Element",g.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},g.prototype.eval=function(a){return new g(this.combinator,this.value.eval?this.value.eval(a):this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.fileInfo(),this.getIndex())},g.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof e&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=g},{"./combinator":54,"./node":73,"./paren":75}],62:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./comment"),g=function(a){if(this.value=a,!a)throw new Error("Expression requires an array parameter")};g.prototype=new d,g.prototype.type="Expression",g.prototype.accept=function(a){this.value=a.visitArray(this.value)},g.prototype.eval=function(a){var b,c=this.parens&&!this.parensInOp,d=!1;return c&&a.inParenthesis(),this.value.length>1?b=new g(this.value.map(function(b){return b.eval(a)})):1===this.value.length?(this.value[0].parens&&!this.value[0].parensInOp&&(d=!0),b=this.value[0].eval(a)):b=this,c&&a.outOfParenthesis(),this.parens&&this.parensInOp&&!a.isMathOn()&&!d&&(b=new e(b)),b},g.prototype.genCSS=function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":73,"./selector":79}],64:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=a("../utils"),k=a("../less-error"),l=function(a,b,c,d,e,f){if(this.options=c,this._index=d,this._fileInfo=e,this.path=a,this.features=b,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f),this.setParent(this.features,this),this.setParent(this.path,this)};l.prototype=new d,l.prototype.type="Import",l.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.isPlugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},l.prototype.genCSS=function(a,b){this.css&&void 0===this.path._fileInfo.reference&&(b.add("@import ",this._fileInfo,this._index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},l.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},l.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),!(a instanceof g)||a.containsVariables()},l.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new l(b.eval(a),this.features,this.options,this._index,this._fileInfo,this.visibilityInfo())},l.prototype.evalPath=function(a){var b=this.path.eval(a),c=this._fileInfo&&this._fileInfo.rootpath;if(!(b instanceof f)){if(c){var d=b.value;d&&a.isPathRelative(d)&&(b.value=c+d)}b.value=a.normalizePath(b.value)}return b},l.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){ +a.addVisibilityBlock()}):b.addVisibilityBlock()),b},l.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a);if(this.options.isPlugin){if(this.root&&this.root.eval)try{this.root.eval(a)}catch(f){throw f.message="Plugin error during evaluation",new k(f,this.root.imports,this.root.filename)}return c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[]}if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var g=new i(this.root,0,{filename:this.importedFilename,reference:this.path._fileInfo&&this.path._fileInfo.reference},(!0),(!0));return this.features?new e([g],this.features.value):[g]}if(this.css){var m=new l(this.evalPath(a),d,this.options,this._index);if(!m.css&&this.error)throw this.error;return m}return b=new h(null,j.copyArray(this.root.rules)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=l},{"../less-error":36,"../utils":86,"./anonymous":48,"./media":69,"./node":73,"./quoted":77,"./ruleset":78,"./url":82}],65:[function(a,b,c){var d=Object.create(null);d.Node=a("./node"),d.Color=a("./color"),d.AtRule=a("./atrule"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Property=a("./property"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Declaration=a("./declaration"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.VariableCall=a("./variable-call"),b.exports=d},{"./anonymous":48,"./assignment":49,"./atrule":50,"./attribute":51,"./call":52,"./color":53,"./combinator":54,"./comment":55,"./condition":56,"./declaration":58,"./detached-ruleset":59,"./dimension":60,"./element":61,"./expression":62,"./extend":63,"./import":64,"./javascript":66,"./keyword":68,"./media":69,"./mixin-call":70,"./mixin-definition":71,"./negative":72,"./node":73,"./operation":74,"./paren":75,"./property":76,"./quoted":77,"./ruleset":78,"./selector":79,"./unicode-descriptor":80,"./unit":81,"./url":82,"./value":83,"./variable":85,"./variable-call":84}],66:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this._index=c,this._fileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a);return"number"==typeof b?new e(b):"string"==typeof b?new f('"'+b+'"',b,this.escaped,this._index):new g(Array.isArray(b)?b.join(", "):b)},b.exports=h},{"./anonymous":48,"./dimension":60,"./js-eval-node":67,"./quoted":77}],67:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(!b.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.fileInfo().filename,index:this.getIndex()};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.getIndex(),d.fileInfo()).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.fileInfo().filename,index:this.getIndex()}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.fileInfo().filename,index:this.getIndex()}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":73,"./variable":85}],68:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":73}],69:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./atrule"),j=a("../utils"),k=function(a,b,c,g,h){this._index=c,this._fileInfo=g;var i=new f([],null,null,this._index,this._fileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0,this.setParent(i,this),this.setParent(this.features,this),this.setParent(this.rules,this)};k.prototype=new i,k.prototype.type="Media",k.prototype.isRulesetLike=function(){return!0},k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},k.prototype.genCSS=function(a,b){b.add("@media ",this._fileInfo,this._index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},k.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new k(null,[],this._index,this._fileInfo,this.visibilityInfo());return this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo),b.features=this.features.eval(a),a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},k.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo()),this.setParent(b,this)}return delete a.mediaBlocks,delete a.mediaPath,b},k.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;b0;b--)a.splice(b,0,new g("and"));return new h(a)})),this.setParent(this.features,this),new d([],[])},k.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(n=!0,k=0;k0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.getIndex(),filename:this.fileInfo().filename};for(k=0;kthis.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;gb?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],74:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};g.prototype=new d,g.prototype.type="Operation",g.prototype.accept=function(a){this.operands=a.visit(this.operands)},g.prototype.eval=function(a){var b=this.operands[0].eval(a),c=this.operands[1].eval(a);if(a.isMathOn()){if(b instanceof f&&c instanceof e&&(b=b.toColor()),c instanceof f&&b instanceof e&&(c=c.toColor()),!b.operate)throw{type:"Operation",message:"Operation on an invalid type"};return b.operate(a,this.op,c)}return new g(this.op,[b,c],this.isSpaced)},g.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=g},{"./color":53,"./dimension":60,"./node":73}],75:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":73}],76:[function(a,b,c){var d=a("./node"),e=a("./declaration"),f=function(a,b,c){this.name=a,this._index=b,this._fileInfo=c};f.prototype=new d,f.prototype.type="Property",f.prototype.eval=function(a){var b,c=this.name,d=a.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;if(this.evaluating)throw{type:"Name",message:"Recursive property reference for "+c,filename:this.fileInfo().filename,index:this.getIndex()};if(this.evaluating=!0,b=this.find(a.frames,function(b){var f,g=b.property(c);if(g){for(var h=0;hd){if(!c||c(g)){e=g.find(new i(a.elements.slice(d)),b,c);for(var j=0;j0&&b.add(k),a.firstSelector=!0,h[0].genCSS(a,b),a.firstSelector=!1,d=1;d0?(e=p.copyArray(a),f=e.pop(),g=d.createDerived(p.copyArray(f.elements))):g=d.createDerived([]),b.length>0){var h=c.combinator,i=b[0].elements[0];h.emptyOrWhitespace&&!i.combinator.emptyOrWhitespace&&(h=i.combinator),g.elements.push(new j(h,i.value,c._index,c._fileInfo)),g.elements=g.elements.concat(b[0].elements.slice(1))}if(0!==g.elements.length&&e.push(g),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function g(a,b,c,d,e){var g;for(g=0;g0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new i(a))}}function l(a,b,c){function m(a){var b;return a.value instanceof h?(b=a.value.value,b instanceof i?b:null):null}var n,o,p,q,r,s,t,u,v,w,x=!1;for(q=[],r=[[]],n=0;u=c.elements[n];n++)if("&"!==u.value){var y=m(u);if(null!=y){k(q,r);var z,A=[],B=[];for(z=l(A,b,y),x=x||z,p=0;p0&&t[0].elements.push(new j(u.combinator,"",u._index,u._fileInfo)),s.push(t);else for(p=0;p0&&(a.push(r[n]),w=r[n][v-1],r[n][v-1]=w.createDerived(w.elements,c.extendList));return x}function m(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var n,o,q;if(o=[],q=l(o,b,c),!q)if(b.length>0)for(o=[],n=0;n0)for(b=0;b=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}},copyArray:function(a){var b,c=a.length,d=new Array(c);for(b=0;b=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.fileInfo(),b),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitDeclaration:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;e0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return k0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitAtRule:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitAtRuleOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=i},{"../logger":37,"../tree":65,"../utils":86,"./visitor":94}],88:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],89:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=a("../utils"),h=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};h.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,g.copyArray(this.context.frames)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.getIndex(),f.filename=a.fileInfo().filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;h0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];if(this.keepOnlyVisibleChilds(c),!this.isEmpty(c))return a.ensureVisibility(),a.removeVisibilityBlock(),a},isVisibleRuleset:function(a){return!!a.firstRoot||!this.isEmpty(a)&&!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitDeclaration:function(a,b){if(!a.blocksVisibility()&&!a.variable)return a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){if(!a.blocksVisibility()&&!a.isSilent(this._context))return a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){if(!a.blocksVisibility())return a},visitAtRule:function(a,b){return a.rules&&a.rules.length?this.visitAtRuleWithBody(a,b):this.visitAtRuleWithoutBody(a,b)},visitAnonymous:function(a,b){if(!a.blocksVisibility())return a.accept(this._visitor),a},visitAtRuleWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitAtRuleWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;c0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;b=0;e--)if(c=a[e],c instanceof d.Declaration)if(f[c.name]){b=f[c.name],b instanceof d.Declaration&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);b.indexOf(g)!==-1?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b={},c=[],e=0;e0){var b=a[0],c=[],e=[new d.Expression(c)];a.forEach(function(a){"+"===a.merge&&c.length>0&&e.push(new d.Expression(c=[])),c.push(a.value),b.important=b.important||a.important}),b.value=new d.Value(e)}})}}},b.exports=g},{"../tree":65,"./visitor":94}],94:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitFnCache=[],h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a;var c,e=this._visitFnCache,f=this._implementation,h=b<<1,i=1|h,j=e[h],k=e[i],l=g;if(l.visitDeeper=!0,j||(c="visit"+a.type,j=f[c]||d,k=f[c+"Out"]||d,e[h]=j,e[i]=k),j!==d){var m=j.call(f,a,l);f.isReplacing&&(a=m)}return l.visitDeeper&&a&&a.accept&&a.accept(this),k!=d&&k.call(f,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;ck){for(var b=0,c=h.length-j;b3.0 ieCompat: true }], + [{ + strictMath: true, + ieCompat: true + }, "strict-math/"], [{strictMath: true, strictUnits: true, javascriptEnabled: true}, "errors/", lessTester.testErrors, null], [{strictMath: true, strictUnits: true, javascriptEnabled: false}, "no-js-errors/", @@ -56,7 +60,7 @@ testMap.forEach(function(args) { lessTester.runTestSet.apply(lessTester, args) }); lessTester.testSyncronous({syncImport: true}, "import"); -lessTester.testSyncronous({syncImport: true}, "css"); +lessTester.testSyncronous({syncImport: true}, "strict-math/css"); lessTester.testNoOptions(); lessTester.testJSImport(); lessTester.finished(); diff --git a/test/less/calc.less b/test/less/calc.less new file mode 100644 index 000000000..df1c7a56d --- /dev/null +++ b/test/less/calc.less @@ -0,0 +1,7 @@ +.no-math { + @var: 50vh/2; + width: calc(50% + (@var - 20px)); + foo: 1 + 2 calc(3 + 4) 5 + 6; + @floor: floor(1 + .1); + bar: calc(@floor + 20%); +} \ No newline at end of file diff --git a/test/less/media.less b/test/less/media.less index 8bd23bb56..ec90a6618 100644 --- a/test/less/media.less +++ b/test/less/media.less @@ -23,7 +23,7 @@ @ratio_large: 16; @ratio_small: 9; -@media all and (device-aspect-ratio: @ratio_large / @ratio_small) { +@media all and (device-aspect-ratio: ~"@{ratio_large} / @{ratio_small}") { body { max-width: 800px; } } @@ -177,7 +177,7 @@ body { } } -@media (-webkit-min-device-pixel-ratio: 2), (min--moz-device-pixel-ratio: 2), (-o-min-device-pixel-ratio: 2/1), (min-resolution: 2dppx), (min-resolution: 128dpcm) { +@media (-webkit-min-device-pixel-ratio: 2), (min--moz-device-pixel-ratio: 2), (-o-min-device-pixel-ratio: ~"2/1"), (min-resolution: 2dppx), (min-resolution: 128dpcm) { .b { background: red; } diff --git a/test/less/css.less b/test/less/strict-math/css.less similarity index 100% rename from test/less/css.less rename to test/less/strict-math/css.less diff --git a/test/less/mixins-args.less b/test/less/strict-math/mixins-args.less similarity index 100% rename from test/less/mixins-args.less rename to test/less/strict-math/mixins-args.less diff --git a/test/less/parens.less b/test/less/strict-math/parens.less similarity index 100% rename from test/less/parens.less rename to test/less/strict-math/parens.less