From eb8b03182cb85cafbbc4d4fab386a6674cf49fae Mon Sep 17 00:00:00 2001 From: alexlamsl Date: Wed, 25 Jan 2017 01:17:22 +0800 Subject: [PATCH] Version 3.3.0 --- README.md | 24 +- dist/htmlminifier.js | 32144 ++++++++++++++++++------------------- dist/htmlminifier.min.js | 34 +- index.html | 2 +- package.json | 2 +- tests/index.html | 4 +- 6 files changed, 15565 insertions(+), 16645 deletions(-) diff --git a/README.md b/README.md index e34b70f..1d1d125 100644 --- a/README.md +++ b/README.md @@ -22,19 +22,19 @@ How does HTMLMinifier compare to other solutions — [HTML Minifier from Will Pe | Site | Original size *(KB)* | HTMLMinifier | minimize | Will Peavy | htmlcompressor.com | | --------------------------------------------------------------------------- |:--------------------:| ------------:| --------:| ----------:| ------------------:| -| [Google](https://www.google.com/) | 44 | **42** | 44 | 46 | 45 | -| [HTMLMinifier](https://github.com/kangax/html-minifier) | 122 | **96** | 103 | 107 | 103 | -| [CNN](http://www.cnn.com/) | 132 | **121** | 128 | 129 | 124 | -| [BBC](http://www.bbc.co.uk/) | 178 | **146** | 172 | 176 | 168 | -| [Amazon](http://www.amazon.co.uk/) | 185 | **152** | 177 | 179 | n/a | -| [New York Times](http://www.nytimes.com/) | 195 | **128** | 143 | 145 | 135 | -| [Stack Overflow](http://stackoverflow.com/) | 244 | **188** | 198 | 206 | 196 | -| [Bootstrap CSS](http://getbootstrap.com/css/) | 276 | **264** | 273 | 231 | 274 | -| [Wikipedia](https://en.wikipedia.org/wiki/President_of_the_United_States) | 499 | **454** | 482 | 498 | n/a | -| [NBC](http://www.nbc.com/) | 548 | **526** | 546 | 548 | n/a | +| [Google](https://www.google.com/) | 44 | **42** | 44 | 46 | 44 | +| [HTMLMinifier](https://github.com/kangax/html-minifier) | 122 | **96** | 104 | 108 | 104 | +| [CNN](http://www.cnn.com/) | 135 | **123** | 132 | 133 | 127 | +| [Amazon](http://www.amazon.co.uk/) | 189 | **158** | 181 | 184 | n/a | +| [BBC](http://www.bbc.co.uk/) | 212 | **174** | 205 | 210 | 200 | +| [New York Times](http://www.nytimes.com/) | 220 | **145** | 168 | 165 | 154 | +| [Stack Overflow](http://stackoverflow.com/) | 239 | **186** | 196 | 204 | 194 | +| [Bootstrap CSS](http://getbootstrap.com/css/) | 272 | **260** | 269 | 229 | 269 | +| [Wikipedia](https://en.wikipedia.org/wiki/President_of_the_United_States) | 541 | **488** | 522 | 540 | 520 | +| [NBC](http://www.nbc.com/) | 563 | **540** | 561 | 563 | 546 | | [Eloquent Javascript](http://eloquentjavascript.net/1st_edition/print.html) | 870 | **815** | 840 | 864 | n/a | -| [ES6 table](http://kangax.github.io/compat-table/es6/) | 4113 | **3459** | 3878 | n/a | n/a | -| [ES6 draft](https://tc39.github.io/ecma262/) | 5157 | **4595** | 4727 | n/a | n/a | +| [ES6 table](http://kangax.github.io/compat-table/es6/) | 4152 | **3492** | 3915 | n/a | n/a | +| [ES6 draft](https://tc39.github.io/ecma262/) | 5266 | **4691** | 4833 | n/a | n/a | ## Options Quick Reference diff --git a/dist/htmlminifier.js b/dist/htmlminifier.js index e4dfd88..c334759 100644 --- a/dist/htmlminifier.js +++ b/dist/htmlminifier.js @@ -1,315 +1,10 @@ /*! - * HTMLMinifier v3.2.3 (http://kangax.github.io/html-minifier/) - * Copyright 2010-2016 Juriy "kangax" Zaytsev + * HTMLMinifier v3.3.0 (http://kangax.github.io/html-minifier/) + * Copyright 2010-2017 Juriy "kangax" Zaytsev * Licensed under the MIT license */ require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 0) { - ary.splice(i - 1, 2); - i -= 2; - } - } - } - } - - function normalize(name, baseName) { - var baseParts; - - //Adjust any relative paths. - if (name && name.charAt(0) === '.') { - //If have a base name, try to normalize against it, - //otherwise, assume it is a top-level require that will - //be relative to baseUrl in the end. - if (baseName) { - baseParts = baseName.split('/'); - baseParts = baseParts.slice(0, baseParts.length - 1); - baseParts = baseParts.concat(name.split('/')); - trimDots(baseParts); - name = baseParts.join('/'); - } - } - - return name; - } - - /** - * Create the normalize() function passed to a loader plugin's - * normalize method. - */ - function makeNormalize(relName) { - return function (name) { - return normalize(name, relName); - }; - } - - function makeLoad(id) { - function load(value) { - loaderCache[id] = value; - } - - load.fromText = function (id, text) { - //This one is difficult because the text can/probably uses - //define, and any relative paths and requires should be relative - //to that id was it would be found on disk. But this would require - //bootstrapping a module/require fairly deeply from node core. - //Not sure how best to go about that yet. - throw new Error('amdefine does not implement load.fromText'); - }; - - return load; - } - - makeRequire = function (systemRequire, exports, module, relId) { - function amdRequire(deps, callback) { - if (typeof deps === 'string') { - //Synchronous, single module require('') - return stringRequire(systemRequire, exports, module, deps, relId); - } else { - //Array of dependencies with a callback. - - //Convert the dependencies to modules. - deps = deps.map(function (depName) { - return stringRequire(systemRequire, exports, module, depName, relId); - }); - - //Wait for next tick to call back the require call. - if (callback) { - process.nextTick(function () { - callback.apply(null, deps); - }); - } - } - } - - amdRequire.toUrl = function (filePath) { - if (filePath.indexOf('.') === 0) { - return normalize(filePath, path.dirname(module.filename)); - } else { - return filePath; - } - }; - - return amdRequire; - }; - - //Favor explicit value, passed in if the module wants to support Node 0.4. - requireFn = requireFn || function req() { - return module.require.apply(module, arguments); - }; - - function runFactory(id, deps, factory) { - var r, e, m, result; - - if (id) { - e = loaderCache[id] = {}; - m = { - id: id, - uri: __filename, - exports: e - }; - r = makeRequire(requireFn, e, m, id); - } else { - //Only support one define call per file - if (alreadyCalled) { - throw new Error('amdefine with no module ID cannot be called more than once per file.'); - } - alreadyCalled = true; - - //Use the real variables from node - //Use module.exports for exports, since - //the exports in here is amdefine exports. - e = module.exports; - m = module; - r = makeRequire(requireFn, e, m, module.id); - } - - //If there are dependencies, they are strings, so need - //to convert them to dependency values. - if (deps) { - deps = deps.map(function (depName) { - return r(depName); - }); - } - - //Call the factory with the right dependencies. - if (typeof factory === 'function') { - result = factory.apply(m.exports, deps); - } else { - result = factory; - } - - if (result !== undefined) { - m.exports = result; - if (id) { - loaderCache[id] = m.exports; - } - } - } - - stringRequire = function (systemRequire, exports, module, id, relId) { - //Split the ID by a ! so that - var index = id.indexOf('!'), - originalId = id, - prefix, plugin; - - if (index === -1) { - id = normalize(id, relId); - - //Straight module lookup. If it is one of the special dependencies, - //deal with it, otherwise, delegate to node. - if (id === 'require') { - return makeRequire(systemRequire, exports, module, relId); - } else if (id === 'exports') { - return exports; - } else if (id === 'module') { - return module; - } else if (loaderCache.hasOwnProperty(id)) { - return loaderCache[id]; - } else if (defineCache[id]) { - runFactory.apply(null, defineCache[id]); - return loaderCache[id]; - } else { - if(systemRequire) { - return systemRequire(originalId); - } else { - throw new Error('No module with ID: ' + id); - } - } - } else { - //There is a plugin in play. - prefix = id.substring(0, index); - id = id.substring(index + 1, id.length); - - plugin = stringRequire(systemRequire, exports, module, prefix, relId); - - if (plugin.normalize) { - id = plugin.normalize(id, makeNormalize(relId)); - } else { - //Normalize the ID normally. - id = normalize(id, relId); - } - - if (loaderCache[id]) { - return loaderCache[id]; - } else { - plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {}); - - return loaderCache[id]; - } - } - }; - - //Create a define function specific to the module asking for amdefine. - function define(id, deps, factory) { - if (Array.isArray(id)) { - factory = deps; - deps = id; - id = undefined; - } else if (typeof id !== 'string') { - factory = id; - id = deps = undefined; - } - - if (deps && !Array.isArray(deps)) { - factory = deps; - deps = undefined; - } - - if (!deps) { - deps = ['require', 'exports', 'module']; - } - - //Set up properties for this module. If an ID, then use - //internal cache. If no ID, then use the external variables - //for this node module. - if (id) { - //Put the module in deep freeze until there is a - //require call for it. - defineCache[id] = [id, deps, factory]; - } else { - runFactory(id, deps, factory); - } - } - - //define.require, which has access to all the values in the - //cache. Useful for AMD modules that all have IDs in the file, - //but need to finally export a value to node based on one of those - //IDs. - define.require = function (id) { - if (loaderCache[id]) { - return loaderCache[id]; - } - - if (defineCache[id]) { - runFactory.apply(null, defineCache[id]); - return loaderCache[id]; - } - }; - - define.amd = {}; - - return define; -} - -module.exports = amdefine; - -}).call(this,require('_process'),"/node_modules\\amdefine\\amdefine.js") -},{"_process":81,"path":79}],2:[function(require,module,exports){ 'use strict' exports.byteLength = byteLength @@ -425,11 +120,11 @@ function fromByteArray (uint8) { return parts.join('') } -},{}],3:[function(require,module,exports){ +},{}],2:[function(require,module,exports){ -},{}],4:[function(require,module,exports){ -arguments[4][3][0].apply(exports,arguments) -},{"dup":3}],5:[function(require,module,exports){ +},{}],3:[function(require,module,exports){ +arguments[4][2][0].apply(exports,arguments) +},{"dup":2}],4:[function(require,module,exports){ (function (global){ 'use strict'; @@ -541,7 +236,7 @@ exports.allocUnsafeSlow = function allocUnsafeSlow(size) { } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"buffer":6}],6:[function(require,module,exports){ +},{"buffer":5}],5:[function(require,module,exports){ (function (global){ /*! * The buffer module from node.js, for the browser. @@ -2334,7 +2029,7 @@ function isnan (val) { } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"base64-js":2,"ieee754":73,"isarray":76}],7:[function(require,module,exports){ +},{"base64-js":1,"ieee754":104,"isarray":107}],6:[function(require,module,exports){ module.exports = { "100": "Continue", "101": "Switching Protocols", @@ -2385,6 +2080,7 @@ module.exports = { "428": "Precondition Required", "429": "Too Many Requests", "431": "Request Header Fields Too Large", + "451": "Unavailable For Legal Reasons", "500": "Internal Server Error", "501": "Not Implemented", "502": "Bad Gateway", @@ -2399,3485 +2095,3174 @@ module.exports = { "511": "Network Authentication Required" } -},{}],8:[function(require,module,exports){ +},{}],7:[function(require,module,exports){ module.exports = require('./lib/clean'); -},{"./lib/clean":9}],9:[function(require,module,exports){ +},{"./lib/clean":8}],8:[function(require,module,exports){ (function (process){ /** * Clean-css - https://github.com/jakubpawlowicz/clean-css * Released under the terms of MIT license * - * Copyright (C) 2015 JakubPawlowicz.com + * Copyright (C) 2017 JakubPawlowicz.com */ -var ImportInliner = require('./imports/inliner'); -var rebaseUrls = require('./urls/rebase'); - -var tokenize = require('./tokenizer/tokenize'); -var simpleOptimize = require('./selectors/simple'); -var advancedOptimize = require('./selectors/advanced'); +var level0Optimize = require('./optimizer/level-0/optimize'); +var level1Optimize = require('./optimizer/level-1/optimize'); +var level2Optimize = require('./optimizer/level-2/optimize'); +var validator = require('./optimizer/validator'); -var simpleStringify = require('./stringifier/simple'); -var sourceMapStringify = require('./stringifier/source-maps'); - -var CommentsProcessor = require('./text/comments-processor'); -var ExpressionsProcessor = require('./text/expressions-processor'); -var FreeTextProcessor = require('./text/free-text-processor'); -var UrlsProcessor = require('./text/urls-processor'); - -var Compatibility = require('./utils/compatibility'); -var InputSourceMapTracker = require('./utils/input-source-map-tracker'); -var SourceTracker = require('./utils/source-tracker'); -var SourceReader = require('./utils/source-reader'); -var Validator = require('./properties/validator'); - -var fs = require('fs'); -var path = require('path'); -var url = require('url'); +var compatibilityFrom = require('./options/compatibility'); +var formatFrom = require('./options/format').formatFrom; +var inlineFrom = require('./options/inline'); +var inlineRequestFrom = require('./options/inline-request'); +var inlineTimeoutFrom = require('./options/inline-timeout'); +var OptimizationLevel = require('./options/optimization-level').OptimizationLevel; +var optimizationLevelFrom = require('./options/optimization-level').optimizationLevelFrom; +var rebaseFrom = require('./options/rebase'); +var rebaseToFrom = require('./options/rebase-to'); -var override = require('./utils/object').override; +var inputSourceMapTracker = require('./reader/input-source-map-tracker'); +var readSources = require('./reader/read-sources'); -var DEFAULT_TIMEOUT = 5000; +var serializeStyles = require('./writer/simple'); +var serializeStylesAndSourceMap = require('./writer/source-maps'); var CleanCSS = module.exports = function CleanCSS(options) { options = options || {}; this.options = { - advanced: undefined === options.advanced ? true : !!options.advanced, - aggressiveMerging: undefined === options.aggressiveMerging ? true : !!options.aggressiveMerging, - benchmark: options.benchmark, - compatibility: new Compatibility(options.compatibility).toOptions(), - debug: options.debug, - explicitRoot: !!options.root, - explicitTarget: !!options.target, - inliner: options.inliner || {}, - keepBreaks: options.keepBreaks || false, - keepSpecialComments: 'keepSpecialComments' in options ? options.keepSpecialComments : '*', - mediaMerging: undefined === options.mediaMerging ? true : !!options.mediaMerging, - processImport: undefined === options.processImport ? true : !!options.processImport, - processImportFrom: importOptionsFrom(options.processImportFrom), - rebase: undefined === options.rebase ? true : !!options.rebase, - relativeTo: options.relativeTo, - restructuring: undefined === options.restructuring ? true : !!options.restructuring, - root: options.root || process.cwd(), - roundingPrecision: options.roundingPrecision, - semanticMerging: undefined === options.semanticMerging ? false : !!options.semanticMerging, - shorthandCompacting: undefined === options.shorthandCompacting ? true : !!options.shorthandCompacting, - sourceMap: options.sourceMap, - sourceMapInlineSources: !!options.sourceMapInlineSources, - target: !options.target || missingDirectory(options.target) || presentDirectory(options.target) ? options.target : path.dirname(options.target) + compatibility: compatibilityFrom(options.compatibility), + format: formatFrom(options.format), + inline: inlineFrom(options.inline), + inlineRequest: inlineRequestFrom(options.inlineRequest), + inlineTimeout: inlineTimeoutFrom(options.inlineTimeout), + level: optimizationLevelFrom(options.level), + rebase: rebaseFrom(options.rebase), + rebaseTo: rebaseToFrom(options.rebaseTo), + returnPromise: !!options.returnPromise, + sourceMap: !!options.sourceMap, + sourceMapInlineSources: !!options.sourceMapInlineSources }; +}; - this.options.inliner.timeout = this.options.inliner.timeout || DEFAULT_TIMEOUT; - this.options.inliner.request = override( - /* jshint camelcase: false */ - proxyOptionsFrom(process.env.HTTP_PROXY || process.env.http_proxy), - this.options.inliner.request || {} - ); +CleanCSS.prototype.minify = function (input, maybeSourceMap, maybeCallback) { + var options = this.options; + + if (options.returnPromise) { + return new Promise(function (resolve, reject) { + minify(input, options, maybeSourceMap, function (errors, output) { + return errors ? + reject(errors) : + resolve(output); + }); + }); + } else { + return minify(input, options, maybeSourceMap, maybeCallback); + } }; -function importOptionsFrom(rules) { - return undefined === rules ? ['all'] : rules; -} +function minify(input, options, maybeSourceMap, maybeCallback) { + var sourceMap = typeof maybeSourceMap != 'function' ? + maybeSourceMap : + null; + var callback = typeof maybeCallback == 'function' ? + maybeCallback : + (typeof maybeSourceMap == 'function' ? maybeSourceMap : null); + var context = { + stats: { + efficiency: 0, + minifiedSize: 0, + originalSize: 0, + startedAt: Date.now(), + timeSpent: 0 + }, + cache: { + specificity: {} + }, + errors: [], + inlinedStylesheets: [], + inputSourceMapTracker: inputSourceMapTracker(), + localOnly: !callback, + options: options, + source: null, + sourcesContent: {}, + validator: validator(options.compatibility), + warnings: [] + }; + + if (sourceMap) { + context.inputSourceMapTracker.track(undefined, sourceMap); + } + + return runner(context.localOnly)(function () { + return readSources(input, context, function (tokens) { + var serialize = context.options.sourceMap ? + serializeStylesAndSourceMap : + serializeStyles; + + var optimizedTokens = optimize(tokens, context); + var optimizedStyles = serialize(optimizedTokens, context); + var output = withMetadata(optimizedStyles, context); -function missingDirectory(filepath) { - return !fs.existsSync(filepath) && !/\.css$/.test(filepath); + return callback ? + callback(context.errors.length > 0 ? context.errors : null, output) : + output; + }); + }); } -function presentDirectory(filepath) { - return fs.existsSync(filepath) && fs.statSync(filepath).isDirectory(); +function runner(localOnly) { + // to always execute code asynchronously when a callback is given + // more at blog.izs.me/post/59142742143/designing-apis-for-asynchrony + return localOnly ? + function (callback) { return callback(); } : + process.nextTick; } -function proxyOptionsFrom(httpProxy) { - return httpProxy ? - { - hostname: url.parse(httpProxy).hostname, - port: parseInt(url.parse(httpProxy).port) - } : - {}; +function optimize(tokens, context) { + var optimized; + + optimized = level0Optimize(tokens, context); + optimized = OptimizationLevel.One in context.options.level ? + level1Optimize(tokens, context) : + tokens; + optimized = OptimizationLevel.Two in context.options.level ? + level2Optimize(tokens, context, true) : + optimized; + + return optimized; } -CleanCSS.prototype.minify = function (data, callback) { - var context = { - stats: {}, - errors: [], - warnings: [], - options: this.options, - debug: this.options.debug, - localOnly: !callback, - sourceTracker: new SourceTracker(), - validator: new Validator(this.options.compatibility) - }; +function withMetadata(output, context) { + output.stats = calculateStatsFrom(output.styles, context); + output.errors = context.errors; + output.inlinedStylesheets = context.inlinedStylesheets; + output.warnings = context.warnings; + + return output; +} - if (context.options.sourceMap) - context.inputSourceMapTracker = new InputSourceMapTracker(context); +function calculateStatsFrom(styles, context) { + var finishedAt = Date.now(); + var timeSpent = finishedAt - context.stats.startedAt; - context.sourceReader = new SourceReader(context, data); - data = context.sourceReader.toString(); + delete context.stats.startedAt; + context.stats.timeSpent = timeSpent; + context.stats.efficiency = 1 - styles.length / context.stats.originalSize; + context.stats.minifiedSize = styles.length; - if (context.options.processImport || data.indexOf('@shallow') > 0) { - // inline all imports - var runner = callback ? - process.nextTick : - function (callback) { return callback(); }; + return context.stats; +} - return runner(function () { - return new ImportInliner(context).process(data, { - localOnly: context.localOnly, - imports: context.options.processImportFrom, - whenDone: runMinifier(callback, context) - }); - }); - } else { - return runMinifier(callback, context)(data); - } +}).call(this,require('_process')) +},{"./optimizer/level-0/optimize":10,"./optimizer/level-1/optimize":11,"./optimizer/level-2/optimize":30,"./optimizer/validator":56,"./options/compatibility":58,"./options/format":59,"./options/inline":62,"./options/inline-request":60,"./options/inline-timeout":61,"./options/optimization-level":63,"./options/rebase":65,"./options/rebase-to":64,"./reader/input-source-map-tracker":69,"./reader/read-sources":75,"./writer/simple":98,"./writer/source-maps":99,"_process":112}],9:[function(require,module,exports){ +var Hack = { + ASTERISK: 'asterisk', + BANG: 'bang', + BACKSLASH: 'backslash', + UNDERSCORE: 'underscore' }; -function runMinifier(callback, context) { - function whenSourceMapReady (data) { - data = context.options.debug ? - minifyWithDebug(context, data) : - minify(context, data); - data = withMetadata(context, data); +module.exports = Hack; - return callback ? - callback.call(null, context.errors.length > 0 ? context.errors : null, data) : - data; - } +},{}],10:[function(require,module,exports){ +function level0Optimize(tokens) { + // noop as level 0 means no optimizations! + return tokens; +} - return function (data) { - if (context.options.sourceMap) { - return context.inputSourceMapTracker.track(data, function () { - if (context.options.sourceMapInlineSources) { - return context.inputSourceMapTracker.resolveSources(function () { - return whenSourceMapReady(data); - }); - } else { - return whenSourceMapReady(data); - } - }); - } else { - return whenSourceMapReady(data); - } - }; +module.exports = level0Optimize; + +},{}],11:[function(require,module,exports){ +var shortenHex = require('./shorten-hex'); +var shortenHsl = require('./shorten-hsl'); +var shortenRgb = require('./shorten-rgb'); +var sortSelectors = require('./sort-selectors'); +var tidyRules = require('./tidy-rules'); +var tidyBlock = require('./tidy-block'); +var tidyAtRule = require('./tidy-at-rule'); + +var Hack = require('../hack'); +var removeUnused = require('../remove-unused'); +var restoreFromOptimizing = require('../restore-from-optimizing'); +var wrapForOptimizing = require('../wrap-for-optimizing').all; + +var OptimizationLevel = require('../../options/optimization-level').OptimizationLevel; + +var Token = require('../../tokenizer/token'); +var Marker = require('../../tokenizer/marker'); + +var formatPosition = require('../../utils/format-position'); +var split = require('../../utils/split'); + +var IgnoreProperty = 'ignore-property'; + +var CHARSET_TOKEN = '@charset'; +var CHARSET_REGEXP = new RegExp('^' + CHARSET_TOKEN, 'i'); + +var DEFAULT_ROUNDING_PRECISION = require('../../options/rounding-precision').DEFAULT; + +var FONT_NUMERAL_WEIGHTS = ['100', '200', '300', '400', '500', '600', '700', '800', '900']; +var FONT_NAME_WEIGHTS = ['normal', 'bold', 'bolder', 'lighter']; +var FONT_NAME_WEIGHTS_WITHOUT_NORMAL = ['bold', 'bolder', 'lighter']; + +var WHOLE_PIXEL_VALUE = /(?:^|\s|\()(-?\d+)px/; +var TIME_VALUE = /^(\-?[\d\.]+)(m?s)$/; + +var PROPERTY_NAME_PATTERN = /^(?:\-chrome\-|\-[\w\-]+\w|\w[\w\-]+\w|\-\-\S+)$/; +var IMPORT_PREFIX_PATTERN = /^@import/i; +var QUOTED_PATTERN = /^('.*'|".*")$/; +var QUOTED_BUT_SAFE_PATTERN = /^['"][a-zA-Z][a-zA-Z\d\-_]+['"]$/; +var URL_PREFIX_PATTERN = /^url\(/i; + +function isNegative(value) { + return value && value[1][0] == '-' && parseFloat(value[1]) < 0; +} + +function isQuoted(value) { + return QUOTED_PATTERN.test(value); } -function withMetadata(context, data) { - data.stats = context.stats; - data.errors = context.errors; - data.warnings = context.warnings; - return data; +function isUrl(value) { + return URL_PREFIX_PATTERN.test(value); } -function minifyWithDebug(context, data) { - var startedAt = process.hrtime(); - context.stats.originalSize = context.sourceTracker.removeAll(data).length; +function normalizeUrl(value) { + return value + .replace(URL_PREFIX_PATTERN, 'url(') + .replace(/\\?\n|\\?\r\n/g, ''); +} - data = minify(context, data); +function optimizeBackground(property) { + var values = property.value; - var elapsed = process.hrtime(startedAt); - context.stats.timeSpent = ~~(elapsed[0] * 1e3 + elapsed[1] / 1e6); - context.stats.efficiency = 1 - data.styles.length / context.stats.originalSize; - context.stats.minifiedSize = data.styles.length; + if (values.length == 1 && values[0][1] == 'none') { + values[0][1] = '0 0'; + } - return data; + if (values.length == 1 && values[0][1] == 'transparent') { + values[0][1] = '0 0'; + } } -function benchmark(runner) { - return function (processor, action) { - var name = processor.constructor.name + '#' + action; - var start = process.hrtime(); - runner(processor, action); - var itTook = process.hrtime(start); - console.log('%d ms: ' + name, 1000 * itTook[0] + itTook[1] / 1000000); - }; +function optimizeBorderRadius(property) { + var values = property.value; + var spliceAt; + + if (values.length == 3 && values[1][1] == '/' && values[0][1] == values[2][1]) { + spliceAt = 1; + } else if (values.length == 5 && values[2][1] == '/' && values[0][1] == values[3][1] && values[1][1] == values[4][1]) { + spliceAt = 2; + } else if (values.length == 7 && values[3][1] == '/' && values[0][1] == values[4][1] && values[1][1] == values[5][1] && values[2][1] == values[6][1]) { + spliceAt = 3; + } else if (values.length == 9 && values[4][1] == '/' && values[0][1] == values[5][1] && values[1][1] == values[6][1] && values[2][1] == values[7][1] && values[3][1] == values[8][1]) { + spliceAt = 4; + } + + if (spliceAt) { + property.value.splice(spliceAt); + property.dirty = true; + } } -function minify(context, data) { - var options = context.options; +function optimizeColors(name, value, compatibility) { + if (value.indexOf('#') === -1 && value.indexOf('rgb') == -1 && value.indexOf('hsl') == -1) { + return shortenHex(value); + } - var commentsProcessor = new CommentsProcessor(context, options.keepSpecialComments, options.keepBreaks, options.sourceMap); - var expressionsProcessor = new ExpressionsProcessor(options.sourceMap); - var freeTextProcessor = new FreeTextProcessor(options.sourceMap); - var urlsProcessor = new UrlsProcessor(context, options.sourceMap, options.compatibility.properties.urlQuotes); + value = value + .replace(/rgb\((\-?\d+),(\-?\d+),(\-?\d+)\)/g, function (match, red, green, blue) { + return shortenRgb(red, green, blue); + }) + .replace(/hsl\((-?\d+),(-?\d+)%?,(-?\d+)%?\)/g, function (match, hue, saturation, lightness) { + return shortenHsl(hue, saturation, lightness); + }) + .replace(/(^|[^='"])#([0-9a-f]{6})/gi, function (match, prefix, color) { + if (color[0] == color[1] && color[2] == color[3] && color[4] == color[5]) { + return (prefix + '#' + color[0] + color[2] + color[4]).toLowerCase(); + } else { + return (prefix + '#' + color).toLowerCase(); + } + }) + .replace(/(^|[^='"])#([0-9a-f]{3})/gi, function (match, prefix, color) { + return prefix + '#' + color.toLowerCase(); + }) + .replace(/(rgb|rgba|hsl|hsla)\(([^\)]+)\)/g, function (match, colorFunction, colorDef) { + var tokens = colorDef.split(','); + var applies = (colorFunction == 'hsl' && tokens.length == 3) || + (colorFunction == 'hsla' && tokens.length == 4) || + (colorFunction == 'rgb' && tokens.length == 3 && colorDef.indexOf('%') > 0) || + (colorFunction == 'rgba' && tokens.length == 4 && colorDef.indexOf('%') > 0); - var stringify = options.sourceMap ? sourceMapStringify : simpleStringify; + if (!applies) { + return match; + } - var run = function (processor, action) { - data = typeof processor == 'function' ? - processor(data) : - processor[action](data); - }; + if (tokens[1].indexOf('%') == -1) { + tokens[1] += '%'; + } - if (options.benchmark) - run = benchmark(run); + if (tokens[2].indexOf('%') == -1) { + tokens[2] += '%'; + } - run(commentsProcessor, 'escape'); - run(expressionsProcessor, 'escape'); - run(urlsProcessor, 'escape'); - run(freeTextProcessor, 'escape'); + return colorFunction + '(' + tokens.join(',') + ')'; + }); - function restoreEscapes(data, prefixContent) { - data = freeTextProcessor.restore(data, prefixContent); - data = urlsProcessor.restore(data); - data = options.rebase ? rebaseUrls(data, context) : data; - data = expressionsProcessor.restore(data); - return commentsProcessor.restore(data); - } + if (compatibility.colors.opacity && name.indexOf('background') == -1) { + value = value.replace(/(?:rgba|hsla)\(0,0%?,0%?,0\)/g, function (match) { + if (split(value, ',').pop().indexOf('gradient(') > -1) { + return match; + } - var tokens = tokenize(data, context); + return 'transparent'; + }); + } - simpleOptimize(tokens, options); + return shortenHex(value); +} - if (options.advanced) - advancedOptimize(tokens, options, context, true); +function optimizeFilter(property) { + if (property.value.length == 1) { + property.value[0][1] = property.value[0][1].replace(/progid:DXImageTransform\.Microsoft\.(Alpha|Chroma)(\W)/, function (match, filter, suffix) { + return filter.toLowerCase() + suffix; + }); + } - return stringify(tokens, options, restoreEscapes, context.inputSourceMapTracker); + property.value[0][1] = property.value[0][1] + .replace(/,(\S)/g, ', $1') + .replace(/ ?= ?/g, '='); } -}).call(this,require('_process')) -},{"./imports/inliner":13,"./properties/validator":28,"./selectors/advanced":31,"./selectors/simple":44,"./stringifier/simple":48,"./stringifier/source-maps":49,"./text/comments-processor":50,"./text/expressions-processor":52,"./text/free-text-processor":53,"./text/urls-processor":54,"./tokenizer/tokenize":57,"./urls/rebase":58,"./utils/compatibility":62,"./utils/input-source-map-tracker":63,"./utils/object":64,"./utils/source-reader":66,"./utils/source-tracker":67,"_process":81,"fs":4,"path":79,"url":139}],10:[function(require,module,exports){ -var HexNameShortener = {}; +function optimizeFont(property, options) { + var values = property.value; + var hasNumeral = FONT_NUMERAL_WEIGHTS.indexOf(values[0][1]) > -1 || + values[1] && FONT_NUMERAL_WEIGHTS.indexOf(values[1][1]) > -1 || + values[2] && FONT_NUMERAL_WEIGHTS.indexOf(values[2][1]) > -1; + var canOptimizeFontWeight = options.level[OptimizationLevel.One].optimizeFontWeight; + var normalCount = 0; + var toOptimize; -var COLORS = { - aliceblue: '#f0f8ff', - antiquewhite: '#faebd7', - aqua: '#0ff', - aquamarine: '#7fffd4', - azure: '#f0ffff', - beige: '#f5f5dc', - bisque: '#ffe4c4', - black: '#000', - blanchedalmond: '#ffebcd', - blue: '#00f', - blueviolet: '#8a2be2', - brown: '#a52a2a', - burlywood: '#deb887', - cadetblue: '#5f9ea0', - chartreuse: '#7fff00', - chocolate: '#d2691e', - coral: '#ff7f50', - cornflowerblue: '#6495ed', - cornsilk: '#fff8dc', - crimson: '#dc143c', - cyan: '#0ff', - darkblue: '#00008b', - darkcyan: '#008b8b', - darkgoldenrod: '#b8860b', - darkgray: '#a9a9a9', - darkgreen: '#006400', - darkgrey: '#a9a9a9', - 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: '#f0f', - gainsboro: '#dcdcdc', - ghostwhite: '#f8f8ff', - gold: '#ffd700', - goldenrod: '#daa520', - gray: '#808080', - green: '#008000', - greenyellow: '#adff2f', - grey: '#808080', - 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', - lightgreen: '#90ee90', - lightgrey: '#d3d3d3', - lightpink: '#ffb6c1', - lightsalmon: '#ffa07a', - lightseagreen: '#20b2aa', - lightskyblue: '#87cefa', - lightslategray: '#778899', - lightslategrey: '#778899', - lightsteelblue: '#b0c4de', - lightyellow: '#ffffe0', - lime: '#0f0', - limegreen: '#32cd32', - linen: '#faf0e6', - magenta: '#ff00ff', - maroon: '#800000', - mediumaquamarine: '#66cdaa', - mediumblue: '#0000cd', - mediumorchid: '#ba55d3', - mediumpurple: '#9370db', - 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: '#db7093', - papayawhip: '#ffefd5', - peachpuff: '#ffdab9', - peru: '#cd853f', - pink: '#ffc0cb', - plum: '#dda0dd', - powderblue: '#b0e0e6', - purple: '#800080', - rebeccapurple: '#663399', - red: '#f00', - 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: '#fff', - whitesmoke: '#f5f5f5', - yellow: '#ff0', - yellowgreen: '#9acd32' -}; + if (!canOptimizeFontWeight) { + return; + } -var toHex = {}; -var toName = {}; + if (hasNumeral) { + return; + } -for (var name in COLORS) { - var hex = COLORS[name]; - if (name.length < hex.length) - toName[hex] = name; - else - toHex[name] = hex; -} + if (values[1] && values[1][1] == '/') { + return; + } -var toHexPattern = new RegExp('(^| |,|\\))(' + Object.keys(toHex).join('|') + ')( |,|\\)|$)', 'ig'); -var toNamePattern = new RegExp('(' + Object.keys(toName).join('|') + ')([^a-f0-9]|$)', 'ig'); + if (values[0][1] == 'normal') { + normalCount++; + } -function hexConverter(match, prefix, colorValue, suffix) { - return prefix + toHex[colorValue.toLowerCase()] + suffix; -} + if (values[1] && values[1][1] == 'normal') { + normalCount++; + } -function nameConverter(match, colorValue, suffix) { - return toName[colorValue.toLowerCase()] + suffix; -} + if (values[2] && values[2][1] == 'normal') { + normalCount++; + } -HexNameShortener.shorten = function (value) { - var hasHex = value.indexOf('#') > -1; - var shortened = value.replace(toHexPattern, hexConverter); + if (normalCount > 1) { + return; + } - if (shortened != value) - shortened = shortened.replace(toHexPattern, hexConverter); + if (FONT_NAME_WEIGHTS_WITHOUT_NORMAL.indexOf(values[0][1]) > -1) { + toOptimize = 0; + } else if (values[1] && FONT_NAME_WEIGHTS_WITHOUT_NORMAL.indexOf(values[1][1]) > -1) { + toOptimize = 1; + } else if (values[2] && FONT_NAME_WEIGHTS_WITHOUT_NORMAL.indexOf(values[2][1]) > -1) { + toOptimize = 2; + } else if (FONT_NAME_WEIGHTS.indexOf(values[0][1]) > -1) { + toOptimize = 0; + } else if (values[1] && FONT_NAME_WEIGHTS.indexOf(values[1][1]) > -1) { + toOptimize = 1; + } else if (values[2] && FONT_NAME_WEIGHTS.indexOf(values[2][1]) > -1) { + toOptimize = 2; + } - return hasHex ? shortened.replace(toNamePattern, nameConverter) : shortened; -}; + if (toOptimize !== undefined && canOptimizeFontWeight) { + optimizeFontWeight(property, toOptimize); + property.dirty = true; + } +} -module.exports = HexNameShortener; +function optimizeFontWeight(property, atIndex) { + var value = property.value[atIndex][1]; -},{}],11:[function(require,module,exports){ -// HSL to RGB converter. Both methods adapted from: -// http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript + if (value == 'normal') { + value = '400'; + } else if (value == 'bold') { + value = '700'; + } -function HSLColor(hue, saturation, lightness) { - this.hue = hue; - this.saturation = saturation; - this.lightness = lightness; + property.value[atIndex][1] = value; } -function hslToRgb(h, s, l) { - var r, g, b; +function optimizeMultipleZeros(property) { + var values = property.value; + var spliceAt; - // normalize hue orientation b/w 0 and 360 degrees - h = h % 360; - if (h < 0) - h += 360; - h = ~~h / 360; + if (values.length == 4 && values[0][1] === '0' && values[1][1] === '0' && values[2][1] === '0' && values[3][1] === '0') { + if (property.name.indexOf('box-shadow') > -1) { + spliceAt = 2; + } else { + spliceAt = 1; + } + } - if (s < 0) - s = 0; - else if (s > 100) - s = 100; - s = ~~s / 100; + if (spliceAt) { + property.value.splice(spliceAt); + property.dirty = true; + } +} - if (l < 0) - l = 0; - else if (l > 100) - l = 100; - l = ~~l / 100; +function optimizeOutline(property) { + var values = property.value; - if (s === 0) { - r = g = b = l; // achromatic - } else { - var q = l < 0.5 ? - l * (1 + s) : - l + s - l * s; - var p = 2 * l - q; - r = hueToRgb(p, q, h + 1/3); - g = hueToRgb(p, q, h); - b = hueToRgb(p, q, h - 1/3); + if (values.length == 1 && values[0][1] == 'none') { + values[0][1] = '0'; } - - return [~~(r * 255), ~~(g * 255), ~~(b * 255)]; } -function hueToRgb(p, q, t) { - if (t < 0) t += 1; - if (t > 1) t -= 1; - if (t < 1/6) return p + (q - p) * 6 * t; - if (t < 1/2) return q; - if (t < 2/3) return p + (q - p) * (2/3 - t) * 6; - return p; -} +function optimizePixelLengths(_, value, compatibility) { + if (!WHOLE_PIXEL_VALUE.test(value)) { + return value; + } -HSLColor.prototype.toHex = function () { - var asRgb = hslToRgb(this.hue, this.saturation, this.lightness); - var redAsHex = asRgb[0].toString(16); - var greenAsHex = asRgb[1].toString(16); - var blueAsHex = asRgb[2].toString(16); + return value.replace(WHOLE_PIXEL_VALUE, function (match, val) { + var newValue; + var intVal = parseInt(val); - return '#' + - ((redAsHex.length == 1 ? '0' : '') + redAsHex) + - ((greenAsHex.length == 1 ? '0' : '') + greenAsHex) + - ((blueAsHex.length == 1 ? '0' : '') + blueAsHex); -}; + if (intVal === 0) { + return match; + } -module.exports = HSLColor; - -},{}],12:[function(require,module,exports){ -function RGB(red, green, blue) { - this.red = red; - this.green = green; - this.blue = blue; -} - -RGB.prototype.toHex = function () { - var red = Math.max(0, Math.min(~~this.red, 255)); - var green = Math.max(0, Math.min(~~this.green, 255)); - var blue = Math.max(0, Math.min(~~this.blue, 255)); + if (compatibility.properties.shorterLengthUnits && compatibility.units.pt && intVal * 3 % 4 === 0) { + newValue = intVal * 3 / 4 + 'pt'; + } - // Credit: Asen http://jsbin.com/UPUmaGOc/2/edit?js,console - return '#' + ('00000' + (red << 16 | green << 8 | blue).toString(16)).slice(-6); -}; + if (compatibility.properties.shorterLengthUnits && compatibility.units.pc && intVal % 16 === 0) { + newValue = intVal / 16 + 'pc'; + } -module.exports = RGB; + if (compatibility.properties.shorterLengthUnits && compatibility.units.in && intVal % 96 === 0) { + newValue = intVal / 96 + 'in'; + } -},{}],13:[function(require,module,exports){ -(function (process){ -var fs = require('fs'); -var path = require('path'); -var http = require('http'); -var https = require('https'); -var url = require('url'); + if (newValue) { + newValue = match.substring(0, match.indexOf(val)) + newValue; + } -var rewriteUrls = require('../urls/rewrite'); -var split = require('../utils/split'); -var override = require('../utils/object.js').override; - -var MAP_MARKER = /\/\*# sourceMappingURL=(\S+) \*\//; -var REMOTE_RESOURCE = /^(https?:)?\/\//; -var NO_PROTOCOL_RESOURCE = /^\/\//; - -function ImportInliner (context) { - this.outerContext = context; -} - -ImportInliner.prototype.process = function (data, context) { - var root = this.outerContext.options.root; - - context = override(context, { - baseRelativeTo: this.outerContext.options.relativeTo || root, - debug: this.outerContext.options.debug, - done: [], - errors: this.outerContext.errors, - left: [], - inliner: this.outerContext.options.inliner, - rebase: this.outerContext.options.rebase, - relativeTo: this.outerContext.options.relativeTo || root, - root: root, - sourceReader: this.outerContext.sourceReader, - sourceTracker: this.outerContext.sourceTracker, - warnings: this.outerContext.warnings, - visited: [] + return newValue && newValue.length < match.length ? newValue : match; }); +} - return importFrom(data, context); -}; +function optimizePrecision(_, value, precisionOptions) { + var optimizedValue = value.replace(/(\d)\.($|\D)/g, '$1$2'); -function importFrom(data, context) { - if (context.shallow) { - context.shallow = false; - context.done.push(data); - return processNext(context); + if (!precisionOptions.matcher || value.indexOf('.') === -1) { + return optimizedValue; } - var nextStart = 0; - var nextEnd = 0; - var cursor = 0; - var isComment = commentScanner(data); - - for (; nextEnd < data.length;) { - nextStart = nextImportAt(data, cursor); - if (nextStart == -1) - break; - - if (isComment(nextStart)) { - cursor = nextStart + 1; - continue; - } - - nextEnd = data.indexOf(';', nextStart); - if (nextEnd == -1) { - cursor = data.length; - data = ''; - break; - } - - var noImportPart = data.substring(0, nextStart); - context.done.push(noImportPart); - context.left.unshift([data.substring(nextEnd + 1), context]); - context.afterContent = hasContent(noImportPart); - return inline(data, nextStart, nextEnd, context); - } + return optimizedValue + .replace(precisionOptions.matcher, function (match, integerPart, fractionPart, unit) { + var multiplier = precisionOptions.units[unit].multiplier; + var parsedInteger = parseInt(integerPart); + var integer = isNaN(parsedInteger) ? 0 : parsedInteger; + var fraction = parseFloat(fractionPart); - // no @import matched in current data - context.done.push(data); - return processNext(context); + return Math.round((integer + fraction) * multiplier) / multiplier + unit; + }); } -function rebaseMap(data, source) { - return data.replace(MAP_MARKER, function (match, sourceMapUrl) { - return REMOTE_RESOURCE.test(sourceMapUrl) ? - match : - match.replace(sourceMapUrl, url.resolve(source, sourceMapUrl)); - }); -} +function optimizeTimeUnits(_, value) { + if (!TIME_VALUE.test(value)) + return value; -function nextImportAt(data, cursor) { - var nextLowerCase = data.indexOf('@import', cursor); - var nextUpperCase = data.indexOf('@IMPORT', cursor); + return value.replace(TIME_VALUE, function (match, val, unit) { + var newValue; - if (nextLowerCase > -1 && nextUpperCase == -1) - return nextLowerCase; - else if (nextLowerCase == -1 && nextUpperCase > -1) - return nextUpperCase; - else - return Math.min(nextLowerCase, nextUpperCase); -} + if (unit == 'ms') { + newValue = parseInt(val) / 1000 + 's'; + } else if (unit == 's') { + newValue = parseFloat(val) * 1000 + 'ms'; + } -function processNext(context) { - return context.left.length > 0 ? - importFrom.apply(null, context.left.shift()) : - context.whenDone(context.done.join('')); + return newValue.length < match.length ? newValue : match; + }); } -function commentScanner(data) { - var commentRegex = /(\/\*(?!\*\/)[\s\S]*?\*\/)/; - var lastStartIndex = 0; - var lastEndIndex = 0; - var noComments = false; - - // test whether an index is located within a comment - return function scanner(idx) { - var comment; - var localStartIndex = 0; - var localEndIndex = 0; - var globalStartIndex = 0; - var globalEndIndex = 0; +function optimizeUnits(name, value, unitsRegexp) { + if (/^(?:\-moz\-calc|\-webkit\-calc|calc)\(/.test(value)) { + return value; + } - // return if we know there are no more comments - if (noComments) - return false; + if (name == 'flex' || name == '-ms-flex' || name == '-webkit-flex' || name == 'flex-basis' || name == '-webkit-flex-basis') { + return value; + } - do { - // idx can be still within last matched comment (many @import statements inside one comment) - if (idx > lastStartIndex && idx < lastEndIndex) - return true; + if (value.indexOf('%') > 0 && (name == 'height' || name == 'max-height')) { + return value; + } - comment = data.match(commentRegex); + return value + .replace(unitsRegexp, '$1' + '0' + '$2') + .replace(unitsRegexp, '$1' + '0' + '$2'); +} - if (!comment) { - noComments = true; - return false; - } +function optimizeWhitespace(name, value) { + if (name.indexOf('filter') > -1 || value.indexOf(' ') == -1 || value.indexOf('expression') === 0) { + return value; + } - // get the indexes relative to the current data chunk - lastStartIndex = localStartIndex = comment.index; - localEndIndex = localStartIndex + comment[0].length; + if (value.indexOf(Marker.SINGLE_QUOTE) > -1 || value.indexOf(Marker.DOUBLE_QUOTE) > -1) { + return value; + } - // calculate the indexes relative to the full original data - globalEndIndex = localEndIndex + lastEndIndex; - globalStartIndex = globalEndIndex - comment[0].length; + value = value.replace(/\s+/g, ' '); - // chop off data up to and including current comment block - data = data.substring(localEndIndex); - lastEndIndex = globalEndIndex; - } while (globalEndIndex < idx); + if (value.indexOf('calc') > -1) { + value = value.replace(/\) ?\/ ?/g, ')/ '); + } - return globalEndIndex > idx && idx > globalStartIndex; - }; + return value + .replace(/(\(;?)\s+/g, '$1') + .replace(/\s+(;?\))/g, '$1') + .replace(/, /g, ','); } -function hasContent(data) { - var isComment = commentScanner(data); - var firstContentIdx = -1; - while (true) { - firstContentIdx = data.indexOf('{', firstContentIdx + 1); - if (firstContentIdx == -1 || !isComment(firstContentIdx)) - break; +function optimizeZeroDegUnit(_, value) { + if (value.indexOf('0deg') == -1) { + return value; } - return firstContentIdx > -1; + return value.replace(/\(0deg\)/g, '(0)'); } -function inline(data, nextStart, nextEnd, context) { - context.shallow = data.indexOf('@shallow') > 0; - - var importDeclaration = data - .substring(nextImportAt(data, nextStart) + '@import'.length + 1, nextEnd) - .replace(/@shallow\)$/, ')') - .trim(); +function optimizeZeroUnits(name, value) { + if (value.indexOf('0') == -1) { + return value; + } - var viaUrl = importDeclaration.indexOf('url(') === 0; - var urlStartsAt = viaUrl ? 4 : 0; - var isQuoted = /^['"]/.exec(importDeclaration.substring(urlStartsAt, urlStartsAt + 2)); - var urlEndsAt = isQuoted ? - importDeclaration.indexOf(isQuoted[0], urlStartsAt + 1) : - split(importDeclaration, ' ')[0].length - (viaUrl ? 1 : 0); - - var importedFile = importDeclaration - .substring(urlStartsAt, urlEndsAt) - .replace(/['"]/g, '') - .replace(/\)$/, '') - .trim(); + if (value.indexOf('-') > -1) { + value = value + .replace(/([^\w\d\-]|^)\-0([^\.]|$)/g, '$10$2') + .replace(/([^\w\d\-]|^)\-0([^\.]|$)/g, '$10$2'); + } - var mediaQuery = importDeclaration - .substring(urlEndsAt + 1) - .replace(/^\)/, '') - .trim(); + return value + .replace(/(^|\s)0+([1-9])/g, '$1$2') + .replace(/(^|\D)\.0+(\D|$)/g, '$10$2') + .replace(/(^|\D)\.0+(\D|$)/g, '$10$2') + .replace(/\.([1-9]*)0+(\D|$)/g, function (match, nonZeroPart, suffix) { + return (nonZeroPart.length > 0 ? '.' : '') + nonZeroPart + suffix; + }) + .replace(/(^|\D)0\.(\d)/g, '$1.$2'); +} - var isRemote = context.isRemote || REMOTE_RESOURCE.test(importedFile); +function removeQuotes(name, value) { + if (name == 'content') { + return value; + } - if (isRemote && (context.localOnly || !allowedResource(importedFile, true, context.imports))) { - if (context.afterContent || hasContent(context.done.join(''))) - context.warnings.push('Ignoring remote @import of "' + importedFile + '" as no callback given.'); - else - restoreImport(importedFile, mediaQuery, context); + return QUOTED_BUT_SAFE_PATTERN.test(value) ? + value.substring(1, value.length - 1) : + value; +} - return processNext(context); - } +function removeUrlQuotes(value) { + return /^url\(['"].+['"]\)$/.test(value) && !/^url\(['"].*[\*\s\(\)'"].*['"]\)$/.test(value) && !/^url\(['"]data:[^;]+;charset/.test(value) ? + value.replace(/["']/g, '') : + value; +} - if (!isRemote && !allowedResource(importedFile, false, context.imports)) { - if (context.afterImport) - context.warnings.push('Ignoring local @import of "' + importedFile + '" as after other inlined content.'); - else - restoreImport(importedFile, mediaQuery, context); - return processNext(context); - } +function transformValue(propertyName, propertyValue, transformCallback) { + var transformedValue = transformCallback(propertyName, propertyValue); - if (!isRemote && context.afterContent) { - context.warnings.push('Ignoring local @import of "' + importedFile + '" as after other CSS content.'); - return processNext(context); + if (transformedValue === undefined) { + return propertyValue; + } else if (transformedValue === false) { + return IgnoreProperty; + } else { + return transformedValue; } - - var method = isRemote ? inlineRemoteResource : inlineLocalResource; - return method(importedFile, mediaQuery, context); } -function allowedResource(importedFile, isRemote, rules) { - if (rules.length === 0) - return false; +// - if (isRemote && NO_PROTOCOL_RESOURCE.test(importedFile)) - importedFile = 'http:' + importedFile; +function optimizeBody(properties, context) { + var options = context.options; + var levelOptions = options.level[OptimizationLevel.One]; + var property, name, type, value; + var valueIsUrl; + var propertyToken; + var _properties = wrapForOptimizing(properties, true); - var match = isRemote ? - url.parse(importedFile).host : - importedFile; - var allowed = true; + propertyLoop: + for (var i = 0, l = _properties.length; i < l; i++) { + property = _properties[i]; + name = property.name; - for (var i = 0; i < rules.length; i++) { - var rule = rules[i]; + if (!PROPERTY_NAME_PATTERN.test(name)) { + propertyToken = property.all[property.position]; + context.warnings.push('Invalid property name \'' + name + '\' at ' + formatPosition(propertyToken[1][2][0]) + '. Ignoring.'); + property.unused = true; + } - if (rule == 'all') - allowed = true; - else if (isRemote && rule == 'local') - allowed = false; - else if (isRemote && rule == 'remote') - allowed = true; - else if (!isRemote && rule == 'remote') - allowed = false; - else if (!isRemote && rule == 'local') - allowed = true; - else if (rule[0] == '!' && rule.substring(1) === match) - allowed = false; - } + if (property.value.length === 0) { + propertyToken = property.all[property.position]; + context.warnings.push('Empty property \'' + name + '\' at ' + formatPosition(propertyToken[1][2][0]) + '. Ignoring.'); + property.unused = true; + } - return allowed; -} + if (property.hack && ( + (property.hack == Hack.ASTERISK || property.hack == Hack.UNDERSCORE) && !options.compatibility.properties.iePrefixHack || + property.hack == Hack.BACKSLASH && !options.compatibility.properties.ieSuffixHack || + property.hack == Hack.BANG && !options.compatibility.properties.ieBangHack)) { + property.unused = true; + } -function inlineRemoteResource(importedFile, mediaQuery, context) { - var importedUrl = REMOTE_RESOURCE.test(importedFile) ? - importedFile : - url.resolve(context.relativeTo, importedFile); - var originalUrl = importedUrl; + if (levelOptions.removeNegativePaddings && name.indexOf('padding') === 0 && (isNegative(property.value[0]) || isNegative(property.value[1]) || isNegative(property.value[2]) || isNegative(property.value[3]))) { + property.unused = true; + } - if (NO_PROTOCOL_RESOURCE.test(importedUrl)) - importedUrl = 'http:' + importedUrl; + if (!options.compatibility.properties.ieFilters && isLegacyFilter(property)) { + property.unused = true; + } - if (context.visited.indexOf(importedUrl) > -1) - return processNext(context); + if (property.unused) { + continue; + } + if (property.block) { + optimizeBody(property.value[0][1], context); + continue; + } - if (context.debug) - console.error('Inlining remote stylesheet: ' + importedUrl); + for (var j = 0, m = property.value.length; j < m; j++) { + type = property.value[j][0]; + value = property.value[j][1]; + valueIsUrl = isUrl(value); - context.visited.push(importedUrl); + if (type == Token.PROPERTY_BLOCK) { + property.unused = true; + context.warnings.push('Invalid value token at ' + formatPosition(value[0][1][2][0]) + '. Ignoring.'); + break; + } - var proxyProtocol = context.inliner.request.protocol || context.inliner.request.hostname; - var get = - ((proxyProtocol && proxyProtocol.indexOf('https://') !== 0 ) || - importedUrl.indexOf('http://') === 0) ? - http.get : - https.get; + if (valueIsUrl && !context.validator.isValidUrl(value)) { + property.unused = true; + context.warnings.push('Broken URL \'' + value + '\' at ' + formatPosition(property.value[j][2][0]) + '. Ignoring.'); + break; + } - var errorHandled = false; - function handleError(message) { - if (errorHandled) - return; + if (valueIsUrl) { + value = levelOptions.normalizeUrls ? + normalizeUrl(value) : + value; + value = !options.compatibility.properties.urlQuotes ? + removeUrlQuotes(value) : + value; + } else if (isQuoted(value)) { + value = levelOptions.removeQuotes ? + removeQuotes(name, value) : + value; + } else { + value = levelOptions.removeWhitespace ? + optimizeWhitespace(name, value) : + value; + value = optimizePrecision(name, value, options.precision); + value = optimizePixelLengths(name, value, options.compatibility); + value = levelOptions.replaceTimeUnits ? + optimizeTimeUnits(name, value) : + value; + value = levelOptions.replaceZeroUnits ? + optimizeZeroUnits(name, value) : + value; - errorHandled = true; - context.errors.push('Broken @import declaration of "' + importedUrl + '" - ' + message); - restoreImport(importedUrl, mediaQuery, context); + if (options.compatibility.properties.zeroUnits) { + value = optimizeZeroDegUnit(name, value); + value = optimizeUnits(name, value, options.unitsRegexp); + } - process.nextTick(function () { - processNext(context); - }); - } + if (options.compatibility.properties.colors) { + value = optimizeColors(name, value, options.compatibility); + } + } - var requestOptions = override(url.parse(importedUrl), context.inliner.request); - if (context.inliner.request.hostname !== undefined) { + value = transformValue(name, value, levelOptions.transform); - //overwrite as we always expect a http proxy currently - requestOptions.protocol = context.inliner.request.protocol || 'http:'; - requestOptions.path = requestOptions.href; - } + if (value === IgnoreProperty) { + property.unused = true; + continue propertyLoop; + } + property.value[j][1] = value; + } - get(requestOptions, function (res) { - if (res.statusCode < 200 || res.statusCode > 399) { - return handleError('error ' + res.statusCode); - } else if (res.statusCode > 299) { - var movedUrl = url.resolve(importedUrl, res.headers.location); - return inlineRemoteResource(movedUrl, mediaQuery, context); + if (levelOptions.replaceMultipleZeros) { + optimizeMultipleZeros(property); } - var chunks = []; - var parsedUrl = url.parse(importedUrl); - res.on('data', function (chunk) { - chunks.push(chunk.toString()); - }); - res.on('end', function () { - var importedData = chunks.join(''); - if (context.rebase) - importedData = rewriteUrls(importedData, { toBase: originalUrl }, context); - context.sourceReader.trackSource(importedUrl, importedData); - importedData = context.sourceTracker.store(importedUrl, importedData); - importedData = rebaseMap(importedData, importedUrl); + if (name == 'background' && levelOptions.optimizeBackground) { + optimizeBackground(property); + } else if (name.indexOf('border') === 0 && name.indexOf('radius') > 0 && levelOptions.optimizeBorderRadius) { + optimizeBorderRadius(property); + } else if (name == 'filter'&& levelOptions.optimizeFilter && options.compatibility.properties.ieFilters) { + optimizeFilter(property); + } else if (name == 'font' && levelOptions.optimizeFont) { + optimizeFont(property, options); + } else if (name == 'font-weight' && levelOptions.optimizeFontWeight) { + optimizeFontWeight(property, 0); + } else if (name == 'outline' && levelOptions.optimizeOutline) { + optimizeOutline(property); + } + } - if (mediaQuery.length > 0) - importedData = '@media ' + mediaQuery + '{' + importedData + '}'; + restoreFromOptimizing(_properties); + removeUnused(_properties); - context.afterImport = true; + if (_properties.length != properties.length) { + removeComments(properties, options); + } +} - var newContext = override(context, { - isRemote: true, - relativeTo: parsedUrl.protocol + '//' + parsedUrl.host + parsedUrl.pathname - }); +function removeComments(tokens, options) { + var token; + var i; - process.nextTick(function () { - importFrom(importedData, newContext); - }); - }); - }) - .on('error', function (res) { - handleError(res.message); - }) - .on('timeout', function () { - handleError('timeout'); - }) - .setTimeout(context.inliner.timeout); -} + for (i = 0; i < tokens.length; i++) { + token = tokens[i]; -function inlineLocalResource(importedFile, mediaQuery, context) { - var relativeTo = importedFile[0] == '/' ? - context.root : - context.relativeTo; + if (token[0] != Token.COMMENT) { + continue; + } - var fullPath = path.resolve(path.join(relativeTo, importedFile)); + optimizeComment(token, options); - if (!fs.existsSync(fullPath) || !fs.statSync(fullPath).isFile()) { - context.errors.push('Broken @import declaration of "' + importedFile + '"'); - return processNext(context); + if (token[1].length === 0) { + tokens.splice(i, 1); + i--; + } } +} - if (context.visited.indexOf(fullPath) > -1) - return processNext(context); +function optimizeComment(token, options) { + if (token[1][2] == Marker.EXCLAMATION && (options.level[OptimizationLevel.One].specialComments == 'all' || options.commentsKept < options.level[OptimizationLevel.One].specialComments)) { + options.commentsKept++; + return; + } + token[1] = []; +} - if (context.debug) - console.error('Inlining local stylesheet: ' + fullPath); +function cleanupCharsets(tokens) { + var hasCharset = false; - context.visited.push(fullPath); + for (var i = 0, l = tokens.length; i < l; i++) { + var token = tokens[i]; - var importRelativeTo = path.dirname(fullPath); - var importedData = fs.readFileSync(fullPath, 'utf8'); - if (context.rebase) { - var rewriteOptions = { - relative: true, - fromBase: importRelativeTo, - toBase: context.baseRelativeTo - }; - importedData = rewriteUrls(importedData, rewriteOptions, context); - } + if (token[0] != Token.AT_RULE) + continue; - var relativePath = path.relative(context.root, fullPath); - context.sourceReader.trackSource(relativePath, importedData); - importedData = context.sourceTracker.store(relativePath, importedData); + if (!CHARSET_REGEXP.test(token[1])) + continue; - if (mediaQuery.length > 0) - importedData = '@media ' + mediaQuery + '{' + importedData + '}'; + if (hasCharset || token[1].indexOf(CHARSET_TOKEN) == -1) { + tokens.splice(i, 1); + i--; + l--; + } else { + hasCharset = true; + tokens.splice(i, 1); + tokens.unshift([Token.AT_RULE, token[1].replace(CHARSET_REGEXP, CHARSET_TOKEN)]); + } + } +} - context.afterImport = true; +function buildUnitRegexp(options) { + var units = ['px', 'em', 'ex', 'cm', 'mm', 'in', 'pt', 'pc', '%']; + var otherUnits = ['ch', 'rem', 'vh', 'vm', 'vmax', 'vmin', 'vw']; - var newContext = override(context, { - relativeTo: importRelativeTo + otherUnits.forEach(function (unit) { + if (options.compatibility.units[unit]) { + units.push(unit); + } }); - return importFrom(importedData, newContext); + return new RegExp('(^|\\s|\\(|,)0(?:' + units.join('|') + ')(\\W|$)', 'g'); } -function restoreImport(importedUrl, mediaQuery, context) { - var restoredImport = '@import url(' + importedUrl + ')' + (mediaQuery.length > 0 ? ' ' + mediaQuery : '') + ';'; - context.done.push(restoredImport); -} +function buildPrecisionOptions(roundingPrecision) { + var precisionOptions = { + matcher: null, + units: {}, + }; + var optimizable = []; + var unit; + var value; -module.exports = ImportInliner; + for (unit in roundingPrecision) { + value = roundingPrecision[unit]; -}).call(this,require('_process')) -},{"../urls/rewrite":60,"../utils/object.js":64,"../utils/split":68,"_process":81,"fs":4,"http":121,"https":72,"path":79,"url":139}],14:[function(require,module,exports){ -var wrapSingle = require('./wrap-for-optimizing').single; -var InvalidPropertyError = require('./invalid-property-error'); + if (value != DEFAULT_ROUNDING_PRECISION) { + precisionOptions.units[unit] = {}; + precisionOptions.units[unit].value = value; + precisionOptions.units[unit].multiplier = Math.pow(10, value); -var split = require('../utils/split'); -var MULTIPLEX_SEPARATOR = ','; + optimizable.push(unit); + } + } -function _colorFilter(validator) { - return function (value) { - return value[0] == 'invert' || validator.isValidColor(value[0]); - }; -} + if (optimizable.length > 0) { + precisionOptions.matcher = new RegExp('(\\d*)(\\.\\d+)(' + optimizable.join('|') + ')', 'g'); + } -function _styleFilter(validator) { - return function (value) { - return value[0] != 'inherit' && validator.isValidStyle(value[0]) && !validator.isValidColorValue(value[0]); - }; + return precisionOptions; } -function _wrapDefault(name, property, compactable) { - var descriptor = compactable[name]; - if (descriptor.doubleValues && descriptor.defaultValue.length == 2) - return wrapSingle([[name, property.important], [descriptor.defaultValue[0]], [descriptor.defaultValue[1]]]); - else if (descriptor.doubleValues && descriptor.defaultValue.length == 1) - return wrapSingle([[name, property.important], [descriptor.defaultValue[0]]]); - else - return wrapSingle([[name, property.important], [descriptor.defaultValue]]); +function isImport(token) { + return IMPORT_PREFIX_PATTERN.test(token[1]); } -function _widthFilter(validator) { - return function (value) { - return value[0] != 'inherit' && validator.isValidWidth(value[0]) && !validator.isValidStyleKeyword(value[0]) && !validator.isValidColorValue(value[0]); - }; +function isLegacyFilter(property) { + var value; + + if (property.name == 'filter' || property.name == '-ms-filter') { + value = property.value[0][1]; + + return value.indexOf('progid') > -1 || + value.indexOf('alpha') === 0 || + value.indexOf('chroma') === 0; + } else { + return false; + } } -function background(property, compactable, validator) { - var image = _wrapDefault('background-image', property, compactable); - var position = _wrapDefault('background-position', property, compactable); - var size = _wrapDefault('background-size', property, compactable); - var repeat = _wrapDefault('background-repeat', property, compactable); - var attachment = _wrapDefault('background-attachment', property, compactable); - var origin = _wrapDefault('background-origin', property, compactable); - var clip = _wrapDefault('background-clip', property, compactable); - var color = _wrapDefault('background-color', property, compactable); - var components = [image, position, size, repeat, attachment, origin, clip, color]; - var values = property.value; - - var positionSet = false; - var clipSet = false; - var originSet = false; - var repeatSet = false; - - if (property.value.length == 1 && property.value[0][0] == 'inherit') { - // NOTE: 'inherit' is not a valid value for background-attachment - color.value = image.value = repeat.value = position.value = size.value = origin.value = clip.value = property.value; - return components; - } - - for (var i = values.length - 1; i >= 0; i--) { - var value = values[i]; +function level1Optimize(tokens, context) { + var options = context.options; + var levelOptions = options.level[OptimizationLevel.One]; + var ie7Hack = options.compatibility.selectors.ie7Hack; + var adjacentSpace = options.compatibility.selectors.adjacentSpace; + var spaceAfterClosingBrace = options.compatibility.properties.spaceAfterClosingBrace; + var format = options.format; + var mayHaveCharset = false; + var afterRules = false; - if (validator.isValidBackgroundAttachment(value[0])) { - attachment.value = [value]; - } else if (validator.isValidBackgroundBox(value[0])) { - if (clipSet) { - origin.value = [value]; - originSet = true; - } else { - clip.value = [value]; - clipSet = true; - } - } else if (validator.isValidBackgroundRepeat(value[0])) { - if (repeatSet) { - repeat.value.unshift(value); - } else { - repeat.value = [value]; - repeatSet = true; - } - } else if (validator.isValidBackgroundPositionPart(value[0]) || validator.isValidBackgroundSizePart(value[0])) { - if (i > 0) { - var previousValue = values[i - 1]; + options.unitsRegexp = options.unitsRegexp || buildUnitRegexp(options); + options.precision = options.precision || buildPrecisionOptions(levelOptions.roundingPrecision); + options.commentsKept = options.commentsKept || 0; - if (previousValue[0].indexOf('/') > 0) { - var twoParts = split(previousValue[0], '/'); - // NOTE: we do this slicing as value may contain metadata too, like for source maps - size.value = [[twoParts.pop()].concat(previousValue.slice(1)), value]; - values[i - 1] = [twoParts.pop()].concat(previousValue.slice(1)); - } else if (i > 1 && values[i - 2][0] == '/') { - size.value = [previousValue, value]; - i -= 2; - } else if (previousValue[0] == '/') { - size.value = [value]; - } else { - if (!positionSet) - position.value = []; + for (var i = 0, l = tokens.length; i < l; i++) { + var token = tokens[i]; - position.value.unshift(value); - positionSet = true; - } - } else { - if (!positionSet) - position.value = []; + switch (token[0]) { + case Token.AT_RULE: + token[1] = isImport(token) && afterRules ? '' : token[1]; + token[1] = levelOptions.tidyAtRules ? tidyAtRule(token[1]) : token[1]; + mayHaveCharset = true; + break; + case Token.AT_RULE_BLOCK: + optimizeBody(token[2], context); + afterRules = true; + break; + case Token.NESTED_BLOCK: + token[1] = levelOptions.tidyBlockScopes ? tidyBlock(token[1], spaceAfterClosingBrace) : token[1]; + level1Optimize(token[2], context); + afterRules = true; + break; + case Token.COMMENT: + optimizeComment(token, options); + break; + case Token.RULE: + token[1] = levelOptions.tidySelectors ? tidyRules(token[1], !ie7Hack, adjacentSpace, format, context.warnings) : token[1]; + token[1] = token[1].length > 1 ? sortSelectors(token[1], levelOptions.selectorsSortingMethod) : token[1]; + optimizeBody(token[2], context); + afterRules = true; + break; + } - position.value.unshift(value); - positionSet = true; - } - } else if (validator.isValidBackgroundPositionAndSize(value[0])) { - var sizeValue = split(value[0], '/'); - // NOTE: we do this slicing as value may contain metadata too, like for source maps - size.value = [[sizeValue.pop()].concat(value.slice(1))]; - position.value = [[sizeValue.pop()].concat(value.slice(1))]; - } else if ((color.value[0][0] == compactable[color.name].defaultValue || color.value[0][0] == 'none') && validator.isValidColor(value[0])) { - color.value = [value]; - } else if (validator.isValidUrl(value[0]) || validator.isValidFunction(value[0])) { - image.value = [value]; + if (token[1].length === 0 || (token[2] && token[2].length === 0)) { + tokens.splice(i, 1); + i--; + l--; } } - if (clipSet && !originSet) - origin.value = clip.value.slice(0); + if (levelOptions.cleanupCharsets && mayHaveCharset) { + cleanupCharsets(tokens); + } - return components; + return tokens; } -function borderRadius(property, compactable) { - var values = property.value; - var splitAt = -1; +module.exports = level1Optimize; - for (var i = 0, l = values.length; i < l; i++) { - if (values[i][0] == '/') { - splitAt = i; - break; - } - } +},{"../../options/optimization-level":63,"../../options/rounding-precision":66,"../../tokenizer/marker":81,"../../tokenizer/token":82,"../../utils/format-position":85,"../../utils/split":95,"../hack":9,"../remove-unused":54,"../restore-from-optimizing":55,"../wrap-for-optimizing":57,"./shorten-hex":12,"./shorten-hsl":13,"./shorten-rgb":14,"./sort-selectors":15,"./tidy-at-rule":16,"./tidy-block":17,"./tidy-rules":18}],12:[function(require,module,exports){ +var COLORS = { + aliceblue: '#f0f8ff', + antiquewhite: '#faebd7', + aqua: '#0ff', + aquamarine: '#7fffd4', + azure: '#f0ffff', + beige: '#f5f5dc', + bisque: '#ffe4c4', + black: '#000', + blanchedalmond: '#ffebcd', + blue: '#00f', + blueviolet: '#8a2be2', + brown: '#a52a2a', + burlywood: '#deb887', + cadetblue: '#5f9ea0', + chartreuse: '#7fff00', + chocolate: '#d2691e', + coral: '#ff7f50', + cornflowerblue: '#6495ed', + cornsilk: '#fff8dc', + crimson: '#dc143c', + cyan: '#0ff', + darkblue: '#00008b', + darkcyan: '#008b8b', + darkgoldenrod: '#b8860b', + darkgray: '#a9a9a9', + darkgreen: '#006400', + darkgrey: '#a9a9a9', + 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: '#f0f', + gainsboro: '#dcdcdc', + ghostwhite: '#f8f8ff', + gold: '#ffd700', + goldenrod: '#daa520', + gray: '#808080', + green: '#008000', + greenyellow: '#adff2f', + grey: '#808080', + 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', + lightgreen: '#90ee90', + lightgrey: '#d3d3d3', + lightpink: '#ffb6c1', + lightsalmon: '#ffa07a', + lightseagreen: '#20b2aa', + lightskyblue: '#87cefa', + lightslategray: '#778899', + lightslategrey: '#778899', + lightsteelblue: '#b0c4de', + lightyellow: '#ffffe0', + lime: '#0f0', + limegreen: '#32cd32', + linen: '#faf0e6', + magenta: '#ff00ff', + maroon: '#800000', + mediumaquamarine: '#66cdaa', + mediumblue: '#0000cd', + mediumorchid: '#ba55d3', + mediumpurple: '#9370db', + 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: '#db7093', + papayawhip: '#ffefd5', + peachpuff: '#ffdab9', + peru: '#cd853f', + pink: '#ffc0cb', + plum: '#dda0dd', + powderblue: '#b0e0e6', + purple: '#800080', + rebeccapurple: '#663399', + red: '#f00', + 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: '#fff', + whitesmoke: '#f5f5f5', + yellow: '#ff0', + yellowgreen: '#9acd32' +}; - if (splitAt === 0 || splitAt === values.length - 1) { - throw new InvalidPropertyError('Invalid border-radius value.'); +var toHex = {}; +var toName = {}; + +for (var name in COLORS) { + var hex = COLORS[name]; + + if (name.length < hex.length) { + toName[hex] = name; + } else { + toHex[name] = hex; } +} - var target = _wrapDefault(property.name, property, compactable); - target.value = splitAt > -1 ? - values.slice(0, splitAt) : - values.slice(0); - target.components = fourValues(target, compactable); +var toHexPattern = new RegExp('(^| |,|\\))(' + Object.keys(toHex).join('|') + ')( |,|\\)|$)', 'ig'); +var toNamePattern = new RegExp('(' + Object.keys(toName).join('|') + ')([^a-f0-9]|$)', 'ig'); - var remainder = _wrapDefault(property.name, property, compactable); - remainder.value = splitAt > -1 ? - values.slice(splitAt + 1) : - values.slice(0); - remainder.components = fourValues(remainder, compactable); - - for (var j = 0; j < 4; j++) { - target.components[j].multiplex = true; - target.components[j].value = target.components[j].value.concat(remainder.components[j].value); - } - - return target.components; +function hexConverter(match, prefix, colorValue, suffix) { + return prefix + toHex[colorValue.toLowerCase()] + suffix; } -function fourValues(property, compactable) { - var componentNames = compactable[property.name].components; - var components = []; - var value = property.value; - - if (value.length < 1) - return []; +function nameConverter(match, colorValue, suffix) { + return toName[colorValue.toLowerCase()] + suffix; +} - if (value.length < 2) - value[1] = value[0].slice(0); - if (value.length < 3) - value[2] = value[0].slice(0); - if (value.length < 4) - value[3] = value[1].slice(0); +function shortenHex(value) { + var hasHex = value.indexOf('#') > -1; + var shortened = value.replace(toHexPattern, hexConverter); - for (var i = componentNames.length - 1; i >= 0; i--) { - var component = wrapSingle([[componentNames[i], property.important]]); - component.value = [value[i]]; - components.unshift(component); + if (shortened != value) { + shortened = shortened.replace(toHexPattern, hexConverter); } - return components; + return hasHex ? + shortened.replace(toNamePattern, nameConverter) : + shortened; } -function multiplex(splitWith) { - return function (property, compactable, validator) { - var splitsAt = []; - var values = property.value; - var i, j, l, m; +module.exports = shortenHex; - // find split commas - for (i = 0, l = values.length; i < l; i++) { - if (values[i][0] == ',') - splitsAt.push(i); - } +},{}],13:[function(require,module,exports){ +// HSL to RGB converter. Both methods adapted from: +// http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript - if (splitsAt.length === 0) - return splitWith(property, compactable, validator); +function hslToRgb(h, s, l) { + var r, g, b; - var splitComponents = []; + // normalize hue orientation b/w 0 and 360 degrees + h = h % 360; + if (h < 0) + h += 360; + h = ~~h / 360; - // split over commas, and into components - for (i = 0, l = splitsAt.length; i <= l; i++) { - var from = i === 0 ? 0 : splitsAt[i - 1] + 1; - var to = i < l ? splitsAt[i] : values.length; + if (s < 0) + s = 0; + else if (s > 100) + s = 100; + s = ~~s / 100; - var _property = _wrapDefault(property.name, property, compactable); - _property.value = values.slice(from, to); + if (l < 0) + l = 0; + else if (l > 100) + l = 100; + l = ~~l / 100; - splitComponents.push(splitWith(_property, compactable, validator)); - } + if (s === 0) { + r = g = b = l; // achromatic + } else { + var q = l < 0.5 ? + l * (1 + s) : + l + s - l * s; + var p = 2 * l - q; + r = hueToRgb(p, q, h + 1/3); + g = hueToRgb(p, q, h); + b = hueToRgb(p, q, h - 1/3); + } - var components = splitComponents[0]; + return [~~(r * 255), ~~(g * 255), ~~(b * 255)]; +} - // group component values from each split - for (i = 0, l = components.length; i < l; i++) { - components[i].multiplex = true; +function hueToRgb(p, q, t) { + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1/6) return p + (q - p) * 6 * t; + if (t < 1/2) return q; + if (t < 2/3) return p + (q - p) * (2/3 - t) * 6; + return p; +} - for (j = 1, m = splitComponents.length; j < m; j++) { - components[i].value.push([MULTIPLEX_SEPARATOR]); - Array.prototype.push.apply(components[i].value, splitComponents[j][i].value); - } - } +function shortenHsl(hue, saturation, lightness) { + var asRgb = hslToRgb(hue, saturation, lightness); + var redAsHex = asRgb[0].toString(16); + var greenAsHex = asRgb[1].toString(16); + var blueAsHex = asRgb[2].toString(16); - return components; - }; + return '#' + + ((redAsHex.length == 1 ? '0' : '') + redAsHex) + + ((greenAsHex.length == 1 ? '0' : '') + greenAsHex) + + ((blueAsHex.length == 1 ? '0' : '') + blueAsHex); } -function listStyle(property, compactable, validator) { - var type = _wrapDefault('list-style-type', property, compactable); - var position = _wrapDefault('list-style-position', property, compactable); - var image = _wrapDefault('list-style-image', property, compactable); - var components = [type, position, image]; - - if (property.value.length == 1 && property.value[0][0] == 'inherit') { - type.value = position.value = image.value = [property.value[0]]; - return components; - } +module.exports = shortenHsl; - var values = property.value.slice(0); - var total = values.length; - var index = 0; +},{}],14:[function(require,module,exports){ +function shortenRgb(red, green, blue) { + var normalizedRed = Math.max(0, Math.min(parseInt(red), 255)); + var normalizedGreen = Math.max(0, Math.min(parseInt(green), 255)); + var normalizedBlue = Math.max(0, Math.min(parseInt(blue), 255)); - // `image` first... - for (index = 0, total = values.length; index < total; index++) { - if (validator.isValidUrl(values[index][0]) || values[index][0] == '0') { - image.value = [values[index]]; - values.splice(index, 1); - break; - } - } + // Credit: Asen http://jsbin.com/UPUmaGOc/2/edit?js,console + return '#' + ('00000' + (normalizedRed << 16 | normalizedGreen << 8 | normalizedBlue).toString(16)).slice(-6); +} - // ... then `type`... - for (index = 0, total = values.length; index < total; index++) { - if (validator.isValidListStyleType(values[index][0])) { - type.value = [values[index]]; - values.splice(index, 1); - break; - } - } +module.exports = shortenRgb; - // ... and what's left is a `position` - if (values.length > 0 && validator.isValidListStylePosition(values[0][0])) - position.value = [values[0]]; +},{}],15:[function(require,module,exports){ +var naturalCompare = require('../../utils/natural-compare'); - return components; +function naturalSorter(scope1, scope2) { + return naturalCompare(scope1[1], scope2[1]); } -function widthStyleColor(property, compactable, validator) { - var descriptor = compactable[property.name]; - var components = [ - _wrapDefault(descriptor.components[0], property, compactable), - _wrapDefault(descriptor.components[1], property, compactable), - _wrapDefault(descriptor.components[2], property, compactable) - ]; - var color, style, width; +function standardSorter(scope1, scope2) { + return scope1[1] > scope2[1] ? 1 : -1; +} - for (var i = 0; i < 3; i++) { - var component = components[i]; +function sortSelectors(selectors, method) { + var sorter; - if (component.name.indexOf('color') > 0) - color = component; - else if (component.name.indexOf('style') > 0) - style = component; - else - width = component; + switch (method) { + case 'natural': + sorter = naturalSorter; + break; + case 'standard': + sorter = standardSorter; } - if ((property.value.length == 1 && property.value[0][0] == 'inherit') || - (property.value.length == 3 && property.value[0][0] == 'inherit' && property.value[1][0] == 'inherit' && property.value[2][0] == 'inherit')) { - color.value = style.value = width.value = [property.value[0]]; - return components; - } + return selectors.sort(sorter); +} - var values = property.value.slice(0); - var match, matches; +module.exports = sortSelectors; - // NOTE: usually users don't follow the required order of parts in this shorthand, - // so we'll try to parse it caring as little about order as possible +},{"../../utils/natural-compare":93}],16:[function(require,module,exports){ +function tidyAtRule(value) { + return value + .replace(/\s+/g, ' ') + .replace(/url\(\s+/g, 'url(') + .replace(/\s+\)/g, ')') + .trim(); +} - if (values.length > 0) { - matches = values.filter(_widthFilter(validator)); - match = matches.length > 1 && (matches[0][0] == 'none' || matches[0][0] == 'auto') ? matches[1] : matches[0]; - if (match) { - width.value = [match]; - values.splice(values.indexOf(match), 1); - } - } +module.exports = tidyAtRule; - if (values.length > 0) { - match = values.filter(_styleFilter(validator))[0]; - if (match) { - style.value = [match]; - values.splice(values.indexOf(match), 1); - } - } +},{}],17:[function(require,module,exports){ +function tidyBlock(values, spaceAfterClosingBrace) { + var i; - if (values.length > 0) { - match = values.filter(_colorFilter(validator))[0]; - if (match) { - color.value = [match]; - values.splice(values.indexOf(match), 1); - } + for (i = values.length - 1; i >= 0; i--) { + values[i][1] = values[i][1] + .replace(/\n|\r\n/g, ' ') + .replace(/\s+/g, ' ') + .replace(/(,|:|\() /g, '$1') + .replace(/ \)/g, ')') + .replace(/'([a-zA-Z][a-zA-Z\d\-_]+)'/, '$1') + .replace(/"([a-zA-Z][a-zA-Z\d\-_]+)"/, '$1') + .replace(spaceAfterClosingBrace ? null : /\) /g, ')'); } - return components; + return values; } -module.exports = { - background: background, - border: widthStyleColor, - borderRadius: borderRadius, - fourValues: fourValues, - listStyle: listStyle, - multiplex: multiplex, - outline: widthStyleColor -}; +module.exports = tidyBlock; -},{"../utils/split":68,"./invalid-property-error":20,"./wrap-for-optimizing":30}],15:[function(require,module,exports){ -// Functions that decide what value can override what. -// The main purpose is to disallow removing CSS fallbacks. -// A separate implementation is needed for every different kind of CSS property. -// ----- -// The generic idea is that properties that have wider browser support are 'more understandable' -// than others and that 'less understandable' values can't override more understandable ones. +},{}],18:[function(require,module,exports){ +var Spaces = require('../../options/format').Spaces; +var Marker = require('../../tokenizer/marker'); +var formatPosition = require('../../utils/format-position'); -// Use when two tokens of the same property can always be merged -function always() { - return true; -} +var HTML_COMMENT_PATTERN = /^(?:(?:)\s*)+/; +var RELATION_PATTERN = /[>\+~]/; +var WHITESPACE_PATTERN = /\s/; -function alwaysButIntoFunction(property1, property2, validator) { - var value1 = property1.value[0][0]; - var value2 = property2.value[0][0]; +var ASTERISK_PLUS_HTML_HACK = '*+html '; +var ASTERISK_FIRST_CHILD_PLUS_HTML_HACK = '*:first-child+html '; +var LESS_THAN = '<'; - var validFunction1 = validator.isValidFunction(value1); - var validFunction2 = validator.isValidFunction(value2); +function hasInvalidCharacters(value) { + var isEscaped; + var isInvalid = false; + var character; + var isQuote = false; + var i, l; - if (validFunction1 && validFunction2) { - return validator.areSameFunction(value1, value2); - } else if (!validFunction1 && validFunction2) { - return false; - } else { - return true; - } -} + for (i = 0, l = value.length; i < l; i++) { + character = value[i]; -function backgroundImage(property1, property2, validator) { - // The idea here is that 'more understandable' values override 'less understandable' values, but not vice versa - // Understandability: (none | url | inherit) > (same function) > (same value) + if (isEscaped) { + // continue as always + } else if (character == Marker.SINGLE_QUOTE || character == Marker.DOUBLE_QUOTE) { + isQuote = !isQuote; + } else if (!isQuote && (character == Marker.CLOSE_CURLY_BRACKET || character == Marker.EXCLAMATION || character == LESS_THAN || character == Marker.SEMICOLON)) { + isInvalid = true; + break; + } else if (!isQuote && i === 0 && RELATION_PATTERN.test(character)) { + isInvalid = true; + break; + } - // (none | url) - var image1 = property1.value[0][0]; - var image2 = property2.value[0][0]; + isEscaped = character == Marker.BACK_SLASH; + } + + return isInvalid; +} + +function removeWhitespace(value, format) { + var stripped = []; + var character; + var isNewLineNix; + var isNewLineWin; + var isEscaped; + var wasEscaped; + var isQuoted; + var isSingleQuoted; + var isDoubleQuoted; + var isAttribute; + var isRelation; + var isWhitespace; + var roundBracketLevel = 0; + var wasRelation = false; + var wasWhitespace = false; + var spaceAroundRelation = format && format.spaces[Spaces.AroundSelectorRelation]; + var i, l; + + for (i = 0, l = value.length; i < l; i++) { + character = value[i]; + + isNewLineNix = character == Marker.NEW_LINE_NIX; + isNewLineWin = character == Marker.NEW_LINE_NIX && value[i - 1] == Marker.NEW_LINE_WIN; + isQuoted = isSingleQuoted || isDoubleQuoted; + isRelation = !isEscaped && RELATION_PATTERN.test(character); + isWhitespace = WHITESPACE_PATTERN.test(character); + + if (wasEscaped && isQuoted && isNewLineWin) { + // swallow escaped new windows lines in comments + stripped.pop(); + stripped.pop(); + } else if (isEscaped && isQuoted && isNewLineNix) { + // swallow escaped new *nix lines in comments + stripped.pop(); + } else if (isEscaped) { + stripped.push(character); + } else if (character == Marker.OPEN_SQUARE_BRACKET && !isQuoted) { + stripped.push(character); + isAttribute = true; + } else if (character == Marker.CLOSE_SQUARE_BRACKET && !isQuoted) { + stripped.push(character); + isAttribute = false; + } else if (character == Marker.OPEN_ROUND_BRACKET && !isQuoted) { + stripped.push(character); + roundBracketLevel++; + } else if (character == Marker.CLOSE_ROUND_BRACKET && !isQuoted) { + stripped.push(character); + roundBracketLevel--; + } else if (character == Marker.SINGLE_QUOTE && !isQuoted) { + stripped.push(character); + isSingleQuoted = true; + } else if (character == Marker.DOUBLE_QUOTE && !isQuoted) { + stripped.push(character); + isDoubleQuoted = true; + } else if (character == Marker.SINGLE_QUOTE && isQuoted) { + stripped.push(character); + isSingleQuoted = false; + } else if (character == Marker.DOUBLE_QUOTE && isQuoted) { + stripped.push(character); + isDoubleQuoted = false; + } else if (isWhitespace && wasRelation && !spaceAroundRelation) { + continue; + } else if (!isWhitespace && wasRelation && spaceAroundRelation) { + stripped.push(Marker.SPACE); + stripped.push(character); + } else if (isWhitespace && (isAttribute || roundBracketLevel > 0) && !isQuoted) { + // skip space + } else if (isWhitespace && wasWhitespace && !isQuoted) { + // skip extra space + } else if ((isNewLineWin || isNewLineNix) && (isAttribute || roundBracketLevel > 0) && isQuoted) { + // skip newline + } else if (isRelation && wasWhitespace && !spaceAroundRelation) { + stripped.pop(); + stripped.push(character); + } else if (isRelation && !wasWhitespace && spaceAroundRelation) { + stripped.push(Marker.SPACE); + stripped.push(character); + } else if (isWhitespace) { + stripped.push(Marker.SPACE); + } else { + stripped.push(character); + } - if (image2 == 'none' || image2 == 'inherit' || validator.isValidUrl(image2)) - return true; - if (image1 == 'none' || image1 == 'inherit' || validator.isValidUrl(image1)) - return false; + wasEscaped = isEscaped; + isEscaped = character == Marker.BACK_SLASH; + wasRelation = isRelation; + wasWhitespace = isWhitespace; + } - // Functions with the same name can override each other; same values can override each other - return sameFunctionOrValue(property1, property2, validator); + return stripped.join(''); } -function border(property1, property2, validator) { - return color(property1.components[2], property2.components[2], validator); +function removeQuotes(value) { + return value + .replace(/='([a-zA-Z][a-zA-Z\d\-_]+)'/g, '=$1') + .replace(/="([a-zA-Z][a-zA-Z\d\-_]+)"/g, '=$1'); } -// Use for color properties (color, background-color, border-color, etc.) -function color(property1, property2, validator) { - // The idea here is that 'more understandable' values override 'less understandable' values, but not vice versa - // Understandability: (hex | named) > (rgba | hsla) > (same function name) > anything else - // NOTE: at this point rgb and hsl are replaced by hex values by clean-css +function tidyRules(rules, removeUnsupported, adjacentSpace, format, warnings) { + var list = []; + var repeated = []; + + function removeHTMLComment(rule, match) { + warnings.push('HTML comment \'' + match + '\' at ' + formatPosition(rule[2][0]) + '. Removing.'); + return ''; + } - var color1 = property1.value[0][0]; - var color2 = property2.value[0][0]; + for (var i = 0, l = rules.length; i < l; i++) { + var rule = rules[i]; + var reduced = rule[1]; - if (!validator.colorOpacity && (validator.isValidRgbaColor(color1) || validator.isValidHslaColor(color1))) - return false; - if (!validator.colorOpacity && (validator.isValidRgbaColor(color2) || validator.isValidHslaColor(color2))) - return false; + reduced = reduced.replace(HTML_COMMENT_PATTERN, removeHTMLComment.bind(null, rule)); - // (hex | named) - if (validator.isValidNamedColor(color2) || validator.isValidHexColor(color2)) - return true; - if (validator.isValidNamedColor(color1) || validator.isValidHexColor(color1)) - return false; + if (hasInvalidCharacters(reduced)) { + warnings.push('Invalid selector \'' + rule[1] + '\' at ' + formatPosition(rule[2][0]) + '. Ignoring.'); + continue; + } - // (rgba|hsla) - if (validator.isValidRgbaColor(color2) || validator.isValidHslaColor(color2)) - return true; - if (validator.isValidRgbaColor(color1) || validator.isValidHslaColor(color1)) - return false; + reduced = removeWhitespace(reduced, format); + reduced = removeQuotes(reduced); - // Functions with the same name can override each other; same values can override each other - return sameFunctionOrValue(property1, property2, validator); -} + if (adjacentSpace && reduced.indexOf('nav') > 0) { + reduced = reduced.replace(/\+nav(\S|$)/, '+ nav$1'); + } -function twoOptionalFunctions(property1, property2, validator) { - var value1 = property1.value[0][0]; - var value2 = property2.value[0][0]; + if (removeUnsupported && reduced.indexOf(ASTERISK_PLUS_HTML_HACK) > -1) { + continue; + } - return !(validator.isValidFunction(value1) ^ validator.isValidFunction(value2)); -} + if (removeUnsupported && reduced.indexOf(ASTERISK_FIRST_CHILD_PLUS_HTML_HACK) > -1) { + continue; + } -function sameValue(property1, property2) { - var value1 = property1.value[0][0]; - var value2 = property2.value[0][0]; + if (reduced.indexOf('*') > -1) { + reduced = reduced + .replace(/\*([:#\.\[])/g, '$1') + .replace(/^(\:first\-child)?\+html/, '*$1+html'); + } - return value1 === value2; -} + if (repeated.indexOf(reduced) > -1) { + continue; + } -function sameFunctionOrValue(property1, property2, validator) { - var value1 = property1.value[0][0]; - var value2 = property2.value[0][0]; + rule[1] = reduced; + repeated.push(reduced); + list.push(rule); + } - // Functions with the same name can override each other - if (validator.areSameFunction(value1, value2)) - return true; + if (list.length == 1 && list[0][1].length === 0) { + warnings.push('Empty selector \'' + list[0][1] + '\' at ' + formatPosition(list[0][2][0]) + '. Ignoring.'); + list = []; + } - return value1 === value2; + return list; } -// Use for properties containing CSS units (margin-top, padding-left, etc.) -function unit(property1, property2, validator) { - // The idea here is that 'more understandable' values override 'less understandable' values, but not vice versa - // Understandability: (unit without functions) > (same functions | standard functions) > anything else - // NOTE: there is no point in having different vendor-specific functions override each other or standard functions, - // or having standard functions override vendor-specific functions, but standard functions can override each other - // NOTE: vendor-specific property values are not taken into consideration here at the moment - var value1 = property1.value[0][0]; - var value2 = property2.value[0][0]; +module.exports = tidyRules; - if (validator.isValidAndCompatibleUnitWithoutFunction(value1) && !validator.isValidAndCompatibleUnitWithoutFunction(value2)) - return false; +},{"../../options/format":59,"../../tokenizer/marker":81,"../../utils/format-position":85}],19:[function(require,module,exports){ +var InvalidPropertyError = require('./invalid-property-error'); - if (validator.isValidUnitWithoutFunction(value2)) - return true; - if (validator.isValidUnitWithoutFunction(value1)) - return false; +var wrapSingle = require('../wrap-for-optimizing').single; - // Standard non-vendor-prefixed functions can override each other - if (validator.isValidFunctionWithoutVendorPrefix(value2) && validator.isValidFunctionWithoutVendorPrefix(value1)) { - return true; - } - - // Functions with the same name can override each other; same values can override each other - return sameFunctionOrValue(property1, property2, validator); -} +var Token = require('../../tokenizer/token'); -module.exports = { - always: always, - alwaysButIntoFunction: alwaysButIntoFunction, - backgroundImage: backgroundImage, - border: border, - color: color, - sameValue: sameValue, - sameFunctionOrValue: sameFunctionOrValue, - twoOptionalFunctions: twoOptionalFunctions, - unit: unit -}; +var formatPosition = require('../../utils/format-position'); -},{}],16:[function(require,module,exports){ -var wrapSingle = require('./wrap-for-optimizing').single; +var MULTIPLEX_SEPARATOR = ','; -function deep(property) { - var cloned = shallow(property); - for (var i = property.components.length - 1; i >= 0; i--) { - var component = shallow(property.components[i]); - component.value = property.components[i].value.slice(0); - cloned.components.unshift(component); - } +function _colorFilter(validator) { + return function (value) { + return value[1] == 'invert' || validator.isValidColor(value[1]) || validator.isValidVendorPrefixedValue(value[1]); + }; +} - cloned.dirty = true; - cloned.value = property.value.slice(0); +function _styleFilter(validator) { + return function (value) { + return value[1] != 'inherit' && validator.isValidStyle(value[1]) && !validator.isValidColorValue(value[1]); + }; +} - return cloned; +function _wrapDefault(name, property, compactable) { + var descriptor = compactable[name]; + if (descriptor.doubleValues && descriptor.defaultValue.length == 2) { + return wrapSingle([ + Token.PROPERTY, + [Token.PROPERTY_NAME, name], + [Token.PROPERTY_VALUE, descriptor.defaultValue[0]], + [Token.PROPERTY_VALUE, descriptor.defaultValue[1]] + ]); + } else if (descriptor.doubleValues && descriptor.defaultValue.length == 1) { + return wrapSingle([ + Token.PROPERTY, + [Token.PROPERTY_NAME, name], + [Token.PROPERTY_VALUE, descriptor.defaultValue[0]] + ]); + } else { + return wrapSingle([ + Token.PROPERTY, + [Token.PROPERTY_NAME, name], + [Token.PROPERTY_VALUE, descriptor.defaultValue] + ]); + } } -function shallow(property) { - var cloned = wrapSingle([[property.name, property.important, property.hack]]); - cloned.unused = false; - return cloned; +function _widthFilter(validator) { + return function (value) { + return value[1] != 'inherit' && validator.isValidWidth(value[1]) && !validator.isValidStyle(value[1]) && !validator.isValidColorValue(value[1]); + }; } -module.exports = { - deep: deep, - shallow: shallow -}; +function background(property, compactable, validator) { + var image = _wrapDefault('background-image', property, compactable); + var position = _wrapDefault('background-position', property, compactable); + var size = _wrapDefault('background-size', property, compactable); + var repeat = _wrapDefault('background-repeat', property, compactable); + var attachment = _wrapDefault('background-attachment', property, compactable); + var origin = _wrapDefault('background-origin', property, compactable); + var clip = _wrapDefault('background-clip', property, compactable); + var color = _wrapDefault('background-color', property, compactable); + var components = [image, position, size, repeat, attachment, origin, clip, color]; + var values = property.value; -},{"./wrap-for-optimizing":30}],17:[function(require,module,exports){ -// Contains the interpretation of CSS properties, as used by the property optimizer + var positionSet = false; + var clipSet = false; + var originSet = false; + var repeatSet = false; -var breakUp = require('./break-up'); -var canOverride = require('./can-override'); -var restore = require('./restore'); + var anyValueSet = false; -// Properties to process -// Extend this object in order to add support for more properties in the optimizer. -// -// Each key in this object represents a CSS property and should be an object. -// Such an object contains properties that describe how the represented CSS property should be handled. -// Possible options: -// -// * components: array (Only specify for shorthand properties.) -// Contains the names of the granular properties this shorthand compacts. -// -// * canOverride: function (Default is canOverride.sameValue - meaning that they'll only be merged if they have the same value.) -// Returns whether two tokens of this property can be merged with each other. -// This property has no meaning for shorthands. -// -// * defaultValue: string -// Specifies the default value of the property according to the CSS standard. -// For shorthand, this is used when every component is set to its default value, therefore it should be the shortest possible default value of all the components. -// -// * shortestValue: string -// Specifies the shortest possible value the property can possibly have. -// (Falls back to defaultValue if unspecified.) -// -// * breakUp: function (Only specify for shorthand properties.) -// Breaks the shorthand up to its components. -// -// * restore: function (Only specify for shorthand properties.) -// Puts the shorthand together from its components. -// -var compactable = { - 'color': { - canOverride: canOverride.color, - defaultValue: 'transparent', - shortestValue: 'red' - }, - 'background': { - components: [ - 'background-image', - 'background-position', - 'background-size', - 'background-repeat', - 'background-attachment', - 'background-origin', - 'background-clip', - 'background-color' - ], - breakUp: breakUp.multiplex(breakUp.background), - defaultValue: '0 0', - restore: restore.multiplex(restore.background), - shortestValue: '0', - shorthand: true - }, - 'background-clip': { - canOverride: canOverride.always, - defaultValue: 'border-box', - shortestValue: 'border-box' - }, - 'background-color': { - canOverride: canOverride.color, - defaultValue: 'transparent', - multiplexLastOnly: true, - nonMergeableValue: 'none', - shortestValue: 'red' - }, - 'background-image': { - canOverride: canOverride.backgroundImage, - defaultValue: 'none' - }, - 'background-origin': { - canOverride: canOverride.always, - defaultValue: 'padding-box', - shortestValue: 'border-box' - }, - 'background-repeat': { - canOverride: canOverride.always, - defaultValue: ['repeat'], - doubleValues: true - }, - 'background-position': { - canOverride: canOverride.alwaysButIntoFunction, - defaultValue: ['0', '0'], - doubleValues: true, - shortestValue: '0' - }, - 'background-size': { - canOverride: canOverride.alwaysButIntoFunction, - defaultValue: ['auto'], - doubleValues: true, - shortestValue: '0 0' - }, - 'background-attachment': { - canOverride: canOverride.always, - defaultValue: 'scroll' - }, - 'border': { - breakUp: breakUp.border, - canOverride: canOverride.border, - components: [ - 'border-width', - 'border-style', - 'border-color' - ], - defaultValue: 'none', - restore: restore.withoutDefaults, - shorthand: true - }, - 'border-color': { - canOverride: canOverride.color, - defaultValue: 'none', - shorthand: true - }, - 'border-style': { - canOverride: canOverride.always, - defaultValue: 'none', - shorthand: true - }, - 'border-width': { - canOverride: canOverride.unit, - defaultValue: 'medium', - shortestValue: '0', - shorthand: true - }, - 'list-style': { - components: [ - 'list-style-type', - 'list-style-position', - 'list-style-image' - ], - canOverride: canOverride.always, - breakUp: breakUp.listStyle, - restore: restore.withoutDefaults, - defaultValue: 'outside', // can't use 'disc' because that'd override default 'decimal' for
    - shortestValue: 'none', - shorthand: true - }, - 'list-style-type' : { - canOverride: canOverride.always, - defaultValue: '__hack', - // NOTE: we can't tell the real default value here, it's 'disc' for
      and 'decimal' for
        - // -- this is a hack, but it doesn't matter because this value will be either overridden or it will disappear at the final step anyway - shortestValue: 'none' - }, - 'list-style-position' : { - canOverride: canOverride.always, - defaultValue: 'outside', - shortestValue: 'inside' - }, - 'list-style-image' : { - canOverride: canOverride.always, - defaultValue: 'none' - }, - 'outline': { - components: [ - 'outline-color', - 'outline-style', - 'outline-width' - ], - breakUp: breakUp.outline, - restore: restore.withoutDefaults, - defaultValue: '0', - shorthand: true - }, - 'outline-color': { - canOverride: canOverride.color, - defaultValue: 'invert', - shortestValue: 'red' - }, - 'outline-style': { - canOverride: canOverride.always, - defaultValue: 'none' - }, - 'outline-width': { - canOverride: canOverride.unit, - defaultValue: 'medium', - shortestValue: '0' - }, - '-moz-transform': { - canOverride: canOverride.sameFunctionOrValue - }, - '-ms-transform': { - canOverride: canOverride.sameFunctionOrValue - }, - '-webkit-transform': { - canOverride: canOverride.sameFunctionOrValue - }, - 'transform': { - canOverride: canOverride.sameFunctionOrValue + if (property.value.length == 1 && property.value[0][1] == 'inherit') { + // NOTE: 'inherit' is not a valid value for background-attachment + color.value = image.value = repeat.value = position.value = size.value = origin.value = clip.value = property.value; + return components; } -}; -var addFourValueShorthand = function (prop, components, options) { - options = options || {}; - compactable[prop] = { - canOverride: options.canOverride, - components: components, - breakUp: options.breakUp || breakUp.fourValues, - defaultValue: options.defaultValue || '0', - restore: options.restore || restore.fourValues, - shortestValue: options.shortestValue, - shorthand: true - }; - for (var i = 0; i < components.length; i++) { - compactable[components[i]] = { - breakUp: options.breakUp || breakUp.fourValues, - canOverride: options.canOverride || canOverride.unit, - defaultValue: options.defaultValue || '0', - shortestValue: options.shortestValue - }; + if (property.value.length == 1 && property.value[0][1] == '0 0') { + return components; } -}; - -['', '-moz-', '-o-', '-webkit-'].forEach(function (prefix) { - addFourValueShorthand(prefix + 'border-radius', [ - prefix + 'border-top-left-radius', - prefix + 'border-top-right-radius', - prefix + 'border-bottom-right-radius', - prefix + 'border-bottom-left-radius' - ], { - breakUp: breakUp.borderRadius, - restore: restore.borderRadius - }); -}); -addFourValueShorthand('border-color', [ - 'border-top-color', - 'border-right-color', - 'border-bottom-color', - 'border-left-color' -], { - breakUp: breakUp.fourValues, - canOverride: canOverride.color, - defaultValue: 'none', - shortestValue: 'red' -}); + for (var i = values.length - 1; i >= 0; i--) { + var value = values[i]; -addFourValueShorthand('border-style', [ - 'border-top-style', - 'border-right-style', - 'border-bottom-style', - 'border-left-style' -], { - breakUp: breakUp.fourValues, - canOverride: canOverride.always, - defaultValue: 'none' -}); + if (validator.isValidBackgroundAttachment(value[1])) { + attachment.value = [value]; + anyValueSet = true; + } else if (validator.isValidBackgroundClip(value[1]) || validator.isValidBackgroundOrigin(value[1])) { + if (clipSet) { + origin.value = [value]; + originSet = true; + } else { + clip.value = [value]; + clipSet = true; + } + anyValueSet = true; + } else if (validator.isValidBackgroundRepeat(value[1])) { + if (repeatSet) { + repeat.value.unshift(value); + } else { + repeat.value = [value]; + repeatSet = true; + } + anyValueSet = true; + } else if (validator.isValidBackgroundPositionPart(value[1]) || validator.isValidBackgroundSizePart(value[1])) { + if (i > 0) { + var previousValue = values[i - 1]; -addFourValueShorthand('border-width', [ - 'border-top-width', - 'border-right-width', - 'border-bottom-width', - 'border-left-width' -], { - defaultValue: 'medium', - shortestValue: '0' -}); + if (previousValue[1] == '/') { + size.value = [value]; + } else if (i > 1 && values[i - 2][1] == '/') { + size.value = [previousValue, value]; + i -= 2; + } else { + if (!positionSet) + position.value = []; -addFourValueShorthand('padding', [ - 'padding-top', - 'padding-right', - 'padding-bottom', - 'padding-left' -]); - -addFourValueShorthand('margin', [ - 'margin-top', - 'margin-right', - 'margin-bottom', - 'margin-left' -]); + position.value.unshift(value); + positionSet = true; + } + } else { + if (!positionSet) + position.value = []; -// Adds `componentOf` field to all longhands -for (var property in compactable) { - if (compactable[property].shorthand) { - for (var i = 0, l = compactable[property].components.length; i < l; i++) { - compactable[compactable[property].components[i]].componentOf = property; + position.value.unshift(value); + positionSet = true; + } + anyValueSet = true; + } else if ((color.value[0][1] == compactable[color.name].defaultValue || color.value[0][1] == 'none') && (validator.isValidColor(value[1]) || validator.isValidVendorPrefixedValue(value[1]))) { + color.value = [value]; + anyValueSet = true; + } else if (validator.isValidUrl(value[1]) || validator.isValidFunction(value[1])) { + image.value = [value]; + anyValueSet = true; } } -} - -module.exports = compactable; -},{"./break-up":14,"./can-override":15,"./restore":26}],18:[function(require,module,exports){ -var shallowClone = require('./clone').shallow; - -var MULTIPLEX_SEPARATOR = ','; + if (clipSet && !originSet) + origin.value = clip.value.slice(0); -function everyCombination(fn, left, right, validator) { - var samePositon = !left.shorthand && !right.shorthand && !left.multiplex && !right.multiplex; - var _left = shallowClone(left); - var _right = shallowClone(right); + if (!anyValueSet) { + throw new InvalidPropertyError('Invalid background value at ' + formatPosition(values[0][2][0]) + '. Ignoring.'); + } - for (var i = 0, l = left.value.length; i < l; i++) { - for (var j = 0, m = right.value.length; j < m; j++) { - if (left.value[i][0] == MULTIPLEX_SEPARATOR || right.value[j][0] == MULTIPLEX_SEPARATOR) - continue; + return components; +} - if (samePositon && i != j) - continue; +function borderRadius(property, compactable) { + var values = property.value; + var splitAt = -1; - _left.value = [left.value[i]]; - _right.value = [right.value[j]]; - if (!fn(_left, _right, validator)) - return false; + for (var i = 0, l = values.length; i < l; i++) { + if (values[i][1] == '/') { + splitAt = i; + break; } } - return true; -} + if (splitAt === 0 || splitAt === values.length - 1) { + throw new InvalidPropertyError('Invalid border-radius value at ' + formatPosition(values[0][2][0]) + '. Ignoring.'); + } -module.exports = everyCombination; + var target = _wrapDefault(property.name, property, compactable); + target.value = splitAt > -1 ? + values.slice(0, splitAt) : + values.slice(0); + target.components = fourValues(target, compactable); -},{"./clone":16}],19:[function(require,module,exports){ -function hasInherit(property) { - for (var i = property.value.length - 1; i >= 0; i--) { - if (property.value[i][0] == 'inherit') - return true; + var remainder = _wrapDefault(property.name, property, compactable); + remainder.value = splitAt > -1 ? + values.slice(splitAt + 1) : + values.slice(0); + remainder.components = fourValues(remainder, compactable); + + for (var j = 0; j < 4; j++) { + target.components[j].multiplex = true; + target.components[j].value = target.components[j].value.concat(remainder.components[j].value); } - return false; + return target.components; } -module.exports = hasInherit; - -},{}],20:[function(require,module,exports){ -function InvalidPropertyError(message) { - this.name = 'InvalidPropertyError'; - this.message = message; - this.stack = (new Error()).stack; -} +function fourValues(property, compactable) { + var componentNames = compactable[property.name].components; + var components = []; + var value = property.value; -InvalidPropertyError.prototype = Object.create(Error.prototype); -InvalidPropertyError.prototype.constructor = InvalidPropertyError; + if (value.length < 1) + return []; -module.exports = InvalidPropertyError; + if (value.length < 2) + value[1] = value[0].slice(0); + if (value.length < 3) + value[2] = value[0].slice(0); + if (value.length < 4) + value[3] = value[1].slice(0); -},{}],21:[function(require,module,exports){ -var compactable = require('./compactable'); -var wrapForOptimizing = require('./wrap-for-optimizing').all; -var populateComponents = require('./populate-components'); -var compactOverrides = require('./override-compactor'); -var compactShorthands = require('./shorthand-compactor'); -var removeUnused = require('./remove-unused'); -var restoreFromOptimizing = require('./restore-from-optimizing'); -var stringifyProperty = require('../stringifier/one-time').property; - -var shorthands = { - 'animation-delay': ['animation'], - 'animation-direction': ['animation'], - 'animation-duration': ['animation'], - 'animation-fill-mode': ['animation'], - 'animation-iteration-count': ['animation'], - 'animation-name': ['animation'], - 'animation-play-state': ['animation'], - 'animation-timing-function': ['animation'], - '-moz-animation-delay': ['-moz-animation'], - '-moz-animation-direction': ['-moz-animation'], - '-moz-animation-duration': ['-moz-animation'], - '-moz-animation-fill-mode': ['-moz-animation'], - '-moz-animation-iteration-count': ['-moz-animation'], - '-moz-animation-name': ['-moz-animation'], - '-moz-animation-play-state': ['-moz-animation'], - '-moz-animation-timing-function': ['-moz-animation'], - '-o-animation-delay': ['-o-animation'], - '-o-animation-direction': ['-o-animation'], - '-o-animation-duration': ['-o-animation'], - '-o-animation-fill-mode': ['-o-animation'], - '-o-animation-iteration-count': ['-o-animation'], - '-o-animation-name': ['-o-animation'], - '-o-animation-play-state': ['-o-animation'], - '-o-animation-timing-function': ['-o-animation'], - '-webkit-animation-delay': ['-webkit-animation'], - '-webkit-animation-direction': ['-webkit-animation'], - '-webkit-animation-duration': ['-webkit-animation'], - '-webkit-animation-fill-mode': ['-webkit-animation'], - '-webkit-animation-iteration-count': ['-webkit-animation'], - '-webkit-animation-name': ['-webkit-animation'], - '-webkit-animation-play-state': ['-webkit-animation'], - '-webkit-animation-timing-function': ['-webkit-animation'], - 'border-color': ['border'], - 'border-style': ['border'], - 'border-width': ['border'], - 'border-bottom': ['border'], - 'border-bottom-color': ['border-bottom', 'border-color', 'border'], - 'border-bottom-style': ['border-bottom', 'border-style', 'border'], - 'border-bottom-width': ['border-bottom', 'border-width', 'border'], - 'border-left': ['border'], - 'border-left-color': ['border-left', 'border-color', 'border'], - 'border-left-style': ['border-left', 'border-style', 'border'], - 'border-left-width': ['border-left', 'border-width', 'border'], - 'border-right': ['border'], - 'border-right-color': ['border-right', 'border-color', 'border'], - 'border-right-style': ['border-right', 'border-style', 'border'], - 'border-right-width': ['border-right', 'border-width', 'border'], - 'border-top': ['border'], - 'border-top-color': ['border-top', 'border-color', 'border'], - 'border-top-style': ['border-top', 'border-style', 'border'], - 'border-top-width': ['border-top', 'border-width', 'border'], - 'font-family': ['font'], - 'font-size': ['font'], - 'font-style': ['font'], - 'font-variant': ['font'], - 'font-weight': ['font'], - 'transition-delay': ['transition'], - 'transition-duration': ['transition'], - 'transition-property': ['transition'], - 'transition-timing-function': ['transition'], - '-moz-transition-delay': ['-moz-transition'], - '-moz-transition-duration': ['-moz-transition'], - '-moz-transition-property': ['-moz-transition'], - '-moz-transition-timing-function': ['-moz-transition'], - '-o-transition-delay': ['-o-transition'], - '-o-transition-duration': ['-o-transition'], - '-o-transition-property': ['-o-transition'], - '-o-transition-timing-function': ['-o-transition'], - '-webkit-transition-delay': ['-webkit-transition'], - '-webkit-transition-duration': ['-webkit-transition'], - '-webkit-transition-property': ['-webkit-transition'], - '-webkit-transition-timing-function': ['-webkit-transition'] -}; + for (var i = componentNames.length - 1; i >= 0; i--) { + var component = wrapSingle([ + Token.PROPERTY, + [Token.PROPERTY_NAME, componentNames[i]] + ]); + component.value = [value[i]]; + components.unshift(component); + } -function _optimize(properties, mergeAdjacent, aggressiveMerging, validator) { - var overrideMapping = {}; - var lastName = null; - var lastProperty; - var j; + return components; +} - function mergeablePosition(position) { - if (mergeAdjacent === false || mergeAdjacent === true) - return mergeAdjacent; +function multiplex(splitWith) { + return function (property, compactable, validator) { + var splitsAt = []; + var values = property.value; + var i, j, l, m; - return mergeAdjacent.indexOf(position) > -1; - } + // find split commas + for (i = 0, l = values.length; i < l; i++) { + if (values[i][1] == ',') + splitsAt.push(i); + } - function sameValue(position) { - var left = properties[position - 1]; - var right = properties[position]; + if (splitsAt.length === 0) + return splitWith(property, compactable, validator); - return stringifyProperty(left.all, left.position) == stringifyProperty(right.all, right.position); - } + var splitComponents = []; - propertyLoop: - for (var position = 0, total = properties.length; position < total; position++) { - var property = properties[position]; - var _name = (property.name == '-ms-filter' || property.name == 'filter') ? - (lastName == 'background' || lastName == 'background-image' ? lastName : property.name) : - property.name; - var isImportant = property.important; - var isHack = property.hack; + // split over commas, and into components + for (i = 0, l = splitsAt.length; i <= l; i++) { + var from = i === 0 ? 0 : splitsAt[i - 1] + 1; + var to = i < l ? splitsAt[i] : values.length; - if (property.unused) - continue; + var _property = _wrapDefault(property.name, property, compactable); + _property.value = values.slice(from, to); - if (position > 0 && lastProperty && _name == lastName && isImportant == lastProperty.important && isHack == lastProperty.hack && sameValue(position) && !lastProperty.unused) { - property.unused = true; - continue; + splitComponents.push(splitWith(_property, compactable, validator)); } - // comment is necessary - we assume that if two properties are one after another - // then it is intentional way of redefining property which may not be widely supported - // e.g. a{display:inline-block;display:-moz-inline-box} - // however if `mergeablePosition` yields true then the rule does not apply - // (e.g merging two adjacent selectors: `a{display:block}a{display:block}`) - if (_name in overrideMapping && (aggressiveMerging && _name != lastName || mergeablePosition(position))) { - var toOverridePositions = overrideMapping[_name]; - var canOverride = compactable[_name] && compactable[_name].canOverride; - var anyRemoved = false; - - for (j = toOverridePositions.length - 1; j >= 0; j--) { - var toRemove = properties[toOverridePositions[j]]; - var longhandToShorthand = toRemove.name != _name; - var wasImportant = toRemove.important; - var wasHack = toRemove.hack; + var components = splitComponents[0]; - if (toRemove.unused) - continue; + // group component values from each split + for (i = 0, l = components.length; i < l; i++) { + components[i].multiplex = true; - if (longhandToShorthand && wasImportant) - continue; + for (j = 1, m = splitComponents.length; j < m; j++) { + components[i].value.push([Token.PROPERTY_VALUE, MULTIPLEX_SEPARATOR]); + Array.prototype.push.apply(components[i].value, splitComponents[j][i].value); + } + } - if (!wasImportant && (wasHack && !isHack || !wasHack && isHack)) - continue; + return components; + }; +} - if (wasImportant && (isHack == 'star' || isHack == 'underscore')) - continue; +function listStyle(property, compactable, validator) { + var type = _wrapDefault('list-style-type', property, compactable); + var position = _wrapDefault('list-style-position', property, compactable); + var image = _wrapDefault('list-style-image', property, compactable); + var components = [type, position, image]; - if (!wasHack && !isHack && !longhandToShorthand && canOverride && !canOverride(toRemove, property, validator)) - continue; + if (property.value.length == 1 && property.value[0][1] == 'inherit') { + type.value = position.value = image.value = [property.value[0]]; + return components; + } - if (wasImportant && !isImportant || wasImportant && isHack) { - property.unused = true; - lastProperty = property; - continue propertyLoop; - } else { - anyRemoved = true; - toRemove.unused = true; - } - } + var values = property.value.slice(0); + var total = values.length; + var index = 0; - if (anyRemoved) { - position = -1; - lastProperty = null; - lastName = null; - overrideMapping = {}; - continue; - } - } else { - overrideMapping[_name] = overrideMapping[_name] || []; - overrideMapping[_name].push(position); - - // TODO: to be removed with - // certain shorthand (see values of `shorthands`) should trigger removal of - // longhand properties (see keys of `shorthands`) - var _shorthands = shorthands[_name]; - if (_shorthands) { - for (j = _shorthands.length - 1; j >= 0; j--) { - var shorthand = _shorthands[j]; - overrideMapping[shorthand] = overrideMapping[shorthand] || []; - overrideMapping[shorthand].push(position); - } - } + // `image` first... + for (index = 0, total = values.length; index < total; index++) { + if (validator.isValidUrl(values[index][1]) || values[index][1] == '0') { + image.value = [values[index]]; + values.splice(index, 1); + break; } + } - lastName = _name; - lastProperty = property; + // ... then `type`... + for (index = 0, total = values.length; index < total; index++) { + if (validator.isValidListStyleType(values[index][1])) { + type.value = [values[index]]; + values.splice(index, 1); + break; + } } + + // ... and what's left is a `position` + if (values.length > 0 && validator.isValidListStylePosition(values[0][1])) + position.value = [values[0]]; + + return components; } -function optimize(selector, properties, mergeAdjacent, withCompacting, options, context) { - var validator = context.validator; - var warnings = context.warnings; +function widthStyleColor(property, compactable, validator) { + var descriptor = compactable[property.name]; + var components = [ + _wrapDefault(descriptor.components[0], property, compactable), + _wrapDefault(descriptor.components[1], property, compactable), + _wrapDefault(descriptor.components[2], property, compactable) + ]; + var color, style, width; - var _properties = wrapForOptimizing(properties); - populateComponents(_properties, validator, warnings); - _optimize(_properties, mergeAdjacent, options.aggressiveMerging, validator); + for (var i = 0; i < 3; i++) { + var component = components[i]; - for (var i = 0, l = _properties.length; i < l; i++) { - var _property = _properties[i]; - if (_property.variable && _property.block) - optimize(selector, _property.value[0], mergeAdjacent, withCompacting, options, context); + if (component.name.indexOf('color') > 0) + color = component; + else if (component.name.indexOf('style') > 0) + style = component; + else + width = component; } - if (withCompacting && options.shorthandCompacting) { - compactOverrides(_properties, options.compatibility, validator); - compactShorthands(_properties, options.sourceMap, validator); + if ((property.value.length == 1 && property.value[0][1] == 'inherit') || + (property.value.length == 3 && property.value[0][1] == 'inherit' && property.value[1][1] == 'inherit' && property.value[2][1] == 'inherit')) { + color.value = style.value = width.value = [property.value[0]]; + return components; } - restoreFromOptimizing(_properties); - removeUnused(_properties); -} + var values = property.value.slice(0); + var match, matches; -module.exports = optimize; + // NOTE: usually users don't follow the required order of parts in this shorthand, + // so we'll try to parse it caring as little about order as possible -},{"../stringifier/one-time":47,"./compactable":17,"./override-compactor":22,"./populate-components":23,"./remove-unused":24,"./restore-from-optimizing":25,"./shorthand-compactor":27,"./wrap-for-optimizing":30}],22:[function(require,module,exports){ -var canOverride = require('./can-override'); -var compactable = require('./compactable'); -var deepClone = require('./clone').deep; -var shallowClone = require('./clone').shallow; -var hasInherit = require('./has-inherit'); -var restoreFromOptimizing = require('./restore-from-optimizing'); -var everyCombination = require('./every-combination'); -var sameVendorPrefixesIn = require('./vendor-prefixes').same; + if (values.length > 0) { + matches = values.filter(_widthFilter(validator)); + match = matches.length > 1 && (matches[0][1] == 'none' || matches[0][1] == 'auto') ? matches[1] : matches[0]; + if (match) { + width.value = [match]; + values.splice(values.indexOf(match), 1); + } + } -var stringifyProperty = require('../stringifier/one-time').property; + if (values.length > 0) { + match = values.filter(_styleFilter(validator))[0]; + if (match) { + style.value = [match]; + values.splice(values.indexOf(match), 1); + } + } -var MULTIPLEX_SEPARATOR = ','; + if (values.length > 0) { + match = values.filter(_colorFilter(validator))[0]; + if (match) { + color.value = [match]; + values.splice(values.indexOf(match), 1); + } + } -// Used when searching for a component that matches property -function nameMatchFilter(to) { - return function (property) { - return to.name === property.name; - }; + return components; } -function wouldBreakCompatibility(property, validator) { - for (var i = 0; i < property.components.length; i++) { - var component = property.components[i]; - var descriptor = compactable[component.name]; - var canOverride = descriptor && descriptor.canOverride || canOverride.sameValue; +module.exports = { + background: background, + border: widthStyleColor, + borderRadius: borderRadius, + fourValues: fourValues, + listStyle: listStyle, + multiplex: multiplex, + outline: widthStyleColor +}; - var _component = shallowClone(component); - _component.value = [[descriptor.defaultValue]]; +},{"../../tokenizer/token":82,"../../utils/format-position":85,"../wrap-for-optimizing":57,"./invalid-property-error":24}],20:[function(require,module,exports){ +var understandable = require('./properties/understandable'); - if (!canOverride(_component, component, validator)) - return true; +function backgroundPosition(validator, value1, value2) { + if (!understandable(validator, value1, value2, 0, true) && !validator.isValidKeywordValue('background-position', value2, true)) { + return false; + } else if (validator.isValidVariable(value1) && validator.isValidVariable(value2)) { + return true; + } else if (validator.isValidKeywordValue('background-position', value2, true)) { + return true; } - return false; -} - -function isComponentOf(shorthand, longhand) { - return compactable[shorthand.name].components.indexOf(longhand.name) > -1; + return unit(validator, value1, value2); } -function overrideIntoMultiplex(property, by) { - by.unused = true; +function backgroundSize(validator, value1, value2) { + if (!understandable(validator, value1, value2, 0, true) && !validator.isValidKeywordValue('background-size', value2, true)) { + return false; + } else if (validator.isValidVariable(value1) && validator.isValidVariable(value2)) { + return true; + } else if (validator.isValidKeywordValue('background-size', value2, true)) { + return true; + } - turnIntoMultiplex(by, multiplexSize(property)); - property.value = by.value; + return unit(validator, value1, value2); } -function overrideByMultiplex(property, by) { - by.unused = true; - property.multiplex = true; - property.value = by.value; -} - -function overrideSimple(property, by) { - by.unused = true; - property.value = by.value; -} - -function override(property, by) { - if (by.multiplex) - overrideByMultiplex(property, by); - else if (property.multiplex) - overrideIntoMultiplex(property, by); - else - overrideSimple(property, by); -} - -function overrideShorthand(property, by) { - by.unused = true; - - for (var i = 0, l = property.components.length; i < l; i++) { - override(property.components[i], by.components[i], property.multiplex); +function color(validator, value1, value2) { + if (!understandable(validator, value1, value2, 0, true) && !validator.isValidColor(value2)) { + return false; + } else if (validator.isValidVariable(value1) && validator.isValidVariable(value2)) { + return true; + } else if (!validator.colorOpacity && (validator.isValidRgbaColor(value1) || validator.isValidHslaColor(value1))) { + return false; + } else if (!validator.colorOpacity && (validator.isValidRgbaColor(value2) || validator.isValidHslaColor(value2))) { + return false; + } else if (validator.isValidColor(value1) && validator.isValidColor(value2)) { + return true; } -} - -function turnIntoMultiplex(property, size) { - property.multiplex = true; - for (var i = 0, l = property.components.length; i < l; i++) { - var component = property.components[i]; - if (component.multiplex) - continue; - - var value = component.value.slice(0); - - for (var j = 1; j < size; j++) { - component.value.push([MULTIPLEX_SEPARATOR]); - Array.prototype.push.apply(component.value, value); - } - } + return sameFunctionOrValue(validator, value1, value2); } -function multiplexSize(component) { - var size = 0; +function components(overrideCheckers) { + return function (validator, value1, value2, position) { + return overrideCheckers[position](validator, value1, value2); + }; +} - for (var i = 0, l = component.value.length; i < l; i++) { - if (component.value[i][0] == MULTIPLEX_SEPARATOR) - size++; +function image(validator, value1, value2) { + if (!understandable(validator, value1, value2, 0, true) && !validator.isValidImage(value2)) { + return false; + } else if (validator.isValidVariable(value1) && validator.isValidVariable(value2)) { + return true; + } else if (validator.isValidImage(value2)) { + return true; + } else if (validator.isValidImage(value1)) { + return false; } - return size + 1; -} - -function lengthOf(property) { - var fakeAsArray = [[property.name]].concat(property.value); - return stringifyProperty([fakeAsArray], 0).length; + return sameFunctionOrValue(validator, value1, value2); } -function moreSameShorthands(properties, startAt, name) { - // Since we run the main loop in `compactOverrides` backwards, at this point some - // properties may not be marked as unused. - // We should consider reverting the order if possible - var count = 0; - - for (var i = startAt; i >= 0; i--) { - if (properties[i].name == name && !properties[i].unused) - count++; - if (count > 1) - break; - } +function keyword(propertyName) { + return function(validator, value1, value2) { + if (!understandable(validator, value1, value2, 0, true) && !validator.isValidKeywordValue(propertyName, value2)) { + return false; + } else if (validator.isValidVariable(value1) && validator.isValidVariable(value2)) { + return true; + } - return count > 1; + return validator.isValidKeywordValue(propertyName, value2, false); + }; } -function overridingFunction(shorthand, validator) { - for (var i = 0, l = shorthand.components.length; i < l; i++) { - if (anyValue(validator.isValidFunction, shorthand.components[i])) +function keywordWithGlobal(propertyName) { + return function(validator, value1, value2) { + if (!understandable(validator, value1, value2, 0, true) && !validator.isValidKeywordValue(propertyName, value2, true)) { + return false; + } else if (validator.isValidVariable(value1) && validator.isValidVariable(value2)) { return true; - } + } - return false; + return validator.isValidKeywordValue(propertyName, value2, true); + }; } -function anyValue(fn, property) { - for (var i = 0, l = property.value.length; i < l; i++) { - if (property.value[i][0] == MULTIPLEX_SEPARATOR) - continue; +function sameFunctionOrValue(validator, value1, value2) { + return validator.areSameFunction(value1, value2) ? + true : + value1 === value2; +} - if (fn(property.value[i][0])) - return true; +function textShadow(validator, value1, value2) { + if (!understandable(validator, value1, value2, 0, true) && !validator.isValidTextShadow(value2)) { + return false; + } else if (validator.isValidVariable(value1) && validator.isValidVariable(value2)) { + return true; } - return false; + return validator.isValidTextShadow(value2); } -function wouldResultInLongerValue(left, right) { - if (!left.multiplex && !right.multiplex || left.multiplex && right.multiplex) +function unit(validator, value1, value2) { + if (!understandable(validator, value1, value2, 0, true) && !validator.isValidUnitWithoutFunction(value2)) { return false; - - var multiplex = left.multiplex ? left : right; - var simple = left.multiplex ? right : left; - var component; - - var multiplexClone = deepClone(multiplex); - restoreFromOptimizing([multiplexClone]); - - var simpleClone = deepClone(simple); - restoreFromOptimizing([simpleClone]); - - var lengthBefore = lengthOf(multiplexClone) + 1 + lengthOf(simpleClone); - - if (left.multiplex) { - component = multiplexClone.components.filter(nameMatchFilter(simpleClone))[0]; - overrideIntoMultiplex(component, simpleClone); - } else { - component = simpleClone.components.filter(nameMatchFilter(multiplexClone))[0]; - turnIntoMultiplex(simpleClone, multiplexSize(multiplexClone)); - overrideByMultiplex(component, multiplexClone); + } else if (validator.isValidVariable(value1) && validator.isValidVariable(value2)) { + return true; + } else if (validator.isValidUnitWithoutFunction(value1) && !validator.isValidUnitWithoutFunction(value2)) { + return false; + } else if (validator.isValidUnitWithoutFunction(value2)) { + return true; + } else if (validator.isValidUnitWithoutFunction(value1)) { + return false; + } else if (validator.isValidFunctionWithoutVendorPrefix(value1) && validator.isValidFunctionWithoutVendorPrefix(value2)) { + return true; } - restoreFromOptimizing([simpleClone]); - - var lengthAfter = lengthOf(simpleClone); - - return lengthBefore < lengthAfter; + return sameFunctionOrValue(validator, value1, value2); } -function isCompactable(property) { - return property.name in compactable; -} +function unitOrKeywordWithGlobal(propertyName) { + var byKeyword = keywordWithGlobal(propertyName); -function noneOverrideHack(left, right) { - return !left.multiplex && - (left.name == 'background' || left.name == 'background-image') && - right.multiplex && - (right.name == 'background' || right.name == 'background-image') && - anyLayerIsNone(right.value); + return function(validator, value1, value2) { + return unit(validator, value1, value2) || byKeyword(validator, value1, value2); + }; } -function anyLayerIsNone(values) { - var layers = intoLayers(values); - - for (var i = 0, l = layers.length; i < l; i++) { - if (layers[i].length == 1 && layers[i][0][0] == 'none') - return true; +function zIndex(validator, value1, value2) { + if (!understandable(validator, value1, value2, 0, true) && !validator.isValidZIndex(value2)) { + return false; + } else if (validator.isValidVariable(value1) && validator.isValidVariable(value2)) { + return true; } - return false; + return validator.isValidZIndex(value2); } -function intoLayers(values) { - var layers = []; - - for (var i = 0, layer = [], l = values.length; i < l; i++) { - var value = values[i]; - if (value[0] == MULTIPLEX_SEPARATOR) { - layers.push(layer); - layer = []; - } else { - layer.push(value); - } +module.exports = { + generic: { + color: color, + components: components, + image: image, + unit: unit + }, + property: { + backgroundAttachment: keyword('background-attachment'), + backgroundClip: keywordWithGlobal('background-clip'), + backgroundOrigin: keyword('background-origin'), + backgroundPosition: backgroundPosition, + backgroundRepeat: keyword('background-repeat'), + backgroundSize: backgroundSize, + bottom: unitOrKeywordWithGlobal('bottom'), + borderCollapse: keyword('border-collapse'), + borderStyle: keywordWithGlobal('*-style'), + clear: keywordWithGlobal('clear'), + cursor: keywordWithGlobal('cursor'), + display: keywordWithGlobal('display'), + float: keywordWithGlobal('float'), + fontStyle: keywordWithGlobal('font-style'), + left: unitOrKeywordWithGlobal('left'), + fontWeight: keywordWithGlobal('font-weight'), + listStyleType: keywordWithGlobal('list-style-type'), + listStylePosition: keywordWithGlobal('list-style-position'), + outlineStyle: keywordWithGlobal('*-style'), + overflow: keywordWithGlobal('overflow'), + position: keywordWithGlobal('position'), + right: unitOrKeywordWithGlobal('right'), + textAlign: keywordWithGlobal('text-align'), + textDecoration: keywordWithGlobal('text-decoration'), + textOverflow: keywordWithGlobal('text-overflow'), + textShadow: textShadow, + top: unitOrKeywordWithGlobal('top'), + transform: sameFunctionOrValue, + verticalAlign: unitOrKeywordWithGlobal('vertical-align'), + visibility: keywordWithGlobal('visibility'), + whiteSpace: keywordWithGlobal('white-space'), + zIndex: zIndex } +}; - layers.push(layer); - return layers; -} - -function compactOverrides(properties, compatibility, validator) { - var mayOverride, right, left, component; - var i, j, k; - - propertyLoop: - for (i = properties.length - 1; i >= 0; i--) { - right = properties[i]; - - if (!isCompactable(right)) - continue; - - if (right.variable) - continue; - - mayOverride = compactable[right.name].canOverride || canOverride.sameValue; - - for (j = i - 1; j >= 0; j--) { - left = properties[j]; - - if (!isCompactable(left)) - continue; - - if (left.variable) - continue; - - if (left.unused || right.unused) - continue; - - if (left.hack && !right.hack || !left.hack && right.hack) - continue; - - if (hasInherit(right)) - continue; - - if (noneOverrideHack(left, right)) - continue; - - if (!left.shorthand && right.shorthand && isComponentOf(right, left)) { - // maybe `left` can be overridden by `right` which is a shorthand? - if (!right.important && left.important) - continue; - - if (!sameVendorPrefixesIn([left], right.components)) - continue; - - if (!anyValue(validator.isValidFunction, left) && overridingFunction(right, validator)) - continue; - - component = right.components.filter(nameMatchFilter(left))[0]; - mayOverride = (compactable[left.name] && compactable[left.name].canOverride) || canOverride.sameValue; - if (everyCombination(mayOverride, left, component, validator)) { - left.unused = true; - } - } else if (left.shorthand && !right.shorthand && isComponentOf(left, right)) { - // maybe `right` can be pulled into `left` which is a shorthand? - if (right.important && !left.important) - continue; - - if (!right.important && left.important) { - right.unused = true; - continue; - } - - // Pending more clever algorithm in #527 - if (moreSameShorthands(properties, i - 1, left.name)) - continue; +},{"./properties/understandable":40}],21:[function(require,module,exports){ +var wrapSingle = require('../wrap-for-optimizing').single; - if (overridingFunction(left, validator)) - continue; +var Token = require('../../tokenizer/token'); - component = left.components.filter(nameMatchFilter(right))[0]; - if (everyCombination(mayOverride, component, right, validator)) { - var disabledBackgroundMerging = - !compatibility.properties.backgroundClipMerging && component.name.indexOf('background-clip') > -1 || - !compatibility.properties.backgroundOriginMerging && component.name.indexOf('background-origin') > -1 || - !compatibility.properties.backgroundSizeMerging && component.name.indexOf('background-size') > -1; - var nonMergeableValue = compactable[right.name].nonMergeableValue === right.value[0][0]; +function deep(property) { + var cloned = shallow(property); + for (var i = property.components.length - 1; i >= 0; i--) { + var component = shallow(property.components[i]); + component.value = property.components[i].value.slice(0); + cloned.components.unshift(component); + } - if (disabledBackgroundMerging || nonMergeableValue) - continue; + cloned.dirty = true; + cloned.value = property.value.slice(0); - if (!compatibility.properties.merging && wouldBreakCompatibility(left, validator)) - continue; + return cloned; +} - if (component.value[0][0] != right.value[0][0] && (hasInherit(left) || hasInherit(right))) - continue; +function shallow(property) { + var cloned = wrapSingle([ + Token.PROPERTY, + [Token.PROPERTY_NAME, property.name] + ]); + cloned.important = property.important; + cloned.hack = property.hack; + cloned.unused = false; + return cloned; +} - if (wouldResultInLongerValue(left, right)) - continue; +module.exports = { + deep: deep, + shallow: shallow +}; - if (!left.multiplex && right.multiplex) - turnIntoMultiplex(left, multiplexSize(right)); +},{"../../tokenizer/token":82,"../wrap-for-optimizing":57}],22:[function(require,module,exports){ +// Contains the interpretation of CSS properties, as used by the property optimizer - override(component, right); - left.dirty = true; - } - } else if (left.shorthand && right.shorthand && left.name == right.name) { - // merge if all components can be merged +var breakUp = require('./break-up'); +var canOverride = require('./can-override'); +var restore = require('./restore'); - if (!left.multiplex && right.multiplex) - continue; +var override = require('../../utils/override'); - if (!right.important && left.important) { - right.unused = true; - continue propertyLoop; - } - - if (right.important && !left.important) { - left.unused = true; - continue; - } - - for (k = left.components.length - 1; k >= 0; k--) { - var leftComponent = left.components[k]; - var rightComponent = right.components[k]; - - mayOverride = compactable[leftComponent.name].canOverride || canOverride.sameValue; - if (!everyCombination(mayOverride, leftComponent, rightComponent, validator)) - continue propertyLoop; - if (!everyCombination(canOverride.twoOptionalFunctions, leftComponent, rightComponent, validator) && validator.isValidFunction(rightComponent)) - continue propertyLoop; - } - - overrideShorthand(left, right); - left.dirty = true; - } else if (left.shorthand && right.shorthand && isComponentOf(left, right)) { - // border is a shorthand but any of its components is a shorthand too - - if (!left.important && right.important) - continue; - - component = left.components.filter(nameMatchFilter(right))[0]; - mayOverride = compactable[right.name].canOverride || canOverride.sameValue; - if (!everyCombination(mayOverride, component, right, validator)) - continue; - - if (left.important && !right.important) { - right.unused = true; - continue; - } - - var rightRestored = compactable[right.name].restore(right, compactable); - if (rightRestored.length > 1) - continue; - - component = left.components.filter(nameMatchFilter(right))[0]; - override(component, right); - right.dirty = true; - } else if (left.name == right.name) { - // two non-shorthands should be merged based on understandability - - if (left.important && !right.important) { - right.unused = true; - continue; - } - - mayOverride = compactable[right.name].canOverride || canOverride.sameValue; - if (!everyCombination(mayOverride, left, right, validator)) - continue; - - left.unused = true; - } - } - } -} - -module.exports = compactOverrides; - -},{"../stringifier/one-time":47,"./can-override":15,"./clone":16,"./compactable":17,"./every-combination":18,"./has-inherit":19,"./restore-from-optimizing":25,"./vendor-prefixes":29}],23:[function(require,module,exports){ -var compactable = require('./compactable'); -var InvalidPropertyError = require('./invalid-property-error'); - -function populateComponents(properties, validator, warnings) { - for (var i = properties.length - 1; i >= 0; i--) { - var property = properties[i]; - var descriptor = compactable[property.name]; - - if (descriptor && descriptor.shorthand) { - property.shorthand = true; - property.dirty = true; - - try { - property.components = descriptor.breakUp(property, compactable, validator); - } catch (e) { - if (e instanceof InvalidPropertyError) { - property.components = []; // this will set property.unused to true below - warnings.push(e.message); - } else { - throw e; - } - } - - if (property.components.length > 0) - property.multiplex = property.components[0].multiplex; - else - property.unused = true; - } - } -} - -module.exports = populateComponents; - -},{"./compactable":17,"./invalid-property-error":20}],24:[function(require,module,exports){ -function removeUnused(properties) { - for (var i = properties.length - 1; i >= 0; i--) { - var property = properties[i]; - - if (property.unused) - property.all.splice(property.position, 1); - } -} - -module.exports = removeUnused; - -},{}],25:[function(require,module,exports){ -var compactable = require('./compactable'); - -var BACKSLASH_HACK = '\\9'; -var IMPORTANT_TOKEN = '!important'; -var STAR_HACK = '*'; -var UNDERSCORE_HACK = '_'; -var BANG_HACK = '!ie'; - -function restoreImportant(property) { - property.value[property.value.length - 1][0] += IMPORTANT_TOKEN; -} - -function restoreHack(property) { - if (property.hack == 'underscore') - property.name = UNDERSCORE_HACK + property.name; - else if (property.hack == 'star') - property.name = STAR_HACK + property.name; - else if (property.hack == 'backslash') - property.value[property.value.length - 1][0] += BACKSLASH_HACK; - else if (property.hack == 'bang') - property.value[property.value.length - 1][0] += ' ' + BANG_HACK; -} - -function restoreFromOptimizing(properties, simpleMode) { - for (var i = properties.length - 1; i >= 0; i--) { - var property = properties[i]; - var descriptor = compactable[property.name]; - var restored; - - if (property.unused) - continue; - - if (!property.dirty && !property.important && !property.hack) - continue; - - if (!simpleMode && descriptor && descriptor.shorthand) { - restored = descriptor.restore(property, compactable); - property.value = restored; - } else { - restored = property.value; - } - - if (property.important) - restoreImportant(property); - - if (property.hack) - restoreHack(property); - - if (!('all' in property)) - continue; - - var current = property.all[property.position]; - current[0][0] = property.name; - - current.splice(1, current.length - 1); - Array.prototype.push.apply(current, restored); - } -} - -module.exports = restoreFromOptimizing; - -},{"./compactable":17}],26:[function(require,module,exports){ -var shallowClone = require('./clone').shallow; -var MULTIPLEX_SEPARATOR = ','; -var SIZE_POSITION_SEPARATOR = '/'; - -function isInheritOnly(values) { - for (var i = 0, l = values.length; i < l; i++) { - var value = values[i][0]; - - if (value != 'inherit' && value != MULTIPLEX_SEPARATOR && value != SIZE_POSITION_SEPARATOR) - return false; - } - - return true; -} - -function background(property, compactable, lastInMultiplex) { - var components = property.components; - var restored = []; - var needsOne, needsBoth; - - function restoreValue(component) { - Array.prototype.unshift.apply(restored, component.value); - } - - function isDefaultValue(component) { - var descriptor = compactable[component.name]; - if (descriptor.doubleValues) { - if (descriptor.defaultValue.length == 1) - return component.value[0][0] == descriptor.defaultValue[0] && (component.value[1] ? component.value[1][0] == descriptor.defaultValue[0] : true); - else - return component.value[0][0] == descriptor.defaultValue[0] && (component.value[1] ? component.value[1][0] : component.value[0][0]) == descriptor.defaultValue[1]; - } else { - return component.value[0][0] == descriptor.defaultValue; - } - } - - for (var i = components.length - 1; i >= 0; i--) { - var component = components[i]; - var isDefault = isDefaultValue(component); - - if (component.name == 'background-clip') { - var originComponent = components[i - 1]; - var isOriginDefault = isDefaultValue(originComponent); - - needsOne = component.value[0][0] == originComponent.value[0][0]; - - needsBoth = !needsOne && ( - (isOriginDefault && !isDefault) || - (!isOriginDefault && !isDefault) || - (!isOriginDefault && isDefault && component.value[0][0] != originComponent.value[0][0])); - - if (needsOne) { - restoreValue(originComponent); - } else if (needsBoth) { - restoreValue(component); - restoreValue(originComponent); - } - - i--; - } else if (component.name == 'background-size') { - var positionComponent = components[i - 1]; - var isPositionDefault = isDefaultValue(positionComponent); - - needsOne = !isPositionDefault && isDefault; - - needsBoth = !needsOne && - (isPositionDefault && !isDefault || !isPositionDefault && !isDefault); - - if (needsOne) { - restoreValue(positionComponent); - } else if (needsBoth) { - restoreValue(component); - restored.unshift([SIZE_POSITION_SEPARATOR]); - restoreValue(positionComponent); - } else if (positionComponent.value.length == 1) { - restoreValue(positionComponent); - } - - i--; - } else { - if (isDefault || compactable[component.name].multiplexLastOnly && !lastInMultiplex) - continue; - - restoreValue(component); - } - } - - if (restored.length === 0 && property.value.length == 1 && property.value[0][0] == '0') - restored.push(property.value[0]); - - if (restored.length === 0) - restored.push([compactable[property.name].defaultValue]); - - if (isInheritOnly(restored)) - return [restored[0]]; - - return restored; -} - -function borderRadius(property, compactable) { - if (property.multiplex) { - var horizontal = shallowClone(property); - var vertical = shallowClone(property); - - for (var i = 0; i < 4; i++) { - var component = property.components[i]; - - var horizontalComponent = shallowClone(property); - horizontalComponent.value = [component.value[0]]; - horizontal.components.push(horizontalComponent); - - var verticalComponent = shallowClone(property); - // FIXME: only shorthand compactor (see breakup#borderRadius) knows that border radius - // longhands have two values, whereas tokenizer does not care about populating 2nd value - // if it's missing, hence this fallback - verticalComponent.value = [component.value[1] || component.value[0]]; - vertical.components.push(verticalComponent); - } - - var horizontalValues = fourValues(horizontal, compactable); - var verticalValues = fourValues(vertical, compactable); - - if (horizontalValues.length == verticalValues.length && - horizontalValues[0][0] == verticalValues[0][0] && - (horizontalValues.length > 1 ? horizontalValues[1][0] == verticalValues[1][0] : true) && - (horizontalValues.length > 2 ? horizontalValues[2][0] == verticalValues[2][0] : true) && - (horizontalValues.length > 3 ? horizontalValues[3][0] == verticalValues[3][0] : true)) { - return horizontalValues; - } else { - return horizontalValues.concat([['/']]).concat(verticalValues); - } - } else { - return fourValues(property, compactable); - } -} - -function fourValues(property) { - var components = property.components; - var value1 = components[0].value[0]; - var value2 = components[1].value[0]; - var value3 = components[2].value[0]; - var value4 = components[3].value[0]; - - if (value1[0] == value2[0] && value1[0] == value3[0] && value1[0] == value4[0]) { - return [value1]; - } else if (value1[0] == value3[0] && value2[0] == value4[0]) { - return [value1, value2]; - } else if (value2[0] == value4[0]) { - return [value1, value2, value3]; - } else { - return [value1, value2, value3, value4]; - } -} - -function multiplex(restoreWith) { - return function (property, compactable) { - if (!property.multiplex) - return restoreWith(property, compactable, true); - - var multiplexSize = 0; - var restored = []; - var componentMultiplexSoFar = {}; - var i, l; - - // At this point we don't know what's the multiplex size, e.g. how many background layers are there - for (i = 0, l = property.components[0].value.length; i < l; i++) { - if (property.components[0].value[i][0] == MULTIPLEX_SEPARATOR) - multiplexSize++; - } - - for (i = 0; i <= multiplexSize; i++) { - var _property = shallowClone(property); - - // We split multiplex into parts and restore them one by one - for (var j = 0, m = property.components.length; j < m; j++) { - var componentToClone = property.components[j]; - var _component = shallowClone(componentToClone); - _property.components.push(_component); - - // The trick is some properties has more than one value, so we iterate over values looking for - // a multiplex separator - a comma - for (var k = componentMultiplexSoFar[_component.name] || 0, n = componentToClone.value.length; k < n; k++) { - if (componentToClone.value[k][0] == MULTIPLEX_SEPARATOR) { - componentMultiplexSoFar[_component.name] = k + 1; - break; - } - - _component.value.push(componentToClone.value[k]); - } - } - - // No we can restore shorthand value - var lastInMultiplex = i == multiplexSize; - var _restored = restoreWith(_property, compactable, lastInMultiplex); - Array.prototype.push.apply(restored, _restored); - - if (i < multiplexSize) - restored.push([',']); - } - - return restored; - }; -} - -function withoutDefaults(property, compactable) { - var components = property.components; - var restored = []; - - for (var i = components.length - 1; i >= 0; i--) { - var component = components[i]; - var descriptor = compactable[component.name]; - - if (component.value[0][0] != descriptor.defaultValue) - restored.unshift(component.value[0]); - } - - if (restored.length === 0) - restored.push([compactable[property.name].defaultValue]); - - if (isInheritOnly(restored)) - return [restored[0]]; - - return restored; -} - -module.exports = { - background: background, - borderRadius: borderRadius, - fourValues: fourValues, - multiplex: multiplex, - withoutDefaults: withoutDefaults -}; - -},{"./clone":16}],27:[function(require,module,exports){ -var compactable = require('./compactable'); -var deepClone = require('./clone').deep; -var hasInherit = require('./has-inherit'); -var populateComponents = require('./populate-components'); -var wrapSingle = require('./wrap-for-optimizing').single; -var everyCombination = require('./every-combination'); - -function mixedImportance(components) { - var important; - - for (var name in components) { - if (undefined !== important && components[name].important != important) - return true; - - important = components[name].important; - } - - return false; -} - -function componentSourceMaps(components) { - var sourceMapping = []; - - for (var name in components) { - var component = components[name]; - var originalValue = component.all[component.position]; - var mapping = originalValue[0][originalValue[0].length - 1]; - - if (Array.isArray(mapping)) - Array.prototype.push.apply(sourceMapping, mapping); - } - - return sourceMapping; -} - -function replaceWithShorthand(properties, candidateComponents, name, sourceMaps, validator) { - var descriptor = compactable[name]; - var newValuePlaceholder = [[name], [descriptor.defaultValue]]; - var all; - - var newProperty = wrapSingle(newValuePlaceholder); - newProperty.shorthand = true; - newProperty.dirty = true; - - populateComponents([newProperty], validator, []); - - for (var i = 0, l = descriptor.components.length; i < l; i++) { - var component = candidateComponents[descriptor.components[i]]; - var canOverride = compactable[component.name].canOverride; - - if (hasInherit(component)) - return; - - if (!everyCombination(canOverride, newProperty.components[i], component, validator)) - return; - - newProperty.components[i] = deepClone(component); - newProperty.important = component.important; - - all = component.all; - } - - for (var componentName in candidateComponents) { - candidateComponents[componentName].unused = true; - } - - if (sourceMaps) { - var sourceMapping = componentSourceMaps(candidateComponents); - if (sourceMapping.length > 0) - newValuePlaceholder[0].push(sourceMapping); - } - - newProperty.position = all.length; - newProperty.all = all; - newProperty.all.push(newValuePlaceholder); - - properties.push(newProperty); -} - -function invalidateOrCompact(properties, position, candidates, sourceMaps, validator) { - var property = properties[position]; - - for (var name in candidates) { - if (undefined !== property && name == property.name) - continue; - - var descriptor = compactable[name]; - var candidateComponents = candidates[name]; - if (descriptor.components.length > Object.keys(candidateComponents).length) { - delete candidates[name]; - continue; - } - - if (mixedImportance(candidateComponents)) - continue; - - replaceWithShorthand(properties, candidateComponents, name, sourceMaps, validator); - } -} - -function compactShortands(properties, sourceMaps, validator) { - var candidates = {}; - - if (properties.length < 3) - return; - - for (var i = 0, l = properties.length; i < l; i++) { - var property = properties[i]; - if (property.unused) - continue; - - if (property.hack) - continue; - - if (property.variable) - continue; - - var descriptor = compactable[property.name]; - if (!descriptor || !descriptor.componentOf) - continue; - - if (property.shorthand) { - invalidateOrCompact(properties, i, candidates, sourceMaps, validator); - } else { - var componentOf = descriptor.componentOf; - candidates[componentOf] = candidates[componentOf] || {}; - candidates[componentOf][property.name] = property; - } - } - - invalidateOrCompact(properties, i, candidates, sourceMaps, validator); -} - -module.exports = compactShortands; - -},{"./clone":16,"./compactable":17,"./every-combination":18,"./has-inherit":19,"./populate-components":23,"./wrap-for-optimizing":30}],28:[function(require,module,exports){ -// Validates various CSS property values - -var split = require('../utils/split'); - -var widthKeywords = ['thin', 'thick', 'medium', 'inherit', 'initial']; -var allUnits = ['px', '%', 'em', 'in', 'cm', 'mm', 'ex', 'pt', 'pc', 'ch', 'rem', 'vh', 'vm', 'vmin', 'vmax', 'vw']; -var cssUnitRegexStr = '(\\-?\\.?\\d+\\.?\\d*(' + allUnits.join('|') + '|)|auto|inherit)'; -var cssCalcRegexStr = '(\\-moz\\-|\\-webkit\\-)?calc\\([^\\)]+\\)'; -var cssFunctionNoVendorRegexStr = '[A-Z]+(\\-|[A-Z]|[0-9])+\\(.*?\\)'; -var cssFunctionVendorRegexStr = '\\-(\\-|[A-Z]|[0-9])+\\(.*?\\)'; -var cssVariableRegexStr = 'var\\(\\-\\-[^\\)]+\\)'; -var cssFunctionAnyRegexStr = '(' + cssVariableRegexStr + '|' + cssFunctionNoVendorRegexStr + '|' + cssFunctionVendorRegexStr + ')'; -var cssUnitOrCalcRegexStr = '(' + cssUnitRegexStr + '|' + cssCalcRegexStr + ')'; -var cssUnitAnyRegexStr = '(none|' + widthKeywords.join('|') + '|' + cssUnitRegexStr + '|' + cssVariableRegexStr + '|' + cssFunctionNoVendorRegexStr + '|' + cssFunctionVendorRegexStr + ')'; - -var cssFunctionNoVendorRegex = new RegExp('^' + cssFunctionNoVendorRegexStr + '$', 'i'); -var cssFunctionVendorRegex = new RegExp('^' + cssFunctionVendorRegexStr + '$', 'i'); -var cssVariableRegex = new RegExp('^' + cssVariableRegexStr + '$', 'i'); -var cssFunctionAnyRegex = new RegExp('^' + cssFunctionAnyRegexStr + '$', 'i'); -var cssUnitRegex = new RegExp('^' + cssUnitRegexStr + '$', 'i'); -var cssUnitOrCalcRegex = new RegExp('^' + cssUnitOrCalcRegexStr + '$', 'i'); -var cssUnitAnyRegex = new RegExp('^' + cssUnitAnyRegexStr + '$', 'i'); - -var backgroundRepeatKeywords = ['repeat', 'no-repeat', 'repeat-x', 'repeat-y', 'inherit']; -var backgroundAttachmentKeywords = ['inherit', 'scroll', 'fixed', 'local']; -var backgroundPositionKeywords = ['center', 'top', 'bottom', 'left', 'right']; -var backgroundSizeKeywords = ['contain', 'cover']; -var backgroundBoxKeywords = ['border-box', 'content-box', 'padding-box']; -var styleKeywords = ['auto', 'inherit', 'hidden', 'none', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset']; -var listStyleTypeKeywords = ['armenian', 'circle', 'cjk-ideographic', 'decimal', 'decimal-leading-zero', 'disc', 'georgian', 'hebrew', 'hiragana', 'hiragana-iroha', 'inherit', 'katakana', 'katakana-iroha', 'lower-alpha', 'lower-greek', 'lower-latin', 'lower-roman', 'none', 'square', 'upper-alpha', 'upper-latin', 'upper-roman']; -var listStylePositionKeywords = ['inside', 'outside', 'inherit']; - -function Validator(compatibility) { - var validUnits = allUnits.slice(0).filter(function (value) { - return !(value in compatibility.units) || compatibility.units[value] === true; - }); - - var compatibleCssUnitRegexStr = '(\\-?\\.?\\d+\\.?\\d*(' + validUnits.join('|') + '|)|auto|inherit)'; - this.compatibleCssUnitRegex = new RegExp('^' + compatibleCssUnitRegexStr + '$', 'i'); - this.compatibleCssUnitAnyRegex = new RegExp('^(none|' + widthKeywords.join('|') + '|' + compatibleCssUnitRegexStr + '|' + cssVariableRegexStr + '|' + cssFunctionNoVendorRegexStr + '|' + cssFunctionVendorRegexStr + ')$', 'i'); - - this.colorOpacity = compatibility.colors.opacity; -} - -Validator.prototype.isValidHexColor = function (s) { - return (s.length === 4 || s.length === 7) && s[0] === '#'; -}; - -Validator.prototype.isValidRgbaColor = function (s) { - s = s.split(' ').join(''); - return s.length > 0 && s.indexOf('rgba(') === 0 && s.indexOf(')') === s.length - 1; -}; - -Validator.prototype.isValidHslaColor = function (s) { - s = s.split(' ').join(''); - return s.length > 0 && s.indexOf('hsla(') === 0 && s.indexOf(')') === s.length - 1; -}; - -Validator.prototype.isValidNamedColor = function (s) { - // We don't really check if it's a valid color value, but allow any letters in it - return s !== 'auto' && (s === 'transparent' || s === 'inherit' || /^[a-zA-Z]+$/.test(s)); -}; - -Validator.prototype.isValidVariable = function (s) { - return cssVariableRegex.test(s); -}; - -Validator.prototype.isValidColor = function (s) { - return this.isValidNamedColor(s) || - this.isValidColorValue(s) || - this.isValidVariable(s) || - this.isValidVendorPrefixedValue(s); -}; - -Validator.prototype.isValidColorValue = function (s) { - return this.isValidHexColor(s) || - this.isValidRgbaColor(s) || - this.isValidHslaColor(s); -}; - -Validator.prototype.isValidUrl = function (s) { - // NOTE: at this point all URLs are replaced with placeholders by clean-css, so we check for those placeholders - return s.indexOf('__ESCAPED_URL_CLEAN_CSS') === 0; -}; - -Validator.prototype.isValidUnit = function (s) { - return cssUnitAnyRegex.test(s); -}; - -Validator.prototype.isValidUnitWithoutFunction = function (s) { - return cssUnitRegex.test(s); -}; - -Validator.prototype.isValidAndCompatibleUnit = function (s) { - return this.compatibleCssUnitAnyRegex.test(s); -}; - -Validator.prototype.isValidAndCompatibleUnitWithoutFunction = function (s) { - return this.compatibleCssUnitRegex.test(s); -}; - -Validator.prototype.isValidFunctionWithoutVendorPrefix = function (s) { - return cssFunctionNoVendorRegex.test(s); -}; - -Validator.prototype.isValidFunctionWithVendorPrefix = function (s) { - return cssFunctionVendorRegex.test(s); -}; - -Validator.prototype.isValidFunction = function (s) { - return cssFunctionAnyRegex.test(s); -}; - -Validator.prototype.isValidBackgroundRepeat = function (s) { - return backgroundRepeatKeywords.indexOf(s) >= 0 || this.isValidVariable(s); -}; - -Validator.prototype.isValidBackgroundAttachment = function (s) { - return backgroundAttachmentKeywords.indexOf(s) >= 0 || this.isValidVariable(s); -}; - -Validator.prototype.isValidBackgroundBox = function (s) { - return backgroundBoxKeywords.indexOf(s) >= 0 || this.isValidVariable(s); -}; - -Validator.prototype.isValidBackgroundPositionPart = function (s) { - return backgroundPositionKeywords.indexOf(s) >= 0 || cssUnitOrCalcRegex.test(s) || this.isValidVariable(s); -}; - -Validator.prototype.isValidBackgroundPosition = function (s) { - if (s === 'inherit') - return true; - - var parts = s.split(' '); - for (var i = 0, l = parts.length; i < l; i++) { - if (parts[i] === '') - continue; - if (this.isValidBackgroundPositionPart(parts[i]) || this.isValidVariable(parts[i])) - continue; - - return false; +// Properties to process +// Extend this object in order to add support for more properties in the optimizer. +// +// Each key in this object represents a CSS property and should be an object. +// Such an object contains properties that describe how the represented CSS property should be handled. +// Possible options: +// +// * components: array (Only specify for shorthand properties.) +// Contains the names of the granular properties this shorthand compacts. +// +// * canOverride: function +// Returns whether two tokens of this property can be merged with each other. +// This property has no meaning for shorthands. +// +// * defaultValue: string +// Specifies the default value of the property according to the CSS standard. +// For shorthand, this is used when every component is set to its default value, therefore it should be the shortest possible default value of all the components. +// +// * shortestValue: string +// Specifies the shortest possible value the property can possibly have. +// (Falls back to defaultValue if unspecified.) +// +// * breakUp: function (Only specify for shorthand properties.) +// Breaks the shorthand up to its components. +// +// * restore: function (Only specify for shorthand properties.) +// Puts the shorthand together from its components. +// +var compactable = { + 'background': { + canOverride: canOverride.generic.components([ + canOverride.generic.image, + canOverride.property.backgroundPosition, + canOverride.property.backgroundSize, + canOverride.property.backgroundRepeat, + canOverride.property.backgroundAttachment, + canOverride.property.backgroundOrigin, + canOverride.property.backgroundClip, + canOverride.generic.color + ]), + components: [ + 'background-image', + 'background-position', + 'background-size', + 'background-repeat', + 'background-attachment', + 'background-origin', + 'background-clip', + 'background-color' + ], + breakUp: breakUp.multiplex(breakUp.background), + defaultValue: '0 0', + restore: restore.multiplex(restore.background), + shortestValue: '0', + shorthand: true + }, + 'background-attachment': { + canOverride: canOverride.property.backgroundAttachment, + componentOf: [ + 'background' + ], + defaultValue: 'scroll' + }, + 'background-clip': { + canOverride: canOverride.property.backgroundClip, + componentOf: [ + 'background' + ], + defaultValue: 'border-box', + shortestValue: 'border-box' + }, + 'background-color': { + canOverride: canOverride.generic.color, + componentOf: [ + 'background' + ], + defaultValue: 'transparent', + multiplexLastOnly: true, + nonMergeableValue: 'none', + shortestValue: 'red' + }, + 'background-image': { + canOverride: canOverride.generic.image, + componentOf: [ + 'background' + ], + defaultValue: 'none' + }, + 'background-origin': { + canOverride: canOverride.property.backgroundOrigin, + componentOf: [ + 'background' + ], + defaultValue: 'padding-box', + shortestValue: 'border-box' + }, + 'background-position': { + canOverride: canOverride.property.backgroundPosition, + componentOf: [ + 'background' + ], + defaultValue: ['0', '0'], + doubleValues: true, + shortestValue: '0' + }, + 'background-repeat': { + canOverride: canOverride.property.backgroundRepeat, + componentOf: [ + 'background' + ], + defaultValue: ['repeat'], + doubleValues: true + }, + 'background-size': { + canOverride: canOverride.property.backgroundSize, + componentOf: [ + 'background' + ], + defaultValue: ['auto'], + doubleValues: true, + shortestValue: '0 0' + }, + 'bottom': { + canOverride: canOverride.property.bottom, + defaultValue: 'auto' + }, + 'border': { + breakUp: breakUp.border, + canOverride: canOverride.generic.components([ + canOverride.generic.unit, + canOverride.property.borderStyle, + canOverride.generic.color + ]), + components: [ + 'border-width', + 'border-style', + 'border-color' + ], + defaultValue: 'none', + overridesShorthands: [ + 'border-bottom', + 'border-left', + 'border-right', + 'border-top' + ], + restore: restore.withoutDefaults, + shorthand: true, + shorthandComponents: true + }, + 'border-bottom': { + breakUp: breakUp.border, + canOverride: canOverride.generic.components([ + canOverride.generic.unit, + canOverride.property.borderStyle, + canOverride.generic.color + ]), + components: [ + 'border-bottom-width', + 'border-bottom-style', + 'border-bottom-color' + ], + defaultValue: 'none', + restore: restore.withoutDefaults, + shorthand: true + }, + 'border-bottom-color': { + canOverride: canOverride.generic.color, + componentOf: [ + 'border-bottom', + 'border-color' + ], + defaultValue: 'none' + }, + 'border-bottom-left-radius': { + canOverride: canOverride.generic.unit, + componentOf: [ + 'border-radius' + ], + defaultValue: '0', + vendorPrefixes: [ + '-moz-', + '-o-' + ] + }, + 'border-bottom-right-radius': { + canOverride: canOverride.generic.unit, + componentOf: [ + 'border-radius' + ], + defaultValue: '0', + vendorPrefixes: [ + '-moz-', + '-o-' + ] + }, + 'border-bottom-style': { + canOverride: canOverride.property.borderStyle, + componentOf: [ + 'border-bottom', + 'border-style' + ], + defaultValue: 'none' + }, + 'border-bottom-width': { + canOverride: canOverride.generic.unit, + componentOf: [ + 'border-bottom', + 'border-width' + ], + defaultValue: 'medium', + shortestValue: '0' + }, + 'border-collapse': { + canOverride: canOverride.property.borderCollapse, + defaultValue: 'separate' + }, + 'border-color': { + breakUp: breakUp.fourValues, + canOverride: canOverride.generic.components([ + canOverride.generic.color, + canOverride.generic.color, + canOverride.generic.color, + canOverride.generic.color + ]), + componentOf: ['border'], + components: [ + 'border-top-color', + 'border-right-color', + 'border-bottom-color', + 'border-left-color' + ], + defaultValue: 'none', + restore: restore.fourValues, + shortestValue: 'red', + shorthand: true + }, + 'border-left': { + breakUp: breakUp.border, + canOverride: canOverride.generic.components([ + canOverride.generic.unit, + canOverride.property.borderStyle, + canOverride.generic.color + ]), + components: [ + 'border-left-width', + 'border-left-style', + 'border-left-color' + ], + defaultValue: 'none', + restore: restore.withoutDefaults, + shorthand: true + }, + 'border-left-color': { + canOverride: canOverride.generic.color, + componentOf: [ + 'border-color', + 'border-left' + ], + defaultValue: 'none' + }, + 'border-left-style': { + canOverride: canOverride.property.borderStyle, + componentOf: [ + 'border-left', + 'border-style' + ], + defaultValue: 'none' + }, + 'border-left-width': { + canOverride: canOverride.generic.unit, + componentOf: [ + 'border-left', + 'border-width' + ], + defaultValue: 'medium', + shortestValue: '0' + }, + 'border-radius': { + breakUp: breakUp.borderRadius, + canOverride: canOverride.generic.components([ + canOverride.generic.unit, + canOverride.generic.unit, + canOverride.generic.unit, + canOverride.generic.unit + ]), + components: [ + 'border-top-left-radius', + 'border-top-right-radius', + 'border-bottom-right-radius', + 'border-bottom-left-radius' + ], + defaultValue: '0', + restore: restore.borderRadius, + shorthand: true, + vendorPrefixes: [ + '-moz-', + '-o-' + ] + }, + 'border-right': { + breakUp: breakUp.border, + canOverride: canOverride.generic.components([ + canOverride.generic.unit, + canOverride.property.borderStyle, + canOverride.generic.color + ]), + components: [ + 'border-right-width', + 'border-right-style', + 'border-right-color' + ], + defaultValue: 'none', + restore: restore.withoutDefaults, + shorthand: true + }, + 'border-right-color': { + canOverride: canOverride.generic.color, + componentOf: [ + 'border-color', + 'border-right' + ], + defaultValue: 'none' + }, + 'border-right-style': { + canOverride: canOverride.property.borderStyle, + componentOf: [ + 'border-right', + 'border-style' + ], + defaultValue: 'none' + }, + 'border-right-width': { + canOverride: canOverride.generic.unit, + componentOf: [ + 'border-right', + 'border-width' + ], + defaultValue: 'medium', + shortestValue: '0' + }, + 'border-style': { + breakUp: breakUp.fourValues, + canOverride: canOverride.generic.components([ + canOverride.property.borderStyle, + canOverride.property.borderStyle, + canOverride.property.borderStyle, + canOverride.property.borderStyle + ]), + componentOf: [ + 'border' + ], + components: [ + 'border-top-style', + 'border-right-style', + 'border-bottom-style', + 'border-left-style' + ], + defaultValue: 'none', + restore: restore.fourValues, + shorthand: true + }, + 'border-top': { + breakUp: breakUp.border, + canOverride: canOverride.generic.components([ + canOverride.generic.unit, + canOverride.property.borderStyle, + canOverride.generic.color + ]), + components: [ + 'border-top-width', + 'border-top-style', + 'border-top-color' + ], + defaultValue: 'none', + restore: restore.withoutDefaults, + shorthand: true + }, + 'border-top-color': { + canOverride: canOverride.generic.color, + componentOf: [ + 'border-color', + 'border-top' + ], + defaultValue: 'none' + }, + 'border-top-left-radius': { + canOverride: canOverride.generic.unit, + componentOf: [ + 'border-radius' + ], + defaultValue: '0', + vendorPrefixes: [ + '-moz-', + '-o-' + ] + }, + 'border-top-right-radius': { + canOverride: canOverride.generic.unit, + componentOf: [ + 'border-radius' + ], + defaultValue: '0', + vendorPrefixes: [ + '-moz-', + '-o-' + ] + }, + 'border-top-style': { + canOverride: canOverride.property.borderStyle, + componentOf: [ + 'border-style', + 'border-top' + ], + defaultValue: 'none' + }, + 'border-top-width': { + canOverride: canOverride.generic.unit, + componentOf: [ + 'border-top', + 'border-width' + ], + defaultValue: 'medium', + shortestValue: '0' + }, + 'border-width': { + breakUp: breakUp.fourValues, + canOverride: canOverride.generic.components([ + canOverride.generic.unit, + canOverride.generic.unit, + canOverride.generic.unit, + canOverride.generic.unit + ]), + components: [ + 'border-top-width', + 'border-right-width', + 'border-bottom-width', + 'border-left-width' + ], + defaultValue: 'medium', + restore: restore.fourValues, + shortestValue: '0', + shorthand: true + }, + 'clear': { + canOverride: canOverride.property.clear, + defaultValue: 'none' + }, + 'color': { + canOverride: canOverride.generic.color, + defaultValue: 'transparent', + shortestValue: 'red' + }, + 'cursor': { + canOverride: canOverride.property.cursor, + defaultValue: 'auto' + }, + 'display': { + canOverride: canOverride.property.display, + }, + 'float': { + canOverride: canOverride.property.float, + defaultValue: 'none' + }, + 'font-size': { + canOverride: canOverride.generic.unit, + defaultValue: 'medium', + shortestValue: '0' + }, + 'font-style': { + canOverride: canOverride.property.fontStyle, + defaultValue: 'normal' + }, + 'font-weight': { + canOverride: canOverride.property.fontWeight, + defaultValue: '400', + shortestValue: '400' + }, + 'height': { + canOverride: canOverride.generic.unit, + defaultValue: 'auto', + shortestValue: '0' + }, + 'left': { + canOverride: canOverride.property.left, + defaultValue: 'auto' + }, + 'line-height': { + canOverride: canOverride.generic.unit, + defaultValue: 'normal', + shortestValue: '0' + }, + 'list-style': { + canOverride: canOverride.generic.components([ + canOverride.property.listStyleType, + canOverride.property.listStylePosition, + canOverride.property.listStyleImage + ]), + components: [ + 'list-style-type', + 'list-style-position', + 'list-style-image' + ], + breakUp: breakUp.listStyle, + restore: restore.withoutDefaults, + defaultValue: 'outside', // can't use 'disc' because that'd override default 'decimal' for
          + shortestValue: 'none', + shorthand: true + }, + 'list-style-image' : { + canOverride: canOverride.generic.image, + componentOf: [ + 'list-style' + ], + defaultValue: 'none' + }, + 'list-style-position' : { + canOverride: canOverride.property.listStylePosition, + componentOf: [ + 'list-style' + ], + defaultValue: 'outside', + shortestValue: 'inside' + }, + 'list-style-type' : { + canOverride: canOverride.property.listStyleType, + componentOf: [ + 'list-style' + ], + // NOTE: we can't tell the real default value here, it's 'disc' for
            and 'decimal' for
              + // this is a hack, but it doesn't matter because this value will be either overridden or + // it will disappear at the final step anyway + defaultValue: 'decimal|disc', + shortestValue: 'none' + }, + 'margin': { + breakUp: breakUp.fourValues, + canOverride: canOverride.generic.components([ + canOverride.generic.unit, + canOverride.generic.unit, + canOverride.generic.unit, + canOverride.generic.unit + ]), + components: [ + 'margin-top', + 'margin-right', + 'margin-bottom', + 'margin-left' + ], + defaultValue: '0', + restore: restore.fourValues, + shorthand: true + }, + 'margin-bottom': { + canOverride: canOverride.generic.unit, + componentOf: [ + 'margin' + ], + defaultValue: '0' + }, + 'margin-left': { + canOverride: canOverride.generic.unit, + componentOf: [ + 'margin' + ], + defaultValue: '0' + }, + 'margin-right': { + canOverride: canOverride.generic.unit, + componentOf: [ + 'margin' + ], + defaultValue: '0' + }, + 'margin-top': { + canOverride: canOverride.generic.unit, + componentOf: [ + 'margin' + ], + defaultValue: '0' + }, + 'outline': { + canOverride: canOverride.generic.components([ + canOverride.generic.color, + canOverride.property.outlineStyle, + canOverride.generic.unit + ]), + components: [ + 'outline-color', + 'outline-style', + 'outline-width' + ], + breakUp: breakUp.outline, + restore: restore.withoutDefaults, + defaultValue: '0', + shorthand: true + }, + 'outline-color': { + canOverride: canOverride.generic.color, + componentOf: [ + 'outline' + ], + defaultValue: 'invert', + shortestValue: 'red' + }, + 'outline-style': { + canOverride: canOverride.property.outlineStyle, + componentOf: [ + 'outline' + ], + defaultValue: 'none' + }, + 'outline-width': { + canOverride: canOverride.generic.unit, + componentOf: [ + 'outline' + ], + defaultValue: 'medium', + shortestValue: '0' + }, + 'overflow': { + canOverride: canOverride.property.overflow, + defaultValue: 'visible' + }, + 'overflow-x': { + canOverride: canOverride.property.overflow, + defaultValue: 'visible' + }, + 'overflow-y': { + canOverride: canOverride.property.overflow, + defaultValue: 'visible' + }, + 'padding': { + breakUp: breakUp.fourValues, + canOverride: canOverride.generic.components([ + canOverride.generic.unit, + canOverride.generic.unit, + canOverride.generic.unit, + canOverride.generic.unit + ]), + components: [ + 'padding-top', + 'padding-right', + 'padding-bottom', + 'padding-left' + ], + defaultValue: '0', + restore: restore.fourValues, + shorthand: true + }, + 'padding-bottom': { + canOverride: canOverride.generic.unit, + componentOf: [ + 'padding' + ], + defaultValue: '0' + }, + 'padding-left': { + canOverride: canOverride.generic.unit, + componentOf: [ + 'padding' + ], + defaultValue: '0' + }, + 'padding-right': { + canOverride: canOverride.generic.unit, + componentOf: [ + 'padding' + ], + defaultValue: '0' + }, + 'padding-top': { + canOverride: canOverride.generic.unit, + componentOf: [ + 'padding' + ], + defaultValue: '0' + }, + 'position': { + canOverride: canOverride.property.position, + defaultValue: 'static' + }, + 'right': { + canOverride: canOverride.property.right, + defaultValue: 'auto' + }, + 'text-align': { + canOverride: canOverride.property.textAlign, + // NOTE: we can't tell the real default value here, as it depends on default text direction + // this is a hack, but it doesn't matter because this value will be either overridden or + // it will disappear anyway + defaultValue: 'left|right' + }, + 'text-decoration': { + canOverride: canOverride.property.textDecoration, + defaultValue: 'none' + }, + 'text-overflow': { + canOverride: canOverride.property.textOverflow, + defaultValue: 'none' + }, + 'text-shadow': { + canOverride: canOverride.property.textShadow, + defaultValue: 'none' + }, + 'top': { + canOverride: canOverride.property.top, + defaultValue: 'auto' + }, + 'transform': { + canOverride: canOverride.property.transform, + vendorPrefixes: [ + '-moz-', + '-ms-', + '-webkit-' + ] + }, + 'vertical-align': { + canOverride: canOverride.property.verticalAlign, + defaultValue: 'baseline' + }, + 'visibility': { + canOverride: canOverride.property.visibility, + defaultValue: 'visible' + }, + 'white-space': { + canOverride: canOverride.property.whiteSpace, + defaultValue: 'normal' + }, + 'width': { + canOverride: canOverride.generic.unit, + defaultValue: 'auto', + shortestValue: '0' + }, + 'z-index': { + canOverride: canOverride.property.zIndex, + defaultValue: 'auto' } - - return true; -}; - -Validator.prototype.isValidBackgroundSizePart = function (s) { - return backgroundSizeKeywords.indexOf(s) >= 0 || cssUnitRegex.test(s) || this.isValidVariable(s); -}; - -Validator.prototype.isValidBackgroundPositionAndSize = function (s) { - if (s.indexOf('/') < 0) - return false; - - var twoParts = split(s, '/'); - return this.isValidBackgroundSizePart(twoParts.pop()) && this.isValidBackgroundPositionPart(twoParts.pop()); -}; - -Validator.prototype.isValidListStyleType = function (s) { - return listStyleTypeKeywords.indexOf(s) >= 0 || this.isValidVariable(s); -}; - -Validator.prototype.isValidListStylePosition = function (s) { - return listStylePositionKeywords.indexOf(s) >= 0 || this.isValidVariable(s); -}; - -Validator.prototype.isValidStyle = function (s) { - return this.isValidStyleKeyword(s) || this.isValidVariable(s); -}; - -Validator.prototype.isValidStyleKeyword = function (s) { - return styleKeywords.indexOf(s) >= 0; -}; - -Validator.prototype.isValidWidth = function (s) { - return this.isValidUnit(s) || this.isValidWidthKeyword(s) || this.isValidVariable(s); -}; - -Validator.prototype.isValidWidthKeyword = function (s) { - return widthKeywords.indexOf(s) >= 0; -}; - -Validator.prototype.isValidVendorPrefixedValue = function (s) { - return /^-([A-Za-z0-9]|-)*$/gi.test(s); }; -Validator.prototype.areSameFunction = function (a, b) { - if (!this.isValidFunction(a) || !this.isValidFunction(b)) - return false; +function cloneDescriptor(propertyName, prefix) { + var clonedDescriptor = override(compactable[propertyName], {}); - var f1name = a.substring(0, a.indexOf('(')); - var f2name = b.substring(0, b.indexOf('(')); + if ('componentOf' in clonedDescriptor) { + clonedDescriptor.componentOf = clonedDescriptor.componentOf.map(function (shorthandName) { + return prefix + shorthandName; + }); + } - return f1name === f2name; -}; + if ('components' in clonedDescriptor) { + clonedDescriptor.components = clonedDescriptor.components.map(function (longhandName) { + return prefix + longhandName; + }); + } -module.exports = Validator; + return clonedDescriptor; +} -},{"../utils/split":68}],29:[function(require,module,exports){ -var VENDOR_PREFIX_PATTERN = /$\-moz\-|\-ms\-|\-o\-|\-webkit\-/; +// generate vendor-prefixed properties +var vendorPrefixedCompactable = {}; -function prefixesIn(tokens) { - var prefixes = []; +for (var propertyName in compactable) { + var descriptor = compactable[propertyName]; - for (var i = 0, l = tokens.length; i < l; i++) { - var token = tokens[i]; + if (!('vendorPrefixes' in descriptor)) { + continue; + } - for (var j = 0, m = token.value.length; j < m; j++) { - var match = VENDOR_PREFIX_PATTERN.exec(token.value[j][0]); + for (var i = 0; i < descriptor.vendorPrefixes.length; i++) { + var prefix = descriptor.vendorPrefixes[i]; + var clonedDescriptor = cloneDescriptor(propertyName, prefix); + delete clonedDescriptor.vendorPrefixes; - if (match && prefixes.indexOf(match[0]) == -1) - prefixes.push(match[0]); - } + vendorPrefixedCompactable[prefix + propertyName] = clonedDescriptor; } - return prefixes; -} - -function same(left, right) { - return prefixesIn(left).sort().join(',') == prefixesIn(right).sort().join(','); + delete descriptor.vendorPrefixes; } -module.exports = { - same: same -}; - -},{}],30:[function(require,module,exports){ -var BACKSLASH_HACK = '\\'; -var IMPORTANT_WORD = 'important'; -var IMPORTANT_TOKEN = '!'+IMPORTANT_WORD; -var IMPORTANT_WORD_MATCH = new RegExp(IMPORTANT_WORD+'$', 'i'); -var IMPORTANT_TOKEN_MATCH = new RegExp(IMPORTANT_TOKEN+'$', 'i'); -var STAR_HACK = '*'; -var UNDERSCORE_HACK = '_'; -var BANG_HACK = '!'; +module.exports = override(compactable, vendorPrefixedCompactable); -function wrapAll(properties) { - var wrapped = []; +},{"../../utils/override":94,"./break-up":19,"./can-override":20,"./restore":48}],23:[function(require,module,exports){ +// This extractor is used in level 2 optimizations +// IMPORTANT: Mind Token class and this code is not related! +// Properties will be tokenized in one step, see #429 - for (var i = properties.length - 1; i >= 0; i--) { - if (typeof properties[i][0] == 'string') - continue; +var Token = require('../../tokenizer/token'); +var serializeRules = require('../../writer/one-time').rules; +var serializeValue = require('../../writer/one-time').value; - var single = wrapSingle(properties[i]); - single.all = properties; - single.position = i; - wrapped.unshift(single); - } +function extractProperties(token) { + var properties = []; + var inSpecificSelector; + var property; + var name; + var value; + var i, l; - return wrapped; -} + if (token[0] == Token.RULE) { + inSpecificSelector = !/[\.\+>~]/.test(serializeRules(token[1])); -function isMultiplex(property) { - for (var i = 1, l = property.length; i < l; i++) { - if (property[i][0] == ',' || property[i][0] == '/') - return true; - } + for (i = 0, l = token[2].length; i < l; i++) { + property = token[2][i]; - return false; -} + if (property[0] != Token.PROPERTY) + continue; -function hackType(property) { - var type = false; - var name = property[0][0]; - var lastValue = property[property.length - 1]; + name = property[1][1]; + if (name.length === 0) + continue; - if (name[0] == UNDERSCORE_HACK) { - type = 'underscore'; - } else if (name[0] == STAR_HACK) { - type = 'star'; - } else if (lastValue[0][0] == BANG_HACK && !lastValue[0].match(IMPORTANT_WORD_MATCH)) { - type = 'bang'; - } else if (lastValue[0].indexOf(BANG_HACK) > 0 && !lastValue[0].match(IMPORTANT_WORD_MATCH)) { - type = 'bang'; - } else if (lastValue[0].indexOf(BACKSLASH_HACK) > 0 && lastValue[0].indexOf(BACKSLASH_HACK) == lastValue[0].length - BACKSLASH_HACK.length - 1) { - type = 'backslash'; - } else if (lastValue[0].indexOf(BACKSLASH_HACK) === 0 && lastValue[0].length == 2) { - type = 'backslash'; - } + if (name.indexOf('--') === 0) + continue; - return type; -} + value = serializeValue(property, i); -function isImportant(property) { - if (property.length > 1) { - var p = property[property.length - 1][0]; - if (typeof(p) === 'string') { - return IMPORTANT_TOKEN_MATCH.test(p); + properties.push([ + name, + value, + findNameRoot(name), + token[2][i], + name + ':' + value, + token[1], + inSpecificSelector + ]); + } + } else if (token[0] == Token.NESTED_BLOCK) { + for (i = 0, l = token[2].length; i < l; i++) { + properties = properties.concat(extractProperties(token[2][i])); } } - return false; -} - -function stripImportant(property) { - if (property.length > 0) - property[property.length - 1][0] = property[property.length - 1][0].replace(IMPORTANT_TOKEN_MATCH, ''); -} -function stripPrefixHack(property) { - property[0][0] = property[0][0].substring(1); + return properties; } -function stripSuffixHack(property, hackType) { - var lastValue = property[property.length - 1]; - lastValue[0] = lastValue[0] - .substring(0, lastValue[0].indexOf(hackType == 'backslash' ? BACKSLASH_HACK : BANG_HACK)) - .trim(); +function findNameRoot(name) { + if (name == 'list-style') + return name; + if (name.indexOf('-radius') > 0) + return 'border-radius'; + if (name == 'border-collapse' || name == 'border-spacing' || name == 'border-image') + return name; + if (name.indexOf('border-') === 0 && /^border\-\w+\-\w+$/.test(name)) + return name.match(/border\-\w+/)[0]; + if (name.indexOf('border-') === 0 && /^border\-\w+$/.test(name)) + return 'border'; + if (name.indexOf('text-') === 0) + return name; + if (name == '-chrome-') + return name; - if (lastValue[0].length === 0) - property.pop(); + return name.replace(/^\-\w+\-/, '').match(/([a-zA-Z]+)/)[0].toLowerCase(); } -function wrapSingle(property) { - var _isImportant = isImportant(property); - if (_isImportant) - stripImportant(property); - - var _hackType = hackType(property); - if (_hackType == 'star' || _hackType == 'underscore') - stripPrefixHack(property); - else if (_hackType == 'backslash' || _hackType == 'bang') - stripSuffixHack(property, _hackType); - - var isVariable = property[0][0].indexOf('--') === 0; +module.exports = extractProperties; - return { - block: isVariable && property[1] && Array.isArray(property[1][0][0]), - components: [], - dirty: false, - hack: _hackType, - important: _isImportant, - name: property[0][0], - multiplex: property.length > 2 ? isMultiplex(property) : false, - position: 0, - shorthand: false, - unused: property.length < 2, - value: property.slice(1), - variable: isVariable - }; +},{"../../tokenizer/token":82,"../../writer/one-time":97}],24:[function(require,module,exports){ +function InvalidPropertyError(message) { + this.name = 'InvalidPropertyError'; + this.message = message; + this.stack = (new Error()).stack; } -module.exports = { - all: wrapAll, - single: wrapSingle -}; +InvalidPropertyError.prototype = Object.create(Error.prototype); +InvalidPropertyError.prototype.constructor = InvalidPropertyError; -},{}],31:[function(require,module,exports){ -var optimizeProperties = require('../properties/optimizer'); +module.exports = InvalidPropertyError; -var removeDuplicates = require('./remove-duplicates'); -var mergeAdjacent = require('./merge-adjacent'); -var reduceNonAdjacent = require('./reduce-non-adjacent'); -var mergeNonAdjacentBySelector = require('./merge-non-adjacent-by-selector'); -var mergeNonAdjacentByBody = require('./merge-non-adjacent-by-body'); -var restructure = require('./restructure'); -var removeDuplicateMediaQueries = require('./remove-duplicate-media-queries'); -var mergeMediaQueries = require('./merge-media-queries'); +},{}],25:[function(require,module,exports){ +var Marker = require('../../tokenizer/marker'); +var split = require('../../utils/split'); + +var DEEP_SELECTOR_PATTERN = /\/deep\//; +var DOUBLE_COLON_PATTERN = /^::/; +var NOT_PSEUDO = ':not'; +var PSEUDO_CLASSES_WITH_ARGUMENTS = [ + ':dir', + ':lang', + ':not', + ':nth-child', + ':nth-last-child', + ':nth-last-of-type', + ':nth-of-type' +]; +var RELATION_PATTERN = /[>\+~]/; + +var Level = { + DOUBLE_QUOTE: 'double-quote', + SINGLE_QUOTE: 'single-quote', + ROOT: 'root' +}; -function removeEmpty(tokens) { - for (var i = 0, l = tokens.length; i < l; i++) { - var token = tokens[i]; - var isEmpty = false; +function isMergeable(selector, mergeablePseudoClasses, mergeablePseudoElements) { + var singleSelectors = split(selector, Marker.COMMA); + var singleSelector; + var i, l; - switch (token[0]) { - case 'selector': - isEmpty = token[1].length === 0 || token[2].length === 0; - break; - case 'block': - removeEmpty(token[2]); - isEmpty = token[2].length === 0; - } + for (i = 0, l = singleSelectors.length; i < l; i++) { + singleSelector = singleSelectors[i]; - if (isEmpty) { - tokens.splice(i, 1); - i--; - l--; + if (singleSelector.length === 0 || + isDeepSelector(singleSelector) || + (singleSelector.indexOf(Marker.COLON) > -1 && !areMergeable(singleSelector, extractPseudoFrom(singleSelector), mergeablePseudoClasses, mergeablePseudoElements))) { + return false; } } -} - -function recursivelyOptimizeBlocks(tokens, options, context) { - for (var i = 0, l = tokens.length; i < l; i++) { - var token = tokens[i]; - if (token[0] == 'block') { - var isKeyframes = /@(-moz-|-o-|-webkit-)?keyframes/.test(token[1][0]); - optimize(token[2], options, context, !isKeyframes); - } - } + return true; } -function recursivelyOptimizeProperties(tokens, options, context) { - for (var i = 0, l = tokens.length; i < l; i++) { - var token = tokens[i]; - - switch (token[0]) { - case 'selector': - optimizeProperties(token[1], token[2], false, true, options, context); - break; - case 'block': - recursivelyOptimizeProperties(token[2], options, context); - } - } +function isDeepSelector(selector) { + return DEEP_SELECTOR_PATTERN.test(selector); } -function optimize(tokens, options, context, withRestructuring) { - recursivelyOptimizeBlocks(tokens, options, context); - recursivelyOptimizeProperties(tokens, options, context); - - removeDuplicates(tokens); - mergeAdjacent(tokens, options, context); - reduceNonAdjacent(tokens, options, context); - - mergeNonAdjacentBySelector(tokens, options, context); - mergeNonAdjacentByBody(tokens, options); +function extractPseudoFrom(selector) { + var list = []; + var character; + var buffer = []; + var level = Level.ROOT; + var roundBracketLevel = 0; + var isQuoted; + var isEscaped; + var isPseudo = false; + var isRelation; + var wasColon = false; + var index; + var len; + + for (index = 0, len = selector.length; index < len; index++) { + character = selector[index]; + + isRelation = !isEscaped && RELATION_PATTERN.test(character); + isQuoted = level == Level.DOUBLE_QUOTE || level == Level.SINGLE_QUOTE; + + if (isEscaped) { + buffer.push(character); + } else if (isQuoted) { + buffer.push(character); + } else if (character == Marker.DOUBLE_QUOTE && level == Level.ROOT) { + buffer.push(character); + level = Level.DOUBLE_QUOTE; + } else if (character == Marker.DOUBLE_QUOTE && level == Level.DOUBLE_QUOTE) { + buffer.push(character); + level = Level.ROOT; + } else if (character == Marker.SINGLE_QUOTE && level == Level.ROOT) { + buffer.push(character); + level = Level.SINGLE_QUOTE; + } else if (character == Marker.SINGLE_QUOTE && level == Level.SINGLE_QUOTE) { + buffer.push(character); + level = Level.ROOT; + } else if (character == Marker.OPEN_ROUND_BRACKET) { + buffer.push(character); + roundBracketLevel++; + } else if (character == Marker.CLOSE_ROUND_BRACKET && roundBracketLevel == 1 && isPseudo) { + buffer.push(character); + list.push(buffer.join('')); + roundBracketLevel--; + buffer = []; + isPseudo = false; + } else if (character == Marker.CLOSE_ROUND_BRACKET) { + buffer.push(character); + roundBracketLevel--; + } else if (character == Marker.COLON && roundBracketLevel === 0 && isPseudo && !wasColon) { + list.push(buffer.join('')); + buffer = []; + buffer.push(character); + } else if (character == Marker.COLON && roundBracketLevel === 0 && !wasColon) { + buffer = []; + buffer.push(character); + isPseudo = true; + } else if (character == Marker.SPACE && roundBracketLevel === 0 && isPseudo) { + list.push(buffer.join('')); + buffer = []; + isPseudo = false; + } else if (isRelation && roundBracketLevel === 0 && isPseudo) { + list.push(buffer.join('')); + buffer = []; + isPseudo = false; + } else { + buffer.push(character); + } - if (options.restructuring && withRestructuring) { - restructure(tokens, options); - mergeAdjacent(tokens, options, context); + isEscaped = character == Marker.BACK_SLASH; + wasColon = character == Marker.COLON; } - if (options.mediaMerging) { - removeDuplicateMediaQueries(tokens); - var reduced = mergeMediaQueries(tokens); - for (var i = reduced.length - 1; i >= 0; i--) { - optimize(reduced[i][2], options, context, false); - } + if (buffer.length > 0 && isPseudo) { + list.push(buffer.join('')); } - removeEmpty(tokens); -} - -module.exports = optimize; - -},{"../properties/optimizer":21,"./merge-adjacent":35,"./merge-media-queries":36,"./merge-non-adjacent-by-body":37,"./merge-non-adjacent-by-selector":38,"./reduce-non-adjacent":39,"./remove-duplicate-media-queries":40,"./remove-duplicates":41,"./restructure":43}],32:[function(require,module,exports){ -function removeWhitespace(match, value) { - return '[' + value.replace(/ /g, '') + ']'; + return list; } -function selectorSorter(s1, s2) { - return s1[0] > s2[0] ? 1 : -1; +function areMergeable(selector, matches, mergeablePseudoClasses, mergeablePseudoElements) { + return areAllowed(matches, mergeablePseudoClasses, mergeablePseudoElements) && + needArguments(matches) && + (matches.length < 2 || !someIncorrectlyChained(selector, matches)) && + (matches.length < 2 || !someMixed(matches)); } -function whitespaceReplacements(_, p1, p2, p3) { - if (p1 && p2 && p3.length) - return p1 + p2 + ' '; - else if (p1 && p2) - return p1 + p2; - else - return p2; -} +function areAllowed(matches, mergeablePseudoClasses, mergeablePseudoElements) { + var match; + var name; + var i, l; -var CleanUp = { - selectors: function (selectors, removeUnsupported, adjacentSpace) { - var list = []; - var repeated = []; + for (i = 0, l = matches.length; i < l; i++) { + match = matches[i]; + name = match.indexOf(Marker.OPEN_ROUND_BRACKET) > -1 ? + match.substring(0, match.indexOf(Marker.OPEN_ROUND_BRACKET)) : + match; - for (var i = 0, l = selectors.length; i < l; i++) { - var selector = selectors[i]; - var reduced = selector[0] - .replace(/\s+/g, ' ') - .replace(/ ?, ?/g, ',') - .replace(/\s*(\\)?([>+~])(\s*)/g, whitespaceReplacements) - .trim(); + if (mergeablePseudoClasses.indexOf(name) === -1 && mergeablePseudoElements.indexOf(name) === -1) { + return false; + } + } - if (adjacentSpace && reduced.indexOf('nav') > 0) - reduced = reduced.replace(/\+nav(\S|$)/, '+ nav$1'); + return true; +} - if (removeUnsupported && (reduced.indexOf('*+html ') != -1 || reduced.indexOf('*:first-child+html ') != -1)) - continue; +function needArguments(matches) { + var match; + var name; + var bracketOpensAt; + var hasArguments; + var i, l; - if (reduced.indexOf('*') > -1) { - reduced = reduced - .replace(/\*([:#\.\[])/g, '$1') - .replace(/^(\:first\-child)?\+html/, '*$1+html'); - } + for (i = 0, l = matches.length; i < l; i++) { + match = matches[i]; - if (reduced.indexOf('[') > -1) - reduced = reduced.replace(/\[([^\]]+)\]/g, removeWhitespace); + bracketOpensAt = match.indexOf(Marker.OPEN_ROUND_BRACKET); + hasArguments = bracketOpensAt > -1; + name = hasArguments ? + match.substring(0, bracketOpensAt) : + match; - if (repeated.indexOf(reduced) == -1) { - selector[0] = reduced; - repeated.push(reduced); - list.push(selector); - } + if (hasArguments && PSEUDO_CLASSES_WITH_ARGUMENTS.indexOf(name) == -1) { + return false; } - return list.sort(selectorSorter); - }, - - selectorDuplicates: function (selectors) { - var list = []; - var repeated = []; - - for (var i = 0, l = selectors.length; i < l; i++) { - var selector = selectors[i]; - - if (repeated.indexOf(selector[0]) == -1) { - repeated.push(selector[0]); - list.push(selector); - } + if (!hasArguments && PSEUDO_CLASSES_WITH_ARGUMENTS.indexOf(name) > -1) { + return false; } - - return list.sort(selectorSorter); - }, - - block: function (values, spaceAfterClosingBrace) { - values[0] = values[0] - .replace(/\s+/g, ' ') - .replace(/(,|:|\() /g, '$1') - .replace(/ \)/g, ')'); - - if (!spaceAfterClosingBrace) - values[0] = values[0].replace(/\) /g, ')'); - }, - - atRule: function (values) { - values[0] = values[0] - .replace(/\s+/g, ' ') - .trim(); } -}; - -module.exports = CleanUp; - -},{}],33:[function(require,module,exports){ -// This extractor is used in advanced optimizations -// IMPORTANT: Mind Token class and this code is not related! -// Properties will be tokenized in one step, see #429 - -var stringifySelectors = require('../stringifier/one-time').selectors; -var stringifyValue = require('../stringifier/one-time').value; - -var AT_RULE = 'at-rule'; - -function extract(token) { - var properties = []; - if (token[0] == 'selector') { - var inSpecificSelector = !/[\.\+>~]/.test(stringifySelectors(token[1])); - for (var i = 0, l = token[2].length; i < l; i++) { - var property = token[2][i]; + return true; +} - if (property.indexOf('__ESCAPED') === 0) - continue; +function someIncorrectlyChained(selector, matches) { + var positionInSelector = 0; + var match; + var matchAt; + var nextMatch; + var nextMatchAt; + var name; + var nextName; + var areChained; + var i, l; - if (property[0] == AT_RULE) - continue; + for (i = 0, l = matches.length; i < l; i++) { + match = matches[i]; + nextMatch = matches[i + 1]; - var name = token[2][i][0][0]; - if (name.length === 0) - continue; + if (!nextMatch) { + break; + } - if (name.indexOf('--') === 0) - continue; + matchAt = selector.indexOf(match, positionInSelector); + nextMatchAt = selector.indexOf(match, matchAt + 1); + positionInSelector = nextMatchAt; + areChained = matchAt + match.length == nextMatchAt; - var value = stringifyValue(token[2], i); + if (areChained) { + name = match.indexOf(Marker.OPEN_ROUND_BRACKET) > -1 ? + match.substring(0, match.indexOf(Marker.OPEN_ROUND_BRACKET)) : + match; + nextName = nextMatch.indexOf(Marker.OPEN_ROUND_BRACKET) > -1 ? + nextMatch.substring(0, nextMatch.indexOf(Marker.OPEN_ROUND_BRACKET)) : + nextMatch; - properties.push([ - name, - value, - findNameRoot(name), - token[2][i], - name + ':' + value, - token[1], - inSpecificSelector - ]); - } - } else if (token[0] == 'block') { - for (var j = 0, k = token[2].length; j < k; j++) { - properties = properties.concat(extract(token[2][j])); + if (name != NOT_PSEUDO || nextName != NOT_PSEUDO) { + return true; + } } } - return properties; + return false; } -function findNameRoot(name) { - if (name == 'list-style') - return name; - if (name.indexOf('-radius') > 0) - return 'border-radius'; - if (name == 'border-collapse' || name == 'border-spacing' || name == 'border-image') - return name; - if (name.indexOf('border-') === 0 && /^border\-\w+\-\w+$/.test(name)) - return name.match(/border\-\w+/)[0]; - if (name.indexOf('border-') === 0 && /^border\-\w+$/.test(name)) - return 'border'; - if (name.indexOf('text-') === 0) - return name; +function someMixed(matches) { + var firstIsPseudoElement = DOUBLE_COLON_PATTERN.test(matches[0]); + var match; + var i, l; + + for (i = 0, l = matches.length; i < l; i++) { + match = matches[i]; + + if (DOUBLE_COLON_PATTERN.test(match) != firstIsPseudoElement) { + return true; + } + } - return name.replace(/^\-\w+\-/, '').match(/([a-zA-Z]+)/)[0].toLowerCase(); + return false; } -module.exports = extract; +module.exports = isMergeable; -},{"../stringifier/one-time":47}],34:[function(require,module,exports){ -function isSpecial(options, selector) { - return options.compatibility.selectors.special.test(selector); -} +},{"../../tokenizer/marker":81,"../../utils/split":95}],26:[function(require,module,exports){ +var isMergeable = require('./is-mergeable'); + +var optimizeProperties = require('./properties/optimize'); + +var sortSelectors = require('../level-1/sort-selectors'); +var tidyRules = require('../level-1/tidy-rules'); -module.exports = isSpecial; +var OptimizationLevel = require('../../options/optimization-level').OptimizationLevel; -},{}],35:[function(require,module,exports){ -var optimizeProperties = require('../properties/optimizer'); +var serializeBody = require('../../writer/one-time').body; +var serializeRules = require('../../writer/one-time').rules; -var stringifyBody = require('../stringifier/one-time').body; -var stringifySelectors = require('../stringifier/one-time').selectors; -var cleanUpSelectors = require('./clean-up').selectors; -var isSpecial = require('./is-special'); +var Token = require('../../tokenizer/token'); -function mergeAdjacent(tokens, options, context) { +function mergeAdjacent(tokens, context) { var lastToken = [null, [], []]; + var options = context.options; var adjacentSpace = options.compatibility.selectors.adjacentSpace; + var selectorsSortingMethod = options.level[OptimizationLevel.One].selectorsSortingMethod; + var mergeablePseudoClasses = options.compatibility.selectors.mergeablePseudoClasses; + var mergeablePseudoElements = options.compatibility.selectors.mergeablePseudoElements; for (var i = 0, l = tokens.length; i < l; i++) { var token = tokens[i]; - if (token[0] != 'selector') { + if (token[0] != Token.RULE) { lastToken = [null, [], []]; continue; } - if (lastToken[0] == 'selector' && stringifySelectors(token[1]) == stringifySelectors(lastToken[1])) { - var joinAt = [lastToken[2].length]; + if (lastToken[0] == Token.RULE && serializeRules(token[1]) == serializeRules(lastToken[1])) { Array.prototype.push.apply(lastToken[2], token[2]); - optimizeProperties(token[1], lastToken[2], joinAt, true, options, context); + optimizeProperties(lastToken[2], true, true, context); token[2] = []; - } else if (lastToken[0] == 'selector' && stringifyBody(token[2]) == stringifyBody(lastToken[2]) && - !isSpecial(options, stringifySelectors(token[1])) && !isSpecial(options, stringifySelectors(lastToken[1]))) { - lastToken[1] = cleanUpSelectors(lastToken[1].concat(token[1]), false, adjacentSpace); + } else if (lastToken[0] == Token.RULE && serializeBody(token[2]) == serializeBody(lastToken[2]) && + isMergeable(serializeRules(token[1]), mergeablePseudoClasses, mergeablePseudoElements) && + isMergeable(serializeRules(lastToken[1]), mergeablePseudoClasses, mergeablePseudoElements)) { + lastToken[1] = tidyRules(lastToken[1].concat(token[1]), false, adjacentSpace, false, context.warnings); + lastToken[1] = lastToken.length > 1 ? sortSelectors(lastToken[1], selectorsSortingMethod) : lastToken[1]; token[2] = []; } else { lastToken = token; @@ -5887,23 +5272,33 @@ function mergeAdjacent(tokens, options, context) { module.exports = mergeAdjacent; -},{"../properties/optimizer":21,"../stringifier/one-time":47,"./clean-up":32,"./is-special":34}],36:[function(require,module,exports){ +},{"../../options/optimization-level":63,"../../tokenizer/token":82,"../../writer/one-time":97,"../level-1/sort-selectors":15,"../level-1/tidy-rules":18,"./is-mergeable":25,"./properties/optimize":36}],27:[function(require,module,exports){ var canReorder = require('./reorderable').canReorder; -var extractProperties = require('./extractor'); +var canReorderSingle = require('./reorderable').canReorderSingle; +var extractProperties = require('./extract-properties'); +var rulesOverlap = require('./rules-overlap'); + +var serializeRules = require('../../writer/one-time').rules; +var OptimizationLevel = require('../../options/optimization-level').OptimizationLevel; +var Token = require('../../tokenizer/token'); -function mergeMediaQueries(tokens) { +function mergeMediaQueries(tokens, context) { + var mergeSemantically = context.options.level[OptimizationLevel.Two].mergeSemantically; + var specificityCache = context.cache.specificity; var candidates = {}; var reduced = []; for (var i = tokens.length - 1; i >= 0; i--) { var token = tokens[i]; - if (token[0] != 'block') + if (token[0] != Token.NESTED_BLOCK) { continue; + } - var candidate = candidates[token[1][0]]; + var key = serializeRules(token[1]); + var candidate = candidates[key]; if (!candidate) { candidate = []; - candidates[token[1][0]] = candidate; + candidates[key] = candidate; } candidate.push(i); @@ -5933,7 +5328,11 @@ function mergeMediaQueries(tokens) { var traversedProperties = extractProperties(tokens[from]); from += delta; - if (!canReorder(movedProperties, traversedProperties)) + if (mergeSemantically && allSameRulePropertiesCanBeReordered(movedProperties, traversedProperties, specificityCache)) { + continue; + } + + if (!canReorder(movedProperties, traversedProperties, specificityCache)) continue directionLoop; } @@ -5951,12807 +5350,12036 @@ function mergeMediaQueries(tokens) { return reduced; } -module.exports = mergeMediaQueries; - -},{"./extractor":33,"./reorderable":42}],37:[function(require,module,exports){ -var stringifyBody = require('../stringifier/one-time').body; -var stringifySelectors = require('../stringifier/one-time').selectors; -var cleanUpSelectors = require('./clean-up').selectors; -var isSpecial = require('./is-special'); - -function unsafeSelector(value) { - return /\.|\*| :/.test(value); -} - -function isBemElement(token) { - var asString = stringifySelectors(token[1]); - return asString.indexOf('__') > -1 || asString.indexOf('--') > -1; -} - -function withoutModifier(selector) { - return selector.replace(/--[^ ,>\+~:]+/g, ''); -} - -function removeAnyUnsafeElements(left, candidates) { - var leftSelector = withoutModifier(stringifySelectors(left[1])); - - for (var body in candidates) { - var right = candidates[body]; - var rightSelector = withoutModifier(stringifySelectors(right[1])); - - if (rightSelector.indexOf(leftSelector) > -1 || leftSelector.indexOf(rightSelector) > -1) - delete candidates[body]; - } -} - -function mergeNonAdjacentByBody(tokens, options) { - var candidates = {}; - var adjacentSpace = options.compatibility.selectors.adjacentSpace; - - for (var i = tokens.length - 1; i >= 0; i--) { - var token = tokens[i]; - if (token[0] != 'selector') - continue; - - if (token[2].length > 0 && (!options.semanticMerging && unsafeSelector(stringifySelectors(token[1])))) - candidates = {}; - - if (token[2].length > 0 && options.semanticMerging && isBemElement(token)) - removeAnyUnsafeElements(token, candidates); - - var candidateBody = stringifyBody(token[2]); - var oldToken = candidates[candidateBody]; - if (oldToken && !isSpecial(options, stringifySelectors(token[1])) && !isSpecial(options, stringifySelectors(oldToken[1]))) { - token[1] = token[2].length > 0 ? - cleanUpSelectors(oldToken[1].concat(token[1]), false, adjacentSpace) : - oldToken[1].concat(token[1]); - - oldToken[2] = []; - candidates[candidateBody] = null; - } - - candidates[stringifyBody(token[2])] = token; - } -} - -module.exports = mergeNonAdjacentByBody; - -},{"../stringifier/one-time":47,"./clean-up":32,"./is-special":34}],38:[function(require,module,exports){ -var optimizeProperties = require('../properties/optimizer'); -var stringifySelectors = require('../stringifier/one-time').selectors; -var extractProperties = require('./extractor'); -var canReorder = require('./reorderable').canReorder; - -function mergeNonAdjacentBySelector(tokens, options, context) { - var allSelectors = {}; - var repeatedSelectors = []; - var i; - - for (i = tokens.length - 1; i >= 0; i--) { - if (tokens[i][0] != 'selector') - continue; - if (tokens[i][2].length === 0) - continue; - - var selector = stringifySelectors(tokens[i][1]); - allSelectors[selector] = [i].concat(allSelectors[selector] || []); - - if (allSelectors[selector].length == 2) - repeatedSelectors.push(selector); - } - - for (i = repeatedSelectors.length - 1; i >= 0; i--) { - var positions = allSelectors[repeatedSelectors[i]]; - - selectorIterator: - for (var j = positions.length - 1; j > 0; j--) { - var positionOne = positions[j - 1]; - var tokenOne = tokens[positionOne]; - var positionTwo = positions[j]; - var tokenTwo = tokens[positionTwo]; - - directionIterator: - for (var direction = 1; direction >= -1; direction -= 2) { - var topToBottom = direction == 1; - var from = topToBottom ? positionOne + 1 : positionTwo - 1; - var to = topToBottom ? positionTwo : positionOne; - var delta = topToBottom ? 1 : -1; - var moved = topToBottom ? tokenOne : tokenTwo; - var target = topToBottom ? tokenTwo : tokenOne; - var movedProperties = extractProperties(moved); - var joinAt; - - while (from != to) { - var traversedProperties = extractProperties(tokens[from]); - from += delta; +function allSameRulePropertiesCanBeReordered(movedProperties, traversedProperties, specificityCache) { + var movedProperty; + var movedRule; + var traversedProperty; + var traversedRule; + var i, l; + var j, m; - // traversed then moved as we move selectors towards the start - var reorderable = topToBottom ? - canReorder(movedProperties, traversedProperties) : - canReorder(traversedProperties, movedProperties); - - if (!reorderable && !topToBottom) - continue selectorIterator; - if (!reorderable && topToBottom) - continue directionIterator; - } + for (i = 0, l = movedProperties.length; i < l; i++) { + movedProperty = movedProperties[i]; + movedRule = movedProperty[5]; - if (topToBottom) { - joinAt = [moved[2].length]; - Array.prototype.push.apply(moved[2], target[2]); - target[2] = moved[2]; - } else { - joinAt = [target[2].length]; - Array.prototype.push.apply(target[2], moved[2]); - } + for (j = 0, m = traversedProperties.length; j < m; j++) { + traversedProperty = traversedProperties[i]; + traversedRule = traversedProperty[5]; - optimizeProperties(target[1], target[2], joinAt, true, options, context); - moved[2] = []; + if (rulesOverlap(movedRule, traversedRule, true) && !canReorderSingle(movedProperty, traversedProperty, specificityCache)) { + return false; } } } -} - -module.exports = mergeNonAdjacentBySelector; - -},{"../properties/optimizer":21,"../stringifier/one-time":47,"./extractor":33,"./reorderable":42}],39:[function(require,module,exports){ -var optimizeProperties = require('../properties/optimizer'); -var stringifyBody = require('../stringifier/one-time').body; -var stringifySelectors = require('../stringifier/one-time').selectors; -var isSpecial = require('./is-special'); -var cloneArray = require('../utils/clone-array'); - -function reduceNonAdjacent(tokens, options, context) { - var candidates = {}; - var repeated = []; - - for (var i = tokens.length - 1; i >= 0; i--) { - var token = tokens[i]; - - if (token[0] != 'selector') - continue; - if (token[2].length === 0) - continue; - - var selectorAsString = stringifySelectors(token[1]); - var isComplexAndNotSpecial = token[1].length > 1 && !isSpecial(options, selectorAsString); - var wrappedSelectors = options.sourceMap ? wrappedSelectorsFrom(token[1]) : token[1]; - var selectors = isComplexAndNotSpecial ? - [selectorAsString].concat(wrappedSelectors) : - [selectorAsString]; - - for (var j = 0, m = selectors.length; j < m; j++) { - var selector = selectors[j]; - - if (!candidates[selector]) - candidates[selector] = []; - else - repeated.push(selector); - - candidates[selector].push({ - where: i, - list: wrappedSelectors, - isPartial: isComplexAndNotSpecial && j > 0, - isComplex: isComplexAndNotSpecial && j === 0 - }); - } - } - - reduceSimpleNonAdjacentCases(tokens, repeated, candidates, options, context); - reduceComplexNonAdjacentCases(tokens, candidates, options, context); -} - -function wrappedSelectorsFrom(list) { - var wrapped = []; - - for (var i = 0; i < list.length; i++) { - wrapped.push([list[i][0]]); - } - - return wrapped; -} - -function reduceSimpleNonAdjacentCases(tokens, repeated, candidates, options, context) { - function filterOut(idx, bodies) { - return data[idx].isPartial && bodies.length === 0; - } - - function reduceBody(token, newBody, processedCount, tokenIdx) { - if (!data[processedCount - tokenIdx - 1].isPartial) - token[2] = newBody; - } - - for (var i = 0, l = repeated.length; i < l; i++) { - var selector = repeated[i]; - var data = candidates[selector]; - reduceSelector(tokens, selector, data, { - filterOut: filterOut, - callback: reduceBody - }, options, context); - } + return true; } -function reduceComplexNonAdjacentCases(tokens, candidates, options, context) { - var localContext = {}; - - function filterOut(idx) { - return localContext.data[idx].where < localContext.intoPosition; - } - - function collectReducedBodies(token, newBody, processedCount, tokenIdx) { - if (tokenIdx === 0) - localContext.reducedBodies.push(newBody); - } - - allSelectors: - for (var complexSelector in candidates) { - var into = candidates[complexSelector]; - if (!into[0].isComplex) - continue; - - var intoPosition = into[into.length - 1].where; - var intoToken = tokens[intoPosition]; - var reducedBodies = []; - - var selectors = isSpecial(options, complexSelector) ? - [complexSelector] : - into[0].list; - - localContext.intoPosition = intoPosition; - localContext.reducedBodies = reducedBodies; +module.exports = mergeMediaQueries; - for (var j = 0, m = selectors.length; j < m; j++) { - var selector = selectors[j]; - var data = candidates[selector]; +},{"../../options/optimization-level":63,"../../tokenizer/token":82,"../../writer/one-time":97,"./extract-properties":23,"./reorderable":46,"./rules-overlap":50}],28:[function(require,module,exports){ +var isMergeable = require('./is-mergeable'); - if (data.length < 2) - continue allSelectors; +var sortSelectors = require('../level-1/sort-selectors'); +var tidyRules = require('../level-1/tidy-rules'); - localContext.data = data; +var OptimizationLevel = require('../../options/optimization-level').OptimizationLevel; - reduceSelector(tokens, selector, data, { - filterOut: filterOut, - callback: collectReducedBodies - }, options, context); +var serializeBody = require('../../writer/one-time').body; +var serializeRules = require('../../writer/one-time').rules; - if (stringifyBody(reducedBodies[reducedBodies.length - 1]) != stringifyBody(reducedBodies[0])) - continue allSelectors; - } +var Token = require('../../tokenizer/token'); - intoToken[2] = reducedBodies[0]; - } +function unsafeSelector(value) { + return /\.|\*| :/.test(value); } -function reduceSelector(tokens, selector, data, context, options, outerContext) { - var bodies = []; - var bodiesAsList = []; - var joinsAt = []; - var processedTokens = []; - - for (var j = data.length - 1, m = 0; j >= 0; j--) { - if (context.filterOut(j, bodies)) - continue; - - var where = data[j].where; - var token = tokens[where]; - var clonedBody = cloneArray(token[2]); - - bodies = bodies.concat(clonedBody); - bodiesAsList.push(clonedBody); - processedTokens.push(where); - } - - for (j = 0, m = bodiesAsList.length; j < m; j++) { - if (bodiesAsList[j].length > 0) - joinsAt.push((joinsAt.length > 0 ? joinsAt[joinsAt.length - 1] : 0) + bodiesAsList[j].length); - } - - optimizeProperties(selector, bodies, joinsAt, false, options, outerContext); - - var processedCount = processedTokens.length; - var propertyIdx = bodies.length - 1; - var tokenIdx = processedCount - 1; - - while (tokenIdx >= 0) { - if ((tokenIdx === 0 || (bodies[propertyIdx] && bodiesAsList[tokenIdx].indexOf(bodies[propertyIdx]) > -1)) && propertyIdx > -1) { - propertyIdx--; - continue; - } - - var newBody = bodies.splice(propertyIdx + 1); - context.callback(tokens[processedTokens[tokenIdx]], newBody, processedCount, tokenIdx); +function isBemElement(token) { + var asString = serializeRules(token[1]); + return asString.indexOf('__') > -1 || asString.indexOf('--') > -1; +} - tokenIdx--; - } +function withoutModifier(selector) { + return selector.replace(/--[^ ,>\+~:]+/g, ''); } -module.exports = reduceNonAdjacent; +function removeAnyUnsafeElements(left, candidates) { + var leftSelector = withoutModifier(serializeRules(left[1])); -},{"../properties/optimizer":21,"../stringifier/one-time":47,"../utils/clone-array":61,"./is-special":34}],40:[function(require,module,exports){ -var stringifyAll = require('../stringifier/one-time').all; + for (var body in candidates) { + var right = candidates[body]; + var rightSelector = withoutModifier(serializeRules(right[1])); -function removeDuplicateMediaQueries(tokens) { + if (rightSelector.indexOf(leftSelector) > -1 || leftSelector.indexOf(rightSelector) > -1) + delete candidates[body]; + } +} + +function mergeNonAdjacentByBody(tokens, context) { + var options = context.options; + var mergeSemantically = options.level[OptimizationLevel.Two].mergeSemantically; + var adjacentSpace = options.compatibility.selectors.adjacentSpace; + var selectorsSortingMethod = options.level[OptimizationLevel.One].selectorsSortingMethod; + var mergeablePseudoClasses = options.compatibility.selectors.mergeablePseudoClasses; + var mergeablePseudoElements = options.compatibility.selectors.mergeablePseudoElements; var candidates = {}; - for (var i = 0, l = tokens.length; i < l; i++) { + for (var i = tokens.length - 1; i >= 0; i--) { var token = tokens[i]; - if (token[0] != 'block') + if (token[0] != Token.RULE) continue; - var key = token[1][0] + '%' + stringifyAll(token[2]); - var candidate = candidates[key]; + if (token[2].length > 0 && (!mergeSemantically && unsafeSelector(serializeRules(token[1])))) + candidates = {}; - if (candidate) - candidate[2] = []; + if (token[2].length > 0 && mergeSemantically && isBemElement(token)) + removeAnyUnsafeElements(token, candidates); - candidates[key] = token; + var candidateBody = serializeBody(token[2]); + var oldToken = candidates[candidateBody]; + if (oldToken && + isMergeable(serializeRules(token[1]), mergeablePseudoClasses, mergeablePseudoElements) && + isMergeable(serializeRules(oldToken[1]), mergeablePseudoClasses, mergeablePseudoElements)) { + + if (token[2].length > 0) { + token[1] = tidyRules(oldToken[1].concat(token[1]), false, adjacentSpace, false, context.warnings); + token[1] = token[1].length > 1 ? sortSelectors(token[1], selectorsSortingMethod) : token[1]; + } else { + token[1] = oldToken[1].concat(token[1]); + } + + oldToken[2] = []; + candidates[candidateBody] = null; + } + + candidates[serializeBody(token[2])] = token; } } -module.exports = removeDuplicateMediaQueries; +module.exports = mergeNonAdjacentByBody; -},{"../stringifier/one-time":47}],41:[function(require,module,exports){ -var stringifyBody = require('../stringifier/one-time').body; -var stringifySelectors = require('../stringifier/one-time').selectors; +},{"../../options/optimization-level":63,"../../tokenizer/token":82,"../../writer/one-time":97,"../level-1/sort-selectors":15,"../level-1/tidy-rules":18,"./is-mergeable":25}],29:[function(require,module,exports){ +var canReorder = require('./reorderable').canReorder; +var extractProperties = require('./extract-properties'); -function removeDuplicates(tokens) { - var matched = {}; - var moreThanOnce = []; - var id, token; - var body, bodies; +var optimizeProperties = require('./properties/optimize'); - for (var i = 0, l = tokens.length; i < l; i++) { - token = tokens[i]; - if (token[0] != 'selector') - continue; +var serializeRules = require('../../writer/one-time').rules; - id = stringifySelectors(token[1]); +var Token = require('../../tokenizer/token'); - if (matched[id] && matched[id].length == 1) - moreThanOnce.push(id); - else - matched[id] = matched[id] || []; +function mergeNonAdjacentBySelector(tokens, context) { + var specificityCache = context.cache.specificity; + var allSelectors = {}; + var repeatedSelectors = []; + var i; - matched[id].push(i); + for (i = tokens.length - 1; i >= 0; i--) { + if (tokens[i][0] != Token.RULE) + continue; + if (tokens[i][2].length === 0) + continue; + + var selector = serializeRules(tokens[i][1]); + allSelectors[selector] = [i].concat(allSelectors[selector] || []); + + if (allSelectors[selector].length == 2) + repeatedSelectors.push(selector); } - for (i = 0, l = moreThanOnce.length; i < l; i++) { - id = moreThanOnce[i]; - bodies = []; + for (i = repeatedSelectors.length - 1; i >= 0; i--) { + var positions = allSelectors[repeatedSelectors[i]]; - for (var j = matched[id].length - 1; j >= 0; j--) { - token = tokens[matched[id][j]]; - body = stringifyBody(token[2]); + selectorIterator: + for (var j = positions.length - 1; j > 0; j--) { + var positionOne = positions[j - 1]; + var tokenOne = tokens[positionOne]; + var positionTwo = positions[j]; + var tokenTwo = tokens[positionTwo]; - if (bodies.indexOf(body) > -1) - token[2] = []; - else - bodies.push(body); - } - } -} + directionIterator: + for (var direction = 1; direction >= -1; direction -= 2) { + var topToBottom = direction == 1; + var from = topToBottom ? positionOne + 1 : positionTwo - 1; + var to = topToBottom ? positionTwo : positionOne; + var delta = topToBottom ? 1 : -1; + var moved = topToBottom ? tokenOne : tokenTwo; + var target = topToBottom ? tokenTwo : tokenOne; + var movedProperties = extractProperties(moved); -module.exports = removeDuplicates; + while (from != to) { + var traversedProperties = extractProperties(tokens[from]); + from += delta; -},{"../stringifier/one-time":47}],42:[function(require,module,exports){ -// TODO: it'd be great to merge it with the other canReorder functionality + // traversed then moved as we move selectors towards the start + var reorderable = topToBottom ? + canReorder(movedProperties, traversedProperties, specificityCache) : + canReorder(traversedProperties, movedProperties, specificityCache); -var FLEX_PROPERTIES = /align\-items|box\-align|box\-pack|flex|justify/; -var BORDER_PROPERTIES = /^border\-(top|right|bottom|left|color|style|width|radius)/; + if (!reorderable && !topToBottom) + continue selectorIterator; + if (!reorderable && topToBottom) + continue directionIterator; + } -function canReorder(left, right) { - for (var i = right.length - 1; i >= 0; i--) { - for (var j = left.length - 1; j >= 0; j--) { - if (!canReorderSingle(left[j], right[i])) - return false; + if (topToBottom) { + Array.prototype.push.apply(moved[2], target[2]); + target[2] = moved[2]; + } else { + Array.prototype.push.apply(target[2], moved[2]); + } + + optimizeProperties(target[2], true, true, context); + moved[2] = []; + } } } - - return true; } -function canReorderSingle(left, right) { - var leftName = left[0]; - var leftValue = left[1]; - var leftNameRoot = left[2]; - var leftSelector = left[5]; - var leftInSpecificSelector = left[6]; - var rightName = right[0]; - var rightValue = right[1]; - var rightNameRoot = right[2]; - var rightSelector = right[5]; - var rightInSpecificSelector = right[6]; +module.exports = mergeNonAdjacentBySelector; - if (leftName == 'font' && rightName == 'line-height' || rightName == 'font' && leftName == 'line-height') - return false; - if (FLEX_PROPERTIES.test(leftName) && FLEX_PROPERTIES.test(rightName)) - return false; - if (leftNameRoot == rightNameRoot && unprefixed(leftName) == unprefixed(rightName) && (vendorPrefixed(leftName) ^ vendorPrefixed(rightName))) - return false; - if (leftNameRoot == 'border' && BORDER_PROPERTIES.test(rightNameRoot) && (leftName == 'border' || leftName == rightNameRoot || (leftValue != rightValue && sameBorderComponent(leftName, rightName)))) - return false; - if (rightNameRoot == 'border' && BORDER_PROPERTIES.test(leftNameRoot) && (rightName == 'border' || rightName == leftNameRoot || (leftValue != rightValue && sameBorderComponent(leftName, rightName)))) - return false; - if (leftNameRoot == 'border' && rightNameRoot == 'border' && leftName != rightName && (isSideBorder(leftName) && isStyleBorder(rightName) || isStyleBorder(leftName) && isSideBorder(rightName))) - return false; - if (leftNameRoot != rightNameRoot) - return true; - if (leftName == rightName && leftNameRoot == rightNameRoot && (leftValue == rightValue || withDifferentVendorPrefix(leftValue, rightValue))) - return true; - if (leftName != rightName && leftNameRoot == rightNameRoot && leftName != leftNameRoot && rightName != rightNameRoot) - return true; - if (leftName != rightName && leftNameRoot == rightNameRoot && leftValue == rightValue) - return true; - if (rightInSpecificSelector && leftInSpecificSelector && !inheritable(leftNameRoot) && !inheritable(rightNameRoot) && selectorsDoNotOverlap(rightSelector, leftSelector)) - return true; +},{"../../tokenizer/token":82,"../../writer/one-time":97,"./extract-properties":23,"./properties/optimize":36,"./reorderable":46}],30:[function(require,module,exports){ +var mergeAdjacent = require('./merge-adjacent'); +var mergeMediaQueries = require('./merge-media-queries'); +var mergeNonAdjacentByBody = require('./merge-non-adjacent-by-body'); +var mergeNonAdjacentBySelector = require('./merge-non-adjacent-by-selector'); +var reduceNonAdjacent = require('./reduce-non-adjacent'); +var removeDuplicateFontAtRules = require('./remove-duplicate-font-at-rules'); +var removeDuplicateMediaQueries = require('./remove-duplicate-media-queries'); +var removeDuplicates = require('./remove-duplicates'); +var restructure = require('./restructure'); - return false; -} +var optimizeProperties = require('./properties/optimize'); -function vendorPrefixed(name) { - return /^\-(?:moz|webkit|ms|o)\-/.test(name); -} +var OptimizationLevel = require('../../options/optimization-level').OptimizationLevel; -function unprefixed(name) { - return name.replace(/^\-(?:moz|webkit|ms|o)\-/, ''); -} +var Token = require('../../tokenizer/token'); -function sameBorderComponent(name1, name2) { - return name1.split('-').pop() == name2.split('-').pop(); -} +function removeEmpty(tokens) { + for (var i = 0, l = tokens.length; i < l; i++) { + var token = tokens[i]; + var isEmpty = false; -function isSideBorder(name) { - return name == 'border-top' || name == 'border-right' || name == 'border-bottom' || name == 'border-left'; -} + switch (token[0]) { + case Token.RULE: + isEmpty = token[1].length === 0 || token[2].length === 0; + break; + case Token.NESTED_BLOCK: + removeEmpty(token[2]); + isEmpty = token[2].length === 0; + break; + case Token.AT_RULE_BLOCK: + isEmpty = token[2].length === 0; + } -function isStyleBorder(name) { - return name == 'border-color' || name == 'border-style' || name == 'border-width'; + if (isEmpty) { + tokens.splice(i, 1); + i--; + l--; + } + } } -function withDifferentVendorPrefix(value1, value2) { - return vendorPrefixed(value1) && vendorPrefixed(value2) && value1.split('-')[1] != value2.split('-')[2]; -} +function recursivelyOptimizeBlocks(tokens, context) { + for (var i = 0, l = tokens.length; i < l; i++) { + var token = tokens[i]; -function selectorsDoNotOverlap(s1, s2) { - for (var i = 0, l = s1.length; i < l; i++) { - for (var j = 0, m = s2.length; j < m; j++) { - if (s1[i][0] == s2[j][0]) - return false; + if (token[0] == Token.NESTED_BLOCK) { + var isKeyframes = /@(-moz-|-o-|-webkit-)?keyframes/.test(token[1][0][1]); + level2Optimize(token[2], context, !isKeyframes); } } - - return true; } -function inheritable(name) { - // According to http://www.w3.org/TR/CSS21/propidx.html - // Others will be catched by other, preceeding rules - return name == 'font' || name == 'line-height' || name == 'list-style'; +function recursivelyOptimizeProperties(tokens, context) { + for (var i = 0, l = tokens.length; i < l; i++) { + var token = tokens[i]; + + switch (token[0]) { + case Token.RULE: + optimizeProperties(token[2], true, true, context); + break; + case Token.NESTED_BLOCK: + recursivelyOptimizeProperties(token[2], context); + } + } } -module.exports = { - canReorder: canReorder, - canReorderSingle: canReorderSingle -}; +function level2Optimize(tokens, context, withRestructuring) { + var levelOptions = context.options.level[OptimizationLevel.Two]; + var reduced; + var i; -},{}],43:[function(require,module,exports){ -var extractProperties = require('./extractor'); -var canReorderSingle = require('./reorderable').canReorderSingle; -var stringifyBody = require('../stringifier/one-time').body; -var stringifySelectors = require('../stringifier/one-time').selectors; -var cleanUpSelectorDuplicates = require('./clean-up').selectorDuplicates; -var isSpecial = require('./is-special'); -var cloneArray = require('../utils/clone-array'); + recursivelyOptimizeBlocks(tokens, context); + recursivelyOptimizeProperties(tokens, context); -function naturalSorter(a, b) { - return a > b; -} + if (levelOptions.removeDuplicateRules) { + removeDuplicates(tokens, context); + } -function cloneAndMergeSelectors(propertyA, propertyB) { - var cloned = cloneArray(propertyA); - cloned[5] = cloned[5].concat(propertyB[5]); + if (levelOptions.mergeAdjacentRules) { + mergeAdjacent(tokens, context); + } - return cloned; -} + if (levelOptions.reduceNonAdjacentRules) { + reduceNonAdjacent(tokens, context); + } -function restructure(tokens, options) { - var movableTokens = {}; - var movedProperties = []; - var multiPropertyMoveCache = {}; - var movedToBeDropped = []; - var maxCombinationsLevel = 2; - var ID_JOIN_CHARACTER = '%'; + if (levelOptions.mergeNonAdjacentRules && levelOptions.mergeNonAdjacentRules != 'body') { + mergeNonAdjacentBySelector(tokens, context); + } - function sendToMultiPropertyMoveCache(position, movedProperty, allFits) { - for (var i = allFits.length - 1; i >= 0; i--) { - var fit = allFits[i][0]; - var id = addToCache(movedProperty, fit); + if (levelOptions.mergeNonAdjacentRules && levelOptions.mergeNonAdjacentRules != 'selector') { + mergeNonAdjacentByBody(tokens, context); + } - if (multiPropertyMoveCache[id].length > 1 && processMultiPropertyMove(position, multiPropertyMoveCache[id])) { - removeAllMatchingFromCache(id); - break; - } - } + if (levelOptions.restructureRules && levelOptions.mergeAdjacentRules && withRestructuring) { + restructure(tokens, context); + mergeAdjacent(tokens, context); } - function addToCache(movedProperty, fit) { - var id = cacheId(fit); - multiPropertyMoveCache[id] = multiPropertyMoveCache[id] || []; - multiPropertyMoveCache[id].push([movedProperty, fit]); - return id; + if (levelOptions.restructureRules && !levelOptions.mergeAdjacentRules && withRestructuring) { + restructure(tokens, context); + } + + if (levelOptions.removeDuplicateFontRules) { + removeDuplicateFontAtRules(tokens, context); } - function removeAllMatchingFromCache(matchId) { - var matchSelectors = matchId.split(ID_JOIN_CHARACTER); - var forRemoval = []; - var i; + if (levelOptions.removeDuplicateMediaBlocks) { + removeDuplicateMediaQueries(tokens, context); + } - for (var id in multiPropertyMoveCache) { - var selectors = id.split(ID_JOIN_CHARACTER); - for (i = selectors.length - 1; i >= 0; i--) { - if (matchSelectors.indexOf(selectors[i]) > -1) { - forRemoval.push(id); - break; - } - } + if (levelOptions.mergeMedia) { + reduced = mergeMediaQueries(tokens, context); + for (i = reduced.length - 1; i >= 0; i--) { + level2Optimize(reduced[i][2], context, false); } + } - for (i = forRemoval.length - 1; i >= 0; i--) { - delete multiPropertyMoveCache[forRemoval[i]]; + removeEmpty(tokens); + + return tokens; +} + +module.exports = level2Optimize; + +},{"../../options/optimization-level":63,"../../tokenizer/token":82,"./merge-adjacent":26,"./merge-media-queries":27,"./merge-non-adjacent-by-body":28,"./merge-non-adjacent-by-selector":29,"./properties/optimize":36,"./reduce-non-adjacent":42,"./remove-duplicate-font-at-rules":43,"./remove-duplicate-media-queries":44,"./remove-duplicates":45,"./restructure":49}],31:[function(require,module,exports){ +var Marker = require('../../../tokenizer/marker'); + +function everyValuesPair(fn, left, right) { + var leftSize = left.value.length; + var rightSize = right.value.length; + var total = Math.max(leftSize, rightSize); + var lowerBound = Math.min(leftSize, rightSize) - 1; + var leftValue; + var rightValue; + var position; + + for (position = 0; position < total; position++) { + leftValue = left.value[position] && left.value[position][1] || leftValue; + rightValue = right.value[position] && right.value[position][1] || rightValue; + + if (leftValue == Marker.COMMA || rightValue == Marker.COMMA) { + continue; } - } - function cacheId(cachedTokens) { - var id = []; - for (var i = 0, l = cachedTokens.length; i < l; i++) { - id.push(stringifySelectors(cachedTokens[i][1])); + if (!fn(leftValue, rightValue, position, position <= lowerBound)) { + return false; } - return id.join(ID_JOIN_CHARACTER); } - function tokensToMerge(sourceTokens) { - var uniqueTokensWithBody = []; - var mergeableTokens = []; + return true; +} - for (var i = sourceTokens.length - 1; i >= 0; i--) { - if (isSpecial(options, stringifySelectors(sourceTokens[i][1]))) - continue; +module.exports = everyValuesPair; - mergeableTokens.unshift(sourceTokens[i]); - if (sourceTokens[i][2].length > 0 && uniqueTokensWithBody.indexOf(sourceTokens[i]) == -1) - uniqueTokensWithBody.push(sourceTokens[i]); - } +},{"../../../tokenizer/marker":81}],32:[function(require,module,exports){ +var compactable = require('../compactable'); - return uniqueTokensWithBody.length > 1 ? - mergeableTokens : - []; - } +function findComponentIn(shorthand, longhand) { + var comparator = nameComparator(longhand); - function shortenIfPossible(position, movedProperty) { - var name = movedProperty[0]; - var value = movedProperty[1]; - var key = movedProperty[4]; - var valueSize = name.length + value.length + 1; - var allSelectors = []; - var qualifiedTokens = []; + return findInDirectComponents(shorthand, comparator) || findInSubComponents(shorthand, comparator); +} - var mergeableTokens = tokensToMerge(movableTokens[key]); - if (mergeableTokens.length < 2) - return; +function nameComparator(to) { + return function (property) { + return to.name === property.name; + }; +} - var allFits = findAllFits(mergeableTokens, valueSize, 1); - var bestFit = allFits[0]; - if (bestFit[1] > 0) - return sendToMultiPropertyMoveCache(position, movedProperty, allFits); +function findInDirectComponents(shorthand, comparator) { + return shorthand.components.filter(comparator)[0]; +} - for (var i = bestFit[0].length - 1; i >=0; i--) { - allSelectors = bestFit[0][i][1].concat(allSelectors); - qualifiedTokens.unshift(bestFit[0][i]); - } +function findInSubComponents(shorthand, comparator) { + var shorthandComponent; + var longhandMatch; + var i, l; - allSelectors = cleanUpSelectorDuplicates(allSelectors); - dropAsNewTokenAt(position, [movedProperty], allSelectors, qualifiedTokens); + if (!compactable[shorthand.name].shorthandComponents) { + return; } - function fitSorter(fit1, fit2) { - return fit1[1] > fit2[1]; - } + for (i = 0, l = shorthand.components.length; i < l; i++) { + shorthandComponent = shorthand.components[i]; + longhandMatch = findInDirectComponents(shorthandComponent, comparator); - function findAllFits(mergeableTokens, propertySize, propertiesCount) { - var combinations = allCombinations(mergeableTokens, propertySize, propertiesCount, maxCombinationsLevel - 1); - return combinations.sort(fitSorter); + if (longhandMatch) { + return longhandMatch; + } } - function allCombinations(tokensVariant, propertySize, propertiesCount, level) { - var differenceVariants = [[tokensVariant, sizeDifference(tokensVariant, propertySize, propertiesCount)]]; - if (tokensVariant.length > 2 && level > 0) { - for (var i = tokensVariant.length - 1; i >= 0; i--) { - var subVariant = Array.prototype.slice.call(tokensVariant, 0); - subVariant.splice(i, 1); - differenceVariants = differenceVariants.concat(allCombinations(subVariant, propertySize, propertiesCount, level - 1)); - } - } + return; +} - return differenceVariants; - } +module.exports = findComponentIn; - function sizeDifference(tokensVariant, propertySize, propertiesCount) { - var allSelectorsSize = 0; - for (var i = tokensVariant.length - 1; i >= 0; i--) { - allSelectorsSize += tokensVariant[i][2].length > propertiesCount ? stringifySelectors(tokensVariant[i][1]).length : -1; - } - return allSelectorsSize - (tokensVariant.length - 1) * propertySize + 1; +},{"../compactable":22}],33:[function(require,module,exports){ +function hasInherit(property) { + for (var i = property.value.length - 1; i >= 0; i--) { + if (property.value[i][1] == 'inherit') + return true; } - function dropAsNewTokenAt(position, properties, allSelectors, mergeableTokens) { - var i, j, k, m; - var allProperties = []; + return false; +} - for (i = mergeableTokens.length - 1; i >= 0; i--) { - var mergeableToken = mergeableTokens[i]; +module.exports = hasInherit; - for (j = mergeableToken[2].length - 1; j >= 0; j--) { - var mergeableProperty = mergeableToken[2][j]; +},{}],34:[function(require,module,exports){ +var compactable = require('../compactable'); - for (k = 0, m = properties.length; k < m; k++) { - var property = properties[k]; +function isComponentOf(property1, property2, shallow) { + return isDirectComponentOf(property1, property2) || + !shallow && !!compactable[property1.name].shorthandComponents && isSubComponentOf(property1, property2); +} - var mergeablePropertyName = mergeableProperty[0][0]; - var propertyName = property[0]; - var propertyBody = property[4]; - if (mergeablePropertyName == propertyName && stringifyBody([mergeableProperty]) == propertyBody) { - mergeableToken[2].splice(j, 1); - break; - } - } - } - } +function isDirectComponentOf(property1, property2) { + var descriptor = compactable[property1.name]; - for (i = properties.length - 1; i >= 0; i--) { - allProperties.unshift(properties[i][3]); - } + return 'components' in descriptor && descriptor.components.indexOf(property2.name) > -1; +} - var newToken = ['selector', allSelectors, allProperties]; - tokens.splice(position, 0, newToken); +function isSubComponentOf(property1, property2) { + return property1 + .components + .some(function (component) { + return isDirectComponentOf(component, property2); + }); +} + +module.exports = isComponentOf; + +},{"../compactable":22}],35:[function(require,module,exports){ +var everyValuesPair = require('./every-values-pair'); +var hasInherit = require('./has-inherit'); +var populateComponents = require('./populate-components'); + +var compactable = require('../compactable'); +var deepClone = require('../clone').deep; + +var wrapSingle = require('../../wrap-for-optimizing').single; + +var Token = require('../../../tokenizer/token'); + +function mixedImportance(components) { + var important; + + for (var name in components) { + if (undefined !== important && components[name].important != important) + return true; + + important = components[name].important; } - function dropPropertiesAt(position, movedProperty) { - var key = movedProperty[4]; - var toMove = movableTokens[key]; + return false; +} - if (toMove && toMove.length > 1) { - if (!shortenMultiMovesIfPossible(position, movedProperty)) - shortenIfPossible(position, movedProperty); - } +function joinMetadata(components, at) { + var metadata = []; + var component; + var originalValue; + var componentMetadata; + var name; + + for (name in components) { + component = components[name]; + originalValue = component.all[component.position]; + componentMetadata = originalValue[at][originalValue[at].length - 1]; + + Array.prototype.push.apply(metadata, componentMetadata); } - function shortenMultiMovesIfPossible(position, movedProperty) { - var candidates = []; - var propertiesAndMergableTokens = []; - var key = movedProperty[4]; - var j, k; + return metadata; +} - var mergeableTokens = tokensToMerge(movableTokens[key]); - if (mergeableTokens.length < 2) - return; +function replaceWithShorthand(properties, candidateComponents, name, validator) { + var descriptor = compactable[name]; + var nameMetadata; + var valueMetadata; + var newValuePlaceholder = [ + Token.PROPERTY, + [Token.PROPERTY_NAME, name], + [Token.PROPERTY_VALUE, descriptor.defaultValue] + ]; + var mayOverride; + var all; - movableLoop: - for (var value in movableTokens) { - var tokensList = movableTokens[value]; + var newProperty = wrapSingle(newValuePlaceholder); + newProperty.shorthand = true; + newProperty.dirty = true; - for (j = mergeableTokens.length - 1; j >= 0; j--) { - if (tokensList.indexOf(mergeableTokens[j]) == -1) - continue movableLoop; - } + populateComponents([newProperty], validator, []); - candidates.push(value); - } + for (var i = 0, l = descriptor.components.length; i < l; i++) { + var component = candidateComponents[descriptor.components[i]]; - if (candidates.length < 2) - return false; + if (hasInherit(component)) + return; - for (j = candidates.length - 1; j >= 0; j--) { - for (k = movedProperties.length - 1; k >= 0; k--) { - if (movedProperties[k][4] == candidates[j]) { - propertiesAndMergableTokens.unshift([movedProperties[k], mergeableTokens]); - break; - } - } - } + mayOverride = compactable[component.name].canOverride; + if (!everyValuesPair(mayOverride.bind(null, validator), newProperty.components[i], component)) + return; - return processMultiPropertyMove(position, propertiesAndMergableTokens); - } + newProperty.components[i] = deepClone(component); + newProperty.important = component.important; - function processMultiPropertyMove(position, propertiesAndMergableTokens) { - var valueSize = 0; - var properties = []; - var property; + all = component.all; + } - for (var i = propertiesAndMergableTokens.length - 1; i >= 0; i--) { - property = propertiesAndMergableTokens[i][0]; - var fullValue = property[4]; - valueSize += fullValue.length + (i > 0 ? 1 : 0); + for (var componentName in candidateComponents) { + candidateComponents[componentName].unused = true; + } - properties.push(property); - } + nameMetadata = joinMetadata(candidateComponents, 1); + newValuePlaceholder[1].push(nameMetadata); - var mergeableTokens = propertiesAndMergableTokens[0][1]; - var bestFit = findAllFits(mergeableTokens, valueSize, properties.length)[0]; - if (bestFit[1] > 0) - return false; + valueMetadata = joinMetadata(candidateComponents, 2); + newValuePlaceholder[2].push(valueMetadata); - var allSelectors = []; - var qualifiedTokens = []; - for (i = bestFit[0].length - 1; i >= 0; i--) { - allSelectors = bestFit[0][i][1].concat(allSelectors); - qualifiedTokens.unshift(bestFit[0][i]); - } + newProperty.position = all.length; + newProperty.all = all; + newProperty.all.push(newValuePlaceholder); - allSelectors = cleanUpSelectorDuplicates(allSelectors); - dropAsNewTokenAt(position, properties, allSelectors, qualifiedTokens); + properties.push(newProperty); +} - for (i = properties.length - 1; i >= 0; i--) { - property = properties[i]; - var index = movedProperties.indexOf(property); +function invalidateOrCompact(properties, position, candidates, validator) { + var property = properties[position]; - delete movableTokens[property[4]]; + for (var name in candidates) { + if (undefined !== property && name == property.name) + continue; - if (index > -1 && movedToBeDropped.indexOf(index) == -1) - movedToBeDropped.push(index); + var descriptor = compactable[name]; + var candidateComponents = candidates[name]; + if (descriptor.components.length > Object.keys(candidateComponents).length) { + delete candidates[name]; + continue; } - return true; + if (mixedImportance(candidateComponents)) + continue; + + replaceWithShorthand(properties, candidateComponents, name, validator); } +} + +function mergeIntoShorthands(properties, validator) { + var candidates = {}; + var descriptor; + var componentOf; + var property; + var i, l; + var j, m; + + if (properties.length < 3) + return; - function boundToAnotherPropertyInCurrrentToken(property, movedProperty, token) { - var propertyName = property[0]; - var movedPropertyName = movedProperty[0]; - if (propertyName != movedPropertyName) - return false; + for (i = 0, l = properties.length; i < l; i++) { + property = properties[i]; - var key = movedProperty[4]; - var toMove = movableTokens[key]; - return toMove && toMove.indexOf(token) > -1; - } + if (property.unused) + continue; - for (var i = tokens.length - 1; i >= 0; i--) { - var token = tokens[i]; - var isSelector; - var j, k, m; - var samePropertyAt; + if (property.hack) + continue; - if (token[0] == 'selector') { - isSelector = true; - } else if (token[0] == 'block') { - isSelector = false; - } else { + if (property.block) continue; - } - // We cache movedProperties.length as it may change in the loop - var movedCount = movedProperties.length; + descriptor = compactable[property.name]; + if (!descriptor || !descriptor.componentOf) + continue; - var properties = extractProperties(token); - movedToBeDropped = []; + if (property.shorthand) { + invalidateOrCompact(properties, i, candidates, validator); + } else { + for (j = 0, m = descriptor.componentOf.length; j < m; j++) { + componentOf = descriptor.componentOf[j]; - var unmovableInCurrentToken = []; - for (j = properties.length - 1; j >= 0; j--) { - for (k = j - 1; k >= 0; k--) { - if (!canReorderSingle(properties[j], properties[k])) { - unmovableInCurrentToken.push(j); - break; - } + candidates[componentOf] = candidates[componentOf] || {}; + candidates[componentOf][property.name] = property; } } + } - for (j = properties.length - 1; j >= 0; j--) { - var property = properties[j]; - var movedSameProperty = false; - - for (k = 0; k < movedCount; k++) { - var movedProperty = movedProperties[k]; + invalidateOrCompact(properties, i, candidates, validator); +} - if (movedToBeDropped.indexOf(k) == -1 && !canReorderSingle(property, movedProperty) && !boundToAnotherPropertyInCurrrentToken(property, movedProperty, token)) { - dropPropertiesAt(i + 1, movedProperty, token); +module.exports = mergeIntoShorthands; - if (movedToBeDropped.indexOf(k) == -1) { - movedToBeDropped.push(k); - delete movableTokens[movedProperty[4]]; - } - } +},{"../../../tokenizer/token":82,"../../wrap-for-optimizing":57,"../clone":21,"../compactable":22,"./every-values-pair":31,"./has-inherit":33,"./populate-components":39}],36:[function(require,module,exports){ +var mergeIntoShorthands = require('./merge-into-shorthands'); +var overrideProperties = require('./override-properties'); +var populateComponents = require('./populate-components'); - if (!movedSameProperty) { - movedSameProperty = property[0] == movedProperty[0] && property[1] == movedProperty[1]; +var restoreWithComponents = require('../restore-with-components'); - if (movedSameProperty) { - samePropertyAt = k; - } - } - } +var wrapForOptimizing = require('../../wrap-for-optimizing').all; +var removeUnused = require('../../remove-unused'); +var restoreFromOptimizing = require('../../restore-from-optimizing'); - if (!isSelector || unmovableInCurrentToken.indexOf(j) > -1) - continue; +var OptimizationLevel = require('../../../options/optimization-level').OptimizationLevel; - var key = property[4]; - movableTokens[key] = movableTokens[key] || []; - movableTokens[key].push(token); +function optimizeProperties(properties, withOverriding, withMerging, context) { + var _properties = wrapForOptimizing(properties, false); + var _property; + var i, l; - if (movedSameProperty) { - movedProperties[samePropertyAt] = cloneAndMergeSelectors(movedProperties[samePropertyAt], property); - } else { - movedProperties.push(property); - } - } + populateComponents(_properties, context.validator, context.warnings); - movedToBeDropped = movedToBeDropped.sort(naturalSorter); - for (j = 0, m = movedToBeDropped.length; j < m; j++) { - var dropAt = movedToBeDropped[j] - j; - movedProperties.splice(dropAt, 1); + for (i = 0, l = _properties.length; i < l; i++) { + _property = _properties[i]; + if (_property.block) { + optimizeProperties(_property.value[0][1], withOverriding, withMerging, context); } } - var position = tokens[0] && tokens[0][0] == 'at-rule' && tokens[0][1][0].indexOf('@charset') === 0 ? 1 : 0; - for (; position < tokens.length - 1; position++) { - var isImportRule = tokens[position][0] === 'at-rule' && tokens[position][1][0].indexOf('@import') === 0; - var isEscapedCommentSpecial = tokens[position][0] === 'text' && tokens[position][1][0].indexOf('__ESCAPED_COMMENT_SPECIAL') === 0; - if (!(isImportRule || isEscapedCommentSpecial)) - break; + if (withOverriding && context.options.level[OptimizationLevel.Two].overrideProperties) { + overrideProperties(_properties, withMerging, context.options.compatibility, context.validator); } - for (i = 0; i < movedProperties.length; i++) { - dropPropertiesAt(position, movedProperties[i]); + if (withMerging && context.options.level[OptimizationLevel.Two].mergeIntoShorthands) { + mergeIntoShorthands(_properties, context.validator); } + + restoreFromOptimizing(_properties, restoreWithComponents); + removeUnused(_properties); } -module.exports = restructure; +module.exports = optimizeProperties; -},{"../stringifier/one-time":47,"../utils/clone-array":61,"./clean-up":32,"./extractor":33,"./is-special":34,"./reorderable":42}],44:[function(require,module,exports){ -var cleanUpSelectors = require('./clean-up').selectors; -var cleanUpBlock = require('./clean-up').block; -var cleanUpAtRule = require('./clean-up').atRule; -var split = require('../utils/split'); +},{"../../../options/optimization-level":63,"../../remove-unused":54,"../../restore-from-optimizing":55,"../../wrap-for-optimizing":57,"../restore-with-components":47,"./merge-into-shorthands":35,"./override-properties":37,"./populate-components":39}],37:[function(require,module,exports){ +var hasInherit = require('./has-inherit'); +var everyValuesPair = require('./every-values-pair'); +var findComponentIn = require('./find-component-in'); +var isComponentOf = require('./is-component-of'); +var overridesNonComponentShorthand = require('./overrides-non-component-shorthand'); +var sameVendorPrefixesIn = require('./vendor-prefixes').same; -var RGB = require('../colors/rgb'); -var HSL = require('../colors/hsl'); -var HexNameShortener = require('../colors/hex-name-shortener'); +var compactable = require('../compactable'); +var deepClone = require('../clone').deep; +var deepClone = require('../clone').deep; +var restoreWithComponents = require('../restore-with-components'); +var shallowClone = require('../clone').shallow; -var wrapForOptimizing = require('../properties/wrap-for-optimizing').all; -var restoreFromOptimizing = require('../properties/restore-from-optimizing'); -var removeUnused = require('../properties/remove-unused'); +var restoreFromOptimizing = require('../../restore-from-optimizing', restoreWithComponents); -var DEFAULT_ROUNDING_PRECISION = 2; -var CHARSET_TOKEN = '@charset'; -var CHARSET_REGEXP = new RegExp('^' + CHARSET_TOKEN, 'i'); +var Token = require('../../../tokenizer/token'); +var Marker = require('../../../tokenizer/marker'); -var FONT_NUMERAL_WEIGHTS = ['100', '200', '300', '400', '500', '600', '700', '800', '900']; -var FONT_NAME_WEIGHTS = ['normal', 'bold', 'bolder', 'lighter']; -var FONT_NAME_WEIGHTS_WITHOUT_NORMAL = ['bold', 'bolder', 'lighter']; +var serializeProperty = require('../../../writer/one-time').property; -var WHOLE_PIXEL_VALUE = /(?:^|\s|\()(-?\d+)px/; -var TIME_VALUE = /^(\-?[\d\.]+)(m?s)$/; +function wouldBreakCompatibility(property, validator) { + for (var i = 0; i < property.components.length; i++) { + var component = property.components[i]; + var descriptor = compactable[component.name]; + var canOverride = descriptor && descriptor.canOverride || canOverride.sameValue; -var valueMinifiers = { - 'background': function (value, index, total) { - return index === 0 && total == 1 && (value == 'none' || value == 'transparent') ? '0 0' : value; - }, - 'font-weight': function (value) { - if (value == 'normal') - return '400'; - else if (value == 'bold') - return '700'; - else - return value; - }, - 'outline': function (value, index, total) { - return index === 0 && total == 1 && value == 'none' ? '0' : value; + var _component = shallowClone(component); + _component.value = [[Token.PROPERTY_VALUE, descriptor.defaultValue]]; + + if (!everyValuesPair(canOverride.bind(null, validator), _component, component)) { + return true; + } } -}; -function isNegative(property, idx) { - return property.value[idx] && property.value[idx][0][0] == '-' && parseFloat(property.value[idx][0]) < 0; + return false; } -function zeroMinifier(name, value) { - if (value.indexOf('0') == -1) - return value; +function overrideIntoMultiplex(property, by) { + by.unused = true; - if (value.indexOf('-') > -1) { - value = value - .replace(/([^\w\d\-]|^)\-0([^\.]|$)/g, '$10$2') - .replace(/([^\w\d\-]|^)\-0([^\.]|$)/g, '$10$2'); - } + turnIntoMultiplex(by, multiplexSize(property)); + property.value = by.value; +} - return value - .replace(/(^|\s)0+([1-9])/g, '$1$2') - .replace(/(^|\D)\.0+(\D|$)/g, '$10$2') - .replace(/(^|\D)\.0+(\D|$)/g, '$10$2') - .replace(/\.([1-9]*)0+(\D|$)/g, function (match, nonZeroPart, suffix) { - return (nonZeroPart.length > 0 ? '.' : '') + nonZeroPart + suffix; - }) - .replace(/(^|\D)0\.(\d)/g, '$1.$2'); +function overrideByMultiplex(property, by) { + by.unused = true; + property.multiplex = true; + property.value = by.value; } -function zeroDegMinifier(_, value) { - if (value.indexOf('0deg') == -1) - return value; +function overrideSimple(property, by) { + by.unused = true; + property.value = by.value; +} - return value.replace(/\(0deg\)/g, '(0)'); +function override(property, by) { + if (by.multiplex) + overrideByMultiplex(property, by); + else if (property.multiplex) + overrideIntoMultiplex(property, by); + else + overrideSimple(property, by); } -function whitespaceMinifier(name, value) { - if (name.indexOf('filter') > -1 || value.indexOf(' ') == -1) - return value; +function overrideShorthand(property, by) { + by.unused = true; - value = value.replace(/\s+/g, ' '); + for (var i = 0, l = property.components.length; i < l; i++) { + override(property.components[i], by.components[i], property.multiplex); + } +} - if (value.indexOf('calc') > -1) - value = value.replace(/\) ?\/ ?/g, ')/ '); +function turnIntoMultiplex(property, size) { + property.multiplex = true; - return value - .replace(/\( /g, '(') - .replace(/ \)/g, ')') - .replace(/, /g, ','); -} + for (var i = 0, l = property.components.length; i < l; i++) { + var component = property.components[i]; + if (component.multiplex) + continue; -function precisionMinifier(_, value, precisionOptions) { - if (precisionOptions.value === -1 || value.indexOf('.') === -1) - return value; + var value = component.value.slice(0); - return value - .replace(precisionOptions.regexp, function (match, number) { - return Math.round(parseFloat(number) * precisionOptions.multiplier) / precisionOptions.multiplier + 'px'; - }) - .replace(/(\d)\.($|\D)/g, '$1$2'); + for (var j = 1; j < size; j++) { + component.value.push([Token.PROPERTY_VALUE, Marker.COMMA]); + Array.prototype.push.apply(component.value, value); + } + } } -function unitMinifier(name, value, unitsRegexp) { - if (/^(?:\-moz\-calc|\-webkit\-calc|calc)\(/.test(value)) - return value; +function multiplexSize(component) { + var size = 0; - if (name == 'flex' || name == '-ms-flex' || name == '-webkit-flex' || name == 'flex-basis' || name == '-webkit-flex-basis') - return value; + for (var i = 0, l = component.value.length; i < l; i++) { + if (component.value[i][1] == Marker.COMMA) + size++; + } - if (value.indexOf('%') > 0 && (name == 'height' || name == 'max-height')) - return value; + return size + 1; +} - return value - .replace(unitsRegexp, '$1' + '0' + '$2') - .replace(unitsRegexp, '$1' + '0' + '$2'); +function lengthOf(property) { + var fakeAsArray = [ + Token.PROPERTY, + [Token.PROPERTY_NAME, property.name] + ].concat(property.value); + return serializeProperty([fakeAsArray], 0).length; } -function multipleZerosMinifier(property) { - var values = property.value; - var spliceAt; +function moreSameShorthands(properties, startAt, name) { + // Since we run the main loop in `compactOverrides` backwards, at this point some + // properties may not be marked as unused. + // We should consider reverting the order if possible + var count = 0; - if (values.length == 4 && values[0][0] === '0' && values[1][0] === '0' && values[2][0] === '0' && values[3][0] === '0') { - if (property.name.indexOf('box-shadow') > -1) - spliceAt = 2; - else - spliceAt = 1; + for (var i = startAt; i >= 0; i--) { + if (properties[i].name == name && !properties[i].unused) + count++; + if (count > 1) + break; } - if (spliceAt) { - property.value.splice(spliceAt); - property.dirty = true; - } + return count > 1; } -function colorMininifier(name, value, compatibility) { - if (value.indexOf('#') === -1 && value.indexOf('rgb') == -1 && value.indexOf('hsl') == -1) - return HexNameShortener.shorten(value); - - value = value - .replace(/rgb\((\-?\d+),(\-?\d+),(\-?\d+)\)/g, function (match, red, green, blue) { - return new RGB(red, green, blue).toHex(); - }) - .replace(/hsl\((-?\d+),(-?\d+)%?,(-?\d+)%?\)/g, function (match, hue, saturation, lightness) { - return new HSL(hue, saturation, lightness).toHex(); - }) - .replace(/(^|[^='"])#([0-9a-f]{6})/gi, function (match, prefix, color) { - if (color[0] == color[1] && color[2] == color[3] && color[4] == color[5]) - return prefix + '#' + color[0] + color[2] + color[4]; - else - return prefix + '#' + color; - }) - .replace(/(rgb|rgba|hsl|hsla)\(([^\)]+)\)/g, function (match, colorFunction, colorDef) { - var tokens = colorDef.split(','); - var applies = (colorFunction == 'hsl' && tokens.length == 3) || - (colorFunction == 'hsla' && tokens.length == 4) || - (colorFunction == 'rgb' && tokens.length == 3 && colorDef.indexOf('%') > 0) || - (colorFunction == 'rgba' && tokens.length == 4 && colorDef.indexOf('%') > 0); - if (!applies) - return match; +function overridingFunction(shorthand, validator) { + for (var i = 0, l = shorthand.components.length; i < l; i++) { + if (anyValue(validator.isValidFunction, shorthand.components[i])) + return true; + } - if (tokens[1].indexOf('%') == -1) - tokens[1] += '%'; - if (tokens[2].indexOf('%') == -1) - tokens[2] += '%'; - return colorFunction + '(' + tokens.join(',') + ')'; - }); + return false; +} - if (compatibility.colors.opacity && name.indexOf('background') == -1) { - value = value.replace(/(?:rgba|hsla)\(0,0%?,0%?,0\)/g, function (match) { - if (split(value, ',').pop().indexOf('gradient(') > -1) - return match; +function anyValue(fn, property) { + for (var i = 0, l = property.value.length; i < l; i++) { + if (property.value[i][1] == Marker.COMMA) + continue; - return 'transparent'; - }); + if (fn(property.value[i][1])) + return true; } - return HexNameShortener.shorten(value); + return false; } -function pixelLengthMinifier(_, value, compatibility) { - if (!WHOLE_PIXEL_VALUE.test(value)) - return value; +function wouldResultInLongerValue(left, right) { + if (!left.multiplex && !right.multiplex || left.multiplex && right.multiplex) + return false; - return value.replace(WHOLE_PIXEL_VALUE, function (match, val) { - var newValue; - var intVal = parseInt(val); + var multiplex = left.multiplex ? left : right; + var simple = left.multiplex ? right : left; + var component; - if (intVal === 0) - return match; + var multiplexClone = deepClone(multiplex); + restoreFromOptimizing([multiplexClone], restoreWithComponents); + + var simpleClone = deepClone(simple); + restoreFromOptimizing([simpleClone], restoreWithComponents); + + var lengthBefore = lengthOf(multiplexClone) + 1 + lengthOf(simpleClone); + + if (left.multiplex) { + component = findComponentIn(multiplexClone, simpleClone); + overrideIntoMultiplex(component, simpleClone); + } else { + component = findComponentIn(simpleClone, multiplexClone); + turnIntoMultiplex(simpleClone, multiplexSize(multiplexClone)); + overrideByMultiplex(component, multiplexClone); + } - if (compatibility.properties.shorterLengthUnits && compatibility.units.pt && intVal * 3 % 4 === 0) - newValue = intVal * 3 / 4 + 'pt'; + restoreFromOptimizing([simpleClone], restoreWithComponents); - if (compatibility.properties.shorterLengthUnits && compatibility.units.pc && intVal % 16 === 0) - newValue = intVal / 16 + 'pc'; + var lengthAfter = lengthOf(simpleClone); - if (compatibility.properties.shorterLengthUnits && compatibility.units.in && intVal % 96 === 0) - newValue = intVal / 96 + 'in'; + return lengthBefore <= lengthAfter; +} - if (newValue) - newValue = match.substring(0, match.indexOf(val)) + newValue; +function isCompactable(property) { + return property.name in compactable; +} - return newValue && newValue.length < match.length ? newValue : match; - }); +function noneOverrideHack(left, right) { + return !left.multiplex && + (left.name == 'background' || left.name == 'background-image') && + right.multiplex && + (right.name == 'background' || right.name == 'background-image') && + anyLayerIsNone(right.value); } -function timeUnitMinifier(_, value) { - if (!TIME_VALUE.test(value)) - return value; +function anyLayerIsNone(values) { + var layers = intoLayers(values); - return value.replace(TIME_VALUE, function (match, val, unit) { - var newValue; + for (var i = 0, l = layers.length; i < l; i++) { + if (layers[i].length == 1 && layers[i][0][1] == 'none') + return true; + } - if (unit == 'ms') { - newValue = parseInt(val) / 1000 + 's'; - } else if (unit == 's') { - newValue = parseFloat(val) * 1000 + 'ms'; + return false; +} + +function intoLayers(values) { + var layers = []; + + for (var i = 0, layer = [], l = values.length; i < l; i++) { + var value = values[i]; + if (value[1] == Marker.COMMA) { + layers.push(layer); + layer = []; + } else { + layer.push(value); } + } - return newValue.length < match.length ? newValue : match; - }); + layers.push(layer); + return layers; } -function minifyBorderRadius(property) { - var values = property.value; - var spliceAt; +function overrideProperties(properties, withMerging, compatibility, validator) { + var mayOverride, right, left, component; + var overriddenComponents; + var overriddenComponent; + var overridingComponent; + var overridable; + var i, j, k; - if (values.length == 3 && values[1][0] == '/' && values[0][0] == values[2][0]) - spliceAt = 1; - else if (values.length == 5 && values[2][0] == '/' && values[0][0] == values[3][0] && values[1][0] == values[4][0]) - spliceAt = 2; - else if (values.length == 7 && values[3][0] == '/' && values[0][0] == values[4][0] && values[1][0] == values[5][0] && values[2][0] == values[6][0]) - spliceAt = 3; - else if (values.length == 9 && values[4][0] == '/' && values[0][0] == values[5][0] && values[1][0] == values[6][0] && values[2][0] == values[7][0] && values[3][0] == values[8][0]) - spliceAt = 4; + propertyLoop: + for (i = properties.length - 1; i >= 0; i--) { + right = properties[i]; - if (spliceAt) { - property.value.splice(spliceAt); - property.dirty = true; - } -} + if (!isCompactable(right)) + continue; -function minifyFilter(property) { - if (property.value.length == 1) { - property.value[0][0] = property.value[0][0].replace(/progid:DXImageTransform\.Microsoft\.(Alpha|Chroma)(\W)/, function (match, filter, suffix) { - return filter.toLowerCase() + suffix; - }); - } + if (right.block) + continue; - property.value[0][0] = property.value[0][0] - .replace(/,(\S)/g, ', $1') - .replace(/ ?= ?/g, '='); -} + mayOverride = compactable[right.name].canOverride; -function minifyFont(property) { - var values = property.value; - var hasNumeral = FONT_NUMERAL_WEIGHTS.indexOf(values[0][0]) > -1 || - values[1] && FONT_NUMERAL_WEIGHTS.indexOf(values[1][0]) > -1 || - values[2] && FONT_NUMERAL_WEIGHTS.indexOf(values[2][0]) > -1; + traverseLoop: + for (j = i - 1; j >= 0; j--) { + left = properties[j]; - if (hasNumeral) - return; + if (!isCompactable(left)) + continue; - if (values[1] == '/') - return; + if (left.block) + continue; - var normalCount = 0; - if (values[0][0] == 'normal') - normalCount++; - if (values[1] && values[1][0] == 'normal') - normalCount++; - if (values[2] && values[2][0] == 'normal') - normalCount++; + if (left.unused || right.unused) + continue; - if (normalCount > 1) - return; + if (left.hack && !right.hack && !right.important || !left.hack && !left.important && right.hack) + continue; - var toOptimize; - if (FONT_NAME_WEIGHTS_WITHOUT_NORMAL.indexOf(values[0][0]) > -1) - toOptimize = 0; - else if (values[1] && FONT_NAME_WEIGHTS_WITHOUT_NORMAL.indexOf(values[1][0]) > -1) - toOptimize = 1; - else if (values[2] && FONT_NAME_WEIGHTS_WITHOUT_NORMAL.indexOf(values[2][0]) > -1) - toOptimize = 2; - else if (FONT_NAME_WEIGHTS.indexOf(values[0][0]) > -1) - toOptimize = 0; - else if (values[1] && FONT_NAME_WEIGHTS.indexOf(values[1][0]) > -1) - toOptimize = 1; - else if (values[2] && FONT_NAME_WEIGHTS.indexOf(values[2][0]) > -1) - toOptimize = 2; + if (left.important == right.important && left.hack != right.hack) + continue; - if (toOptimize !== undefined) { - property.value[toOptimize][0] = valueMinifiers['font-weight'](values[toOptimize][0]); - property.dirty = true; - } -} + if (hasInherit(right)) + continue; -function optimizeBody(properties, options) { - var property, name, value; - var _properties = wrapForOptimizing(properties); + if (noneOverrideHack(left, right)) + continue; - for (var i = 0, l = _properties.length; i < l; i++) { - property = _properties[i]; - name = property.name; + if (right.shorthand && isComponentOf(right, left)) { + // maybe `left` can be overridden by `right` which is a shorthand? + if (!right.important && left.important) + continue; - if (property.hack && ( - (property.hack == 'star' || property.hack == 'underscore') && !options.compatibility.properties.iePrefixHack || - property.hack == 'backslash' && !options.compatibility.properties.ieSuffixHack || - property.hack == 'bang' && !options.compatibility.properties.ieBangHack)) - property.unused = true; + if (!sameVendorPrefixesIn([left], right.components)) + continue; - if (name.indexOf('padding') === 0 && (isNegative(property, 0) || isNegative(property, 1) || isNegative(property, 2) || isNegative(property, 3))) - property.unused = true; + if (!anyValue(validator.isValidFunction, left) && overridingFunction(right, validator)) + continue; - if (property.unused) - continue; + component = findComponentIn(right, left); + mayOverride = compactable[left.name].canOverride; + if (everyValuesPair(mayOverride.bind(null, validator), left, component)) { + left.unused = true; + } + } else if (right.shorthand && overridesNonComponentShorthand(right, left)) { + // `right` is a shorthand while `left` can be overriden by it, think `border` and `border-top` + if (!right.important && left.important) { + continue; + } - if (property.variable) { - if (property.block) - optimizeBody(property.value[0], options); - continue; - } + if (!sameVendorPrefixesIn([left], right.components)) { + continue; + } - for (var j = 0, m = property.value.length; j < m; j++) { - value = property.value[j][0]; - - if (valueMinifiers[name]) - value = valueMinifiers[name](value, j, m); - - value = whitespaceMinifier(name, value); - value = precisionMinifier(name, value, options.precision); - value = pixelLengthMinifier(name, value, options.compatibility); - value = timeUnitMinifier(name, value); - value = zeroMinifier(name, value); - if (options.compatibility.properties.zeroUnits) { - value = zeroDegMinifier(name, value); - value = unitMinifier(name, value, options.unitsRegexp); - } - if (options.compatibility.properties.colors) - value = colorMininifier(name, value, options.compatibility); + if (!anyValue(validator.isValidFunction, left) && overridingFunction(right, validator)) { + continue; + } - property.value[j][0] = value; - } + overriddenComponents = left.shorthand ? + left.components: + [left]; - multipleZerosMinifier(property); + for (k = overriddenComponents.length - 1; k >= 0; k--) { + overriddenComponent = overriddenComponents[k]; + overridingComponent = findComponentIn(right, overriddenComponent); + mayOverride = compactable[overriddenComponent.name].canOverride; - if (name.indexOf('border') === 0 && name.indexOf('radius') > 0) - minifyBorderRadius(property); - else if (name == 'filter') - minifyFilter(property); - else if (name == 'font') - minifyFont(property); - } + if (!everyValuesPair(mayOverride.bind(null, validator), left, overridingComponent)) { + continue traverseLoop; + } + } - restoreFromOptimizing(_properties, true); - removeUnused(_properties); -} + left.unused = true; + } else if (withMerging && left.shorthand && !right.shorthand && isComponentOf(left, right, true)) { + // maybe `right` can be pulled into `left` which is a shorthand? + if (right.important && !left.important) + continue; -function cleanupCharsets(tokens) { - var hasCharset = false; + if (!right.important && left.important) { + right.unused = true; + continue; + } - for (var i = 0, l = tokens.length; i < l; i++) { - var token = tokens[i]; + // Pending more clever algorithm in #527 + if (moreSameShorthands(properties, i - 1, left.name)) + continue; - if (token[0] != 'at-rule') - continue; + if (overridingFunction(left, validator)) + continue; - if (!CHARSET_REGEXP.test(token[1][0])) - continue; + component = findComponentIn(left, right); + if (everyValuesPair(mayOverride.bind(null, validator), component, right)) { + var disabledBackgroundMerging = + !compatibility.properties.backgroundClipMerging && component.name.indexOf('background-clip') > -1 || + !compatibility.properties.backgroundOriginMerging && component.name.indexOf('background-origin') > -1 || + !compatibility.properties.backgroundSizeMerging && component.name.indexOf('background-size') > -1; + var nonMergeableValue = compactable[right.name].nonMergeableValue === right.value[0][1]; - if (hasCharset || token[1][0].indexOf(CHARSET_TOKEN) == -1) { - tokens.splice(i, 1); - i--; - l--; - } else { - hasCharset = true; - tokens.splice(i, 1); - tokens.unshift(['at-rule', [token[1][0].replace(CHARSET_REGEXP, CHARSET_TOKEN)]]); - } - } -} + if (disabledBackgroundMerging || nonMergeableValue) + continue; -function buildUnitRegexp(options) { - var units = ['px', 'em', 'ex', 'cm', 'mm', 'in', 'pt', 'pc', '%']; - var otherUnits = ['ch', 'rem', 'vh', 'vm', 'vmax', 'vmin', 'vw']; + if (!compatibility.properties.merging && wouldBreakCompatibility(left, validator)) + continue; - otherUnits.forEach(function (unit) { - if (options.compatibility.units[unit]) - units.push(unit); - }); + if (component.value[0][1] != right.value[0][1] && (hasInherit(left) || hasInherit(right))) + continue; - return new RegExp('(^|\\s|\\(|,)0(?:' + units.join('|') + ')(\\W|$)', 'g'); -} + if (wouldResultInLongerValue(left, right)) + continue; + + if (!left.multiplex && right.multiplex) + turnIntoMultiplex(left, multiplexSize(right)); -function buildPrecision(options) { - var precision = {}; + override(component, right); + left.dirty = true; + } + } else if (withMerging && left.shorthand && right.shorthand && left.name == right.name) { + // merge if all components can be merged - precision.value = options.roundingPrecision === undefined ? - DEFAULT_ROUNDING_PRECISION : - options.roundingPrecision; - precision.multiplier = Math.pow(10, precision.value); - precision.regexp = new RegExp('(\\d*\\.\\d{' + (precision.value + 1) + ',})px', 'g'); + if (!left.multiplex && right.multiplex) + continue; - return precision; -} + if (!right.important && left.important) { + right.unused = true; + continue propertyLoop; + } -function optimize(tokens, options) { - var ie7Hack = options.compatibility.selectors.ie7Hack; - var adjacentSpace = options.compatibility.selectors.adjacentSpace; - var spaceAfterClosingBrace = options.compatibility.properties.spaceAfterClosingBrace; - var mayHaveCharset = false; + if (right.important && !left.important) { + left.unused = true; + continue; + } - options.unitsRegexp = buildUnitRegexp(options); - options.precision = buildPrecision(options); + for (k = left.components.length - 1; k >= 0; k--) { + var leftComponent = left.components[k]; + var rightComponent = right.components[k]; - for (var i = 0, l = tokens.length; i < l; i++) { - var token = tokens[i]; + mayOverride = compactable[leftComponent.name].canOverride; + if (!everyValuesPair(mayOverride.bind(null, validator), leftComponent, rightComponent)) + continue propertyLoop; + } - switch (token[0]) { - case 'selector': - token[1] = cleanUpSelectors(token[1], !ie7Hack, adjacentSpace); - optimizeBody(token[2], options); - break; - case 'block': - cleanUpBlock(token[1], spaceAfterClosingBrace); - optimize(token[2], options); - break; - case 'flat-block': - cleanUpBlock(token[1], spaceAfterClosingBrace); - optimizeBody(token[2], options); - break; - case 'at-rule': - cleanUpAtRule(token[1]); - mayHaveCharset = true; - } + overrideShorthand(left, right); + left.dirty = true; + } else if (withMerging && left.shorthand && right.shorthand && isComponentOf(left, right)) { + // border is a shorthand but any of its components is a shorthand too - if (token[1].length === 0 || (token[2] && token[2].length === 0)) { - tokens.splice(i, 1); - i--; - l--; - } - } + if (!left.important && right.important) + continue; - if (mayHaveCharset) - cleanupCharsets(tokens); -} + component = findComponentIn(left, right); + mayOverride = compactable[right.name].canOverride; + if (!everyValuesPair(mayOverride.bind(null, validator), component, right)) + continue; -module.exports = optimize; + if (left.important && !right.important) { + right.unused = true; + continue; + } -},{"../colors/hex-name-shortener":10,"../colors/hsl":11,"../colors/rgb":12,"../properties/remove-unused":24,"../properties/restore-from-optimizing":25,"../properties/wrap-for-optimizing":30,"../utils/split":68,"./clean-up":32}],45:[function(require,module,exports){ -var escapePrefix = '__ESCAPED_'; + var rightRestored = compactable[right.name].restore(right, compactable); + if (rightRestored.length > 1) + continue; -function trackPrefix(value, context, interestingContent) { - if (!interestingContent && value.indexOf('\n') == -1) { - if (value.indexOf(escapePrefix) === 0) { - return value; - } else { - context.column += value.length; - return; - } - } + component = findComponentIn(left, right); + override(component, right); + right.dirty = true; + } else if (left.name == right.name) { + // two non-shorthands should be merged based on understandability + overridable = true; - var withoutContent = 0; - var split = value.split('\n'); - var total = split.length; - var shift = 0; + if (right.shorthand) { + for (k = right.components.length - 1; k >= 0 && overridable; k--) { + overriddenComponent = left.components[k]; + overridingComponent = right.components[k]; + mayOverride = compactable[overridingComponent.name].canOverride; - while (true) { - if (withoutContent == total - 1) - break; + overridable = overridable && everyValuesPair(mayOverride.bind(null, validator), overriddenComponent, overridingComponent); + } + } else { + mayOverride = compactable[right.name].canOverride; + overridable = everyValuesPair(mayOverride.bind(null, validator), left, right); + } - var part = split[withoutContent]; - if (/\S/.test(part)) - break; + if (left.important && !right.important && overridable) { + right.unused = true; + continue; + } - shift += part.length + 1; - withoutContent++; - } + if (!left.important && right.important && overridable) { + left.unused = true; + continue; + } - context.line += withoutContent; - context.column = withoutContent > 0 ? 0 : context.column; - context.column += /^(\s)*/.exec(split[withoutContent])[0].length; + if (!overridable) { + continue; + } - return value.substring(shift).trimLeft(); + left.unused = true; + } + } + } } -function sourceFor(originalMetadata, contextMetadata, context) { - var source = originalMetadata.source || contextMetadata.source; +module.exports = overrideProperties; - if (source && context.resolvePath) - return context.resolvePath(contextMetadata.source, source); +},{"../../../tokenizer/marker":81,"../../../tokenizer/token":82,"../../../writer/one-time":97,"../../restore-from-optimizing":55,"../clone":21,"../compactable":22,"../restore-with-components":47,"./every-values-pair":31,"./find-component-in":32,"./has-inherit":33,"./is-component-of":34,"./overrides-non-component-shorthand":38,"./vendor-prefixes":41}],38:[function(require,module,exports){ +var compactable = require('../compactable'); - return source; +function overridesNonComponentShorthand(property1, property2) { + return property1.name in compactable && + 'overridesShorthands' in compactable[property1.name] && + compactable[property1.name].overridesShorthands.indexOf(property2.name) > -1; } -function snapshot(data, context, fallbacks) { - var metadata = { - line: context.line, - column: context.column, - source: context.source - }; - var sourceContent = null; - var sourceMetadata = context.sourceMapTracker.isTracking(metadata.source) ? - context.sourceMapTracker.originalPositionFor(metadata, data, fallbacks || 0) : - {}; - - metadata.line = sourceMetadata.line || metadata.line; - metadata.column = sourceMetadata.column || metadata.column; - metadata.source = sourceMetadata.sourceResolved ? - sourceMetadata.source : - sourceFor(sourceMetadata, metadata, context); - - if (context.sourceMapInlineSources) { - var sourceMapSourcesContent = context.sourceMapTracker.sourcesContentFor(context.source); - sourceContent = sourceMapSourcesContent && sourceMapSourcesContent[metadata.source] ? - sourceMapSourcesContent : - context.sourceReader.sourceAt(context.source); - } +module.exports = overridesNonComponentShorthand; - return sourceContent ? - [metadata.line, metadata.column, metadata.source, sourceContent] : - [metadata.line, metadata.column, metadata.source]; -} +},{"../compactable":22}],39:[function(require,module,exports){ +var compactable = require('../compactable'); +var InvalidPropertyError = require('../invalid-property-error'); -function trackSuffix(data, context) { - var parts = data.split('\n'); +function populateComponents(properties, validator, warnings) { + var component; + var j, m; - for (var i = 0, l = parts.length; i < l; i++) { - var part = parts[i]; - var cursor = 0; + for (var i = properties.length - 1; i >= 0; i--) { + var property = properties[i]; + var descriptor = compactable[property.name]; - if (i > 0) { - context.line++; - context.column = 0; - } + if (descriptor && descriptor.shorthand) { + property.shorthand = true; + property.dirty = true; - while (true) { - var next = part.indexOf(escapePrefix, cursor); + try { + property.components = descriptor.breakUp(property, compactable, validator); - if (next == -1) { - context.column += part.substring(cursor).length; - break; + if (descriptor.shorthandComponents) { + for (j = 0, m = property.components.length; j < m; j++) { + component = property.components[j]; + component.components = compactable[component.name].breakUp(component, compactable, validator); + } + } + } catch (e) { + if (e instanceof InvalidPropertyError) { + property.components = []; // this will set property.unused to true below + warnings.push(e.message); + } else { + throw e; + } } - context.column += next - cursor; - cursor += next - cursor; - - var escaped = part.substring(next, part.indexOf('__', next + 1) + 2); - var encodedValues = escaped.substring(escaped.indexOf('(') + 1, escaped.indexOf(')')).split(','); - context.line += ~~encodedValues[0]; - context.column = (~~encodedValues[0] === 0 ? context.column : 0) + ~~encodedValues[1]; - cursor += escaped.length; + if (property.components.length > 0) + property.multiplex = property.components[0].multiplex; + else + property.unused = true; } } } -function track(data, context, snapshotMetadata, fallbacks) { - var untracked = trackPrefix(data, context, snapshotMetadata); - var metadata = snapshotMetadata ? - snapshot(untracked, context, fallbacks) : - []; +module.exports = populateComponents; - if (untracked) - trackSuffix(untracked, context); +},{"../compactable":22,"../invalid-property-error":24}],40:[function(require,module,exports){ +var sameVendorPrefixes = require('./vendor-prefixes').same; - return metadata; +function understandable(validator, value1, value2, _position, isPaired) { + if (!sameVendorPrefixes(value1, value2)) { + return false; + } + + if (isPaired && validator.isValidVariable(value1) !== validator.isValidVariable(value2)) { + return false; + } + + return true; } -module.exports = track; +module.exports = understandable; -},{}],46:[function(require,module,exports){ -var lineBreak = require('os').EOL; +},{"./vendor-prefixes":41}],41:[function(require,module,exports){ +var VENDOR_PREFIX_PATTERN = /(?:^|\W)(\-\w+\-)/g; -var AT_RULE = 'at-rule'; -var PROPERTY_SEPARATOR = ';'; +function unique(value) { + var prefixes = []; + var match; -function hasMoreProperties(tokens, index) { - for (var i = index, l = tokens.length; i < l; i++) { - if (typeof tokens[i] != 'string') - return true; + while ((match = VENDOR_PREFIX_PATTERN.exec(value)) !== null) { + if (prefixes.indexOf(match[0]) == -1) { + prefixes.push(match[0]); + } } - return false; + return prefixes; } -function supportsAfterClosingBrace(token) { - return token[0][0] == 'background' || token[0][0] == 'transform' || token[0][0] == 'src'; +function same(value1, value2) { + return unique(value1).sort().join(',') == unique(value2).sort().join(','); } -function afterClosingBrace(token, valueIndex) { - return token[valueIndex][0][token[valueIndex][0].length - 1] == ')' || token[valueIndex][0].indexOf('__ESCAPED_URL_CLEAN_CSS') === 0; -} +module.exports = { + unique: unique, + same: same +}; -function afterComma(token, valueIndex) { - return token[valueIndex][0] == ','; -} +},{}],42:[function(require,module,exports){ +var isMergeable = require('./is-mergeable'); -function afterSlash(token, valueIndex) { - return token[valueIndex][0] == '/'; -} +var optimizeProperties = require('./properties/optimize'); -function beforeComma(token, valueIndex) { - return token[valueIndex + 1] && token[valueIndex + 1][0] == ','; -} +var cloneArray = require('../../utils/clone-array'); -function beforeSlash(token, valueIndex) { - return token[valueIndex + 1] && token[valueIndex + 1][0] == '/'; -} +var Token = require('../../tokenizer/token'); -function inFilter(token) { - return token[0][0] == 'filter' || token[0][0] == '-ms-filter'; -} +var serializeBody = require('../../writer/one-time').body; +var serializeRules = require('../../writer/one-time').rules; -function inSpecialContext(token, valueIndex, context) { - return !context.spaceAfterClosingBrace && supportsAfterClosingBrace(token) && afterClosingBrace(token, valueIndex) || - beforeSlash(token, valueIndex) || - afterSlash(token, valueIndex) || - beforeComma(token, valueIndex) || - afterComma(token, valueIndex); -} +function reduceNonAdjacent(tokens, context) { + var options = context.options; + var mergeablePseudoClasses = options.compatibility.selectors.mergeablePseudoClasses; + var mergeablePseudoElements = options.compatibility.selectors.mergeablePseudoElements; + var candidates = {}; + var repeated = []; -function selectors(tokens, context) { - var store = context.store; + for (var i = tokens.length - 1; i >= 0; i--) { + var token = tokens[i]; - for (var i = 0, l = tokens.length; i < l; i++) { - store(tokens[i], context); + if (token[0] != Token.RULE) { + continue; + } else if (token[2].length === 0) { + continue; + } - if (i < l - 1) - store(',', context); - } -} + var selectorAsString = serializeRules(token[1]); + var isComplexAndNotSpecial = token[1].length > 1 && + isMergeable(selectorAsString, mergeablePseudoClasses, mergeablePseudoElements); + var wrappedSelectors = wrappedSelectorsFrom(token[1]); + var selectors = isComplexAndNotSpecial ? + [selectorAsString].concat(wrappedSelectors) : + [selectorAsString]; -function body(tokens, context) { - for (var i = 0, l = tokens.length; i < l; i++) { - property(tokens, i, i == l - 1, context); - } -} + for (var j = 0, m = selectors.length; j < m; j++) { + var selector = selectors[j]; -function property(tokens, position, isLast, context) { - var store = context.store; - var token = tokens[position]; + if (!candidates[selector]) + candidates[selector] = []; + else + repeated.push(selector); - if (typeof token == 'string') { - store(token, context); - } else if (token[0] == AT_RULE) { - propertyAtRule(token[1], isLast, context); - } else { - store(token[0], context); - store(':', context); - value(tokens, position, isLast, context); + candidates[selector].push({ + where: i, + list: wrappedSelectors, + isPartial: isComplexAndNotSpecial && j > 0, + isComplex: isComplexAndNotSpecial && j === 0 + }); + } } -} - -function propertyAtRule(value, isLast, context) { - var store = context.store; - store(value, context); - if (!isLast) - store(PROPERTY_SEPARATOR, context); + reduceSimpleNonAdjacentCases(tokens, repeated, candidates, options, context); + reduceComplexNonAdjacentCases(tokens, candidates, options, context); } -function value(tokens, position, isLast, context) { - var store = context.store; - var token = tokens[position]; - var isVariableDeclaration = token[0][0].indexOf('--') === 0; - var isBlockVariable = isVariableDeclaration && Array.isArray(token[1][0]); +function wrappedSelectorsFrom(list) { + var wrapped = []; - if (isVariableDeclaration && isBlockVariable && atRulesOrProperties(token[1])) { - store('{', context); - body(token[1], context); - store('};', context); - return; + for (var i = 0; i < list.length; i++) { + wrapped.push([list[i][1]]); } - for (var j = 1, m = token.length; j < m; j++) { - store(token[j], context); - - if (j < m - 1 && (inFilter(token) || !inSpecialContext(token, j, context))) { - store(' ', context); - } else if (j == m - 1 && !isLast && hasMoreProperties(tokens, position + 1)) { - store(PROPERTY_SEPARATOR, context); - } - } + return wrapped; } -function atRulesOrProperties(values) { - for (var i = 0, l = values.length; i < l; i++) { - if (values[i][0] == AT_RULE || Array.isArray(values[i][0])) - return true; +function reduceSimpleNonAdjacentCases(tokens, repeated, candidates, options, context) { + function filterOut(idx, bodies) { + return data[idx].isPartial && bodies.length === 0; } - return false; -} - -function all(tokens, context) { - var joinCharacter = context.keepBreaks ? lineBreak : ''; - var store = context.store; + function reduceBody(token, newBody, processedCount, tokenIdx) { + if (!data[processedCount - tokenIdx - 1].isPartial) + token[2] = newBody; + } - for (var i = 0, l = tokens.length; i < l; i++) { - var token = tokens[i]; + for (var i = 0, l = repeated.length; i < l; i++) { + var selector = repeated[i]; + var data = candidates[selector]; - switch (token[0]) { - case 'at-rule': - case 'text': - store(token[1][0], context); - store(joinCharacter, context); - break; - case 'block': - selectors([token[1]], context); - store('{', context); - all(token[2], context); - store('}', context); - store(joinCharacter, context); - break; - case 'flat-block': - selectors([token[1]], context); - store('{', context); - body(token[2], context); - store('}', context); - store(joinCharacter, context); - break; - default: - selectors(token[1], context); - store('{', context); - body(token[2], context); - store('}', context); - store(joinCharacter, context); - } + reduceSelector(tokens, data, { + filterOut: filterOut, + callback: reduceBody + }, options, context); } } -module.exports = { - all: all, - body: body, - property: property, - selectors: selectors, - value: value -}; - -},{"os":78}],47:[function(require,module,exports){ -var helpers = require('./helpers'); - -function store(token, context) { - context.output.push(typeof token == 'string' ? token : token[0]); -} +function reduceComplexNonAdjacentCases(tokens, candidates, options, context) { + var mergeablePseudoClasses = options.compatibility.selectors.mergeablePseudoClasses; + var mergeablePseudoElements = options.compatibility.selectors.mergeablePseudoElements; + var localContext = {}; -function context() { - return { - output: [], - store: store - }; -} + function filterOut(idx) { + return localContext.data[idx].where < localContext.intoPosition; + } -function all(tokens) { - var fakeContext = context(); - helpers.all(tokens, fakeContext); - return fakeContext.output.join(''); -} + function collectReducedBodies(token, newBody, processedCount, tokenIdx) { + if (tokenIdx === 0) + localContext.reducedBodies.push(newBody); + } -function body(tokens) { - var fakeContext = context(); - helpers.body(tokens, fakeContext); - return fakeContext.output.join(''); -} + allSelectors: + for (var complexSelector in candidates) { + var into = candidates[complexSelector]; + if (!into[0].isComplex) + continue; -function property(tokens, position) { - var fakeContext = context(); - helpers.property(tokens, position, true, fakeContext); - return fakeContext.output.join(''); -} + var intoPosition = into[into.length - 1].where; + var intoToken = tokens[intoPosition]; + var reducedBodies = []; -function selectors(tokens) { - var fakeContext = context(); - helpers.selectors(tokens, fakeContext); - return fakeContext.output.join(''); -} + var selectors = isMergeable(complexSelector, mergeablePseudoClasses, mergeablePseudoElements) ? + into[0].list : + [complexSelector]; -function value(tokens, position) { - var fakeContext = context(); - helpers.value(tokens, position, true, fakeContext); - return fakeContext.output.join(''); -} + localContext.intoPosition = intoPosition; + localContext.reducedBodies = reducedBodies; -module.exports = { - all: all, - body: body, - property: property, - selectors: selectors, - value: value -}; + for (var j = 0, m = selectors.length; j < m; j++) { + var selector = selectors[j]; + var data = candidates[selector]; -},{"./helpers":46}],48:[function(require,module,exports){ -var all = require('./helpers').all; + if (data.length < 2) + continue allSelectors; -function store(token, context) { - context.output.push(typeof token == 'string' ? token : token[0]); -} + localContext.data = data; -function stringify(tokens, options, restoreCallback) { - var context = { - keepBreaks: options.keepBreaks, - output: [], - spaceAfterClosingBrace: options.compatibility.properties.spaceAfterClosingBrace, - store: store - }; + reduceSelector(tokens, data, { + filterOut: filterOut, + callback: collectReducedBodies + }, options, context); - all(tokens, context, false); + if (serializeBody(reducedBodies[reducedBodies.length - 1]) != serializeBody(reducedBodies[0])) + continue allSelectors; + } - return { - styles: restoreCallback(context.output.join('')).trim() - }; + intoToken[2] = reducedBodies[0]; + } } -module.exports = stringify; +function reduceSelector(tokens, data, context, options, outerContext) { + var bodies = []; + var bodiesAsList = []; + var processedTokens = []; -},{"./helpers":46}],49:[function(require,module,exports){ -(function (process){ -var SourceMapGenerator = require('source-map').SourceMapGenerator; -var all = require('./helpers').all; + for (var j = data.length - 1; j >= 0; j--) { + if (context.filterOut(j, bodies)) + continue; -var isWindows = process.platform == 'win32'; -var unknownSource = '$stdin'; + var where = data[j].where; + var token = tokens[where]; + var clonedBody = cloneArray(token[2]); -function store(element, context) { - var fromString = typeof element == 'string'; - var value = fromString ? element : element[0]; + bodies = bodies.concat(clonedBody); + bodiesAsList.push(clonedBody); + processedTokens.push(where); + } - if (value.indexOf('_') > -1) - value = context.restore(value, prefixContentFrom(context.output)); + optimizeProperties(bodies, true, false, outerContext); - track(value, fromString ? null : element, context); - context.output.push(value); -} + var processedCount = processedTokens.length; + var propertyIdx = bodies.length - 1; + var tokenIdx = processedCount - 1; -function prefixContentFrom(values) { - var content = []; + while (tokenIdx >= 0) { + if ((tokenIdx === 0 || (bodies[propertyIdx] && bodiesAsList[tokenIdx].indexOf(bodies[propertyIdx]) > -1)) && propertyIdx > -1) { + propertyIdx--; + continue; + } - for (var i = values.length - 1; i >= 0; i--) { - var value = values[i]; - content.unshift(value); + var newBody = bodies.splice(propertyIdx + 1); + context.callback(tokens[processedTokens[tokenIdx]], newBody, processedCount, tokenIdx); - if (value == '{' || value == ';') - break; + tokenIdx--; } - - return content.join(''); } -function track(value, element, context) { - if (element) - trackAllMappings(element, context); - - var parts = value.split('\n'); - context.line += parts.length - 1; - context.column = parts.length > 1 ? 0 : (context.column + parts.pop().length); -} +module.exports = reduceNonAdjacent; -function trackAllMappings(element, context) { - var mapping = element[element.length - 1]; +},{"../../tokenizer/token":82,"../../utils/clone-array":84,"../../writer/one-time":97,"./is-mergeable":25,"./properties/optimize":36}],43:[function(require,module,exports){ +var Token = require('../../tokenizer/token'); - if (!Array.isArray(mapping)) - return; +var serializeAll = require('../../writer/one-time').all; - for (var i = 0, l = mapping.length; i < l; i++) { - trackMapping(mapping[i], context); - } -} +var FONT_FACE_SCOPE = '@font-face'; -function trackMapping(mapping, context) { - var source = mapping[2] || unknownSource; +function removeDuplicateFontAtRules(tokens) { + var fontAtRules = []; + var token; + var key; + var i, l; - if (isWindows) - source = source.replace(/\\/g, '/'); + for (i = 0, l = tokens.length; i < l; i++) { + token = tokens[i]; - context.outputMap.addMapping({ - generated: { - line: context.line, - column: context.column - }, - source: source, - original: { - line: mapping[0], - column: mapping[1] + if (token[0] != Token.AT_RULE_BLOCK && token[1][0][1] != FONT_FACE_SCOPE) { + continue; } - }); - if (mapping[3]) - context.outputMap.setSourceContent(source, mapping[3][mapping[2]]); -} + key = serializeAll([token]); -function stringify(tokens, options, restoreCallback, inputMapTracker) { - var context = { - column: 0, - inputMapTracker: inputMapTracker, - keepBreaks: options.keepBreaks, - line: 1, - output: [], - outputMap: new SourceMapGenerator(), - restore: restoreCallback, - sourceMapInlineSources: options.sourceMapInlineSources, - spaceAfterClosingBrace: options.compatibility.properties.spaceAfterClosingBrace, - store: store - }; + if (fontAtRules.indexOf(key) > -1) { + token[2] = []; + } else { + fontAtRules.push(key); + } + } +} - all(tokens, context, false); +module.exports = removeDuplicateFontAtRules; - return { - sourceMap: context.outputMap, - styles: context.output.join('').trim() - }; -} +},{"../../tokenizer/token":82,"../../writer/one-time":97}],44:[function(require,module,exports){ +var Token = require('../../tokenizer/token'); -module.exports = stringify; +var serializeAll = require('../../writer/one-time').all; +var serializeRules = require('../../writer/one-time').rules; -}).call(this,require('_process')) -},{"./helpers":46,"_process":81,"source-map":110}],50:[function(require,module,exports){ -var EscapeStore = require('./escape-store'); -var QuoteScanner = require('../utils/quote-scanner'); +function removeDuplicateMediaQueries(tokens) { + var candidates = {}; + var candidate; + var token; + var key; + var i, l; -var SPECIAL_COMMENT_PREFIX = '/*!'; -var COMMENT_PREFIX = '/*'; -var COMMENT_SUFFIX = '*/'; + for (i = 0, l = tokens.length; i < l; i++) { + token = tokens[i]; + if (token[0] != Token.NESTED_BLOCK) { + continue; + } -var lineBreak = require('os').EOL; + key = serializeRules(token[1]) + '%' + serializeAll(token[2]); + candidate = candidates[key]; -function CommentsProcessor(context, keepSpecialComments, keepBreaks, saveWaypoints) { - this.comments = new EscapeStore('COMMENT'); - this.specialComments = new EscapeStore('COMMENT_SPECIAL'); + if (candidate) { + candidate[2] = []; + } - this.context = context; - this.restored = 0; - this.keepAll = keepSpecialComments == '*'; - this.keepOne = keepSpecialComments == '1' || keepSpecialComments === 1; - this.keepBreaks = keepBreaks; - this.saveWaypoints = saveWaypoints; + candidates[key] = token; + } } -function quoteScannerFor(data) { - var quoteMap = []; - new QuoteScanner(data).each(function (quotedString, _, startsAt) { - quoteMap.push([startsAt, startsAt + quotedString.length]); - }); +module.exports = removeDuplicateMediaQueries; - return function (position) { - for (var i = 0, l = quoteMap.length; i < l; i++) { - if (quoteMap[i][0] < position && quoteMap[i][1] > position) - return true; - } +},{"../../tokenizer/token":82,"../../writer/one-time":97}],45:[function(require,module,exports){ +var Token = require('../../tokenizer/token'); - return false; - }; -} +var serializeBody = require('../../writer/one-time').body; +var serializeRules = require('../../writer/one-time').rules; -CommentsProcessor.prototype.escape = function (data) { - var tempData = []; - var nextStart = 0; - var nextEnd = 0; - var cursor = 0; - var indent = 0; - var breaksCount; - var lastBreakAt; - var newIndent; - var isQuotedAt = quoteScannerFor(data); - var saveWaypoints = this.saveWaypoints; - - for (; nextEnd < data.length;) { - nextStart = data.indexOf(COMMENT_PREFIX, cursor); - if (nextStart == -1) - break; +function removeDuplicates(tokens) { + var matched = {}; + var moreThanOnce = []; + var id, token; + var body, bodies; - if (isQuotedAt(nextStart)) { - tempData.push(data.substring(cursor, nextStart + COMMENT_PREFIX.length)); - cursor = nextStart + COMMENT_PREFIX.length; + for (var i = 0, l = tokens.length; i < l; i++) { + token = tokens[i]; + if (token[0] != Token.RULE) continue; - } - nextEnd = data.indexOf(COMMENT_SUFFIX, nextStart + COMMENT_PREFIX.length); - if (nextEnd == -1) { - this.context.warnings.push('Broken comment: \'' + data.substring(nextStart) + '\'.'); - nextEnd = data.length - 2; - } + id = serializeRules(token[1]); - tempData.push(data.substring(cursor, nextStart)); + if (matched[id] && matched[id].length == 1) + moreThanOnce.push(id); + else + matched[id] = matched[id] || []; - var comment = data.substring(nextStart, nextEnd + COMMENT_SUFFIX.length); - var isSpecialComment = comment.indexOf(SPECIAL_COMMENT_PREFIX) === 0; + matched[id].push(i); + } - if (saveWaypoints) { - breaksCount = comment.split(lineBreak).length - 1; - lastBreakAt = comment.lastIndexOf(lineBreak); - newIndent = lastBreakAt > 0 ? - comment.substring(lastBreakAt + lineBreak.length).length : - indent + comment.length; - } + for (i = 0, l = moreThanOnce.length; i < l; i++) { + id = moreThanOnce[i]; + bodies = []; - if (saveWaypoints || isSpecialComment) { - var metadata = saveWaypoints ? [breaksCount, newIndent] : null; - var placeholder = isSpecialComment ? - this.specialComments.store(comment, metadata) : - this.comments.store(comment, metadata); - tempData.push(placeholder); - } + for (var j = matched[id].length - 1; j >= 0; j--) { + token = tokens[matched[id][j]]; + body = serializeBody(token[2]); - if (saveWaypoints) - indent = newIndent + 1; - cursor = nextEnd + COMMENT_SUFFIX.length; + if (bodies.indexOf(body) > -1) + token[2] = []; + else + bodies.push(body); + } } +} - return tempData.length > 0 ? - tempData.join('') + data.substring(cursor, data.length) : - data; -}; - -function restore(context, data, from, isSpecial) { - var tempData = []; - var cursor = 0; +module.exports = removeDuplicates; - for (; cursor < data.length;) { - var nextMatch = from.nextMatch(data, cursor); - if (nextMatch.start < 0) - break; +},{"../../tokenizer/token":82,"../../writer/one-time":97}],46:[function(require,module,exports){ +// TODO: it'd be great to merge it with the other canReorder functionality - tempData.push(data.substring(cursor, nextMatch.start)); - var comment = from.restore(nextMatch.match); +var rulesOverlap = require('./rules-overlap'); +var specificitiesOverlap = require('./specificities-overlap'); - if (isSpecial && (context.keepAll || (context.keepOne && context.restored === 0))) { - context.restored++; - tempData.push(comment); +var FLEX_PROPERTIES = /align\-items|box\-align|box\-pack|flex|justify/; +var BORDER_PROPERTIES = /^border\-(top|right|bottom|left|color|style|width|radius)/; - cursor = nextMatch.end; - } else { - cursor = nextMatch.end + (context.keepBreaks && data.substring(nextMatch.end, nextMatch.end + lineBreak.length) == lineBreak ? lineBreak.length : 0); +function canReorder(left, right, cache) { + for (var i = right.length - 1; i >= 0; i--) { + for (var j = left.length - 1; j >= 0; j--) { + if (!canReorderSingle(left[j], right[i], cache)) + return false; } } - return tempData.length > 0 ? - tempData.join('') + data.substring(cursor, data.length) : - data; + return true; } -CommentsProcessor.prototype.restore = function (data) { - data = restore(this, data, this.comments, false); - data = restore(this, data, this.specialComments, true); - return data; -}; - -module.exports = CommentsProcessor; +function canReorderSingle(left, right, cache) { + var leftName = left[0]; + var leftValue = left[1]; + var leftNameRoot = left[2]; + var leftSelector = left[5]; + var leftInSpecificSelector = left[6]; + var rightName = right[0]; + var rightValue = right[1]; + var rightNameRoot = right[2]; + var rightSelector = right[5]; + var rightInSpecificSelector = right[6]; -},{"../utils/quote-scanner":65,"./escape-store":51,"os":78}],51:[function(require,module,exports){ -var placeholderBrace = '__'; + if (leftName == 'font' && rightName == 'line-height' || rightName == 'font' && leftName == 'line-height') + return false; + if (FLEX_PROPERTIES.test(leftName) && FLEX_PROPERTIES.test(rightName)) + return false; + if (leftNameRoot == rightNameRoot && unprefixed(leftName) == unprefixed(rightName) && (vendorPrefixed(leftName) ^ vendorPrefixed(rightName))) + return false; + if (leftNameRoot == 'border' && BORDER_PROPERTIES.test(rightNameRoot) && (leftName == 'border' || leftName == rightNameRoot || (leftValue != rightValue && sameBorderComponent(leftName, rightName)))) + return false; + if (rightNameRoot == 'border' && BORDER_PROPERTIES.test(leftNameRoot) && (rightName == 'border' || rightName == leftNameRoot || (leftValue != rightValue && sameBorderComponent(leftName, rightName)))) + return false; + if (leftNameRoot == 'border' && rightNameRoot == 'border' && leftName != rightName && (isSideBorder(leftName) && isStyleBorder(rightName) || isStyleBorder(leftName) && isSideBorder(rightName))) + return false; + if (leftNameRoot != rightNameRoot) + return true; + if (leftName == rightName && leftNameRoot == rightNameRoot && (leftValue == rightValue || withDifferentVendorPrefix(leftValue, rightValue))) + return true; + if (leftName != rightName && leftNameRoot == rightNameRoot && leftName != leftNameRoot && rightName != rightNameRoot) + return true; + if (leftName != rightName && leftNameRoot == rightNameRoot && leftValue == rightValue) + return true; + if (rightInSpecificSelector && leftInSpecificSelector && !inheritable(leftNameRoot) && !inheritable(rightNameRoot) && !rulesOverlap(rightSelector, leftSelector, false)) + return true; + if (!specificitiesOverlap(leftSelector, rightSelector, cache)) + return true; -function EscapeStore(placeholderRoot) { - this.placeholderRoot = 'ESCAPED_' + placeholderRoot + '_CLEAN_CSS'; - this.placeholderToData = {}; - this.dataToPlaceholder = {}; - this.count = 0; - this.restoreMatcher = new RegExp(this.placeholderRoot + '(\\d+)'); + return false; } -EscapeStore.prototype._nextPlaceholder = function (metadata) { - return { - index: this.count, - value: placeholderBrace + this.placeholderRoot + this.count++ + metadata + placeholderBrace - }; -}; - -EscapeStore.prototype.store = function (data, metadata) { - var encodedMetadata = metadata ? - '(' + metadata.join(',') + ')' : - ''; - var placeholder = this.dataToPlaceholder[data]; +function vendorPrefixed(name) { + return /^\-(?:moz|webkit|ms|o)\-/.test(name); +} - if (!placeholder) { - var nextPlaceholder = this._nextPlaceholder(encodedMetadata); - placeholder = nextPlaceholder.value; - this.placeholderToData[nextPlaceholder.index] = data; - this.dataToPlaceholder[data] = nextPlaceholder.value; - } +function unprefixed(name) { + return name.replace(/^\-(?:moz|webkit|ms|o)\-/, ''); +} - if (metadata) - placeholder = placeholder.replace(/\([^\)]+\)/, encodedMetadata); +function sameBorderComponent(name1, name2) { + return name1.split('-').pop() == name2.split('-').pop(); +} - return placeholder; -}; +function isSideBorder(name) { + return name == 'border-top' || name == 'border-right' || name == 'border-bottom' || name == 'border-left'; +} -EscapeStore.prototype.nextMatch = function (data, cursor) { - var next = {}; +function isStyleBorder(name) { + return name == 'border-color' || name == 'border-style' || name == 'border-width'; +} - next.start = data.indexOf(this.placeholderRoot, cursor) - placeholderBrace.length; - next.end = data.indexOf(placeholderBrace, next.start + placeholderBrace.length) + placeholderBrace.length; - if (next.start > -1 && next.end > -1) - next.match = data.substring(next.start, next.end); +function withDifferentVendorPrefix(value1, value2) { + return vendorPrefixed(value1) && vendorPrefixed(value2) && value1.split('-')[1] != value2.split('-')[2]; +} - return next; -}; +function inheritable(name) { + // According to http://www.w3.org/TR/CSS21/propidx.html + // Others will be catched by other, preceeding rules + return name == 'font' || name == 'line-height' || name == 'list-style'; +} -EscapeStore.prototype.restore = function (placeholder) { - var index = this.restoreMatcher.exec(placeholder)[1]; - return this.placeholderToData[index]; +module.exports = { + canReorder: canReorder, + canReorderSingle: canReorderSingle }; -module.exports = EscapeStore; +},{"./rules-overlap":50,"./specificities-overlap":51}],47:[function(require,module,exports){ +var compactable = require('./compactable'); -},{}],52:[function(require,module,exports){ -var EscapeStore = require('./escape-store'); +function restoreWithComponents(property) { + var descriptor = compactable[property.name]; -var EXPRESSION_NAME = 'expression'; -var EXPRESSION_START = '('; -var EXPRESSION_END = ')'; -var EXPRESSION_PREFIX = EXPRESSION_NAME + EXPRESSION_START; -var BODY_START = '{'; -var BODY_END = '}'; + if (descriptor && descriptor.shorthand) { + return descriptor.restore(property, compactable); + } else { + return property.value; + } +} -var lineBreak = require('os').EOL; +module.exports = restoreWithComponents; -function findEnd(data, start) { - var end = start + EXPRESSION_NAME.length; - var level = 0; - var quoted = false; - var braced = false; +},{"./compactable":22}],48:[function(require,module,exports){ +var shallowClone = require('./clone').shallow; - while (true) { - var current = data[end++]; +var Token = require('../../tokenizer/token'); +var Marker = require('../../tokenizer/marker'); - if (quoted) { - quoted = current != '\'' && current != '"'; - } else { - quoted = current == '\'' || current == '"'; - - if (current == EXPRESSION_START) - level++; - if (current == EXPRESSION_END) - level--; - if (current == BODY_START) - braced = true; - if (current == BODY_END && !braced && level == 1) { - end--; - level--; - } - } +function isInheritOnly(values) { + for (var i = 0, l = values.length; i < l; i++) { + var value = values[i][1]; - if (level === 0 && current == EXPRESSION_END) - break; - if (!current) { - end = data.substring(0, end).lastIndexOf(BODY_END); - break; - } + if (value != 'inherit' && value != Marker.COMMA && value != Marker.FORWARD_SLASH) + return false; } - return end; + return true; } -function ExpressionsProcessor(saveWaypoints) { - this.expressions = new EscapeStore('EXPRESSION'); - this.saveWaypoints = saveWaypoints; -} +function background(property, compactable, lastInMultiplex) { + var components = property.components; + var restored = []; + var needsOne, needsBoth; -ExpressionsProcessor.prototype.escape = function (data) { - var nextStart = 0; - var nextEnd = 0; - var cursor = 0; - var tempData = []; - var indent = 0; - var breaksCount; - var lastBreakAt; - var newIndent; - var saveWaypoints = this.saveWaypoints; - - for (; nextEnd < data.length;) { - nextStart = data.indexOf(EXPRESSION_PREFIX, nextEnd); - if (nextStart == -1) - break; + function restoreValue(component) { + Array.prototype.unshift.apply(restored, component.value); + } - nextEnd = findEnd(data, nextStart); + function isDefaultValue(component) { + var descriptor = compactable[component.name]; - var expression = data.substring(nextStart, nextEnd); - if (saveWaypoints) { - breaksCount = expression.split(lineBreak).length - 1; - lastBreakAt = expression.lastIndexOf(lineBreak); - newIndent = lastBreakAt > 0 ? - expression.substring(lastBreakAt + lineBreak.length).length : - indent + expression.length; + if (descriptor.doubleValues && descriptor.defaultValue.length == 1) { + return component.value[0][1] == descriptor.defaultValue[0] && (component.value[1] ? component.value[1][1] == descriptor.defaultValue[0] : true); + } else if (descriptor.doubleValues && descriptor.defaultValue.length != 1) { + return component.value[0][1] == descriptor.defaultValue[0] && (component.value[1] ? component.value[1][1] : component.value[0][1]) == descriptor.defaultValue[1]; + } else { + return component.value[0][1] == descriptor.defaultValue; } - - var metadata = saveWaypoints ? [breaksCount, newIndent] : null; - var placeholder = this.expressions.store(expression, metadata); - tempData.push(data.substring(cursor, nextStart)); - tempData.push(placeholder); - - if (saveWaypoints) - indent = newIndent + 1; - cursor = nextEnd; } - return tempData.length > 0 ? - tempData.join('') + data.substring(cursor, data.length) : - data; -}; - -ExpressionsProcessor.prototype.restore = function (data) { - var tempData = []; - var cursor = 0; + for (var i = components.length - 1; i >= 0; i--) { + var component = components[i]; + var isDefault = isDefaultValue(component); - for (; cursor < data.length;) { - var nextMatch = this.expressions.nextMatch(data, cursor); - if (nextMatch.start < 0) - break; + if (component.name == 'background-clip') { + var originComponent = components[i - 1]; + var isOriginDefault = isDefaultValue(originComponent); - tempData.push(data.substring(cursor, nextMatch.start)); - var comment = this.expressions.restore(nextMatch.match); - tempData.push(comment); + needsOne = component.value[0][1] == originComponent.value[0][1]; - cursor = nextMatch.end; - } + needsBoth = !needsOne && ( + (isOriginDefault && !isDefault) || + (!isOriginDefault && !isDefault) || + (!isOriginDefault && isDefault && component.value[0][1] != originComponent.value[0][1])); - return tempData.length > 0 ? - tempData.join('') + data.substring(cursor, data.length) : - data; -}; + if (needsOne) { + restoreValue(originComponent); + } else if (needsBoth) { + restoreValue(component); + restoreValue(originComponent); + } -module.exports = ExpressionsProcessor; + i--; + } else if (component.name == 'background-size') { + var positionComponent = components[i - 1]; + var isPositionDefault = isDefaultValue(positionComponent); -},{"./escape-store":51,"os":78}],53:[function(require,module,exports){ -var EscapeStore = require('./escape-store'); -var QuoteScanner = require('../utils/quote-scanner'); + needsOne = !isPositionDefault && isDefault; -var lineBreak = require('os').EOL; + needsBoth = !needsOne && + (isPositionDefault && !isDefault || !isPositionDefault && !isDefault); -function FreeTextProcessor(saveWaypoints) { - this.matches = new EscapeStore('FREE_TEXT'); - this.saveWaypoints = saveWaypoints; -} + if (needsOne) { + restoreValue(positionComponent); + } else if (needsBoth) { + restoreValue(component); + restored.unshift([Token.PROPERTY_VALUE, Marker.FORWARD_SLASH]); + restoreValue(positionComponent); + } else if (positionComponent.value.length == 1) { + restoreValue(positionComponent); + } -// Strip content tags by replacing them by the a special -// marker for further restoring. It's done via string scanning -// instead of regexps to speed up the process. -FreeTextProcessor.prototype.escape = function (data) { - var self = this; - var breaksCount; - var lastBreakAt; - var indent; - var metadata; - var saveWaypoints = this.saveWaypoints; + i--; + } else { + if (isDefault || compactable[component.name].multiplexLastOnly && !lastInMultiplex) + continue; - return new QuoteScanner(data).each(function (match, store) { - if (saveWaypoints) { - breaksCount = match.split(lineBreak).length - 1; - lastBreakAt = match.lastIndexOf(lineBreak); - indent = lastBreakAt > 0 ? - match.substring(lastBreakAt + lineBreak.length).length : - match.length; - metadata = [breaksCount, indent]; + restoreValue(component); } + } - var placeholder = self.matches.store(match, metadata); - store.push(placeholder); - }); -}; + if (restored.length === 0 && property.value.length == 1 && property.value[0][1] == '0') + restored.push(property.value[0]); -function normalize(text, data, prefixContext, cursor) { - // FIXME: this is even a bigger hack now - see #407 - var searchIn = data; - if (prefixContext) { - searchIn = prefixContext + data.substring(0, data.indexOf('__ESCAPED_FREE_TEXT_CLEAN_CSS')); - cursor = searchIn.length; - } + if (restored.length === 0) + restored.push([Token.PROPERTY_VALUE, compactable[property.name].defaultValue]); + + if (isInheritOnly(restored)) + return [restored[0]]; + + return restored; +} - var lastSemicolon = searchIn.lastIndexOf(';', cursor); - var lastOpenBrace = searchIn.lastIndexOf('{', cursor); - var lastOne = 0; +function borderRadius(property, compactable) { + if (property.multiplex) { + var horizontal = shallowClone(property); + var vertical = shallowClone(property); - if (lastSemicolon > -1 && lastOpenBrace > -1) - lastOne = Math.max(lastSemicolon, lastOpenBrace); - else if (lastSemicolon == -1) - lastOne = lastOpenBrace; - else - lastOne = lastSemicolon; + for (var i = 0; i < 4; i++) { + var component = property.components[i]; - var context = searchIn.substring(lastOne + 1, cursor); + var horizontalComponent = shallowClone(property); + horizontalComponent.value = [component.value[0]]; + horizontal.components.push(horizontalComponent); - if (/\[[\w\d\-]+[\*\|\~\^\$]?=$/.test(context)) { - text = text - .replace(/\\\n|\\\r\n/g, '') - .replace(/\n|\r\n/g, ''); - } + var verticalComponent = shallowClone(property); + // FIXME: only shorthand compactor (see breakup#borderRadius) knows that border radius + // longhands have two values, whereas tokenizer does not care about populating 2nd value + // if it's missing, hence this fallback + verticalComponent.value = [component.value[1] || component.value[0]]; + vertical.components.push(verticalComponent); + } - if (/^['"][a-zA-Z][a-zA-Z\d\-_]+['"]$/.test(text) && !/format\($/.test(context)) { - var isFont = /^(font|font\-family):/.test(context); - var isAttribute = /\[[\w\d\-]+[\*\|\~\^\$]?=$/.test(context); - var isKeyframe = /@(-moz-|-o-|-webkit-)?keyframes /.test(context); - var isAnimation = /^(-moz-|-o-|-webkit-)?animation(-name)?:/.test(context); + var horizontalValues = fourValues(horizontal, compactable); + var verticalValues = fourValues(vertical, compactable); - if (isFont || isAttribute || isKeyframe || isAnimation) - text = text.substring(1, text.length - 1); + if (horizontalValues.length == verticalValues.length && + horizontalValues[0][1] == verticalValues[0][1] && + (horizontalValues.length > 1 ? horizontalValues[1][1] == verticalValues[1][1] : true) && + (horizontalValues.length > 2 ? horizontalValues[2][1] == verticalValues[2][1] : true) && + (horizontalValues.length > 3 ? horizontalValues[3][1] == verticalValues[3][1] : true)) { + return horizontalValues; + } else { + return horizontalValues.concat([[Token.PROPERTY_VALUE, Marker.FORWARD_SLASH]]).concat(verticalValues); + } + } else { + return fourValues(property, compactable); } - - return text; } -FreeTextProcessor.prototype.restore = function (data, prefixContext) { - var tempData = []; - var cursor = 0; - - for (; cursor < data.length;) { - var nextMatch = this.matches.nextMatch(data, cursor); - if (nextMatch.start < 0) - break; - - tempData.push(data.substring(cursor, nextMatch.start)); - var text = normalize(this.matches.restore(nextMatch.match), data, prefixContext, nextMatch.start); - tempData.push(text); +function fourValues(property) { + var components = property.components; + var value1 = components[0].value[0]; + var value2 = components[1].value[0]; + var value3 = components[2].value[0]; + var value4 = components[3].value[0]; - cursor = nextMatch.end; + if (value1[1] == value2[1] && value1[1] == value3[1] && value1[1] == value4[1]) { + return [value1]; + } else if (value1[1] == value3[1] && value2[1] == value4[1]) { + return [value1, value2]; + } else if (value2[1] == value4[1]) { + return [value1, value2, value3]; + } else { + return [value1, value2, value3, value4]; } +} - return tempData.length > 0 ? - tempData.join('') + data.substring(cursor, data.length) : - data; -}; - -module.exports = FreeTextProcessor; +function multiplex(restoreWith) { + return function (property, compactable) { + if (!property.multiplex) + return restoreWith(property, compactable, true); -},{"../utils/quote-scanner":65,"./escape-store":51,"os":78}],54:[function(require,module,exports){ -var EscapeStore = require('./escape-store'); -var reduceUrls = require('../urls/reduce'); + var multiplexSize = 0; + var restored = []; + var componentMultiplexSoFar = {}; + var i, l; -var lineBreak = require('os').EOL; + // At this point we don't know what's the multiplex size, e.g. how many background layers are there + for (i = 0, l = property.components[0].value.length; i < l; i++) { + if (property.components[0].value[i][1] == Marker.COMMA) + multiplexSize++; + } -function UrlsProcessor(context, saveWaypoints, keepUrlQuotes) { - this.urls = new EscapeStore('URL'); - this.context = context; - this.saveWaypoints = saveWaypoints; - this.keepUrlQuotes = keepUrlQuotes; -} - -// Strip urls by replacing them by a special -// marker for further restoring. It's done via string scanning -// instead of regexps to speed up the process. -UrlsProcessor.prototype.escape = function (data) { - var breaksCount; - var lastBreakAt; - var indent; - var saveWaypoints = this.saveWaypoints; - var self = this; + for (i = 0; i <= multiplexSize; i++) { + var _property = shallowClone(property); - return reduceUrls(data, this.context, function (url, tempData) { - if (saveWaypoints) { - breaksCount = url.split(lineBreak).length - 1; - lastBreakAt = url.lastIndexOf(lineBreak); - indent = lastBreakAt > 0 ? - url.substring(lastBreakAt + lineBreak.length).length : - url.length; - } + // We split multiplex into parts and restore them one by one + for (var j = 0, m = property.components.length; j < m; j++) { + var componentToClone = property.components[j]; + var _component = shallowClone(componentToClone); + _property.components.push(_component); - var placeholder = self.urls.store(url, saveWaypoints ? [breaksCount, indent] : null); - tempData.push(placeholder); - }); -}; + // The trick is some properties has more than one value, so we iterate over values looking for + // a multiplex separator - a comma + for (var k = componentMultiplexSoFar[_component.name] || 0, n = componentToClone.value.length; k < n; k++) { + if (componentToClone.value[k][1] == Marker.COMMA) { + componentMultiplexSoFar[_component.name] = k + 1; + break; + } -function normalize(url, keepUrlQuotes) { - url = url - .replace(/^url/gi, 'url') - .replace(/\\?\n|\\?\r\n/g, '') - .replace(/(\s{2,}|\s)/g, ' ') - .replace(/^url\((['"])? /, 'url($1') - .replace(/ (['"])?\)$/, '$1)'); + _component.value.push(componentToClone.value[k]); + } + } - if (/url\(".*'.*"\)/.test(url) || /url\('.*".*'\)/.test(url)) - return url; + // No we can restore shorthand value + var lastInMultiplex = i == multiplexSize; + var _restored = restoreWith(_property, compactable, lastInMultiplex); + Array.prototype.push.apply(restored, _restored); - if (!keepUrlQuotes && !/^['"].+['"]$/.test(url) && !/url\(.*[\s\(\)].*\)/.test(url) && !/url\(['"]data:[^;]+;charset/.test(url)) - url = url.replace(/["']/g, ''); + if (i < multiplexSize) + restored.push([Token.PROPERTY_VALUE, Marker.COMMA]); + } - return url; + return restored; + }; } -UrlsProcessor.prototype.restore = function (data) { - var tempData = []; - var cursor = 0; - - for (; cursor < data.length;) { - var nextMatch = this.urls.nextMatch(data, cursor); - if (nextMatch.start < 0) - break; +function withoutDefaults(property, compactable) { + var components = property.components; + var restored = []; - tempData.push(data.substring(cursor, nextMatch.start)); - var url = normalize(this.urls.restore(nextMatch.match), this.keepUrlQuotes); - tempData.push(url); + for (var i = components.length - 1; i >= 0; i--) { + var component = components[i]; + var descriptor = compactable[component.name]; - cursor = nextMatch.end; + if (component.value[0][1] != descriptor.defaultValue) + restored.unshift(component.value[0]); } - return tempData.length > 0 ? - tempData.join('') + data.substring(cursor, data.length) : - data; -}; - -module.exports = UrlsProcessor; - -},{"../urls/reduce":59,"./escape-store":51,"os":78}],55:[function(require,module,exports){ -var split = require('../utils/split'); - -var COMMA = ','; -var FORWARD_SLASH = '/'; - -var AT_RULE = 'at-rule'; + if (restored.length === 0) + restored.push([Token.PROPERTY_VALUE, compactable[property.name].defaultValue]); -var IMPORTANT_WORD = 'important'; -var IMPORTANT_TOKEN = '!'+IMPORTANT_WORD; -var IMPORTANT_WORD_MATCH = new RegExp('^'+IMPORTANT_WORD+'$', 'i'); -var IMPORTANT_TOKEN_MATCH = new RegExp('^'+IMPORTANT_TOKEN+'$', 'i'); + if (isInheritOnly(restored)) + return [restored[0]]; -function selectorName(value) { - return value[0]; + return restored; } -function noop() {} +module.exports = { + background: background, + borderRadius: borderRadius, + fourValues: fourValues, + multiplex: multiplex, + withoutDefaults: withoutDefaults +}; -function withoutComments(string, into, heading, context) { - var matcher = heading ? /^__ESCAPED_COMMENT_/ : /__ESCAPED_COMMENT_/; - var track = heading ? context.track : noop; // don't track when comment not in a heading as we do it later in `trackComments` +},{"../../tokenizer/marker":81,"../../tokenizer/token":82,"./clone":21}],49:[function(require,module,exports){ +var canReorderSingle = require('./reorderable').canReorderSingle; +var extractProperties = require('./extract-properties'); +var isMergeable = require('./is-mergeable'); +var tidyRuleDuplicates = require('./tidy-rule-duplicates'); - while (matcher.test(string)) { - var startOfComment = string.indexOf('__'); - var endOfComment = string.indexOf('__', startOfComment + 1) + 2; - var comment = string.substring(startOfComment, endOfComment); - string = string.substring(0, startOfComment) + string.substring(endOfComment); +var Token = require('../../tokenizer/token'); - track(comment); - into.push(comment); - } +var cloneArray = require('../../utils/clone-array'); - return string; -} +var serializeBody = require('../../writer/one-time').body; +var serializeRules = require('../../writer/one-time').rules; -function withoutHeadingComments(string, into, context) { - return withoutComments(string, into, true, context); +function naturalSorter(a, b) { + return a > b ? 1 : -1; } -function withoutInnerComments(string, into, context) { - return withoutComments(string, into, false, context); -} +function cloneAndMergeSelectors(propertyA, propertyB) { + var cloned = cloneArray(propertyA); + cloned[5] = cloned[5].concat(propertyB[5]); -function trackComments(comments, into, context) { - for (var i = 0, l = comments.length; i < l; i++) { - context.track(comments[i]); - into.push(comments[i]); - } + return cloned; } -function extractProperties(string, selectors, context) { - var list = []; - var innerComments = []; - var valueSeparator = /[ ,\/]/; +function restructure(tokens, context) { + var options = context.options; + var mergeablePseudoClasses = options.compatibility.selectors.mergeablePseudoClasses; + var mergeablePseudoElements = options.compatibility.selectors.mergeablePseudoElements; + var specificityCache = context.cache.specificity; + var movableTokens = {}; + var movedProperties = []; + var multiPropertyMoveCache = {}; + var movedToBeDropped = []; + var maxCombinationsLevel = 2; + var ID_JOIN_CHARACTER = '%'; - if (typeof string != 'string') - return []; + function sendToMultiPropertyMoveCache(position, movedProperty, allFits) { + for (var i = allFits.length - 1; i >= 0; i--) { + var fit = allFits[i][0]; + var id = addToCache(movedProperty, fit); - if (string.indexOf(')') > -1) - string = string.replace(/\)([^\s_;:,\)])/g, context.sourceMap ? ') __ESCAPED_COMMENT_CLEAN_CSS(0,-1)__ $1' : ') $1'); + if (multiPropertyMoveCache[id].length > 1 && processMultiPropertyMove(position, multiPropertyMoveCache[id])) { + removeAllMatchingFromCache(id); + break; + } + } + } - if (string.indexOf('ESCAPED_URL_CLEAN_CSS') > -1) - string = string.replace(/(ESCAPED_URL_CLEAN_CSS[^_]+?__)/g, context.sourceMap ? '$1 __ESCAPED_COMMENT_CLEAN_CSS(0,-1)__ ' : '$1 '); + function addToCache(movedProperty, fit) { + var id = cacheId(fit); + multiPropertyMoveCache[id] = multiPropertyMoveCache[id] || []; + multiPropertyMoveCache[id].push([movedProperty, fit]); + return id; + } - var candidates = split(string, ';', false, '{', '}'); + function removeAllMatchingFromCache(matchId) { + var matchSelectors = matchId.split(ID_JOIN_CHARACTER); + var forRemoval = []; + var i; - for (var i = 0, l = candidates.length; i < l; i++) { - var candidate = candidates[i]; - var firstColonAt = candidate.indexOf(':'); + for (var id in multiPropertyMoveCache) { + var selectors = id.split(ID_JOIN_CHARACTER); + for (i = selectors.length - 1; i >= 0; i--) { + if (matchSelectors.indexOf(selectors[i]) > -1) { + forRemoval.push(id); + break; + } + } + } - var atRule = candidate.trim()[0] == '@'; - if (atRule) { - context.track(candidate); - list.push([AT_RULE, candidate.trim()]); - continue; + for (i = forRemoval.length - 1; i >= 0; i--) { + delete multiPropertyMoveCache[forRemoval[i]]; } + } - if (firstColonAt == -1) { - context.track(candidate); - if (candidate.indexOf('__ESCAPED_COMMENT_SPECIAL') > -1) - list.push(candidate.trim()); - continue; + function cacheId(cachedTokens) { + var id = []; + for (var i = 0, l = cachedTokens.length; i < l; i++) { + id.push(serializeRules(cachedTokens[i][1])); } + return id.join(ID_JOIN_CHARACTER); + } - if (candidate.indexOf('{') > 0 && candidate.indexOf('{') < firstColonAt) { - context.track(candidate); - continue; + function tokensToMerge(sourceTokens) { + var uniqueTokensWithBody = []; + var mergeableTokens = []; + + for (var i = sourceTokens.length - 1; i >= 0; i--) { + if (!isMergeable(serializeRules(sourceTokens[i][1]), mergeablePseudoClasses, mergeablePseudoElements)) { + continue; + } + + mergeableTokens.unshift(sourceTokens[i]); + if (sourceTokens[i][2].length > 0 && uniqueTokensWithBody.indexOf(sourceTokens[i]) == -1) + uniqueTokensWithBody.push(sourceTokens[i]); } - var body = []; - var name = candidate.substring(0, firstColonAt); + return uniqueTokensWithBody.length > 1 ? + mergeableTokens : + []; + } - innerComments = []; + function shortenIfPossible(position, movedProperty) { + var name = movedProperty[0]; + var value = movedProperty[1]; + var key = movedProperty[4]; + var valueSize = name.length + value.length + 1; + var allSelectors = []; + var qualifiedTokens = []; - if (name.indexOf('__ESCAPED_COMMENT') > -1) - name = withoutHeadingComments(name, list, context); + var mergeableTokens = tokensToMerge(movableTokens[key]); + if (mergeableTokens.length < 2) + return; - if (name.indexOf('__ESCAPED_COMMENT') > -1) - name = withoutInnerComments(name, innerComments, context); + var allFits = findAllFits(mergeableTokens, valueSize, 1); + var bestFit = allFits[0]; + if (bestFit[1] > 0) + return sendToMultiPropertyMoveCache(position, movedProperty, allFits); - body.push([name.trim()].concat(context.track(name, true))); - context.track(':'); + for (var i = bestFit[0].length - 1; i >=0; i--) { + allSelectors = bestFit[0][i][1].concat(allSelectors); + qualifiedTokens.unshift(bestFit[0][i]); + } - trackComments(innerComments, list, context); + allSelectors = tidyRuleDuplicates(allSelectors); + dropAsNewTokenAt(position, [movedProperty], allSelectors, qualifiedTokens); + } - var firstBraceAt = candidate.indexOf('{'); - var isVariable = name.trim().indexOf('--') === 0; - if (isVariable && firstBraceAt > 0) { - var blockPrefix = candidate.substring(firstColonAt + 1, firstBraceAt + 1); - var blockSuffix = candidate.substring(candidate.indexOf('}')); - var blockContent = candidate.substring(firstBraceAt + 1, candidate.length - blockSuffix.length); + function fitSorter(fit1, fit2) { + return fit1[1] > fit2[1]; + } - context.track(blockPrefix); - body.push(extractProperties(blockContent, selectors, context)); - list.push(body); - context.track(blockSuffix); - context.track(i < l - 1 ? ';' : ''); + function findAllFits(mergeableTokens, propertySize, propertiesCount) { + var combinations = allCombinations(mergeableTokens, propertySize, propertiesCount, maxCombinationsLevel - 1); + return combinations.sort(fitSorter); + } - continue; + function allCombinations(tokensVariant, propertySize, propertiesCount, level) { + var differenceVariants = [[tokensVariant, sizeDifference(tokensVariant, propertySize, propertiesCount)]]; + if (tokensVariant.length > 2 && level > 0) { + for (var i = tokensVariant.length - 1; i >= 0; i--) { + var subVariant = Array.prototype.slice.call(tokensVariant, 0); + subVariant.splice(i, 1); + differenceVariants = differenceVariants.concat(allCombinations(subVariant, propertySize, propertiesCount, level - 1)); + } } - var values = split(candidate.substring(firstColonAt + 1), valueSeparator, true); + return differenceVariants; + } - if (values.length == 1 && values[0] === '') { - context.warnings.push('Empty property \'' + name + '\' inside \'' + selectors.filter(selectorName).join(',') + '\' selector. Ignoring.'); - continue; + function sizeDifference(tokensVariant, propertySize, propertiesCount) { + var allSelectorsSize = 0; + for (var i = tokensVariant.length - 1; i >= 0; i--) { + allSelectorsSize += tokensVariant[i][2].length > propertiesCount ? serializeRules(tokensVariant[i][1]).length : -1; } + return allSelectorsSize - (tokensVariant.length - 1) * propertySize + 1; + } + + function dropAsNewTokenAt(position, properties, allSelectors, mergeableTokens) { + var i, j, k, m; + var allProperties = []; - for (var j = 0, m = values.length; j < m; j++) { - var value = values[j]; - var trimmed = value.trim(); + for (i = mergeableTokens.length - 1; i >= 0; i--) { + var mergeableToken = mergeableTokens[i]; - if (trimmed.length === 0) - continue; + for (j = mergeableToken[2].length - 1; j >= 0; j--) { + var mergeableProperty = mergeableToken[2][j]; + + for (k = 0, m = properties.length; k < m; k++) { + var property = properties[k]; - var lastCharacter = trimmed[trimmed.length - 1]; - var endsWithNonSpaceSeparator = trimmed.length > 1 && (lastCharacter == COMMA || lastCharacter == FORWARD_SLASH); + var mergeablePropertyName = mergeableProperty[1][1]; + var propertyName = property[0]; + var propertyBody = property[4]; + if (mergeablePropertyName == propertyName && serializeBody([mergeableProperty]) == propertyBody) { + mergeableToken[2].splice(j, 1); + break; + } + } + } + } - if (endsWithNonSpaceSeparator) - trimmed = trimmed.substring(0, trimmed.length - 1); + for (i = properties.length - 1; i >= 0; i--) { + allProperties.unshift(properties[i][3]); + } - if (trimmed.indexOf('__ESCAPED_COMMENT_CLEAN_CSS(0,-') > -1) { - context.track(trimmed); - continue; - } + var newToken = [Token.RULE, allSelectors, allProperties]; + tokens.splice(position, 0, newToken); + } - innerComments = []; + function dropPropertiesAt(position, movedProperty) { + var key = movedProperty[4]; + var toMove = movableTokens[key]; - if (trimmed.indexOf('__ESCAPED_COMMENT') > -1) - trimmed = withoutHeadingComments(trimmed, list, context); + if (toMove && toMove.length > 1) { + if (!shortenMultiMovesIfPossible(position, movedProperty)) + shortenIfPossible(position, movedProperty); + } + } - if (trimmed.indexOf('__ESCAPED_COMMENT') > -1) - trimmed = withoutInnerComments(trimmed, innerComments, context); + function shortenMultiMovesIfPossible(position, movedProperty) { + var candidates = []; + var propertiesAndMergableTokens = []; + var key = movedProperty[4]; + var j, k; - if (trimmed.length === 0) { - trackComments(innerComments, list, context); - continue; - } + var mergeableTokens = tokensToMerge(movableTokens[key]); + if (mergeableTokens.length < 2) + return; - var pos = body.length - 1; - if (IMPORTANT_WORD_MATCH.test(trimmed) && body[pos][0] == '!') { - context.track(trimmed); - body[pos - 1][0] += IMPORTANT_TOKEN; - body.pop(); - continue; - } + movableLoop: + for (var value in movableTokens) { + var tokensList = movableTokens[value]; - if (IMPORTANT_TOKEN_MATCH.test(trimmed) || (IMPORTANT_WORD_MATCH.test(trimmed) && body[pos][0][body[pos][0].length - 1] == '!')) { - context.track(trimmed); - body[pos][0] += trimmed; - continue; + for (j = mergeableTokens.length - 1; j >= 0; j--) { + if (tokensList.indexOf(mergeableTokens[j]) == -1) + continue movableLoop; } - body.push([trimmed].concat(context.track(value, true))); + candidates.push(value); + } - trackComments(innerComments, list, context); + if (candidates.length < 2) + return false; - if (endsWithNonSpaceSeparator) { - body.push([lastCharacter]); - context.track(lastCharacter); + for (j = candidates.length - 1; j >= 0; j--) { + for (k = movedProperties.length - 1; k >= 0; k--) { + if (movedProperties[k][4] == candidates[j]) { + propertiesAndMergableTokens.unshift([movedProperties[k], mergeableTokens]); + break; + } } } - if (i < l - 1) - context.track(';'); - - list.push(body); - } - - return list; -} - -module.exports = extractProperties; - -},{"../utils/split":68}],56:[function(require,module,exports){ -var split = require('../utils/split'); - -function extractSelectors(string, context) { - var list = []; - var metadata; - var selectors = split(string, ','); - - for (var i = 0, l = selectors.length; i < l; i++) { - metadata = context.track(selectors[i], true, i); - context.track(','); - list.push([selectors[i].trim()].concat(metadata)); + return processMultiPropertyMove(position, propertiesAndMergableTokens); } - return list; -} + function processMultiPropertyMove(position, propertiesAndMergableTokens) { + var valueSize = 0; + var properties = []; + var property; -module.exports = extractSelectors; + for (var i = propertiesAndMergableTokens.length - 1; i >= 0; i--) { + property = propertiesAndMergableTokens[i][0]; + var fullValue = property[4]; + valueSize += fullValue.length + (i > 0 ? 1 : 0); -},{"../utils/split":68}],57:[function(require,module,exports){ -var extractProperties = require('./extract-properties'); -var extractSelectors = require('./extract-selectors'); -var track = require('../source-maps/track'); -var split = require('../utils/split'); + properties.push(property); + } -var path = require('path'); + var mergeableTokens = propertiesAndMergableTokens[0][1]; + var bestFit = findAllFits(mergeableTokens, valueSize, properties.length)[0]; + if (bestFit[1] > 0) + return false; -var flatBlock = /(@(font\-face|page|\-ms\-viewport|\-o\-viewport|viewport|counter\-style)|\\@.+?)/; + var allSelectors = []; + var qualifiedTokens = []; + for (i = bestFit[0].length - 1; i >= 0; i--) { + allSelectors = bestFit[0][i][1].concat(allSelectors); + qualifiedTokens.unshift(bestFit[0][i]); + } -function tokenize(data, outerContext) { - var chunks = split(normalize(data), '}', true, '{', '}'); - if (chunks.length === 0) - return []; + allSelectors = tidyRuleDuplicates(allSelectors); + dropAsNewTokenAt(position, properties, allSelectors, qualifiedTokens); - var context = { - chunk: chunks.shift(), - chunks: chunks, - column: 0, - cursor: 0, - line: 1, - mode: 'top', - resolvePath: outerContext.options.explicitTarget ? - relativePathResolver(outerContext.options.root, outerContext.options.target) : - null, - source: undefined, - sourceMap: outerContext.options.sourceMap, - sourceMapInlineSources: outerContext.options.sourceMapInlineSources, - sourceMapTracker: outerContext.inputSourceMapTracker, - sourceReader: outerContext.sourceReader, - sourceTracker: outerContext.sourceTracker, - state: [], - track: outerContext.options.sourceMap ? - function (data, snapshotMetadata, fallbacks) { return [[track(data, context, snapshotMetadata, fallbacks)]]; } : - function () { return []; }, - warnings: outerContext.warnings - }; + for (i = properties.length - 1; i >= 0; i--) { + property = properties[i]; + var index = movedProperties.indexOf(property); - return intoTokens(context); -} + delete movableTokens[property[4]]; -function normalize(data) { - return data.replace(/\r\n/g, '\n'); -} + if (index > -1 && movedToBeDropped.indexOf(index) == -1) + movedToBeDropped.push(index); + } -function relativePathResolver(root, target) { - var rebaseTo = path.relative(root, target); + return true; + } - return function (relativeTo, sourcePath) { - return relativeTo != sourcePath ? - path.normalize(path.join(path.relative(rebaseTo, path.dirname(relativeTo)), sourcePath)) : - sourcePath; - }; -} + function boundToAnotherPropertyInCurrrentToken(property, movedProperty, token) { + var propertyName = property[0]; + var movedPropertyName = movedProperty[0]; + if (propertyName != movedPropertyName) + return false; -function whatsNext(context) { - var mode = context.mode; - var chunk = context.chunk; - var closest; + var key = movedProperty[4]; + var toMove = movableTokens[key]; + return toMove && toMove.indexOf(token) > -1; + } - if (chunk.length == context.cursor) { - if (context.chunks.length === 0) - return null; + for (var i = tokens.length - 1; i >= 0; i--) { + var token = tokens[i]; + var isRule; + var j, k, m; + var samePropertyAt; - context.chunk = chunk = context.chunks.shift(); - context.cursor = 0; - } + if (token[0] == Token.RULE) { + isRule = true; + } else if (token[0] == Token.NESTED_BLOCK) { + isRule = false; + } else { + continue; + } - if (mode == 'body') { - if (chunk[context.cursor] == '}') - return [context.cursor, 'bodyEnd']; + // We cache movedProperties.length as it may change in the loop + var movedCount = movedProperties.length; - if (chunk.indexOf('}', context.cursor) == -1) - return null; + var properties = extractProperties(token); + movedToBeDropped = []; - closest = context.cursor + split(chunk.substring(context.cursor - 1), '}', true, '{', '}')[0].length - 2; - return [closest, 'bodyEnd']; - } + var unmovableInCurrentToken = []; + for (j = properties.length - 1; j >= 0; j--) { + for (k = j - 1; k >= 0; k--) { + if (!canReorderSingle(properties[j], properties[k], specificityCache)) { + unmovableInCurrentToken.push(j); + break; + } + } + } - var nextSpecial = chunk.indexOf('@', context.cursor); - var nextEscape = chunk.indexOf('__ESCAPED_', context.cursor); - var nextBodyStart = chunk.indexOf('{', context.cursor); - var nextBodyEnd = chunk.indexOf('}', context.cursor); + for (j = properties.length - 1; j >= 0; j--) { + var property = properties[j]; + var movedSameProperty = false; - if (nextSpecial > -1 && context.cursor > 0 && !/\s|\{|\}|\/|_|,|;/.test(chunk.substring(nextSpecial - 1, nextSpecial))) { - nextSpecial = -1; - } + for (k = 0; k < movedCount; k++) { + var movedProperty = movedProperties[k]; - if (nextEscape > -1 && /\S/.test(chunk.substring(context.cursor, nextEscape))) - nextEscape = -1; + if (movedToBeDropped.indexOf(k) == -1 && !canReorderSingle(property, movedProperty, specificityCache) && !boundToAnotherPropertyInCurrrentToken(property, movedProperty, token)) { + dropPropertiesAt(i + 1, movedProperty, token); - closest = nextSpecial; - if (closest == -1 || (nextEscape > -1 && nextEscape < closest)) - closest = nextEscape; - if (closest == -1 || (nextBodyStart > -1 && nextBodyStart < closest)) - closest = nextBodyStart; - if (closest == -1 || (nextBodyEnd > -1 && nextBodyEnd < closest)) - closest = nextBodyEnd; + if (movedToBeDropped.indexOf(k) == -1) { + movedToBeDropped.push(k); + delete movableTokens[movedProperty[4]]; + } + } - if (closest == -1) - return; - if (nextEscape === closest) - return [closest, 'escape']; - if (nextBodyStart === closest) - return [closest, 'bodyStart']; - if (nextBodyEnd === closest) - return [closest, 'bodyEnd']; - if (nextSpecial === closest) - return [closest, 'special']; -} - -function intoTokens(context) { - var chunk = context.chunk; - var tokenized = []; - var newToken; - var value; + if (!movedSameProperty) { + movedSameProperty = property[0] == movedProperty[0] && property[1] == movedProperty[1]; - while (true) { - var next = whatsNext(context); - if (!next) { - var whatsLeft = context.chunk.substring(context.cursor); - if (whatsLeft.trim().length > 0) { - if (context.mode == 'body') { - context.warnings.push('Missing \'}\' after \'' + whatsLeft + '\'. Ignoring.'); - } else { - tokenized.push(['text', [whatsLeft]]); + if (movedSameProperty) { + samePropertyAt = k; + } } - context.cursor += whatsLeft.length; } - break; - } - var nextSpecial = next[0]; - var what = next[1]; - var nextEnd; - var oldMode; - - chunk = context.chunk; + if (!isRule || unmovableInCurrentToken.indexOf(j) > -1) + continue; - if (context.cursor != nextSpecial && what != 'bodyEnd') { - var spacing = chunk.substring(context.cursor, nextSpecial); - var leadingWhitespace = /^\s+/.exec(spacing); + var key = property[4]; + movableTokens[key] = movableTokens[key] || []; + movableTokens[key].push(token); - if (leadingWhitespace) { - context.cursor += leadingWhitespace[0].length; - context.track(leadingWhitespace[0]); + if (movedSameProperty) { + movedProperties[samePropertyAt] = cloneAndMergeSelectors(movedProperties[samePropertyAt], property); + } else { + movedProperties.push(property); } } - if (what == 'special') { - var firstOpenBraceAt = chunk.indexOf('{', nextSpecial); - var firstSemicolonAt = chunk.indexOf(';', nextSpecial); - var isSingle = firstSemicolonAt > -1 && (firstOpenBraceAt == -1 || firstSemicolonAt < firstOpenBraceAt); - var isBroken = firstOpenBraceAt == -1 && firstSemicolonAt == -1; - if (isBroken) { - context.warnings.push('Broken declaration: \'' + chunk.substring(context.cursor) + '\'.'); - context.cursor = chunk.length; - } else if (isSingle) { - nextEnd = chunk.indexOf(';', nextSpecial + 1); - value = chunk.substring(context.cursor, nextEnd + 1); - - tokenized.push([ - 'at-rule', - [value].concat(context.track(value, true)) - ]); - - context.track(';'); - context.cursor = nextEnd + 1; - } else { - nextEnd = chunk.indexOf('{', nextSpecial + 1); - value = chunk.substring(context.cursor, nextEnd); + movedToBeDropped = movedToBeDropped.sort(naturalSorter); + for (j = 0, m = movedToBeDropped.length; j < m; j++) { + var dropAt = movedToBeDropped[j] - j; + movedProperties.splice(dropAt, 1); + } + } + + var position = tokens[0] && tokens[0][0] == Token.AT_RULE && tokens[0][1].indexOf('@charset') === 0 ? 1 : 0; + for (; position < tokens.length - 1; position++) { + var isImportRule = tokens[position][0] === Token.AT_RULE && tokens[position][1].indexOf('@import') === 0; + var isComment = tokens[position][0] === Token.COMMENT; + if (!(isImportRule || isComment)) + break; + } + + for (i = 0; i < movedProperties.length; i++) { + dropPropertiesAt(position, movedProperties[i]); + } +} - var trimmedValue = value.trim(); - var isFlat = flatBlock.test(trimmedValue); - oldMode = context.mode; - context.cursor = nextEnd + 1; - context.mode = isFlat ? 'body' : 'block'; +module.exports = restructure; - newToken = [ - isFlat ? 'flat-block' : 'block' - ]; +},{"../../tokenizer/token":82,"../../utils/clone-array":84,"../../writer/one-time":97,"./extract-properties":23,"./is-mergeable":25,"./reorderable":46,"./tidy-rule-duplicates":53}],50:[function(require,module,exports){ +var MODIFIER_PATTERN = /\-\-.+$/; - newToken.push([trimmedValue].concat(context.track(value, true))); - context.track('{'); - newToken.push(intoTokens(context)); +function rulesOverlap(rule1, rule2, bemMode) { + var scope1; + var scope2; + var i, l; + var j, m; - if (typeof newToken[2] == 'string') - newToken[2] = extractProperties(newToken[2], [[trimmedValue]], context); + for (i = 0, l = rule1.length; i < l; i++) { + scope1 = rule1[i][1]; - context.mode = oldMode; - context.track('}'); + for (j = 0, m = rule2.length; j < m; j++) { + scope2 = rule2[j][1]; - tokenized.push(newToken); + if (scope1 == scope2) { + return true; } - } else if (what == 'escape') { - nextEnd = chunk.indexOf('__', nextSpecial + 1); - var escaped = chunk.substring(context.cursor, nextEnd + 2); - var isStartSourceMarker = !!context.sourceTracker.nextStart(escaped); - var isEndSourceMarker = !!context.sourceTracker.nextEnd(escaped); - - if (isStartSourceMarker) { - context.track(escaped); - context.state.push({ - source: context.source, - line: context.line, - column: context.column - }); - context.source = context.sourceTracker.nextStart(escaped).filename; - context.line = 1; - context.column = 0; - } else if (isEndSourceMarker) { - var oldState = context.state.pop(); - context.source = oldState.source; - context.line = oldState.line; - context.column = oldState.column; - context.track(escaped); - } else { - if (escaped.indexOf('__ESCAPED_COMMENT_SPECIAL') === 0) - tokenized.push(['text', [escaped]]); - context.track(escaped); + if (bemMode && withoutModifiers(scope1) == withoutModifiers(scope2)) { + return true; } + } + } - context.cursor = nextEnd + 2; - } else if (what == 'bodyStart') { - var selectors = extractSelectors(chunk.substring(context.cursor, nextSpecial), context); + return false; +} - oldMode = context.mode; - context.cursor = nextSpecial + 1; - context.mode = 'body'; +function withoutModifiers(scope) { + return scope.replace(MODIFIER_PATTERN, ''); +} - var body = extractProperties(intoTokens(context), selectors, context); +module.exports = rulesOverlap; - context.track('{'); - context.mode = oldMode; +},{}],51:[function(require,module,exports){ +var specificity = require('./specificity'); - tokenized.push([ - 'selector', - selectors, - body - ]); - } else if (what == 'bodyEnd') { - // extra closing brace at the top level can be safely ignored - if (context.mode == 'top') { - var at = context.cursor; - var warning = chunk[context.cursor] == '}' ? - 'Unexpected \'}\' in \'' + chunk.substring(at - 20, at + 20) + '\'. Ignoring.' : - 'Unexpected content: \'' + chunk.substring(at, nextSpecial + 1) + '\'. Ignoring.'; - - context.warnings.push(warning); - context.cursor = nextSpecial + 1; - continue; - } +function specificitiesOverlap(selector1, selector2, cache) { + var specificity1; + var specificity2; + var i, l; + var j, m; - if (context.mode == 'block') - context.track(chunk.substring(context.cursor, nextSpecial)); - if (context.mode != 'block') - tokenized = chunk.substring(context.cursor, nextSpecial); + for (i = 0, l = selector1.length; i < l; i++) { + specificity1 = findSpecificity(selector1[i][1], cache); - context.cursor = nextSpecial + 1; + for (j = 0, m = selector2.length; j < m; j++) { + specificity2 = findSpecificity(selector2[j][1], cache); - break; + if (specificity1[0] === specificity2[0] && specificity1[1] === specificity2[1] && specificity1[2] === specificity2[2]) { + return true; + } } } - return tokenized; + return false; } -module.exports = tokenize; - -},{"../source-maps/track":45,"../utils/split":68,"./extract-properties":55,"./extract-selectors":56,"path":79}],58:[function(require,module,exports){ -var path = require('path'); - -var rewriteUrls = require('./rewrite'); +function findSpecificity(selector, cache) { + var value; -function rebaseUrls(data, context) { - var rebaseOpts = { - absolute: context.options.explicitRoot, - relative: !context.options.explicitRoot && context.options.explicitTarget, - fromBase: context.options.relativeTo - }; + if (!(selector in cache)) { + cache[selector] = value = specificity(selector); + } - if (!rebaseOpts.absolute && !rebaseOpts.relative) - return data; + return value || cache[selector]; +} - if (rebaseOpts.absolute && context.options.explicitTarget) - context.warnings.push('Both \'root\' and output file given so rebasing URLs as absolute paths'); +module.exports = specificitiesOverlap; - if (rebaseOpts.absolute) - rebaseOpts.toBase = path.resolve(context.options.root); +},{"./specificity":52}],52:[function(require,module,exports){ +var Marker = require('../../tokenizer/marker'); - if (rebaseOpts.relative) - rebaseOpts.toBase = path.resolve(context.options.target); +var Selector = { + ADJACENT_SIBLING: '+', + DESCENDANT: '>', + DOT: '.', + HASH: '#', + NON_ADJACENT_SIBLING: '~', + PSEUDO: ':' +}; - if (!rebaseOpts.fromBase || !rebaseOpts.toBase) - return data; +var LETTER_PATTERN = /[a-zA-Z]/; +var NOT_PREFIX = ':not('; +var SEPARATOR_PATTERN = /[\s,\(>~\+]/; + +function specificity(selector) { + var result = [0, 0, 0]; + var character; + var isEscaped; + var isSingleQuoted; + var isDoubleQuoted; + var roundBracketLevel = 0; + var couldIntroduceNewTypeSelector; + var withinNotPseudoClass = false; + var wasPseudoClass = false; + var i, l; + + for (i = 0, l = selector.length; i < l; i++) { + character = selector[i]; + + if (isEscaped) { + // noop + } else if (character == Marker.SINGLE_QUOTE && !isDoubleQuoted && !isSingleQuoted) { + isSingleQuoted = true; + } else if (character == Marker.SINGLE_QUOTE && !isDoubleQuoted && isSingleQuoted) { + isSingleQuoted = false; + } else if (character == Marker.DOUBLE_QUOTE && !isDoubleQuoted && !isSingleQuoted) { + isDoubleQuoted = true; + } else if (character == Marker.DOUBLE_QUOTE && isDoubleQuoted && !isSingleQuoted) { + isDoubleQuoted = false; + } else if (isSingleQuoted || isDoubleQuoted) { + continue; + } else if (roundBracketLevel > 0 && !withinNotPseudoClass) { + // noop + } else if (character == Marker.OPEN_ROUND_BRACKET) { + roundBracketLevel++; + } else if (character == Marker.CLOSE_ROUND_BRACKET && roundBracketLevel == 1) { + roundBracketLevel--; + withinNotPseudoClass = false; + } else if (character == Marker.CLOSE_ROUND_BRACKET) { + roundBracketLevel--; + } else if (character == Selector.HASH) { + result[0]++; + } else if (character == Selector.DOT || character == Marker.OPEN_SQUARE_BRACKET) { + result[1]++; + } else if (character == Selector.PSEUDO && !wasPseudoClass && !isNotPseudoClass(selector, i)) { + result[1]++; + withinNotPseudoClass = false; + } else if (character == Selector.PSEUDO) { + withinNotPseudoClass = true; + } else if ((i === 0 || couldIntroduceNewTypeSelector) && LETTER_PATTERN.test(character)) { + result[2]++; + } + + isEscaped = character == Marker.BACK_SLASH; + wasPseudoClass = character == Selector.PSEUDO; + couldIntroduceNewTypeSelector = !isEscaped && SEPARATOR_PATTERN.test(character); + } - return rewriteUrls(data, rebaseOpts, context); + return result; } -module.exports = rebaseUrls; - -},{"./rewrite":60,"path":79}],59:[function(require,module,exports){ -var split = require('../utils/split'); - -var URL_PREFIX = 'url('; -var UPPERCASE_URL_PREFIX = 'URL('; -var URL_SUFFIX = ')'; -var SINGLE_QUOTE_URL_SUFFIX = '\')'; -var DOUBLE_QUOTE_URL_SUFFIX = '")'; +function isNotPseudoClass(selector, index) { + return selector.indexOf(NOT_PREFIX, index) === index; +} -var DATA_URI_PREFIX_PATTERN = /^\s*['"]?\s*data:/; -var DATA_URI_TRAILER_PATTERN = /[\s\};,\/!]/; +module.exports = specificity; -var IMPORT_URL_PREFIX = '@import'; -var UPPERCASE_IMPORT_URL_PREFIX = '@IMPORT'; +},{"../../tokenizer/marker":81}],53:[function(require,module,exports){ +function ruleSorter(s1, s2) { + return s1[1] > s2[1] ? 1 : -1; +} -var COMMENT_END_MARKER = /\*\//; +function tidyRuleDuplicates(rules) { + var list = []; + var repeated = []; -function byUrl(data, context, callback) { - var nextStart = 0; - var nextStartUpperCase = 0; - var nextEnd = 0; - var firstMatch; - var isDataURI = false; - var cursor = 0; - var tempData = []; - var hasUppercaseUrl = data.indexOf(UPPERCASE_URL_PREFIX) > -1; + for (var i = 0, l = rules.length; i < l; i++) { + var rule = rules[i]; - for (; nextEnd < data.length;) { - nextStart = data.indexOf(URL_PREFIX, nextEnd); - nextStartUpperCase = hasUppercaseUrl ? data.indexOf(UPPERCASE_URL_PREFIX, nextEnd) : -1; - if (nextStart == -1 && nextStartUpperCase == -1) - break; + if (repeated.indexOf(rule[1]) == -1) { + repeated.push(rule[1]); + list.push(rule); + } + } - if (nextStart == -1 && nextStartUpperCase > -1) - nextStart = nextStartUpperCase; + return list.sort(ruleSorter); +} - if (data[nextStart + URL_PREFIX.length] == '"') { - nextEnd = data.indexOf(DOUBLE_QUOTE_URL_SUFFIX, nextStart); - } else if (data[nextStart + URL_PREFIX.length] == '\'') { - nextEnd = data.indexOf(SINGLE_QUOTE_URL_SUFFIX, nextStart); - } else { - isDataURI = DATA_URI_PREFIX_PATTERN.test(data.substring(nextStart + URL_PREFIX.length)); +module.exports = tidyRuleDuplicates; - if (isDataURI) { - firstMatch = split(data.substring(nextStart), DATA_URI_TRAILER_PATTERN, false, '(', ')', true).pop(); +},{}],54:[function(require,module,exports){ +function removeUnused(properties) { + for (var i = properties.length - 1; i >= 0; i--) { + var property = properties[i]; - if (firstMatch && firstMatch[firstMatch.length - 1] == URL_SUFFIX) { - nextEnd = nextStart + firstMatch.length - URL_SUFFIX.length; - } else { - nextEnd = -1; - } - } else { - nextEnd = data.indexOf(URL_SUFFIX, nextStart); - } + if (property.unused) { + property.all.splice(property.position, 1); } + } +} +module.exports = removeUnused; - // Following lines are a safety mechanism to ensure - // incorrectly terminated urls are processed correctly. - if (nextEnd == -1) { - nextEnd = data.indexOf('}', nextStart); - - if (nextEnd == -1) - nextEnd = data.length; - else - nextEnd--; +},{}],55:[function(require,module,exports){ +var Hack = require('./hack'); - context.warnings.push('Broken URL declaration: \'' + data.substring(nextStart, nextEnd + 1) + '\'.'); - } else { - if (data[nextEnd] != URL_SUFFIX) - nextEnd = data.indexOf(URL_SUFFIX, nextEnd); - } +var Marker = require('../tokenizer/marker'); - tempData.push(data.substring(cursor, nextStart)); +var ASTERISK_HACK = '*'; +var BACKSLASH_HACK = '\\9'; +var IMPORTANT_TOKEN = '!important'; +var UNDERSCORE_HACK = '_'; +var BANG_HACK = '!ie'; - var url = data.substring(nextStart, nextEnd + 1); - callback(url, tempData); +function restoreFromOptimizing(properties, restoreCallback) { + var property; + var restored; + var current; + var i; - cursor = nextEnd + 1; - } + for (i = properties.length - 1; i >= 0; i--) { + property = properties[i]; - return tempData.length > 0 ? - tempData.join('') + data.substring(cursor, data.length) : - data; -} + if (property.unused) { + continue; + } -function byImport(data, context, callback) { - var nextImport = 0; - var nextImportUpperCase = 0; - var nextStart = 0; - var nextEnd = 0; - var cursor = 0; - var tempData = []; - var nextSingleQuote = 0; - var nextDoubleQuote = 0; - var untilNextQuote; - var withQuote; - var SINGLE_QUOTE = '\''; - var DOUBLE_QUOTE = '"'; - - for (; nextEnd < data.length;) { - nextImport = data.indexOf(IMPORT_URL_PREFIX, nextEnd); - nextImportUpperCase = data.indexOf(UPPERCASE_IMPORT_URL_PREFIX, nextEnd); - if (nextImport == -1 && nextImportUpperCase == -1) - break; + if (!property.dirty && !property.important && !property.hack) { + continue; + } - if (nextImport > -1 && nextImportUpperCase > -1 && nextImportUpperCase < nextImport) - nextImport = nextImportUpperCase; - - nextSingleQuote = data.indexOf(SINGLE_QUOTE, nextImport); - nextDoubleQuote = data.indexOf(DOUBLE_QUOTE, nextImport); - - if (nextSingleQuote > -1 && nextDoubleQuote > -1 && nextSingleQuote < nextDoubleQuote) { - nextStart = nextSingleQuote; - withQuote = SINGLE_QUOTE; - } else if (nextSingleQuote > -1 && nextDoubleQuote > -1 && nextSingleQuote > nextDoubleQuote) { - nextStart = nextDoubleQuote; - withQuote = DOUBLE_QUOTE; - } else if (nextSingleQuote > -1) { - nextStart = nextSingleQuote; - withQuote = SINGLE_QUOTE; - } else if (nextDoubleQuote > -1) { - nextStart = nextDoubleQuote; - withQuote = DOUBLE_QUOTE; + if (restoreCallback) { + restored = restoreCallback(property); + property.value = restored; } else { - break; + restored = property.value; } - tempData.push(data.substring(cursor, nextStart)); - nextEnd = data.indexOf(withQuote, nextStart + 1); + if (property.important) { + restoreImportant(property); + } - untilNextQuote = data.substring(nextImport, nextEnd); - if (nextEnd == -1 || /^@import\s+(url\(|__ESCAPED)/i.test(untilNextQuote) || COMMENT_END_MARKER.test(untilNextQuote)) { - cursor = nextStart; - break; + if (property.hack) { + restoreHack(property); } - var url = data.substring(nextStart, nextEnd + 1); - callback(url, tempData); + if ('all' in property) { + current = property.all[property.position]; + current[1][1] = property.name; - cursor = nextEnd + 1; + current.splice(2, current.length - 1); + Array.prototype.push.apply(current, restored); + } } - - return tempData.length > 0 ? - tempData.join('') + data.substring(cursor, data.length) : - data; } -function reduceAll(data, context, callback) { - data = byUrl(data, context, callback); - data = byImport(data, context, callback); - return data; +function restoreImportant(property) { + property.value[property.value.length - 1][1] += IMPORTANT_TOKEN; } -module.exports = reduceAll; - -},{"../utils/split":68}],60:[function(require,module,exports){ -(function (process){ -var path = require('path'); -var url = require('url'); +function restoreHack(property) { + if (property.hack == Hack.UNDERSCORE) { + property.name = UNDERSCORE_HACK + property.name; + } else if (property.hack == Hack.ASTERISK) { + property.name = ASTERISK_HACK + property.name; + } else if (property.hack == Hack.BACKSLASH) { + property.value[property.value.length - 1][1] += BACKSLASH_HACK; + } else if (property.hack == Hack.BANG) { + property.value[property.value.length - 1][1] += Marker.SPACE + BANG_HACK; + } +} -var reduceUrls = require('./reduce'); +module.exports = restoreFromOptimizing; -var isWindows = process.platform == 'win32'; +},{"../tokenizer/marker":81,"./hack":9}],56:[function(require,module,exports){ +var Units = [ + '%', + 'ch', + 'cm', + 'em', + 'ex', + 'in', + 'mm', + 'pc', + 'pt', + 'px', + 'rem', + 'vh', + 'vm', + 'vmax', + 'vmin', + 'vw' +]; +var cssUnitRegexStr = '(\\-?\\.?\\d+\\.?\\d*(' + Units.join('|') + '|)|auto|inherit)'; +var cssCalcRegexStr = '(\\-moz\\-|\\-webkit\\-)?calc\\([^\\)]+\\)'; +var cssFunctionNoVendorRegexStr = '[A-Z]+(\\-|[A-Z]|[0-9])+\\(.*?\\)'; +var cssFunctionVendorRegexStr = '\\-(\\-|[A-Z]|[0-9])+\\(.*?\\)'; +var cssVariableRegexStr = 'var\\(\\-\\-[^\\)]+\\)'; +var cssFunctionAnyRegexStr = '(' + cssVariableRegexStr + '|' + cssFunctionNoVendorRegexStr + '|' + cssFunctionVendorRegexStr + ')'; +var cssUnitOrCalcRegexStr = '(' + cssUnitRegexStr + '|' + cssCalcRegexStr + ')'; -function isAbsolute(uri) { - return uri[0] == '/'; -} +var cssFunctionNoVendorRegex = new RegExp('^' + cssFunctionNoVendorRegexStr + '$', 'i'); +var cssVariableRegex = new RegExp('^' + cssVariableRegexStr + '$', 'i'); +var cssFunctionAnyRegex = new RegExp('^' + cssFunctionAnyRegexStr + '$', 'i'); +var cssUnitRegex = new RegExp('^' + cssUnitRegexStr + '$', 'i'); +var cssUnitOrCalcRegex = new RegExp('^' + cssUnitOrCalcRegexStr + '$', 'i'); -function isSVGMarker(uri) { - return uri[0] == '#'; -} +var urlRegex = /^url\([\s\S]+\)$/i; + +var globalKeywords = [ + 'inherit', + 'initial', + 'unset' +]; + +var Keywords = { + '*-style': [ + 'auto', + 'dashed', + 'dotted', + 'double', + 'groove', + 'hidden', + 'inset', + 'none', + 'outset', + 'ridge', + 'solid' + ], + 'background-attachment': [ + 'fixed', + 'inherit', + 'local', + 'scroll' + ], + 'background-clip': [ + 'border-box', + 'content-box', + 'inherit', + 'padding-box', + 'text' + ], + 'background-origin': [ + 'border-box', + 'content-box', + 'inherit', + 'padding-box' + ], + 'background-position': [ + 'bottom', + 'center', + 'left', + 'right', + 'top' + ], + 'background-repeat': [ + 'no-repeat', + 'inherit', + 'repeat', + 'repeat-x', + 'repeat-y', + 'round', + 'space' + ], + 'background-size': [ + 'auto', + 'cover', + 'contain' + ], + 'border-collapse': [ + 'collapse', + 'inherit', + 'separate' + ], + 'bottom': [ + 'auto' + ], + 'clear': [ + 'both', + 'left', + 'none', + 'right' + ], + 'cursor': [ + 'all-scroll', + 'auto', + 'col-resize', + 'crosshair', + 'default', + 'e-resize', + 'help', + 'move', + 'n-resize', + 'ne-resize', + 'no-drop', + 'not-allowed', + 'nw-resize', + 'pointer', + 'progress', + 'row-resize', + 's-resize', + 'se-resize', + 'sw-resize', + 'text', + 'vertical-text', + 'w-resize', + 'wait' + ], + 'display': [ + 'block', + 'inline', + 'inline-block', + 'inline-table', + 'list-item', + 'none', + 'table', + 'table-caption', + 'table-cell', + 'table-column', + 'table-column-group', + 'table-footer-group', + 'table-header-group', + 'table-row', + 'table-row-group' + ], + 'float': [ + 'left', + 'none', + 'right' + ], + 'left': [ + 'auto' + ], + 'font-style': [ + 'italic', + 'normal', + 'oblique' + ], + 'font-weight': [ + '100', + '200', + '300', + '400', + '500', + '600', + '700', + '800', + '900', + 'bold', + 'bolder', + 'lighter', + 'normal' + ], + 'list-style-position': [ + 'inside', + 'outside' + ], + 'list-style-type': [ + 'armenian', + 'circle', + 'decimal', + 'decimal-leading-zero', + 'disc', + 'decimal|disc', // this is the default value of list-style-type, see comment in compactable.js + 'georgian', + 'lower-alpha', + 'lower-greek', + 'lower-latin', + 'lower-roman', + 'none', + 'square', + 'upper-alpha', + 'upper-latin', + 'upper-roman' + ], + 'overflow': [ + 'auto', + 'hidden', + 'scroll', + 'visible' + ], + 'position': [ + 'absolute', + 'fixed', + 'relative', + 'static' + ], + 'right': [ + 'auto' + ], + 'text-align': [ + 'center', + 'justify', + 'left', + 'left|right', // this is the default value of list-style-type, see comment in compactable.js + 'right' + ], + 'text-decoration': [ + 'line-through', + 'none', + 'overline', + 'underline' + ], + 'text-overflow': [ + 'clip', + 'ellipsis' + ], + 'top': [ + 'auto' + ], + 'vertical-align': [ + 'baseline', + 'bottom', + 'middle', + 'sub', + 'super', + 'text-bottom', + 'text-top', + 'top' + ], + 'visibility': [ + 'collapse', + 'hidden', + 'visible' + ], + 'white-space': [ + 'normal', + 'nowrap', + 'pre' + ], + 'width': [ + 'inherit', + 'initial', + 'medium', + 'thick', + 'thin' + ] +}; -function isEscaped(uri) { - return uri.indexOf('__ESCAPED_URL_CLEAN_CSS__') === 0; -} +var VENDOR_PREFIX_PATTERN = /(^|\W)-\w+\-/; -function isInternal(uri) { - return /^\w+:\w+/.test(uri); -} +function areSameFunction(value1, value2) { + if (!isValidFunction(value1) || !isValidFunction(value2)) { + return false; + } -function isRemote(uri) { - return /^[^:]+?:\/\//.test(uri) || uri.indexOf('//') === 0; -} + var function1Name = value1.substring(0, value1.indexOf('(')); + var function2Name = value2.substring(0, value2.indexOf('(')); -function isSameOrigin(uri1, uri2) { - return url.parse(uri1).protocol == url.parse(uri2).protocol && - url.parse(uri1).host == url.parse(uri2).host; + return function1Name === function2Name; } -function isImport(uri) { - return uri.lastIndexOf('.css') === uri.length - 4; +function hasNoVendorPrefix(value) { + return VENDOR_PREFIX_PATTERN.test(value); } -function isData(uri) { - return uri.indexOf('data:') === 0; +function isValidBackgroundAttachment(value) { + return Keywords['background-attachment'].indexOf(value) > -1; } -function absolute(uri, options) { - return path - .resolve(path.join(options.fromBase || '', uri)) - .replace(options.toBase, ''); +function isValidBackgroundClip(value) { + return Keywords['background-clip'].indexOf(value) > -1; } -function relative(uri, options) { - return path.relative(options.toBase, path.join(options.fromBase || '', uri)); +function isValidBackgroundRepeat(value) { + return Keywords['background-repeat'].indexOf(value) > -1; } -function normalize(uri) { - return isWindows ? uri.replace(/\\/g, '/') : uri; +function isValidBackgroundOrigin(value) { + return Keywords['background-origin'].indexOf(value) > -1; } -function rebase(uri, options) { - if (isAbsolute(uri) || isSVGMarker(uri) || isEscaped(uri) || isInternal(uri)) - return uri; - - if (options.rebase === false && !isImport(uri)) - return uri; - - if (!options.imports && isImport(uri)) - return uri; - - if (isData(uri)) - return '\'' + uri + '\''; +function isValidBackgroundPosition(value) { + var parts; + var i, l; - if (isRemote(uri) && !isRemote(options.toBase)) - return uri; + if (value === 'inherit') { + return true; + } - if (isRemote(uri) && !isSameOrigin(uri, options.toBase)) - return uri; + parts = value.split(' '); + for (i = 0, l = parts.length; i < l; i++) { + if (parts[i] === '') { + continue; + } else if (isValidBackgroundPositionPart(parts[i])) { + continue; + } - if (!isRemote(uri) && isRemote(options.toBase)) - return url.resolve(options.toBase, uri); + return false; + } - return options.absolute ? - normalize(absolute(uri, options)) : - normalize(relative(uri, options)); + return true; } -function quoteFor(url) { - if (url.indexOf('\'') > -1) - return '"'; - else if (url.indexOf('"') > -1) - return '\''; - else if (/\s/.test(url) || /[\(\)]/.test(url)) - return '\''; - else - return ''; +function isValidBackgroundPositionPart(value) { + return Keywords['background-position'].indexOf(value) > -1 || cssUnitOrCalcRegex.test(value); } -function rewriteUrls(data, options, context) { - return reduceUrls(data, context, function (originUrl, tempData) { - var url = originUrl.replace(/^(url\()?\s*['"]?|['"]?\s*\)?$/g, ''); - var match = originUrl.match(/^(url\()?\s*(['"]).*?(['"])\s*\)?$/); - var quote; - if (!!options.urlQuotes && match && match[2] === match[3]) { - quote = match[2]; - } else { - quote = quoteFor(url); - } - tempData.push('url(' + quote + rebase(url, options) + quote + ')'); - }); +function isValidBackgroundSizePart(value) { + return Keywords['background-size'].indexOf(value) > -1 || cssUnitRegex.test(value); } -module.exports = rewriteUrls; - -}).call(this,require('_process')) -},{"./reduce":59,"_process":81,"path":79,"url":139}],61:[function(require,module,exports){ -function cloneArray(array) { - var cloned = array.slice(0); - - for (var i = 0, l = cloned.length; i < l; i++) { - if (Array.isArray(cloned[i])) - cloned[i] = cloneArray(cloned[i]); - } - - return cloned; +function isValidColor(value) { + return isValidNamedColor(value) || + isValidColorValue(value); } -module.exports = cloneArray; +function isValidColorValue(value) { + return isValidHexColor(value) || + isValidRgbaColor(value) || + isValidHslaColor(value); +} -},{}],62:[function(require,module,exports){ -var util = require('util'); +function isValidFunction(value) { + return !urlRegex.test(value) && cssFunctionAnyRegex.test(value); +} -var DEFAULTS = { - '*': { - colors: { - opacity: true // rgba / hsla - }, - properties: { - backgroundClipMerging: false, // background-clip to shorthand - backgroundOriginMerging: false, // background-origin to shorthand - backgroundSizeMerging: false, // background-size to shorthand - colors: true, // any kind of color transformations, like `#ff00ff` to `#f0f` or `#fff` into `red` - ieBangHack: false, // !ie suffix hacks on IE<8 - iePrefixHack: false, // underscore / asterisk prefix hacks on IE - ieSuffixHack: true, // \9 suffix hacks on IE6-9 - merging: true, // merging properties into one - shorterLengthUnits: false, // optimize pixel units into `pt`, `pc` or `in` units - spaceAfterClosingBrace: true, // 'url() no-repeat' to 'url()no-repeat' - urlQuotes: false, // whether to wrap content of `url()` into quotes or not - zeroUnits: true // 0[unit] -> 0 - }, - selectors: { - adjacentSpace: false, // div+ nav Android stock browser hack - ie7Hack: false, // *+html hack - special: /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:dir\([a-z-]*\)|:first(?![a-z-])|:fullscreen|:left|:read-only|:read-write|:right|:placeholder|:host|:content|\/deep\/|:shadow|:selection|^,)/ // special selectors which prevent merging - }, - units: { - ch: true, - in: true, - pc: true, - pt: true, - rem: true, - vh: true, - vm: true, // vm is vmin on IE9+ see https://developer.mozilla.org/en-US/docs/Web/CSS/length - vmax: true, - vmin: true, - vw: true - } - }, - 'ie8': { - colors: { - opacity: false - }, - properties: { - backgroundClipMerging: false, - backgroundOriginMerging: false, - backgroundSizeMerging: false, - colors: true, - ieBangHack: false, - iePrefixHack: true, - ieSuffixHack: true, - merging: false, - shorterLengthUnits: false, - spaceAfterClosingBrace: true, - urlQuotes: false, - zeroUnits: true - }, - selectors: { - adjacentSpace: false, - ie7Hack: false, - special: /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:root|:nth|:first\-of|:last|:only|:empty|:target|:checked|::selection|:enabled|:disabled|:not|:placeholder|:host|::content|\/deep\/|::shadow|^,)/ - }, - units: { - ch: false, - in: true, - pc: true, - pt: true, - rem: false, - vh: false, - vm: false, - vmax: false, - vmin: false, - vw: false - } - }, - 'ie7': { - colors: { - opacity: false - }, - properties: { - backgroundClipMerging: false, - backgroundOriginMerging: false, - backgroundSizeMerging: false, - colors: true, - ieBangHack: true, - iePrefixHack: true, - ieSuffixHack: true, - merging: false, - shorterLengthUnits: false, - spaceAfterClosingBrace: true, - urlQuotes: false, - zeroUnits: true - }, - selectors: { - adjacentSpace: false, - ie7Hack: true, - special: /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:focus|:before|:after|:root|:nth|:first\-of|:last|:only|:empty|:target|:checked|::selection|:enabled|:disabled|:not|:placeholder|:host|::content|\/deep\/|::shadow|^,)/ - }, - units: { - ch: false, - in: true, - pc: true, - pt: true, - rem: false, - vh: false, - vm: false, - vmax: false, - vmin: false, - vw: false, - } - } -}; +function isValidFunctionWithoutVendorPrefix(value) { + return !urlRegex.test(value) && cssFunctionNoVendorRegex.test(value); +} -function Compatibility(source) { - this.source = source || {}; +function isValidGlobalValue(value) { + return globalKeywords.indexOf(value) > -1; } -function merge(source, target) { - for (var key in source) { - var value = source[key]; +function isValidHexColor(value) { + return (value.length === 4 || value.length === 7) && value[0] === '#'; +} - if (typeof value === 'object' && !util.isRegExp(value)) - target[key] = merge(value, target[key] || {}); - else - target[key] = key in target ? target[key] : value; - } +function isValidHslaColor(value) { + return value.length > 0 && value.indexOf('hsla(') === 0 && value.indexOf(')') === value.length - 1; +} - return target; +function isValidImage(value) { + return value == 'none' || value == 'inherit' || isValidUrl(value); } -function calculateSource(source) { - if (typeof source == 'object') - return source; +function isValidKeywordValue(propertyName, value, includeGlobal) { + return Keywords[propertyName].indexOf(value) > -1 || includeGlobal && isValidGlobalValue(value); +} - if (!/[,\+\-]/.test(source)) - return DEFAULTS[source] || DEFAULTS['*']; +function isValidListStyleType(value) { + return Keywords['list-style-type'].indexOf(value) > -1; +} - var parts = source.split(','); - var template = parts[0] in DEFAULTS ? - DEFAULTS[parts.shift()] : - DEFAULTS['*']; +function isValidListStylePosition(value) { + return Keywords['list-style-position'].indexOf(value) > -1; +} - source = {}; +function isValidNamedColor(value) { + // We don't really check if it's a valid color value, but allow any letters in it + return value !== 'auto' && (value === 'transparent' || value === 'inherit' || /^[a-zA-Z]+$/.test(value)); +} - parts.forEach(function (part) { - var isAdd = part[0] == '+'; - var key = part.substring(1).split('.'); - var group = key[0]; - var option = key[1]; +function isValidRgbaColor(value) { + return value.length > 0 && value.indexOf('rgba(') === 0 && value.indexOf(')') === value.length - 1; +} - source[group] = source[group] || {}; - source[group][option] = isAdd; - }); +function isValidStyle(value) { + return Keywords['*-style'].indexOf(value) > -1; +} - return merge(template, source); +function isValidTextShadow(compatibleCssUnitRegex, value) { + return isValidUnitWithoutFunction(compatibleCssUnitRegex, value) || + isValidColor(value) || + isValidGlobalValue(value); } -Compatibility.prototype.toOptions = function () { - return merge(DEFAULTS['*'], calculateSource(this.source)); -}; +function isValidUnit(compatibleCssUnitAnyRegex, value) { + return compatibleCssUnitAnyRegex.test(value); +} -module.exports = Compatibility; +function isValidUnitWithoutFunction(compatibleCssUnitRegex, value) { + return compatibleCssUnitRegex.test(value); +} -},{"util":144}],63:[function(require,module,exports){ -(function (process,global,Buffer){ -var SourceMapConsumer = require('source-map').SourceMapConsumer; +function isValidUrl(value) { + return urlRegex.test(value); +} -var fs = require('fs'); -var path = require('path'); -var http = require('http'); -var https = require('https'); -var url = require('url'); +function isValidVariable(value) { + return cssVariableRegex.test(value); +} -var override = require('../utils/object.js').override; +function isValidVendorPrefixedValue(value) { + return /^-([A-Za-z0-9]|-)*$/gi.test(value); +} -var MAP_MARKER = /\/\*# sourceMappingURL=(\S+) \*\//; -var REMOTE_RESOURCE = /^(https?:)?\/\//; -var DATA_URI = /^data:(\S*?)?(;charset=[^;]+)?(;[^,]+?)?,(.+)/; +function isValidWidth(compatibleCssUnitRegex, value) { + return isValidUnit(compatibleCssUnitRegex, value) || Keywords.width.indexOf(value) > -1; +} -var unescape = global.unescape; +function isValidZIndex(value) { + return value == 'auto' || + isValidGlobalValue(value) || + value.length > 0 && value == ('' + parseInt(value)); +} -function InputSourceMapStore(outerContext) { - this.options = outerContext.options; - this.errors = outerContext.errors; - this.warnings = outerContext.warnings; - this.sourceTracker = outerContext.sourceTracker; - this.timeout = this.options.inliner.timeout; - this.requestOptions = this.options.inliner.request; - this.localOnly = outerContext.localOnly; - this.relativeTo = outerContext.options.target || process.cwd(); +function validator(compatibility) { + var validUnits = Units.slice(0).filter(function (value) { + return !(value in compatibility.units) || compatibility.units[value] === true; + }); - this.maps = {}; - this.sourcesContent = {}; -} + var compatibleCssUnitRegexStr = '(\\-?\\.?\\d+\\.?\\d*(' + validUnits.join('|') + '|)|auto|inherit)'; + var compatibleCssUnitRegex = new RegExp('^' + compatibleCssUnitRegexStr + '$', 'i'); + var compatibleCssUnitAnyRegex = new RegExp('^(none|' + Keywords.width.join('|') + '|' + compatibleCssUnitRegexStr + '|' + cssVariableRegexStr + '|' + cssFunctionNoVendorRegexStr + '|' + cssFunctionVendorRegexStr + ')$', 'i'); + var colorOpacity = compatibility.colors.opacity; -function fromString(self, _, whenDone) { - self.trackLoaded(undefined, undefined, self.options.sourceMap); - return whenDone(); + return { + areSameFunction: areSameFunction, + colorOpacity: colorOpacity, + hasNoVendorPrefix: hasNoVendorPrefix, + isValidBackgroundAttachment: isValidBackgroundAttachment, + isValidBackgroundClip: isValidBackgroundClip, + isValidBackgroundOrigin: isValidBackgroundOrigin, + isValidBackgroundPosition: isValidBackgroundPosition, + isValidBackgroundPositionPart: isValidBackgroundPositionPart, + isValidBackgroundRepeat: isValidBackgroundRepeat, + isValidBackgroundSizePart: isValidBackgroundSizePart, + isValidColor: isValidColor, + isValidColorValue: isValidColorValue, + isValidFunction: isValidFunction, + isValidFunctionWithoutVendorPrefix: isValidFunctionWithoutVendorPrefix, + isValidGlobalValue: isValidGlobalValue, + isValidHexColor: isValidHexColor, + isValidHslaColor: isValidHslaColor, + isValidImage: isValidImage, + isValidKeywordValue: isValidKeywordValue, + isValidListStylePosition: isValidListStylePosition, + isValidListStyleType: isValidListStyleType, + isValidNamedColor: isValidNamedColor, + isValidRgbaColor: isValidRgbaColor, + isValidStyle: isValidStyle, + isValidTextShadow: isValidTextShadow.bind(null, compatibleCssUnitRegex), + isValidUnit: isValidUnit.bind(null, compatibleCssUnitAnyRegex), + isValidUnitWithoutFunction: isValidUnitWithoutFunction.bind(null, compatibleCssUnitRegex), + isValidUrl: isValidUrl, + isValidVariable: isValidVariable, + isValidVendorPrefixedValue: isValidVendorPrefixedValue, + isValidWidth: isValidWidth.bind(null, compatibleCssUnitRegex), + isValidZIndex: isValidZIndex + }; } -function fromSource(self, data, whenDone, context) { - var nextAt = 0; +module.exports = validator; - function proceedToNext() { - context.cursor += nextAt + 1; - fromSource(self, data, whenDone, context); - } +},{}],57:[function(require,module,exports){ +var Hack = require('./hack'); - while (context.cursor < data.length) { - var fragment = data.substring(context.cursor); +var Marker = require('../tokenizer/marker'); +var Token = require('../tokenizer/token'); - var markerStartMatch = self.sourceTracker.nextStart(fragment) || { index: -1 }; - var markerEndMatch = self.sourceTracker.nextEnd(fragment) || { index: -1 }; - var mapMatch = MAP_MARKER.exec(fragment) || { index: -1 }; - var sourceMapFile = mapMatch[1]; +var Match = { + ASTERISK: '*', + BACKSLASH: '\\', + BANG: '!', + BANG_SUFFIX_PATTERN: /!\w+$/, + IMPORTANT_TOKEN: '!important', + IMPORTANT_TOKEN_PATTERN: new RegExp('!important$', 'i'), + IMPORTANT_WORD: 'important', + IMPORTANT_WORD_PATTERN: new RegExp('important$', 'i'), + SUFFIX_BANG_PATTERN: /!$/, + UNDERSCORE: '_', + VARIABLE_REFERENCE_PATTERN: /var\(--.+\)$/ +}; - nextAt = data.length; - if (markerStartMatch.index > -1) - nextAt = markerStartMatch.index; - if (markerEndMatch.index > -1 && markerEndMatch.index < nextAt) - nextAt = markerEndMatch.index; - if (mapMatch.index > -1 && mapMatch.index < nextAt) - nextAt = mapMatch.index; +function wrapAll(properties, includeVariable) { + var wrapped = []; + var single; + var property; + var i; - if (nextAt == data.length) - break; + for (i = properties.length - 1; i >= 0; i--) { + property = properties[i]; - if (nextAt == markerStartMatch.index) { - context.files.push(markerStartMatch.filename); - } else if (nextAt == markerEndMatch.index) { - context.files.pop(); - } else if (nextAt == mapMatch.index) { - var isRemote = /^https?:\/\//.test(sourceMapFile) || /^\/\//.test(sourceMapFile); - var isDataUri = DATA_URI.test(sourceMapFile); + if (property[0] != Token.PROPERTY) { + continue; + } - if (isRemote) { - return fetchMapFile(self, sourceMapFile, context, proceedToNext); - } else { - var sourceFile = context.files[context.files.length - 1]; - var sourceMapPath, sourceMapData; - var sourceDir = sourceFile ? path.dirname(sourceFile) : self.options.relativeTo; - - if (isDataUri) { - // source map's path is the same as the source file it comes from - sourceMapPath = path.resolve(self.options.root, sourceFile || ''); - sourceMapData = fromDataUri(sourceMapFile); - } else { - sourceMapPath = path.resolve(self.options.root, path.join(sourceDir || '', sourceMapFile)); - sourceMapData = fs.readFileSync(sourceMapPath, 'utf-8'); - } - self.trackLoaded(sourceFile || undefined, sourceMapPath, sourceMapData); - } + if (!includeVariable && someVariableReferences(property)) { + continue; } - context.cursor += nextAt + 1; + single = wrapSingle(property); + single.all = properties; + single.position = i; + wrapped.unshift(single); } - return whenDone(); -} - -function fromDataUri(uriString) { - var match = DATA_URI.exec(uriString); - var charset = match[2] ? match[2].split(/[=;]/)[2] : 'us-ascii'; - var encoding = match[3] ? match[3].split(';')[1] : 'utf8'; - var data = encoding == 'utf8' ? unescape(match[4]) : match[4]; - - var buffer = new Buffer(data, encoding); - buffer.charset = charset; - - return buffer.toString(); + return wrapped; } -function fetchMapFile(self, sourceUrl, context, done) { - fetch(self, sourceUrl, function (data) { - self.trackLoaded(context.files[context.files.length - 1] || undefined, sourceUrl, data); - done(); - }, function (message) { - context.errors.push('Broken source map at "' + sourceUrl + '" - ' + message); - return done(); - }); -} +function someVariableReferences(property) { + var i, l; + var value; -function fetch(self, path, onSuccess, onFailure) { - var protocol = path.indexOf('https') === 0 ? https : http; - var requestOptions = override(url.parse(path), self.requestOptions); - var errorHandled = false; + // skipping `property` and property name tokens + for (i = 2, l = property.length; i < l; i++) { + value = property[i]; - protocol - .get(requestOptions, function (res) { - if (res.statusCode < 200 || res.statusCode > 299) - return onFailure(res.statusCode); + if (value[0] != Token.PROPERTY_VALUE) { + continue; + } - var chunks = []; - res.on('data', function (chunk) { - chunks.push(chunk.toString()); - }); - res.on('end', function () { - onSuccess(chunks.join('')); - }); - }) - .on('error', function (res) { - if (errorHandled) - return; + if (isVariableReference(value[1])) { + return true; + } + } - onFailure(res.message); - errorHandled = true; - }) - .on('timeout', function () { - if (errorHandled) - return; + return false; +} - onFailure('timeout'); - errorHandled = true; - }) - .setTimeout(self.timeout); +function isVariableReference(value) { + return Match.VARIABLE_REFERENCE_PATTERN.test(value); } -function originalPositionIn(trackedSource, line, column, token, allowNFallbacks) { - var originalPosition; - var maxRange = token.length; - var position = { - line: line, - column: column + maxRange - }; +function isMultiplex(property) { + var value; + var i, l; - while (maxRange-- > 0) { - position.column--; - originalPosition = trackedSource.data.originalPositionFor(position); + for (i = 3, l = property.length; i < l; i++) { + value = property[i]; - if (originalPosition) - break; + if (value[0] == Token.PROPERTY_VALUE && (value[1] == Marker.COMMA || value[1] == Marker.FORWARD_SLASH)) { + return true; + } } - if (originalPosition.line === null && line > 1 && allowNFallbacks > 0) - return originalPositionIn(trackedSource, line - 1, column, token, allowNFallbacks - 1); + return false; +} - if (trackedSource.path && originalPosition.source) { - originalPosition.source = REMOTE_RESOURCE.test(trackedSource.path) ? - url.resolve(trackedSource.path, originalPosition.source) : - path.join(trackedSource.path, originalPosition.source); +function hackType(property) { + var type = false; + var name = property[1][1]; + var lastValue = property[property.length - 1]; - originalPosition.sourceResolved = true; + if (name[0] == Match.UNDERSCORE) { + type = Hack.UNDERSCORE; + } else if (name[0] == Match.ASTERISK) { + type = Hack.ASTERISK; + } else if (lastValue[1][0] == Match.BANG && !lastValue[1].match(Match.IMPORTANT_WORD_PATTERN)) { + type = Hack.BANG; + } else if (lastValue[1].indexOf(Match.BANG) > 0 && !lastValue[1].match(Match.IMPORTANT_WORD_PATTERN) && Match.BANG_SUFFIX_PATTERN.test(lastValue[1])) { + type = Hack.BANG; + } else if (lastValue[1].indexOf(Match.BACKSLASH) > 0 && lastValue[1].indexOf(Match.BACKSLASH) == lastValue[1].length - Match.BACKSLASH.length - 1) { + type = Hack.BACKSLASH; + } else if (lastValue[1].indexOf(Match.BACKSLASH) === 0 && lastValue[1].length == 2) { + type = Hack.BACKSLASH; } - return originalPosition; + return type; } -function trackContentSources(self, sourceFile) { - var consumer = self.maps[sourceFile].data; - var isRemote = REMOTE_RESOURCE.test(sourceFile); - var sourcesMapping = {}; +function isImportant(property) { + if (property.length < 3) + return false; - consumer.sources.forEach(function (file, index) { - var uniquePath = isRemote ? - url.resolve(path.dirname(sourceFile), file) : - path.relative(self.relativeTo, path.resolve(path.dirname(sourceFile || '.'), file)); + var lastValue = property[property.length - 1]; + if (Match.IMPORTANT_TOKEN_PATTERN.test(lastValue[1])) { + return true; + } else if (Match.IMPORTANT_WORD_PATTERN.test(lastValue[1]) && Match.SUFFIX_BANG_PATTERN.test(property[property.length - 2][1])) { + return true; + } - sourcesMapping[uniquePath] = consumer.sourcesContent && consumer.sourcesContent[index]; - }); - self.sourcesContent[sourceFile] = sourcesMapping; + return false; } -function _resolveSources(self, remaining, whenDone) { - function processNext() { - return _resolveSources(self, remaining, whenDone); - } - - if (remaining.length === 0) - return whenDone(); +function stripImportant(property) { + var lastValue = property[property.length - 1]; + var oneButLastValue = property[property.length - 2]; - var current = remaining.shift(); - var sourceFile = current[0]; - var originalFile = current[1]; - var isRemote = REMOTE_RESOURCE.test(sourceFile); + if (Match.IMPORTANT_TOKEN_PATTERN.test(lastValue[1])) { + lastValue[1] = lastValue[1].replace(Match.IMPORTANT_TOKEN_PATTERN, ''); + } else { + lastValue[1] = lastValue[1].replace(Match.IMPORTANT_WORD_PATTERN, ''); + oneButLastValue[1] = oneButLastValue[1].replace(Match.SUFFIX_BANG_PATTERN, ''); + } - if (isRemote && self.localOnly) { - self.warnings.push('No callback given to `#minify` method, cannot fetch a remote file from "' + originalFile + '"'); - return processNext(); + if (lastValue[1].length === 0) { + property.pop(); } - if (isRemote) { - fetch(self, originalFile, function (data) { - self.sourcesContent[sourceFile][originalFile] = data; - processNext(); - }, function (message) { - self.warnings.push('Broken original source file at "' + originalFile + '" - ' + message); - processNext(); - }); - } else { - var fullPath = path.join(self.options.root, originalFile); - if (fs.existsSync(fullPath)) - self.sourcesContent[sourceFile][originalFile] = fs.readFileSync(fullPath, 'utf-8'); - else - self.warnings.push('Missing original source file at "' + fullPath + '".'); - return processNext(); + if (oneButLastValue[1].length === 0) { + property.pop(); } } -InputSourceMapStore.prototype.track = function (data, whenDone) { - return typeof this.options.sourceMap == 'string' ? - fromString(this, data, whenDone) : - fromSource(this, data, whenDone, { files: [], cursor: 0, errors: this.errors }); -}; +function stripPrefixHack(property) { + property[1][1] = property[1][1].substring(1); +} -InputSourceMapStore.prototype.trackLoaded = function (sourcePath, mapPath, mapData) { - var relativeTo = this.options.explicitTarget ? this.options.target : this.options.root; - var isRemote = REMOTE_RESOURCE.test(sourcePath); +function stripSuffixHack(property, hackType) { + var lastValue = property[property.length - 1]; + lastValue[1] = lastValue[1] + .substring(0, lastValue[1].indexOf(hackType == Hack.BACKSLASH ? Match.BACKSLASH : Match.BANG)) + .trim(); - if (mapPath) { - mapPath = isRemote ? - path.dirname(mapPath) : - path.dirname(path.relative(relativeTo, mapPath)); + if (lastValue[1].length === 0) { + property.pop(); } +} - this.maps[sourcePath] = { - path: mapPath, - data: new SourceMapConsumer(mapData) - }; - - trackContentSources(this, sourcePath); -}; - -InputSourceMapStore.prototype.isTracking = function (source) { - return !!this.maps[source]; -}; - -InputSourceMapStore.prototype.originalPositionFor = function (sourceInfo, token, allowNFallbacks) { - return originalPositionIn(this.maps[sourceInfo.source], sourceInfo.line, sourceInfo.column, token, allowNFallbacks); -}; - -InputSourceMapStore.prototype.sourcesContentFor = function (contextSource) { - return this.sourcesContent[contextSource]; -}; - -InputSourceMapStore.prototype.resolveSources = function (whenDone) { - var toResolve = []; - - for (var sourceFile in this.sourcesContent) { - var contents = this.sourcesContent[sourceFile]; - for (var originalFile in contents) { - if (!contents[originalFile]) - toResolve.push([sourceFile, originalFile]); - } +function wrapSingle(property) { + var importantProperty = isImportant(property); + if (importantProperty) { + stripImportant(property); } - return _resolveSources(this, toResolve, whenDone); -}; + var hackProperty = hackType(property); + if (hackProperty == Hack.ASTERISK || hackProperty == Hack.UNDERSCORE) { + stripPrefixHack(property); + } else if (hackProperty == Hack.BACKSLASH || hackProperty == Hack.BANG) { + stripSuffixHack(property, hackProperty); + } -module.exports = InputSourceMapStore; + return { + block: property[2] && property[2][0] == Token.PROPERTY_BLOCK, + components: [], + dirty: false, + hack: hackProperty, + important: importantProperty, + name: property[1][1], + multiplex: property.length > 3 ? isMultiplex(property) : false, + position: 0, + shorthand: false, + unused: false, + value: property.slice(2) + }; +} -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"../utils/object.js":64,"_process":81,"buffer":6,"fs":4,"http":121,"https":72,"path":79,"source-map":110,"url":139}],64:[function(require,module,exports){ module.exports = { - override: function (source1, source2) { - var target = {}; - for (var key1 in source1) - target[key1] = source1[key1]; - for (var key2 in source2) - target[key2] = source2[key2]; + all: wrapAll, + single: wrapSingle +}; - return target; +},{"../tokenizer/marker":81,"../tokenizer/token":82,"./hack":9}],58:[function(require,module,exports){ +var DEFAULTS = { + '*': { + colors: { + opacity: true // rgba / hsla + }, + properties: { + backgroundClipMerging: true, // background-clip to shorthand + backgroundOriginMerging: true, // background-origin to shorthand + backgroundSizeMerging: true, // background-size to shorthand + colors: true, // any kind of color transformations, like `#ff00ff` to `#f0f` or `#fff` into `red` + ieBangHack: false, // !ie suffix hacks on IE<8 + ieFilters: false, // whether to preserve `filter` and `-ms-filter` properties + iePrefixHack: false, // underscore / asterisk prefix hacks on IE + ieSuffixHack: false, // \9 suffix hacks on IE6-9 + merging: true, // merging properties into one + shorterLengthUnits: false, // optimize pixel units into `pt`, `pc` or `in` units + spaceAfterClosingBrace: true, // 'url() no-repeat' to 'url()no-repeat' + urlQuotes: false, // whether to wrap content of `url()` into quotes or not + zeroUnits: true // 0[unit] -> 0 + }, + selectors: { + adjacentSpace: false, // div+ nav Android stock browser hack + ie7Hack: false, // *+html hack + mergeablePseudoClasses: [ + ':active', + ':after', + ':before', + ':empty', + ':checked', + ':disabled', + ':empty', + ':enabled', + ':first-child', + ':first-letter', + ':first-line', + ':first-of-type', + ':focus', + ':hover', + ':lang', + ':last-child', + ':last-of-type', + ':link', + ':not', + ':nth-child', + ':nth-last-child', + ':nth-last-of-type', + ':nth-of-type', + ':only-child', + ':only-of-type', + ':root', + ':target', + ':visited' + ], // selectors with these pseudo-classes can be merged as these are universally supported + mergeablePseudoElements: [ + '::after', + '::before', + '::first-letter', + '::first-line' + ] // selectors with these pseudo-elements can be merged as these are universally supported + }, + units: { + ch: true, + in: true, + pc: true, + pt: true, + rem: true, + vh: true, + vm: true, // vm is vmin on IE9+ see https://developer.mozilla.org/en-US/docs/Web/CSS/length + vmax: true, + vmin: true, + vw: true + } } }; -},{}],65:[function(require,module,exports){ -var COMMENT_START_MARK = '/*'; - -function QuoteScanner(data) { - this.data = data; -} - -var findQuoteEnd = function (data, matched, cursor, oldCursor) { - var commentEndMark = '*/'; - var escapeMark = '\\'; - var blockEndMark = '}'; - var dataPrefix = data.substring(oldCursor, cursor); - var commentEndedAt = dataPrefix.lastIndexOf(commentEndMark, cursor); - var commentStartedAt = findLastCommentStartedAt(dataPrefix, cursor); - var commentStarted = false; - - if (commentEndedAt >= cursor && commentStartedAt > -1) - commentStarted = true; - if (commentStartedAt < cursor && commentStartedAt > commentEndedAt) - commentStarted = true; +DEFAULTS.ie11 = DEFAULTS['*']; - if (commentStarted) { - var commentEndsAt = data.indexOf(commentEndMark, cursor); - if (commentEndsAt > -1) - return commentEndsAt; +DEFAULTS.ie10 = DEFAULTS['*']; - commentEndsAt = data.indexOf(blockEndMark, cursor); - return commentEndsAt > -1 ? commentEndsAt - 1 : data.length; +DEFAULTS.ie9 = merge(DEFAULTS['*'], { + properties: { + ieFilters: true, + ieSuffixHack: true } +}); - while (true) { - if (data[cursor] === undefined) - break; - if (data[cursor] == matched && (data[cursor - 1] != escapeMark || data[cursor - 2] == escapeMark)) - break; - - cursor++; +DEFAULTS.ie8 = merge(DEFAULTS.ie9, { + colors: { + opacity: false + }, + properties: { + backgroundClipMerging: false, + backgroundOriginMerging: false, + backgroundSizeMerging: false, + iePrefixHack: true, + merging: false + }, + selectors: { + mergeablePseudoClasses: [ + ':after', + ':before', + ':first-child', + ':first-letter', + ':focus', + ':hover', + ':visited' + ], + mergeablePseudoElements: [] + }, + units: { + ch: false, + rem: false, + vh: false, + vm: false, + vmax: false, + vmin: false, + vw: false } +}); - return cursor; -}; +DEFAULTS.ie7 = merge(DEFAULTS.ie8, { + properties: { + ieBangHack: true + }, + selectors: { + ie7Hack: true, + mergeablePseudoClasses: [ + ':first-child', + ':first-letter', + ':hover', + ':visited' + ] + }, +}); -function findLastCommentStartedAt(data, cursor) { - var position = cursor; +function compatibilityFrom(source) { + return merge(DEFAULTS['*'], calculateSource(source)); +} - while (position > -1) { - position = data.lastIndexOf(COMMENT_START_MARK, position); +function merge(source, target) { + for (var key in source) { + var value = source[key]; - if (position > -1 && data[position - 1] != '*') { - break; + if (typeof value === 'object' && !Array.isArray(value)) { + target[key] = merge(value, target[key] || {}); } else { - position--; + target[key] = key in target ? target[key] : value; } } - return position; -} - -function findNext(data, mark, startAt) { - var escapeMark = '\\'; - var candidate = startAt; - - while (true) { - candidate = data.indexOf(mark, candidate + 1); - if (candidate == -1) - return -1; - if (data[candidate - 1] != escapeMark) - return candidate; - } + return target; } -QuoteScanner.prototype.each = function (callback) { - var data = this.data; - var tempData = []; - var nextStart = 0; - var nextEnd = 0; - var cursor = 0; - var matchedMark = null; - var singleMark = '\''; - var doubleMark = '"'; - var dataLength = data.length; - - for (; nextEnd < data.length;) { - var nextStartSingle = findNext(data, singleMark, nextEnd); - var nextStartDouble = findNext(data, doubleMark, nextEnd); - - if (nextStartSingle == -1) - nextStartSingle = dataLength; - if (nextStartDouble == -1) - nextStartDouble = dataLength; - - if (nextStartSingle < nextStartDouble) { - nextStart = nextStartSingle; - matchedMark = singleMark; - } else { - nextStart = nextStartDouble; - matchedMark = doubleMark; - } - - if (nextStart == -1) - break; +function calculateSource(source) { + if (typeof source == 'object') + return source; - nextEnd = findQuoteEnd(data, matchedMark, nextStart + 1, cursor); - if (nextEnd == -1) - break; + if (!/[,\+\-]/.test(source)) + return DEFAULTS[source] || DEFAULTS['*']; - var text = data.substring(nextStart, nextEnd + 1); - tempData.push(data.substring(cursor, nextStart)); - if (text.length > 0) - callback(text, tempData, nextStart); + var parts = source.split(','); + var template = parts[0] in DEFAULTS ? + DEFAULTS[parts.shift()] : + DEFAULTS['*']; - cursor = nextEnd + 1; - } + source = {}; - return tempData.length > 0 ? - tempData.join('') + data.substring(cursor, data.length) : - data; -}; + parts.forEach(function (part) { + var isAdd = part[0] == '+'; + var key = part.substring(1).split('.'); + var group = key[0]; + var option = key[1]; -module.exports = QuoteScanner; + source[group] = source[group] || {}; + source[group][option] = isAdd; + }); -},{}],66:[function(require,module,exports){ -(function (Buffer){ -var path = require('path'); -var rewriteUrls = require('../urls/rewrite'); + return merge(template, source); +} -var REMOTE_RESOURCE = /^(https?:)?\/\//; +module.exports = compatibilityFrom; -function SourceReader(context, data) { - this.outerContext = context; - this.data = data; - this.sources = {}; -} +},{}],59:[function(require,module,exports){ +var override = require('../utils/override'); -SourceReader.prototype.sourceAt = function (path) { - return this.sources[path]; +var Breaks = { + AfterAtRule: 'afterAtRule', + AfterBlockBegins: 'afterBlockBegins', + AfterBlockEnds: 'afterBlockEnds', + AfterComment: 'afterComment', + AfterProperty: 'afterProperty', + AfterRuleBegins: 'afterRuleBegins', + AfterRuleEnds: 'afterRuleEnds', + BeforeBlockEnds: 'beforeBlockEnds', + BetweenSelectors: 'betweenSelectors' }; -SourceReader.prototype.trackSource = function (path, source) { - this.sources[path] = {}; - this.sources[path][path] = source; +var IndentWith = { + Space: ' ', + Tab: '\t' }; -SourceReader.prototype.toString = function () { - if (typeof this.data == 'string') - return fromString(this); - if (Buffer.isBuffer(this.data)) - return fromBuffer(this); - if (Array.isArray(this.data)) - return fromArray(this); - - return fromHash(this); +var Spaces = { + AroundSelectorRelation: 'aroundSelectorRelation', + BeforeBlockBegins: 'beforeBlockBegins', + BeforeValue: 'beforeValue' }; -function fromString(self) { - var data = self.data; - self.trackSource(undefined, data); - return data; -} - -function fromBuffer(self) { - var data = self.data.toString(); - self.trackSource(undefined, data); - return data; -} +var DEFAULTS = { + breaks: breaks(false), + indentBy: 0, + indentWith: IndentWith.Space, + spaces: spaces(false), + wrapAt: false +}; -function fromArray(self) { - return self.data - .map(function (source) { - return self.outerContext.options.processImport === false ? - source + '@shallow' : - source; - }) - .map(function (source) { - return !self.outerContext.options.relativeTo || /^https?:\/\//.test(source) ? - source : - path.relative(self.outerContext.options.relativeTo, source); - }) - .map(function (source) { return '@import url(' + source + ');'; }) - .join(''); -} - -function fromHash(self) { - var data = []; - var toBase = path.resolve(self.outerContext.options.target || self.outerContext.options.root); - - for (var source in self.data) { - var styles = self.data[source].styles; - var inputSourceMap = self.data[source].sourceMap; - var isRemote = REMOTE_RESOURCE.test(source); - var absoluteSource = isRemote ? source : path.resolve(source); - var absoluteSourcePath = path.dirname(absoluteSource); - - var rewriteOptions = { - absolute: self.outerContext.options.explicitRoot, - relative: !self.outerContext.options.explicitRoot, - imports: true, - rebase: self.outerContext.options.rebase, - fromBase: absoluteSourcePath, - toBase: isRemote ? absoluteSourcePath : toBase, - urlQuotes: self.outerContext.options.compatibility.properties.urlQuotes - }; - styles = rewriteUrls(styles, rewriteOptions, self.outerContext); +var BEAUTIFY_ALIAS = 'beautify'; +var KEEP_BREAKS_ALIAS = 'keep-breaks'; - self.trackSource(source, styles); +var OPTION_SEPARATOR = ';'; +var OPTION_NAME_VALUE_SEPARATOR = ':'; +var HASH_VALUES_OPTION_SEPARATOR = ','; +var HASH_VALUES_NAME_VALUE_SEPARATOR = '='; - styles = self.outerContext.sourceTracker.store(source, styles); +var FALSE_KEYWORD_1 = 'false'; +var FALSE_KEYWORD_2 = 'off'; +var TRUE_KEYWORD_1 = 'true'; +var TRUE_KEYWORD_2 = 'on'; - // here we assume source map lies in the same directory as `source` does - if (self.outerContext.options.sourceMap && inputSourceMap) - self.outerContext.inputSourceMapTracker.trackLoaded(source, source, inputSourceMap); +function breaks(value) { + var breakOptions = {}; - data.push(styles); - } + breakOptions[Breaks.AfterAtRule] = value; + breakOptions[Breaks.AfterBlockBegins] = value; + breakOptions[Breaks.AfterBlockEnds] = value; + breakOptions[Breaks.AfterComment] = value; + breakOptions[Breaks.AfterProperty] = value; + breakOptions[Breaks.AfterRuleBegins] = value; + breakOptions[Breaks.AfterRuleEnds] = value; + breakOptions[Breaks.BeforeBlockEnds] = value; + breakOptions[Breaks.BetweenSelectors] = value; - return data.join(''); + return breakOptions; } -module.exports = SourceReader; +function spaces(value) { + var spaceOptions = {}; -}).call(this,{"isBuffer":require("../../../is-buffer/index.js")}) -},{"../../../is-buffer/index.js":75,"../urls/rewrite":60,"path":79}],67:[function(require,module,exports){ -function SourceTracker() { - this.sources = []; -} + spaceOptions[Spaces.AroundSelectorRelation] = value; + spaceOptions[Spaces.BeforeBlockBegins] = value; + spaceOptions[Spaces.BeforeValue] = value; -SourceTracker.prototype.store = function (filename, data) { - this.sources.push(filename); + return spaceOptions; +} - return '__ESCAPED_SOURCE_CLEAN_CSS' + (this.sources.length - 1) + '__' + - data + - '__ESCAPED_SOURCE_END_CLEAN_CSS__'; -}; +function formatFrom(source) { + if (source === undefined || source === false) { + return false; + } -SourceTracker.prototype.nextStart = function (data) { - var next = /__ESCAPED_SOURCE_CLEAN_CSS(\d+)__/.exec(data); + if (typeof source == 'object' && 'indentBy' in source) { + source = override(source, { indentBy: parseInt(source.indentBy) }); + } - return next ? - { index: next.index, filename: this.sources[~~next[1]] } : - null; -}; + if (typeof source == 'object' && 'indentWith' in source) { + source = override(source, { indentWith: mapIndentWith(source.indentWith) }); + } -SourceTracker.prototype.nextEnd = function (data) { - return /__ESCAPED_SOURCE_END_CLEAN_CSS__/g.exec(data); -}; + if (typeof source == 'object') { + return override(DEFAULTS, source); + } -SourceTracker.prototype.removeAll = function (data) { - return data - .replace(/__ESCAPED_SOURCE_CLEAN_CSS\d+__/g, '') - .replace(/__ESCAPED_SOURCE_END_CLEAN_CSS__/g, ''); -}; + if (typeof source == 'object') { + return override(DEFAULTS, source); + } -module.exports = SourceTracker; + if (typeof source == 'string' && source == BEAUTIFY_ALIAS) { + return override(DEFAULTS, { + breaks: breaks(true), + indentBy: 2, + spaces: spaces(true) + }); + } -},{}],68:[function(require,module,exports){ -function split(value, separator, includeSeparator, openLevel, closeLevel, firstOnly) { - var withRegex = typeof separator != 'string'; - var hasSeparator = withRegex ? - separator.test(value) : - value.indexOf(separator); + if (typeof source == 'string' && source == KEEP_BREAKS_ALIAS) { + return override(DEFAULTS, { + breaks: { + afterAtRule: true, + afterBlockBegins: true, + afterBlockEnds: true, + afterComment: true, + afterRuleEnds: true, + beforeBlockEnds: true + } + }); + } - if (!hasSeparator) - return [value]; + if (typeof source == 'string') { + return override(DEFAULTS, toHash(source)); + } - openLevel = openLevel || '('; - closeLevel = closeLevel || ')'; + return DEFAULTS; +} - if (value.indexOf(openLevel) == -1 && !includeSeparator && !firstOnly) - return value.split(separator); +function toHash(string) { + return string + .split(OPTION_SEPARATOR) + .reduce(function (accumulator, directive) { + var parts = directive.split(OPTION_NAME_VALUE_SEPARATOR); + var name = parts[0]; + var value = parts[1]; - var level = 0; - var cursor = 0; - var lastStart = 0; - var len = value.length; - var tokens = []; + if (name == 'breaks' || name == 'spaces') { + accumulator[name] = hashValuesToHash(value); + } else if (name == 'indentBy' || name == 'wrapAt') { + accumulator[name] = parseInt(value); + } else if (name == 'indentWith') { + accumulator[name] = mapIndentWith(value); + } - while (cursor < len) { - if (value[cursor] == openLevel) { - level++; - } else if (value[cursor] == closeLevel) { - level--; - } + return accumulator; + }, {}); +} - if (level === 0 && cursor > 0 && cursor + 1 < len && (withRegex ? separator.test(value[cursor]) : value[cursor] == separator)) { - tokens.push(value.substring(lastStart, cursor + (includeSeparator ? 1 : 0))); - lastStart = cursor + 1; +function hashValuesToHash(string) { + return string + .split(HASH_VALUES_OPTION_SEPARATOR) + .reduce(function (accumulator, directive) { + var parts = directive.split(HASH_VALUES_NAME_VALUE_SEPARATOR); + var name = parts[0]; + var value = parts[1]; - if (firstOnly && tokens.length == 1) { - break; - } - } + accumulator[name] = normalizeValue(value); - cursor++; - } + return accumulator; + }, {}); +} - if (lastStart < cursor + 1) { - var lastValue = value.substring(lastStart); - var lastCharacter = lastValue[lastValue.length - 1]; - if (!includeSeparator && (withRegex ? separator.test(lastCharacter) : lastCharacter == separator)) - lastValue = lastValue.substring(0, lastValue.length - 1); - tokens.push(lastValue); +function normalizeValue(value) { + switch (value) { + case FALSE_KEYWORD_1: + case FALSE_KEYWORD_2: + return false; + case TRUE_KEYWORD_1: + case TRUE_KEYWORD_2: + return true; + default: + return value; } +} - return tokens; +function mapIndentWith(value) { + switch (value) { + case 'space': + return IndentWith.Space; + case 'tab': + return IndentWith.Tab; + default: + return value; + } } -module.exports = split; +module.exports = { + Breaks: Breaks, + Spaces: Spaces, + formatFrom: formatFrom +}; -},{}],69:[function(require,module,exports){ -(function (Buffer){ -// 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. +},{"../utils/override":94}],60:[function(require,module,exports){ +(function (process){ +var url = require('url'); -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. +var override = require('../utils/override'); -function isArray(arg) { - if (Array.isArray) { - return Array.isArray(arg); - } - return objectToString(arg) === '[object Array]'; +function inlineRequestFrom(option) { + return override( + /* jshint camelcase: false */ + proxyOptionsFrom(process.env.HTTP_PROXY || process.env.http_proxy), + option || {} + ); } -exports.isArray = isArray; -function isBoolean(arg) { - return typeof arg === 'boolean'; +function proxyOptionsFrom(httpProxy) { + return httpProxy ? + { + hostname: url.parse(httpProxy).hostname, + port: parseInt(url.parse(httpProxy).port) + } : + {}; } -exports.isBoolean = isBoolean; -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; +module.exports = inlineRequestFrom; -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; +}).call(this,require('_process')) +},{"../utils/override":94,"_process":112,"url":159}],61:[function(require,module,exports){ +var DEFAULT_TIMEOUT = 5000; -function isNumber(arg) { - return typeof arg === 'number'; +function inlineTimeoutFrom(option) { + return option || DEFAULT_TIMEOUT; } -exports.isNumber = isNumber; -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; +module.exports = inlineTimeoutFrom; -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; +},{}],62:[function(require,module,exports){ +function inlineOptionsFrom(rules) { + if (Array.isArray(rules)) { + return rules; + } -function isUndefined(arg) { - return arg === void 0; + return undefined === rules ? + ['local'] : + rules.split(','); } -exports.isUndefined = isUndefined; -function isRegExp(re) { - return objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; +module.exports = inlineOptionsFrom; -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; +},{}],63:[function(require,module,exports){ +var roundingPrecisionFrom = require('./rounding-precision').roundingPrecisionFrom; -function isDate(d) { - return objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; +var override = require('../utils/override'); -function isError(e) { - return (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; +var OptimizationLevel = { + Zero: '0', + One: '1', + Two: '2' +}; -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; +var DEFAULTS = {}; + +DEFAULTS[OptimizationLevel.Zero] = {}; +DEFAULTS[OptimizationLevel.One] = { + cleanupCharsets: true, + normalizeUrls: true, + optimizeBackground: true, + optimizeBorderRadius: true, + optimizeFilter: true, + optimizeFont: true, + optimizeFontWeight: true, + optimizeOutline: true, + removeNegativePaddings: true, + removeQuotes: true, + removeWhitespace: true, + replaceMultipleZeros: true, + replaceTimeUnits: true, + replaceZeroUnits: true, + roundingPrecision: roundingPrecisionFrom(undefined), + selectorsSortingMethod: 'standard', + specialComments: 'all', + tidyAtRules: true, + tidyBlockScopes: true, + tidySelectors: true, + transform: noop +}; +DEFAULTS[OptimizationLevel.Two] = { + mergeAdjacentRules: true, + mergeIntoShorthands: true, + mergeMedia: true, + mergeNonAdjacentRules: true, + mergeSemantically: false, + overrideProperties: true, + reduceNonAdjacentRules: true, + removeDuplicateFontRules: true, + removeDuplicateMediaBlocks: true, + removeDuplicateRules: true, + restructureRules: false +}; -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; +var ALL_KEYWORD_1 = '*'; +var ALL_KEYWORD_2 = 'all'; +var FALSE_KEYWORD_1 = 'false'; +var FALSE_KEYWORD_2 = 'off'; +var TRUE_KEYWORD_1 = 'true'; +var TRUE_KEYWORD_2 = 'on'; -exports.isBuffer = Buffer.isBuffer; +var OPTION_SEPARATOR = ';'; +var OPTION_VALUE_SEPARATOR = ':'; -function objectToString(o) { - return Object.prototype.toString.call(o); -} +function noop() {} -}).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":75}],70:[function(require,module,exports){ -// 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. +function optimizationLevelFrom(source) { + var level = override(DEFAULTS, {}); + var Zero = OptimizationLevel.Zero; + var One = OptimizationLevel.One; + var Two = OptimizationLevel.Two; -function EventEmitter() { - this._events = this._events || {}; - this._maxListeners = this._maxListeners || undefined; -} -module.exports = EventEmitter; -// Backwards-compat with node 0.10.x -EventEmitter.EventEmitter = EventEmitter; + if (undefined === source) { + delete level[Two]; + return level; + } -EventEmitter.prototype._events = undefined; -EventEmitter.prototype._maxListeners = undefined; + if (typeof source == 'string') { + source = parseInt(source); + } -// By default EventEmitters will print a warning if more than 10 listeners are -// added to it. This is a useful default which helps finding memory leaks. -EventEmitter.defaultMaxListeners = 10; + if (typeof source == 'number' && source === parseInt(Two)) { + return level; + } -// Obviously not all Emitters should be limited to 10. This function allows -// that to be increased. Set to zero for unlimited. -EventEmitter.prototype.setMaxListeners = function(n) { - if (!isNumber(n) || n < 0 || isNaN(n)) - throw TypeError('n must be a positive number'); - this._maxListeners = n; - return this; -}; + if (typeof source == 'number' && source === parseInt(One)) { + delete level[Two]; + return level; + } -EventEmitter.prototype.emit = function(type) { - var er, handler, len, args, i, listeners; + if (typeof source == 'number' && source === parseInt(Zero)) { + delete level[Two]; + delete level[One]; + return level; + } - if (!this._events) - this._events = {}; + if (typeof source == 'object') { + source = covertValuesToHashes(source); + } - // If there is no 'error' event listener then throw. - if (type === 'error') { - if (!this._events.error || - (isObject(this._events.error) && !this._events.error.length)) { - er = arguments[1]; - if (er instanceof Error) { - throw er; // Unhandled 'error' event - } else { - // At least give some kind of context to the user - var err = new Error('Uncaught, unspecified "error" event. (' + er + ')'); - err.context = er; - throw err; - } - } + if (One in source && 'roundingPrecision' in source[One]) { + source[One].roundingPrecision = roundingPrecisionFrom(source[One].roundingPrecision); } - handler = this._events[type]; + if (Zero in source || One in source || Two in source) { + level[Zero] = override(level[Zero], source[Zero]); + } - if (isUndefined(handler)) - return false; + if (One in source && ALL_KEYWORD_1 in source[One]) { + level[One] = override(level[One], defaults(One, normalizeValue(source[One][ALL_KEYWORD_1]))); + delete source[One][ALL_KEYWORD_1]; + } - if (isFunction(handler)) { - switch (arguments.length) { - // fast cases - case 1: - handler.call(this); - break; - case 2: - handler.call(this, arguments[1]); - break; - case 3: - handler.call(this, arguments[1], arguments[2]); - break; - // slower - default: - args = Array.prototype.slice.call(arguments, 1); - handler.apply(this, args); - } - } else if (isObject(handler)) { - args = Array.prototype.slice.call(arguments, 1); - listeners = handler.slice(); - len = listeners.length; - for (i = 0; i < len; i++) - listeners[i].apply(this, args); + if (One in source && ALL_KEYWORD_2 in source[One]) { + level[One] = override(level[One], defaults(One, normalizeValue(source[One][ALL_KEYWORD_2]))); + delete source[One][ALL_KEYWORD_2]; } - return true; -}; + if (One in source || Two in source) { + level[One] = override(level[One], source[One]); + } else { + delete level[One]; + } -EventEmitter.prototype.addListener = function(type, listener) { - var m; + if (Two in source && ALL_KEYWORD_1 in source[Two]) { + level[Two] = override(level[Two], defaults(Two, normalizeValue(source[Two][ALL_KEYWORD_1]))); + delete source[Two][ALL_KEYWORD_1]; + } - if (!isFunction(listener)) - throw TypeError('listener must be a function'); + if (Two in source && ALL_KEYWORD_2 in source[Two]) { + level[Two] = override(level[Two], defaults(Two, normalizeValue(source[Two][ALL_KEYWORD_2]))); + delete source[Two][ALL_KEYWORD_2]; + } - if (!this._events) - this._events = {}; + if (Two in source) { + level[Two] = override(level[Two], source[Two]); + } else { + delete level[Two]; + } - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (this._events.newListener) - this.emit('newListener', type, - isFunction(listener.listener) ? - listener.listener : listener); + return level; +} - if (!this._events[type]) - // Optimize the case of one listener. Don't need the extra array object. - this._events[type] = listener; - else if (isObject(this._events[type])) - // If we've already got an array, just append. - this._events[type].push(listener); - else - // Adding the second element, need to change to array. - this._events[type] = [this._events[type], listener]; +function defaults(level, value) { + var options = override(DEFAULTS[level], {}); + var key; - // Check for listener leak - if (isObject(this._events[type]) && !this._events[type].warned) { - if (!isUndefined(this._maxListeners)) { - m = this._maxListeners; - } else { - m = EventEmitter.defaultMaxListeners; + for (key in options) { + if (typeof options[key] == 'boolean') { + options[key] = value; } + } - if (m && m > 0 && this._events[type].length > m) { - this._events[type].warned = true; - console.error('(node) warning: possible EventEmitter memory ' + - 'leak detected. %d listeners added. ' + - 'Use emitter.setMaxListeners() to increase limit.', - this._events[type].length); - if (typeof console.trace === 'function') { - // not supported in IE 10 - console.trace(); - } + return options; +} + +function normalizeValue(value) { + switch (value) { + case FALSE_KEYWORD_1: + case FALSE_KEYWORD_2: + return false; + case TRUE_KEYWORD_1: + case TRUE_KEYWORD_2: + return true; + default: + return value; + } +} + +function covertValuesToHashes(source) { + var clonedSource = override(source, {}); + var level; + var i; + + for (i = 0; i <= 2; i++) { + level = '' + i; + + if (level in clonedSource && (clonedSource[level] === undefined || clonedSource[level] === false)) { + delete clonedSource[level]; + } + + if (level in clonedSource && clonedSource[level] === true) { + clonedSource[level] = {}; + } + + if (level in clonedSource && typeof clonedSource[level] == 'string') { + clonedSource[level] = covertToHash(clonedSource[level], level); } } - return this; + return clonedSource; +} + +function covertToHash(asString, level) { + return asString + .split(OPTION_SEPARATOR) + .reduce(function (accumulator, directive) { + var parts = directive.split(OPTION_VALUE_SEPARATOR); + var name = parts[0]; + var value = parts[1]; + var normalizedValue = normalizeValue(value); + + if (ALL_KEYWORD_1 == name || ALL_KEYWORD_2 == name) { + accumulator = override(accumulator, defaults(level, normalizedValue)); + } else { + accumulator[name] = normalizedValue; + } + + return accumulator; + }, {}); +} + +module.exports = { + OptimizationLevel: OptimizationLevel, + optimizationLevelFrom: optimizationLevelFrom, }; -EventEmitter.prototype.on = EventEmitter.prototype.addListener; +},{"../utils/override":94,"./rounding-precision":66}],64:[function(require,module,exports){ +(function (process){ +var path = require('path'); -EventEmitter.prototype.once = function(type, listener) { - if (!isFunction(listener)) - throw TypeError('listener must be a function'); +function rebaseToFrom(option) { + return option ? path.resolve(option) : process.cwd(); +} + +module.exports = rebaseToFrom; + +}).call(this,require('_process')) +},{"_process":112,"path":110}],65:[function(require,module,exports){ +function rebaseFrom(rebaseOption) { + return undefined === rebaseOption ? true : !!rebaseOption; +} + +module.exports = rebaseFrom; + +},{}],66:[function(require,module,exports){ +var override = require('../utils/override'); + +var INTEGER_PATTERN = /^\d+$/; + +var ALL_UNITS = ['*', 'all']; +var DEFAULT_PRECISION = 'off'; // all precision changes are disabled +var DIRECTIVES_SEPARATOR = ','; // e.g. *=5,px=3 +var DIRECTIVE_VALUE_SEPARATOR = '='; // e.g. *=5 - var fired = false; +function roundingPrecisionFrom(source) { + return override(defaults(DEFAULT_PRECISION), buildPrecisionFrom(source)); +} - function g() { - this.removeListener(type, g); +function defaults(value) { + return { + 'ch': value, + 'cm': value, + 'em': value, + 'ex': value, + 'in': value, + 'mm': value, + 'pc': value, + 'pt': value, + 'px': value, + 'q': value, + 'rem': value, + 'vh': value, + 'vmax': value, + 'vmin': value, + 'vw': value, + '%': value + }; +} - if (!fired) { - fired = true; - listener.apply(this, arguments); - } +function buildPrecisionFrom(source) { + if (source === null || source === undefined) { + return {}; } - g.listener = listener; - this.on(type, g); + if (typeof source == 'boolean') { + return {}; + } - return this; -}; + if (typeof source == 'number' && source == -1) { + return defaults(DEFAULT_PRECISION); + } -// emits a 'removeListener' event iff the listener was removed -EventEmitter.prototype.removeListener = function(type, listener) { - var list, position, length, i; + if (typeof source == 'number') { + return defaults(source); + } - if (!isFunction(listener)) - throw TypeError('listener must be a function'); + if (typeof source == 'string' && INTEGER_PATTERN.test(source)) { + return defaults(parseInt(source)); + } - if (!this._events || !this._events[type]) - return this; + if (typeof source == 'string' && source == DEFAULT_PRECISION) { + return defaults(DEFAULT_PRECISION); + } - list = this._events[type]; - length = list.length; - position = -1; + if (typeof source == 'object') { + return source; + } - if (list === listener || - (isFunction(list.listener) && list.listener === listener)) { - delete this._events[type]; - if (this._events.removeListener) - this.emit('removeListener', type, listener); + return source + .split(DIRECTIVES_SEPARATOR) + .reduce(function (accumulator, directive) { + var directiveParts = directive.split(DIRECTIVE_VALUE_SEPARATOR); + var name = directiveParts[0]; + var value = parseInt(directiveParts[1]); - } else if (isObject(list)) { - for (i = length; i-- > 0;) { - if (list[i] === listener || - (list[i].listener && list[i].listener === listener)) { - position = i; - break; + if (isNaN(value) || value == -1) { + value = DEFAULT_PRECISION; } - } - if (position < 0) - return this; - - if (list.length === 1) { - list.length = 0; - delete this._events[type]; - } else { - list.splice(position, 1); - } + if (ALL_UNITS.indexOf(name) > -1) { + accumulator = override(accumulator, defaults(value)); + } else { + accumulator[name] = value; + } - if (this._events.removeListener) - this.emit('removeListener', type, listener); - } + return accumulator; + }, {}); +} - return this; +module.exports = { + DEFAULT: DEFAULT_PRECISION, + roundingPrecisionFrom: roundingPrecisionFrom }; -EventEmitter.prototype.removeAllListeners = function(type) { - var key, listeners; +},{"../utils/override":94}],67:[function(require,module,exports){ +(function (global,Buffer){ +var fs = require('fs'); +var path = require('path'); - if (!this._events) - return this; +var isAllowedResource = require('./is-allowed-resource'); +var loadRemoteResource = require('./load-remote-resource'); +var matchDataUri = require('./match-data-uri'); +var rebaseLocalMap = require('./rebase-local-map'); +var rebaseRemoteMap = require('./rebase-remote-map'); + +var Token = require('../tokenizer/token'); +var hasProtocol = require('../utils/has-protocol'); +var isDataUriResource = require('../utils/is-data-uri-resource'); +var isRemoteResource = require('../utils/is-remote-resource'); + +var MAP_MARKER_PATTERN = /^\/\*# sourceMappingURL=(\S+) \*\/$/; + +function applySourceMaps(tokens, context, callback) { + var applyContext = { + callback: callback, + index: 0, + inline: context.options.inline, + inlineRequest: context.options.inlineRequest, + inlineTimeout: context.options.inlineTimeout, + inputSourceMapTracker: context.inputSourceMapTracker, + localOnly: context.localOnly, + processedTokens: [], + rebaseTo: context.options.rebaseTo, + sourceTokens: tokens, + warnings: context.warnings + }; - // not listening for removeListener, no need to emit - if (!this._events.removeListener) { - if (arguments.length === 0) - this._events = {}; - else if (this._events[type]) - delete this._events[type]; - return this; - } + return tokens.length > 0 ? + doApplySourceMaps(applyContext) : + callback(tokens); +} - // emit removeListener for all listeners on all events - if (arguments.length === 0) { - for (key in this._events) { - if (key === 'removeListener') continue; - this.removeAllListeners(key); +function doApplySourceMaps(applyContext) { + var singleSourceTokens = []; + var lastSource = findTokenSource(applyContext.sourceTokens[0]); + var source; + var token; + var l; + + for (l = applyContext.sourceTokens.length; applyContext.index < l; applyContext.index++) { + token = applyContext.sourceTokens[applyContext.index]; + source = findTokenSource(token); + + if (source != lastSource) { + singleSourceTokens = []; + lastSource = source; } - this.removeAllListeners('removeListener'); - this._events = {}; - return this; - } - listeners = this._events[type]; + singleSourceTokens.push(token); + applyContext.processedTokens.push(token); - if (isFunction(listeners)) { - this.removeListener(type, listeners); - } else if (listeners) { - // LIFO order - while (listeners.length) - this.removeListener(type, listeners[listeners.length - 1]); + if (token[0] == Token.COMMENT && MAP_MARKER_PATTERN.test(token[1])) { + return fetchAndApplySourceMap(token[1], source, singleSourceTokens, applyContext); + } } - delete this._events[type]; - - return this; -}; -EventEmitter.prototype.listeners = function(type) { - var ret; - if (!this._events || !this._events[type]) - ret = []; - else if (isFunction(this._events[type])) - ret = [this._events[type]]; - else - ret = this._events[type].slice(); - return ret; -}; + return applyContext.callback(applyContext.processedTokens); +} -EventEmitter.prototype.listenerCount = function(type) { - if (this._events) { - var evlistener = this._events[type]; +function findTokenSource(token) { + var scope; + var metadata; - if (isFunction(evlistener)) - return 1; - else if (evlistener) - return evlistener.length; + if (token[0] == Token.AT_RULE || token[0] == Token.COMMENT) { + metadata = token[2][0]; + } else { + scope = token[1][0]; + metadata = scope[2][0]; } - return 0; -}; - -EventEmitter.listenerCount = function(emitter, type) { - return emitter.listenerCount(type); -}; -function isFunction(arg) { - return typeof arg === 'function'; + return metadata[2]; } -function isNumber(arg) { - return typeof arg === 'number'; +function fetchAndApplySourceMap(sourceMapComment, source, singleSourceTokens, applyContext) { + return extractInputSourceMapFrom(sourceMapComment, applyContext, function (inputSourceMap) { + if (inputSourceMap) { + applyContext.inputSourceMapTracker.track(source, inputSourceMap); + applySourceMapRecursively(singleSourceTokens, applyContext.inputSourceMapTracker); + } + + applyContext.index++; + return doApplySourceMaps(applyContext); + }); } -function isObject(arg) { - return typeof arg === 'object' && arg !== null; +function extractInputSourceMapFrom(sourceMapComment, applyContext, whenSourceMapReady) { + var uri = MAP_MARKER_PATTERN.exec(sourceMapComment)[1]; + var absoluteUri; + var sourceMap; + var rebasedMap; + + if (isDataUriResource(uri)) { + sourceMap = extractInputSourceMapFromDataUri(uri); + return whenSourceMapReady(sourceMap); + } else if (isRemoteResource(uri)) { + return loadInputSourceMapFromRemoteUri(uri, applyContext, function (sourceMap) { + var parsedMap; + + if (sourceMap) { + parsedMap = JSON.parse(sourceMap); + rebasedMap = rebaseRemoteMap(parsedMap, uri); + whenSourceMapReady(rebasedMap); + } else { + whenSourceMapReady(null); + } + }); + } else { + // at this point `uri` is already rebased, see lib/reader/rebase.js#rebaseSourceMapComment + // it is rebased to be consistent with rebasing other URIs + // however here we need to resolve it back to read it from disk + absoluteUri = path.resolve(applyContext.rebaseTo, uri); + sourceMap = loadInputSourceMapFromLocalUri(absoluteUri, applyContext); + + if (sourceMap) { + rebasedMap = rebaseLocalMap(sourceMap, absoluteUri, applyContext.rebaseTo); + return whenSourceMapReady(rebasedMap); + } else { + return whenSourceMapReady(null); + } + } } -function isUndefined(arg) { - return arg === void 0; +function extractInputSourceMapFromDataUri(uri) { + var dataUriMatch = matchDataUri(uri); + var charset = dataUriMatch[2] ? dataUriMatch[2].split(/[=;]/)[2] : 'us-ascii'; + var encoding = dataUriMatch[3] ? dataUriMatch[3].split(';')[1] : 'utf8'; + var data = encoding == 'utf8' ? global.unescape(dataUriMatch[4]) : dataUriMatch[4]; + + var buffer = new Buffer(data, encoding); + buffer.charset = charset; + + return JSON.parse(buffer.toString()); } -},{}],71:[function(require,module,exports){ -(function (global){ -/*! https://mths.be/he v1.1.0 by @mathias | MIT license */ -;(function(root) { +function loadInputSourceMapFromRemoteUri(uri, applyContext, whenLoaded) { + var isAllowed = isAllowedResource(uri, true, applyContext.inline); + var isRuntimeResource = !hasProtocol(uri); - // Detect free variables `exports`. - var freeExports = typeof exports == 'object' && exports; + if (applyContext.localOnly) { + applyContext.warnings.push('Cannot fetch remote resource from "' + uri + '" as no callback given.'); + return whenLoaded(null); + } else if (isRuntimeResource) { + applyContext.warnings.push('Cannot fetch "' + uri + '" as no protocol given.'); + return whenLoaded(null); + } else if (!isAllowed) { + applyContext.warnings.push('Cannot fetch "' + uri + '" as resource is not allowed.'); + return whenLoaded(null); + } - // Detect free variable `module`. - var freeModule = typeof module == 'object' && module && - module.exports == freeExports && module; + loadRemoteResource(uri, applyContext.inlineRequest, applyContext.inlineTimeout, function (error, body) { + if (error) { + applyContext.warnings.push('Missing source map at "' + uri + '" - ' + error); + return whenLoaded(null); + } - // Detect free variable `global`, from Node.js or Browserified code, - // and use it as `root`. - var freeGlobal = typeof global == 'object' && global; - if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { - root = freeGlobal; - } + whenLoaded(body); + }); +} - /*--------------------------------------------------------------------------*/ +function loadInputSourceMapFromLocalUri(uri, applyContext) { + var isAllowed = isAllowedResource(uri, false, applyContext.inline); + var sourceMap; - // All astral symbols. - var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; - // All ASCII symbols (not just printable ASCII) except those listed in the - // first column of the overrides table. - // https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides - var regexAsciiWhitelist = /[\x01-\x7F]/g; - // All BMP symbols that are not ASCII newlines, printable ASCII symbols, or - // code points listed in the first column of the overrides table on - // https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides. - var regexBmpWhitelist = /[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g; + if (!fs.existsSync(uri) || !fs.statSync(uri).isFile()) { + applyContext.warnings.push('Ignoring local source map at "' + uri + '" as resource is missing.'); + return null; + } else if (!isAllowed) { + applyContext.warnings.push('Cannot fetch "' + uri + '" as resource is not allowed.'); + return null; + } - var regexEncodeNonAscii = /<\u20D2|=\u20E5|>\u20D2|\u205F\u200A|\u219D\u0338|\u2202\u0338|\u2220\u20D2|\u2229\uFE00|\u222A\uFE00|\u223C\u20D2|\u223D\u0331|\u223E\u0333|\u2242\u0338|\u224B\u0338|\u224D\u20D2|\u224E\u0338|\u224F\u0338|\u2250\u0338|\u2261\u20E5|\u2264\u20D2|\u2265\u20D2|\u2266\u0338|\u2267\u0338|\u2268\uFE00|\u2269\uFE00|\u226A\u0338|\u226A\u20D2|\u226B\u0338|\u226B\u20D2|\u227F\u0338|\u2282\u20D2|\u2283\u20D2|\u228A\uFE00|\u228B\uFE00|\u228F\u0338|\u2290\u0338|\u2293\uFE00|\u2294\uFE00|\u22B4\u20D2|\u22B5\u20D2|\u22D8\u0338|\u22D9\u0338|\u22DA\uFE00|\u22DB\uFE00|\u22F5\u0338|\u22F9\u0338|\u2933\u0338|\u29CF\u0338|\u29D0\u0338|\u2A6D\u0338|\u2A70\u0338|\u2A7D\u0338|\u2A7E\u0338|\u2AA1\u0338|\u2AA2\u0338|\u2AAC\uFE00|\u2AAD\uFE00|\u2AAF\u0338|\u2AB0\u0338|\u2AC5\u0338|\u2AC6\u0338|\u2ACB\uFE00|\u2ACC\uFE00|\u2AFD\u20E5|[\xA0-\u0113\u0116-\u0122\u0124-\u012B\u012E-\u014D\u0150-\u017E\u0192\u01B5\u01F5\u0237\u02C6\u02C7\u02D8-\u02DD\u0311\u0391-\u03A1\u03A3-\u03A9\u03B1-\u03C9\u03D1\u03D2\u03D5\u03D6\u03DC\u03DD\u03F0\u03F1\u03F5\u03F6\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E\u045F\u2002-\u2005\u2007-\u2010\u2013-\u2016\u2018-\u201A\u201C-\u201E\u2020-\u2022\u2025\u2026\u2030-\u2035\u2039\u203A\u203E\u2041\u2043\u2044\u204F\u2057\u205F-\u2063\u20AC\u20DB\u20DC\u2102\u2105\u210A-\u2113\u2115-\u211E\u2122\u2124\u2127-\u2129\u212C\u212D\u212F-\u2131\u2133-\u2138\u2145-\u2148\u2153-\u215E\u2190-\u219B\u219D-\u21A7\u21A9-\u21AE\u21B0-\u21B3\u21B5-\u21B7\u21BA-\u21DB\u21DD\u21E4\u21E5\u21F5\u21FD-\u2205\u2207-\u2209\u220B\u220C\u220F-\u2214\u2216-\u2218\u221A\u221D-\u2238\u223A-\u2257\u2259\u225A\u225C\u225F-\u2262\u2264-\u228B\u228D-\u229B\u229D-\u22A5\u22A7-\u22B0\u22B2-\u22BB\u22BD-\u22DB\u22DE-\u22E3\u22E6-\u22F7\u22F9-\u22FE\u2305\u2306\u2308-\u2310\u2312\u2313\u2315\u2316\u231C-\u231F\u2322\u2323\u232D\u232E\u2336\u233D\u233F\u237C\u23B0\u23B1\u23B4-\u23B6\u23DC-\u23DF\u23E2\u23E7\u2423\u24C8\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2550-\u256C\u2580\u2584\u2588\u2591-\u2593\u25A1\u25AA\u25AB\u25AD\u25AE\u25B1\u25B3-\u25B5\u25B8\u25B9\u25BD-\u25BF\u25C2\u25C3\u25CA\u25CB\u25EC\u25EF\u25F8-\u25FC\u2605\u2606\u260E\u2640\u2642\u2660\u2663\u2665\u2666\u266A\u266D-\u266F\u2713\u2717\u2720\u2736\u2758\u2772\u2773\u27C8\u27C9\u27E6-\u27ED\u27F5-\u27FA\u27FC\u27FF\u2902-\u2905\u290C-\u2913\u2916\u2919-\u2920\u2923-\u292A\u2933\u2935-\u2939\u293C\u293D\u2945\u2948-\u294B\u294E-\u2976\u2978\u2979\u297B-\u297F\u2985\u2986\u298B-\u2996\u299A\u299C\u299D\u29A4-\u29B7\u29B9\u29BB\u29BC\u29BE-\u29C5\u29C9\u29CD-\u29D0\u29DC-\u29DE\u29E3-\u29E5\u29EB\u29F4\u29F6\u2A00-\u2A02\u2A04\u2A06\u2A0C\u2A0D\u2A10-\u2A17\u2A22-\u2A27\u2A29\u2A2A\u2A2D-\u2A31\u2A33-\u2A3C\u2A3F\u2A40\u2A42-\u2A4D\u2A50\u2A53-\u2A58\u2A5A-\u2A5D\u2A5F\u2A66\u2A6A\u2A6D-\u2A75\u2A77-\u2A9A\u2A9D-\u2AA2\u2AA4-\u2AB0\u2AB3-\u2AC8\u2ACB\u2ACC\u2ACF-\u2ADB\u2AE4\u2AE6-\u2AE9\u2AEB-\u2AF3\u2AFD\uFB00-\uFB04]|\uD835[\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDD6B]/g; - var encodeMap = {'\xAD':'shy','\u200C':'zwnj','\u200D':'zwj','\u200E':'lrm','\u2063':'ic','\u2062':'it','\u2061':'af','\u200F':'rlm','\u200B':'ZeroWidthSpace','\u2060':'NoBreak','\u0311':'DownBreve','\u20DB':'tdot','\u20DC':'DotDot','\t':'Tab','\n':'NewLine','\u2008':'puncsp','\u205F':'MediumSpace','\u2009':'thinsp','\u200A':'hairsp','\u2004':'emsp13','\u2002':'ensp','\u2005':'emsp14','\u2003':'emsp','\u2007':'numsp','\xA0':'nbsp','\u205F\u200A':'ThickSpace','\u203E':'oline','_':'lowbar','\u2010':'dash','\u2013':'ndash','\u2014':'mdash','\u2015':'horbar',',':'comma',';':'semi','\u204F':'bsemi',':':'colon','\u2A74':'Colone','!':'excl','\xA1':'iexcl','?':'quest','\xBF':'iquest','.':'period','\u2025':'nldr','\u2026':'mldr','\xB7':'middot','\'':'apos','\u2018':'lsquo','\u2019':'rsquo','\u201A':'sbquo','\u2039':'lsaquo','\u203A':'rsaquo','"':'quot','\u201C':'ldquo','\u201D':'rdquo','\u201E':'bdquo','\xAB':'laquo','\xBB':'raquo','(':'lpar',')':'rpar','[':'lsqb',']':'rsqb','{':'lcub','}':'rcub','\u2308':'lceil','\u2309':'rceil','\u230A':'lfloor','\u230B':'rfloor','\u2985':'lopar','\u2986':'ropar','\u298B':'lbrke','\u298C':'rbrke','\u298D':'lbrkslu','\u298E':'rbrksld','\u298F':'lbrksld','\u2990':'rbrkslu','\u2991':'langd','\u2992':'rangd','\u2993':'lparlt','\u2994':'rpargt','\u2995':'gtlPar','\u2996':'ltrPar','\u27E6':'lobrk','\u27E7':'robrk','\u27E8':'lang','\u27E9':'rang','\u27EA':'Lang','\u27EB':'Rang','\u27EC':'loang','\u27ED':'roang','\u2772':'lbbrk','\u2773':'rbbrk','\u2016':'Vert','\xA7':'sect','\xB6':'para','@':'commat','*':'ast','/':'sol','undefined':null,'&':'amp','#':'num','%':'percnt','\u2030':'permil','\u2031':'pertenk','\u2020':'dagger','\u2021':'Dagger','\u2022':'bull','\u2043':'hybull','\u2032':'prime','\u2033':'Prime','\u2034':'tprime','\u2057':'qprime','\u2035':'bprime','\u2041':'caret','`':'grave','\xB4':'acute','\u02DC':'tilde','^':'Hat','\xAF':'macr','\u02D8':'breve','\u02D9':'dot','\xA8':'die','\u02DA':'ring','\u02DD':'dblac','\xB8':'cedil','\u02DB':'ogon','\u02C6':'circ','\u02C7':'caron','\xB0':'deg','\xA9':'copy','\xAE':'reg','\u2117':'copysr','\u2118':'wp','\u211E':'rx','\u2127':'mho','\u2129':'iiota','\u2190':'larr','\u219A':'nlarr','\u2192':'rarr','\u219B':'nrarr','\u2191':'uarr','\u2193':'darr','\u2194':'harr','\u21AE':'nharr','\u2195':'varr','\u2196':'nwarr','\u2197':'nearr','\u2198':'searr','\u2199':'swarr','\u219D':'rarrw','\u219D\u0338':'nrarrw','\u219E':'Larr','\u219F':'Uarr','\u21A0':'Rarr','\u21A1':'Darr','\u21A2':'larrtl','\u21A3':'rarrtl','\u21A4':'mapstoleft','\u21A5':'mapstoup','\u21A6':'map','\u21A7':'mapstodown','\u21A9':'larrhk','\u21AA':'rarrhk','\u21AB':'larrlp','\u21AC':'rarrlp','\u21AD':'harrw','\u21B0':'lsh','\u21B1':'rsh','\u21B2':'ldsh','\u21B3':'rdsh','\u21B5':'crarr','\u21B6':'cularr','\u21B7':'curarr','\u21BA':'olarr','\u21BB':'orarr','\u21BC':'lharu','\u21BD':'lhard','\u21BE':'uharr','\u21BF':'uharl','\u21C0':'rharu','\u21C1':'rhard','\u21C2':'dharr','\u21C3':'dharl','\u21C4':'rlarr','\u21C5':'udarr','\u21C6':'lrarr','\u21C7':'llarr','\u21C8':'uuarr','\u21C9':'rrarr','\u21CA':'ddarr','\u21CB':'lrhar','\u21CC':'rlhar','\u21D0':'lArr','\u21CD':'nlArr','\u21D1':'uArr','\u21D2':'rArr','\u21CF':'nrArr','\u21D3':'dArr','\u21D4':'iff','\u21CE':'nhArr','\u21D5':'vArr','\u21D6':'nwArr','\u21D7':'neArr','\u21D8':'seArr','\u21D9':'swArr','\u21DA':'lAarr','\u21DB':'rAarr','\u21DD':'zigrarr','\u21E4':'larrb','\u21E5':'rarrb','\u21F5':'duarr','\u21FD':'loarr','\u21FE':'roarr','\u21FF':'hoarr','\u2200':'forall','\u2201':'comp','\u2202':'part','\u2202\u0338':'npart','\u2203':'exist','\u2204':'nexist','\u2205':'empty','\u2207':'Del','\u2208':'in','\u2209':'notin','\u220B':'ni','\u220C':'notni','\u03F6':'bepsi','\u220F':'prod','\u2210':'coprod','\u2211':'sum','+':'plus','\xB1':'pm','\xF7':'div','\xD7':'times','<':'lt','\u226E':'nlt','<\u20D2':'nvlt','=':'equals','\u2260':'ne','=\u20E5':'bne','\u2A75':'Equal','>':'gt','\u226F':'ngt','>\u20D2':'nvgt','\xAC':'not','|':'vert','\xA6':'brvbar','\u2212':'minus','\u2213':'mp','\u2214':'plusdo','\u2044':'frasl','\u2216':'setmn','\u2217':'lowast','\u2218':'compfn','\u221A':'Sqrt','\u221D':'prop','\u221E':'infin','\u221F':'angrt','\u2220':'ang','\u2220\u20D2':'nang','\u2221':'angmsd','\u2222':'angsph','\u2223':'mid','\u2224':'nmid','\u2225':'par','\u2226':'npar','\u2227':'and','\u2228':'or','\u2229':'cap','\u2229\uFE00':'caps','\u222A':'cup','\u222A\uFE00':'cups','\u222B':'int','\u222C':'Int','\u222D':'tint','\u2A0C':'qint','\u222E':'oint','\u222F':'Conint','\u2230':'Cconint','\u2231':'cwint','\u2232':'cwconint','\u2233':'awconint','\u2234':'there4','\u2235':'becaus','\u2236':'ratio','\u2237':'Colon','\u2238':'minusd','\u223A':'mDDot','\u223B':'homtht','\u223C':'sim','\u2241':'nsim','\u223C\u20D2':'nvsim','\u223D':'bsim','\u223D\u0331':'race','\u223E':'ac','\u223E\u0333':'acE','\u223F':'acd','\u2240':'wr','\u2242':'esim','\u2242\u0338':'nesim','\u2243':'sime','\u2244':'nsime','\u2245':'cong','\u2247':'ncong','\u2246':'simne','\u2248':'ap','\u2249':'nap','\u224A':'ape','\u224B':'apid','\u224B\u0338':'napid','\u224C':'bcong','\u224D':'CupCap','\u226D':'NotCupCap','\u224D\u20D2':'nvap','\u224E':'bump','\u224E\u0338':'nbump','\u224F':'bumpe','\u224F\u0338':'nbumpe','\u2250':'doteq','\u2250\u0338':'nedot','\u2251':'eDot','\u2252':'efDot','\u2253':'erDot','\u2254':'colone','\u2255':'ecolon','\u2256':'ecir','\u2257':'cire','\u2259':'wedgeq','\u225A':'veeeq','\u225C':'trie','\u225F':'equest','\u2261':'equiv','\u2262':'nequiv','\u2261\u20E5':'bnequiv','\u2264':'le','\u2270':'nle','\u2264\u20D2':'nvle','\u2265':'ge','\u2271':'nge','\u2265\u20D2':'nvge','\u2266':'lE','\u2266\u0338':'nlE','\u2267':'gE','\u2267\u0338':'ngE','\u2268\uFE00':'lvnE','\u2268':'lnE','\u2269':'gnE','\u2269\uFE00':'gvnE','\u226A':'ll','\u226A\u0338':'nLtv','\u226A\u20D2':'nLt','\u226B':'gg','\u226B\u0338':'nGtv','\u226B\u20D2':'nGt','\u226C':'twixt','\u2272':'lsim','\u2274':'nlsim','\u2273':'gsim','\u2275':'ngsim','\u2276':'lg','\u2278':'ntlg','\u2277':'gl','\u2279':'ntgl','\u227A':'pr','\u2280':'npr','\u227B':'sc','\u2281':'nsc','\u227C':'prcue','\u22E0':'nprcue','\u227D':'sccue','\u22E1':'nsccue','\u227E':'prsim','\u227F':'scsim','\u227F\u0338':'NotSucceedsTilde','\u2282':'sub','\u2284':'nsub','\u2282\u20D2':'vnsub','\u2283':'sup','\u2285':'nsup','\u2283\u20D2':'vnsup','\u2286':'sube','\u2288':'nsube','\u2287':'supe','\u2289':'nsupe','\u228A\uFE00':'vsubne','\u228A':'subne','\u228B\uFE00':'vsupne','\u228B':'supne','\u228D':'cupdot','\u228E':'uplus','\u228F':'sqsub','\u228F\u0338':'NotSquareSubset','\u2290':'sqsup','\u2290\u0338':'NotSquareSuperset','\u2291':'sqsube','\u22E2':'nsqsube','\u2292':'sqsupe','\u22E3':'nsqsupe','\u2293':'sqcap','\u2293\uFE00':'sqcaps','\u2294':'sqcup','\u2294\uFE00':'sqcups','\u2295':'oplus','\u2296':'ominus','\u2297':'otimes','\u2298':'osol','\u2299':'odot','\u229A':'ocir','\u229B':'oast','\u229D':'odash','\u229E':'plusb','\u229F':'minusb','\u22A0':'timesb','\u22A1':'sdotb','\u22A2':'vdash','\u22AC':'nvdash','\u22A3':'dashv','\u22A4':'top','\u22A5':'bot','\u22A7':'models','\u22A8':'vDash','\u22AD':'nvDash','\u22A9':'Vdash','\u22AE':'nVdash','\u22AA':'Vvdash','\u22AB':'VDash','\u22AF':'nVDash','\u22B0':'prurel','\u22B2':'vltri','\u22EA':'nltri','\u22B3':'vrtri','\u22EB':'nrtri','\u22B4':'ltrie','\u22EC':'nltrie','\u22B4\u20D2':'nvltrie','\u22B5':'rtrie','\u22ED':'nrtrie','\u22B5\u20D2':'nvrtrie','\u22B6':'origof','\u22B7':'imof','\u22B8':'mumap','\u22B9':'hercon','\u22BA':'intcal','\u22BB':'veebar','\u22BD':'barvee','\u22BE':'angrtvb','\u22BF':'lrtri','\u22C0':'Wedge','\u22C1':'Vee','\u22C2':'xcap','\u22C3':'xcup','\u22C4':'diam','\u22C5':'sdot','\u22C6':'Star','\u22C7':'divonx','\u22C8':'bowtie','\u22C9':'ltimes','\u22CA':'rtimes','\u22CB':'lthree','\u22CC':'rthree','\u22CD':'bsime','\u22CE':'cuvee','\u22CF':'cuwed','\u22D0':'Sub','\u22D1':'Sup','\u22D2':'Cap','\u22D3':'Cup','\u22D4':'fork','\u22D5':'epar','\u22D6':'ltdot','\u22D7':'gtdot','\u22D8':'Ll','\u22D8\u0338':'nLl','\u22D9':'Gg','\u22D9\u0338':'nGg','\u22DA\uFE00':'lesg','\u22DA':'leg','\u22DB':'gel','\u22DB\uFE00':'gesl','\u22DE':'cuepr','\u22DF':'cuesc','\u22E6':'lnsim','\u22E7':'gnsim','\u22E8':'prnsim','\u22E9':'scnsim','\u22EE':'vellip','\u22EF':'ctdot','\u22F0':'utdot','\u22F1':'dtdot','\u22F2':'disin','\u22F3':'isinsv','\u22F4':'isins','\u22F5':'isindot','\u22F5\u0338':'notindot','\u22F6':'notinvc','\u22F7':'notinvb','\u22F9':'isinE','\u22F9\u0338':'notinE','\u22FA':'nisd','\u22FB':'xnis','\u22FC':'nis','\u22FD':'notnivc','\u22FE':'notnivb','\u2305':'barwed','\u2306':'Barwed','\u230C':'drcrop','\u230D':'dlcrop','\u230E':'urcrop','\u230F':'ulcrop','\u2310':'bnot','\u2312':'profline','\u2313':'profsurf','\u2315':'telrec','\u2316':'target','\u231C':'ulcorn','\u231D':'urcorn','\u231E':'dlcorn','\u231F':'drcorn','\u2322':'frown','\u2323':'smile','\u232D':'cylcty','\u232E':'profalar','\u2336':'topbot','\u233D':'ovbar','\u233F':'solbar','\u237C':'angzarr','\u23B0':'lmoust','\u23B1':'rmoust','\u23B4':'tbrk','\u23B5':'bbrk','\u23B6':'bbrktbrk','\u23DC':'OverParenthesis','\u23DD':'UnderParenthesis','\u23DE':'OverBrace','\u23DF':'UnderBrace','\u23E2':'trpezium','\u23E7':'elinters','\u2423':'blank','\u2500':'boxh','\u2502':'boxv','\u250C':'boxdr','\u2510':'boxdl','\u2514':'boxur','\u2518':'boxul','\u251C':'boxvr','\u2524':'boxvl','\u252C':'boxhd','\u2534':'boxhu','\u253C':'boxvh','\u2550':'boxH','\u2551':'boxV','\u2552':'boxdR','\u2553':'boxDr','\u2554':'boxDR','\u2555':'boxdL','\u2556':'boxDl','\u2557':'boxDL','\u2558':'boxuR','\u2559':'boxUr','\u255A':'boxUR','\u255B':'boxuL','\u255C':'boxUl','\u255D':'boxUL','\u255E':'boxvR','\u255F':'boxVr','\u2560':'boxVR','\u2561':'boxvL','\u2562':'boxVl','\u2563':'boxVL','\u2564':'boxHd','\u2565':'boxhD','\u2566':'boxHD','\u2567':'boxHu','\u2568':'boxhU','\u2569':'boxHU','\u256A':'boxvH','\u256B':'boxVh','\u256C':'boxVH','\u2580':'uhblk','\u2584':'lhblk','\u2588':'block','\u2591':'blk14','\u2592':'blk12','\u2593':'blk34','\u25A1':'squ','\u25AA':'squf','\u25AB':'EmptyVerySmallSquare','\u25AD':'rect','\u25AE':'marker','\u25B1':'fltns','\u25B3':'xutri','\u25B4':'utrif','\u25B5':'utri','\u25B8':'rtrif','\u25B9':'rtri','\u25BD':'xdtri','\u25BE':'dtrif','\u25BF':'dtri','\u25C2':'ltrif','\u25C3':'ltri','\u25CA':'loz','\u25CB':'cir','\u25EC':'tridot','\u25EF':'xcirc','\u25F8':'ultri','\u25F9':'urtri','\u25FA':'lltri','\u25FB':'EmptySmallSquare','\u25FC':'FilledSmallSquare','\u2605':'starf','\u2606':'star','\u260E':'phone','\u2640':'female','\u2642':'male','\u2660':'spades','\u2663':'clubs','\u2665':'hearts','\u2666':'diams','\u266A':'sung','\u2713':'check','\u2717':'cross','\u2720':'malt','\u2736':'sext','\u2758':'VerticalSeparator','\u27C8':'bsolhsub','\u27C9':'suphsol','\u27F5':'xlarr','\u27F6':'xrarr','\u27F7':'xharr','\u27F8':'xlArr','\u27F9':'xrArr','\u27FA':'xhArr','\u27FC':'xmap','\u27FF':'dzigrarr','\u2902':'nvlArr','\u2903':'nvrArr','\u2904':'nvHarr','\u2905':'Map','\u290C':'lbarr','\u290D':'rbarr','\u290E':'lBarr','\u290F':'rBarr','\u2910':'RBarr','\u2911':'DDotrahd','\u2912':'UpArrowBar','\u2913':'DownArrowBar','\u2916':'Rarrtl','\u2919':'latail','\u291A':'ratail','\u291B':'lAtail','\u291C':'rAtail','\u291D':'larrfs','\u291E':'rarrfs','\u291F':'larrbfs','\u2920':'rarrbfs','\u2923':'nwarhk','\u2924':'nearhk','\u2925':'searhk','\u2926':'swarhk','\u2927':'nwnear','\u2928':'toea','\u2929':'tosa','\u292A':'swnwar','\u2933':'rarrc','\u2933\u0338':'nrarrc','\u2935':'cudarrr','\u2936':'ldca','\u2937':'rdca','\u2938':'cudarrl','\u2939':'larrpl','\u293C':'curarrm','\u293D':'cularrp','\u2945':'rarrpl','\u2948':'harrcir','\u2949':'Uarrocir','\u294A':'lurdshar','\u294B':'ldrushar','\u294E':'LeftRightVector','\u294F':'RightUpDownVector','\u2950':'DownLeftRightVector','\u2951':'LeftUpDownVector','\u2952':'LeftVectorBar','\u2953':'RightVectorBar','\u2954':'RightUpVectorBar','\u2955':'RightDownVectorBar','\u2956':'DownLeftVectorBar','\u2957':'DownRightVectorBar','\u2958':'LeftUpVectorBar','\u2959':'LeftDownVectorBar','\u295A':'LeftTeeVector','\u295B':'RightTeeVector','\u295C':'RightUpTeeVector','\u295D':'RightDownTeeVector','\u295E':'DownLeftTeeVector','\u295F':'DownRightTeeVector','\u2960':'LeftUpTeeVector','\u2961':'LeftDownTeeVector','\u2962':'lHar','\u2963':'uHar','\u2964':'rHar','\u2965':'dHar','\u2966':'luruhar','\u2967':'ldrdhar','\u2968':'ruluhar','\u2969':'rdldhar','\u296A':'lharul','\u296B':'llhard','\u296C':'rharul','\u296D':'lrhard','\u296E':'udhar','\u296F':'duhar','\u2970':'RoundImplies','\u2971':'erarr','\u2972':'simrarr','\u2973':'larrsim','\u2974':'rarrsim','\u2975':'rarrap','\u2976':'ltlarr','\u2978':'gtrarr','\u2979':'subrarr','\u297B':'suplarr','\u297C':'lfisht','\u297D':'rfisht','\u297E':'ufisht','\u297F':'dfisht','\u299A':'vzigzag','\u299C':'vangrt','\u299D':'angrtvbd','\u29A4':'ange','\u29A5':'range','\u29A6':'dwangle','\u29A7':'uwangle','\u29A8':'angmsdaa','\u29A9':'angmsdab','\u29AA':'angmsdac','\u29AB':'angmsdad','\u29AC':'angmsdae','\u29AD':'angmsdaf','\u29AE':'angmsdag','\u29AF':'angmsdah','\u29B0':'bemptyv','\u29B1':'demptyv','\u29B2':'cemptyv','\u29B3':'raemptyv','\u29B4':'laemptyv','\u29B5':'ohbar','\u29B6':'omid','\u29B7':'opar','\u29B9':'operp','\u29BB':'olcross','\u29BC':'odsold','\u29BE':'olcir','\u29BF':'ofcir','\u29C0':'olt','\u29C1':'ogt','\u29C2':'cirscir','\u29C3':'cirE','\u29C4':'solb','\u29C5':'bsolb','\u29C9':'boxbox','\u29CD':'trisb','\u29CE':'rtriltri','\u29CF':'LeftTriangleBar','\u29CF\u0338':'NotLeftTriangleBar','\u29D0':'RightTriangleBar','\u29D0\u0338':'NotRightTriangleBar','\u29DC':'iinfin','\u29DD':'infintie','\u29DE':'nvinfin','\u29E3':'eparsl','\u29E4':'smeparsl','\u29E5':'eqvparsl','\u29EB':'lozf','\u29F4':'RuleDelayed','\u29F6':'dsol','\u2A00':'xodot','\u2A01':'xoplus','\u2A02':'xotime','\u2A04':'xuplus','\u2A06':'xsqcup','\u2A0D':'fpartint','\u2A10':'cirfnint','\u2A11':'awint','\u2A12':'rppolint','\u2A13':'scpolint','\u2A14':'npolint','\u2A15':'pointint','\u2A16':'quatint','\u2A17':'intlarhk','\u2A22':'pluscir','\u2A23':'plusacir','\u2A24':'simplus','\u2A25':'plusdu','\u2A26':'plussim','\u2A27':'plustwo','\u2A29':'mcomma','\u2A2A':'minusdu','\u2A2D':'loplus','\u2A2E':'roplus','\u2A2F':'Cross','\u2A30':'timesd','\u2A31':'timesbar','\u2A33':'smashp','\u2A34':'lotimes','\u2A35':'rotimes','\u2A36':'otimesas','\u2A37':'Otimes','\u2A38':'odiv','\u2A39':'triplus','\u2A3A':'triminus','\u2A3B':'tritime','\u2A3C':'iprod','\u2A3F':'amalg','\u2A40':'capdot','\u2A42':'ncup','\u2A43':'ncap','\u2A44':'capand','\u2A45':'cupor','\u2A46':'cupcap','\u2A47':'capcup','\u2A48':'cupbrcap','\u2A49':'capbrcup','\u2A4A':'cupcup','\u2A4B':'capcap','\u2A4C':'ccups','\u2A4D':'ccaps','\u2A50':'ccupssm','\u2A53':'And','\u2A54':'Or','\u2A55':'andand','\u2A56':'oror','\u2A57':'orslope','\u2A58':'andslope','\u2A5A':'andv','\u2A5B':'orv','\u2A5C':'andd','\u2A5D':'ord','\u2A5F':'wedbar','\u2A66':'sdote','\u2A6A':'simdot','\u2A6D':'congdot','\u2A6D\u0338':'ncongdot','\u2A6E':'easter','\u2A6F':'apacir','\u2A70':'apE','\u2A70\u0338':'napE','\u2A71':'eplus','\u2A72':'pluse','\u2A73':'Esim','\u2A77':'eDDot','\u2A78':'equivDD','\u2A79':'ltcir','\u2A7A':'gtcir','\u2A7B':'ltquest','\u2A7C':'gtquest','\u2A7D':'les','\u2A7D\u0338':'nles','\u2A7E':'ges','\u2A7E\u0338':'nges','\u2A7F':'lesdot','\u2A80':'gesdot','\u2A81':'lesdoto','\u2A82':'gesdoto','\u2A83':'lesdotor','\u2A84':'gesdotol','\u2A85':'lap','\u2A86':'gap','\u2A87':'lne','\u2A88':'gne','\u2A89':'lnap','\u2A8A':'gnap','\u2A8B':'lEg','\u2A8C':'gEl','\u2A8D':'lsime','\u2A8E':'gsime','\u2A8F':'lsimg','\u2A90':'gsiml','\u2A91':'lgE','\u2A92':'glE','\u2A93':'lesges','\u2A94':'gesles','\u2A95':'els','\u2A96':'egs','\u2A97':'elsdot','\u2A98':'egsdot','\u2A99':'el','\u2A9A':'eg','\u2A9D':'siml','\u2A9E':'simg','\u2A9F':'simlE','\u2AA0':'simgE','\u2AA1':'LessLess','\u2AA1\u0338':'NotNestedLessLess','\u2AA2':'GreaterGreater','\u2AA2\u0338':'NotNestedGreaterGreater','\u2AA4':'glj','\u2AA5':'gla','\u2AA6':'ltcc','\u2AA7':'gtcc','\u2AA8':'lescc','\u2AA9':'gescc','\u2AAA':'smt','\u2AAB':'lat','\u2AAC':'smte','\u2AAC\uFE00':'smtes','\u2AAD':'late','\u2AAD\uFE00':'lates','\u2AAE':'bumpE','\u2AAF':'pre','\u2AAF\u0338':'npre','\u2AB0':'sce','\u2AB0\u0338':'nsce','\u2AB3':'prE','\u2AB4':'scE','\u2AB5':'prnE','\u2AB6':'scnE','\u2AB7':'prap','\u2AB8':'scap','\u2AB9':'prnap','\u2ABA':'scnap','\u2ABB':'Pr','\u2ABC':'Sc','\u2ABD':'subdot','\u2ABE':'supdot','\u2ABF':'subplus','\u2AC0':'supplus','\u2AC1':'submult','\u2AC2':'supmult','\u2AC3':'subedot','\u2AC4':'supedot','\u2AC5':'subE','\u2AC5\u0338':'nsubE','\u2AC6':'supE','\u2AC6\u0338':'nsupE','\u2AC7':'subsim','\u2AC8':'supsim','\u2ACB\uFE00':'vsubnE','\u2ACB':'subnE','\u2ACC\uFE00':'vsupnE','\u2ACC':'supnE','\u2ACF':'csub','\u2AD0':'csup','\u2AD1':'csube','\u2AD2':'csupe','\u2AD3':'subsup','\u2AD4':'supsub','\u2AD5':'subsub','\u2AD6':'supsup','\u2AD7':'suphsub','\u2AD8':'supdsub','\u2AD9':'forkv','\u2ADA':'topfork','\u2ADB':'mlcp','\u2AE4':'Dashv','\u2AE6':'Vdashl','\u2AE7':'Barv','\u2AE8':'vBar','\u2AE9':'vBarv','\u2AEB':'Vbar','\u2AEC':'Not','\u2AED':'bNot','\u2AEE':'rnmid','\u2AEF':'cirmid','\u2AF0':'midcir','\u2AF1':'topcir','\u2AF2':'nhpar','\u2AF3':'parsim','\u2AFD':'parsl','\u2AFD\u20E5':'nparsl','\u266D':'flat','\u266E':'natur','\u266F':'sharp','\xA4':'curren','\xA2':'cent','$':'dollar','\xA3':'pound','\xA5':'yen','\u20AC':'euro','\xB9':'sup1','\xBD':'half','\u2153':'frac13','\xBC':'frac14','\u2155':'frac15','\u2159':'frac16','\u215B':'frac18','\xB2':'sup2','\u2154':'frac23','\u2156':'frac25','\xB3':'sup3','\xBE':'frac34','\u2157':'frac35','\u215C':'frac38','\u2158':'frac45','\u215A':'frac56','\u215D':'frac58','\u215E':'frac78','\uD835\uDCB6':'ascr','\uD835\uDD52':'aopf','\uD835\uDD1E':'afr','\uD835\uDD38':'Aopf','\uD835\uDD04':'Afr','\uD835\uDC9C':'Ascr','\xAA':'ordf','\xE1':'aacute','\xC1':'Aacute','\xE0':'agrave','\xC0':'Agrave','\u0103':'abreve','\u0102':'Abreve','\xE2':'acirc','\xC2':'Acirc','\xE5':'aring','\xC5':'angst','\xE4':'auml','\xC4':'Auml','\xE3':'atilde','\xC3':'Atilde','\u0105':'aogon','\u0104':'Aogon','\u0101':'amacr','\u0100':'Amacr','\xE6':'aelig','\xC6':'AElig','\uD835\uDCB7':'bscr','\uD835\uDD53':'bopf','\uD835\uDD1F':'bfr','\uD835\uDD39':'Bopf','\u212C':'Bscr','\uD835\uDD05':'Bfr','\uD835\uDD20':'cfr','\uD835\uDCB8':'cscr','\uD835\uDD54':'copf','\u212D':'Cfr','\uD835\uDC9E':'Cscr','\u2102':'Copf','\u0107':'cacute','\u0106':'Cacute','\u0109':'ccirc','\u0108':'Ccirc','\u010D':'ccaron','\u010C':'Ccaron','\u010B':'cdot','\u010A':'Cdot','\xE7':'ccedil','\xC7':'Ccedil','\u2105':'incare','\uD835\uDD21':'dfr','\u2146':'dd','\uD835\uDD55':'dopf','\uD835\uDCB9':'dscr','\uD835\uDC9F':'Dscr','\uD835\uDD07':'Dfr','\u2145':'DD','\uD835\uDD3B':'Dopf','\u010F':'dcaron','\u010E':'Dcaron','\u0111':'dstrok','\u0110':'Dstrok','\xF0':'eth','\xD0':'ETH','\u2147':'ee','\u212F':'escr','\uD835\uDD22':'efr','\uD835\uDD56':'eopf','\u2130':'Escr','\uD835\uDD08':'Efr','\uD835\uDD3C':'Eopf','\xE9':'eacute','\xC9':'Eacute','\xE8':'egrave','\xC8':'Egrave','\xEA':'ecirc','\xCA':'Ecirc','\u011B':'ecaron','\u011A':'Ecaron','\xEB':'euml','\xCB':'Euml','\u0117':'edot','\u0116':'Edot','\u0119':'eogon','\u0118':'Eogon','\u0113':'emacr','\u0112':'Emacr','\uD835\uDD23':'ffr','\uD835\uDD57':'fopf','\uD835\uDCBB':'fscr','\uD835\uDD09':'Ffr','\uD835\uDD3D':'Fopf','\u2131':'Fscr','\uFB00':'fflig','\uFB03':'ffilig','\uFB04':'ffllig','\uFB01':'filig','fj':'fjlig','\uFB02':'fllig','\u0192':'fnof','\u210A':'gscr','\uD835\uDD58':'gopf','\uD835\uDD24':'gfr','\uD835\uDCA2':'Gscr','\uD835\uDD3E':'Gopf','\uD835\uDD0A':'Gfr','\u01F5':'gacute','\u011F':'gbreve','\u011E':'Gbreve','\u011D':'gcirc','\u011C':'Gcirc','\u0121':'gdot','\u0120':'Gdot','\u0122':'Gcedil','\uD835\uDD25':'hfr','\u210E':'planckh','\uD835\uDCBD':'hscr','\uD835\uDD59':'hopf','\u210B':'Hscr','\u210C':'Hfr','\u210D':'Hopf','\u0125':'hcirc','\u0124':'Hcirc','\u210F':'hbar','\u0127':'hstrok','\u0126':'Hstrok','\uD835\uDD5A':'iopf','\uD835\uDD26':'ifr','\uD835\uDCBE':'iscr','\u2148':'ii','\uD835\uDD40':'Iopf','\u2110':'Iscr','\u2111':'Im','\xED':'iacute','\xCD':'Iacute','\xEC':'igrave','\xCC':'Igrave','\xEE':'icirc','\xCE':'Icirc','\xEF':'iuml','\xCF':'Iuml','\u0129':'itilde','\u0128':'Itilde','\u0130':'Idot','\u012F':'iogon','\u012E':'Iogon','\u012B':'imacr','\u012A':'Imacr','\u0133':'ijlig','\u0132':'IJlig','\u0131':'imath','\uD835\uDCBF':'jscr','\uD835\uDD5B':'jopf','\uD835\uDD27':'jfr','\uD835\uDCA5':'Jscr','\uD835\uDD0D':'Jfr','\uD835\uDD41':'Jopf','\u0135':'jcirc','\u0134':'Jcirc','\u0237':'jmath','\uD835\uDD5C':'kopf','\uD835\uDCC0':'kscr','\uD835\uDD28':'kfr','\uD835\uDCA6':'Kscr','\uD835\uDD42':'Kopf','\uD835\uDD0E':'Kfr','\u0137':'kcedil','\u0136':'Kcedil','\uD835\uDD29':'lfr','\uD835\uDCC1':'lscr','\u2113':'ell','\uD835\uDD5D':'lopf','\u2112':'Lscr','\uD835\uDD0F':'Lfr','\uD835\uDD43':'Lopf','\u013A':'lacute','\u0139':'Lacute','\u013E':'lcaron','\u013D':'Lcaron','\u013C':'lcedil','\u013B':'Lcedil','\u0142':'lstrok','\u0141':'Lstrok','\u0140':'lmidot','\u013F':'Lmidot','\uD835\uDD2A':'mfr','\uD835\uDD5E':'mopf','\uD835\uDCC2':'mscr','\uD835\uDD10':'Mfr','\uD835\uDD44':'Mopf','\u2133':'Mscr','\uD835\uDD2B':'nfr','\uD835\uDD5F':'nopf','\uD835\uDCC3':'nscr','\u2115':'Nopf','\uD835\uDCA9':'Nscr','\uD835\uDD11':'Nfr','\u0144':'nacute','\u0143':'Nacute','\u0148':'ncaron','\u0147':'Ncaron','\xF1':'ntilde','\xD1':'Ntilde','\u0146':'ncedil','\u0145':'Ncedil','\u2116':'numero','\u014B':'eng','\u014A':'ENG','\uD835\uDD60':'oopf','\uD835\uDD2C':'ofr','\u2134':'oscr','\uD835\uDCAA':'Oscr','\uD835\uDD12':'Ofr','\uD835\uDD46':'Oopf','\xBA':'ordm','\xF3':'oacute','\xD3':'Oacute','\xF2':'ograve','\xD2':'Ograve','\xF4':'ocirc','\xD4':'Ocirc','\xF6':'ouml','\xD6':'Ouml','\u0151':'odblac','\u0150':'Odblac','\xF5':'otilde','\xD5':'Otilde','\xF8':'oslash','\xD8':'Oslash','\u014D':'omacr','\u014C':'Omacr','\u0153':'oelig','\u0152':'OElig','\uD835\uDD2D':'pfr','\uD835\uDCC5':'pscr','\uD835\uDD61':'popf','\u2119':'Popf','\uD835\uDD13':'Pfr','\uD835\uDCAB':'Pscr','\uD835\uDD62':'qopf','\uD835\uDD2E':'qfr','\uD835\uDCC6':'qscr','\uD835\uDCAC':'Qscr','\uD835\uDD14':'Qfr','\u211A':'Qopf','\u0138':'kgreen','\uD835\uDD2F':'rfr','\uD835\uDD63':'ropf','\uD835\uDCC7':'rscr','\u211B':'Rscr','\u211C':'Re','\u211D':'Ropf','\u0155':'racute','\u0154':'Racute','\u0159':'rcaron','\u0158':'Rcaron','\u0157':'rcedil','\u0156':'Rcedil','\uD835\uDD64':'sopf','\uD835\uDCC8':'sscr','\uD835\uDD30':'sfr','\uD835\uDD4A':'Sopf','\uD835\uDD16':'Sfr','\uD835\uDCAE':'Sscr','\u24C8':'oS','\u015B':'sacute','\u015A':'Sacute','\u015D':'scirc','\u015C':'Scirc','\u0161':'scaron','\u0160':'Scaron','\u015F':'scedil','\u015E':'Scedil','\xDF':'szlig','\uD835\uDD31':'tfr','\uD835\uDCC9':'tscr','\uD835\uDD65':'topf','\uD835\uDCAF':'Tscr','\uD835\uDD17':'Tfr','\uD835\uDD4B':'Topf','\u0165':'tcaron','\u0164':'Tcaron','\u0163':'tcedil','\u0162':'Tcedil','\u2122':'trade','\u0167':'tstrok','\u0166':'Tstrok','\uD835\uDCCA':'uscr','\uD835\uDD66':'uopf','\uD835\uDD32':'ufr','\uD835\uDD4C':'Uopf','\uD835\uDD18':'Ufr','\uD835\uDCB0':'Uscr','\xFA':'uacute','\xDA':'Uacute','\xF9':'ugrave','\xD9':'Ugrave','\u016D':'ubreve','\u016C':'Ubreve','\xFB':'ucirc','\xDB':'Ucirc','\u016F':'uring','\u016E':'Uring','\xFC':'uuml','\xDC':'Uuml','\u0171':'udblac','\u0170':'Udblac','\u0169':'utilde','\u0168':'Utilde','\u0173':'uogon','\u0172':'Uogon','\u016B':'umacr','\u016A':'Umacr','\uD835\uDD33':'vfr','\uD835\uDD67':'vopf','\uD835\uDCCB':'vscr','\uD835\uDD19':'Vfr','\uD835\uDD4D':'Vopf','\uD835\uDCB1':'Vscr','\uD835\uDD68':'wopf','\uD835\uDCCC':'wscr','\uD835\uDD34':'wfr','\uD835\uDCB2':'Wscr','\uD835\uDD4E':'Wopf','\uD835\uDD1A':'Wfr','\u0175':'wcirc','\u0174':'Wcirc','\uD835\uDD35':'xfr','\uD835\uDCCD':'xscr','\uD835\uDD69':'xopf','\uD835\uDD4F':'Xopf','\uD835\uDD1B':'Xfr','\uD835\uDCB3':'Xscr','\uD835\uDD36':'yfr','\uD835\uDCCE':'yscr','\uD835\uDD6A':'yopf','\uD835\uDCB4':'Yscr','\uD835\uDD1C':'Yfr','\uD835\uDD50':'Yopf','\xFD':'yacute','\xDD':'Yacute','\u0177':'ycirc','\u0176':'Ycirc','\xFF':'yuml','\u0178':'Yuml','\uD835\uDCCF':'zscr','\uD835\uDD37':'zfr','\uD835\uDD6B':'zopf','\u2128':'Zfr','\u2124':'Zopf','\uD835\uDCB5':'Zscr','\u017A':'zacute','\u0179':'Zacute','\u017E':'zcaron','\u017D':'Zcaron','\u017C':'zdot','\u017B':'Zdot','\u01B5':'imped','\xFE':'thorn','\xDE':'THORN','\u0149':'napos','\u03B1':'alpha','\u0391':'Alpha','\u03B2':'beta','\u0392':'Beta','\u03B3':'gamma','\u0393':'Gamma','\u03B4':'delta','\u0394':'Delta','\u03B5':'epsi','\u03F5':'epsiv','\u0395':'Epsilon','\u03DD':'gammad','\u03DC':'Gammad','\u03B6':'zeta','\u0396':'Zeta','\u03B7':'eta','\u0397':'Eta','\u03B8':'theta','\u03D1':'thetav','\u0398':'Theta','\u03B9':'iota','\u0399':'Iota','\u03BA':'kappa','\u03F0':'kappav','\u039A':'Kappa','\u03BB':'lambda','\u039B':'Lambda','\u03BC':'mu','\xB5':'micro','\u039C':'Mu','\u03BD':'nu','\u039D':'Nu','\u03BE':'xi','\u039E':'Xi','\u03BF':'omicron','\u039F':'Omicron','\u03C0':'pi','\u03D6':'piv','\u03A0':'Pi','\u03C1':'rho','\u03F1':'rhov','\u03A1':'Rho','\u03C3':'sigma','\u03A3':'Sigma','\u03C2':'sigmaf','\u03C4':'tau','\u03A4':'Tau','\u03C5':'upsi','\u03A5':'Upsilon','\u03D2':'Upsi','\u03C6':'phi','\u03D5':'phiv','\u03A6':'Phi','\u03C7':'chi','\u03A7':'Chi','\u03C8':'psi','\u03A8':'Psi','\u03C9':'omega','\u03A9':'ohm','\u0430':'acy','\u0410':'Acy','\u0431':'bcy','\u0411':'Bcy','\u0432':'vcy','\u0412':'Vcy','\u0433':'gcy','\u0413':'Gcy','\u0453':'gjcy','\u0403':'GJcy','\u0434':'dcy','\u0414':'Dcy','\u0452':'djcy','\u0402':'DJcy','\u0435':'iecy','\u0415':'IEcy','\u0451':'iocy','\u0401':'IOcy','\u0454':'jukcy','\u0404':'Jukcy','\u0436':'zhcy','\u0416':'ZHcy','\u0437':'zcy','\u0417':'Zcy','\u0455':'dscy','\u0405':'DScy','\u0438':'icy','\u0418':'Icy','\u0456':'iukcy','\u0406':'Iukcy','\u0457':'yicy','\u0407':'YIcy','\u0439':'jcy','\u0419':'Jcy','\u0458':'jsercy','\u0408':'Jsercy','\u043A':'kcy','\u041A':'Kcy','\u045C':'kjcy','\u040C':'KJcy','\u043B':'lcy','\u041B':'Lcy','\u0459':'ljcy','\u0409':'LJcy','\u043C':'mcy','\u041C':'Mcy','\u043D':'ncy','\u041D':'Ncy','\u045A':'njcy','\u040A':'NJcy','\u043E':'ocy','\u041E':'Ocy','\u043F':'pcy','\u041F':'Pcy','\u0440':'rcy','\u0420':'Rcy','\u0441':'scy','\u0421':'Scy','\u0442':'tcy','\u0422':'Tcy','\u045B':'tshcy','\u040B':'TSHcy','\u0443':'ucy','\u0423':'Ucy','\u045E':'ubrcy','\u040E':'Ubrcy','\u0444':'fcy','\u0424':'Fcy','\u0445':'khcy','\u0425':'KHcy','\u0446':'tscy','\u0426':'TScy','\u0447':'chcy','\u0427':'CHcy','\u045F':'dzcy','\u040F':'DZcy','\u0448':'shcy','\u0428':'SHcy','\u0449':'shchcy','\u0429':'SHCHcy','\u044A':'hardcy','\u042A':'HARDcy','\u044B':'ycy','\u042B':'Ycy','\u044C':'softcy','\u042C':'SOFTcy','\u044D':'ecy','\u042D':'Ecy','\u044E':'yucy','\u042E':'YUcy','\u044F':'yacy','\u042F':'YAcy','\u2135':'aleph','\u2136':'beth','\u2137':'gimel','\u2138':'daleth'}; + sourceMap = fs.readFileSync(uri, 'utf-8'); + return JSON.parse(sourceMap); +} - var regexEscape = /["&'<>`]/g; - var escapeMap = { - '"': '"', - '&': '&', - '\'': ''', - '<': '<', - // See https://mathiasbynens.be/notes/ambiguous-ampersands: in HTML, the - // following is not strictly necessary unless it’s part of a tag or an - // unquoted attribute value. We’re only escaping it to support those - // situations, and for XML support. - '>': '>', - // In Internet Explorer ≤ 8, the backtick character can be used - // to break out of (un)quoted attribute values or HTML comments. - // See http://html5sec.org/#102, http://html5sec.org/#108, and - // http://html5sec.org/#133. - '`': '`' - }; +function applySourceMapRecursively(tokens, inputSourceMapTracker) { + var token; + var i, l; - var regexInvalidEntity = /&#(?:[xX][^a-fA-F0-9]|[^0-9xX])/; - var regexInvalidRawCodePoint = /[\0-\x08\x0B\x0E-\x1F\x7F-\x9F\uFDD0-\uFDEF\uFFFE\uFFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDFFE\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; - var regexDecode = /&#([0-9]+)(;?)|&#[xX]([a-fA-F0-9]+)(;?)|&([0-9a-zA-Z]+);|&(Aacute|Agrave|Atilde|Ccedil|Eacute|Egrave|Iacute|Igrave|Ntilde|Oacute|Ograve|Oslash|Otilde|Uacute|Ugrave|Yacute|aacute|agrave|atilde|brvbar|ccedil|curren|divide|eacute|egrave|frac12|frac14|frac34|iacute|igrave|iquest|middot|ntilde|oacute|ograve|oslash|otilde|plusmn|uacute|ugrave|yacute|AElig|Acirc|Aring|Ecirc|Icirc|Ocirc|THORN|Ucirc|acirc|acute|aelig|aring|cedil|ecirc|icirc|iexcl|laquo|micro|ocirc|pound|raquo|szlig|thorn|times|ucirc|Auml|COPY|Euml|Iuml|Ouml|QUOT|Uuml|auml|cent|copy|euml|iuml|macr|nbsp|ordf|ordm|ouml|para|quot|sect|sup1|sup2|sup3|uuml|yuml|AMP|ETH|REG|amp|deg|eth|not|reg|shy|uml|yen|GT|LT|gt|lt)([=a-zA-Z0-9])?/g; - var decodeMap = {'aacute':'\xE1','Aacute':'\xC1','abreve':'\u0103','Abreve':'\u0102','ac':'\u223E','acd':'\u223F','acE':'\u223E\u0333','acirc':'\xE2','Acirc':'\xC2','acute':'\xB4','acy':'\u0430','Acy':'\u0410','aelig':'\xE6','AElig':'\xC6','af':'\u2061','afr':'\uD835\uDD1E','Afr':'\uD835\uDD04','agrave':'\xE0','Agrave':'\xC0','alefsym':'\u2135','aleph':'\u2135','alpha':'\u03B1','Alpha':'\u0391','amacr':'\u0101','Amacr':'\u0100','amalg':'\u2A3F','amp':'&','AMP':'&','and':'\u2227','And':'\u2A53','andand':'\u2A55','andd':'\u2A5C','andslope':'\u2A58','andv':'\u2A5A','ang':'\u2220','ange':'\u29A4','angle':'\u2220','angmsd':'\u2221','angmsdaa':'\u29A8','angmsdab':'\u29A9','angmsdac':'\u29AA','angmsdad':'\u29AB','angmsdae':'\u29AC','angmsdaf':'\u29AD','angmsdag':'\u29AE','angmsdah':'\u29AF','angrt':'\u221F','angrtvb':'\u22BE','angrtvbd':'\u299D','angsph':'\u2222','angst':'\xC5','angzarr':'\u237C','aogon':'\u0105','Aogon':'\u0104','aopf':'\uD835\uDD52','Aopf':'\uD835\uDD38','ap':'\u2248','apacir':'\u2A6F','ape':'\u224A','apE':'\u2A70','apid':'\u224B','apos':'\'','ApplyFunction':'\u2061','approx':'\u2248','approxeq':'\u224A','aring':'\xE5','Aring':'\xC5','ascr':'\uD835\uDCB6','Ascr':'\uD835\uDC9C','Assign':'\u2254','ast':'*','asymp':'\u2248','asympeq':'\u224D','atilde':'\xE3','Atilde':'\xC3','auml':'\xE4','Auml':'\xC4','awconint':'\u2233','awint':'\u2A11','backcong':'\u224C','backepsilon':'\u03F6','backprime':'\u2035','backsim':'\u223D','backsimeq':'\u22CD','Backslash':'\u2216','Barv':'\u2AE7','barvee':'\u22BD','barwed':'\u2305','Barwed':'\u2306','barwedge':'\u2305','bbrk':'\u23B5','bbrktbrk':'\u23B6','bcong':'\u224C','bcy':'\u0431','Bcy':'\u0411','bdquo':'\u201E','becaus':'\u2235','because':'\u2235','Because':'\u2235','bemptyv':'\u29B0','bepsi':'\u03F6','bernou':'\u212C','Bernoullis':'\u212C','beta':'\u03B2','Beta':'\u0392','beth':'\u2136','between':'\u226C','bfr':'\uD835\uDD1F','Bfr':'\uD835\uDD05','bigcap':'\u22C2','bigcirc':'\u25EF','bigcup':'\u22C3','bigodot':'\u2A00','bigoplus':'\u2A01','bigotimes':'\u2A02','bigsqcup':'\u2A06','bigstar':'\u2605','bigtriangledown':'\u25BD','bigtriangleup':'\u25B3','biguplus':'\u2A04','bigvee':'\u22C1','bigwedge':'\u22C0','bkarow':'\u290D','blacklozenge':'\u29EB','blacksquare':'\u25AA','blacktriangle':'\u25B4','blacktriangledown':'\u25BE','blacktriangleleft':'\u25C2','blacktriangleright':'\u25B8','blank':'\u2423','blk12':'\u2592','blk14':'\u2591','blk34':'\u2593','block':'\u2588','bne':'=\u20E5','bnequiv':'\u2261\u20E5','bnot':'\u2310','bNot':'\u2AED','bopf':'\uD835\uDD53','Bopf':'\uD835\uDD39','bot':'\u22A5','bottom':'\u22A5','bowtie':'\u22C8','boxbox':'\u29C9','boxdl':'\u2510','boxdL':'\u2555','boxDl':'\u2556','boxDL':'\u2557','boxdr':'\u250C','boxdR':'\u2552','boxDr':'\u2553','boxDR':'\u2554','boxh':'\u2500','boxH':'\u2550','boxhd':'\u252C','boxhD':'\u2565','boxHd':'\u2564','boxHD':'\u2566','boxhu':'\u2534','boxhU':'\u2568','boxHu':'\u2567','boxHU':'\u2569','boxminus':'\u229F','boxplus':'\u229E','boxtimes':'\u22A0','boxul':'\u2518','boxuL':'\u255B','boxUl':'\u255C','boxUL':'\u255D','boxur':'\u2514','boxuR':'\u2558','boxUr':'\u2559','boxUR':'\u255A','boxv':'\u2502','boxV':'\u2551','boxvh':'\u253C','boxvH':'\u256A','boxVh':'\u256B','boxVH':'\u256C','boxvl':'\u2524','boxvL':'\u2561','boxVl':'\u2562','boxVL':'\u2563','boxvr':'\u251C','boxvR':'\u255E','boxVr':'\u255F','boxVR':'\u2560','bprime':'\u2035','breve':'\u02D8','Breve':'\u02D8','brvbar':'\xA6','bscr':'\uD835\uDCB7','Bscr':'\u212C','bsemi':'\u204F','bsim':'\u223D','bsime':'\u22CD','bsol':'\\','bsolb':'\u29C5','bsolhsub':'\u27C8','bull':'\u2022','bullet':'\u2022','bump':'\u224E','bumpe':'\u224F','bumpE':'\u2AAE','bumpeq':'\u224F','Bumpeq':'\u224E','cacute':'\u0107','Cacute':'\u0106','cap':'\u2229','Cap':'\u22D2','capand':'\u2A44','capbrcup':'\u2A49','capcap':'\u2A4B','capcup':'\u2A47','capdot':'\u2A40','CapitalDifferentialD':'\u2145','caps':'\u2229\uFE00','caret':'\u2041','caron':'\u02C7','Cayleys':'\u212D','ccaps':'\u2A4D','ccaron':'\u010D','Ccaron':'\u010C','ccedil':'\xE7','Ccedil':'\xC7','ccirc':'\u0109','Ccirc':'\u0108','Cconint':'\u2230','ccups':'\u2A4C','ccupssm':'\u2A50','cdot':'\u010B','Cdot':'\u010A','cedil':'\xB8','Cedilla':'\xB8','cemptyv':'\u29B2','cent':'\xA2','centerdot':'\xB7','CenterDot':'\xB7','cfr':'\uD835\uDD20','Cfr':'\u212D','chcy':'\u0447','CHcy':'\u0427','check':'\u2713','checkmark':'\u2713','chi':'\u03C7','Chi':'\u03A7','cir':'\u25CB','circ':'\u02C6','circeq':'\u2257','circlearrowleft':'\u21BA','circlearrowright':'\u21BB','circledast':'\u229B','circledcirc':'\u229A','circleddash':'\u229D','CircleDot':'\u2299','circledR':'\xAE','circledS':'\u24C8','CircleMinus':'\u2296','CirclePlus':'\u2295','CircleTimes':'\u2297','cire':'\u2257','cirE':'\u29C3','cirfnint':'\u2A10','cirmid':'\u2AEF','cirscir':'\u29C2','ClockwiseContourIntegral':'\u2232','CloseCurlyDoubleQuote':'\u201D','CloseCurlyQuote':'\u2019','clubs':'\u2663','clubsuit':'\u2663','colon':':','Colon':'\u2237','colone':'\u2254','Colone':'\u2A74','coloneq':'\u2254','comma':',','commat':'@','comp':'\u2201','compfn':'\u2218','complement':'\u2201','complexes':'\u2102','cong':'\u2245','congdot':'\u2A6D','Congruent':'\u2261','conint':'\u222E','Conint':'\u222F','ContourIntegral':'\u222E','copf':'\uD835\uDD54','Copf':'\u2102','coprod':'\u2210','Coproduct':'\u2210','copy':'\xA9','COPY':'\xA9','copysr':'\u2117','CounterClockwiseContourIntegral':'\u2233','crarr':'\u21B5','cross':'\u2717','Cross':'\u2A2F','cscr':'\uD835\uDCB8','Cscr':'\uD835\uDC9E','csub':'\u2ACF','csube':'\u2AD1','csup':'\u2AD0','csupe':'\u2AD2','ctdot':'\u22EF','cudarrl':'\u2938','cudarrr':'\u2935','cuepr':'\u22DE','cuesc':'\u22DF','cularr':'\u21B6','cularrp':'\u293D','cup':'\u222A','Cup':'\u22D3','cupbrcap':'\u2A48','cupcap':'\u2A46','CupCap':'\u224D','cupcup':'\u2A4A','cupdot':'\u228D','cupor':'\u2A45','cups':'\u222A\uFE00','curarr':'\u21B7','curarrm':'\u293C','curlyeqprec':'\u22DE','curlyeqsucc':'\u22DF','curlyvee':'\u22CE','curlywedge':'\u22CF','curren':'\xA4','curvearrowleft':'\u21B6','curvearrowright':'\u21B7','cuvee':'\u22CE','cuwed':'\u22CF','cwconint':'\u2232','cwint':'\u2231','cylcty':'\u232D','dagger':'\u2020','Dagger':'\u2021','daleth':'\u2138','darr':'\u2193','dArr':'\u21D3','Darr':'\u21A1','dash':'\u2010','dashv':'\u22A3','Dashv':'\u2AE4','dbkarow':'\u290F','dblac':'\u02DD','dcaron':'\u010F','Dcaron':'\u010E','dcy':'\u0434','Dcy':'\u0414','dd':'\u2146','DD':'\u2145','ddagger':'\u2021','ddarr':'\u21CA','DDotrahd':'\u2911','ddotseq':'\u2A77','deg':'\xB0','Del':'\u2207','delta':'\u03B4','Delta':'\u0394','demptyv':'\u29B1','dfisht':'\u297F','dfr':'\uD835\uDD21','Dfr':'\uD835\uDD07','dHar':'\u2965','dharl':'\u21C3','dharr':'\u21C2','DiacriticalAcute':'\xB4','DiacriticalDot':'\u02D9','DiacriticalDoubleAcute':'\u02DD','DiacriticalGrave':'`','DiacriticalTilde':'\u02DC','diam':'\u22C4','diamond':'\u22C4','Diamond':'\u22C4','diamondsuit':'\u2666','diams':'\u2666','die':'\xA8','DifferentialD':'\u2146','digamma':'\u03DD','disin':'\u22F2','div':'\xF7','divide':'\xF7','divideontimes':'\u22C7','divonx':'\u22C7','djcy':'\u0452','DJcy':'\u0402','dlcorn':'\u231E','dlcrop':'\u230D','dollar':'$','dopf':'\uD835\uDD55','Dopf':'\uD835\uDD3B','dot':'\u02D9','Dot':'\xA8','DotDot':'\u20DC','doteq':'\u2250','doteqdot':'\u2251','DotEqual':'\u2250','dotminus':'\u2238','dotplus':'\u2214','dotsquare':'\u22A1','doublebarwedge':'\u2306','DoubleContourIntegral':'\u222F','DoubleDot':'\xA8','DoubleDownArrow':'\u21D3','DoubleLeftArrow':'\u21D0','DoubleLeftRightArrow':'\u21D4','DoubleLeftTee':'\u2AE4','DoubleLongLeftArrow':'\u27F8','DoubleLongLeftRightArrow':'\u27FA','DoubleLongRightArrow':'\u27F9','DoubleRightArrow':'\u21D2','DoubleRightTee':'\u22A8','DoubleUpArrow':'\u21D1','DoubleUpDownArrow':'\u21D5','DoubleVerticalBar':'\u2225','downarrow':'\u2193','Downarrow':'\u21D3','DownArrow':'\u2193','DownArrowBar':'\u2913','DownArrowUpArrow':'\u21F5','DownBreve':'\u0311','downdownarrows':'\u21CA','downharpoonleft':'\u21C3','downharpoonright':'\u21C2','DownLeftRightVector':'\u2950','DownLeftTeeVector':'\u295E','DownLeftVector':'\u21BD','DownLeftVectorBar':'\u2956','DownRightTeeVector':'\u295F','DownRightVector':'\u21C1','DownRightVectorBar':'\u2957','DownTee':'\u22A4','DownTeeArrow':'\u21A7','drbkarow':'\u2910','drcorn':'\u231F','drcrop':'\u230C','dscr':'\uD835\uDCB9','Dscr':'\uD835\uDC9F','dscy':'\u0455','DScy':'\u0405','dsol':'\u29F6','dstrok':'\u0111','Dstrok':'\u0110','dtdot':'\u22F1','dtri':'\u25BF','dtrif':'\u25BE','duarr':'\u21F5','duhar':'\u296F','dwangle':'\u29A6','dzcy':'\u045F','DZcy':'\u040F','dzigrarr':'\u27FF','eacute':'\xE9','Eacute':'\xC9','easter':'\u2A6E','ecaron':'\u011B','Ecaron':'\u011A','ecir':'\u2256','ecirc':'\xEA','Ecirc':'\xCA','ecolon':'\u2255','ecy':'\u044D','Ecy':'\u042D','eDDot':'\u2A77','edot':'\u0117','eDot':'\u2251','Edot':'\u0116','ee':'\u2147','efDot':'\u2252','efr':'\uD835\uDD22','Efr':'\uD835\uDD08','eg':'\u2A9A','egrave':'\xE8','Egrave':'\xC8','egs':'\u2A96','egsdot':'\u2A98','el':'\u2A99','Element':'\u2208','elinters':'\u23E7','ell':'\u2113','els':'\u2A95','elsdot':'\u2A97','emacr':'\u0113','Emacr':'\u0112','empty':'\u2205','emptyset':'\u2205','EmptySmallSquare':'\u25FB','emptyv':'\u2205','EmptyVerySmallSquare':'\u25AB','emsp':'\u2003','emsp13':'\u2004','emsp14':'\u2005','eng':'\u014B','ENG':'\u014A','ensp':'\u2002','eogon':'\u0119','Eogon':'\u0118','eopf':'\uD835\uDD56','Eopf':'\uD835\uDD3C','epar':'\u22D5','eparsl':'\u29E3','eplus':'\u2A71','epsi':'\u03B5','epsilon':'\u03B5','Epsilon':'\u0395','epsiv':'\u03F5','eqcirc':'\u2256','eqcolon':'\u2255','eqsim':'\u2242','eqslantgtr':'\u2A96','eqslantless':'\u2A95','Equal':'\u2A75','equals':'=','EqualTilde':'\u2242','equest':'\u225F','Equilibrium':'\u21CC','equiv':'\u2261','equivDD':'\u2A78','eqvparsl':'\u29E5','erarr':'\u2971','erDot':'\u2253','escr':'\u212F','Escr':'\u2130','esdot':'\u2250','esim':'\u2242','Esim':'\u2A73','eta':'\u03B7','Eta':'\u0397','eth':'\xF0','ETH':'\xD0','euml':'\xEB','Euml':'\xCB','euro':'\u20AC','excl':'!','exist':'\u2203','Exists':'\u2203','expectation':'\u2130','exponentiale':'\u2147','ExponentialE':'\u2147','fallingdotseq':'\u2252','fcy':'\u0444','Fcy':'\u0424','female':'\u2640','ffilig':'\uFB03','fflig':'\uFB00','ffllig':'\uFB04','ffr':'\uD835\uDD23','Ffr':'\uD835\uDD09','filig':'\uFB01','FilledSmallSquare':'\u25FC','FilledVerySmallSquare':'\u25AA','fjlig':'fj','flat':'\u266D','fllig':'\uFB02','fltns':'\u25B1','fnof':'\u0192','fopf':'\uD835\uDD57','Fopf':'\uD835\uDD3D','forall':'\u2200','ForAll':'\u2200','fork':'\u22D4','forkv':'\u2AD9','Fouriertrf':'\u2131','fpartint':'\u2A0D','frac12':'\xBD','frac13':'\u2153','frac14':'\xBC','frac15':'\u2155','frac16':'\u2159','frac18':'\u215B','frac23':'\u2154','frac25':'\u2156','frac34':'\xBE','frac35':'\u2157','frac38':'\u215C','frac45':'\u2158','frac56':'\u215A','frac58':'\u215D','frac78':'\u215E','frasl':'\u2044','frown':'\u2322','fscr':'\uD835\uDCBB','Fscr':'\u2131','gacute':'\u01F5','gamma':'\u03B3','Gamma':'\u0393','gammad':'\u03DD','Gammad':'\u03DC','gap':'\u2A86','gbreve':'\u011F','Gbreve':'\u011E','Gcedil':'\u0122','gcirc':'\u011D','Gcirc':'\u011C','gcy':'\u0433','Gcy':'\u0413','gdot':'\u0121','Gdot':'\u0120','ge':'\u2265','gE':'\u2267','gel':'\u22DB','gEl':'\u2A8C','geq':'\u2265','geqq':'\u2267','geqslant':'\u2A7E','ges':'\u2A7E','gescc':'\u2AA9','gesdot':'\u2A80','gesdoto':'\u2A82','gesdotol':'\u2A84','gesl':'\u22DB\uFE00','gesles':'\u2A94','gfr':'\uD835\uDD24','Gfr':'\uD835\uDD0A','gg':'\u226B','Gg':'\u22D9','ggg':'\u22D9','gimel':'\u2137','gjcy':'\u0453','GJcy':'\u0403','gl':'\u2277','gla':'\u2AA5','glE':'\u2A92','glj':'\u2AA4','gnap':'\u2A8A','gnapprox':'\u2A8A','gne':'\u2A88','gnE':'\u2269','gneq':'\u2A88','gneqq':'\u2269','gnsim':'\u22E7','gopf':'\uD835\uDD58','Gopf':'\uD835\uDD3E','grave':'`','GreaterEqual':'\u2265','GreaterEqualLess':'\u22DB','GreaterFullEqual':'\u2267','GreaterGreater':'\u2AA2','GreaterLess':'\u2277','GreaterSlantEqual':'\u2A7E','GreaterTilde':'\u2273','gscr':'\u210A','Gscr':'\uD835\uDCA2','gsim':'\u2273','gsime':'\u2A8E','gsiml':'\u2A90','gt':'>','Gt':'\u226B','GT':'>','gtcc':'\u2AA7','gtcir':'\u2A7A','gtdot':'\u22D7','gtlPar':'\u2995','gtquest':'\u2A7C','gtrapprox':'\u2A86','gtrarr':'\u2978','gtrdot':'\u22D7','gtreqless':'\u22DB','gtreqqless':'\u2A8C','gtrless':'\u2277','gtrsim':'\u2273','gvertneqq':'\u2269\uFE00','gvnE':'\u2269\uFE00','Hacek':'\u02C7','hairsp':'\u200A','half':'\xBD','hamilt':'\u210B','hardcy':'\u044A','HARDcy':'\u042A','harr':'\u2194','hArr':'\u21D4','harrcir':'\u2948','harrw':'\u21AD','Hat':'^','hbar':'\u210F','hcirc':'\u0125','Hcirc':'\u0124','hearts':'\u2665','heartsuit':'\u2665','hellip':'\u2026','hercon':'\u22B9','hfr':'\uD835\uDD25','Hfr':'\u210C','HilbertSpace':'\u210B','hksearow':'\u2925','hkswarow':'\u2926','hoarr':'\u21FF','homtht':'\u223B','hookleftarrow':'\u21A9','hookrightarrow':'\u21AA','hopf':'\uD835\uDD59','Hopf':'\u210D','horbar':'\u2015','HorizontalLine':'\u2500','hscr':'\uD835\uDCBD','Hscr':'\u210B','hslash':'\u210F','hstrok':'\u0127','Hstrok':'\u0126','HumpDownHump':'\u224E','HumpEqual':'\u224F','hybull':'\u2043','hyphen':'\u2010','iacute':'\xED','Iacute':'\xCD','ic':'\u2063','icirc':'\xEE','Icirc':'\xCE','icy':'\u0438','Icy':'\u0418','Idot':'\u0130','iecy':'\u0435','IEcy':'\u0415','iexcl':'\xA1','iff':'\u21D4','ifr':'\uD835\uDD26','Ifr':'\u2111','igrave':'\xEC','Igrave':'\xCC','ii':'\u2148','iiiint':'\u2A0C','iiint':'\u222D','iinfin':'\u29DC','iiota':'\u2129','ijlig':'\u0133','IJlig':'\u0132','Im':'\u2111','imacr':'\u012B','Imacr':'\u012A','image':'\u2111','ImaginaryI':'\u2148','imagline':'\u2110','imagpart':'\u2111','imath':'\u0131','imof':'\u22B7','imped':'\u01B5','Implies':'\u21D2','in':'\u2208','incare':'\u2105','infin':'\u221E','infintie':'\u29DD','inodot':'\u0131','int':'\u222B','Int':'\u222C','intcal':'\u22BA','integers':'\u2124','Integral':'\u222B','intercal':'\u22BA','Intersection':'\u22C2','intlarhk':'\u2A17','intprod':'\u2A3C','InvisibleComma':'\u2063','InvisibleTimes':'\u2062','iocy':'\u0451','IOcy':'\u0401','iogon':'\u012F','Iogon':'\u012E','iopf':'\uD835\uDD5A','Iopf':'\uD835\uDD40','iota':'\u03B9','Iota':'\u0399','iprod':'\u2A3C','iquest':'\xBF','iscr':'\uD835\uDCBE','Iscr':'\u2110','isin':'\u2208','isindot':'\u22F5','isinE':'\u22F9','isins':'\u22F4','isinsv':'\u22F3','isinv':'\u2208','it':'\u2062','itilde':'\u0129','Itilde':'\u0128','iukcy':'\u0456','Iukcy':'\u0406','iuml':'\xEF','Iuml':'\xCF','jcirc':'\u0135','Jcirc':'\u0134','jcy':'\u0439','Jcy':'\u0419','jfr':'\uD835\uDD27','Jfr':'\uD835\uDD0D','jmath':'\u0237','jopf':'\uD835\uDD5B','Jopf':'\uD835\uDD41','jscr':'\uD835\uDCBF','Jscr':'\uD835\uDCA5','jsercy':'\u0458','Jsercy':'\u0408','jukcy':'\u0454','Jukcy':'\u0404','kappa':'\u03BA','Kappa':'\u039A','kappav':'\u03F0','kcedil':'\u0137','Kcedil':'\u0136','kcy':'\u043A','Kcy':'\u041A','kfr':'\uD835\uDD28','Kfr':'\uD835\uDD0E','kgreen':'\u0138','khcy':'\u0445','KHcy':'\u0425','kjcy':'\u045C','KJcy':'\u040C','kopf':'\uD835\uDD5C','Kopf':'\uD835\uDD42','kscr':'\uD835\uDCC0','Kscr':'\uD835\uDCA6','lAarr':'\u21DA','lacute':'\u013A','Lacute':'\u0139','laemptyv':'\u29B4','lagran':'\u2112','lambda':'\u03BB','Lambda':'\u039B','lang':'\u27E8','Lang':'\u27EA','langd':'\u2991','langle':'\u27E8','lap':'\u2A85','Laplacetrf':'\u2112','laquo':'\xAB','larr':'\u2190','lArr':'\u21D0','Larr':'\u219E','larrb':'\u21E4','larrbfs':'\u291F','larrfs':'\u291D','larrhk':'\u21A9','larrlp':'\u21AB','larrpl':'\u2939','larrsim':'\u2973','larrtl':'\u21A2','lat':'\u2AAB','latail':'\u2919','lAtail':'\u291B','late':'\u2AAD','lates':'\u2AAD\uFE00','lbarr':'\u290C','lBarr':'\u290E','lbbrk':'\u2772','lbrace':'{','lbrack':'[','lbrke':'\u298B','lbrksld':'\u298F','lbrkslu':'\u298D','lcaron':'\u013E','Lcaron':'\u013D','lcedil':'\u013C','Lcedil':'\u013B','lceil':'\u2308','lcub':'{','lcy':'\u043B','Lcy':'\u041B','ldca':'\u2936','ldquo':'\u201C','ldquor':'\u201E','ldrdhar':'\u2967','ldrushar':'\u294B','ldsh':'\u21B2','le':'\u2264','lE':'\u2266','LeftAngleBracket':'\u27E8','leftarrow':'\u2190','Leftarrow':'\u21D0','LeftArrow':'\u2190','LeftArrowBar':'\u21E4','LeftArrowRightArrow':'\u21C6','leftarrowtail':'\u21A2','LeftCeiling':'\u2308','LeftDoubleBracket':'\u27E6','LeftDownTeeVector':'\u2961','LeftDownVector':'\u21C3','LeftDownVectorBar':'\u2959','LeftFloor':'\u230A','leftharpoondown':'\u21BD','leftharpoonup':'\u21BC','leftleftarrows':'\u21C7','leftrightarrow':'\u2194','Leftrightarrow':'\u21D4','LeftRightArrow':'\u2194','leftrightarrows':'\u21C6','leftrightharpoons':'\u21CB','leftrightsquigarrow':'\u21AD','LeftRightVector':'\u294E','LeftTee':'\u22A3','LeftTeeArrow':'\u21A4','LeftTeeVector':'\u295A','leftthreetimes':'\u22CB','LeftTriangle':'\u22B2','LeftTriangleBar':'\u29CF','LeftTriangleEqual':'\u22B4','LeftUpDownVector':'\u2951','LeftUpTeeVector':'\u2960','LeftUpVector':'\u21BF','LeftUpVectorBar':'\u2958','LeftVector':'\u21BC','LeftVectorBar':'\u2952','leg':'\u22DA','lEg':'\u2A8B','leq':'\u2264','leqq':'\u2266','leqslant':'\u2A7D','les':'\u2A7D','lescc':'\u2AA8','lesdot':'\u2A7F','lesdoto':'\u2A81','lesdotor':'\u2A83','lesg':'\u22DA\uFE00','lesges':'\u2A93','lessapprox':'\u2A85','lessdot':'\u22D6','lesseqgtr':'\u22DA','lesseqqgtr':'\u2A8B','LessEqualGreater':'\u22DA','LessFullEqual':'\u2266','LessGreater':'\u2276','lessgtr':'\u2276','LessLess':'\u2AA1','lesssim':'\u2272','LessSlantEqual':'\u2A7D','LessTilde':'\u2272','lfisht':'\u297C','lfloor':'\u230A','lfr':'\uD835\uDD29','Lfr':'\uD835\uDD0F','lg':'\u2276','lgE':'\u2A91','lHar':'\u2962','lhard':'\u21BD','lharu':'\u21BC','lharul':'\u296A','lhblk':'\u2584','ljcy':'\u0459','LJcy':'\u0409','ll':'\u226A','Ll':'\u22D8','llarr':'\u21C7','llcorner':'\u231E','Lleftarrow':'\u21DA','llhard':'\u296B','lltri':'\u25FA','lmidot':'\u0140','Lmidot':'\u013F','lmoust':'\u23B0','lmoustache':'\u23B0','lnap':'\u2A89','lnapprox':'\u2A89','lne':'\u2A87','lnE':'\u2268','lneq':'\u2A87','lneqq':'\u2268','lnsim':'\u22E6','loang':'\u27EC','loarr':'\u21FD','lobrk':'\u27E6','longleftarrow':'\u27F5','Longleftarrow':'\u27F8','LongLeftArrow':'\u27F5','longleftrightarrow':'\u27F7','Longleftrightarrow':'\u27FA','LongLeftRightArrow':'\u27F7','longmapsto':'\u27FC','longrightarrow':'\u27F6','Longrightarrow':'\u27F9','LongRightArrow':'\u27F6','looparrowleft':'\u21AB','looparrowright':'\u21AC','lopar':'\u2985','lopf':'\uD835\uDD5D','Lopf':'\uD835\uDD43','loplus':'\u2A2D','lotimes':'\u2A34','lowast':'\u2217','lowbar':'_','LowerLeftArrow':'\u2199','LowerRightArrow':'\u2198','loz':'\u25CA','lozenge':'\u25CA','lozf':'\u29EB','lpar':'(','lparlt':'\u2993','lrarr':'\u21C6','lrcorner':'\u231F','lrhar':'\u21CB','lrhard':'\u296D','lrm':'\u200E','lrtri':'\u22BF','lsaquo':'\u2039','lscr':'\uD835\uDCC1','Lscr':'\u2112','lsh':'\u21B0','Lsh':'\u21B0','lsim':'\u2272','lsime':'\u2A8D','lsimg':'\u2A8F','lsqb':'[','lsquo':'\u2018','lsquor':'\u201A','lstrok':'\u0142','Lstrok':'\u0141','lt':'<','Lt':'\u226A','LT':'<','ltcc':'\u2AA6','ltcir':'\u2A79','ltdot':'\u22D6','lthree':'\u22CB','ltimes':'\u22C9','ltlarr':'\u2976','ltquest':'\u2A7B','ltri':'\u25C3','ltrie':'\u22B4','ltrif':'\u25C2','ltrPar':'\u2996','lurdshar':'\u294A','luruhar':'\u2966','lvertneqq':'\u2268\uFE00','lvnE':'\u2268\uFE00','macr':'\xAF','male':'\u2642','malt':'\u2720','maltese':'\u2720','map':'\u21A6','Map':'\u2905','mapsto':'\u21A6','mapstodown':'\u21A7','mapstoleft':'\u21A4','mapstoup':'\u21A5','marker':'\u25AE','mcomma':'\u2A29','mcy':'\u043C','Mcy':'\u041C','mdash':'\u2014','mDDot':'\u223A','measuredangle':'\u2221','MediumSpace':'\u205F','Mellintrf':'\u2133','mfr':'\uD835\uDD2A','Mfr':'\uD835\uDD10','mho':'\u2127','micro':'\xB5','mid':'\u2223','midast':'*','midcir':'\u2AF0','middot':'\xB7','minus':'\u2212','minusb':'\u229F','minusd':'\u2238','minusdu':'\u2A2A','MinusPlus':'\u2213','mlcp':'\u2ADB','mldr':'\u2026','mnplus':'\u2213','models':'\u22A7','mopf':'\uD835\uDD5E','Mopf':'\uD835\uDD44','mp':'\u2213','mscr':'\uD835\uDCC2','Mscr':'\u2133','mstpos':'\u223E','mu':'\u03BC','Mu':'\u039C','multimap':'\u22B8','mumap':'\u22B8','nabla':'\u2207','nacute':'\u0144','Nacute':'\u0143','nang':'\u2220\u20D2','nap':'\u2249','napE':'\u2A70\u0338','napid':'\u224B\u0338','napos':'\u0149','napprox':'\u2249','natur':'\u266E','natural':'\u266E','naturals':'\u2115','nbsp':'\xA0','nbump':'\u224E\u0338','nbumpe':'\u224F\u0338','ncap':'\u2A43','ncaron':'\u0148','Ncaron':'\u0147','ncedil':'\u0146','Ncedil':'\u0145','ncong':'\u2247','ncongdot':'\u2A6D\u0338','ncup':'\u2A42','ncy':'\u043D','Ncy':'\u041D','ndash':'\u2013','ne':'\u2260','nearhk':'\u2924','nearr':'\u2197','neArr':'\u21D7','nearrow':'\u2197','nedot':'\u2250\u0338','NegativeMediumSpace':'\u200B','NegativeThickSpace':'\u200B','NegativeThinSpace':'\u200B','NegativeVeryThinSpace':'\u200B','nequiv':'\u2262','nesear':'\u2928','nesim':'\u2242\u0338','NestedGreaterGreater':'\u226B','NestedLessLess':'\u226A','NewLine':'\n','nexist':'\u2204','nexists':'\u2204','nfr':'\uD835\uDD2B','Nfr':'\uD835\uDD11','nge':'\u2271','ngE':'\u2267\u0338','ngeq':'\u2271','ngeqq':'\u2267\u0338','ngeqslant':'\u2A7E\u0338','nges':'\u2A7E\u0338','nGg':'\u22D9\u0338','ngsim':'\u2275','ngt':'\u226F','nGt':'\u226B\u20D2','ngtr':'\u226F','nGtv':'\u226B\u0338','nharr':'\u21AE','nhArr':'\u21CE','nhpar':'\u2AF2','ni':'\u220B','nis':'\u22FC','nisd':'\u22FA','niv':'\u220B','njcy':'\u045A','NJcy':'\u040A','nlarr':'\u219A','nlArr':'\u21CD','nldr':'\u2025','nle':'\u2270','nlE':'\u2266\u0338','nleftarrow':'\u219A','nLeftarrow':'\u21CD','nleftrightarrow':'\u21AE','nLeftrightarrow':'\u21CE','nleq':'\u2270','nleqq':'\u2266\u0338','nleqslant':'\u2A7D\u0338','nles':'\u2A7D\u0338','nless':'\u226E','nLl':'\u22D8\u0338','nlsim':'\u2274','nlt':'\u226E','nLt':'\u226A\u20D2','nltri':'\u22EA','nltrie':'\u22EC','nLtv':'\u226A\u0338','nmid':'\u2224','NoBreak':'\u2060','NonBreakingSpace':'\xA0','nopf':'\uD835\uDD5F','Nopf':'\u2115','not':'\xAC','Not':'\u2AEC','NotCongruent':'\u2262','NotCupCap':'\u226D','NotDoubleVerticalBar':'\u2226','NotElement':'\u2209','NotEqual':'\u2260','NotEqualTilde':'\u2242\u0338','NotExists':'\u2204','NotGreater':'\u226F','NotGreaterEqual':'\u2271','NotGreaterFullEqual':'\u2267\u0338','NotGreaterGreater':'\u226B\u0338','NotGreaterLess':'\u2279','NotGreaterSlantEqual':'\u2A7E\u0338','NotGreaterTilde':'\u2275','NotHumpDownHump':'\u224E\u0338','NotHumpEqual':'\u224F\u0338','notin':'\u2209','notindot':'\u22F5\u0338','notinE':'\u22F9\u0338','notinva':'\u2209','notinvb':'\u22F7','notinvc':'\u22F6','NotLeftTriangle':'\u22EA','NotLeftTriangleBar':'\u29CF\u0338','NotLeftTriangleEqual':'\u22EC','NotLess':'\u226E','NotLessEqual':'\u2270','NotLessGreater':'\u2278','NotLessLess':'\u226A\u0338','NotLessSlantEqual':'\u2A7D\u0338','NotLessTilde':'\u2274','NotNestedGreaterGreater':'\u2AA2\u0338','NotNestedLessLess':'\u2AA1\u0338','notni':'\u220C','notniva':'\u220C','notnivb':'\u22FE','notnivc':'\u22FD','NotPrecedes':'\u2280','NotPrecedesEqual':'\u2AAF\u0338','NotPrecedesSlantEqual':'\u22E0','NotReverseElement':'\u220C','NotRightTriangle':'\u22EB','NotRightTriangleBar':'\u29D0\u0338','NotRightTriangleEqual':'\u22ED','NotSquareSubset':'\u228F\u0338','NotSquareSubsetEqual':'\u22E2','NotSquareSuperset':'\u2290\u0338','NotSquareSupersetEqual':'\u22E3','NotSubset':'\u2282\u20D2','NotSubsetEqual':'\u2288','NotSucceeds':'\u2281','NotSucceedsEqual':'\u2AB0\u0338','NotSucceedsSlantEqual':'\u22E1','NotSucceedsTilde':'\u227F\u0338','NotSuperset':'\u2283\u20D2','NotSupersetEqual':'\u2289','NotTilde':'\u2241','NotTildeEqual':'\u2244','NotTildeFullEqual':'\u2247','NotTildeTilde':'\u2249','NotVerticalBar':'\u2224','npar':'\u2226','nparallel':'\u2226','nparsl':'\u2AFD\u20E5','npart':'\u2202\u0338','npolint':'\u2A14','npr':'\u2280','nprcue':'\u22E0','npre':'\u2AAF\u0338','nprec':'\u2280','npreceq':'\u2AAF\u0338','nrarr':'\u219B','nrArr':'\u21CF','nrarrc':'\u2933\u0338','nrarrw':'\u219D\u0338','nrightarrow':'\u219B','nRightarrow':'\u21CF','nrtri':'\u22EB','nrtrie':'\u22ED','nsc':'\u2281','nsccue':'\u22E1','nsce':'\u2AB0\u0338','nscr':'\uD835\uDCC3','Nscr':'\uD835\uDCA9','nshortmid':'\u2224','nshortparallel':'\u2226','nsim':'\u2241','nsime':'\u2244','nsimeq':'\u2244','nsmid':'\u2224','nspar':'\u2226','nsqsube':'\u22E2','nsqsupe':'\u22E3','nsub':'\u2284','nsube':'\u2288','nsubE':'\u2AC5\u0338','nsubset':'\u2282\u20D2','nsubseteq':'\u2288','nsubseteqq':'\u2AC5\u0338','nsucc':'\u2281','nsucceq':'\u2AB0\u0338','nsup':'\u2285','nsupe':'\u2289','nsupE':'\u2AC6\u0338','nsupset':'\u2283\u20D2','nsupseteq':'\u2289','nsupseteqq':'\u2AC6\u0338','ntgl':'\u2279','ntilde':'\xF1','Ntilde':'\xD1','ntlg':'\u2278','ntriangleleft':'\u22EA','ntrianglelefteq':'\u22EC','ntriangleright':'\u22EB','ntrianglerighteq':'\u22ED','nu':'\u03BD','Nu':'\u039D','num':'#','numero':'\u2116','numsp':'\u2007','nvap':'\u224D\u20D2','nvdash':'\u22AC','nvDash':'\u22AD','nVdash':'\u22AE','nVDash':'\u22AF','nvge':'\u2265\u20D2','nvgt':'>\u20D2','nvHarr':'\u2904','nvinfin':'\u29DE','nvlArr':'\u2902','nvle':'\u2264\u20D2','nvlt':'<\u20D2','nvltrie':'\u22B4\u20D2','nvrArr':'\u2903','nvrtrie':'\u22B5\u20D2','nvsim':'\u223C\u20D2','nwarhk':'\u2923','nwarr':'\u2196','nwArr':'\u21D6','nwarrow':'\u2196','nwnear':'\u2927','oacute':'\xF3','Oacute':'\xD3','oast':'\u229B','ocir':'\u229A','ocirc':'\xF4','Ocirc':'\xD4','ocy':'\u043E','Ocy':'\u041E','odash':'\u229D','odblac':'\u0151','Odblac':'\u0150','odiv':'\u2A38','odot':'\u2299','odsold':'\u29BC','oelig':'\u0153','OElig':'\u0152','ofcir':'\u29BF','ofr':'\uD835\uDD2C','Ofr':'\uD835\uDD12','ogon':'\u02DB','ograve':'\xF2','Ograve':'\xD2','ogt':'\u29C1','ohbar':'\u29B5','ohm':'\u03A9','oint':'\u222E','olarr':'\u21BA','olcir':'\u29BE','olcross':'\u29BB','oline':'\u203E','olt':'\u29C0','omacr':'\u014D','Omacr':'\u014C','omega':'\u03C9','Omega':'\u03A9','omicron':'\u03BF','Omicron':'\u039F','omid':'\u29B6','ominus':'\u2296','oopf':'\uD835\uDD60','Oopf':'\uD835\uDD46','opar':'\u29B7','OpenCurlyDoubleQuote':'\u201C','OpenCurlyQuote':'\u2018','operp':'\u29B9','oplus':'\u2295','or':'\u2228','Or':'\u2A54','orarr':'\u21BB','ord':'\u2A5D','order':'\u2134','orderof':'\u2134','ordf':'\xAA','ordm':'\xBA','origof':'\u22B6','oror':'\u2A56','orslope':'\u2A57','orv':'\u2A5B','oS':'\u24C8','oscr':'\u2134','Oscr':'\uD835\uDCAA','oslash':'\xF8','Oslash':'\xD8','osol':'\u2298','otilde':'\xF5','Otilde':'\xD5','otimes':'\u2297','Otimes':'\u2A37','otimesas':'\u2A36','ouml':'\xF6','Ouml':'\xD6','ovbar':'\u233D','OverBar':'\u203E','OverBrace':'\u23DE','OverBracket':'\u23B4','OverParenthesis':'\u23DC','par':'\u2225','para':'\xB6','parallel':'\u2225','parsim':'\u2AF3','parsl':'\u2AFD','part':'\u2202','PartialD':'\u2202','pcy':'\u043F','Pcy':'\u041F','percnt':'%','period':'.','permil':'\u2030','perp':'\u22A5','pertenk':'\u2031','pfr':'\uD835\uDD2D','Pfr':'\uD835\uDD13','phi':'\u03C6','Phi':'\u03A6','phiv':'\u03D5','phmmat':'\u2133','phone':'\u260E','pi':'\u03C0','Pi':'\u03A0','pitchfork':'\u22D4','piv':'\u03D6','planck':'\u210F','planckh':'\u210E','plankv':'\u210F','plus':'+','plusacir':'\u2A23','plusb':'\u229E','pluscir':'\u2A22','plusdo':'\u2214','plusdu':'\u2A25','pluse':'\u2A72','PlusMinus':'\xB1','plusmn':'\xB1','plussim':'\u2A26','plustwo':'\u2A27','pm':'\xB1','Poincareplane':'\u210C','pointint':'\u2A15','popf':'\uD835\uDD61','Popf':'\u2119','pound':'\xA3','pr':'\u227A','Pr':'\u2ABB','prap':'\u2AB7','prcue':'\u227C','pre':'\u2AAF','prE':'\u2AB3','prec':'\u227A','precapprox':'\u2AB7','preccurlyeq':'\u227C','Precedes':'\u227A','PrecedesEqual':'\u2AAF','PrecedesSlantEqual':'\u227C','PrecedesTilde':'\u227E','preceq':'\u2AAF','precnapprox':'\u2AB9','precneqq':'\u2AB5','precnsim':'\u22E8','precsim':'\u227E','prime':'\u2032','Prime':'\u2033','primes':'\u2119','prnap':'\u2AB9','prnE':'\u2AB5','prnsim':'\u22E8','prod':'\u220F','Product':'\u220F','profalar':'\u232E','profline':'\u2312','profsurf':'\u2313','prop':'\u221D','Proportion':'\u2237','Proportional':'\u221D','propto':'\u221D','prsim':'\u227E','prurel':'\u22B0','pscr':'\uD835\uDCC5','Pscr':'\uD835\uDCAB','psi':'\u03C8','Psi':'\u03A8','puncsp':'\u2008','qfr':'\uD835\uDD2E','Qfr':'\uD835\uDD14','qint':'\u2A0C','qopf':'\uD835\uDD62','Qopf':'\u211A','qprime':'\u2057','qscr':'\uD835\uDCC6','Qscr':'\uD835\uDCAC','quaternions':'\u210D','quatint':'\u2A16','quest':'?','questeq':'\u225F','quot':'"','QUOT':'"','rAarr':'\u21DB','race':'\u223D\u0331','racute':'\u0155','Racute':'\u0154','radic':'\u221A','raemptyv':'\u29B3','rang':'\u27E9','Rang':'\u27EB','rangd':'\u2992','range':'\u29A5','rangle':'\u27E9','raquo':'\xBB','rarr':'\u2192','rArr':'\u21D2','Rarr':'\u21A0','rarrap':'\u2975','rarrb':'\u21E5','rarrbfs':'\u2920','rarrc':'\u2933','rarrfs':'\u291E','rarrhk':'\u21AA','rarrlp':'\u21AC','rarrpl':'\u2945','rarrsim':'\u2974','rarrtl':'\u21A3','Rarrtl':'\u2916','rarrw':'\u219D','ratail':'\u291A','rAtail':'\u291C','ratio':'\u2236','rationals':'\u211A','rbarr':'\u290D','rBarr':'\u290F','RBarr':'\u2910','rbbrk':'\u2773','rbrace':'}','rbrack':']','rbrke':'\u298C','rbrksld':'\u298E','rbrkslu':'\u2990','rcaron':'\u0159','Rcaron':'\u0158','rcedil':'\u0157','Rcedil':'\u0156','rceil':'\u2309','rcub':'}','rcy':'\u0440','Rcy':'\u0420','rdca':'\u2937','rdldhar':'\u2969','rdquo':'\u201D','rdquor':'\u201D','rdsh':'\u21B3','Re':'\u211C','real':'\u211C','realine':'\u211B','realpart':'\u211C','reals':'\u211D','rect':'\u25AD','reg':'\xAE','REG':'\xAE','ReverseElement':'\u220B','ReverseEquilibrium':'\u21CB','ReverseUpEquilibrium':'\u296F','rfisht':'\u297D','rfloor':'\u230B','rfr':'\uD835\uDD2F','Rfr':'\u211C','rHar':'\u2964','rhard':'\u21C1','rharu':'\u21C0','rharul':'\u296C','rho':'\u03C1','Rho':'\u03A1','rhov':'\u03F1','RightAngleBracket':'\u27E9','rightarrow':'\u2192','Rightarrow':'\u21D2','RightArrow':'\u2192','RightArrowBar':'\u21E5','RightArrowLeftArrow':'\u21C4','rightarrowtail':'\u21A3','RightCeiling':'\u2309','RightDoubleBracket':'\u27E7','RightDownTeeVector':'\u295D','RightDownVector':'\u21C2','RightDownVectorBar':'\u2955','RightFloor':'\u230B','rightharpoondown':'\u21C1','rightharpoonup':'\u21C0','rightleftarrows':'\u21C4','rightleftharpoons':'\u21CC','rightrightarrows':'\u21C9','rightsquigarrow':'\u219D','RightTee':'\u22A2','RightTeeArrow':'\u21A6','RightTeeVector':'\u295B','rightthreetimes':'\u22CC','RightTriangle':'\u22B3','RightTriangleBar':'\u29D0','RightTriangleEqual':'\u22B5','RightUpDownVector':'\u294F','RightUpTeeVector':'\u295C','RightUpVector':'\u21BE','RightUpVectorBar':'\u2954','RightVector':'\u21C0','RightVectorBar':'\u2953','ring':'\u02DA','risingdotseq':'\u2253','rlarr':'\u21C4','rlhar':'\u21CC','rlm':'\u200F','rmoust':'\u23B1','rmoustache':'\u23B1','rnmid':'\u2AEE','roang':'\u27ED','roarr':'\u21FE','robrk':'\u27E7','ropar':'\u2986','ropf':'\uD835\uDD63','Ropf':'\u211D','roplus':'\u2A2E','rotimes':'\u2A35','RoundImplies':'\u2970','rpar':')','rpargt':'\u2994','rppolint':'\u2A12','rrarr':'\u21C9','Rrightarrow':'\u21DB','rsaquo':'\u203A','rscr':'\uD835\uDCC7','Rscr':'\u211B','rsh':'\u21B1','Rsh':'\u21B1','rsqb':']','rsquo':'\u2019','rsquor':'\u2019','rthree':'\u22CC','rtimes':'\u22CA','rtri':'\u25B9','rtrie':'\u22B5','rtrif':'\u25B8','rtriltri':'\u29CE','RuleDelayed':'\u29F4','ruluhar':'\u2968','rx':'\u211E','sacute':'\u015B','Sacute':'\u015A','sbquo':'\u201A','sc':'\u227B','Sc':'\u2ABC','scap':'\u2AB8','scaron':'\u0161','Scaron':'\u0160','sccue':'\u227D','sce':'\u2AB0','scE':'\u2AB4','scedil':'\u015F','Scedil':'\u015E','scirc':'\u015D','Scirc':'\u015C','scnap':'\u2ABA','scnE':'\u2AB6','scnsim':'\u22E9','scpolint':'\u2A13','scsim':'\u227F','scy':'\u0441','Scy':'\u0421','sdot':'\u22C5','sdotb':'\u22A1','sdote':'\u2A66','searhk':'\u2925','searr':'\u2198','seArr':'\u21D8','searrow':'\u2198','sect':'\xA7','semi':';','seswar':'\u2929','setminus':'\u2216','setmn':'\u2216','sext':'\u2736','sfr':'\uD835\uDD30','Sfr':'\uD835\uDD16','sfrown':'\u2322','sharp':'\u266F','shchcy':'\u0449','SHCHcy':'\u0429','shcy':'\u0448','SHcy':'\u0428','ShortDownArrow':'\u2193','ShortLeftArrow':'\u2190','shortmid':'\u2223','shortparallel':'\u2225','ShortRightArrow':'\u2192','ShortUpArrow':'\u2191','shy':'\xAD','sigma':'\u03C3','Sigma':'\u03A3','sigmaf':'\u03C2','sigmav':'\u03C2','sim':'\u223C','simdot':'\u2A6A','sime':'\u2243','simeq':'\u2243','simg':'\u2A9E','simgE':'\u2AA0','siml':'\u2A9D','simlE':'\u2A9F','simne':'\u2246','simplus':'\u2A24','simrarr':'\u2972','slarr':'\u2190','SmallCircle':'\u2218','smallsetminus':'\u2216','smashp':'\u2A33','smeparsl':'\u29E4','smid':'\u2223','smile':'\u2323','smt':'\u2AAA','smte':'\u2AAC','smtes':'\u2AAC\uFE00','softcy':'\u044C','SOFTcy':'\u042C','sol':'/','solb':'\u29C4','solbar':'\u233F','sopf':'\uD835\uDD64','Sopf':'\uD835\uDD4A','spades':'\u2660','spadesuit':'\u2660','spar':'\u2225','sqcap':'\u2293','sqcaps':'\u2293\uFE00','sqcup':'\u2294','sqcups':'\u2294\uFE00','Sqrt':'\u221A','sqsub':'\u228F','sqsube':'\u2291','sqsubset':'\u228F','sqsubseteq':'\u2291','sqsup':'\u2290','sqsupe':'\u2292','sqsupset':'\u2290','sqsupseteq':'\u2292','squ':'\u25A1','square':'\u25A1','Square':'\u25A1','SquareIntersection':'\u2293','SquareSubset':'\u228F','SquareSubsetEqual':'\u2291','SquareSuperset':'\u2290','SquareSupersetEqual':'\u2292','SquareUnion':'\u2294','squarf':'\u25AA','squf':'\u25AA','srarr':'\u2192','sscr':'\uD835\uDCC8','Sscr':'\uD835\uDCAE','ssetmn':'\u2216','ssmile':'\u2323','sstarf':'\u22C6','star':'\u2606','Star':'\u22C6','starf':'\u2605','straightepsilon':'\u03F5','straightphi':'\u03D5','strns':'\xAF','sub':'\u2282','Sub':'\u22D0','subdot':'\u2ABD','sube':'\u2286','subE':'\u2AC5','subedot':'\u2AC3','submult':'\u2AC1','subne':'\u228A','subnE':'\u2ACB','subplus':'\u2ABF','subrarr':'\u2979','subset':'\u2282','Subset':'\u22D0','subseteq':'\u2286','subseteqq':'\u2AC5','SubsetEqual':'\u2286','subsetneq':'\u228A','subsetneqq':'\u2ACB','subsim':'\u2AC7','subsub':'\u2AD5','subsup':'\u2AD3','succ':'\u227B','succapprox':'\u2AB8','succcurlyeq':'\u227D','Succeeds':'\u227B','SucceedsEqual':'\u2AB0','SucceedsSlantEqual':'\u227D','SucceedsTilde':'\u227F','succeq':'\u2AB0','succnapprox':'\u2ABA','succneqq':'\u2AB6','succnsim':'\u22E9','succsim':'\u227F','SuchThat':'\u220B','sum':'\u2211','Sum':'\u2211','sung':'\u266A','sup':'\u2283','Sup':'\u22D1','sup1':'\xB9','sup2':'\xB2','sup3':'\xB3','supdot':'\u2ABE','supdsub':'\u2AD8','supe':'\u2287','supE':'\u2AC6','supedot':'\u2AC4','Superset':'\u2283','SupersetEqual':'\u2287','suphsol':'\u27C9','suphsub':'\u2AD7','suplarr':'\u297B','supmult':'\u2AC2','supne':'\u228B','supnE':'\u2ACC','supplus':'\u2AC0','supset':'\u2283','Supset':'\u22D1','supseteq':'\u2287','supseteqq':'\u2AC6','supsetneq':'\u228B','supsetneqq':'\u2ACC','supsim':'\u2AC8','supsub':'\u2AD4','supsup':'\u2AD6','swarhk':'\u2926','swarr':'\u2199','swArr':'\u21D9','swarrow':'\u2199','swnwar':'\u292A','szlig':'\xDF','Tab':'\t','target':'\u2316','tau':'\u03C4','Tau':'\u03A4','tbrk':'\u23B4','tcaron':'\u0165','Tcaron':'\u0164','tcedil':'\u0163','Tcedil':'\u0162','tcy':'\u0442','Tcy':'\u0422','tdot':'\u20DB','telrec':'\u2315','tfr':'\uD835\uDD31','Tfr':'\uD835\uDD17','there4':'\u2234','therefore':'\u2234','Therefore':'\u2234','theta':'\u03B8','Theta':'\u0398','thetasym':'\u03D1','thetav':'\u03D1','thickapprox':'\u2248','thicksim':'\u223C','ThickSpace':'\u205F\u200A','thinsp':'\u2009','ThinSpace':'\u2009','thkap':'\u2248','thksim':'\u223C','thorn':'\xFE','THORN':'\xDE','tilde':'\u02DC','Tilde':'\u223C','TildeEqual':'\u2243','TildeFullEqual':'\u2245','TildeTilde':'\u2248','times':'\xD7','timesb':'\u22A0','timesbar':'\u2A31','timesd':'\u2A30','tint':'\u222D','toea':'\u2928','top':'\u22A4','topbot':'\u2336','topcir':'\u2AF1','topf':'\uD835\uDD65','Topf':'\uD835\uDD4B','topfork':'\u2ADA','tosa':'\u2929','tprime':'\u2034','trade':'\u2122','TRADE':'\u2122','triangle':'\u25B5','triangledown':'\u25BF','triangleleft':'\u25C3','trianglelefteq':'\u22B4','triangleq':'\u225C','triangleright':'\u25B9','trianglerighteq':'\u22B5','tridot':'\u25EC','trie':'\u225C','triminus':'\u2A3A','TripleDot':'\u20DB','triplus':'\u2A39','trisb':'\u29CD','tritime':'\u2A3B','trpezium':'\u23E2','tscr':'\uD835\uDCC9','Tscr':'\uD835\uDCAF','tscy':'\u0446','TScy':'\u0426','tshcy':'\u045B','TSHcy':'\u040B','tstrok':'\u0167','Tstrok':'\u0166','twixt':'\u226C','twoheadleftarrow':'\u219E','twoheadrightarrow':'\u21A0','uacute':'\xFA','Uacute':'\xDA','uarr':'\u2191','uArr':'\u21D1','Uarr':'\u219F','Uarrocir':'\u2949','ubrcy':'\u045E','Ubrcy':'\u040E','ubreve':'\u016D','Ubreve':'\u016C','ucirc':'\xFB','Ucirc':'\xDB','ucy':'\u0443','Ucy':'\u0423','udarr':'\u21C5','udblac':'\u0171','Udblac':'\u0170','udhar':'\u296E','ufisht':'\u297E','ufr':'\uD835\uDD32','Ufr':'\uD835\uDD18','ugrave':'\xF9','Ugrave':'\xD9','uHar':'\u2963','uharl':'\u21BF','uharr':'\u21BE','uhblk':'\u2580','ulcorn':'\u231C','ulcorner':'\u231C','ulcrop':'\u230F','ultri':'\u25F8','umacr':'\u016B','Umacr':'\u016A','uml':'\xA8','UnderBar':'_','UnderBrace':'\u23DF','UnderBracket':'\u23B5','UnderParenthesis':'\u23DD','Union':'\u22C3','UnionPlus':'\u228E','uogon':'\u0173','Uogon':'\u0172','uopf':'\uD835\uDD66','Uopf':'\uD835\uDD4C','uparrow':'\u2191','Uparrow':'\u21D1','UpArrow':'\u2191','UpArrowBar':'\u2912','UpArrowDownArrow':'\u21C5','updownarrow':'\u2195','Updownarrow':'\u21D5','UpDownArrow':'\u2195','UpEquilibrium':'\u296E','upharpoonleft':'\u21BF','upharpoonright':'\u21BE','uplus':'\u228E','UpperLeftArrow':'\u2196','UpperRightArrow':'\u2197','upsi':'\u03C5','Upsi':'\u03D2','upsih':'\u03D2','upsilon':'\u03C5','Upsilon':'\u03A5','UpTee':'\u22A5','UpTeeArrow':'\u21A5','upuparrows':'\u21C8','urcorn':'\u231D','urcorner':'\u231D','urcrop':'\u230E','uring':'\u016F','Uring':'\u016E','urtri':'\u25F9','uscr':'\uD835\uDCCA','Uscr':'\uD835\uDCB0','utdot':'\u22F0','utilde':'\u0169','Utilde':'\u0168','utri':'\u25B5','utrif':'\u25B4','uuarr':'\u21C8','uuml':'\xFC','Uuml':'\xDC','uwangle':'\u29A7','vangrt':'\u299C','varepsilon':'\u03F5','varkappa':'\u03F0','varnothing':'\u2205','varphi':'\u03D5','varpi':'\u03D6','varpropto':'\u221D','varr':'\u2195','vArr':'\u21D5','varrho':'\u03F1','varsigma':'\u03C2','varsubsetneq':'\u228A\uFE00','varsubsetneqq':'\u2ACB\uFE00','varsupsetneq':'\u228B\uFE00','varsupsetneqq':'\u2ACC\uFE00','vartheta':'\u03D1','vartriangleleft':'\u22B2','vartriangleright':'\u22B3','vBar':'\u2AE8','Vbar':'\u2AEB','vBarv':'\u2AE9','vcy':'\u0432','Vcy':'\u0412','vdash':'\u22A2','vDash':'\u22A8','Vdash':'\u22A9','VDash':'\u22AB','Vdashl':'\u2AE6','vee':'\u2228','Vee':'\u22C1','veebar':'\u22BB','veeeq':'\u225A','vellip':'\u22EE','verbar':'|','Verbar':'\u2016','vert':'|','Vert':'\u2016','VerticalBar':'\u2223','VerticalLine':'|','VerticalSeparator':'\u2758','VerticalTilde':'\u2240','VeryThinSpace':'\u200A','vfr':'\uD835\uDD33','Vfr':'\uD835\uDD19','vltri':'\u22B2','vnsub':'\u2282\u20D2','vnsup':'\u2283\u20D2','vopf':'\uD835\uDD67','Vopf':'\uD835\uDD4D','vprop':'\u221D','vrtri':'\u22B3','vscr':'\uD835\uDCCB','Vscr':'\uD835\uDCB1','vsubne':'\u228A\uFE00','vsubnE':'\u2ACB\uFE00','vsupne':'\u228B\uFE00','vsupnE':'\u2ACC\uFE00','Vvdash':'\u22AA','vzigzag':'\u299A','wcirc':'\u0175','Wcirc':'\u0174','wedbar':'\u2A5F','wedge':'\u2227','Wedge':'\u22C0','wedgeq':'\u2259','weierp':'\u2118','wfr':'\uD835\uDD34','Wfr':'\uD835\uDD1A','wopf':'\uD835\uDD68','Wopf':'\uD835\uDD4E','wp':'\u2118','wr':'\u2240','wreath':'\u2240','wscr':'\uD835\uDCCC','Wscr':'\uD835\uDCB2','xcap':'\u22C2','xcirc':'\u25EF','xcup':'\u22C3','xdtri':'\u25BD','xfr':'\uD835\uDD35','Xfr':'\uD835\uDD1B','xharr':'\u27F7','xhArr':'\u27FA','xi':'\u03BE','Xi':'\u039E','xlarr':'\u27F5','xlArr':'\u27F8','xmap':'\u27FC','xnis':'\u22FB','xodot':'\u2A00','xopf':'\uD835\uDD69','Xopf':'\uD835\uDD4F','xoplus':'\u2A01','xotime':'\u2A02','xrarr':'\u27F6','xrArr':'\u27F9','xscr':'\uD835\uDCCD','Xscr':'\uD835\uDCB3','xsqcup':'\u2A06','xuplus':'\u2A04','xutri':'\u25B3','xvee':'\u22C1','xwedge':'\u22C0','yacute':'\xFD','Yacute':'\xDD','yacy':'\u044F','YAcy':'\u042F','ycirc':'\u0177','Ycirc':'\u0176','ycy':'\u044B','Ycy':'\u042B','yen':'\xA5','yfr':'\uD835\uDD36','Yfr':'\uD835\uDD1C','yicy':'\u0457','YIcy':'\u0407','yopf':'\uD835\uDD6A','Yopf':'\uD835\uDD50','yscr':'\uD835\uDCCE','Yscr':'\uD835\uDCB4','yucy':'\u044E','YUcy':'\u042E','yuml':'\xFF','Yuml':'\u0178','zacute':'\u017A','Zacute':'\u0179','zcaron':'\u017E','Zcaron':'\u017D','zcy':'\u0437','Zcy':'\u0417','zdot':'\u017C','Zdot':'\u017B','zeetrf':'\u2128','ZeroWidthSpace':'\u200B','zeta':'\u03B6','Zeta':'\u0396','zfr':'\uD835\uDD37','Zfr':'\u2128','zhcy':'\u0436','ZHcy':'\u0416','zigrarr':'\u21DD','zopf':'\uD835\uDD6B','Zopf':'\u2124','zscr':'\uD835\uDCCF','Zscr':'\uD835\uDCB5','zwj':'\u200D','zwnj':'\u200C'}; - var decodeMapLegacy = {'aacute':'\xE1','Aacute':'\xC1','acirc':'\xE2','Acirc':'\xC2','acute':'\xB4','aelig':'\xE6','AElig':'\xC6','agrave':'\xE0','Agrave':'\xC0','amp':'&','AMP':'&','aring':'\xE5','Aring':'\xC5','atilde':'\xE3','Atilde':'\xC3','auml':'\xE4','Auml':'\xC4','brvbar':'\xA6','ccedil':'\xE7','Ccedil':'\xC7','cedil':'\xB8','cent':'\xA2','copy':'\xA9','COPY':'\xA9','curren':'\xA4','deg':'\xB0','divide':'\xF7','eacute':'\xE9','Eacute':'\xC9','ecirc':'\xEA','Ecirc':'\xCA','egrave':'\xE8','Egrave':'\xC8','eth':'\xF0','ETH':'\xD0','euml':'\xEB','Euml':'\xCB','frac12':'\xBD','frac14':'\xBC','frac34':'\xBE','gt':'>','GT':'>','iacute':'\xED','Iacute':'\xCD','icirc':'\xEE','Icirc':'\xCE','iexcl':'\xA1','igrave':'\xEC','Igrave':'\xCC','iquest':'\xBF','iuml':'\xEF','Iuml':'\xCF','laquo':'\xAB','lt':'<','LT':'<','macr':'\xAF','micro':'\xB5','middot':'\xB7','nbsp':'\xA0','not':'\xAC','ntilde':'\xF1','Ntilde':'\xD1','oacute':'\xF3','Oacute':'\xD3','ocirc':'\xF4','Ocirc':'\xD4','ograve':'\xF2','Ograve':'\xD2','ordf':'\xAA','ordm':'\xBA','oslash':'\xF8','Oslash':'\xD8','otilde':'\xF5','Otilde':'\xD5','ouml':'\xF6','Ouml':'\xD6','para':'\xB6','plusmn':'\xB1','pound':'\xA3','quot':'"','QUOT':'"','raquo':'\xBB','reg':'\xAE','REG':'\xAE','sect':'\xA7','shy':'\xAD','sup1':'\xB9','sup2':'\xB2','sup3':'\xB3','szlig':'\xDF','thorn':'\xFE','THORN':'\xDE','times':'\xD7','uacute':'\xFA','Uacute':'\xDA','ucirc':'\xFB','Ucirc':'\xDB','ugrave':'\xF9','Ugrave':'\xD9','uml':'\xA8','uuml':'\xFC','Uuml':'\xDC','yacute':'\xFD','Yacute':'\xDD','yen':'\xA5','yuml':'\xFF'}; - var decodeMapNumeric = {'0':'\uFFFD','128':'\u20AC','130':'\u201A','131':'\u0192','132':'\u201E','133':'\u2026','134':'\u2020','135':'\u2021','136':'\u02C6','137':'\u2030','138':'\u0160','139':'\u2039','140':'\u0152','142':'\u017D','145':'\u2018','146':'\u2019','147':'\u201C','148':'\u201D','149':'\u2022','150':'\u2013','151':'\u2014','152':'\u02DC','153':'\u2122','154':'\u0161','155':'\u203A','156':'\u0153','158':'\u017E','159':'\u0178'}; - var invalidReferenceCodePoints = [1,2,3,4,5,6,7,8,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,64976,64977,64978,64979,64980,64981,64982,64983,64984,64985,64986,64987,64988,64989,64990,64991,64992,64993,64994,64995,64996,64997,64998,64999,65000,65001,65002,65003,65004,65005,65006,65007,65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]; + for (i = 0, l = tokens.length; i < l; i++) { + token = tokens[i]; - /*--------------------------------------------------------------------------*/ + switch (token[0]) { + case Token.AT_RULE: + applySourceMapTo(token, inputSourceMapTracker); + break; + case Token.AT_RULE_BLOCK: + applySourceMapRecursively(token[1], inputSourceMapTracker); + applySourceMapRecursively(token[2], inputSourceMapTracker); + break; + case Token.AT_RULE_BLOCK_SCOPE: + applySourceMapTo(token, inputSourceMapTracker); + break; + case Token.NESTED_BLOCK: + applySourceMapRecursively(token[1], inputSourceMapTracker); + applySourceMapRecursively(token[2], inputSourceMapTracker); + break; + case Token.NESTED_BLOCK_SCOPE: + applySourceMapTo(token, inputSourceMapTracker); + break; + case Token.COMMENT: + applySourceMapTo(token, inputSourceMapTracker); + break; + case Token.PROPERTY: + applySourceMapRecursively(token, inputSourceMapTracker); + break; + case Token.PROPERTY_BLOCK: + applySourceMapRecursively(token[1], inputSourceMapTracker); + break; + case Token.PROPERTY_NAME: + applySourceMapTo(token, inputSourceMapTracker); + break; + case Token.PROPERTY_VALUE: + applySourceMapTo(token, inputSourceMapTracker); + break; + case Token.RULE: + applySourceMapRecursively(token[1], inputSourceMapTracker); + applySourceMapRecursively(token[2], inputSourceMapTracker); + break; + case Token.RULE_SCOPE: + applySourceMapTo(token, inputSourceMapTracker); + } + } - var stringFromCharCode = String.fromCharCode; + return tokens; +} - var object = {}; - var hasOwnProperty = object.hasOwnProperty; - var has = function(object, propertyName) { - return hasOwnProperty.call(object, propertyName); - }; +function applySourceMapTo(token, inputSourceMapTracker) { + var value = token[1]; + var metadata = token[2]; + var newMetadata = []; + var i, l; - var contains = function(array, value) { - var index = -1; - var length = array.length; - while (++index < length) { - if (array[index] == value) { - return true; - } - } - return false; - }; + for (i = 0, l = metadata.length; i < l; i++) { + newMetadata.push(inputSourceMapTracker.originalPositionFor(metadata[i], value.length)); + } - var merge = function(options, defaults) { - if (!options) { - return defaults; - } - var result = {}; - var key; - for (key in defaults) { - // A `hasOwnProperty` check is not needed here, since only recognized - // option names are used anyway. Any others are ignored. - result[key] = has(options, key) ? options[key] : defaults[key]; - } - return result; - }; + token[2] = newMetadata; +} - // Modified version of `ucs2encode`; see https://mths.be/punycode. - var codePointToSymbol = function(codePoint, strict) { - var output = ''; - if ((codePoint >= 0xD800 && codePoint <= 0xDFFF) || codePoint > 0x10FFFF) { - // See issue #4: - // “Otherwise, if the number is in the range 0xD800 to 0xDFFF or is - // greater than 0x10FFFF, then this is a parse error. Return a U+FFFD - // REPLACEMENT CHARACTER.” - if (strict) { - parseError('character reference outside the permissible Unicode range'); - } - return '\uFFFD'; - } - if (has(decodeMapNumeric, codePoint)) { - if (strict) { - parseError('disallowed character reference'); - } - return decodeMapNumeric[codePoint]; - } - if (strict && contains(invalidReferenceCodePoints, codePoint)) { - parseError('disallowed character reference'); - } - if (codePoint > 0xFFFF) { - codePoint -= 0x10000; - output += stringFromCharCode(codePoint >>> 10 & 0x3FF | 0xD800); - codePoint = 0xDC00 | codePoint & 0x3FF; - } - output += stringFromCharCode(codePoint); - return output; - }; +module.exports = applySourceMaps; - var hexEscape = function(codePoint) { - return '&#x' + codePoint.toString(16).toUpperCase() + ';'; - }; +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) +},{"../tokenizer/token":82,"../utils/has-protocol":86,"../utils/is-data-uri-resource":88,"../utils/is-remote-resource":92,"./is-allowed-resource":70,"./load-remote-resource":72,"./match-data-uri":73,"./rebase-local-map":76,"./rebase-remote-map":77,"buffer":5,"fs":3,"path":110}],68:[function(require,module,exports){ +var split = require('../utils/split'); - var decEscape = function(codePoint) { - return '&#' + codePoint + ';'; - }; +var BRACE_PREFIX = /^\(/; +var BRACE_SUFFIX = /\)$/; +var IMPORT_PREFIX_PATTERN = /^@import/i; +var QUOTE_PREFIX_PATTERN = /['"]\s*/; +var QUOTE_SUFFIX_PATTERN = /\s*['"]/; +var URL_PREFIX_PATTERN = /^url\(\s*/i; +var URL_SUFFIX_PATTERN = /\s*\)/i; - var parseError = function(message) { - throw Error('Parse error: ' + message); - }; +function extractImportUrlAndMedia(atRuleValue) { + var uri; + var mediaQuery; + var stripped; + var parts; - /*--------------------------------------------------------------------------*/ + stripped = atRuleValue + .replace(IMPORT_PREFIX_PATTERN, '') + .trim() + .replace(URL_PREFIX_PATTERN, '(') + .replace(URL_SUFFIX_PATTERN, ')') + .replace(QUOTE_PREFIX_PATTERN, '') + .replace(QUOTE_SUFFIX_PATTERN, ''); - var encode = function(string, options) { - options = merge(options, encode.options); - var strict = options.strict; - if (strict && regexInvalidRawCodePoint.test(string)) { - parseError('forbidden code point'); - } - var encodeEverything = options.encodeEverything; - var useNamedReferences = options.useNamedReferences; - var allowUnsafeSymbols = options.allowUnsafeSymbols; - var escapeCodePoint = options.decimal ? decEscape : hexEscape; + parts = split(stripped, ' '); - var escapeBmpSymbol = function(symbol) { - return escapeCodePoint(symbol.charCodeAt(0)); - }; + uri = parts[0] + .replace(BRACE_PREFIX, '') + .replace(BRACE_SUFFIX, ''); + mediaQuery = parts.slice(1).join(' '); - if (encodeEverything) { - // Encode ASCII symbols. - string = string.replace(regexAsciiWhitelist, function(symbol) { - // Use named references if requested & possible. - if (useNamedReferences && has(encodeMap, symbol)) { - return '&' + encodeMap[symbol] + ';'; - } - return escapeBmpSymbol(symbol); - }); - // Shorten a few escapes that represent two symbols, of which at least one - // is within the ASCII range. - if (useNamedReferences) { - string = string - .replace(/>\u20D2/g, '>⃒') - .replace(/<\u20D2/g, '<⃒') - .replace(/fj/g, 'fj'); - } - // Encode non-ASCII symbols. - if (useNamedReferences) { - // Encode non-ASCII symbols that can be replaced with a named reference. - string = string.replace(regexEncodeNonAscii, function(string) { - // Note: there is no need to check `has(encodeMap, string)` here. - return '&' + encodeMap[string] + ';'; - }); - } - // Note: any remaining non-ASCII symbols are handled outside of the `if`. - } else if (useNamedReferences) { - // Apply named character references. - // Encode `<>"'&` using named character references. - if (!allowUnsafeSymbols) { - string = string.replace(regexEscape, function(string) { - return '&' + encodeMap[string] + ';'; // no need to check `has()` here - }); - } - // Shorten escapes that represent two symbols, of which at least one is - // `<>"'&`. - string = string - .replace(/>\u20D2/g, '>⃒') - .replace(/<\u20D2/g, '<⃒'); - // Encode non-ASCII symbols that can be replaced with a named reference. - string = string.replace(regexEncodeNonAscii, function(string) { - // Note: there is no need to check `has(encodeMap, string)` here. - return '&' + encodeMap[string] + ';'; - }); - } else if (!allowUnsafeSymbols) { - // Encode `<>"'&` using hexadecimal escapes, now that they’re not handled - // using named character references. - string = string.replace(regexEscape, escapeBmpSymbol); - } - return string - // Encode astral symbols. - .replace(regexAstralSymbols, function($0) { - // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - var high = $0.charCodeAt(0); - var low = $0.charCodeAt(1); - var codePoint = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000; - return escapeCodePoint(codePoint); - }) - // Encode any remaining BMP symbols that are not printable ASCII symbols - // using a hexadecimal escape. - .replace(regexBmpWhitelist, escapeBmpSymbol); - }; - // Expose default options (so they can be overridden globally). - encode.options = { - 'allowUnsafeSymbols': false, - 'encodeEverything': false, - 'strict': false, - 'useNamedReferences': false, - 'decimal' : false - }; + return [uri, mediaQuery]; +} - var decode = function(html, options) { - options = merge(options, decode.options); - var strict = options.strict; - if (strict && regexInvalidEntity.test(html)) { - parseError('malformed character reference'); - } - return html.replace(regexDecode, function($0, $1, $2, $3, $4, $5, $6, $7) { - var codePoint; - var semicolon; - var decDigits; - var hexDigits; - var reference; - var next; - if ($1) { - // Decode decimal escapes, e.g. `𝌆`. - decDigits = $1; - semicolon = $2; - if (strict && !semicolon) { - parseError('character reference was not terminated by a semicolon'); - } - codePoint = parseInt(decDigits, 10); - return codePointToSymbol(codePoint, strict); - } - if ($3) { - // Decode hexadecimal escapes, e.g. `𝌆`. - hexDigits = $3; - semicolon = $4; - if (strict && !semicolon) { - parseError('character reference was not terminated by a semicolon'); - } - codePoint = parseInt(hexDigits, 16); - return codePointToSymbol(codePoint, strict); - } - if ($5) { - // Decode named character references with trailing `;`, e.g. `©`. - reference = $5; - if (has(decodeMap, reference)) { - return decodeMap[reference]; - } else { - // Ambiguous ampersand. https://mths.be/notes/ambiguous-ampersands - if (strict) { - parseError( - 'named character reference was not terminated by a semicolon' - ); - } - return $0; - } - } - // If we’re still here, it’s a legacy reference for sure. No need for an - // extra `if` check. - // Decode named character references without trailing `;`, e.g. `&` - // This is only a parse error if it gets converted to `&`, or if it is - // followed by `=` in an attribute context. - reference = $6; - next = $7; - if (next && options.isAttributeValue) { - if (strict && next == '=') { - parseError('`&` did not start a character reference'); - } - return $0; - } else { - if (strict) { - parseError( - 'named character reference was not terminated by a semicolon' - ); - } - // Note: there is no need to check `has(decodeMapLegacy, reference)`. - return decodeMapLegacy[reference] + (next || ''); - } - }); - }; - // Expose default options (so they can be overridden globally). - decode.options = { - 'isAttributeValue': false, - 'strict': false - }; +module.exports = extractImportUrlAndMedia; - var escape = function(string) { - return string.replace(regexEscape, function($0) { - // Note: there is no need to check `has(escapeMap, $0)` here. - return escapeMap[$0]; - }); - }; +},{"../utils/split":95}],69:[function(require,module,exports){ +var SourceMapConsumer = require('source-map').SourceMapConsumer; - /*--------------------------------------------------------------------------*/ +function inputSourceMapTracker() { + var maps = {}; - var he = { - 'version': '1.1.0', - 'encode': encode, - 'decode': decode, - 'escape': escape, - 'unescape': decode - }; + return { + all: all.bind(null, maps), + isTracking: isTracking.bind(null, maps), + originalPositionFor: originalPositionFor.bind(null, maps), + track: track.bind(null, maps) + }; +} - // Some AMD build optimizers, like r.js, check for specific condition patterns - // like the following: - if ( - typeof define == 'function' && - typeof define.amd == 'object' && - define.amd - ) { - define(function() { - return he; - }); - } else if (freeExports && !freeExports.nodeType) { - if (freeModule) { // in Node.js, io.js, or RingoJS v0.8.0+ - freeModule.exports = he; - } else { // in Narwhal or RingoJS v0.7.0- - for (var key in he) { - has(he, key) && (freeExports[key] = he[key]); - } - } - } else { // in Rhino or a web browser - root.he = he; - } +function all(maps) { + return maps; +} -}(this)); +function isTracking(maps, source) { + return source in maps; +} -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],72:[function(require,module,exports){ -var http = require('http'); +function originalPositionFor(maps, metadata, range, selectorFallbacks) { + var line = metadata[0]; + var column = metadata[1]; + var source = metadata[2]; + var position = { + line: line, + column: column + range + }; + var originalPosition; -var https = module.exports; + while (!originalPosition && position.column > column) { + position.column--; + originalPosition = maps[source].originalPositionFor(position); + } + + if (originalPosition.line === null && line > 1 && selectorFallbacks > 0) { + return originalPositionFor(maps, [line - 1, column, source], range, selectorFallbacks - 1); + } + + return originalPosition.line !== null ? + toMetadata(originalPosition) : + metadata; +} -for (var key in http) { - if (http.hasOwnProperty(key)) https[key] = http[key]; -}; +function toMetadata(asHash) { + return [asHash.line, asHash.column, asHash.source]; +} -https.request = function (params, cb) { - if (!params) params = {}; - params.scheme = 'https'; - params.protocol = 'https:'; - return http.request.call(this, params, cb); +function track(maps, source, data) { + maps[source] = new SourceMapConsumer(data); } -},{"http":121}],73:[function(require,module,exports){ -exports.read = function (buffer, offset, isLE, mLen, nBytes) { - var e, m - var eLen = nBytes * 8 - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var nBits = -7 - var i = isLE ? (nBytes - 1) : 0 - var d = isLE ? -1 : 1 - var s = buffer[offset + i] +module.exports = inputSourceMapTracker; - i += d +},{"source-map":151}],70:[function(require,module,exports){ +var path = require('path'); +var url = require('url'); - e = s & ((1 << (-nBits)) - 1) - s >>= (-nBits) - nBits += eLen - for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} +var isRemoteResource = require('../utils/is-remote-resource'); +var hasProtocol = require('../utils/has-protocol'); - m = e & ((1 << (-nBits)) - 1) - e >>= (-nBits) - nBits += mLen - for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} +var HTTP_PROTOCOL = 'http:'; - if (e === 0) { - e = 1 - eBias - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity) - } else { - m = m + Math.pow(2, mLen) - e = e - eBias +function isAllowedResource(uri, isRemote, rules) { + var match; + var absoluteUri; + var allowed = true; + var rule; + var isNegated; + var normalizedRule; + var i; + + if (rules.length === 0) { + return false; } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen) -} -exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c - var eLen = nBytes * 8 - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) - var i = isLE ? 0 : (nBytes - 1) - var d = isLE ? 1 : -1 - var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 + if (isRemote && !hasProtocol(uri)) { + uri = HTTP_PROTOCOL + uri; + } - value = Math.abs(value) + match = isRemote ? + url.parse(uri).host : + uri; - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0 - e = eMax - } else { - e = Math.floor(Math.log(value) / Math.LN2) - if (value * (c = Math.pow(2, -e)) < 1) { - e-- - c *= 2 - } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) - } - if (value * c >= 2) { - e++ - c /= 2 - } + absoluteUri = isRemote ? + uri : + path.resolve(uri); - if (e + eBias >= eMax) { - m = 0 - e = eMax - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen) - e = e + eBias + for (i = 0; i < rules.length; i++) { + rule = rules[i]; + isNegated = rule[0] == '!'; + normalizedRule = rule.substring(1); + + if (isNegated && isRemote && isRemoteRule(normalizedRule)) { + allowed = allowed && !isAllowedResource(uri, true, [normalizedRule]); + } else if (isNegated && !isRemote && !isRemoteRule(normalizedRule)) { + allowed = allowed && !isAllowedResource(uri, false, [normalizedRule]); + } else if (isNegated) { + allowed = allowed && true; + } else if (rule == 'all') { + allowed = true; + } else if (isRemote && rule == 'local') { + allowed = false; + } else if (isRemote && rule == 'remote') { + allowed = true; + } else if (!isRemote && rule == 'remote') { + allowed = false; + } else if (!isRemote && rule == 'local') { + allowed = true; + } else if (rule === match) { + allowed = true; + } else if (rule === uri) { + allowed = true; + } else if (isRemote && absoluteUri.indexOf(rule) === 0) { + allowed = true; + } else if (!isRemote && absoluteUri.indexOf(path.resolve(rule)) === 0) { + allowed = true; + } else if (isRemote != isRemoteRule(normalizedRule)) { + allowed = allowed && true; } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) - e = 0 + allowed = false; } } - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} - - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + return allowed; +} - buffer[offset + i - d] |= s * 128 +function isRemoteRule(rule) { + return isRemoteResource(rule) || url.parse(HTTP_PROTOCOL + '//' + rule).host == rule; } -},{}],74:[function(require,module,exports){ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); +module.exports = isAllowedResource; + +},{"../utils/has-protocol":86,"../utils/is-remote-resource":92,"path":110,"url":159}],71:[function(require,module,exports){ +var fs = require('fs'); +var path = require('path'); + +var isAllowedResource = require('./is-allowed-resource'); +var loadRemoteResource = require('./load-remote-resource'); + +var hasProtocol = require('../utils/has-protocol'); +var isRemoteResource = require('../utils/is-remote-resource'); + +function loadOriginalSources(context, callback) { + var loadContext = { + callback: callback, + index: 0, + inline: context.options.inline, + inlineRequest: context.options.inlineRequest, + inlineTimeout: context.options.inlineTimeout, + localOnly: context.localOnly, + rebaseTo: context.options.rebaseTo, + sourcesContent: context.sourcesContent, + uriToSource: uriToSourceMapping(context.inputSourceMapTracker.all()), + warnings: context.warnings }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } + + return doLoadOriginalSources(loadContext); } -},{}],75:[function(require,module,exports){ -/*! - * Determine if an object is a Buffer - * - * @author Feross Aboukhadijeh - * @license MIT - */ +function uriToSourceMapping(allSourceMapConsumers) { + var mapping = {}; + var consumer; + var uri; + var source; + var i, l; -// The _isBuffer check is for Safari 5-7 support, because it's missing -// Object.prototype.constructor. Remove this eventually -module.exports = function (obj) { - return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) -} + for (source in allSourceMapConsumers) { + consumer = allSourceMapConsumers[source]; -function isBuffer (obj) { - return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) -} + for (i = 0, l = consumer.sources.length; i < l; i++) { + uri = consumer.sources[i]; + source = consumer.sourceContentFor(uri, true); -// For Node v0.10 support. Remove this eventually. -function isSlowBuffer (obj) { - return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) + mapping[uri] = source; + } + } + + return mapping; } -},{}],76:[function(require,module,exports){ -var toString = {}.toString; +function doLoadOriginalSources(loadContext) { + var uris = Object.keys(loadContext.uriToSource); + var uri; + var source; + var total; -module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; -}; + for (total = uris.length; loadContext.index < total; loadContext.index++) { + uri = uris[loadContext.index]; + source = loadContext.uriToSource[uri]; -},{}],77:[function(require,module,exports){ -'use strict'; -var xmlChars = require('xml-char-classes'); + if (source) { + loadContext.sourcesContent[uri] = source; + } else { + return loadOriginalSource(uri, loadContext); + } + } -function getRange(re) { - return re.source.slice(1, -1); + return loadContext.callback(); } -// http://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName -module.exports = new RegExp('^[' + getRange(xmlChars.letter) + '_][' + getRange(xmlChars.letter) + getRange(xmlChars.digit) + '\\.\\-_' + getRange(xmlChars.combiningChar) + getRange(xmlChars.extender) + ']*$'); +function loadOriginalSource(uri, loadContext) { + var content; -},{"xml-char-classes":145}],78:[function(require,module,exports){ -exports.endianness = function () { return 'LE' }; + if (isRemoteResource(uri)) { + return loadOriginalSourceFromRemoteUri(uri, loadContext, function (content) { + loadContext.index++; + loadContext.sourcesContent[uri] = content; + return doLoadOriginalSources(loadContext); + }); + } else { + content = loadOriginalSourceFromLocalUri(uri, loadContext); + loadContext.index++; + loadContext.sourcesContent[uri] = content; + return doLoadOriginalSources(loadContext); + } +} -exports.hostname = function () { - if (typeof location !== 'undefined') { - return location.hostname +function loadOriginalSourceFromRemoteUri(uri, loadContext, whenLoaded) { + var isAllowed = isAllowedResource(uri, true, loadContext.inline); + var isRuntimeResource = !hasProtocol(uri); + + if (loadContext.localOnly) { + loadContext.warnings.push('Cannot fetch remote resource from "' + uri + '" as no callback given.'); + return whenLoaded(null); + } else if (isRuntimeResource) { + loadContext.warnings.push('Cannot fetch "' + uri + '" as no protocol given.'); + return whenLoaded(null); + } else if (!isAllowed) { + loadContext.warnings.push('Cannot fetch "' + uri + '" as resource is not allowed.'); + return whenLoaded(null); + } + + loadRemoteResource(uri, loadContext.inlineRequest, loadContext.inlineTimeout, function (error, content) { + if (error) { + loadContext.warnings.push('Missing original source at "' + uri + '" - ' + error); } - else return ''; -}; -exports.loadavg = function () { return [] }; + whenLoaded(content); + }); +} -exports.uptime = function () { return 0 }; +function loadOriginalSourceFromLocalUri(relativeUri, loadContext) { + var isAllowed = isAllowedResource(relativeUri, false, loadContext.inline); + var absoluteUri = path.resolve(loadContext.rebaseTo, relativeUri); -exports.freemem = function () { - return Number.MAX_VALUE; -}; + if (!fs.existsSync(absoluteUri) || !fs.statSync(absoluteUri).isFile()) { + loadContext.warnings.push('Ignoring local source map at "' + absoluteUri + '" as resource is missing.'); + return null; + } else if (!isAllowed) { + loadContext.warnings.push('Cannot fetch "' + absoluteUri + '" as resource is not allowed.'); + return null; + } -exports.totalmem = function () { - return Number.MAX_VALUE; -}; + return fs.readFileSync(absoluteUri, 'utf8'); +} -exports.cpus = function () { return [] }; +module.exports = loadOriginalSources; -exports.type = function () { return 'Browser' }; +},{"../utils/has-protocol":86,"../utils/is-remote-resource":92,"./is-allowed-resource":70,"./load-remote-resource":72,"fs":3,"path":110}],72:[function(require,module,exports){ +var http = require('http'); +var https = require('https'); +var url = require('url'); -exports.release = function () { - if (typeof navigator !== 'undefined') { - return navigator.appVersion; - } - return ''; -}; +var isHttpResource = require('../utils/is-http-resource'); +var isHttpsResource = require('../utils/is-https-resource'); +var override = require('../utils/override'); -exports.networkInterfaces -= exports.getNetworkInterfaces -= function () { return {} }; +var HTTP_PROTOCOL = 'http:'; -exports.arch = function () { return 'javascript' }; +function loadRemoteResource(uri, inlineRequest, inlineTimeout, callback) { + var proxyProtocol = inlineRequest.protocol || inlineRequest.hostname; + var errorHandled = false; + var requestOptions; + var fetch; -exports.platform = function () { return 'browser' }; + requestOptions = override( + url.parse(uri), + inlineRequest || {} + ); -exports.tmpdir = exports.tmpDir = function () { - return '/tmp'; -}; + if (inlineRequest.hostname !== undefined) { + // overwrite as we always expect a http proxy currently + requestOptions.protocol = inlineRequest.protocol || HTTP_PROTOCOL; + requestOptions.path = requestOptions.href; + } -exports.EOL = '\n'; + fetch = (proxyProtocol && !isHttpsResource(proxyProtocol)) || isHttpResource(uri) ? + http.get : + https.get; -},{}],79:[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. + fetch(requestOptions, function (res) { + var chunks = []; + var movedUri; -// 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 (res.statusCode < 200 || res.statusCode > 399) { + return callback(res.statusCode, null); + } else if (res.statusCode > 299) { + movedUri = url.resolve(uri, res.headers.location); + return loadRemoteResource(movedUri, inlineRequest, inlineTimeout, callback); + } + + res.on('data', function (chunk) { + chunks.push(chunk.toString()); + }); + res.on('end', function () { + var body = chunks.join(''); + callback(null, body); + }); + }) + .on('error', function (res) { + if (errorHandled) { + return; } - } - // if the path is allowed to go above the root, restore leading ..s - if (allowAboveRoot) { - for (; up--; up) { - parts.unshift('..'); + errorHandled = true; + callback(res.message, null); + }) + .on('timeout', function () { + if (errorHandled) { + return; } - } - return parts; + errorHandled = true; + callback('timeout', null); + }) + .setTimeout(inlineTimeout); } -// 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); -}; +module.exports = loadRemoteResource; -// path.resolve([from ...], to) -// posix version -exports.resolve = function() { - var resolvedPath = '', - resolvedAbsolute = false; +},{"../utils/is-http-resource":89,"../utils/is-https-resource":90,"../utils/override":94,"http":152,"https":103,"url":159}],73:[function(require,module,exports){ +var DATA_URI_PATTERN = /^data:(\S*?)?(;charset=[^;]+)?(;[^,]+?)?,(.+)/; - for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { - var path = (i >= 0) ? arguments[i] : process.cwd(); +function matchDataUri(uri) { + return DATA_URI_PATTERN.exec(uri); +} - // Skip empty and invalid entries - if (typeof path !== 'string') { - throw new TypeError('Arguments to path.resolve must be strings'); - } else if (!path) { - continue; - } +module.exports = matchDataUri; - resolvedPath = path + '/' + resolvedPath; - resolvedAbsolute = path.charAt(0) === '/'; +},{}],74:[function(require,module,exports){ +var UNIX_SEPARATOR = '/'; +var WINDOWS_SEPARATOR_PATTERN = /\\/g; + +function normalizePath(path) { + return path.replace(WINDOWS_SEPARATOR_PATTERN, UNIX_SEPARATOR); +} + +module.exports = normalizePath; + +},{}],75:[function(require,module,exports){ +(function (Buffer,process){ +var fs = require('fs'); +var path = require('path'); + +var applySourceMaps = require('./apply-source-maps'); +var extractImportUrlAndMedia = require('./extract-import-url-and-media'); +var isAllowedResource = require('./is-allowed-resource'); +var loadOriginalSources = require('./load-original-sources'); +var loadRemoteResource = require('./load-remote-resource'); +var normalizePath = require('./normalize-path'); +var rebase = require('./rebase'); +var rebaseLocalMap = require('./rebase-local-map'); +var rebaseRemoteMap = require('./rebase-remote-map'); +var restoreImport = require('./restore-import'); + +var tokenize = require('../tokenizer/tokenize'); +var Token = require('../tokenizer/token'); +var Marker = require('../tokenizer/marker'); +var hasProtocol = require('../utils/has-protocol'); +var isAbsoluteResource = require('../utils/is-absolute-resource'); +var isImport = require('../utils/is-import'); +var isRemoteResource = require('../utils/is-remote-resource'); + +var UNKNOWN_URI = 'uri:unknown'; + +function readSources(input, context, callback) { + return doReadSources(input, context, function (tokens) { + return applySourceMaps(tokens, context, function () { + return context.options.sourceMapInlineSources ? + loadOriginalSources(context, function () { return callback(tokens); }) : + callback(tokens); + }); + }); +} + +function doReadSources(input, context, callback) { + if (typeof input == 'string') { + return fromString(input, context, callback); + } else if (Buffer.isBuffer(input)) { + return fromString(input.toString(), context, callback); + } else if (Array.isArray(input)) { + return fromArray(input, context, callback); + } else if (typeof input == 'object') { + return fromHash(input, context, callback); } +} - // 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) +function fromString(input, context, callback) { + context.source = undefined; + context.sourcesContent[undefined] = input; + context.stats.originalSize += input.length; - // Normalize the path - resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { - return !!p; - }), !resolvedAbsolute).join('/'); + return fromStyles(input, context, { inline: context.options.inline }, callback); +} - return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; -}; +function fromArray(input, context, callback) { + var inputAsImports = input.reduce(function (accumulator, uri) { + var normalizedUri = isRemoteResource(uri) ? uri : normalizePath(uri); -// path.normalize(path) -// posix version -exports.normalize = function(path) { - var isAbsolute = exports.isAbsolute(path), - trailingSlash = substr(path, -1) === '/'; + accumulator.push(restoreAsRelativeImport(normalizedUri)); + return accumulator; + }, []); - // Normalize the path - path = normalizeArray(filter(path.split('/'), function(p) { - return !!p; - }), !isAbsolute).join('/'); + return fromStyles(inputAsImports.join(''), context, { inline: ['all'] }, callback); +} - if (!path && !isAbsolute) { - path = '.'; - } - if (path && trailingSlash) { - path += '/'; - } +function fromHash(input, context, callback) { + var uri; + var normalizedUri; + var source; + var inputAsImports = []; - return (isAbsolute ? '/' : '') + path; -}; + for (uri in input) { + source = input[uri]; + normalizedUri = isRemoteResource(uri) ? uri : normalizePath(uri); -// posix version -exports.isAbsolute = function(path) { - return path.charAt(0) === '/'; -}; + inputAsImports.push(restoreAsRelativeImport(normalizedUri)); -// 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'); + context.sourcesContent[normalizedUri] = source.styles; + + if (source.sourceMap) { + trackSourceMap(source.sourceMap, normalizedUri, context); } - return p; - }).join('/')); -}; + } + return fromStyles(inputAsImports.join(''), context, { inline: ['all'] }, callback); +} -// path.relative(from, to) -// posix version -exports.relative = function(from, to) { - from = exports.resolve(from).substr(1); - to = exports.resolve(to).substr(1); +function trackSourceMap(sourceMap, uri, context) { + var parsedMap = typeof sourceMap == 'string' ? + JSON.parse(sourceMap) : + sourceMap; + var rebasedMap = isRemoteResource(uri) ? + rebaseRemoteMap(parsedMap, uri) : + rebaseLocalMap(parsedMap, uri || UNKNOWN_URI, context.options.rebaseTo); - function trim(arr) { - var start = 0; - for (; start < arr.length; start++) { - if (arr[start] !== '') break; - } + context.inputSourceMapTracker.track(uri, rebasedMap); +} - var end = arr.length - 1; - for (; end >= 0; end--) { - if (arr[end] !== '') break; - } +function restoreAsRelativeImport(uri) { + var currentPath = path.resolve(''); + var absoluteUri; + var relativeToCurrentPath; - if (start > end) return []; - return arr.slice(start, end - start + 1); + if (isRemoteResource(uri)) { + return restoreImport(uri, '') + Marker.SEMICOLON; + } else { + absoluteUri = isAbsoluteResource(uri) ? + uri : + path.resolve(uri); + relativeToCurrentPath = path.relative(currentPath, absoluteUri); + + return restoreImport(relativeToCurrentPath, '') + Marker.SEMICOLON; } +} - var fromParts = trim(from.split('/')); - var toParts = trim(to.split('/')); +function fromStyles(styles, context, parentInlinerContext, callback) { + var tokens; + var rebaseConfig = {}; - 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; + if (!context.source) { + rebaseConfig.fromBase = path.resolve(''); + rebaseConfig.toBase = context.options.rebaseTo; + } else if (isRemoteResource(context.source)) { + rebaseConfig.fromBase = context.source; + rebaseConfig.toBase = context.source; + } else if (isAbsoluteResource(context.source)) { + rebaseConfig.fromBase = path.dirname(context.source); + rebaseConfig.toBase = context.options.rebaseTo; + } else { + rebaseConfig.fromBase = path.dirname(path.resolve(context.source)); + rebaseConfig.toBase = context.options.rebaseTo; + } + + tokens = tokenize(styles, context); + tokens = rebase(tokens, context.options.rebase, context.validator, rebaseConfig); + + return allowsAnyImports(parentInlinerContext.inline) ? + inline(tokens, context, parentInlinerContext, callback) : + callback(tokens); +} + +function allowsAnyImports(inline) { + return !(inline.length == 1 && inline[0] == 'none'); +} + +function inline(tokens, externalContext, parentInlinerContext, callback) { + var inlinerContext = { + afterContent: false, + callback: callback, + errors: externalContext.errors, + externalContext: externalContext, + inlinedStylesheets: parentInlinerContext.inlinedStylesheets || externalContext.inlinedStylesheets, + inline: parentInlinerContext.inline, + inlineRequest: externalContext.options.inlineRequest, + inlineTimeout: externalContext.options.inlineTimeout, + isRemote: parentInlinerContext.isRemote || false, + localOnly: externalContext.localOnly, + outputTokens: [], + rebaseTo: externalContext.options.rebaseTo, + sourceTokens: tokens, + warnings: externalContext.warnings + }; + + return doInlineImports(inlinerContext); +} + +function doInlineImports(inlinerContext) { + var token; + var i, l; + + for (i = 0, l = inlinerContext.sourceTokens.length; i < l; i++) { + token = inlinerContext.sourceTokens[i]; + + if (token[0] == Token.AT_RULE && isImport(token[1])) { + inlinerContext.sourceTokens.splice(0, i); + return inlineStylesheet(token, inlinerContext); + } else if (token[0] == Token.AT_RULE || token[0] == Token.COMMENT) { + inlinerContext.outputTokens.push(token); + } else { + inlinerContext.outputTokens.push(token); + inlinerContext.afterContent = true; + } + } + + inlinerContext.sourceTokens = []; + return inlinerContext.callback(inlinerContext.outputTokens); +} + +function inlineStylesheet(token, inlinerContext) { + var uriAndMediaQuery = extractImportUrlAndMedia(token[1]); + var uri = uriAndMediaQuery[0]; + var mediaQuery = uriAndMediaQuery[1]; + var metadata = token[2]; + + return isRemoteResource(uri) ? + inlineRemoteStylesheet(uri, mediaQuery, metadata, inlinerContext) : + inlineLocalStylesheet(uri, mediaQuery, metadata, inlinerContext); +} + +function inlineRemoteStylesheet(uri, mediaQuery, metadata, inlinerContext) { + var isAllowed = isAllowedResource(uri, true, inlinerContext.inline); + var originalUri = uri; + var isLoaded = uri in inlinerContext.externalContext.sourcesContent; + var isRuntimeResource = !hasProtocol(uri); + + if (inlinerContext.inlinedStylesheets.indexOf(uri) > -1) { + inlinerContext.warnings.push('Ignoring remote @import of "' + uri + '" as it has already been imported.'); + inlinerContext.sourceTokens = inlinerContext.sourceTokens.slice(1); + return doInlineImports(inlinerContext); + } else if (inlinerContext.localOnly && inlinerContext.afterContent) { + inlinerContext.warnings.push('Ignoring remote @import of "' + uri + '" as no callback given and after other content.'); + inlinerContext.sourceTokens = inlinerContext.sourceTokens.slice(1); + return doInlineImports(inlinerContext); + } else if (isRuntimeResource) { + inlinerContext.warnings.push('Skipping remote @import of "' + uri + '" as no protocol given.'); + inlinerContext.outputTokens = inlinerContext.outputTokens.concat(inlinerContext.sourceTokens.slice(0, 1)); + inlinerContext.sourceTokens = inlinerContext.sourceTokens.slice(1); + return doInlineImports(inlinerContext); + } else if (inlinerContext.localOnly && !isLoaded) { + inlinerContext.warnings.push('Skipping remote @import of "' + uri + '" as no callback given.'); + inlinerContext.outputTokens = inlinerContext.outputTokens.concat(inlinerContext.sourceTokens.slice(0, 1)); + inlinerContext.sourceTokens = inlinerContext.sourceTokens.slice(1); + return doInlineImports(inlinerContext); + } else if (!isAllowed && inlinerContext.afterContent) { + inlinerContext.warnings.push('Ignoring remote @import of "' + uri + '" as resource is not allowed and after other content.'); + inlinerContext.sourceTokens = inlinerContext.sourceTokens.slice(1); + return doInlineImports(inlinerContext); + } else if (!isAllowed) { + inlinerContext.warnings.push('Skipping remote @import of "' + uri + '" as resource is not allowed.'); + inlinerContext.outputTokens = inlinerContext.outputTokens.concat(inlinerContext.sourceTokens.slice(0, 1)); + inlinerContext.sourceTokens = inlinerContext.sourceTokens.slice(1); + return doInlineImports(inlinerContext); + } + + inlinerContext.inlinedStylesheets.push(uri); + + function whenLoaded(error, importedStyles) { + if (error) { + inlinerContext.errors.push('Broken @import declaration of "' + uri + '" - ' + error); + + return process.nextTick(function () { + inlinerContext.outputTokens = inlinerContext.outputTokens.concat(inlinerContext.sourceTokens.slice(0, 1)); + inlinerContext.sourceTokens = inlinerContext.sourceTokens.slice(1); + doInlineImports(inlinerContext); + }); } - } - var outputParts = []; - for (var i = samePartsLength; i < fromParts.length; i++) { - outputParts.push('..'); + inlinerContext.inline = inlinerContext.externalContext.options.inline; + inlinerContext.isRemote = true; + + inlinerContext.externalContext.source = originalUri; + inlinerContext.externalContext.sourcesContent[uri] = importedStyles; + inlinerContext.externalContext.stats.originalSize += importedStyles.length; + + return fromStyles(importedStyles, inlinerContext.externalContext, inlinerContext, function (importedTokens) { + importedTokens = wrapInMedia(importedTokens, mediaQuery, metadata); + + inlinerContext.outputTokens = inlinerContext.outputTokens.concat(importedTokens); + inlinerContext.sourceTokens = inlinerContext.sourceTokens.slice(1); + + return doInlineImports(inlinerContext); + }); } - outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return isLoaded ? + whenLoaded(null, inlinerContext.externalContext.sourcesContent[uri]) : + loadRemoteResource(uri, inlinerContext.inlineRequest, inlinerContext.inlineTimeout, whenLoaded); +} + +function inlineLocalStylesheet(uri, mediaQuery, metadata, inlinerContext) { + var currentPath = path.resolve(''); + var absoluteUri = isAbsoluteResource(uri) ? + path.resolve(currentPath, uri.substring(1)) : + path.resolve(inlinerContext.rebaseTo, uri); + var relativeToCurrentPath = path.relative(currentPath, absoluteUri); + var importedStyles; + var importedTokens; + var isAllowed = isAllowedResource(uri, false, inlinerContext.inline); + var normalizedPath = normalizePath(relativeToCurrentPath); + var isLoaded = normalizedPath in inlinerContext.externalContext.sourcesContent; + + if (inlinerContext.inlinedStylesheets.indexOf(absoluteUri) > -1) { + inlinerContext.warnings.push('Ignoring local @import of "' + uri + '" as it has already been imported.'); + } else if (!isLoaded && (!fs.existsSync(absoluteUri) || !fs.statSync(absoluteUri).isFile())) { + inlinerContext.errors.push('Ignoring local @import of "' + uri + '" as resource is missing.'); + } else if (!isAllowed && inlinerContext.afterContent) { + inlinerContext.warnings.push('Ignoring local @import of "' + uri + '" as resource is not allowed and after other content.'); + } else if (inlinerContext.afterContent) { + inlinerContext.warnings.push('Ignoring local @import of "' + uri + '" as after other content.'); + } else if (!isAllowed) { + inlinerContext.warnings.push('Skipping local @import of "' + uri + '" as resource is not allowed.'); + inlinerContext.outputTokens = inlinerContext.outputTokens.concat(inlinerContext.sourceTokens.slice(0, 1)); + } else { + importedStyles = isLoaded ? + inlinerContext.externalContext.sourcesContent[normalizedPath] : + fs.readFileSync(absoluteUri, 'utf-8'); - return outputParts.join('/'); -}; + inlinerContext.inlinedStylesheets.push(absoluteUri); + inlinerContext.inline = inlinerContext.externalContext.options.inline; -exports.sep = '/'; -exports.delimiter = ':'; + inlinerContext.externalContext.source = normalizedPath; + inlinerContext.externalContext.sourcesContent[normalizedPath] = importedStyles; + inlinerContext.externalContext.stats.originalSize += importedStyles.length; -exports.dirname = function(path) { - var result = splitPath(path), - root = result[0], - dir = result[1]; + importedTokens = fromStyles(importedStyles, inlinerContext.externalContext, inlinerContext, function (tokens) { return tokens; }); + importedTokens = wrapInMedia(importedTokens, mediaQuery, metadata); - if (!root && !dir) { - // No dirname whatsoever - return '.'; + inlinerContext.outputTokens = inlinerContext.outputTokens.concat(importedTokens); } - if (dir) { - // It has a dirname, strip trailing slash - dir = dir.substr(0, dir.length - 1); + inlinerContext.sourceTokens = inlinerContext.sourceTokens.slice(1); + + return doInlineImports(inlinerContext); +} + +function wrapInMedia(tokens, mediaQuery, metadata) { + if (mediaQuery) { + return [[Token.NESTED_BLOCK, [[Token.NESTED_BLOCK_SCOPE, '@media ' + mediaQuery, metadata]], tokens]]; + } else { + return tokens; } +} - return root + dir; -}; +module.exports = readSources; +}).call(this,{"isBuffer":require("../../../is-buffer/index.js")},require('_process')) +},{"../../../is-buffer/index.js":106,"../tokenizer/marker":81,"../tokenizer/token":82,"../tokenizer/tokenize":83,"../utils/has-protocol":86,"../utils/is-absolute-resource":87,"../utils/is-import":91,"../utils/is-remote-resource":92,"./apply-source-maps":67,"./extract-import-url-and-media":68,"./is-allowed-resource":70,"./load-original-sources":71,"./load-remote-resource":72,"./normalize-path":74,"./rebase":78,"./rebase-local-map":76,"./rebase-remote-map":77,"./restore-import":79,"_process":112,"fs":3,"path":110}],76:[function(require,module,exports){ +var path = require('path'); -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; -}; +function rebaseLocalMap(sourceMap, sourceUri, rebaseTo) { + var currentPath = path.resolve(''); + var absoluteUri = path.resolve(currentPath, sourceUri); + var absoluteUriDirectory = path.dirname(absoluteUri); + sourceMap.sources = sourceMap.sources.map(function(source) { + return path.relative(rebaseTo, path.resolve(absoluteUriDirectory, source)); + }); -exports.extname = function(path) { - return splitPath(path)[3]; -}; + return sourceMap; +} -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; +module.exports = rebaseLocalMap; + +},{"path":110}],77:[function(require,module,exports){ +var path = require('path'); +var url = require('url'); + +function rebaseRemoteMap(sourceMap, sourceUri) { + var sourceDirectory = path.dirname(sourceUri); + + sourceMap.sources = sourceMap.sources.map(function(source) { + return url.resolve(sourceDirectory, source); + }); + + return sourceMap; } -// 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); - } -; +module.exports = rebaseRemoteMap; -}).call(this,require('_process')) -},{"_process":81}],80:[function(require,module,exports){ -(function (process){ -'use strict'; +},{"path":110,"url":159}],78:[function(require,module,exports){ +var extractImportUrlAndMedia = require('./extract-import-url-and-media'); +var restoreImport = require('./restore-import'); +var rewriteUrl = require('./rewrite-url'); -if (!process.version || - process.version.indexOf('v0.') === 0 || - process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { - module.exports = nextTick; -} else { - module.exports = process.nextTick; +var Token = require('../tokenizer/token'); +var isImport = require('../utils/is-import'); + +var SOURCE_MAP_COMMENT_PATTERN = /^\/\*# sourceMappingURL=(\S+) \*\/$/; + +function rebase(tokens, rebaseAll, validator, rebaseConfig) { + return rebaseAll ? + rebaseEverything(tokens, validator, rebaseConfig) : + rebaseAtRules(tokens, validator, rebaseConfig); } -function nextTick(fn, arg1, arg2, arg3) { - if (typeof fn !== 'function') { - throw new TypeError('"callback" argument must be a function'); - } - var len = arguments.length; - var args, i; - switch (len) { - case 0: - case 1: - return process.nextTick(fn); - case 2: - return process.nextTick(function afterTickOne() { - fn.call(null, arg1); - }); - case 3: - return process.nextTick(function afterTickTwo() { - fn.call(null, arg1, arg2); - }); - case 4: - return process.nextTick(function afterTickThree() { - fn.call(null, arg1, arg2, arg3); - }); - default: - args = new Array(len - 1); - i = 0; - while (i < args.length) { - args[i++] = arguments[i]; +function rebaseEverything(tokens, validator, rebaseConfig) { + var token; + var i, l; + + for (i = 0, l = tokens.length; i < l; i++) { + token = tokens[i]; + + switch (token[0]) { + case Token.AT_RULE: + rebaseAtRule(token, validator, rebaseConfig); + break; + case Token.AT_RULE_BLOCK: + rebaseProperties(token[2], validator, rebaseConfig); + break; + case Token.COMMENT: + rebaseSourceMapComment(token, rebaseConfig); + break; + case Token.NESTED_BLOCK: + rebaseEverything(token[2], validator, rebaseConfig); + break; + case Token.RULE: + rebaseProperties(token[2], validator, rebaseConfig); + break; } - return process.nextTick(function afterTick() { - fn.apply(null, args); - }); } + + return tokens; } -}).call(this,require('_process')) -},{"_process":81}],81:[function(require,module,exports){ -// shim for using process in browser -var process = module.exports = {}; +function rebaseAtRules(tokens, validator, rebaseConfig) { + var token; + var i, l; -// 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. + for (i = 0, l = tokens.length; i < l; i++) { + token = tokens[i]; -var cachedSetTimeout; -var cachedClearTimeout; + switch (token[0]) { + case Token.AT_RULE: + rebaseAtRule(token, validator, rebaseConfig); + break; + } + } -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); + return tokens; } -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); + +function rebaseAtRule(token, validator, rebaseConfig) { + if (!isImport(token[1])) { + return; + } + + var uriAndMediaQuery = extractImportUrlAndMedia(token[1]); + var newUrl = rewriteUrl(uriAndMediaQuery[0], rebaseConfig); + var mediaQuery = uriAndMediaQuery[1]; + + token[1] = restoreImport(newUrl, mediaQuery); } -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } +function rebaseSourceMapComment(token, rebaseConfig) { + var matches = SOURCE_MAP_COMMENT_PATTERN.exec(token[1]); + if (matches && matches[1].indexOf('data:') === -1) { + token[1] = token[1].replace(matches[1], rewriteUrl(matches[1], rebaseConfig, true)); + } } -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } +function rebaseProperties(properties, validator, rebaseConfig) { + var property; + var value; + var i, l; + var j, m; + for (i = 0, l = properties.length; i < l; i++) { + property = properties[i]; -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; + for (j = 2 /* 0 is Token.PROPERTY, 1 is name */, m = property.length; j < m; j++) { + value = property[j][1]; -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); + if (validator.isValidUrl(value)) { + property[j][1] = rewriteUrl(value, rebaseConfig); + } } + } } -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; +module.exports = rebase; - 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; - runClearTimeout(timeout); +},{"../tokenizer/token":82,"../utils/is-import":91,"./extract-import-url-and-media":68,"./restore-import":79,"./rewrite-url":80}],79:[function(require,module,exports){ +function restoreImport(uri, mediaQuery) { + return ('@import ' + uri + ' ' + mediaQuery).trim(); } -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) { - runTimeout(drainQueue); - } -}; +module.exports = restoreImport; -// 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 = {}; +},{}],80:[function(require,module,exports){ +(function (process){ +var path = require('path'); +var url = require('url'); -function noop() {} +var DOUBLE_QUOTE = '"'; +var SINGLE_QUOTE = '\''; +var URL_PREFIX = 'url('; +var URL_SUFFIX = ')'; -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; +var QUOTE_PREFIX_PATTERN = /^["']/; +var QUOTE_SUFFIX_PATTERN = /["']$/; +var ROUND_BRACKETS_PATTERN = /[\(\)]/; +var URL_PREFIX_PATTERN = /^url\(/i; +var URL_SUFFIX_PATTERN = /\)$/; +var WHITESPACE_PATTERN = /\s/; -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; +var isWindows = process.platform == 'win32'; -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; +function rebase(uri, rebaseConfig) { + if (!rebaseConfig) { + return uri; + } -},{}],82:[function(require,module,exports){ -(function (global){ -/*! https://mths.be/punycode v1.4.1 by @mathias */ -;(function(root) { + if (isAbsolute(uri) && !isRemote(rebaseConfig.toBase)) { + return uri; + } - /** Detect free variables */ - var freeExports = typeof exports == 'object' && exports && - !exports.nodeType && exports; - var freeModule = typeof module == 'object' && module && - !module.nodeType && module; - var freeGlobal = typeof global == 'object' && global; - if ( - freeGlobal.global === freeGlobal || - freeGlobal.window === freeGlobal || - freeGlobal.self === freeGlobal - ) { - root = freeGlobal; - } + if (isRemote(uri) || isSVGMarker(uri) || isInternal(uri)) { + return uri; + } - /** - * The `punycode` object. - * @name punycode - * @type Object - */ - var punycode, + if (isData(uri)) { + return '\'' + uri + '\''; + } - /** Highest positive signed 32-bit float value */ - maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + if (isRemote(rebaseConfig.toBase)) { + return url.resolve(rebaseConfig.toBase, uri); + } - /** Bootstring parameters */ - base = 36, - tMin = 1, - tMax = 26, - skew = 38, - damp = 700, - initialBias = 72, - initialN = 128, // 0x80 - delimiter = '-', // '\x2D' + return rebaseConfig.absolute ? + normalize(absolute(uri, rebaseConfig)) : + normalize(relative(uri, rebaseConfig)); +} - /** Regular expressions */ - regexPunycode = /^xn--/, - regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars - regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators +function isAbsolute(uri) { + return uri[0] == '/'; +} + +function isSVGMarker(uri) { + return uri[0] == '#'; +} + +function isInternal(uri) { + return /^\w+:\w+/.test(uri); +} + +function isRemote(uri) { + return /^[^:]+?:\/\//.test(uri) || uri.indexOf('//') === 0; +} + +function isData(uri) { + return uri.indexOf('data:') === 0; +} + +function absolute(uri, rebaseConfig) { + return path + .resolve(path.join(rebaseConfig.fromBase || '', uri)) + .replace(rebaseConfig.toBase, ''); +} + +function relative(uri, rebaseConfig) { + return path.relative(rebaseConfig.toBase, path.join(rebaseConfig.fromBase || '', uri)); +} + +function normalize(uri) { + return isWindows ? uri.replace(/\\/g, '/') : uri; +} - /** Error messages */ - errors = { - 'overflow': 'Overflow: input needs wider integers to process', - 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', - 'invalid-input': 'Invalid input' - }, +function quoteFor(unquotedUrl) { + if (unquotedUrl.indexOf(SINGLE_QUOTE) > -1) { + return DOUBLE_QUOTE; + } else if (unquotedUrl.indexOf(DOUBLE_QUOTE) > -1) { + return SINGLE_QUOTE; + } else if (hasWhitespace(unquotedUrl) || hasRoundBrackets(unquotedUrl)) { + return SINGLE_QUOTE; + } else { + return ''; + } +} - /** Convenience shortcuts */ - baseMinusTMin = base - tMin, - floor = Math.floor, - stringFromCharCode = String.fromCharCode, +function hasWhitespace(url) { + return WHITESPACE_PATTERN.test(url); +} - /** Temporary variable */ - key; +function hasRoundBrackets(url) { + return ROUND_BRACKETS_PATTERN.test(url); +} - /*--------------------------------------------------------------------------*/ +function rewriteUrl(originalUrl, rebaseConfig, pathOnly) { + var strippedUrl = originalUrl + .replace(URL_PREFIX_PATTERN, '') + .replace(URL_SUFFIX_PATTERN, '') + .trim(); - /** - * A generic error utility function. - * @private - * @param {String} type The error type. - * @returns {Error} Throws a `RangeError` with the applicable error message. - */ - function error(type) { - throw new RangeError(errors[type]); - } + var unquotedUrl = strippedUrl + .replace(QUOTE_PREFIX_PATTERN, '') + .replace(QUOTE_SUFFIX_PATTERN, '') + .trim(); - /** - * A generic `Array#map` utility function. - * @private - * @param {Array} array The array to iterate over. - * @param {Function} callback The function that gets called for every array - * item. - * @returns {Array} A new array of values returned by the callback function. - */ - function map(array, fn) { - var length = array.length; - var result = []; - while (length--) { - result[length] = fn(array[length]); - } - return result; - } + var quote = strippedUrl[0] == SINGLE_QUOTE || strippedUrl[0] == DOUBLE_QUOTE ? + strippedUrl[0] : + quoteFor(unquotedUrl); - /** - * A simple `Array#map`-like wrapper to work with domain name strings or email - * addresses. - * @private - * @param {String} domain The domain name or email address. - * @param {Function} callback The function that gets called for every - * character. - * @returns {Array} A new string of characters returned by the callback - * function. - */ - function mapDomain(string, fn) { - var parts = string.split('@'); - var result = ''; - if (parts.length > 1) { - // In email addresses, only the domain name should be punycoded. Leave - // the local part (i.e. everything up to `@`) intact. - result = parts[0] + '@'; - string = parts[1]; - } - // Avoid `split(regex)` for IE8 compatibility. See #17. - string = string.replace(regexSeparators, '\x2E'); - var labels = string.split('.'); - var encoded = map(labels, fn).join('.'); - return result + encoded; - } + return pathOnly ? + rebase(unquotedUrl, rebaseConfig) : + URL_PREFIX + quote + rebase(unquotedUrl, rebaseConfig) + quote + URL_SUFFIX; +} - /** - * Creates an array containing the numeric code points of each Unicode - * character in the string. While JavaScript uses UCS-2 internally, - * this function will convert a pair of surrogate halves (each of which - * UCS-2 exposes as separate characters) into a single code point, - * matching UTF-16. - * @see `punycode.ucs2.encode` - * @see - * @memberOf punycode.ucs2 - * @name decode - * @param {String} string The Unicode input string (UCS-2). - * @returns {Array} The new array of code points. - */ - function ucs2decode(string) { - var output = [], - counter = 0, - length = string.length, - value, - extra; - while (counter < length) { - value = string.charCodeAt(counter++); - if (value >= 0xD800 && value <= 0xDBFF && counter < length) { - // high surrogate, and there is a next character - extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { // low surrogate - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); - } else { - // unmatched surrogate; only append this code unit, in case the next - // code unit is the high surrogate of a surrogate pair - output.push(value); - counter--; - } - } else { - output.push(value); - } - } - return output; - } +module.exports = rewriteUrl; - /** - * Creates a string based on an array of numeric code points. - * @see `punycode.ucs2.decode` - * @memberOf punycode.ucs2 - * @name encode - * @param {Array} codePoints The array of numeric code points. - * @returns {String} The new Unicode string (UCS-2). - */ - function ucs2encode(array) { - return map(array, function(value) { - var output = ''; - if (value > 0xFFFF) { - value -= 0x10000; - output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); - value = 0xDC00 | value & 0x3FF; - } - output += stringFromCharCode(value); - return output; - }).join(''); - } +}).call(this,require('_process')) +},{"_process":112,"path":110,"url":159}],81:[function(require,module,exports){ +var Marker = { + ASTERISK: '*', + AT: '@', + BACK_SLASH: '\\', + CLOSE_CURLY_BRACKET: '}', + CLOSE_ROUND_BRACKET: ')', + CLOSE_SQUARE_BRACKET: ']', + COLON: ':', + COMMA: ',', + DOUBLE_QUOTE: '"', + EXCLAMATION: '!', + FORWARD_SLASH: '/', + NEW_LINE_NIX: '\n', + NEW_LINE_WIN: '\r', + OPEN_CURLY_BRACKET: '{', + OPEN_ROUND_BRACKET: '(', + OPEN_SQUARE_BRACKET: '[', + SEMICOLON: ';', + SINGLE_QUOTE: '\'', + SPACE: ' ', + TAB: '\t', + UNDERSCORE: '_' +}; - /** - * Converts a basic code point into a digit/integer. - * @see `digitToBasic()` - * @private - * @param {Number} codePoint The basic numeric code point value. - * @returns {Number} The numeric value of a basic code point (for use in - * representing integers) in the range `0` to `base - 1`, or `base` if - * the code point does not represent a value. - */ - function basicToDigit(codePoint) { - if (codePoint - 48 < 10) { - return codePoint - 22; - } - if (codePoint - 65 < 26) { - return codePoint - 65; - } - if (codePoint - 97 < 26) { - return codePoint - 97; - } - return base; - } +module.exports = Marker; - /** - * Converts a digit/integer into a basic code point. - * @see `basicToDigit()` - * @private - * @param {Number} digit The numeric value of a basic code point. - * @returns {Number} The basic code point whose value (when used for - * representing integers) is `digit`, which needs to be in the range - * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is - * used; else, the lowercase form is used. The behavior is undefined - * if `flag` is non-zero and `digit` has no uppercase form. - */ - function digitToBasic(digit, flag) { - // 0..25 map to ASCII a..z or A..Z - // 26..35 map to ASCII 0..9 - return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); - } +},{}],82:[function(require,module,exports){ +var Token = { + AT_RULE: 'at-rule', // e.g. `@import`, `@charset` + AT_RULE_BLOCK: 'at-rule-block', // e.g. `@font-face{...}` + AT_RULE_BLOCK_SCOPE: 'at-rule-block-scope', // e.g. `@font-face` + COMMENT: 'comment', // e.g. `/* comment */` + NESTED_BLOCK: 'nested-block', // e.g. `@media screen{...}`, `@keyframes animation {...}` + NESTED_BLOCK_SCOPE: 'nested-block-scope', // e.g. `@media`, `@keyframes` + PROPERTY: 'property', // e.g. `color:red` + PROPERTY_BLOCK: 'property-block', // e.g. `--var:{color:red}` + PROPERTY_NAME: 'property-name', // e.g. `color` + PROPERTY_VALUE: 'property-value', // e.g. `red` + RULE: 'rule', // e.g `div > a{...}` + RULE_SCOPE: 'rule-scope' // e.g `div > a` +}; - /** - * Bias adaptation function as per section 3.4 of RFC 3492. - * https://tools.ietf.org/html/rfc3492#section-3.4 - * @private - */ - function adapt(delta, numPoints, firstTime) { - var k = 0; - delta = firstTime ? floor(delta / damp) : delta >> 1; - delta += floor(delta / numPoints); - for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { - delta = floor(delta / baseMinusTMin); - } - return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); - } +module.exports = Token; - /** - * Converts a Punycode string of ASCII-only symbols to a string of Unicode - * symbols. - * @memberOf punycode - * @param {String} input The Punycode string of ASCII-only symbols. - * @returns {String} The resulting string of Unicode symbols. - */ - function decode(input) { - // Don't use UCS-2 - var output = [], - inputLength = input.length, - out, - i = 0, - n = initialN, - bias = initialBias, - basic, - j, - index, - oldi, - w, - k, - digit, - t, - /** Cached calculation results */ - baseMinusT; +},{}],83:[function(require,module,exports){ +var Marker = require('./marker'); +var Token = require('./token'); - // Handle the basic code points: let `basic` be the number of input code - // points before the last delimiter, or `0` if there is none, then copy - // the first basic code points to the output. +var formatPosition = require('../utils/format-position'); - basic = input.lastIndexOf(delimiter); - if (basic < 0) { - basic = 0; - } +var Level = { + BLOCK: 'block', + COMMENT: 'comment', + DOUBLE_QUOTE: 'double-quote', + RULE: 'rule', + SINGLE_QUOTE: 'single-quote' +}; - for (j = 0; j < basic; ++j) { - // if it's not a basic code point - if (input.charCodeAt(j) >= 0x80) { - error('not-basic'); - } - output.push(input.charCodeAt(j)); - } +var AT_RULES = [ + '@charset', + '@import' +]; + +var BLOCK_RULES = [ + '@-moz-document', + '@document', + '@-moz-keyframes', + '@-ms-keyframes', + '@-o-keyframes', + '@-webkit-keyframes', + '@keyframes', + '@media', + '@supports' +]; + +var TAIL_BROKEN_VALUE_PATTERN = /[\s|\}]*$/; + +function tokenize(source, externalContext) { + var internalContext = { + level: Level.BLOCK, + position: { + source: externalContext.source || undefined, + line: 1, + column: 0, + index: 0 + } + }; - // Main decoding loop: start just after the last delimiter if any basic code - // points were copied; start at the beginning otherwise. + return intoTokens(source, externalContext, internalContext, false); +} - for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { +function intoTokens(source, externalContext, internalContext, isNested) { + var allTokens = []; + var newTokens = allTokens; + var lastToken; + var ruleToken; + var ruleTokens = []; + var propertyToken; + var metadata; + var metadatas = []; + var level = internalContext.level; + var levels = []; + var buffer = []; + var buffers = []; + var serializedBuffer; + var roundBracketLevel = 0; + var isQuoted; + var isSpace; + var isNewLineNix; + var isNewLineWin; + var isCommentStart; + var wasCommentStart = false; + var isCommentEnd; + var wasCommentEnd = false; + var isEscaped; + var seekingValue = false; + var seekingPropertyBlockClosing = false; + var position = internalContext.position; + + for (; position.index < source.length; position.index++) { + var character = source[position.index]; + + isQuoted = level == Level.SINGLE_QUOTE || level == Level.DOUBLE_QUOTE; + isSpace = character == Marker.SPACE || character == Marker.TAB; + isNewLineNix = character == Marker.NEW_LINE_NIX; + isNewLineWin = character == Marker.NEW_LINE_NIX && source[position.index - 1] == Marker.NEW_LINE_WIN; + isCommentStart = !wasCommentEnd && level != Level.COMMENT && !isQuoted && character == Marker.ASTERISK && source[position.index - 1] == Marker.FORWARD_SLASH; + isCommentEnd = !wasCommentStart && level == Level.COMMENT && character == Marker.FORWARD_SLASH && source[position.index - 1] == Marker.ASTERISK; + + metadata = buffer.length === 0 ? + [position.line, position.column, position.source] : + metadata; + + if (isEscaped) { + // previous character was a backslash + buffer.push(character); + } else if (!isCommentEnd && level == Level.COMMENT) { + buffer.push(character); + } else if (isCommentStart && (level == Level.BLOCK || level == Level.RULE) && buffer.length > 1) { + // comment start within block preceded by some content, e.g. div/*<-- + metadatas.push(metadata); + buffer.push(character); + buffers.push(buffer.slice(0, buffer.length - 2)); + + buffer = buffer.slice(buffer.length - 2); + metadata = [position.line, position.column - 1, position.source]; + + levels.push(level); + level = Level.COMMENT; + } else if (isCommentStart) { + // comment start, e.g. /*<-- + levels.push(level); + level = Level.COMMENT; + buffer.push(character); + } else if (isCommentEnd) { + // comment end, e.g. /* comment */<-- + serializedBuffer = buffer.join('').trim() + character; + lastToken = [Token.COMMENT, serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext)]]; + newTokens.push(lastToken); + + level = levels.pop(); + metadata = metadatas.pop() || null; + buffer = buffers.pop() || []; + } else if (character == Marker.SINGLE_QUOTE && !isQuoted) { + // single quotation start, e.g. a[href^='https<-- + levels.push(level); + level = Level.SINGLE_QUOTE; + buffer.push(character); + } else if (character == Marker.SINGLE_QUOTE && level == Level.SINGLE_QUOTE) { + // single quotation end, e.g. a[href^='https'<-- + level = levels.pop(); + buffer.push(character); + } else if (character == Marker.DOUBLE_QUOTE && !isQuoted) { + // double quotation start, e.g. a[href^="<-- + levels.push(level); + level = Level.DOUBLE_QUOTE; + buffer.push(character); + } else if (character == Marker.DOUBLE_QUOTE && level == Level.DOUBLE_QUOTE) { + // double quotation end, e.g. a[href^="https"<-- + level = levels.pop(); + buffer.push(character); + } else if (!isCommentStart && !isCommentEnd && character != Marker.CLOSE_ROUND_BRACKET && character != Marker.OPEN_ROUND_BRACKET && level != Level.COMMENT && !isQuoted && roundBracketLevel > 0) { + // character inside any function, e.g. hsla(.<-- + buffer.push(character); + } else if (character == Marker.OPEN_ROUND_BRACKET && !isQuoted && level != Level.COMMENT && !seekingValue) { + // round open bracket, e.g. @import url(<-- + buffer.push(character); + + roundBracketLevel++; + } else if (character == Marker.CLOSE_ROUND_BRACKET && !isQuoted && level != Level.COMMENT && !seekingValue) { + // round open bracket, e.g. @import url(test.css)<-- + buffer.push(character); + + roundBracketLevel--; + } else if (character == Marker.SEMICOLON && level == Level.BLOCK && buffer[0] == Marker.AT) { + // semicolon ending rule at block level, e.g. @import '...';<-- + serializedBuffer = buffer.join('').trim(); + allTokens.push([Token.AT_RULE, serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext)]]); + + buffer = []; + } else if (character == Marker.COMMA && level == Level.BLOCK && ruleToken) { + // comma separator at block level, e.g. a,div,<-- + serializedBuffer = buffer.join('').trim(); + ruleToken[1].push([tokenScopeFrom(ruleToken[0]), serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext, ruleToken[1].length)]]); + + buffer = []; + } else if (character == Marker.COMMA && level == Level.BLOCK && tokenTypeFrom(buffer) == Token.AT_RULE) { + // comma separator at block level, e.g. @import url(...) screen,<-- + // keep iterating as end semicolon will create the token + buffer.push(character); + } else if (character == Marker.COMMA && level == Level.BLOCK) { + // comma separator at block level, e.g. a,<-- + ruleToken = [tokenTypeFrom(buffer), [], []]; + serializedBuffer = buffer.join('').trim(); + ruleToken[1].push([tokenScopeFrom(ruleToken[0]), serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext, 0)]]); + + buffer = []; + } else if (character == Marker.OPEN_CURLY_BRACKET && level == Level.BLOCK && ruleToken && ruleToken[0] == Token.NESTED_BLOCK) { + // open brace opening at-rule at block level, e.g. @media{<-- + serializedBuffer = buffer.join('').trim(); + ruleToken[1].push([Token.NESTED_BLOCK_SCOPE, serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext)]]); + allTokens.push(ruleToken); + + levels.push(level); + position.column++; + position.index++; + buffer = []; + + ruleToken[2] = intoTokens(source, externalContext, internalContext, true); + ruleToken = null; + } else if (character == Marker.OPEN_CURLY_BRACKET && level == Level.BLOCK && tokenTypeFrom(buffer) == Token.NESTED_BLOCK) { + // open brace opening at-rule at block level, e.g. @media{<-- + serializedBuffer = buffer.join('').trim(); + ruleToken = ruleToken || [Token.NESTED_BLOCK, [], []]; + ruleToken[1].push([Token.NESTED_BLOCK_SCOPE, serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext)]]); + allTokens.push(ruleToken); + + levels.push(level); + position.column++; + position.index++; + buffer = []; + + ruleToken[2] = intoTokens(source, externalContext, internalContext, true); + ruleToken = null; + } else if (character == Marker.OPEN_CURLY_BRACKET && level == Level.BLOCK) { + // open brace opening rule at block level, e.g. div{<-- + serializedBuffer = buffer.join('').trim(); + ruleToken = ruleToken || [tokenTypeFrom(buffer), [], []]; + ruleToken[1].push([tokenScopeFrom(ruleToken[0]), serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext, ruleToken[1].length)]]); + newTokens = ruleToken[2]; + allTokens.push(ruleToken); + + levels.push(level); + level = Level.RULE; + buffer = []; + } else if (character == Marker.OPEN_CURLY_BRACKET && level == Level.RULE && seekingValue) { + // open brace opening rule at rule level, e.g. div{--variable:{<-- + ruleTokens.push(ruleToken); + ruleToken = [Token.PROPERTY_BLOCK, []]; + propertyToken.push(ruleToken); + newTokens = ruleToken[1]; + + levels.push(level); + level = Level.RULE; + seekingValue = false; + } else if (character == Marker.COLON && level == Level.RULE && !seekingValue) { + // colon at rule level, e.g. a{color:<-- + serializedBuffer = buffer.join('').trim(); + propertyToken = [Token.PROPERTY, [Token.PROPERTY_NAME, serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext)]]]; + newTokens.push(propertyToken); + + seekingValue = true; + buffer = []; + } else if (character == Marker.SEMICOLON && level == Level.RULE && propertyToken && ruleTokens.length > 0 && buffer.length > 0 && buffer[0] == Marker.AT) { + // semicolon at rule level for at-rule, e.g. a{--color:{@apply(--other-color);<-- + serializedBuffer = buffer.join('').trim(); + ruleToken[1].push([Token.AT_RULE, serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext)]]); + + buffer = []; + } else if (character == Marker.SEMICOLON && level == Level.RULE && propertyToken && buffer.length > 0) { + // semicolon at rule level, e.g. a{color:red;<-- + serializedBuffer = buffer.join('').trim(); + propertyToken.push([Token.PROPERTY_VALUE, serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext)]]); + + propertyToken = null; + seekingValue = false; + buffer = []; + } else if (character == Marker.SEMICOLON && level == Level.RULE && propertyToken && buffer.length === 0) { + // semicolon after bracketed value at rule level, e.g. a{color:rgb(...);<-- + seekingValue = false; + } else if (character == Marker.SEMICOLON && level == Level.RULE && buffer.length > 0 && buffer[0] == Marker.AT) { + // semicolon for at-rule at rule level, e.g. a{@apply(--variable);<-- + serializedBuffer = buffer.join(''); + newTokens.push([Token.AT_RULE, serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext)]]); + + seekingValue = false; + buffer = []; + } else if (character == Marker.SEMICOLON && level == Level.RULE && seekingPropertyBlockClosing) { + // close brace after a property block at rule level, e.g. a{--custom:{color:red;};<-- + seekingPropertyBlockClosing = false; + buffer = []; + } else if (character == Marker.SEMICOLON && level == Level.RULE && buffer.length === 0) { + // stray semicolon at rule level, e.g. a{;<-- + // noop + } else if (character == Marker.CLOSE_CURLY_BRACKET && level == Level.RULE && propertyToken && seekingValue && buffer.length > 0 && ruleTokens.length > 0) { + // close brace at rule level, e.g. a{--color:{color:red}<-- + serializedBuffer = buffer.join(''); + propertyToken.push([Token.PROPERTY_VALUE, serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext)]]); + propertyToken = null; + ruleToken = ruleTokens.pop(); + newTokens = ruleToken[2]; + + level = levels.pop(); + seekingValue = false; + buffer = []; + } else if (character == Marker.CLOSE_CURLY_BRACKET && level == Level.RULE && propertyToken && buffer.length > 0 && buffer[0] == Marker.AT && ruleTokens.length > 0) { + // close brace at rule level for at-rule, e.g. a{--color:{@apply(--other-color)}<-- + serializedBuffer = buffer.join(''); + ruleToken[1].push([Token.AT_RULE, serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext)]]); + propertyToken = null; + ruleToken = ruleTokens.pop(); + newTokens = ruleToken[2]; + + level = levels.pop(); + seekingValue = false; + buffer = []; + } else if (character == Marker.CLOSE_CURLY_BRACKET && level == Level.RULE && propertyToken && ruleTokens.length > 0) { + // close brace at rule level after space, e.g. a{--color:{color:red }<-- + propertyToken = null; + ruleToken = ruleTokens.pop(); + newTokens = ruleToken[2]; + + level = levels.pop(); + seekingValue = false; + } else if (character == Marker.CLOSE_CURLY_BRACKET && level == Level.RULE && propertyToken && buffer.length > 0) { + // close brace at rule level, e.g. a{color:red}<-- + serializedBuffer = buffer.join(''); + propertyToken.push([Token.PROPERTY_VALUE, serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext)]]); + propertyToken = null; + ruleToken = ruleTokens.pop(); + newTokens = allTokens; + + level = levels.pop(); + seekingValue = false; + buffer = []; + } else if (character == Marker.CLOSE_CURLY_BRACKET && level == Level.RULE && buffer.length > 0 && buffer[0] == Marker.AT) { + // close brace after at-rule at rule level, e.g. a{@apply(--variable)}<-- + ruleToken = null; + serializedBuffer = buffer.join('').trim(); + newTokens.push([Token.AT_RULE, serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext)]]); + newTokens = allTokens; + + level = levels.pop(); + seekingValue = false; + buffer = []; + } else if (character == Marker.CLOSE_CURLY_BRACKET && level == Level.RULE && levels[levels.length - 1] == Level.RULE) { + // close brace after a property block at rule level, e.g. a{--custom:{color:red;}<-- + ruleToken = ruleTokens.pop(); + newTokens = ruleToken[2]; + + level = levels.pop(); + seekingValue = false; + seekingPropertyBlockClosing = true; + buffer = []; + } else if (character == Marker.CLOSE_CURLY_BRACKET && level == Level.RULE) { + // close brace after a rule, e.g. a{color:red;}<-- + ruleToken = null; + newTokens = allTokens; + + level = levels.pop(); + seekingValue = false; + } else if (character == Marker.CLOSE_CURLY_BRACKET && level == Level.BLOCK && !isNested && position.index <= source.length - 1) { + // stray close brace at block level, e.g. a{color:red}color:blue}<-- + externalContext.warnings.push('Unexpected \'}\' at ' + formatPosition([position.line, position.column, position.source]) + '.'); + buffer.push(character); + } else if (character == Marker.CLOSE_CURLY_BRACKET && level == Level.BLOCK) { + // close brace at block level, e.g. @media screen {...}<-- + break; + } else if (character == Marker.OPEN_ROUND_BRACKET && level == Level.RULE && seekingValue) { + // round open bracket, e.g. a{color:hsla(<-- + buffer.push(character); + roundBracketLevel++; + } else if (character == Marker.CLOSE_ROUND_BRACKET && level == Level.RULE && seekingValue && roundBracketLevel == 1) { + // round close bracket, e.g. a{color:hsla(0,0%,0%)<-- + buffer.push(character); + serializedBuffer = buffer.join('').trim(); + propertyToken.push([Token.PROPERTY_VALUE, serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext)]]); + + roundBracketLevel--; + buffer = []; + } else if (character == Marker.CLOSE_ROUND_BRACKET && level == Level.RULE && seekingValue) { + // round close bracket within other brackets, e.g. a{width:calc((10rem / 2)<-- + buffer.push(character); + roundBracketLevel--; + } else if (character == Marker.FORWARD_SLASH && source[position.index + 1] != Marker.ASTERISK && level == Level.RULE && seekingValue && buffer.length > 0) { + // forward slash within a property, e.g. a{background:url(image.png) 0 0/<-- + serializedBuffer = buffer.join('').trim(); + propertyToken.push([Token.PROPERTY_VALUE, serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext)]]); + propertyToken.push([Token.PROPERTY_VALUE, character, [[position.line, position.column, position.source]]]); + + buffer = []; + } else if (character == Marker.FORWARD_SLASH && source[position.index + 1] != Marker.ASTERISK && level == Level.RULE && seekingValue) { + // forward slash within a property after space, e.g. a{background:url(image.png) 0 0 /<-- + propertyToken.push([Token.PROPERTY_VALUE, character, [[position.line, position.column, position.source]]]); + + buffer = []; + } else if (character == Marker.COMMA && level == Level.RULE && seekingValue && buffer.length > 0) { + // comma within a property, e.g. a{background:url(image.png),<-- + serializedBuffer = buffer.join('').trim(); + propertyToken.push([Token.PROPERTY_VALUE, serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext)]]); + propertyToken.push([Token.PROPERTY_VALUE, character, [[position.line, position.column, position.source]]]); + + buffer = []; + } else if (character == Marker.COMMA && level == Level.RULE && seekingValue) { + // comma within a property after space, e.g. a{background:url(image.png) ,<-- + propertyToken.push([Token.PROPERTY_VALUE, character, [[position.line, position.column, position.source]]]); + + buffer = []; + } else if ((isSpace || (isNewLineNix && !isNewLineWin)) && level == Level.RULE && seekingValue && propertyToken && buffer.length > 0) { + // space or *nix newline within property, e.g. a{margin:0 <-- + serializedBuffer = buffer.join('').trim(); + propertyToken.push([Token.PROPERTY_VALUE, serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext)]]); + + buffer = []; + } else if (isNewLineWin && level == Level.RULE && seekingValue && propertyToken && buffer.length > 1) { + // win newline within property, e.g. a{margin:0\r\n<-- + serializedBuffer = buffer.join('').trim(); + propertyToken.push([Token.PROPERTY_VALUE, serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext)]]); + + buffer = []; + } else if (isNewLineWin && level == Level.RULE && seekingValue) { + // win newline + buffer = []; + } else if (buffer.length == 1 && isNewLineWin) { + // ignore windows newline which is composed of two characters + buffer.pop(); + } else if (buffer.length > 0 || !isSpace && !isNewLineNix && !isNewLineWin) { + // any character + buffer.push(character); + } + + isEscaped = character == Marker.BACK_SLASH; + wasCommentStart = isCommentStart; + wasCommentEnd = isCommentEnd; + + position.line = (isNewLineWin || isNewLineNix) ? position.line + 1 : position.line; + position.column = (isNewLineWin || isNewLineNix) ? 0 : position.column + 1; + } + + if (seekingValue) { + externalContext.warnings.push('Missing \'}\' at ' + formatPosition([position.line, position.column, position.source]) + '.'); + } + + if (seekingValue && buffer.length > 0) { + serializedBuffer = buffer.join('').replace(TAIL_BROKEN_VALUE_PATTERN, ''); + propertyToken.push([Token.PROPERTY_VALUE, serializedBuffer, [originalMetadata(metadata, serializedBuffer, externalContext)]]); + + buffer = []; + } + + if (buffer.length > 0) { + externalContext.warnings.push('Invalid character(s) \'' + buffer.join('') + '\' at ' + formatPosition(metadata) + '. Ignoring.'); + } + + return allTokens; +} + +function originalMetadata(metadata, value, externalContext, selectorFallbacks) { + var source = metadata[2]; + + return externalContext.inputSourceMapTracker.isTracking(source) ? + externalContext.inputSourceMapTracker.originalPositionFor(metadata, value.length, selectorFallbacks) : + metadata; +} + +function tokenTypeFrom(buffer) { + var isAtRule = buffer[0] == Marker.AT || buffer[0] == Marker.UNDERSCORE; + var ruleWord = buffer.join('').split(/\s/)[0]; + + if (isAtRule && BLOCK_RULES.indexOf(ruleWord) > -1) { + return Token.NESTED_BLOCK; + } else if (isAtRule && AT_RULES.indexOf(ruleWord) > -1) { + return Token.AT_RULE; + } else if (isAtRule) { + return Token.AT_RULE_BLOCK; + } else { + return Token.RULE; + } +} - // `index` is the index of the next character to be consumed. - // Decode a generalized variable-length integer into `delta`, - // which gets added to `i`. The overflow checking is easier - // if we increase `i` as we go, then subtract off its starting - // value at the end to obtain `delta`. - for (oldi = i, w = 1, k = base; /* no condition */; k += base) { +function tokenScopeFrom(tokenType) { + if (tokenType == Token.RULE) { + return Token.RULE_SCOPE; + } else if (tokenType == Token.NESTED_BLOCK) { + return Token.NESTED_BLOCK_SCOPE; + } else if (tokenType == Token.AT_RULE_BLOCK) { + return Token.AT_RULE_BLOCK_SCOPE; + } +} - if (index >= inputLength) { - error('invalid-input'); - } +module.exports = tokenize; - digit = basicToDigit(input.charCodeAt(index++)); +},{"../utils/format-position":85,"./marker":81,"./token":82}],84:[function(require,module,exports){ +function cloneArray(array) { + var cloned = array.slice(0); - if (digit >= base || digit > floor((maxInt - i) / w)) { - error('overflow'); - } + for (var i = 0, l = cloned.length; i < l; i++) { + if (Array.isArray(cloned[i])) + cloned[i] = cloneArray(cloned[i]); + } - i += digit * w; - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + return cloned; +} - if (digit < t) { - break; - } +module.exports = cloneArray; - baseMinusT = base - t; - if (w > floor(maxInt / baseMinusT)) { - error('overflow'); - } +},{}],85:[function(require,module,exports){ +function formatPosition(metadata) { + var line = metadata[0]; + var column = metadata[1]; + var source = metadata[2]; - w *= baseMinusT; + return source ? + source + ':' + line + ':' + column : + line + ':' + column; +} - } +module.exports = formatPosition; - out = output.length + 1; - bias = adapt(i - oldi, out, oldi == 0); +},{}],86:[function(require,module,exports){ +var NO_PROTOCOL_RESOURCE_PATTERN = /^\/\//; - // `i` was supposed to wrap around from `out` to `0`, - // incrementing `n` each time, so we'll fix that now: - if (floor(i / out) > maxInt - n) { - error('overflow'); - } +function hasProtocol(uri) { + return !NO_PROTOCOL_RESOURCE_PATTERN.test(uri); +} - n += floor(i / out); - i %= out; +module.exports = hasProtocol; - // Insert `n` at position `i` of the output - output.splice(i++, 0, n); +},{}],87:[function(require,module,exports){ +var isRemoteResource = require('./is-remote-resource'); - } +function isAbsoluteResource(uri) { + return !isRemoteResource(uri) && uri[0] == '/'; +} - return ucs2encode(output); - } +module.exports = isAbsoluteResource; - /** - * Converts a string of Unicode symbols (e.g. a domain name label) to a - * Punycode string of ASCII-only symbols. - * @memberOf punycode - * @param {String} input The string of Unicode symbols. - * @returns {String} The resulting Punycode string of ASCII-only symbols. - */ - function encode(input) { - var n, - delta, - handledCPCount, - basicLength, - bias, - j, - m, - q, - k, - t, - currentValue, - output = [], - /** `inputLength` will hold the number of code points in `input`. */ - inputLength, - /** Cached calculation results */ - handledCPCountPlusOne, - baseMinusT, - qMinusT; +},{"./is-remote-resource":92}],88:[function(require,module,exports){ +var DATA_URI_PATTERN = /^data:(\S*?)?(;charset=[^;]+)?(;[^,]+?)?,(.+)/; - // Convert the input in UCS-2 to Unicode - input = ucs2decode(input); +function isDataUriResource(uri) { + return DATA_URI_PATTERN.test(uri); +} - // Cache the length - inputLength = input.length; +module.exports = isDataUriResource; - // Initialize the state - n = initialN; - delta = 0; - bias = initialBias; +},{}],89:[function(require,module,exports){ +var HTTP_RESOURCE_PATTERN = /^http:\/\//; - // Handle the basic code points - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue < 0x80) { - output.push(stringFromCharCode(currentValue)); - } - } +function isHttpResource(uri) { + return HTTP_RESOURCE_PATTERN.test(uri); +} - handledCPCount = basicLength = output.length; +module.exports = isHttpResource; - // `handledCPCount` is the number of code points that have been handled; - // `basicLength` is the number of basic code points. +},{}],90:[function(require,module,exports){ +var HTTPS_RESOURCE_PATTERN = /^https:\/\//; - // Finish the basic string - if it is not empty - with a delimiter - if (basicLength) { - output.push(delimiter); - } +function isHttpsResource(uri) { + return HTTPS_RESOURCE_PATTERN.test(uri); +} - // Main encoding loop: - while (handledCPCount < inputLength) { +module.exports = isHttpsResource; - // All non-basic code points < n have been handled already. Find the next - // larger one: - for (m = maxInt, j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue >= n && currentValue < m) { - m = currentValue; - } - } +},{}],91:[function(require,module,exports){ +var IMPORT_PREFIX_PATTERN = /^@import/i; - // Increase `delta` enough to advance the decoder's state to , - // but guard against overflow - handledCPCountPlusOne = handledCPCount + 1; - if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { - error('overflow'); - } +function isImport(value) { + return IMPORT_PREFIX_PATTERN.test(value); +} - delta += (m - n) * handledCPCountPlusOne; - n = m; +module.exports = isImport; - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; +},{}],92:[function(require,module,exports){ +var REMOTE_RESOURCE_PATTERN = /^(\w+:\/\/|\/\/)/; - if (currentValue < n && ++delta > maxInt) { - error('overflow'); - } +function isRemoteResource(uri) { + return REMOTE_RESOURCE_PATTERN.test(uri); +} - if (currentValue == n) { - // Represent delta as a generalized variable-length integer - for (q = delta, k = base; /* no condition */; k += base) { - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - if (q < t) { - break; - } - qMinusT = q - t; - baseMinusT = base - t; - output.push( - stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) - ); - q = floor(qMinusT / baseMinusT); - } +module.exports = isRemoteResource; - output.push(stringFromCharCode(digitToBasic(q, 0))); - bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); - delta = 0; - ++handledCPCount; - } - } +},{}],93:[function(require,module,exports){ +// adapted from http://nedbatchelder.com/blog/200712.html#e20071211T054956 - ++delta; - ++n; +var NUMBER_PATTERN = /([0-9]+)/; - } - return output.join(''); - } +function naturalCompare(value1, value2) { + var keys1 = ('' + value1).split(NUMBER_PATTERN).map(tryParseInt); + var keys2 = ('' + value2).split(NUMBER_PATTERN).map(tryParseInt); + var key1; + var key2; + var compareFirst = Math.min(keys1.length, keys2.length); + var i, l; - /** - * Converts a Punycode string representing a domain name or an email address - * to Unicode. Only the Punycoded parts of the input will be converted, i.e. - * it doesn't matter if you call it on a string that has already been - * converted to Unicode. - * @memberOf punycode - * @param {String} input The Punycoded domain name or email address to - * convert to Unicode. - * @returns {String} The Unicode representation of the given Punycode - * string. - */ - function toUnicode(input) { - return mapDomain(input, function(string) { - return regexPunycode.test(string) - ? decode(string.slice(4).toLowerCase()) - : string; - }); - } + for (i = 0, l = compareFirst; i < l; i++) { + key1 = keys1[i]; + key2 = keys2[i]; - /** - * Converts a Unicode string representing a domain name or an email address to - * Punycode. Only the non-ASCII parts of the domain name will be converted, - * i.e. it doesn't matter if you call it with a domain that's already in - * ASCII. - * @memberOf punycode - * @param {String} input The domain name or email address to convert, as a - * Unicode string. - * @returns {String} The Punycode representation of the given domain name or - * email address. - */ - function toASCII(input) { - return mapDomain(input, function(string) { - return regexNonASCII.test(string) - ? 'xn--' + encode(string) - : string; - }); - } + if (key1 != key2) { + return key1 > key2 ? 1 : -1; + } + } - /*--------------------------------------------------------------------------*/ + return keys1.length > keys2.length ? 1 : (keys1.length == keys2.length ? 0 : -1); +} - /** Define the public API */ - punycode = { - /** - * A string representing the current Punycode.js version number. - * @memberOf punycode - * @type String - */ - 'version': '1.4.1', - /** - * An object of methods to convert from JavaScript's internal character - * representation (UCS-2) to Unicode code points, and back. - * @see - * @memberOf punycode - * @type Object - */ - 'ucs2': { - 'decode': ucs2decode, - 'encode': ucs2encode - }, - 'decode': decode, - 'encode': encode, - 'toASCII': toASCII, - 'toUnicode': toUnicode - }; +function tryParseInt(value) { + return ('' + parseInt(value)) == value ? + parseInt(value) : + value; +} - /** Expose `punycode` */ - // Some AMD build optimizers, like r.js, check for specific condition patterns - // like the following: - if ( - typeof define == 'function' && - typeof define.amd == 'object' && - define.amd - ) { - define('punycode', function() { - return punycode; - }); - } else if (freeExports && freeModule) { - if (module.exports == freeExports) { - // in Node.js, io.js, or RingoJS v0.8.0+ - freeModule.exports = punycode; - } else { - // in Narwhal or RingoJS v0.7.0- - for (key in punycode) { - punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); - } - } - } else { - // in Rhino or a web browser - root.punycode = punycode; - } +module.exports = naturalCompare; -}(this)); +},{}],94:[function(require,module,exports){ +function override(source1, source2) { + var target = {}; + var key1; + var key2; + var item; + + for (key1 in source1) { + item = source1[key1]; + + if (Array.isArray(item)) { + target[key1] = item.slice(0); + } else if (typeof item == 'object' && item !== null) { + target[key1] = override(item, {}); + } else { + target[key1] = item; + } + } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],83:[function(require,module,exports){ -// 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. + for (key2 in source2) { + item = source2[key2]; -'use strict'; + if (key2 in target && Array.isArray(item)) { + target[key2] = item.slice(0); + } else if (key2 in target && typeof item == 'object' && item !== null) { + target[key2] = override(target[key2], item); + } else { + target[key2] = item; + } + } -// If obj.hasOwnProperty has been overridden, then calling -// obj.hasOwnProperty(prop) will break. -// See: https://github.com/joyent/node/issues/1707 -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); + return target; } -module.exports = function(qs, sep, eq, options) { - sep = sep || '&'; - eq = eq || '='; - var obj = {}; +module.exports = override; - if (typeof qs !== 'string' || qs.length === 0) { - return obj; - } +},{}],95:[function(require,module,exports){ +var Marker = require('../tokenizer/marker'); - var regexp = /\+/g; - qs = qs.split(sep); +function split(value, separator) { + var openLevel = Marker.OPEN_ROUND_BRACKET; + var closeLevel = Marker.CLOSE_ROUND_BRACKET; + var level = 0; + var cursor = 0; + var lastStart = 0; + var lastValue; + var lastCharacter; + var len = value.length; + var parts = []; - var maxKeys = 1000; - if (options && typeof options.maxKeys === 'number') { - maxKeys = options.maxKeys; + if (value.indexOf(separator) == -1) { + return [value]; } - var len = qs.length; - // maxKeys <= 0 means that we should not limit keys count - if (maxKeys > 0 && len > maxKeys) { - len = maxKeys; + if (value.indexOf(openLevel) == -1) { + return value.split(separator); } - for (var i = 0; i < len; ++i) { - var x = qs[i].replace(regexp, '%20'), - idx = x.indexOf(eq), - kstr, vstr, k, v; + while (cursor < len) { + if (value[cursor] == openLevel) { + level++; + } else if (value[cursor] == closeLevel) { + level--; + } - if (idx >= 0) { - kstr = x.substr(0, idx); - vstr = x.substr(idx + 1); - } else { - kstr = x; - vstr = ''; + if (level === 0 && cursor > 0 && cursor + 1 < len && value[cursor] == separator) { + parts.push(value.substring(lastStart, cursor)); + lastStart = cursor + 1; } - k = decodeURIComponent(kstr); - v = decodeURIComponent(vstr); + cursor++; + } - if (!hasOwnProperty(obj, k)) { - obj[k] = v; - } else if (isArray(obj[k])) { - obj[k].push(v); - } else { - obj[k] = [obj[k], v]; + if (lastStart < cursor + 1) { + lastValue = value.substring(lastStart); + lastCharacter = lastValue[lastValue.length - 1]; + if (lastCharacter == separator) { + lastValue = lastValue.substring(0, lastValue.length - 1); } + + parts.push(lastValue); } - return obj; -}; + return parts; +} -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; +module.exports = split; -},{}],84:[function(require,module,exports){ -// 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. +},{"../tokenizer/marker":81}],96:[function(require,module,exports){ +var lineBreak = require('os').EOL; +var emptyCharacter = ''; -'use strict'; +var Breaks = require('../options/format').Breaks; +var Spaces = require('../options/format').Spaces; -var stringifyPrimitive = function(v) { - switch (typeof v) { - case 'string': - return v; +var Marker = require('../tokenizer/marker'); +var Token = require('../tokenizer/token'); - case 'boolean': - return v ? 'true' : 'false'; +function supportsAfterClosingBrace(token) { + return token[1][1] == 'background' || token[1][1] == 'transform' || token[1][1] == 'src'; +} - case 'number': - return isFinite(v) ? v : ''; +function afterClosingBrace(token, valueIndex) { + return token[valueIndex][1][token[valueIndex][1].length - 1] == Marker.CLOSE_ROUND_BRACKET; +} - default: - return ''; +function afterComma(token, valueIndex) { + return token[valueIndex][1] == Marker.COMMA; +} + +function afterSlash(token, valueIndex) { + return token[valueIndex][1] == Marker.FORWARD_SLASH; +} + +function beforeComma(token, valueIndex) { + return token[valueIndex + 1] && token[valueIndex + 1][1] == Marker.COMMA; +} + +function beforeSlash(token, valueIndex) { + return token[valueIndex + 1] && token[valueIndex + 1][1] == Marker.FORWARD_SLASH; +} + +function inFilter(token) { + return token[1][1] == 'filter' || token[1][1] == '-ms-filter'; +} + +function disallowsSpace(context, token, valueIndex) { + return !context.spaceAfterClosingBrace && supportsAfterClosingBrace(token) && afterClosingBrace(token, valueIndex) || + beforeSlash(token, valueIndex) || + afterSlash(token, valueIndex) || + beforeComma(token, valueIndex) || + afterComma(token, valueIndex); +} + +function rules(context, tokens) { + var store = context.store; + + for (var i = 0, l = tokens.length; i < l; i++) { + store(context, tokens[i]); + + if (i < l - 1) { + store(context, comma(context)); + } } -}; +} -module.exports = function(obj, sep, eq, name) { - sep = sep || '&'; - eq = eq || '='; - if (obj === null) { - obj = undefined; +function body(context, tokens) { + var lastPropertyAt = lastPropertyIndex(tokens); + + for (var i = 0, l = tokens.length; i < l; i++) { + property(context, tokens, i, lastPropertyAt); } +} - if (typeof obj === 'object') { - return map(objectKeys(obj), function(k) { - var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; - if (isArray(obj[k])) { - return map(obj[k], function(v) { - return ks + encodeURIComponent(stringifyPrimitive(v)); - }).join(sep); - } else { - return ks + encodeURIComponent(stringifyPrimitive(obj[k])); - } - }).join(sep); +function lastPropertyIndex(tokens) { + var index = tokens.length - 1; + for (; index >= 0; index--) { + if (tokens[index][0] != Token.COMMENT) { + break; + } } - if (!name) return ''; - return encodeURIComponent(stringifyPrimitive(name)) + eq + - encodeURIComponent(stringifyPrimitive(obj)); -}; + return index; +} -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; +function property(context, tokens, position, lastPropertyAt) { + var store = context.store; + var token = tokens[position]; + var isPropertyBlock = token[2][0] == Token.PROPERTY_BLOCK; + var needsSemicolon = position < lastPropertyAt || isPropertyBlock; + var isLast = position === lastPropertyAt; + + switch (token[0]) { + case Token.AT_RULE: + store(context, token); + store(context, position < lastPropertyAt ? semicolon(context, Breaks.AfterProperty, false) : emptyCharacter); + break; + case Token.COMMENT: + store(context, token); + break; + case Token.PROPERTY: + store(context, token[1]); + store(context, colon(context)); + value(context, token); + store(context, needsSemicolon ? semicolon(context, Breaks.AfterProperty, isLast) : emptyCharacter); + } +} -function map (xs, f) { - if (xs.map) return xs.map(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - res.push(f(xs[i], i)); +function value(context, token) { + var store = context.store; + var j, m; + + if (token[2][0] == Token.PROPERTY_BLOCK) { + store(context, openBrace(context, Breaks.AfterBlockBegins, false)); + body(context, token[2][1]); + store(context, closeBrace(context, Breaks.AfterBlockEnds, false, true)); + } else { + for (j = 2, m = token.length; j < m; j++) { + store(context, token[j]); + + if (j < m - 1 && (inFilter(token) || !disallowsSpace(context, token, j))) { + store(context, Marker.SPACE); + } + } } - return res; } -var objectKeys = Object.keys || function (obj) { - var res = []; - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); +function allowsBreak(context, where) { + return context.format && context.format.breaks[where]; +} + +function allowsSpace(context, where) { + return context.format && context.format.spaces[where]; +} + +function openBrace(context, where, needsPrefixSpace) { + if (context.format) { + context.indentBy += context.format.indentBy; + context.indentWith = context.format.indentWith.repeat(context.indentBy); + return (needsPrefixSpace && allowsSpace(context, Spaces.BeforeBlockBegins) ? Marker.SPACE : emptyCharacter) + + Marker.OPEN_CURLY_BRACKET + + (allowsBreak(context, where) ? lineBreak : emptyCharacter) + + context.indentWith; + } else { + return Marker.OPEN_CURLY_BRACKET; } - return res; -}; +} -},{}],85:[function(require,module,exports){ -'use strict'; +function closeBrace(context, where, beforeBlockEnd, isLast) { + if (context.format) { + context.indentBy -= context.format.indentBy; + context.indentWith = context.format.indentWith.repeat(context.indentBy); + return (allowsBreak(context, Breaks.AfterProperty) || beforeBlockEnd && allowsBreak(context, Breaks.BeforeBlockEnds) ? lineBreak : emptyCharacter) + + context.indentWith + + Marker.CLOSE_CURLY_BRACKET + + (isLast ? emptyCharacter : (allowsBreak(context, where) ? lineBreak : emptyCharacter) + context.indentWith); + } else { + return Marker.CLOSE_CURLY_BRACKET; + } +} -exports.decode = exports.parse = require('./decode'); -exports.encode = exports.stringify = require('./encode'); +function colon(context) { + return context.format ? + Marker.COLON + (allowsSpace(context, Spaces.BeforeValue) ? Marker.SPACE : emptyCharacter) : + Marker.COLON; +} -},{"./decode":83,"./encode":84}],86:[function(require,module,exports){ -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. +function semicolon(context, where, isLast) { + return context.format ? + Marker.SEMICOLON + (isLast || !allowsBreak(context, where) ? emptyCharacter : lineBreak + context.indentWith) : + Marker.SEMICOLON; +} -'use strict'; +function comma(context) { + return context.format ? + Marker.COMMA + (allowsBreak(context, Breaks.BetweenSelectors) ? lineBreak : emptyCharacter) + context.indentWith : + Marker.COMMA; +} -/**/ +function all(context, tokens) { + var store = context.store; + var token; + var isLast; + var i, l; -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - keys.push(key); - }return keys; + for (i = 0, l = tokens.length; i < l; i++) { + token = tokens[i]; + isLast = i == l - 1; + + switch (token[0]) { + case Token.AT_RULE: + store(context, token); + store(context, semicolon(context, Breaks.AfterAtRule, isLast)); + break; + case Token.AT_RULE_BLOCK: + rules(context, token[1]); + store(context, openBrace(context, Breaks.AfterRuleBegins, true)); + body(context, token[2]); + store(context, closeBrace(context, Breaks.AfterRuleEnds, false, isLast)); + break; + case Token.NESTED_BLOCK: + rules(context, token[1]); + store(context, openBrace(context, Breaks.AfterBlockBegins, true)); + all(context, token[2]); + store(context, closeBrace(context, Breaks.AfterBlockEnds, true, isLast)); + break; + case Token.COMMENT: + store(context, token); + store(context, allowsBreak(context, Breaks.AfterComment) ? lineBreak : emptyCharacter); + break; + case Token.RULE: + rules(context, token[1]); + store(context, openBrace(context, Breaks.AfterRuleBegins, true)); + body(context, token[2]); + store(context, closeBrace(context, Breaks.AfterRuleEnds, false, isLast)); + break; + } + } +} + +module.exports = { + all: all, + body: body, + property: property, + rules: rules, + value: value }; -/**/ -module.exports = Duplex; +},{"../options/format":59,"../tokenizer/marker":81,"../tokenizer/token":82,"os":109}],97:[function(require,module,exports){ +var helpers = require('./helpers'); -/**/ -var processNextTick = require('process-nextick-args'); -/**/ +function store(serializeContext, token) { + serializeContext.output.push(typeof token == 'string' ? token : token[1]); +} -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ +function context() { + var newContext = { + output: [], + store: store + }; -var Readable = require('./_stream_readable'); -var Writable = require('./_stream_writable'); + return newContext; +} + +function all(tokens) { + var oneTimeContext = context(); + helpers.all(oneTimeContext, tokens); + return oneTimeContext.output.join(''); +} + +function body(tokens) { + var oneTimeContext = context(); + helpers.body(oneTimeContext, tokens); + return oneTimeContext.output.join(''); +} -util.inherits(Duplex, Readable); +function property(tokens, position) { + var oneTimeContext = context(); + helpers.property(oneTimeContext, tokens, position, true); + return oneTimeContext.output.join(''); +} -var keys = objectKeys(Writable.prototype); -for (var v = 0; v < keys.length; v++) { - var method = keys[v]; - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; +function rules(tokens) { + var oneTimeContext = context(); + helpers.rules(oneTimeContext, tokens); + return oneTimeContext.output.join(''); } -function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options); +function value(tokens) { + var oneTimeContext = context(); + helpers.value(oneTimeContext, tokens); + return oneTimeContext.output.join(''); +} - Readable.call(this, options); - Writable.call(this, options); +module.exports = { + all: all, + body: body, + property: property, + rules: rules, + value: value +}; - if (options && options.readable === false) this.readable = false; +},{"./helpers":96}],98:[function(require,module,exports){ +var all = require('./helpers').all; - if (options && options.writable === false) this.writable = false; +var lineBreak = require('os').EOL; - this.allowHalfOpen = true; - if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; +function store(serializeContext, token) { + var value = typeof token == 'string' ? + token : + token[1]; + var wrap = serializeContext.wrap; - this.once('end', onend); + wrap(serializeContext, value); + track(serializeContext, value); + serializeContext.output.push(value); } -// the no-half-open enforcer -function onend() { - // if we allow half-open state, or if the writable side ended, - // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) return; - - // no more data can be written. - // But allow more writes to happen in this tick. - processNextTick(onEndNT, this); +function wrap(serializeContext, value) { + if (serializeContext.column + value.length > serializeContext.format.wrapAt) { + track(serializeContext, lineBreak); + serializeContext.output.push(lineBreak); + } } -function onEndNT(self) { - self.end(); +function track(serializeContext, value) { + var parts = value.split('\n'); + + serializeContext.line += parts.length - 1; + serializeContext.column = parts.length > 1 ? 0 : (serializeContext.column + parts.pop().length); } -function forEach(xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } +function serializeStyles(tokens, context) { + var serializeContext = { + column: 0, + format: context.options.format, + indentBy: 0, + indentWith: '', + line: 1, + output: [], + spaceAfterClosingBrace: context.options.compatibility.properties.spaceAfterClosingBrace, + store: store, + wrap: context.options.format.wrapAt ? + wrap : + function () { /* noop */ } + }; + + all(serializeContext, tokens); + + return { + styles: serializeContext.output.join('') + }; } -},{"./_stream_readable":88,"./_stream_writable":90,"core-util-is":69,"inherits":74,"process-nextick-args":80}],87:[function(require,module,exports){ -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. -'use strict'; +module.exports = serializeStyles; -module.exports = PassThrough; +},{"./helpers":96,"os":109}],99:[function(require,module,exports){ +(function (process){ +var SourceMapGenerator = require('source-map').SourceMapGenerator; +var all = require('./helpers').all; -var Transform = require('./_stream_transform'); +var lineBreak = require('os').EOL; +var isRemoteResource = require('../utils/is-remote-resource'); -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ +var isWindows = process.platform == 'win32'; -util.inherits(PassThrough, Transform); +var NIX_SEPARATOR_PATTERN = /\//g; +var UNKNOWN_SOURCE = '$stdin'; +var WINDOWS_SEPARATOR = '\\'; -function PassThrough(options) { - if (!(this instanceof PassThrough)) return new PassThrough(options); +function store(serializeContext, element) { + var fromString = typeof element == 'string'; + var value = fromString ? element : element[1]; + var mappings = fromString ? null : element[2]; + var wrap = serializeContext.wrap; - Transform.call(this, options); + wrap(serializeContext, value); + track(serializeContext, value, mappings); + serializeContext.output.push(value); } -PassThrough.prototype._transform = function (chunk, encoding, cb) { - cb(null, chunk); -}; -},{"./_stream_transform":89,"core-util-is":69,"inherits":74}],88:[function(require,module,exports){ -(function (process){ -'use strict'; +function wrap(serializeContext, value) { + if (serializeContext.column + value.length > serializeContext.format.wrapAt) { + track(serializeContext, lineBreak, false); + serializeContext.output.push(lineBreak); + } +} -module.exports = Readable; +function track(serializeContext, value, mappings) { + var parts = value.split('\n'); -/**/ -var processNextTick = require('process-nextick-args'); -/**/ + if (mappings) { + trackAllMappings(serializeContext, mappings); + } -/**/ -var isArray = require('isarray'); -/**/ + serializeContext.line += parts.length - 1; + serializeContext.column = parts.length > 1 ? 0 : (serializeContext.column + parts.pop().length); +} -/**/ -var Duplex; -/**/ +function trackAllMappings(serializeContext, mappings) { + for (var i = 0, l = mappings.length; i < l; i++) { + trackMapping(serializeContext, mappings[i]); + } +} -Readable.ReadableState = ReadableState; +function trackMapping(serializeContext, mapping) { + var line = mapping[0]; + var column = mapping[1]; + var originalSource = mapping[2]; + var source = originalSource; + var storedSource = source || UNKNOWN_SOURCE; -/**/ -var EE = require('events').EventEmitter; + if (isWindows && source && !isRemoteResource(source)) { + storedSource = source.replace(NIX_SEPARATOR_PATTERN, WINDOWS_SEPARATOR); + } -var EElistenerCount = function (emitter, type) { - return emitter.listeners(type).length; -}; -/**/ + serializeContext.outputMap.addMapping({ + generated: { + line: serializeContext.line, + column: serializeContext.column + }, + source: storedSource, + original: { + line: line, + column: column + } + }); -/**/ -var Stream; -(function () { - try { - Stream = require('st' + 'ream'); - } catch (_) {} finally { - if (!Stream) Stream = require('events').EventEmitter; + if (serializeContext.inlineSources && (originalSource in serializeContext.sourcesContent)) { + serializeContext.outputMap.setSourceContent(storedSource, serializeContext.sourcesContent[originalSource]); } -})(); -/**/ +} -var Buffer = require('buffer').Buffer; -/**/ -var bufferShim = require('buffer-shims'); -/**/ +function serializeStylesAndSourceMap(tokens, context) { + var serializeContext = { + column: 0, + format: context.options.format, + indentBy: 0, + indentWith: '', + inlineSources: context.options.sourceMapInlineSources, + line: 1, + output: [], + outputMap: new SourceMapGenerator(), + sourcesContent: context.sourcesContent, + spaceAfterClosingBrace: context.options.compatibility.properties.spaceAfterClosingBrace, + store: store, + wrap: context.options.format.wrapAt ? + wrap : + function () { /* noop */ } + }; -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ + all(serializeContext, tokens); -/**/ -var debugUtil = require('util'); -var debug = void 0; -if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog('stream'); -} else { - debug = function () {}; + return { + sourceMap: serializeContext.outputMap, + styles: serializeContext.output.join('') + }; } -/**/ -var BufferList = require('./internal/streams/BufferList'); -var StringDecoder; +module.exports = serializeStylesAndSourceMap; -util.inherits(Readable, Stream); +}).call(this,require('_process')) +},{"../utils/is-remote-resource":92,"./helpers":96,"_process":112,"os":109,"source-map":151}],100:[function(require,module,exports){ +(function (Buffer){ +// 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. -function prependListener(emitter, event, fn) { - // Sadly this is not cacheable as some libraries bundle their own - // event emitter implementation with them. - if (typeof emitter.prependListener === 'function') { - return emitter.prependListener(event, fn); - } else { - // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. - if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. + +function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); } + return objectToString(arg) === '[object Array]'; } +exports.isArray = isArray; -function ReadableState(options, stream) { - Duplex = Duplex || require('./_stream_duplex'); +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; - options = options || {}; +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; - if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode; +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - var hwm = options.highWaterMark; - var defaultHwm = this.objectMode ? 16 : 16 * 1024; - this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; - // cast to ints. - this.highWaterMark = ~ ~this.highWaterMark; +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; - // A linked list is used to store data chunks instead of an array because the - // linked list can remove elements from the beginning faster than - // array.shift() - this.buffer = new BufferList(); - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; - // when piping, we only care about 'readable' events that happen - // after read()ing all the bytes and not getting any pushback. - this.ranOut = false; +exports.isBuffer = Buffer.isBuffer; - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; +function objectToString(o) { + return Object.prototype.toString.call(o); +} - // if true, a maybeReadMore has been scheduled - this.readingMore = false; +}).call(this,{"isBuffer":require("../../is-buffer/index.js")}) +},{"../../is-buffer/index.js":106}],101:[function(require,module,exports){ +// 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. - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } +function EventEmitter() { + this._events = this._events || {}; + this._maxListeners = this._maxListeners || undefined; } +module.exports = EventEmitter; -function Readable(options) { - Duplex = Duplex || require('./_stream_duplex'); +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; - if (!(this instanceof Readable)) return new Readable(options); +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._maxListeners = undefined; - this._readableState = new ReadableState(options, this); +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +EventEmitter.defaultMaxListeners = 10; - // legacy - this.readable = true; +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function(n) { + if (!isNumber(n) || n < 0 || isNaN(n)) + throw TypeError('n must be a positive number'); + this._maxListeners = n; + return this; +}; - if (options && typeof options.read === 'function') this._read = options.read; +EventEmitter.prototype.emit = function(type) { + var er, handler, len, args, i, listeners; - Stream.call(this); -} + if (!this._events) + this._events = {}; -// Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. -Readable.prototype.push = function (chunk, encoding) { - var state = this._readableState; + // If there is no 'error' event listener then throw. + if (type === 'error') { + if (!this._events.error || + (isObject(this._events.error) && !this._events.error.length)) { + er = arguments[1]; + if (er instanceof Error) { + throw er; // Unhandled 'error' event + } else { + // At least give some kind of context to the user + var err = new Error('Uncaught, unspecified "error" event. (' + er + ')'); + err.context = er; + throw err; + } + } + } - if (!state.objectMode && typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = bufferShim.from(chunk, encoding); - encoding = ''; + handler = this._events[type]; + + if (isUndefined(handler)) + return false; + + if (isFunction(handler)) { + switch (arguments.length) { + // fast cases + case 1: + handler.call(this); + break; + case 2: + handler.call(this, arguments[1]); + break; + case 3: + handler.call(this, arguments[1], arguments[2]); + break; + // slower + default: + args = Array.prototype.slice.call(arguments, 1); + handler.apply(this, args); } + } else if (isObject(handler)) { + args = Array.prototype.slice.call(arguments, 1); + listeners = handler.slice(); + len = listeners.length; + for (i = 0; i < len; i++) + listeners[i].apply(this, args); } - return readableAddChunk(this, state, chunk, encoding, false); + return true; }; -// Unshift should *always* be something directly out of read() -Readable.prototype.unshift = function (chunk) { - var state = this._readableState; - return readableAddChunk(this, state, chunk, '', true); -}; +EventEmitter.prototype.addListener = function(type, listener) { + var m; -Readable.prototype.isPaused = function () { - return this._readableState.flowing === false; -}; + if (!isFunction(listener)) + throw TypeError('listener must be a function'); -function readableAddChunk(stream, state, chunk, encoding, addToFront) { - var er = chunkInvalid(state, chunk); - if (er) { - stream.emit('error', er); - } else if (chunk === null) { - state.reading = false; - onEofChunk(stream, state); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (state.ended && !addToFront) { - var e = new Error('stream.push() after EOF'); - stream.emit('error', e); - } else if (state.endEmitted && addToFront) { - var _e = new Error('stream.unshift() after end event'); - stream.emit('error', _e); - } else { - var skipAdd; - if (state.decoder && !addToFront && !encoding) { - chunk = state.decoder.write(chunk); - skipAdd = !state.objectMode && chunk.length === 0; - } + if (!this._events) + this._events = {}; - if (!addToFront) state.reading = false; + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (this._events.newListener) + this.emit('newListener', type, + isFunction(listener.listener) ? + listener.listener : listener); - // Don't add to the buffer if we've decoded to an empty string chunk and - // we're not in object mode - if (!skipAdd) { - // if we want the data now, just emit it. - if (state.flowing && state.length === 0 && !state.sync) { - stream.emit('data', chunk); - stream.read(0); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + if (!this._events[type]) + // Optimize the case of one listener. Don't need the extra array object. + this._events[type] = listener; + else if (isObject(this._events[type])) + // If we've already got an array, just append. + this._events[type].push(listener); + else + // Adding the second element, need to change to array. + this._events[type] = [this._events[type], listener]; - if (state.needReadable) emitReadable(stream); - } - } + // Check for listener leak + if (isObject(this._events[type]) && !this._events[type].warned) { + if (!isUndefined(this._maxListeners)) { + m = this._maxListeners; + } else { + m = EventEmitter.defaultMaxListeners; + } - maybeReadMore(stream, state); + if (m && m > 0 && this._events[type].length > m) { + this._events[type].warned = true; + console.error('(node) warning: possible EventEmitter memory ' + + 'leak detected. %d listeners added. ' + + 'Use emitter.setMaxListeners() to increase limit.', + this._events[type].length); + if (typeof console.trace === 'function') { + // not supported in IE 10 + console.trace(); + } } - } else if (!addToFront) { - state.reading = false; } - return needMoreData(state); -} + return this; +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.once = function(type, listener) { + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + var fired = false; + + function g() { + this.removeListener(type, g); + + if (!fired) { + fired = true; + listener.apply(this, arguments); + } + } -// if it's past the high water mark, we can push in some more. -// Also, if we have no data yet, we can stand some -// more bytes. This is to work around cases where hwm=0, -// such as the repl. Also, if the push() triggered a -// readable event, and the user called read(largeNumber) such that -// needReadable was set, then we ought to push more, so that another -// 'readable' event will be triggered. -function needMoreData(state) { - return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); -} + g.listener = listener; + this.on(type, g); -// backwards compatibility. -Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this._readableState.decoder = new StringDecoder(enc); - this._readableState.encoding = enc; return this; }; -// Don't raise the hwm > 8MB -var MAX_HWM = 0x800000; -function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - // Get the next highest power of 2 to prevent increasing hwm excessively in - // tiny amounts - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } - return n; -} +// emits a 'removeListener' event iff the listener was removed +EventEmitter.prototype.removeListener = function(type, listener) { + var list, position, length, i; -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function howMuchToRead(n, state) { - if (n <= 0 || state.length === 0 && state.ended) return 0; - if (state.objectMode) return 1; - if (n !== n) { - // Only flow one buffer at a time - if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; - } - // If we're asking for more than the current hwm, then raise the hwm. - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); - if (n <= state.length) return n; - // Don't have enough - if (!state.ended) { - state.needReadable = true; - return 0; - } - return state.length; -} + if (!isFunction(listener)) + throw TypeError('listener must be a function'); -// you can override either this method, or the async _read(n) below. -Readable.prototype.read = function (n) { - debug('read', n); - n = parseInt(n, 10); - var state = this._readableState; - var nOrig = n; + if (!this._events || !this._events[type]) + return this; - if (n !== 0) state.emittedReadable = false; + list = this._events[type]; + length = list.length; + position = -1; - // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); - return null; - } + if (list === listener || + (isFunction(list.listener) && list.listener === listener)) { + delete this._events[type]; + if (this._events.removeListener) + this.emit('removeListener', type, listener); - n = howMuchToRead(n, state); + } else if (isObject(list)) { + for (i = length; i-- > 0;) { + if (list[i] === listener || + (list[i].listener && list[i].listener === listener)) { + position = i; + break; + } + } - // if we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - if (state.length === 0) endReadable(this); - return null; + if (position < 0) + return this; + + if (list.length === 1) { + list.length = 0; + delete this._events[type]; + } else { + list.splice(position, 1); + } + + if (this._events.removeListener) + this.emit('removeListener', type, listener); } - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. + return this; +}; - // if we need a readable event, then we need to do some reading. - var doRead = state.needReadable; - debug('need readable', doRead); +EventEmitter.prototype.removeAllListeners = function(type) { + var key, listeners; - // if we currently have less than the highWaterMark, then also read some - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } + if (!this._events) + return this; - // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } else if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (state.length === 0) state.needReadable = true; - // call internal read method - this._read(state.highWaterMark); - state.sync = false; - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (!state.reading) n = howMuchToRead(nOrig, state); + // not listening for removeListener, no need to emit + if (!this._events.removeListener) { + if (arguments.length === 0) + this._events = {}; + else if (this._events[type]) + delete this._events[type]; + return this; } - var ret; - if (n > 0) ret = fromList(n, state);else ret = null; - - if (ret === null) { - state.needReadable = true; - n = 0; - } else { - state.length -= n; + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + for (key in this._events) { + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = {}; + return this; } - if (state.length === 0) { - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (!state.ended) state.needReadable = true; + listeners = this._events[type]; - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended) endReadable(this); + if (isFunction(listeners)) { + this.removeListener(type, listeners); + } else if (listeners) { + // LIFO order + while (listeners.length) + this.removeListener(type, listeners[listeners.length - 1]); } + delete this._events[type]; - if (ret !== null) this.emit('data', ret); + return this; +}; +EventEmitter.prototype.listeners = function(type) { + var ret; + if (!this._events || !this._events[type]) + ret = []; + else if (isFunction(this._events[type])) + ret = [this._events[type]]; + else + ret = this._events[type].slice(); return ret; }; -function chunkInvalid(state, chunk) { - var er = null; - if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - return er; -} +EventEmitter.prototype.listenerCount = function(type) { + if (this._events) { + var evlistener = this._events[type]; -function onEofChunk(stream, state) { - if (state.ended) return; - if (state.decoder) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } + if (isFunction(evlistener)) + return 1; + else if (evlistener) + return evlistener.length; } - state.ended = true; - - // emit 'readable' now to make sure it gets picked up. - emitReadable(stream); -} + return 0; +}; -// Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. -function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream); - } -} +EventEmitter.listenerCount = function(emitter, type) { + return emitter.listenerCount(type); +}; -function emitReadable_(stream) { - debug('emit readable'); - stream.emit('readable'); - flow(stream); +function isFunction(arg) { + return typeof arg === 'function'; } -// at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - processNextTick(maybeReadMore_, stream, state); - } +function isNumber(arg) { + return typeof arg === 'number'; } -function maybeReadMore_(stream, state) { - var len = state.length; - while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) - // didn't get any data, stop spinning. - break;else len = state.length; - } - state.readingMore = false; +function isObject(arg) { + return typeof arg === 'object' && arg !== null; } -// abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. -Readable.prototype._read = function (n) { - this.emit('error', new Error('_read() is not implemented')); -}; - -Readable.prototype.pipe = function (dest, pipeOpts) { - var src = this; - var state = this._readableState; +function isUndefined(arg) { + return arg === void 0; +} - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); +},{}],102:[function(require,module,exports){ +(function (global){ +/*! https://mths.be/he v1.1.1 by @mathias | MIT license */ +;(function(root) { - var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + // Detect free variables `exports`. + var freeExports = typeof exports == 'object' && exports; - var endFn = doEnd ? onend : cleanup; - if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn); + // Detect free variable `module`. + var freeModule = typeof module == 'object' && module && + module.exports == freeExports && module; - dest.on('unpipe', onunpipe); - function onunpipe(readable) { - debug('onunpipe'); - if (readable === src) { - cleanup(); - } - } + // Detect free variable `global`, from Node.js or Browserified code, + // and use it as `root`. + var freeGlobal = typeof global == 'object' && global; + if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { + root = freeGlobal; + } - function onend() { - debug('onend'); - dest.end(); - } + /*--------------------------------------------------------------------------*/ - // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); + // All astral symbols. + var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; + // All ASCII symbols (not just printable ASCII) except those listed in the + // first column of the overrides table. + // https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides + var regexAsciiWhitelist = /[\x01-\x7F]/g; + // All BMP symbols that are not ASCII newlines, printable ASCII symbols, or + // code points listed in the first column of the overrides table on + // https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides. + var regexBmpWhitelist = /[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g; - var cleanedUp = false; - function cleanup() { - debug('cleanup'); - // cleanup event handlers once the pipe is broken - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', cleanup); - src.removeListener('data', ondata); + var regexEncodeNonAscii = /<\u20D2|=\u20E5|>\u20D2|\u205F\u200A|\u219D\u0338|\u2202\u0338|\u2220\u20D2|\u2229\uFE00|\u222A\uFE00|\u223C\u20D2|\u223D\u0331|\u223E\u0333|\u2242\u0338|\u224B\u0338|\u224D\u20D2|\u224E\u0338|\u224F\u0338|\u2250\u0338|\u2261\u20E5|\u2264\u20D2|\u2265\u20D2|\u2266\u0338|\u2267\u0338|\u2268\uFE00|\u2269\uFE00|\u226A\u0338|\u226A\u20D2|\u226B\u0338|\u226B\u20D2|\u227F\u0338|\u2282\u20D2|\u2283\u20D2|\u228A\uFE00|\u228B\uFE00|\u228F\u0338|\u2290\u0338|\u2293\uFE00|\u2294\uFE00|\u22B4\u20D2|\u22B5\u20D2|\u22D8\u0338|\u22D9\u0338|\u22DA\uFE00|\u22DB\uFE00|\u22F5\u0338|\u22F9\u0338|\u2933\u0338|\u29CF\u0338|\u29D0\u0338|\u2A6D\u0338|\u2A70\u0338|\u2A7D\u0338|\u2A7E\u0338|\u2AA1\u0338|\u2AA2\u0338|\u2AAC\uFE00|\u2AAD\uFE00|\u2AAF\u0338|\u2AB0\u0338|\u2AC5\u0338|\u2AC6\u0338|\u2ACB\uFE00|\u2ACC\uFE00|\u2AFD\u20E5|[\xA0-\u0113\u0116-\u0122\u0124-\u012B\u012E-\u014D\u0150-\u017E\u0192\u01B5\u01F5\u0237\u02C6\u02C7\u02D8-\u02DD\u0311\u0391-\u03A1\u03A3-\u03A9\u03B1-\u03C9\u03D1\u03D2\u03D5\u03D6\u03DC\u03DD\u03F0\u03F1\u03F5\u03F6\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E\u045F\u2002-\u2005\u2007-\u2010\u2013-\u2016\u2018-\u201A\u201C-\u201E\u2020-\u2022\u2025\u2026\u2030-\u2035\u2039\u203A\u203E\u2041\u2043\u2044\u204F\u2057\u205F-\u2063\u20AC\u20DB\u20DC\u2102\u2105\u210A-\u2113\u2115-\u211E\u2122\u2124\u2127-\u2129\u212C\u212D\u212F-\u2131\u2133-\u2138\u2145-\u2148\u2153-\u215E\u2190-\u219B\u219D-\u21A7\u21A9-\u21AE\u21B0-\u21B3\u21B5-\u21B7\u21BA-\u21DB\u21DD\u21E4\u21E5\u21F5\u21FD-\u2205\u2207-\u2209\u220B\u220C\u220F-\u2214\u2216-\u2218\u221A\u221D-\u2238\u223A-\u2257\u2259\u225A\u225C\u225F-\u2262\u2264-\u228B\u228D-\u229B\u229D-\u22A5\u22A7-\u22B0\u22B2-\u22BB\u22BD-\u22DB\u22DE-\u22E3\u22E6-\u22F7\u22F9-\u22FE\u2305\u2306\u2308-\u2310\u2312\u2313\u2315\u2316\u231C-\u231F\u2322\u2323\u232D\u232E\u2336\u233D\u233F\u237C\u23B0\u23B1\u23B4-\u23B6\u23DC-\u23DF\u23E2\u23E7\u2423\u24C8\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2550-\u256C\u2580\u2584\u2588\u2591-\u2593\u25A1\u25AA\u25AB\u25AD\u25AE\u25B1\u25B3-\u25B5\u25B8\u25B9\u25BD-\u25BF\u25C2\u25C3\u25CA\u25CB\u25EC\u25EF\u25F8-\u25FC\u2605\u2606\u260E\u2640\u2642\u2660\u2663\u2665\u2666\u266A\u266D-\u266F\u2713\u2717\u2720\u2736\u2758\u2772\u2773\u27C8\u27C9\u27E6-\u27ED\u27F5-\u27FA\u27FC\u27FF\u2902-\u2905\u290C-\u2913\u2916\u2919-\u2920\u2923-\u292A\u2933\u2935-\u2939\u293C\u293D\u2945\u2948-\u294B\u294E-\u2976\u2978\u2979\u297B-\u297F\u2985\u2986\u298B-\u2996\u299A\u299C\u299D\u29A4-\u29B7\u29B9\u29BB\u29BC\u29BE-\u29C5\u29C9\u29CD-\u29D0\u29DC-\u29DE\u29E3-\u29E5\u29EB\u29F4\u29F6\u2A00-\u2A02\u2A04\u2A06\u2A0C\u2A0D\u2A10-\u2A17\u2A22-\u2A27\u2A29\u2A2A\u2A2D-\u2A31\u2A33-\u2A3C\u2A3F\u2A40\u2A42-\u2A4D\u2A50\u2A53-\u2A58\u2A5A-\u2A5D\u2A5F\u2A66\u2A6A\u2A6D-\u2A75\u2A77-\u2A9A\u2A9D-\u2AA2\u2AA4-\u2AB0\u2AB3-\u2AC8\u2ACB\u2ACC\u2ACF-\u2ADB\u2AE4\u2AE6-\u2AE9\u2AEB-\u2AF3\u2AFD\uFB00-\uFB04]|\uD835[\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDD6B]/g; + var encodeMap = {'\xAD':'shy','\u200C':'zwnj','\u200D':'zwj','\u200E':'lrm','\u2063':'ic','\u2062':'it','\u2061':'af','\u200F':'rlm','\u200B':'ZeroWidthSpace','\u2060':'NoBreak','\u0311':'DownBreve','\u20DB':'tdot','\u20DC':'DotDot','\t':'Tab','\n':'NewLine','\u2008':'puncsp','\u205F':'MediumSpace','\u2009':'thinsp','\u200A':'hairsp','\u2004':'emsp13','\u2002':'ensp','\u2005':'emsp14','\u2003':'emsp','\u2007':'numsp','\xA0':'nbsp','\u205F\u200A':'ThickSpace','\u203E':'oline','_':'lowbar','\u2010':'dash','\u2013':'ndash','\u2014':'mdash','\u2015':'horbar',',':'comma',';':'semi','\u204F':'bsemi',':':'colon','\u2A74':'Colone','!':'excl','\xA1':'iexcl','?':'quest','\xBF':'iquest','.':'period','\u2025':'nldr','\u2026':'mldr','\xB7':'middot','\'':'apos','\u2018':'lsquo','\u2019':'rsquo','\u201A':'sbquo','\u2039':'lsaquo','\u203A':'rsaquo','"':'quot','\u201C':'ldquo','\u201D':'rdquo','\u201E':'bdquo','\xAB':'laquo','\xBB':'raquo','(':'lpar',')':'rpar','[':'lsqb',']':'rsqb','{':'lcub','}':'rcub','\u2308':'lceil','\u2309':'rceil','\u230A':'lfloor','\u230B':'rfloor','\u2985':'lopar','\u2986':'ropar','\u298B':'lbrke','\u298C':'rbrke','\u298D':'lbrkslu','\u298E':'rbrksld','\u298F':'lbrksld','\u2990':'rbrkslu','\u2991':'langd','\u2992':'rangd','\u2993':'lparlt','\u2994':'rpargt','\u2995':'gtlPar','\u2996':'ltrPar','\u27E6':'lobrk','\u27E7':'robrk','\u27E8':'lang','\u27E9':'rang','\u27EA':'Lang','\u27EB':'Rang','\u27EC':'loang','\u27ED':'roang','\u2772':'lbbrk','\u2773':'rbbrk','\u2016':'Vert','\xA7':'sect','\xB6':'para','@':'commat','*':'ast','/':'sol','undefined':null,'&':'amp','#':'num','%':'percnt','\u2030':'permil','\u2031':'pertenk','\u2020':'dagger','\u2021':'Dagger','\u2022':'bull','\u2043':'hybull','\u2032':'prime','\u2033':'Prime','\u2034':'tprime','\u2057':'qprime','\u2035':'bprime','\u2041':'caret','`':'grave','\xB4':'acute','\u02DC':'tilde','^':'Hat','\xAF':'macr','\u02D8':'breve','\u02D9':'dot','\xA8':'die','\u02DA':'ring','\u02DD':'dblac','\xB8':'cedil','\u02DB':'ogon','\u02C6':'circ','\u02C7':'caron','\xB0':'deg','\xA9':'copy','\xAE':'reg','\u2117':'copysr','\u2118':'wp','\u211E':'rx','\u2127':'mho','\u2129':'iiota','\u2190':'larr','\u219A':'nlarr','\u2192':'rarr','\u219B':'nrarr','\u2191':'uarr','\u2193':'darr','\u2194':'harr','\u21AE':'nharr','\u2195':'varr','\u2196':'nwarr','\u2197':'nearr','\u2198':'searr','\u2199':'swarr','\u219D':'rarrw','\u219D\u0338':'nrarrw','\u219E':'Larr','\u219F':'Uarr','\u21A0':'Rarr','\u21A1':'Darr','\u21A2':'larrtl','\u21A3':'rarrtl','\u21A4':'mapstoleft','\u21A5':'mapstoup','\u21A6':'map','\u21A7':'mapstodown','\u21A9':'larrhk','\u21AA':'rarrhk','\u21AB':'larrlp','\u21AC':'rarrlp','\u21AD':'harrw','\u21B0':'lsh','\u21B1':'rsh','\u21B2':'ldsh','\u21B3':'rdsh','\u21B5':'crarr','\u21B6':'cularr','\u21B7':'curarr','\u21BA':'olarr','\u21BB':'orarr','\u21BC':'lharu','\u21BD':'lhard','\u21BE':'uharr','\u21BF':'uharl','\u21C0':'rharu','\u21C1':'rhard','\u21C2':'dharr','\u21C3':'dharl','\u21C4':'rlarr','\u21C5':'udarr','\u21C6':'lrarr','\u21C7':'llarr','\u21C8':'uuarr','\u21C9':'rrarr','\u21CA':'ddarr','\u21CB':'lrhar','\u21CC':'rlhar','\u21D0':'lArr','\u21CD':'nlArr','\u21D1':'uArr','\u21D2':'rArr','\u21CF':'nrArr','\u21D3':'dArr','\u21D4':'iff','\u21CE':'nhArr','\u21D5':'vArr','\u21D6':'nwArr','\u21D7':'neArr','\u21D8':'seArr','\u21D9':'swArr','\u21DA':'lAarr','\u21DB':'rAarr','\u21DD':'zigrarr','\u21E4':'larrb','\u21E5':'rarrb','\u21F5':'duarr','\u21FD':'loarr','\u21FE':'roarr','\u21FF':'hoarr','\u2200':'forall','\u2201':'comp','\u2202':'part','\u2202\u0338':'npart','\u2203':'exist','\u2204':'nexist','\u2205':'empty','\u2207':'Del','\u2208':'in','\u2209':'notin','\u220B':'ni','\u220C':'notni','\u03F6':'bepsi','\u220F':'prod','\u2210':'coprod','\u2211':'sum','+':'plus','\xB1':'pm','\xF7':'div','\xD7':'times','<':'lt','\u226E':'nlt','<\u20D2':'nvlt','=':'equals','\u2260':'ne','=\u20E5':'bne','\u2A75':'Equal','>':'gt','\u226F':'ngt','>\u20D2':'nvgt','\xAC':'not','|':'vert','\xA6':'brvbar','\u2212':'minus','\u2213':'mp','\u2214':'plusdo','\u2044':'frasl','\u2216':'setmn','\u2217':'lowast','\u2218':'compfn','\u221A':'Sqrt','\u221D':'prop','\u221E':'infin','\u221F':'angrt','\u2220':'ang','\u2220\u20D2':'nang','\u2221':'angmsd','\u2222':'angsph','\u2223':'mid','\u2224':'nmid','\u2225':'par','\u2226':'npar','\u2227':'and','\u2228':'or','\u2229':'cap','\u2229\uFE00':'caps','\u222A':'cup','\u222A\uFE00':'cups','\u222B':'int','\u222C':'Int','\u222D':'tint','\u2A0C':'qint','\u222E':'oint','\u222F':'Conint','\u2230':'Cconint','\u2231':'cwint','\u2232':'cwconint','\u2233':'awconint','\u2234':'there4','\u2235':'becaus','\u2236':'ratio','\u2237':'Colon','\u2238':'minusd','\u223A':'mDDot','\u223B':'homtht','\u223C':'sim','\u2241':'nsim','\u223C\u20D2':'nvsim','\u223D':'bsim','\u223D\u0331':'race','\u223E':'ac','\u223E\u0333':'acE','\u223F':'acd','\u2240':'wr','\u2242':'esim','\u2242\u0338':'nesim','\u2243':'sime','\u2244':'nsime','\u2245':'cong','\u2247':'ncong','\u2246':'simne','\u2248':'ap','\u2249':'nap','\u224A':'ape','\u224B':'apid','\u224B\u0338':'napid','\u224C':'bcong','\u224D':'CupCap','\u226D':'NotCupCap','\u224D\u20D2':'nvap','\u224E':'bump','\u224E\u0338':'nbump','\u224F':'bumpe','\u224F\u0338':'nbumpe','\u2250':'doteq','\u2250\u0338':'nedot','\u2251':'eDot','\u2252':'efDot','\u2253':'erDot','\u2254':'colone','\u2255':'ecolon','\u2256':'ecir','\u2257':'cire','\u2259':'wedgeq','\u225A':'veeeq','\u225C':'trie','\u225F':'equest','\u2261':'equiv','\u2262':'nequiv','\u2261\u20E5':'bnequiv','\u2264':'le','\u2270':'nle','\u2264\u20D2':'nvle','\u2265':'ge','\u2271':'nge','\u2265\u20D2':'nvge','\u2266':'lE','\u2266\u0338':'nlE','\u2267':'gE','\u2267\u0338':'ngE','\u2268\uFE00':'lvnE','\u2268':'lnE','\u2269':'gnE','\u2269\uFE00':'gvnE','\u226A':'ll','\u226A\u0338':'nLtv','\u226A\u20D2':'nLt','\u226B':'gg','\u226B\u0338':'nGtv','\u226B\u20D2':'nGt','\u226C':'twixt','\u2272':'lsim','\u2274':'nlsim','\u2273':'gsim','\u2275':'ngsim','\u2276':'lg','\u2278':'ntlg','\u2277':'gl','\u2279':'ntgl','\u227A':'pr','\u2280':'npr','\u227B':'sc','\u2281':'nsc','\u227C':'prcue','\u22E0':'nprcue','\u227D':'sccue','\u22E1':'nsccue','\u227E':'prsim','\u227F':'scsim','\u227F\u0338':'NotSucceedsTilde','\u2282':'sub','\u2284':'nsub','\u2282\u20D2':'vnsub','\u2283':'sup','\u2285':'nsup','\u2283\u20D2':'vnsup','\u2286':'sube','\u2288':'nsube','\u2287':'supe','\u2289':'nsupe','\u228A\uFE00':'vsubne','\u228A':'subne','\u228B\uFE00':'vsupne','\u228B':'supne','\u228D':'cupdot','\u228E':'uplus','\u228F':'sqsub','\u228F\u0338':'NotSquareSubset','\u2290':'sqsup','\u2290\u0338':'NotSquareSuperset','\u2291':'sqsube','\u22E2':'nsqsube','\u2292':'sqsupe','\u22E3':'nsqsupe','\u2293':'sqcap','\u2293\uFE00':'sqcaps','\u2294':'sqcup','\u2294\uFE00':'sqcups','\u2295':'oplus','\u2296':'ominus','\u2297':'otimes','\u2298':'osol','\u2299':'odot','\u229A':'ocir','\u229B':'oast','\u229D':'odash','\u229E':'plusb','\u229F':'minusb','\u22A0':'timesb','\u22A1':'sdotb','\u22A2':'vdash','\u22AC':'nvdash','\u22A3':'dashv','\u22A4':'top','\u22A5':'bot','\u22A7':'models','\u22A8':'vDash','\u22AD':'nvDash','\u22A9':'Vdash','\u22AE':'nVdash','\u22AA':'Vvdash','\u22AB':'VDash','\u22AF':'nVDash','\u22B0':'prurel','\u22B2':'vltri','\u22EA':'nltri','\u22B3':'vrtri','\u22EB':'nrtri','\u22B4':'ltrie','\u22EC':'nltrie','\u22B4\u20D2':'nvltrie','\u22B5':'rtrie','\u22ED':'nrtrie','\u22B5\u20D2':'nvrtrie','\u22B6':'origof','\u22B7':'imof','\u22B8':'mumap','\u22B9':'hercon','\u22BA':'intcal','\u22BB':'veebar','\u22BD':'barvee','\u22BE':'angrtvb','\u22BF':'lrtri','\u22C0':'Wedge','\u22C1':'Vee','\u22C2':'xcap','\u22C3':'xcup','\u22C4':'diam','\u22C5':'sdot','\u22C6':'Star','\u22C7':'divonx','\u22C8':'bowtie','\u22C9':'ltimes','\u22CA':'rtimes','\u22CB':'lthree','\u22CC':'rthree','\u22CD':'bsime','\u22CE':'cuvee','\u22CF':'cuwed','\u22D0':'Sub','\u22D1':'Sup','\u22D2':'Cap','\u22D3':'Cup','\u22D4':'fork','\u22D5':'epar','\u22D6':'ltdot','\u22D7':'gtdot','\u22D8':'Ll','\u22D8\u0338':'nLl','\u22D9':'Gg','\u22D9\u0338':'nGg','\u22DA\uFE00':'lesg','\u22DA':'leg','\u22DB':'gel','\u22DB\uFE00':'gesl','\u22DE':'cuepr','\u22DF':'cuesc','\u22E6':'lnsim','\u22E7':'gnsim','\u22E8':'prnsim','\u22E9':'scnsim','\u22EE':'vellip','\u22EF':'ctdot','\u22F0':'utdot','\u22F1':'dtdot','\u22F2':'disin','\u22F3':'isinsv','\u22F4':'isins','\u22F5':'isindot','\u22F5\u0338':'notindot','\u22F6':'notinvc','\u22F7':'notinvb','\u22F9':'isinE','\u22F9\u0338':'notinE','\u22FA':'nisd','\u22FB':'xnis','\u22FC':'nis','\u22FD':'notnivc','\u22FE':'notnivb','\u2305':'barwed','\u2306':'Barwed','\u230C':'drcrop','\u230D':'dlcrop','\u230E':'urcrop','\u230F':'ulcrop','\u2310':'bnot','\u2312':'profline','\u2313':'profsurf','\u2315':'telrec','\u2316':'target','\u231C':'ulcorn','\u231D':'urcorn','\u231E':'dlcorn','\u231F':'drcorn','\u2322':'frown','\u2323':'smile','\u232D':'cylcty','\u232E':'profalar','\u2336':'topbot','\u233D':'ovbar','\u233F':'solbar','\u237C':'angzarr','\u23B0':'lmoust','\u23B1':'rmoust','\u23B4':'tbrk','\u23B5':'bbrk','\u23B6':'bbrktbrk','\u23DC':'OverParenthesis','\u23DD':'UnderParenthesis','\u23DE':'OverBrace','\u23DF':'UnderBrace','\u23E2':'trpezium','\u23E7':'elinters','\u2423':'blank','\u2500':'boxh','\u2502':'boxv','\u250C':'boxdr','\u2510':'boxdl','\u2514':'boxur','\u2518':'boxul','\u251C':'boxvr','\u2524':'boxvl','\u252C':'boxhd','\u2534':'boxhu','\u253C':'boxvh','\u2550':'boxH','\u2551':'boxV','\u2552':'boxdR','\u2553':'boxDr','\u2554':'boxDR','\u2555':'boxdL','\u2556':'boxDl','\u2557':'boxDL','\u2558':'boxuR','\u2559':'boxUr','\u255A':'boxUR','\u255B':'boxuL','\u255C':'boxUl','\u255D':'boxUL','\u255E':'boxvR','\u255F':'boxVr','\u2560':'boxVR','\u2561':'boxvL','\u2562':'boxVl','\u2563':'boxVL','\u2564':'boxHd','\u2565':'boxhD','\u2566':'boxHD','\u2567':'boxHu','\u2568':'boxhU','\u2569':'boxHU','\u256A':'boxvH','\u256B':'boxVh','\u256C':'boxVH','\u2580':'uhblk','\u2584':'lhblk','\u2588':'block','\u2591':'blk14','\u2592':'blk12','\u2593':'blk34','\u25A1':'squ','\u25AA':'squf','\u25AB':'EmptyVerySmallSquare','\u25AD':'rect','\u25AE':'marker','\u25B1':'fltns','\u25B3':'xutri','\u25B4':'utrif','\u25B5':'utri','\u25B8':'rtrif','\u25B9':'rtri','\u25BD':'xdtri','\u25BE':'dtrif','\u25BF':'dtri','\u25C2':'ltrif','\u25C3':'ltri','\u25CA':'loz','\u25CB':'cir','\u25EC':'tridot','\u25EF':'xcirc','\u25F8':'ultri','\u25F9':'urtri','\u25FA':'lltri','\u25FB':'EmptySmallSquare','\u25FC':'FilledSmallSquare','\u2605':'starf','\u2606':'star','\u260E':'phone','\u2640':'female','\u2642':'male','\u2660':'spades','\u2663':'clubs','\u2665':'hearts','\u2666':'diams','\u266A':'sung','\u2713':'check','\u2717':'cross','\u2720':'malt','\u2736':'sext','\u2758':'VerticalSeparator','\u27C8':'bsolhsub','\u27C9':'suphsol','\u27F5':'xlarr','\u27F6':'xrarr','\u27F7':'xharr','\u27F8':'xlArr','\u27F9':'xrArr','\u27FA':'xhArr','\u27FC':'xmap','\u27FF':'dzigrarr','\u2902':'nvlArr','\u2903':'nvrArr','\u2904':'nvHarr','\u2905':'Map','\u290C':'lbarr','\u290D':'rbarr','\u290E':'lBarr','\u290F':'rBarr','\u2910':'RBarr','\u2911':'DDotrahd','\u2912':'UpArrowBar','\u2913':'DownArrowBar','\u2916':'Rarrtl','\u2919':'latail','\u291A':'ratail','\u291B':'lAtail','\u291C':'rAtail','\u291D':'larrfs','\u291E':'rarrfs','\u291F':'larrbfs','\u2920':'rarrbfs','\u2923':'nwarhk','\u2924':'nearhk','\u2925':'searhk','\u2926':'swarhk','\u2927':'nwnear','\u2928':'toea','\u2929':'tosa','\u292A':'swnwar','\u2933':'rarrc','\u2933\u0338':'nrarrc','\u2935':'cudarrr','\u2936':'ldca','\u2937':'rdca','\u2938':'cudarrl','\u2939':'larrpl','\u293C':'curarrm','\u293D':'cularrp','\u2945':'rarrpl','\u2948':'harrcir','\u2949':'Uarrocir','\u294A':'lurdshar','\u294B':'ldrushar','\u294E':'LeftRightVector','\u294F':'RightUpDownVector','\u2950':'DownLeftRightVector','\u2951':'LeftUpDownVector','\u2952':'LeftVectorBar','\u2953':'RightVectorBar','\u2954':'RightUpVectorBar','\u2955':'RightDownVectorBar','\u2956':'DownLeftVectorBar','\u2957':'DownRightVectorBar','\u2958':'LeftUpVectorBar','\u2959':'LeftDownVectorBar','\u295A':'LeftTeeVector','\u295B':'RightTeeVector','\u295C':'RightUpTeeVector','\u295D':'RightDownTeeVector','\u295E':'DownLeftTeeVector','\u295F':'DownRightTeeVector','\u2960':'LeftUpTeeVector','\u2961':'LeftDownTeeVector','\u2962':'lHar','\u2963':'uHar','\u2964':'rHar','\u2965':'dHar','\u2966':'luruhar','\u2967':'ldrdhar','\u2968':'ruluhar','\u2969':'rdldhar','\u296A':'lharul','\u296B':'llhard','\u296C':'rharul','\u296D':'lrhard','\u296E':'udhar','\u296F':'duhar','\u2970':'RoundImplies','\u2971':'erarr','\u2972':'simrarr','\u2973':'larrsim','\u2974':'rarrsim','\u2975':'rarrap','\u2976':'ltlarr','\u2978':'gtrarr','\u2979':'subrarr','\u297B':'suplarr','\u297C':'lfisht','\u297D':'rfisht','\u297E':'ufisht','\u297F':'dfisht','\u299A':'vzigzag','\u299C':'vangrt','\u299D':'angrtvbd','\u29A4':'ange','\u29A5':'range','\u29A6':'dwangle','\u29A7':'uwangle','\u29A8':'angmsdaa','\u29A9':'angmsdab','\u29AA':'angmsdac','\u29AB':'angmsdad','\u29AC':'angmsdae','\u29AD':'angmsdaf','\u29AE':'angmsdag','\u29AF':'angmsdah','\u29B0':'bemptyv','\u29B1':'demptyv','\u29B2':'cemptyv','\u29B3':'raemptyv','\u29B4':'laemptyv','\u29B5':'ohbar','\u29B6':'omid','\u29B7':'opar','\u29B9':'operp','\u29BB':'olcross','\u29BC':'odsold','\u29BE':'olcir','\u29BF':'ofcir','\u29C0':'olt','\u29C1':'ogt','\u29C2':'cirscir','\u29C3':'cirE','\u29C4':'solb','\u29C5':'bsolb','\u29C9':'boxbox','\u29CD':'trisb','\u29CE':'rtriltri','\u29CF':'LeftTriangleBar','\u29CF\u0338':'NotLeftTriangleBar','\u29D0':'RightTriangleBar','\u29D0\u0338':'NotRightTriangleBar','\u29DC':'iinfin','\u29DD':'infintie','\u29DE':'nvinfin','\u29E3':'eparsl','\u29E4':'smeparsl','\u29E5':'eqvparsl','\u29EB':'lozf','\u29F4':'RuleDelayed','\u29F6':'dsol','\u2A00':'xodot','\u2A01':'xoplus','\u2A02':'xotime','\u2A04':'xuplus','\u2A06':'xsqcup','\u2A0D':'fpartint','\u2A10':'cirfnint','\u2A11':'awint','\u2A12':'rppolint','\u2A13':'scpolint','\u2A14':'npolint','\u2A15':'pointint','\u2A16':'quatint','\u2A17':'intlarhk','\u2A22':'pluscir','\u2A23':'plusacir','\u2A24':'simplus','\u2A25':'plusdu','\u2A26':'plussim','\u2A27':'plustwo','\u2A29':'mcomma','\u2A2A':'minusdu','\u2A2D':'loplus','\u2A2E':'roplus','\u2A2F':'Cross','\u2A30':'timesd','\u2A31':'timesbar','\u2A33':'smashp','\u2A34':'lotimes','\u2A35':'rotimes','\u2A36':'otimesas','\u2A37':'Otimes','\u2A38':'odiv','\u2A39':'triplus','\u2A3A':'triminus','\u2A3B':'tritime','\u2A3C':'iprod','\u2A3F':'amalg','\u2A40':'capdot','\u2A42':'ncup','\u2A43':'ncap','\u2A44':'capand','\u2A45':'cupor','\u2A46':'cupcap','\u2A47':'capcup','\u2A48':'cupbrcap','\u2A49':'capbrcup','\u2A4A':'cupcup','\u2A4B':'capcap','\u2A4C':'ccups','\u2A4D':'ccaps','\u2A50':'ccupssm','\u2A53':'And','\u2A54':'Or','\u2A55':'andand','\u2A56':'oror','\u2A57':'orslope','\u2A58':'andslope','\u2A5A':'andv','\u2A5B':'orv','\u2A5C':'andd','\u2A5D':'ord','\u2A5F':'wedbar','\u2A66':'sdote','\u2A6A':'simdot','\u2A6D':'congdot','\u2A6D\u0338':'ncongdot','\u2A6E':'easter','\u2A6F':'apacir','\u2A70':'apE','\u2A70\u0338':'napE','\u2A71':'eplus','\u2A72':'pluse','\u2A73':'Esim','\u2A77':'eDDot','\u2A78':'equivDD','\u2A79':'ltcir','\u2A7A':'gtcir','\u2A7B':'ltquest','\u2A7C':'gtquest','\u2A7D':'les','\u2A7D\u0338':'nles','\u2A7E':'ges','\u2A7E\u0338':'nges','\u2A7F':'lesdot','\u2A80':'gesdot','\u2A81':'lesdoto','\u2A82':'gesdoto','\u2A83':'lesdotor','\u2A84':'gesdotol','\u2A85':'lap','\u2A86':'gap','\u2A87':'lne','\u2A88':'gne','\u2A89':'lnap','\u2A8A':'gnap','\u2A8B':'lEg','\u2A8C':'gEl','\u2A8D':'lsime','\u2A8E':'gsime','\u2A8F':'lsimg','\u2A90':'gsiml','\u2A91':'lgE','\u2A92':'glE','\u2A93':'lesges','\u2A94':'gesles','\u2A95':'els','\u2A96':'egs','\u2A97':'elsdot','\u2A98':'egsdot','\u2A99':'el','\u2A9A':'eg','\u2A9D':'siml','\u2A9E':'simg','\u2A9F':'simlE','\u2AA0':'simgE','\u2AA1':'LessLess','\u2AA1\u0338':'NotNestedLessLess','\u2AA2':'GreaterGreater','\u2AA2\u0338':'NotNestedGreaterGreater','\u2AA4':'glj','\u2AA5':'gla','\u2AA6':'ltcc','\u2AA7':'gtcc','\u2AA8':'lescc','\u2AA9':'gescc','\u2AAA':'smt','\u2AAB':'lat','\u2AAC':'smte','\u2AAC\uFE00':'smtes','\u2AAD':'late','\u2AAD\uFE00':'lates','\u2AAE':'bumpE','\u2AAF':'pre','\u2AAF\u0338':'npre','\u2AB0':'sce','\u2AB0\u0338':'nsce','\u2AB3':'prE','\u2AB4':'scE','\u2AB5':'prnE','\u2AB6':'scnE','\u2AB7':'prap','\u2AB8':'scap','\u2AB9':'prnap','\u2ABA':'scnap','\u2ABB':'Pr','\u2ABC':'Sc','\u2ABD':'subdot','\u2ABE':'supdot','\u2ABF':'subplus','\u2AC0':'supplus','\u2AC1':'submult','\u2AC2':'supmult','\u2AC3':'subedot','\u2AC4':'supedot','\u2AC5':'subE','\u2AC5\u0338':'nsubE','\u2AC6':'supE','\u2AC6\u0338':'nsupE','\u2AC7':'subsim','\u2AC8':'supsim','\u2ACB\uFE00':'vsubnE','\u2ACB':'subnE','\u2ACC\uFE00':'vsupnE','\u2ACC':'supnE','\u2ACF':'csub','\u2AD0':'csup','\u2AD1':'csube','\u2AD2':'csupe','\u2AD3':'subsup','\u2AD4':'supsub','\u2AD5':'subsub','\u2AD6':'supsup','\u2AD7':'suphsub','\u2AD8':'supdsub','\u2AD9':'forkv','\u2ADA':'topfork','\u2ADB':'mlcp','\u2AE4':'Dashv','\u2AE6':'Vdashl','\u2AE7':'Barv','\u2AE8':'vBar','\u2AE9':'vBarv','\u2AEB':'Vbar','\u2AEC':'Not','\u2AED':'bNot','\u2AEE':'rnmid','\u2AEF':'cirmid','\u2AF0':'midcir','\u2AF1':'topcir','\u2AF2':'nhpar','\u2AF3':'parsim','\u2AFD':'parsl','\u2AFD\u20E5':'nparsl','\u266D':'flat','\u266E':'natur','\u266F':'sharp','\xA4':'curren','\xA2':'cent','$':'dollar','\xA3':'pound','\xA5':'yen','\u20AC':'euro','\xB9':'sup1','\xBD':'half','\u2153':'frac13','\xBC':'frac14','\u2155':'frac15','\u2159':'frac16','\u215B':'frac18','\xB2':'sup2','\u2154':'frac23','\u2156':'frac25','\xB3':'sup3','\xBE':'frac34','\u2157':'frac35','\u215C':'frac38','\u2158':'frac45','\u215A':'frac56','\u215D':'frac58','\u215E':'frac78','\uD835\uDCB6':'ascr','\uD835\uDD52':'aopf','\uD835\uDD1E':'afr','\uD835\uDD38':'Aopf','\uD835\uDD04':'Afr','\uD835\uDC9C':'Ascr','\xAA':'ordf','\xE1':'aacute','\xC1':'Aacute','\xE0':'agrave','\xC0':'Agrave','\u0103':'abreve','\u0102':'Abreve','\xE2':'acirc','\xC2':'Acirc','\xE5':'aring','\xC5':'angst','\xE4':'auml','\xC4':'Auml','\xE3':'atilde','\xC3':'Atilde','\u0105':'aogon','\u0104':'Aogon','\u0101':'amacr','\u0100':'Amacr','\xE6':'aelig','\xC6':'AElig','\uD835\uDCB7':'bscr','\uD835\uDD53':'bopf','\uD835\uDD1F':'bfr','\uD835\uDD39':'Bopf','\u212C':'Bscr','\uD835\uDD05':'Bfr','\uD835\uDD20':'cfr','\uD835\uDCB8':'cscr','\uD835\uDD54':'copf','\u212D':'Cfr','\uD835\uDC9E':'Cscr','\u2102':'Copf','\u0107':'cacute','\u0106':'Cacute','\u0109':'ccirc','\u0108':'Ccirc','\u010D':'ccaron','\u010C':'Ccaron','\u010B':'cdot','\u010A':'Cdot','\xE7':'ccedil','\xC7':'Ccedil','\u2105':'incare','\uD835\uDD21':'dfr','\u2146':'dd','\uD835\uDD55':'dopf','\uD835\uDCB9':'dscr','\uD835\uDC9F':'Dscr','\uD835\uDD07':'Dfr','\u2145':'DD','\uD835\uDD3B':'Dopf','\u010F':'dcaron','\u010E':'Dcaron','\u0111':'dstrok','\u0110':'Dstrok','\xF0':'eth','\xD0':'ETH','\u2147':'ee','\u212F':'escr','\uD835\uDD22':'efr','\uD835\uDD56':'eopf','\u2130':'Escr','\uD835\uDD08':'Efr','\uD835\uDD3C':'Eopf','\xE9':'eacute','\xC9':'Eacute','\xE8':'egrave','\xC8':'Egrave','\xEA':'ecirc','\xCA':'Ecirc','\u011B':'ecaron','\u011A':'Ecaron','\xEB':'euml','\xCB':'Euml','\u0117':'edot','\u0116':'Edot','\u0119':'eogon','\u0118':'Eogon','\u0113':'emacr','\u0112':'Emacr','\uD835\uDD23':'ffr','\uD835\uDD57':'fopf','\uD835\uDCBB':'fscr','\uD835\uDD09':'Ffr','\uD835\uDD3D':'Fopf','\u2131':'Fscr','\uFB00':'fflig','\uFB03':'ffilig','\uFB04':'ffllig','\uFB01':'filig','fj':'fjlig','\uFB02':'fllig','\u0192':'fnof','\u210A':'gscr','\uD835\uDD58':'gopf','\uD835\uDD24':'gfr','\uD835\uDCA2':'Gscr','\uD835\uDD3E':'Gopf','\uD835\uDD0A':'Gfr','\u01F5':'gacute','\u011F':'gbreve','\u011E':'Gbreve','\u011D':'gcirc','\u011C':'Gcirc','\u0121':'gdot','\u0120':'Gdot','\u0122':'Gcedil','\uD835\uDD25':'hfr','\u210E':'planckh','\uD835\uDCBD':'hscr','\uD835\uDD59':'hopf','\u210B':'Hscr','\u210C':'Hfr','\u210D':'Hopf','\u0125':'hcirc','\u0124':'Hcirc','\u210F':'hbar','\u0127':'hstrok','\u0126':'Hstrok','\uD835\uDD5A':'iopf','\uD835\uDD26':'ifr','\uD835\uDCBE':'iscr','\u2148':'ii','\uD835\uDD40':'Iopf','\u2110':'Iscr','\u2111':'Im','\xED':'iacute','\xCD':'Iacute','\xEC':'igrave','\xCC':'Igrave','\xEE':'icirc','\xCE':'Icirc','\xEF':'iuml','\xCF':'Iuml','\u0129':'itilde','\u0128':'Itilde','\u0130':'Idot','\u012F':'iogon','\u012E':'Iogon','\u012B':'imacr','\u012A':'Imacr','\u0133':'ijlig','\u0132':'IJlig','\u0131':'imath','\uD835\uDCBF':'jscr','\uD835\uDD5B':'jopf','\uD835\uDD27':'jfr','\uD835\uDCA5':'Jscr','\uD835\uDD0D':'Jfr','\uD835\uDD41':'Jopf','\u0135':'jcirc','\u0134':'Jcirc','\u0237':'jmath','\uD835\uDD5C':'kopf','\uD835\uDCC0':'kscr','\uD835\uDD28':'kfr','\uD835\uDCA6':'Kscr','\uD835\uDD42':'Kopf','\uD835\uDD0E':'Kfr','\u0137':'kcedil','\u0136':'Kcedil','\uD835\uDD29':'lfr','\uD835\uDCC1':'lscr','\u2113':'ell','\uD835\uDD5D':'lopf','\u2112':'Lscr','\uD835\uDD0F':'Lfr','\uD835\uDD43':'Lopf','\u013A':'lacute','\u0139':'Lacute','\u013E':'lcaron','\u013D':'Lcaron','\u013C':'lcedil','\u013B':'Lcedil','\u0142':'lstrok','\u0141':'Lstrok','\u0140':'lmidot','\u013F':'Lmidot','\uD835\uDD2A':'mfr','\uD835\uDD5E':'mopf','\uD835\uDCC2':'mscr','\uD835\uDD10':'Mfr','\uD835\uDD44':'Mopf','\u2133':'Mscr','\uD835\uDD2B':'nfr','\uD835\uDD5F':'nopf','\uD835\uDCC3':'nscr','\u2115':'Nopf','\uD835\uDCA9':'Nscr','\uD835\uDD11':'Nfr','\u0144':'nacute','\u0143':'Nacute','\u0148':'ncaron','\u0147':'Ncaron','\xF1':'ntilde','\xD1':'Ntilde','\u0146':'ncedil','\u0145':'Ncedil','\u2116':'numero','\u014B':'eng','\u014A':'ENG','\uD835\uDD60':'oopf','\uD835\uDD2C':'ofr','\u2134':'oscr','\uD835\uDCAA':'Oscr','\uD835\uDD12':'Ofr','\uD835\uDD46':'Oopf','\xBA':'ordm','\xF3':'oacute','\xD3':'Oacute','\xF2':'ograve','\xD2':'Ograve','\xF4':'ocirc','\xD4':'Ocirc','\xF6':'ouml','\xD6':'Ouml','\u0151':'odblac','\u0150':'Odblac','\xF5':'otilde','\xD5':'Otilde','\xF8':'oslash','\xD8':'Oslash','\u014D':'omacr','\u014C':'Omacr','\u0153':'oelig','\u0152':'OElig','\uD835\uDD2D':'pfr','\uD835\uDCC5':'pscr','\uD835\uDD61':'popf','\u2119':'Popf','\uD835\uDD13':'Pfr','\uD835\uDCAB':'Pscr','\uD835\uDD62':'qopf','\uD835\uDD2E':'qfr','\uD835\uDCC6':'qscr','\uD835\uDCAC':'Qscr','\uD835\uDD14':'Qfr','\u211A':'Qopf','\u0138':'kgreen','\uD835\uDD2F':'rfr','\uD835\uDD63':'ropf','\uD835\uDCC7':'rscr','\u211B':'Rscr','\u211C':'Re','\u211D':'Ropf','\u0155':'racute','\u0154':'Racute','\u0159':'rcaron','\u0158':'Rcaron','\u0157':'rcedil','\u0156':'Rcedil','\uD835\uDD64':'sopf','\uD835\uDCC8':'sscr','\uD835\uDD30':'sfr','\uD835\uDD4A':'Sopf','\uD835\uDD16':'Sfr','\uD835\uDCAE':'Sscr','\u24C8':'oS','\u015B':'sacute','\u015A':'Sacute','\u015D':'scirc','\u015C':'Scirc','\u0161':'scaron','\u0160':'Scaron','\u015F':'scedil','\u015E':'Scedil','\xDF':'szlig','\uD835\uDD31':'tfr','\uD835\uDCC9':'tscr','\uD835\uDD65':'topf','\uD835\uDCAF':'Tscr','\uD835\uDD17':'Tfr','\uD835\uDD4B':'Topf','\u0165':'tcaron','\u0164':'Tcaron','\u0163':'tcedil','\u0162':'Tcedil','\u2122':'trade','\u0167':'tstrok','\u0166':'Tstrok','\uD835\uDCCA':'uscr','\uD835\uDD66':'uopf','\uD835\uDD32':'ufr','\uD835\uDD4C':'Uopf','\uD835\uDD18':'Ufr','\uD835\uDCB0':'Uscr','\xFA':'uacute','\xDA':'Uacute','\xF9':'ugrave','\xD9':'Ugrave','\u016D':'ubreve','\u016C':'Ubreve','\xFB':'ucirc','\xDB':'Ucirc','\u016F':'uring','\u016E':'Uring','\xFC':'uuml','\xDC':'Uuml','\u0171':'udblac','\u0170':'Udblac','\u0169':'utilde','\u0168':'Utilde','\u0173':'uogon','\u0172':'Uogon','\u016B':'umacr','\u016A':'Umacr','\uD835\uDD33':'vfr','\uD835\uDD67':'vopf','\uD835\uDCCB':'vscr','\uD835\uDD19':'Vfr','\uD835\uDD4D':'Vopf','\uD835\uDCB1':'Vscr','\uD835\uDD68':'wopf','\uD835\uDCCC':'wscr','\uD835\uDD34':'wfr','\uD835\uDCB2':'Wscr','\uD835\uDD4E':'Wopf','\uD835\uDD1A':'Wfr','\u0175':'wcirc','\u0174':'Wcirc','\uD835\uDD35':'xfr','\uD835\uDCCD':'xscr','\uD835\uDD69':'xopf','\uD835\uDD4F':'Xopf','\uD835\uDD1B':'Xfr','\uD835\uDCB3':'Xscr','\uD835\uDD36':'yfr','\uD835\uDCCE':'yscr','\uD835\uDD6A':'yopf','\uD835\uDCB4':'Yscr','\uD835\uDD1C':'Yfr','\uD835\uDD50':'Yopf','\xFD':'yacute','\xDD':'Yacute','\u0177':'ycirc','\u0176':'Ycirc','\xFF':'yuml','\u0178':'Yuml','\uD835\uDCCF':'zscr','\uD835\uDD37':'zfr','\uD835\uDD6B':'zopf','\u2128':'Zfr','\u2124':'Zopf','\uD835\uDCB5':'Zscr','\u017A':'zacute','\u0179':'Zacute','\u017E':'zcaron','\u017D':'Zcaron','\u017C':'zdot','\u017B':'Zdot','\u01B5':'imped','\xFE':'thorn','\xDE':'THORN','\u0149':'napos','\u03B1':'alpha','\u0391':'Alpha','\u03B2':'beta','\u0392':'Beta','\u03B3':'gamma','\u0393':'Gamma','\u03B4':'delta','\u0394':'Delta','\u03B5':'epsi','\u03F5':'epsiv','\u0395':'Epsilon','\u03DD':'gammad','\u03DC':'Gammad','\u03B6':'zeta','\u0396':'Zeta','\u03B7':'eta','\u0397':'Eta','\u03B8':'theta','\u03D1':'thetav','\u0398':'Theta','\u03B9':'iota','\u0399':'Iota','\u03BA':'kappa','\u03F0':'kappav','\u039A':'Kappa','\u03BB':'lambda','\u039B':'Lambda','\u03BC':'mu','\xB5':'micro','\u039C':'Mu','\u03BD':'nu','\u039D':'Nu','\u03BE':'xi','\u039E':'Xi','\u03BF':'omicron','\u039F':'Omicron','\u03C0':'pi','\u03D6':'piv','\u03A0':'Pi','\u03C1':'rho','\u03F1':'rhov','\u03A1':'Rho','\u03C3':'sigma','\u03A3':'Sigma','\u03C2':'sigmaf','\u03C4':'tau','\u03A4':'Tau','\u03C5':'upsi','\u03A5':'Upsilon','\u03D2':'Upsi','\u03C6':'phi','\u03D5':'phiv','\u03A6':'Phi','\u03C7':'chi','\u03A7':'Chi','\u03C8':'psi','\u03A8':'Psi','\u03C9':'omega','\u03A9':'ohm','\u0430':'acy','\u0410':'Acy','\u0431':'bcy','\u0411':'Bcy','\u0432':'vcy','\u0412':'Vcy','\u0433':'gcy','\u0413':'Gcy','\u0453':'gjcy','\u0403':'GJcy','\u0434':'dcy','\u0414':'Dcy','\u0452':'djcy','\u0402':'DJcy','\u0435':'iecy','\u0415':'IEcy','\u0451':'iocy','\u0401':'IOcy','\u0454':'jukcy','\u0404':'Jukcy','\u0436':'zhcy','\u0416':'ZHcy','\u0437':'zcy','\u0417':'Zcy','\u0455':'dscy','\u0405':'DScy','\u0438':'icy','\u0418':'Icy','\u0456':'iukcy','\u0406':'Iukcy','\u0457':'yicy','\u0407':'YIcy','\u0439':'jcy','\u0419':'Jcy','\u0458':'jsercy','\u0408':'Jsercy','\u043A':'kcy','\u041A':'Kcy','\u045C':'kjcy','\u040C':'KJcy','\u043B':'lcy','\u041B':'Lcy','\u0459':'ljcy','\u0409':'LJcy','\u043C':'mcy','\u041C':'Mcy','\u043D':'ncy','\u041D':'Ncy','\u045A':'njcy','\u040A':'NJcy','\u043E':'ocy','\u041E':'Ocy','\u043F':'pcy','\u041F':'Pcy','\u0440':'rcy','\u0420':'Rcy','\u0441':'scy','\u0421':'Scy','\u0442':'tcy','\u0422':'Tcy','\u045B':'tshcy','\u040B':'TSHcy','\u0443':'ucy','\u0423':'Ucy','\u045E':'ubrcy','\u040E':'Ubrcy','\u0444':'fcy','\u0424':'Fcy','\u0445':'khcy','\u0425':'KHcy','\u0446':'tscy','\u0426':'TScy','\u0447':'chcy','\u0427':'CHcy','\u045F':'dzcy','\u040F':'DZcy','\u0448':'shcy','\u0428':'SHcy','\u0449':'shchcy','\u0429':'SHCHcy','\u044A':'hardcy','\u042A':'HARDcy','\u044B':'ycy','\u042B':'Ycy','\u044C':'softcy','\u042C':'SOFTcy','\u044D':'ecy','\u042D':'Ecy','\u044E':'yucy','\u042E':'YUcy','\u044F':'yacy','\u042F':'YAcy','\u2135':'aleph','\u2136':'beth','\u2137':'gimel','\u2138':'daleth'}; - cleanedUp = true; + var regexEscape = /["&'<>`]/g; + var escapeMap = { + '"': '"', + '&': '&', + '\'': ''', + '<': '<', + // See https://mathiasbynens.be/notes/ambiguous-ampersands: in HTML, the + // following is not strictly necessary unless it’s part of a tag or an + // unquoted attribute value. We’re only escaping it to support those + // situations, and for XML support. + '>': '>', + // In Internet Explorer ≤ 8, the backtick character can be used + // to break out of (un)quoted attribute values or HTML comments. + // See http://html5sec.org/#102, http://html5sec.org/#108, and + // http://html5sec.org/#133. + '`': '`' + }; - // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); - } + var regexInvalidEntity = /&#(?:[xX][^a-fA-F0-9]|[^0-9xX])/; + var regexInvalidRawCodePoint = /[\0-\x08\x0B\x0E-\x1F\x7F-\x9F\uFDD0-\uFDEF\uFFFE\uFFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDFFE\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; + var regexDecode = /&#([0-9]+)(;?)|&#[xX]([a-fA-F0-9]+)(;?)|&([0-9a-zA-Z]+);|&(Aacute|Agrave|Atilde|Ccedil|Eacute|Egrave|Iacute|Igrave|Ntilde|Oacute|Ograve|Oslash|Otilde|Uacute|Ugrave|Yacute|aacute|agrave|atilde|brvbar|ccedil|curren|divide|eacute|egrave|frac12|frac14|frac34|iacute|igrave|iquest|middot|ntilde|oacute|ograve|oslash|otilde|plusmn|uacute|ugrave|yacute|AElig|Acirc|Aring|Ecirc|Icirc|Ocirc|THORN|Ucirc|acirc|acute|aelig|aring|cedil|ecirc|icirc|iexcl|laquo|micro|ocirc|pound|raquo|szlig|thorn|times|ucirc|Auml|COPY|Euml|Iuml|Ouml|QUOT|Uuml|auml|cent|copy|euml|iuml|macr|nbsp|ordf|ordm|ouml|para|quot|sect|sup1|sup2|sup3|uuml|yuml|AMP|ETH|REG|amp|deg|eth|not|reg|shy|uml|yen|GT|LT|gt|lt)([=a-zA-Z0-9])?/g; + var decodeMap = {'aacute':'\xE1','Aacute':'\xC1','abreve':'\u0103','Abreve':'\u0102','ac':'\u223E','acd':'\u223F','acE':'\u223E\u0333','acirc':'\xE2','Acirc':'\xC2','acute':'\xB4','acy':'\u0430','Acy':'\u0410','aelig':'\xE6','AElig':'\xC6','af':'\u2061','afr':'\uD835\uDD1E','Afr':'\uD835\uDD04','agrave':'\xE0','Agrave':'\xC0','alefsym':'\u2135','aleph':'\u2135','alpha':'\u03B1','Alpha':'\u0391','amacr':'\u0101','Amacr':'\u0100','amalg':'\u2A3F','amp':'&','AMP':'&','and':'\u2227','And':'\u2A53','andand':'\u2A55','andd':'\u2A5C','andslope':'\u2A58','andv':'\u2A5A','ang':'\u2220','ange':'\u29A4','angle':'\u2220','angmsd':'\u2221','angmsdaa':'\u29A8','angmsdab':'\u29A9','angmsdac':'\u29AA','angmsdad':'\u29AB','angmsdae':'\u29AC','angmsdaf':'\u29AD','angmsdag':'\u29AE','angmsdah':'\u29AF','angrt':'\u221F','angrtvb':'\u22BE','angrtvbd':'\u299D','angsph':'\u2222','angst':'\xC5','angzarr':'\u237C','aogon':'\u0105','Aogon':'\u0104','aopf':'\uD835\uDD52','Aopf':'\uD835\uDD38','ap':'\u2248','apacir':'\u2A6F','ape':'\u224A','apE':'\u2A70','apid':'\u224B','apos':'\'','ApplyFunction':'\u2061','approx':'\u2248','approxeq':'\u224A','aring':'\xE5','Aring':'\xC5','ascr':'\uD835\uDCB6','Ascr':'\uD835\uDC9C','Assign':'\u2254','ast':'*','asymp':'\u2248','asympeq':'\u224D','atilde':'\xE3','Atilde':'\xC3','auml':'\xE4','Auml':'\xC4','awconint':'\u2233','awint':'\u2A11','backcong':'\u224C','backepsilon':'\u03F6','backprime':'\u2035','backsim':'\u223D','backsimeq':'\u22CD','Backslash':'\u2216','Barv':'\u2AE7','barvee':'\u22BD','barwed':'\u2305','Barwed':'\u2306','barwedge':'\u2305','bbrk':'\u23B5','bbrktbrk':'\u23B6','bcong':'\u224C','bcy':'\u0431','Bcy':'\u0411','bdquo':'\u201E','becaus':'\u2235','because':'\u2235','Because':'\u2235','bemptyv':'\u29B0','bepsi':'\u03F6','bernou':'\u212C','Bernoullis':'\u212C','beta':'\u03B2','Beta':'\u0392','beth':'\u2136','between':'\u226C','bfr':'\uD835\uDD1F','Bfr':'\uD835\uDD05','bigcap':'\u22C2','bigcirc':'\u25EF','bigcup':'\u22C3','bigodot':'\u2A00','bigoplus':'\u2A01','bigotimes':'\u2A02','bigsqcup':'\u2A06','bigstar':'\u2605','bigtriangledown':'\u25BD','bigtriangleup':'\u25B3','biguplus':'\u2A04','bigvee':'\u22C1','bigwedge':'\u22C0','bkarow':'\u290D','blacklozenge':'\u29EB','blacksquare':'\u25AA','blacktriangle':'\u25B4','blacktriangledown':'\u25BE','blacktriangleleft':'\u25C2','blacktriangleright':'\u25B8','blank':'\u2423','blk12':'\u2592','blk14':'\u2591','blk34':'\u2593','block':'\u2588','bne':'=\u20E5','bnequiv':'\u2261\u20E5','bnot':'\u2310','bNot':'\u2AED','bopf':'\uD835\uDD53','Bopf':'\uD835\uDD39','bot':'\u22A5','bottom':'\u22A5','bowtie':'\u22C8','boxbox':'\u29C9','boxdl':'\u2510','boxdL':'\u2555','boxDl':'\u2556','boxDL':'\u2557','boxdr':'\u250C','boxdR':'\u2552','boxDr':'\u2553','boxDR':'\u2554','boxh':'\u2500','boxH':'\u2550','boxhd':'\u252C','boxhD':'\u2565','boxHd':'\u2564','boxHD':'\u2566','boxhu':'\u2534','boxhU':'\u2568','boxHu':'\u2567','boxHU':'\u2569','boxminus':'\u229F','boxplus':'\u229E','boxtimes':'\u22A0','boxul':'\u2518','boxuL':'\u255B','boxUl':'\u255C','boxUL':'\u255D','boxur':'\u2514','boxuR':'\u2558','boxUr':'\u2559','boxUR':'\u255A','boxv':'\u2502','boxV':'\u2551','boxvh':'\u253C','boxvH':'\u256A','boxVh':'\u256B','boxVH':'\u256C','boxvl':'\u2524','boxvL':'\u2561','boxVl':'\u2562','boxVL':'\u2563','boxvr':'\u251C','boxvR':'\u255E','boxVr':'\u255F','boxVR':'\u2560','bprime':'\u2035','breve':'\u02D8','Breve':'\u02D8','brvbar':'\xA6','bscr':'\uD835\uDCB7','Bscr':'\u212C','bsemi':'\u204F','bsim':'\u223D','bsime':'\u22CD','bsol':'\\','bsolb':'\u29C5','bsolhsub':'\u27C8','bull':'\u2022','bullet':'\u2022','bump':'\u224E','bumpe':'\u224F','bumpE':'\u2AAE','bumpeq':'\u224F','Bumpeq':'\u224E','cacute':'\u0107','Cacute':'\u0106','cap':'\u2229','Cap':'\u22D2','capand':'\u2A44','capbrcup':'\u2A49','capcap':'\u2A4B','capcup':'\u2A47','capdot':'\u2A40','CapitalDifferentialD':'\u2145','caps':'\u2229\uFE00','caret':'\u2041','caron':'\u02C7','Cayleys':'\u212D','ccaps':'\u2A4D','ccaron':'\u010D','Ccaron':'\u010C','ccedil':'\xE7','Ccedil':'\xC7','ccirc':'\u0109','Ccirc':'\u0108','Cconint':'\u2230','ccups':'\u2A4C','ccupssm':'\u2A50','cdot':'\u010B','Cdot':'\u010A','cedil':'\xB8','Cedilla':'\xB8','cemptyv':'\u29B2','cent':'\xA2','centerdot':'\xB7','CenterDot':'\xB7','cfr':'\uD835\uDD20','Cfr':'\u212D','chcy':'\u0447','CHcy':'\u0427','check':'\u2713','checkmark':'\u2713','chi':'\u03C7','Chi':'\u03A7','cir':'\u25CB','circ':'\u02C6','circeq':'\u2257','circlearrowleft':'\u21BA','circlearrowright':'\u21BB','circledast':'\u229B','circledcirc':'\u229A','circleddash':'\u229D','CircleDot':'\u2299','circledR':'\xAE','circledS':'\u24C8','CircleMinus':'\u2296','CirclePlus':'\u2295','CircleTimes':'\u2297','cire':'\u2257','cirE':'\u29C3','cirfnint':'\u2A10','cirmid':'\u2AEF','cirscir':'\u29C2','ClockwiseContourIntegral':'\u2232','CloseCurlyDoubleQuote':'\u201D','CloseCurlyQuote':'\u2019','clubs':'\u2663','clubsuit':'\u2663','colon':':','Colon':'\u2237','colone':'\u2254','Colone':'\u2A74','coloneq':'\u2254','comma':',','commat':'@','comp':'\u2201','compfn':'\u2218','complement':'\u2201','complexes':'\u2102','cong':'\u2245','congdot':'\u2A6D','Congruent':'\u2261','conint':'\u222E','Conint':'\u222F','ContourIntegral':'\u222E','copf':'\uD835\uDD54','Copf':'\u2102','coprod':'\u2210','Coproduct':'\u2210','copy':'\xA9','COPY':'\xA9','copysr':'\u2117','CounterClockwiseContourIntegral':'\u2233','crarr':'\u21B5','cross':'\u2717','Cross':'\u2A2F','cscr':'\uD835\uDCB8','Cscr':'\uD835\uDC9E','csub':'\u2ACF','csube':'\u2AD1','csup':'\u2AD0','csupe':'\u2AD2','ctdot':'\u22EF','cudarrl':'\u2938','cudarrr':'\u2935','cuepr':'\u22DE','cuesc':'\u22DF','cularr':'\u21B6','cularrp':'\u293D','cup':'\u222A','Cup':'\u22D3','cupbrcap':'\u2A48','cupcap':'\u2A46','CupCap':'\u224D','cupcup':'\u2A4A','cupdot':'\u228D','cupor':'\u2A45','cups':'\u222A\uFE00','curarr':'\u21B7','curarrm':'\u293C','curlyeqprec':'\u22DE','curlyeqsucc':'\u22DF','curlyvee':'\u22CE','curlywedge':'\u22CF','curren':'\xA4','curvearrowleft':'\u21B6','curvearrowright':'\u21B7','cuvee':'\u22CE','cuwed':'\u22CF','cwconint':'\u2232','cwint':'\u2231','cylcty':'\u232D','dagger':'\u2020','Dagger':'\u2021','daleth':'\u2138','darr':'\u2193','dArr':'\u21D3','Darr':'\u21A1','dash':'\u2010','dashv':'\u22A3','Dashv':'\u2AE4','dbkarow':'\u290F','dblac':'\u02DD','dcaron':'\u010F','Dcaron':'\u010E','dcy':'\u0434','Dcy':'\u0414','dd':'\u2146','DD':'\u2145','ddagger':'\u2021','ddarr':'\u21CA','DDotrahd':'\u2911','ddotseq':'\u2A77','deg':'\xB0','Del':'\u2207','delta':'\u03B4','Delta':'\u0394','demptyv':'\u29B1','dfisht':'\u297F','dfr':'\uD835\uDD21','Dfr':'\uD835\uDD07','dHar':'\u2965','dharl':'\u21C3','dharr':'\u21C2','DiacriticalAcute':'\xB4','DiacriticalDot':'\u02D9','DiacriticalDoubleAcute':'\u02DD','DiacriticalGrave':'`','DiacriticalTilde':'\u02DC','diam':'\u22C4','diamond':'\u22C4','Diamond':'\u22C4','diamondsuit':'\u2666','diams':'\u2666','die':'\xA8','DifferentialD':'\u2146','digamma':'\u03DD','disin':'\u22F2','div':'\xF7','divide':'\xF7','divideontimes':'\u22C7','divonx':'\u22C7','djcy':'\u0452','DJcy':'\u0402','dlcorn':'\u231E','dlcrop':'\u230D','dollar':'$','dopf':'\uD835\uDD55','Dopf':'\uD835\uDD3B','dot':'\u02D9','Dot':'\xA8','DotDot':'\u20DC','doteq':'\u2250','doteqdot':'\u2251','DotEqual':'\u2250','dotminus':'\u2238','dotplus':'\u2214','dotsquare':'\u22A1','doublebarwedge':'\u2306','DoubleContourIntegral':'\u222F','DoubleDot':'\xA8','DoubleDownArrow':'\u21D3','DoubleLeftArrow':'\u21D0','DoubleLeftRightArrow':'\u21D4','DoubleLeftTee':'\u2AE4','DoubleLongLeftArrow':'\u27F8','DoubleLongLeftRightArrow':'\u27FA','DoubleLongRightArrow':'\u27F9','DoubleRightArrow':'\u21D2','DoubleRightTee':'\u22A8','DoubleUpArrow':'\u21D1','DoubleUpDownArrow':'\u21D5','DoubleVerticalBar':'\u2225','downarrow':'\u2193','Downarrow':'\u21D3','DownArrow':'\u2193','DownArrowBar':'\u2913','DownArrowUpArrow':'\u21F5','DownBreve':'\u0311','downdownarrows':'\u21CA','downharpoonleft':'\u21C3','downharpoonright':'\u21C2','DownLeftRightVector':'\u2950','DownLeftTeeVector':'\u295E','DownLeftVector':'\u21BD','DownLeftVectorBar':'\u2956','DownRightTeeVector':'\u295F','DownRightVector':'\u21C1','DownRightVectorBar':'\u2957','DownTee':'\u22A4','DownTeeArrow':'\u21A7','drbkarow':'\u2910','drcorn':'\u231F','drcrop':'\u230C','dscr':'\uD835\uDCB9','Dscr':'\uD835\uDC9F','dscy':'\u0455','DScy':'\u0405','dsol':'\u29F6','dstrok':'\u0111','Dstrok':'\u0110','dtdot':'\u22F1','dtri':'\u25BF','dtrif':'\u25BE','duarr':'\u21F5','duhar':'\u296F','dwangle':'\u29A6','dzcy':'\u045F','DZcy':'\u040F','dzigrarr':'\u27FF','eacute':'\xE9','Eacute':'\xC9','easter':'\u2A6E','ecaron':'\u011B','Ecaron':'\u011A','ecir':'\u2256','ecirc':'\xEA','Ecirc':'\xCA','ecolon':'\u2255','ecy':'\u044D','Ecy':'\u042D','eDDot':'\u2A77','edot':'\u0117','eDot':'\u2251','Edot':'\u0116','ee':'\u2147','efDot':'\u2252','efr':'\uD835\uDD22','Efr':'\uD835\uDD08','eg':'\u2A9A','egrave':'\xE8','Egrave':'\xC8','egs':'\u2A96','egsdot':'\u2A98','el':'\u2A99','Element':'\u2208','elinters':'\u23E7','ell':'\u2113','els':'\u2A95','elsdot':'\u2A97','emacr':'\u0113','Emacr':'\u0112','empty':'\u2205','emptyset':'\u2205','EmptySmallSquare':'\u25FB','emptyv':'\u2205','EmptyVerySmallSquare':'\u25AB','emsp':'\u2003','emsp13':'\u2004','emsp14':'\u2005','eng':'\u014B','ENG':'\u014A','ensp':'\u2002','eogon':'\u0119','Eogon':'\u0118','eopf':'\uD835\uDD56','Eopf':'\uD835\uDD3C','epar':'\u22D5','eparsl':'\u29E3','eplus':'\u2A71','epsi':'\u03B5','epsilon':'\u03B5','Epsilon':'\u0395','epsiv':'\u03F5','eqcirc':'\u2256','eqcolon':'\u2255','eqsim':'\u2242','eqslantgtr':'\u2A96','eqslantless':'\u2A95','Equal':'\u2A75','equals':'=','EqualTilde':'\u2242','equest':'\u225F','Equilibrium':'\u21CC','equiv':'\u2261','equivDD':'\u2A78','eqvparsl':'\u29E5','erarr':'\u2971','erDot':'\u2253','escr':'\u212F','Escr':'\u2130','esdot':'\u2250','esim':'\u2242','Esim':'\u2A73','eta':'\u03B7','Eta':'\u0397','eth':'\xF0','ETH':'\xD0','euml':'\xEB','Euml':'\xCB','euro':'\u20AC','excl':'!','exist':'\u2203','Exists':'\u2203','expectation':'\u2130','exponentiale':'\u2147','ExponentialE':'\u2147','fallingdotseq':'\u2252','fcy':'\u0444','Fcy':'\u0424','female':'\u2640','ffilig':'\uFB03','fflig':'\uFB00','ffllig':'\uFB04','ffr':'\uD835\uDD23','Ffr':'\uD835\uDD09','filig':'\uFB01','FilledSmallSquare':'\u25FC','FilledVerySmallSquare':'\u25AA','fjlig':'fj','flat':'\u266D','fllig':'\uFB02','fltns':'\u25B1','fnof':'\u0192','fopf':'\uD835\uDD57','Fopf':'\uD835\uDD3D','forall':'\u2200','ForAll':'\u2200','fork':'\u22D4','forkv':'\u2AD9','Fouriertrf':'\u2131','fpartint':'\u2A0D','frac12':'\xBD','frac13':'\u2153','frac14':'\xBC','frac15':'\u2155','frac16':'\u2159','frac18':'\u215B','frac23':'\u2154','frac25':'\u2156','frac34':'\xBE','frac35':'\u2157','frac38':'\u215C','frac45':'\u2158','frac56':'\u215A','frac58':'\u215D','frac78':'\u215E','frasl':'\u2044','frown':'\u2322','fscr':'\uD835\uDCBB','Fscr':'\u2131','gacute':'\u01F5','gamma':'\u03B3','Gamma':'\u0393','gammad':'\u03DD','Gammad':'\u03DC','gap':'\u2A86','gbreve':'\u011F','Gbreve':'\u011E','Gcedil':'\u0122','gcirc':'\u011D','Gcirc':'\u011C','gcy':'\u0433','Gcy':'\u0413','gdot':'\u0121','Gdot':'\u0120','ge':'\u2265','gE':'\u2267','gel':'\u22DB','gEl':'\u2A8C','geq':'\u2265','geqq':'\u2267','geqslant':'\u2A7E','ges':'\u2A7E','gescc':'\u2AA9','gesdot':'\u2A80','gesdoto':'\u2A82','gesdotol':'\u2A84','gesl':'\u22DB\uFE00','gesles':'\u2A94','gfr':'\uD835\uDD24','Gfr':'\uD835\uDD0A','gg':'\u226B','Gg':'\u22D9','ggg':'\u22D9','gimel':'\u2137','gjcy':'\u0453','GJcy':'\u0403','gl':'\u2277','gla':'\u2AA5','glE':'\u2A92','glj':'\u2AA4','gnap':'\u2A8A','gnapprox':'\u2A8A','gne':'\u2A88','gnE':'\u2269','gneq':'\u2A88','gneqq':'\u2269','gnsim':'\u22E7','gopf':'\uD835\uDD58','Gopf':'\uD835\uDD3E','grave':'`','GreaterEqual':'\u2265','GreaterEqualLess':'\u22DB','GreaterFullEqual':'\u2267','GreaterGreater':'\u2AA2','GreaterLess':'\u2277','GreaterSlantEqual':'\u2A7E','GreaterTilde':'\u2273','gscr':'\u210A','Gscr':'\uD835\uDCA2','gsim':'\u2273','gsime':'\u2A8E','gsiml':'\u2A90','gt':'>','Gt':'\u226B','GT':'>','gtcc':'\u2AA7','gtcir':'\u2A7A','gtdot':'\u22D7','gtlPar':'\u2995','gtquest':'\u2A7C','gtrapprox':'\u2A86','gtrarr':'\u2978','gtrdot':'\u22D7','gtreqless':'\u22DB','gtreqqless':'\u2A8C','gtrless':'\u2277','gtrsim':'\u2273','gvertneqq':'\u2269\uFE00','gvnE':'\u2269\uFE00','Hacek':'\u02C7','hairsp':'\u200A','half':'\xBD','hamilt':'\u210B','hardcy':'\u044A','HARDcy':'\u042A','harr':'\u2194','hArr':'\u21D4','harrcir':'\u2948','harrw':'\u21AD','Hat':'^','hbar':'\u210F','hcirc':'\u0125','Hcirc':'\u0124','hearts':'\u2665','heartsuit':'\u2665','hellip':'\u2026','hercon':'\u22B9','hfr':'\uD835\uDD25','Hfr':'\u210C','HilbertSpace':'\u210B','hksearow':'\u2925','hkswarow':'\u2926','hoarr':'\u21FF','homtht':'\u223B','hookleftarrow':'\u21A9','hookrightarrow':'\u21AA','hopf':'\uD835\uDD59','Hopf':'\u210D','horbar':'\u2015','HorizontalLine':'\u2500','hscr':'\uD835\uDCBD','Hscr':'\u210B','hslash':'\u210F','hstrok':'\u0127','Hstrok':'\u0126','HumpDownHump':'\u224E','HumpEqual':'\u224F','hybull':'\u2043','hyphen':'\u2010','iacute':'\xED','Iacute':'\xCD','ic':'\u2063','icirc':'\xEE','Icirc':'\xCE','icy':'\u0438','Icy':'\u0418','Idot':'\u0130','iecy':'\u0435','IEcy':'\u0415','iexcl':'\xA1','iff':'\u21D4','ifr':'\uD835\uDD26','Ifr':'\u2111','igrave':'\xEC','Igrave':'\xCC','ii':'\u2148','iiiint':'\u2A0C','iiint':'\u222D','iinfin':'\u29DC','iiota':'\u2129','ijlig':'\u0133','IJlig':'\u0132','Im':'\u2111','imacr':'\u012B','Imacr':'\u012A','image':'\u2111','ImaginaryI':'\u2148','imagline':'\u2110','imagpart':'\u2111','imath':'\u0131','imof':'\u22B7','imped':'\u01B5','Implies':'\u21D2','in':'\u2208','incare':'\u2105','infin':'\u221E','infintie':'\u29DD','inodot':'\u0131','int':'\u222B','Int':'\u222C','intcal':'\u22BA','integers':'\u2124','Integral':'\u222B','intercal':'\u22BA','Intersection':'\u22C2','intlarhk':'\u2A17','intprod':'\u2A3C','InvisibleComma':'\u2063','InvisibleTimes':'\u2062','iocy':'\u0451','IOcy':'\u0401','iogon':'\u012F','Iogon':'\u012E','iopf':'\uD835\uDD5A','Iopf':'\uD835\uDD40','iota':'\u03B9','Iota':'\u0399','iprod':'\u2A3C','iquest':'\xBF','iscr':'\uD835\uDCBE','Iscr':'\u2110','isin':'\u2208','isindot':'\u22F5','isinE':'\u22F9','isins':'\u22F4','isinsv':'\u22F3','isinv':'\u2208','it':'\u2062','itilde':'\u0129','Itilde':'\u0128','iukcy':'\u0456','Iukcy':'\u0406','iuml':'\xEF','Iuml':'\xCF','jcirc':'\u0135','Jcirc':'\u0134','jcy':'\u0439','Jcy':'\u0419','jfr':'\uD835\uDD27','Jfr':'\uD835\uDD0D','jmath':'\u0237','jopf':'\uD835\uDD5B','Jopf':'\uD835\uDD41','jscr':'\uD835\uDCBF','Jscr':'\uD835\uDCA5','jsercy':'\u0458','Jsercy':'\u0408','jukcy':'\u0454','Jukcy':'\u0404','kappa':'\u03BA','Kappa':'\u039A','kappav':'\u03F0','kcedil':'\u0137','Kcedil':'\u0136','kcy':'\u043A','Kcy':'\u041A','kfr':'\uD835\uDD28','Kfr':'\uD835\uDD0E','kgreen':'\u0138','khcy':'\u0445','KHcy':'\u0425','kjcy':'\u045C','KJcy':'\u040C','kopf':'\uD835\uDD5C','Kopf':'\uD835\uDD42','kscr':'\uD835\uDCC0','Kscr':'\uD835\uDCA6','lAarr':'\u21DA','lacute':'\u013A','Lacute':'\u0139','laemptyv':'\u29B4','lagran':'\u2112','lambda':'\u03BB','Lambda':'\u039B','lang':'\u27E8','Lang':'\u27EA','langd':'\u2991','langle':'\u27E8','lap':'\u2A85','Laplacetrf':'\u2112','laquo':'\xAB','larr':'\u2190','lArr':'\u21D0','Larr':'\u219E','larrb':'\u21E4','larrbfs':'\u291F','larrfs':'\u291D','larrhk':'\u21A9','larrlp':'\u21AB','larrpl':'\u2939','larrsim':'\u2973','larrtl':'\u21A2','lat':'\u2AAB','latail':'\u2919','lAtail':'\u291B','late':'\u2AAD','lates':'\u2AAD\uFE00','lbarr':'\u290C','lBarr':'\u290E','lbbrk':'\u2772','lbrace':'{','lbrack':'[','lbrke':'\u298B','lbrksld':'\u298F','lbrkslu':'\u298D','lcaron':'\u013E','Lcaron':'\u013D','lcedil':'\u013C','Lcedil':'\u013B','lceil':'\u2308','lcub':'{','lcy':'\u043B','Lcy':'\u041B','ldca':'\u2936','ldquo':'\u201C','ldquor':'\u201E','ldrdhar':'\u2967','ldrushar':'\u294B','ldsh':'\u21B2','le':'\u2264','lE':'\u2266','LeftAngleBracket':'\u27E8','leftarrow':'\u2190','Leftarrow':'\u21D0','LeftArrow':'\u2190','LeftArrowBar':'\u21E4','LeftArrowRightArrow':'\u21C6','leftarrowtail':'\u21A2','LeftCeiling':'\u2308','LeftDoubleBracket':'\u27E6','LeftDownTeeVector':'\u2961','LeftDownVector':'\u21C3','LeftDownVectorBar':'\u2959','LeftFloor':'\u230A','leftharpoondown':'\u21BD','leftharpoonup':'\u21BC','leftleftarrows':'\u21C7','leftrightarrow':'\u2194','Leftrightarrow':'\u21D4','LeftRightArrow':'\u2194','leftrightarrows':'\u21C6','leftrightharpoons':'\u21CB','leftrightsquigarrow':'\u21AD','LeftRightVector':'\u294E','LeftTee':'\u22A3','LeftTeeArrow':'\u21A4','LeftTeeVector':'\u295A','leftthreetimes':'\u22CB','LeftTriangle':'\u22B2','LeftTriangleBar':'\u29CF','LeftTriangleEqual':'\u22B4','LeftUpDownVector':'\u2951','LeftUpTeeVector':'\u2960','LeftUpVector':'\u21BF','LeftUpVectorBar':'\u2958','LeftVector':'\u21BC','LeftVectorBar':'\u2952','leg':'\u22DA','lEg':'\u2A8B','leq':'\u2264','leqq':'\u2266','leqslant':'\u2A7D','les':'\u2A7D','lescc':'\u2AA8','lesdot':'\u2A7F','lesdoto':'\u2A81','lesdotor':'\u2A83','lesg':'\u22DA\uFE00','lesges':'\u2A93','lessapprox':'\u2A85','lessdot':'\u22D6','lesseqgtr':'\u22DA','lesseqqgtr':'\u2A8B','LessEqualGreater':'\u22DA','LessFullEqual':'\u2266','LessGreater':'\u2276','lessgtr':'\u2276','LessLess':'\u2AA1','lesssim':'\u2272','LessSlantEqual':'\u2A7D','LessTilde':'\u2272','lfisht':'\u297C','lfloor':'\u230A','lfr':'\uD835\uDD29','Lfr':'\uD835\uDD0F','lg':'\u2276','lgE':'\u2A91','lHar':'\u2962','lhard':'\u21BD','lharu':'\u21BC','lharul':'\u296A','lhblk':'\u2584','ljcy':'\u0459','LJcy':'\u0409','ll':'\u226A','Ll':'\u22D8','llarr':'\u21C7','llcorner':'\u231E','Lleftarrow':'\u21DA','llhard':'\u296B','lltri':'\u25FA','lmidot':'\u0140','Lmidot':'\u013F','lmoust':'\u23B0','lmoustache':'\u23B0','lnap':'\u2A89','lnapprox':'\u2A89','lne':'\u2A87','lnE':'\u2268','lneq':'\u2A87','lneqq':'\u2268','lnsim':'\u22E6','loang':'\u27EC','loarr':'\u21FD','lobrk':'\u27E6','longleftarrow':'\u27F5','Longleftarrow':'\u27F8','LongLeftArrow':'\u27F5','longleftrightarrow':'\u27F7','Longleftrightarrow':'\u27FA','LongLeftRightArrow':'\u27F7','longmapsto':'\u27FC','longrightarrow':'\u27F6','Longrightarrow':'\u27F9','LongRightArrow':'\u27F6','looparrowleft':'\u21AB','looparrowright':'\u21AC','lopar':'\u2985','lopf':'\uD835\uDD5D','Lopf':'\uD835\uDD43','loplus':'\u2A2D','lotimes':'\u2A34','lowast':'\u2217','lowbar':'_','LowerLeftArrow':'\u2199','LowerRightArrow':'\u2198','loz':'\u25CA','lozenge':'\u25CA','lozf':'\u29EB','lpar':'(','lparlt':'\u2993','lrarr':'\u21C6','lrcorner':'\u231F','lrhar':'\u21CB','lrhard':'\u296D','lrm':'\u200E','lrtri':'\u22BF','lsaquo':'\u2039','lscr':'\uD835\uDCC1','Lscr':'\u2112','lsh':'\u21B0','Lsh':'\u21B0','lsim':'\u2272','lsime':'\u2A8D','lsimg':'\u2A8F','lsqb':'[','lsquo':'\u2018','lsquor':'\u201A','lstrok':'\u0142','Lstrok':'\u0141','lt':'<','Lt':'\u226A','LT':'<','ltcc':'\u2AA6','ltcir':'\u2A79','ltdot':'\u22D6','lthree':'\u22CB','ltimes':'\u22C9','ltlarr':'\u2976','ltquest':'\u2A7B','ltri':'\u25C3','ltrie':'\u22B4','ltrif':'\u25C2','ltrPar':'\u2996','lurdshar':'\u294A','luruhar':'\u2966','lvertneqq':'\u2268\uFE00','lvnE':'\u2268\uFE00','macr':'\xAF','male':'\u2642','malt':'\u2720','maltese':'\u2720','map':'\u21A6','Map':'\u2905','mapsto':'\u21A6','mapstodown':'\u21A7','mapstoleft':'\u21A4','mapstoup':'\u21A5','marker':'\u25AE','mcomma':'\u2A29','mcy':'\u043C','Mcy':'\u041C','mdash':'\u2014','mDDot':'\u223A','measuredangle':'\u2221','MediumSpace':'\u205F','Mellintrf':'\u2133','mfr':'\uD835\uDD2A','Mfr':'\uD835\uDD10','mho':'\u2127','micro':'\xB5','mid':'\u2223','midast':'*','midcir':'\u2AF0','middot':'\xB7','minus':'\u2212','minusb':'\u229F','minusd':'\u2238','minusdu':'\u2A2A','MinusPlus':'\u2213','mlcp':'\u2ADB','mldr':'\u2026','mnplus':'\u2213','models':'\u22A7','mopf':'\uD835\uDD5E','Mopf':'\uD835\uDD44','mp':'\u2213','mscr':'\uD835\uDCC2','Mscr':'\u2133','mstpos':'\u223E','mu':'\u03BC','Mu':'\u039C','multimap':'\u22B8','mumap':'\u22B8','nabla':'\u2207','nacute':'\u0144','Nacute':'\u0143','nang':'\u2220\u20D2','nap':'\u2249','napE':'\u2A70\u0338','napid':'\u224B\u0338','napos':'\u0149','napprox':'\u2249','natur':'\u266E','natural':'\u266E','naturals':'\u2115','nbsp':'\xA0','nbump':'\u224E\u0338','nbumpe':'\u224F\u0338','ncap':'\u2A43','ncaron':'\u0148','Ncaron':'\u0147','ncedil':'\u0146','Ncedil':'\u0145','ncong':'\u2247','ncongdot':'\u2A6D\u0338','ncup':'\u2A42','ncy':'\u043D','Ncy':'\u041D','ndash':'\u2013','ne':'\u2260','nearhk':'\u2924','nearr':'\u2197','neArr':'\u21D7','nearrow':'\u2197','nedot':'\u2250\u0338','NegativeMediumSpace':'\u200B','NegativeThickSpace':'\u200B','NegativeThinSpace':'\u200B','NegativeVeryThinSpace':'\u200B','nequiv':'\u2262','nesear':'\u2928','nesim':'\u2242\u0338','NestedGreaterGreater':'\u226B','NestedLessLess':'\u226A','NewLine':'\n','nexist':'\u2204','nexists':'\u2204','nfr':'\uD835\uDD2B','Nfr':'\uD835\uDD11','nge':'\u2271','ngE':'\u2267\u0338','ngeq':'\u2271','ngeqq':'\u2267\u0338','ngeqslant':'\u2A7E\u0338','nges':'\u2A7E\u0338','nGg':'\u22D9\u0338','ngsim':'\u2275','ngt':'\u226F','nGt':'\u226B\u20D2','ngtr':'\u226F','nGtv':'\u226B\u0338','nharr':'\u21AE','nhArr':'\u21CE','nhpar':'\u2AF2','ni':'\u220B','nis':'\u22FC','nisd':'\u22FA','niv':'\u220B','njcy':'\u045A','NJcy':'\u040A','nlarr':'\u219A','nlArr':'\u21CD','nldr':'\u2025','nle':'\u2270','nlE':'\u2266\u0338','nleftarrow':'\u219A','nLeftarrow':'\u21CD','nleftrightarrow':'\u21AE','nLeftrightarrow':'\u21CE','nleq':'\u2270','nleqq':'\u2266\u0338','nleqslant':'\u2A7D\u0338','nles':'\u2A7D\u0338','nless':'\u226E','nLl':'\u22D8\u0338','nlsim':'\u2274','nlt':'\u226E','nLt':'\u226A\u20D2','nltri':'\u22EA','nltrie':'\u22EC','nLtv':'\u226A\u0338','nmid':'\u2224','NoBreak':'\u2060','NonBreakingSpace':'\xA0','nopf':'\uD835\uDD5F','Nopf':'\u2115','not':'\xAC','Not':'\u2AEC','NotCongruent':'\u2262','NotCupCap':'\u226D','NotDoubleVerticalBar':'\u2226','NotElement':'\u2209','NotEqual':'\u2260','NotEqualTilde':'\u2242\u0338','NotExists':'\u2204','NotGreater':'\u226F','NotGreaterEqual':'\u2271','NotGreaterFullEqual':'\u2267\u0338','NotGreaterGreater':'\u226B\u0338','NotGreaterLess':'\u2279','NotGreaterSlantEqual':'\u2A7E\u0338','NotGreaterTilde':'\u2275','NotHumpDownHump':'\u224E\u0338','NotHumpEqual':'\u224F\u0338','notin':'\u2209','notindot':'\u22F5\u0338','notinE':'\u22F9\u0338','notinva':'\u2209','notinvb':'\u22F7','notinvc':'\u22F6','NotLeftTriangle':'\u22EA','NotLeftTriangleBar':'\u29CF\u0338','NotLeftTriangleEqual':'\u22EC','NotLess':'\u226E','NotLessEqual':'\u2270','NotLessGreater':'\u2278','NotLessLess':'\u226A\u0338','NotLessSlantEqual':'\u2A7D\u0338','NotLessTilde':'\u2274','NotNestedGreaterGreater':'\u2AA2\u0338','NotNestedLessLess':'\u2AA1\u0338','notni':'\u220C','notniva':'\u220C','notnivb':'\u22FE','notnivc':'\u22FD','NotPrecedes':'\u2280','NotPrecedesEqual':'\u2AAF\u0338','NotPrecedesSlantEqual':'\u22E0','NotReverseElement':'\u220C','NotRightTriangle':'\u22EB','NotRightTriangleBar':'\u29D0\u0338','NotRightTriangleEqual':'\u22ED','NotSquareSubset':'\u228F\u0338','NotSquareSubsetEqual':'\u22E2','NotSquareSuperset':'\u2290\u0338','NotSquareSupersetEqual':'\u22E3','NotSubset':'\u2282\u20D2','NotSubsetEqual':'\u2288','NotSucceeds':'\u2281','NotSucceedsEqual':'\u2AB0\u0338','NotSucceedsSlantEqual':'\u22E1','NotSucceedsTilde':'\u227F\u0338','NotSuperset':'\u2283\u20D2','NotSupersetEqual':'\u2289','NotTilde':'\u2241','NotTildeEqual':'\u2244','NotTildeFullEqual':'\u2247','NotTildeTilde':'\u2249','NotVerticalBar':'\u2224','npar':'\u2226','nparallel':'\u2226','nparsl':'\u2AFD\u20E5','npart':'\u2202\u0338','npolint':'\u2A14','npr':'\u2280','nprcue':'\u22E0','npre':'\u2AAF\u0338','nprec':'\u2280','npreceq':'\u2AAF\u0338','nrarr':'\u219B','nrArr':'\u21CF','nrarrc':'\u2933\u0338','nrarrw':'\u219D\u0338','nrightarrow':'\u219B','nRightarrow':'\u21CF','nrtri':'\u22EB','nrtrie':'\u22ED','nsc':'\u2281','nsccue':'\u22E1','nsce':'\u2AB0\u0338','nscr':'\uD835\uDCC3','Nscr':'\uD835\uDCA9','nshortmid':'\u2224','nshortparallel':'\u2226','nsim':'\u2241','nsime':'\u2244','nsimeq':'\u2244','nsmid':'\u2224','nspar':'\u2226','nsqsube':'\u22E2','nsqsupe':'\u22E3','nsub':'\u2284','nsube':'\u2288','nsubE':'\u2AC5\u0338','nsubset':'\u2282\u20D2','nsubseteq':'\u2288','nsubseteqq':'\u2AC5\u0338','nsucc':'\u2281','nsucceq':'\u2AB0\u0338','nsup':'\u2285','nsupe':'\u2289','nsupE':'\u2AC6\u0338','nsupset':'\u2283\u20D2','nsupseteq':'\u2289','nsupseteqq':'\u2AC6\u0338','ntgl':'\u2279','ntilde':'\xF1','Ntilde':'\xD1','ntlg':'\u2278','ntriangleleft':'\u22EA','ntrianglelefteq':'\u22EC','ntriangleright':'\u22EB','ntrianglerighteq':'\u22ED','nu':'\u03BD','Nu':'\u039D','num':'#','numero':'\u2116','numsp':'\u2007','nvap':'\u224D\u20D2','nvdash':'\u22AC','nvDash':'\u22AD','nVdash':'\u22AE','nVDash':'\u22AF','nvge':'\u2265\u20D2','nvgt':'>\u20D2','nvHarr':'\u2904','nvinfin':'\u29DE','nvlArr':'\u2902','nvle':'\u2264\u20D2','nvlt':'<\u20D2','nvltrie':'\u22B4\u20D2','nvrArr':'\u2903','nvrtrie':'\u22B5\u20D2','nvsim':'\u223C\u20D2','nwarhk':'\u2923','nwarr':'\u2196','nwArr':'\u21D6','nwarrow':'\u2196','nwnear':'\u2927','oacute':'\xF3','Oacute':'\xD3','oast':'\u229B','ocir':'\u229A','ocirc':'\xF4','Ocirc':'\xD4','ocy':'\u043E','Ocy':'\u041E','odash':'\u229D','odblac':'\u0151','Odblac':'\u0150','odiv':'\u2A38','odot':'\u2299','odsold':'\u29BC','oelig':'\u0153','OElig':'\u0152','ofcir':'\u29BF','ofr':'\uD835\uDD2C','Ofr':'\uD835\uDD12','ogon':'\u02DB','ograve':'\xF2','Ograve':'\xD2','ogt':'\u29C1','ohbar':'\u29B5','ohm':'\u03A9','oint':'\u222E','olarr':'\u21BA','olcir':'\u29BE','olcross':'\u29BB','oline':'\u203E','olt':'\u29C0','omacr':'\u014D','Omacr':'\u014C','omega':'\u03C9','Omega':'\u03A9','omicron':'\u03BF','Omicron':'\u039F','omid':'\u29B6','ominus':'\u2296','oopf':'\uD835\uDD60','Oopf':'\uD835\uDD46','opar':'\u29B7','OpenCurlyDoubleQuote':'\u201C','OpenCurlyQuote':'\u2018','operp':'\u29B9','oplus':'\u2295','or':'\u2228','Or':'\u2A54','orarr':'\u21BB','ord':'\u2A5D','order':'\u2134','orderof':'\u2134','ordf':'\xAA','ordm':'\xBA','origof':'\u22B6','oror':'\u2A56','orslope':'\u2A57','orv':'\u2A5B','oS':'\u24C8','oscr':'\u2134','Oscr':'\uD835\uDCAA','oslash':'\xF8','Oslash':'\xD8','osol':'\u2298','otilde':'\xF5','Otilde':'\xD5','otimes':'\u2297','Otimes':'\u2A37','otimesas':'\u2A36','ouml':'\xF6','Ouml':'\xD6','ovbar':'\u233D','OverBar':'\u203E','OverBrace':'\u23DE','OverBracket':'\u23B4','OverParenthesis':'\u23DC','par':'\u2225','para':'\xB6','parallel':'\u2225','parsim':'\u2AF3','parsl':'\u2AFD','part':'\u2202','PartialD':'\u2202','pcy':'\u043F','Pcy':'\u041F','percnt':'%','period':'.','permil':'\u2030','perp':'\u22A5','pertenk':'\u2031','pfr':'\uD835\uDD2D','Pfr':'\uD835\uDD13','phi':'\u03C6','Phi':'\u03A6','phiv':'\u03D5','phmmat':'\u2133','phone':'\u260E','pi':'\u03C0','Pi':'\u03A0','pitchfork':'\u22D4','piv':'\u03D6','planck':'\u210F','planckh':'\u210E','plankv':'\u210F','plus':'+','plusacir':'\u2A23','plusb':'\u229E','pluscir':'\u2A22','plusdo':'\u2214','plusdu':'\u2A25','pluse':'\u2A72','PlusMinus':'\xB1','plusmn':'\xB1','plussim':'\u2A26','plustwo':'\u2A27','pm':'\xB1','Poincareplane':'\u210C','pointint':'\u2A15','popf':'\uD835\uDD61','Popf':'\u2119','pound':'\xA3','pr':'\u227A','Pr':'\u2ABB','prap':'\u2AB7','prcue':'\u227C','pre':'\u2AAF','prE':'\u2AB3','prec':'\u227A','precapprox':'\u2AB7','preccurlyeq':'\u227C','Precedes':'\u227A','PrecedesEqual':'\u2AAF','PrecedesSlantEqual':'\u227C','PrecedesTilde':'\u227E','preceq':'\u2AAF','precnapprox':'\u2AB9','precneqq':'\u2AB5','precnsim':'\u22E8','precsim':'\u227E','prime':'\u2032','Prime':'\u2033','primes':'\u2119','prnap':'\u2AB9','prnE':'\u2AB5','prnsim':'\u22E8','prod':'\u220F','Product':'\u220F','profalar':'\u232E','profline':'\u2312','profsurf':'\u2313','prop':'\u221D','Proportion':'\u2237','Proportional':'\u221D','propto':'\u221D','prsim':'\u227E','prurel':'\u22B0','pscr':'\uD835\uDCC5','Pscr':'\uD835\uDCAB','psi':'\u03C8','Psi':'\u03A8','puncsp':'\u2008','qfr':'\uD835\uDD2E','Qfr':'\uD835\uDD14','qint':'\u2A0C','qopf':'\uD835\uDD62','Qopf':'\u211A','qprime':'\u2057','qscr':'\uD835\uDCC6','Qscr':'\uD835\uDCAC','quaternions':'\u210D','quatint':'\u2A16','quest':'?','questeq':'\u225F','quot':'"','QUOT':'"','rAarr':'\u21DB','race':'\u223D\u0331','racute':'\u0155','Racute':'\u0154','radic':'\u221A','raemptyv':'\u29B3','rang':'\u27E9','Rang':'\u27EB','rangd':'\u2992','range':'\u29A5','rangle':'\u27E9','raquo':'\xBB','rarr':'\u2192','rArr':'\u21D2','Rarr':'\u21A0','rarrap':'\u2975','rarrb':'\u21E5','rarrbfs':'\u2920','rarrc':'\u2933','rarrfs':'\u291E','rarrhk':'\u21AA','rarrlp':'\u21AC','rarrpl':'\u2945','rarrsim':'\u2974','rarrtl':'\u21A3','Rarrtl':'\u2916','rarrw':'\u219D','ratail':'\u291A','rAtail':'\u291C','ratio':'\u2236','rationals':'\u211A','rbarr':'\u290D','rBarr':'\u290F','RBarr':'\u2910','rbbrk':'\u2773','rbrace':'}','rbrack':']','rbrke':'\u298C','rbrksld':'\u298E','rbrkslu':'\u2990','rcaron':'\u0159','Rcaron':'\u0158','rcedil':'\u0157','Rcedil':'\u0156','rceil':'\u2309','rcub':'}','rcy':'\u0440','Rcy':'\u0420','rdca':'\u2937','rdldhar':'\u2969','rdquo':'\u201D','rdquor':'\u201D','rdsh':'\u21B3','Re':'\u211C','real':'\u211C','realine':'\u211B','realpart':'\u211C','reals':'\u211D','rect':'\u25AD','reg':'\xAE','REG':'\xAE','ReverseElement':'\u220B','ReverseEquilibrium':'\u21CB','ReverseUpEquilibrium':'\u296F','rfisht':'\u297D','rfloor':'\u230B','rfr':'\uD835\uDD2F','Rfr':'\u211C','rHar':'\u2964','rhard':'\u21C1','rharu':'\u21C0','rharul':'\u296C','rho':'\u03C1','Rho':'\u03A1','rhov':'\u03F1','RightAngleBracket':'\u27E9','rightarrow':'\u2192','Rightarrow':'\u21D2','RightArrow':'\u2192','RightArrowBar':'\u21E5','RightArrowLeftArrow':'\u21C4','rightarrowtail':'\u21A3','RightCeiling':'\u2309','RightDoubleBracket':'\u27E7','RightDownTeeVector':'\u295D','RightDownVector':'\u21C2','RightDownVectorBar':'\u2955','RightFloor':'\u230B','rightharpoondown':'\u21C1','rightharpoonup':'\u21C0','rightleftarrows':'\u21C4','rightleftharpoons':'\u21CC','rightrightarrows':'\u21C9','rightsquigarrow':'\u219D','RightTee':'\u22A2','RightTeeArrow':'\u21A6','RightTeeVector':'\u295B','rightthreetimes':'\u22CC','RightTriangle':'\u22B3','RightTriangleBar':'\u29D0','RightTriangleEqual':'\u22B5','RightUpDownVector':'\u294F','RightUpTeeVector':'\u295C','RightUpVector':'\u21BE','RightUpVectorBar':'\u2954','RightVector':'\u21C0','RightVectorBar':'\u2953','ring':'\u02DA','risingdotseq':'\u2253','rlarr':'\u21C4','rlhar':'\u21CC','rlm':'\u200F','rmoust':'\u23B1','rmoustache':'\u23B1','rnmid':'\u2AEE','roang':'\u27ED','roarr':'\u21FE','robrk':'\u27E7','ropar':'\u2986','ropf':'\uD835\uDD63','Ropf':'\u211D','roplus':'\u2A2E','rotimes':'\u2A35','RoundImplies':'\u2970','rpar':')','rpargt':'\u2994','rppolint':'\u2A12','rrarr':'\u21C9','Rrightarrow':'\u21DB','rsaquo':'\u203A','rscr':'\uD835\uDCC7','Rscr':'\u211B','rsh':'\u21B1','Rsh':'\u21B1','rsqb':']','rsquo':'\u2019','rsquor':'\u2019','rthree':'\u22CC','rtimes':'\u22CA','rtri':'\u25B9','rtrie':'\u22B5','rtrif':'\u25B8','rtriltri':'\u29CE','RuleDelayed':'\u29F4','ruluhar':'\u2968','rx':'\u211E','sacute':'\u015B','Sacute':'\u015A','sbquo':'\u201A','sc':'\u227B','Sc':'\u2ABC','scap':'\u2AB8','scaron':'\u0161','Scaron':'\u0160','sccue':'\u227D','sce':'\u2AB0','scE':'\u2AB4','scedil':'\u015F','Scedil':'\u015E','scirc':'\u015D','Scirc':'\u015C','scnap':'\u2ABA','scnE':'\u2AB6','scnsim':'\u22E9','scpolint':'\u2A13','scsim':'\u227F','scy':'\u0441','Scy':'\u0421','sdot':'\u22C5','sdotb':'\u22A1','sdote':'\u2A66','searhk':'\u2925','searr':'\u2198','seArr':'\u21D8','searrow':'\u2198','sect':'\xA7','semi':';','seswar':'\u2929','setminus':'\u2216','setmn':'\u2216','sext':'\u2736','sfr':'\uD835\uDD30','Sfr':'\uD835\uDD16','sfrown':'\u2322','sharp':'\u266F','shchcy':'\u0449','SHCHcy':'\u0429','shcy':'\u0448','SHcy':'\u0428','ShortDownArrow':'\u2193','ShortLeftArrow':'\u2190','shortmid':'\u2223','shortparallel':'\u2225','ShortRightArrow':'\u2192','ShortUpArrow':'\u2191','shy':'\xAD','sigma':'\u03C3','Sigma':'\u03A3','sigmaf':'\u03C2','sigmav':'\u03C2','sim':'\u223C','simdot':'\u2A6A','sime':'\u2243','simeq':'\u2243','simg':'\u2A9E','simgE':'\u2AA0','siml':'\u2A9D','simlE':'\u2A9F','simne':'\u2246','simplus':'\u2A24','simrarr':'\u2972','slarr':'\u2190','SmallCircle':'\u2218','smallsetminus':'\u2216','smashp':'\u2A33','smeparsl':'\u29E4','smid':'\u2223','smile':'\u2323','smt':'\u2AAA','smte':'\u2AAC','smtes':'\u2AAC\uFE00','softcy':'\u044C','SOFTcy':'\u042C','sol':'/','solb':'\u29C4','solbar':'\u233F','sopf':'\uD835\uDD64','Sopf':'\uD835\uDD4A','spades':'\u2660','spadesuit':'\u2660','spar':'\u2225','sqcap':'\u2293','sqcaps':'\u2293\uFE00','sqcup':'\u2294','sqcups':'\u2294\uFE00','Sqrt':'\u221A','sqsub':'\u228F','sqsube':'\u2291','sqsubset':'\u228F','sqsubseteq':'\u2291','sqsup':'\u2290','sqsupe':'\u2292','sqsupset':'\u2290','sqsupseteq':'\u2292','squ':'\u25A1','square':'\u25A1','Square':'\u25A1','SquareIntersection':'\u2293','SquareSubset':'\u228F','SquareSubsetEqual':'\u2291','SquareSuperset':'\u2290','SquareSupersetEqual':'\u2292','SquareUnion':'\u2294','squarf':'\u25AA','squf':'\u25AA','srarr':'\u2192','sscr':'\uD835\uDCC8','Sscr':'\uD835\uDCAE','ssetmn':'\u2216','ssmile':'\u2323','sstarf':'\u22C6','star':'\u2606','Star':'\u22C6','starf':'\u2605','straightepsilon':'\u03F5','straightphi':'\u03D5','strns':'\xAF','sub':'\u2282','Sub':'\u22D0','subdot':'\u2ABD','sube':'\u2286','subE':'\u2AC5','subedot':'\u2AC3','submult':'\u2AC1','subne':'\u228A','subnE':'\u2ACB','subplus':'\u2ABF','subrarr':'\u2979','subset':'\u2282','Subset':'\u22D0','subseteq':'\u2286','subseteqq':'\u2AC5','SubsetEqual':'\u2286','subsetneq':'\u228A','subsetneqq':'\u2ACB','subsim':'\u2AC7','subsub':'\u2AD5','subsup':'\u2AD3','succ':'\u227B','succapprox':'\u2AB8','succcurlyeq':'\u227D','Succeeds':'\u227B','SucceedsEqual':'\u2AB0','SucceedsSlantEqual':'\u227D','SucceedsTilde':'\u227F','succeq':'\u2AB0','succnapprox':'\u2ABA','succneqq':'\u2AB6','succnsim':'\u22E9','succsim':'\u227F','SuchThat':'\u220B','sum':'\u2211','Sum':'\u2211','sung':'\u266A','sup':'\u2283','Sup':'\u22D1','sup1':'\xB9','sup2':'\xB2','sup3':'\xB3','supdot':'\u2ABE','supdsub':'\u2AD8','supe':'\u2287','supE':'\u2AC6','supedot':'\u2AC4','Superset':'\u2283','SupersetEqual':'\u2287','suphsol':'\u27C9','suphsub':'\u2AD7','suplarr':'\u297B','supmult':'\u2AC2','supne':'\u228B','supnE':'\u2ACC','supplus':'\u2AC0','supset':'\u2283','Supset':'\u22D1','supseteq':'\u2287','supseteqq':'\u2AC6','supsetneq':'\u228B','supsetneqq':'\u2ACC','supsim':'\u2AC8','supsub':'\u2AD4','supsup':'\u2AD6','swarhk':'\u2926','swarr':'\u2199','swArr':'\u21D9','swarrow':'\u2199','swnwar':'\u292A','szlig':'\xDF','Tab':'\t','target':'\u2316','tau':'\u03C4','Tau':'\u03A4','tbrk':'\u23B4','tcaron':'\u0165','Tcaron':'\u0164','tcedil':'\u0163','Tcedil':'\u0162','tcy':'\u0442','Tcy':'\u0422','tdot':'\u20DB','telrec':'\u2315','tfr':'\uD835\uDD31','Tfr':'\uD835\uDD17','there4':'\u2234','therefore':'\u2234','Therefore':'\u2234','theta':'\u03B8','Theta':'\u0398','thetasym':'\u03D1','thetav':'\u03D1','thickapprox':'\u2248','thicksim':'\u223C','ThickSpace':'\u205F\u200A','thinsp':'\u2009','ThinSpace':'\u2009','thkap':'\u2248','thksim':'\u223C','thorn':'\xFE','THORN':'\xDE','tilde':'\u02DC','Tilde':'\u223C','TildeEqual':'\u2243','TildeFullEqual':'\u2245','TildeTilde':'\u2248','times':'\xD7','timesb':'\u22A0','timesbar':'\u2A31','timesd':'\u2A30','tint':'\u222D','toea':'\u2928','top':'\u22A4','topbot':'\u2336','topcir':'\u2AF1','topf':'\uD835\uDD65','Topf':'\uD835\uDD4B','topfork':'\u2ADA','tosa':'\u2929','tprime':'\u2034','trade':'\u2122','TRADE':'\u2122','triangle':'\u25B5','triangledown':'\u25BF','triangleleft':'\u25C3','trianglelefteq':'\u22B4','triangleq':'\u225C','triangleright':'\u25B9','trianglerighteq':'\u22B5','tridot':'\u25EC','trie':'\u225C','triminus':'\u2A3A','TripleDot':'\u20DB','triplus':'\u2A39','trisb':'\u29CD','tritime':'\u2A3B','trpezium':'\u23E2','tscr':'\uD835\uDCC9','Tscr':'\uD835\uDCAF','tscy':'\u0446','TScy':'\u0426','tshcy':'\u045B','TSHcy':'\u040B','tstrok':'\u0167','Tstrok':'\u0166','twixt':'\u226C','twoheadleftarrow':'\u219E','twoheadrightarrow':'\u21A0','uacute':'\xFA','Uacute':'\xDA','uarr':'\u2191','uArr':'\u21D1','Uarr':'\u219F','Uarrocir':'\u2949','ubrcy':'\u045E','Ubrcy':'\u040E','ubreve':'\u016D','Ubreve':'\u016C','ucirc':'\xFB','Ucirc':'\xDB','ucy':'\u0443','Ucy':'\u0423','udarr':'\u21C5','udblac':'\u0171','Udblac':'\u0170','udhar':'\u296E','ufisht':'\u297E','ufr':'\uD835\uDD32','Ufr':'\uD835\uDD18','ugrave':'\xF9','Ugrave':'\xD9','uHar':'\u2963','uharl':'\u21BF','uharr':'\u21BE','uhblk':'\u2580','ulcorn':'\u231C','ulcorner':'\u231C','ulcrop':'\u230F','ultri':'\u25F8','umacr':'\u016B','Umacr':'\u016A','uml':'\xA8','UnderBar':'_','UnderBrace':'\u23DF','UnderBracket':'\u23B5','UnderParenthesis':'\u23DD','Union':'\u22C3','UnionPlus':'\u228E','uogon':'\u0173','Uogon':'\u0172','uopf':'\uD835\uDD66','Uopf':'\uD835\uDD4C','uparrow':'\u2191','Uparrow':'\u21D1','UpArrow':'\u2191','UpArrowBar':'\u2912','UpArrowDownArrow':'\u21C5','updownarrow':'\u2195','Updownarrow':'\u21D5','UpDownArrow':'\u2195','UpEquilibrium':'\u296E','upharpoonleft':'\u21BF','upharpoonright':'\u21BE','uplus':'\u228E','UpperLeftArrow':'\u2196','UpperRightArrow':'\u2197','upsi':'\u03C5','Upsi':'\u03D2','upsih':'\u03D2','upsilon':'\u03C5','Upsilon':'\u03A5','UpTee':'\u22A5','UpTeeArrow':'\u21A5','upuparrows':'\u21C8','urcorn':'\u231D','urcorner':'\u231D','urcrop':'\u230E','uring':'\u016F','Uring':'\u016E','urtri':'\u25F9','uscr':'\uD835\uDCCA','Uscr':'\uD835\uDCB0','utdot':'\u22F0','utilde':'\u0169','Utilde':'\u0168','utri':'\u25B5','utrif':'\u25B4','uuarr':'\u21C8','uuml':'\xFC','Uuml':'\xDC','uwangle':'\u29A7','vangrt':'\u299C','varepsilon':'\u03F5','varkappa':'\u03F0','varnothing':'\u2205','varphi':'\u03D5','varpi':'\u03D6','varpropto':'\u221D','varr':'\u2195','vArr':'\u21D5','varrho':'\u03F1','varsigma':'\u03C2','varsubsetneq':'\u228A\uFE00','varsubsetneqq':'\u2ACB\uFE00','varsupsetneq':'\u228B\uFE00','varsupsetneqq':'\u2ACC\uFE00','vartheta':'\u03D1','vartriangleleft':'\u22B2','vartriangleright':'\u22B3','vBar':'\u2AE8','Vbar':'\u2AEB','vBarv':'\u2AE9','vcy':'\u0432','Vcy':'\u0412','vdash':'\u22A2','vDash':'\u22A8','Vdash':'\u22A9','VDash':'\u22AB','Vdashl':'\u2AE6','vee':'\u2228','Vee':'\u22C1','veebar':'\u22BB','veeeq':'\u225A','vellip':'\u22EE','verbar':'|','Verbar':'\u2016','vert':'|','Vert':'\u2016','VerticalBar':'\u2223','VerticalLine':'|','VerticalSeparator':'\u2758','VerticalTilde':'\u2240','VeryThinSpace':'\u200A','vfr':'\uD835\uDD33','Vfr':'\uD835\uDD19','vltri':'\u22B2','vnsub':'\u2282\u20D2','vnsup':'\u2283\u20D2','vopf':'\uD835\uDD67','Vopf':'\uD835\uDD4D','vprop':'\u221D','vrtri':'\u22B3','vscr':'\uD835\uDCCB','Vscr':'\uD835\uDCB1','vsubne':'\u228A\uFE00','vsubnE':'\u2ACB\uFE00','vsupne':'\u228B\uFE00','vsupnE':'\u2ACC\uFE00','Vvdash':'\u22AA','vzigzag':'\u299A','wcirc':'\u0175','Wcirc':'\u0174','wedbar':'\u2A5F','wedge':'\u2227','Wedge':'\u22C0','wedgeq':'\u2259','weierp':'\u2118','wfr':'\uD835\uDD34','Wfr':'\uD835\uDD1A','wopf':'\uD835\uDD68','Wopf':'\uD835\uDD4E','wp':'\u2118','wr':'\u2240','wreath':'\u2240','wscr':'\uD835\uDCCC','Wscr':'\uD835\uDCB2','xcap':'\u22C2','xcirc':'\u25EF','xcup':'\u22C3','xdtri':'\u25BD','xfr':'\uD835\uDD35','Xfr':'\uD835\uDD1B','xharr':'\u27F7','xhArr':'\u27FA','xi':'\u03BE','Xi':'\u039E','xlarr':'\u27F5','xlArr':'\u27F8','xmap':'\u27FC','xnis':'\u22FB','xodot':'\u2A00','xopf':'\uD835\uDD69','Xopf':'\uD835\uDD4F','xoplus':'\u2A01','xotime':'\u2A02','xrarr':'\u27F6','xrArr':'\u27F9','xscr':'\uD835\uDCCD','Xscr':'\uD835\uDCB3','xsqcup':'\u2A06','xuplus':'\u2A04','xutri':'\u25B3','xvee':'\u22C1','xwedge':'\u22C0','yacute':'\xFD','Yacute':'\xDD','yacy':'\u044F','YAcy':'\u042F','ycirc':'\u0177','Ycirc':'\u0176','ycy':'\u044B','Ycy':'\u042B','yen':'\xA5','yfr':'\uD835\uDD36','Yfr':'\uD835\uDD1C','yicy':'\u0457','YIcy':'\u0407','yopf':'\uD835\uDD6A','Yopf':'\uD835\uDD50','yscr':'\uD835\uDCCE','Yscr':'\uD835\uDCB4','yucy':'\u044E','YUcy':'\u042E','yuml':'\xFF','Yuml':'\u0178','zacute':'\u017A','Zacute':'\u0179','zcaron':'\u017E','Zcaron':'\u017D','zcy':'\u0437','Zcy':'\u0417','zdot':'\u017C','Zdot':'\u017B','zeetrf':'\u2128','ZeroWidthSpace':'\u200B','zeta':'\u03B6','Zeta':'\u0396','zfr':'\uD835\uDD37','Zfr':'\u2128','zhcy':'\u0436','ZHcy':'\u0416','zigrarr':'\u21DD','zopf':'\uD835\uDD6B','Zopf':'\u2124','zscr':'\uD835\uDCCF','Zscr':'\uD835\uDCB5','zwj':'\u200D','zwnj':'\u200C'}; + var decodeMapLegacy = {'aacute':'\xE1','Aacute':'\xC1','acirc':'\xE2','Acirc':'\xC2','acute':'\xB4','aelig':'\xE6','AElig':'\xC6','agrave':'\xE0','Agrave':'\xC0','amp':'&','AMP':'&','aring':'\xE5','Aring':'\xC5','atilde':'\xE3','Atilde':'\xC3','auml':'\xE4','Auml':'\xC4','brvbar':'\xA6','ccedil':'\xE7','Ccedil':'\xC7','cedil':'\xB8','cent':'\xA2','copy':'\xA9','COPY':'\xA9','curren':'\xA4','deg':'\xB0','divide':'\xF7','eacute':'\xE9','Eacute':'\xC9','ecirc':'\xEA','Ecirc':'\xCA','egrave':'\xE8','Egrave':'\xC8','eth':'\xF0','ETH':'\xD0','euml':'\xEB','Euml':'\xCB','frac12':'\xBD','frac14':'\xBC','frac34':'\xBE','gt':'>','GT':'>','iacute':'\xED','Iacute':'\xCD','icirc':'\xEE','Icirc':'\xCE','iexcl':'\xA1','igrave':'\xEC','Igrave':'\xCC','iquest':'\xBF','iuml':'\xEF','Iuml':'\xCF','laquo':'\xAB','lt':'<','LT':'<','macr':'\xAF','micro':'\xB5','middot':'\xB7','nbsp':'\xA0','not':'\xAC','ntilde':'\xF1','Ntilde':'\xD1','oacute':'\xF3','Oacute':'\xD3','ocirc':'\xF4','Ocirc':'\xD4','ograve':'\xF2','Ograve':'\xD2','ordf':'\xAA','ordm':'\xBA','oslash':'\xF8','Oslash':'\xD8','otilde':'\xF5','Otilde':'\xD5','ouml':'\xF6','Ouml':'\xD6','para':'\xB6','plusmn':'\xB1','pound':'\xA3','quot':'"','QUOT':'"','raquo':'\xBB','reg':'\xAE','REG':'\xAE','sect':'\xA7','shy':'\xAD','sup1':'\xB9','sup2':'\xB2','sup3':'\xB3','szlig':'\xDF','thorn':'\xFE','THORN':'\xDE','times':'\xD7','uacute':'\xFA','Uacute':'\xDA','ucirc':'\xFB','Ucirc':'\xDB','ugrave':'\xF9','Ugrave':'\xD9','uml':'\xA8','uuml':'\xFC','Uuml':'\xDC','yacute':'\xFD','Yacute':'\xDD','yen':'\xA5','yuml':'\xFF'}; + var decodeMapNumeric = {'0':'\uFFFD','128':'\u20AC','130':'\u201A','131':'\u0192','132':'\u201E','133':'\u2026','134':'\u2020','135':'\u2021','136':'\u02C6','137':'\u2030','138':'\u0160','139':'\u2039','140':'\u0152','142':'\u017D','145':'\u2018','146':'\u2019','147':'\u201C','148':'\u201D','149':'\u2022','150':'\u2013','151':'\u2014','152':'\u02DC','153':'\u2122','154':'\u0161','155':'\u203A','156':'\u0153','158':'\u017E','159':'\u0178'}; + var invalidReferenceCodePoints = [1,2,3,4,5,6,7,8,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,64976,64977,64978,64979,64980,64981,64982,64983,64984,64985,64986,64987,64988,64989,64990,64991,64992,64993,64994,64995,64996,64997,64998,64999,65000,65001,65002,65003,65004,65005,65006,65007,65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]; - // If the user pushes more data while we're writing to dest then we'll end up - // in ondata again. However, we only want to increase awaitDrain once because - // dest will only emit one 'drain' event for the multiple writes. - // => Introduce a guard on increasing awaitDrain. - var increasedAwaitDrain = false; - src.on('data', ondata); - function ondata(chunk) { - debug('ondata'); - increasedAwaitDrain = false; - var ret = dest.write(chunk); - if (false === ret && !increasedAwaitDrain) { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - // => Check whether `dest` is still a piping destination. - if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { - debug('false write response, pause', src._readableState.awaitDrain); - src._readableState.awaitDrain++; - increasedAwaitDrain = true; - } - src.pause(); - } - } + /*--------------------------------------------------------------------------*/ - // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); - } + var stringFromCharCode = String.fromCharCode; - // Make sure our error handler is attached before userland ones. - prependListener(dest, 'error', onerror); + var object = {}; + var hasOwnProperty = object.hasOwnProperty; + var has = function(object, propertyName) { + return hasOwnProperty.call(object, propertyName); + }; - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - dest.once('close', onclose); - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } - dest.once('finish', onfinish); + var contains = function(array, value) { + var index = -1; + var length = array.length; + while (++index < length) { + if (array[index] == value) { + return true; + } + } + return false; + }; - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } + var merge = function(options, defaults) { + if (!options) { + return defaults; + } + var result = {}; + var key; + for (key in defaults) { + // A `hasOwnProperty` check is not needed here, since only recognized + // option names are used anyway. Any others are ignored. + result[key] = has(options, key) ? options[key] : defaults[key]; + } + return result; + }; - // tell the dest that it's being piped to - dest.emit('pipe', src); + // Modified version of `ucs2encode`; see https://mths.be/punycode. + var codePointToSymbol = function(codePoint, strict) { + var output = ''; + if ((codePoint >= 0xD800 && codePoint <= 0xDFFF) || codePoint > 0x10FFFF) { + // See issue #4: + // “Otherwise, if the number is in the range 0xD800 to 0xDFFF or is + // greater than 0x10FFFF, then this is a parse error. Return a U+FFFD + // REPLACEMENT CHARACTER.” + if (strict) { + parseError('character reference outside the permissible Unicode range'); + } + return '\uFFFD'; + } + if (has(decodeMapNumeric, codePoint)) { + if (strict) { + parseError('disallowed character reference'); + } + return decodeMapNumeric[codePoint]; + } + if (strict && contains(invalidReferenceCodePoints, codePoint)) { + parseError('disallowed character reference'); + } + if (codePoint > 0xFFFF) { + codePoint -= 0x10000; + output += stringFromCharCode(codePoint >>> 10 & 0x3FF | 0xD800); + codePoint = 0xDC00 | codePoint & 0x3FF; + } + output += stringFromCharCode(codePoint); + return output; + }; - // start the flow if it hasn't been started already. - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } + var hexEscape = function(codePoint) { + return '&#x' + codePoint.toString(16).toUpperCase() + ';'; + }; - return dest; -}; + var decEscape = function(codePoint) { + return '&#' + codePoint + ';'; + }; -function pipeOnDrain(src) { - return function () { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) state.awaitDrain--; - if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; -} + var parseError = function(message) { + throw Error('Parse error: ' + message); + }; -Readable.prototype.unpipe = function (dest) { - var state = this._readableState; + /*--------------------------------------------------------------------------*/ - // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) return this; + var encode = function(string, options) { + options = merge(options, encode.options); + var strict = options.strict; + if (strict && regexInvalidRawCodePoint.test(string)) { + parseError('forbidden code point'); + } + var encodeEverything = options.encodeEverything; + var useNamedReferences = options.useNamedReferences; + var allowUnsafeSymbols = options.allowUnsafeSymbols; + var escapeCodePoint = options.decimal ? decEscape : hexEscape; - // just one destination. most common case. - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) return this; + var escapeBmpSymbol = function(symbol) { + return escapeCodePoint(symbol.charCodeAt(0)); + }; - if (!dest) dest = state.pipes; + if (encodeEverything) { + // Encode ASCII symbols. + string = string.replace(regexAsciiWhitelist, function(symbol) { + // Use named references if requested & possible. + if (useNamedReferences && has(encodeMap, symbol)) { + return '&' + encodeMap[symbol] + ';'; + } + return escapeBmpSymbol(symbol); + }); + // Shorten a few escapes that represent two symbols, of which at least one + // is within the ASCII range. + if (useNamedReferences) { + string = string + .replace(/>\u20D2/g, '>⃒') + .replace(/<\u20D2/g, '<⃒') + .replace(/fj/g, 'fj'); + } + // Encode non-ASCII symbols. + if (useNamedReferences) { + // Encode non-ASCII symbols that can be replaced with a named reference. + string = string.replace(regexEncodeNonAscii, function(string) { + // Note: there is no need to check `has(encodeMap, string)` here. + return '&' + encodeMap[string] + ';'; + }); + } + // Note: any remaining non-ASCII symbols are handled outside of the `if`. + } else if (useNamedReferences) { + // Apply named character references. + // Encode `<>"'&` using named character references. + if (!allowUnsafeSymbols) { + string = string.replace(regexEscape, function(string) { + return '&' + encodeMap[string] + ';'; // no need to check `has()` here + }); + } + // Shorten escapes that represent two symbols, of which at least one is + // `<>"'&`. + string = string + .replace(/>\u20D2/g, '>⃒') + .replace(/<\u20D2/g, '<⃒'); + // Encode non-ASCII symbols that can be replaced with a named reference. + string = string.replace(regexEncodeNonAscii, function(string) { + // Note: there is no need to check `has(encodeMap, string)` here. + return '&' + encodeMap[string] + ';'; + }); + } else if (!allowUnsafeSymbols) { + // Encode `<>"'&` using hexadecimal escapes, now that they’re not handled + // using named character references. + string = string.replace(regexEscape, escapeBmpSymbol); + } + return string + // Encode astral symbols. + .replace(regexAstralSymbols, function($0) { + // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + var high = $0.charCodeAt(0); + var low = $0.charCodeAt(1); + var codePoint = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000; + return escapeCodePoint(codePoint); + }) + // Encode any remaining BMP symbols that are not printable ASCII symbols + // using a hexadecimal escape. + .replace(regexBmpWhitelist, escapeBmpSymbol); + }; + // Expose default options (so they can be overridden globally). + encode.options = { + 'allowUnsafeSymbols': false, + 'encodeEverything': false, + 'strict': false, + 'useNamedReferences': false, + 'decimal' : false + }; - // got a match. - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) dest.emit('unpipe', this); - return this; - } + var decode = function(html, options) { + options = merge(options, decode.options); + var strict = options.strict; + if (strict && regexInvalidEntity.test(html)) { + parseError('malformed character reference'); + } + return html.replace(regexDecode, function($0, $1, $2, $3, $4, $5, $6, $7) { + var codePoint; + var semicolon; + var decDigits; + var hexDigits; + var reference; + var next; + if ($1) { + // Decode decimal escapes, e.g. `𝌆`. + decDigits = $1; + semicolon = $2; + if (strict && !semicolon) { + parseError('character reference was not terminated by a semicolon'); + } + codePoint = parseInt(decDigits, 10); + return codePointToSymbol(codePoint, strict); + } + if ($3) { + // Decode hexadecimal escapes, e.g. `𝌆`. + hexDigits = $3; + semicolon = $4; + if (strict && !semicolon) { + parseError('character reference was not terminated by a semicolon'); + } + codePoint = parseInt(hexDigits, 16); + return codePointToSymbol(codePoint, strict); + } + if ($5) { + // Decode named character references with trailing `;`, e.g. `©`. + reference = $5; + if (has(decodeMap, reference)) { + return decodeMap[reference]; + } else { + // Ambiguous ampersand. https://mths.be/notes/ambiguous-ampersands + if (strict) { + parseError( + 'named character reference was not terminated by a semicolon' + ); + } + return $0; + } + } + // If we’re still here, it’s a legacy reference for sure. No need for an + // extra `if` check. + // Decode named character references without trailing `;`, e.g. `&` + // This is only a parse error if it gets converted to `&`, or if it is + // followed by `=` in an attribute context. + reference = $6; + next = $7; + if (next && options.isAttributeValue) { + if (strict && next == '=') { + parseError('`&` did not start a character reference'); + } + return $0; + } else { + if (strict) { + parseError( + 'named character reference was not terminated by a semicolon' + ); + } + // Note: there is no need to check `has(decodeMapLegacy, reference)`. + return decodeMapLegacy[reference] + (next || ''); + } + }); + }; + // Expose default options (so they can be overridden globally). + decode.options = { + 'isAttributeValue': false, + 'strict': false + }; - // slow case. multiple pipe destinations. + var escape = function(string) { + return string.replace(regexEscape, function($0) { + // Note: there is no need to check `has(escapeMap, $0)` here. + return escapeMap[$0]; + }); + }; - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; + /*--------------------------------------------------------------------------*/ - for (var i = 0; i < len; i++) { - dests[i].emit('unpipe', this); - }return this; - } + var he = { + 'version': '1.1.1', + 'encode': encode, + 'decode': decode, + 'escape': escape, + 'unescape': decode + }; - // try to find the right one. - var index = indexOf(state.pipes, dest); - if (index === -1) return this; + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof define == 'function' && + typeof define.amd == 'object' && + define.amd + ) { + define(function() { + return he; + }); + } else if (freeExports && !freeExports.nodeType) { + if (freeModule) { // in Node.js, io.js, or RingoJS v0.8.0+ + freeModule.exports = he; + } else { // in Narwhal or RingoJS v0.7.0- + for (var key in he) { + has(he, key) && (freeExports[key] = he[key]); + } + } + } else { // in Rhino or a web browser + root.he = he; + } - state.pipes.splice(index, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) state.pipes = state.pipes[0]; +}(this)); - dest.emit('unpipe', this); +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],103:[function(require,module,exports){ +var http = require('http'); - return this; +var https = module.exports; + +for (var key in http) { + if (http.hasOwnProperty(key)) https[key] = http[key]; }; -// set up data events if they are asked for -// Ensure readable listeners eventually get something -Readable.prototype.on = function (ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); +https.request = function (params, cb) { + if (!params) params = {}; + params.scheme = 'https'; + params.protocol = 'https:'; + return http.request.call(this, params, cb); +} - if (ev === 'data') { - // Start flowing on next tick if stream isn't explicitly paused - if (this._readableState.flowing !== false) this.resume(); - } else if (ev === 'readable') { - var state = this._readableState; - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.emittedReadable = false; - if (!state.reading) { - processNextTick(nReadingNextTick, this); - } else if (state.length) { - emitReadable(this, state); - } - } - } +},{"http":152}],104:[function(require,module,exports){ +exports.read = function (buffer, offset, isLE, mLen, nBytes) { + var e, m + var eLen = nBytes * 8 - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var nBits = -7 + var i = isLE ? (nBytes - 1) : 0 + var d = isLE ? -1 : 1 + var s = buffer[offset + i] - return res; -}; -Readable.prototype.addListener = Readable.prototype.on; + i += d -function nReadingNextTick(self) { - debug('readable nexttick read 0'); - self.read(0); -} + e = s & ((1 << (-nBits)) - 1) + s >>= (-nBits) + nBits += eLen + for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} -// pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. -Readable.prototype.resume = function () { - var state = this._readableState; - if (!state.flowing) { - debug('resume'); - state.flowing = true; - resume(this, state); - } - return this; -}; + m = e & ((1 << (-nBits)) - 1) + e >>= (-nBits) + nBits += mLen + for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - processNextTick(resume_, stream, state); + if (e === 0) { + e = 1 - eBias + } else if (e === eMax) { + return m ? NaN : ((s ? -1 : 1) * Infinity) + } else { + m = m + Math.pow(2, mLen) + e = e - eBias } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen) } -function resume_(stream, state) { - if (!state.reading) { - debug('resume read 0'); - stream.read(0); +exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c + var eLen = nBytes * 8 - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) + var i = isLE ? 0 : (nBytes - 1) + var d = isLE ? 1 : -1 + var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 + + value = Math.abs(value) + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0 + e = eMax + } else { + e = Math.floor(Math.log(value) / Math.LN2) + if (value * (c = Math.pow(2, -e)) < 1) { + e-- + c *= 2 + } + if (e + eBias >= 1) { + value += rt / c + } else { + value += rt * Math.pow(2, 1 - eBias) + } + if (value * c >= 2) { + e++ + c /= 2 + } + + if (e + eBias >= eMax) { + m = 0 + e = eMax + } else if (e + eBias >= 1) { + m = (value * c - 1) * Math.pow(2, mLen) + e = e + eBias + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) + e = 0 + } } - state.resumeScheduled = false; - state.awaitDrain = 0; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) stream.read(0); + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} + + e = (e << mLen) | m + eLen += mLen + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + + buffer[offset + i - d] |= s * 128 } -Readable.prototype.pause = function () { - debug('call pause flowing=%j', this._readableState.flowing); - if (false !== this._readableState.flowing) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); +},{}],105:[function(require,module,exports){ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor } - return this; -}; - -function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); - while (state.flowing && stream.read() !== null) {} } -// wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. -Readable.prototype.wrap = function (stream) { - var state = this._readableState; - var paused = false; +},{}],106:[function(require,module,exports){ +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ - var self = this; - stream.on('end', function () { - debug('wrapped end'); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) self.push(chunk); - } +// The _isBuffer check is for Safari 5-7 support, because it's missing +// Object.prototype.constructor. Remove this eventually +module.exports = function (obj) { + return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) +} - self.push(null); - }); +function isBuffer (obj) { + return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) +} - stream.on('data', function (chunk) { - debug('wrapped data'); - if (state.decoder) chunk = state.decoder.write(chunk); +// For Node v0.10 support. Remove this eventually. +function isSlowBuffer (obj) { + return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) +} - // don't skip over falsy values in objectMode - if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; +},{}],107:[function(require,module,exports){ +var toString = {}.toString; - var ret = self.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; - // proxy all the other methods. - // important when wrapping filters and duplexes. - for (var i in stream) { - if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = function (method) { - return function () { - return stream[method].apply(stream, arguments); - }; - }(i); - } - } +},{}],108:[function(require,module,exports){ +'use strict'; +var xmlChars = require('xml-char-classes'); - // proxy certain important events. - var events = ['error', 'close', 'destroy', 'pause', 'resume']; - forEach(events, function (ev) { - stream.on(ev, self.emit.bind(self, ev)); - }); +function getRange(re) { + return re.source.slice(1, -1); +} - // when we try to consume some more bytes, simply unpause the - // underlying stream. - self._read = function (n) { - debug('wrapped _read', n); - if (paused) { - paused = false; - stream.resume(); - } - }; +// http://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName +module.exports = new RegExp('^[' + getRange(xmlChars.letter) + '_][' + getRange(xmlChars.letter) + getRange(xmlChars.digit) + '\\.\\-_' + getRange(xmlChars.combiningChar) + getRange(xmlChars.extender) + ']*$'); - return self; +},{"xml-char-classes":165}],109:[function(require,module,exports){ +exports.endianness = function () { return 'LE' }; + +exports.hostname = function () { + if (typeof location !== 'undefined') { + return location.hostname + } + else return ''; }; -// exposed for testing purposes only. -Readable._fromList = fromList; +exports.loadavg = function () { return [] }; -// Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function fromList(n, state) { - // nothing buffered - if (state.length === 0) return null; +exports.uptime = function () { return 0 }; - var ret; - if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { - // read it all, truncate the list - if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); - state.buffer.clear(); - } else { - // read part of list - ret = fromListPartial(n, state.buffer, state.decoder); - } +exports.freemem = function () { + return Number.MAX_VALUE; +}; - return ret; -} +exports.totalmem = function () { + return Number.MAX_VALUE; +}; -// Extracts only enough buffered data to satisfy the amount requested. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function fromListPartial(n, list, hasStrings) { - var ret; - if (n < list.head.data.length) { - // slice is the same for buffers and strings - ret = list.head.data.slice(0, n); - list.head.data = list.head.data.slice(n); - } else if (n === list.head.data.length) { - // first chunk is a perfect match - ret = list.shift(); - } else { - // result spans more than one buffer - ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); - } - return ret; -} +exports.cpus = function () { return [] }; -// Copies a specified amount of characters from the list of buffered data -// chunks. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function copyFromBufferString(n, list) { - var p = list.head; - var c = 1; - var ret = p.data; - n -= ret.length; - while (p = p.next) { - var str = p.data; - var nb = n > str.length ? str.length : n; - if (nb === str.length) ret += str;else ret += str.slice(0, n); - n -= nb; - if (n === 0) { - if (nb === str.length) { - ++c; - if (p.next) list.head = p.next;else list.head = list.tail = null; - } else { - list.head = p; - p.data = str.slice(nb); - } - break; - } - ++c; - } - list.length -= c; - return ret; -} +exports.type = function () { return 'Browser' }; -// Copies a specified amount of bytes from the list of buffered data chunks. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function copyFromBuffer(n, list) { - var ret = bufferShim.allocUnsafe(n); - var p = list.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; - while (p = p.next) { - var buf = p.data; - var nb = n > buf.length ? buf.length : n; - buf.copy(ret, ret.length - n, 0, nb); - n -= nb; - if (n === 0) { - if (nb === buf.length) { - ++c; - if (p.next) list.head = p.next;else list.head = list.tail = null; - } else { - list.head = p; - p.data = buf.slice(nb); - } - break; +exports.release = function () { + if (typeof navigator !== 'undefined') { + return navigator.appVersion; } - ++c; - } - list.length -= c; - return ret; -} + return ''; +}; -function endReadable(stream) { - var state = stream._readableState; +exports.networkInterfaces += exports.getNetworkInterfaces += function () { return {} }; - // If we get here before consuming all the bytes, then that is a - // bug in node. Should never happen. - if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); +exports.arch = function () { return 'javascript' }; - if (!state.endEmitted) { - state.ended = true; - processNextTick(endReadableNT, state, stream); - } -} +exports.platform = function () { return 'browser' }; -function endReadableNT(state, stream) { - // Check that we didn't get one last unshift. - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - } -} +exports.tmpdir = exports.tmpDir = function () { + return '/tmp'; +}; -function forEach(xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } -} +exports.EOL = '\n'; -function indexOf(xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; - } - return -1; -} -}).call(this,require('_process')) -},{"./_stream_duplex":86,"./internal/streams/BufferList":91,"_process":81,"buffer":6,"buffer-shims":5,"core-util-is":69,"events":70,"inherits":74,"isarray":76,"process-nextick-args":80,"string_decoder/":125,"util":3}],89:[function(require,module,exports){ -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. +},{}],110:[function(require,module,exports){ +(function (process){ +// Copyright Joyent, Inc. and other Node contributors. // -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. +// 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: // -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. // -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. +// 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; -'use strict'; + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? arguments[i] : process.cwd(); -module.exports = Transform; + // Skip empty and invalid entries + if (typeof path !== 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + continue; + } -var Duplex = require('./_stream_duplex'); + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charAt(0) === '/'; + } -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ + // 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) -util.inherits(Transform, Duplex); + // Normalize the path + resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { + return !!p; + }), !resolvedAbsolute).join('/'); -function TransformState(stream) { - this.afterTransform = function (er, data) { - return afterTransform(stream, er, data); - }; + return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; +}; - this.needTransform = false; - this.transforming = false; - this.writecb = null; - this.writechunk = null; - this.writeencoding = null; -} +// path.normalize(path) +// posix version +exports.normalize = function(path) { + var isAbsolute = exports.isAbsolute(path), + trailingSlash = substr(path, -1) === '/'; -function afterTransform(stream, er, data) { - var ts = stream._transformState; - ts.transforming = false; + // Normalize the path + path = normalizeArray(filter(path.split('/'), function(p) { + return !!p; + }), !isAbsolute).join('/'); - var cb = ts.writecb; + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } - if (!cb) return stream.emit('error', new Error('no writecb in Transform class')); + return (isAbsolute ? '/' : '') + path; +}; - ts.writechunk = null; - ts.writecb = null; +// posix version +exports.isAbsolute = function(path) { + return path.charAt(0) === '/'; +}; - if (data !== null && data !== undefined) stream.push(data); +// 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('/')); +}; - cb(er); - var rs = stream._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - stream._read(rs.highWaterMark); +// 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); } -} -function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options); + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); - Duplex.call(this, options); + 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; + } + } - this._transformState = new TransformState(this); + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } - var stream = this; + outputParts = outputParts.concat(toParts.slice(samePartsLength)); - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; + return outputParts.join('/'); +}; - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; +exports.sep = '/'; +exports.delimiter = ':'; - if (options) { - if (typeof options.transform === 'function') this._transform = options.transform; +exports.dirname = function(path) { + var result = splitPath(path), + root = result[0], + dir = result[1]; - if (typeof options.flush === 'function') this._flush = options.flush; + if (!root && !dir) { + // No dirname whatsoever + return '.'; } - // When the writable side finishes, then flush out anything remaining. - this.once('prefinish', function () { - if (typeof this._flush === 'function') this._flush(function (er, data) { - done(stream, er, data); - });else done(stream); - }); -} + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.substr(0, dir.length - 1); + } -Transform.prototype.push = function (chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); + return root + dir; }; -// This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. -Transform.prototype._transform = function (chunk, encoding, cb) { - throw new Error('_transform() is not implemented'); -}; -Transform.prototype._write = function (chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); +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]; }; -// Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. -Transform.prototype._read = function (n) { - var ts = this._transformState; +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":112}],111:[function(require,module,exports){ +(function (process){ +'use strict'; + +if (!process.version || + process.version.indexOf('v0.') === 0 || + process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { + module.exports = nextTick; +} else { + module.exports = process.nextTick; +} + +function nextTick(fn, arg1, arg2, arg3) { + if (typeof fn !== 'function') { + throw new TypeError('"callback" argument must be a function'); + } + var len = arguments.length; + var args, i; + switch (len) { + case 0: + case 1: + return process.nextTick(fn); + case 2: + return process.nextTick(function afterTickOne() { + fn.call(null, arg1); + }); + case 3: + return process.nextTick(function afterTickTwo() { + fn.call(null, arg1, arg2); + }); + case 4: + return process.nextTick(function afterTickThree() { + fn.call(null, arg1, arg2, arg3); + }); + default: + args = new Array(len - 1); + i = 0; + while (i < args.length) { + args[i++] = arguments[i]; + } + return process.nextTick(function afterTick() { + fn.apply(null, args); + }); + } +} + +}).call(this,require('_process')) +},{"_process":112}],112:[function(require,module,exports){ +// shim for using process in browser +var process = module.exports = {}; - if (ts.writechunk !== null && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } -}; +// 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. -function done(stream, er, data) { - if (er) return stream.emit('error', er); +var cachedSetTimeout; +var cachedClearTimeout; - if (data !== null && data !== undefined) stream.push(data); +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - var ws = stream._writableState; - var ts = stream._transformState; - if (ws.length) throw new Error('Calling transform done when ws.length != 0'); +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + - if (ts.transforming) throw new Error('Calling transform done when still transforming'); - return stream.push(null); } -},{"./_stream_duplex":86,"core-util-is":69,"inherits":74}],90:[function(require,module,exports){ -(function (process){ -// A bit simpler than readable streams. -// Implement an async ._write(chunk, encoding, cb), and it'll handle all -// the drain event emission and buffering. +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; -'use strict'; +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} -module.exports = Writable; +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; -/**/ -var processNextTick = require('process-nextick-args'); -/**/ + 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; + runClearTimeout(timeout); +} -/**/ -var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick; -/**/ +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) { + runTimeout(drainQueue); + } +}; -/**/ -var Duplex; -/**/ +// 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 = {}; -Writable.WritableState = WritableState; +function noop() {} -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; -/**/ -var internalUtil = { - deprecate: require('util-deprecate') +process.binding = function (name) { + throw new Error('process.binding is not supported'); }; -/**/ -/**/ -var Stream; -(function () { - try { - Stream = require('st' + 'ream'); - } catch (_) {} finally { - if (!Stream) Stream = require('events').EventEmitter; - } -})(); -/**/ +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; -var Buffer = require('buffer').Buffer; -/**/ -var bufferShim = require('buffer-shims'); -/**/ +},{}],113:[function(require,module,exports){ +(function (global){ +/*! https://mths.be/punycode v1.4.1 by @mathias */ +;(function(root) { -util.inherits(Writable, Stream); + /** Detect free variables */ + var freeExports = typeof exports == 'object' && exports && + !exports.nodeType && exports; + var freeModule = typeof module == 'object' && module && + !module.nodeType && module; + var freeGlobal = typeof global == 'object' && global; + if ( + freeGlobal.global === freeGlobal || + freeGlobal.window === freeGlobal || + freeGlobal.self === freeGlobal + ) { + root = freeGlobal; + } -function nop() {} + /** + * The `punycode` object. + * @name punycode + * @type Object + */ + var punycode, -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; - this.next = null; -} + /** Highest positive signed 32-bit float value */ + maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 -function WritableState(options, stream) { - Duplex = Duplex || require('./_stream_duplex'); + /** Bootstring parameters */ + base = 36, + tMin = 1, + tMax = 26, + skew = 38, + damp = 700, + initialBias = 72, + initialN = 128, // 0x80 + delimiter = '-', // '\x2D' - options = options || {}; + /** Regular expressions */ + regexPunycode = /^xn--/, + regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars + regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; + /** Error messages */ + errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' + }, - if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode; + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, - // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - var hwm = options.highWaterMark; - var defaultHwm = this.objectMode ? 16 : 16 * 1024; - this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; + /** Temporary variable */ + key; - // cast to ints. - this.highWaterMark = ~ ~this.highWaterMark; + /*--------------------------------------------------------------------------*/ - // drain event flag. - this.needDrain = false; - // at the start of calling end() - this.ending = false; - // when end() has been called, and returned - this.ended = false; - // when 'finish' is emitted - this.finished = false; + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw new RangeError(errors[type]); + } - // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + var result = []; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; + /** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + var parts = string.split('@'); + var result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + var labels = string.split('.'); + var encoded = map(labels, fn).join('.'); + return result + encoded; + } - // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0; + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } - // a flag to see when we're in the middle of a write. - this.writing = false; + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function(value) { + var output = ''; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + return output; + }).join(''); + } - // when true all writes will be buffered until .uncork() call - this.corked = 0; + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } - // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false; + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * https://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + /** Cached calculation results */ + baseMinusT; - // the callback that's passed to _write(chunk,cb) - this.onwrite = function (er) { - onwrite(stream, er); - }; + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } - // the amount that is being written when _write is called. - this.writelen = 0; + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } - this.bufferedRequest = null; - this.lastBufferedRequest = null; + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. - // number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted - this.pendingcb = 0; + for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { - // emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams - this.prefinished = false; + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for (oldi = i, w = 1, k = base; /* no condition */; k += base) { - // True if the error was already emitted and should not be thrown again - this.errorEmitted = false; + if (index >= inputLength) { + error('invalid-input'); + } - // count buffered requests - this.bufferedRequestCount = 0; + digit = basicToDigit(input.charCodeAt(index++)); - // allocate the first CorkedRequest, there is always - // one allocated and free to use, and we maintain at most two - this.corkedRequestsFree = new CorkedRequest(this); -} + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } -WritableState.prototype.getBuffer = function getBuffer() { - var current = this.bufferedRequest; - var out = []; - while (current) { - out.push(current); - current = current.next; - } - return out; -}; + i += digit * w; + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); -(function () { - try { - Object.defineProperty(WritableState.prototype, 'buffer', { - get: internalUtil.deprecate(function () { - return this.getBuffer(); - }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.') - }); - } catch (_) {} -})(); + if (digit < t) { + break; + } -// Test _writableState for inheritance to account for Duplex streams, -// whose prototype chain only points to Readable. -var realHasInstance; -if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { - realHasInstance = Function.prototype[Symbol.hasInstance]; - Object.defineProperty(Writable, Symbol.hasInstance, { - value: function (object) { - if (realHasInstance.call(this, object)) return true; + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } - return object && object._writableState instanceof WritableState; - } - }); -} else { - realHasInstance = function (object) { - return object instanceof this; - }; -} + w *= baseMinusT; -function Writable(options) { - Duplex = Duplex || require('./_stream_duplex'); + } - // Writable ctor is applied to Duplexes, too. - // `realHasInstance` is necessary because using plain `instanceof` - // would return false, as no `_writableState` property is attached. + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); - // Trying to use the custom `instanceof` for Writable here will also break the - // Node.js LazyTransform implementation, which has a non-trivial getter for - // `_writableState` that would lead to infinite recursion. - if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) { - return new Writable(options); - } + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } - this._writableState = new WritableState(options, this); + n += floor(i / out); + i %= out; - // legacy. - this.writable = true; + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); - if (options) { - if (typeof options.write === 'function') this._write = options.write; + } - if (typeof options.writev === 'function') this._writev = options.writev; - } + return ucs2encode(output); + } - Stream.call(this); -} + /** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; -// Otherwise people can pipe Writable streams, which is just wrong. -Writable.prototype.pipe = function () { - this.emit('error', new Error('Cannot pipe, not readable')); -}; + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); -function writeAfterEnd(stream, cb) { - var er = new Error('write after end'); - // TODO: defer error events consistently everywhere, not just the cb - stream.emit('error', er); - processNextTick(cb, er); -} + // Cache the length + inputLength = input.length; -// If we get something that is not a buffer, string, null, or undefined, -// and we're not in objectMode, then that's an error. -// Otherwise stream chunks are all considered to be of length=1, and the -// watermarks determine how many objects to keep in the buffer, rather than -// how many bytes or characters. -function validChunk(stream, state, chunk, cb) { - var valid = true; - var er = false; - // Always throw error if a null is written - // if we are not in object mode then throw - // if it is not a buffer, string, or undefined. - if (chunk === null) { - er = new TypeError('May not write null values to stream'); - } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - if (er) { - stream.emit('error', er); - processNextTick(cb, er); - valid = false; - } - return valid; -} + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; -Writable.prototype.write = function (chunk, encoding, cb) { - var state = this._writableState; - var ret = false; + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } - if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } + handledCPCount = basicLength = output.length; - if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. - if (typeof cb !== 'function') cb = nop; + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } - if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, chunk, encoding, cb); - } + // Main encoding loop: + while (handledCPCount < inputLength) { - return ret; -}; + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } -Writable.prototype.cork = function () { - var state = this._writableState; + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } - state.corked++; -}; + delta += (m - n) * handledCPCountPlusOne; + n = m; -Writable.prototype.uncork = function () { - var state = this._writableState; + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; - if (state.corked) { - state.corked--; + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } - if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); - } -}; + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for (q = delta, k = base; /* no condition */; k += base) { + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } -Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - // node::ParseEncoding() requires lower case. - if (typeof encoding === 'string') encoding = encoding.toLowerCase(); - if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); - this._writableState.defaultEncoding = encoding; - return this; -}; + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { - chunk = bufferShim.from(chunk, encoding); - } - return chunk; -} + ++delta; + ++n; -// if we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. -function writeOrBuffer(stream, state, chunk, encoding, cb) { - chunk = decodeChunk(state, chunk, encoding); + } + return output.join(''); + } - if (Buffer.isBuffer(chunk)) encoding = 'buffer'; - var len = state.objectMode ? 1 : chunk.length; + /** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(input) { + return mapDomain(input, function(string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + } - state.length += len; + /** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ + function toASCII(input) { + return mapDomain(input, function(string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); + } - var ret = state.length < state.highWaterMark; - // we must ensure that previous needDrain will not be reset to false. - if (!ret) state.needDrain = true; + /*--------------------------------------------------------------------------*/ - if (state.writing || state.corked) { - var last = state.lastBufferedRequest; - state.lastBufferedRequest = new WriteReq(chunk, encoding, cb); - if (last) { - last.next = state.lastBufferedRequest; - } else { - state.bufferedRequest = state.lastBufferedRequest; - } - state.bufferedRequestCount += 1; - } else { - doWrite(stream, state, false, len, chunk, encoding, cb); - } + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '1.4.1', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode + }; - return ret; -} + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof define == 'function' && + typeof define.amd == 'object' && + define.amd + ) { + define('punycode', function() { + return punycode; + }); + } else if (freeExports && freeModule) { + if (module.exports == freeExports) { + // in Node.js, io.js, or RingoJS v0.8.0+ + freeModule.exports = punycode; + } else { + // in Narwhal or RingoJS v0.7.0- + for (key in punycode) { + punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); + } + } + } else { + // in Rhino or a web browser + root.punycode = punycode; + } -function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); - state.sync = false; -} +}(this)); -function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - if (sync) processNextTick(cb, er);else cb(er); +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],114:[function(require,module,exports){ +// 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. - stream._writableState.errorEmitted = true; - stream.emit('error', er); -} +'use strict'; -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; +// If obj.hasOwnProperty has been overridden, then calling +// obj.hasOwnProperty(prop) will break. +// See: https://github.com/joyent/node/issues/1707 +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); } -function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - - onwriteStateUpdate(state); +module.exports = function(qs, sep, eq, options) { + sep = sep || '&'; + eq = eq || '='; + var obj = {}; - if (er) onwriteError(stream, state, sync, er, cb);else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(state); + if (typeof qs !== 'string' || qs.length === 0) { + return obj; + } - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { - clearBuffer(stream, state); - } + var regexp = /\+/g; + qs = qs.split(sep); - if (sync) { - /**/ - asyncWrite(afterWrite, stream, state, finished, cb); - /**/ - } else { - afterWrite(stream, state, finished, cb); - } + var maxKeys = 1000; + if (options && typeof options.maxKeys === 'number') { + maxKeys = options.maxKeys; } -} -function afterWrite(stream, state, finished, cb) { - if (!finished) onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); -} - -// Must force callback to be called on nextTick, so that we don't -// emit 'drain' before the write() consumer gets the 'false' return -// value, and has a chance to attach a 'drain' listener. -function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); + var len = qs.length; + // maxKeys <= 0 means that we should not limit keys count + if (maxKeys > 0 && len > maxKeys) { + len = maxKeys; } -} - -// if there's something in the buffer waiting, then process it -function clearBuffer(stream, state) { - state.bufferProcessing = true; - var entry = state.bufferedRequest; - if (stream._writev && entry && entry.next) { - // Fast case, write everything using _writev() - var l = state.bufferedRequestCount; - var buffer = new Array(l); - var holder = state.corkedRequestsFree; - holder.entry = entry; + for (var i = 0; i < len; ++i) { + var x = qs[i].replace(regexp, '%20'), + idx = x.indexOf(eq), + kstr, vstr, k, v; - var count = 0; - while (entry) { - buffer[count] = entry; - entry = entry.next; - count += 1; + if (idx >= 0) { + kstr = x.substr(0, idx); + vstr = x.substr(idx + 1); + } else { + kstr = x; + vstr = ''; } - doWrite(stream, state, true, state.length, buffer, '', holder.finish); + k = decodeURIComponent(kstr); + v = decodeURIComponent(vstr); - // doWrite is almost always async, defer these to save a bit of time - // as the hot path ends with doWrite - state.pendingcb++; - state.lastBufferedRequest = null; - if (holder.next) { - state.corkedRequestsFree = holder.next; - holder.next = null; + if (!hasOwnProperty(obj, k)) { + obj[k] = v; + } else if (isArray(obj[k])) { + obj[k].push(v); } else { - state.corkedRequestsFree = new CorkedRequest(state); - } - } else { - // Slow case, write chunks one-by-one - while (entry) { - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - - doWrite(stream, state, false, len, chunk, encoding, cb); - entry = entry.next; - // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - if (state.writing) { - break; - } + obj[k] = [obj[k], v]; } - - if (entry === null) state.lastBufferedRequest = null; } - state.bufferedRequestCount = 0; - state.bufferedRequest = entry; - state.bufferProcessing = false; -} + return obj; +}; -Writable.prototype._write = function (chunk, encoding, cb) { - cb(new Error('_write() is not implemented')); +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; }; -Writable.prototype._writev = null; +},{}],115:[function(require,module,exports){ +// 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. -Writable.prototype.end = function (chunk, encoding, cb) { - var state = this._writableState; +'use strict'; - if (typeof chunk === 'function') { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === 'function') { - cb = encoding; - encoding = null; +var stringifyPrimitive = function(v) { + switch (typeof v) { + case 'string': + return v; + + case 'boolean': + return v ? 'true' : 'false'; + + case 'number': + return isFinite(v) ? v : ''; + + default: + return ''; } +}; - if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); +module.exports = function(obj, sep, eq, name) { + sep = sep || '&'; + eq = eq || '='; + if (obj === null) { + obj = undefined; + } + + if (typeof obj === 'object') { + return map(objectKeys(obj), function(k) { + var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; + if (isArray(obj[k])) { + return map(obj[k], function(v) { + return ks + encodeURIComponent(stringifyPrimitive(v)); + }).join(sep); + } else { + return ks + encodeURIComponent(stringifyPrimitive(obj[k])); + } + }).join(sep); - // .end() fully uncorks - if (state.corked) { - state.corked = 1; - this.uncork(); } - // ignore unnecessary end() calls. - if (!state.ending && !state.finished) endWritable(this, state, cb); + if (!name) return ''; + return encodeURIComponent(stringifyPrimitive(name)) + eq + + encodeURIComponent(stringifyPrimitive(obj)); }; -function needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; -} +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; -function prefinish(stream, state) { - if (!state.prefinished) { - state.prefinished = true; - stream.emit('prefinish'); +function map (xs, f) { + if (xs.map) return xs.map(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + res.push(f(xs[i], i)); } + return res; } -function finishMaybe(stream, state) { - var need = needFinish(state); - if (need) { - if (state.pendingcb === 0) { - prefinish(stream, state); - state.finished = true; - stream.emit('finish'); - } else { - prefinish(stream, state); - } +var objectKeys = Object.keys || function (obj) { + var res = []; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); } - return need; -} + return res; +}; -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) processNextTick(cb);else stream.once('finish', cb); - } - state.ended = true; - stream.writable = false; -} +},{}],116:[function(require,module,exports){ +'use strict'; -// It seems a linked list but it is not -// there will be only 2 of these for each stream -function CorkedRequest(state) { - var _this = this; +exports.decode = exports.parse = require('./decode'); +exports.encode = exports.stringify = require('./encode'); - this.next = null; - this.entry = null; +},{"./decode":114,"./encode":115}],117:[function(require,module,exports){ +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. - this.finish = function (err) { - var entry = _this.entry; - _this.entry = null; - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } - if (state.corkedRequestsFree) { - state.corkedRequestsFree.next = _this; - } else { - state.corkedRequestsFree = _this; - } - }; -} -}).call(this,require('_process')) -},{"./_stream_duplex":86,"_process":81,"buffer":6,"buffer-shims":5,"core-util-is":69,"events":70,"inherits":74,"process-nextick-args":80,"util-deprecate":141}],91:[function(require,module,exports){ 'use strict'; -var Buffer = require('buffer').Buffer; /**/ -var bufferShim = require('buffer-shims'); + +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) { + keys.push(key); + }return keys; +}; +/**/ + +module.exports = Duplex; + +/**/ +var processNextTick = require('process-nextick-args'); +/**/ + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); /**/ -module.exports = BufferList; +var Readable = require('./_stream_readable'); +var Writable = require('./_stream_writable'); + +util.inherits(Duplex, Readable); + +var keys = objectKeys(Writable.prototype); +for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; +} + +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + + Readable.call(this, options); + Writable.call(this, options); + + if (options && options.readable === false) this.readable = false; -function BufferList() { - this.head = null; - this.tail = null; - this.length = 0; -} + if (options && options.writable === false) this.writable = false; -BufferList.prototype.push = function (v) { - var entry = { data: v, next: null }; - if (this.length > 0) this.tail.next = entry;else this.head = entry; - this.tail = entry; - ++this.length; -}; + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; -BufferList.prototype.unshift = function (v) { - var entry = { data: v, next: this.head }; - if (this.length === 0) this.tail = entry; - this.head = entry; - ++this.length; -}; + this.once('end', onend); +} -BufferList.prototype.shift = function () { - if (this.length === 0) return; - var ret = this.head.data; - if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; - --this.length; - return ret; -}; +// the no-half-open enforcer +function onend() { + // if we allow half-open state, or if the writable side ended, + // then we're ok. + if (this.allowHalfOpen || this._writableState.ended) return; -BufferList.prototype.clear = function () { - this.head = this.tail = null; - this.length = 0; -}; + // no more data can be written. + // But allow more writes to happen in this tick. + processNextTick(onEndNT, this); +} -BufferList.prototype.join = function (s) { - if (this.length === 0) return ''; - var p = this.head; - var ret = '' + p.data; - while (p = p.next) { - ret += s + p.data; - }return ret; -}; +function onEndNT(self) { + self.end(); +} -BufferList.prototype.concat = function (n) { - if (this.length === 0) return bufferShim.alloc(0); - if (this.length === 1) return this.head.data; - var ret = bufferShim.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; - while (p) { - p.data.copy(ret, i); - i += p.data.length; - p = p.next; +function forEach(xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); } - return ret; -}; -},{"buffer":6,"buffer-shims":5}],92:[function(require,module,exports){ -(function (process){ -var Stream = (function (){ - try { - return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify - } catch(_){} -}()); -exports = module.exports = require('./lib/_stream_readable.js'); -exports.Stream = Stream || exports; -exports.Readable = exports; -exports.Writable = require('./lib/_stream_writable.js'); -exports.Duplex = require('./lib/_stream_duplex.js'); -exports.Transform = require('./lib/_stream_transform.js'); -exports.PassThrough = require('./lib/_stream_passthrough.js'); - -if (!process.browser && process.env.READABLE_STREAM === 'disable' && Stream) { - module.exports = Stream; } +},{"./_stream_readable":119,"./_stream_writable":121,"core-util-is":100,"inherits":105,"process-nextick-args":111}],118:[function(require,module,exports){ +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. -}).call(this,require('_process')) -},{"./lib/_stream_duplex.js":86,"./lib/_stream_passthrough.js":87,"./lib/_stream_readable.js":88,"./lib/_stream_transform.js":89,"./lib/_stream_writable.js":90,"_process":81}],93:[function(require,module,exports){ -"use strict"; +'use strict'; -module.exports = -{ - // Output - ABSOLUTE: "absolute", - PATH_RELATIVE: "pathRelative", - ROOT_RELATIVE: "rootRelative", - SHORTEST: "shortest" -}; +module.exports = PassThrough; -},{}],94:[function(require,module,exports){ -"use strict"; +var Transform = require('./_stream_transform'); -var constants = require("./constants"); +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ +util.inherits(PassThrough, Transform); +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); -function formatAuth(urlObj, options) -{ - if (urlObj.auth && !options.removeAuth && (urlObj.extra.relation.maximumHost || options.output===constants.ABSOLUTE)) - { - return urlObj.auth + "@"; - } - - return ""; + Transform.call(this, options); } +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +}; +},{"./_stream_transform":120,"core-util-is":100,"inherits":105}],119:[function(require,module,exports){ +(function (process){ +'use strict'; +module.exports = Readable; -function formatHash(urlObj, options) -{ - return urlObj.hash ? urlObj.hash : ""; -} +/**/ +var processNextTick = require('process-nextick-args'); +/**/ +/**/ +var isArray = require('isarray'); +/**/ +/**/ +var Duplex; +/**/ -function formatHost(urlObj, options) -{ - if (urlObj.host.full && (urlObj.extra.relation.maximumAuth || options.output===constants.ABSOLUTE)) - { - return urlObj.host.full; - } - - return ""; -} +Readable.ReadableState = ReadableState; +/**/ +var EE = require('events').EventEmitter; +var EElistenerCount = function (emitter, type) { + return emitter.listeners(type).length; +}; +/**/ -function formatPath(urlObj, options) -{ - var str = ""; - - var absolutePath = urlObj.path.absolute.string; - var relativePath = urlObj.path.relative.string; - var resource = showResource(urlObj, options); - - if (urlObj.extra.relation.maximumHost || options.output===constants.ABSOLUTE || options.output===constants.ROOT_RELATIVE) - { - str = absolutePath; - } - else if (relativePath.length<=absolutePath.length && options.output===constants.SHORTEST || options.output===constants.PATH_RELATIVE) - { - str = relativePath; - - if (str === "") - { - var query = showQuery(urlObj,options) && !!getQuery(urlObj,options); - - if (urlObj.extra.relation.maximumPath && !resource) - { - str = "./"; - } - else if (urlObj.extra.relation.overridesQuery && !resource && !query) - { - str = "./"; - } - } - } - else - { - str = absolutePath; - } - - if ( str==="/" && !resource && options.removeRootTrailingSlash && (!urlObj.extra.relation.minimumPort || options.output===constants.ABSOLUTE) ) - { - str = ""; - } - - return str; -} +/**/ +var Stream; +(function () { + try { + Stream = require('st' + 'ream'); + } catch (_) {} finally { + if (!Stream) Stream = require('events').EventEmitter; + } +})(); +/**/ +var Buffer = require('buffer').Buffer; +/**/ +var bufferShim = require('buffer-shims'); +/**/ +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ -function formatPort(urlObj, options) -{ - if (urlObj.port && !urlObj.extra.portIsDefault && urlObj.extra.relation.maximumHost) - { - return ":" + urlObj.port; - } - - return ""; +/**/ +var debugUtil = require('util'); +var debug = void 0; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function () {}; } +/**/ +var BufferList = require('./internal/streams/BufferList'); +var StringDecoder; +util.inherits(Readable, Stream); -function formatQuery(urlObj, options) -{ - return showQuery(urlObj,options) ? getQuery(urlObj, options) : ""; +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') { + return emitter.prependListener(event, fn); + } else { + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; + } } +function ReadableState(options, stream) { + Duplex = Duplex || require('./_stream_duplex'); + + options = options || {}; + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode; -function formatResource(urlObj, options) -{ - return showResource(urlObj,options) ? urlObj.resource : ""; -} + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + var hwm = options.highWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; + // cast to ints. + this.highWaterMark = ~ ~this.highWaterMark; + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; -function formatScheme(urlObj, options) -{ - var str = ""; - - if (urlObj.extra.relation.maximumHost || options.output===constants.ABSOLUTE) - { - if (!urlObj.extra.relation.minimumScheme || !options.schemeRelative || options.output===constants.ABSOLUTE) - { - str += urlObj.scheme + "://"; - } - else - { - str += "//"; - } - } - - return str; -} + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; -function formatUrl(urlObj, options) -{ - var url = ""; - - url += formatScheme(urlObj, options); - url += formatAuth(urlObj, options); - url += formatHost(urlObj, options); - url += formatPort(urlObj, options); - url += formatPath(urlObj, options); - url += formatResource(urlObj, options); - url += formatQuery(urlObj, options); - url += formatHash(urlObj, options); - - return url; -} + // when piping, we only care about 'readable' events that happen + // after read()ing all the bytes and not getting any pushback. + this.ranOut = false; + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + // if true, a maybeReadMore has been scheduled + this.readingMore = false; -function getQuery(urlObj, options) -{ - var stripQuery = options.removeEmptyQueries && urlObj.extra.relation.minimumPort; - - return urlObj.query.string[ stripQuery ? "stripped" : "full" ]; + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } } +function Readable(options) { + Duplex = Duplex || require('./_stream_duplex'); + if (!(this instanceof Readable)) return new Readable(options); -function showQuery(urlObj, options) -{ - return !urlObj.extra.relation.minimumQuery || options.output===constants.ABSOLUTE || options.output===constants.ROOT_RELATIVE; -} + this._readableState = new ReadableState(options, this); + // legacy + this.readable = true; + if (options && typeof options.read === 'function') this._read = options.read; -function showResource(urlObj, options) -{ - var removeIndex = options.removeDirectoryIndexes && urlObj.extra.resourceIsIndex; - var removeMatchingResource = urlObj.extra.relation.minimumResource && options.output!==constants.ABSOLUTE && options.output!==constants.ROOT_RELATIVE; - - return !!urlObj.resource && !removeMatchingResource && !removeIndex; + Stream.call(this); } +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + if (!state.objectMode && typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = bufferShim.from(chunk, encoding); + encoding = ''; + } + } -module.exports = formatUrl; + return readableAddChunk(this, state, chunk, encoding, false); +}; -},{"./constants":93}],95:[function(require,module,exports){ -"use strict"; +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function (chunk) { + var state = this._readableState; + return readableAddChunk(this, state, chunk, '', true); +}; -var constants = require("./constants"); -var formatUrl = require("./format"); -var getOptions = require("./options"); -var objUtils = require("./util/object"); -var parseUrl = require("./parse"); -var relateUrl = require("./relate"); +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; +function readableAddChunk(stream, state, chunk, encoding, addToFront) { + var er = chunkInvalid(state, chunk); + if (er) { + stream.emit('error', er); + } else if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (state.ended && !addToFront) { + var e = new Error('stream.push() after EOF'); + stream.emit('error', e); + } else if (state.endEmitted && addToFront) { + var _e = new Error('stream.unshift() after end event'); + stream.emit('error', _e); + } else { + var skipAdd; + if (state.decoder && !addToFront && !encoding) { + chunk = state.decoder.write(chunk); + skipAdd = !state.objectMode && chunk.length === 0; + } + if (!addToFront) state.reading = false; -function RelateUrl(from, options) -{ - this.options = getOptions(options, - { - defaultPorts: {ftp:21, http:80, https:443}, - directoryIndexes: ["index.html"], - ignore_www: false, - output: RelateUrl.SHORTEST, - rejectedSchemes: ["data","javascript","mailto"], - removeAuth: false, - removeDirectoryIndexes: true, - removeEmptyQueries: false, - removeRootTrailingSlash: true, - schemeRelative: true, - site: undefined, - slashesDenoteHost: true - }); - - this.from = parseUrl.from(from, this.options, null); -} + // Don't add to the buffer if we've decoded to an empty string chunk and + // we're not in object mode + if (!skipAdd) { + // if we want the data now, just emit it. + if (state.flowing && state.length === 0 && !state.sync) { + stream.emit('data', chunk); + stream.read(0); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + if (state.needReadable) emitReadable(stream); + } + } + maybeReadMore(stream, state); + } + } else if (!addToFront) { + state.reading = false; + } -/* - Usage: instance=new RelateUrl(); instance.relate(); -*/ -RelateUrl.prototype.relate = function(from, to, options) -{ - // relate(to,options) - if ( objUtils.isPlainObject(to) ) - { - options = to; - to = from; - from = null; - } - // relate(to) - else if (!to) - { - to = from; - from = null; - } - - options = getOptions(options, this.options); - from = from || options.site; - from = parseUrl.from(from, options, this.from); - - if (!from || !from.href) - { - throw new Error("from value not defined."); - } - else if (from.extra.hrefInfo.minimumPathOnly) - { - throw new Error("from value supplied is not absolute: "+from.href); - } - - to = parseUrl.to(to, options); - - if (to.valid===false) return to.href; - - to = relateUrl(from, to, options); - to = formatUrl(to, options); - - return to; + return needMoreData(state); } - - -/* - Usage: RelateUrl.relate(); -*/ -RelateUrl.relate = function(from, to, options) -{ - return new RelateUrl().relate(from, to, options); +// if it's past the high water mark, we can push in some more. +// Also, if we have no data yet, we can stand some +// more bytes. This is to work around cases where hwm=0, +// such as the repl. Also, if the push() triggered a +// readable event, and the user called read(largeNumber) such that +// needReadable was set, then we ought to push more, so that another +// 'readable' event will be triggered. +function needMoreData(state) { + return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); } +// backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + this._readableState.decoder = new StringDecoder(enc); + this._readableState.encoding = enc; + return this; +}; +// Don't raise the hwm > 8MB +var MAX_HWM = 0x800000; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; +} -// Make constants accessible from API -objUtils.shallowMerge(RelateUrl, constants); +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; + // Don't have enough + if (!state.ended) { + state.needReadable = true; + return 0; + } + return state.length; +} +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + if (n !== 0) state.emittedReadable = false; -module.exports = RelateUrl; + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } -},{"./constants":93,"./format":94,"./options":96,"./parse":99,"./relate":106,"./util/object":108}],96:[function(require,module,exports){ -"use strict"; + n = howMuchToRead(n, state); -var objUtils = require("./util/object"); + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); -function getOptions(options, defaults) -{ - if ( objUtils.isPlainObject(options) ) - { - var newOptions = {}; - - for (var i in defaults) - { - if ( defaults.hasOwnProperty(i) ) - { - if (options[i] !== undefined) - { - newOptions[i] = mergeOption(options[i], defaults[i]); - } - else - { - newOptions[i] = defaults[i]; - } - } - } - - return newOptions; - } - else - { - return defaults; - } -} + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state); + } + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; -function mergeOption(newValues, defaultValues) -{ - if (defaultValues instanceof Object && newValues instanceof Object) - { - if (defaultValues instanceof Array && newValues instanceof Array) - { - return defaultValues.concat(newValues); - } - else - { - return objUtils.shallowMerge(newValues, defaultValues); - } - } - - return newValues; -} + if (ret === null) { + state.needReadable = true; + n = 0; + } else { + state.length -= n; + } + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended) endReadable(this); + } -module.exports = getOptions; + if (ret !== null) this.emit('data', ret); -},{"./util/object":108}],97:[function(require,module,exports){ -"use strict"; + return ret; +}; -function parseHost(urlObj, options) -{ - // TWEAK :: condition only for speed optimization - if (options.ignore_www) - { - var host = urlObj.host.full; - - if (host) - { - var stripped = host; - - if (host.indexOf("www.") === 0) - { - stripped = host.substr(4); - } - - urlObj.host.stripped = stripped; - } - } +function chunkInvalid(state, chunk) { + var er = null; + if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + return er; } +function onEofChunk(stream, state) { + if (state.ended) return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + // emit 'readable' now to make sure it gets picked up. + emitReadable(stream); +} -module.exports = parseHost; - -},{}],98:[function(require,module,exports){ -"use strict"; +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream); + } +} -function hrefInfo(urlObj) -{ - var minimumPathOnly = (!urlObj.scheme && !urlObj.auth && !urlObj.host.full && !urlObj.port); - var minimumResourceOnly = (minimumPathOnly && !urlObj.path.absolute.string); - var minimumQueryOnly = (minimumResourceOnly && !urlObj.resource); - var minimumHashOnly = (minimumQueryOnly && !urlObj.query.string.full.length); - var empty = (minimumHashOnly && !urlObj.hash); - - urlObj.extra.hrefInfo.minimumPathOnly = minimumPathOnly; - urlObj.extra.hrefInfo.minimumResourceOnly = minimumResourceOnly; - urlObj.extra.hrefInfo.minimumQueryOnly = minimumQueryOnly; - urlObj.extra.hrefInfo.minimumHashOnly = minimumHashOnly; - urlObj.extra.hrefInfo.empty = empty; +function emitReadable_(stream) { + debug('emit readable'); + stream.emit('readable'); + flow(stream); } +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + processNextTick(maybeReadMore_, stream, state); + } +} +function maybeReadMore_(stream, state) { + var len = state.length; + while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break;else len = state.length; + } + state.readingMore = false; +} -module.exports = hrefInfo; +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function (n) { + this.emit('error', new Error('_read() is not implemented')); +}; -},{}],99:[function(require,module,exports){ -"use strict"; +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; -var hrefInfo = require("./hrefInfo"); -var parseHost = require("./host"); -var parsePath = require("./path"); -var parsePort = require("./port"); -var parseQuery = require("./query"); -var parseUrlString = require("./urlstring"); -var pathUtils = require("../util/path"); + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + var endFn = doEnd ? onend : cleanup; + if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn); -function parseFromUrl(url, options, fallback) -{ - if (url) - { - var urlObj = parseUrl(url, options); - - // Because the following occurs in the relate stage for "to" URLs, - // such had to be mostly duplicated here - - var pathArray = pathUtils.resolveDotSegments(urlObj.path.absolute.array); - - urlObj.path.absolute.array = pathArray; - urlObj.path.absolute.string = "/" + pathUtils.join(pathArray); - - return urlObj; - } - else - { - return fallback; - } -} + dest.on('unpipe', onunpipe); + function onunpipe(readable) { + debug('onunpipe'); + if (readable === src) { + cleanup(); + } + } + + function onend() { + debug('onend'); + dest.end(); + } + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + var cleanedUp = false; + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', cleanup); + src.removeListener('data', ondata); -function parseUrl(url, options) -{ - var urlObj = parseUrlString(url, options); - - if (urlObj.valid===false) return urlObj; - - parseHost(urlObj, options); - parsePort(urlObj, options); - parsePath(urlObj, options); - parseQuery(urlObj, options); - hrefInfo(urlObj); - - return urlObj; -} + cleanedUp = true; + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } + // If the user pushes more data while we're writing to dest then we'll end up + // in ondata again. However, we only want to increase awaitDrain once because + // dest will only emit one 'drain' event for the multiple writes. + // => Introduce a guard on increasing awaitDrain. + var increasedAwaitDrain = false; + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + increasedAwaitDrain = false; + var ret = dest.write(chunk); + if (false === ret && !increasedAwaitDrain) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', src._readableState.awaitDrain); + src._readableState.awaitDrain++; + increasedAwaitDrain = true; + } + src.pause(); + } + } -module.exports = -{ - from: parseFromUrl, - to: parseUrl -}; + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); + } -},{"../util/path":109,"./host":97,"./hrefInfo":98,"./path":100,"./port":101,"./query":102,"./urlstring":103}],100:[function(require,module,exports){ -"use strict"; + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror); -function isDirectoryIndex(resource, options) -{ - var verdict = false; - - options.directoryIndexes.every( function(index) - { - if (index === resource) - { - verdict = true; - return false; - } - - return true; - }); - - return verdict; -} + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } + // tell the dest that it's being piped to + dest.emit('pipe', src); -function parsePath(urlObj, options) -{ - var path = urlObj.path.absolute.string; - - if (path) - { - var lastSlash = path.lastIndexOf("/"); - - if (lastSlash > -1) - { - if (++lastSlash < path.length) - { - var resource = path.substr(lastSlash); - - if (resource!=="." && resource!=="..") - { - urlObj.resource = resource; - path = path.substr(0, lastSlash); - } - else - { - path += "/"; - } - } - - urlObj.path.absolute.string = path; - urlObj.path.absolute.array = splitPath(path); - } - else if (path==="." || path==="..") - { - // "..?var", "..#anchor", etc ... not "..index.html" - path += "/"; - - urlObj.path.absolute.string = path; - urlObj.path.absolute.array = splitPath(path); - } - else - { - // Resource-only - urlObj.resource = path; - urlObj.path.absolute.string = null; - } - - urlObj.extra.resourceIsIndex = isDirectoryIndex(urlObj.resource, options); - } - // Else: query/hash-only or empty + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + + return dest; +}; + +function pipeOnDrain(src) { + return function () { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; } +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) return this; -function splitPath(path) -{ - // TWEAK :: condition only for speed optimization - if (path !== "/") - { - var cleaned = []; - - path.split("/").forEach( function(dir) - { - // Cleanup -- splitting "/dir/" becomes ["","dir",""] - if (dir !== "") - { - cleaned.push(dir); - } - }); - - return cleaned; - } - else - { - // Faster to skip the above block and just create an array - return []; - } -} + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + if (!dest) dest = state.pipes; + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this); + return this; + } -module.exports = parsePath; + // slow case. multiple pipe destinations. -},{}],101:[function(require,module,exports){ -"use strict"; + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; -function parsePort(urlObj, options) -{ - var defaultPort = -1; - - for (var i in options.defaultPorts) - { - if ( i===urlObj.scheme && options.defaultPorts.hasOwnProperty(i) ) - { - defaultPort = options.defaultPorts[i]; - break; - } - } - - if (defaultPort > -1) - { - // Force same type as urlObj.port - defaultPort = defaultPort.toString(); - - if (urlObj.port === null) - { - urlObj.port = defaultPort; - } - - urlObj.extra.portIsDefault = (urlObj.port === defaultPort); - } -} + for (var i = 0; i < len; i++) { + dests[i].emit('unpipe', this); + }return this; + } + // try to find the right one. + var index = indexOf(state.pipes, dest); + if (index === -1) return this; + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; -module.exports = parsePort; + dest.emit('unpipe', this); -},{}],102:[function(require,module,exports){ -"use strict"; -var hasOwnProperty = Object.prototype.hasOwnProperty; + return this; +}; +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + if (ev === 'data') { + // Start flowing on next tick if stream isn't explicitly paused + if (this._readableState.flowing !== false) this.resume(); + } else if (ev === 'readable') { + var state = this._readableState; + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.emittedReadable = false; + if (!state.reading) { + processNextTick(nReadingNextTick, this); + } else if (state.length) { + emitReadable(this, state); + } + } + } -function parseQuery(urlObj, options) -{ - urlObj.query.string.full = stringify(urlObj.query.object, false); - - // TWEAK :: condition only for speed optimization - if (options.removeEmptyQueries) - { - urlObj.query.string.stripped = stringify(urlObj.query.object, true); - } + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; + +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); } +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function () { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + state.flowing = true; + resume(this, state); + } + return this; +}; +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + processNextTick(resume_, stream, state); + } +} -function stringify(queryObj, removeEmptyQueries) -{ - var count = 0; - var str = ""; - - for (var i in queryObj) - { - if ( i!=="" && hasOwnProperty.call(queryObj, i)===true ) - { - var value = queryObj[i]; - - if (value !== "" || !removeEmptyQueries) - { - str += (++count===1) ? "?" : "&"; - - i = encodeURIComponent(i); - - if (value !== "") - { - str += i +"="+ encodeURIComponent(value).replace(/%20/g,"+"); - } - else - { - str += i; - } - } - } - } - - return str; +function resume_(stream, state) { + if (!state.reading) { + debug('resume read 0'); + stream.read(0); + } + + state.resumeScheduled = false; + state.awaitDrain = 0; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} + +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + if (false !== this._readableState.flowing) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + return this; +}; + +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + while (state.flowing && stream.read() !== null) {} } +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function (stream) { + var state = this._readableState; + var paused = false; + + var self = this; + stream.on('end', function () { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) self.push(chunk); + } + + self.push(null); + }); + + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); + + // don't skip over falsy values in objectMode + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + + var ret = self.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function (method) { + return function () { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } + + // proxy certain important events. + var events = ['error', 'close', 'destroy', 'pause', 'resume']; + forEach(events, function (ev) { + stream.on(ev, self.emit.bind(self, ev)); + }); + // when we try to consume some more bytes, simply unpause the + // underlying stream. + self._read = function (n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; -module.exports = parseQuery; + return self; +}; -},{}],103:[function(require,module,exports){ -"use strict"; +// exposed for testing purposes only. +Readable._fromList = fromList; -var _parseUrl = require("url").parse; +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = fromListPartial(n, state.buffer, state.decoder); + } + return ret; +} -/* - Customize the URL object that Node generates - because: - - * necessary data for later - * urlObj.host is useless - * urlObj.hostname is too long - * urlObj.path is useless - * urlObj.pathname is too long - * urlObj.protocol is inaccurate; should be called "scheme" - * urlObj.search is mostly useless -*/ -function clean(urlObj) -{ - var scheme = urlObj.protocol; - - if (scheme) - { - // Remove ":" suffix - if (scheme.indexOf(":") === scheme.length-1) - { - scheme = scheme.substr(0, scheme.length-1); - } - } - - urlObj.host = - { - // TODO :: unescape(encodeURIComponent(s)) ? ... http://ecmanaut.blogspot.ca/2006/07/encoding-decoding-utf8-in-javascript.html - full: urlObj.hostname, - stripped: null - }; - - urlObj.path = - { - absolute: - { - array: null, - string: urlObj.pathname - }, - relative: - { - array: null, - string: null - } - }; - - urlObj.query = - { - object: urlObj.query, - string: - { - full: null, - stripped: null - } - }; - - urlObj.extra = - { - hrefInfo: - { - minimumPathOnly: null, - minimumResourceOnly: null, - minimumQueryOnly: null, - minimumHashOnly: null, - empty: null, - - separatorOnlyQuery: urlObj.search==="?" - }, - portIsDefault: null, - relation: - { - maximumScheme: null, - maximumAuth: null, - maximumHost: null, - maximumPort: null, - maximumPath: null, - maximumResource: null, - maximumQuery: null, - maximumHash: null, - - minimumScheme: null, - minimumAuth: null, - minimumHost: null, - minimumPort: null, - minimumPath: null, - minimumResource: null, - minimumQuery: null, - minimumHash: null, - - overridesQuery: null - }, - resourceIsIndex: null, - slashes: urlObj.slashes - }; - - urlObj.resource = null; - urlObj.scheme = scheme; - delete urlObj.hostname; - delete urlObj.pathname; - delete urlObj.protocol; - delete urlObj.search; - delete urlObj.slashes; - - return urlObj; +// Extracts only enough buffered data to satisfy the amount requested. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromListPartial(n, list, hasStrings) { + var ret; + if (n < list.head.data.length) { + // slice is the same for buffers and strings + ret = list.head.data.slice(0, n); + list.head.data = list.head.data.slice(n); + } else if (n === list.head.data.length) { + // first chunk is a perfect match + ret = list.shift(); + } else { + // result spans more than one buffer + ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); + } + return ret; +} + +// Copies a specified amount of characters from the list of buffered data +// chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBufferString(n, list) { + var p = list.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret; +} + +// Copies a specified amount of bytes from the list of buffered data chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBuffer(n, list) { + var ret = bufferShim.allocUnsafe(n); + var p = list.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret; } +function endReadable(stream) { + var state = stream._readableState; + // If we get here before consuming all the bytes, then that is a + // bug in node. Should never happen. + if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); -function validScheme(url, options) -{ - var valid = true; - - options.rejectedSchemes.every( function(rejectedScheme) - { - valid = !(url.indexOf(rejectedScheme+":") === 0); - - // Break loop - return valid; - }); - - return valid; + if (!state.endEmitted) { + state.ended = true; + processNextTick(endReadableNT, state, stream); + } +} + +function endReadableNT(state, stream) { + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + } } - - -function parseUrlString(url, options) -{ - if ( validScheme(url,options) ) - { - return clean( _parseUrl(url, true, options.slashesDenoteHost) ); - } - else - { - return {href:url, valid:false}; - } +function forEach(xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } } +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} +}).call(this,require('_process')) +},{"./_stream_duplex":117,"./internal/streams/BufferList":122,"_process":112,"buffer":5,"buffer-shims":4,"core-util-is":100,"events":101,"inherits":105,"isarray":107,"process-nextick-args":111,"string_decoder/":156,"util":2}],120:[function(require,module,exports){ +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. +'use strict'; -module.exports = parseUrlString; +module.exports = Transform; -},{"url":139}],104:[function(require,module,exports){ -"use strict"; +var Duplex = require('./_stream_duplex'); -var findRelation = require("./findRelation"); -var objUtils = require("../util/object"); -var pathUtils = require("../util/path"); +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ +util.inherits(Transform, Duplex); +function TransformState(stream) { + this.afterTransform = function (er, data) { + return afterTransform(stream, er, data); + }; -function absolutize(urlObj, siteUrlObj, options) -{ - findRelation.upToPath(urlObj, siteUrlObj, options); - - // Fill in relative URLs - if (urlObj.extra.relation.minimumScheme) urlObj.scheme = siteUrlObj.scheme; - if (urlObj.extra.relation.minimumAuth) urlObj.auth = siteUrlObj.auth; - if (urlObj.extra.relation.minimumHost) urlObj.host = objUtils.clone(siteUrlObj.host); - if (urlObj.extra.relation.minimumPort) copyPort(urlObj, siteUrlObj); - if (urlObj.extra.relation.minimumScheme) copyPath(urlObj, siteUrlObj); - - // Check remaining relativeness now that path has been copied and/or resolved - findRelation.pathOn(urlObj, siteUrlObj, options); - - // Fill in relative URLs - if (urlObj.extra.relation.minimumResource) copyResource(urlObj, siteUrlObj); - if (urlObj.extra.relation.minimumQuery) urlObj.query = objUtils.clone(siteUrlObj.query); - if (urlObj.extra.relation.minimumHash) urlObj.hash = siteUrlObj.hash; + this.needTransform = false; + this.transforming = false; + this.writecb = null; + this.writechunk = null; + this.writeencoding = null; } +function afterTransform(stream, er, data) { + var ts = stream._transformState; + ts.transforming = false; + var cb = ts.writecb; -/* - Get an absolute path that's relative to site url. -*/ -function copyPath(urlObj, siteUrlObj) -{ - if (urlObj.extra.relation.maximumHost || !urlObj.extra.hrefInfo.minimumResourceOnly) - { - var pathArray = urlObj.path.absolute.array; - var pathString = "/"; - - // If not erroneous URL - if (pathArray) - { - // If is relative path - if (urlObj.extra.hrefInfo.minimumPathOnly && urlObj.path.absolute.string.indexOf("/")!==0) - { - // Append path to site path - pathArray = siteUrlObj.path.absolute.array.concat(pathArray); - } - - pathArray = pathUtils.resolveDotSegments(pathArray); - pathString += pathUtils.join(pathArray); - } - else - { - pathArray = []; - } - - urlObj.path.absolute.array = pathArray; - urlObj.path.absolute.string = pathString; - } - else - { - // Resource-, query- or hash-only or empty - urlObj.path = objUtils.clone(siteUrlObj.path); - } -} - - + if (!cb) return stream.emit('error', new Error('no writecb in Transform class')); -function copyPort(urlObj, siteUrlObj) -{ - urlObj.port = siteUrlObj.port; - - urlObj.extra.portIsDefault = siteUrlObj.extra.portIsDefault; -} + ts.writechunk = null; + ts.writecb = null; + if (data !== null && data !== undefined) stream.push(data); + cb(er); -function copyResource(urlObj, siteUrlObj) -{ - urlObj.resource = siteUrlObj.resource; - - urlObj.extra.resourceIsIndex = siteUrlObj.extra.resourceIsIndex; + var rs = stream._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + stream._read(rs.highWaterMark); + } } +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + Duplex.call(this, options); -module.exports = absolutize; + this._transformState = new TransformState(this); -},{"../util/object":108,"../util/path":109,"./findRelation":105}],105:[function(require,module,exports){ -"use strict"; + var stream = this; -function findRelation_upToPath(urlObj, siteUrlObj, options) -{ - // Path- or root-relative URL - var pathOnly = urlObj.extra.hrefInfo.minimumPathOnly; - - // Matching scheme, scheme-relative or path-only - var minimumScheme = (urlObj.scheme===siteUrlObj.scheme || !urlObj.scheme); - - // Matching auth, ignoring auth or path-only - var minimumAuth = minimumScheme && (urlObj.auth===siteUrlObj.auth || options.removeAuth || pathOnly); - - // Matching host or path-only - var www = options.ignore_www ? "stripped" : "full"; - var minimumHost = minimumAuth && (urlObj.host[www]===siteUrlObj.host[www] || pathOnly); - - // Matching port or path-only - var minimumPort = minimumHost && (urlObj.port===siteUrlObj.port || pathOnly); - - urlObj.extra.relation.minimumScheme = minimumScheme; - urlObj.extra.relation.minimumAuth = minimumAuth; - urlObj.extra.relation.minimumHost = minimumHost; - urlObj.extra.relation.minimumPort = minimumPort; - - urlObj.extra.relation.maximumScheme = !minimumScheme || minimumScheme && !minimumAuth; - urlObj.extra.relation.maximumAuth = !minimumScheme || minimumScheme && !minimumHost; - urlObj.extra.relation.maximumHost = !minimumScheme || minimumScheme && !minimumPort; -} + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; -function findRelation_pathOn(urlObj, siteUrlObj, options) -{ - var queryOnly = urlObj.extra.hrefInfo.minimumQueryOnly; - var hashOnly = urlObj.extra.hrefInfo.minimumHashOnly; - var empty = urlObj.extra.hrefInfo.empty; // not required, but self-documenting - - // From upToPath() - var minimumPort = urlObj.extra.relation.minimumPort; - var minimumScheme = urlObj.extra.relation.minimumScheme; - - // Matching port and path - var minimumPath = minimumPort && urlObj.path.absolute.string===siteUrlObj.path.absolute.string; - - // Matching resource or query/hash-only or empty - var matchingResource = (urlObj.resource===siteUrlObj.resource || !urlObj.resource && siteUrlObj.extra.resourceIsIndex) || (options.removeDirectoryIndexes && urlObj.extra.resourceIsIndex && !siteUrlObj.resource); - var minimumResource = minimumPath && (matchingResource || queryOnly || hashOnly || empty); - - // Matching query or hash-only/empty - var query = options.removeEmptyQueries ? "stripped" : "full"; - var urlQuery = urlObj.query.string[query]; - var siteUrlQuery = siteUrlObj.query.string[query]; - var minimumQuery = (minimumResource && !!urlQuery && urlQuery===siteUrlQuery) || ((hashOnly || empty) && !urlObj.extra.hrefInfo.separatorOnlyQuery); - - var minimumHash = minimumQuery && urlObj.hash===siteUrlObj.hash; - - urlObj.extra.relation.minimumPath = minimumPath; - urlObj.extra.relation.minimumResource = minimumResource; - urlObj.extra.relation.minimumQuery = minimumQuery; - urlObj.extra.relation.minimumHash = minimumHash; - - urlObj.extra.relation.maximumPort = !minimumScheme || minimumScheme && !minimumPath; - urlObj.extra.relation.maximumPath = !minimumScheme || minimumScheme && !minimumResource; - urlObj.extra.relation.maximumResource = !minimumScheme || minimumScheme && !minimumQuery; - urlObj.extra.relation.maximumQuery = !minimumScheme || minimumScheme && !minimumHash; - urlObj.extra.relation.maximumHash = !minimumScheme || minimumScheme && !minimumHash; // there's nothing after hash, so it's the same as maximumQuery - - // Matching path and/or resource with existing but non-matching site query - urlObj.extra.relation.overridesQuery = minimumPath && urlObj.extra.relation.maximumResource && !minimumQuery && !!siteUrlQuery; + if (typeof options.flush === 'function') this._flush = options.flush; + } + + // When the writable side finishes, then flush out anything remaining. + this.once('prefinish', function () { + if (typeof this._flush === 'function') this._flush(function (er, data) { + done(stream, er, data); + });else done(stream); + }); } +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function (chunk, encoding, cb) { + throw new Error('_transform() is not implemented'); +}; -module.exports = -{ - pathOn: findRelation_pathOn, - upToPath: findRelation_upToPath +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } }; -},{}],106:[function(require,module,exports){ -"use strict"; +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function (n) { + var ts = this._transformState; -var absolutize = require("./absolutize"); -var relativize = require("./relativize"); + if (ts.writechunk !== null && ts.writecb && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; +function done(stream, er, data) { + if (er) return stream.emit('error', er); + if (data !== null && data !== undefined) stream.push(data); -function relateUrl(siteUrlObj, urlObj, options) -{ - absolutize(urlObj, siteUrlObj, options); - relativize(urlObj, siteUrlObj, options); - - return urlObj; + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + var ws = stream._writableState; + var ts = stream._transformState; + + if (ws.length) throw new Error('Calling transform done when ws.length != 0'); + + if (ts.transforming) throw new Error('Calling transform done when still transforming'); + + return stream.push(null); } +},{"./_stream_duplex":117,"core-util-is":100,"inherits":105}],121:[function(require,module,exports){ +(function (process){ +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. +'use strict'; +module.exports = Writable; -module.exports = relateUrl; +/**/ +var processNextTick = require('process-nextick-args'); +/**/ -},{"./absolutize":104,"./relativize":107}],107:[function(require,module,exports){ -"use strict"; +/**/ +var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick; +/**/ -var pathUtils = require("../util/path"); +/**/ +var Duplex; +/**/ +Writable.WritableState = WritableState; +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ -/* - Get a path relative to the site path. -*/ -function relatePath(absolutePath, siteAbsolutePath) -{ - var relativePath = []; - - // At this point, it's related to the host/port - var related = true; - var parentIndex = -1; - - // Find parents - siteAbsolutePath.forEach( function(siteAbsoluteDir, i) - { - if (related) - { - if (absolutePath[i] !== siteAbsoluteDir) - { - related = false; - } - else - { - parentIndex = i; - } - } - - if (!related) - { - // Up one level - relativePath.push(".."); - } - }); - - // Form path - absolutePath.forEach( function(dir, i) - { - if (i > parentIndex) - { - relativePath.push(dir); - } - }); - - return relativePath; -} +/**/ +var internalUtil = { + deprecate: require('util-deprecate') +}; +/**/ +/**/ +var Stream; +(function () { + try { + Stream = require('st' + 'ream'); + } catch (_) {} finally { + if (!Stream) Stream = require('events').EventEmitter; + } +})(); +/**/ +var Buffer = require('buffer').Buffer; +/**/ +var bufferShim = require('buffer-shims'); +/**/ -function relativize(urlObj, siteUrlObj, options) -{ - if (urlObj.extra.relation.minimumScheme) - { - var pathArray = relatePath(urlObj.path.absolute.array, siteUrlObj.path.absolute.array); - - urlObj.path.relative.array = pathArray; - urlObj.path.relative.string = pathUtils.join(pathArray); - } +util.inherits(Writable, Stream); + +function nop() {} + +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; } +function WritableState(options, stream) { + Duplex = Duplex || require('./_stream_duplex'); + options = options || {}; -module.exports = relativize; + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; -},{"../util/path":109}],108:[function(require,module,exports){ -"use strict"; + if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode; -/* - Deep-clone an object. -*/ -function clone(obj) -{ - if (obj instanceof Object) - { - var clonedObj = (obj instanceof Array) ? [] : {}; - - for (var i in obj) - { - if ( obj.hasOwnProperty(i) ) - { - clonedObj[i] = clone( obj[i] ); - } - } - - return clonedObj; - } - - return obj; -} + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + var hwm = options.highWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; + // cast to ints. + this.highWaterMark = ~ ~this.highWaterMark; + // drain event flag. + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; -/* - https://github.com/jonschlinkert/is-plain-object -*/ -function isPlainObject(obj) -{ - return !!obj && typeof obj==="object" && obj.constructor===Object; -} + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { + onwrite(stream, er); + }; + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; -/* - Shallow-merge two objects. -*/ -function shallowMerge(target, source) -{ - if (target instanceof Object && source instanceof Object) - { - for (var i in source) - { - if ( source.hasOwnProperty(i) ) - { - target[i] = source[i]; - } - } - } - - return target; -} + // the amount that is being written when _write is called. + this.writelen = 0; + this.bufferedRequest = null; + this.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; -module.exports = -{ - clone: clone, - isPlainObject: isPlainObject, - shallowMerge: shallowMerge -}; + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; -},{}],109:[function(require,module,exports){ -"use strict"; + // count buffered requests + this.bufferedRequestCount = 0; -function joinPath(pathArray) -{ - if (pathArray.length > 0) - { - return pathArray.join("/") + "/"; - } - else - { - return ""; - } + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); } +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; +}; + +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function () { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.') + }); + } catch (_) {} +})(); +// Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. +var realHasInstance; +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function (object) { + if (realHasInstance.call(this, object)) return true; -function resolveDotSegments(pathArray) -{ - var pathAbsolute = []; - - pathArray.forEach( function(dir) - { - if (dir !== "..") - { - if (dir !== ".") - { - pathAbsolute.push(dir); - } - } - else - { - // Remove parent - if (pathAbsolute.length > 0) - { - pathAbsolute.splice(pathAbsolute.length-1, 1); - } - } - }); - - return pathAbsolute; + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function (object) { + return object instanceof this; + }; } +function Writable(options) { + Duplex = Duplex || require('./_stream_duplex'); + // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. -module.exports = -{ - join: joinPath, - resolveDotSegments: resolveDotSegments -}; + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) { + return new Writable(options); + } -},{}],110:[function(require,module,exports){ -/* - * Copyright 2009-2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE.txt or: - * http://opensource.org/licenses/BSD-3-Clause - */ -exports.SourceMapGenerator = require('./source-map/source-map-generator').SourceMapGenerator; -exports.SourceMapConsumer = require('./source-map/source-map-consumer').SourceMapConsumer; -exports.SourceNode = require('./source-map/source-node').SourceNode; + this._writableState = new WritableState(options, this); -},{"./source-map/source-map-consumer":117,"./source-map/source-map-generator":118,"./source-map/source-node":119}],111:[function(require,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -if (typeof define !== 'function') { - var define = require('amdefine')(module, require); -} -define(function (require, exports, module) { + // legacy. + this.writable = true; - var util = require('./util'); + if (options) { + if (typeof options.write === 'function') this._write = options.write; - /** - * A data structure which is a combination of an array and a set. Adding a new - * member is O(1), testing for membership is O(1), and finding the index of an - * element is O(1). Removing elements from the set is not supported. Only - * strings are supported for membership. - */ - function ArraySet() { - this._array = []; - this._set = {}; + if (typeof options.writev === 'function') this._writev = options.writev; } - /** - * Static method for creating ArraySet instances from an existing array. - */ - ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { - var set = new ArraySet(); - for (var i = 0, len = aArray.length; i < len; i++) { - set.add(aArray[i], aAllowDuplicates); - } - return set; - }; + Stream.call(this); +} - /** - * Return how many unique items are in this ArraySet. If duplicates have been - * added, than those do not count towards the size. - * - * @returns Number - */ - ArraySet.prototype.size = function ArraySet_size() { - return Object.getOwnPropertyNames(this._set).length; - }; +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + this.emit('error', new Error('Cannot pipe, not readable')); +}; - /** - * Add the given string to this set. - * - * @param String aStr - */ - ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { - var isDuplicate = this.has(aStr); - var idx = this._array.length; - if (!isDuplicate || aAllowDuplicates) { - this._array.push(aStr); - } - if (!isDuplicate) { - this._set[util.toSetString(aStr)] = idx; - } - }; +function writeAfterEnd(stream, cb) { + var er = new Error('write after end'); + // TODO: defer error events consistently everywhere, not just the cb + stream.emit('error', er); + processNextTick(cb, er); +} - /** - * Is the given string a member of this set? - * - * @param String aStr - */ - ArraySet.prototype.has = function ArraySet_has(aStr) { - return Object.prototype.hasOwnProperty.call(this._set, - util.toSetString(aStr)); - }; +// If we get something that is not a buffer, string, null, or undefined, +// and we're not in objectMode, then that's an error. +// Otherwise stream chunks are all considered to be of length=1, and the +// watermarks determine how many objects to keep in the buffer, rather than +// how many bytes or characters. +function validChunk(stream, state, chunk, cb) { + var valid = true; + var er = false; + // Always throw error if a null is written + // if we are not in object mode then throw + // if it is not a buffer, string, or undefined. + if (chunk === null) { + er = new TypeError('May not write null values to stream'); + } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + if (er) { + stream.emit('error', er); + processNextTick(cb, er); + valid = false; + } + return valid; +} - /** - * What is the index of the given string in the array? - * - * @param String aStr - */ - ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { - if (this.has(aStr)) { - return this._set[util.toSetString(aStr)]; - } - throw new Error('"' + aStr + '" is not in the set.'); - }; +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; - /** - * What is the element at the given index? - * - * @param Number aIdx - */ - ArraySet.prototype.at = function ArraySet_at(aIdx) { - if (aIdx >= 0 && aIdx < this._array.length) { - return this._array[aIdx]; - } - throw new Error('No element indexed by ' + aIdx); - }; + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } - /** - * Returns the array representation of this set (which has the proper indices - * indicated by indexOf). Note that this is a copy of the internal array used - * for storing the members so that no one can mess with internal state. - */ - ArraySet.prototype.toArray = function ArraySet_toArray() { - return this._array.slice(); - }; + if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; - exports.ArraySet = ArraySet; + if (typeof cb !== 'function') cb = nop; -}); + if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, chunk, encoding, cb); + } -},{"./util":120,"amdefine":1}],112:[function(require,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - * - * Based on the Base 64 VLQ implementation in Closure Compiler: - * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java - * - * Copyright 2011 The Closure Compiler Authors. All rights reserved. - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -if (typeof define !== 'function') { - var define = require('amdefine')(module, require); -} -define(function (require, exports, module) { + return ret; +}; + +Writable.prototype.cork = function () { + var state = this._writableState; - var base64 = require('./base64'); + state.corked++; +}; - // A single base 64 digit can contain 6 bits of data. For the base 64 variable - // length quantities we use in the source map spec, the first bit is the sign, - // the next four bits are the actual value, and the 6th bit is the - // continuation bit. The continuation bit tells us whether there are more - // digits in this value following this digit. - // - // Continuation - // | Sign - // | | - // V V - // 101011 - - var VLQ_BASE_SHIFT = 5; - - // binary: 100000 - var VLQ_BASE = 1 << VLQ_BASE_SHIFT; - - // binary: 011111 - var VLQ_BASE_MASK = VLQ_BASE - 1; - - // binary: 100000 - var VLQ_CONTINUATION_BIT = VLQ_BASE; - - /** - * Converts from a two-complement value to a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) - * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) - */ - function toVLQSigned(aValue) { - return aValue < 0 - ? ((-aValue) << 1) + 1 - : (aValue << 1) + 0; - } - - /** - * Converts to a two-complement value from a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 - * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 - */ - function fromVLQSigned(aValue) { - var isNegative = (aValue & 1) === 1; - var shifted = aValue >> 1; - return isNegative - ? -shifted - : shifted; - } - - /** - * Returns the base 64 VLQ encoded value. - */ - exports.encode = function base64VLQ_encode(aValue) { - var encoded = ""; - var digit; - - var vlq = toVLQSigned(aValue); - - do { - digit = vlq & VLQ_BASE_MASK; - vlq >>>= VLQ_BASE_SHIFT; - if (vlq > 0) { - // There are still more digits in this value, so we must make sure the - // continuation bit is marked. - digit |= VLQ_CONTINUATION_BIT; - } - encoded += base64.encode(digit); - } while (vlq > 0); +Writable.prototype.uncork = function () { + var state = this._writableState; - return encoded; - }; + if (state.corked) { + state.corked--; - /** - * Decodes the next base 64 VLQ value from the given string and returns the - * value and the rest of the string via the out parameter. - */ - exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { - var strLen = aStr.length; - var result = 0; - var shift = 0; - var continuation, digit; - - do { - if (aIndex >= strLen) { - throw new Error("Expected more digits in base 64 VLQ value."); - } + if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; - digit = base64.decode(aStr.charCodeAt(aIndex++)); - if (digit === -1) { - throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); - } +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; - continuation = !!(digit & VLQ_CONTINUATION_BIT); - digit &= VLQ_BASE_MASK; - result = result + (digit << shift); - shift += VLQ_BASE_SHIFT; - } while (continuation); +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = bufferShim.from(chunk, encoding); + } + return chunk; +} - aOutParam.value = fromVLQSigned(result); - aOutParam.rest = aIndex; - }; +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, chunk, encoding, cb) { + chunk = decodeChunk(state, chunk, encoding); -}); + if (Buffer.isBuffer(chunk)) encoding = 'buffer'; + var len = state.objectMode ? 1 : chunk.length; -},{"./base64":113,"amdefine":1}],113:[function(require,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -if (typeof define !== 'function') { - var define = require('amdefine')(module, require); -} -define(function (require, exports, module) { + state.length += len; - var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true; - /** - * Encode an integer in the range of 0 to 63 to a single base 64 digit. - */ - exports.encode = function (number) { - if (0 <= number && number < intToCharMap.length) { - return intToCharMap[number]; + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = new WriteReq(chunk, encoding, cb); + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; } - throw new TypeError("Must be between 0 and 63: " + aNumber); - }; + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } - /** - * Decode a single base 64 character code digit to an integer. Returns -1 on - * failure. - */ - exports.decode = function (charCode) { - var bigA = 65; // 'A' - var bigZ = 90; // 'Z' + return ret; +} - var littleA = 97; // 'a' - var littleZ = 122; // 'z' +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} - var zero = 48; // '0' - var nine = 57; // '9' +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + if (sync) processNextTick(cb, er);else cb(er); - var plus = 43; // '+' - var slash = 47; // '/' + stream._writableState.errorEmitted = true; + stream.emit('error', er); +} - var littleOffset = 26; - var numberOffset = 52; +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} - // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ - if (bigA <= charCode && charCode <= bigZ) { - return (charCode - bigA); - } +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; - // 26 - 51: abcdefghijklmnopqrstuvwxyz - if (littleA <= charCode && charCode <= littleZ) { - return (charCode - littleA + littleOffset); - } + onwriteStateUpdate(state); - // 52 - 61: 0123456789 - if (zero <= charCode && charCode <= nine) { - return (charCode - zero + numberOffset); - } + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state); - // 62: + - if (charCode == plus) { - return 62; + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); } - // 63: / - if (charCode == slash) { - return 63; - } + if (sync) { + /**/ + asyncWrite(afterWrite, stream, state, finished, cb); + /**/ + } else { + afterWrite(stream, state, finished, cb); + } + } +} - // Invalid base64 digit. - return -1; - }; +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} -}); +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} -},{"amdefine":1}],114:[function(require,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -if (typeof define !== 'function') { - var define = require('amdefine')(module, require); -} -define(function (require, exports, module) { - - exports.GREATEST_LOWER_BOUND = 1; - exports.LEAST_UPPER_BOUND = 2; - - /** - * Recursive implementation of binary search. - * - * @param aLow Indices here and lower do not contain the needle. - * @param aHigh Indices here and higher do not contain the needle. - * @param aNeedle The element being searched for. - * @param aHaystack The non-empty array being searched. - * @param aCompare Function which takes two elements and returns -1, 0, or 1. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - */ - function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { - // This function terminates when one of the following is true: - // - // 1. We find the exact element we are looking for. - // - // 2. We did not find the exact element, but we can return the index of - // the next-closest element. - // - // 3. We did not find the exact element, and there is no next-closest - // element than the one we are searching for, so we return -1. - var mid = Math.floor((aHigh - aLow) / 2) + aLow; - var cmp = aCompare(aNeedle, aHaystack[mid], true); - if (cmp === 0) { - // Found the element we are looking for. - return mid; - } - else if (cmp > 0) { - // Our needle is greater than aHaystack[mid]. - if (aHigh - mid > 1) { - // The element is in the upper half. - return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); - } +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; - // The exact needle element was not found in this haystack. Determine if - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return aHigh < aHaystack.length ? aHigh : -1; - } else { - return mid; - } - } - else { - // Our needle is less than aHaystack[mid]. - if (mid - aLow > 1) { - // The element is in the lower half. - return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); - } + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return mid; - } else { - return aLow < 0 ? -1 : aLow; - } + var count = 0; + while (entry) { + buffer[count] = entry; + entry = entry.next; + count += 1; } - } - /** - * This is an implementation of binary search which will always try and return - * the index of the closest element if there is no exact hit. This is because - * mappings between original and generated line/col pairs are single points, - * and there is an implicit region between each of them, so a miss just means - * that you aren't on the very start of a region. - * - * @param aNeedle The element you are looking for. - * @param aHaystack The array that is being searched. - * @param aCompare A function which takes the needle and an element in the - * array and returns -1, 0, or 1 depending on whether the needle is less - * than, equal to, or greater than the element, respectively. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. - */ - exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { - if (aHaystack.length === 0) { - return -1; - } - - var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, - aCompare, aBias || exports.GREATEST_LOWER_BOUND); - if (index < 0) { - return -1; + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); } + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; - // We have found either the exact element, or the next-closest element than - // the one we are searching for. However, there may be more than one such - // element. Make sure we always return the smallest of these. - while (index - 1 >= 0) { - if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { break; } - --index; } - return index; - }; + if (entry === null) state.lastBufferedRequest = null; + } -}); + state.bufferedRequestCount = 0; + state.bufferedRequest = entry; + state.bufferProcessing = false; +} -},{"amdefine":1}],115:[function(require,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2014 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -if (typeof define !== 'function') { - var define = require('amdefine')(module, require); -} -define(function (require, exports, module) { - - var util = require('./util'); - - /** - * Determine whether mappingB is after mappingA with respect to generated - * position. - */ - function generatedPositionAfter(mappingA, mappingB) { - // Optimized for most common case - var lineA = mappingA.generatedLine; - var lineB = mappingB.generatedLine; - var columnA = mappingA.generatedColumn; - var columnB = mappingB.generatedColumn; - return lineB > lineA || lineB == lineA && columnB >= columnA || - util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; - } - - /** - * A data structure to provide a sorted view of accumulated mappings in a - * performance conscious manner. It trades a neglibable overhead in general - * case for a large speedup in case of mappings being added in order. - */ - function MappingList() { - this._array = []; - this._sorted = true; - // Serves as infimum - this._last = {generatedLine: -1, generatedColumn: 0}; - } - - /** - * Iterate through internal items. This method takes the same arguments that - * `Array.prototype.forEach` takes. - * - * NOTE: The order of the mappings is NOT guaranteed. - */ - MappingList.prototype.unsortedForEach = - function MappingList_forEach(aCallback, aThisArg) { - this._array.forEach(aCallback, aThisArg); - }; +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new Error('_write() is not implemented')); +}; - /** - * Add the given source mapping. - * - * @param Object aMapping - */ - MappingList.prototype.add = function MappingList_add(aMapping) { - var mapping; - if (generatedPositionAfter(this._last, aMapping)) { - this._last = aMapping; - this._array.push(aMapping); - } else { - this._sorted = false; - this._array.push(aMapping); - } - }; +Writable.prototype._writev = null; - /** - * Returns the flat, sorted array of mappings. The mappings are sorted by - * generated position. - * - * WARNING: This method returns internal data without copying, for - * performance. The return value must NOT be mutated, and should be treated as - * an immutable borrow. If you want to take ownership, you must make your own - * copy. - */ - MappingList.prototype.toArray = function MappingList_toArray() { - if (!this._sorted) { - this._array.sort(util.compareByGeneratedPositionsInflated); - this._sorted = true; - } - return this._array; - }; +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; - exports.MappingList = MappingList; + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } -}); + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); -},{"./util":120,"amdefine":1}],116:[function(require,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -if (typeof define !== 'function') { - var define = require('amdefine')(module, require); -} -define(function (require, exports, module) { - - // It turns out that some (most?) JavaScript engines don't self-host - // `Array.prototype.sort`. This makes sense because C++ will likely remain - // faster than JS when doing raw CPU-intensive sorting. However, when using a - // custom comparator function, calling back and forth between the VM's C++ and - // JIT'd JS is rather slow *and* loses JIT type information, resulting in - // worse generated code for the comparator function than would be optimal. In - // fact, when sorting with a comparator, these costs outweigh the benefits of - // sorting in C++. By using our own JS-implemented Quick Sort (below), we get - // a ~3500ms mean speed-up in `bench/bench.html`. - - /** - * Swap the elements indexed by `x` and `y` in the array `ary`. - * - * @param {Array} ary - * The array. - * @param {Number} x - * The index of the first item. - * @param {Number} y - * The index of the second item. - */ - function swap(ary, x, y) { - var temp = ary[x]; - ary[x] = ary[y]; - ary[y] = temp; - } - - /** - * Returns a random integer within the range `low .. high` inclusive. - * - * @param {Number} low - * The lower bound on the range. - * @param {Number} high - * The upper bound on the range. - */ - function randomIntInRange(low, high) { - return Math.round(low + (Math.random() * (high - low))); - } - - /** - * The Quick Sort algorithm. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - * @param {Number} p - * Start index of the array - * @param {Number} r - * End index of the array - */ - function doQuickSort(ary, comparator, p, r) { - // If our lower bound is less than our upper bound, we (1) partition the - // array into two pieces and (2) recurse on each half. If it is not, this is - // the empty array and our base case. - - if (p < r) { - // (1) Partitioning. - // - // The partitioning chooses a pivot between `p` and `r` and moves all - // elements that are less than or equal to the pivot to the before it, and - // all the elements that are greater than it after it. The effect is that - // once partition is done, the pivot is in the exact place it will be when - // the array is put in sorted order, and it will not need to be moved - // again. This runs in O(n) time. - - // Always choose a random pivot so that an input array which is reverse - // sorted does not cause O(n^2) running time. - var pivotIndex = randomIntInRange(p, r); - var i = p - 1; - - swap(ary, pivotIndex, r); - var pivot = ary[r]; - - // Immediately after `j` is incremented in this loop, the following hold - // true: - // - // * Every element in `ary[p .. i]` is less than or equal to the pivot. - // - // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. - for (var j = p; j < r; j++) { - if (comparator(ary[j], pivot) <= 0) { - i += 1; - swap(ary, i, j); - } - } + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending && !state.finished) endWritable(this, state, cb); +}; - swap(ary, i + 1, j); - var q = i + 1; +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} - // (2) Recurse on each half. +function prefinish(stream, state) { + if (!state.prefinished) { + state.prefinished = true; + stream.emit('prefinish'); + } +} - doQuickSort(ary, comparator, p, q - 1); - doQuickSort(ary, comparator, q + 1, r); +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + if (state.pendingcb === 0) { + prefinish(stream, state); + state.finished = true; + stream.emit('finish'); + } else { + prefinish(stream, state); } } - - /** - * Sort the given array in-place with the given comparator function. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - */ - exports.quickSort = function (ary, comparator) { - doQuickSort(ary, comparator, 0, ary.length - 1); - }; - -}); - -},{"amdefine":1}],117:[function(require,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -if (typeof define !== 'function') { - var define = require('amdefine')(module, require); + return need; } -define(function (require, exports, module) { - var util = require('./util'); - var binarySearch = require('./binary-search'); - var ArraySet = require('./array-set').ArraySet; - var base64VLQ = require('./base64-vlq'); - var quickSort = require('./quick-sort').quickSort; +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) processNextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} - function SourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; - return sourceMap.sections != null - ? new IndexedSourceMapConsumer(sourceMap) - : new BasicSourceMapConsumer(sourceMap); - } + this.next = null; + this.entry = null; - SourceMapConsumer.fromSourceMap = function(aSourceMap) { - return BasicSourceMapConsumer.fromSourceMap(aSourceMap); - } + this.finish = function (err) { + var entry = _this.entry; + _this.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + if (state.corkedRequestsFree) { + state.corkedRequestsFree.next = _this; + } else { + state.corkedRequestsFree = _this; + } + }; +} +}).call(this,require('_process')) +},{"./_stream_duplex":117,"_process":112,"buffer":5,"buffer-shims":4,"core-util-is":100,"events":101,"inherits":105,"process-nextick-args":111,"util-deprecate":161}],122:[function(require,module,exports){ +'use strict'; - /** - * The version of the source mapping spec that we are consuming. - */ - SourceMapConsumer.prototype._version = 3; +var Buffer = require('buffer').Buffer; +/**/ +var bufferShim = require('buffer-shims'); +/**/ - // `__generatedMappings` and `__originalMappings` are arrays that hold the - // parsed mapping coordinates from the source map's "mappings" attribute. They - // are lazily instantiated, accessed via the `_generatedMappings` and - // `_originalMappings` getters respectively, and we only parse the mappings - // and create these arrays once queried for a source location. We jump through - // these hoops because there can be many thousands of mappings, and parsing - // them is expensive, so we only want to do it if we must. - // - // Each object in the arrays is of the form: - // - // { - // generatedLine: The line number in the generated code, - // generatedColumn: The column number in the generated code, - // source: The path to the original source file that generated this - // chunk of code, - // originalLine: The line number in the original source that - // corresponds to this chunk of generated code, - // originalColumn: The column number in the original source that - // corresponds to this chunk of generated code, - // name: The name of the original symbol which generated this chunk of - // code. - // } - // - // All properties except for `generatedLine` and `generatedColumn` can be - // `null`. - // - // `_generatedMappings` is ordered by the generated positions. - // - // `_originalMappings` is ordered by the original positions. +module.exports = BufferList; - SourceMapConsumer.prototype.__generatedMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { - get: function () { - if (!this.__generatedMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } +function BufferList() { + this.head = null; + this.tail = null; + this.length = 0; +} - return this.__generatedMappings; - } - }); +BufferList.prototype.push = function (v) { + var entry = { data: v, next: null }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; +}; - SourceMapConsumer.prototype.__originalMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { - get: function () { - if (!this.__originalMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } +BufferList.prototype.unshift = function (v) { + var entry = { data: v, next: this.head }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; +}; - return this.__originalMappings; - } - }); +BufferList.prototype.shift = function () { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; +}; - SourceMapConsumer.prototype._charIsMappingSeparator = - function SourceMapConsumer_charIsMappingSeparator(aStr, index) { - var c = aStr.charAt(index); - return c === ";" || c === ","; - }; +BufferList.prototype.clear = function () { + this.head = this.tail = null; + this.length = 0; +}; - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - SourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - throw new Error("Subclasses must implement _parseMappings"); - }; +BufferList.prototype.join = function (s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) { + ret += s + p.data; + }return ret; +}; - SourceMapConsumer.GENERATED_ORDER = 1; - SourceMapConsumer.ORIGINAL_ORDER = 2; - - SourceMapConsumer.GREATEST_LOWER_BOUND = 1; - SourceMapConsumer.LEAST_UPPER_BOUND = 2; - - /** - * Iterate over each mapping between an original source/line/column and a - * generated line/column in this source map. - * - * @param Function aCallback - * The function that is called with each mapping. - * @param Object aContext - * Optional. If specified, this object will be the value of `this` every - * time that `aCallback` is called. - * @param aOrder - * Either `SourceMapConsumer.GENERATED_ORDER` or - * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to - * iterate over the mappings sorted by the generated file's line/column - * order or the original's source/line/column order, respectively. Defaults to - * `SourceMapConsumer.GENERATED_ORDER`. - */ - SourceMapConsumer.prototype.eachMapping = - function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { - var context = aContext || null; - var order = aOrder || SourceMapConsumer.GENERATED_ORDER; - - var mappings; - switch (order) { - case SourceMapConsumer.GENERATED_ORDER: - mappings = this._generatedMappings; - break; - case SourceMapConsumer.ORIGINAL_ORDER: - mappings = this._originalMappings; - break; - default: - throw new Error("Unknown order of iteration."); - } +BufferList.prototype.concat = function (n) { + if (this.length === 0) return bufferShim.alloc(0); + if (this.length === 1) return this.head.data; + var ret = bufferShim.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + p.data.copy(ret, i); + i += p.data.length; + p = p.next; + } + return ret; +}; +},{"buffer":5,"buffer-shims":4}],123:[function(require,module,exports){ +(function (process){ +var Stream = (function (){ + try { + return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify + } catch(_){} +}()); +exports = module.exports = require('./lib/_stream_readable.js'); +exports.Stream = Stream || exports; +exports.Readable = exports; +exports.Writable = require('./lib/_stream_writable.js'); +exports.Duplex = require('./lib/_stream_duplex.js'); +exports.Transform = require('./lib/_stream_transform.js'); +exports.PassThrough = require('./lib/_stream_passthrough.js'); - var sourceRoot = this.sourceRoot; - mappings.map(function (mapping) { - var source = mapping.source === null ? null : this._sources.at(mapping.source); - if (source != null && sourceRoot != null) { - source = util.join(sourceRoot, source); - } - return { - source: source, - generatedLine: mapping.generatedLine, - generatedColumn: mapping.generatedColumn, - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: mapping.name === null ? null : this._names.at(mapping.name) - }; - }, this).forEach(aCallback, context); - }; +if (!process.browser && process.env.READABLE_STREAM === 'disable' && Stream) { + module.exports = Stream; +} - /** - * Returns all generated line and column information for the original source, - * line, and column provided. If no column is provided, returns all mappings - * corresponding to a either the line we are searching for or the next - * closest line that has any mappings. Otherwise, returns all mappings - * corresponding to the given line and either the column we are searching for - * or the next closest column that has any offsets. - * - * The only argument is an object with the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: Optional. the column number in the original source. - * - * and an array of objects is returned, each with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - SourceMapConsumer.prototype.allGeneratedPositionsFor = - function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { - var line = util.getArg(aArgs, 'line'); - - // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping - // returns the index of the closest mapping less than the needle. By - // setting needle.originalColumn to 0, we thus find the last mapping for - // the given line, provided such a mapping exists. - var needle = { - source: util.getArg(aArgs, 'source'), - originalLine: line, - originalColumn: util.getArg(aArgs, 'column', 0) - }; +}).call(this,require('_process')) +},{"./lib/_stream_duplex.js":117,"./lib/_stream_passthrough.js":118,"./lib/_stream_readable.js":119,"./lib/_stream_transform.js":120,"./lib/_stream_writable.js":121,"_process":112}],124:[function(require,module,exports){ +"use strict"; - if (this.sourceRoot != null) { - needle.source = util.relative(this.sourceRoot, needle.source); - } - if (!this._sources.has(needle.source)) { - return []; - } - needle.source = this._sources.indexOf(needle.source); - - var mappings = []; - - var index = this._findMapping(needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - binarySearch.LEAST_UPPER_BOUND); - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (aArgs.column === undefined) { - var originalLine = mapping.originalLine; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we found. Since - // mappings are sorted, this is guaranteed to find all mappings for - // the line we found. - while (mapping && mapping.originalLine === originalLine) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); +module.exports = +{ + // Output + ABSOLUTE: "absolute", + PATH_RELATIVE: "pathRelative", + ROOT_RELATIVE: "rootRelative", + SHORTEST: "shortest" +}; - mapping = this._originalMappings[++index]; - } - } else { - var originalColumn = mapping.originalColumn; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we were searching for. - // Since mappings are sorted, this is guaranteed to find all mappings for - // the line we are searching for. - while (mapping && - mapping.originalLine === line && - mapping.originalColumn == originalColumn) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); +},{}],125:[function(require,module,exports){ +"use strict"; - mapping = this._originalMappings[++index]; - } - } - } +var constants = require("./constants"); - return mappings; - }; - exports.SourceMapConsumer = SourceMapConsumer; - - /** - * A BasicSourceMapConsumer instance represents a parsed source map which we can - * query for information about the original file positions by giving it a file - * position in the generated source. - * - * The only parameter is the raw source map (either as a JSON string, or - * already parsed to an object). According to the spec, source maps have the - * following attributes: - * - * - version: Which version of the source map spec this map is following. - * - sources: An array of URLs to the original source files. - * - names: An array of identifiers which can be referrenced by individual mappings. - * - sourceRoot: Optional. The URL root from which all sources are relative. - * - sourcesContent: Optional. An array of contents of the original source files. - * - mappings: A string of base64 VLQs which contain the actual mappings. - * - file: Optional. The generated file this source map is associated with. - * - * Here is an example source map, taken from the source map spec[0]: - * - * { - * version : 3, - * file: "out.js", - * sourceRoot : "", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AA,AB;;ABCDE;" - * } - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# - */ - function BasicSourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - var version = util.getArg(sourceMap, 'version'); - var sources = util.getArg(sourceMap, 'sources'); - // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which - // requires the array) to play nice here. - var names = util.getArg(sourceMap, 'names', []); - var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); - var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); - var mappings = util.getArg(sourceMap, 'mappings'); - var file = util.getArg(sourceMap, 'file', null); - - // Once again, Sass deviates from the spec and supplies the version as a - // string rather than a number, so we use loose equality checking here. - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - // Some source maps produce relative source paths like "./foo.js" instead of - // "foo.js". Normalize these first so that future comparisons will succeed. - // See bugzil.la/1090768. - sources = sources.map(util.normalize); - - // Pass `true` below to allow duplicate names and sources. While source maps - // are intended to be compressed and deduplicated, the TypeScript compiler - // sometimes generates source maps with duplicates in them. See Github issue - // #72 and bugzil.la/889492. - this._names = ArraySet.fromArray(names, true); - this._sources = ArraySet.fromArray(sources, true); - - this.sourceRoot = sourceRoot; - this.sourcesContent = sourcesContent; - this._mappings = mappings; - this.file = file; - } - - BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; - - /** - * Create a BasicSourceMapConsumer from a SourceMapGenerator. - * - * @param SourceMapGenerator aSourceMap - * The source map that will be consumed. - * @returns BasicSourceMapConsumer - */ - BasicSourceMapConsumer.fromSourceMap = - function SourceMapConsumer_fromSourceMap(aSourceMap) { - var smc = Object.create(BasicSourceMapConsumer.prototype); - - var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); - var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); - smc.sourceRoot = aSourceMap._sourceRoot; - smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), - smc.sourceRoot); - smc.file = aSourceMap._file; - - // Because we are modifying the entries (by converting string sources and - // names to indices into the sources and names ArraySets), we have to make - // a copy of the entry or else bad things happen. Shared mutable state - // strikes again! See github issue #191. - - var generatedMappings = aSourceMap._mappings.toArray().slice(); - var destGeneratedMappings = smc.__generatedMappings = []; - var destOriginalMappings = smc.__originalMappings = []; - - for (var i = 0, length = generatedMappings.length; i < length; i++) { - var srcMapping = generatedMappings[i]; - var destMapping = new Mapping; - destMapping.generatedLine = srcMapping.generatedLine; - destMapping.generatedColumn = srcMapping.generatedColumn; - - if (srcMapping.source) { - destMapping.source = sources.indexOf(srcMapping.source); - destMapping.originalLine = srcMapping.originalLine; - destMapping.originalColumn = srcMapping.originalColumn; - - if (srcMapping.name) { - destMapping.name = names.indexOf(srcMapping.name); - } +function formatAuth(urlObj, options) +{ + if (urlObj.auth && !options.removeAuth && (urlObj.extra.relation.maximumHost || options.output===constants.ABSOLUTE)) + { + return urlObj.auth + "@"; + } + + return ""; +} - destOriginalMappings.push(destMapping); - } - destGeneratedMappings.push(destMapping); - } - quickSort(smc.__originalMappings, util.compareByOriginalPositions); +function formatHash(urlObj, options) +{ + return urlObj.hash ? urlObj.hash : ""; +} - return smc; - }; - /** - * The version of the source mapping spec that we are consuming. - */ - BasicSourceMapConsumer.prototype._version = 3; - /** - * The list of original sources. - */ - Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { - get: function () { - return this._sources.toArray().map(function (s) { - return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s; - }, this); - } - }); +function formatHost(urlObj, options) +{ + if (urlObj.host.full && (urlObj.extra.relation.maximumAuth || options.output===constants.ABSOLUTE)) + { + return urlObj.host.full; + } + + return ""; +} - /** - * Provide the JIT with a nice shape / hidden class. - */ - function Mapping() { - this.generatedLine = 0; - this.generatedColumn = 0; - this.source = null; - this.originalLine = null; - this.originalColumn = null; - this.name = null; - } - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - BasicSourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - var generatedLine = 1; - var previousGeneratedColumn = 0; - var previousOriginalLine = 0; - var previousOriginalColumn = 0; - var previousSource = 0; - var previousName = 0; - var length = aStr.length; - var index = 0; - var cachedSegments = {}; - var temp = {}; - var originalMappings = []; - var generatedMappings = []; - var mapping, str, segment, end, value; - - while (index < length) { - if (aStr.charAt(index) === ';') { - generatedLine++; - index++; - previousGeneratedColumn = 0; - } - else if (aStr.charAt(index) === ',') { - index++; - } - else { - mapping = new Mapping(); - mapping.generatedLine = generatedLine; - - // Because each offset is encoded relative to the previous one, - // many segments often have the same encoding. We can exploit this - // fact by caching the parsed variable length fields of each segment, - // allowing us to avoid a second parse if we encounter the same - // segment again. - for (end = index; end < length; end++) { - if (this._charIsMappingSeparator(aStr, end)) { - break; - } - } - str = aStr.slice(index, end); - - segment = cachedSegments[str]; - if (segment) { - index += str.length; - } else { - segment = []; - while (index < end) { - base64VLQ.decode(aStr, index, temp); - value = temp.value; - index = temp.rest; - segment.push(value); - } - if (segment.length === 2) { - throw new Error('Found a source, but no line and column'); - } - if (segment.length === 3) { - throw new Error('Found a source and line, but no column'); - } +function formatPath(urlObj, options) +{ + var str = ""; + + var absolutePath = urlObj.path.absolute.string; + var relativePath = urlObj.path.relative.string; + var resource = showResource(urlObj, options); + + if (urlObj.extra.relation.maximumHost || options.output===constants.ABSOLUTE || options.output===constants.ROOT_RELATIVE) + { + str = absolutePath; + } + else if (relativePath.length<=absolutePath.length && options.output===constants.SHORTEST || options.output===constants.PATH_RELATIVE) + { + str = relativePath; + + if (str === "") + { + var query = showQuery(urlObj,options) && !!getQuery(urlObj,options); + + if (urlObj.extra.relation.maximumPath && !resource) + { + str = "./"; + } + else if (urlObj.extra.relation.overridesQuery && !resource && !query) + { + str = "./"; + } + } + } + else + { + str = absolutePath; + } + + if ( str==="/" && !resource && options.removeRootTrailingSlash && (!urlObj.extra.relation.minimumPort || options.output===constants.ABSOLUTE) ) + { + str = ""; + } + + return str; +} - cachedSegments[str] = segment; - } - // Generated column. - mapping.generatedColumn = previousGeneratedColumn + segment[0]; - previousGeneratedColumn = mapping.generatedColumn; - - if (segment.length > 1) { - // Original source. - mapping.source = previousSource + segment[1]; - previousSource += segment[1]; - - // Original line. - mapping.originalLine = previousOriginalLine + segment[2]; - previousOriginalLine = mapping.originalLine; - // Lines are stored 0-based - mapping.originalLine += 1; - - // Original column. - mapping.originalColumn = previousOriginalColumn + segment[3]; - previousOriginalColumn = mapping.originalColumn; - - if (segment.length > 4) { - // Original name. - mapping.name = previousName + segment[4]; - previousName += segment[4]; - } - } - generatedMappings.push(mapping); - if (typeof mapping.originalLine === 'number') { - originalMappings.push(mapping); - } - } - } +function formatPort(urlObj, options) +{ + if (urlObj.port && !urlObj.extra.portIsDefault && urlObj.extra.relation.maximumHost) + { + return ":" + urlObj.port; + } + + return ""; +} - quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); - this.__generatedMappings = generatedMappings; - quickSort(originalMappings, util.compareByOriginalPositions); - this.__originalMappings = originalMappings; - }; - /** - * Find the mapping that best matches the hypothetical "needle" mapping that - * we are searching for in the given "haystack" of mappings. - */ - BasicSourceMapConsumer.prototype._findMapping = - function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, - aColumnName, aComparator, aBias) { - // To return the position we are searching for, we must first find the - // mapping for the given position and then return the opposite position it - // points to. Because the mappings are sorted, we can use binary search to - // find the best mapping. - - if (aNeedle[aLineName] <= 0) { - throw new TypeError('Line must be greater than or equal to 1, got ' - + aNeedle[aLineName]); - } - if (aNeedle[aColumnName] < 0) { - throw new TypeError('Column must be greater than or equal to 0, got ' - + aNeedle[aColumnName]); - } +function formatQuery(urlObj, options) +{ + return showQuery(urlObj,options) ? getQuery(urlObj, options) : ""; +} - return binarySearch.search(aNeedle, aMappings, aComparator, aBias); - }; - /** - * Compute the last column for each generated mapping. The last column is - * inclusive. - */ - BasicSourceMapConsumer.prototype.computeColumnSpans = - function SourceMapConsumer_computeColumnSpans() { - for (var index = 0; index < this._generatedMappings.length; ++index) { - var mapping = this._generatedMappings[index]; - - // Mappings do not contain a field for the last generated columnt. We - // can come up with an optimistic estimate, however, by assuming that - // mappings are contiguous (i.e. given two consecutive mappings, the - // first mapping ends where the second one starts). - if (index + 1 < this._generatedMappings.length) { - var nextMapping = this._generatedMappings[index + 1]; - - if (mapping.generatedLine === nextMapping.generatedLine) { - mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; - continue; - } - } - // The last mapping for each line spans the entire line. - mapping.lastGeneratedColumn = Infinity; - } - }; +function formatResource(urlObj, options) +{ + return showResource(urlObj,options) ? urlObj.resource : ""; +} - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. - * - column: The column number in the generated source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. - * - column: The column number in the original source, or null. - * - name: The original identifier, or null. - */ - BasicSourceMapConsumer.prototype.originalPositionFor = - function SourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - var index = this._findMapping( - needle, - this._generatedMappings, - "generatedLine", - "generatedColumn", - util.compareByGeneratedPositionsDeflated, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._generatedMappings[index]; - - if (mapping.generatedLine === needle.generatedLine) { - var source = util.getArg(mapping, 'source', null); - if (source !== null) { - source = this._sources.at(source); - if (this.sourceRoot != null) { - source = util.join(this.sourceRoot, source); - } - } - var name = util.getArg(mapping, 'name', null); - if (name !== null) { - name = this._names.at(name); - } - return { - source: source, - line: util.getArg(mapping, 'originalLine', null), - column: util.getArg(mapping, 'originalColumn', null), - name: name - }; - } - } - return { - source: null, - line: null, - column: null, - name: null - }; - }; +function formatScheme(urlObj, options) +{ + var str = ""; + + if (urlObj.extra.relation.maximumHost || options.output===constants.ABSOLUTE) + { + if (!urlObj.extra.relation.minimumScheme || !options.schemeRelative || options.output===constants.ABSOLUTE) + { + str += urlObj.scheme + "://"; + } + else + { + str += "//"; + } + } + + return str; +} - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - BasicSourceMapConsumer.prototype.hasContentsOfAllSources = - function BasicSourceMapConsumer_hasContentsOfAllSources() { - if (!this.sourcesContent) { - return false; - } - return this.sourcesContent.length >= this._sources.size() && - !this.sourcesContent.some(function (sc) { return sc == null; }); - }; - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * availible. - */ - BasicSourceMapConsumer.prototype.sourceContentFor = - function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - if (!this.sourcesContent) { - return null; - } - if (this.sourceRoot != null) { - aSource = util.relative(this.sourceRoot, aSource); - } +function formatUrl(urlObj, options) +{ + var url = ""; + + url += formatScheme(urlObj, options); + url += formatAuth(urlObj, options); + url += formatHost(urlObj, options); + url += formatPort(urlObj, options); + url += formatPath(urlObj, options); + url += formatResource(urlObj, options); + url += formatQuery(urlObj, options); + url += formatHash(urlObj, options); + + return url; +} - if (this._sources.has(aSource)) { - return this.sourcesContent[this._sources.indexOf(aSource)]; - } - var url; - if (this.sourceRoot != null - && (url = util.urlParse(this.sourceRoot))) { - // XXX: file:// URIs and absolute paths lead to unexpected behavior for - // many users. We can help them out when they expect file:// URIs to - // behave like it would if they were running a local HTTP server. See - // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. - var fileUriAbsPath = aSource.replace(/^file:\/\//, ""); - if (url.scheme == "file" - && this._sources.has(fileUriAbsPath)) { - return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] - } - if ((!url.path || url.path == "/") - && this._sources.has("/" + aSource)) { - return this.sourcesContent[this._sources.indexOf("/" + aSource)]; - } - } +function getQuery(urlObj, options) +{ + var stripQuery = options.removeEmptyQueries && urlObj.extra.relation.minimumPort; + + return urlObj.query.string[ stripQuery ? "stripped" : "full" ]; +} - // This function is used recursively from - // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we - // don't want to throw if we can't find the source - we just want to - // return null, so we provide a flag to exit gracefully. - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } - }; - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: The column number in the original source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - BasicSourceMapConsumer.prototype.generatedPositionFor = - function SourceMapConsumer_generatedPositionFor(aArgs) { - var source = util.getArg(aArgs, 'source'); - if (this.sourceRoot != null) { - source = util.relative(this.sourceRoot, source); - } - if (!this._sources.has(source)) { - return { - line: null, - column: null, - lastColumn: null - }; - } - source = this._sources.indexOf(source); - var needle = { - source: source, - originalLine: util.getArg(aArgs, 'line'), - originalColumn: util.getArg(aArgs, 'column') - }; +function showQuery(urlObj, options) +{ + return !urlObj.extra.relation.minimumQuery || options.output===constants.ABSOLUTE || options.output===constants.ROOT_RELATIVE; +} - var index = this._findMapping( - needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - if (index >= 0) { - var mapping = this._originalMappings[index]; - if (mapping.source === needle.source) { - return { - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }; - } - } +function showResource(urlObj, options) +{ + var removeIndex = options.removeDirectoryIndexes && urlObj.extra.resourceIsIndex; + var removeMatchingResource = urlObj.extra.relation.minimumResource && options.output!==constants.ABSOLUTE && options.output!==constants.ROOT_RELATIVE; + + return !!urlObj.resource && !removeMatchingResource && !removeIndex; +} - return { - line: null, - column: null, - lastColumn: null - }; - }; - exports.BasicSourceMapConsumer = BasicSourceMapConsumer; - - /** - * An IndexedSourceMapConsumer instance represents a parsed source map which - * we can query for information. It differs from BasicSourceMapConsumer in - * that it takes "indexed" source maps (i.e. ones with a "sections" field) as - * input. - * - * The only parameter is a raw source map (either as a JSON string, or already - * parsed to an object). According to the spec for indexed source maps, they - * have the following attributes: - * - * - version: Which version of the source map spec this map is following. - * - file: Optional. The generated file this source map is associated with. - * - sections: A list of section definitions. - * - * Each value under the "sections" field has two fields: - * - offset: The offset into the original specified at which this section - * begins to apply, defined as an object with a "line" and "column" - * field. - * - map: A source map definition. This source map could also be indexed, - * but doesn't have to be. - * - * Instead of the "map" field, it's also possible to have a "url" field - * specifying a URL to retrieve a source map from, but that's currently - * unsupported. - * - * Here's an example source map, taken from the source map spec[0], but - * modified to omit a section which uses the "url" field. - * - * { - * version : 3, - * file: "app.js", - * sections: [{ - * offset: {line:100, column:10}, - * map: { - * version : 3, - * file: "section.js", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AAAA,E;;ABCDE;" - * } - * }], - * } - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt - */ - function IndexedSourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - var version = util.getArg(sourceMap, 'version'); - var sections = util.getArg(sourceMap, 'sections'); - - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - this._sources = new ArraySet(); - this._names = new ArraySet(); - - var lastOffset = { - line: -1, - column: 0 - }; - this._sections = sections.map(function (s) { - if (s.url) { - // The url field will require support for asynchronicity. - // See https://github.com/mozilla/source-map/issues/16 - throw new Error('Support for url field in sections not implemented.'); - } - var offset = util.getArg(s, 'offset'); - var offsetLine = util.getArg(offset, 'line'); - var offsetColumn = util.getArg(offset, 'column'); - if (offsetLine < lastOffset.line || - (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { - throw new Error('Section offsets must be ordered and non-overlapping.'); - } - lastOffset = offset; +module.exports = formatUrl; - return { - generatedOffset: { - // The offset fields are 0-based, but we use 1-based indices when - // encoding/decoding from VLQ. - generatedLine: offsetLine + 1, - generatedColumn: offsetColumn + 1 - }, - consumer: new SourceMapConsumer(util.getArg(s, 'map')) - } - }); - } +},{"./constants":124}],126:[function(require,module,exports){ +"use strict"; - IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; +var constants = require("./constants"); +var formatUrl = require("./format"); +var getOptions = require("./options"); +var objUtils = require("./util/object"); +var parseUrl = require("./parse"); +var relateUrl = require("./relate"); - /** - * The version of the source mapping spec that we are consuming. - */ - IndexedSourceMapConsumer.prototype._version = 3; - /** - * The list of original sources. - */ - Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { - get: function () { - var sources = []; - for (var i = 0; i < this._sections.length; i++) { - for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { - sources.push(this._sections[i].consumer.sources[j]); - } - }; - return sources; - } - }); - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. - * - column: The column number in the generated source. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. - * - column: The column number in the original source, or null. - * - name: The original identifier, or null. - */ - IndexedSourceMapConsumer.prototype.originalPositionFor = - function IndexedSourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; +function RelateUrl(from, options) +{ + this.options = getOptions(options, + { + defaultPorts: {ftp:21, http:80, https:443}, + directoryIndexes: ["index.html"], + ignore_www: false, + output: RelateUrl.SHORTEST, + rejectedSchemes: ["data","javascript","mailto"], + removeAuth: false, + removeDirectoryIndexes: true, + removeEmptyQueries: false, + removeRootTrailingSlash: true, + schemeRelative: true, + site: undefined, + slashesDenoteHost: true + }); + + this.from = parseUrl.from(from, this.options, null); +} - // Find the section containing the generated position we're trying to map - // to an original position. - var sectionIndex = binarySearch.search(needle, this._sections, - function(needle, section) { - var cmp = needle.generatedLine - section.generatedOffset.generatedLine; - if (cmp) { - return cmp; - } - return (needle.generatedColumn - - section.generatedOffset.generatedColumn); - }); - var section = this._sections[sectionIndex]; - if (!section) { - return { - source: null, - line: null, - column: null, - name: null - }; - } +/* + Usage: instance=new RelateUrl(); instance.relate(); +*/ +RelateUrl.prototype.relate = function(from, to, options) +{ + // relate(to,options) + if ( objUtils.isPlainObject(to) ) + { + options = to; + to = from; + from = null; + } + // relate(to) + else if (!to) + { + to = from; + from = null; + } + + options = getOptions(options, this.options); + from = from || options.site; + from = parseUrl.from(from, options, this.from); + + if (!from || !from.href) + { + throw new Error("from value not defined."); + } + else if (from.extra.hrefInfo.minimumPathOnly) + { + throw new Error("from value supplied is not absolute: "+from.href); + } + + to = parseUrl.to(to, options); + + if (to.valid===false) return to.href; + + to = relateUrl(from, to, options); + to = formatUrl(to, options); + + return to; +} - return section.consumer.originalPositionFor({ - line: needle.generatedLine - - (section.generatedOffset.generatedLine - 1), - column: needle.generatedColumn - - (section.generatedOffset.generatedLine === needle.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - bias: aArgs.bias - }); - }; - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = - function IndexedSourceMapConsumer_hasContentsOfAllSources() { - return this._sections.every(function (s) { - return s.consumer.hasContentsOfAllSources(); - }); - }; - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - IndexedSourceMapConsumer.prototype.sourceContentFor = - function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; +/* + Usage: RelateUrl.relate(); +*/ +RelateUrl.relate = function(from, to, options) +{ + return new RelateUrl().relate(from, to, options); +} - var content = section.consumer.sourceContentFor(aSource, true); - if (content) { - return content; - } - } - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } - }; - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: The column number in the original source. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - IndexedSourceMapConsumer.prototype.generatedPositionFor = - function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - // Only consider this section if the requested source is in the list of - // sources of the consumer. - if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) { - continue; - } - var generatedPosition = section.consumer.generatedPositionFor(aArgs); - if (generatedPosition) { - var ret = { - line: generatedPosition.line + - (section.generatedOffset.generatedLine - 1), - column: generatedPosition.column + - (section.generatedOffset.generatedLine === generatedPosition.line - ? section.generatedOffset.generatedColumn - 1 - : 0) - }; - return ret; - } - } - return { - line: null, - column: null - }; - }; +// Make constants accessible from API +objUtils.shallowMerge(RelateUrl, constants); - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - IndexedSourceMapConsumer.prototype._parseMappings = - function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { - this.__generatedMappings = []; - this.__originalMappings = []; - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - var sectionMappings = section.consumer._generatedMappings; - for (var j = 0; j < sectionMappings.length; j++) { - var mapping = sectionMappings[i]; - - var source = section.consumer._sources.at(mapping.source); - if (section.consumer.sourceRoot !== null) { - source = util.join(section.consumer.sourceRoot, source); - } - this._sources.add(source); - source = this._sources.indexOf(source); - - var name = section.consumer._names.at(mapping.name); - this._names.add(name); - name = this._names.indexOf(name); - - // The mappings coming from the consumer for the section have - // generated positions relative to the start of the section, so we - // need to offset them to be relative to the start of the concatenated - // generated file. - var adjustedMapping = { - source: source, - generatedLine: mapping.generatedLine + - (section.generatedOffset.generatedLine - 1), - generatedColumn: mapping.column + - (section.generatedOffset.generatedLine === mapping.generatedLine) - ? section.generatedOffset.generatedColumn - 1 - : 0, - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: name - }; - this.__generatedMappings.push(adjustedMapping); - if (typeof adjustedMapping.originalLine === 'number') { - this.__originalMappings.push(adjustedMapping); - } - }; - }; - quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); - quickSort(this.__originalMappings, util.compareByOriginalPositions); - }; +module.exports = RelateUrl; - exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; +},{"./constants":124,"./format":125,"./options":127,"./parse":130,"./relate":137,"./util/object":139}],127:[function(require,module,exports){ +"use strict"; -}); +var objUtils = require("./util/object"); -},{"./array-set":111,"./base64-vlq":112,"./binary-search":114,"./quick-sort":116,"./util":120,"amdefine":1}],118:[function(require,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -if (typeof define !== 'function') { - var define = require('amdefine')(module, require); -} -define(function (require, exports, module) { - - var base64VLQ = require('./base64-vlq'); - var util = require('./util'); - var ArraySet = require('./array-set').ArraySet; - var MappingList = require('./mapping-list').MappingList; - - /** - * An instance of the SourceMapGenerator represents a source map which is - * being built incrementally. You may pass an object with the following - * properties: - * - * - file: The filename of the generated source. - * - sourceRoot: A root for all relative URLs in this source map. - */ - function SourceMapGenerator(aArgs) { - if (!aArgs) { - aArgs = {}; - } - this._file = util.getArg(aArgs, 'file', null); - this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); - this._skipValidation = util.getArg(aArgs, 'skipValidation', false); - this._sources = new ArraySet(); - this._names = new ArraySet(); - this._mappings = new MappingList(); - this._sourcesContents = null; - } - - SourceMapGenerator.prototype._version = 3; - - /** - * Creates a new SourceMapGenerator based on a SourceMapConsumer - * - * @param aSourceMapConsumer The SourceMap. - */ - SourceMapGenerator.fromSourceMap = - function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { - var sourceRoot = aSourceMapConsumer.sourceRoot; - var generator = new SourceMapGenerator({ - file: aSourceMapConsumer.file, - sourceRoot: sourceRoot - }); - aSourceMapConsumer.eachMapping(function (mapping) { - var newMapping = { - generated: { - line: mapping.generatedLine, - column: mapping.generatedColumn - } - }; - if (mapping.source != null) { - newMapping.source = mapping.source; - if (sourceRoot != null) { - newMapping.source = util.relative(sourceRoot, newMapping.source); - } - newMapping.original = { - line: mapping.originalLine, - column: mapping.originalColumn - }; +function getOptions(options, defaults) +{ + if ( objUtils.isPlainObject(options) ) + { + var newOptions = {}; + + for (var i in defaults) + { + if ( defaults.hasOwnProperty(i) ) + { + if (options[i] !== undefined) + { + newOptions[i] = mergeOption(options[i], defaults[i]); + } + else + { + newOptions[i] = defaults[i]; + } + } + } + + return newOptions; + } + else + { + return defaults; + } +} - if (mapping.name != null) { - newMapping.name = mapping.name; - } - } - generator.addMapping(newMapping); - }); - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - generator.setSourceContent(sourceFile, content); - } - }); - return generator; - }; - /** - * Add a single mapping from original source line and column to the generated - * source's line and column for this source map being created. The mapping - * object should have the following properties: - * - * - generated: An object with the generated line and column positions. - * - original: An object with the original line and column positions. - * - source: The original source file (relative to the sourceRoot). - * - name: An optional original token name for this mapping. - */ - SourceMapGenerator.prototype.addMapping = - function SourceMapGenerator_addMapping(aArgs) { - var generated = util.getArg(aArgs, 'generated'); - var original = util.getArg(aArgs, 'original', null); - var source = util.getArg(aArgs, 'source', null); - var name = util.getArg(aArgs, 'name', null); - - if (!this._skipValidation) { - this._validateMapping(generated, original, source, name); - } +function mergeOption(newValues, defaultValues) +{ + if (defaultValues instanceof Object && newValues instanceof Object) + { + if (defaultValues instanceof Array && newValues instanceof Array) + { + return defaultValues.concat(newValues); + } + else + { + return objUtils.shallowMerge(newValues, defaultValues); + } + } + + return newValues; +} - if (source != null && !this._sources.has(source)) { - this._sources.add(source); - } - if (name != null && !this._names.has(name)) { - this._names.add(name); - } - this._mappings.add({ - generatedLine: generated.line, - generatedColumn: generated.column, - originalLine: original != null && original.line, - originalColumn: original != null && original.column, - source: source, - name: name - }); - }; +module.exports = getOptions; - /** - * Set the source content for a source file. - */ - SourceMapGenerator.prototype.setSourceContent = - function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { - var source = aSourceFile; - if (this._sourceRoot != null) { - source = util.relative(this._sourceRoot, source); - } +},{"./util/object":139}],128:[function(require,module,exports){ +"use strict"; - if (aSourceContent != null) { - // Add the source content to the _sourcesContents map. - // Create a new _sourcesContents map if the property is null. - if (!this._sourcesContents) { - this._sourcesContents = {}; - } - this._sourcesContents[util.toSetString(source)] = aSourceContent; - } else if (this._sourcesContents) { - // Remove the source file from the _sourcesContents map. - // If the _sourcesContents map is empty, set the property to null. - delete this._sourcesContents[util.toSetString(source)]; - if (Object.keys(this._sourcesContents).length === 0) { - this._sourcesContents = null; - } - } - }; +function parseHost(urlObj, options) +{ + // TWEAK :: condition only for speed optimization + if (options.ignore_www) + { + var host = urlObj.host.full; + + if (host) + { + var stripped = host; + + if (host.indexOf("www.") === 0) + { + stripped = host.substr(4); + } + + urlObj.host.stripped = stripped; + } + } +} - /** - * Applies the mappings of a sub-source-map for a specific source file to the - * source map being generated. Each mapping to the supplied source file is - * rewritten using the supplied source map. Note: The resolution for the - * resulting mappings is the minimium of this map and the supplied map. - * - * @param aSourceMapConsumer The source map to be applied. - * @param aSourceFile Optional. The filename of the source file. - * If omitted, SourceMapConsumer's file property will be used. - * @param aSourceMapPath Optional. The dirname of the path to the source map - * to be applied. If relative, it is relative to the SourceMapConsumer. - * This parameter is needed when the two source maps aren't in the same - * directory, and the source map to be applied contains relative source - * paths. If so, those relative source paths need to be rewritten - * relative to the SourceMapGenerator. - */ - SourceMapGenerator.prototype.applySourceMap = - function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { - var sourceFile = aSourceFile; - // If aSourceFile is omitted, we will use the file property of the SourceMap - if (aSourceFile == null) { - if (aSourceMapConsumer.file == null) { - throw new Error( - 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + - 'or the source map\'s "file" property. Both were omitted.' - ); - } - sourceFile = aSourceMapConsumer.file; - } - var sourceRoot = this._sourceRoot; - // Make "sourceFile" relative if an absolute Url is passed. - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - // Applying the SourceMap can add and remove items from the sources and - // the names array. - var newSources = new ArraySet(); - var newNames = new ArraySet(); - - // Find mappings for the "sourceFile" - this._mappings.unsortedForEach(function (mapping) { - if (mapping.source === sourceFile && mapping.originalLine != null) { - // Check if it can be mapped by the source map, then update the mapping. - var original = aSourceMapConsumer.originalPositionFor({ - line: mapping.originalLine, - column: mapping.originalColumn - }); - if (original.source != null) { - // Copy mapping - mapping.source = original.source; - if (aSourceMapPath != null) { - mapping.source = util.join(aSourceMapPath, mapping.source) - } - if (sourceRoot != null) { - mapping.source = util.relative(sourceRoot, mapping.source); - } - mapping.originalLine = original.line; - mapping.originalColumn = original.column; - if (original.name != null) { - mapping.name = original.name; - } - } - } - var source = mapping.source; - if (source != null && !newSources.has(source)) { - newSources.add(source); - } - var name = mapping.name; - if (name != null && !newNames.has(name)) { - newNames.add(name); - } +module.exports = parseHost; - }, this); - this._sources = newSources; - this._names = newNames; +},{}],129:[function(require,module,exports){ +"use strict"; - // Copy sourcesContents of applied map. - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aSourceMapPath != null) { - sourceFile = util.join(aSourceMapPath, sourceFile); - } - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - this.setSourceContent(sourceFile, content); - } - }, this); - }; +function hrefInfo(urlObj) +{ + var minimumPathOnly = (!urlObj.scheme && !urlObj.auth && !urlObj.host.full && !urlObj.port); + var minimumResourceOnly = (minimumPathOnly && !urlObj.path.absolute.string); + var minimumQueryOnly = (minimumResourceOnly && !urlObj.resource); + var minimumHashOnly = (minimumQueryOnly && !urlObj.query.string.full.length); + var empty = (minimumHashOnly && !urlObj.hash); + + urlObj.extra.hrefInfo.minimumPathOnly = minimumPathOnly; + urlObj.extra.hrefInfo.minimumResourceOnly = minimumResourceOnly; + urlObj.extra.hrefInfo.minimumQueryOnly = minimumQueryOnly; + urlObj.extra.hrefInfo.minimumHashOnly = minimumHashOnly; + urlObj.extra.hrefInfo.empty = empty; +} - /** - * A mapping can have one of the three levels of data: - * - * 1. Just the generated position. - * 2. The Generated position, original position, and original source. - * 3. Generated and original position, original source, as well as a name - * token. - * - * To maintain consistency, we validate that any new mapping being added falls - * in to one of these categories. - */ - SourceMapGenerator.prototype._validateMapping = - function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, - aName) { - if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aGenerated.line > 0 && aGenerated.column >= 0 - && !aOriginal && !aSource && !aName) { - // Case 1. - return; - } - else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aOriginal && 'line' in aOriginal && 'column' in aOriginal - && aGenerated.line > 0 && aGenerated.column >= 0 - && aOriginal.line > 0 && aOriginal.column >= 0 - && aSource) { - // Cases 2 and 3. - return; - } - else { - throw new Error('Invalid mapping: ' + JSON.stringify({ - generated: aGenerated, - source: aSource, - original: aOriginal, - name: aName - })); - } - }; - /** - * Serialize the accumulated mappings in to the stream of base 64 VLQs - * specified by the source map format. - */ - SourceMapGenerator.prototype._serializeMappings = - function SourceMapGenerator_serializeMappings() { - var previousGeneratedColumn = 0; - var previousGeneratedLine = 1; - var previousOriginalColumn = 0; - var previousOriginalLine = 0; - var previousName = 0; - var previousSource = 0; - var result = ''; - var mapping; - - var mappings = this._mappings.toArray(); - for (var i = 0, len = mappings.length; i < len; i++) { - mapping = mappings[i]; - - if (mapping.generatedLine !== previousGeneratedLine) { - previousGeneratedColumn = 0; - while (mapping.generatedLine !== previousGeneratedLine) { - result += ';'; - previousGeneratedLine++; - } - } - else { - if (i > 0) { - if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { - continue; - } - result += ','; - } - } - result += base64VLQ.encode(mapping.generatedColumn - - previousGeneratedColumn); - previousGeneratedColumn = mapping.generatedColumn; +module.exports = hrefInfo; - if (mapping.source != null) { - result += base64VLQ.encode(this._sources.indexOf(mapping.source) - - previousSource); - previousSource = this._sources.indexOf(mapping.source); +},{}],130:[function(require,module,exports){ +"use strict"; - // lines are stored 0-based in SourceMap spec version 3 - result += base64VLQ.encode(mapping.originalLine - 1 - - previousOriginalLine); - previousOriginalLine = mapping.originalLine - 1; +var hrefInfo = require("./hrefInfo"); +var parseHost = require("./host"); +var parsePath = require("./path"); +var parsePort = require("./port"); +var parseQuery = require("./query"); +var parseUrlString = require("./urlstring"); +var pathUtils = require("../util/path"); - result += base64VLQ.encode(mapping.originalColumn - - previousOriginalColumn); - previousOriginalColumn = mapping.originalColumn; - if (mapping.name != null) { - result += base64VLQ.encode(this._names.indexOf(mapping.name) - - previousName); - previousName = this._names.indexOf(mapping.name); - } - } - } - return result; - }; +function parseFromUrl(url, options, fallback) +{ + if (url) + { + var urlObj = parseUrl(url, options); + + // Because the following occurs in the relate stage for "to" URLs, + // such had to be mostly duplicated here + + var pathArray = pathUtils.resolveDotSegments(urlObj.path.absolute.array); + + urlObj.path.absolute.array = pathArray; + urlObj.path.absolute.string = "/" + pathUtils.join(pathArray); + + return urlObj; + } + else + { + return fallback; + } +} - SourceMapGenerator.prototype._generateSourcesContent = - function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { - return aSources.map(function (source) { - if (!this._sourcesContents) { - return null; - } - if (aSourceRoot != null) { - source = util.relative(aSourceRoot, source); - } - var key = util.toSetString(source); - return Object.prototype.hasOwnProperty.call(this._sourcesContents, - key) - ? this._sourcesContents[key] - : null; - }, this); - }; - /** - * Externalize the source map. - */ - SourceMapGenerator.prototype.toJSON = - function SourceMapGenerator_toJSON() { - var map = { - version: this._version, - sources: this._sources.toArray(), - names: this._names.toArray(), - mappings: this._serializeMappings() - }; - if (this._file != null) { - map.file = this._file; - } - if (this._sourceRoot != null) { - map.sourceRoot = this._sourceRoot; - } - if (this._sourcesContents) { - map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); - } - return map; - }; +function parseUrl(url, options) +{ + var urlObj = parseUrlString(url, options); + + if (urlObj.valid===false) return urlObj; + + parseHost(urlObj, options); + parsePort(urlObj, options); + parsePath(urlObj, options); + parseQuery(urlObj, options); + hrefInfo(urlObj); + + return urlObj; +} - /** - * Render the source map being generated to a string. - */ - SourceMapGenerator.prototype.toString = - function SourceMapGenerator_toString() { - return JSON.stringify(this.toJSON()); - }; - exports.SourceMapGenerator = SourceMapGenerator; -}); +module.exports = +{ + from: parseFromUrl, + to: parseUrl +}; -},{"./array-set":111,"./base64-vlq":112,"./mapping-list":115,"./util":120,"amdefine":1}],119:[function(require,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -if (typeof define !== 'function') { - var define = require('amdefine')(module, require); -} -define(function (require, exports, module) { - - var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator; - var util = require('./util'); - - // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other - // operating systems these days (capturing the result). - var REGEX_NEWLINE = /(\r?\n)/; - - // Newline character code for charCodeAt() comparisons - var NEWLINE_CODE = 10; - - // Private symbol for identifying `SourceNode`s when multiple versions of - // the source-map library are loaded. This MUST NOT CHANGE across - // versions! - var isSourceNode = "$$$isSourceNode$$$"; - - /** - * SourceNodes provide a way to abstract over interpolating/concatenating - * snippets of generated JavaScript source code while maintaining the line and - * column information associated with the original source code. - * - * @param aLine The original line number. - * @param aColumn The original column number. - * @param aSource The original source's filename. - * @param aChunks Optional. An array of strings which are snippets of - * generated JS, or other SourceNodes. - * @param aName The original identifier. - */ - function SourceNode(aLine, aColumn, aSource, aChunks, aName) { - this.children = []; - this.sourceContents = {}; - this.line = aLine == null ? null : aLine; - this.column = aColumn == null ? null : aColumn; - this.source = aSource == null ? null : aSource; - this.name = aName == null ? null : aName; - this[isSourceNode] = true; - if (aChunks != null) this.add(aChunks); - } - - /** - * Creates a SourceNode from generated code and a SourceMapConsumer. - * - * @param aGeneratedCode The generated code - * @param aSourceMapConsumer The SourceMap for the generated code - * @param aRelativePath Optional. The path that relative sources in the - * SourceMapConsumer should be relative to. - */ - SourceNode.fromStringWithSourceMap = - function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { - // The SourceNode we want to fill with the generated code - // and the SourceMap - var node = new SourceNode(); - - // All even indices of this array are one line of the generated code, - // while all odd indices are the newlines between two adjacent lines - // (since `REGEX_NEWLINE` captures its match). - // Processed fragments are removed from this array, by calling `shiftNextLine`. - var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); - var shiftNextLine = function() { - var lineContents = remainingLines.shift(); - // The last line of a file might not have a newline. - var newLine = remainingLines.shift() || ""; - return lineContents + newLine; - }; +},{"../util/path":140,"./host":128,"./hrefInfo":129,"./path":131,"./port":132,"./query":133,"./urlstring":134}],131:[function(require,module,exports){ +"use strict"; - // We need to remember the position of "remainingLines" - var lastGeneratedLine = 1, lastGeneratedColumn = 0; - - // The generate SourceNodes we need a code range. - // To extract it current and last mapping is used. - // Here we store the last mapping. - var lastMapping = null; - - aSourceMapConsumer.eachMapping(function (mapping) { - if (lastMapping !== null) { - // We add the code from "lastMapping" to "mapping": - // First check if there is a new line in between. - if (lastGeneratedLine < mapping.generatedLine) { - var code = ""; - // Associate first line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - lastGeneratedLine++; - lastGeneratedColumn = 0; - // The remaining code is added without mapping - } else { - // There is no new line in between. - // Associate the code between "lastGeneratedColumn" and - // "mapping.generatedColumn" with "lastMapping" - var nextLine = remainingLines[0]; - var code = nextLine.substr(0, mapping.generatedColumn - - lastGeneratedColumn); - remainingLines[0] = nextLine.substr(mapping.generatedColumn - - lastGeneratedColumn); - lastGeneratedColumn = mapping.generatedColumn; - addMappingWithCode(lastMapping, code); - // No more remaining code, continue - lastMapping = mapping; - return; - } - } - // We add the generated code until the first mapping - // to the SourceNode without any mapping. - // Each line is added as separate string. - while (lastGeneratedLine < mapping.generatedLine) { - node.add(shiftNextLine()); - lastGeneratedLine++; - } - if (lastGeneratedColumn < mapping.generatedColumn) { - var nextLine = remainingLines[0]; - node.add(nextLine.substr(0, mapping.generatedColumn)); - remainingLines[0] = nextLine.substr(mapping.generatedColumn); - lastGeneratedColumn = mapping.generatedColumn; - } - lastMapping = mapping; - }, this); - // We have processed all mappings. - if (remainingLines.length > 0) { - if (lastMapping) { - // Associate the remaining code in the current line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - } - // and add the remaining lines without any mapping - node.add(remainingLines.join("")); - } +function isDirectoryIndex(resource, options) +{ + var verdict = false; + + options.directoryIndexes.every( function(index) + { + if (index === resource) + { + verdict = true; + return false; + } + + return true; + }); + + return verdict; +} - // Copy sourcesContent into SourceNode - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aRelativePath != null) { - sourceFile = util.join(aRelativePath, sourceFile); - } - node.setSourceContent(sourceFile, content); - } - }); - return node; - function addMappingWithCode(mapping, code) { - if (mapping === null || mapping.source === undefined) { - node.add(code); - } else { - var source = aRelativePath - ? util.join(aRelativePath, mapping.source) - : mapping.source; - node.add(new SourceNode(mapping.originalLine, - mapping.originalColumn, - source, - code, - mapping.name)); - } - } - }; +function parsePath(urlObj, options) +{ + var path = urlObj.path.absolute.string; + + if (path) + { + var lastSlash = path.lastIndexOf("/"); + + if (lastSlash > -1) + { + if (++lastSlash < path.length) + { + var resource = path.substr(lastSlash); + + if (resource!=="." && resource!=="..") + { + urlObj.resource = resource; + path = path.substr(0, lastSlash); + } + else + { + path += "/"; + } + } + + urlObj.path.absolute.string = path; + urlObj.path.absolute.array = splitPath(path); + } + else if (path==="." || path==="..") + { + // "..?var", "..#anchor", etc ... not "..index.html" + path += "/"; + + urlObj.path.absolute.string = path; + urlObj.path.absolute.array = splitPath(path); + } + else + { + // Resource-only + urlObj.resource = path; + urlObj.path.absolute.string = null; + } + + urlObj.extra.resourceIsIndex = isDirectoryIndex(urlObj.resource, options); + } + // Else: query/hash-only or empty +} - /** - * Add a chunk of generated JS to this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ - SourceNode.prototype.add = function SourceNode_add(aChunk) { - if (Array.isArray(aChunk)) { - aChunk.forEach(function (chunk) { - this.add(chunk); - }, this); - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - if (aChunk) { - this.children.push(aChunk); - } - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; - }; - /** - * Add a chunk of generated JS to the beginning of this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ - SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { - if (Array.isArray(aChunk)) { - for (var i = aChunk.length-1; i >= 0; i--) { - this.prepend(aChunk[i]); - } - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - this.children.unshift(aChunk); - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; - }; - /** - * Walk over the tree of JS snippets in this node and its children. The - * walking function is called once for each snippet of JS and is passed that - * snippet and the its original associated source's line/column location. - * - * @param aFn The traversal function. - */ - SourceNode.prototype.walk = function SourceNode_walk(aFn) { - var chunk; - for (var i = 0, len = this.children.length; i < len; i++) { - chunk = this.children[i]; - if (chunk[isSourceNode]) { - chunk.walk(aFn); - } - else { - if (chunk !== '') { - aFn(chunk, { source: this.source, - line: this.line, - column: this.column, - name: this.name }); - } - } - } - }; +function splitPath(path) +{ + // TWEAK :: condition only for speed optimization + if (path !== "/") + { + var cleaned = []; + + path.split("/").forEach( function(dir) + { + // Cleanup -- splitting "/dir/" becomes ["","dir",""] + if (dir !== "") + { + cleaned.push(dir); + } + }); + + return cleaned; + } + else + { + // Faster to skip the above block and just create an array + return []; + } +} - /** - * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between - * each of `this.children`. - * - * @param aSep The separator. - */ - SourceNode.prototype.join = function SourceNode_join(aSep) { - var newChildren; - var i; - var len = this.children.length; - if (len > 0) { - newChildren = []; - for (i = 0; i < len-1; i++) { - newChildren.push(this.children[i]); - newChildren.push(aSep); - } - newChildren.push(this.children[i]); - this.children = newChildren; - } - return this; - }; - /** - * Call String.prototype.replace on the very right-most source snippet. Useful - * for trimming whitespace from the end of a source node, etc. - * - * @param aPattern The pattern to replace. - * @param aReplacement The thing to replace the pattern with. - */ - SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { - var lastChild = this.children[this.children.length - 1]; - if (lastChild[isSourceNode]) { - lastChild.replaceRight(aPattern, aReplacement); - } - else if (typeof lastChild === 'string') { - this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); - } - else { - this.children.push(''.replace(aPattern, aReplacement)); - } - return this; - }; - /** - * Set the source content for a source file. This will be added to the SourceMapGenerator - * in the sourcesContent field. - * - * @param aSourceFile The filename of the source file - * @param aSourceContent The content of the source file - */ - SourceNode.prototype.setSourceContent = - function SourceNode_setSourceContent(aSourceFile, aSourceContent) { - this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; - }; +module.exports = parsePath; - /** - * Walk over the tree of SourceNodes. The walking function is called for each - * source file content and is passed the filename and source content. - * - * @param aFn The traversal function. - */ - SourceNode.prototype.walkSourceContents = - function SourceNode_walkSourceContents(aFn) { - for (var i = 0, len = this.children.length; i < len; i++) { - if (this.children[i][isSourceNode]) { - this.children[i].walkSourceContents(aFn); - } - } +},{}],132:[function(require,module,exports){ +"use strict"; - var sources = Object.keys(this.sourceContents); - for (var i = 0, len = sources.length; i < len; i++) { - aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); - } - }; +function parsePort(urlObj, options) +{ + var defaultPort = -1; + + for (var i in options.defaultPorts) + { + if ( i===urlObj.scheme && options.defaultPorts.hasOwnProperty(i) ) + { + defaultPort = options.defaultPorts[i]; + break; + } + } + + if (defaultPort > -1) + { + // Force same type as urlObj.port + defaultPort = defaultPort.toString(); + + if (urlObj.port === null) + { + urlObj.port = defaultPort; + } + + urlObj.extra.portIsDefault = (urlObj.port === defaultPort); + } +} - /** - * Return the string representation of this source node. Walks over the tree - * and concatenates all the various snippets together to one string. - */ - SourceNode.prototype.toString = function SourceNode_toString() { - var str = ""; - this.walk(function (chunk) { - str += chunk; - }); - return str; - }; - /** - * Returns the string representation of this source node along with a source - * map. - */ - SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { - var generated = { - code: "", - line: 1, - column: 0 - }; - var map = new SourceMapGenerator(aArgs); - var sourceMappingActive = false; - var lastOriginalSource = null; - var lastOriginalLine = null; - var lastOriginalColumn = null; - var lastOriginalName = null; - this.walk(function (chunk, original) { - generated.code += chunk; - if (original.source !== null - && original.line !== null - && original.column !== null) { - if(lastOriginalSource !== original.source - || lastOriginalLine !== original.line - || lastOriginalColumn !== original.column - || lastOriginalName !== original.name) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - lastOriginalSource = original.source; - lastOriginalLine = original.line; - lastOriginalColumn = original.column; - lastOriginalName = original.name; - sourceMappingActive = true; - } else if (sourceMappingActive) { - map.addMapping({ - generated: { - line: generated.line, - column: generated.column - } - }); - lastOriginalSource = null; - sourceMappingActive = false; - } - for (var idx = 0, length = chunk.length; idx < length; idx++) { - if (chunk.charCodeAt(idx) === NEWLINE_CODE) { - generated.line++; - generated.column = 0; - // Mappings end at eol - if (idx + 1 === length) { - lastOriginalSource = null; - sourceMappingActive = false; - } else if (sourceMappingActive) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - } else { - generated.column++; - } - } - }); - this.walkSourceContents(function (sourceFile, sourceContent) { - map.setSourceContent(sourceFile, sourceContent); - }); - return { code: generated.code, map: map }; - }; +module.exports = parsePort; - exports.SourceNode = SourceNode; +},{}],133:[function(require,module,exports){ +"use strict"; +var hasOwnProperty = Object.prototype.hasOwnProperty; -}); -},{"./source-map-generator":118,"./util":120,"amdefine":1}],120:[function(require,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ -if (typeof define !== 'function') { - var define = require('amdefine')(module, require); -} -define(function (require, exports, module) { - - /** - * This is a helper function for getting values from parameter/options - * objects. - * - * @param args The object we are extracting values from - * @param name The name of the property we are getting. - * @param defaultValue An optional value to return if the property is missing - * from the object. If this is not specified and the property is missing, an - * error will be thrown. - */ - function getArg(aArgs, aName, aDefaultValue) { - if (aName in aArgs) { - return aArgs[aName]; - } else if (arguments.length === 3) { - return aDefaultValue; - } else { - throw new Error('"' + aName + '" is a required argument.'); - } - } - exports.getArg = getArg; - var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/; - var dataUrlRegexp = /^data:.+\,.+$/; +function parseQuery(urlObj, options) +{ + urlObj.query.string.full = stringify(urlObj.query.object, false); + + // TWEAK :: condition only for speed optimization + if (options.removeEmptyQueries) + { + urlObj.query.string.stripped = stringify(urlObj.query.object, true); + } +} - function urlParse(aUrl) { - var match = aUrl.match(urlRegexp); - if (!match) { - return null; - } - return { - scheme: match[1], - auth: match[2], - host: match[3], - port: match[4], - path: match[5] - }; - } - exports.urlParse = urlParse; - - function urlGenerate(aParsedUrl) { - var url = ''; - if (aParsedUrl.scheme) { - url += aParsedUrl.scheme + ':'; - } - url += '//'; - if (aParsedUrl.auth) { - url += aParsedUrl.auth + '@'; - } - if (aParsedUrl.host) { - url += aParsedUrl.host; - } - if (aParsedUrl.port) { - url += ":" + aParsedUrl.port - } - if (aParsedUrl.path) { - url += aParsedUrl.path; - } - return url; - } - exports.urlGenerate = urlGenerate; - - /** - * Normalizes a path, or the path portion of a URL: - * - * - Replaces consequtive slashes with one slash. - * - Removes unnecessary '.' parts. - * - Removes unnecessary '/..' parts. - * - * Based on code in the Node.js 'path' core module. - * - * @param aPath The path or url to normalize. - */ - function normalize(aPath) { - var path = aPath; - var url = urlParse(aPath); - if (url) { - if (!url.path) { - return aPath; - } - path = url.path; - } - var isAbsolute = (path.charAt(0) === '/'); - - var parts = path.split(/\/+/); - for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { - part = parts[i]; - if (part === '.') { - parts.splice(i, 1); - } else if (part === '..') { - up++; - } else if (up > 0) { - if (part === '') { - // The first part is blank if the path is absolute. Trying to go - // above the root is a no-op. Therefore we can remove all '..' parts - // directly after the root. - parts.splice(i + 1, up); - up = 0; - } else { - parts.splice(i, 2); - up--; - } - } - } - path = parts.join('/'); - - if (path === '') { - path = isAbsolute ? '/' : '.'; - } - - if (url) { - url.path = path; - return urlGenerate(url); - } - return path; - } - exports.normalize = normalize; - - /** - * Joins two paths/URLs. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be joined with the root. - * - * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a - * scheme-relative URL: Then the scheme of aRoot, if any, is prepended - * first. - * - Otherwise aPath is a path. If aRoot is a URL, then its path portion - * is updated with the result and aRoot is returned. Otherwise the result - * is returned. - * - If aPath is absolute, the result is aPath. - * - Otherwise the two paths are joined with a slash. - * - Joining for example 'http://' and 'www.example.com' is also supported. - */ - function join(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - if (aPath === "") { - aPath = "."; - } - var aPathUrl = urlParse(aPath); - var aRootUrl = urlParse(aRoot); - if (aRootUrl) { - aRoot = aRootUrl.path || '/'; - } - // `join(foo, '//www.example.org')` - if (aPathUrl && !aPathUrl.scheme) { - if (aRootUrl) { - aPathUrl.scheme = aRootUrl.scheme; - } - return urlGenerate(aPathUrl); - } - if (aPathUrl || aPath.match(dataUrlRegexp)) { - return aPath; - } +function stringify(queryObj, removeEmptyQueries) +{ + var count = 0; + var str = ""; + + for (var i in queryObj) + { + if ( i!=="" && hasOwnProperty.call(queryObj, i)===true ) + { + var value = queryObj[i]; + + if (value !== "" || !removeEmptyQueries) + { + str += (++count===1) ? "?" : "&"; + + i = encodeURIComponent(i); + + if (value !== "") + { + str += i +"="+ encodeURIComponent(value).replace(/%20/g,"+"); + } + else + { + str += i; + } + } + } + } + + return str; +} - // `join('http://', 'www.example.com')` - if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { - aRootUrl.host = aPath; - return urlGenerate(aRootUrl); - } - var joined = aPath.charAt(0) === '/' - ? aPath - : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); - if (aRootUrl) { - aRootUrl.path = joined; - return urlGenerate(aRootUrl); - } - return joined; - } - exports.join = join; - - /** - * Make a path relative to a URL or another path. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be made relative to aRoot. - */ - function relative(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - - aRoot = aRoot.replace(/\/$/, ''); - - // It is possible for the path to be above the root. In this case, simply - // checking whether the root is a prefix of the path won't work. Instead, we - // need to remove components from the root one by one, until either we find - // a prefix that fits, or we run out of components to remove. - var level = 0; - while (aPath.indexOf(aRoot + '/') !== 0) { - var index = aRoot.lastIndexOf("/"); - if (index < 0) { - return aPath; - } +module.exports = parseQuery; - // If the only part of the root that is left is the scheme (i.e. http://, - // file:///, etc.), one or more slashes (/), or simply nothing at all, we - // have exhausted all components, so the path is not relative to the root. - aRoot = aRoot.slice(0, index); - if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { - return aPath; - } +},{}],134:[function(require,module,exports){ +"use strict"; - ++level; - } +var _parseUrl = require("url").parse; - // Make sure we add a "../" for each component we removed from the root. - return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); - } - exports.relative = relative; - /** - * Because behavior goes wacky when you set `__proto__` on objects, we - * have to prefix all the strings in our set with an arbitrary character. - * - * See https://github.com/mozilla/source-map/pull/31 and - * https://github.com/mozilla/source-map/issues/30 - * - * @param String aStr - */ - function toSetString(aStr) { - return '$' + aStr; - } - exports.toSetString = toSetString; - function fromSetString(aStr) { - return aStr.substr(1); - } - exports.fromSetString = fromSetString; +/* + Customize the URL object that Node generates + because: + + * necessary data for later + * urlObj.host is useless + * urlObj.hostname is too long + * urlObj.path is useless + * urlObj.pathname is too long + * urlObj.protocol is inaccurate; should be called "scheme" + * urlObj.search is mostly useless +*/ +function clean(urlObj) +{ + var scheme = urlObj.protocol; + + if (scheme) + { + // Remove ":" suffix + if (scheme.indexOf(":") === scheme.length-1) + { + scheme = scheme.substr(0, scheme.length-1); + } + } + + urlObj.host = + { + // TODO :: unescape(encodeURIComponent(s)) ? ... http://ecmanaut.blogspot.ca/2006/07/encoding-decoding-utf8-in-javascript.html + full: urlObj.hostname, + stripped: null + }; + + urlObj.path = + { + absolute: + { + array: null, + string: urlObj.pathname + }, + relative: + { + array: null, + string: null + } + }; + + urlObj.query = + { + object: urlObj.query, + string: + { + full: null, + stripped: null + } + }; + + urlObj.extra = + { + hrefInfo: + { + minimumPathOnly: null, + minimumResourceOnly: null, + minimumQueryOnly: null, + minimumHashOnly: null, + empty: null, + + separatorOnlyQuery: urlObj.search==="?" + }, + portIsDefault: null, + relation: + { + maximumScheme: null, + maximumAuth: null, + maximumHost: null, + maximumPort: null, + maximumPath: null, + maximumResource: null, + maximumQuery: null, + maximumHash: null, + + minimumScheme: null, + minimumAuth: null, + minimumHost: null, + minimumPort: null, + minimumPath: null, + minimumResource: null, + minimumQuery: null, + minimumHash: null, + + overridesQuery: null + }, + resourceIsIndex: null, + slashes: urlObj.slashes + }; + + urlObj.resource = null; + urlObj.scheme = scheme; + delete urlObj.hostname; + delete urlObj.pathname; + delete urlObj.protocol; + delete urlObj.search; + delete urlObj.slashes; + + return urlObj; +} - /** - * Comparator between two mappings where the original positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same original source/line/column, but different generated - * line and column the same. Useful when searching for a mapping with a - * stubbed out mapping. - */ - function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { - var cmp = mappingA.source - mappingB.source; - if (cmp !== 0) { - return cmp; - } - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0 || onlyCompareOriginal) { - return cmp; - } +function validScheme(url, options) +{ + var valid = true; + + options.rejectedSchemes.every( function(rejectedScheme) + { + valid = !(url.indexOf(rejectedScheme+":") === 0); + + // Break loop + return valid; + }); + + return valid; +} - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - return mappingA.name - mappingB.name; - }; - exports.compareByOriginalPositions = compareByOriginalPositions; +function parseUrlString(url, options) +{ + if ( validScheme(url,options) ) + { + return clean( _parseUrl(url, true, options.slashesDenoteHost) ); + } + else + { + return {href:url, valid:false}; + } +} - /** - * Comparator between two mappings with deflated source and name indices where - * the generated positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same generated line and column, but different - * source/name/original line and column the same. Useful when searching for a - * mapping with a stubbed out mapping. - */ - function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0 || onlyCompareGenerated) { - return cmp; - } - cmp = mappingA.source - mappingB.source; - if (cmp !== 0) { - return cmp; - } +module.exports = parseUrlString; - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } +},{"url":159}],135:[function(require,module,exports){ +"use strict"; - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } +var findRelation = require("./findRelation"); +var objUtils = require("../util/object"); +var pathUtils = require("../util/path"); - return mappingA.name - mappingB.name; - }; - exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; - function strcmp(aStr1, aStr2) { - if (aStr1 === aStr2) { - return 0; - } - if (aStr1 > aStr2) { - return 1; - } +function absolutize(urlObj, siteUrlObj, options) +{ + findRelation.upToPath(urlObj, siteUrlObj, options); + + // Fill in relative URLs + if (urlObj.extra.relation.minimumScheme) urlObj.scheme = siteUrlObj.scheme; + if (urlObj.extra.relation.minimumAuth) urlObj.auth = siteUrlObj.auth; + if (urlObj.extra.relation.minimumHost) urlObj.host = objUtils.clone(siteUrlObj.host); + if (urlObj.extra.relation.minimumPort) copyPort(urlObj, siteUrlObj); + if (urlObj.extra.relation.minimumScheme) copyPath(urlObj, siteUrlObj); + + // Check remaining relativeness now that path has been copied and/or resolved + findRelation.pathOn(urlObj, siteUrlObj, options); + + // Fill in relative URLs + if (urlObj.extra.relation.minimumResource) copyResource(urlObj, siteUrlObj); + if (urlObj.extra.relation.minimumQuery) urlObj.query = objUtils.clone(siteUrlObj.query); + if (urlObj.extra.relation.minimumHash) urlObj.hash = siteUrlObj.hash; +} - return -1; - } - /** - * Comparator between two mappings with inflated source and name strings where - * the generated positions are compared. - */ - function compareByGeneratedPositionsInflated(mappingA, mappingB) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } +/* + Get an absolute path that's relative to site url. +*/ +function copyPath(urlObj, siteUrlObj) +{ + if (urlObj.extra.relation.maximumHost || !urlObj.extra.hrefInfo.minimumResourceOnly) + { + var pathArray = urlObj.path.absolute.array; + var pathString = "/"; + + // If not erroneous URL + if (pathArray) + { + // If is relative path + if (urlObj.extra.hrefInfo.minimumPathOnly && urlObj.path.absolute.string.indexOf("/")!==0) + { + // Append path to site path + pathArray = siteUrlObj.path.absolute.array.concat(pathArray); + } + + pathArray = pathUtils.resolveDotSegments(pathArray); + pathString += pathUtils.join(pathArray); + } + else + { + pathArray = []; + } + + urlObj.path.absolute.array = pathArray; + urlObj.path.absolute.string = pathString; + } + else + { + // Resource-, query- or hash-only or empty + urlObj.path = objUtils.clone(siteUrlObj.path); + } +} - cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } +function copyPort(urlObj, siteUrlObj) +{ + urlObj.port = siteUrlObj.port; + + urlObj.extra.portIsDefault = siteUrlObj.extra.portIsDefault; +} - return strcmp(mappingA.name, mappingB.name); - }; - exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; -}); -},{"amdefine":1}],121:[function(require,module,exports){ -(function (global){ -var ClientRequest = require('./lib/request') -var extend = require('xtend') -var statusCodes = require('builtin-status-codes') -var url = require('url') +function copyResource(urlObj, siteUrlObj) +{ + urlObj.resource = siteUrlObj.resource; + + urlObj.extra.resourceIsIndex = siteUrlObj.extra.resourceIsIndex; +} -var http = exports -http.request = function (opts, cb) { - if (typeof opts === 'string') - opts = url.parse(opts) - else - opts = extend(opts) - // Normally, the page is loaded from http or https, so not specifying a protocol - // will result in a (valid) protocol-relative url. However, this won't work if - // the protocol is something else, like 'file:' - var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : '' +module.exports = absolutize; - var protocol = opts.protocol || defaultProtocol - var host = opts.hostname || opts.host - var port = opts.port - var path = opts.path || '/' +},{"../util/object":139,"../util/path":140,"./findRelation":136}],136:[function(require,module,exports){ +"use strict"; - // Necessary for IPv6 addresses - if (host && host.indexOf(':') !== -1) - host = '[' + host + ']' +function findRelation_upToPath(urlObj, siteUrlObj, options) +{ + // Path- or root-relative URL + var pathOnly = urlObj.extra.hrefInfo.minimumPathOnly; + + // Matching scheme, scheme-relative or path-only + var minimumScheme = (urlObj.scheme===siteUrlObj.scheme || !urlObj.scheme); + + // Matching auth, ignoring auth or path-only + var minimumAuth = minimumScheme && (urlObj.auth===siteUrlObj.auth || options.removeAuth || pathOnly); + + // Matching host or path-only + var www = options.ignore_www ? "stripped" : "full"; + var minimumHost = minimumAuth && (urlObj.host[www]===siteUrlObj.host[www] || pathOnly); + + // Matching port or path-only + var minimumPort = minimumHost && (urlObj.port===siteUrlObj.port || pathOnly); + + urlObj.extra.relation.minimumScheme = minimumScheme; + urlObj.extra.relation.minimumAuth = minimumAuth; + urlObj.extra.relation.minimumHost = minimumHost; + urlObj.extra.relation.minimumPort = minimumPort; + + urlObj.extra.relation.maximumScheme = !minimumScheme || minimumScheme && !minimumAuth; + urlObj.extra.relation.maximumAuth = !minimumScheme || minimumScheme && !minimumHost; + urlObj.extra.relation.maximumHost = !minimumScheme || minimumScheme && !minimumPort; +} - // This may be a relative url. The browser should always be able to interpret it correctly. - opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path - opts.method = (opts.method || 'GET').toUpperCase() - opts.headers = opts.headers || {} - // Also valid opts.auth, opts.mode - var req = new ClientRequest(opts) - if (cb) - req.on('response', cb) - return req +function findRelation_pathOn(urlObj, siteUrlObj, options) +{ + var queryOnly = urlObj.extra.hrefInfo.minimumQueryOnly; + var hashOnly = urlObj.extra.hrefInfo.minimumHashOnly; + var empty = urlObj.extra.hrefInfo.empty; // not required, but self-documenting + + // From upToPath() + var minimumPort = urlObj.extra.relation.minimumPort; + var minimumScheme = urlObj.extra.relation.minimumScheme; + + // Matching port and path + var minimumPath = minimumPort && urlObj.path.absolute.string===siteUrlObj.path.absolute.string; + + // Matching resource or query/hash-only or empty + var matchingResource = (urlObj.resource===siteUrlObj.resource || !urlObj.resource && siteUrlObj.extra.resourceIsIndex) || (options.removeDirectoryIndexes && urlObj.extra.resourceIsIndex && !siteUrlObj.resource); + var minimumResource = minimumPath && (matchingResource || queryOnly || hashOnly || empty); + + // Matching query or hash-only/empty + var query = options.removeEmptyQueries ? "stripped" : "full"; + var urlQuery = urlObj.query.string[query]; + var siteUrlQuery = siteUrlObj.query.string[query]; + var minimumQuery = (minimumResource && !!urlQuery && urlQuery===siteUrlQuery) || ((hashOnly || empty) && !urlObj.extra.hrefInfo.separatorOnlyQuery); + + var minimumHash = minimumQuery && urlObj.hash===siteUrlObj.hash; + + urlObj.extra.relation.minimumPath = minimumPath; + urlObj.extra.relation.minimumResource = minimumResource; + urlObj.extra.relation.minimumQuery = minimumQuery; + urlObj.extra.relation.minimumHash = minimumHash; + + urlObj.extra.relation.maximumPort = !minimumScheme || minimumScheme && !minimumPath; + urlObj.extra.relation.maximumPath = !minimumScheme || minimumScheme && !minimumResource; + urlObj.extra.relation.maximumResource = !minimumScheme || minimumScheme && !minimumQuery; + urlObj.extra.relation.maximumQuery = !minimumScheme || minimumScheme && !minimumHash; + urlObj.extra.relation.maximumHash = !minimumScheme || minimumScheme && !minimumHash; // there's nothing after hash, so it's the same as maximumQuery + + // Matching path and/or resource with existing but non-matching site query + urlObj.extra.relation.overridesQuery = minimumPath && urlObj.extra.relation.maximumResource && !minimumQuery && !!siteUrlQuery; } -http.get = function get (opts, cb) { - var req = http.request(opts, cb) - req.end() - return req -} -http.Agent = function () {} -http.Agent.defaultMaxSockets = 4 -http.STATUS_CODES = statusCodes +module.exports = +{ + pathOn: findRelation_pathOn, + upToPath: findRelation_upToPath +}; -http.METHODS = [ - 'CHECKOUT', - 'CONNECT', - 'COPY', - 'DELETE', - 'GET', - 'HEAD', - 'LOCK', - 'M-SEARCH', - 'MERGE', - 'MKACTIVITY', - 'MKCOL', - 'MOVE', - 'NOTIFY', - 'OPTIONS', - 'PATCH', - 'POST', - 'PROPFIND', - 'PROPPATCH', - 'PURGE', - 'PUT', - 'REPORT', - 'SEARCH', - 'SUBSCRIBE', - 'TRACE', - 'UNLOCK', - 'UNSUBSCRIBE' -] -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./lib/request":123,"builtin-status-codes":7,"url":139,"xtend":146}],122:[function(require,module,exports){ -(function (global){ -exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream) +},{}],137:[function(require,module,exports){ +"use strict"; -exports.blobConstructor = false -try { - new Blob([new ArrayBuffer(1)]) - exports.blobConstructor = true -} catch (e) {} +var absolutize = require("./absolutize"); +var relativize = require("./relativize"); -var xhr = new global.XMLHttpRequest() -// If XDomainRequest is available (ie only, where xhr might not work -// cross domain), use the page location. Otherwise use example.com -xhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com') -function checkTypeSupport (type) { - try { - xhr.responseType = type - return xhr.responseType === type - } catch (e) {} - return false + +function relateUrl(siteUrlObj, urlObj, options) +{ + absolutize(urlObj, siteUrlObj, options); + relativize(urlObj, siteUrlObj, options); + + return urlObj; } -// For some strange reason, Safari 7.0 reports typeof global.ArrayBuffer === 'object'. -// Safari 7.1 appears to have fixed this bug. -var haveArrayBuffer = typeof global.ArrayBuffer !== 'undefined' -var haveSlice = haveArrayBuffer && isFunction(global.ArrayBuffer.prototype.slice) -exports.arraybuffer = haveArrayBuffer && checkTypeSupport('arraybuffer') -// These next two tests unavoidably show warnings in Chrome. Since fetch will always -// be used if it's available, just return false for these to avoid the warnings. -exports.msstream = !exports.fetch && haveSlice && checkTypeSupport('ms-stream') -exports.mozchunkedarraybuffer = !exports.fetch && haveArrayBuffer && - checkTypeSupport('moz-chunked-arraybuffer') -exports.overrideMimeType = isFunction(xhr.overrideMimeType) -exports.vbArray = isFunction(global.VBArray) -function isFunction (value) { - return typeof value === 'function' -} +module.exports = relateUrl; -xhr = null // Help gc +},{"./absolutize":135,"./relativize":138}],138:[function(require,module,exports){ +"use strict"; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],123:[function(require,module,exports){ -(function (process,global,Buffer){ -var capability = require('./capability') -var inherits = require('inherits') -var response = require('./response') -var stream = require('readable-stream') -var toArrayBuffer = require('to-arraybuffer') +var pathUtils = require("../util/path"); -var IncomingMessage = response.IncomingMessage -var rStates = response.readyStates -function decideMode (preferBinary, useFetch) { - if (capability.fetch && useFetch) { - return 'fetch' - } else if (capability.mozchunkedarraybuffer) { - return 'moz-chunked-arraybuffer' - } else if (capability.msstream) { - return 'ms-stream' - } else if (capability.arraybuffer && preferBinary) { - return 'arraybuffer' - } else if (capability.vbArray && preferBinary) { - return 'text:vbarray' - } else { - return 'text' - } + +/* + Get a path relative to the site path. +*/ +function relatePath(absolutePath, siteAbsolutePath) +{ + var relativePath = []; + + // At this point, it's related to the host/port + var related = true; + var parentIndex = -1; + + // Find parents + siteAbsolutePath.forEach( function(siteAbsoluteDir, i) + { + if (related) + { + if (absolutePath[i] !== siteAbsoluteDir) + { + related = false; + } + else + { + parentIndex = i; + } + } + + if (!related) + { + // Up one level + relativePath.push(".."); + } + }); + + // Form path + absolutePath.forEach( function(dir, i) + { + if (i > parentIndex) + { + relativePath.push(dir); + } + }); + + return relativePath; } -var ClientRequest = module.exports = function (opts) { - var self = this - stream.Writable.call(self) - self._opts = opts - self._body = [] - self._headers = {} - if (opts.auth) - self.setHeader('Authorization', 'Basic ' + new Buffer(opts.auth).toString('base64')) - Object.keys(opts.headers).forEach(function (name) { - self.setHeader(name, opts.headers[name]) - }) - var preferBinary - var useFetch = true - if (opts.mode === 'disable-fetch') { - // If the use of XHR should be preferred and includes preserving the 'content-type' header - useFetch = false - preferBinary = true - } else if (opts.mode === 'prefer-streaming') { - // If streaming is a high priority but binary compatibility and - // the accuracy of the 'content-type' header aren't - preferBinary = false - } else if (opts.mode === 'allow-wrong-content-type') { - // If streaming is more important than preserving the 'content-type' header - preferBinary = !capability.overrideMimeType - } else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') { - // Use binary if text streaming may corrupt data or the content-type header, or for speed - preferBinary = true - } else { - throw new Error('Invalid value for opts.mode') +function relativize(urlObj, siteUrlObj, options) +{ + if (urlObj.extra.relation.minimumScheme) + { + var pathArray = relatePath(urlObj.path.absolute.array, siteUrlObj.path.absolute.array); + + urlObj.path.relative.array = pathArray; + urlObj.path.relative.string = pathUtils.join(pathArray); } - self._mode = decideMode(preferBinary, useFetch) - - self.on('finish', function () { - self._onFinish() - }) } -inherits(ClientRequest, stream.Writable) -ClientRequest.prototype.setHeader = function (name, value) { - var self = this - var lowerName = name.toLowerCase() - // This check is not necessary, but it prevents warnings from browsers about setting unsafe - // headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but - // http-browserify did it, so I will too. - if (unsafeHeaders.indexOf(lowerName) !== -1) - return - self._headers[lowerName] = { - name: name, - value: value +module.exports = relativize; + +},{"../util/path":140}],139:[function(require,module,exports){ +"use strict"; + +/* + Deep-clone an object. +*/ +function clone(obj) +{ + if (obj instanceof Object) + { + var clonedObj = (obj instanceof Array) ? [] : {}; + + for (var i in obj) + { + if ( obj.hasOwnProperty(i) ) + { + clonedObj[i] = clone( obj[i] ); + } + } + + return clonedObj; } + + return obj; } -ClientRequest.prototype.getHeader = function (name) { - var self = this - return self._headers[name.toLowerCase()].value -} -ClientRequest.prototype.removeHeader = function (name) { - var self = this - delete self._headers[name.toLowerCase()] + +/* + https://github.com/jonschlinkert/is-plain-object +*/ +function isPlainObject(obj) +{ + return !!obj && typeof obj==="object" && obj.constructor===Object; } -ClientRequest.prototype._onFinish = function () { - var self = this - if (self._destroyed) - return - var opts = self._opts - var headersObj = self._headers - var body - if (opts.method === 'POST' || opts.method === 'PUT' || opts.method === 'PATCH' || opts.method === 'MERGE') { - if (capability.blobConstructor) { - body = new global.Blob(self._body.map(function (buffer) { - return toArrayBuffer(buffer) - }), { - type: (headersObj['content-type'] || {}).value || '' - }) - } else { - // get utf8 string - body = Buffer.concat(self._body).toString() +/* + Shallow-merge two objects. +*/ +function shallowMerge(target, source) +{ + if (target instanceof Object && source instanceof Object) + { + for (var i in source) + { + if ( source.hasOwnProperty(i) ) + { + target[i] = source[i]; + } } } + + return target; +} - if (self._mode === 'fetch') { - var headers = Object.keys(headersObj).map(function (name) { - return [headersObj[name].name, headersObj[name].value] - }) - global.fetch(self._opts.url, { - method: self._opts.method, - headers: headers, - body: body, - mode: 'cors', - credentials: opts.withCredentials ? 'include' : 'same-origin' - }).then(function (response) { - self._fetchResponse = response - self._connect() - }, function (reason) { - self.emit('error', reason) - }) - } else { - var xhr = self._xhr = new global.XMLHttpRequest() - try { - xhr.open(self._opts.method, self._opts.url, true) - } catch (err) { - process.nextTick(function () { - self.emit('error', err) - }) - return - } - // Can't set responseType on really old browsers - if ('responseType' in xhr) - xhr.responseType = self._mode.split(':')[0] +module.exports = +{ + clone: clone, + isPlainObject: isPlainObject, + shallowMerge: shallowMerge +}; - if ('withCredentials' in xhr) - xhr.withCredentials = !!opts.withCredentials +},{}],140:[function(require,module,exports){ +"use strict"; - if (self._mode === 'text' && 'overrideMimeType' in xhr) - xhr.overrideMimeType('text/plain; charset=x-user-defined') +function joinPath(pathArray) +{ + if (pathArray.length > 0) + { + return pathArray.join("/") + "/"; + } + else + { + return ""; + } +} - Object.keys(headersObj).forEach(function (name) { - xhr.setRequestHeader(headersObj[name].name, headersObj[name].value) - }) - self._response = null - xhr.onreadystatechange = function () { - switch (xhr.readyState) { - case rStates.LOADING: - case rStates.DONE: - self._onXHRProgress() - break + +function resolveDotSegments(pathArray) +{ + var pathAbsolute = []; + + pathArray.forEach( function(dir) + { + if (dir !== "..") + { + if (dir !== ".") + { + pathAbsolute.push(dir); } } - // Necessary for streaming in Firefox, since xhr.response is ONLY defined - // in onprogress, not in onreadystatechange with xhr.readyState = 3 - if (self._mode === 'moz-chunked-arraybuffer') { - xhr.onprogress = function () { - self._onXHRProgress() + else + { + // Remove parent + if (pathAbsolute.length > 0) + { + pathAbsolute.splice(pathAbsolute.length-1, 1); } } + }); + + return pathAbsolute; +} - xhr.onerror = function () { - if (self._destroyed) - return - self.emit('error', new Error('XHR error')) - } - try { - xhr.send(body) - } catch (err) { - process.nextTick(function () { - self.emit('error', err) - }) - return - } - } + +module.exports = +{ + join: joinPath, + resolveDotSegments: resolveDotSegments +}; + +},{}],141:[function(require,module,exports){ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = require('./util'); +var has = Object.prototype.hasOwnProperty; + +/** + * A data structure which is a combination of an array and a set. Adding a new + * member is O(1), testing for membership is O(1), and finding the index of an + * element is O(1). Removing elements from the set is not supported. Only + * strings are supported for membership. + */ +function ArraySet() { + this._array = []; + this._set = Object.create(null); } /** - * Checks if xhr.status is readable and non-zero, indicating no error. - * Even though the spec says it should be available in readyState 3, - * accessing it throws an exception in IE8 + * Static method for creating ArraySet instances from an existing array. + */ +ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { + var set = new ArraySet(); + for (var i = 0, len = aArray.length; i < len; i++) { + set.add(aArray[i], aAllowDuplicates); + } + return set; +}; + +/** + * Return how many unique items are in this ArraySet. If duplicates have been + * added, than those do not count towards the size. + * + * @returns Number + */ +ArraySet.prototype.size = function ArraySet_size() { + return Object.getOwnPropertyNames(this._set).length; +}; + +/** + * Add the given string to this set. + * + * @param String aStr + */ +ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { + var sStr = util.toSetString(aStr); + var isDuplicate = has.call(this._set, sStr); + var idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + this._set[sStr] = idx; + } +}; + +/** + * Is the given string a member of this set? + * + * @param String aStr + */ +ArraySet.prototype.has = function ArraySet_has(aStr) { + var sStr = util.toSetString(aStr); + return has.call(this._set, sStr); +}; + +/** + * What is the index of the given string in the array? + * + * @param String aStr + */ +ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + var sStr = util.toSetString(aStr); + if (has.call(this._set, sStr)) { + return this._set[sStr]; + } + throw new Error('"' + aStr + '" is not in the set.'); +}; + +/** + * What is the element at the given index? + * + * @param Number aIdx + */ +ArraySet.prototype.at = function ArraySet_at(aIdx) { + if (aIdx >= 0 && aIdx < this._array.length) { + return this._array[aIdx]; + } + throw new Error('No element indexed by ' + aIdx); +}; + +/** + * Returns the array representation of this set (which has the proper indices + * indicated by indexOf). Note that this is a copy of the internal array used + * for storing the members so that no one can mess with internal state. */ -function statusValid (xhr) { - try { - var status = xhr.status - return (status !== null && status !== 0) - } catch (e) { - return false - } -} +ArraySet.prototype.toArray = function ArraySet_toArray() { + return this._array.slice(); +}; -ClientRequest.prototype._onXHRProgress = function () { - var self = this +exports.ArraySet = ArraySet; - if (!statusValid(self._xhr) || self._destroyed) - return +},{"./util":150}],142:[function(require,module,exports){ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + * + * Based on the Base 64 VLQ implementation in Closure Compiler: + * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java + * + * Copyright 2011 The Closure Compiler Authors. All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ - if (!self._response) - self._connect() +var base64 = require('./base64'); - self._response._onXHRProgress() -} +// A single base 64 digit can contain 6 bits of data. For the base 64 variable +// length quantities we use in the source map spec, the first bit is the sign, +// the next four bits are the actual value, and the 6th bit is the +// continuation bit. The continuation bit tells us whether there are more +// digits in this value following this digit. +// +// Continuation +// | Sign +// | | +// V V +// 101011 -ClientRequest.prototype._connect = function () { - var self = this +var VLQ_BASE_SHIFT = 5; - if (self._destroyed) - return +// binary: 100000 +var VLQ_BASE = 1 << VLQ_BASE_SHIFT; - self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode) - self.emit('response', self._response) -} +// binary: 011111 +var VLQ_BASE_MASK = VLQ_BASE - 1; -ClientRequest.prototype._write = function (chunk, encoding, cb) { - var self = this +// binary: 100000 +var VLQ_CONTINUATION_BIT = VLQ_BASE; - self._body.push(chunk) - cb() +/** + * Converts from a two-complement value to a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) + * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) + */ +function toVLQSigned(aValue) { + return aValue < 0 + ? ((-aValue) << 1) + 1 + : (aValue << 1) + 0; } -ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () { - var self = this - self._destroyed = true - if (self._response) - self._response._destroyed = true - if (self._xhr) - self._xhr.abort() - // Currently, there isn't a way to truly abort a fetch. - // If you like bikeshedding, see https://github.com/whatwg/fetch/issues/27 +/** + * Converts to a two-complement value from a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 + * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 + */ +function fromVLQSigned(aValue) { + var isNegative = (aValue & 1) === 1; + var shifted = aValue >> 1; + return isNegative + ? -shifted + : shifted; } -ClientRequest.prototype.end = function (data, encoding, cb) { - var self = this - if (typeof data === 'function') { - cb = data - data = undefined - } +/** + * Returns the base 64 VLQ encoded value. + */ +exports.encode = function base64VLQ_encode(aValue) { + var encoded = ""; + var digit; - stream.Writable.prototype.end.call(self, data, encoding, cb) -} + var vlq = toVLQSigned(aValue); -ClientRequest.prototype.flushHeaders = function () {} -ClientRequest.prototype.setTimeout = function () {} -ClientRequest.prototype.setNoDelay = function () {} -ClientRequest.prototype.setSocketKeepAlive = function () {} + do { + digit = vlq & VLQ_BASE_MASK; + vlq >>>= VLQ_BASE_SHIFT; + if (vlq > 0) { + // There are still more digits in this value, so we must make sure the + // continuation bit is marked. + digit |= VLQ_CONTINUATION_BIT; + } + encoded += base64.encode(digit); + } while (vlq > 0); -// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method -var unsafeHeaders = [ - 'accept-charset', - 'accept-encoding', - 'access-control-request-headers', - 'access-control-request-method', - 'connection', - 'content-length', - 'cookie', - 'cookie2', - 'date', - 'dnt', - 'expect', - 'host', - 'keep-alive', - 'origin', - 'referer', - 'te', - 'trailer', - 'transfer-encoding', - 'upgrade', - 'user-agent', - 'via' -] + return encoded; +}; -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"./capability":122,"./response":124,"_process":81,"buffer":6,"inherits":74,"readable-stream":92,"to-arraybuffer":126}],124:[function(require,module,exports){ -(function (process,global,Buffer){ -var capability = require('./capability') -var inherits = require('inherits') -var stream = require('readable-stream') +/** + * Decodes the next base 64 VLQ value from the given string and returns the + * value and the rest of the string via the out parameter. + */ +exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { + var strLen = aStr.length; + var result = 0; + var shift = 0; + var continuation, digit; -var rStates = exports.readyStates = { - UNSENT: 0, - OPENED: 1, - HEADERS_RECEIVED: 2, - LOADING: 3, - DONE: 4 -} + do { + if (aIndex >= strLen) { + throw new Error("Expected more digits in base 64 VLQ value."); + } -var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode) { - var self = this - stream.Readable.call(self) + digit = base64.decode(aStr.charCodeAt(aIndex++)); + if (digit === -1) { + throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); + } - self._mode = mode - self.headers = {} - self.rawHeaders = [] - self.trailers = {} - self.rawTrailers = [] + continuation = !!(digit & VLQ_CONTINUATION_BIT); + digit &= VLQ_BASE_MASK; + result = result + (digit << shift); + shift += VLQ_BASE_SHIFT; + } while (continuation); - // Fake the 'close' event, but only once 'end' fires - self.on('end', function () { - // The nextTick is necessary to prevent the 'request' module from causing an infinite loop - process.nextTick(function () { - self.emit('close') - }) - }) + aOutParam.value = fromVLQSigned(result); + aOutParam.rest = aIndex; +}; - if (mode === 'fetch') { - self._fetchResponse = response +},{"./base64":143}],143:[function(require,module,exports){ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ - self.url = response.url - self.statusCode = response.status - self.statusMessage = response.statusText - - response.headers.forEach(function(header, key){ - self.headers[key.toLowerCase()] = header - self.rawHeaders.push(key, header) - }) +var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); +/** + * Encode an integer in the range of 0 to 63 to a single base 64 digit. + */ +exports.encode = function (number) { + if (0 <= number && number < intToCharMap.length) { + return intToCharMap[number]; + } + throw new TypeError("Must be between 0 and 63: " + number); +}; - // TODO: this doesn't respect backpressure. Once WritableStream is available, this can be fixed - var reader = response.body.getReader() - function read () { - reader.read().then(function (result) { - if (self._destroyed) - return - if (result.done) { - self.push(null) - return - } - self.push(new Buffer(result.value)) - read() - }) - } - read() +/** + * Decode a single base 64 character code digit to an integer. Returns -1 on + * failure. + */ +exports.decode = function (charCode) { + var bigA = 65; // 'A' + var bigZ = 90; // 'Z' - } else { - self._xhr = xhr - self._pos = 0 + var littleA = 97; // 'a' + var littleZ = 122; // 'z' - self.url = xhr.responseURL - self.statusCode = xhr.status - self.statusMessage = xhr.statusText - var headers = xhr.getAllResponseHeaders().split(/\r?\n/) - headers.forEach(function (header) { - var matches = header.match(/^([^:]+):\s*(.*)/) - if (matches) { - var key = matches[1].toLowerCase() - if (key === 'set-cookie') { - if (self.headers[key] === undefined) { - self.headers[key] = [] - } - self.headers[key].push(matches[2]) - } else if (self.headers[key] !== undefined) { - self.headers[key] += ', ' + matches[2] - } else { - self.headers[key] = matches[2] - } - self.rawHeaders.push(matches[1], matches[2]) - } - }) + var zero = 48; // '0' + var nine = 57; // '9' - self._charset = 'x-user-defined' - if (!capability.overrideMimeType) { - var mimeType = self.rawHeaders['mime-type'] - if (mimeType) { - var charsetMatch = mimeType.match(/;\s*charset=([^;])(;|$)/) - if (charsetMatch) { - self._charset = charsetMatch[1].toLowerCase() - } - } - if (!self._charset) - self._charset = 'utf-8' // best guess - } - } -} + var plus = 43; // '+' + var slash = 47; // '/' -inherits(IncomingMessage, stream.Readable) + var littleOffset = 26; + var numberOffset = 52; -IncomingMessage.prototype._read = function () {} + // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ + if (bigA <= charCode && charCode <= bigZ) { + return (charCode - bigA); + } -IncomingMessage.prototype._onXHRProgress = function () { - var self = this + // 26 - 51: abcdefghijklmnopqrstuvwxyz + if (littleA <= charCode && charCode <= littleZ) { + return (charCode - littleA + littleOffset); + } - var xhr = self._xhr + // 52 - 61: 0123456789 + if (zero <= charCode && charCode <= nine) { + return (charCode - zero + numberOffset); + } - var response = null - switch (self._mode) { - case 'text:vbarray': // For IE9 - if (xhr.readyState !== rStates.DONE) - break - try { - // This fails in IE8 - response = new global.VBArray(xhr.responseBody).toArray() - } catch (e) {} - if (response !== null) { - self.push(new Buffer(response)) - break - } - // Falls through in IE8 - case 'text': - try { // This will fail when readyState = 3 in IE9. Switch mode and wait for readyState = 4 - response = xhr.responseText - } catch (e) { - self._mode = 'text:vbarray' - break - } - if (response.length > self._pos) { - var newData = response.substr(self._pos) - if (self._charset === 'x-user-defined') { - var buffer = new Buffer(newData.length) - for (var i = 0; i < newData.length; i++) - buffer[i] = newData.charCodeAt(i) & 0xff + // 62: + + if (charCode == plus) { + return 62; + } - self.push(buffer) - } else { - self.push(newData, self._charset) - } - self._pos = response.length - } - break - case 'arraybuffer': - if (xhr.readyState !== rStates.DONE || !xhr.response) - break - response = xhr.response - self.push(new Buffer(new Uint8Array(response))) - break - case 'moz-chunked-arraybuffer': // take whole - response = xhr.response - if (xhr.readyState !== rStates.LOADING || !response) - break - self.push(new Buffer(new Uint8Array(response))) - break - case 'ms-stream': - response = xhr.response - if (xhr.readyState !== rStates.LOADING) - break - var reader = new global.MSStreamReader() - reader.onprogress = function () { - if (reader.result.byteLength > self._pos) { - self.push(new Buffer(new Uint8Array(reader.result.slice(self._pos)))) - self._pos = reader.result.byteLength - } - } - reader.onload = function () { - self.push(null) - } - // reader.onerror = ??? // TODO: this - reader.readAsArrayBuffer(response) - break - } + // 63: / + if (charCode == slash) { + return 63; + } - // The ms-stream case handles end separately in reader.onload() - if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') { - self.push(null) - } -} + // Invalid base64 digit. + return -1; +}; -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"./capability":122,"_process":81,"buffer":6,"inherits":74,"readable-stream":92}],125:[function(require,module,exports){ -// 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. +},{}],144:[function(require,module,exports){ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ -var Buffer = require('buffer').Buffer; +exports.GREATEST_LOWER_BOUND = 1; +exports.LEAST_UPPER_BOUND = 2; -var isBufferEncoding = Buffer.isEncoding - || function(encoding) { - switch (encoding && encoding.toLowerCase()) { - case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true; - default: return false; - } - } +/** + * Recursive implementation of binary search. + * + * @param aLow Indices here and lower do not contain the needle. + * @param aHigh Indices here and higher do not contain the needle. + * @param aNeedle The element being searched for. + * @param aHaystack The non-empty array being searched. + * @param aCompare Function which takes two elements and returns -1, 0, or 1. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + */ +function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { + // This function terminates when one of the following is true: + // + // 1. We find the exact element we are looking for. + // + // 2. We did not find the exact element, but we can return the index of + // the next-closest element. + // + // 3. We did not find the exact element, and there is no next-closest + // element than the one we are searching for, so we return -1. + var mid = Math.floor((aHigh - aLow) / 2) + aLow; + var cmp = aCompare(aNeedle, aHaystack[mid], true); + if (cmp === 0) { + // Found the element we are looking for. + return mid; + } + else if (cmp > 0) { + // Our needle is greater than aHaystack[mid]. + if (aHigh - mid > 1) { + // The element is in the upper half. + return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); + } + // The exact needle element was not found in this haystack. Determine if + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return aHigh < aHaystack.length ? aHigh : -1; + } else { + return mid; + } + } + else { + // Our needle is less than aHaystack[mid]. + if (mid - aLow > 1) { + // The element is in the lower half. + return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); + } -function assertEncoding(encoding) { - if (encoding && !isBufferEncoding(encoding)) { - throw new Error('Unknown encoding: ' + encoding); + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return mid; + } else { + return aLow < 0 ? -1 : aLow; + } } } -// StringDecoder provides an interface for efficiently splitting a series of -// buffers into a series of JS strings without breaking apart multi-byte -// characters. CESU-8 is handled as part of the UTF-8 encoding. -// -// @TODO Handling all encodings inside a single object makes it very difficult -// to reason about this code, so it should be split up in the future. -// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code -// points as used by CESU-8. -var StringDecoder = exports.StringDecoder = function(encoding) { - this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); - assertEncoding(encoding); - switch (this.encoding) { - case 'utf8': - // CESU-8 represents each of Surrogate Pair by 3-bytes - this.surrogateSize = 3; - break; - case 'ucs2': - case 'utf16le': - // UTF-16 represents each of Surrogate Pair by 2-bytes - this.surrogateSize = 2; - this.detectIncompleteChar = utf16DetectIncompleteChar; - break; - case 'base64': - // Base-64 stores 3 bytes in 4 chars, and pads the remainder. - this.surrogateSize = 3; - this.detectIncompleteChar = base64DetectIncompleteChar; +/** + * This is an implementation of binary search which will always try and return + * the index of the closest element if there is no exact hit. This is because + * mappings between original and generated line/col pairs are single points, + * and there is an implicit region between each of them, so a miss just means + * that you aren't on the very start of a region. + * + * @param aNeedle The element you are looking for. + * @param aHaystack The array that is being searched. + * @param aCompare A function which takes the needle and an element in the + * array and returns -1, 0, or 1 depending on whether the needle is less + * than, equal to, or greater than the element, respectively. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. + */ +exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { + if (aHaystack.length === 0) { + return -1; + } + + var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, + aCompare, aBias || exports.GREATEST_LOWER_BOUND); + if (index < 0) { + return -1; + } + + // We have found either the exact element, or the next-closest element than + // the one we are searching for. However, there may be more than one such + // element. Make sure we always return the smallest of these. + while (index - 1 >= 0) { + if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { break; - default: - this.write = passThroughWrite; - return; + } + --index; } - // Enough space to store all bytes of a single character. UTF-8 needs 4 - // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate). - this.charBuffer = new Buffer(6); - // Number of bytes received for the current incomplete multi-byte character. - this.charReceived = 0; - // Number of bytes expected for the current incomplete multi-byte character. - this.charLength = 0; + return index; }; +},{}],145:[function(require,module,exports){ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2014 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ -// write decodes the given buffer and returns it as JS string that is -// guaranteed to not contain any partial multi-byte characters. Any partial -// character found at the end of the buffer is buffered up, and will be -// returned when calling write again with the remaining bytes. -// -// Note: Converting a Buffer containing an orphan surrogate to a String -// currently works, but converting a String to a Buffer (via `new Buffer`, or -// Buffer#write) will replace incomplete surrogates with the unicode -// replacement character. See https://codereview.chromium.org/121173009/ . -StringDecoder.prototype.write = function(buffer) { - var charStr = ''; - // if our last write ended with an incomplete multibyte character - while (this.charLength) { - // determine how many remaining bytes this buffer has to offer for this char - var available = (buffer.length >= this.charLength - this.charReceived) ? - this.charLength - this.charReceived : - buffer.length; - - // add the new bytes to the char buffer - buffer.copy(this.charBuffer, this.charReceived, 0, available); - this.charReceived += available; +var util = require('./util'); - if (this.charReceived < this.charLength) { - // still not enough chars in this buffer? wait for more ... - return ''; - } +/** + * Determine whether mappingB is after mappingA with respect to generated + * position. + */ +function generatedPositionAfter(mappingA, mappingB) { + // Optimized for most common case + var lineA = mappingA.generatedLine; + var lineB = mappingB.generatedLine; + var columnA = mappingA.generatedColumn; + var columnB = mappingB.generatedColumn; + return lineB > lineA || lineB == lineA && columnB >= columnA || + util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; +} - // remove bytes belonging to the current character from the buffer - buffer = buffer.slice(available, buffer.length); +/** + * A data structure to provide a sorted view of accumulated mappings in a + * performance conscious manner. It trades a neglibable overhead in general + * case for a large speedup in case of mappings being added in order. + */ +function MappingList() { + this._array = []; + this._sorted = true; + // Serves as infimum + this._last = {generatedLine: -1, generatedColumn: 0}; +} - // get the character that was split - charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); +/** + * Iterate through internal items. This method takes the same arguments that + * `Array.prototype.forEach` takes. + * + * NOTE: The order of the mappings is NOT guaranteed. + */ +MappingList.prototype.unsortedForEach = + function MappingList_forEach(aCallback, aThisArg) { + this._array.forEach(aCallback, aThisArg); + }; - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - var charCode = charStr.charCodeAt(charStr.length - 1); - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - this.charLength += this.surrogateSize; - charStr = ''; - continue; - } - this.charReceived = this.charLength = 0; +/** + * Add the given source mapping. + * + * @param Object aMapping + */ +MappingList.prototype.add = function MappingList_add(aMapping) { + if (generatedPositionAfter(this._last, aMapping)) { + this._last = aMapping; + this._array.push(aMapping); + } else { + this._sorted = false; + this._array.push(aMapping); + } +}; - // if there are no more bytes in this buffer, just emit our char - if (buffer.length === 0) { - return charStr; - } - break; +/** + * Returns the flat, sorted array of mappings. The mappings are sorted by + * generated position. + * + * WARNING: This method returns internal data without copying, for + * performance. The return value must NOT be mutated, and should be treated as + * an immutable borrow. If you want to take ownership, you must make your own + * copy. + */ +MappingList.prototype.toArray = function MappingList_toArray() { + if (!this._sorted) { + this._array.sort(util.compareByGeneratedPositionsInflated); + this._sorted = true; } + return this._array; +}; - // determine and set charLength / charReceived - this.detectIncompleteChar(buffer); +exports.MappingList = MappingList; - var end = buffer.length; - if (this.charLength) { - // buffer the incomplete character bytes we got - buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end); - end -= this.charReceived; - } +},{"./util":150}],146:[function(require,module,exports){ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ - charStr += buffer.toString(this.encoding, 0, end); +// It turns out that some (most?) JavaScript engines don't self-host +// `Array.prototype.sort`. This makes sense because C++ will likely remain +// faster than JS when doing raw CPU-intensive sorting. However, when using a +// custom comparator function, calling back and forth between the VM's C++ and +// JIT'd JS is rather slow *and* loses JIT type information, resulting in +// worse generated code for the comparator function than would be optimal. In +// fact, when sorting with a comparator, these costs outweigh the benefits of +// sorting in C++. By using our own JS-implemented Quick Sort (below), we get +// a ~3500ms mean speed-up in `bench/bench.html`. - var end = charStr.length - 1; - var charCode = charStr.charCodeAt(end); - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - var size = this.surrogateSize; - this.charLength += size; - this.charReceived += size; - this.charBuffer.copy(this.charBuffer, size, 0, size); - buffer.copy(this.charBuffer, 0, 0, size); - return charStr.substring(0, end); - } +/** + * Swap the elements indexed by `x` and `y` in the array `ary`. + * + * @param {Array} ary + * The array. + * @param {Number} x + * The index of the first item. + * @param {Number} y + * The index of the second item. + */ +function swap(ary, x, y) { + var temp = ary[x]; + ary[x] = ary[y]; + ary[y] = temp; +} - // or just emit the charStr - return charStr; -}; +/** + * Returns a random integer within the range `low .. high` inclusive. + * + * @param {Number} low + * The lower bound on the range. + * @param {Number} high + * The upper bound on the range. + */ +function randomIntInRange(low, high) { + return Math.round(low + (Math.random() * (high - low))); +} -// detectIncompleteChar determines if there is an incomplete UTF-8 character at -// the end of the given buffer. If so, it sets this.charLength to the byte -// length that character, and sets this.charReceived to the number of bytes -// that are available for this character. -StringDecoder.prototype.detectIncompleteChar = function(buffer) { - // determine how many bytes we have to check at the end of this buffer - var i = (buffer.length >= 3) ? 3 : buffer.length; +/** + * The Quick Sort algorithm. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + * @param {Number} p + * Start index of the array + * @param {Number} r + * End index of the array + */ +function doQuickSort(ary, comparator, p, r) { + // If our lower bound is less than our upper bound, we (1) partition the + // array into two pieces and (2) recurse on each half. If it is not, this is + // the empty array and our base case. - // Figure out if one of the last i bytes of our buffer announces an - // incomplete char. - for (; i > 0; i--) { - var c = buffer[buffer.length - i]; + if (p < r) { + // (1) Partitioning. + // + // The partitioning chooses a pivot between `p` and `r` and moves all + // elements that are less than or equal to the pivot to the before it, and + // all the elements that are greater than it after it. The effect is that + // once partition is done, the pivot is in the exact place it will be when + // the array is put in sorted order, and it will not need to be moved + // again. This runs in O(n) time. - // See http://en.wikipedia.org/wiki/UTF-8#Description + // Always choose a random pivot so that an input array which is reverse + // sorted does not cause O(n^2) running time. + var pivotIndex = randomIntInRange(p, r); + var i = p - 1; - // 110XXXXX - if (i == 1 && c >> 5 == 0x06) { - this.charLength = 2; - break; - } + swap(ary, pivotIndex, r); + var pivot = ary[r]; - // 1110XXXX - if (i <= 2 && c >> 4 == 0x0E) { - this.charLength = 3; - break; + // Immediately after `j` is incremented in this loop, the following hold + // true: + // + // * Every element in `ary[p .. i]` is less than or equal to the pivot. + // + // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. + for (var j = p; j < r; j++) { + if (comparator(ary[j], pivot) <= 0) { + i += 1; + swap(ary, i, j); + } } - // 11110XXX - if (i <= 3 && c >> 3 == 0x1E) { - this.charLength = 4; - break; - } - } - this.charReceived = i; -}; + swap(ary, i + 1, j); + var q = i + 1; -StringDecoder.prototype.end = function(buffer) { - var res = ''; - if (buffer && buffer.length) - res = this.write(buffer); + // (2) Recurse on each half. - if (this.charReceived) { - var cr = this.charReceived; - var buf = this.charBuffer; - var enc = this.encoding; - res += buf.slice(0, cr).toString(enc); + doQuickSort(ary, comparator, p, q - 1); + doQuickSort(ary, comparator, q + 1, r); } - - return res; -}; - -function passThroughWrite(buffer) { - return buffer.toString(this.encoding); -} - -function utf16DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 2; - this.charLength = this.charReceived ? 2 : 0; -} - -function base64DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 3; - this.charLength = this.charReceived ? 3 : 0; } -},{"buffer":6}],126:[function(require,module,exports){ -var Buffer = require('buffer').Buffer - -module.exports = function (buf) { - // If the buffer is backed by a Uint8Array, a faster version will work - if (buf instanceof Uint8Array) { - // If the buffer isn't a subarray, return the underlying ArrayBuffer - if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) { - return buf.buffer - } else if (typeof buf.buffer.slice === 'function') { - // Otherwise we need to get a proper copy - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength) - } - } - - if (Buffer.isBuffer(buf)) { - // This is the slow version that will work with any Buffer - // implementation (even in old browsers) - var arrayCopy = new Uint8Array(buf.length) - var len = buf.length - for (var i = 0; i < len; i++) { - arrayCopy[i] = buf[i] - } - return arrayCopy.buffer - } else { - throw new Error('Argument must be a Buffer') - } -} +/** + * Sort the given array in-place with the given comparator function. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + */ +exports.quickSort = function (ary, comparator) { + doQuickSort(ary, comparator, 0, ary.length - 1); +}; -},{"buffer":6}],127:[function(require,module,exports){ +},{}],147:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -18760,2953 +17388,3217 @@ module.exports = function (buf) { */ var util = require('./util'); -var has = Object.prototype.hasOwnProperty; +var binarySearch = require('./binary-search'); +var ArraySet = require('./array-set').ArraySet; +var base64VLQ = require('./base64-vlq'); +var quickSort = require('./quick-sort').quickSort; -/** - * A data structure which is a combination of an array and a set. Adding a new - * member is O(1), testing for membership is O(1), and finding the index of an - * element is O(1). Removing elements from the set is not supported. Only - * strings are supported for membership. - */ -function ArraySet() { - this._array = []; - this._set = Object.create(null); +function SourceMapConsumer(aSourceMap) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); + } + + return sourceMap.sections != null + ? new IndexedSourceMapConsumer(sourceMap) + : new BasicSourceMapConsumer(sourceMap); } -/** - * Static method for creating ArraySet instances from an existing array. - */ -ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { - var set = new ArraySet(); - for (var i = 0, len = aArray.length; i < len; i++) { - set.add(aArray[i], aAllowDuplicates); - } - return set; -}; +SourceMapConsumer.fromSourceMap = function(aSourceMap) { + return BasicSourceMapConsumer.fromSourceMap(aSourceMap); +} /** - * Return how many unique items are in this ArraySet. If duplicates have been - * added, than those do not count towards the size. - * - * @returns Number + * The version of the source mapping spec that we are consuming. */ -ArraySet.prototype.size = function ArraySet_size() { - return Object.getOwnPropertyNames(this._set).length; -}; +SourceMapConsumer.prototype._version = 3; -/** - * Add the given string to this set. - * - * @param String aStr - */ -ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { - var sStr = util.toSetString(aStr); - var isDuplicate = has.call(this._set, sStr); - var idx = this._array.length; - if (!isDuplicate || aAllowDuplicates) { - this._array.push(aStr); +// `__generatedMappings` and `__originalMappings` are arrays that hold the +// parsed mapping coordinates from the source map's "mappings" attribute. They +// are lazily instantiated, accessed via the `_generatedMappings` and +// `_originalMappings` getters respectively, and we only parse the mappings +// and create these arrays once queried for a source location. We jump through +// these hoops because there can be many thousands of mappings, and parsing +// them is expensive, so we only want to do it if we must. +// +// Each object in the arrays is of the form: +// +// { +// generatedLine: The line number in the generated code, +// generatedColumn: The column number in the generated code, +// source: The path to the original source file that generated this +// chunk of code, +// originalLine: The line number in the original source that +// corresponds to this chunk of generated code, +// originalColumn: The column number in the original source that +// corresponds to this chunk of generated code, +// name: The name of the original symbol which generated this chunk of +// code. +// } +// +// All properties except for `generatedLine` and `generatedColumn` can be +// `null`. +// +// `_generatedMappings` is ordered by the generated positions. +// +// `_originalMappings` is ordered by the original positions. + +SourceMapConsumer.prototype.__generatedMappings = null; +Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { + get: function () { + if (!this.__generatedMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__generatedMappings; } - if (!isDuplicate) { - this._set[sStr] = idx; +}); + +SourceMapConsumer.prototype.__originalMappings = null; +Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { + get: function () { + if (!this.__originalMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__originalMappings; } -}; +}); -/** - * Is the given string a member of this set? - * - * @param String aStr - */ -ArraySet.prototype.has = function ArraySet_has(aStr) { - var sStr = util.toSetString(aStr); - return has.call(this._set, sStr); -}; +SourceMapConsumer.prototype._charIsMappingSeparator = + function SourceMapConsumer_charIsMappingSeparator(aStr, index) { + var c = aStr.charAt(index); + return c === ";" || c === ","; + }; /** - * What is the index of the given string in the array? - * - * @param String aStr + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). */ -ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { - var sStr = util.toSetString(aStr); - if (has.call(this._set, sStr)) { - return this._set[sStr]; - } - throw new Error('"' + aStr + '" is not in the set.'); -}; +SourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + throw new Error("Subclasses must implement _parseMappings"); + }; + +SourceMapConsumer.GENERATED_ORDER = 1; +SourceMapConsumer.ORIGINAL_ORDER = 2; + +SourceMapConsumer.GREATEST_LOWER_BOUND = 1; +SourceMapConsumer.LEAST_UPPER_BOUND = 2; /** - * What is the element at the given index? + * Iterate over each mapping between an original source/line/column and a + * generated line/column in this source map. * - * @param Number aIdx + * @param Function aCallback + * The function that is called with each mapping. + * @param Object aContext + * Optional. If specified, this object will be the value of `this` every + * time that `aCallback` is called. + * @param aOrder + * Either `SourceMapConsumer.GENERATED_ORDER` or + * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to + * iterate over the mappings sorted by the generated file's line/column + * order or the original's source/line/column order, respectively. Defaults to + * `SourceMapConsumer.GENERATED_ORDER`. */ -ArraySet.prototype.at = function ArraySet_at(aIdx) { - if (aIdx >= 0 && aIdx < this._array.length) { - return this._array[aIdx]; - } - throw new Error('No element indexed by ' + aIdx); -}; +SourceMapConsumer.prototype.eachMapping = + function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { + var context = aContext || null; + var order = aOrder || SourceMapConsumer.GENERATED_ORDER; -/** - * Returns the array representation of this set (which has the proper indices - * indicated by indexOf). Note that this is a copy of the internal array used - * for storing the members so that no one can mess with internal state. - */ -ArraySet.prototype.toArray = function ArraySet_toArray() { - return this._array.slice(); -}; + var mappings; + switch (order) { + case SourceMapConsumer.GENERATED_ORDER: + mappings = this._generatedMappings; + break; + case SourceMapConsumer.ORIGINAL_ORDER: + mappings = this._originalMappings; + break; + default: + throw new Error("Unknown order of iteration."); + } -exports.ArraySet = ArraySet; + var sourceRoot = this.sourceRoot; + mappings.map(function (mapping) { + var source = mapping.source === null ? null : this._sources.at(mapping.source); + if (source != null && sourceRoot != null) { + source = util.join(sourceRoot, source); + } + return { + source: source, + generatedLine: mapping.generatedLine, + generatedColumn: mapping.generatedColumn, + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: mapping.name === null ? null : this._names.at(mapping.name) + }; + }, this).forEach(aCallback, context); + }; -},{"./util":136}],128:[function(require,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause +/** + * Returns all generated line and column information for the original source, + * line, and column provided. If no column is provided, returns all mappings + * corresponding to a either the line we are searching for or the next + * closest line that has any mappings. Otherwise, returns all mappings + * corresponding to the given line and either the column we are searching for + * or the next closest column that has any offsets. * - * Based on the Base 64 VLQ implementation in Closure Compiler: - * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java + * The only argument is an object with the following properties: * - * Copyright 2011 The Closure Compiler Authors. All rights reserved. - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: + * - source: The filename of the original source. + * - line: The line number in the original source. + * - column: Optional. the column number in the original source. * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. + * and an array of objects is returned, each with the following properties: * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * - line: The line number in the generated source, or null. + * - column: The column number in the generated source, or null. */ +SourceMapConsumer.prototype.allGeneratedPositionsFor = + function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { + var line = util.getArg(aArgs, 'line'); -var base64 = require('./base64'); + // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping + // returns the index of the closest mapping less than the needle. By + // setting needle.originalColumn to 0, we thus find the last mapping for + // the given line, provided such a mapping exists. + var needle = { + source: util.getArg(aArgs, 'source'), + originalLine: line, + originalColumn: util.getArg(aArgs, 'column', 0) + }; -// A single base 64 digit can contain 6 bits of data. For the base 64 variable -// length quantities we use in the source map spec, the first bit is the sign, -// the next four bits are the actual value, and the 6th bit is the -// continuation bit. The continuation bit tells us whether there are more -// digits in this value following this digit. -// -// Continuation -// | Sign -// | | -// V V -// 101011 + if (this.sourceRoot != null) { + needle.source = util.relative(this.sourceRoot, needle.source); + } + if (!this._sources.has(needle.source)) { + return []; + } + needle.source = this._sources.indexOf(needle.source); + + var mappings = []; + + var index = this._findMapping(needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + binarySearch.LEAST_UPPER_BOUND); + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (aArgs.column === undefined) { + var originalLine = mapping.originalLine; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we found. Since + // mappings are sorted, this is guaranteed to find all mappings for + // the line we found. + while (mapping && mapping.originalLine === originalLine) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } else { + var originalColumn = mapping.originalColumn; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we were searching for. + // Since mappings are sorted, this is guaranteed to find all mappings for + // the line we are searching for. + while (mapping && + mapping.originalLine === line && + mapping.originalColumn == originalColumn) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } + } + + return mappings; + }; + +exports.SourceMapConsumer = SourceMapConsumer; + +/** + * A BasicSourceMapConsumer instance represents a parsed source map which we can + * query for information about the original file positions by giving it a file + * position in the generated source. + * + * The only parameter is the raw source map (either as a JSON string, or + * already parsed to an object). According to the spec, source maps have the + * following attributes: + * + * - version: Which version of the source map spec this map is following. + * - sources: An array of URLs to the original source files. + * - names: An array of identifiers which can be referrenced by individual mappings. + * - sourceRoot: Optional. The URL root from which all sources are relative. + * - sourcesContent: Optional. An array of contents of the original source files. + * - mappings: A string of base64 VLQs which contain the actual mappings. + * - file: Optional. The generated file this source map is associated with. + * + * Here is an example source map, taken from the source map spec[0]: + * + * { + * version : 3, + * file: "out.js", + * sourceRoot : "", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AA,AB;;ABCDE;" + * } + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# + */ +function BasicSourceMapConsumer(aSourceMap) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); + } -var VLQ_BASE_SHIFT = 5; + var version = util.getArg(sourceMap, 'version'); + var sources = util.getArg(sourceMap, 'sources'); + // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which + // requires the array) to play nice here. + var names = util.getArg(sourceMap, 'names', []); + var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); + var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); + var mappings = util.getArg(sourceMap, 'mappings'); + var file = util.getArg(sourceMap, 'file', null); -// binary: 100000 -var VLQ_BASE = 1 << VLQ_BASE_SHIFT; + // Once again, Sass deviates from the spec and supplies the version as a + // string rather than a number, so we use loose equality checking here. + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } -// binary: 011111 -var VLQ_BASE_MASK = VLQ_BASE - 1; + sources = sources + .map(String) + // Some source maps produce relative source paths like "./foo.js" instead of + // "foo.js". Normalize these first so that future comparisons will succeed. + // See bugzil.la/1090768. + .map(util.normalize) + // Always ensure that absolute sources are internally stored relative to + // the source root, if the source root is absolute. Not doing this would + // be particularly problematic when the source root is a prefix of the + // source (valid, but why??). See github issue #199 and bugzil.la/1188982. + .map(function (source) { + return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) + ? util.relative(sourceRoot, source) + : source; + }); -// binary: 100000 -var VLQ_CONTINUATION_BIT = VLQ_BASE; + // Pass `true` below to allow duplicate names and sources. While source maps + // are intended to be compressed and deduplicated, the TypeScript compiler + // sometimes generates source maps with duplicates in them. See Github issue + // #72 and bugzil.la/889492. + this._names = ArraySet.fromArray(names.map(String), true); + this._sources = ArraySet.fromArray(sources, true); -/** - * Converts from a two-complement value to a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) - * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) - */ -function toVLQSigned(aValue) { - return aValue < 0 - ? ((-aValue) << 1) + 1 - : (aValue << 1) + 0; + this.sourceRoot = sourceRoot; + this.sourcesContent = sourcesContent; + this._mappings = mappings; + this.file = file; } -/** - * Converts to a two-complement value from a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 - * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 - */ -function fromVLQSigned(aValue) { - var isNegative = (aValue & 1) === 1; - var shifted = aValue >> 1; - return isNegative - ? -shifted - : shifted; -} +BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); +BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; /** - * Returns the base 64 VLQ encoded value. + * Create a BasicSourceMapConsumer from a SourceMapGenerator. + * + * @param SourceMapGenerator aSourceMap + * The source map that will be consumed. + * @returns BasicSourceMapConsumer */ -exports.encode = function base64VLQ_encode(aValue) { - var encoded = ""; - var digit; +BasicSourceMapConsumer.fromSourceMap = + function SourceMapConsumer_fromSourceMap(aSourceMap) { + var smc = Object.create(BasicSourceMapConsumer.prototype); - var vlq = toVLQSigned(aValue); + var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); + var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); + smc.sourceRoot = aSourceMap._sourceRoot; + smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), + smc.sourceRoot); + smc.file = aSourceMap._file; - do { - digit = vlq & VLQ_BASE_MASK; - vlq >>>= VLQ_BASE_SHIFT; - if (vlq > 0) { - // There are still more digits in this value, so we must make sure the - // continuation bit is marked. - digit |= VLQ_CONTINUATION_BIT; - } - encoded += base64.encode(digit); - } while (vlq > 0); + // Because we are modifying the entries (by converting string sources and + // names to indices into the sources and names ArraySets), we have to make + // a copy of the entry or else bad things happen. Shared mutable state + // strikes again! See github issue #191. - return encoded; -}; + var generatedMappings = aSourceMap._mappings.toArray().slice(); + var destGeneratedMappings = smc.__generatedMappings = []; + var destOriginalMappings = smc.__originalMappings = []; -/** - * Decodes the next base 64 VLQ value from the given string and returns the - * value and the rest of the string via the out parameter. - */ -exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { - var strLen = aStr.length; - var result = 0; - var shift = 0; - var continuation, digit; + for (var i = 0, length = generatedMappings.length; i < length; i++) { + var srcMapping = generatedMappings[i]; + var destMapping = new Mapping; + destMapping.generatedLine = srcMapping.generatedLine; + destMapping.generatedColumn = srcMapping.generatedColumn; - do { - if (aIndex >= strLen) { - throw new Error("Expected more digits in base 64 VLQ value."); - } + if (srcMapping.source) { + destMapping.source = sources.indexOf(srcMapping.source); + destMapping.originalLine = srcMapping.originalLine; + destMapping.originalColumn = srcMapping.originalColumn; - digit = base64.decode(aStr.charCodeAt(aIndex++)); - if (digit === -1) { - throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); + if (srcMapping.name) { + destMapping.name = names.indexOf(srcMapping.name); + } + + destOriginalMappings.push(destMapping); + } + + destGeneratedMappings.push(destMapping); } - continuation = !!(digit & VLQ_CONTINUATION_BIT); - digit &= VLQ_BASE_MASK; - result = result + (digit << shift); - shift += VLQ_BASE_SHIFT; - } while (continuation); + quickSort(smc.__originalMappings, util.compareByOriginalPositions); - aOutParam.value = fromVLQSigned(result); - aOutParam.rest = aIndex; -}; + return smc; + }; -},{"./base64":129}],129:[function(require,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause +/** + * The version of the source mapping spec that we are consuming. */ - -var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); +BasicSourceMapConsumer.prototype._version = 3; /** - * Encode an integer in the range of 0 to 63 to a single base 64 digit. + * The list of original sources. */ -exports.encode = function (number) { - if (0 <= number && number < intToCharMap.length) { - return intToCharMap[number]; +Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { + get: function () { + return this._sources.toArray().map(function (s) { + return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s; + }, this); } - throw new TypeError("Must be between 0 and 63: " + number); -}; +}); /** - * Decode a single base 64 character code digit to an integer. Returns -1 on - * failure. + * Provide the JIT with a nice shape / hidden class. */ -exports.decode = function (charCode) { - var bigA = 65; // 'A' - var bigZ = 90; // 'Z' +function Mapping() { + this.generatedLine = 0; + this.generatedColumn = 0; + this.source = null; + this.originalLine = null; + this.originalColumn = null; + this.name = null; +} - var littleA = 97; // 'a' - var littleZ = 122; // 'z' +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +BasicSourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + var generatedLine = 1; + var previousGeneratedColumn = 0; + var previousOriginalLine = 0; + var previousOriginalColumn = 0; + var previousSource = 0; + var previousName = 0; + var length = aStr.length; + var index = 0; + var cachedSegments = {}; + var temp = {}; + var originalMappings = []; + var generatedMappings = []; + var mapping, str, segment, end, value; + + while (index < length) { + if (aStr.charAt(index) === ';') { + generatedLine++; + index++; + previousGeneratedColumn = 0; + } + else if (aStr.charAt(index) === ',') { + index++; + } + else { + mapping = new Mapping(); + mapping.generatedLine = generatedLine; + + // Because each offset is encoded relative to the previous one, + // many segments often have the same encoding. We can exploit this + // fact by caching the parsed variable length fields of each segment, + // allowing us to avoid a second parse if we encounter the same + // segment again. + for (end = index; end < length; end++) { + if (this._charIsMappingSeparator(aStr, end)) { + break; + } + } + str = aStr.slice(index, end); + + segment = cachedSegments[str]; + if (segment) { + index += str.length; + } else { + segment = []; + while (index < end) { + base64VLQ.decode(aStr, index, temp); + value = temp.value; + index = temp.rest; + segment.push(value); + } - var zero = 48; // '0' - var nine = 57; // '9' + if (segment.length === 2) { + throw new Error('Found a source, but no line and column'); + } - var plus = 43; // '+' - var slash = 47; // '/' + if (segment.length === 3) { + throw new Error('Found a source and line, but no column'); + } - var littleOffset = 26; - var numberOffset = 52; + cachedSegments[str] = segment; + } - // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ - if (bigA <= charCode && charCode <= bigZ) { - return (charCode - bigA); - } + // Generated column. + mapping.generatedColumn = previousGeneratedColumn + segment[0]; + previousGeneratedColumn = mapping.generatedColumn; - // 26 - 51: abcdefghijklmnopqrstuvwxyz - if (littleA <= charCode && charCode <= littleZ) { - return (charCode - littleA + littleOffset); - } + if (segment.length > 1) { + // Original source. + mapping.source = previousSource + segment[1]; + previousSource += segment[1]; - // 52 - 61: 0123456789 - if (zero <= charCode && charCode <= nine) { - return (charCode - zero + numberOffset); - } + // Original line. + mapping.originalLine = previousOriginalLine + segment[2]; + previousOriginalLine = mapping.originalLine; + // Lines are stored 0-based + mapping.originalLine += 1; - // 62: + - if (charCode == plus) { - return 62; - } + // Original column. + mapping.originalColumn = previousOriginalColumn + segment[3]; + previousOriginalColumn = mapping.originalColumn; - // 63: / - if (charCode == slash) { - return 63; - } + if (segment.length > 4) { + // Original name. + mapping.name = previousName + segment[4]; + previousName += segment[4]; + } + } - // Invalid base64 digit. - return -1; -}; + generatedMappings.push(mapping); + if (typeof mapping.originalLine === 'number') { + originalMappings.push(mapping); + } + } + } -},{}],130:[function(require,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ + quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); + this.__generatedMappings = generatedMappings; -exports.GREATEST_LOWER_BOUND = 1; -exports.LEAST_UPPER_BOUND = 2; + quickSort(originalMappings, util.compareByOriginalPositions); + this.__originalMappings = originalMappings; + }; /** - * Recursive implementation of binary search. - * - * @param aLow Indices here and lower do not contain the needle. - * @param aHigh Indices here and higher do not contain the needle. - * @param aNeedle The element being searched for. - * @param aHaystack The non-empty array being searched. - * @param aCompare Function which takes two elements and returns -1, 0, or 1. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. + * Find the mapping that best matches the hypothetical "needle" mapping that + * we are searching for in the given "haystack" of mappings. */ -function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { - // This function terminates when one of the following is true: - // - // 1. We find the exact element we are looking for. - // - // 2. We did not find the exact element, but we can return the index of - // the next-closest element. - // - // 3. We did not find the exact element, and there is no next-closest - // element than the one we are searching for, so we return -1. - var mid = Math.floor((aHigh - aLow) / 2) + aLow; - var cmp = aCompare(aNeedle, aHaystack[mid], true); - if (cmp === 0) { - // Found the element we are looking for. - return mid; - } - else if (cmp > 0) { - // Our needle is greater than aHaystack[mid]. - if (aHigh - mid > 1) { - // The element is in the upper half. - return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); - } +BasicSourceMapConsumer.prototype._findMapping = + function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, + aColumnName, aComparator, aBias) { + // To return the position we are searching for, we must first find the + // mapping for the given position and then return the opposite position it + // points to. Because the mappings are sorted, we can use binary search to + // find the best mapping. - // The exact needle element was not found in this haystack. Determine if - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return aHigh < aHaystack.length ? aHigh : -1; - } else { - return mid; + if (aNeedle[aLineName] <= 0) { + throw new TypeError('Line must be greater than or equal to 1, got ' + + aNeedle[aLineName]); } - } - else { - // Our needle is less than aHaystack[mid]. - if (mid - aLow > 1) { - // The element is in the lower half. - return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); + if (aNeedle[aColumnName] < 0) { + throw new TypeError('Column must be greater than or equal to 0, got ' + + aNeedle[aColumnName]); } - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return mid; - } else { - return aLow < 0 ? -1 : aLow; - } - } -} + return binarySearch.search(aNeedle, aMappings, aComparator, aBias); + }; /** - * This is an implementation of binary search which will always try and return - * the index of the closest element if there is no exact hit. This is because - * mappings between original and generated line/col pairs are single points, - * and there is an implicit region between each of them, so a miss just means - * that you aren't on the very start of a region. - * - * @param aNeedle The element you are looking for. - * @param aHaystack The array that is being searched. - * @param aCompare A function which takes the needle and an element in the - * array and returns -1, 0, or 1 depending on whether the needle is less - * than, equal to, or greater than the element, respectively. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. + * Compute the last column for each generated mapping. The last column is + * inclusive. */ -exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { - if (aHaystack.length === 0) { - return -1; - } - - var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, - aCompare, aBias || exports.GREATEST_LOWER_BOUND); - if (index < 0) { - return -1; - } - - // We have found either the exact element, or the next-closest element than - // the one we are searching for. However, there may be more than one such - // element. Make sure we always return the smallest of these. - while (index - 1 >= 0) { - if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { - break; - } - --index; - } +BasicSourceMapConsumer.prototype.computeColumnSpans = + function SourceMapConsumer_computeColumnSpans() { + for (var index = 0; index < this._generatedMappings.length; ++index) { + var mapping = this._generatedMappings[index]; - return index; -}; + // Mappings do not contain a field for the last generated columnt. We + // can come up with an optimistic estimate, however, by assuming that + // mappings are contiguous (i.e. given two consecutive mappings, the + // first mapping ends where the second one starts). + if (index + 1 < this._generatedMappings.length) { + var nextMapping = this._generatedMappings[index + 1]; -},{}],131:[function(require,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2014 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ + if (mapping.generatedLine === nextMapping.generatedLine) { + mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; + continue; + } + } -var util = require('./util'); + // The last mapping for each line spans the entire line. + mapping.lastGeneratedColumn = Infinity; + } + }; /** - * Determine whether mappingB is after mappingA with respect to generated - * position. + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. + * - column: The column number in the generated source. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. + * - column: The column number in the original source, or null. + * - name: The original identifier, or null. */ -function generatedPositionAfter(mappingA, mappingB) { - // Optimized for most common case - var lineA = mappingA.generatedLine; - var lineB = mappingB.generatedLine; - var columnA = mappingA.generatedColumn; - var columnB = mappingB.generatedColumn; - return lineB > lineA || lineB == lineA && columnB >= columnA || - util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; -} +BasicSourceMapConsumer.prototype.originalPositionFor = + function SourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._generatedMappings, + "generatedLine", + "generatedColumn", + util.compareByGeneratedPositionsDeflated, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); -/** - * A data structure to provide a sorted view of accumulated mappings in a - * performance conscious manner. It trades a neglibable overhead in general - * case for a large speedup in case of mappings being added in order. - */ -function MappingList() { - this._array = []; - this._sorted = true; - // Serves as infimum - this._last = {generatedLine: -1, generatedColumn: 0}; -} + if (index >= 0) { + var mapping = this._generatedMappings[index]; -/** - * Iterate through internal items. This method takes the same arguments that - * `Array.prototype.forEach` takes. - * - * NOTE: The order of the mappings is NOT guaranteed. - */ -MappingList.prototype.unsortedForEach = - function MappingList_forEach(aCallback, aThisArg) { - this._array.forEach(aCallback, aThisArg); + if (mapping.generatedLine === needle.generatedLine) { + var source = util.getArg(mapping, 'source', null); + if (source !== null) { + source = this._sources.at(source); + if (this.sourceRoot != null) { + source = util.join(this.sourceRoot, source); + } + } + var name = util.getArg(mapping, 'name', null); + if (name !== null) { + name = this._names.at(name); + } + return { + source: source, + line: util.getArg(mapping, 'originalLine', null), + column: util.getArg(mapping, 'originalColumn', null), + name: name + }; + } + } + + return { + source: null, + line: null, + column: null, + name: null + }; }; /** - * Add the given source mapping. - * - * @param Object aMapping + * Return true if we have the source content for every source in the source + * map, false otherwise. */ -MappingList.prototype.add = function MappingList_add(aMapping) { - if (generatedPositionAfter(this._last, aMapping)) { - this._last = aMapping; - this._array.push(aMapping); - } else { - this._sorted = false; - this._array.push(aMapping); - } -}; +BasicSourceMapConsumer.prototype.hasContentsOfAllSources = + function BasicSourceMapConsumer_hasContentsOfAllSources() { + if (!this.sourcesContent) { + return false; + } + return this.sourcesContent.length >= this._sources.size() && + !this.sourcesContent.some(function (sc) { return sc == null; }); + }; /** - * Returns the flat, sorted array of mappings. The mappings are sorted by - * generated position. - * - * WARNING: This method returns internal data without copying, for - * performance. The return value must NOT be mutated, and should be treated as - * an immutable borrow. If you want to take ownership, you must make your own - * copy. + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. */ -MappingList.prototype.toArray = function MappingList_toArray() { - if (!this._sorted) { - this._array.sort(util.compareByGeneratedPositionsInflated); - this._sorted = true; - } - return this._array; -}; +BasicSourceMapConsumer.prototype.sourceContentFor = + function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + if (!this.sourcesContent) { + return null; + } -exports.MappingList = MappingList; + if (this.sourceRoot != null) { + aSource = util.relative(this.sourceRoot, aSource); + } -},{"./util":136}],132:[function(require,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ + if (this._sources.has(aSource)) { + return this.sourcesContent[this._sources.indexOf(aSource)]; + } -// It turns out that some (most?) JavaScript engines don't self-host -// `Array.prototype.sort`. This makes sense because C++ will likely remain -// faster than JS when doing raw CPU-intensive sorting. However, when using a -// custom comparator function, calling back and forth between the VM's C++ and -// JIT'd JS is rather slow *and* loses JIT type information, resulting in -// worse generated code for the comparator function than would be optimal. In -// fact, when sorting with a comparator, these costs outweigh the benefits of -// sorting in C++. By using our own JS-implemented Quick Sort (below), we get -// a ~3500ms mean speed-up in `bench/bench.html`. + var url; + if (this.sourceRoot != null + && (url = util.urlParse(this.sourceRoot))) { + // XXX: file:// URIs and absolute paths lead to unexpected behavior for + // many users. We can help them out when they expect file:// URIs to + // behave like it would if they were running a local HTTP server. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. + var fileUriAbsPath = aSource.replace(/^file:\/\//, ""); + if (url.scheme == "file" + && this._sources.has(fileUriAbsPath)) { + return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] + } -/** - * Swap the elements indexed by `x` and `y` in the array `ary`. - * - * @param {Array} ary - * The array. - * @param {Number} x - * The index of the first item. - * @param {Number} y - * The index of the second item. - */ -function swap(ary, x, y) { - var temp = ary[x]; - ary[x] = ary[y]; - ary[y] = temp; -} + if ((!url.path || url.path == "/") + && this._sources.has("/" + aSource)) { + return this.sourcesContent[this._sources.indexOf("/" + aSource)]; + } + } -/** - * Returns a random integer within the range `low .. high` inclusive. - * - * @param {Number} low - * The lower bound on the range. - * @param {Number} high - * The upper bound on the range. - */ -function randomIntInRange(low, high) { - return Math.round(low + (Math.random() * (high - low))); -} + // This function is used recursively from + // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we + // don't want to throw if we can't find the source - we just want to + // return null, so we provide a flag to exit gracefully. + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + aSource + '" is not in the SourceMap.'); + } + }; /** - * The Quick Sort algorithm. + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - * @param {Number} p - * Start index of the array - * @param {Number} r - * End index of the array + * - source: The filename of the original source. + * - line: The line number in the original source. + * - column: The column number in the original source. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. + * - column: The column number in the generated source, or null. */ -function doQuickSort(ary, comparator, p, r) { - // If our lower bound is less than our upper bound, we (1) partition the - // array into two pieces and (2) recurse on each half. If it is not, this is - // the empty array and our base case. - - if (p < r) { - // (1) Partitioning. - // - // The partitioning chooses a pivot between `p` and `r` and moves all - // elements that are less than or equal to the pivot to the before it, and - // all the elements that are greater than it after it. The effect is that - // once partition is done, the pivot is in the exact place it will be when - // the array is put in sorted order, and it will not need to be moved - // again. This runs in O(n) time. +BasicSourceMapConsumer.prototype.generatedPositionFor = + function SourceMapConsumer_generatedPositionFor(aArgs) { + var source = util.getArg(aArgs, 'source'); + if (this.sourceRoot != null) { + source = util.relative(this.sourceRoot, source); + } + if (!this._sources.has(source)) { + return { + line: null, + column: null, + lastColumn: null + }; + } + source = this._sources.indexOf(source); - // Always choose a random pivot so that an input array which is reverse - // sorted does not cause O(n^2) running time. - var pivotIndex = randomIntInRange(p, r); - var i = p - 1; + var needle = { + source: source, + originalLine: util.getArg(aArgs, 'line'), + originalColumn: util.getArg(aArgs, 'column') + }; - swap(ary, pivotIndex, r); - var pivot = ary[r]; + var index = this._findMapping( + needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); - // Immediately after `j` is incremented in this loop, the following hold - // true: - // - // * Every element in `ary[p .. i]` is less than or equal to the pivot. - // - // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. - for (var j = p; j < r; j++) { - if (comparator(ary[j], pivot) <= 0) { - i += 1; - swap(ary, i, j); + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (mapping.source === needle.source) { + return { + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }; } } - swap(ary, i + 1, j); - var q = i + 1; - - // (2) Recurse on each half. + return { + line: null, + column: null, + lastColumn: null + }; + }; - doQuickSort(ary, comparator, p, q - 1); - doQuickSort(ary, comparator, q + 1, r); - } -} +exports.BasicSourceMapConsumer = BasicSourceMapConsumer; /** - * Sort the given array in-place with the given comparator function. + * An IndexedSourceMapConsumer instance represents a parsed source map which + * we can query for information. It differs from BasicSourceMapConsumer in + * that it takes "indexed" source maps (i.e. ones with a "sections" field) as + * input. * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - */ -exports.quickSort = function (ary, comparator) { - doQuickSort(ary, comparator, 0, ary.length - 1); -}; - -},{}],133:[function(require,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause + * The only parameter is a raw source map (either as a JSON string, or already + * parsed to an object). According to the spec for indexed source maps, they + * have the following attributes: + * + * - version: Which version of the source map spec this map is following. + * - file: Optional. The generated file this source map is associated with. + * - sections: A list of section definitions. + * + * Each value under the "sections" field has two fields: + * - offset: The offset into the original specified at which this section + * begins to apply, defined as an object with a "line" and "column" + * field. + * - map: A source map definition. This source map could also be indexed, + * but doesn't have to be. + * + * Instead of the "map" field, it's also possible to have a "url" field + * specifying a URL to retrieve a source map from, but that's currently + * unsupported. + * + * Here's an example source map, taken from the source map spec[0], but + * modified to omit a section which uses the "url" field. + * + * { + * version : 3, + * file: "app.js", + * sections: [{ + * offset: {line:100, column:10}, + * map: { + * version : 3, + * file: "section.js", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AAAA,E;;ABCDE;" + * } + * }], + * } + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt */ - -var util = require('./util'); -var binarySearch = require('./binary-search'); -var ArraySet = require('./array-set').ArraySet; -var base64VLQ = require('./base64-vlq'); -var quickSort = require('./quick-sort').quickSort; - -function SourceMapConsumer(aSourceMap) { +function IndexedSourceMapConsumer(aSourceMap) { var sourceMap = aSourceMap; if (typeof aSourceMap === 'string') { sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); } - return sourceMap.sections != null - ? new IndexedSourceMapConsumer(sourceMap) - : new BasicSourceMapConsumer(sourceMap); -} + var version = util.getArg(sourceMap, 'version'); + var sections = util.getArg(sourceMap, 'sections'); -SourceMapConsumer.fromSourceMap = function(aSourceMap) { - return BasicSourceMapConsumer.fromSourceMap(aSourceMap); + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + this._sources = new ArraySet(); + this._names = new ArraySet(); + + var lastOffset = { + line: -1, + column: 0 + }; + this._sections = sections.map(function (s) { + if (s.url) { + // The url field will require support for asynchronicity. + // See https://github.com/mozilla/source-map/issues/16 + throw new Error('Support for url field in sections not implemented.'); + } + var offset = util.getArg(s, 'offset'); + var offsetLine = util.getArg(offset, 'line'); + var offsetColumn = util.getArg(offset, 'column'); + + if (offsetLine < lastOffset.line || + (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { + throw new Error('Section offsets must be ordered and non-overlapping.'); + } + lastOffset = offset; + + return { + generatedOffset: { + // The offset fields are 0-based, but we use 1-based indices when + // encoding/decoding from VLQ. + generatedLine: offsetLine + 1, + generatedColumn: offsetColumn + 1 + }, + consumer: new SourceMapConsumer(util.getArg(s, 'map')) + } + }); } +IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); +IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; + /** * The version of the source mapping spec that we are consuming. */ -SourceMapConsumer.prototype._version = 3; - -// `__generatedMappings` and `__originalMappings` are arrays that hold the -// parsed mapping coordinates from the source map's "mappings" attribute. They -// are lazily instantiated, accessed via the `_generatedMappings` and -// `_originalMappings` getters respectively, and we only parse the mappings -// and create these arrays once queried for a source location. We jump through -// these hoops because there can be many thousands of mappings, and parsing -// them is expensive, so we only want to do it if we must. -// -// Each object in the arrays is of the form: -// -// { -// generatedLine: The line number in the generated code, -// generatedColumn: The column number in the generated code, -// source: The path to the original source file that generated this -// chunk of code, -// originalLine: The line number in the original source that -// corresponds to this chunk of generated code, -// originalColumn: The column number in the original source that -// corresponds to this chunk of generated code, -// name: The name of the original symbol which generated this chunk of -// code. -// } -// -// All properties except for `generatedLine` and `generatedColumn` can be -// `null`. -// -// `_generatedMappings` is ordered by the generated positions. -// -// `_originalMappings` is ordered by the original positions. +IndexedSourceMapConsumer.prototype._version = 3; -SourceMapConsumer.prototype.__generatedMappings = null; -Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { +/** + * The list of original sources. + */ +Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { get: function () { - if (!this.__generatedMappings) { - this._parseMappings(this._mappings, this.sourceRoot); + var sources = []; + for (var i = 0; i < this._sections.length; i++) { + for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { + sources.push(this._sections[i].consumer.sources[j]); + } } - - return this.__generatedMappings; + return sources; } }); -SourceMapConsumer.prototype.__originalMappings = null; -Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { - get: function () { - if (!this.__originalMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } +/** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. + * - column: The column number in the generated source. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. + * - column: The column number in the original source, or null. + * - name: The original identifier, or null. + */ +IndexedSourceMapConsumer.prototype.originalPositionFor = + function IndexedSourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; - return this.__originalMappings; - } -}); + // Find the section containing the generated position we're trying to map + // to an original position. + var sectionIndex = binarySearch.search(needle, this._sections, + function(needle, section) { + var cmp = needle.generatedLine - section.generatedOffset.generatedLine; + if (cmp) { + return cmp; + } -SourceMapConsumer.prototype._charIsMappingSeparator = - function SourceMapConsumer_charIsMappingSeparator(aStr, index) { - var c = aStr.charAt(index); - return c === ";" || c === ","; - }; + return (needle.generatedColumn - + section.generatedOffset.generatedColumn); + }); + var section = this._sections[sectionIndex]; -/** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ -SourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - throw new Error("Subclasses must implement _parseMappings"); + if (!section) { + return { + source: null, + line: null, + column: null, + name: null + }; + } + + return section.consumer.originalPositionFor({ + line: needle.generatedLine - + (section.generatedOffset.generatedLine - 1), + column: needle.generatedColumn - + (section.generatedOffset.generatedLine === needle.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + bias: aArgs.bias + }); }; -SourceMapConsumer.GENERATED_ORDER = 1; -SourceMapConsumer.ORIGINAL_ORDER = 2; - -SourceMapConsumer.GREATEST_LOWER_BOUND = 1; -SourceMapConsumer.LEAST_UPPER_BOUND = 2; - /** - * Iterate over each mapping between an original source/line/column and a - * generated line/column in this source map. - * - * @param Function aCallback - * The function that is called with each mapping. - * @param Object aContext - * Optional. If specified, this object will be the value of `this` every - * time that `aCallback` is called. - * @param aOrder - * Either `SourceMapConsumer.GENERATED_ORDER` or - * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to - * iterate over the mappings sorted by the generated file's line/column - * order or the original's source/line/column order, respectively. Defaults to - * `SourceMapConsumer.GENERATED_ORDER`. + * Return true if we have the source content for every source in the source + * map, false otherwise. */ -SourceMapConsumer.prototype.eachMapping = - function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { - var context = aContext || null; - var order = aOrder || SourceMapConsumer.GENERATED_ORDER; +IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = + function IndexedSourceMapConsumer_hasContentsOfAllSources() { + return this._sections.every(function (s) { + return s.consumer.hasContentsOfAllSources(); + }); + }; - var mappings; - switch (order) { - case SourceMapConsumer.GENERATED_ORDER: - mappings = this._generatedMappings; - break; - case SourceMapConsumer.ORIGINAL_ORDER: - mappings = this._originalMappings; - break; - default: - throw new Error("Unknown order of iteration."); - } +/** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ +IndexedSourceMapConsumer.prototype.sourceContentFor = + function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; - var sourceRoot = this.sourceRoot; - mappings.map(function (mapping) { - var source = mapping.source === null ? null : this._sources.at(mapping.source); - if (source != null && sourceRoot != null) { - source = util.join(sourceRoot, source); + var content = section.consumer.sourceContentFor(aSource, true); + if (content) { + return content; } - return { - source: source, - generatedLine: mapping.generatedLine, - generatedColumn: mapping.generatedColumn, - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: mapping.name === null ? null : this._names.at(mapping.name) - }; - }, this).forEach(aCallback, context); + } + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + aSource + '" is not in the SourceMap.'); + } }; /** - * Returns all generated line and column information for the original source, - * line, and column provided. If no column is provided, returns all mappings - * corresponding to a either the line we are searching for or the next - * closest line that has any mappings. Otherwise, returns all mappings - * corresponding to the given line and either the column we are searching for - * or the next closest column that has any offsets. - * - * The only argument is an object with the following properties: + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: * * - source: The filename of the original source. * - line: The line number in the original source. - * - column: Optional. the column number in the original source. + * - column: The column number in the original source. * - * and an array of objects is returned, each with the following properties: + * and an object is returned with the following properties: * * - line: The line number in the generated source, or null. * - column: The column number in the generated source, or null. */ -SourceMapConsumer.prototype.allGeneratedPositionsFor = - function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { - var line = util.getArg(aArgs, 'line'); +IndexedSourceMapConsumer.prototype.generatedPositionFor = + function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; - // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping - // returns the index of the closest mapping less than the needle. By - // setting needle.originalColumn to 0, we thus find the last mapping for - // the given line, provided such a mapping exists. - var needle = { - source: util.getArg(aArgs, 'source'), - originalLine: line, - originalColumn: util.getArg(aArgs, 'column', 0) + // Only consider this section if the requested source is in the list of + // sources of the consumer. + if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) { + continue; + } + var generatedPosition = section.consumer.generatedPositionFor(aArgs); + if (generatedPosition) { + var ret = { + line: generatedPosition.line + + (section.generatedOffset.generatedLine - 1), + column: generatedPosition.column + + (section.generatedOffset.generatedLine === generatedPosition.line + ? section.generatedOffset.generatedColumn - 1 + : 0) + }; + return ret; + } + } + + return { + line: null, + column: null }; + }; - if (this.sourceRoot != null) { - needle.source = util.relative(this.sourceRoot, needle.source); - } - if (!this._sources.has(needle.source)) { - return []; +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +IndexedSourceMapConsumer.prototype._parseMappings = + function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { + this.__generatedMappings = []; + this.__originalMappings = []; + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + var sectionMappings = section.consumer._generatedMappings; + for (var j = 0; j < sectionMappings.length; j++) { + var mapping = sectionMappings[j]; + + var source = section.consumer._sources.at(mapping.source); + if (section.consumer.sourceRoot !== null) { + source = util.join(section.consumer.sourceRoot, source); + } + this._sources.add(source); + source = this._sources.indexOf(source); + + var name = section.consumer._names.at(mapping.name); + this._names.add(name); + name = this._names.indexOf(name); + + // The mappings coming from the consumer for the section have + // generated positions relative to the start of the section, so we + // need to offset them to be relative to the start of the concatenated + // generated file. + var adjustedMapping = { + source: source, + generatedLine: mapping.generatedLine + + (section.generatedOffset.generatedLine - 1), + generatedColumn: mapping.generatedColumn + + (section.generatedOffset.generatedLine === mapping.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: name + }; + + this.__generatedMappings.push(adjustedMapping); + if (typeof adjustedMapping.originalLine === 'number') { + this.__originalMappings.push(adjustedMapping); + } + } } - needle.source = this._sources.indexOf(needle.source); - var mappings = []; + quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); + quickSort(this.__originalMappings, util.compareByOriginalPositions); + }; - var index = this._findMapping(needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - binarySearch.LEAST_UPPER_BOUND); - if (index >= 0) { - var mapping = this._originalMappings[index]; +exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; - if (aArgs.column === undefined) { - var originalLine = mapping.originalLine; +},{"./array-set":141,"./base64-vlq":142,"./binary-search":144,"./quick-sort":146,"./util":150}],148:[function(require,module,exports){ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we found. Since - // mappings are sorted, this is guaranteed to find all mappings for - // the line we found. - while (mapping && mapping.originalLine === originalLine) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); +var base64VLQ = require('./base64-vlq'); +var util = require('./util'); +var ArraySet = require('./array-set').ArraySet; +var MappingList = require('./mapping-list').MappingList; + +/** + * An instance of the SourceMapGenerator represents a source map which is + * being built incrementally. You may pass an object with the following + * properties: + * + * - file: The filename of the generated source. + * - sourceRoot: A root for all relative URLs in this source map. + */ +function SourceMapGenerator(aArgs) { + if (!aArgs) { + aArgs = {}; + } + this._file = util.getArg(aArgs, 'file', null); + this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); + this._skipValidation = util.getArg(aArgs, 'skipValidation', false); + this._sources = new ArraySet(); + this._names = new ArraySet(); + this._mappings = new MappingList(); + this._sourcesContents = null; +} + +SourceMapGenerator.prototype._version = 3; + +/** + * Creates a new SourceMapGenerator based on a SourceMapConsumer + * + * @param aSourceMapConsumer The SourceMap. + */ +SourceMapGenerator.fromSourceMap = + function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { + var sourceRoot = aSourceMapConsumer.sourceRoot; + var generator = new SourceMapGenerator({ + file: aSourceMapConsumer.file, + sourceRoot: sourceRoot + }); + aSourceMapConsumer.eachMapping(function (mapping) { + var newMapping = { + generated: { + line: mapping.generatedLine, + column: mapping.generatedColumn + } + }; - mapping = this._originalMappings[++index]; + if (mapping.source != null) { + newMapping.source = mapping.source; + if (sourceRoot != null) { + newMapping.source = util.relative(sourceRoot, newMapping.source); } - } else { - var originalColumn = mapping.originalColumn; - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we were searching for. - // Since mappings are sorted, this is guaranteed to find all mappings for - // the line we are searching for. - while (mapping && - mapping.originalLine === line && - mapping.originalColumn == originalColumn) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); + newMapping.original = { + line: mapping.originalLine, + column: mapping.originalColumn + }; - mapping = this._originalMappings[++index]; + if (mapping.name != null) { + newMapping.name = mapping.name; } } - } - return mappings; + generator.addMapping(newMapping); + }); + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + generator.setSourceContent(sourceFile, content); + } + }); + return generator; }; -exports.SourceMapConsumer = SourceMapConsumer; - /** - * A BasicSourceMapConsumer instance represents a parsed source map which we can - * query for information about the original file positions by giving it a file - * position in the generated source. - * - * The only parameter is the raw source map (either as a JSON string, or - * already parsed to an object). According to the spec, source maps have the - * following attributes: - * - * - version: Which version of the source map spec this map is following. - * - sources: An array of URLs to the original source files. - * - names: An array of identifiers which can be referrenced by individual mappings. - * - sourceRoot: Optional. The URL root from which all sources are relative. - * - sourcesContent: Optional. An array of contents of the original source files. - * - mappings: A string of base64 VLQs which contain the actual mappings. - * - file: Optional. The generated file this source map is associated with. - * - * Here is an example source map, taken from the source map spec[0]: - * - * { - * version : 3, - * file: "out.js", - * sourceRoot : "", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AA,AB;;ABCDE;" - * } + * Add a single mapping from original source line and column to the generated + * source's line and column for this source map being created. The mapping + * object should have the following properties: * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# + * - generated: An object with the generated line and column positions. + * - original: An object with the original line and column positions. + * - source: The original source file (relative to the sourceRoot). + * - name: An optional original token name for this mapping. */ -function BasicSourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } +SourceMapGenerator.prototype.addMapping = + function SourceMapGenerator_addMapping(aArgs) { + var generated = util.getArg(aArgs, 'generated'); + var original = util.getArg(aArgs, 'original', null); + var source = util.getArg(aArgs, 'source', null); + var name = util.getArg(aArgs, 'name', null); - var version = util.getArg(sourceMap, 'version'); - var sources = util.getArg(sourceMap, 'sources'); - // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which - // requires the array) to play nice here. - var names = util.getArg(sourceMap, 'names', []); - var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); - var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); - var mappings = util.getArg(sourceMap, 'mappings'); - var file = util.getArg(sourceMap, 'file', null); + if (!this._skipValidation) { + this._validateMapping(generated, original, source, name); + } - // Once again, Sass deviates from the spec and supplies the version as a - // string rather than a number, so we use loose equality checking here. - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } + if (source != null) { + source = String(source); + if (!this._sources.has(source)) { + this._sources.add(source); + } + } - sources = sources - .map(String) - // Some source maps produce relative source paths like "./foo.js" instead of - // "foo.js". Normalize these first so that future comparisons will succeed. - // See bugzil.la/1090768. - .map(util.normalize) - // Always ensure that absolute sources are internally stored relative to - // the source root, if the source root is absolute. Not doing this would - // be particularly problematic when the source root is a prefix of the - // source (valid, but why??). See github issue #199 and bugzil.la/1188982. - .map(function (source) { - return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) - ? util.relative(sourceRoot, source) - : source; + if (name != null) { + name = String(name); + if (!this._names.has(name)) { + this._names.add(name); + } + } + + this._mappings.add({ + generatedLine: generated.line, + generatedColumn: generated.column, + originalLine: original != null && original.line, + originalColumn: original != null && original.column, + source: source, + name: name }); + }; - // Pass `true` below to allow duplicate names and sources. While source maps - // are intended to be compressed and deduplicated, the TypeScript compiler - // sometimes generates source maps with duplicates in them. See Github issue - // #72 and bugzil.la/889492. - this._names = ArraySet.fromArray(names.map(String), true); - this._sources = ArraySet.fromArray(sources, true); +/** + * Set the source content for a source file. + */ +SourceMapGenerator.prototype.setSourceContent = + function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { + var source = aSourceFile; + if (this._sourceRoot != null) { + source = util.relative(this._sourceRoot, source); + } - this.sourceRoot = sourceRoot; - this.sourcesContent = sourcesContent; - this._mappings = mappings; - this.file = file; -} + if (aSourceContent != null) { + // Add the source content to the _sourcesContents map. + // Create a new _sourcesContents map if the property is null. + if (!this._sourcesContents) { + this._sourcesContents = Object.create(null); + } + this._sourcesContents[util.toSetString(source)] = aSourceContent; + } else if (this._sourcesContents) { + // Remove the source file from the _sourcesContents map. + // If the _sourcesContents map is empty, set the property to null. + delete this._sourcesContents[util.toSetString(source)]; + if (Object.keys(this._sourcesContents).length === 0) { + this._sourcesContents = null; + } + } + }; + +/** + * Applies the mappings of a sub-source-map for a specific source file to the + * source map being generated. Each mapping to the supplied source file is + * rewritten using the supplied source map. Note: The resolution for the + * resulting mappings is the minimium of this map and the supplied map. + * + * @param aSourceMapConsumer The source map to be applied. + * @param aSourceFile Optional. The filename of the source file. + * If omitted, SourceMapConsumer's file property will be used. + * @param aSourceMapPath Optional. The dirname of the path to the source map + * to be applied. If relative, it is relative to the SourceMapConsumer. + * This parameter is needed when the two source maps aren't in the same + * directory, and the source map to be applied contains relative source + * paths. If so, those relative source paths need to be rewritten + * relative to the SourceMapGenerator. + */ +SourceMapGenerator.prototype.applySourceMap = + function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { + var sourceFile = aSourceFile; + // If aSourceFile is omitted, we will use the file property of the SourceMap + if (aSourceFile == null) { + if (aSourceMapConsumer.file == null) { + throw new Error( + 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + + 'or the source map\'s "file" property. Both were omitted.' + ); + } + sourceFile = aSourceMapConsumer.file; + } + var sourceRoot = this._sourceRoot; + // Make "sourceFile" relative if an absolute Url is passed. + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + // Applying the SourceMap can add and remove items from the sources and + // the names array. + var newSources = new ArraySet(); + var newNames = new ArraySet(); + + // Find mappings for the "sourceFile" + this._mappings.unsortedForEach(function (mapping) { + if (mapping.source === sourceFile && mapping.originalLine != null) { + // Check if it can be mapped by the source map, then update the mapping. + var original = aSourceMapConsumer.originalPositionFor({ + line: mapping.originalLine, + column: mapping.originalColumn + }); + if (original.source != null) { + // Copy mapping + mapping.source = original.source; + if (aSourceMapPath != null) { + mapping.source = util.join(aSourceMapPath, mapping.source) + } + if (sourceRoot != null) { + mapping.source = util.relative(sourceRoot, mapping.source); + } + mapping.originalLine = original.line; + mapping.originalColumn = original.column; + if (original.name != null) { + mapping.name = original.name; + } + } + } + + var source = mapping.source; + if (source != null && !newSources.has(source)) { + newSources.add(source); + } + + var name = mapping.name; + if (name != null && !newNames.has(name)) { + newNames.add(name); + } + + }, this); + this._sources = newSources; + this._names = newNames; -BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); -BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; + // Copy sourcesContents of applied map. + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aSourceMapPath != null) { + sourceFile = util.join(aSourceMapPath, sourceFile); + } + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + this.setSourceContent(sourceFile, content); + } + }, this); + }; /** - * Create a BasicSourceMapConsumer from a SourceMapGenerator. + * A mapping can have one of the three levels of data: * - * @param SourceMapGenerator aSourceMap - * The source map that will be consumed. - * @returns BasicSourceMapConsumer + * 1. Just the generated position. + * 2. The Generated position, original position, and original source. + * 3. Generated and original position, original source, as well as a name + * token. + * + * To maintain consistency, we validate that any new mapping being added falls + * in to one of these categories. */ -BasicSourceMapConsumer.fromSourceMap = - function SourceMapConsumer_fromSourceMap(aSourceMap) { - var smc = Object.create(BasicSourceMapConsumer.prototype); +SourceMapGenerator.prototype._validateMapping = + function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, + aName) { + if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aGenerated.line > 0 && aGenerated.column >= 0 + && !aOriginal && !aSource && !aName) { + // Case 1. + return; + } + else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aOriginal && 'line' in aOriginal && 'column' in aOriginal + && aGenerated.line > 0 && aGenerated.column >= 0 + && aOriginal.line > 0 && aOriginal.column >= 0 + && aSource) { + // Cases 2 and 3. + return; + } + else { + throw new Error('Invalid mapping: ' + JSON.stringify({ + generated: aGenerated, + source: aSource, + original: aOriginal, + name: aName + })); + } + }; - var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); - var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); - smc.sourceRoot = aSourceMap._sourceRoot; - smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), - smc.sourceRoot); - smc.file = aSourceMap._file; +/** + * Serialize the accumulated mappings in to the stream of base 64 VLQs + * specified by the source map format. + */ +SourceMapGenerator.prototype._serializeMappings = + function SourceMapGenerator_serializeMappings() { + var previousGeneratedColumn = 0; + var previousGeneratedLine = 1; + var previousOriginalColumn = 0; + var previousOriginalLine = 0; + var previousName = 0; + var previousSource = 0; + var result = ''; + var next; + var mapping; + var nameIdx; + var sourceIdx; - // Because we are modifying the entries (by converting string sources and - // names to indices into the sources and names ArraySets), we have to make - // a copy of the entry or else bad things happen. Shared mutable state - // strikes again! See github issue #191. + var mappings = this._mappings.toArray(); + for (var i = 0, len = mappings.length; i < len; i++) { + mapping = mappings[i]; + next = '' - var generatedMappings = aSourceMap._mappings.toArray().slice(); - var destGeneratedMappings = smc.__generatedMappings = []; - var destOriginalMappings = smc.__originalMappings = []; + if (mapping.generatedLine !== previousGeneratedLine) { + previousGeneratedColumn = 0; + while (mapping.generatedLine !== previousGeneratedLine) { + next += ';'; + previousGeneratedLine++; + } + } + else { + if (i > 0) { + if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { + continue; + } + next += ','; + } + } - for (var i = 0, length = generatedMappings.length; i < length; i++) { - var srcMapping = generatedMappings[i]; - var destMapping = new Mapping; - destMapping.generatedLine = srcMapping.generatedLine; - destMapping.generatedColumn = srcMapping.generatedColumn; + next += base64VLQ.encode(mapping.generatedColumn + - previousGeneratedColumn); + previousGeneratedColumn = mapping.generatedColumn; - if (srcMapping.source) { - destMapping.source = sources.indexOf(srcMapping.source); - destMapping.originalLine = srcMapping.originalLine; - destMapping.originalColumn = srcMapping.originalColumn; + if (mapping.source != null) { + sourceIdx = this._sources.indexOf(mapping.source); + next += base64VLQ.encode(sourceIdx - previousSource); + previousSource = sourceIdx; - if (srcMapping.name) { - destMapping.name = names.indexOf(srcMapping.name); - } + // lines are stored 0-based in SourceMap spec version 3 + next += base64VLQ.encode(mapping.originalLine - 1 + - previousOriginalLine); + previousOriginalLine = mapping.originalLine - 1; - destOriginalMappings.push(destMapping); + next += base64VLQ.encode(mapping.originalColumn + - previousOriginalColumn); + previousOriginalColumn = mapping.originalColumn; + + if (mapping.name != null) { + nameIdx = this._names.indexOf(mapping.name); + next += base64VLQ.encode(nameIdx - previousName); + previousName = nameIdx; + } } - destGeneratedMappings.push(destMapping); + result += next; } - quickSort(smc.__originalMappings, util.compareByOriginalPositions); + return result; + }; - return smc; +SourceMapGenerator.prototype._generateSourcesContent = + function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { + return aSources.map(function (source) { + if (!this._sourcesContents) { + return null; + } + if (aSourceRoot != null) { + source = util.relative(aSourceRoot, source); + } + var key = util.toSetString(source); + return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) + ? this._sourcesContents[key] + : null; + }, this); }; /** - * The version of the source mapping spec that we are consuming. + * Externalize the source map. */ -BasicSourceMapConsumer.prototype._version = 3; +SourceMapGenerator.prototype.toJSON = + function SourceMapGenerator_toJSON() { + var map = { + version: this._version, + sources: this._sources.toArray(), + names: this._names.toArray(), + mappings: this._serializeMappings() + }; + if (this._file != null) { + map.file = this._file; + } + if (this._sourceRoot != null) { + map.sourceRoot = this._sourceRoot; + } + if (this._sourcesContents) { + map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); + } -/** - * The list of original sources. - */ -Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { - get: function () { - return this._sources.toArray().map(function (s) { - return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s; - }, this); - } -}); + return map; + }; /** - * Provide the JIT with a nice shape / hidden class. + * Render the source map being generated to a string. */ -function Mapping() { - this.generatedLine = 0; - this.generatedColumn = 0; - this.source = null; - this.originalLine = null; - this.originalColumn = null; - this.name = null; -} +SourceMapGenerator.prototype.toString = + function SourceMapGenerator_toString() { + return JSON.stringify(this.toJSON()); + }; -/** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ -BasicSourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - var generatedLine = 1; - var previousGeneratedColumn = 0; - var previousOriginalLine = 0; - var previousOriginalColumn = 0; - var previousSource = 0; - var previousName = 0; - var length = aStr.length; - var index = 0; - var cachedSegments = {}; - var temp = {}; - var originalMappings = []; - var generatedMappings = []; - var mapping, str, segment, end, value; +exports.SourceMapGenerator = SourceMapGenerator; - while (index < length) { - if (aStr.charAt(index) === ';') { - generatedLine++; - index++; - previousGeneratedColumn = 0; - } - else if (aStr.charAt(index) === ',') { - index++; - } - else { - mapping = new Mapping(); - mapping.generatedLine = generatedLine; +},{"./array-set":141,"./base64-vlq":142,"./mapping-list":145,"./util":150}],149:[function(require,module,exports){ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ - // Because each offset is encoded relative to the previous one, - // many segments often have the same encoding. We can exploit this - // fact by caching the parsed variable length fields of each segment, - // allowing us to avoid a second parse if we encounter the same - // segment again. - for (end = index; end < length; end++) { - if (this._charIsMappingSeparator(aStr, end)) { - break; - } - } - str = aStr.slice(index, end); +var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator; +var util = require('./util'); - segment = cachedSegments[str]; - if (segment) { - index += str.length; - } else { - segment = []; - while (index < end) { - base64VLQ.decode(aStr, index, temp); - value = temp.value; - index = temp.rest; - segment.push(value); - } +// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other +// operating systems these days (capturing the result). +var REGEX_NEWLINE = /(\r?\n)/; - if (segment.length === 2) { - throw new Error('Found a source, but no line and column'); - } +// Newline character code for charCodeAt() comparisons +var NEWLINE_CODE = 10; - if (segment.length === 3) { - throw new Error('Found a source and line, but no column'); - } +// Private symbol for identifying `SourceNode`s when multiple versions of +// the source-map library are loaded. This MUST NOT CHANGE across +// versions! +var isSourceNode = "$$$isSourceNode$$$"; - cachedSegments[str] = segment; - } +/** + * SourceNodes provide a way to abstract over interpolating/concatenating + * snippets of generated JavaScript source code while maintaining the line and + * column information associated with the original source code. + * + * @param aLine The original line number. + * @param aColumn The original column number. + * @param aSource The original source's filename. + * @param aChunks Optional. An array of strings which are snippets of + * generated JS, or other SourceNodes. + * @param aName The original identifier. + */ +function SourceNode(aLine, aColumn, aSource, aChunks, aName) { + this.children = []; + this.sourceContents = {}; + this.line = aLine == null ? null : aLine; + this.column = aColumn == null ? null : aColumn; + this.source = aSource == null ? null : aSource; + this.name = aName == null ? null : aName; + this[isSourceNode] = true; + if (aChunks != null) this.add(aChunks); +} - // Generated column. - mapping.generatedColumn = previousGeneratedColumn + segment[0]; - previousGeneratedColumn = mapping.generatedColumn; +/** + * Creates a SourceNode from generated code and a SourceMapConsumer. + * + * @param aGeneratedCode The generated code + * @param aSourceMapConsumer The SourceMap for the generated code + * @param aRelativePath Optional. The path that relative sources in the + * SourceMapConsumer should be relative to. + */ +SourceNode.fromStringWithSourceMap = + function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { + // The SourceNode we want to fill with the generated code + // and the SourceMap + var node = new SourceNode(); - if (segment.length > 1) { - // Original source. - mapping.source = previousSource + segment[1]; - previousSource += segment[1]; + // All even indices of this array are one line of the generated code, + // while all odd indices are the newlines between two adjacent lines + // (since `REGEX_NEWLINE` captures its match). + // Processed fragments are removed from this array, by calling `shiftNextLine`. + var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); + var shiftNextLine = function() { + var lineContents = remainingLines.shift(); + // The last line of a file might not have a newline. + var newLine = remainingLines.shift() || ""; + return lineContents + newLine; + }; - // Original line. - mapping.originalLine = previousOriginalLine + segment[2]; - previousOriginalLine = mapping.originalLine; - // Lines are stored 0-based - mapping.originalLine += 1; + // We need to remember the position of "remainingLines" + var lastGeneratedLine = 1, lastGeneratedColumn = 0; - // Original column. - mapping.originalColumn = previousOriginalColumn + segment[3]; - previousOriginalColumn = mapping.originalColumn; + // The generate SourceNodes we need a code range. + // To extract it current and last mapping is used. + // Here we store the last mapping. + var lastMapping = null; - if (segment.length > 4) { - // Original name. - mapping.name = previousName + segment[4]; - previousName += segment[4]; - } + aSourceMapConsumer.eachMapping(function (mapping) { + if (lastMapping !== null) { + // We add the code from "lastMapping" to "mapping": + // First check if there is a new line in between. + if (lastGeneratedLine < mapping.generatedLine) { + // Associate first line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + lastGeneratedLine++; + lastGeneratedColumn = 0; + // The remaining code is added without mapping + } else { + // There is no new line in between. + // Associate the code between "lastGeneratedColumn" and + // "mapping.generatedColumn" with "lastMapping" + var nextLine = remainingLines[0]; + var code = nextLine.substr(0, mapping.generatedColumn - + lastGeneratedColumn); + remainingLines[0] = nextLine.substr(mapping.generatedColumn - + lastGeneratedColumn); + lastGeneratedColumn = mapping.generatedColumn; + addMappingWithCode(lastMapping, code); + // No more remaining code, continue + lastMapping = mapping; + return; } + } + // We add the generated code until the first mapping + // to the SourceNode without any mapping. + // Each line is added as separate string. + while (lastGeneratedLine < mapping.generatedLine) { + node.add(shiftNextLine()); + lastGeneratedLine++; + } + if (lastGeneratedColumn < mapping.generatedColumn) { + var nextLine = remainingLines[0]; + node.add(nextLine.substr(0, mapping.generatedColumn)); + remainingLines[0] = nextLine.substr(mapping.generatedColumn); + lastGeneratedColumn = mapping.generatedColumn; + } + lastMapping = mapping; + }, this); + // We have processed all mappings. + if (remainingLines.length > 0) { + if (lastMapping) { + // Associate the remaining code in the current line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + } + // and add the remaining lines without any mapping + node.add(remainingLines.join("")); + } - generatedMappings.push(mapping); - if (typeof mapping.originalLine === 'number') { - originalMappings.push(mapping); + // Copy sourcesContent into SourceNode + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aRelativePath != null) { + sourceFile = util.join(aRelativePath, sourceFile); } + node.setSourceContent(sourceFile, content); } - } + }); - quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); - this.__generatedMappings = generatedMappings; + return node; - quickSort(originalMappings, util.compareByOriginalPositions); - this.__originalMappings = originalMappings; + function addMappingWithCode(mapping, code) { + if (mapping === null || mapping.source === undefined) { + node.add(code); + } else { + var source = aRelativePath + ? util.join(aRelativePath, mapping.source) + : mapping.source; + node.add(new SourceNode(mapping.originalLine, + mapping.originalColumn, + source, + code, + mapping.name)); + } + } }; /** - * Find the mapping that best matches the hypothetical "needle" mapping that - * we are searching for in the given "haystack" of mappings. + * Add a chunk of generated JS to this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. */ -BasicSourceMapConsumer.prototype._findMapping = - function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, - aColumnName, aComparator, aBias) { - // To return the position we are searching for, we must first find the - // mapping for the given position and then return the opposite position it - // points to. Because the mappings are sorted, we can use binary search to - // find the best mapping. +SourceNode.prototype.add = function SourceNode_add(aChunk) { + if (Array.isArray(aChunk)) { + aChunk.forEach(function (chunk) { + this.add(chunk); + }, this); + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + if (aChunk) { + this.children.push(aChunk); + } + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; +}; - if (aNeedle[aLineName] <= 0) { - throw new TypeError('Line must be greater than or equal to 1, got ' - + aNeedle[aLineName]); +/** + * Add a chunk of generated JS to the beginning of this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ +SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { + if (Array.isArray(aChunk)) { + for (var i = aChunk.length-1; i >= 0; i--) { + this.prepend(aChunk[i]); } - if (aNeedle[aColumnName] < 0) { - throw new TypeError('Column must be greater than or equal to 0, got ' - + aNeedle[aColumnName]); + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + this.children.unshift(aChunk); + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; +}; + +/** + * Walk over the tree of JS snippets in this node and its children. The + * walking function is called once for each snippet of JS and is passed that + * snippet and the its original associated source's line/column location. + * + * @param aFn The traversal function. + */ +SourceNode.prototype.walk = function SourceNode_walk(aFn) { + var chunk; + for (var i = 0, len = this.children.length; i < len; i++) { + chunk = this.children[i]; + if (chunk[isSourceNode]) { + chunk.walk(aFn); + } + else { + if (chunk !== '') { + aFn(chunk, { source: this.source, + line: this.line, + column: this.column, + name: this.name }); + } } - - return binarySearch.search(aNeedle, aMappings, aComparator, aBias); - }; + } +}; /** - * Compute the last column for each generated mapping. The last column is - * inclusive. + * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between + * each of `this.children`. + * + * @param aSep The separator. */ -BasicSourceMapConsumer.prototype.computeColumnSpans = - function SourceMapConsumer_computeColumnSpans() { - for (var index = 0; index < this._generatedMappings.length; ++index) { - var mapping = this._generatedMappings[index]; - - // Mappings do not contain a field for the last generated columnt. We - // can come up with an optimistic estimate, however, by assuming that - // mappings are contiguous (i.e. given two consecutive mappings, the - // first mapping ends where the second one starts). - if (index + 1 < this._generatedMappings.length) { - var nextMapping = this._generatedMappings[index + 1]; - - if (mapping.generatedLine === nextMapping.generatedLine) { - mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; - continue; - } - } - - // The last mapping for each line spans the entire line. - mapping.lastGeneratedColumn = Infinity; +SourceNode.prototype.join = function SourceNode_join(aSep) { + var newChildren; + var i; + var len = this.children.length; + if (len > 0) { + newChildren = []; + for (i = 0; i < len-1; i++) { + newChildren.push(this.children[i]); + newChildren.push(aSep); } - }; + newChildren.push(this.children[i]); + this.children = newChildren; + } + return this; +}; /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. - * - column: The column number in the generated source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: + * Call String.prototype.replace on the very right-most source snippet. Useful + * for trimming whitespace from the end of a source node, etc. * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. - * - column: The column number in the original source, or null. - * - name: The original identifier, or null. + * @param aPattern The pattern to replace. + * @param aReplacement The thing to replace the pattern with. */ -BasicSourceMapConsumer.prototype.originalPositionFor = - function SourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._generatedMappings, - "generatedLine", - "generatedColumn", - util.compareByGeneratedPositionsDeflated, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); +SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { + var lastChild = this.children[this.children.length - 1]; + if (lastChild[isSourceNode]) { + lastChild.replaceRight(aPattern, aReplacement); + } + else if (typeof lastChild === 'string') { + this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); + } + else { + this.children.push(''.replace(aPattern, aReplacement)); + } + return this; +}; - if (index >= 0) { - var mapping = this._generatedMappings[index]; +/** + * Set the source content for a source file. This will be added to the SourceMapGenerator + * in the sourcesContent field. + * + * @param aSourceFile The filename of the source file + * @param aSourceContent The content of the source file + */ +SourceNode.prototype.setSourceContent = + function SourceNode_setSourceContent(aSourceFile, aSourceContent) { + this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; + }; - if (mapping.generatedLine === needle.generatedLine) { - var source = util.getArg(mapping, 'source', null); - if (source !== null) { - source = this._sources.at(source); - if (this.sourceRoot != null) { - source = util.join(this.sourceRoot, source); - } - } - var name = util.getArg(mapping, 'name', null); - if (name !== null) { - name = this._names.at(name); - } - return { - source: source, - line: util.getArg(mapping, 'originalLine', null), - column: util.getArg(mapping, 'originalColumn', null), - name: name - }; +/** + * Walk over the tree of SourceNodes. The walking function is called for each + * source file content and is passed the filename and source content. + * + * @param aFn The traversal function. + */ +SourceNode.prototype.walkSourceContents = + function SourceNode_walkSourceContents(aFn) { + for (var i = 0, len = this.children.length; i < len; i++) { + if (this.children[i][isSourceNode]) { + this.children[i].walkSourceContents(aFn); } } - return { - source: null, - line: null, - column: null, - name: null - }; + var sources = Object.keys(this.sourceContents); + for (var i = 0, len = sources.length; i < len; i++) { + aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); + } }; /** - * Return true if we have the source content for every source in the source - * map, false otherwise. + * Return the string representation of this source node. Walks over the tree + * and concatenates all the various snippets together to one string. */ -BasicSourceMapConsumer.prototype.hasContentsOfAllSources = - function BasicSourceMapConsumer_hasContentsOfAllSources() { - if (!this.sourcesContent) { - return false; - } - return this.sourcesContent.length >= this._sources.size() && - !this.sourcesContent.some(function (sc) { return sc == null; }); - }; +SourceNode.prototype.toString = function SourceNode_toString() { + var str = ""; + this.walk(function (chunk) { + str += chunk; + }); + return str; +}; /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. + * Returns the string representation of this source node along with a source + * map. */ -BasicSourceMapConsumer.prototype.sourceContentFor = - function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - if (!this.sourcesContent) { - return null; +SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { + var generated = { + code: "", + line: 1, + column: 0 + }; + var map = new SourceMapGenerator(aArgs); + var sourceMappingActive = false; + var lastOriginalSource = null; + var lastOriginalLine = null; + var lastOriginalColumn = null; + var lastOriginalName = null; + this.walk(function (chunk, original) { + generated.code += chunk; + if (original.source !== null + && original.line !== null + && original.column !== null) { + if(lastOriginalSource !== original.source + || lastOriginalLine !== original.line + || lastOriginalColumn !== original.column + || lastOriginalName !== original.name) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + lastOriginalSource = original.source; + lastOriginalLine = original.line; + lastOriginalColumn = original.column; + lastOriginalName = original.name; + sourceMappingActive = true; + } else if (sourceMappingActive) { + map.addMapping({ + generated: { + line: generated.line, + column: generated.column + } + }); + lastOriginalSource = null; + sourceMappingActive = false; } - - if (this.sourceRoot != null) { - aSource = util.relative(this.sourceRoot, aSource); + for (var idx = 0, length = chunk.length; idx < length; idx++) { + if (chunk.charCodeAt(idx) === NEWLINE_CODE) { + generated.line++; + generated.column = 0; + // Mappings end at eol + if (idx + 1 === length) { + lastOriginalSource = null; + sourceMappingActive = false; + } else if (sourceMappingActive) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + } else { + generated.column++; + } } + }); + this.walkSourceContents(function (sourceFile, sourceContent) { + map.setSourceContent(sourceFile, sourceContent); + }); - if (this._sources.has(aSource)) { - return this.sourcesContent[this._sources.indexOf(aSource)]; - } + return { code: generated.code, map: map }; +}; - var url; - if (this.sourceRoot != null - && (url = util.urlParse(this.sourceRoot))) { - // XXX: file:// URIs and absolute paths lead to unexpected behavior for - // many users. We can help them out when they expect file:// URIs to - // behave like it would if they were running a local HTTP server. See - // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. - var fileUriAbsPath = aSource.replace(/^file:\/\//, ""); - if (url.scheme == "file" - && this._sources.has(fileUriAbsPath)) { - return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] - } +exports.SourceNode = SourceNode; - if ((!url.path || url.path == "/") - && this._sources.has("/" + aSource)) { - return this.sourcesContent[this._sources.indexOf("/" + aSource)]; - } - } +},{"./source-map-generator":148,"./util":150}],150:[function(require,module,exports){ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ - // This function is used recursively from - // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we - // don't want to throw if we can't find the source - we just want to - // return null, so we provide a flag to exit gracefully. - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } +/** + * This is a helper function for getting values from parameter/options + * objects. + * + * @param args The object we are extracting values from + * @param name The name of the property we are getting. + * @param defaultValue An optional value to return if the property is missing + * from the object. If this is not specified and the property is missing, an + * error will be thrown. + */ +function getArg(aArgs, aName, aDefaultValue) { + if (aName in aArgs) { + return aArgs[aName]; + } else if (arguments.length === 3) { + return aDefaultValue; + } else { + throw new Error('"' + aName + '" is a required argument.'); + } +} +exports.getArg = getArg; + +var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/; +var dataUrlRegexp = /^data:.+\,.+$/; + +function urlParse(aUrl) { + var match = aUrl.match(urlRegexp); + if (!match) { + return null; + } + return { + scheme: match[1], + auth: match[2], + host: match[3], + port: match[4], + path: match[5] }; +} +exports.urlParse = urlParse; + +function urlGenerate(aParsedUrl) { + var url = ''; + if (aParsedUrl.scheme) { + url += aParsedUrl.scheme + ':'; + } + url += '//'; + if (aParsedUrl.auth) { + url += aParsedUrl.auth + '@'; + } + if (aParsedUrl.host) { + url += aParsedUrl.host; + } + if (aParsedUrl.port) { + url += ":" + aParsedUrl.port + } + if (aParsedUrl.path) { + url += aParsedUrl.path; + } + return url; +} +exports.urlGenerate = urlGenerate; /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: + * Normalizes a path, or the path portion of a URL: * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: The column number in the original source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * - Replaces consecutive slashes with one slash. + * - Removes unnecessary '.' parts. + * - Removes unnecessary '/..' parts. * - * and an object is returned with the following properties: + * Based on code in the Node.js 'path' core module. * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. + * @param aPath The path or url to normalize. */ -BasicSourceMapConsumer.prototype.generatedPositionFor = - function SourceMapConsumer_generatedPositionFor(aArgs) { - var source = util.getArg(aArgs, 'source'); - if (this.sourceRoot != null) { - source = util.relative(this.sourceRoot, source); - } - if (!this._sources.has(source)) { - return { - line: null, - column: null, - lastColumn: null - }; +function normalize(aPath) { + var path = aPath; + var url = urlParse(aPath); + if (url) { + if (!url.path) { + return aPath; } - source = this._sources.indexOf(source); - - var needle = { - source: source, - originalLine: util.getArg(aArgs, 'line'), - originalColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._originalMappings[index]; + path = url.path; + } + var isAbsolute = exports.isAbsolute(path); - if (mapping.source === needle.source) { - return { - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }; + var parts = path.split(/\/+/); + for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { + part = parts[i]; + if (part === '.') { + parts.splice(i, 1); + } else if (part === '..') { + up++; + } else if (up > 0) { + if (part === '') { + // The first part is blank if the path is absolute. Trying to go + // above the root is a no-op. Therefore we can remove all '..' parts + // directly after the root. + parts.splice(i + 1, up); + up = 0; + } else { + parts.splice(i, 2); + up--; } } + } + path = parts.join('/'); - return { - line: null, - column: null, - lastColumn: null - }; - }; + if (path === '') { + path = isAbsolute ? '/' : '.'; + } -exports.BasicSourceMapConsumer = BasicSourceMapConsumer; + if (url) { + url.path = path; + return urlGenerate(url); + } + return path; +} +exports.normalize = normalize; /** - * An IndexedSourceMapConsumer instance represents a parsed source map which - * we can query for information. It differs from BasicSourceMapConsumer in - * that it takes "indexed" source maps (i.e. ones with a "sections" field) as - * input. - * - * The only parameter is a raw source map (either as a JSON string, or already - * parsed to an object). According to the spec for indexed source maps, they - * have the following attributes: - * - * - version: Which version of the source map spec this map is following. - * - file: Optional. The generated file this source map is associated with. - * - sections: A list of section definitions. - * - * Each value under the "sections" field has two fields: - * - offset: The offset into the original specified at which this section - * begins to apply, defined as an object with a "line" and "column" - * field. - * - map: A source map definition. This source map could also be indexed, - * but doesn't have to be. - * - * Instead of the "map" field, it's also possible to have a "url" field - * specifying a URL to retrieve a source map from, but that's currently - * unsupported. - * - * Here's an example source map, taken from the source map spec[0], but - * modified to omit a section which uses the "url" field. + * Joins two paths/URLs. * - * { - * version : 3, - * file: "app.js", - * sections: [{ - * offset: {line:100, column:10}, - * map: { - * version : 3, - * file: "section.js", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AAAA,E;;ABCDE;" - * } - * }], - * } + * @param aRoot The root path or URL. + * @param aPath The path or URL to be joined with the root. * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt + * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a + * scheme-relative URL: Then the scheme of aRoot, if any, is prepended + * first. + * - Otherwise aPath is a path. If aRoot is a URL, then its path portion + * is updated with the result and aRoot is returned. Otherwise the result + * is returned. + * - If aPath is absolute, the result is aPath. + * - Otherwise the two paths are joined with a slash. + * - Joining for example 'http://' and 'www.example.com' is also supported. */ -function IndexedSourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); +function join(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + if (aPath === "") { + aPath = "."; + } + var aPathUrl = urlParse(aPath); + var aRootUrl = urlParse(aRoot); + if (aRootUrl) { + aRoot = aRootUrl.path || '/'; } - var version = util.getArg(sourceMap, 'version'); - var sections = util.getArg(sourceMap, 'sections'); - - if (version != this._version) { - throw new Error('Unsupported version: ' + version); + // `join(foo, '//www.example.org')` + if (aPathUrl && !aPathUrl.scheme) { + if (aRootUrl) { + aPathUrl.scheme = aRootUrl.scheme; + } + return urlGenerate(aPathUrl); } - this._sources = new ArraySet(); - this._names = new ArraySet(); + if (aPathUrl || aPath.match(dataUrlRegexp)) { + return aPath; + } - var lastOffset = { - line: -1, - column: 0 - }; - this._sections = sections.map(function (s) { - if (s.url) { - // The url field will require support for asynchronicity. - // See https://github.com/mozilla/source-map/issues/16 - throw new Error('Support for url field in sections not implemented.'); - } - var offset = util.getArg(s, 'offset'); - var offsetLine = util.getArg(offset, 'line'); - var offsetColumn = util.getArg(offset, 'column'); + // `join('http://', 'www.example.com')` + if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { + aRootUrl.host = aPath; + return urlGenerate(aRootUrl); + } - if (offsetLine < lastOffset.line || - (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { - throw new Error('Section offsets must be ordered and non-overlapping.'); - } - lastOffset = offset; + var joined = aPath.charAt(0) === '/' + ? aPath + : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); - return { - generatedOffset: { - // The offset fields are 0-based, but we use 1-based indices when - // encoding/decoding from VLQ. - generatedLine: offsetLine + 1, - generatedColumn: offsetColumn + 1 - }, - consumer: new SourceMapConsumer(util.getArg(s, 'map')) - } - }); + if (aRootUrl) { + aRootUrl.path = joined; + return urlGenerate(aRootUrl); + } + return joined; } +exports.join = join; -IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); -IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; +exports.isAbsolute = function (aPath) { + return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp); +}; /** - * The version of the source mapping spec that we are consuming. + * Make a path relative to a URL or another path. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be made relative to aRoot. */ -IndexedSourceMapConsumer.prototype._version = 3; +function relative(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } -/** - * The list of original sources. - */ -Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { - get: function () { - var sources = []; - for (var i = 0; i < this._sections.length; i++) { - for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { - sources.push(this._sections[i].consumer.sources[j]); - } + aRoot = aRoot.replace(/\/$/, ''); + + // It is possible for the path to be above the root. In this case, simply + // checking whether the root is a prefix of the path won't work. Instead, we + // need to remove components from the root one by one, until either we find + // a prefix that fits, or we run out of components to remove. + var level = 0; + while (aPath.indexOf(aRoot + '/') !== 0) { + var index = aRoot.lastIndexOf("/"); + if (index < 0) { + return aPath; } - return sources; + + // If the only part of the root that is left is the scheme (i.e. http://, + // file:///, etc.), one or more slashes (/), or simply nothing at all, we + // have exhausted all components, so the path is not relative to the root. + aRoot = aRoot.slice(0, index); + if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { + return aPath; + } + + ++level; } -}); + + // Make sure we add a "../" for each component we removed from the root. + return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); +} +exports.relative = relative; + +var supportsNullProto = (function () { + var obj = Object.create(null); + return !('__proto__' in obj); +}()); + +function identity (s) { + return s; +} /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. - * - column: The column number in the generated source. + * Because behavior goes wacky when you set `__proto__` on objects, we + * have to prefix all the strings in our set with an arbitrary character. * - * and an object is returned with the following properties: + * See https://github.com/mozilla/source-map/pull/31 and + * https://github.com/mozilla/source-map/issues/30 * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. - * - column: The column number in the original source, or null. - * - name: The original identifier, or null. + * @param String aStr */ -IndexedSourceMapConsumer.prototype.originalPositionFor = - function IndexedSourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; +function toSetString(aStr) { + if (isProtoString(aStr)) { + return '$' + aStr; + } - // Find the section containing the generated position we're trying to map - // to an original position. - var sectionIndex = binarySearch.search(needle, this._sections, - function(needle, section) { - var cmp = needle.generatedLine - section.generatedOffset.generatedLine; - if (cmp) { - return cmp; - } + return aStr; +} +exports.toSetString = supportsNullProto ? identity : toSetString; - return (needle.generatedColumn - - section.generatedOffset.generatedColumn); - }); - var section = this._sections[sectionIndex]; +function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } - if (!section) { - return { - source: null, - line: null, - column: null, - name: null - }; - } + return aStr; +} +exports.fromSetString = supportsNullProto ? identity : fromSetString; - return section.consumer.originalPositionFor({ - line: needle.generatedLine - - (section.generatedOffset.generatedLine - 1), - column: needle.generatedColumn - - (section.generatedOffset.generatedLine === needle.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - bias: aArgs.bias - }); - }; +function isProtoString(s) { + if (!s) { + return false; + } -/** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ -IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = - function IndexedSourceMapConsumer_hasContentsOfAllSources() { - return this._sections.every(function (s) { - return s.consumer.hasContentsOfAllSources(); - }); - }; + var length = s.length; -/** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ -IndexedSourceMapConsumer.prototype.sourceContentFor = - function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; + if (length < 9 /* "__proto__".length */) { + return false; + } - var content = section.consumer.sourceContentFor(aSource, true); - if (content) { - return content; - } - } - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || + s.charCodeAt(length - 2) !== 95 /* '_' */ || + s.charCodeAt(length - 3) !== 111 /* 'o' */ || + s.charCodeAt(length - 4) !== 116 /* 't' */ || + s.charCodeAt(length - 5) !== 111 /* 'o' */ || + s.charCodeAt(length - 6) !== 114 /* 'r' */ || + s.charCodeAt(length - 7) !== 112 /* 'p' */ || + s.charCodeAt(length - 8) !== 95 /* '_' */ || + s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + + for (var i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; } - }; + } + + return true; +} /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: The column number in the original source. - * - * and an object is returned with the following properties: + * Comparator between two mappings where the original positions are compared. * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same original source/line/column, but different generated + * line and column the same. Useful when searching for a mapping with a + * stubbed out mapping. */ -IndexedSourceMapConsumer.prototype.generatedPositionFor = - function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; +function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { + var cmp = mappingA.source - mappingB.source; + if (cmp !== 0) { + return cmp; + } - // Only consider this section if the requested source is in the list of - // sources of the consumer. - if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) { - continue; - } - var generatedPosition = section.consumer.generatedPositionFor(aArgs); - if (generatedPosition) { - var ret = { - line: generatedPosition.line + - (section.generatedOffset.generatedLine - 1), - column: generatedPosition.column + - (section.generatedOffset.generatedLine === generatedPosition.line - ? section.generatedOffset.generatedColumn - 1 - : 0) - }; - return ret; - } - } + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } - return { - line: null, - column: null - }; - }; + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0 || onlyCompareOriginal) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + return mappingA.name - mappingB.name; +} +exports.compareByOriginalPositions = compareByOriginalPositions; /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). + * Comparator between two mappings with deflated source and name indices where + * the generated positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same generated line and column, but different + * source/name/original line and column the same. Useful when searching for a + * mapping with a stubbed out mapping. */ -IndexedSourceMapConsumer.prototype._parseMappings = - function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { - this.__generatedMappings = []; - this.__originalMappings = []; - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - var sectionMappings = section.consumer._generatedMappings; - for (var j = 0; j < sectionMappings.length; j++) { - var mapping = sectionMappings[j]; +function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } - var source = section.consumer._sources.at(mapping.source); - if (section.consumer.sourceRoot !== null) { - source = util.join(section.consumer.sourceRoot, source); - } - this._sources.add(source); - source = this._sources.indexOf(source); + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0 || onlyCompareGenerated) { + return cmp; + } - var name = section.consumer._names.at(mapping.name); - this._names.add(name); - name = this._names.indexOf(name); + cmp = mappingA.source - mappingB.source; + if (cmp !== 0) { + return cmp; + } - // The mappings coming from the consumer for the section have - // generated positions relative to the start of the section, so we - // need to offset them to be relative to the start of the concatenated - // generated file. - var adjustedMapping = { - source: source, - generatedLine: mapping.generatedLine + - (section.generatedOffset.generatedLine - 1), - generatedColumn: mapping.generatedColumn + - (section.generatedOffset.generatedLine === mapping.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: name - }; + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } - this.__generatedMappings.push(adjustedMapping); - if (typeof adjustedMapping.originalLine === 'number') { - this.__originalMappings.push(adjustedMapping); - } - } - } + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } - quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); - quickSort(this.__originalMappings, util.compareByOriginalPositions); - }; + return mappingA.name - mappingB.name; +} +exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; -exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; +function strcmp(aStr1, aStr2) { + if (aStr1 === aStr2) { + return 0; + } -},{"./array-set":127,"./base64-vlq":128,"./binary-search":130,"./quick-sort":132,"./util":136}],134:[function(require,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ + if (aStr1 > aStr2) { + return 1; + } -var base64VLQ = require('./base64-vlq'); -var util = require('./util'); -var ArraySet = require('./array-set').ArraySet; -var MappingList = require('./mapping-list').MappingList; + return -1; +} /** - * An instance of the SourceMapGenerator represents a source map which is - * being built incrementally. You may pass an object with the following - * properties: - * - * - file: The filename of the generated source. - * - sourceRoot: A root for all relative URLs in this source map. + * Comparator between two mappings with inflated source and name strings where + * the generated positions are compared. */ -function SourceMapGenerator(aArgs) { - if (!aArgs) { - aArgs = {}; +function compareByGeneratedPositionsInflated(mappingA, mappingB) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; } - this._file = util.getArg(aArgs, 'file', null); - this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); - this._skipValidation = util.getArg(aArgs, 'skipValidation', false); - this._sources = new ArraySet(); - this._names = new ArraySet(); - this._mappings = new MappingList(); - this._sourcesContents = null; -} - -SourceMapGenerator.prototype._version = 3; -/** - * Creates a new SourceMapGenerator based on a SourceMapConsumer - * - * @param aSourceMapConsumer The SourceMap. - */ -SourceMapGenerator.fromSourceMap = - function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { - var sourceRoot = aSourceMapConsumer.sourceRoot; - var generator = new SourceMapGenerator({ - file: aSourceMapConsumer.file, - sourceRoot: sourceRoot - }); - aSourceMapConsumer.eachMapping(function (mapping) { - var newMapping = { - generated: { - line: mapping.generatedLine, - column: mapping.generatedColumn - } - }; + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } - if (mapping.source != null) { - newMapping.source = mapping.source; - if (sourceRoot != null) { - newMapping.source = util.relative(sourceRoot, newMapping.source); - } + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } - newMapping.original = { - line: mapping.originalLine, - column: mapping.originalColumn - }; + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } - if (mapping.name != null) { - newMapping.name = mapping.name; - } - } + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } - generator.addMapping(newMapping); - }); - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - generator.setSourceContent(sourceFile, content); - } - }); - return generator; - }; + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; -/** - * Add a single mapping from original source line and column to the generated - * source's line and column for this source map being created. The mapping - * object should have the following properties: - * - * - generated: An object with the generated line and column positions. - * - original: An object with the original line and column positions. - * - source: The original source file (relative to the sourceRoot). - * - name: An optional original token name for this mapping. +},{}],151:[function(require,module,exports){ +/* + * Copyright 2009-2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE.txt or: + * http://opensource.org/licenses/BSD-3-Clause */ -SourceMapGenerator.prototype.addMapping = - function SourceMapGenerator_addMapping(aArgs) { - var generated = util.getArg(aArgs, 'generated'); - var original = util.getArg(aArgs, 'original', null); - var source = util.getArg(aArgs, 'source', null); - var name = util.getArg(aArgs, 'name', null); - - if (!this._skipValidation) { - this._validateMapping(generated, original, source, name); - } +exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator; +exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer; +exports.SourceNode = require('./lib/source-node').SourceNode; - if (source != null) { - source = String(source); - if (!this._sources.has(source)) { - this._sources.add(source); - } - } +},{"./lib/source-map-consumer":147,"./lib/source-map-generator":148,"./lib/source-node":149}],152:[function(require,module,exports){ +(function (global){ +var ClientRequest = require('./lib/request') +var extend = require('xtend') +var statusCodes = require('builtin-status-codes') +var url = require('url') - if (name != null) { - name = String(name); - if (!this._names.has(name)) { - this._names.add(name); - } - } +var http = exports - this._mappings.add({ - generatedLine: generated.line, - generatedColumn: generated.column, - originalLine: original != null && original.line, - originalColumn: original != null && original.column, - source: source, - name: name - }); - }; +http.request = function (opts, cb) { + if (typeof opts === 'string') + opts = url.parse(opts) + else + opts = extend(opts) -/** - * Set the source content for a source file. - */ -SourceMapGenerator.prototype.setSourceContent = - function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { - var source = aSourceFile; - if (this._sourceRoot != null) { - source = util.relative(this._sourceRoot, source); - } + // Normally, the page is loaded from http or https, so not specifying a protocol + // will result in a (valid) protocol-relative url. However, this won't work if + // the protocol is something else, like 'file:' + var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : '' - if (aSourceContent != null) { - // Add the source content to the _sourcesContents map. - // Create a new _sourcesContents map if the property is null. - if (!this._sourcesContents) { - this._sourcesContents = Object.create(null); - } - this._sourcesContents[util.toSetString(source)] = aSourceContent; - } else if (this._sourcesContents) { - // Remove the source file from the _sourcesContents map. - // If the _sourcesContents map is empty, set the property to null. - delete this._sourcesContents[util.toSetString(source)]; - if (Object.keys(this._sourcesContents).length === 0) { - this._sourcesContents = null; - } - } - }; + var protocol = opts.protocol || defaultProtocol + var host = opts.hostname || opts.host + var port = opts.port + var path = opts.path || '/' -/** - * Applies the mappings of a sub-source-map for a specific source file to the - * source map being generated. Each mapping to the supplied source file is - * rewritten using the supplied source map. Note: The resolution for the - * resulting mappings is the minimium of this map and the supplied map. - * - * @param aSourceMapConsumer The source map to be applied. - * @param aSourceFile Optional. The filename of the source file. - * If omitted, SourceMapConsumer's file property will be used. - * @param aSourceMapPath Optional. The dirname of the path to the source map - * to be applied. If relative, it is relative to the SourceMapConsumer. - * This parameter is needed when the two source maps aren't in the same - * directory, and the source map to be applied contains relative source - * paths. If so, those relative source paths need to be rewritten - * relative to the SourceMapGenerator. - */ -SourceMapGenerator.prototype.applySourceMap = - function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { - var sourceFile = aSourceFile; - // If aSourceFile is omitted, we will use the file property of the SourceMap - if (aSourceFile == null) { - if (aSourceMapConsumer.file == null) { - throw new Error( - 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + - 'or the source map\'s "file" property. Both were omitted.' - ); - } - sourceFile = aSourceMapConsumer.file; - } - var sourceRoot = this._sourceRoot; - // Make "sourceFile" relative if an absolute Url is passed. - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - // Applying the SourceMap can add and remove items from the sources and - // the names array. - var newSources = new ArraySet(); - var newNames = new ArraySet(); + // Necessary for IPv6 addresses + if (host && host.indexOf(':') !== -1) + host = '[' + host + ']' - // Find mappings for the "sourceFile" - this._mappings.unsortedForEach(function (mapping) { - if (mapping.source === sourceFile && mapping.originalLine != null) { - // Check if it can be mapped by the source map, then update the mapping. - var original = aSourceMapConsumer.originalPositionFor({ - line: mapping.originalLine, - column: mapping.originalColumn - }); - if (original.source != null) { - // Copy mapping - mapping.source = original.source; - if (aSourceMapPath != null) { - mapping.source = util.join(aSourceMapPath, mapping.source) - } - if (sourceRoot != null) { - mapping.source = util.relative(sourceRoot, mapping.source); - } - mapping.originalLine = original.line; - mapping.originalColumn = original.column; - if (original.name != null) { - mapping.name = original.name; - } - } - } + // This may be a relative url. The browser should always be able to interpret it correctly. + opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path + opts.method = (opts.method || 'GET').toUpperCase() + opts.headers = opts.headers || {} - var source = mapping.source; - if (source != null && !newSources.has(source)) { - newSources.add(source); - } + // Also valid opts.auth, opts.mode - var name = mapping.name; - if (name != null && !newNames.has(name)) { - newNames.add(name); - } + var req = new ClientRequest(opts) + if (cb) + req.on('response', cb) + return req +} - }, this); - this._sources = newSources; - this._names = newNames; +http.get = function get (opts, cb) { + var req = http.request(opts, cb) + req.end() + return req +} - // Copy sourcesContents of applied map. - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aSourceMapPath != null) { - sourceFile = util.join(aSourceMapPath, sourceFile); - } - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - this.setSourceContent(sourceFile, content); - } - }, this); - }; +http.Agent = function () {} +http.Agent.defaultMaxSockets = 4 -/** - * A mapping can have one of the three levels of data: - * - * 1. Just the generated position. - * 2. The Generated position, original position, and original source. - * 3. Generated and original position, original source, as well as a name - * token. - * - * To maintain consistency, we validate that any new mapping being added falls - * in to one of these categories. - */ -SourceMapGenerator.prototype._validateMapping = - function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, - aName) { - if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aGenerated.line > 0 && aGenerated.column >= 0 - && !aOriginal && !aSource && !aName) { - // Case 1. - return; - } - else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aOriginal && 'line' in aOriginal && 'column' in aOriginal - && aGenerated.line > 0 && aGenerated.column >= 0 - && aOriginal.line > 0 && aOriginal.column >= 0 - && aSource) { - // Cases 2 and 3. - return; - } - else { - throw new Error('Invalid mapping: ' + JSON.stringify({ - generated: aGenerated, - source: aSource, - original: aOriginal, - name: aName - })); - } - }; +http.STATUS_CODES = statusCodes -/** - * Serialize the accumulated mappings in to the stream of base 64 VLQs - * specified by the source map format. - */ -SourceMapGenerator.prototype._serializeMappings = - function SourceMapGenerator_serializeMappings() { - var previousGeneratedColumn = 0; - var previousGeneratedLine = 1; - var previousOriginalColumn = 0; - var previousOriginalLine = 0; - var previousName = 0; - var previousSource = 0; - var result = ''; - var next; - var mapping; - var nameIdx; - var sourceIdx; +http.METHODS = [ + 'CHECKOUT', + 'CONNECT', + 'COPY', + 'DELETE', + 'GET', + 'HEAD', + 'LOCK', + 'M-SEARCH', + 'MERGE', + 'MKACTIVITY', + 'MKCOL', + 'MOVE', + 'NOTIFY', + 'OPTIONS', + 'PATCH', + 'POST', + 'PROPFIND', + 'PROPPATCH', + 'PURGE', + 'PUT', + 'REPORT', + 'SEARCH', + 'SUBSCRIBE', + 'TRACE', + 'UNLOCK', + 'UNSUBSCRIBE' +] +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./lib/request":154,"builtin-status-codes":6,"url":159,"xtend":166}],153:[function(require,module,exports){ +(function (global){ +exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream) - var mappings = this._mappings.toArray(); - for (var i = 0, len = mappings.length; i < len; i++) { - mapping = mappings[i]; - next = '' +exports.blobConstructor = false +try { + new Blob([new ArrayBuffer(1)]) + exports.blobConstructor = true +} catch (e) {} - if (mapping.generatedLine !== previousGeneratedLine) { - previousGeneratedColumn = 0; - while (mapping.generatedLine !== previousGeneratedLine) { - next += ';'; - previousGeneratedLine++; - } - } - else { - if (i > 0) { - if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { - continue; - } - next += ','; - } - } +// The xhr request to example.com may violate some restrictive CSP configurations, +// so if we're running in a browser that supports `fetch`, avoid calling getXHR() +// and assume support for certain features below. +var xhr +function getXHR () { + // Cache the xhr value + if (xhr !== undefined) return xhr + + if (global.XMLHttpRequest) { + xhr = new global.XMLHttpRequest() + // If XDomainRequest is available (ie only, where xhr might not work + // cross domain), use the page location. Otherwise use example.com + // Note: this doesn't actually make an http request. + try { + xhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com') + } catch(e) { + xhr = null + } + } else { + // Service workers don't have XHR + xhr = null + } + return xhr +} - next += base64VLQ.encode(mapping.generatedColumn - - previousGeneratedColumn); - previousGeneratedColumn = mapping.generatedColumn; +function checkTypeSupport (type) { + var xhr = getXHR() + if (!xhr) return false + try { + xhr.responseType = type + return xhr.responseType === type + } catch (e) {} + return false +} - if (mapping.source != null) { - sourceIdx = this._sources.indexOf(mapping.source); - next += base64VLQ.encode(sourceIdx - previousSource); - previousSource = sourceIdx; +// For some strange reason, Safari 7.0 reports typeof global.ArrayBuffer === 'object'. +// Safari 7.1 appears to have fixed this bug. +var haveArrayBuffer = typeof global.ArrayBuffer !== 'undefined' +var haveSlice = haveArrayBuffer && isFunction(global.ArrayBuffer.prototype.slice) - // lines are stored 0-based in SourceMap spec version 3 - next += base64VLQ.encode(mapping.originalLine - 1 - - previousOriginalLine); - previousOriginalLine = mapping.originalLine - 1; +// If fetch is supported, then arraybuffer will be supported too. Skip calling +// checkTypeSupport(), since that calls getXHR(). +exports.arraybuffer = exports.fetch || (haveArrayBuffer && checkTypeSupport('arraybuffer')) - next += base64VLQ.encode(mapping.originalColumn - - previousOriginalColumn); - previousOriginalColumn = mapping.originalColumn; +// These next two tests unavoidably show warnings in Chrome. Since fetch will always +// be used if it's available, just return false for these to avoid the warnings. +exports.msstream = !exports.fetch && haveSlice && checkTypeSupport('ms-stream') +exports.mozchunkedarraybuffer = !exports.fetch && haveArrayBuffer && + checkTypeSupport('moz-chunked-arraybuffer') - if (mapping.name != null) { - nameIdx = this._names.indexOf(mapping.name); - next += base64VLQ.encode(nameIdx - previousName); - previousName = nameIdx; - } - } +// If fetch is supported, then overrideMimeType will be supported too. Skip calling +// getXHR(). +exports.overrideMimeType = exports.fetch || (getXHR() ? isFunction(getXHR().overrideMimeType) : false) - result += next; - } +exports.vbArray = isFunction(global.VBArray) - return result; - }; +function isFunction (value) { + return typeof value === 'function' +} -SourceMapGenerator.prototype._generateSourcesContent = - function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { - return aSources.map(function (source) { - if (!this._sourcesContents) { - return null; - } - if (aSourceRoot != null) { - source = util.relative(aSourceRoot, source); - } - var key = util.toSetString(source); - return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) - ? this._sourcesContents[key] - : null; - }, this); - }; +xhr = null // Help gc -/** - * Externalize the source map. - */ -SourceMapGenerator.prototype.toJSON = - function SourceMapGenerator_toJSON() { - var map = { - version: this._version, - sources: this._sources.toArray(), - names: this._names.toArray(), - mappings: this._serializeMappings() - }; - if (this._file != null) { - map.file = this._file; - } - if (this._sourceRoot != null) { - map.sourceRoot = this._sourceRoot; - } - if (this._sourcesContents) { - map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); - } +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],154:[function(require,module,exports){ +(function (process,global,Buffer){ +var capability = require('./capability') +var inherits = require('inherits') +var response = require('./response') +var stream = require('readable-stream') +var toArrayBuffer = require('to-arraybuffer') - return map; - }; +var IncomingMessage = response.IncomingMessage +var rStates = response.readyStates -/** - * Render the source map being generated to a string. - */ -SourceMapGenerator.prototype.toString = - function SourceMapGenerator_toString() { - return JSON.stringify(this.toJSON()); - }; +function decideMode (preferBinary, useFetch) { + if (capability.fetch && useFetch) { + return 'fetch' + } else if (capability.mozchunkedarraybuffer) { + return 'moz-chunked-arraybuffer' + } else if (capability.msstream) { + return 'ms-stream' + } else if (capability.arraybuffer && preferBinary) { + return 'arraybuffer' + } else if (capability.vbArray && preferBinary) { + return 'text:vbarray' + } else { + return 'text' + } +} -exports.SourceMapGenerator = SourceMapGenerator; +var ClientRequest = module.exports = function (opts) { + var self = this + stream.Writable.call(self) -},{"./array-set":127,"./base64-vlq":128,"./mapping-list":131,"./util":136}],135:[function(require,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ + self._opts = opts + self._body = [] + self._headers = {} + if (opts.auth) + self.setHeader('Authorization', 'Basic ' + new Buffer(opts.auth).toString('base64')) + Object.keys(opts.headers).forEach(function (name) { + self.setHeader(name, opts.headers[name]) + }) -var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator; -var util = require('./util'); + var preferBinary + var useFetch = true + if (opts.mode === 'disable-fetch' || 'timeout' in opts) { + // If the use of XHR should be preferred and includes preserving the 'content-type' header. + // Force XHR to be used since the Fetch API does not yet support timeouts. + useFetch = false + preferBinary = true + } else if (opts.mode === 'prefer-streaming') { + // If streaming is a high priority but binary compatibility and + // the accuracy of the 'content-type' header aren't + preferBinary = false + } else if (opts.mode === 'allow-wrong-content-type') { + // If streaming is more important than preserving the 'content-type' header + preferBinary = !capability.overrideMimeType + } else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') { + // Use binary if text streaming may corrupt data or the content-type header, or for speed + preferBinary = true + } else { + throw new Error('Invalid value for opts.mode') + } + self._mode = decideMode(preferBinary, useFetch) -// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other -// operating systems these days (capturing the result). -var REGEX_NEWLINE = /(\r?\n)/; + self.on('finish', function () { + self._onFinish() + }) +} -// Newline character code for charCodeAt() comparisons -var NEWLINE_CODE = 10; +inherits(ClientRequest, stream.Writable) -// Private symbol for identifying `SourceNode`s when multiple versions of -// the source-map library are loaded. This MUST NOT CHANGE across -// versions! -var isSourceNode = "$$$isSourceNode$$$"; +ClientRequest.prototype.setHeader = function (name, value) { + var self = this + var lowerName = name.toLowerCase() + // This check is not necessary, but it prevents warnings from browsers about setting unsafe + // headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but + // http-browserify did it, so I will too. + if (unsafeHeaders.indexOf(lowerName) !== -1) + return -/** - * SourceNodes provide a way to abstract over interpolating/concatenating - * snippets of generated JavaScript source code while maintaining the line and - * column information associated with the original source code. - * - * @param aLine The original line number. - * @param aColumn The original column number. - * @param aSource The original source's filename. - * @param aChunks Optional. An array of strings which are snippets of - * generated JS, or other SourceNodes. - * @param aName The original identifier. - */ -function SourceNode(aLine, aColumn, aSource, aChunks, aName) { - this.children = []; - this.sourceContents = {}; - this.line = aLine == null ? null : aLine; - this.column = aColumn == null ? null : aColumn; - this.source = aSource == null ? null : aSource; - this.name = aName == null ? null : aName; - this[isSourceNode] = true; - if (aChunks != null) this.add(aChunks); + self._headers[lowerName] = { + name: name, + value: value + } +} + +ClientRequest.prototype.getHeader = function (name) { + var self = this + return self._headers[name.toLowerCase()].value } -/** - * Creates a SourceNode from generated code and a SourceMapConsumer. - * - * @param aGeneratedCode The generated code - * @param aSourceMapConsumer The SourceMap for the generated code - * @param aRelativePath Optional. The path that relative sources in the - * SourceMapConsumer should be relative to. - */ -SourceNode.fromStringWithSourceMap = - function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { - // The SourceNode we want to fill with the generated code - // and the SourceMap - var node = new SourceNode(); +ClientRequest.prototype.removeHeader = function (name) { + var self = this + delete self._headers[name.toLowerCase()] +} - // All even indices of this array are one line of the generated code, - // while all odd indices are the newlines between two adjacent lines - // (since `REGEX_NEWLINE` captures its match). - // Processed fragments are removed from this array, by calling `shiftNextLine`. - var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); - var shiftNextLine = function() { - var lineContents = remainingLines.shift(); - // The last line of a file might not have a newline. - var newLine = remainingLines.shift() || ""; - return lineContents + newLine; - }; +ClientRequest.prototype._onFinish = function () { + var self = this - // We need to remember the position of "remainingLines" - var lastGeneratedLine = 1, lastGeneratedColumn = 0; + if (self._destroyed) + return + var opts = self._opts - // The generate SourceNodes we need a code range. - // To extract it current and last mapping is used. - // Here we store the last mapping. - var lastMapping = null; + var headersObj = self._headers + var body = null + if (opts.method === 'POST' || opts.method === 'PUT' || opts.method === 'PATCH' || opts.method === 'MERGE') { + if (capability.blobConstructor) { + body = new global.Blob(self._body.map(function (buffer) { + return toArrayBuffer(buffer) + }), { + type: (headersObj['content-type'] || {}).value || '' + }) + } else { + // get utf8 string + body = Buffer.concat(self._body).toString() + } + } - aSourceMapConsumer.eachMapping(function (mapping) { - if (lastMapping !== null) { - // We add the code from "lastMapping" to "mapping": - // First check if there is a new line in between. - if (lastGeneratedLine < mapping.generatedLine) { - // Associate first line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - lastGeneratedLine++; - lastGeneratedColumn = 0; - // The remaining code is added without mapping - } else { - // There is no new line in between. - // Associate the code between "lastGeneratedColumn" and - // "mapping.generatedColumn" with "lastMapping" - var nextLine = remainingLines[0]; - var code = nextLine.substr(0, mapping.generatedColumn - - lastGeneratedColumn); - remainingLines[0] = nextLine.substr(mapping.generatedColumn - - lastGeneratedColumn); - lastGeneratedColumn = mapping.generatedColumn; - addMappingWithCode(lastMapping, code); - // No more remaining code, continue - lastMapping = mapping; - return; - } - } - // We add the generated code until the first mapping - // to the SourceNode without any mapping. - // Each line is added as separate string. - while (lastGeneratedLine < mapping.generatedLine) { - node.add(shiftNextLine()); - lastGeneratedLine++; - } - if (lastGeneratedColumn < mapping.generatedColumn) { - var nextLine = remainingLines[0]; - node.add(nextLine.substr(0, mapping.generatedColumn)); - remainingLines[0] = nextLine.substr(mapping.generatedColumn); - lastGeneratedColumn = mapping.generatedColumn; - } - lastMapping = mapping; - }, this); - // We have processed all mappings. - if (remainingLines.length > 0) { - if (lastMapping) { - // Associate the remaining code in the current line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - } - // and add the remaining lines without any mapping - node.add(remainingLines.join("")); - } + if (self._mode === 'fetch') { + var headers = Object.keys(headersObj).map(function (name) { + return [headersObj[name].name, headersObj[name].value] + }) - // Copy sourcesContent into SourceNode - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aRelativePath != null) { - sourceFile = util.join(aRelativePath, sourceFile); - } - node.setSourceContent(sourceFile, content); - } - }); + global.fetch(self._opts.url, { + method: self._opts.method, + headers: headers, + body: body || undefined, + mode: 'cors', + credentials: opts.withCredentials ? 'include' : 'same-origin' + }).then(function (response) { + self._fetchResponse = response + self._connect() + }, function (reason) { + self.emit('error', reason) + }) + } else { + var xhr = self._xhr = new global.XMLHttpRequest() + try { + xhr.open(self._opts.method, self._opts.url, true) + } catch (err) { + process.nextTick(function () { + self.emit('error', err) + }) + return + } - return node; + // Can't set responseType on really old browsers + if ('responseType' in xhr) + xhr.responseType = self._mode.split(':')[0] - function addMappingWithCode(mapping, code) { - if (mapping === null || mapping.source === undefined) { - node.add(code); - } else { - var source = aRelativePath - ? util.join(aRelativePath, mapping.source) - : mapping.source; - node.add(new SourceNode(mapping.originalLine, - mapping.originalColumn, - source, - code, - mapping.name)); - } - } - }; + if ('withCredentials' in xhr) + xhr.withCredentials = !!opts.withCredentials -/** - * Add a chunk of generated JS to this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ -SourceNode.prototype.add = function SourceNode_add(aChunk) { - if (Array.isArray(aChunk)) { - aChunk.forEach(function (chunk) { - this.add(chunk); - }, this); - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - if (aChunk) { - this.children.push(aChunk); - } - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; -}; + if (self._mode === 'text' && 'overrideMimeType' in xhr) + xhr.overrideMimeType('text/plain; charset=x-user-defined') -/** - * Add a chunk of generated JS to the beginning of this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ -SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { - if (Array.isArray(aChunk)) { - for (var i = aChunk.length-1; i >= 0; i--) { - this.prepend(aChunk[i]); - } - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - this.children.unshift(aChunk); - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; -}; + if ('timeout' in opts) { + xhr.timeout = opts.timeout + xhr.ontimeout = function () { + self.emit('timeout') + } + } -/** - * Walk over the tree of JS snippets in this node and its children. The - * walking function is called once for each snippet of JS and is passed that - * snippet and the its original associated source's line/column location. - * - * @param aFn The traversal function. - */ -SourceNode.prototype.walk = function SourceNode_walk(aFn) { - var chunk; - for (var i = 0, len = this.children.length; i < len; i++) { - chunk = this.children[i]; - if (chunk[isSourceNode]) { - chunk.walk(aFn); - } - else { - if (chunk !== '') { - aFn(chunk, { source: this.source, - line: this.line, - column: this.column, - name: this.name }); - } - } - } -}; + Object.keys(headersObj).forEach(function (name) { + xhr.setRequestHeader(headersObj[name].name, headersObj[name].value) + }) + + self._response = null + xhr.onreadystatechange = function () { + switch (xhr.readyState) { + case rStates.LOADING: + case rStates.DONE: + self._onXHRProgress() + break + } + } + // Necessary for streaming in Firefox, since xhr.response is ONLY defined + // in onprogress, not in onreadystatechange with xhr.readyState = 3 + if (self._mode === 'moz-chunked-arraybuffer') { + xhr.onprogress = function () { + self._onXHRProgress() + } + } -/** - * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between - * each of `this.children`. - * - * @param aSep The separator. - */ -SourceNode.prototype.join = function SourceNode_join(aSep) { - var newChildren; - var i; - var len = this.children.length; - if (len > 0) { - newChildren = []; - for (i = 0; i < len-1; i++) { - newChildren.push(this.children[i]); - newChildren.push(aSep); - } - newChildren.push(this.children[i]); - this.children = newChildren; - } - return this; -}; + xhr.onerror = function () { + if (self._destroyed) + return + self.emit('error', new Error('XHR error')) + } -/** - * Call String.prototype.replace on the very right-most source snippet. Useful - * for trimming whitespace from the end of a source node, etc. - * - * @param aPattern The pattern to replace. - * @param aReplacement The thing to replace the pattern with. - */ -SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { - var lastChild = this.children[this.children.length - 1]; - if (lastChild[isSourceNode]) { - lastChild.replaceRight(aPattern, aReplacement); - } - else if (typeof lastChild === 'string') { - this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); - } - else { - this.children.push(''.replace(aPattern, aReplacement)); - } - return this; -}; + try { + xhr.send(body) + } catch (err) { + process.nextTick(function () { + self.emit('error', err) + }) + return + } + } +} /** - * Set the source content for a source file. This will be added to the SourceMapGenerator - * in the sourcesContent field. - * - * @param aSourceFile The filename of the source file - * @param aSourceContent The content of the source file + * Checks if xhr.status is readable and non-zero, indicating no error. + * Even though the spec says it should be available in readyState 3, + * accessing it throws an exception in IE8 */ -SourceNode.prototype.setSourceContent = - function SourceNode_setSourceContent(aSourceFile, aSourceContent) { - this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; - }; +function statusValid (xhr) { + try { + var status = xhr.status + return (status !== null && status !== 0) + } catch (e) { + return false + } +} -/** - * Walk over the tree of SourceNodes. The walking function is called for each - * source file content and is passed the filename and source content. - * - * @param aFn The traversal function. - */ -SourceNode.prototype.walkSourceContents = - function SourceNode_walkSourceContents(aFn) { - for (var i = 0, len = this.children.length; i < len; i++) { - if (this.children[i][isSourceNode]) { - this.children[i].walkSourceContents(aFn); - } - } +ClientRequest.prototype._onXHRProgress = function () { + var self = this - var sources = Object.keys(this.sourceContents); - for (var i = 0, len = sources.length; i < len; i++) { - aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); - } - }; + if (!statusValid(self._xhr) || self._destroyed) + return -/** - * Return the string representation of this source node. Walks over the tree - * and concatenates all the various snippets together to one string. - */ -SourceNode.prototype.toString = function SourceNode_toString() { - var str = ""; - this.walk(function (chunk) { - str += chunk; - }); - return str; -}; + if (!self._response) + self._connect() -/** - * Returns the string representation of this source node along with a source - * map. - */ -SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { - var generated = { - code: "", - line: 1, - column: 0 - }; - var map = new SourceMapGenerator(aArgs); - var sourceMappingActive = false; - var lastOriginalSource = null; - var lastOriginalLine = null; - var lastOriginalColumn = null; - var lastOriginalName = null; - this.walk(function (chunk, original) { - generated.code += chunk; - if (original.source !== null - && original.line !== null - && original.column !== null) { - if(lastOriginalSource !== original.source - || lastOriginalLine !== original.line - || lastOriginalColumn !== original.column - || lastOriginalName !== original.name) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - lastOriginalSource = original.source; - lastOriginalLine = original.line; - lastOriginalColumn = original.column; - lastOriginalName = original.name; - sourceMappingActive = true; - } else if (sourceMappingActive) { - map.addMapping({ - generated: { - line: generated.line, - column: generated.column - } - }); - lastOriginalSource = null; - sourceMappingActive = false; - } - for (var idx = 0, length = chunk.length; idx < length; idx++) { - if (chunk.charCodeAt(idx) === NEWLINE_CODE) { - generated.line++; - generated.column = 0; - // Mappings end at eol - if (idx + 1 === length) { - lastOriginalSource = null; - sourceMappingActive = false; - } else if (sourceMappingActive) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - } else { - generated.column++; - } - } - }); - this.walkSourceContents(function (sourceFile, sourceContent) { - map.setSourceContent(sourceFile, sourceContent); - }); + self._response._onXHRProgress() +} - return { code: generated.code, map: map }; -}; +ClientRequest.prototype._connect = function () { + var self = this -exports.SourceNode = SourceNode; + if (self._destroyed) + return -},{"./source-map-generator":134,"./util":136}],136:[function(require,module,exports){ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ + self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode) + self._response.on('error', function(err) { + self.emit('error', err) + }) -/** - * This is a helper function for getting values from parameter/options - * objects. - * - * @param args The object we are extracting values from - * @param name The name of the property we are getting. - * @param defaultValue An optional value to return if the property is missing - * from the object. If this is not specified and the property is missing, an - * error will be thrown. - */ -function getArg(aArgs, aName, aDefaultValue) { - if (aName in aArgs) { - return aArgs[aName]; - } else if (arguments.length === 3) { - return aDefaultValue; - } else { - throw new Error('"' + aName + '" is a required argument.'); - } + self.emit('response', self._response) +} + +ClientRequest.prototype._write = function (chunk, encoding, cb) { + var self = this + + self._body.push(chunk) + cb() +} + +ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () { + var self = this + self._destroyed = true + if (self._response) + self._response._destroyed = true + if (self._xhr) + self._xhr.abort() + // Currently, there isn't a way to truly abort a fetch. + // If you like bikeshedding, see https://github.com/whatwg/fetch/issues/27 +} + +ClientRequest.prototype.end = function (data, encoding, cb) { + var self = this + if (typeof data === 'function') { + cb = data + data = undefined + } + + stream.Writable.prototype.end.call(self, data, encoding, cb) } -exports.getArg = getArg; -var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/; -var dataUrlRegexp = /^data:.+\,.+$/; +ClientRequest.prototype.flushHeaders = function () {} +ClientRequest.prototype.setTimeout = function () {} +ClientRequest.prototype.setNoDelay = function () {} +ClientRequest.prototype.setSocketKeepAlive = function () {} -function urlParse(aUrl) { - var match = aUrl.match(urlRegexp); - if (!match) { - return null; - } - return { - scheme: match[1], - auth: match[2], - host: match[3], - port: match[4], - path: match[5] - }; -} -exports.urlParse = urlParse; +// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method +var unsafeHeaders = [ + 'accept-charset', + 'accept-encoding', + 'access-control-request-headers', + 'access-control-request-method', + 'connection', + 'content-length', + 'cookie', + 'cookie2', + 'date', + 'dnt', + 'expect', + 'host', + 'keep-alive', + 'origin', + 'referer', + 'te', + 'trailer', + 'transfer-encoding', + 'upgrade', + 'user-agent', + 'via' +] -function urlGenerate(aParsedUrl) { - var url = ''; - if (aParsedUrl.scheme) { - url += aParsedUrl.scheme + ':'; - } - url += '//'; - if (aParsedUrl.auth) { - url += aParsedUrl.auth + '@'; - } - if (aParsedUrl.host) { - url += aParsedUrl.host; - } - if (aParsedUrl.port) { - url += ":" + aParsedUrl.port - } - if (aParsedUrl.path) { - url += aParsedUrl.path; - } - return url; +}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) +},{"./capability":153,"./response":155,"_process":112,"buffer":5,"inherits":105,"readable-stream":123,"to-arraybuffer":157}],155:[function(require,module,exports){ +(function (process,global,Buffer){ +var capability = require('./capability') +var inherits = require('inherits') +var stream = require('readable-stream') + +var rStates = exports.readyStates = { + UNSENT: 0, + OPENED: 1, + HEADERS_RECEIVED: 2, + LOADING: 3, + DONE: 4 } -exports.urlGenerate = urlGenerate; -/** - * Normalizes a path, or the path portion of a URL: - * - * - Replaces consecutive slashes with one slash. - * - Removes unnecessary '.' parts. - * - Removes unnecessary '/..' parts. - * - * Based on code in the Node.js 'path' core module. - * - * @param aPath The path or url to normalize. - */ -function normalize(aPath) { - var path = aPath; - var url = urlParse(aPath); - if (url) { - if (!url.path) { - return aPath; - } - path = url.path; - } - var isAbsolute = exports.isAbsolute(path); +var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode) { + var self = this + stream.Readable.call(self) - var parts = path.split(/\/+/); - for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { - part = parts[i]; - if (part === '.') { - parts.splice(i, 1); - } else if (part === '..') { - up++; - } else if (up > 0) { - if (part === '') { - // The first part is blank if the path is absolute. Trying to go - // above the root is a no-op. Therefore we can remove all '..' parts - // directly after the root. - parts.splice(i + 1, up); - up = 0; - } else { - parts.splice(i, 2); - up--; - } - } - } - path = parts.join('/'); + self._mode = mode + self.headers = {} + self.rawHeaders = [] + self.trailers = {} + self.rawTrailers = [] - if (path === '') { - path = isAbsolute ? '/' : '.'; - } + // Fake the 'close' event, but only once 'end' fires + self.on('end', function () { + // The nextTick is necessary to prevent the 'request' module from causing an infinite loop + process.nextTick(function () { + self.emit('close') + }) + }) - if (url) { - url.path = path; - return urlGenerate(url); - } - return path; -} -exports.normalize = normalize; + if (mode === 'fetch') { + self._fetchResponse = response -/** - * Joins two paths/URLs. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be joined with the root. - * - * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a - * scheme-relative URL: Then the scheme of aRoot, if any, is prepended - * first. - * - Otherwise aPath is a path. If aRoot is a URL, then its path portion - * is updated with the result and aRoot is returned. Otherwise the result - * is returned. - * - If aPath is absolute, the result is aPath. - * - Otherwise the two paths are joined with a slash. - * - Joining for example 'http://' and 'www.example.com' is also supported. - */ -function join(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - if (aPath === "") { - aPath = "."; - } - var aPathUrl = urlParse(aPath); - var aRootUrl = urlParse(aRoot); - if (aRootUrl) { - aRoot = aRootUrl.path || '/'; - } + self.url = response.url + self.statusCode = response.status + self.statusMessage = response.statusText + + response.headers.forEach(function(header, key){ + self.headers[key.toLowerCase()] = header + self.rawHeaders.push(key, header) + }) - // `join(foo, '//www.example.org')` - if (aPathUrl && !aPathUrl.scheme) { - if (aRootUrl) { - aPathUrl.scheme = aRootUrl.scheme; - } - return urlGenerate(aPathUrl); - } - if (aPathUrl || aPath.match(dataUrlRegexp)) { - return aPath; - } + // TODO: this doesn't respect backpressure. Once WritableStream is available, this can be fixed + var reader = response.body.getReader() + function read () { + reader.read().then(function (result) { + if (self._destroyed) + return + if (result.done) { + self.push(null) + return + } + self.push(new Buffer(result.value)) + read() + }).catch(function(err) { + self.emit('error', err) + }) + } + read() - // `join('http://', 'www.example.com')` - if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { - aRootUrl.host = aPath; - return urlGenerate(aRootUrl); - } + } else { + self._xhr = xhr + self._pos = 0 - var joined = aPath.charAt(0) === '/' - ? aPath - : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); + self.url = xhr.responseURL + self.statusCode = xhr.status + self.statusMessage = xhr.statusText + var headers = xhr.getAllResponseHeaders().split(/\r?\n/) + headers.forEach(function (header) { + var matches = header.match(/^([^:]+):\s*(.*)/) + if (matches) { + var key = matches[1].toLowerCase() + if (key === 'set-cookie') { + if (self.headers[key] === undefined) { + self.headers[key] = [] + } + self.headers[key].push(matches[2]) + } else if (self.headers[key] !== undefined) { + self.headers[key] += ', ' + matches[2] + } else { + self.headers[key] = matches[2] + } + self.rawHeaders.push(matches[1], matches[2]) + } + }) - if (aRootUrl) { - aRootUrl.path = joined; - return urlGenerate(aRootUrl); - } - return joined; + self._charset = 'x-user-defined' + if (!capability.overrideMimeType) { + var mimeType = self.rawHeaders['mime-type'] + if (mimeType) { + var charsetMatch = mimeType.match(/;\s*charset=([^;])(;|$)/) + if (charsetMatch) { + self._charset = charsetMatch[1].toLowerCase() + } + } + if (!self._charset) + self._charset = 'utf-8' // best guess + } + } } -exports.join = join; -exports.isAbsolute = function (aPath) { - return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp); -}; +inherits(IncomingMessage, stream.Readable) -/** - * Make a path relative to a URL or another path. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be made relative to aRoot. - */ -function relative(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } +IncomingMessage.prototype._read = function () {} - aRoot = aRoot.replace(/\/$/, ''); +IncomingMessage.prototype._onXHRProgress = function () { + var self = this - // It is possible for the path to be above the root. In this case, simply - // checking whether the root is a prefix of the path won't work. Instead, we - // need to remove components from the root one by one, until either we find - // a prefix that fits, or we run out of components to remove. - var level = 0; - while (aPath.indexOf(aRoot + '/') !== 0) { - var index = aRoot.lastIndexOf("/"); - if (index < 0) { - return aPath; - } + var xhr = self._xhr - // If the only part of the root that is left is the scheme (i.e. http://, - // file:///, etc.), one or more slashes (/), or simply nothing at all, we - // have exhausted all components, so the path is not relative to the root. - aRoot = aRoot.slice(0, index); - if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { - return aPath; - } + var response = null + switch (self._mode) { + case 'text:vbarray': // For IE9 + if (xhr.readyState !== rStates.DONE) + break + try { + // This fails in IE8 + response = new global.VBArray(xhr.responseBody).toArray() + } catch (e) {} + if (response !== null) { + self.push(new Buffer(response)) + break + } + // Falls through in IE8 + case 'text': + try { // This will fail when readyState = 3 in IE9. Switch mode and wait for readyState = 4 + response = xhr.responseText + } catch (e) { + self._mode = 'text:vbarray' + break + } + if (response.length > self._pos) { + var newData = response.substr(self._pos) + if (self._charset === 'x-user-defined') { + var buffer = new Buffer(newData.length) + for (var i = 0; i < newData.length; i++) + buffer[i] = newData.charCodeAt(i) & 0xff - ++level; - } + self.push(buffer) + } else { + self.push(newData, self._charset) + } + self._pos = response.length + } + break + case 'arraybuffer': + if (xhr.readyState !== rStates.DONE || !xhr.response) + break + response = xhr.response + self.push(new Buffer(new Uint8Array(response))) + break + case 'moz-chunked-arraybuffer': // take whole + response = xhr.response + if (xhr.readyState !== rStates.LOADING || !response) + break + self.push(new Buffer(new Uint8Array(response))) + break + case 'ms-stream': + response = xhr.response + if (xhr.readyState !== rStates.LOADING) + break + var reader = new global.MSStreamReader() + reader.onprogress = function () { + if (reader.result.byteLength > self._pos) { + self.push(new Buffer(new Uint8Array(reader.result.slice(self._pos)))) + self._pos = reader.result.byteLength + } + } + reader.onload = function () { + self.push(null) + } + // reader.onerror = ??? // TODO: this + reader.readAsArrayBuffer(response) + break + } - // Make sure we add a "../" for each component we removed from the root. - return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); + // The ms-stream case handles end separately in reader.onload() + if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') { + self.push(null) + } } -exports.relative = relative; -var supportsNullProto = (function () { - var obj = Object.create(null); - return !('__proto__' in obj); -}()); +}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) +},{"./capability":153,"_process":112,"buffer":5,"inherits":105,"readable-stream":123}],156:[function(require,module,exports){ +// 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. -function identity (s) { - return s; -} +var Buffer = require('buffer').Buffer; -/** - * Because behavior goes wacky when you set `__proto__` on objects, we - * have to prefix all the strings in our set with an arbitrary character. - * - * See https://github.com/mozilla/source-map/pull/31 and - * https://github.com/mozilla/source-map/issues/30 - * - * @param String aStr - */ -function toSetString(aStr) { - if (isProtoString(aStr)) { - return '$' + aStr; - } +var isBufferEncoding = Buffer.isEncoding + || function(encoding) { + switch (encoding && encoding.toLowerCase()) { + case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true; + default: return false; + } + } - return aStr; -} -exports.toSetString = supportsNullProto ? identity : toSetString; -function fromSetString(aStr) { - if (isProtoString(aStr)) { - return aStr.slice(1); +function assertEncoding(encoding) { + if (encoding && !isBufferEncoding(encoding)) { + throw new Error('Unknown encoding: ' + encoding); } - - return aStr; } -exports.fromSetString = supportsNullProto ? identity : fromSetString; -function isProtoString(s) { - if (!s) { - return false; +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. CESU-8 is handled as part of the UTF-8 encoding. +// +// @TODO Handling all encodings inside a single object makes it very difficult +// to reason about this code, so it should be split up in the future. +// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code +// points as used by CESU-8. +var StringDecoder = exports.StringDecoder = function(encoding) { + this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); + assertEncoding(encoding); + switch (this.encoding) { + case 'utf8': + // CESU-8 represents each of Surrogate Pair by 3-bytes + this.surrogateSize = 3; + break; + case 'ucs2': + case 'utf16le': + // UTF-16 represents each of Surrogate Pair by 2-bytes + this.surrogateSize = 2; + this.detectIncompleteChar = utf16DetectIncompleteChar; + break; + case 'base64': + // Base-64 stores 3 bytes in 4 chars, and pads the remainder. + this.surrogateSize = 3; + this.detectIncompleteChar = base64DetectIncompleteChar; + break; + default: + this.write = passThroughWrite; + return; } - var length = s.length; + // Enough space to store all bytes of a single character. UTF-8 needs 4 + // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate). + this.charBuffer = new Buffer(6); + // Number of bytes received for the current incomplete multi-byte character. + this.charReceived = 0; + // Number of bytes expected for the current incomplete multi-byte character. + this.charLength = 0; +}; - if (length < 9 /* "__proto__".length */) { - return false; - } - if (s.charCodeAt(length - 1) !== 95 /* '_' */ || - s.charCodeAt(length - 2) !== 95 /* '_' */ || - s.charCodeAt(length - 3) !== 111 /* 'o' */ || - s.charCodeAt(length - 4) !== 116 /* 't' */ || - s.charCodeAt(length - 5) !== 111 /* 'o' */ || - s.charCodeAt(length - 6) !== 114 /* 'r' */ || - s.charCodeAt(length - 7) !== 112 /* 'p' */ || - s.charCodeAt(length - 8) !== 95 /* '_' */ || - s.charCodeAt(length - 9) !== 95 /* '_' */) { - return false; - } +// write decodes the given buffer and returns it as JS string that is +// guaranteed to not contain any partial multi-byte characters. Any partial +// character found at the end of the buffer is buffered up, and will be +// returned when calling write again with the remaining bytes. +// +// Note: Converting a Buffer containing an orphan surrogate to a String +// currently works, but converting a String to a Buffer (via `new Buffer`, or +// Buffer#write) will replace incomplete surrogates with the unicode +// replacement character. See https://codereview.chromium.org/121173009/ . +StringDecoder.prototype.write = function(buffer) { + var charStr = ''; + // if our last write ended with an incomplete multibyte character + while (this.charLength) { + // determine how many remaining bytes this buffer has to offer for this char + var available = (buffer.length >= this.charLength - this.charReceived) ? + this.charLength - this.charReceived : + buffer.length; - for (var i = length - 10; i >= 0; i--) { - if (s.charCodeAt(i) !== 36 /* '$' */) { - return false; + // add the new bytes to the char buffer + buffer.copy(this.charBuffer, this.charReceived, 0, available); + this.charReceived += available; + + if (this.charReceived < this.charLength) { + // still not enough chars in this buffer? wait for more ... + return ''; } - } - return true; -} + // remove bytes belonging to the current character from the buffer + buffer = buffer.slice(available, buffer.length); -/** - * Comparator between two mappings where the original positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same original source/line/column, but different generated - * line and column the same. Useful when searching for a mapping with a - * stubbed out mapping. - */ -function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { - var cmp = mappingA.source - mappingB.source; - if (cmp !== 0) { - return cmp; - } + // get the character that was split + charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } + // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character + var charCode = charStr.charCodeAt(charStr.length - 1); + if (charCode >= 0xD800 && charCode <= 0xDBFF) { + this.charLength += this.surrogateSize; + charStr = ''; + continue; + } + this.charReceived = this.charLength = 0; - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0 || onlyCompareOriginal) { - return cmp; + // if there are no more bytes in this buffer, just emit our char + if (buffer.length === 0) { + return charStr; + } + break; } - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } + // determine and set charLength / charReceived + this.detectIncompleteChar(buffer); - cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; + var end = buffer.length; + if (this.charLength) { + // buffer the incomplete character bytes we got + buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end); + end -= this.charReceived; } - return mappingA.name - mappingB.name; -} -exports.compareByOriginalPositions = compareByOriginalPositions; + charStr += buffer.toString(this.encoding, 0, end); -/** - * Comparator between two mappings with deflated source and name indices where - * the generated positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same generated line and column, but different - * source/name/original line and column the same. Useful when searching for a - * mapping with a stubbed out mapping. - */ -function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; + var end = charStr.length - 1; + var charCode = charStr.charCodeAt(end); + // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character + if (charCode >= 0xD800 && charCode <= 0xDBFF) { + var size = this.surrogateSize; + this.charLength += size; + this.charReceived += size; + this.charBuffer.copy(this.charBuffer, size, 0, size); + buffer.copy(this.charBuffer, 0, 0, size); + return charStr.substring(0, end); } - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0 || onlyCompareGenerated) { - return cmp; - } + // or just emit the charStr + return charStr; +}; - cmp = mappingA.source - mappingB.source; - if (cmp !== 0) { - return cmp; - } +// detectIncompleteChar determines if there is an incomplete UTF-8 character at +// the end of the given buffer. If so, it sets this.charLength to the byte +// length that character, and sets this.charReceived to the number of bytes +// that are available for this character. +StringDecoder.prototype.detectIncompleteChar = function(buffer) { + // determine how many bytes we have to check at the end of this buffer + var i = (buffer.length >= 3) ? 3 : buffer.length; - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } + // Figure out if one of the last i bytes of our buffer announces an + // incomplete char. + for (; i > 0; i--) { + var c = buffer[buffer.length - i]; - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } + // See http://en.wikipedia.org/wiki/UTF-8#Description - return mappingA.name - mappingB.name; -} -exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; + // 110XXXXX + if (i == 1 && c >> 5 == 0x06) { + this.charLength = 2; + break; + } -function strcmp(aStr1, aStr2) { - if (aStr1 === aStr2) { - return 0; - } + // 1110XXXX + if (i <= 2 && c >> 4 == 0x0E) { + this.charLength = 3; + break; + } - if (aStr1 > aStr2) { - return 1; + // 11110XXX + if (i <= 3 && c >> 3 == 0x1E) { + this.charLength = 4; + break; + } } + this.charReceived = i; +}; - return -1; -} - -/** - * Comparator between two mappings with inflated source and name strings where - * the generated positions are compared. - */ -function compareByGeneratedPositionsInflated(mappingA, mappingB) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } +StringDecoder.prototype.end = function(buffer) { + var res = ''; + if (buffer && buffer.length) + res = this.write(buffer); - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; + if (this.charReceived) { + var cr = this.charReceived; + var buf = this.charBuffer; + var enc = this.encoding; + res += buf.slice(0, cr).toString(enc); } - cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } + return res; +}; - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } +function passThroughWrite(buffer) { + return buffer.toString(this.encoding); +} - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } +function utf16DetectIncompleteChar(buffer) { + this.charReceived = buffer.length % 2; + this.charLength = this.charReceived ? 2 : 0; +} - return strcmp(mappingA.name, mappingB.name); +function base64DetectIncompleteChar(buffer) { + this.charReceived = buffer.length % 3; + this.charLength = this.charReceived ? 3 : 0; } -exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; -},{}],137:[function(require,module,exports){ -/* - * Copyright 2009-2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE.txt or: - * http://opensource.org/licenses/BSD-3-Clause - */ -exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator; -exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer; -exports.SourceNode = require('./lib/source-node').SourceNode; +},{"buffer":5}],157:[function(require,module,exports){ +var Buffer = require('buffer').Buffer + +module.exports = function (buf) { + // If the buffer is backed by a Uint8Array, a faster version will work + if (buf instanceof Uint8Array) { + // If the buffer isn't a subarray, return the underlying ArrayBuffer + if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) { + return buf.buffer + } else if (typeof buf.buffer.slice === 'function') { + // Otherwise we need to get a proper copy + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength) + } + } + + if (Buffer.isBuffer(buf)) { + // This is the slow version that will work with any Buffer + // implementation (even in old browsers) + var arrayCopy = new Uint8Array(buf.length) + var len = buf.length + for (var i = 0; i < len; i++) { + arrayCopy[i] = buf[i] + } + return arrayCopy.buffer + } else { + throw new Error('Argument must be a Buffer') + } +} -},{"./lib/source-map-consumer":133,"./lib/source-map-generator":134,"./lib/source-node":135}],138:[function(require,module,exports){ +},{"buffer":5}],158:[function(require,module,exports){ (function (Buffer){ var sys = require("util"); var MOZ_SourceMap = require("source-map"); @@ -21825,6 +20717,8 @@ function merge(obj, ext) { }; function noop() {}; +function return_false() { return false; } +function return_true() { return true; } var MAP = (function(){ function MAP(a, f, backwards) { @@ -25539,6 +24433,20 @@ AST_Toplevel.DEFMETHOD("scope_warnings", function(options){ var EXPECT_DIRECTIVE = /^$|[;{][\s\n]*$/; +function is_some_comments(comment) { + var text = comment.value; + var type = comment.type; + if (type == "comment2") { + // multiline comment + return /@preserve|@license|@cc_on/i.test(text); + } + return type == "comment5"; +} + +function is_comment5(comment) { + return comment.type == "comment5"; +} + function OutputStream(options) { options = defaults(options, { @@ -25566,46 +24474,30 @@ function OutputStream(options) { }, true); // Convert comment option to RegExp if neccessary and set up comments filter - if (typeof options.comments === "string" && /^\/.*\/[a-zA-Z]*$/.test(options.comments)) { - var regex_pos = options.comments.lastIndexOf("/"); - options.comments = new RegExp( - options.comments.substr(1, regex_pos - 1), - options.comments.substr(regex_pos + 1) - ); - } - if (options.comments instanceof RegExp) { - options.comments = (function(f) { - return function(comment) { - return comment.type == "comment5" || f.test(comment.value); - } - })(options.comments); - } - else if (typeof options.comments === "function") { - options.comments = (function(f) { - return function(comment) { - return comment.type == "comment5" || f(this, comment); - } - })(options.comments); - } - else if (options.comments === "some") { - options.comments = function(comment) { - var text = comment.value; - var type = comment.type; - if (type == "comment2") { - // multiline comment - return /@preserve|@license|@cc_on/i.test(text); - } - return type == "comment5"; + var comment_filter = options.shebang ? is_comment5 : return_false; // Default case, throw all comments away except shebangs + if (options.comments) { + var comments = options.comments; + if (typeof options.comments === "string" && /^\/.*\/[a-zA-Z]*$/.test(options.comments)) { + var regex_pos = options.comments.lastIndexOf("/"); + comments = new RegExp( + options.comments.substr(1, regex_pos - 1), + options.comments.substr(regex_pos + 1) + ); } - } - else if (options.comments){ // NOTE includes "all" option - options.comments = function() { - return true; + if (comments instanceof RegExp) { + comment_filter = function(comment) { + return comment.type == "comment5" || comments.test(comment.value); + }; } - } else { - // Falsy case, so reject all comments, except shebangs - options.comments = function(comment) { - return comment.type == "comment5"; + else if (typeof comments === "function") { + comment_filter = function(comment) { + return comment.type == "comment5" || comments(this, comment); + }; + } + else if (comments === "some") { + comment_filter = is_some_comments; + } else { // NOTE includes "all" option + comment_filter = return_true; } } @@ -25915,6 +24807,7 @@ function OutputStream(options) { with_square : with_square, add_mapping : add_mapping, option : function(opt) { return options[opt] }, + comment_filter : comment_filter, line : function() { return current_line }, col : function() { return current_col }, pos : function() { return current_pos }, @@ -25997,7 +24890,7 @@ function OutputStream(options) { })); } - comments = comments.filter(output.option("comments"), self); + comments = comments.filter(output.comment_filter, self); // Keep single line comments after nlb, after nlb if (!output.option("beautify") && comments.length > 0 && @@ -27870,7 +26763,7 @@ merge(Compressor.prototype, { (function (def){ var unary_bool = [ "!", "delete" ]; var binary_bool = [ "in", "instanceof", "==", "!=", "===", "!==", "<", "<=", ">=", ">" ]; - def(AST_Node, function(){ return false }); + def(AST_Node, return_false); def(AST_UnaryPrefix, function(){ return member(this.operator, unary_bool); }); @@ -27888,16 +26781,16 @@ merge(Compressor.prototype, { def(AST_Seq, function(){ return this.cdr.is_boolean(); }); - def(AST_True, function(){ return true }); - def(AST_False, function(){ return true }); + def(AST_True, return_true); + def(AST_False, return_true); })(function(node, func){ node.DEFMETHOD("is_boolean", func); }); // methods to determine if an expression has a string result type (function (def){ - def(AST_Node, function(){ return false }); - def(AST_String, function(){ return true }); + def(AST_Node, return_false); + def(AST_String, return_true); def(AST_UnaryPrefix, function(){ return this.operator == "typeof"; }); @@ -28151,11 +27044,11 @@ merge(Compressor.prototype, { // determine if expression has side effects (function(def){ - def(AST_Node, function(compressor){ return true }); + def(AST_Node, return_true); - def(AST_EmptyStatement, function(compressor){ return false }); - def(AST_Constant, function(compressor){ return false }); - def(AST_This, function(compressor){ return false }); + def(AST_EmptyStatement, return_false); + def(AST_Constant, return_false); + def(AST_This, return_false); def(AST_Call, function(compressor){ var pure = compressor.option("pure_funcs"); @@ -28175,13 +27068,13 @@ merge(Compressor.prototype, { def(AST_SimpleStatement, function(compressor){ return this.body.has_side_effects(compressor); }); - def(AST_Defun, function(compressor){ return true }); - def(AST_Function, function(compressor){ return false }); + def(AST_Defun, return_true); + def(AST_Function, return_false); def(AST_Binary, function(compressor){ return this.left.has_side_effects(compressor) || this.right.has_side_effects(compressor); }); - def(AST_Assign, function(compressor){ return true }); + def(AST_Assign, return_true); def(AST_Conditional, function(compressor){ return this.condition.has_side_effects(compressor) || this.consequent.has_side_effects(compressor) @@ -29944,7 +28837,7 @@ function SourceMap(options) { var orig_map = options.orig && new MOZ_SourceMap.SourceMapConsumer(options.orig); if (orig_map && Array.isArray(options.orig.sources)) { - options.orig.sources.forEach(function(source) { + orig_map._sources.toArray().forEach(function(source) { var sourceContent = orig_map.sourceContentFor(source, true); if (sourceContent) { generator.setSourceContent(source, sourceContent); @@ -30658,7 +29551,8 @@ function mangle_properties(ast, options) { cache : null, only_cache : false, regex : null, - ignore_quoted : false + ignore_quoted : false, + debug : false }); var reserved = options.reserved; @@ -30676,6 +29570,15 @@ function mangle_properties(ast, options) { var regex = options.regex; var ignore_quoted = options.ignore_quoted; + // note debug is either false (disabled), or a string of the debug suffix to use (enabled). + // note debug may be enabled as an empty string, which is falsey. Also treat passing 'true' + // the same as passing an empty string. + var debug = (options.debug !== false); + var debug_name_suffix; + if (debug) { + debug_name_suffix = (options.debug === true ? "" : options.debug); + } + var names_to_mangle = []; var unmangleable = []; var ignored = {}; @@ -30769,9 +29672,25 @@ function mangle_properties(ast, options) { var mangled = cache.props.get(name); if (!mangled) { - do { - mangled = base54(++cache.cname); - } while (!can_mangle(mangled)); + if (debug) { + // debug mode: use a prefix and suffix to preserve readability, e.g. o.foo -> o._$foo$NNN_. + var debug_mangled = "_$" + name + "$" + debug_name_suffix + "_"; + + if (can_mangle(debug_mangled) && !(ignore_quoted && debug_mangled in ignored)) { + mangled = debug_mangled; + } + } + + // either debug mode is off, or it is on and we could not use the mangled name + if (!mangled) { + // note can_mangle() does not check if the name collides with the 'ignored' set + // (filled with quoted properties when ignore_quoted set). Make sure we add this + // check so we don't collide with a quoted name. + do { + mangled = base54(++cache.cname); + } while (!can_mangle(mangled) || (ignore_quoted && mangled in ignored)); + } + cache.props.set(name, mangled); } return mangled; @@ -30859,6 +29778,8 @@ exports.DefaultsError = DefaultsError; exports.defaults = defaults; exports.merge = merge; exports.noop = noop; +exports.return_false = return_false; +exports.return_true = return_true; exports.MAP = MAP; exports.push_uniq = push_uniq; exports.string_template = string_template; @@ -31001,6 +29922,8 @@ exports.TreeTransformer = TreeTransformer; exports.SymbolDef = SymbolDef; exports.base54 = base54; exports.EXPECT_DIRECTIVE = EXPECT_DIRECTIVE; +exports.is_some_comments = is_some_comments; +exports.is_comment5 = is_comment5; exports.OutputStream = OutputStream; exports.Compressor = Compressor; exports.SourceMap = SourceMap; @@ -31013,6 +29936,7 @@ exports.minify = function (files, options) { options = UglifyJS.defaults(options, { spidermonkey : false, outSourceMap : null, + outFileName : null, sourceRoot : null, inSourceMap : null, sourceMapUrl : null, @@ -31092,7 +30016,8 @@ exports.minify = function (files, options) { } if (options.outSourceMap || options.sourceMapInline) { output.source_map = UglifyJS.SourceMap({ - file: options.outSourceMap, + // prefer outFileName, otherwise use outSourceMap without .map suffix + file: options.outFileName || (typeof options.outSourceMap === 'string' ? options.outSourceMap.replace(/\.map$/i, '') : null), orig: inMap, root: options.sourceRoot }); @@ -31165,7 +30090,7 @@ exports.describe_ast = function () { return out + ""; }; }).call(this,require("buffer").Buffer) -},{"buffer":6,"source-map":137,"util":144}],139:[function(require,module,exports){ +},{"buffer":5,"source-map":151,"util":164}],159:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -31899,7 +30824,7 @@ Url.prototype.parseHost = function() { if (host) this.hostname = host; }; -},{"./util":140,"punycode":82,"querystring":85}],140:[function(require,module,exports){ +},{"./util":160,"punycode":113,"querystring":116}],160:[function(require,module,exports){ 'use strict'; module.exports = { @@ -31917,7 +30842,7 @@ module.exports = { } }; -},{}],141:[function(require,module,exports){ +},{}],161:[function(require,module,exports){ (function (global){ /** @@ -31988,16 +30913,16 @@ function config (name) { } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],142:[function(require,module,exports){ -arguments[4][74][0].apply(exports,arguments) -},{"dup":74}],143:[function(require,module,exports){ +},{}],162:[function(require,module,exports){ +arguments[4][105][0].apply(exports,arguments) +},{"dup":105}],163:[function(require,module,exports){ module.exports = function isBuffer(arg) { return arg && typeof arg === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function'; } -},{}],144:[function(require,module,exports){ +},{}],164:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -32587,7 +31512,7 @@ function hasOwnProperty(obj, prop) { } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":143,"_process":81,"inherits":142}],145:[function(require,module,exports){ +},{"./support/isBuffer":163,"_process":112,"inherits":162}],165:[function(require,module,exports){ exports.baseChar = /[A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u0131\u0134-\u013E\u0141-\u0148\u014A-\u017E\u0180-\u01C3\u01CD-\u01F0\u01F4\u01F5\u01FA-\u0217\u0250-\u02A8\u02BB-\u02C1\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03CE\u03D0-\u03D6\u03DA\u03DC\u03DE\u03E0\u03E2-\u03F3\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E-\u0481\u0490-\u04C4\u04C7\u04C8\u04CB\u04CC\u04D0-\u04EB\u04EE-\u04F5\u04F8\u04F9\u0531-\u0556\u0559\u0561-\u0586\u05D0-\u05EA\u05F0-\u05F2\u0621-\u063A\u0641-\u064A\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D3\u06D5\u06E5\u06E6\u0905-\u0939\u093D\u0958-\u0961\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8B\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AE0\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B36-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB5\u0BB7-\u0BB9\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CDE\u0CE0\u0CE1\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D60\u0D61\u0E01-\u0E2E\u0E30\u0E32\u0E33\u0E40-\u0E45\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD\u0EAE\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0F40-\u0F47\u0F49-\u0F69\u10A0-\u10C5\u10D0-\u10F6\u1100\u1102\u1103\u1105-\u1107\u1109\u110B\u110C\u110E-\u1112\u113C\u113E\u1140\u114C\u114E\u1150\u1154\u1155\u1159\u115F-\u1161\u1163\u1165\u1167\u1169\u116D\u116E\u1172\u1173\u1175\u119E\u11A8\u11AB\u11AE\u11AF\u11B7\u11B8\u11BA\u11BC-\u11C2\u11EB\u11F0\u11F9\u1E00-\u1E9B\u1EA0-\u1EF9\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2126\u212A\u212B\u212E\u2180-\u2182\u3041-\u3094\u30A1-\u30FA\u3105-\u312C\uAC00-\uD7A3]/; exports.ideographic = /[\u3007\u3021-\u3029\u4E00-\u9FA5]/; @@ -32599,7 +31524,7 @@ exports.combiningChar = /[\u0300-\u0345\u0360\u0361\u0483-\u0486\u0591-\u05A1\u0 exports.digit = /[0-9\u0660-\u0669\u06F0-\u06F9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE7-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29]/; exports.extender = /[\xB7\u02D0\u02D1\u0387\u0640\u0E46\u0EC6\u3005\u3031-\u3035\u309D\u309E\u30FC-\u30FE]/; -},{}],146:[function(require,module,exports){ +},{}],166:[function(require,module,exports){ module.exports = extend var hasOwnProperty = Object.prototype.hasOwnProperty; @@ -32620,7 +31545,7 @@ function extend() { return target } -},{}],147:[function(require,module,exports){ +},{}],167:[function(require,module,exports){ /*! * HTML Parser By John Resig (ejohn.org) * Modified by Juriy "kangax" Zaytsev @@ -33151,7 +32076,7 @@ exports.HTMLtoDOM = function(html, doc) { return doc; }; -},{"./utils":149,"ncname":77}],148:[function(require,module,exports){ +},{"./utils":169,"ncname":108}],168:[function(require,module,exports){ 'use strict'; function Sorter() { @@ -33221,7 +32146,7 @@ TokenChain.prototype = { module.exports = TokenChain; -},{}],149:[function(require,module,exports){ +},{}],169:[function(require,module,exports){ 'use strict'; function createMap(values, ignoreCase) { @@ -33946,17 +32871,12 @@ function processOptions(options) { if (typeof minifyCSS !== 'object') { minifyCSS = {}; } - if (typeof minifyCSS.advanced === 'undefined') { - minifyCSS.advanced = false; - } options.minifyCSS = function(text) { text = text.replace(/(url\s*\(\s*)("|'|)(.*?)\2(\s*\))/ig, function(match, prefix, quote, url, suffix) { return prefix + quote + options.minifyURLs(url) + quote + suffix; }); - var start = text.match(/^\s*\s*$/, '') : text; try { - return new CleanCSS(minifyCSS).minify(style).styles; + return new CleanCSS(minifyCSS).minify(text).styles; } catch (err) { options.log(err); @@ -34554,4 +33474,4 @@ exports.minify = function(value, options) { return minify(value, options); }; -},{"./htmlparser":147,"./tokenchain":148,"./utils":149,"clean-css":8,"he":71,"relateurl":95,"uglify-js":138}]},{},["html-minifier"]); +},{"./htmlparser":167,"./tokenchain":168,"./utils":169,"clean-css":7,"he":102,"relateurl":126,"uglify-js":158}]},{},["html-minifier"]); diff --git a/dist/htmlminifier.min.js b/dist/htmlminifier.min.js index 9a02df3..3b9e1d9 100644 --- a/dist/htmlminifier.min.js +++ b/dist/htmlminifier.min.js @@ -1,20 +1,20 @@ /*! - * HTMLMinifier v3.2.3 (http://kangax.github.io/html-minifier/) - * Copyright 2010-2016 Juriy "kangax" Zaytsev + * HTMLMinifier v3.3.0 (http://kangax.github.io/html-minifier/) + * Copyright 2010-2017 Juriy "kangax" Zaytsev * Licensed under the MIT license */ -require=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&&(a.splice(b-1,2),b-=2)}}function g(a,b){var c;return a&&"."===a.charAt(0)&&b&&(c=b.split("/"),c=c.slice(0,c.length-1),c=c.concat(a.split("/")),f(c),a=c.join("/")),a}function h(a){return function(b){return g(b,a)}}function i(a){function b(b){o[a]=b}return b.fromText=function(a,b){throw new Error("amdefine does not implement load.fromText")},b}function j(a,c,f){var g,h,i,j;if(a)h=o[a]={},i={id:a,uri:d,exports:h},g=l(e,h,i,a);else{if(p)throw new Error("amdefine with no module ID cannot be called more than once per file.");p=!0,h=b.exports,i=b,g=l(e,h,i,b.id)}c&&(c=c.map(function(a){return g(a)})),j="function"==typeof f?f.apply(i.exports,c):f,void 0!==j&&(i.exports=j,a&&(o[a]=i.exports))}function k(a,b,c){Array.isArray(a)?(c=b,b=a,a=void 0):"string"!=typeof a&&(c=a,a=b=void 0),b&&!Array.isArray(b)&&(c=b,b=void 0),b||(b=["require","exports","module"]),a?n[a]=[a,b,c]:j(a,b,c)}var l,m,n={},o={},p=!1,q=a("path");return l=function(a,b,d,e){function f(f,g){return"string"==typeof f?m(a,b,d,f,e):(f=f.map(function(c){return m(a,b,d,c,e)}),void(g&&c.nextTick(function(){g.apply(null,f)})))}return f.toUrl=function(a){return 0===a.indexOf(".")?g(a,q.dirname(d.filename)):a},f},e=e||function(){return b.require.apply(b,arguments)},m=function(a,b,c,d,e){var f,k,p=d.indexOf("!"),q=d;if(p===-1){if(d=g(d,e),"require"===d)return l(a,b,c,e);if("exports"===d)return b;if("module"===d)return c;if(o.hasOwnProperty(d))return o[d];if(n[d])return j.apply(null,n[d]),o[d];if(a)return a(q);throw new Error("No module with ID: "+d)}return f=d.substring(0,p),d=d.substring(p+1,d.length),k=m(a,b,c,f,e),d=k.normalize?k.normalize(d,h(e)):g(d,e),o[d]?o[d]:(k.load(d,l(a,b,c,e),i(d),{}),o[d])},k.require=function(a){return o[a]?o[a]:n[a]?(j.apply(null,n[a]),o[a]):void 0},k.amd={},k}b.exports=e}).call(this,a("_process"),"/node_modules\\amdefine\\amdefine.js")},{_process:81,path:79}],2:[function(a,b,c){"use strict";function d(a){var b=a.length;if(b%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===a[b-2]?2:"="===a[b-1]?1:0}function e(a){return 3*a.length/4-d(a)}function f(a){var b,c,e,f,g,h,i=a.length;g=d(a),h=new l(3*i/4-g),e=g>0?i-4:i;var j=0;for(b=0,c=0;b>16&255,h[j++]=f>>8&255,h[j++]=255&f;return 2===g?(f=k[a.charCodeAt(b)]<<2|k[a.charCodeAt(b+1)]>>4,h[j++]=255&f):1===g&&(f=k[a.charCodeAt(b)]<<10|k[a.charCodeAt(b+1)]<<4|k[a.charCodeAt(b+2)]>>2,h[j++]=f>>8&255,h[j++]=255&f),h}function g(a){return j[a>>18&63]+j[a>>12&63]+j[a>>6&63]+j[63&a]}function h(a,b,c){for(var d,e=[],f=b;fk?k:i+g));return 1===d?(b=a[c-1],e+=j[b>>2],e+=j[b<<4&63],e+="=="):2===d&&(b=(a[c-2]<<8)+a[c-1],e+=j[b>>10],e+=j[b>>4&63],e+=j[b<<2&63],e+="="),f.push(e),f.join("")}c.byteLength=e,c.toByteArray=f,c.fromByteArray=i;for(var j=[],k=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,o=m.length;ng)throw new RangeError("size is too large");var d=c,f=b;void 0===f&&(d=void 0,f=0);var h=new e(a);if("string"==typeof f)for(var i=new e(f,d),j=i.length,k=-1;++kg)throw new RangeError("size is too large");return new e(a)},c.from=function(a,c,d){if("function"==typeof e.from&&(!b.Uint8Array||Uint8Array.from!==e.from))return e.from(a,c,d);if("number"==typeof a)throw new TypeError('"value" argument must not be a number');if("string"==typeof a)return new e(a,c);if("undefined"!=typeof ArrayBuffer&&a instanceof ArrayBuffer){var f=c;if(1===arguments.length)return new e(a);"undefined"==typeof f&&(f=0);var g=d;if("undefined"==typeof g&&(g=a.byteLength-f),f>=a.byteLength)throw new RangeError("'offset' is out of bounds");if(g>a.byteLength-f)throw new RangeError("'length' is out of bounds");return new e(a.slice(f,f+g))}if(e.isBuffer(a)){var h=new e(a.length);return a.copy(h,0,0,a.length),h}if(a){if(Array.isArray(a)||"undefined"!=typeof ArrayBuffer&&a.buffer instanceof ArrayBuffer||"length"in a)return new e(a);if("Buffer"===a.type&&Array.isArray(a.data))return new e(a.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},c.allocUnsafeSlow=function(a){if("function"==typeof e.allocUnsafeSlow)return e.allocUnsafeSlow(a);if("number"!=typeof a)throw new TypeError("size must be a number");if(a>=g)throw new RangeError("size is too large");return new f(a)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{buffer:6}],6:[function(a,b,c){(function(b){"use strict";function d(){try{var a=new Uint8Array(1);return a.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===a.foo()&&"function"==typeof a.subarray&&0===a.subarray(1,1).byteLength}catch(a){return!1}}function e(){return g.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function f(a,b){if(e()=e())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+e().toString(16)+" bytes");return 0|a}function q(a){return+a!=a&&(a=0),g.alloc(+a)}function r(a,b){if(g.isBuffer(a))return a.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(a)||a instanceof ArrayBuffer))return a.byteLength;"string"!=typeof a&&(a=""+a);var c=a.length;if(0===c)return 0;for(var d=!1;;)switch(b){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":case void 0:return T(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return W(a).length;default:if(d)return T(a).length;b=(""+b).toLowerCase(),d=!0}}function s(a,b,c){var d=!1;if((void 0===b||b<0)&&(b=0),b>this.length)return"";if((void 0===c||c>this.length)&&(c=this.length),c<=0)return"";if(c>>>=0,b>>>=0,c<=b)return"";for(a||(a="utf8");;)switch(a){case"hex":return H(this,b,c);case"utf8":case"utf-8":return D(this,b,c);case"ascii":return F(this,b,c);case"latin1":case"binary":return G(this,b,c);case"base64":return C(this,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,b,c);default:if(d)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),d=!0}}function t(a,b,c){var d=a[b];a[b]=a[c],a[c]=d}function u(a,b,c,d,e){if(0===a.length)return-1;if("string"==typeof c?(d=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,isNaN(c)&&(c=e?0:a.length-1),c<0&&(c=a.length+c),c>=a.length){if(e)return-1;c=a.length-1}else if(c<0){if(!e)return-1;c=0}if("string"==typeof b&&(b=g.from(b,d)),g.isBuffer(b))return 0===b.length?-1:v(a,b,c,d,e);if("number"==typeof b)return b&=255,g.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?e?Uint8Array.prototype.indexOf.call(a,b,c):Uint8Array.prototype.lastIndexOf.call(a,b,c):v(a,[b],c,d,e);throw new TypeError("val must be string, number or Buffer")}function v(a,b,c,d,e){function f(a,b){return 1===g?a[b]:a.readUInt16BE(b*g)}var g=1,h=a.length,i=b.length;if(void 0!==d&&(d=String(d).toLowerCase(),"ucs2"===d||"ucs-2"===d||"utf16le"===d||"utf-16le"===d)){if(a.length<2||b.length<2)return-1;g=2,h/=2,i/=2,c/=2}var j;if(e){var k=-1;for(j=c;jh&&(c=h-i),j=c;j>=0;j--){for(var l=!0,m=0;me&&(d=e)):d=e;var f=b.length;if(f%2!==0)throw new TypeError("Invalid hex string");d>f/2&&(d=f/2);for(var g=0;g239?4:f>223?3:f>191?2:1;if(e+h<=c){var i,j,k,l;switch(h){case 1:f<128&&(g=f);break;case 2:i=a[e+1],128===(192&i)&&(l=(31&f)<<6|63&i,l>127&&(g=l));break;case 3:i=a[e+1],j=a[e+2],128===(192&i)&&128===(192&j)&&(l=(15&f)<<12|(63&i)<<6|63&j,l>2047&&(l<55296||l>57343)&&(g=l));break;case 4:i=a[e+1],j=a[e+2],k=a[e+3],128===(192&i)&&128===(192&j)&&128===(192&k)&&(l=(15&f)<<18|(63&i)<<12|(63&j)<<6|63&k,l>65535&&l<1114112&&(g=l))}}null===g?(g=65533,h=1):g>65535&&(g-=65536,d.push(g>>>10&1023|55296),g=56320|1023&g),d.push(g),e+=h}return E(d)}function E(a){var b=a.length;if(b<=aa)return String.fromCharCode.apply(String,a);for(var c="",d=0;dd)&&(c=d);for(var e="",f=b;fc)throw new RangeError("Trying to access beyond buffer length")}function K(a,b,c,d,e,f){if(!g.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(b>e||ba.length)throw new RangeError("Index out of range")}function L(a,b,c,d){b<0&&(b=65535+b+1);for(var e=0,f=Math.min(a.length-c,2);e>>8*(d?e:1-e)}function M(a,b,c,d){b<0&&(b=4294967295+b+1);for(var e=0,f=Math.min(a.length-c,4);e>>8*(d?e:3-e)&255}function N(a,b,c,d,e,f){if(c+d>a.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function O(a,b,c,d,e){return e||N(a,b,c,4,0xf.fffff(e+31),-0xf.fffff(e+31)),$.write(a,b,c,d,23,4),c+4}function P(a,b,c,d,e){return e||N(a,b,c,8,1.7976931348623157e308,-1.7976931348623157e308),$.write(a,b,c,d,52,8),c+8}function Q(a){if(a=R(a).replace(ba,""),a.length<2)return"";for(;a.length%4!==0;)a+="=";return a}function R(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function S(a){return a<16?"0"+a.toString(16):a.toString(16)}function T(a,b){b=b||1/0;for(var c,d=a.length,e=null,f=[],g=0;g55295&&c<57344){if(!e){if(c>56319){(b-=3)>-1&&f.push(239,191,189);continue}if(g+1===d){(b-=3)>-1&&f.push(239,191,189);continue}e=c;continue}if(c<56320){(b-=3)>-1&&f.push(239,191,189),e=c;continue}c=(e-55296<<10|c-56320)+65536}else e&&(b-=3)>-1&&f.push(239,191,189);if(e=null,c<128){if((b-=1)<0)break;f.push(c)}else if(c<2048){if((b-=2)<0)break;f.push(c>>6|192,63&c|128)}else if(c<65536){if((b-=3)<0)break;f.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(c<1114112))throw new Error("Invalid code point");if((b-=4)<0)break;f.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return f}function U(a){for(var b=[],c=0;c>8,e=c%256,f.push(e),f.push(d);return f}function W(a){return Z.toByteArray(Q(a))}function X(a,b,c,d){for(var e=0;e=b.length||e>=a.length);++e)b[e+c]=a[e];return e}function Y(a){return a!==a}var Z=a("base64-js"),$=a("ieee754"),_=a("isarray");c.Buffer=g,c.SlowBuffer=q,c.INSPECT_MAX_BYTES=50,g.TYPED_ARRAY_SUPPORT=void 0!==b.TYPED_ARRAY_SUPPORT?b.TYPED_ARRAY_SUPPORT:d(),c.kMaxLength=e(),g.poolSize=8192,g._augment=function(a){return a.__proto__=g.prototype,a},g.from=function(a,b,c){return h(null,a,b,c)},g.TYPED_ARRAY_SUPPORT&&(g.prototype.__proto__=Uint8Array.prototype,g.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&g[Symbol.species]===g&&Object.defineProperty(g,Symbol.species,{value:null,configurable:!0})),g.alloc=function(a,b,c){return j(null,a,b,c)},g.allocUnsafe=function(a){return k(null,a)},g.allocUnsafeSlow=function(a){return k(null,a)},g.isBuffer=function(a){return!(null==a||!a._isBuffer)},g.compare=function(a,b){if(!g.isBuffer(a)||!g.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var c=a.length,d=b.length,e=0,f=Math.min(c,d);e0&&(a=this.toString("hex",0,b).match(/.{2}/g).join(" "),this.length>b&&(a+=" ... ")),""},g.prototype.compare=function(a,b,c,d,e){if(!g.isBuffer(a))throw new TypeError("Argument must be a Buffer");if(void 0===b&&(b=0),void 0===c&&(c=a?a.length:0),void 0===d&&(d=0),void 0===e&&(e=this.length),b<0||c>a.length||d<0||e>this.length)throw new RangeError("out of range index");if(d>=e&&b>=c)return 0;if(d>=e)return-1;if(b>=c)return 1;if(b>>>=0,c>>>=0,d>>>=0,e>>>=0,this===a)return 0;for(var f=e-d,h=c-b,i=Math.min(f,h),j=this.slice(d,e),k=a.slice(b,c),l=0;le)&&(c=e),a.length>0&&(c<0||b<0)||b>this.length)throw new RangeError("Attempt to write outside buffer bounds");d||(d="utf8");for(var f=!1;;)switch(d){case"hex":return w(this,a,b,c);case"utf8":case"utf-8":return x(this,a,b,c);case"ascii":return y(this,a,b,c);case"latin1":case"binary":return z(this,a,b,c);case"base64":return A(this,a,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,a,b,c);default:if(f)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),f=!0}},g.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var aa=4096;g.prototype.slice=function(a,b){var c=this.length;a=~~a,b=void 0===b?c:~~b,a<0?(a+=c,a<0&&(a=0)):a>c&&(a=c),b<0?(b+=c,b<0&&(b=0)):b>c&&(b=c),b0&&(e*=256);)d+=this[a+--b]*e;return d},g.prototype.readUInt8=function(a,b){return b||J(a,1,this.length),this[a]},g.prototype.readUInt16LE=function(a,b){return b||J(a,2,this.length),this[a]|this[a+1]<<8},g.prototype.readUInt16BE=function(a,b){return b||J(a,2,this.length),this[a]<<8|this[a+1]},g.prototype.readUInt32LE=function(a,b){return b||J(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]},g.prototype.readUInt32BE=function(a,b){return b||J(a,4,this.length),16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])},g.prototype.readIntLE=function(a,b,c){a|=0,b|=0,c||J(a,b,this.length);for(var d=this[a],e=1,f=0;++f=e&&(d-=Math.pow(2,8*b)),d},g.prototype.readIntBE=function(a,b,c){a|=0,b|=0,c||J(a,b,this.length);for(var d=b,e=1,f=this[a+--d];d>0&&(e*=256);)f+=this[a+--d]*e;return e*=128,f>=e&&(f-=Math.pow(2,8*b)),f},g.prototype.readInt8=function(a,b){return b||J(a,1,this.length),128&this[a]?(255-this[a]+1)*-1:this[a]},g.prototype.readInt16LE=function(a,b){b||J(a,2,this.length);var c=this[a]|this[a+1]<<8;return 32768&c?4294901760|c:c},g.prototype.readInt16BE=function(a,b){b||J(a,2,this.length);var c=this[a+1]|this[a]<<8;return 32768&c?4294901760|c:c},g.prototype.readInt32LE=function(a,b){return b||J(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},g.prototype.readInt32BE=function(a,b){return b||J(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},g.prototype.readFloatLE=function(a,b){return b||J(a,4,this.length),$.read(this,a,!0,23,4)},g.prototype.readFloatBE=function(a,b){return b||J(a,4,this.length),$.read(this,a,!1,23,4)},g.prototype.readDoubleLE=function(a,b){return b||J(a,8,this.length),$.read(this,a,!0,52,8)},g.prototype.readDoubleBE=function(a,b){return b||J(a,8,this.length),$.read(this,a,!1,52,8)},g.prototype.writeUIntLE=function(a,b,c,d){if(a=+a,b|=0,c|=0,!d){var e=Math.pow(2,8*c)-1;K(this,a,b,c,e,0)}var f=1,g=0;for(this[b]=255&a;++g=0&&(g*=256);)this[b+f]=a/g&255;return b+c},g.prototype.writeUInt8=function(a,b,c){return a=+a,b|=0,c||K(this,a,b,1,255,0),g.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),this[b]=255&a,b+1},g.prototype.writeUInt16LE=function(a,b,c){return a=+a,b|=0,c||K(this,a,b,2,65535,0),g.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8):L(this,a,b,!0),b+2},g.prototype.writeUInt16BE=function(a,b,c){return a=+a,b|=0,c||K(this,a,b,2,65535,0),g.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=255&a):L(this,a,b,!1),b+2},g.prototype.writeUInt32LE=function(a,b,c){return a=+a,b|=0,c||K(this,a,b,4,4294967295,0),g.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=255&a):M(this,a,b,!0),b+4},g.prototype.writeUInt32BE=function(a,b,c){return a=+a,b|=0,c||K(this,a,b,4,4294967295,0),g.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a):M(this,a,b,!1),b+4},g.prototype.writeIntLE=function(a,b,c,d){if(a=+a,b|=0,!d){var e=Math.pow(2,8*c-1);K(this,a,b,c,e-1,-e)}var f=0,g=1,h=0;for(this[b]=255&a;++f>0)-h&255;return b+c},g.prototype.writeIntBE=function(a,b,c,d){if(a=+a,b|=0,!d){var e=Math.pow(2,8*c-1);K(this,a,b,c,e-1,-e)}var f=c-1,g=1,h=0;for(this[b+f]=255&a;--f>=0&&(g*=256);)a<0&&0===h&&0!==this[b+f+1]&&(h=1),this[b+f]=(a/g>>0)-h&255;return b+c},g.prototype.writeInt8=function(a,b,c){return a=+a,b|=0,c||K(this,a,b,1,127,-128),g.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),a<0&&(a=255+a+1),this[b]=255&a,b+1},g.prototype.writeInt16LE=function(a,b,c){return a=+a,b|=0,c||K(this,a,b,2,32767,-32768),g.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8):L(this,a,b,!0),b+2},g.prototype.writeInt16BE=function(a,b,c){return a=+a,b|=0,c||K(this,a,b,2,32767,-32768),g.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=255&a):L(this,a,b,!1),b+2},g.prototype.writeInt32LE=function(a,b,c){return a=+a,b|=0,c||K(this,a,b,4,2147483647,-2147483648),g.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):M(this,a,b,!0),b+4},g.prototype.writeInt32BE=function(a,b,c){return a=+a,b|=0,c||K(this,a,b,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),g.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a):M(this,a,b,!1),b+4},g.prototype.writeFloatLE=function(a,b,c){return O(this,a,b,!0,c)},g.prototype.writeFloatBE=function(a,b,c){return O(this,a,b,!1,c)},g.prototype.writeDoubleLE=function(a,b,c){return P(this,a,b,!0,c)},g.prototype.writeDoubleBE=function(a,b,c){return P(this,a,b,!1,c)},g.prototype.copy=function(a,b,c,d){if(c||(c=0),d||0===d||(d=this.length),b>=a.length&&(b=a.length),b||(b=0),d>0&&d=this.length)throw new RangeError("sourceStart out of bounds");if(d<0)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),a.length-b=0;--e)a[e+b]=this[e+c];else if(f<1e3||!g.TYPED_ARRAY_SUPPORT)for(e=0;e>>=0,c=void 0===c?this.length:c>>>0,a||(a=0);var f;if("number"==typeof a)for(f=b;f0?b.errors:null,c):c}return function(a){return b.options.sourceMap?b.inputSourceMapTracker.track(a,function(){return b.options.sourceMapInlineSources?b.inputSourceMapTracker.resolveSources(function(){return c(a)}):c(a)}):c(a)}}function i(a,b){return b.stats=a.stats,b.errors=a.errors,b.warnings=a.warnings,b}function j(a,b){var d=c.hrtime();a.stats.originalSize=a.sourceTracker.removeAll(b).length,b=l(a,b);var e=c.hrtime(d);return a.stats.timeSpent=~~(1e3*e[0]+e[1]/1e6),a.stats.efficiency=1-b.styles.length/a.stats.originalSize,a.stats.minifiedSize=b.styles.length,b}function k(a){return function(b,d){var e=b.constructor.name+"#"+d,f=c.hrtime();a(b,d);var g=c.hrtime(f);console.log("%d ms: "+e,1e3*g[0]+g[1]/1e6)}}function l(a,b){function c(b,c){return b=g.restore(b,c),b=h.restore(b),b=d.rebase?n(b,a):b,b=f.restore(b),e.restore(b)}var d=a.options,e=new t(a,d.keepSpecialComments,d.keepBreaks,d.sourceMap),f=new u(d.sourceMap),g=new v(d.sourceMap),h=new w(a,d.sourceMap,d.compatibility.properties.urlQuotes),i=d.sourceMap?s:r,j=function(a,c){b="function"==typeof a?a(b):a[c](b)};d.benchmark&&(j=k(j)),j(e,"escape"),j(f,"escape"),j(h,"escape"),j(g,"escape");var l=o(b,a);return p(l,d),d.advanced&&q(l,d,a,!0),i(l,d,c,a.inputSourceMapTracker)}var m=a("./imports/inliner"),n=a("./urls/rebase"),o=a("./tokenizer/tokenize"),p=a("./selectors/simple"),q=a("./selectors/advanced"),r=a("./stringifier/simple"),s=a("./stringifier/source-maps"),t=a("./text/comments-processor"),u=a("./text/expressions-processor"),v=a("./text/free-text-processor"),w=a("./text/urls-processor"),x=a("./utils/compatibility"),y=a("./utils/input-source-map-tracker"),z=a("./utils/source-tracker"),A=a("./utils/source-reader"),B=a("./properties/validator"),C=a("fs"),D=a("path"),E=a("url"),F=a("./utils/object").override,G=5e3,H=b.exports=function(a){a=a||{},this.options={advanced:void 0===a.advanced||!!a.advanced,aggressiveMerging:void 0===a.aggressiveMerging||!!a.aggressiveMerging,benchmark:a.benchmark,compatibility:new x(a.compatibility).toOptions(),debug:a.debug,explicitRoot:!!a.root,explicitTarget:!!a.target,inliner:a.inliner||{},keepBreaks:a.keepBreaks||!1,keepSpecialComments:"keepSpecialComments"in a?a.keepSpecialComments:"*",mediaMerging:void 0===a.mediaMerging||!!a.mediaMerging,processImport:void 0===a.processImport||!!a.processImport,processImportFrom:d(a.processImportFrom),rebase:void 0===a.rebase||!!a.rebase,relativeTo:a.relativeTo,restructuring:void 0===a.restructuring||!!a.restructuring,root:a.root||c.cwd(),roundingPrecision:a.roundingPrecision,semanticMerging:void 0!==a.semanticMerging&&!!a.semanticMerging,shorthandCompacting:void 0===a.shorthandCompacting||!!a.shorthandCompacting,sourceMap:a.sourceMap,sourceMapInlineSources:!!a.sourceMapInlineSources,target:!a.target||e(a.target)||f(a.target)?a.target:D.dirname(a.target)},this.options.inliner.timeout=this.options.inliner.timeout||G,this.options.inliner.request=F(g(c.env.HTTP_PROXY||c.env.http_proxy),this.options.inliner.request||{})};H.prototype.minify=function(a,b){var d={stats:{},errors:[],warnings:[],options:this.options,debug:this.options.debug,localOnly:!b,sourceTracker:new z,validator:new B(this.options.compatibility)};if(d.options.sourceMap&&(d.inputSourceMapTracker=new y(d)),d.sourceReader=new A(d,a),a=d.sourceReader.toString(),d.options.processImport||a.indexOf("@shallow")>0){var e=b?c.nextTick:function(a){return a()};return e(function(){return new m(d).process(a,{localOnly:d.localOnly,imports:d.options.processImportFrom,whenDone:h(b,d)})})}return h(b,d)(a)}}).call(this,a("_process"))},{"./imports/inliner":13,"./properties/validator":28,"./selectors/advanced":31,"./selectors/simple":44,"./stringifier/simple":48,"./stringifier/source-maps":49,"./text/comments-processor":50,"./text/expressions-processor":52,"./text/free-text-processor":53,"./text/urls-processor":54,"./tokenizer/tokenize":57,"./urls/rebase":58,"./utils/compatibility":62,"./utils/input-source-map-tracker":63,"./utils/object":64,"./utils/source-reader":66,"./utils/source-tracker":67, -_process:81,fs:4,path:79,url:139}],10:[function(a,b,c){function d(a,b,c,d){return b+h[c.toLowerCase()]+d}function e(a,b,c){return i[b.toLowerCase()]+c}var f={},g={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#0ff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000",blanchedalmond:"#ffebcd",blue:"#00f",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#0ff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",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:"#f0f",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",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",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#0f0",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",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:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#f00",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:"#fff",whitesmoke:"#f5f5f5",yellow:"#ff0",yellowgreen:"#9acd32"},h={},i={};for(var j in g){var k=g[j];j.length-1,c=a.replace(l,d);return c!=a&&(c=c.replace(l,d)),b?c.replace(m,e):c},b.exports=f},{}],11:[function(a,b,c){function d(a,b,c){this.hue=a,this.saturation=b,this.lightness=c}function e(a,b,c){var d,e,g;if(a%=360,a<0&&(a+=360),a=~~a/360,b<0?b=0:b>100&&(b=100),b=~~b/100,c<0?c=0:c>100&&(c=100),c=~~c/100,0===b)d=e=g=c;else{var h=c<.5?c*(1+b):c+b-c*b,i=2*c-h;d=f(i,h,a+1/3),e=f(i,h,a),g=f(i,h,a-1/3)}return[~~(255*d),~~(255*e),~~(255*g)]}function f(a,b,c){return c<0&&(c+=1),c>1&&(c-=1),c<1/6?a+6*(b-a)*c:c<.5?b:c<2/3?a+(b-a)*(2/3-c)*6:a}d.prototype.toHex=function(){var a=e(this.hue,this.saturation,this.lightness),b=a[0].toString(16),c=a[1].toString(16),d=a[2].toString(16);return"#"+((1==b.length?"0":"")+b)+((1==c.length?"0":"")+c)+((1==d.length?"0":"")+d)},b.exports=d},{}],12:[function(a,b,c){function d(a,b,c){this.red=a,this.green=b,this.blue=c}d.prototype.toHex=function(){var a=Math.max(0,Math.min(~~this.red,255)),b=Math.max(0,Math.min(~~this.green,255)),c=Math.max(0,Math.min(~~this.blue,255));return"#"+("00000"+(a<<16|b<<8|c).toString(16)).slice(-6)},b.exports=d},{}],13:[function(a,b,c){(function(c){function d(a){this.outerContext=a}function e(a,b){if(b.shallow)return b.shallow=!1,b.done.push(a),h(b);for(var c=0,d=0,e=0,f=i(a);d-1&&d==-1?c:c==-1&&d>-1?d:Math.min(c,d)}function h(a){return a.left.length>0?e.apply(null,a.left.shift()):a.whenDone(a.done.join(""))}function i(a){var b=/(\/\*(?!\*\/)[\s\S]*?\*\/)/,c=0,d=0,e=!1;return function(f){var g,h=0,i=0,j=0,k=0;if(e)return!1;do{if(f>c&&ff&&f>j}}function j(a){for(var b=i(a),c=-1;;)if(c=a.indexOf("{",c+1),c==-1||!b(c))break;return c>-1}function k(a,b,c,d){d.shallow=a.indexOf("@shallow")>0;var e=a.substring(g(a,b)+"@import".length+1,c).replace(/@shallow\)$/,")").trim(),f=0===e.indexOf("url("),i=f?4:0,k=/^['"]/.exec(e.substring(i,i+2)),p=k?e.indexOf(k[0],i+1):v(e," ")[0].length-(f?1:0),q=e.substring(i,p).replace(/['"]/g,"").replace(/\)$/,"").trim(),r=e.substring(p+1).replace(/^\)/,"").trim(),s=d.isRemote||y.test(q);if(s&&(d.localOnly||!l(q,!0,d.imports)))return d.afterContent||j(d.done.join(""))?d.warnings.push('Ignoring remote @import of "'+q+'" as no callback given.'):o(q,r,d),h(d);if(!s&&!l(q,!1,d.imports))return d.afterImport?d.warnings.push('Ignoring local @import of "'+q+'" as after other inlined content.'):o(q,r,d),h(d);if(!s&&d.afterContent)return d.warnings.push('Ignoring local @import of "'+q+'" as after other CSS content.'),h(d);var t=s?m:n;return t(q,r,d)}function l(a,b,c){if(0===c.length)return!1;b&&z.test(a)&&(a="http:"+a);for(var d=b?t.parse(a).host:a,e=!0,f=0;f-1)return h(d);d.debug&&console.error("Inlining remote stylesheet: "+i),d.visited.push(i);var k=d.inliner.request.protocol||d.inliner.request.hostname,l=k&&0!==k.indexOf("https://")||0===i.indexOf("http://")?r.get:s.get,n=!1,p=w(t.parse(i),d.inliner.request);void 0!==d.inliner.request.hostname&&(p.protocol=d.inliner.request.protocol||"http:",p.path=p.href),l(p,function(a){if(a.statusCode<200||a.statusCode>399)return g("error "+a.statusCode);if(a.statusCode>299){var h=t.resolve(i,a.headers.location);return m(h,b,d)}var k=[],l=t.parse(i);a.on("data",function(a){k.push(a.toString())}),a.on("end",function(){var a=k.join("");d.rebase&&(a=u(a,{toBase:j},d)),d.sourceReader.trackSource(i,a),a=d.sourceTracker.store(i,a),a=f(a,i),b.length>0&&(a="@media "+b+"{"+a+"}"),d.afterImport=!0;var g=w(d,{isRemote:!0,relativeTo:l.protocol+"//"+l.host+l.pathname});c.nextTick(function(){e(a,g)})})}).on("error",function(a){g(a.message)}).on("timeout",function(){g("timeout")}).setTimeout(d.inliner.timeout)}function n(a,b,c){var d="/"==a[0]?c.root:c.relativeTo,f=q.resolve(q.join(d,a));if(!p.existsSync(f)||!p.statSync(f).isFile())return c.errors.push('Broken @import declaration of "'+a+'"'),h(c);if(c.visited.indexOf(f)>-1)return h(c);c.debug&&console.error("Inlining local stylesheet: "+f),c.visited.push(f);var g=q.dirname(f),i=p.readFileSync(f,"utf8");if(c.rebase){var j={relative:!0,fromBase:g,toBase:c.baseRelativeTo};i=u(i,j,c)}var k=q.relative(c.root,f);c.sourceReader.trackSource(k,i),i=c.sourceTracker.store(k,i),b.length>0&&(i="@media "+b+"{"+i+"}"),c.afterImport=!0;var l=w(c,{relativeTo:g});return e(i,l)}function o(a,b,c){var d="@import url("+a+")"+(b.length>0?" "+b:"")+";";c.done.push(d)}var p=a("fs"),q=a("path"),r=a("http"),s=a("https"),t=a("url"),u=a("../urls/rewrite"),v=a("../utils/split"),w=a("../utils/object.js").override,x=/\/\*# sourceMappingURL=(\S+) \*\//,y=/^(https?:)?\/\//,z=/^\/\//;d.prototype.process=function(a,b){var c=this.outerContext.options.root;return b=w(b,{baseRelativeTo:this.outerContext.options.relativeTo||c,debug:this.outerContext.options.debug,done:[],errors:this.outerContext.errors,left:[],inliner:this.outerContext.options.inliner,rebase:this.outerContext.options.rebase,relativeTo:this.outerContext.options.relativeTo||c,root:c,sourceReader:this.outerContext.sourceReader,sourceTracker:this.outerContext.sourceTracker,warnings:this.outerContext.warnings,visited:[]}),e(a,b)},b.exports=d}).call(this,a("_process"))},{"../urls/rewrite":60,"../utils/object.js":64,"../utils/split":68,_process:81,fs:4,http:121,https:72,path:79,url:139}],14:[function(a,b,c){function d(a){return function(b){return"invert"==b[0]||a.isValidColor(b[0])}}function e(a){return function(b){return"inherit"!=b[0]&&a.isValidStyle(b[0])&&!a.isValidColorValue(b[0])}}function f(a,b,c){var d=c[a];return n(d.doubleValues&&2==d.defaultValue.length?[[a,b.important],[d.defaultValue[0]],[d.defaultValue[1]]]:d.doubleValues&&1==d.defaultValue.length?[[a,b.important],[d.defaultValue[0]]]:[[a,b.important],[d.defaultValue]])}function g(a){return function(b){return"inherit"!=b[0]&&a.isValidWidth(b[0])&&!a.isValidStyleKeyword(b[0])&&!a.isValidColorValue(b[0])}}function h(a,b,c){var d=f("background-image",a,b),e=f("background-position",a,b),g=f("background-size",a,b),h=f("background-repeat",a,b),i=f("background-attachment",a,b),j=f("background-origin",a,b),k=f("background-clip",a,b),l=f("background-color",a,b),m=[d,e,g,h,i,j,k,l],n=a.value,o=!1,q=!1,r=!1,s=!1;if(1==a.value.length&&"inherit"==a.value[0][0])return l.value=d.value=h.value=e.value=g.value=j.value=k.value=a.value,m;for(var t=n.length-1;t>=0;t--){var u=n[t];if(c.isValidBackgroundAttachment(u[0]))i.value=[u];else if(c.isValidBackgroundBox(u[0]))q?(j.value=[u],r=!0):(k.value=[u],q=!0);else if(c.isValidBackgroundRepeat(u[0]))s?h.value.unshift(u):(h.value=[u],s=!0);else if(c.isValidBackgroundPositionPart(u[0])||c.isValidBackgroundSizePart(u[0]))if(t>0){var v=n[t-1];if(v[0].indexOf("/")>0){var w=p(v[0],"/");g.value=[[w.pop()].concat(v.slice(1)),u],n[t-1]=[w.pop()].concat(v.slice(1))}else t>1&&"/"==n[t-2][0]?(g.value=[v,u],t-=2):"/"==v[0]?g.value=[u]:(o||(e.value=[]),e.value.unshift(u),o=!0)}else o||(e.value=[]),e.value.unshift(u),o=!0;else if(c.isValidBackgroundPositionAndSize(u[0])){var x=p(u[0],"/");g.value=[[x.pop()].concat(u.slice(1))],e.value=[[x.pop()].concat(u.slice(1))]}else l.value[0][0]!=b[l.name].defaultValue&&"none"!=l.value[0][0]||!c.isValidColor(u[0])?(c.isValidUrl(u[0])||c.isValidFunction(u[0]))&&(d.value=[u]):l.value=[u]}return q&&!r&&(j.value=k.value.slice(0)),m}function i(a,b){for(var c=a.value,d=-1,e=0,g=c.length;e-1?c.slice(0,d):c.slice(0),h.components=j(h,b);var i=f(a.name,a,b);i.value=d>-1?c.slice(d+1):c.slice(0),i.components=j(i,b);for(var k=0;k<4;k++)h.components[k].multiplex=!0,h.components[k].value=h.components[k].value.concat(i.components[k].value);return h.components}function j(a,b){var c=b[a.name].components,d=[],e=a.value;if(e.length<1)return[];e.length<2&&(e[1]=e[0].slice(0)),e.length<3&&(e[2]=e[0].slice(0)),e.length<4&&(e[3]=e[1].slice(0));for(var f=c.length-1;f>=0;f--){var g=n([[c[f],a.important]]);g.value=[e[f]],d.unshift(g)}return d}function k(a){return function(b,c,d){var e,g,h,i,j=[],k=b.value;for(e=0,h=k.length;e0&&c.isValidListStylePosition(i[0][0])&&(e.value=[i[0]]),h}function m(a,b,c){for(var h,i,j,k=b[a.name],l=[f(k.components[0],a,b),f(k.components[1],a,b),f(k.components[2],a,b)],m=0;m<3;m++){var n=l[m];n.name.indexOf("color")>0?h=n:n.name.indexOf("style")>0?i=n:j=n}if(1==a.value.length&&"inherit"==a.value[0][0]||3==a.value.length&&"inherit"==a.value[0][0]&&"inherit"==a.value[1][0]&&"inherit"==a.value[2][0])return h.value=i.value=j.value=[a.value[0]],l;var o,p,q=a.value.slice(0);return q.length>0&&(p=q.filter(g(c)),o=p.length>1&&("none"==p[0][0]||"auto"==p[0][0])?p[1]:p[0],o&&(j.value=[o],q.splice(q.indexOf(o),1))),q.length>0&&(o=q.filter(e(c))[0],o&&(i.value=[o],q.splice(q.indexOf(o),1))),q.length>0&&(o=q.filter(d(c))[0],o&&(h.value=[o],q.splice(q.indexOf(o),1))),l}var n=a("./wrap-for-optimizing").single,o=a("./invalid-property-error"),p=a("../utils/split"),q=",";b.exports={background:h,border:m,borderRadius:i,fourValues:j,listStyle:l,multiplex:k,outline:m}},{"../utils/split":68,"./invalid-property-error":20,"./wrap-for-optimizing":30}],15:[function(a,b,c){function d(){return!0}function e(a,b,c){var d=a.value[0][0],e=b.value[0][0],f=c.isValidFunction(d),g=c.isValidFunction(e);return f&&g?c.areSameFunction(d,e):!(!f&&g)}function f(a,b,c){var d=a.value[0][0],e=b.value[0][0];return!("none"!=e&&"inherit"!=e&&!c.isValidUrl(e))||"none"!=d&&"inherit"!=d&&!c.isValidUrl(d)&&k(a,b,c)}function g(a,b,c){return h(a.components[2],b.components[2],c)}function h(a,b,c){var d=a.value[0][0],e=b.value[0][0];return!(!c.colorOpacity&&(c.isValidRgbaColor(d)||c.isValidHslaColor(d)))&&(!(!c.colorOpacity&&(c.isValidRgbaColor(e)||c.isValidHslaColor(e)))&&(!(!c.isValidNamedColor(e)&&!c.isValidHexColor(e))||!c.isValidNamedColor(d)&&!c.isValidHexColor(d)&&(!(!c.isValidRgbaColor(e)&&!c.isValidHslaColor(e))||!c.isValidRgbaColor(d)&&!c.isValidHslaColor(d)&&k(a,b,c))))}function i(a,b,c){var d=a.value[0][0],e=b.value[0][0];return!(c.isValidFunction(d)^c.isValidFunction(e))}function j(a,b){var c=a.value[0][0],d=b.value[0][0];return c===d}function k(a,b,c){var d=a.value[0][0],e=b.value[0][0];return!!c.areSameFunction(d,e)||d===e}function l(a,b,c){var d=a.value[0][0],e=b.value[0][0];return!(c.isValidAndCompatibleUnitWithoutFunction(d)&&!c.isValidAndCompatibleUnitWithoutFunction(e))&&(!!c.isValidUnitWithoutFunction(e)||!c.isValidUnitWithoutFunction(d)&&(!(!c.isValidFunctionWithoutVendorPrefix(e)||!c.isValidFunctionWithoutVendorPrefix(d))||k(a,b,c)))}b.exports={always:d,alwaysButIntoFunction:e,backgroundImage:f,border:g,color:h,sameValue:j,sameFunctionOrValue:k,twoOptionalFunctions:i,unit:l}},{}],16:[function(a,b,c){function d(a){for(var b=e(a),c=a.components.length-1;c>=0;c--){var d=e(a.components[c]);d.value=a.components[c].value.slice(0),b.components.unshift(d)}return b.dirty=!0,b.value=a.value.slice(0),b}function e(a){var b=f([[a.name,a.important,a.hack]]);return b.unused=!1,b}var f=a("./wrap-for-optimizing").single;b.exports={deep:d,shallow:e}},{"./wrap-for-optimizing":30}],17:[function(a,b,c){var d=a("./break-up"),e=a("./can-override"),f=a("./restore"),g={color:{canOverride:e.color,defaultValue:"transparent",shortestValue:"red"},background:{components:["background-image","background-position","background-size","background-repeat","background-attachment","background-origin","background-clip","background-color"],breakUp:d.multiplex(d.background),defaultValue:"0 0",restore:f.multiplex(f.background),shortestValue:"0",shorthand:!0},"background-clip":{canOverride:e.always,defaultValue:"border-box",shortestValue:"border-box"},"background-color":{canOverride:e.color,defaultValue:"transparent",multiplexLastOnly:!0,nonMergeableValue:"none",shortestValue:"red"},"background-image":{canOverride:e.backgroundImage,defaultValue:"none"},"background-origin":{canOverride:e.always,defaultValue:"padding-box",shortestValue:"border-box"},"background-repeat":{canOverride:e.always,defaultValue:["repeat"],doubleValues:!0},"background-position":{canOverride:e.alwaysButIntoFunction,defaultValue:["0","0"],doubleValues:!0,shortestValue:"0"},"background-size":{canOverride:e.alwaysButIntoFunction,defaultValue:["auto"],doubleValues:!0,shortestValue:"0 0"},"background-attachment":{canOverride:e.always,defaultValue:"scroll"},border:{breakUp:d.border,canOverride:e.border,components:["border-width","border-style","border-color"],defaultValue:"none",restore:f.withoutDefaults,shorthand:!0},"border-color":{canOverride:e.color,defaultValue:"none",shorthand:!0},"border-style":{canOverride:e.always,defaultValue:"none",shorthand:!0},"border-width":{canOverride:e.unit,defaultValue:"medium",shortestValue:"0",shorthand:!0},"list-style":{components:["list-style-type","list-style-position","list-style-image"],canOverride:e.always,breakUp:d.listStyle,restore:f.withoutDefaults,defaultValue:"outside",shortestValue:"none",shorthand:!0},"list-style-type":{canOverride:e.always,defaultValue:"__hack",shortestValue:"none"},"list-style-position":{canOverride:e.always,defaultValue:"outside",shortestValue:"inside"},"list-style-image":{canOverride:e.always,defaultValue:"none"},outline:{components:["outline-color","outline-style","outline-width"],breakUp:d.outline,restore:f.withoutDefaults,defaultValue:"0",shorthand:!0},"outline-color":{canOverride:e.color,defaultValue:"invert",shortestValue:"red"},"outline-style":{canOverride:e.always,defaultValue:"none"},"outline-width":{canOverride:e.unit,defaultValue:"medium",shortestValue:"0"},"-moz-transform":{canOverride:e.sameFunctionOrValue},"-ms-transform":{canOverride:e.sameFunctionOrValue},"-webkit-transform":{canOverride:e.sameFunctionOrValue},transform:{canOverride:e.sameFunctionOrValue}},h=function(a,b,c){c=c||{},g[a]={canOverride:c.canOverride,components:b,breakUp:c.breakUp||d.fourValues,defaultValue:c.defaultValue||"0",restore:c.restore||f.fourValues,shortestValue:c.shortestValue,shorthand:!0};for(var h=0;h=0;b--)if("inherit"==a.value[b][0])return!0;return!1}b.exports=d},{}],20:[function(a,b,c){function d(a){this.name="InvalidPropertyError",this.message=a,this.stack=(new Error).stack}d.prototype=Object.create(Error.prototype),d.prototype.constructor=d,b.exports=d},{}],21:[function(a,b,c){function d(a,b,c,d){function e(a){return b===!1||b===!0?b:b.indexOf(a)>-1}function g(b){var c=a[b-1],d=a[b];return m(c.all,c.position)==m(d.all,d.position)}var h,i,j={},k=null;a:for(var l=0,o=a.length;l0&&h&&q==k&&r==h.important&&s==h.hack&&g(l)&&!h.unused)p.unused=!0;else{if(q in j&&(c&&q!=k||e(l))){var t=j[q],u=f[q]&&f[q].canOverride,v=!1;for(i=t.length-1;i>=0;i--){var w=a[t[i]],x=w.name!=q,y=w.important,z=w.hack;if(!w.unused&&(!x||!y)&&(y||!(z&&!s||!z&&s))&&(!y||"star"!=s&&"underscore"!=s)&&(z||s||x||!u||u(w,p,d))){if(y&&!r||y&&s){p.unused=!0,h=p;continue a}v=!0,w.unused=!0}}if(v){l=-1,h=null,k=null,j={};continue}}else{j[q]=j[q]||[],j[q].push(l);var A=n[q];if(A)for(i=A.length-1;i>=0;i--){var B=A[i];j[B]=j[B]||[],j[B].push(l)}}k=q,h=p}}}function e(a,b,c,f,m,n){var o=n.validator,p=n.warnings,q=g(b);h(q,o,p),d(q,c,m.aggressiveMerging,o);for(var r=0,s=q.length;r-1}function g(a,b){b.unused=!0,l(b,m(a)),a.value=b.value}function h(a,b){b.unused=!0,a.multiplex=!0,a.value=b.value}function i(a,b){b.unused=!0,a.value=b.value}function j(a,b){b.multiplex?h(a,b):a.multiplex?g(a,b):i(a,b)}function k(a,b){b.unused=!0;for(var c=0,d=a.components.length;c=0&&(a[e].name!=c||a[e].unused||d++,!(d>1));e--);return d>1}function p(a,b){for(var c=0,d=a.components.length;c=0;u--)if(h=a[u],s(h)&&!h.variable)for(g=y[h.name].canOverride||x.sameValue,v=u-1;v>=0;v--)if(i=a[v],s(i)&&!(i.variable||i.unused||h.unused||i.hack&&!h.hack||!i.hack&&h.hack||B(h)||t(i,h)))if(!i.shorthand&&h.shorthand&&f(h,i)){if(!h.important&&i.important)continue;if(!E([i],h.components))continue;if(!q(c.isValidFunction,i)&&p(h,c))continue;n=h.components.filter(d(i))[0],g=y[i.name]&&y[i.name].canOverride||x.sameValue,D(g,i,n,c)&&(i.unused=!0)}else if(i.shorthand&&!h.shorthand&&f(i,h)){if(h.important&&!i.important)continue;if(!h.important&&i.important){h.unused=!0;continue}if(o(a,u-1,i.name))continue;if(p(i,c))continue;if(n=i.components.filter(d(h))[0],D(g,n,h,c)){var z=!b.properties.backgroundClipMerging&&n.name.indexOf("background-clip")>-1||!b.properties.backgroundOriginMerging&&n.name.indexOf("background-origin")>-1||!b.properties.backgroundSizeMerging&&n.name.indexOf("background-size")>-1,A=y[h.name].nonMergeableValue===h.value[0][0];if(z||A)continue;if(!b.properties.merging&&e(i,c))continue;if(n.value[0][0]!=h.value[0][0]&&(B(i)||B(h)))continue;if(r(i,h))continue;!i.multiplex&&h.multiplex&&l(i,m(h)),j(n,h),i.dirty=!0}}else if(i.shorthand&&h.shorthand&&i.name==h.name){if(!i.multiplex&&h.multiplex)continue;if(!h.important&&i.important){h.unused=!0;continue a}if(h.important&&!i.important){i.unused=!0;continue}for(w=i.components.length-1;w>=0;w--){var C=i.components[w],F=h.components[w];if(g=y[C.name].canOverride||x.sameValue,!D(g,C,F,c))continue a;if(!D(x.twoOptionalFunctions,C,F,c)&&c.isValidFunction(F))continue a}k(i,h),i.dirty=!0}else if(i.shorthand&&h.shorthand&&f(i,h)){if(!i.important&&h.important)continue;if(n=i.components.filter(d(h))[0],g=y[h.name].canOverride||x.sameValue,!D(g,n,h,c))continue;if(i.important&&!h.important){h.unused=!0;continue}var G=y[h.name].restore(h,y);if(G.length>1)continue;n=i.components.filter(d(h))[0],j(n,h),h.dirty=!0}else if(i.name==h.name){if(i.important&&!h.important){h.unused=!0;continue}if(g=y[h.name].canOverride||x.sameValue,!D(g,i,h,c))continue;i.unused=!0}}var x=a("./can-override"),y=a("./compactable"),z=a("./clone").deep,A=a("./clone").shallow,B=a("./has-inherit"),C=a("./restore-from-optimizing"),D=a("./every-combination"),E=a("./vendor-prefixes").same,F=a("../stringifier/one-time").property,G=",";b.exports=w},{"../stringifier/one-time":47,"./can-override":15,"./clone":16,"./compactable":17,"./every-combination":18,"./has-inherit":19,"./restore-from-optimizing":25,"./vendor-prefixes":29}],23:[function(a,b,c){function d(a,b,c){for(var d=a.length-1;d>=0;d--){var g=a[d],h=e[g.name];if(h&&h.shorthand){g.shorthand=!0,g.dirty=!0;try{g.components=h.breakUp(g,e,b)}catch(a){if(!(a instanceof f))throw a;g.components=[],c.push(a.message)}g.components.length>0?g.multiplex=g.components[0].multiplex:g.unused=!0}}}var e=a("./compactable"),f=a("./invalid-property-error");b.exports=d},{"./compactable":17,"./invalid-property-error":20}],24:[function(a,b,c){function d(a){for(var b=a.length-1;b>=0;b--){var c=a[b];c.unused&&c.all.splice(c.position,1)}}b.exports=d},{}],25:[function(a,b,c){function d(a){a.value[a.value.length-1][0]+=i}function e(a){"underscore"==a.hack?a.name=k+a.name:"star"==a.hack?a.name=j+a.name:"backslash"==a.hack?a.value[a.value.length-1][0]+=h:"bang"==a.hack&&(a.value[a.value.length-1][0]+=" "+l)}function f(a,b){for(var c=a.length-1;c>=0;c--){var f,h=a[c],i=g[h.name];if(!h.unused&&(h.dirty||h.important||h.hack)&&(!b&&i&&i.shorthand?(f=i.restore(h,g),h.value=f):f=h.value,h.important&&d(h),h.hack&&e(h),"all"in h)){var j=h.all[h.position];j[0][0]=h.name,j.splice(1,j.length-1),Array.prototype.push.apply(j,f)}}}var g=a("./compactable"),h="\\9",i="!important",j="*",k="_",l="!ie";b.exports=f},{"./compactable":17}],26:[function(a,b,c){function d(a){for(var b=0,c=a.length;b=0;k--){var m=i[k],n=f(m);if("background-clip"==m.name){var o=i[k-1],p=f(o);g=m.value[0][0]==o.value[0][0],h=!g&&(p&&!n||!p&&!n||!p&&n&&m.value[0][0]!=o.value[0][0]),g?e(o):h&&(e(m),e(o)),k--}else if("background-size"==m.name){var q=i[k-1],r=f(q);g=!r&&n,h=!g&&(r&&!n||!r&&!n),g?e(q):h?(e(m),j.unshift([l]),e(q)):1==q.value.length&&e(q),k--}else{if(n||b[m.name].multiplexLastOnly&&!c)continue;e(m)}}return 0===j.length&&1==a.value.length&&"0"==a.value[0][0]&&j.push(a.value[0]),0===j.length&&j.push([b[a.name].defaultValue]),d(j)?[j[0]]:j}function f(a,b){if(a.multiplex){for(var c=j(a),d=j(a),e=0;e<4;e++){var f=a.components[e],h=j(a);h.value=[f.value[0]],c.components.push(h);var i=j(a);i.value=[f.value[1]||f.value[0]],d.components.push(i)}var k=g(c,b),l=g(d,b);return k.length!=l.length||k[0][0]!=l[0][0]||k.length>1&&k[1][0]!=l[1][0]||k.length>2&&k[2][0]!=l[2][0]||k.length>3&&k[3][0]!=l[3][0]?k.concat([["/"]]).concat(l):k}return g(a,b)}function g(a){var b=a.components,c=b[0].value[0],d=b[1].value[0],e=b[2].value[0],f=b[3].value[0];return c[0]==d[0]&&c[0]==e[0]&&c[0]==f[0]?[c]:c[0]==e[0]&&d[0]==f[0]?[c,d]:d[0]==f[0]?[c,d,e]:[c,d,e,f]}function h(a){return function(b,c){if(!b.multiplex)return a(b,c,!0);var d,e,f=0,g=[],h={};for(d=0,e=b.components[0].value.length;d=0;f--){var g=c[f],h=b[g.name];g.value[0][0]!=h.defaultValue&&e.unshift(g.value[0])}return 0===e.length&&e.push([b[a.name].defaultValue]),d(e)?[e[0]]:e}var j=a("./clone").shallow,k=",",l="/";b.exports={background:e,borderRadius:f,fourValues:g,multiplex:h,withoutDefaults:i}},{"./clone":16}],27:[function(a,b,c){function d(a){var b;for(var c in a){if(void 0!==b&&a[c].important!=b)return!0;b=a[c].important}return!1}function e(a){var b=[];for(var c in a){var d=a[c],e=d.all[d.position],f=e[0][e[0].length-1];Array.isArray(f)&&Array.prototype.push.apply(b,f)}return b}function f(a,b,c,d,f){var g,h=i[c],o=[[c],[h.defaultValue]],p=m(o);p.shorthand=!0,p.dirty=!0,l([p],f,[]);for(var q=0,r=h.components.length;q0&&o[0].push(v)}p.position=g.length,p.all=g,p.all.push(o),a.push(p)}function g(a,b,c,e,g){var h=a[b];for(var j in c)if(void 0===h||j!=h.name){var k=i[j],l=c[j];k.components.length>Object.keys(l).length?delete c[j]:d(l)||f(a,l,j,e,g)}}function h(a,b,c){var d={};if(!(a.length<3)){for(var e=0,f=a.length;e0&&0===a.indexOf("rgba(")&&a.indexOf(")")===a.length-1},d.prototype.isValidHslaColor=function(a){return a=a.split(" ").join(""),a.length>0&&0===a.indexOf("hsla(")&&a.indexOf(")")===a.length-1},d.prototype.isValidNamedColor=function(a){return"auto"!==a&&("transparent"===a||"inherit"===a||/^[a-zA-Z]+$/.test(a))},d.prototype.isValidVariable=function(a){return r.test(a)},d.prototype.isValidColor=function(a){return this.isValidNamedColor(a)||this.isValidColorValue(a)||this.isValidVariable(a)||this.isValidVendorPrefixedValue(a)},d.prototype.isValidColorValue=function(a){return this.isValidHexColor(a)||this.isValidRgbaColor(a)||this.isValidHslaColor(a)},d.prototype.isValidUrl=function(a){return 0===a.indexOf("__ESCAPED_URL_CLEAN_CSS")},d.prototype.isValidUnit=function(a){return v.test(a)},d.prototype.isValidUnitWithoutFunction=function(a){return t.test(a)},d.prototype.isValidAndCompatibleUnit=function(a){return this.compatibleCssUnitAnyRegex.test(a)},d.prototype.isValidAndCompatibleUnitWithoutFunction=function(a){return this.compatibleCssUnitRegex.test(a)},d.prototype.isValidFunctionWithoutVendorPrefix=function(a){return p.test(a)},d.prototype.isValidFunctionWithVendorPrefix=function(a){return q.test(a)},d.prototype.isValidFunction=function(a){return s.test(a)},d.prototype.isValidBackgroundRepeat=function(a){return w.indexOf(a)>=0||this.isValidVariable(a)},d.prototype.isValidBackgroundAttachment=function(a){return x.indexOf(a)>=0||this.isValidVariable(a)},d.prototype.isValidBackgroundBox=function(a){return A.indexOf(a)>=0||this.isValidVariable(a)},d.prototype.isValidBackgroundPositionPart=function(a){return y.indexOf(a)>=0||u.test(a)||this.isValidVariable(a)},d.prototype.isValidBackgroundPosition=function(a){if("inherit"===a)return!0;for(var b=a.split(" "),c=0,d=b.length;c=0||t.test(a)||this.isValidVariable(a)},d.prototype.isValidBackgroundPositionAndSize=function(a){if(a.indexOf("/")<0)return!1;var b=e(a,"/");return this.isValidBackgroundSizePart(b.pop())&&this.isValidBackgroundPositionPart(b.pop())},d.prototype.isValidListStyleType=function(a){return C.indexOf(a)>=0||this.isValidVariable(a)},d.prototype.isValidListStylePosition=function(a){return D.indexOf(a)>=0||this.isValidVariable(a)},d.prototype.isValidStyle=function(a){return this.isValidStyleKeyword(a)||this.isValidVariable(a)},d.prototype.isValidStyleKeyword=function(a){return B.indexOf(a)>=0},d.prototype.isValidWidth=function(a){return this.isValidUnit(a)||this.isValidWidthKeyword(a)||this.isValidVariable(a)},d.prototype.isValidWidthKeyword=function(a){return f.indexOf(a)>=0},d.prototype.isValidVendorPrefixedValue=function(a){return/^-([A-Za-z0-9]|-)*$/gi.test(a)},d.prototype.areSameFunction=function(a,b){if(!this.isValidFunction(a)||!this.isValidFunction(b))return!1;var c=a.substring(0,a.indexOf("(")),d=b.substring(0,b.indexOf("("));return c===d},b.exports=d},{"../utils/split":68}],29:[function(a,b,c){function d(a){for(var b=[],c=0,d=a.length;c=0;c--)if("string"!=typeof a[c][0]){var d=k(a[c]);d.all=a,d.position=c,b.unshift(d)}return b}function e(a){for(var b=1,c=a.length;b0&&!d[0].match(o)?b="bang":d[0].indexOf(l)>0&&d[0].indexOf(l)==d[0].length-l.length-1?b="backslash":0===d[0].indexOf(l)&&2==d[0].length&&(b="backslash"):b="bang",b}function g(a){if(a.length>1){var b=a[a.length-1][0];if("string"==typeof b)return p.test(b)}return!1}function h(a){a.length>0&&(a[a.length-1][0]=a[a.length-1][0].replace(p,""))}function i(a){a[0][0]=a[0][0].substring(1)}function j(a,b){var c=a[a.length-1];c[0]=c[0].substring(0,c[0].indexOf("backslash"==b?l:s)).trim(),0===c[0].length&&a.pop()}function k(a){var b=g(a);b&&h(a);var c=f(a);"star"==c||"underscore"==c?i(a):"backslash"!=c&&"bang"!=c||j(a,c);var d=0===a[0][0].indexOf("--");return{block:d&&a[1]&&Array.isArray(a[1][0][0]),components:[],dirty:!1,hack:c,important:b,name:a[0][0],multiplex:a.length>2&&e(a),position:0,shorthand:!1,unused:a.length<2,value:a.slice(1),variable:d}}var l="\\",m="important",n="!"+m,o=new RegExp(m+"$","i"),p=new RegExp(n+"$","i"),q="*",r="_",s="!";b.exports={all:d,single:k}},{}],31:[function(a,b,c){function d(a){for(var b=0,c=a.length;b=0;r--)g(q[r][2],b,c,!1)}d(a)}var h=a("../properties/optimizer"),i=a("./remove-duplicates"),j=a("./merge-adjacent"),k=a("./reduce-non-adjacent"),l=a("./merge-non-adjacent-by-selector"),m=a("./merge-non-adjacent-by-body"),n=a("./restructure"),o=a("./remove-duplicate-media-queries"),p=a("./merge-media-queries");b.exports=g},{"../properties/optimizer":21,"./merge-adjacent":35,"./merge-media-queries":36,"./merge-non-adjacent-by-body":37,"./merge-non-adjacent-by-selector":38,"./reduce-non-adjacent":39,"./remove-duplicate-media-queries":40,"./remove-duplicates":41,"./restructure":43}],32:[function(a,b,c){function d(a,b){return"["+b.replace(/ /g,"")+"]"}function e(a,b){return a[0]>b[0]?1:-1}function f(a,b,c,d){return b&&c&&d.length?b+c+" ":b&&c?b+c:c}var g={selectors:function(a,b,c){for(var g=[],h=[],i=0,j=a.length;i+~])(\s*)/g,f).trim();c&&l.indexOf("nav")>0&&(l=l.replace(/\+nav(\S|$)/,"+ nav$1")),(!b||l.indexOf("*+html ")==-1&&l.indexOf("*:first-child+html ")==-1)&&(l.indexOf("*")>-1&&(l=l.replace(/\*([:#\.\[])/g,"$1").replace(/^(\:first\-child)?\+html/,"*$1+html")),l.indexOf("[")>-1&&(l=l.replace(/\[([^\]]+)\]/g,d)),h.indexOf(l)==-1&&(k[0]=l,h.push(l),g.push(k)))}return g.sort(e)},selectorDuplicates:function(a){for(var b=[],c=[],d=0,f=a.length;d~]/.test(f(a[1])),i=0,j=a[2].length;i0?"border-radius":"border-collapse"==a||"border-spacing"==a||"border-image"==a?a:0===a.indexOf("border-")&&/^border\-\w+\-\w+$/.test(a)?a.match(/border\-\w+/)[0]:0===a.indexOf("border-")&&/^border\-\w+$/.test(a)?"border":0===a.indexOf("text-")?a:a.replace(/^\-\w+\-/,"").match(/([a-zA-Z]+)/)[0].toLowerCase()}var f=a("../stringifier/one-time").selectors,g=a("../stringifier/one-time").value,h="at-rule";b.exports=d},{"../stringifier/one-time":47}],34:[function(a,b,c){function d(a,b){return a.compatibility.selectors.special.test(b)}b.exports=d},{}],35:[function(a,b,c){function d(a,b,c){for(var d=[null,[],[]],j=b.compatibility.selectors.adjacentSpace,k=0,l=a.length;k=0;d--){var g=a[d];if("block"==g[0]){var h=b[g[1][0]];h||(h=[],b[g[1][0]]=h),h.push(d)}}for(var i in b){var j=b[i];a:for(var k=j.length-1;k>0;k--){var l=j[k],m=a[l],n=j[k-1],o=a[n];b:for(var p=1;p>=-1;p-=2){for(var q=1==p,r=q?l+1:n-1,s=q?n:l,t=q?1:-1,u=q?m:o,v=q?o:m,w=f(u);r!=s;){var x=f(a[r]);if(r+=t,!e(w,x))continue b}v[2]=q?u[2].concat(v[2]):v[2].concat(u[2]),u[2]=[],c.push(v);continue a}}}return c}var e=a("./reorderable").canReorder,f=a("./extractor");b.exports=d},{"./extractor":33,"./reorderable":42}],37:[function(a,b,c){function d(a){return/\.|\*| :/.test(a)}function e(a){var b=j(a[1]);return b.indexOf("__")>-1||b.indexOf("--")>-1}function f(a){return a.replace(/--[^ ,>\+~:]+/g,"")}function g(a,b){var c=f(j(a[1]));for(var d in b){var e=b[d],g=f(j(e[1]));(g.indexOf(c)>-1||c.indexOf(g)>-1)&&delete b[d]}}function h(a,b){for(var c={},f=b.compatibility.selectors.adjacentSpace,h=a.length-1;h>=0;h--){var m=a[h];if("selector"==m[0]){m[2].length>0&&!b.semanticMerging&&d(j(m[1]))&&(c={}),m[2].length>0&&b.semanticMerging&&e(m)&&g(m,c);var n=i(m[2]),o=c[n];!o||l(b,j(m[1]))||l(b,j(o[1]))||(m[1]=m[2].length>0?k(o[1].concat(m[1]),!1,f):o[1].concat(m[1]),o[2]=[],c[n]=null),c[i(m[2])]=m}}}var i=a("../stringifier/one-time").body,j=a("../stringifier/one-time").selectors,k=a("./clean-up").selectors,l=a("./is-special");b.exports=h},{"../stringifier/one-time":47,"./clean-up":32,"./is-special":34}],38:[function(a,b,c){function d(a,b,c){var d,i={},j=[];for(d=a.length-1;d>=0;d--)if("selector"==a[d][0]&&0!==a[d][2].length){var k=f(a[d][1]);i[k]=[d].concat(i[k]||[]),2==i[k].length&&j.push(k)}for(d=j.length-1;d>=0;d--){var l=i[j[d]];a:for(var m=l.length-1;m>0;m--){var n=l[m-1],o=a[n],p=l[m],q=a[p];b:for(var r=1;r>=-1;r-=2){for(var s,t=1==r,u=t?n+1:p-1,v=t?p:n,w=t?1:-1,x=t?o:q,y=t?q:o,z=g(x);u!=v;){var A=g(a[u]);u+=w;var B=t?h(z,A):h(A,z);if(!B&&!t)continue a;if(!B&&t)continue b}t?(s=[x[2].length],Array.prototype.push.apply(x[2],y[2]),y[2]=x[2]):(s=[y[2].length],Array.prototype.push.apply(y[2],x[2])),e(y[1],y[2],s,!0,b,c),x[2]=[]}}}}var e=a("../properties/optimizer"),f=a("../stringifier/one-time").selectors,g=a("./extractor"),h=a("./reorderable").canReorder;b.exports=d},{"../properties/optimizer":21,"../stringifier/one-time":47,"./extractor":33,"./reorderable":42}],39:[function(a,b,c){function d(a,b,c){for(var d={},h=[],i=a.length-1;i>=0;i--){var j=a[i];if("selector"==j[0]&&0!==j[2].length)for(var m=k(j[1]),n=j[1].length>1&&!l(b,m),o=b.sourceMap?e(j[1]):j[1],p=n?[m].concat(o):[m],q=0,r=p.length;q0,isComplex:n&&0===q})}}f(a,h,d,b,c),g(a,d,b,c)}function e(a){for(var b=[],c=0;c=0;l--)if(!d.filterOut(l,g)){var o=c[l].where,p=a[o],q=m(p[2]);g=g.concat(q),h.push(q),k.push(o)}for(l=0,n=h.length;l0&&j.push((j.length>0?j[j.length-1]:0)+h[l].length);i(b,g,j,!1,e,f);for(var r=k.length,s=g.length-1,t=r-1;t>=0;)if((0===t||g[s]&&h[t].indexOf(g[s])>-1)&&s>-1)s--;else{var u=g.splice(s+1);d.callback(a[k[t]],u,r,t),t--}}var i=a("../properties/optimizer"),j=a("../stringifier/one-time").body,k=a("../stringifier/one-time").selectors,l=a("./is-special"),m=a("../utils/clone-array");b.exports=d},{"../properties/optimizer":21,"../stringifier/one-time":47,"../utils/clone-array":61,"./is-special":34}],40:[function(a,b,c){function d(a){for(var b={},c=0,d=a.length;c=0;l--)c=a[h[b][l]],d=e(c[2]),g.indexOf(d)>-1?c[2]=[]:g.push(d)}}var e=a("../stringifier/one-time").body,f=a("../stringifier/one-time").selectors;b.exports=d},{"../stringifier/one-time":47}],42:[function(a,b,c){function d(a,b){for(var c=b.length-1;c>=0;c--)for(var d=a.length-1;d>=0;d--)if(!e(a[d],b[c]))return!1;return!0}function e(a,b){var c=a[0],d=a[1],e=a[2],p=a[5],q=a[6],r=b[0],s=b[1],t=b[2],u=b[5],v=b[6];return!("font"==c&&"line-height"==r||"font"==r&&"line-height"==c)&&((!n.test(c)||!n.test(r))&&(!(e==t&&g(c)==g(r)&&f(c)^f(r))&&(("border"!=e||!o.test(t)||!("border"==c||c==t||d!=s&&h(c,r)))&&(("border"!=t||!o.test(e)||!("border"==r||r==e||d!=s&&h(c,r)))&&(("border"!=e||"border"!=t||c==r||!(i(c)&&j(r)||j(c)&&i(r)))&&(e!=t||(!(c!=r||e!=t||d!=s&&!k(d,s))||(c!=r&&e==t&&c!=e&&r!=t||(c!=r&&e==t&&d==s||!(!v||!q||m(e)||m(t)||!l(u,p)))))))))))}function f(a){return/^\-(?:moz|webkit|ms|o)\-/.test(a)}function g(a){return a.replace(/^\-(?:moz|webkit|ms|o)\-/,"")}function h(a,b){return a.split("-").pop()==b.split("-").pop()}function i(a){return"border-top"==a||"border-right"==a||"border-bottom"==a||"border-left"==a}function j(a){return"border-color"==a||"border-style"==a||"border-width"==a}function k(a,b){return f(a)&&f(b)&&a.split("-")[1]!=b.split("-")[2]}function l(a,b){for(var c=0,d=a.length;cb}function e(a,b){var c=m(a);return c[5]=c[5].concat(b[5]),c}function f(a,b){function c(a,b,c){for(var d=c.length-1;d>=0;d--){var e=c[d][0],g=f(b,e);if(B[g].length>1&&x(a,B[g])){m(g);break}}}function f(a,b){var c=n(b);return B[c]=B[c]||[],B[c].push([a,b]),c}function m(a){var b,c=a.split(E),d=[];for(var e in B){var f=e.split(E);for(b=f.length-1;b>=0;b--)if(c.indexOf(f[b])>-1){d.push(e);break}}for(b=d.length-1;b>=0;b--)delete B[d[b]]}function n(a){for(var b=[],c=0,d=a.length;c=0;e--)l(b,j(a[e][1]))||(d.unshift(a[e]),a[e][2].length>0&&c.indexOf(a[e])==-1&&c.push(a[e]));return c.length>1?d:[]}function p(a,b){var d=b[0],e=b[1],f=b[4],g=d.length+e.length+1,h=[],i=[],j=o(z[f]);if(!(j.length<2)){var l=r(j,g,1),m=l[0];if(m[1]>0)return c(a,b,l);for(var n=m[0].length-1;n>=0;n--)h=m[0][n][1].concat(h),i.unshift(m[0][n]);h=k(h),u(a,[b],h,i)}}function q(a,b){return a[1]>b[1]}function r(a,b,c){var d=s(a,b,c,D-1);return d.sort(q)}function s(a,b,c,d){var e=[[a,t(a,b,c)]];if(a.length>2&&d>0)for(var f=a.length-1;f>=0;f--){var g=Array.prototype.slice.call(a,0);g.splice(f,1),e=e.concat(s(g,b,c,d-1))}return e}function t(a,b,c){for(var d=0,e=a.length-1;e>=0;e--)d+=a[e][2].length>c?j(a[e][1]).length:-1;return d-(a.length-1)*b+1}function u(b,c,d,e){var f,g,h,j,k=[];for(f=e.length-1;f>=0;f--){var l=e[f];for(g=l[2].length-1;g>=0;g--){var m=l[2][g];for(h=0,j=c.length;h=0;f--)k.unshift(c[f][3]);var r=["selector",d,k];a.splice(b,0,r)}function v(a,b){var c=b[4],d=z[c];d&&d.length>1&&(w(a,b)||p(a,b))}function w(a,b){var c,d,e=[],f=[],g=b[4],h=o(z[g]);if(!(h.length<2)){a:for(var i in z){var j=z[i];for(c=h.length-1;c>=0;c--)if(j.indexOf(h[c])==-1)continue a;e.push(i)}if(e.length<2)return!1;for(c=e.length-1;c>=0;c--)for(d=A.length-1;d>=0;d--)if(A[d][4]==e[c]){f.unshift([A[d],h]);break}return x(a,f)}}function x(a,b){for(var c,d=0,e=[],f=b.length-1;f>=0;f--){c=b[f][0];var g=c[4];d+=g.length+(f>0?1:0),e.push(c)}var h=b[0][1],i=r(h,d,e.length)[0];if(i[1]>0)return!1;var j=[],l=[];for(f=i[0].length-1;f>=0;f--)j=i[0][f][1].concat(j),l.unshift(i[0][f]);for(j=k(j),u(a,e,j,l),f=e.length-1;f>=0;f--){c=e[f];var m=A.indexOf(c);delete z[c[4]],m>-1&&C.indexOf(m)==-1&&C.push(m)}return!0}function y(a,b,c){var d=a[0],e=b[0];if(d!=e)return!1;var f=b[4],g=z[f];return g&&g.indexOf(c)>-1}for(var z={},A=[],B={},C=[],D=2,E="%",F=a.length-1;F>=0;F--){var G,H,I,J,K,L=a[F];if("selector"==L[0])G=!0;else{if("block"!=L[0])continue;G=!1}var M=A.length,N=g(L);C=[];var O=[];for(H=N.length-1;H>=0;H--)for(I=H-1;I>=0;I--)if(!h(N[H],N[I])){O.push(H);break}for(H=N.length-1;H>=0;H--){var P=N[H],Q=!1;for(I=0;I-1)){var S=P[4];z[S]=z[S]||[],z[S].push(L),Q?A[K]=e(A[K],P):A.push(P)}}for(C=C.sort(d),H=0,J=C.length;H-1&&(b=b.replace(/([^\w\d\-]|^)\-0([^\.]|$)/g,"$10$2").replace(/([^\w\d\-]|^)\-0([^\.]|$)/g,"$10$2")),b.replace(/(^|\s)0+([1-9])/g,"$1$2").replace(/(^|\D)\.0+(\D|$)/g,"$10$2").replace(/(^|\D)\.0+(\D|$)/g,"$10$2").replace(/\.([1-9]*)0+(\D|$)/g,function(a,b,c){return(b.length>0?".":"")+b+c}).replace(/(^|\D)0\.(\d)/g,"$1.$2"))}function f(a,b){return b.indexOf("0deg")==-1?b:b.replace(/\(0deg\)/g,"(0)")}function g(a,b){return a.indexOf("filter")>-1||b.indexOf(" ")==-1?b:(b=b.replace(/\s+/g," "),b.indexOf("calc")>-1&&(b=b.replace(/\) ?\/ ?/g,")/ ")),b.replace(/\( /g,"(").replace(/ \)/g,")").replace(/, /g,","))}function h(a,b,c){return c.value===-1||b.indexOf(".")===-1?b:b.replace(c.regexp,function(a,b){return Math.round(parseFloat(b)*c.multiplier)/c.multiplier+"px"}).replace(/(\d)\.($|\D)/g,"$1$2")}function i(a,b,c){return/^(?:\-moz\-calc|\-webkit\-calc|calc)\(/.test(b)?b:"flex"==a||"-ms-flex"==a||"-webkit-flex"==a||"flex-basis"==a||"-webkit-flex-basis"==a?b:b.indexOf("%")>0&&("height"==a||"max-height"==a)?b:b.replace(c,"$10$2").replace(c,"$10$2")}function j(a){var b,c=a.value;4==c.length&&"0"===c[0][0]&&"0"===c[1][0]&&"0"===c[2][0]&&"0"===c[3][0]&&(b=a.name.indexOf("box-shadow")>-1?2:1),b&&(a.value.splice(b),a.dirty=!0)}function k(a,b,c){return b.indexOf("#")===-1&&b.indexOf("rgb")==-1&&b.indexOf("hsl")==-1?B.shorten(b):(b=b.replace(/rgb\((\-?\d+),(\-?\d+),(\-?\d+)\)/g,function(a,b,c,d){return new z(b,c,d).toHex()}).replace(/hsl\((-?\d+),(-?\d+)%?,(-?\d+)%?\)/g,function(a,b,c,d){return new A(b,c,d).toHex()}).replace(/(^|[^='"])#([0-9a-f]{6})/gi,function(a,b,c){return c[0]==c[1]&&c[2]==c[3]&&c[4]==c[5]?b+"#"+c[0]+c[2]+c[4]:b+"#"+c}).replace(/(rgb|rgba|hsl|hsla)\(([^\)]+)\)/g,function(a,b,c){var d=c.split(","),e="hsl"==b&&3==d.length||"hsla"==b&&4==d.length||"rgb"==b&&3==d.length&&c.indexOf("%")>0||"rgba"==b&&4==d.length&&c.indexOf("%")>0;return e?(d[1].indexOf("%")==-1&&(d[1]+="%"),d[2].indexOf("%")==-1&&(d[2]+="%"),b+"("+d.join(",")+")"):a}),c.colors.opacity&&a.indexOf("background")==-1&&(b=b.replace(/(?:rgba|hsla)\(0,0%?,0%?,0\)/g,function(a){return y(b,",").pop().indexOf("gradient(")>-1?a:"transparent"})),B.shorten(b))}function l(a,b,c){return L.test(b)?b.replace(L,function(a,b){var d,e=parseInt(b);return 0===e?a:(c.properties.shorterLengthUnits&&c.units.pt&&3*e%4===0&&(d=3*e/4+"pt"),c.properties.shorterLengthUnits&&c.units.pc&&e%16===0&&(d=e/16+"pc"),c.properties.shorterLengthUnits&&c.units.in&&e%96===0&&(d=e/96+"in"),d&&(d=a.substring(0,a.indexOf(b))+d),d&&d.length-1||b[1]&&I.indexOf(b[1][0])>-1||b[2]&&I.indexOf(b[2][0])>-1;if(!c&&"/"!=b[1]){var d=0;if("normal"==b[0][0]&&d++,b[1]&&"normal"==b[1][0]&&d++,b[2]&&"normal"==b[2][0]&&d++,!(d>1)){var e;K.indexOf(b[0][0])>-1?e=0:b[1]&&K.indexOf(b[1][0])>-1?e=1:b[2]&&K.indexOf(b[2][0])>-1?e=2:J.indexOf(b[0][0])>-1?e=0:b[1]&&J.indexOf(b[1][0])>-1?e=1:b[2]&&J.indexOf(b[2][0])>-1&&(e=2),void 0!==e&&(a.value[e][0]=N["font-weight"](b[e][0]),a.dirty=!0)}}}function q(a,b){for(var c,r,s,t=C(a),u=0,v=t.length;u0?n(c):"filter"==r?o(c):"font"==r&&p(c)}D(t,!0),E(t)}function r(a){for(var b=!1,c=0,d=a.length;c0?0:b.column,b.column+=/^(\s)*/.exec(e[d])[0].length,a.substring(g).trimLeft()}function e(a,b,c){var d=a.source||b.source;return d&&c.resolvePath?c.resolvePath(b.source,d):d}function f(a,b,c){var d={line:b.line,column:b.column,source:b.source},f=null,g=b.sourceMapTracker.isTracking(d.source)?b.sourceMapTracker.originalPositionFor(d,a,c||0):{};if(d.line=g.line||d.line,d.column=g.column||d.column,d.source=g.sourceResolved?g.source:e(g,d,b),b.sourceMapInlineSources){var h=b.sourceMapTracker.sourcesContentFor(b.source);f=h&&h[d.source]?h:b.sourceReader.sourceAt(b.source)}return f?[d.line,d.column,d.source,f]:[d.line,d.column,d.source]}function g(a,b){for(var c=a.split("\n"),d=0,e=c.length;d0&&(b.line++,b.column=0);;){var h=f.indexOf(i,g);if(h==-1){b.column+=f.substring(g).length; -break}b.column+=h-g,g+=h-g;var j=f.substring(h,f.indexOf("__",h+1)+2),k=j.substring(j.indexOf("(")+1,j.indexOf(")")).split(",");b.line+=~~k[0],b.column=(0===~~k[0]?b.column:0)+~~k[1],g+=j.length}}}function h(a,b,c,e){var h=d(a,b,c),i=c?f(h,b,e):[];return h&&g(h,b),i}var i="__ESCAPED_";b.exports=h},{}],46:[function(a,b,c){function d(a,b){for(var c=b,d=a.length;c-1&&(d=b.restore(d,e(b.output))),f(d,c?null:a,b),b.output.push(d)}function e(a){for(var b=[],c=a.length-1;c>=0;c--){var d=a[c];if(b.unshift(d),"{"==d||";"==d)break}return b.join("")}function f(a,b,c){b&&g(b,c);var d=a.split("\n");c.line+=d.length-1,c.column=d.length>1?0:c.column+d.pop().length}function g(a,b){var c=a[a.length-1];if(Array.isArray(c))for(var d=0,e=c.length;da)return!0;return!1}}function f(a,b,c,d){for(var e=[],f=0;f0?e.join("")+b.substring(f,b.length):b}var g=a("./escape-store"),h=a("../utils/quote-scanner"),i="/*!",j="/*",k="*/",l=a("os").EOL;d.prototype.escape=function(a){for(var b,c,d,f=[],g=0,h=0,m=0,n=0,o=e(a),p=this.saveWaypoints;h0?q.substring(c+l.length).length:n+q.length),p||r){var s=p?[b,d]:null,t=r?this.specialComments.store(q,s):this.comments.store(q,s);f.push(t)}p&&(n=d+1),m=h+k.length}return f.length>0?f.join("")+a.substring(m,a.length):a},d.prototype.restore=function(a){return a=f(this,a,this.comments,!1),a=f(this,a,this.specialComments,!0)},b.exports=d},{"../utils/quote-scanner":65,"./escape-store":51,os:78}],51:[function(a,b,c){function d(a){this.placeholderRoot="ESCAPED_"+a+"_CLEAN_CSS",this.placeholderToData={},this.dataToPlaceholder={},this.count=0,this.restoreMatcher=new RegExp(this.placeholderRoot+"(\\d+)")}var e="__";d.prototype._nextPlaceholder=function(a){return{index:this.count,value:e+this.placeholderRoot+this.count++ +a+e}},d.prototype.store=function(a,b){var c=b?"("+b.join(",")+")":"",d=this.dataToPlaceholder[a];if(!d){var e=this._nextPlaceholder(c);d=e.value,this.placeholderToData[e.index]=a,this.dataToPlaceholder[a]=e.value}return b&&(d=d.replace(/\([^\)]+\)/,c)),d},d.prototype.nextMatch=function(a,b){var c={};return c.start=a.indexOf(this.placeholderRoot,b)-e.length,c.end=a.indexOf(e,c.start+e.length)+e.length,c.start>-1&&c.end>-1&&(c.match=a.substring(c.start,c.end)),c},d.prototype.restore=function(a){var b=this.restoreMatcher.exec(a)[1];return this.placeholderToData[b]},b.exports=d},{}],52:[function(a,b,c){function d(a,b){for(var c=b+g.length,d=0,e=!1,f=!1;;){var j=a[c++];if(e?e="'"!=j&&'"'!=j:(e="'"==j||'"'==j,j==h&&d++,j==i&&d--,j==k&&(f=!0),j!=l||f||1!=d||(c--,d--)),0===d&&j==i)break;if(!j){c=a.substring(0,c).lastIndexOf(l);break}}return c}function e(a){this.expressions=new f("EXPRESSION"),this.saveWaypoints=a}var f=a("./escape-store"),g="expression",h="(",i=")",j=g+h,k="{",l="}",m=a("os").EOL;e.prototype.escape=function(a){for(var b,c,e,f=0,g=0,h=0,i=[],k=0,l=this.saveWaypoints;g0?n.substring(c+m.length).length:k+n.length);var o=l?[b,e]:null,p=this.expressions.store(n,o);i.push(a.substring(h,f)),i.push(p),l&&(k=e+1),h=g}return i.length>0?i.join("")+a.substring(h,a.length):a},e.prototype.restore=function(a){for(var b=[],c=0;c0?b.join("")+a.substring(c,a.length):a},b.exports=e},{"./escape-store":51,os:78}],53:[function(a,b,c){function d(a){this.matches=new f("FREE_TEXT"),this.saveWaypoints=a}function e(a,b,c,d){var e=b;c&&(e=c+b.substring(0,b.indexOf("__ESCAPED_FREE_TEXT_CLEAN_CSS")),d=e.length);var f=e.lastIndexOf(";",d),g=e.lastIndexOf("{",d),h=0;h=f>-1&&g>-1?Math.max(f,g):f==-1?g:f;var i=e.substring(h+1,d);if(/\[[\w\d\-]+[\*\|\~\^\$]?=$/.test(i)&&(a=a.replace(/\\\n|\\\r\n/g,"").replace(/\n|\r\n/g,"")),/^['"][a-zA-Z][a-zA-Z\d\-_]+['"]$/.test(a)&&!/format\($/.test(i)){var j=/^(font|font\-family):/.test(i),k=/\[[\w\d\-]+[\*\|\~\^\$]?=$/.test(i),l=/@(-moz-|-o-|-webkit-)?keyframes /.test(i),m=/^(-moz-|-o-|-webkit-)?animation(-name)?:/.test(i);(j||k||l||m)&&(a=a.substring(1,a.length-1))}return a}var f=a("./escape-store"),g=a("../utils/quote-scanner"),h=a("os").EOL;d.prototype.escape=function(a){var b,c,d,e,f=this,i=this.saveWaypoints;return new g(a).each(function(a,g){i&&(b=a.split(h).length-1,c=a.lastIndexOf(h),d=c>0?a.substring(c+h.length).length:a.length,e=[b,d]);var j=f.matches.store(a,e);g.push(j)})},d.prototype.restore=function(a,b){for(var c=[],d=0;d0?c.join("")+a.substring(d,a.length):a},b.exports=d},{"../utils/quote-scanner":65,"./escape-store":51,os:78}],54:[function(a,b,c){function d(a,b,c){this.urls=new f("URL"),this.context=a,this.saveWaypoints=b,this.keepUrlQuotes=c}function e(a,b){return a=a.replace(/^url/gi,"url").replace(/\\?\n|\\?\r\n/g,"").replace(/(\s{2,}|\s)/g," ").replace(/^url\((['"])? /,"url($1").replace(/ (['"])?\)$/,"$1)"),/url\(".*'.*"\)/.test(a)||/url\('.*".*'\)/.test(a)?a:(b||/^['"].+['"]$/.test(a)||/url\(.*[\s\(\)].*\)/.test(a)||/url\(['"]data:[^;]+;charset/.test(a)||(a=a.replace(/["']/g,"")),a)}var f=a("./escape-store"),g=a("../urls/reduce"),h=a("os").EOL;d.prototype.escape=function(a){var b,c,d,e=this.saveWaypoints,f=this;return g(a,this.context,function(a,g){e&&(b=a.split(h).length-1,c=a.lastIndexOf(h),d=c>0?a.substring(c+h.length).length:a.length);var i=f.urls.store(a,e?[b,d]:null);g.push(i)})},d.prototype.restore=function(a){for(var b=[],c=0;c0?b.join("")+a.substring(c,a.length):a},b.exports=d},{"../urls/reduce":59,"./escape-store":51,os:78}],55:[function(a,b,c){function d(a){return a[0]}function e(){}function f(a,b,c,d){for(var f=c?/^__ESCAPED_COMMENT_/:/__ESCAPED_COMMENT_/,g=c?d.track:e;f.test(a);){var h=a.indexOf("__"),i=a.indexOf("__",h+1)+2,j=a.substring(h,i);a=a.substring(0,h)+a.substring(i),g(j),b.push(j)}return a}function g(a,b,c){return f(a,b,!0,c)}function h(a,b,c){return f(a,b,!1,c)}function i(a,b,c){for(var d=0,e=a.length;d-1&&(a=a.replace(/\)([^\s_;:,\)])/g,c.sourceMap?") __ESCAPED_COMMENT_CLEAN_CSS(0,-1)__ $1":") $1")),a.indexOf("ESCAPED_URL_CLEAN_CSS")>-1&&(a=a.replace(/(ESCAPED_URL_CLEAN_CSS[^_]+?__)/g,c.sourceMap?"$1 __ESCAPED_COMMENT_CLEAN_CSS(0,-1)__ ":"$1 "));for(var s=k(a,";",!1,"{","}"),t=0,u=s.length;t0&&v.indexOf("{")-1&&(z=g(z,e,c)),z.indexOf("__ESCAPED_COMMENT")>-1&&(z=h(z,f,c)),y.push([z.trim()].concat(c.track(z,!0))),c.track(":"),i(f,e,c);var A=v.indexOf("{"),B=0===z.trim().indexOf("--");if(B&&A>0){var C=v.substring(w+1,A+1),D=v.substring(v.indexOf("}")),E=v.substring(A+1,v.length-D.length);c.track(C),y.push(j(E,b,c)),e.push(y),c.track(D),c.track(t1&&(K==l||K==m);if(L&&(J=J.substring(0,J.length-1)),J.indexOf("__ESCAPED_COMMENT_CLEAN_CSS(0,-")>-1)c.track(J);else if(f=[],J.indexOf("__ESCAPED_COMMENT")>-1&&(J=g(J,e,c)),J.indexOf("__ESCAPED_COMMENT")>-1&&(J=h(J,f,c)),0!==J.length){var M=y.length-1;q.test(J)&&"!"==y[M][0]?(c.track(J),y[M-1][0]+=p,y.pop()):r.test(J)||q.test(J)&&"!"==y[M][0][y[M][0].length-1]?(c.track(J),y[M][0]+=J):(y.push([J].concat(c.track(I,!0))),i(f,e,c),L&&(y.push([K]),c.track(K)))}else i(f,e,c)}}t-1&&e.push(v.trim())}return e}var k=a("../utils/split"),l=",",m="/",n="at-rule",o="important",p="!"+o,q=new RegExp("^"+o+"$","i"),r=new RegExp("^"+p+"$","i");b.exports=j},{"../utils/split":68}],56:[function(a,b,c){function d(a,b){for(var c,d=[],f=e(a,","),g=0,h=f.length;g-1&&a.cursor>0&&!/\s|\{|\}|\/|_|,|;/.test(d.substring(e-1,e))&&(e=-1),f>-1&&/\S/.test(d.substring(a.cursor,f))&&(f=-1),b=e,(b==-1||f>-1&&f-1&&g-1&&h0&&("body"==a.mode?a.warnings.push("Missing '}' after '"+k+"'. Ignoring."):e.push(["text",[k]]),a.cursor+=k.length);break}var l,m,o=f[0],p=f[1];if(d=a.chunk,a.cursor!=o&&"bodyEnd"!=p){var q=d.substring(a.cursor,o),r=/^\s+/.exec(q);r&&(a.cursor+=r[0].length,a.track(r[0]))}if("special"==p){var s=d.indexOf("{",o),t=d.indexOf(";",o),u=t>-1&&(s==-1||t-1;o-1&&(e=f),'"'==a[e+h.length]?o=a.indexOf(l,e):"'"==a[e+h.length]?o=a.indexOf(k,e):(p=m.test(a.substring(e+h.length)),p?(d=g(a.substring(e),n,!1,"(",")",!0).pop(),o=d&&d[d.length-1]==j?e+d.length-j.length:-1):o=a.indexOf(j,e)),o==-1?(o=a.indexOf("}",e),o==-1?o=a.length:o--,b.warnings.push("Broken URL declaration: '"+a.substring(e,o+1)+"'.")):a[o]!=j&&(o=a.indexOf(j,o)),r.push(a.substring(q,e));var t=a.substring(e,o+1);c(t,r),q=o+1}return r.length>0?r.join("")+a.substring(q,a.length):a}function e(a,b,c){for(var d,e,f=0,g=0,h=0,i=0,j=0,k=[],l=0,m=0,n="'",r='"';i-1&&g>-1&&g-1&&m>-1&&l-1&&m>-1&&l>m)h=m,e=r;else if(l>-1)h=l,e=n;else{if(!(m>-1))break;h=m,e=r}if(k.push(a.substring(j,h)),i=a.indexOf(e,h+1),d=a.substring(f,i),i==-1||/^@import\s+(url\(|__ESCAPED)/i.test(d)||q.test(d)){j=h;break}var s=a.substring(h,i+1);c(s,k),j=i+1}return k.length>0?k.join("")+a.substring(j,a.length):a}function f(a,b,c){return a=d(a,b,c),a=e(a,b,c)}var g=a("../utils/split"),h="url(",i="URL(",j=")",k="')",l='")',m=/^\s*['"]?\s*data:/,n=/[\s\};,\/!]/,o="@import",p="@IMPORT",q=/\*\//;b.exports=f},{"../utils/split":68}],60:[function(a,b,c){(function(c){function d(a){return"/"==a[0]}function e(a){return"#"==a[0]}function f(a){return 0===a.indexOf("__ESCAPED_URL_CLEAN_CSS__")}function g(a){return/^\w+:\w+/.test(a)}function h(a){return/^[^:]+?:\/\//.test(a)||0===a.indexOf("//")}function i(a,b){return s.parse(a).protocol==s.parse(b).protocol&&s.parse(a).host==s.parse(b).host}function j(a){return a.lastIndexOf(".css")===a.length-4}function k(a){return 0===a.indexOf("data:")}function l(a,b){return r.resolve(r.join(b.fromBase||"",a)).replace(b.toBase,"")}function m(a,b){return r.relative(b.toBase,r.join(b.fromBase||"",a))}function n(a){return u?a.replace(/\\/g,"/"):a}function o(a,b){return d(a)||e(a)||f(a)||g(a)?a:b.rebase!==!1||j(a)?!b.imports&&j(a)?a:k(a)?"'"+a+"'":h(a)&&!h(b.toBase)?a:h(a)&&!i(a,b.toBase)?a:!h(a)&&h(b.toBase)?s.resolve(b.toBase,a):n(b.absolute?l(a,b):m(a,b)):a}function p(a){return a.indexOf("'")>-1?'"':a.indexOf('"')>-1?"'":/\s/.test(a)||/[\(\)]/.test(a)?"'":""}function q(a,b,c){return t(a,c,function(a,c){var d,e=a.replace(/^(url\()?\s*['"]?|['"]?\s*\)?$/g,""),f=a.match(/^(url\()?\s*(['"]).*?(['"])\s*\)?$/);d=b.urlQuotes&&f&&f[2]===f[3]?f[2]:p(e),c.push("url("+d+o(e,b)+d+")")})}var r=a("path"),s=a("url"),t=a("./reduce"),u="win32"==c.platform;b.exports=q}).call(this,a("_process"))},{"./reduce":59,_process:81,path:79,url:139}],61:[function(a,b,c){function d(a){for(var b=a.slice(0),c=0,e=b.length;c-1&&(f=k.index),l.index>-1&&l.index-1&&m.index299)return d(a.statusCode);var b=[];a.on("data",function(a){b.push(a.toString())}),a.on("end",function(){c(b.join(""))})}).on("error",function(a){g||(d(a.message),g=!0)}).on("timeout",function(){g||(d("timeout"),g=!0)}).setTimeout(a.timeout)}function l(a,b,c,d,e){for(var f,g=d.length,h={line:b,column:c+g};g-- >0&&(h.column--,!(f=a.data.originalPositionFor(h))););return null===f.line&&b>1&&e>0?l(a,b-1,c,d,e-1):(a.path&&f.source&&(f.source=w.test(a.path)?t.resolve(a.path,f.source):q.join(a.path,f.source),f.sourceResolved=!0),f)}function m(a,b){var c=a.maps[b].data,d=w.test(b),e={};c.sources.forEach(function(f,g){var h=d?t.resolve(q.dirname(b),f):q.relative(a.relativeTo,q.resolve(q.dirname(b||"."),f));e[h]=c.sourcesContent&&c.sourcesContent[g]}),a.sourcesContent[b]=e}function n(a,b,c){function d(){return n(a,b,c)}if(0===b.length)return c();var e=b.shift(),f=e[0],g=e[1],h=w.test(f);if(h&&a.localOnly)return a.warnings.push('No callback given to `#minify` method, cannot fetch a remote file from "'+g+'"'),d();if(!h){var i=q.join(a.options.root,g);return p.existsSync(i)?a.sourcesContent[f][g]=p.readFileSync(i,"utf-8"):a.warnings.push('Missing original source file at "'+i+'".'),d()}k(a,g,function(b){a.sourcesContent[f][g]=b,d()},function(b){a.warnings.push('Broken original source file at "'+g+'" - '+b),d()})}var o=a("source-map").SourceMapConsumer,p=a("fs"),q=a("path"),r=a("http"),s=a("https"),t=a("url"),u=a("../utils/object.js").override,v=/\/\*# sourceMappingURL=(\S+) \*\//,w=/^(https?:)?\/\//,x=/^data:(\S*?)?(;charset=[^;]+)?(;[^,]+?)?,(.+)/,y=d.unescape;f.prototype.track=function(a,b){return"string"==typeof this.options.sourceMap?g(this,a,b):h(this,a,b,{files:[],cursor:0,errors:this.errors})},f.prototype.trackLoaded=function(a,b,c){var d=this.options.explicitTarget?this.options.target:this.options.root,e=w.test(a);b&&(b=e?q.dirname(b):q.dirname(q.relative(d,b))),this.maps[a]={path:b,data:new o(c)},m(this,a)},f.prototype.isTracking=function(a){return!!this.maps[a]},f.prototype.originalPositionFor=function(a,b,c){return l(this.maps[a.source],a.line,a.column,b,c)},f.prototype.sourcesContentFor=function(a){return this.sourcesContent[a]},f.prototype.resolveSources=function(a){var b=[];for(var c in this.sourcesContent){var d=this.sourcesContent[c];for(var e in d)d[e]||b.push([c,e])}return n(this,b,a)},b.exports=f}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},a("buffer").Buffer)},{"../utils/object.js":64,_process:81,buffer:6,fs:4,http:121,https:72,path:79,"source-map":110,url:139}],64:[function(a,b,c){b.exports={override:function(a,b){var c={};for(var d in a)c[d]=a[d];for(var e in b)c[e]=b[e];return c}}},{}],65:[function(a,b,c){function d(a){this.data=a}function e(a,b){for(var c=b;c>-1&&(c=a.lastIndexOf(g,c),!(c>-1&&"*"!=a[c-1]));)c--;return c}function f(a,b,c){for(var d="\\",e=c;;){if(e=a.indexOf(b,e+1),e==-1)return-1;if(a[e-1]!=d)return e}}var g="/*",h=function(a,b,c,d){var f="*/",g="\\",h="}",i=a.substring(d,c),j=i.lastIndexOf(f,c),k=e(i,c),l=!1;if(j>=c&&k>-1&&(l=!0),kj&&(l=!0),l){var m=a.indexOf(f,c);return m>-1?m:(m=a.indexOf(h,c),m>-1?m-1:a.length)}for(;;){if(void 0===a[c])break;if(a[c]==b&&(a[c-1]!=g||a[c-2]==g))break;c++}return c};d.prototype.each=function(a){for(var b=this.data,c=[],d=0,e=0,g=0,i=null,j="'",k='"',l=b.length;e0&&a(o,c,d),g=e+1}return c.length>0?c.join("")+b.substring(g,b.length):b},b.exports=d},{}],66:[function(a,b,c){(function(c){function d(a,b){this.outerContext=a,this.data=b,this.sources={}}function e(a){var b=a.data;return a.trackSource(void 0,b),b}function f(a){var b=a.data.toString();return a.trackSource(void 0,b),b}function g(a){return a.data.map(function(b){return a.outerContext.options.processImport===!1?b+"@shallow":b}).map(function(b){return!a.outerContext.options.relativeTo||/^https?:\/\//.test(b)?b:i.relative(a.outerContext.options.relativeTo,b)}).map(function(a){return"@import url("+a+");"}).join("")}function h(a){var b=[],c=i.resolve(a.outerContext.options.target||a.outerContext.options.root);for(var d in a.data){var e=a.data[d].styles,f=a.data[d].sourceMap,g=k.test(d),h=g?d:i.resolve(d),l=i.dirname(h),m={absolute:a.outerContext.options.explicitRoot,relative:!a.outerContext.options.explicitRoot,imports:!0,rebase:a.outerContext.options.rebase,fromBase:l,toBase:g?l:c,urlQuotes:a.outerContext.options.compatibility.properties.urlQuotes};e=j(e,m,a.outerContext),a.trackSource(d,e),e=a.outerContext.sourceTracker.store(d,e),a.outerContext.options.sourceMap&&f&&a.outerContext.inputSourceMapTracker.trackLoaded(d,d,f),b.push(e)}return b.join("")}var i=a("path"),j=a("../urls/rewrite"),k=/^(https?:)?\/\//;d.prototype.sourceAt=function(a){return this.sources[a]},d.prototype.trackSource=function(a,b){this.sources[a]={},this.sources[a][a]=b},d.prototype.toString=function(){return"string"==typeof this.data?e(this):c.isBuffer(this.data)?f(this):Array.isArray(this.data)?g(this):h(this)},b.exports=d}).call(this,{isBuffer:a("../../../is-buffer/index.js")})},{"../../../is-buffer/index.js":75,"../urls/rewrite":60,path:79}],67:[function(a,b,c){function d(){this.sources=[]}d.prototype.store=function(a,b){return this.sources.push(a),"__ESCAPED_SOURCE_CLEAN_CSS"+(this.sources.length-1)+"__"+b+"__ESCAPED_SOURCE_END_CLEAN_CSS__"},d.prototype.nextStart=function(a){var b=/__ESCAPED_SOURCE_CLEAN_CSS(\d+)__/.exec(a);return b?{index:b.index,filename:this.sources[~~b[1]]}:null},d.prototype.nextEnd=function(a){return/__ESCAPED_SOURCE_END_CLEAN_CSS__/g.exec(a)},d.prototype.removeAll=function(a){return a.replace(/__ESCAPED_SOURCE_CLEAN_CSS\d+__/g,"").replace(/__ESCAPED_SOURCE_END_CLEAN_CSS__/g,"")},b.exports=d},{}],68:[function(a,b,c){function d(a,b,c,d,e,f){var g="string"!=typeof b,h=g?b.test(a):a.indexOf(b);if(!h)return[a];if(d=d||"(",e=e||")",a.indexOf(d)==-1&&!c&&!f)return a.split(b);for(var i=0,j=0,k=0,l=a.length,m=[];j0&&j+10&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),"function"==typeof console.trace&&console.trace())),this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){function c(){this.removeListener(a,c),d||(d=!0,b.apply(this,arguments))}if(!e(b))throw TypeError("listener must be a function");var d=!1;return c.listener=b,this.on(a,c),this},d.prototype.removeListener=function(a,b){var c,d,f,h;if(!e(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],f=c.length,d=-1,c===b||e(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(g(c)){for(h=f;h-- >0;)if(c[h]===b||c[h].listener&&c[h].listener===b){d=h;break}if(d<0)return this;1===c.length?(c.length=0,delete this._events[a]):c.splice(d,1),this._events.removeListener&&this.emit("removeListener",a,b)}return this},d.prototype.removeAllListeners=function(a){var b,c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(c=this._events[a],e(c))this.removeListener(a,c);else if(c)for(;c.length;)this.removeListener(a,c[c.length-1]);return delete this._events[a],this},d.prototype.listeners=function(a){var b;return b=this._events&&this._events[a]?e(this._events[a])?[this._events[a]]:this._events[a].slice():[]},d.prototype.listenerCount=function(a){if(this._events){var b=this._events[a];if(e(b))return 1;if(b)return b.length}return 0},d.listenerCount=function(a,b){return a.listenerCount(b)}},{}],71:[function(a,b,c){(function(a){!function(d){var e="object"==typeof c&&c,f="object"==typeof b&&b&&b.exports==e&&b,g="object"==typeof a&&a;g.global!==g&&g.window!==g||(d=g);var h=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,i=/[\x01-\x7F]/g,j=/[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,k=/<\u20D2|=\u20E5|>\u20D2|\u205F\u200A|\u219D\u0338|\u2202\u0338|\u2220\u20D2|\u2229\uFE00|\u222A\uFE00|\u223C\u20D2|\u223D\u0331|\u223E\u0333|\u2242\u0338|\u224B\u0338|\u224D\u20D2|\u224E\u0338|\u224F\u0338|\u2250\u0338|\u2261\u20E5|\u2264\u20D2|\u2265\u20D2|\u2266\u0338|\u2267\u0338|\u2268\uFE00|\u2269\uFE00|\u226A\u0338|\u226A\u20D2|\u226B\u0338|\u226B\u20D2|\u227F\u0338|\u2282\u20D2|\u2283\u20D2|\u228A\uFE00|\u228B\uFE00|\u228F\u0338|\u2290\u0338|\u2293\uFE00|\u2294\uFE00|\u22B4\u20D2|\u22B5\u20D2|\u22D8\u0338|\u22D9\u0338|\u22DA\uFE00|\u22DB\uFE00|\u22F5\u0338|\u22F9\u0338|\u2933\u0338|\u29CF\u0338|\u29D0\u0338|\u2A6D\u0338|\u2A70\u0338|\u2A7D\u0338|\u2A7E\u0338|\u2AA1\u0338|\u2AA2\u0338|\u2AAC\uFE00|\u2AAD\uFE00|\u2AAF\u0338|\u2AB0\u0338|\u2AC5\u0338|\u2AC6\u0338|\u2ACB\uFE00|\u2ACC\uFE00|\u2AFD\u20E5|[\xA0-\u0113\u0116-\u0122\u0124-\u012B\u012E-\u014D\u0150-\u017E\u0192\u01B5\u01F5\u0237\u02C6\u02C7\u02D8-\u02DD\u0311\u0391-\u03A1\u03A3-\u03A9\u03B1-\u03C9\u03D1\u03D2\u03D5\u03D6\u03DC\u03DD\u03F0\u03F1\u03F5\u03F6\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E\u045F\u2002-\u2005\u2007-\u2010\u2013-\u2016\u2018-\u201A\u201C-\u201E\u2020-\u2022\u2025\u2026\u2030-\u2035\u2039\u203A\u203E\u2041\u2043\u2044\u204F\u2057\u205F-\u2063\u20AC\u20DB\u20DC\u2102\u2105\u210A-\u2113\u2115-\u211E\u2122\u2124\u2127-\u2129\u212C\u212D\u212F-\u2131\u2133-\u2138\u2145-\u2148\u2153-\u215E\u2190-\u219B\u219D-\u21A7\u21A9-\u21AE\u21B0-\u21B3\u21B5-\u21B7\u21BA-\u21DB\u21DD\u21E4\u21E5\u21F5\u21FD-\u2205\u2207-\u2209\u220B\u220C\u220F-\u2214\u2216-\u2218\u221A\u221D-\u2238\u223A-\u2257\u2259\u225A\u225C\u225F-\u2262\u2264-\u228B\u228D-\u229B\u229D-\u22A5\u22A7-\u22B0\u22B2-\u22BB\u22BD-\u22DB\u22DE-\u22E3\u22E6-\u22F7\u22F9-\u22FE\u2305\u2306\u2308-\u2310\u2312\u2313\u2315\u2316\u231C-\u231F\u2322\u2323\u232D\u232E\u2336\u233D\u233F\u237C\u23B0\u23B1\u23B4-\u23B6\u23DC-\u23DF\u23E2\u23E7\u2423\u24C8\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2550-\u256C\u2580\u2584\u2588\u2591-\u2593\u25A1\u25AA\u25AB\u25AD\u25AE\u25B1\u25B3-\u25B5\u25B8\u25B9\u25BD-\u25BF\u25C2\u25C3\u25CA\u25CB\u25EC\u25EF\u25F8-\u25FC\u2605\u2606\u260E\u2640\u2642\u2660\u2663\u2665\u2666\u266A\u266D-\u266F\u2713\u2717\u2720\u2736\u2758\u2772\u2773\u27C8\u27C9\u27E6-\u27ED\u27F5-\u27FA\u27FC\u27FF\u2902-\u2905\u290C-\u2913\u2916\u2919-\u2920\u2923-\u292A\u2933\u2935-\u2939\u293C\u293D\u2945\u2948-\u294B\u294E-\u2976\u2978\u2979\u297B-\u297F\u2985\u2986\u298B-\u2996\u299A\u299C\u299D\u29A4-\u29B7\u29B9\u29BB\u29BC\u29BE-\u29C5\u29C9\u29CD-\u29D0\u29DC-\u29DE\u29E3-\u29E5\u29EB\u29F4\u29F6\u2A00-\u2A02\u2A04\u2A06\u2A0C\u2A0D\u2A10-\u2A17\u2A22-\u2A27\u2A29\u2A2A\u2A2D-\u2A31\u2A33-\u2A3C\u2A3F\u2A40\u2A42-\u2A4D\u2A50\u2A53-\u2A58\u2A5A-\u2A5D\u2A5F\u2A66\u2A6A\u2A6D-\u2A75\u2A77-\u2A9A\u2A9D-\u2AA2\u2AA4-\u2AB0\u2AB3-\u2AC8\u2ACB\u2ACC\u2ACF-\u2ADB\u2AE4\u2AE6-\u2AE9\u2AEB-\u2AF3\u2AFD\uFB00-\uFB04]|\uD835[\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDD6B]/g,l={"­":"shy","‌":"zwnj","‍":"zwj","‎":"lrm","⁣":"ic","⁢":"it","⁡":"af","‏":"rlm","​":"ZeroWidthSpace","⁠":"NoBreak","̑":"DownBreve","⃛":"tdot","⃜":"DotDot","\t":"Tab","\n":"NewLine"," ":"puncsp"," ":"MediumSpace"," ":"thinsp"," ":"hairsp"," ":"emsp13"," ":"ensp"," ":"emsp14"," ":"emsp"," ":"numsp"," ":"nbsp","  ":"ThickSpace","‾":"oline",_:"lowbar","‐":"dash","–":"ndash","—":"mdash","―":"horbar",",":"comma",";":"semi","⁏":"bsemi",":":"colon","⩴":"Colone","!":"excl","¡":"iexcl","?":"quest","¿":"iquest",".":"period","‥":"nldr","…":"mldr","·":"middot","'":"apos","‘":"lsquo","’":"rsquo","‚":"sbquo","‹":"lsaquo","›":"rsaquo",'"':"quot","“":"ldquo","”":"rdquo","„":"bdquo","«":"laquo","»":"raquo","(":"lpar",")":"rpar","[":"lsqb","]":"rsqb","{":"lcub","}":"rcub","⌈":"lceil","⌉":"rceil","⌊":"lfloor","⌋":"rfloor","⦅":"lopar","⦆":"ropar","⦋":"lbrke","⦌":"rbrke","⦍":"lbrkslu","⦎":"rbrksld","⦏":"lbrksld","⦐":"rbrkslu","⦑":"langd","⦒":"rangd","⦓":"lparlt","⦔":"rpargt","⦕":"gtlPar","⦖":"ltrPar","⟦":"lobrk","⟧":"robrk","⟨":"lang","⟩":"rang","⟪":"Lang","⟫":"Rang","⟬":"loang","⟭":"roang","❲":"lbbrk","❳":"rbbrk","‖":"Vert","§":"sect","¶":"para","@":"commat","*":"ast","/":"sol",undefined:null,"&":"amp","#":"num","%":"percnt","‰":"permil","‱":"pertenk","†":"dagger","‡":"Dagger","•":"bull","⁃":"hybull","′":"prime","″":"Prime","‴":"tprime","⁗":"qprime","‵":"bprime","⁁":"caret","`":"grave","´":"acute","˜":"tilde","^":"Hat","¯":"macr","˘":"breve","˙":"dot","¨":"die","˚":"ring","˝":"dblac","¸":"cedil","˛":"ogon","ˆ":"circ","ˇ":"caron","°":"deg","©":"copy","®":"reg","℗":"copysr","℘":"wp","℞":"rx","℧":"mho","℩":"iiota","←":"larr","↚":"nlarr","→":"rarr","↛":"nrarr","↑":"uarr","↓":"darr","↔":"harr","↮":"nharr","↕":"varr","↖":"nwarr","↗":"nearr","↘":"searr","↙":"swarr","↝":"rarrw","↝̸":"nrarrw","↞":"Larr","↟":"Uarr","↠":"Rarr","↡":"Darr","↢":"larrtl","↣":"rarrtl","↤":"mapstoleft","↥":"mapstoup","↦":"map","↧":"mapstodown","↩":"larrhk","↪":"rarrhk","↫":"larrlp","↬":"rarrlp","↭":"harrw","↰":"lsh","↱":"rsh","↲":"ldsh","↳":"rdsh","↵":"crarr","↶":"cularr","↷":"curarr","↺":"olarr","↻":"orarr","↼":"lharu","↽":"lhard","↾":"uharr","↿":"uharl","⇀":"rharu","⇁":"rhard","⇂":"dharr","⇃":"dharl","⇄":"rlarr","⇅":"udarr","⇆":"lrarr","⇇":"llarr","⇈":"uuarr","⇉":"rrarr","⇊":"ddarr","⇋":"lrhar","⇌":"rlhar","⇐":"lArr","⇍":"nlArr","⇑":"uArr","⇒":"rArr","⇏":"nrArr","⇓":"dArr","⇔":"iff","⇎":"nhArr","⇕":"vArr","⇖":"nwArr","⇗":"neArr","⇘":"seArr","⇙":"swArr","⇚":"lAarr","⇛":"rAarr","⇝":"zigrarr","⇤":"larrb","⇥":"rarrb","⇵":"duarr","⇽":"loarr","⇾":"roarr","⇿":"hoarr","∀":"forall","∁":"comp","∂":"part","∂̸":"npart","∃":"exist","∄":"nexist","∅":"empty","∇":"Del","∈":"in","∉":"notin","∋":"ni","∌":"notni","϶":"bepsi","∏":"prod","∐":"coprod","∑":"sum","+":"plus","±":"pm","÷":"div","×":"times","<":"lt","≮":"nlt","<⃒":"nvlt","=":"equals","≠":"ne","=⃥":"bne","⩵":"Equal",">":"gt","≯":"ngt",">⃒":"nvgt","¬":"not","|":"vert","¦":"brvbar","−":"minus","∓":"mp","∔":"plusdo","⁄":"frasl","∖":"setmn","∗":"lowast","∘":"compfn","√":"Sqrt","∝":"prop","∞":"infin","∟":"angrt","∠":"ang","∠⃒":"nang","∡":"angmsd","∢":"angsph","∣":"mid","∤":"nmid","∥":"par","∦":"npar","∧":"and","∨":"or","∩":"cap","∩︀":"caps","∪":"cup","∪︀":"cups","∫":"int","∬":"Int","∭":"tint","⨌":"qint","∮":"oint","∯":"Conint","∰":"Cconint","∱":"cwint","∲":"cwconint","∳":"awconint","∴":"there4","∵":"becaus","∶":"ratio","∷":"Colon","∸":"minusd","∺":"mDDot","∻":"homtht","∼":"sim","≁":"nsim","∼⃒":"nvsim","∽":"bsim","∽̱":"race","∾":"ac","∾̳":"acE","∿":"acd","≀":"wr","≂":"esim","≂̸":"nesim","≃":"sime","≄":"nsime","≅":"cong","≇":"ncong","≆":"simne","≈":"ap","≉":"nap","≊":"ape","≋":"apid","≋̸":"napid","≌":"bcong","≍":"CupCap","≭":"NotCupCap","≍⃒":"nvap","≎":"bump","≎̸":"nbump","≏":"bumpe","≏̸":"nbumpe","≐":"doteq","≐̸":"nedot","≑":"eDot","≒":"efDot","≓":"erDot","≔":"colone","≕":"ecolon","≖":"ecir","≗":"cire","≙":"wedgeq","≚":"veeeq","≜":"trie","≟":"equest","≡":"equiv","≢":"nequiv","≡⃥":"bnequiv","≤":"le","≰":"nle","≤⃒":"nvle","≥":"ge","≱":"nge","≥⃒":"nvge","≦":"lE","≦̸":"nlE","≧":"gE","≧̸":"ngE","≨︀":"lvnE","≨":"lnE","≩":"gnE","≩︀":"gvnE","≪":"ll","≪̸":"nLtv","≪⃒":"nLt","≫":"gg","≫̸":"nGtv","≫⃒":"nGt","≬":"twixt","≲":"lsim","≴":"nlsim","≳":"gsim","≵":"ngsim","≶":"lg","≸":"ntlg","≷":"gl","≹":"ntgl","≺":"pr","⊀":"npr","≻":"sc","⊁":"nsc","≼":"prcue","⋠":"nprcue","≽":"sccue","⋡":"nsccue","≾":"prsim","≿":"scsim","≿̸":"NotSucceedsTilde","⊂":"sub","⊄":"nsub","⊂⃒":"vnsub","⊃":"sup","⊅":"nsup","⊃⃒":"vnsup","⊆":"sube","⊈":"nsube","⊇":"supe","⊉":"nsupe","⊊︀":"vsubne","⊊":"subne","⊋︀":"vsupne","⊋":"supne","⊍":"cupdot","⊎":"uplus","⊏":"sqsub","⊏̸":"NotSquareSubset","⊐":"sqsup","⊐̸":"NotSquareSuperset","⊑":"sqsube","⋢":"nsqsube","⊒":"sqsupe","⋣":"nsqsupe","⊓":"sqcap","⊓︀":"sqcaps","⊔":"sqcup","⊔︀":"sqcups","⊕":"oplus","⊖":"ominus","⊗":"otimes","⊘":"osol","⊙":"odot","⊚":"ocir","⊛":"oast","⊝":"odash","⊞":"plusb","⊟":"minusb","⊠":"timesb","⊡":"sdotb","⊢":"vdash","⊬":"nvdash","⊣":"dashv","⊤":"top","⊥":"bot","⊧":"models","⊨":"vDash","⊭":"nvDash","⊩":"Vdash","⊮":"nVdash","⊪":"Vvdash","⊫":"VDash","⊯":"nVDash","⊰":"prurel","⊲":"vltri","⋪":"nltri","⊳":"vrtri","⋫":"nrtri","⊴":"ltrie","⋬":"nltrie","⊴⃒":"nvltrie","⊵":"rtrie","⋭":"nrtrie","⊵⃒":"nvrtrie","⊶":"origof","⊷":"imof","⊸":"mumap","⊹":"hercon","⊺":"intcal","⊻":"veebar","⊽":"barvee","⊾":"angrtvb","⊿":"lrtri","⋀":"Wedge","⋁":"Vee","⋂":"xcap","⋃":"xcup","⋄":"diam","⋅":"sdot","⋆":"Star","⋇":"divonx","⋈":"bowtie","⋉":"ltimes","⋊":"rtimes","⋋":"lthree","⋌":"rthree","⋍":"bsime","⋎":"cuvee","⋏":"cuwed","⋐":"Sub","⋑":"Sup","⋒":"Cap","⋓":"Cup","⋔":"fork","⋕":"epar","⋖":"ltdot","⋗":"gtdot","⋘":"Ll","⋘̸":"nLl","⋙":"Gg","⋙̸":"nGg","⋚︀":"lesg","⋚":"leg","⋛":"gel","⋛︀":"gesl","⋞":"cuepr","⋟":"cuesc","⋦":"lnsim","⋧":"gnsim","⋨":"prnsim","⋩":"scnsim","⋮":"vellip","⋯":"ctdot","⋰":"utdot","⋱":"dtdot","⋲":"disin","⋳":"isinsv","⋴":"isins","⋵":"isindot","⋵̸":"notindot","⋶":"notinvc","⋷":"notinvb","⋹":"isinE","⋹̸":"notinE","⋺":"nisd","⋻":"xnis","⋼":"nis","⋽":"notnivc","⋾":"notnivb","⌅":"barwed","⌆":"Barwed","⌌":"drcrop","⌍":"dlcrop","⌎":"urcrop","⌏":"ulcrop","⌐":"bnot","⌒":"profline","⌓":"profsurf","⌕":"telrec","⌖":"target","⌜":"ulcorn","⌝":"urcorn","⌞":"dlcorn","⌟":"drcorn","⌢":"frown","⌣":"smile","⌭":"cylcty","⌮":"profalar","⌶":"topbot","⌽":"ovbar","⌿":"solbar","⍼":"angzarr","⎰":"lmoust","⎱":"rmoust","⎴":"tbrk","⎵":"bbrk","⎶":"bbrktbrk","⏜":"OverParenthesis","⏝":"UnderParenthesis","⏞":"OverBrace","⏟":"UnderBrace","⏢":"trpezium","⏧":"elinters","␣":"blank","─":"boxh","│":"boxv","┌":"boxdr","┐":"boxdl","└":"boxur","┘":"boxul","├":"boxvr","┤":"boxvl","┬":"boxhd","┴":"boxhu","┼":"boxvh","═":"boxH","║":"boxV","╒":"boxdR","╓":"boxDr","╔":"boxDR","╕":"boxdL","╖":"boxDl","╗":"boxDL","╘":"boxuR","╙":"boxUr","╚":"boxUR","╛":"boxuL","╜":"boxUl","╝":"boxUL","╞":"boxvR","╟":"boxVr","╠":"boxVR","╡":"boxvL","╢":"boxVl","╣":"boxVL","╤":"boxHd","╥":"boxhD","╦":"boxHD","╧":"boxHu","╨":"boxhU","╩":"boxHU","╪":"boxvH","╫":"boxVh","╬":"boxVH","▀":"uhblk","▄":"lhblk","█":"block","░":"blk14","▒":"blk12","▓":"blk34","□":"squ","▪":"squf","▫":"EmptyVerySmallSquare","▭":"rect","▮":"marker","▱":"fltns","△":"xutri","▴":"utrif","▵":"utri","▸":"rtrif","▹":"rtri","▽":"xdtri","▾":"dtrif","▿":"dtri","◂":"ltrif","◃":"ltri","◊":"loz","○":"cir","◬":"tridot","◯":"xcirc","◸":"ultri","◹":"urtri","◺":"lltri","◻":"EmptySmallSquare","◼":"FilledSmallSquare","★":"starf","☆":"star","☎":"phone","♀":"female","♂":"male","♠":"spades","♣":"clubs","♥":"hearts","♦":"diams","♪":"sung","✓":"check","✗":"cross","✠":"malt","✶":"sext","❘":"VerticalSeparator","⟈":"bsolhsub","⟉":"suphsol","⟵":"xlarr","⟶":"xrarr","⟷":"xharr","⟸":"xlArr","⟹":"xrArr","⟺":"xhArr","⟼":"xmap","⟿":"dzigrarr","⤂":"nvlArr","⤃":"nvrArr","⤄":"nvHarr","⤅":"Map","⤌":"lbarr","⤍":"rbarr","⤎":"lBarr","⤏":"rBarr","⤐":"RBarr","⤑":"DDotrahd","⤒":"UpArrowBar","⤓":"DownArrowBar","⤖":"Rarrtl","⤙":"latail","⤚":"ratail","⤛":"lAtail","⤜":"rAtail","⤝":"larrfs","⤞":"rarrfs","⤟":"larrbfs","⤠":"rarrbfs","⤣":"nwarhk","⤤":"nearhk","⤥":"searhk","⤦":"swarhk","⤧":"nwnear","⤨":"toea","⤩":"tosa","⤪":"swnwar","⤳":"rarrc","⤳̸":"nrarrc","⤵":"cudarrr","⤶":"ldca","⤷":"rdca","⤸":"cudarrl","⤹":"larrpl","⤼":"curarrm","⤽":"cularrp","⥅":"rarrpl","⥈":"harrcir","⥉":"Uarrocir","⥊":"lurdshar","⥋":"ldrushar","⥎":"LeftRightVector","⥏":"RightUpDownVector","⥐":"DownLeftRightVector","⥑":"LeftUpDownVector","⥒":"LeftVectorBar","⥓":"RightVectorBar","⥔":"RightUpVectorBar","⥕":"RightDownVectorBar","⥖":"DownLeftVectorBar","⥗":"DownRightVectorBar","⥘":"LeftUpVectorBar","⥙":"LeftDownVectorBar","⥚":"LeftTeeVector","⥛":"RightTeeVector","⥜":"RightUpTeeVector","⥝":"RightDownTeeVector","⥞":"DownLeftTeeVector","⥟":"DownRightTeeVector","⥠":"LeftUpTeeVector","⥡":"LeftDownTeeVector","⥢":"lHar","⥣":"uHar","⥤":"rHar","⥥":"dHar","⥦":"luruhar","⥧":"ldrdhar","⥨":"ruluhar","⥩":"rdldhar","⥪":"lharul","⥫":"llhard","⥬":"rharul","⥭":"lrhard","⥮":"udhar","⥯":"duhar","⥰":"RoundImplies","⥱":"erarr","⥲":"simrarr","⥳":"larrsim","⥴":"rarrsim","⥵":"rarrap","⥶":"ltlarr","⥸":"gtrarr","⥹":"subrarr","⥻":"suplarr","⥼":"lfisht","⥽":"rfisht","⥾":"ufisht","⥿":"dfisht","⦚":"vzigzag","⦜":"vangrt","⦝":"angrtvbd","⦤":"ange","⦥":"range","⦦":"dwangle","⦧":"uwangle","⦨":"angmsdaa","⦩":"angmsdab","⦪":"angmsdac","⦫":"angmsdad","⦬":"angmsdae","⦭":"angmsdaf","⦮":"angmsdag","⦯":"angmsdah","⦰":"bemptyv","⦱":"demptyv","⦲":"cemptyv","⦳":"raemptyv","⦴":"laemptyv","⦵":"ohbar","⦶":"omid","⦷":"opar","⦹":"operp","⦻":"olcross","⦼":"odsold","⦾":"olcir","⦿":"ofcir","⧀":"olt","⧁":"ogt","⧂":"cirscir","⧃":"cirE","⧄":"solb","⧅":"bsolb","⧉":"boxbox","⧍":"trisb","⧎":"rtriltri","⧏":"LeftTriangleBar","⧏̸":"NotLeftTriangleBar","⧐":"RightTriangleBar","⧐̸":"NotRightTriangleBar","⧜":"iinfin","⧝":"infintie","⧞":"nvinfin","⧣":"eparsl","⧤":"smeparsl","⧥":"eqvparsl","⧫":"lozf","⧴":"RuleDelayed","⧶":"dsol","⨀":"xodot","⨁":"xoplus","⨂":"xotime","⨄":"xuplus","⨆":"xsqcup","⨍":"fpartint","⨐":"cirfnint","⨑":"awint","⨒":"rppolint","⨓":"scpolint","⨔":"npolint","⨕":"pointint","⨖":"quatint","⨗":"intlarhk","⨢":"pluscir","⨣":"plusacir","⨤":"simplus","⨥":"plusdu","⨦":"plussim","⨧":"plustwo","⨩":"mcomma","⨪":"minusdu","⨭":"loplus","⨮":"roplus","⨯":"Cross","⨰":"timesd","⨱":"timesbar","⨳":"smashp","⨴":"lotimes","⨵":"rotimes","⨶":"otimesas","⨷":"Otimes","⨸":"odiv","⨹":"triplus","⨺":"triminus","⨻":"tritime","⨼":"iprod","⨿":"amalg","⩀":"capdot","⩂":"ncup","⩃":"ncap","⩄":"capand","⩅":"cupor","⩆":"cupcap","⩇":"capcup","⩈":"cupbrcap","⩉":"capbrcup","⩊":"cupcup","⩋":"capcap","⩌":"ccups","⩍":"ccaps","⩐":"ccupssm","⩓":"And","⩔":"Or","⩕":"andand","⩖":"oror","⩗":"orslope","⩘":"andslope","⩚":"andv","⩛":"orv","⩜":"andd","⩝":"ord","⩟":"wedbar","⩦":"sdote","⩪":"simdot","⩭":"congdot","⩭̸":"ncongdot","⩮":"easter","⩯":"apacir","⩰":"apE","⩰̸":"napE","⩱":"eplus","⩲":"pluse","⩳":"Esim","⩷":"eDDot","⩸":"equivDD","⩹":"ltcir","⩺":"gtcir","⩻":"ltquest","⩼":"gtquest","⩽":"les","⩽̸":"nles","⩾":"ges","⩾̸":"nges","⩿":"lesdot","⪀":"gesdot","⪁":"lesdoto","⪂":"gesdoto","⪃":"lesdotor","⪄":"gesdotol","⪅":"lap","⪆":"gap","⪇":"lne","⪈":"gne","⪉":"lnap","⪊":"gnap","⪋":"lEg","⪌":"gEl","⪍":"lsime","⪎":"gsime","⪏":"lsimg","⪐":"gsiml","⪑":"lgE","⪒":"glE","⪓":"lesges","⪔":"gesles","⪕":"els","⪖":"egs","⪗":"elsdot","⪘":"egsdot","⪙":"el","⪚":"eg","⪝":"siml","⪞":"simg","⪟":"simlE","⪠":"simgE","⪡":"LessLess","⪡̸":"NotNestedLessLess","⪢":"GreaterGreater","⪢̸":"NotNestedGreaterGreater","⪤":"glj","⪥":"gla","⪦":"ltcc","⪧":"gtcc","⪨":"lescc","⪩":"gescc","⪪":"smt","⪫":"lat","⪬":"smte","⪬︀":"smtes","⪭":"late","⪭︀":"lates","⪮":"bumpE","⪯":"pre","⪯̸":"npre","⪰":"sce","⪰̸":"nsce","⪳":"prE","⪴":"scE","⪵":"prnE","⪶":"scnE","⪷":"prap","⪸":"scap","⪹":"prnap","⪺":"scnap","⪻":"Pr","⪼":"Sc","⪽":"subdot","⪾":"supdot","⪿":"subplus","⫀":"supplus","⫁":"submult","⫂":"supmult","⫃":"subedot","⫄":"supedot","⫅":"subE","⫅̸":"nsubE","⫆":"supE","⫆̸":"nsupE","⫇":"subsim","⫈":"supsim","⫋︀":"vsubnE","⫋":"subnE","⫌︀":"vsupnE","⫌":"supnE","⫏":"csub","⫐":"csup","⫑":"csube","⫒":"csupe","⫓":"subsup","⫔":"supsub","⫕":"subsub","⫖":"supsup","⫗":"suphsub","⫘":"supdsub","⫙":"forkv","⫚":"topfork","⫛":"mlcp","⫤":"Dashv","⫦":"Vdashl","⫧":"Barv","⫨":"vBar","⫩":"vBarv","⫫":"Vbar","⫬":"Not","⫭":"bNot","⫮":"rnmid","⫯":"cirmid","⫰":"midcir","⫱":"topcir","⫲":"nhpar","⫳":"parsim","⫽":"parsl","⫽⃥":"nparsl","♭":"flat","♮":"natur","♯":"sharp","¤":"curren","¢":"cent",$:"dollar","£":"pound","¥":"yen","€":"euro","¹":"sup1","½":"half","⅓":"frac13","¼":"frac14","⅕":"frac15","⅙":"frac16","⅛":"frac18","²":"sup2","⅔":"frac23","⅖":"frac25","³":"sup3","¾":"frac34","⅗":"frac35","⅜":"frac38","⅘":"frac45","⅚":"frac56","⅝":"frac58","⅞":"frac78","𝒶":"ascr","𝕒":"aopf","𝔞":"afr","𝔸":"Aopf","𝔄":"Afr","𝒜":"Ascr","ª":"ordf","á":"aacute","Á":"Aacute","à":"agrave","À":"Agrave","ă":"abreve","Ă":"Abreve","â":"acirc","Â":"Acirc","å":"aring","Å":"angst","ä":"auml","Ä":"Auml","ã":"atilde","Ã":"Atilde","ą":"aogon","Ą":"Aogon","ā":"amacr","Ā":"Amacr","æ":"aelig","Æ":"AElig","𝒷":"bscr","𝕓":"bopf","𝔟":"bfr","𝔹":"Bopf","ℬ":"Bscr","𝔅":"Bfr","𝔠":"cfr","𝒸":"cscr","𝕔":"copf","ℭ":"Cfr","𝒞":"Cscr","ℂ":"Copf","ć":"cacute","Ć":"Cacute","ĉ":"ccirc","Ĉ":"Ccirc","č":"ccaron","Č":"Ccaron","ċ":"cdot","Ċ":"Cdot","ç":"ccedil","Ç":"Ccedil","℅":"incare","𝔡":"dfr","ⅆ":"dd","𝕕":"dopf","𝒹":"dscr","𝒟":"Dscr","𝔇":"Dfr","ⅅ":"DD","𝔻":"Dopf","ď":"dcaron","Ď":"Dcaron","đ":"dstrok","Đ":"Dstrok","ð":"eth","Ð":"ETH","ⅇ":"ee","ℯ":"escr","𝔢":"efr","𝕖":"eopf","ℰ":"Escr","𝔈":"Efr","𝔼":"Eopf","é":"eacute","É":"Eacute","è":"egrave","È":"Egrave","ê":"ecirc","Ê":"Ecirc","ě":"ecaron","Ě":"Ecaron","ë":"euml","Ë":"Euml","ė":"edot","Ė":"Edot","ę":"eogon","Ę":"Eogon","ē":"emacr","Ē":"Emacr","𝔣":"ffr","𝕗":"fopf","𝒻":"fscr","𝔉":"Ffr","𝔽":"Fopf","ℱ":"Fscr","ff":"fflig","ffi":"ffilig","ffl":"ffllig","fi":"filig",fj:"fjlig","fl":"fllig","ƒ":"fnof","ℊ":"gscr","𝕘":"gopf","𝔤":"gfr","𝒢":"Gscr","𝔾":"Gopf","𝔊":"Gfr","ǵ":"gacute","ğ":"gbreve","Ğ":"Gbreve","ĝ":"gcirc","Ĝ":"Gcirc","ġ":"gdot","Ġ":"Gdot","Ģ":"Gcedil","𝔥":"hfr","ℎ":"planckh","𝒽":"hscr","𝕙":"hopf","ℋ":"Hscr","ℌ":"Hfr","ℍ":"Hopf","ĥ":"hcirc","Ĥ":"Hcirc","ℏ":"hbar","ħ":"hstrok","Ħ":"Hstrok","𝕚":"iopf","𝔦":"ifr","𝒾":"iscr","ⅈ":"ii","𝕀":"Iopf","ℐ":"Iscr","ℑ":"Im","í":"iacute","Í":"Iacute","ì":"igrave","Ì":"Igrave","î":"icirc","Î":"Icirc","ï":"iuml","Ï":"Iuml","ĩ":"itilde","Ĩ":"Itilde","İ":"Idot","į":"iogon","Į":"Iogon","ī":"imacr","Ī":"Imacr","ij":"ijlig","IJ":"IJlig","ı":"imath","𝒿":"jscr","𝕛":"jopf","𝔧":"jfr","𝒥":"Jscr","𝔍":"Jfr","𝕁":"Jopf","ĵ":"jcirc","Ĵ":"Jcirc","ȷ":"jmath","𝕜":"kopf","𝓀":"kscr","𝔨":"kfr","𝒦":"Kscr","𝕂":"Kopf","𝔎":"Kfr","ķ":"kcedil","Ķ":"Kcedil","𝔩":"lfr","𝓁":"lscr","ℓ":"ell","𝕝":"lopf","ℒ":"Lscr","𝔏":"Lfr","𝕃":"Lopf","ĺ":"lacute","Ĺ":"Lacute","ľ":"lcaron","Ľ":"Lcaron","ļ":"lcedil","Ļ":"Lcedil","ł":"lstrok","Ł":"Lstrok","ŀ":"lmidot","Ŀ":"Lmidot","𝔪":"mfr","𝕞":"mopf","𝓂":"mscr","𝔐":"Mfr","𝕄":"Mopf","ℳ":"Mscr","𝔫":"nfr","𝕟":"nopf","𝓃":"nscr","ℕ":"Nopf","𝒩":"Nscr","𝔑":"Nfr","ń":"nacute","Ń":"Nacute","ň":"ncaron","Ň":"Ncaron","ñ":"ntilde","Ñ":"Ntilde","ņ":"ncedil","Ņ":"Ncedil","№":"numero","ŋ":"eng","Ŋ":"ENG","𝕠":"oopf","𝔬":"ofr","ℴ":"oscr","𝒪":"Oscr","𝔒":"Ofr","𝕆":"Oopf","º":"ordm","ó":"oacute","Ó":"Oacute","ò":"ograve","Ò":"Ograve","ô":"ocirc","Ô":"Ocirc","ö":"ouml","Ö":"Ouml","ő":"odblac","Ő":"Odblac","õ":"otilde","Õ":"Otilde","ø":"oslash","Ø":"Oslash","ō":"omacr","Ō":"Omacr","œ":"oelig","Œ":"OElig","𝔭":"pfr","𝓅":"pscr","𝕡":"popf","ℙ":"Popf","𝔓":"Pfr","𝒫":"Pscr","𝕢":"qopf","𝔮":"qfr","𝓆":"qscr","𝒬":"Qscr","𝔔":"Qfr","ℚ":"Qopf","ĸ":"kgreen","𝔯":"rfr","𝕣":"ropf","𝓇":"rscr","ℛ":"Rscr","ℜ":"Re","ℝ":"Ropf","ŕ":"racute","Ŕ":"Racute","ř":"rcaron","Ř":"Rcaron","ŗ":"rcedil","Ŗ":"Rcedil","𝕤":"sopf","𝓈":"sscr","𝔰":"sfr","𝕊":"Sopf","𝔖":"Sfr","𝒮":"Sscr","Ⓢ":"oS","ś":"sacute","Ś":"Sacute","ŝ":"scirc","Ŝ":"Scirc","š":"scaron","Š":"Scaron","ş":"scedil","Ş":"Scedil","ß":"szlig","𝔱":"tfr","𝓉":"tscr","𝕥":"topf","𝒯":"Tscr","𝔗":"Tfr","𝕋":"Topf","ť":"tcaron","Ť":"Tcaron","ţ":"tcedil","Ţ":"Tcedil","™":"trade","ŧ":"tstrok","Ŧ":"Tstrok","𝓊":"uscr","𝕦":"uopf","𝔲":"ufr","𝕌":"Uopf","𝔘":"Ufr","𝒰":"Uscr","ú":"uacute","Ú":"Uacute","ù":"ugrave","Ù":"Ugrave","ŭ":"ubreve","Ŭ":"Ubreve","û":"ucirc","Û":"Ucirc","ů":"uring","Ů":"Uring","ü":"uuml","Ü":"Uuml","ű":"udblac","Ű":"Udblac","ũ":"utilde","Ũ":"Utilde","ų":"uogon","Ų":"Uogon","ū":"umacr","Ū":"Umacr","𝔳":"vfr","𝕧":"vopf","𝓋":"vscr","𝔙":"Vfr","𝕍":"Vopf","𝒱":"Vscr","𝕨":"wopf","𝓌":"wscr","𝔴":"wfr","𝒲":"Wscr","𝕎":"Wopf","𝔚":"Wfr","ŵ":"wcirc","Ŵ":"Wcirc","𝔵":"xfr","𝓍":"xscr","𝕩":"xopf","𝕏":"Xopf","𝔛":"Xfr","𝒳":"Xscr","𝔶":"yfr","𝓎":"yscr","𝕪":"yopf","𝒴":"Yscr","𝔜":"Yfr","𝕐":"Yopf","ý":"yacute","Ý":"Yacute","ŷ":"ycirc","Ŷ":"Ycirc","ÿ":"yuml","Ÿ":"Yuml","𝓏":"zscr","𝔷":"zfr","𝕫":"zopf","ℨ":"Zfr","ℤ":"Zopf","𝒵":"Zscr","ź":"zacute","Ź":"Zacute","ž":"zcaron","Ž":"Zcaron","ż":"zdot","Ż":"Zdot","Ƶ":"imped","þ":"thorn","Þ":"THORN","ʼn":"napos","α":"alpha","Α":"Alpha","β":"beta","Β":"Beta","γ":"gamma","Γ":"Gamma","δ":"delta","Δ":"Delta","ε":"epsi","ϵ":"epsiv","Ε":"Epsilon","ϝ":"gammad","Ϝ":"Gammad","ζ":"zeta","Ζ":"Zeta","η":"eta","Η":"Eta","θ":"theta","ϑ":"thetav","Θ":"Theta","ι":"iota","Ι":"Iota","κ":"kappa","ϰ":"kappav","Κ":"Kappa","λ":"lambda","Λ":"Lambda","μ":"mu","µ":"micro","Μ":"Mu","ν":"nu","Ν":"Nu","ξ":"xi","Ξ":"Xi","ο":"omicron","Ο":"Omicron","π":"pi","ϖ":"piv","Π":"Pi","ρ":"rho","ϱ":"rhov","Ρ":"Rho","σ":"sigma","Σ":"Sigma","ς":"sigmaf","τ":"tau","Τ":"Tau","υ":"upsi","Υ":"Upsilon","ϒ":"Upsi","φ":"phi","ϕ":"phiv","Φ":"Phi","χ":"chi","Χ":"Chi","ψ":"psi","Ψ":"Psi","ω":"omega","Ω":"ohm","а":"acy","А":"Acy","б":"bcy","Б":"Bcy","в":"vcy","В":"Vcy","г":"gcy","Г":"Gcy","ѓ":"gjcy","Ѓ":"GJcy","д":"dcy","Д":"Dcy","ђ":"djcy","Ђ":"DJcy","е":"iecy","Е":"IEcy","ё":"iocy","Ё":"IOcy","є":"jukcy","Є":"Jukcy","ж":"zhcy","Ж":"ZHcy","з":"zcy","З":"Zcy","ѕ":"dscy","Ѕ":"DScy","и":"icy","И":"Icy","і":"iukcy","І":"Iukcy","ї":"yicy","Ї":"YIcy","й":"jcy","Й":"Jcy","ј":"jsercy","Ј":"Jsercy","к":"kcy","К":"Kcy","ќ":"kjcy","Ќ":"KJcy","л":"lcy","Л":"Lcy","љ":"ljcy","Љ":"LJcy","м":"mcy","М":"Mcy","н":"ncy","Н":"Ncy","њ":"njcy","Њ":"NJcy","о":"ocy","О":"Ocy","п":"pcy","П":"Pcy","р":"rcy","Р":"Rcy","с":"scy","С":"Scy","т":"tcy","Т":"Tcy","ћ":"tshcy","Ћ":"TSHcy","у":"ucy","У":"Ucy","ў":"ubrcy","Ў":"Ubrcy","ф":"fcy","Ф":"Fcy","х":"khcy","Х":"KHcy","ц":"tscy","Ц":"TScy","ч":"chcy","Ч":"CHcy","џ":"dzcy","Џ":"DZcy","ш":"shcy","Ш":"SHcy","щ":"shchcy","Щ":"SHCHcy","ъ":"hardcy","Ъ":"HARDcy","ы":"ycy","Ы":"Ycy","ь":"softcy","Ь":"SOFTcy","э":"ecy","Э":"Ecy","ю":"yucy","Ю":"YUcy","я":"yacy","Я":"YAcy","ℵ":"aleph","ℶ":"beth","ℷ":"gimel","ℸ":"daleth"},m=/["&'<>`]/g,n={'"':""","&":"&","'":"'","<":"<",">":">","`":"`"},o=/&#(?:[xX][^a-fA-F0-9]|[^0-9xX])/,p=/[\0-\x08\x0B\x0E-\x1F\x7F-\x9F\uFDD0-\uFDEF\uFFFE\uFFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDFFE\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,q=/&#([0-9]+)(;?)|&#[xX]([a-fA-F0-9]+)(;?)|&([0-9a-zA-Z]+);|&(Aacute|Agrave|Atilde|Ccedil|Eacute|Egrave|Iacute|Igrave|Ntilde|Oacute|Ograve|Oslash|Otilde|Uacute|Ugrave|Yacute|aacute|agrave|atilde|brvbar|ccedil|curren|divide|eacute|egrave|frac12|frac14|frac34|iacute|igrave|iquest|middot|ntilde|oacute|ograve|oslash|otilde|plusmn|uacute|ugrave|yacute|AElig|Acirc|Aring|Ecirc|Icirc|Ocirc|THORN|Ucirc|acirc|acute|aelig|aring|cedil|ecirc|icirc|iexcl|laquo|micro|ocirc|pound|raquo|szlig|thorn|times|ucirc|Auml|COPY|Euml|Iuml|Ouml|QUOT|Uuml|auml|cent|copy|euml|iuml|macr|nbsp|ordf|ordm|ouml|para|quot|sect|sup1|sup2|sup3|uuml|yuml|AMP|ETH|REG|amp|deg|eth|not|reg|shy|uml|yen|GT|LT|gt|lt)([=a-zA-Z0-9])?/g,r={aacute:"á",Aacute:"Á",abreve:"ă",Abreve:"Ă",ac:"∾",acd:"∿",acE:"∾̳",acirc:"â",Acirc:"Â",acute:"´",acy:"а",Acy:"А",aelig:"æ",AElig:"Æ",af:"⁡",afr:"𝔞",Afr:"𝔄",agrave:"à",Agrave:"À",alefsym:"ℵ",aleph:"ℵ",alpha:"α",Alpha:"Α",amacr:"ā",Amacr:"Ā",amalg:"⨿",amp:"&",AMP:"&",and:"∧",And:"⩓",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",aogon:"ą",Aogon:"Ą",aopf:"𝕒",Aopf:"𝔸",ap:"≈",apacir:"⩯",ape:"≊",apE:"⩰",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",aring:"å",Aring:"Å",ascr:"𝒶",Ascr:"𝒜",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",atilde:"ã",Atilde:"Ã",auml:"ä",Auml:"Ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",barwed:"⌅",Barwed:"⌆",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",bcy:"б",Bcy:"Б",bdquo:"„",becaus:"∵",because:"∵",Because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",beta:"β",Beta:"Β",beth:"ℶ",between:"≬",bfr:"𝔟",Bfr:"𝔅",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bnot:"⌐",bNot:"⫭",bopf:"𝕓",Bopf:"𝔹",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxdl:"┐",boxdL:"╕",boxDl:"╖",boxDL:"╗",boxdr:"┌",boxdR:"╒",boxDr:"╓",boxDR:"╔",boxh:"─",boxH:"═",boxhd:"┬",boxhD:"╥",boxHd:"╤",boxHD:"╦",boxhu:"┴",boxhU:"╨",boxHu:"╧",boxHU:"╩",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxul:"┘",boxuL:"╛",boxUl:"╜",boxUL:"╝",boxur:"└",boxuR:"╘",boxUr:"╙",boxUR:"╚",boxv:"│",boxV:"║",boxvh:"┼",boxvH:"╪",boxVh:"╫",boxVH:"╬",boxvl:"┤",boxvL:"╡",boxVl:"╢",boxVL:"╣",boxvr:"├",boxvR:"╞",boxVr:"╟",boxVR:"╠",bprime:"‵",breve:"˘",Breve:"˘",brvbar:"¦",bscr:"𝒷",Bscr:"ℬ",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpe:"≏",bumpE:"⪮",bumpeq:"≏",Bumpeq:"≎",cacute:"ć",Cacute:"Ć",cap:"∩",Cap:"⋒",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",ccaron:"č",Ccaron:"Č",ccedil:"ç",Ccedil:"Ç",ccirc:"ĉ",Ccirc:"Ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",cdot:"ċ",Cdot:"Ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",centerdot:"·",CenterDot:"·",cfr:"𝔠",Cfr:"ℭ",chcy:"ч",CHcy:"Ч",check:"✓",checkmark:"✓",chi:"χ",Chi:"Χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cire:"≗",cirE:"⧃",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",colon:":",Colon:"∷",colone:"≔",Colone:"⩴",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",conint:"∮",Conint:"∯",ContourIntegral:"∮",copf:"𝕔",Copf:"ℂ",coprod:"∐",Coproduct:"∐",copy:"©",COPY:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",cross:"✗",Cross:"⨯",cscr:"𝒸",Cscr:"𝒞",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",cup:"∪",Cup:"⋓",cupbrcap:"⩈",cupcap:"⩆",CupCap:"≍",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",dagger:"†",Dagger:"‡",daleth:"ℸ",darr:"↓",dArr:"⇓",Darr:"↡",dash:"‐",dashv:"⊣",Dashv:"⫤",dbkarow:"⤏",dblac:"˝",dcaron:"ď",Dcaron:"Ď",dcy:"д",Dcy:"Д",dd:"ⅆ",DD:"ⅅ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",delta:"δ",Delta:"Δ",demptyv:"⦱",dfisht:"⥿",dfr:"𝔡",Dfr:"𝔇",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",diamond:"⋄",Diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",djcy:"ђ",DJcy:"Ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",dopf:"𝕕",Dopf:"𝔻",dot:"˙",Dot:"¨",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",downarrow:"↓",Downarrow:"⇓",DownArrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",dscr:"𝒹",Dscr:"𝒟",dscy:"ѕ",DScy:"Ѕ",dsol:"⧶",dstrok:"đ",Dstrok:"Đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",dzcy:"џ",DZcy:"Џ",dzigrarr:"⟿",eacute:"é",Eacute:"É",easter:"⩮",ecaron:"ě",Ecaron:"Ě",ecir:"≖",ecirc:"ê",Ecirc:"Ê",ecolon:"≕",ecy:"э",Ecy:"Э",eDDot:"⩷",edot:"ė",eDot:"≑",Edot:"Ė",ee:"ⅇ",efDot:"≒",efr:"𝔢",Efr:"𝔈",eg:"⪚",egrave:"è",Egrave:"È",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",emacr:"ē",Emacr:"Ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",eng:"ŋ",ENG:"Ŋ",ensp:" ",eogon:"ę",Eogon:"Ę", -eopf:"𝕖",Eopf:"𝔼",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",epsilon:"ε",Epsilon:"Ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",escr:"ℯ",Escr:"ℰ",esdot:"≐",esim:"≂",Esim:"⩳",eta:"η",Eta:"Η",eth:"ð",ETH:"Ð",euml:"ë",Euml:"Ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",exponentiale:"ⅇ",ExponentialE:"ⅇ",fallingdotseq:"≒",fcy:"ф",Fcy:"Ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",ffr:"𝔣",Ffr:"𝔉",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",fopf:"𝕗",Fopf:"𝔽",forall:"∀",ForAll:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",fscr:"𝒻",Fscr:"ℱ",gacute:"ǵ",gamma:"γ",Gamma:"Γ",gammad:"ϝ",Gammad:"Ϝ",gap:"⪆",gbreve:"ğ",Gbreve:"Ğ",Gcedil:"Ģ",gcirc:"ĝ",Gcirc:"Ĝ",gcy:"г",Gcy:"Г",gdot:"ġ",Gdot:"Ġ",ge:"≥",gE:"≧",gel:"⋛",gEl:"⪌",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",gfr:"𝔤",Gfr:"𝔊",gg:"≫",Gg:"⋙",ggg:"⋙",gimel:"ℷ",gjcy:"ѓ",GJcy:"Ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gne:"⪈",gnE:"≩",gneq:"⪈",gneqq:"≩",gnsim:"⋧",gopf:"𝕘",Gopf:"𝔾",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",gscr:"ℊ",Gscr:"𝒢",gsim:"≳",gsime:"⪎",gsiml:"⪐",gt:">",Gt:"≫",GT:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",hardcy:"ъ",HARDcy:"Ъ",harr:"↔",hArr:"⇔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",hcirc:"ĥ",Hcirc:"Ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",hfr:"𝔥",Hfr:"ℌ",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",hopf:"𝕙",Hopf:"ℍ",horbar:"―",HorizontalLine:"─",hscr:"𝒽",Hscr:"ℋ",hslash:"ℏ",hstrok:"ħ",Hstrok:"Ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",iacute:"í",Iacute:"Í",ic:"⁣",icirc:"î",Icirc:"Î",icy:"и",Icy:"И",Idot:"İ",iecy:"е",IEcy:"Е",iexcl:"¡",iff:"⇔",ifr:"𝔦",Ifr:"ℑ",igrave:"ì",Igrave:"Ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",ijlig:"ij",IJlig:"IJ",Im:"ℑ",imacr:"ī",Imacr:"Ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",int:"∫",Int:"∬",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",iocy:"ё",IOcy:"Ё",iogon:"į",Iogon:"Į",iopf:"𝕚",Iopf:"𝕀",iota:"ι",Iota:"Ι",iprod:"⨼",iquest:"¿",iscr:"𝒾",Iscr:"ℐ",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",itilde:"ĩ",Itilde:"Ĩ",iukcy:"і",Iukcy:"І",iuml:"ï",Iuml:"Ï",jcirc:"ĵ",Jcirc:"Ĵ",jcy:"й",Jcy:"Й",jfr:"𝔧",Jfr:"𝔍",jmath:"ȷ",jopf:"𝕛",Jopf:"𝕁",jscr:"𝒿",Jscr:"𝒥",jsercy:"ј",Jsercy:"Ј",jukcy:"є",Jukcy:"Є",kappa:"κ",Kappa:"Κ",kappav:"ϰ",kcedil:"ķ",Kcedil:"Ķ",kcy:"к",Kcy:"К",kfr:"𝔨",Kfr:"𝔎",kgreen:"ĸ",khcy:"х",KHcy:"Х",kjcy:"ќ",KJcy:"Ќ",kopf:"𝕜",Kopf:"𝕂",kscr:"𝓀",Kscr:"𝒦",lAarr:"⇚",lacute:"ĺ",Lacute:"Ĺ",laemptyv:"⦴",lagran:"ℒ",lambda:"λ",Lambda:"Λ",lang:"⟨",Lang:"⟪",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",larr:"←",lArr:"⇐",Larr:"↞",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",latail:"⤙",lAtail:"⤛",late:"⪭",lates:"⪭︀",lbarr:"⤌",lBarr:"⤎",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",lcaron:"ľ",Lcaron:"Ľ",lcedil:"ļ",Lcedil:"Ļ",lceil:"⌈",lcub:"{",lcy:"л",Lcy:"Л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",le:"≤",lE:"≦",LeftAngleBracket:"⟨",leftarrow:"←",Leftarrow:"⇐",LeftArrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",leftrightarrow:"↔",Leftrightarrow:"⇔",LeftRightArrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",leg:"⋚",lEg:"⪋",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",lfr:"𝔩",Lfr:"𝔏",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",ljcy:"љ",LJcy:"Љ",ll:"≪",Ll:"⋘",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",lmidot:"ŀ",Lmidot:"Ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lne:"⪇",lnE:"≨",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",longleftarrow:"⟵",Longleftarrow:"⟸",LongLeftArrow:"⟵",longleftrightarrow:"⟷",Longleftrightarrow:"⟺",LongLeftRightArrow:"⟷",longmapsto:"⟼",longrightarrow:"⟶",Longrightarrow:"⟹",LongRightArrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",lopf:"𝕝",Lopf:"𝕃",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",lscr:"𝓁",Lscr:"ℒ",lsh:"↰",Lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",lstrok:"ł",Lstrok:"Ł",lt:"<",Lt:"≪",LT:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",map:"↦",Map:"⤅",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",mcy:"м",Mcy:"М",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",mfr:"𝔪",Mfr:"𝔐",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",mopf:"𝕞",Mopf:"𝕄",mp:"∓",mscr:"𝓂",Mscr:"ℳ",mstpos:"∾",mu:"μ",Mu:"Μ",multimap:"⊸",mumap:"⊸",nabla:"∇",nacute:"ń",Nacute:"Ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",ncaron:"ň",Ncaron:"Ň",ncedil:"ņ",Ncedil:"Ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",ncy:"н",Ncy:"Н",ndash:"–",ne:"≠",nearhk:"⤤",nearr:"↗",neArr:"⇗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",nfr:"𝔫",Nfr:"𝔑",nge:"≱",ngE:"≧̸",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",ngt:"≯",nGt:"≫⃒",ngtr:"≯",nGtv:"≫̸",nharr:"↮",nhArr:"⇎",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",njcy:"њ",NJcy:"Њ",nlarr:"↚",nlArr:"⇍",nldr:"‥",nle:"≰",nlE:"≦̸",nleftarrow:"↚",nLeftarrow:"⇍",nleftrightarrow:"↮",nLeftrightarrow:"⇎",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nlt:"≮",nLt:"≪⃒",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",nopf:"𝕟",Nopf:"ℕ",not:"¬",Not:"⫬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrarr:"↛",nrArr:"⇏",nrarrc:"⤳̸",nrarrw:"↝̸",nrightarrow:"↛",nRightarrow:"⇏",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",nscr:"𝓃",Nscr:"𝒩",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsube:"⊈",nsubE:"⫅̸",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupe:"⊉",nsupE:"⫆̸",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",ntilde:"ñ",Ntilde:"Ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",nu:"ν",Nu:"Ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nvdash:"⊬",nvDash:"⊭",nVdash:"⊮",nVDash:"⊯",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwarr:"↖",nwArr:"⇖",nwarrow:"↖",nwnear:"⤧",oacute:"ó",Oacute:"Ó",oast:"⊛",ocir:"⊚",ocirc:"ô",Ocirc:"Ô",ocy:"о",Ocy:"О",odash:"⊝",odblac:"ő",Odblac:"Ő",odiv:"⨸",odot:"⊙",odsold:"⦼",oelig:"œ",OElig:"Œ",ofcir:"⦿",ofr:"𝔬",Ofr:"𝔒",ogon:"˛",ograve:"ò",Ograve:"Ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",omacr:"ō",Omacr:"Ō",omega:"ω",Omega:"Ω",omicron:"ο",Omicron:"Ο",omid:"⦶",ominus:"⊖",oopf:"𝕠",Oopf:"𝕆",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",or:"∨",Or:"⩔",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",oscr:"ℴ",Oscr:"𝒪",oslash:"ø",Oslash:"Ø",osol:"⊘",otilde:"õ",Otilde:"Õ",otimes:"⊗",Otimes:"⨷",otimesas:"⨶",ouml:"ö",Ouml:"Ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",pcy:"п",Pcy:"П",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",pfr:"𝔭",Pfr:"𝔓",phi:"φ",Phi:"Φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",pi:"π",Pi:"Π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",popf:"𝕡",Popf:"ℙ",pound:"£",pr:"≺",Pr:"⪻",prap:"⪷",prcue:"≼",pre:"⪯",prE:"⪳",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",prime:"′",Prime:"″",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",pscr:"𝓅",Pscr:"𝒫",psi:"ψ",Psi:"Ψ",puncsp:" ",qfr:"𝔮",Qfr:"𝔔",qint:"⨌",qopf:"𝕢",Qopf:"ℚ",qprime:"⁗",qscr:"𝓆",Qscr:"𝒬",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",quot:'"',QUOT:'"',rAarr:"⇛",race:"∽̱",racute:"ŕ",Racute:"Ŕ",radic:"√",raemptyv:"⦳",rang:"⟩",Rang:"⟫",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",rarr:"→",rArr:"⇒",Rarr:"↠",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",rarrtl:"↣",Rarrtl:"⤖",rarrw:"↝",ratail:"⤚",rAtail:"⤜",ratio:"∶",rationals:"ℚ",rbarr:"⤍",rBarr:"⤏",RBarr:"⤐",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",rcaron:"ř",Rcaron:"Ř",rcedil:"ŗ",Rcedil:"Ŗ",rceil:"⌉",rcub:"}",rcy:"р",Rcy:"Р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",reg:"®",REG:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",rfr:"𝔯",Rfr:"ℜ",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",rho:"ρ",Rho:"Ρ",rhov:"ϱ",RightAngleBracket:"⟩",rightarrow:"→",Rightarrow:"⇒",RightArrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",ropf:"𝕣",Ropf:"ℝ",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",rscr:"𝓇",Rscr:"ℛ",rsh:"↱",Rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",sacute:"ś",Sacute:"Ś",sbquo:"‚",sc:"≻",Sc:"⪼",scap:"⪸",scaron:"š",Scaron:"Š",sccue:"≽",sce:"⪰",scE:"⪴",scedil:"ş",Scedil:"Ş",scirc:"ŝ",Scirc:"Ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",scy:"с",Scy:"С",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",searr:"↘",seArr:"⇘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",sfr:"𝔰",Sfr:"𝔖",sfrown:"⌢",sharp:"♯",shchcy:"щ",SHCHcy:"Щ",shcy:"ш",SHcy:"Ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",sigma:"σ",Sigma:"Σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",softcy:"ь",SOFTcy:"Ь",sol:"/",solb:"⧄",solbar:"⌿",sopf:"𝕤",Sopf:"𝕊",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",square:"□",Square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",sscr:"𝓈",Sscr:"𝒮",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",star:"☆",Star:"⋆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",sub:"⊂",Sub:"⋐",subdot:"⪽",sube:"⊆",subE:"⫅",subedot:"⫃",submult:"⫁",subne:"⊊",subnE:"⫋",subplus:"⪿",subrarr:"⥹",subset:"⊂",Subset:"⋐",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",sum:"∑",Sum:"∑",sung:"♪",sup:"⊃",Sup:"⋑",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supe:"⊇",supE:"⫆",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supne:"⊋",supnE:"⫌",supplus:"⫀",supset:"⊃",Supset:"⋑",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swarr:"↙",swArr:"⇙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",tau:"τ",Tau:"Τ",tbrk:"⎴",tcaron:"ť",Tcaron:"Ť",tcedil:"ţ",Tcedil:"Ţ",tcy:"т",Tcy:"Т",tdot:"⃛",telrec:"⌕",tfr:"𝔱",Tfr:"𝔗",there4:"∴",therefore:"∴",Therefore:"∴",theta:"θ",Theta:"Θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",thorn:"þ",THORN:"Þ",tilde:"˜",Tilde:"∼",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",topf:"𝕥",Topf:"𝕋",topfork:"⫚",tosa:"⤩",tprime:"‴",trade:"™",TRADE:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",tscr:"𝓉",Tscr:"𝒯",tscy:"ц",TScy:"Ц",tshcy:"ћ",TSHcy:"Ћ",tstrok:"ŧ",Tstrok:"Ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",uacute:"ú",Uacute:"Ú",uarr:"↑",uArr:"⇑",Uarr:"↟",Uarrocir:"⥉",ubrcy:"ў",Ubrcy:"Ў",ubreve:"ŭ",Ubreve:"Ŭ",ucirc:"û",Ucirc:"Û",ucy:"у",Ucy:"У",udarr:"⇅",udblac:"ű",Udblac:"Ű",udhar:"⥮",ufisht:"⥾",ufr:"𝔲",Ufr:"𝔘",ugrave:"ù",Ugrave:"Ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",umacr:"ū",Umacr:"Ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",uogon:"ų",Uogon:"Ų",uopf:"𝕦",Uopf:"𝕌",uparrow:"↑",Uparrow:"⇑",UpArrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",updownarrow:"↕",Updownarrow:"⇕",UpDownArrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",upsi:"υ",Upsi:"ϒ",upsih:"ϒ",upsilon:"υ",Upsilon:"Υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",uring:"ů",Uring:"Ů",urtri:"◹",uscr:"𝓊",Uscr:"𝒰",utdot:"⋰",utilde:"ũ",Utilde:"Ũ",utri:"▵",utrif:"▴",uuarr:"⇈",uuml:"ü",Uuml:"Ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",varr:"↕",vArr:"⇕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",vBar:"⫨",Vbar:"⫫",vBarv:"⫩",vcy:"в",Vcy:"В",vdash:"⊢",vDash:"⊨",Vdash:"⊩",VDash:"⊫",Vdashl:"⫦",vee:"∨",Vee:"⋁",veebar:"⊻",veeeq:"≚",vellip:"⋮",verbar:"|",Verbar:"‖",vert:"|",Vert:"‖",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",vfr:"𝔳",Vfr:"𝔙",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",vopf:"𝕧",Vopf:"𝕍",vprop:"∝",vrtri:"⊳",vscr:"𝓋",Vscr:"𝒱",vsubne:"⊊︀",vsubnE:"⫋︀",vsupne:"⊋︀",vsupnE:"⫌︀",Vvdash:"⊪",vzigzag:"⦚",wcirc:"ŵ",Wcirc:"Ŵ",wedbar:"⩟",wedge:"∧",Wedge:"⋀",wedgeq:"≙",weierp:"℘",wfr:"𝔴",Wfr:"𝔚",wopf:"𝕨",Wopf:"𝕎",wp:"℘",wr:"≀",wreath:"≀",wscr:"𝓌",Wscr:"𝒲",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",xfr:"𝔵",Xfr:"𝔛",xharr:"⟷",xhArr:"⟺",xi:"ξ",Xi:"Ξ",xlarr:"⟵",xlArr:"⟸",xmap:"⟼",xnis:"⋻",xodot:"⨀",xopf:"𝕩",Xopf:"𝕏",xoplus:"⨁",xotime:"⨂",xrarr:"⟶",xrArr:"⟹",xscr:"𝓍",Xscr:"𝒳",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",yacute:"ý",Yacute:"Ý",yacy:"я",YAcy:"Я",ycirc:"ŷ",Ycirc:"Ŷ",ycy:"ы",Ycy:"Ы",yen:"¥",yfr:"𝔶",Yfr:"𝔜",yicy:"ї",YIcy:"Ї",yopf:"𝕪",Yopf:"𝕐",yscr:"𝓎",Yscr:"𝒴",yucy:"ю",YUcy:"Ю",yuml:"ÿ",Yuml:"Ÿ",zacute:"ź",Zacute:"Ź",zcaron:"ž",Zcaron:"Ž",zcy:"з",Zcy:"З",zdot:"ż",Zdot:"Ż",zeetrf:"ℨ",ZeroWidthSpace:"​",zeta:"ζ",Zeta:"Ζ",zfr:"𝔷",Zfr:"ℨ",zhcy:"ж",ZHcy:"Ж",zigrarr:"⇝",zopf:"𝕫",Zopf:"ℤ",zscr:"𝓏",Zscr:"𝒵",zwj:"‍",zwnj:"‌"},s={aacute:"á",Aacute:"Á",acirc:"â",Acirc:"Â",acute:"´",aelig:"æ",AElig:"Æ",agrave:"à",Agrave:"À",amp:"&",AMP:"&",aring:"å",Aring:"Å",atilde:"ã",Atilde:"Ã",auml:"ä",Auml:"Ä",brvbar:"¦",ccedil:"ç",Ccedil:"Ç",cedil:"¸",cent:"¢",copy:"©",COPY:"©",curren:"¤",deg:"°",divide:"÷",eacute:"é",Eacute:"É",ecirc:"ê",Ecirc:"Ê",egrave:"è",Egrave:"È",eth:"ð",ETH:"Ð",euml:"ë",Euml:"Ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",GT:">",iacute:"í",Iacute:"Í",icirc:"î",Icirc:"Î",iexcl:"¡",igrave:"ì",Igrave:"Ì",iquest:"¿",iuml:"ï",Iuml:"Ï",laquo:"«",lt:"<",LT:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",ntilde:"ñ",Ntilde:"Ñ",oacute:"ó",Oacute:"Ó",ocirc:"ô",Ocirc:"Ô",ograve:"ò",Ograve:"Ò",ordf:"ª",ordm:"º",oslash:"ø",Oslash:"Ø",otilde:"õ",Otilde:"Õ",ouml:"ö",Ouml:"Ö",para:"¶",plusmn:"±",pound:"£",quot:'"',QUOT:'"',raquo:"»",reg:"®",REG:"®",sect:"§",shy:"­",sup1:"¹",sup2:"²",sup3:"³",szlig:"ß",thorn:"þ",THORN:"Þ",times:"×",uacute:"ú",Uacute:"Ú",ucirc:"û",Ucirc:"Û",ugrave:"ù",Ugrave:"Ù",uml:"¨",uuml:"ü",Uuml:"Ü",yacute:"ý",Yacute:"Ý",yen:"¥",yuml:"ÿ"},t={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"},u=[1,2,3,4,5,6,7,8,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,64976,64977,64978,64979,64980,64981,64982,64983,64984,64985,64986,64987,64988,64989,64990,64991,64992,64993,64994,64995,64996,64997,64998,64999,65e3,65001,65002,65003,65004,65005,65006,65007,65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111],v=String.fromCharCode,w={},x=w.hasOwnProperty,y=function(a,b){return x.call(a,b)},z=function(a,b){for(var c=-1,d=a.length;++c=55296&&a<=57343||a>1114111?(b&&E("character reference outside the permissible Unicode range"),"�"):y(t,a)?(b&&E("disallowed character reference"),t[a]):(b&&z(u,a)&&E("disallowed character reference"),a>65535&&(a-=65536,c+=v(a>>>10&1023|55296),a=56320|1023&a),c+=v(a))},C=function(a){return"&#x"+a.toString(16).toUpperCase()+";"},D=function(a){return"&#"+a+";"},E=function(a){throw Error("Parse error: "+a)},F=function(a,b){b=A(b,F.options);var c=b.strict;c&&p.test(a)&&E("forbidden code point");var d=b.encodeEverything,e=b.useNamedReferences,f=b.allowUnsafeSymbols,g=b.decimal?D:C,n=function(a){return g(a.charCodeAt(0))};return d?(a=a.replace(i,function(a){return e&&y(l,a)?"&"+l[a]+";":n(a)}),e&&(a=a.replace(/>\u20D2/g,">⃒").replace(/<\u20D2/g,"<⃒").replace(/fj/g,"fj")),e&&(a=a.replace(k,function(a){return"&"+l[a]+";"}))):e?(f||(a=a.replace(m,function(a){return"&"+l[a]+";"})),a=a.replace(/>\u20D2/g,">⃒").replace(/<\u20D2/g,"<⃒"),a=a.replace(k,function(a){return"&"+l[a]+";"})):f||(a=a.replace(m,n)),a.replace(h,function(a){var b=a.charCodeAt(0),c=a.charCodeAt(1),d=1024*(b-55296)+c-56320+65536;return g(d)}).replace(j,n)};F.options={allowUnsafeSymbols:!1,encodeEverything:!1,strict:!1,useNamedReferences:!1,decimal:!1};var G=function(a,b){b=A(b,G.options);var c=b.strict;return c&&o.test(a)&&E("malformed character reference"),a.replace(q,function(a,d,e,f,g,h,i,j){var k,l,m,n,o,p;return d?(m=d,l=e,c&&!l&&E("character reference was not terminated by a semicolon"),k=parseInt(m,10),B(k,c)):f?(n=f,l=g,c&&!l&&E("character reference was not terminated by a semicolon"),k=parseInt(n,16),B(k,c)):h?(o=h,y(r,o)?r[o]:(c&&E("named character reference was not terminated by a semicolon"),a)):(o=i,p=j,p&&b.isAttributeValue?(c&&"="==p&&E("`&` did not start a character reference"),a):(c&&E("named character reference was not terminated by a semicolon"),s[o]+(p||"")))})};G.options={isAttributeValue:!1,strict:!1};var H=function(a){return a.replace(m,function(a){return n[a]})},I={version:"1.1.0",encode:F,decode:G,escape:H,unescape:G};if("function"==typeof define&&"object"==typeof define.amd&&define.amd)define(function(){return I});else if(e&&!e.nodeType)if(f)f.exports=I;else for(var J in I)y(I,J)&&(e[J]=I[J]);else d.he=I}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],72:[function(a,b,c){var d=a("http"),e=b.exports;for(var f in d)d.hasOwnProperty(f)&&(e[f]=d[f]);e.request=function(a,b){return a||(a={}),a.scheme="https",a.protocol="https:",d.request.call(this,a,b)}},{http:121}],73:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?NaN:(n?-1:1)*(1/0);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=b<0||0===b&&1/b<0?1:0;for(b=Math.abs(b),isNaN(b)||b===1/0?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],74:[function(a,b,c){"function"==typeof Object.create?b.exports=function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:b.exports=function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],75:[function(a,b,c){function d(a){return!!a.constructor&&"function"==typeof a.constructor.isBuffer&&a.constructor.isBuffer(a)}function e(a){return"function"==typeof a.readFloatLE&&"function"==typeof a.slice&&d(a.slice(0,0))}b.exports=function(a){return null!=a&&(d(a)||e(a)||!!a._isBuffer)}},{}],76:[function(a,b,c){var d={}.toString;b.exports=Array.isArray||function(a){return"[object Array]"==d.call(a)}},{}],77:[function(a,b,c){"use strict";function d(a){return a.source.slice(1,-1)}var e=a("xml-char-classes");b.exports=new RegExp("^["+d(e.letter)+"_]["+d(e.letter)+d(e.digit)+"\\.\\-_"+d(e.combiningChar)+d(e.extender)+"]*$")},{"xml-char-classes":145}],78:[function(a,b,c){c.endianness=function(){return"LE"},c.hostname=function(){return"undefined"!=typeof location?location.hostname:""},c.loadavg=function(){return[]},c.uptime=function(){return 0},c.freemem=function(){return Number.MAX_VALUE},c.totalmem=function(){return Number.MAX_VALUE},c.cpus=function(){return[]},c.type=function(){return"Browser"},c.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},c.networkInterfaces=c.getNetworkInterfaces=function(){return{}},c.arch=function(){return"javascript"},c.platform=function(){return"browser"},c.tmpdir=c.tmpDir=function(){return"/tmp"},c.EOL="\n"},{}],79:[function(a,b,c){(function(a){function b(a,b){for(var c=0,d=a.length-1;d>=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;c1&&(d=c[0]+"@",a=c[1]),a=a.replace(G,".");var e=a.split("."),g=f(e,b).join(".");return d+g}function h(a){for(var b,c,d=[],e=0,f=a.length;e=55296&&b<=56319&&e65535&&(a-=65536,b+=K(a>>>10&1023|55296),a=56320|1023&a),b+=K(a)}).join("")}function j(a){return a-48<10?a-22:a-65<26?a-65:a-97<26?a-97:w}function k(a,b){return a+22+75*(a<26)-((0!=b)<<5)}function l(a,b,c){var d=0;for(a=c?J(a/A):a>>1,a+=J(a/b);a>I*y>>1;d+=w)a=J(a/I);return J(d+(I+1)*a/(a+z))}function m(a){var b,c,d,f,g,h,k,m,n,o,p=[],q=a.length,r=0,s=C,t=B;for(c=a.lastIndexOf(D),c<0&&(c=0),d=0;d=128&&e("not-basic"),p.push(a.charCodeAt(d));for(f=c>0?c+1:0;f=q&&e("invalid-input"),m=j(a.charCodeAt(f++)),(m>=w||m>J((v-r)/h))&&e("overflow"),r+=m*h,n=k<=t?x:k>=t+y?y:k-t,!(mJ(v/o)&&e("overflow"),h*=o;b=p.length+1,t=l(r-g,b,0==g),J(r/b)>v-s&&e("overflow"),s+=J(r/b),r%=b,p.splice(r++,0,s)}return i(p)}function n(a){var b,c,d,f,g,i,j,m,n,o,p,q,r,s,t,u=[]; -for(a=h(a),q=a.length,b=C,c=0,g=B,i=0;i=b&&pJ((v-c)/r)&&e("overflow"),c+=(j-b)*r,b=j,i=0;iv&&e("overflow"),p==b){for(m=c,n=w;o=n<=g?x:n>=g+y?y:n-g,!(m= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=w-x,J=Math.floor,K=String.fromCharCode;if(t={version:"1.4.1",ucs2:{decode:h,encode:i},decode:m,encode:n,toASCII:p,toUnicode:o},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return t});else if(q&&r)if(b.exports==q)r.exports=t;else for(u in t)t.hasOwnProperty(u)&&(q[u]=t[u]);else d.punycode=t}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],83:[function(a,b,c){"use strict";function d(a,b){return Object.prototype.hasOwnProperty.call(a,b)}b.exports=function(a,b,c,f){b=b||"&",c=c||"=";var g={};if("string"!=typeof a||0===a.length)return g;var h=/\+/g;a=a.split(b);var i=1e3;f&&"number"==typeof f.maxKeys&&(i=f.maxKeys);var j=a.length;i>0&&j>i&&(j=i);for(var k=0;k=0?(l=p.substr(0,q),m=p.substr(q+1)):(l=p,m=""),n=decodeURIComponent(l),o=decodeURIComponent(m),d(g,n)?e(g[n])?g[n].push(o):g[n]=[g[n],o]:g[n]=o}return g};var e=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}},{}],84:[function(a,b,c){"use strict";function d(a,b){if(a.map)return a.map(b);for(var c=[],d=0;d0)if(b.ended&&!e){var g=new Error("stream.push() after EOF");a.emit("error",g)}else if(b.endEmitted&&e){var i=new Error("stream.unshift() after end event");a.emit("error",i)}else{var j;!b.decoder||e||d||(c=b.decoder.write(c),j=!b.objectMode&&0===c.length),e||(b.reading=!1),j||(b.flowing&&0===b.length&&!b.sync?(a.emit("data",c),a.read(0)):(b.length+=b.objectMode?1:c.length,e?b.buffer.unshift(c):b.buffer.push(c),b.needReadable&&m(a))),o(a,b)}else e||(b.reading=!1);return h(b)}function h(a){return!a.ended&&(a.needReadable||a.length=P?a=P:(a--,a|=a>>>1,a|=a>>>2,a|=a>>>4,a|=a>>>8,a|=a>>>16,a++),a}function j(a,b){return a<=0||0===b.length&&b.ended?0:b.objectMode?1:a!==a?b.flowing&&b.length?b.buffer.head.data.length:b.length:(a>b.highWaterMark&&(b.highWaterMark=i(a)),a<=b.length?a:b.ended?b.length:(b.needReadable=!0,0))}function k(a,b){var c=null;return I.isBuffer(b)||"string"==typeof b||null===b||void 0===b||a.objectMode||(c=new TypeError("Invalid non-string/buffer chunk")),c}function l(a,b){if(!b.ended){if(b.decoder){var c=b.decoder.end();c&&c.length&&(b.buffer.push(c),b.length+=b.objectMode?1:c.length)}b.ended=!0,m(a)}}function m(a){var b=a._readableState;b.needReadable=!1,b.emittedReadable||(M("emitReadable",b.flowing),b.emittedReadable=!0,b.sync?E(n,a):n(a))}function n(a){M("emit readable"),a.emit("readable"),u(a)}function o(a,b){b.readingMore||(b.readingMore=!0,E(p,a,b))}function p(a,b){for(var c=b.length;!b.reading&&!b.flowing&&!b.ended&&b.length=b.length?(c=b.decoder?b.buffer.join(""):1===b.buffer.length?b.buffer.head.data:b.buffer.concat(b.length),b.buffer.clear()):c=w(a,b.buffer,b.decoder),c}function w(a,b,c){var d;return af.length?f.length:a;if(e+=g===f.length?f:f.slice(0,a),a-=g,0===a){g===f.length?(++d,c.next?b.head=c.next:b.head=b.tail=null):(b.head=c,c.data=f.slice(g));break}++d}return b.length-=d,e}function y(a,b){var c=J.allocUnsafe(a),d=b.head,e=1;for(d.data.copy(c),a-=d.data.length;d=d.next;){var f=d.data,g=a>f.length?f.length:a;if(f.copy(c,c.length-a,0,g),a-=g,0===a){g===f.length?(++e,d.next?b.head=d.next:b.head=b.tail=null):(b.head=d,d.data=f.slice(g));break}++e}return b.length-=e,c}function z(a){var b=a._readableState;if(b.length>0)throw new Error('"endReadable()" called on non-empty stream');b.endEmitted||(b.ended=!0,E(A,b,a))}function A(a,b){a.endEmitted||0!==a.length||(a.endEmitted=!0,b.readable=!1,b.emit("end"))}function B(a,b){for(var c=0,d=a.length;c=b.highWaterMark||b.ended))return M("read: emitReadable",b.length,b.ended),0===b.length&&b.ended?z(this):m(this),null;if(a=j(a,b),0===a&&b.ended)return 0===b.length&&z(this),null;var d=b.needReadable;M("need readable",d),(0===b.length||b.length-a0?v(a,b):null,null===e?(b.needReadable=!0,a=0):b.length-=a,0===b.length&&(b.ended||(b.needReadable=!0),c!==a&&b.ended&&z(this)),null!==e&&this.emit("data",e),e},f.prototype._read=function(a){this.emit("error",new Error("_read() is not implemented"))},f.prototype.pipe=function(a,b){function e(a){M("onunpipe"),a===m&&g()}function f(){M("onend"),a.end()}function g(){M("cleanup"),a.removeListener("close",j),a.removeListener("finish",k),a.removeListener("drain",r),a.removeListener("error",i),a.removeListener("unpipe",e),m.removeListener("end",f),m.removeListener("end",g),m.removeListener("data",h),s=!0,!n.awaitDrain||a._writableState&&!a._writableState.needDrain||r()}function h(b){M("ondata"),t=!1;var c=a.write(b);!1!==c||t||((1===n.pipesCount&&n.pipes===a||n.pipesCount>1&&C(n.pipes,a)!==-1)&&!s&&(M("false write response, pause",m._readableState.awaitDrain),m._readableState.awaitDrain++,t=!0),m.pause())}function i(b){M("onerror",b),l(),a.removeListener("error",i),0===H(a,"error")&&a.emit("error",b)}function j(){a.removeListener("finish",k),l()}function k(){M("onfinish"),a.removeListener("close",j),l()}function l(){M("unpipe"),m.unpipe(a)}var m=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=a;break;case 1:n.pipes=[n.pipes,a];break;default:n.pipes.push(a)}n.pipesCount+=1,M("pipe count=%d opts=%j",n.pipesCount,b);var o=(!b||b.end!==!1)&&a!==c.stdout&&a!==c.stderr,p=o?f:g;n.endEmitted?E(p):m.once("end",p),a.on("unpipe",e);var r=q(m);a.on("drain",r);var s=!1,t=!1;return m.on("data",h),d(a,"error",i),a.once("close",j),a.once("finish",k),a.emit("pipe",m),n.flowing||(M("pipe resume"),m.resume()),a},f.prototype.unpipe=function(a){var b=this._readableState;if(0===b.pipesCount)return this;if(1===b.pipesCount)return a&&a!==b.pipes?this:(a||(a=b.pipes),b.pipes=null,b.pipesCount=0,b.flowing=!1,a&&a.emit("unpipe",this),this);if(!a){var c=b.pipes,d=b.pipesCount;b.pipes=null,b.pipesCount=0,b.flowing=!1;for(var e=0;e-1?setImmediate:y;g.WritableState=f;var A=a("core-util-is");A.inherits=a("inherits");var B,C={deprecate:a("util-deprecate")};!function(){try{B=a("stream")}catch(a){}finally{B||(B=a("events").EventEmitter)}}();var D=a("buffer").Buffer,E=a("buffer-shims");A.inherits(g,B),f.prototype.getBuffer=function(){for(var a=this.bufferedRequest,b=[];a;)b.push(a),a=a.next;return b},function(){try{Object.defineProperty(f.prototype,"buffer",{get:C.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(a){}}();var F;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(F=Function.prototype[Symbol.hasInstance],Object.defineProperty(g,Symbol.hasInstance,{value:function(a){return!!F.call(this,a)||a&&a._writableState instanceof f}})):F=function(a){return a instanceof this},g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},g.prototype.write=function(a,b,c){var e=this._writableState,f=!1;return"function"==typeof b&&(c=b,b=null),D.isBuffer(a)?b="buffer":b||(b=e.defaultEncoding),"function"!=typeof c&&(c=d),e.ended?h(this,c):i(this,e,a,c)&&(e.pendingcb++,f=k(this,e,a,b,c)),f},g.prototype.cork=function(){var a=this._writableState;a.corked++},g.prototype.uncork=function(){var a=this._writableState;a.corked&&(a.corked--,a.writing||a.corked||a.finished||a.bufferProcessing||!a.bufferedRequest||r(this,a))},g.prototype.setDefaultEncoding=function(a){if("string"==typeof a&&(a=a.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((a+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+a);return this._writableState.defaultEncoding=a,this},g.prototype._write=function(a,b,c){c(new Error("_write() is not implemented"))},g.prototype._writev=null,g.prototype.end=function(a,b,c){var d=this._writableState;"function"==typeof a?(c=a,a=null,b=null):"function"==typeof b&&(c=b,b=null),null!==a&&void 0!==a&&this.write(a,b),d.corked&&(d.corked=1,this.uncork()),d.ending||d.finished||v(this,d,c)}}).call(this,a("_process"))},{"./_stream_duplex":86,_process:81,buffer:6,"buffer-shims":5,"core-util-is":69,events:70,inherits:74,"process-nextick-args":80,"util-deprecate":141}],91:[function(a,b,c){"use strict";function d(){this.head=null,this.tail=null,this.length=0}var e=(a("buffer").Buffer,a("buffer-shims"));b.exports=d,d.prototype.push=function(a){var b={data:a,next:null};this.length>0?this.tail.next=b:this.head=b,this.tail=b,++this.length},d.prototype.unshift=function(a){var b={data:a,next:this.head};0===this.length&&(this.tail=b),this.head=b,++this.length},d.prototype.shift=function(){if(0!==this.length){var a=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,a}},d.prototype.clear=function(){this.head=this.tail=null,this.length=0},d.prototype.join=function(a){if(0===this.length)return"";for(var b=this.head,c=""+b.data;b=b.next;)c+=a+b.data;return c},d.prototype.concat=function(a){if(0===this.length)return e.alloc(0);if(1===this.length)return this.head.data;for(var b=e.allocUnsafe(a>>>0),c=this.head,d=0;c;)c.data.copy(b,d),d+=c.data.length,c=c.next;return b}},{buffer:6,"buffer-shims":5}],92:[function(a,b,c){(function(d){var e=function(){try{return a("stream")}catch(a){}}();c=b.exports=a("./lib/_stream_readable.js"),c.Stream=e||c,c.Readable=c,c.Writable=a("./lib/_stream_writable.js"),c.Duplex=a("./lib/_stream_duplex.js"),c.Transform=a("./lib/_stream_transform.js"),c.PassThrough=a("./lib/_stream_passthrough.js"),!d.browser&&"disable"===d.env.READABLE_STREAM&&e&&(b.exports=e)}).call(this,a("_process"))},{"./lib/_stream_duplex.js":86,"./lib/_stream_passthrough.js":87,"./lib/_stream_readable.js":88,"./lib/_stream_transform.js":89,"./lib/_stream_writable.js":90,_process:81}],93:[function(a,b,c){"use strict";b.exports={ABSOLUTE:"absolute",PATH_RELATIVE:"pathRelative",ROOT_RELATIVE:"rootRelative",SHORTEST:"shortest"}},{}],94:[function(a,b,c){"use strict";function d(a,b){return!a.auth||b.removeAuth||!a.extra.relation.maximumHost&&b.output!==p.ABSOLUTE?"":a.auth+"@"}function e(a,b){return a.hash?a.hash:""}function f(a,b){return a.host.full&&(a.extra.relation.maximumAuth||b.output===p.ABSOLUTE)?a.host.full:""}function g(a,b){var c="",d=a.path.absolute.string,e=a.path.relative.string,f=o(a,b);if(a.extra.relation.maximumHost||b.output===p.ABSOLUTE||b.output===p.ROOT_RELATIVE)c=d;else if(e.length<=d.length&&b.output===p.SHORTEST||b.output===p.PATH_RELATIVE){if(c=e,""===c){var g=n(a,b)&&!!m(a,b);a.extra.relation.maximumPath&&!f?c="./":!a.extra.relation.overridesQuery||f||g||(c="./")}}else c=d;return"/"!==c||f||!b.removeRootTrailingSlash||a.extra.relation.minimumPort&&b.output!==p.ABSOLUTE||(c=""),c}function h(a,b){return a.port&&!a.extra.portIsDefault&&a.extra.relation.maximumHost?":"+a.port:""}function i(a,b){return n(a,b)?m(a,b):""}function j(a,b){return o(a,b)?a.resource:""}function k(a,b){var c="";return(a.extra.relation.maximumHost||b.output===p.ABSOLUTE)&&(c+=a.extra.relation.minimumScheme&&b.schemeRelative&&b.output!==p.ABSOLUTE?"//":a.scheme+"://"),c}function l(a,b){var c="";return c+=k(a,b),c+=d(a,b),c+=f(a,b),c+=h(a,b),c+=g(a,b),c+=j(a,b),c+=i(a,b),c+=e(a,b)}function m(a,b){var c=b.removeEmptyQueries&&a.extra.relation.minimumPort;return a.query.string[c?"stripped":"full"]}function n(a,b){return!a.extra.relation.minimumQuery||b.output===p.ABSOLUTE||b.output===p.ROOT_RELATIVE}function o(a,b){var c=b.removeDirectoryIndexes&&a.extra.resourceIsIndex,d=a.extra.relation.minimumResource&&b.output!==p.ABSOLUTE&&b.output!==p.ROOT_RELATIVE;return!!a.resource&&!d&&!c}var p=a("./constants");b.exports=l},{"./constants":93}],95:[function(a,b,c){"use strict";function d(a,b){this.options=g(b,{defaultPorts:{ftp:21,http:80,https:443},directoryIndexes:["index.html"],ignore_www:!1,output:d.SHORTEST,rejectedSchemes:["data","javascript","mailto"],removeAuth:!1,removeDirectoryIndexes:!0,removeEmptyQueries:!1,removeRootTrailingSlash:!0,schemeRelative:!0,site:void 0,slashesDenoteHost:!0}),this.from=i.from(a,this.options,null)}var e=a("./constants"),f=a("./format"),g=a("./options"),h=a("./util/object"),i=a("./parse"),j=a("./relate");d.prototype.relate=function(a,b,c){if(h.isPlainObject(b)?(c=b,b=a,a=null):b||(b=a,a=null),c=g(c,this.options),a=a||c.site,a=i.from(a,c,this.from),!a||!a.href)throw new Error("from value not defined.");if(a.extra.hrefInfo.minimumPathOnly)throw new Error("from value supplied is not absolute: "+a.href);return b=i.to(b,c),b.valid===!1?b.href:(b=j(a,b,c),b=f(b,c))},d.relate=function(a,b,c){return(new d).relate(a,b,c)},h.shallowMerge(d,e),b.exports=d},{"./constants":93,"./format":94,"./options":96,"./parse":99,"./relate":106,"./util/object":108}],96:[function(a,b,c){"use strict";function d(a,b){if(f.isPlainObject(a)){var c={};for(var d in b)b.hasOwnProperty(d)&&(void 0!==a[d]?c[d]=e(a[d],b[d]):c[d]=b[d]);return c}return b}function e(a,b){return b instanceof Object&&a instanceof Object?b instanceof Array&&a instanceof Array?b.concat(a):f.shallowMerge(a,b):a}var f=a("./util/object");b.exports=d},{"./util/object":108}],97:[function(a,b,c){"use strict";function d(a,b){if(b.ignore_www){var c=a.host.full;if(c){var d=c;0===c.indexOf("www.")&&(d=c.substr(4)),a.host.stripped=d}}}b.exports=d},{}],98:[function(a,b,c){"use strict";function d(a){var b=!(a.scheme||a.auth||a.host.full||a.port),c=b&&!a.path.absolute.string,d=c&&!a.resource,e=d&&!a.query.string.full.length,f=e&&!a.hash;a.extra.hrefInfo.minimumPathOnly=b,a.extra.hrefInfo.minimumResourceOnly=c,a.extra.hrefInfo.minimumQueryOnly=d,a.extra.hrefInfo.minimumHashOnly=e,a.extra.hrefInfo.empty=f}b.exports=d},{}],99:[function(a,b,c){"use strict";function d(a,b,c){if(a){var d=e(a,b),f=l.resolveDotSegments(d.path.absolute.array);return d.path.absolute.array=f,d.path.absolute.string="/"+l.join(f),d}return c}function e(a,b){var c=k(a,b);return c.valid===!1?c:(g(c,b),i(c,b),h(c,b),j(c,b),f(c),c)}var f=a("./hrefInfo"),g=a("./host"),h=a("./path"),i=a("./port"),j=a("./query"),k=a("./urlstring"),l=a("../util/path");b.exports={from:d,to:e}},{"../util/path":109,"./host":97,"./hrefInfo":98,"./path":100,"./port":101,"./query":102,"./urlstring":103}],100:[function(a,b,c){"use strict";function d(a,b){var c=!1;return b.directoryIndexes.every(function(b){return b!==a||(c=!0,!1)}),c}function e(a,b){var c=a.path.absolute.string;if(c){var e=c.lastIndexOf("/");if(e>-1){if(++e-1&&(c=c.toString(),null===a.port&&(a.port=c),a.extra.portIsDefault=a.port===c)}b.exports=d},{}],102:[function(a,b,c){"use strict";function d(a,b){a.query.string.full=e(a.query.object,!1),b.removeEmptyQueries&&(a.query.string.stripped=e(a.query.object,!0))}function e(a,b){var c=0,d="";for(var e in a)if(""!==e&&f.call(a,e)===!0){var g=a[e];""===g&&b||(d+=1===++c?"?":"&",e=encodeURIComponent(e),d+=""!==g?e+"="+encodeURIComponent(g).replace(/%20/g,"+"):e)}return d}var f=Object.prototype.hasOwnProperty;b.exports=d},{}],103:[function(a,b,c){"use strict";function d(a){var b=a.protocol;return b&&b.indexOf(":")===b.length-1&&(b=b.substr(0,b.length-1)),a.host={full:a.hostname,stripped:null},a.path={absolute:{array:null,string:a.pathname},relative:{array:null,string:null}},a.query={object:a.query,string:{full:null,stripped:null}},a.extra={hrefInfo:{minimumPathOnly:null,minimumResourceOnly:null,minimumQueryOnly:null,minimumHashOnly:null,empty:null,separatorOnlyQuery:"?"===a.search},portIsDefault:null,relation:{maximumScheme:null,maximumAuth:null,maximumHost:null,maximumPort:null,maximumPath:null,maximumResource:null,maximumQuery:null,maximumHash:null,minimumScheme:null,minimumAuth:null,minimumHost:null,minimumPort:null,minimumPath:null,minimumResource:null,minimumQuery:null,minimumHash:null,overridesQuery:null},resourceIsIndex:null,slashes:a.slashes},a.resource=null,a.scheme=b,delete a.hostname,delete a.pathname,delete a.protocol,delete a.search,delete a.slashes,a}function e(a,b){var c=!0;return b.rejectedSchemes.every(function(b){return c=!(0===a.indexOf(b+":"))}),c}function f(a,b){return e(a,b)?d(g(a,!0,b.slashesDenoteHost)):{href:a,valid:!1}}var g=a("url").parse;b.exports=f},{url:139}],104:[function(a,b,c){"use strict";function d(a,b,c){h.upToPath(a,b,c),a.extra.relation.minimumScheme&&(a.scheme=b.scheme),a.extra.relation.minimumAuth&&(a.auth=b.auth),a.extra.relation.minimumHost&&(a.host=i.clone(b.host)),a.extra.relation.minimumPort&&f(a,b),a.extra.relation.minimumScheme&&e(a,b),h.pathOn(a,b,c),a.extra.relation.minimumResource&&g(a,b),a.extra.relation.minimumQuery&&(a.query=i.clone(b.query)),a.extra.relation.minimumHash&&(a.hash=b.hash)}function e(a,b){if(a.extra.relation.maximumHost||!a.extra.hrefInfo.minimumResourceOnly){var c=a.path.absolute.array,d="/";c?(a.extra.hrefInfo.minimumPathOnly&&0!==a.path.absolute.string.indexOf("/")&&(c=b.path.absolute.array.concat(c)),c=j.resolveDotSegments(c),d+=j.join(c)):c=[],a.path.absolute.array=c,a.path.absolute.string=d}else a.path=i.clone(b.path)}function f(a,b){a.port=b.port,a.extra.portIsDefault=b.extra.portIsDefault} -function g(a,b){a.resource=b.resource,a.extra.resourceIsIndex=b.extra.resourceIsIndex}var h=a("./findRelation"),i=a("../util/object"),j=a("../util/path");b.exports=d},{"../util/object":108,"../util/path":109,"./findRelation":105}],105:[function(a,b,c){"use strict";function d(a,b,c){var d=a.extra.hrefInfo.minimumPathOnly,e=a.scheme===b.scheme||!a.scheme,f=e&&(a.auth===b.auth||c.removeAuth||d),g=c.ignore_www?"stripped":"full",h=f&&(a.host[g]===b.host[g]||d),i=h&&(a.port===b.port||d);a.extra.relation.minimumScheme=e,a.extra.relation.minimumAuth=f,a.extra.relation.minimumHost=h,a.extra.relation.minimumPort=i,a.extra.relation.maximumScheme=!e||e&&!f,a.extra.relation.maximumAuth=!e||e&&!h,a.extra.relation.maximumHost=!e||e&&!i}function e(a,b,c){var d=a.extra.hrefInfo.minimumQueryOnly,e=a.extra.hrefInfo.minimumHashOnly,f=a.extra.hrefInfo.empty,g=a.extra.relation.minimumPort,h=a.extra.relation.minimumScheme,i=g&&a.path.absolute.string===b.path.absolute.string,j=a.resource===b.resource||!a.resource&&b.extra.resourceIsIndex||c.removeDirectoryIndexes&&a.extra.resourceIsIndex&&!b.resource,k=i&&(j||d||e||f),l=c.removeEmptyQueries?"stripped":"full",m=a.query.string[l],n=b.query.string[l],o=k&&!!m&&m===n||(e||f)&&!a.extra.hrefInfo.separatorOnlyQuery,p=o&&a.hash===b.hash;a.extra.relation.minimumPath=i,a.extra.relation.minimumResource=k,a.extra.relation.minimumQuery=o,a.extra.relation.minimumHash=p,a.extra.relation.maximumPort=!h||h&&!i,a.extra.relation.maximumPath=!h||h&&!k,a.extra.relation.maximumResource=!h||h&&!o,a.extra.relation.maximumQuery=!h||h&&!p,a.extra.relation.maximumHash=!h||h&&!p,a.extra.relation.overridesQuery=i&&a.extra.relation.maximumResource&&!o&&!!n}b.exports={pathOn:e,upToPath:d}},{}],106:[function(a,b,c){"use strict";function d(a,b,c){return e(b,a,c),f(b,a,c),b}var e=a("./absolutize"),f=a("./relativize");b.exports=d},{"./absolutize":104,"./relativize":107}],107:[function(a,b,c){"use strict";function d(a,b){var c=[],d=!0,e=-1;return b.forEach(function(b,f){d&&(a[f]!==b?d=!1:e=f),d||c.push("..")}),a.forEach(function(a,b){b>e&&c.push(a)}),c}function e(a,b,c){if(a.extra.relation.minimumScheme){var e=d(a.path.absolute.array,b.path.absolute.array);a.path.relative.array=e,a.path.relative.string=f.join(e)}}var f=a("../util/path");b.exports=e},{"../util/path":109}],108:[function(a,b,c){"use strict";function d(a){if(a instanceof Object){var b=a instanceof Array?[]:{};for(var c in a)a.hasOwnProperty(c)&&(b[c]=d(a[c]));return b}return a}function e(a){return!!a&&"object"==typeof a&&a.constructor===Object}function f(a,b){if(a instanceof Object&&b instanceof Object)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}b.exports={clone:d,isPlainObject:e,shallowMerge:f}},{}],109:[function(a,b,c){"use strict";function d(a){return a.length>0?a.join("/")+"/":""}function e(a){var b=[];return a.forEach(function(a){".."!==a?"."!==a&&b.push(a):b.length>0&&b.splice(b.length-1,1)}),b}b.exports={join:d,resolveDotSegments:e}},{}],110:[function(a,b,c){c.SourceMapGenerator=a("./source-map/source-map-generator").SourceMapGenerator,c.SourceMapConsumer=a("./source-map/source-map-consumer").SourceMapConsumer,c.SourceNode=a("./source-map/source-node").SourceNode},{"./source-map/source-map-consumer":117,"./source-map/source-map-generator":118,"./source-map/source-node":119}],111:[function(a,b,c){if("function"!=typeof d)var d=a("amdefine")(b,a);d(function(a,b,c){function d(){this._array=[],this._set={}}var e=a("./util");d.fromArray=function(a,b){for(var c=new d,e=0,f=a.length;e=0&&a>1;return b?-c:c}var f=a("./base64"),g=5,h=1<>>=g,e>0&&(b|=j),c+=f.encode(b);while(e>0);return c},b.decode=function(a,b,c){var d,h,k=a.length,l=0,m=0;do{if(b>=k)throw new Error("Expected more digits in base 64 VLQ value.");if(h=f.decode(a.charCodeAt(b++)),h===-1)throw new Error("Invalid base64 digit: "+a.charAt(b-1));d=!!(h&j),h&=i,l+=h<0?c-i>1?d(i,c,e,f,g,h):h==b.LEAST_UPPER_BOUND?c1?d(a,i,e,f,g,h):h==b.LEAST_UPPER_BOUND?i:a<0?-1:a}b.GREATEST_LOWER_BOUND=1,b.LEAST_UPPER_BOUND=2,b.search=function(a,c,e,f){if(0===c.length)return-1;var g=d(-1,c.length,a,c,e,f||b.GREATEST_LOWER_BOUND);if(g<0)return-1;for(;g-1>=0&&0===e(c[g],c[g-1],!0);)--g;return g}})},{amdefine:1}],115:[function(a,b,c){if("function"!=typeof d)var d=a("amdefine")(b,a);d(function(a,b,c){function d(a,b){var c=a.generatedLine,d=b.generatedLine,e=a.generatedColumn,g=b.generatedColumn;return d>c||d==c&&g>=e||f.compareByGeneratedPositionsInflated(a,b)<=0}function e(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var f=a("./util");e.prototype.unsortedForEach=function(a,b){this._array.forEach(a,b)},e.prototype.add=function(a){d(this._last,a)?(this._last=a,this._array.push(a)):(this._sorted=!1,this._array.push(a))},e.prototype.toArray=function(){return this._sorted||(this._array.sort(f.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},b.MappingList=e})},{"./util":120,amdefine:1}],116:[function(a,b,c){if("function"!=typeof d)var d=a("amdefine")(b,a);d(function(a,b,c){function d(a,b,c){var d=a[b];a[b]=a[c],a[c]=d}function e(a,b){return Math.round(a+Math.random()*(b-a))}function f(a,b,c,g){if(c=0){var f=this._originalMappings[e];if(void 0===a.column)for(var g=f.originalLine;f&&f.originalLine===g;)d.push({line:h.getArg(f,"generatedLine",null),column:h.getArg(f,"generatedColumn",null),lastColumn:h.getArg(f,"lastGeneratedColumn",null)}),f=this._originalMappings[++e];else for(var j=f.originalColumn;f&&f.originalLine===b&&f.originalColumn==j;)d.push({line:h.getArg(f,"generatedLine",null),column:h.getArg(f,"generatedColumn",null),lastColumn:h.getArg(f,"lastGeneratedColumn",null)}),f=this._originalMappings[++e]}return d},b.SourceMapConsumer=d,e.prototype=Object.create(d.prototype),e.prototype.consumer=d,e.fromSourceMap=function(a){var b=Object.create(e.prototype),c=b._names=j.fromArray(a._names.toArray(),!0),d=b._sources=j.fromArray(a._sources.toArray(),!0);b.sourceRoot=a._sourceRoot,b.sourcesContent=a._generateSourcesContent(b._sources.toArray(),b.sourceRoot),b.file=a._file;for(var g=a._mappings.toArray().slice(),i=b.__generatedMappings=[],k=b.__originalMappings=[],m=0,n=g.length;m1&&(c.source=p+e[1],p+=e[1],c.originalLine=n+e[2],n=c.originalLine,c.originalLine+=1,c.originalColumn=o+e[3],o=c.originalColumn,e.length>4&&(c.name=q+e[4],q+=e[4])),w.push(c),"number"==typeof c.originalLine&&v.push(c)}l(w,h.compareByGeneratedPositionsDeflated),this.__generatedMappings=w,l(v,h.compareByOriginalPositions),this.__originalMappings=v},e.prototype._findMapping=function(a,b,c,d,e,f){if(a[c]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+a[c]);if(a[d]<0)throw new TypeError("Column must be greater than or equal to 0, got "+a[d]);return i.search(a,b,e,f)},e.prototype.computeColumnSpans=function(){for(var a=0;a=0){var e=this._generatedMappings[c];if(e.generatedLine===b.generatedLine){var f=h.getArg(e,"source",null);null!==f&&(f=this._sources.at(f),null!=this.sourceRoot&&(f=h.join(this.sourceRoot,f)));var g=h.getArg(e,"name",null);return null!==g&&(g=this._names.at(g)),{source:f,line:h.getArg(e,"originalLine",null),column:h.getArg(e,"originalColumn",null),name:g}}}return{source:null,line:null,column:null,name:null}},e.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(a){return null==a}))},e.prototype.sourceContentFor=function(a,b){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(a=h.relative(this.sourceRoot,a)),this._sources.has(a))return this.sourcesContent[this._sources.indexOf(a)];var c;if(null!=this.sourceRoot&&(c=h.urlParse(this.sourceRoot))){var d=a.replace(/^file:\/\//,"");if("file"==c.scheme&&this._sources.has(d))return this.sourcesContent[this._sources.indexOf(d)];if((!c.path||"/"==c.path)&&this._sources.has("/"+a))return this.sourcesContent[this._sources.indexOf("/"+a)]}if(b)return null;throw new Error('"'+a+'" is not in the SourceMap.')},e.prototype.generatedPositionFor=function(a){var b=h.getArg(a,"source");if(null!=this.sourceRoot&&(b=h.relative(this.sourceRoot,b)),!this._sources.has(b))return{line:null,column:null,lastColumn:null};b=this._sources.indexOf(b);var c={source:b,originalLine:h.getArg(a,"line"),originalColumn:h.getArg(a,"column")},e=this._findMapping(c,this._originalMappings,"originalLine","originalColumn",h.compareByOriginalPositions,h.getArg(a,"bias",d.GREATEST_LOWER_BOUND));if(e>=0){var f=this._originalMappings[e];if(f.source===c.source)return{line:h.getArg(f,"generatedLine",null),column:h.getArg(f,"generatedColumn",null),lastColumn:h.getArg(f,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},b.BasicSourceMapConsumer=e,g.prototype=Object.create(d.prototype),g.prototype.constructor=d,g.prototype._version=3,Object.defineProperty(g.prototype,"sources",{get:function(){for(var a=[],b=0;b0&&a.column>=0)||b||c||d)&&!(a&&"line"in a&&"column"in a&&b&&"line"in b&&"column"in b&&a.line>0&&a.column>=0&&b.line>0&&b.column>=0&&c))throw new Error("Invalid mapping: "+JSON.stringify({generated:a,source:c,original:b,name:d}))},d.prototype._serializeMappings=function(){for(var a,b=0,c=1,d=0,g=0,h=0,i=0,j="",k=this._mappings.toArray(),l=0,m=k.length;l0){if(!f.compareByGeneratedPositionsInflated(a,k[l-1]))continue;j+=","}j+=e.encode(a.generatedColumn-b),b=a.generatedColumn,null!=a.source&&(j+=e.encode(this._sources.indexOf(a.source)-i),i=this._sources.indexOf(a.source),j+=e.encode(a.originalLine-1-g),g=a.originalLine-1,j+=e.encode(a.originalColumn-d),d=a.originalColumn,null!=a.name&&(j+=e.encode(this._names.indexOf(a.name)-h),h=this._names.indexOf(a.name)))}return j},d.prototype._generateSourcesContent=function(a,b){return a.map(function(a){if(!this._sourcesContents)return null;null!=b&&(a=f.relative(b,a));var c=f.toSetString(a);return Object.prototype.hasOwnProperty.call(this._sourcesContents,c)?this._sourcesContents[c]:null},this)},d.prototype.toJSON=function(){var a={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(a.file=this._file),null!=this._sourceRoot&&(a.sourceRoot=this._sourceRoot),this._sourcesContents&&(a.sourcesContent=this._generateSourcesContent(a.sources,a.sourceRoot)),a},d.prototype.toString=function(){return JSON.stringify(this.toJSON())},b.SourceMapGenerator=d})},{"./array-set":111,"./base64-vlq":112,"./mapping-list":115,"./util":120,amdefine:1}],119:[function(a,b,c){if("function"!=typeof d)var d=a("amdefine")(b,a);d(function(a,b,c){function d(a,b,c,d,e){this.children=[],this.sourceContents={},this.line=null==a?null:a,this.column=null==b?null:b,this.source=null==c?null:c,this.name=null==e?null:e,this[i]=!0,null!=d&&this.add(d)}var e=a("./source-map-generator").SourceMapGenerator,f=a("./util"),g=/(\r?\n)/,h=10,i="$$$isSourceNode$$$";d.fromStringWithSourceMap=function(a,b,c){function e(a,b){if(null===a||void 0===a.source)h.add(b);else{var e=c?f.join(c,a.source):a.source;h.add(new d(a.originalLine,a.originalColumn,e,b,a.name))}}var h=new d,i=a.split(g),j=function(){var a=i.shift(),b=i.shift()||"";return a+b},k=1,l=0,m=null;return b.eachMapping(function(a){if(null!==m){if(!(k0&&(m&&e(m,j()),h.add(i.join(""))),b.sources.forEach(function(a){var d=b.sourceContentFor(a);null!=d&&(null!=c&&(a=f.join(c,a)),h.setSourceContent(a,d))}),h},d.prototype.add=function(a){if(Array.isArray(a))a.forEach(function(a){this.add(a)},this);else{if(!a[i]&&"string"!=typeof a)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+a);a&&this.children.push(a)}return this},d.prototype.prepend=function(a){if(Array.isArray(a))for(var b=a.length-1;b>=0;b--)this.prepend(a[b]);else{if(!a[i]&&"string"!=typeof a)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+a);this.children.unshift(a)}return this},d.prototype.walk=function(a){for(var b,c=0,d=this.children.length;c0){for(b=[],c=0;c=0;j--)d=h[j],"."===d?h.splice(j,1):".."===d?i++:i>0&&(""===d?(h.splice(j+1,i),i=0):(h.splice(j,2),i--));return b=h.join("/"),""===b&&(b=g?"/":"."),c?(c.path=b,f(c)):b}function h(a,b){""===a&&(a="."),""===b&&(b=".");var c=e(b),d=e(a);if(d&&(a=d.path||"/"),c&&!c.scheme)return d&&(c.scheme=d.scheme),f(c);if(c||b.match(q))return b;if(d&&!d.host&&!d.path)return d.host=b,f(d);var h="/"===b.charAt(0)?b:g(a.replace(/\/+$/,"")+"/"+b);return d?(d.path=h,f(d)):h}function i(a,b){""===a&&(a="."),a=a.replace(/\/$/,"");for(var c=0;0!==b.indexOf(a+"/");){var d=a.lastIndexOf("/");if(d<0)return b;if(a=a.slice(0,d),a.match(/^([^\/]+:\/)?\/*$/))return b;++c}return Array(c+1).join("../")+b.substr(a.length+1)}function j(a){return"$"+a}function k(a){return a.substr(1)}function l(a,b,c){var d=a.source-b.source;return 0!==d?d:(d=a.originalLine-b.originalLine,0!==d?d:(d=a.originalColumn-b.originalColumn,0!==d||c?d:(d=a.generatedColumn-b.generatedColumn,0!==d?d:(d=a.generatedLine-b.generatedLine,0!==d?d:a.name-b.name))))}function m(a,b,c){var d=a.generatedLine-b.generatedLine;return 0!==d?d:(d=a.generatedColumn-b.generatedColumn,0!==d||c?d:(d=a.source-b.source,0!==d?d:(d=a.originalLine-b.originalLine,0!==d?d:(d=a.originalColumn-b.originalColumn,0!==d?d:a.name-b.name))))}function n(a,b){return a===b?0:a>b?1:-1}function o(a,b){var c=a.generatedLine-b.generatedLine;return 0!==c?c:(c=a.generatedColumn-b.generatedColumn,0!==c?c:(c=n(a.source,b.source),0!==c?c:(c=a.originalLine-b.originalLine,0!==c?c:(c=a.originalColumn-b.originalColumn,0!==c?c:n(a.name,b.name)))))}b.getArg=d;var p=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,q=/^data:.+\,.+$/;b.urlParse=e,b.urlGenerate=f,b.normalize=g,b.join=h,b.relative=i,b.toSetString=j,b.fromSetString=k,b.compareByOriginalPositions=l,b.compareByGeneratedPositionsDeflated=m,b.compareByGeneratedPositionsInflated=o})},{amdefine:1}],121:[function(a,b,c){(function(b){var d=a("./lib/request"),e=a("xtend"),f=a("builtin-status-codes"),g=a("url"),h=c;h.request=function(a,c){a="string"==typeof a?g.parse(a):e(a);var f=b.location.protocol.search(/^https?:$/)===-1?"http:":"",h=a.protocol||f,i=a.hostname||a.host,j=a.port,k=a.path||"/";i&&i.indexOf(":")!==-1&&(i="["+i+"]"),a.url=(i?h+"//"+i:"")+(j?":"+j:"")+k,a.method=(a.method||"GET").toUpperCase(),a.headers=a.headers||{};var l=new d(a);return c&&l.on("response",c),l},h.get=function(a,b){var c=h.request(a,b);return c.end(),c},h.Agent=function(){},h.Agent.defaultMaxSockets=4,h.STATUS_CODES=f,h.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/request":123,"builtin-status-codes":7,url:139,xtend:146}],122:[function(a,b,c){(function(a){function b(a){try{return e.responseType=a,e.responseType===a}catch(a){}return!1}function d(a){return"function"==typeof a}c.fetch=d(a.fetch)&&d(a.ReadableStream),c.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),c.blobConstructor=!0}catch(a){}var e=new a.XMLHttpRequest;e.open("GET",a.XDomainRequest?"/":"https://example.com");var f="undefined"!=typeof a.ArrayBuffer,g=f&&d(a.ArrayBuffer.prototype.slice);c.arraybuffer=f&&b("arraybuffer"),c.msstream=!c.fetch&&g&&b("ms-stream"),c.mozchunkedarraybuffer=!c.fetch&&f&&b("moz-chunked-arraybuffer"),c.overrideMimeType=d(e.overrideMimeType),c.vbArray=d(a.VBArray),e=null}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],123:[function(a,b,c){(function(c,d,e){function f(a,b){return h.fetch&&b?"fetch":h.mozchunkedarraybuffer?"moz-chunked-arraybuffer":h.msstream?"ms-stream":h.arraybuffer&&a?"arraybuffer":h.vbArray&&a?"text:vbarray":"text"}function g(a){try{var b=a.status;return null!==b&&0!==b}catch(a){return!1}}var h=a("./capability"),i=a("inherits"),j=a("./response"),k=a("readable-stream"),l=a("to-arraybuffer"),m=j.IncomingMessage,n=j.readyStates,o=b.exports=function(a){var b=this;k.Writable.call(b),b._opts=a,b._body=[],b._headers={},a.auth&&b.setHeader("Authorization","Basic "+new e(a.auth).toString("base64")),Object.keys(a.headers).forEach(function(c){b.setHeader(c,a.headers[c])});var c,d=!0;if("disable-fetch"===a.mode)d=!1,c=!0;else if("prefer-streaming"===a.mode)c=!1;else if("allow-wrong-content-type"===a.mode)c=!h.overrideMimeType;else{if(a.mode&&"default"!==a.mode&&"prefer-fast"!==a.mode)throw new Error("Invalid value for opts.mode");c=!0}b._mode=f(c,d),b.on("finish",function(){b._onFinish()})};i(o,k.Writable),o.prototype.setHeader=function(a,b){var c=this,d=a.toLowerCase();p.indexOf(d)===-1&&(c._headers[d]={name:a,value:b})},o.prototype.getHeader=function(a){ -var b=this;return b._headers[a.toLowerCase()].value},o.prototype.removeHeader=function(a){var b=this;delete b._headers[a.toLowerCase()]},o.prototype._onFinish=function(){var a=this;if(!a._destroyed){var b,f=a._opts,g=a._headers;if("POST"!==f.method&&"PUT"!==f.method&&"PATCH"!==f.method&&"MERGE"!==f.method||(b=h.blobConstructor?new d.Blob(a._body.map(function(a){return l(a)}),{type:(g["content-type"]||{}).value||""}):e.concat(a._body).toString()),"fetch"===a._mode){var i=Object.keys(g).map(function(a){return[g[a].name,g[a].value]});d.fetch(a._opts.url,{method:a._opts.method,headers:i,body:b,mode:"cors",credentials:f.withCredentials?"include":"same-origin"}).then(function(b){a._fetchResponse=b,a._connect()},function(b){a.emit("error",b)})}else{var j=a._xhr=new d.XMLHttpRequest;try{j.open(a._opts.method,a._opts.url,!0)}catch(b){return void c.nextTick(function(){a.emit("error",b)})}"responseType"in j&&(j.responseType=a._mode.split(":")[0]),"withCredentials"in j&&(j.withCredentials=!!f.withCredentials),"text"===a._mode&&"overrideMimeType"in j&&j.overrideMimeType("text/plain; charset=x-user-defined"),Object.keys(g).forEach(function(a){j.setRequestHeader(g[a].name,g[a].value)}),a._response=null,j.onreadystatechange=function(){switch(j.readyState){case n.LOADING:case n.DONE:a._onXHRProgress()}},"moz-chunked-arraybuffer"===a._mode&&(j.onprogress=function(){a._onXHRProgress()}),j.onerror=function(){a._destroyed||a.emit("error",new Error("XHR error"))};try{j.send(b)}catch(b){return void c.nextTick(function(){a.emit("error",b)})}}}},o.prototype._onXHRProgress=function(){var a=this;g(a._xhr)&&!a._destroyed&&(a._response||a._connect(),a._response._onXHRProgress())},o.prototype._connect=function(){var a=this;a._destroyed||(a._response=new m(a._xhr,a._fetchResponse,a._mode),a.emit("response",a._response))},o.prototype._write=function(a,b,c){var d=this;d._body.push(a),c()},o.prototype.abort=o.prototype.destroy=function(){var a=this;a._destroyed=!0,a._response&&(a._response._destroyed=!0),a._xhr&&a._xhr.abort()},o.prototype.end=function(a,b,c){var d=this;"function"==typeof a&&(c=a,a=void 0),k.Writable.prototype.end.call(d,a,b,c)},o.prototype.flushHeaders=function(){},o.prototype.setTimeout=function(){},o.prototype.setNoDelay=function(){},o.prototype.setSocketKeepAlive=function(){};var p=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"]}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},a("buffer").Buffer)},{"./capability":122,"./response":124,_process:81,buffer:6,inherits:74,"readable-stream":92,"to-arraybuffer":126}],124:[function(a,b,c){(function(b,d,e){var f=a("./capability"),g=a("inherits"),h=a("readable-stream"),i=c.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},j=c.IncomingMessage=function(a,c,d){function g(){j.read().then(function(a){if(!i._destroyed){if(a.done)return void i.push(null);i.push(new e(a.value)),g()}})}var i=this;if(h.Readable.call(i),i._mode=d,i.headers={},i.rawHeaders=[],i.trailers={},i.rawTrailers=[],i.on("end",function(){b.nextTick(function(){i.emit("close")})}),"fetch"===d){i._fetchResponse=c,i.url=c.url,i.statusCode=c.status,i.statusMessage=c.statusText,c.headers.forEach(function(a,b){i.headers[b.toLowerCase()]=a,i.rawHeaders.push(b,a)});var j=c.body.getReader();g()}else{i._xhr=a,i._pos=0,i.url=a.responseURL,i.statusCode=a.status,i.statusMessage=a.statusText;var k=a.getAllResponseHeaders().split(/\r?\n/);if(k.forEach(function(a){var b=a.match(/^([^:]+):\s*(.*)/);if(b){var c=b[1].toLowerCase();"set-cookie"===c?(void 0===i.headers[c]&&(i.headers[c]=[]),i.headers[c].push(b[2])):void 0!==i.headers[c]?i.headers[c]+=", "+b[2]:i.headers[c]=b[2],i.rawHeaders.push(b[1],b[2])}}),i._charset="x-user-defined",!f.overrideMimeType){var l=i.rawHeaders["mime-type"];if(l){var m=l.match(/;\s*charset=([^;])(;|$)/);m&&(i._charset=m[1].toLowerCase())}i._charset||(i._charset="utf-8")}}};g(j,h.Readable),j.prototype._read=function(){},j.prototype._onXHRProgress=function(){var a=this,b=a._xhr,c=null;switch(a._mode){case"text:vbarray":if(b.readyState!==i.DONE)break;try{c=new d.VBArray(b.responseBody).toArray()}catch(a){}if(null!==c){a.push(new e(c));break}case"text":try{c=b.responseText}catch(b){a._mode="text:vbarray";break}if(c.length>a._pos){var f=c.substr(a._pos);if("x-user-defined"===a._charset){for(var g=new e(f.length),h=0;ha._pos&&(a.push(new e(new Uint8Array(j.result.slice(a._pos)))),a._pos=j.result.byteLength)},j.onload=function(){a.push(null)},j.readAsArrayBuffer(c)}a._xhr.readyState===i.DONE&&"ms-stream"!==a._mode&&a.push(null)}}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},a("buffer").Buffer)},{"./capability":122,_process:81,buffer:6,inherits:74,"readable-stream":92}],125:[function(a,b,c){function d(a){if(a&&!i(a))throw new Error("Unknown encoding: "+a)}function e(a){return a.toString(this.encoding)}function f(a){this.charReceived=a.length%2,this.charLength=this.charReceived?2:0}function g(a){this.charReceived=a.length%3,this.charLength=this.charReceived?3:0}var h=a("buffer").Buffer,i=h.isEncoding||function(a){switch(a&&a.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},j=c.StringDecoder=function(a){switch(this.encoding=(a||"utf8").toLowerCase().replace(/[-_]/,""),d(a),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=f;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=g;break;default:return void(this.write=e)}this.charBuffer=new h(6),this.charReceived=0,this.charLength=0};j.prototype.write=function(a){for(var b="";this.charLength;){var c=a.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:a.length;if(a.copy(this.charBuffer,this.charReceived,0,c),this.charReceived+=c,this.charReceived=55296&&d<=56319)){if(this.charReceived=this.charLength=0,0===a.length)return b;break}this.charLength+=this.surrogateSize,b=""}this.detectIncompleteChar(a);var e=a.length;this.charLength&&(a.copy(this.charBuffer,0,a.length-this.charReceived,e),e-=this.charReceived),b+=a.toString(this.encoding,0,e);var e=b.length-1,d=b.charCodeAt(e);if(d>=55296&&d<=56319){var f=this.surrogateSize;return this.charLength+=f,this.charReceived+=f,this.charBuffer.copy(this.charBuffer,f,0,f),a.copy(this.charBuffer,0,0,f),b.substring(0,e)}return b},j.prototype.detectIncompleteChar=function(a){for(var b=a.length>=3?3:a.length;b>0;b--){var c=a[a.length-b];if(1==b&&c>>5==6){this.charLength=2;break}if(b<=2&&c>>4==14){this.charLength=3;break}if(b<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=b},j.prototype.end=function(a){var b="";if(a&&a.length&&(b=this.write(a)),this.charReceived){var c=this.charReceived,d=this.charBuffer,e=this.encoding;b+=d.slice(0,c).toString(e)}return b}},{buffer:6}],126:[function(a,b,c){var d=a("buffer").Buffer;b.exports=function(a){if(a instanceof Uint8Array){if(0===a.byteOffset&&a.byteLength===a.buffer.byteLength)return a.buffer;if("function"==typeof a.buffer.slice)return a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength)}if(d.isBuffer(a)){for(var b=new Uint8Array(a.length),c=a.length,e=0;e=0&&a>1;return b?-c:c}var f=a("./base64"),g=5,h=1<>>=g,e>0&&(b|=j),c+=f.encode(b);while(e>0);return c},c.decode=function(a,b,c){var d,h,k=a.length,l=0,m=0;do{if(b>=k)throw new Error("Expected more digits in base 64 VLQ value.");if(h=f.decode(a.charCodeAt(b++)),h===-1)throw new Error("Invalid base64 digit: "+a.charAt(b-1));d=!!(h&j),h&=i,l+=h<0?b-i>1?d(i,b,e,f,g,h):h==c.LEAST_UPPER_BOUND?b1?d(a,i,e,f,g,h):h==c.LEAST_UPPER_BOUND?i:a<0?-1:a}c.GREATEST_LOWER_BOUND=1,c.LEAST_UPPER_BOUND=2,c.search=function(a,b,e,f){if(0===b.length)return-1;var g=d(-1,b.length,a,b,e,f||c.GREATEST_LOWER_BOUND);if(g<0)return-1;for(;g-1>=0&&0===e(b[g],b[g-1],!0);)--g;return g}},{}],131:[function(a,b,c){function d(a,b){var c=a.generatedLine,d=b.generatedLine,e=a.generatedColumn,g=b.generatedColumn;return d>c||d==c&&g>=e||f.compareByGeneratedPositionsInflated(a,b)<=0}function e(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var f=a("./util");e.prototype.unsortedForEach=function(a,b){this._array.forEach(a,b)},e.prototype.add=function(a){d(this._last,a)?(this._last=a,this._array.push(a)):(this._sorted=!1,this._array.push(a))},e.prototype.toArray=function(){return this._sorted||(this._array.sort(f.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},c.MappingList=e},{"./util":136}],132:[function(a,b,c){function d(a,b,c){var d=a[b];a[b]=a[c],a[c]=d}function e(a,b){return Math.round(a+Math.random()*(b-a))}function f(a,b,c,g){if(c=0){var f=this._originalMappings[e];if(void 0===a.column)for(var g=f.originalLine;f&&f.originalLine===g;)d.push({line:h.getArg(f,"generatedLine",null),column:h.getArg(f,"generatedColumn",null),lastColumn:h.getArg(f,"lastGeneratedColumn",null)}),f=this._originalMappings[++e];else for(var j=f.originalColumn;f&&f.originalLine===b&&f.originalColumn==j;)d.push({line:h.getArg(f,"generatedLine",null),column:h.getArg(f,"generatedColumn",null),lastColumn:h.getArg(f,"lastGeneratedColumn",null)}),f=this._originalMappings[++e]}return d},c.SourceMapConsumer=d,e.prototype=Object.create(d.prototype),e.prototype.consumer=d,e.fromSourceMap=function(a){var b=Object.create(e.prototype),c=b._names=j.fromArray(a._names.toArray(),!0),d=b._sources=j.fromArray(a._sources.toArray(),!0);b.sourceRoot=a._sourceRoot,b.sourcesContent=a._generateSourcesContent(b._sources.toArray(),b.sourceRoot),b.file=a._file;for(var g=a._mappings.toArray().slice(),i=b.__generatedMappings=[],k=b.__originalMappings=[],m=0,n=g.length;m1&&(c.source=p+e[1],p+=e[1],c.originalLine=n+e[2],n=c.originalLine,c.originalLine+=1,c.originalColumn=o+e[3],o=c.originalColumn,e.length>4&&(c.name=q+e[4],q+=e[4])),w.push(c),"number"==typeof c.originalLine&&v.push(c)}l(w,h.compareByGeneratedPositionsDeflated),this.__generatedMappings=w,l(v,h.compareByOriginalPositions),this.__originalMappings=v},e.prototype._findMapping=function(a,b,c,d,e,f){if(a[c]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+a[c]);if(a[d]<0)throw new TypeError("Column must be greater than or equal to 0, got "+a[d]);return i.search(a,b,e,f)},e.prototype.computeColumnSpans=function(){for(var a=0;a=0){var e=this._generatedMappings[c];if(e.generatedLine===b.generatedLine){var f=h.getArg(e,"source",null);null!==f&&(f=this._sources.at(f),null!=this.sourceRoot&&(f=h.join(this.sourceRoot,f)));var g=h.getArg(e,"name",null);return null!==g&&(g=this._names.at(g)),{source:f,line:h.getArg(e,"originalLine",null),column:h.getArg(e,"originalColumn",null),name:g}}}return{source:null,line:null,column:null,name:null}},e.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(a){return null==a}))},e.prototype.sourceContentFor=function(a,b){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(a=h.relative(this.sourceRoot,a)),this._sources.has(a))return this.sourcesContent[this._sources.indexOf(a)];var c;if(null!=this.sourceRoot&&(c=h.urlParse(this.sourceRoot))){var d=a.replace(/^file:\/\//,"");if("file"==c.scheme&&this._sources.has(d))return this.sourcesContent[this._sources.indexOf(d)];if((!c.path||"/"==c.path)&&this._sources.has("/"+a))return this.sourcesContent[this._sources.indexOf("/"+a)]}if(b)return null;throw new Error('"'+a+'" is not in the SourceMap.')},e.prototype.generatedPositionFor=function(a){var b=h.getArg(a,"source");if(null!=this.sourceRoot&&(b=h.relative(this.sourceRoot,b)),!this._sources.has(b))return{line:null,column:null,lastColumn:null};b=this._sources.indexOf(b);var c={source:b,originalLine:h.getArg(a,"line"),originalColumn:h.getArg(a,"column")},e=this._findMapping(c,this._originalMappings,"originalLine","originalColumn",h.compareByOriginalPositions,h.getArg(a,"bias",d.GREATEST_LOWER_BOUND));if(e>=0){var f=this._originalMappings[e];if(f.source===c.source)return{line:h.getArg(f,"generatedLine",null),column:h.getArg(f,"generatedColumn",null),lastColumn:h.getArg(f,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},c.BasicSourceMapConsumer=e,g.prototype=Object.create(d.prototype),g.prototype.constructor=d,g.prototype._version=3,Object.defineProperty(g.prototype,"sources",{get:function(){for(var a=[],b=0;b0&&a.column>=0)||b||c||d)&&!(a&&"line"in a&&"column"in a&&b&&"line"in b&&"column"in b&&a.line>0&&a.column>=0&&b.line>0&&b.column>=0&&c))throw new Error("Invalid mapping: "+JSON.stringify({generated:a,source:c,original:b,name:d}))},d.prototype._serializeMappings=function(){for(var a,b,c,d,g=0,h=1,i=0,j=0,k=0,l=0,m="",n=this._mappings.toArray(),o=0,p=n.length;o0){if(!f.compareByGeneratedPositionsInflated(b,n[o-1]))continue;a+=","}a+=e.encode(b.generatedColumn-g),g=b.generatedColumn,null!=b.source&&(d=this._sources.indexOf(b.source),a+=e.encode(d-l),l=d,a+=e.encode(b.originalLine-1-j),j=b.originalLine-1,a+=e.encode(b.originalColumn-i),i=b.originalColumn,null!=b.name&&(c=this._names.indexOf(b.name),a+=e.encode(c-k),k=c)),m+=a}return m},d.prototype._generateSourcesContent=function(a,b){return a.map(function(a){if(!this._sourcesContents)return null;null!=b&&(a=f.relative(b,a));var c=f.toSetString(a);return Object.prototype.hasOwnProperty.call(this._sourcesContents,c)?this._sourcesContents[c]:null},this)},d.prototype.toJSON=function(){var a={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(a.file=this._file),null!=this._sourceRoot&&(a.sourceRoot=this._sourceRoot),this._sourcesContents&&(a.sourcesContent=this._generateSourcesContent(a.sources,a.sourceRoot)),a},d.prototype.toString=function(){return JSON.stringify(this.toJSON())},c.SourceMapGenerator=d},{"./array-set":127,"./base64-vlq":128,"./mapping-list":131,"./util":136}],135:[function(a,b,c){function d(a,b,c,d,e){this.children=[],this.sourceContents={},this.line=null==a?null:a,this.column=null==b?null:b,this.source=null==c?null:c,this.name=null==e?null:e,this[i]=!0,null!=d&&this.add(d)}var e=a("./source-map-generator").SourceMapGenerator,f=a("./util"),g=/(\r?\n)/,h=10,i="$$$isSourceNode$$$";d.fromStringWithSourceMap=function(a,b,c){function e(a,b){if(null===a||void 0===a.source)h.add(b);else{var e=c?f.join(c,a.source):a.source;h.add(new d(a.originalLine,a.originalColumn,e,b,a.name))}}var h=new d,i=a.split(g),j=function(){var a=i.shift(),b=i.shift()||"";return a+b},k=1,l=0,m=null;return b.eachMapping(function(a){if(null!==m){if(!(k0&&(m&&e(m,j()),h.add(i.join(""))),b.sources.forEach(function(a){var d=b.sourceContentFor(a);null!=d&&(null!=c&&(a=f.join(c,a)),h.setSourceContent(a,d))}),h},d.prototype.add=function(a){if(Array.isArray(a))a.forEach(function(a){this.add(a)},this);else{if(!a[i]&&"string"!=typeof a)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+a);a&&this.children.push(a)}return this},d.prototype.prepend=function(a){if(Array.isArray(a))for(var b=a.length-1;b>=0;b--)this.prepend(a[b]);else{if(!a[i]&&"string"!=typeof a)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+a);this.children.unshift(a)}return this},d.prototype.walk=function(a){for(var b,c=0,d=this.children.length;c0){for(b=[],c=0;c=0;k--)g=i[k],"."===g?i.splice(k,1):".."===g?j++:j>0&&(""===g?(i.splice(k+1,j),j=0):(i.splice(k,2),j--));return b=i.join("/"),""===b&&(b=h?"/":"."),d?(d.path=b,f(d)):b}function h(a,b){""===a&&(a="."),""===b&&(b=".");var c=e(b),d=e(a);if(d&&(a=d.path||"/"),c&&!c.scheme)return d&&(c.scheme=d.scheme),f(c);if(c||b.match(s))return b;if(d&&!d.host&&!d.path)return d.host=b,f(d);var h="/"===b.charAt(0)?b:g(a.replace(/\/+$/,"")+"/"+b);return d?(d.path=h,f(d)):h}function i(a,b){""===a&&(a="."),a=a.replace(/\/$/,"");for(var c=0;0!==b.indexOf(a+"/");){ -var d=a.lastIndexOf("/");if(d<0)return b;if(a=a.slice(0,d),a.match(/^([^\/]+:\/)?\/*$/))return b;++c}return Array(c+1).join("../")+b.substr(a.length+1)}function j(a){return a}function k(a){return m(a)?"$"+a:a}function l(a){return m(a)?a.slice(1):a}function m(a){if(!a)return!1;var b=a.length;if(b<9)return!1;if(95!==a.charCodeAt(b-1)||95!==a.charCodeAt(b-2)||111!==a.charCodeAt(b-3)||116!==a.charCodeAt(b-4)||111!==a.charCodeAt(b-5)||114!==a.charCodeAt(b-6)||112!==a.charCodeAt(b-7)||95!==a.charCodeAt(b-8)||95!==a.charCodeAt(b-9))return!1;for(var c=b-10;c>=0;c--)if(36!==a.charCodeAt(c))return!1;return!0}function n(a,b,c){var d=a.source-b.source;return 0!==d?d:(d=a.originalLine-b.originalLine,0!==d?d:(d=a.originalColumn-b.originalColumn,0!==d||c?d:(d=a.generatedColumn-b.generatedColumn,0!==d?d:(d=a.generatedLine-b.generatedLine,0!==d?d:a.name-b.name))))}function o(a,b,c){var d=a.generatedLine-b.generatedLine;return 0!==d?d:(d=a.generatedColumn-b.generatedColumn,0!==d||c?d:(d=a.source-b.source,0!==d?d:(d=a.originalLine-b.originalLine,0!==d?d:(d=a.originalColumn-b.originalColumn,0!==d?d:a.name-b.name))))}function p(a,b){return a===b?0:a>b?1:-1}function q(a,b){var c=a.generatedLine-b.generatedLine;return 0!==c?c:(c=a.generatedColumn-b.generatedColumn,0!==c?c:(c=p(a.source,b.source),0!==c?c:(c=a.originalLine-b.originalLine,0!==c?c:(c=a.originalColumn-b.originalColumn,0!==c?c:p(a.name,b.name)))))}c.getArg=d;var r=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,s=/^data:.+\,.+$/;c.urlParse=e,c.urlGenerate=f,c.normalize=g,c.join=h,c.isAbsolute=function(a){return"/"===a.charAt(0)||!!a.match(r)},c.relative=i;var t=function(){var a=Object.create(null);return!("__proto__"in a)}();c.toSetString=t?j:k,c.fromSetString=t?j:l,c.compareByOriginalPositions=n,c.compareByGeneratedPositionsDeflated=o,c.compareByGeneratedPositionsInflated=q},{}],137:[function(a,b,c){c.SourceMapGenerator=a("./lib/source-map-generator").SourceMapGenerator,c.SourceMapConsumer=a("./lib/source-map-consumer").SourceMapConsumer,c.SourceNode=a("./lib/source-node").SourceNode},{"./lib/source-map-consumer":133,"./lib/source-map-generator":134,"./lib/source-node":135}],138:[function(a,b,c){(function(b){function d(a){for(var b=Object.create(null),c=0;c=0}function h(a,b){for(var c=0,d=b.length;c>1);return c+=c,1&b&&(c+=a),c}function j(a,b){Error.call(this,a),this.msg=a,this.defs=b}function k(a,b,c){a===!0&&(a={});var d=a||{};if(c)for(var e in d)w(d,e)&&!w(b,e)&&j.croak("`"+e+"` is not a supported option",b);for(var e in b)w(b,e)&&(d[e]=a&&w(a,e)?a[e]:b[e]);return d}function l(a,b){var c=0;for(var d in b)w(b,d)&&(a[d]=b[d],c++);return c}function m(){}function n(a,b){a.indexOf(b)<0&&a.push(b)}function o(a,b){return a.replace(/\{(.+?)\}/g,function(a,c){return b[c]})}function p(a,b){for(var c=a.length;--c>=0;)a[c]===b&&a.splice(c,1)}function q(a,b){function c(a,c){for(var d=[],e=0,f=0,g=0;e=0})}function t(a){function b(a){return JSON.stringify(a).replace(/[\u2028\u2029]/g,function(a){switch(a){case"\u2028":return"\\u2028";case"\u2029":return"\\u2029"}return a})}function c(a){if(1==a.length)return d+="return str === "+b(a[0])+";";d+="switch(str){";for(var c=0;c3){e.sort(function(a,b){return b.length-a.length}),d+="switch(str.length){";for(var f=0;f=0;)if(!b(a[c]))return!1;return!0}function v(){this._values=Object.create(null),this._size=0}function w(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function x(a,b,d,e){arguments.length<4&&(e=aa),b=b?b.split(/\s+/):[];var f=b;e&&e.PROPS&&(b=b.concat(e.PROPS));for(var g="return function AST_"+a+"(props){ if (props) { ",h=b.length;--h>=0;)g+="this."+b[h]+" = props."+b[h]+";";var i=e&&new e;(i&&i.initialize||d&&d.initialize)&&(g+="this.initialize();"),g+="}}";var j=new Function(g)();if(i&&(j.prototype=i,j.BASE=e),e&&e.SUBCLASSES.push(j),j.prototype.CTOR=j,j.PROPS=b||null,j.SELF_PROPS=f,j.SUBCLASSES=[],a&&(j.prototype.TYPE=j.TYPE=a),d)for(h in d)w(d,h)&&(/^\$/.test(h)?j[h.substr(1)]=d[h]:j.prototype[h]=d[h]);return j.DEFMETHOD=function(a,b){this.prototype[a]=b},c["AST_"+a]=j,j}function y(a,b){a.body instanceof ba?a.body._walk(b):a.body.forEach(function(a){a._walk(b)})}function z(a){this.visit=a,this.stack=[],this.directives=Object.create(null)}function A(a){return a>=97&&a<=122||a>=65&&a<=90||a>=170&&Tb.letter.test(String.fromCharCode(a))}function B(a){return a>=48&&a<=57}function C(a){return B(a)||A(a)}function D(a){return Tb.digit.test(String.fromCharCode(a))}function E(a){return Tb.non_spacing_mark.test(a)||Tb.space_combining_mark.test(a)}function F(a){return Tb.connector_punctuation.test(a)}function G(a){return!Ib(a)&&/^[a-z_$][a-z0-9_$]*$/i.test(a)}function H(a){return 36==a||95==a||A(a)}function I(a){var b=a.charCodeAt(0);return H(b)||B(b)||8204==b||8205==b||E(a)||F(a)||D(b)}function J(a){return/^[a-z_$][a-z0-9_$]*$/i.test(a)}function K(a){if(Lb.test(a))return parseInt(a.substr(2),16);if(Mb.test(a))return parseInt(a.substr(1),8);var b=parseFloat(a);return b==a?b:void 0}function L(a,b,c,d,e){this.message=a,this.filename=b,this.line=c,this.col=d,this.pos=e,this.stack=(new Error).stack}function M(a,b,c,d,e){throw new L(a,b,c,d,e)}function N(a,b,c){return a.type==b&&(null==c||a.value==c)}function O(a,b,c,d){function e(){return D.text.charAt(D.pos)}function f(a,b){var c=D.text.charAt(D.pos++);if(a&&!c)throw Ub;return Pb(c)?(D.newline_before=D.newline_before||!b,++D.line,D.col=0,b||"\r"!=c||"\n"!=e()||(++D.pos,c="\n")):++D.col,c}function g(a){for(;a-- >0;)f()}function h(a){return D.text.substr(D.pos,a.length)==a}function i(){for(var a=D.text,b=D.pos,c=D.text.length;b="0"&&b<="7"?r(b):b}function r(a){var b=e();return b>="0"&&b<="7"&&(a+=f(!0),a[0]<="3"&&(b=e())>="0"&&b<="7"&&(a+=f(!0))),"0"===a?"\0":(a.length>0&&A.has_directive("use strict")&&o("SyntaxError: Legacy octal escape sequences are not allowed in strict mode"),String.fromCharCode(parseInt(a,8)))}function s(a){for(var b=0;a>0;--a){var c=parseInt(f(!0),16);isNaN(c)&&o("SyntaxError: Invalid hex-character pattern in string"),b=b<<4|c}return b}function t(a){var b,c=D.regex_allowed,d=i();return d==-1?(b=D.text.substr(D.pos),D.pos=D.text.length):(b=D.text.substring(D.pos,d),D.pos=d),D.col=D.tokcol+(D.pos-D.tokpos),D.comments_before.push(l(a,b,!0)),D.regex_allowed=c,A}function u(){for(var a,b,c=!1,d="",g=!1;null!=(a=e());)if(c)"u"!=a&&o("SyntaxError: Expecting UnicodeEscapeSequence -- uXXXX"),a=q(),I(a)||o("SyntaxError: Unicode char: "+a.charCodeAt(0)+" is not valid in identifier"),d+=a,c=!1;else if("\\"==a)g=c=!0,f();else{if(!I(a))break;d+=f()}return Gb(d)&&g&&(b=d.charCodeAt(0).toString(16).toUpperCase(),d="\\u"+"0000".substr(b.length)+b+d.slice(1)),d}function v(a){function b(a){if(!e())return a;var c=a+e();return Nb(c)?(f(),b(c)):a}return l("operator",b(a||f()))}function w(){switch(f(),e()){case"/":return f(),t("comment1");case"*":return f(),G()}return D.regex_allowed?J(""):v("/")}function x(){return f(),B(e().charCodeAt(0))?p("."):l("punc",".")}function y(){var a=u();return E?l("name",a):Hb(a)?l("atom",a):Gb(a)?Nb(a)?l("operator",a):l("keyword",a):l("name",a)}function z(a,b){return function(c){try{return b(c)}catch(b){if(b!==Ub)throw b;o(a)}}}function A(a){if(null!=a)return J(a);for(;;){if(m(),k(),c){if(h("")&&D.newline_before){g(3),t("comment4");continue}}var b=e();if(!b)return l("eof");var i=b.charCodeAt(0);switch(i){case 34:case 39:return F(b);case 46:return x();case 47:var j=w();if(j===A)continue;return j}if(B(i))return p();if(Rb(b))return l("punc",f());if(Kb(b))return v();if(92==i||H(i))return y();if(!d||0!=D.pos||!h("#!"))break;g(2),t("comment5")}o("SyntaxError: Unexpected character '"+b+"'")}var D={text:a,filename:b,pos:0,tokpos:0,line:1,tokline:0,col:0,tokcol:0,newline_before:!1,regex_allowed:!1,comments_before:[],directives:{},directive_stack:[]},E=!1,F=z("SyntaxError: Unterminated string constant",function(a){for(var b=f(),c="";;){var d=f(!0,!0);if("\\"==d)d=q(!0);else if(Pb(d))o("SyntaxError: Unterminated string constant");else if(d==b)break;c+=d}var e=l("string",c);return e.quote=a,e}),G=z("SyntaxError: Unterminated multiline comment",function(){var a=D.regex_allowed,b=j("*/",!0),c=D.text.substring(D.pos,b).replace(/\r\n|\r|\u2028|\u2029/g,"\n");return g(c.length+2),D.comments_before.push(l("comment2",c,!0)),D.regex_allowed=a,A}),J=z("SyntaxError: Unterminated regular expression",function(a){for(var b,c=!1,d=!1;b=f(!0);)if(Pb(b))o("SyntaxError: Unexpected line terminator");else if(c)a+="\\"+b,c=!1;else if("["==b)d=!0,a+=b;else if("]"==b&&d)d=!1,a+=b;else{if("/"==b&&!d)break;"\\"==b?c=!0:a+=b}var e=u();try{return l("regexp",new RegExp(a,e))}catch(a){o("SyntaxError: "+a.message)}});return A.context=function(a){return a&&(D=a),D},A.add_directive=function(a){D.directive_stack[D.directive_stack.length-1].push(a),void 0===D.directives[a]?D.directives[a]=1:D.directives[a]++},A.push_directives_stack=function(){D.directive_stack.push([])},A.pop_directives_stack=function(){for(var a=D.directive_stack[D.directive_stack.length-1],b=0;b0},A}function P(a,b){function c(a,b){return N(R.token,a,b)}function d(){return R.peeked||(R.peeked=R.input())}function e(){return R.prev=R.token,R.peeked?(R.token=R.peeked,R.peeked=null):R.token=R.input(),R.in_directives=R.in_directives&&("string"==R.token.type||c("punc",";")),R.token}function f(){return R.prev}function g(a,b,c,d){var e=R.input.context();M(a,e.filename,null!=b?b:e.tokline,null!=c?c:e.tokcol,null!=d?d:e.tokpos)}function i(a,b){g(b,a.line,a.col)}function j(a){null==a&&(a=R.token),i(a,"SyntaxError: Unexpected token: "+a.type+" ("+a.value+")")}function l(a,b){return c(a,b)?e():void i(R.token,"SyntaxError: Unexpected token "+R.token.type+" «"+R.token.value+"», expected "+a+" «"+b+"»")}function m(a){return l("punc",a)}function n(){return!b.strict&&(R.token.nlb||c("eof")||c("punc","}"))}function o(a){c("punc",";")?e():a||n()||j()}function p(){m("(");var a=ia(!0);return m(")"),a}function q(a){return function(){var b=R.token,c=a(),d=f();return c.start=b,c.end=d,c}}function r(){(c("operator","/")||c("operator","/="))&&(R.peeked=null,R.token=R.input(R.token.value.substr(1)))}function s(){var a=I(pb);h(function(b){return b.name==a.name},R.labels)&&g("SyntaxError: Label "+a.name+" defined twice"),m(":"),R.labels.push(a);var b=S();return R.labels.pop(),b instanceof ka||a.references.forEach(function(b){b instanceof Da&&(b=b.label.start,g("SyntaxError: Continue label `"+a.name+"` refers to non-IterationStatement.",b.line,b.col,b.pos))}),new ja({body:b,label:a})}function t(a){return new ea({body:(a=ia(!0),o(),a)})}function u(a){var b,c=null;n()||(c=I(rb,!0)),null!=c?(b=h(function(a){return a.name==c.name},R.labels),b||g("SyntaxError: Undefined label "+c.name),c.thedef=b):0==R.in_loop&&g("SyntaxError: "+a.TYPE+" not inside a loop or switch"),o();var d=new a({label:c});return b&&b.references.push(d),d}function v(){m("(");var a=null;return!c("punc",";")&&(a=c("keyword","var")?(e(),U(!0)):ia(!0,!0),c("operator","in"))?(a instanceof Na&&a.definitions.length>1&&g("SyntaxError: Only one variable declaration allowed in for..in loop"),e(),x(a)):w(a)}function w(a){m(";");var b=c("punc",";")?null:ia(!0);m(";");var d=c("punc",")")?null:ia(!0);return m(")"),new oa({init:a,condition:b,step:d,body:Q(S)})}function x(a){var b=a instanceof Na?a.definitions[0].name:null,c=ia(!0);return m(")"),new pa({init:a,name:b,object:c,body:Q(S)})}function y(){var a=p(),b=S(),d=null;return c("keyword","else")&&(e(),d=S()),new Ea({condition:a,body:b,alternative:d})}function z(){m("{");for(var a=[];!c("punc","}");)c("eof")&&j(),a.push(S());return e(),a}function A(){m("{");for(var a,b=[],d=null,g=null;!c("punc","}");)c("eof")&&j(),c("keyword","case")?(g&&(g.end=f()),d=[],g=new Ia({start:(a=R.token,e(),a),expression:ia(!0),body:d}),b.push(g),m(":")):c("keyword","default")?(g&&(g.end=f()),d=[],g=new Ha({start:(a=R.token,e(),m(":"),a),body:d}),b.push(g)):(d||j(),d.push(S()));return g&&(g.end=f()),e(),b}function B(){var a=z(),b=null,d=null;if(c("keyword","catch")){var h=R.token;e(),m("(");var i=I(ob);m(")"),b=new Ka({start:h,argname:i,body:z(),end:f()})}if(c("keyword","finally")){var h=R.token;e(),d=new La({start:h,body:z(),end:f()})}return b||d||g("SyntaxError: Missing catch/finally blocks"),new Ja({body:a,bcatch:b,bfinally:d})}function C(a,b){for(var d=[];d.push(new Pa({start:R.token,name:I(b?kb:jb),value:c("operator","=")?(e(),ia(!1,a)):null,end:f()})),c("punc",",");)e();return d}function D(){var a,b=R.token;switch(b.type){case"name":case"keyword":a=H(qb);break;case"num":a=new vb({start:b,end:b,value:b.value});break;case"string":a=new ub({start:b,end:b,value:b.value,quote:b.quote});break;case"regexp":a=new wb({start:b,end:b,value:b.value});break;case"atom":switch(b.value){case"false":a=new Eb({start:b,end:b});break;case"true":a=new Fb({start:b,end:b});break;case"null":a=new yb({start:b,end:b})}break;case"operator":J(b.value)||g("SyntaxError: Invalid getter/setter name: "+b.value,b.line,b.col,b.pos),a=H(qb)}return e(),a}function E(a,b,d){for(var f=!0,g=[];!c("punc",a)&&(f?f=!1:m(","),!b||!c("punc",a));)c("punc",",")&&d?g.push(new Bb({start:R.token,end:R.token})):g.push(ia(!1));return e(),g}function F(){var a=R.token;switch(e(),a.type){case"num":case"string":case"name":case"operator":case"keyword":case"atom":return a.value;default:j()}}function G(){var a=R.token;switch(e(),a.type){case"name":case"operator":case"keyword":case"atom":return a.value;default:j()}}function H(a){var b=R.token.value;return new("this"==b?sb:a)({name:String(b),start:R.token,end:R.token})}function I(a,b){if(!c("name"))return b||g("SyntaxError: Name expected"),null;var d=H(a);return e(),d}function K(a,b,c){return"++"!=b&&"--"!=b||P(c)||g("SyntaxError: Invalid use of "+b+" operator"),new a({operator:b,expression:c})}function L(a){return aa(_(!0),0,a)}function P(a){return!b.strict||!(a instanceof sb)&&(a instanceof Ta||a instanceof gb)}function Q(a){++R.in_loop;var b=a();return--R.in_loop,b}b=k(b,{strict:!1,filename:null,toplevel:null,expression:!1,html5_comments:!0,bare_returns:!1,shebang:!0});var R={input:"string"==typeof a?O(a,b.filename,b.html5_comments,b.shebang):a,token:null,prev:null,peeked:null,in_function:0,in_directives:!0,in_loop:0,labels:[]};R.token=e();var S=q(function(){var a;switch(r(),R.token.type){case"string":var h=!1;R.in_directives===!0&&((N(d(),"punc",";")||d().nlb)&&R.token.raw.indexOf("\\")===-1?R.input.add_directive(R.token.value):R.in_directives=!1);var h=R.in_directives,i=t();return h?new da({start:i.body.start,end:i.body.end,quote:i.body.quote,value:i.body.value}):i;case"num":case"regexp":case"operator":case"atom":return t();case"name":return N(d(),"punc",":")?s():t();case"punc":switch(R.token.value){case"{":return new ga({start:R.token,body:z(),end:f()});case"[":case"(":return t();case";":return R.in_directives=!1,e(),new ha;default:j()}case"keyword":switch(a=R.token.value,e(),a){case"break":return u(Ca);case"continue":return u(Da);case"debugger":return o(),new ca;case"do":return new ma({body:Q(S),condition:(l("keyword","while"),a=p(),o(!0),a)});case"while":return new na({condition:p(),body:Q(S)});case"for":return v();case"function":return T(wa);case"if":return y();case"return":return 0!=R.in_function||b.bare_returns||g("SyntaxError: 'return' outside of function"),new za({value:c("punc",";")?(e(),null):n()?null:(a=ia(!0),o(),a)});case"switch":return new Fa({expression:p(),body:Q(A)});case"throw":return R.token.nlb&&g("SyntaxError: Illegal newline after 'throw'"),new Aa({value:(a=ia(!0),o(),a)});case"try":return B();case"var":return a=U(),o(),a;case"const":return a=V(),o(),a;case"with":return R.input.has_directive("use strict")&&g("SyntaxError: Strict mode may not include a with statement"),new qa({expression:p(),body:S()});default:j()}}}),T=function(a){var b=a===wa,d=c("name")?I(b?mb:nb):null;return b&&!d&&j(),m("("),new a({name:d,argnames:function(a,b){for(;!c("punc",")");)a?a=!1:m(","),b.push(I(lb));return e(),b}(!0,[]),body:function(a,b){++R.in_function,R.in_directives=!0,R.input.push_directives_stack(),R.in_loop=0,R.labels=[];var c=z();return R.input.pop_directives_stack(),--R.in_function,R.in_loop=a,R.labels=b,c}(R.in_loop,R.labels)})},U=function(a){return new Na({start:f(),definitions:C(a,!1),end:f()})},V=function(){return new Oa({start:f(),definitions:C(!1,!0),end:f()})},W=function(a){var b=R.token;l("operator","new");var d,g=X(!1);return c("punc","(")?(e(),d=E(")")):d=[],$(new Ra({start:b,expression:g,args:d,end:f()}),a)},X=function(a){if(c("operator","new"))return W(a);var b=R.token;if(c("punc")){switch(b.value){case"(":e();var d=ia(!0);return d.start=b,d.end=R.token,m(")"),$(d,a);case"[":return $(Y(),a);case"{":return $(Z(),a)}j()}if(c("keyword","function")){e();var g=T(va);return g.start=b,g.end=f(),$(g,a)}return $b[R.token.type]?$(D(),a):void j()},Y=q(function(){return m("["),new ab({elements:E("]",!b.strict,!0)})}),Z=q(function(){m("{");for(var a=!0,d=[];!c("punc","}")&&(a?a=!1:m(","),b.strict||!c("punc","}"));){var g=R.token,h=g.type,i=F();if("name"==h&&!c("punc",":")){if("get"==i){d.push(new fb({start:g,key:D(),value:T(ua),end:f()}));continue}if("set"==i){d.push(new eb({start:g,key:D(),value:T(ua),end:f()}));continue}}m(":"),d.push(new db({start:g,quote:g.quote,key:i,value:ia(!1),end:f()}))}return e(),new bb({properties:d})}),$=function(a,b){var d=a.start;if(c("punc","."))return e(),$(new Ua({start:d,expression:a,property:G(),end:f()}),b);if(c("punc","[")){e();var g=ia(!0);return m("]"),$(new Va({start:d,expression:a,property:g,end:f()}),b)}return b&&c("punc","(")?(e(),$(new Qa({start:d,expression:a,args:E(")"),end:f()}),!0)):a},_=function(a){var b=R.token;if(c("operator")&&Vb(b.value)){e(),r();var d=K(Xa,b.value,_(a));return d.start=b,d.end=f(),d}for(var g=X(a);c("operator")&&Wb(R.token.value)&&!R.token.nlb;)g=K(Ya,R.token.value,g),g.start=b,g.end=R.token,e();return g},aa=function(a,b,d){var f=c("operator")?R.token.value:null;"in"==f&&d&&(f=null);var g=null!=f?Yb[f]:null;if(null!=g&&g>b){e();var h=aa(_(!0),g,d);return aa(new Za({start:a.start,left:a,operator:f,right:h,end:h.end}),b,d)}return a},ba=function(a){var b=R.token,d=L(a);if(c("operator","?")){e();var g=ia(!1);return m(":"),new $a({start:b,condition:d,consequent:g,alternative:ia(!1,a),end:f()})}return d},fa=function(a){var b=R.token,d=ba(a),h=R.token.value;if(c("operator")&&Xb(h)){if(P(d))return e(),new _a({start:b,left:d,operator:h,right:fa(a),end:f()});g("SyntaxError: Invalid assignment")}return d},ia=function(a,b){var f=R.token,g=fa(b);return a&&c("punc",",")?(e(),new Sa({start:f,car:g,cdr:ia(!0,b),end:d()})):g};return b.expression?ia(!0):function(){var a=R.token,d=[];for(R.input.push_directives_stack();!c("eof");)d.push(S());R.input.pop_directives_stack();var e=f(),g=b.toplevel;return g?(g.body=g.body.concat(d),g.end=e):g=new sa({start:a,body:d,end:e}),g}()}function Q(a,b){z.call(this),this.before=a,this.after=b}function R(a,b,c){this.name=c.name,this.orig=[c],this.scope=a,this.references=[],this.global=!1,this.mangled_name=null,this.undeclared=!1,this.constant=!1,this.index=b,this.id=R.next_id++}function S(a){function b(a,b){return a.replace(/[\u0000-\u001f\u007f-\uffff]/g,function(a){var c=a.charCodeAt(0).toString(16);if(c.length<=2&&!b){for(;c.length<2;)c="0"+c;return"\\x"+c}for(;c.length<4;)c="0"+c;return"\\u"+c})}function c(c,d){function e(){return"'"+c.replace(/\x27/g,"\\'")+"'"}function f(){return'"'+c.replace(/\x22/g,'\\"')+'"'}var g=0,h=0;switch(c=c.replace(/[\\\b\f\n\r\v\t\x22\x27\u2028\u2029\0\ufeff]/g,function(b,d){switch(b){case'"':return++g,'"';case"'":return++h,"'";case"\\":return"\\\\";case"\n":return"\\n";case"\r":return"\\r";case"\t":return"\\t";case"\b":return"\\b";case"\f":return"\\f";case"\v":return a.screw_ie8?"\\v":"\\x0B";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";case"\ufeff":return"\\ufeff";case"\0":return/[0-7]/.test(c.charAt(d+1))?"\\x00":"\\0"}return b}),a.ascii_only&&(c=b(c)),a.quote_style){case 1:return e();case 2:return f();case 3:return"'"==d?e():f();default:return g>h?e():f()}}function d(b,d){var e=c(b,d);return a.inline_script&&(e=e.replace(/<\x2fscript([>\/\t\n\f\r ])/gi,"<\\/script$1"),e=e.replace(/\x3c!--/g,"\\x3c!--"),e=e.replace(/--\x3e/g,"--\\x3e")),e}function e(c){return c=c.toString(),a.ascii_only&&(c=b(c,!0)),c}function f(b){return i(" ",a.indent_start+w-b*a.indent_level)}function g(){return D.charAt(D.length-1)}function h(){a.max_line_len&&x>a.max_line_len&&j("\n")}function j(b){b=String(b);var c=b.charAt(0);if(C&&(C=!1,c&&!(";}".indexOf(c)<0)||/[;]$/.test(D)||(a.semicolons||E(c)?(A+=";",x++,z++):(A+="\n",z++,y++,x=0,/^\s+$/.test(b)&&(C=!0)),a.beautify||(B=!1))),!a.beautify&&a.preserve_line&&M[M.length-1])for(var d=M[M.length-1].start.line;y=a.width},newline:J,print:j,space:F,comma:r,colon:s,last:function(){return D},semicolon:K,force_semicolon:l,to_ascii:b,print_name:function(a){j(e(a))},print_string:function(a,b,c){var e=d(a,b);c===!0&&e.indexOf("\\")===-1&&(ac.test(A)||l(),l()),j(e)},encode_string:d,next_indent:n,with_indent:H,with_block:o,with_parens:p,with_square:q,add_mapping:L,option:function(b){return a[b]},line:function(){return y},col:function(){return x},pos:function(){return z},push_node:function(a){M.push(a)},pop_node:function(){return M.pop()},stack:function(){return M},parent:function(a){return M[M.length-2-(a||0)]}}}function T(a,b){if(!(this instanceof T))return new T(a,b);Q.call(this,this.before,this.after),this.options=k(a,{sequences:!b,properties:!b,dead_code:!b,drop_debugger:!b,unsafe:!1,unsafe_comps:!1,conditionals:!b,comparisons:!b,evaluate:!b,booleans:!b,loops:!b,unused:!b,hoist_funs:!b,keep_fargs:!0,keep_fnames:!1,hoist_vars:!1,if_return:!b,join_vars:!b,collapse_vars:!1,reduce_vars:!1,cascade:!b,side_effects:!b,pure_getters:!1,pure_funcs:null,negate_iife:!b,screw_ie8:!0,drop_console:!1,angular:!1,warnings:!0,global_defs:{},passes:1},!0);var c=this.options.sequences;this.sequences_limit=1==c?200:0|c,this.warnings_produced={}}function U(a){function b(b,e,f,g,h,i){if(d){var j=d.originalPositionFor({line:g,column:h});if(null===j.source)return;b=j.source,g=j.line,h=j.column,i=j.name||i}c.addMapping({generated:{line:e+a.dest_line_diff,column:f},original:{line:g+a.orig_line_diff,column:h},source:b,name:i})}a=k(a,{file:null,root:null,orig:null,orig_line_diff:0,dest_line_diff:0});var c=new Y.SourceMapGenerator({file:a.file,sourceRoot:a.root}),d=a.orig&&new Y.SourceMapConsumer(a.orig);return d&&Array.isArray(a.orig.sources)&&a.orig.sources.forEach(function(a){var b=d.sourceContentFor(a,!0);b&&c.setSourceContent(a,b)}),{add:b,get:function(){return c},toString:function(){return JSON.stringify(c.toJSON())}}}function V(){function a(a){n(b,a)}var b=[];return[Object,Array,Function,Number,String,Boolean,Error,Math,Date,RegExp].forEach(function(b){Object.getOwnPropertyNames(b).map(a),b.prototype&&Object.getOwnPropertyNames(b.prototype).map(a)}),b}function W(a,b){function c(a){return!(p.indexOf(a)>=0)&&(!(i.indexOf(a)>=0)&&(b.only_cache?j.props.has(a):!/^[0-9.]+$/.test(a)))}function d(a){return!(m&&a in q)&&(!(l&&!l.test(a))&&(!(i.indexOf(a)>=0)&&(j.props.has(a)||o.indexOf(a)>=0)))}function e(a,b){return b?void(q[a]=!0):(c(a)&&n(o,a),void(d(a)||n(p,a)))}function f(a){if(!d(a))return a;var b=j.props.get(a);if(!b){do b=_b(++j.cname);while(!c(b));j.props.set(a,b)}return b}function g(a,b){var c={};try{!function a(d){d.walk(new z(function(d){if(d instanceof Sa)return a(d.cdr),!0;if(d instanceof ub)return e(d.value,b),!0;if(d instanceof $a)return a(d.consequent),a(d.alternative),!0;throw c}))}(a)}catch(a){if(a!==c)throw a}}function h(a){return a.transform(new Q(function(a){return a instanceof Sa?a.cdr=h(a.cdr):a instanceof ub?a.value=f(a.value):a instanceof $a&&(a.consequent=h(a.consequent),a.alternative=h(a.alternative)),a}))}b=k(b,{reserved:null,cache:null,only_cache:!1,regex:null,ignore_quoted:!1});var i=b.reserved;null==i&&(i=V());var j=b.cache;null==j&&(j={cname:-1,props:new v});var l=b.regex,m=b.ignore_quoted,o=[],p=[],q={};return a.walk(new z(function(a){a instanceof db?e(a.key,m&&a.quote):a instanceof cb?e(a.key.name):a instanceof Ua?e(a.property):a instanceof Va&&g(a.property,m)})),a.transform(new Q(function(a){a instanceof db?m&&a.quote||(a.key=f(a.key)):a instanceof cb?a.key.name=f(a.key.name):a instanceof Ua?a.property=f(a.property):a instanceof Va&&(m||(a.property=h(a.property)))}))}var X=a("util"),Y=a("source-map"),Z=c;j.prototype=Object.create(Error.prototype),j.prototype.constructor=j,j.croak=function(a,b){throw new j(a,b)};var $=function(){function a(a,f,g){function h(){var h=f(a[i],i),l=h instanceof d;return l&&(h=h.v),h instanceof b?(h=h.v,h instanceof c?k.push.apply(k,g?h.v.slice().reverse():h.v):k.push(h)):h!==e&&(h instanceof c?j.push.apply(j,g?h.v.slice().reverse():h.v):j.push(h)),l}var i,j=[],k=[];if(a instanceof Array)if(g){for(i=a.length;--i>=0&&!h(););j.reverse(),k.reverse()}else for(i=0;i SymbolDef for all variables/functions defined in this scope",functions:"[Object/S] like `variables`, but only lists function declarations",uses_with:"[boolean/S] tells whether this scope uses the `with` statement",uses_eval:"[boolean/S] tells whether this scope contains a direct call to the global `eval`",parent_scope:"[AST_Scope?/S] link to the parent scope",enclosed:"[SymbolDef*/S] a list of all symbol definitions that are accessed from this scope or any subscopes",cname:"[integer/S] current index for mangling variables (used internally by the mangler)"}},fa),sa=x("Toplevel","globals",{$documentation:"The toplevel scope",$propdoc:{globals:"[Object/S] a map of name -> SymbolDef for all undeclared names"},wrap_enclose:function(a){var b=this,c=[],d=[];a.forEach(function(a){var b=a.lastIndexOf(":");c.push(a.substr(0,b)),d.push(a.substr(b+1))});var e="(function("+d.join(",")+"){ '$ORIG'; })("+c.join(",")+")";return e=P(e),e=e.transform(new Q(function(a){if(a instanceof da&&"$ORIG"==a.value)return $.splice(b.body)}))},wrap_commonjs:function(a,b){var c=this,d=[];b&&(c.figure_out_scope(),c.walk(new z(function(a){a instanceof ib&&a.definition().global&&(h(function(b){return b.name==a.name},d)||d.push(a))})));var e="(function(exports, global){ '$ORIG'; '$EXPORTS'; global['"+a+"'] = exports; }({}, (function(){return this}())))";return e=P(e),e=e.transform(new Q(function(a){if(a instanceof da)switch(a.value){case"$ORIG":return $.splice(c.body);case"$EXPORTS":var b=[];return d.forEach(function(a){b.push(new ea({body:new _a({left:new Va({expression:new qb({name:"exports"}),property:new ub({value:a.name})}),operator:"=",right:new qb(a)})}))}),$.splice(b)}}))}},ra),ta=x("Lambda","name argnames uses_arguments",{$documentation:"Base class for functions",$propdoc:{name:"[AST_SymbolDeclaration?] the name of this function",argnames:"[AST_SymbolFunarg*] array of function arguments",uses_arguments:"[boolean/S] tells whether this function accesses the arguments array"},_walk:function(a){return a._visit(this,function(){this.name&&this.name._walk(a),this.argnames.forEach(function(b){b._walk(a)}),y(this,a)})}},ra),ua=x("Accessor",null,{$documentation:"A setter/getter function. The `name` property is always null."},ta),va=x("Function",null,{$documentation:"A function expression"},ta),wa=x("Defun",null,{$documentation:"A function definition"},ta),xa=x("Jump",null,{$documentation:"Base class for “jumps” (for now that's `return`, `throw`, `break` and `continue`)"},ba),ya=x("Exit","value",{$documentation:"Base class for “exits” (`return` and `throw`)",$propdoc:{value:"[AST_Node?] the value returned or thrown by this statement; could be null for AST_Return"},_walk:function(a){return a._visit(this,this.value&&function(){this.value._walk(a)})}},xa),za=x("Return",null,{$documentation:"A `return` statement"},ya),Aa=x("Throw",null,{$documentation:"A `throw` statement"},ya),Ba=x("LoopControl","label",{$documentation:"Base class for loop control statements (`break` and `continue`)",$propdoc:{label:"[AST_LabelRef?] the label, or null if none"},_walk:function(a){return a._visit(this,this.label&&function(){this.label._walk(a)})}},xa),Ca=x("Break",null,{$documentation:"A `break` statement"},Ba),Da=x("Continue",null,{$documentation:"A `continue` statement"},Ba),Ea=x("If","condition alternative",{$documentation:"A `if` statement",$propdoc:{condition:"[AST_Node] the `if` condition",alternative:"[AST_Statement?] the `else` part, or null if not present"},_walk:function(a){return a._visit(this,function(){this.condition._walk(a),this.body._walk(a),this.alternative&&this.alternative._walk(a)})}},ia),Fa=x("Switch","expression",{$documentation:"A `switch` statement",$propdoc:{expression:"[AST_Node] the `switch` “discriminant”"},_walk:function(a){return a._visit(this,function(){this.expression._walk(a),y(this,a)})}},fa),Ga=x("SwitchBranch",null,{$documentation:"Base class for `switch` branches"},fa),Ha=x("Default",null,{$documentation:"A `default` switch branch"},Ga),Ia=x("Case","expression",{$documentation:"A `case` switch branch",$propdoc:{expression:"[AST_Node] the `case` expression"},_walk:function(a){return a._visit(this,function(){this.expression._walk(a),y(this,a)})}},Ga),Ja=x("Try","bcatch bfinally",{$documentation:"A `try` statement",$propdoc:{bcatch:"[AST_Catch?] the catch block, or null if not present",bfinally:"[AST_Finally?] the finally block, or null if not present"},_walk:function(a){return a._visit(this,function(){y(this,a),this.bcatch&&this.bcatch._walk(a),this.bfinally&&this.bfinally._walk(a)})}},fa),Ka=x("Catch","argname",{$documentation:"A `catch` node; only makes sense as part of a `try` statement",$propdoc:{argname:"[AST_SymbolCatch] symbol for the exception"},_walk:function(a){return a._visit(this,function(){this.argname._walk(a),y(this,a)})}},fa),La=x("Finally",null,{$documentation:"A `finally` node; only makes sense as part of a `try` statement"},fa),Ma=x("Definitions","definitions",{$documentation:"Base class for `var` or `const` nodes (variable declarations/initializations)",$propdoc:{definitions:"[AST_VarDef*] array of variable definitions"},_walk:function(a){return a._visit(this,function(){this.definitions.forEach(function(b){b._walk(a)})})}},ba),Na=x("Var",null,{$documentation:"A `var` statement"},Ma),Oa=x("Const",null,{$documentation:"A `const` statement"},Ma),Pa=x("VarDef","name value",{$documentation:"A variable declaration; only appears in a AST_Definitions node",$propdoc:{name:"[AST_SymbolVar|AST_SymbolConst] name of the variable",value:"[AST_Node?] initializer, or null of there's no initializer"},_walk:function(a){return a._visit(this,function(){this.name._walk(a),this.value&&this.value._walk(a)})}}),Qa=x("Call","expression args",{$documentation:"A function call expression",$propdoc:{expression:"[AST_Node] expression to invoke as function",args:"[AST_Node*] array of arguments"},_walk:function(a){return a._visit(this,function(){this.expression._walk(a),this.args.forEach(function(b){b._walk(a)})})}}),Ra=x("New",null,{$documentation:"An object instantiation. Derives from a function call since it has exactly the same properties"},Qa),Sa=x("Seq","car cdr",{$documentation:"A sequence expression (two comma-separated expressions)",$propdoc:{car:"[AST_Node] first element in sequence",cdr:"[AST_Node] second element in sequence"},$cons:function(a,b){var c=new Sa(a);return c.car=a,c.cdr=b,c},$from_array:function(a){if(0==a.length)return null;if(1==a.length)return a[0].clone();for(var b=null,c=a.length;--c>=0;)b=Sa.cons(a[c],b);for(var d=b;d;){if(d.cdr&&!d.cdr.cdr){d.cdr=d.cdr.car;break}d=d.cdr}return b},to_array:function(){for(var a=this,b=[];a;){if(b.push(a.car),a.cdr&&!(a.cdr instanceof Sa)){b.push(a.cdr);break}a=a.cdr}return b},add:function(a){for(var b=this;b;){if(!(b.cdr instanceof Sa)){var c=Sa.cons(b.cdr,a);return b.cdr=c}b=b.cdr}},len:function(){return this.cdr instanceof Sa?this.cdr.len()+1:2},_walk:function(a){return a._visit(this,function(){this.car._walk(a),this.cdr&&this.cdr._walk(a)})}}),Ta=x("PropAccess","expression property",{$documentation:'Base class for property access expressions, i.e. `a.foo` or `a["foo"]`',$propdoc:{expression:"[AST_Node] the “container” expression",property:"[AST_Node|string] the property to access. For AST_Dot this is always a plain string, while for AST_Sub it's an arbitrary AST_Node"}}),Ua=x("Dot",null,{$documentation:"A dotted property access expression",_walk:function(a){return a._visit(this,function(){this.expression._walk(a)})}},Ta),Va=x("Sub",null,{$documentation:'Index-style property access, i.e. `a["foo"]`',_walk:function(a){return a._visit(this,function(){this.expression._walk(a),this.property._walk(a)})}},Ta),Wa=x("Unary","operator expression",{$documentation:"Base class for unary expressions",$propdoc:{operator:"[string] the operator",expression:"[AST_Node] expression that this unary operator applies to"},_walk:function(a){return a._visit(this,function(){this.expression._walk(a)})}}),Xa=x("UnaryPrefix",null,{$documentation:"Unary prefix expression, i.e. `typeof i` or `++i`"},Wa),Ya=x("UnaryPostfix",null,{$documentation:"Unary postfix expression, i.e. `i++`"},Wa),Za=x("Binary","left operator right",{$documentation:"Binary expression, i.e. `a + b`",$propdoc:{left:"[AST_Node] left-hand side expression",operator:"[string] the operator",right:"[AST_Node] right-hand side expression"},_walk:function(a){return a._visit(this,function(){this.left._walk(a),this.right._walk(a)})}}),$a=x("Conditional","condition consequent alternative",{$documentation:"Conditional expression using the ternary operator, i.e. `a ? b : c`",$propdoc:{condition:"[AST_Node]",consequent:"[AST_Node]",alternative:"[AST_Node]"},_walk:function(a){return a._visit(this,function(){this.condition._walk(a),this.consequent._walk(a),this.alternative._walk(a)})}}),_a=x("Assign",null,{$documentation:"An assignment expression — `a = b + 5`"},Za),ab=x("Array","elements",{$documentation:"An array literal",$propdoc:{elements:"[AST_Node*] array of elements"},_walk:function(a){return a._visit(this,function(){this.elements.forEach(function(b){b._walk(a)})})}}),bb=x("Object","properties",{$documentation:"An object literal",$propdoc:{properties:"[AST_ObjectProperty*] array of properties"},_walk:function(a){return a._visit(this,function(){this.properties.forEach(function(b){b._walk(a)})})}}),cb=x("ObjectProperty","key value",{$documentation:"Base class for literal object properties",$propdoc:{key:"[string] the property name converted to a string for ObjectKeyVal. For setters and getters this is an arbitrary AST_Node.",value:"[AST_Node] property value. For setters and getters this is an AST_Function."},_walk:function(a){return a._visit(this,function(){this.value._walk(a)})}}),db=x("ObjectKeyVal","quote",{$documentation:"A key: value object property",$propdoc:{quote:"[string] the original quote character"}},cb),eb=x("ObjectSetter",null,{$documentation:"An object setter property"},cb),fb=x("ObjectGetter",null,{$documentation:"An object getter property"},cb),gb=x("Symbol","scope name thedef",{$propdoc:{name:"[string] name of this symbol",scope:"[AST_Scope/S] the current scope (not necessarily the definition scope)",thedef:"[SymbolDef/S] the definition of this symbol"},$documentation:"Base class for all symbols"}),hb=x("SymbolAccessor",null,{$documentation:"The name of a property accessor (setter/getter function)"},gb),ib=x("SymbolDeclaration","init",{$documentation:"A declaration symbol (symbol in var/const, function name or argument, symbol in catch)",$propdoc:{init:"[AST_Node*/S] array of initializers for this declaration."}},gb),jb=x("SymbolVar",null,{$documentation:"Symbol defining a variable"},ib),kb=x("SymbolConst",null,{$documentation:"A constant declaration"},ib),lb=x("SymbolFunarg",null,{$documentation:"Symbol naming a function argument"},jb),mb=x("SymbolDefun",null,{$documentation:"Symbol defining a function"},ib),nb=x("SymbolLambda",null,{$documentation:"Symbol naming a function expression"},ib),ob=x("SymbolCatch",null,{$documentation:"Symbol naming the exception in catch"},ib),pb=x("Label","references",{$documentation:"Symbol naming a label (declaration)",$propdoc:{references:"[AST_LoopControl*] a list of nodes referring to this label"},initialize:function(){this.references=[],this.thedef=this}},gb),qb=x("SymbolRef",null,{$documentation:"Reference to some symbol (not definition/declaration)"},gb),rb=x("LabelRef",null,{$documentation:"Reference to a label symbol"},gb),sb=x("This",null,{$documentation:"The `this` symbol"},gb),tb=x("Constant",null,{$documentation:"Base class for all constants",getValue:function(){return this.value}}),ub=x("String","value quote",{$documentation:"A string literal",$propdoc:{value:"[string] the contents of this string",quote:"[string] the original quote character"}},tb),vb=x("Number","value literal",{$documentation:"A number literal",$propdoc:{value:"[number] the numeric value",literal:"[string] numeric value as string (optional)"}},tb),wb=x("RegExp","value",{$documentation:"A regexp literal",$propdoc:{value:"[RegExp] the actual regexp"}},tb),xb=x("Atom",null,{$documentation:"Base class for atoms"},tb),yb=x("Null",null,{$documentation:"The `null` atom",value:null},xb),zb=x("NaN",null,{$documentation:"The impossible value",value:NaN},xb),Ab=x("Undefined",null,{$documentation:"The `undefined` value",value:void 0},xb),Bb=x("Hole",null,{$documentation:"A hole in an array",value:void 0},xb),Cb=x("Infinity",null,{$documentation:"The `Infinity` value",value:1/0},xb),Db=x("Boolean",null,{$documentation:"Base class for booleans"},xb),Eb=x("False",null,{$documentation:"The `false` atom",value:!1},Db),Fb=x("True",null,{$documentation:"The `true` atom",value:!0},Db);z.prototype={_visit:function(a,b){this.push(a);var c=this.visit(a,b?function(){b.call(a)}:m);return!c&&b&&b.call(a),this.pop(a),c},parent:function(a){return this.stack[this.stack.length-2-(a||0)]},push:function(a){a instanceof ta?this.directives=Object.create(this.directives):a instanceof da&&(this.directives[a.value]=!this.directives[a.value]||"up"),this.stack.push(a)},pop:function(a){this.stack.pop(),a instanceof ta&&(this.directives=Object.getPrototypeOf(this.directives))},self:function(){return this.stack[this.stack.length-1]},find_parent:function(a){for(var b=this.stack,c=b.length;--c>=0;){var d=b[c];if(d instanceof a)return d}},has_directive:function(a){var b=this.directives[a];if(b)return b;var c=this.stack[this.stack.length-1];if(c instanceof ra)for(var d=0;d0;){var d=a[--b];if(d instanceof Ea&&d.condition===c||d instanceof $a&&d.condition===c||d instanceof la&&d.condition===c||d instanceof oa&&d.condition===c||d instanceof Xa&&"!"==d.operator&&d.expression===c)return!0;if(!(d instanceof Za)||"&&"!=d.operator&&"||"!=d.operator)return!1;c=d}},loopcontrol_target:function(a){var b=this.stack;if(a)for(var c=b.length;--c>=0;){var d=b[c];if(d instanceof ja&&d.label.name==a.name)return d.body}else for(var c=b.length;--c>=0;){var d=b[c];if(d instanceof Fa||d instanceof ka)return d}}};var Gb="break case catch const continue debugger default delete do else finally for function if in instanceof new return switch throw try typeof var void while with",Hb="false null true",Ib="abstract boolean byte char class double enum export extends final float goto implements import int interface let long native package private protected public short static super synchronized this throws transient volatile yield "+Hb+" "+Gb,Jb="return new delete throw else case";Gb=t(Gb),Ib=t(Ib),Jb=t(Jb),Hb=t(Hb);var Kb=t(f("+-*&%=<>!?|~^")),Lb=/^0x[0-9a-f]+$/i,Mb=/^0[0-7]+$/,Nb=t(["in","instanceof","typeof","new","void","delete","++","--","+","-","!","~","&","|","^","*","/","%",">>","<<",">>>","<",">","<=",">=","==","===","!=","!==","?","=","+=","-=","/=","*=","%=",">>=","<<=",">>>=","|=","^=","&=","&&","||"]),Ob=t(f("  \n\r\t\f\v​           \u2028\u2029   \ufeff")),Pb=t(f("\n\r\u2028\u2029")),Qb=t(f("[{(,.;:")),Rb=t(f("[]{}(),;:")),Sb=t(f("gmsiy")),Tb={letter:new RegExp("[\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),digit:new RegExp("[\\u0030-\\u0039\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0BE6-\\u0BEF\\u0C66-\\u0C6F\\u0CE6-\\u0CEF\\u0D66-\\u0D6F\\u0DE6-\\u0DEF\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F29\\u1040-\\u1049\\u1090-\\u1099\\u17E0-\\u17E9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19D9\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\uA620-\\uA629\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uA9F0-\\uA9F9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19]"),non_spacing_mark:new RegExp("[\\u0300-\\u036F\\u0483-\\u0487\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u065E\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0900-\\u0902\\u093C\\u0941-\\u0948\\u094D\\u0951-\\u0955\\u0962\\u0963\\u0981\\u09BC\\u09C1-\\u09C4\\u09CD\\u09E2\\u09E3\\u0A01\\u0A02\\u0A3C\\u0A41\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81\\u0A82\\u0ABC\\u0AC1-\\u0AC5\\u0AC7\\u0AC8\\u0ACD\\u0AE2\\u0AE3\\u0B01\\u0B3C\\u0B3F\\u0B41-\\u0B44\\u0B4D\\u0B56\\u0B62\\u0B63\\u0B82\\u0BC0\\u0BCD\\u0C3E-\\u0C40\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0CBC\\u0CBF\\u0CC6\\u0CCC\\u0CCD\\u0CE2\\u0CE3\\u0D41-\\u0D44\\u0D4D\\u0D62\\u0D63\\u0DCA\\u0DD2-\\u0DD4\\u0DD6\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F71-\\u0F7E\\u0F80-\\u0F84\\u0F86\\u0F87\\u0F90-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1030\\u1032-\\u1037\\u1039\\u103A\\u103D\\u103E\\u1058\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108D\\u109D\\u135F\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B7-\\u17BD\\u17C6\\u17C9-\\u17D3\\u17DD\\u180B-\\u180D\\u18A9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193B\\u1A17\\u1A18\\u1A56\\u1A58-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A6C\\u1A73-\\u1A7C\\u1A7F\\u1B00-\\u1B03\\u1B34\\u1B36-\\u1B3A\\u1B3C\\u1B42\\u1B6B-\\u1B73\\u1B80\\u1B81\\u1BA2-\\u1BA5\\u1BA8\\u1BA9\\u1C2C-\\u1C33\\u1C36\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE0\\u1CE2-\\u1CE8\\u1CED\\u1DC0-\\u1DE6\\u1DFD-\\u1DFF\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2CEF-\\u2CF1\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F\\uA67C\\uA67D\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA825\\uA826\\uA8C4\\uA8E0-\\uA8F1\\uA926-\\uA92D\\uA947-\\uA951\\uA980-\\uA982\\uA9B3\\uA9B6-\\uA9B9\\uA9BC\\uAA29-\\uAA2E\\uAA31\\uAA32\\uAA35\\uAA36\\uAA43\\uAA4C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uABE5\\uABE8\\uABED\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE26]"),space_combining_mark:new RegExp("[\\u0903\\u093E-\\u0940\\u0949-\\u094C\\u094E\\u0982\\u0983\\u09BE-\\u09C0\\u09C7\\u09C8\\u09CB\\u09CC\\u09D7\\u0A03\\u0A3E-\\u0A40\\u0A83\\u0ABE-\\u0AC0\\u0AC9\\u0ACB\\u0ACC\\u0B02\\u0B03\\u0B3E\\u0B40\\u0B47\\u0B48\\u0B4B\\u0B4C\\u0B57\\u0BBE\\u0BBF\\u0BC1\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCC\\u0BD7\\u0C01-\\u0C03\\u0C41-\\u0C44\\u0C82\\u0C83\\u0CBE\\u0CC0-\\u0CC4\\u0CC7\\u0CC8\\u0CCA\\u0CCB\\u0CD5\\u0CD6\\u0D02\\u0D03\\u0D3E-\\u0D40\\u0D46-\\u0D48\\u0D4A-\\u0D4C\\u0D57\\u0D82\\u0D83\\u0DCF-\\u0DD1\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0F3E\\u0F3F\\u0F7F\\u102B\\u102C\\u1031\\u1038\\u103B\\u103C\\u1056\\u1057\\u1062-\\u1064\\u1067-\\u106D\\u1083\\u1084\\u1087-\\u108C\\u108F\\u109A-\\u109C\\u17B6\\u17BE-\\u17C5\\u17C7\\u17C8\\u1923-\\u1926\\u1929-\\u192B\\u1930\\u1931\\u1933-\\u1938\\u19B0-\\u19C0\\u19C8\\u19C9\\u1A19-\\u1A1B\\u1A55\\u1A57\\u1A61\\u1A63\\u1A64\\u1A6D-\\u1A72\\u1B04\\u1B35\\u1B3B\\u1B3D-\\u1B41\\u1B43\\u1B44\\u1B82\\u1BA1\\u1BA6\\u1BA7\\u1BAA\\u1C24-\\u1C2B\\u1C34\\u1C35\\u1CE1\\u1CF2\\uA823\\uA824\\uA827\\uA880\\uA881\\uA8B4-\\uA8C3\\uA952\\uA953\\uA983\\uA9B4\\uA9B5\\uA9BA\\uA9BB\\uA9BD-\\uA9C0\\uAA2F\\uAA30\\uAA33\\uAA34\\uAA4D\\uAA7B\\uABE3\\uABE4\\uABE6\\uABE7\\uABE9\\uABEA\\uABEC]"),connector_punctuation:new RegExp("[\\u005F\\u203F\\u2040\\u2054\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFF3F]")};L.prototype.toString=function(){return this.message+" (line: "+this.line+", col: "+this.col+", pos: "+this.pos+")\n\n"+this.stack};var Ub={},Vb=t(["typeof","void","delete","--","++","!","~","-","+"]),Wb=t(["--","++"]),Xb=t(["=","+=","-=","/=","*=","%=",">>=","<<=",">>>=","|=","^=","&="]),Yb=function(a,b){for(var c=0;c","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]],{}),Zb=d(["for","do","while","switch"]),$b=d(["atom","num","string","regexp","name"]);Q.prototype=new z,function(a){function b(b,c){b.DEFMETHOD("transform",function(b,d){var e,f;return b.push(this),b.before&&(e=b.before(this,c,d)),e===a&&(b.after?(b.stack[b.stack.length-1]=e=this,c(e,b),f=b.after(e,d),f!==a&&(e=f)):(e=this,c(e,b))),b.pop(this),e})}function c(a,b){return $(a,function(a){return a.transform(b,!0)})}b(aa,m),b(ja,function(a,b){a.label=a.label.transform(b),a.body=a.body.transform(b)}),b(ea,function(a,b){a.body=a.body.transform(b)}),b(fa,function(a,b){a.body=c(a.body,b)}),b(la,function(a,b){a.condition=a.condition.transform(b),a.body=a.body.transform(b)}),b(oa,function(a,b){a.init&&(a.init=a.init.transform(b)),a.condition&&(a.condition=a.condition.transform(b)),a.step&&(a.step=a.step.transform(b)),a.body=a.body.transform(b)}),b(pa,function(a,b){a.init=a.init.transform(b),a.object=a.object.transform(b),a.body=a.body.transform(b)}),b(qa,function(a,b){a.expression=a.expression.transform(b),a.body=a.body.transform(b)}),b(ya,function(a,b){a.value&&(a.value=a.value.transform(b))}),b(Ba,function(a,b){a.label&&(a.label=a.label.transform(b))}),b(Ea,function(a,b){a.condition=a.condition.transform(b),a.body=a.body.transform(b),a.alternative&&(a.alternative=a.alternative.transform(b))}),b(Fa,function(a,b){a.expression=a.expression.transform(b),a.body=c(a.body,b)}),b(Ia,function(a,b){a.expression=a.expression.transform(b),a.body=c(a.body,b)}),b(Ja,function(a,b){a.body=c(a.body,b),a.bcatch&&(a.bcatch=a.bcatch.transform(b)),a.bfinally&&(a.bfinally=a.bfinally.transform(b))}),b(Ka,function(a,b){a.argname=a.argname.transform(b),a.body=c(a.body,b)}),b(Ma,function(a,b){a.definitions=c(a.definitions,b)}),b(Pa,function(a,b){a.name=a.name.transform(b),a.value&&(a.value=a.value.transform(b))}),b(ta,function(a,b){a.name&&(a.name=a.name.transform(b)),a.argnames=c(a.argnames,b),a.body=c(a.body,b)}),b(Qa,function(a,b){a.expression=a.expression.transform(b),a.args=c(a.args,b)}),b(Sa,function(a,b){a.car=a.car.transform(b),a.cdr=a.cdr.transform(b)}),b(Ua,function(a,b){a.expression=a.expression.transform(b)}),b(Va,function(a,b){a.expression=a.expression.transform(b),a.property=a.property.transform(b)}),b(Wa,function(a,b){a.expression=a.expression.transform(b)}),b(Za,function(a,b){a.left=a.left.transform(b),a.right=a.right.transform(b)}),b($a,function(a,b){a.condition=a.condition.transform(b),a.consequent=a.consequent.transform(b),a.alternative=a.alternative.transform(b)}),b(ab,function(a,b){a.elements=c(a.elements,b)}),b(bb,function(a,b){a.properties=c(a.properties,b)}),b(cb,function(a,b){a.value=a.value.transform(b)})}(),R.next_id=1,R.prototype={unmangleable:function(a){return a||(a={}),this.global&&!a.toplevel||this.undeclared||!a.eval&&(this.scope.uses_eval||this.scope.uses_with)||a.keep_fnames&&(this.orig[0]instanceof nb||this.orig[0]instanceof mb)},mangle:function(a){var b=a.cache&&a.cache.props;if(this.global&&b&&b.has(this.name))this.mangled_name=b.get(this.name);else if(!this.mangled_name&&!this.unmangleable(a)){var c=this.scope;!a.screw_ie8&&this.orig[0]instanceof nb&&(c=c.parent_scope),this.mangled_name=c.next_mangled(a,this),this.global&&b&&b.set(this.name,this.mangled_name)}}},sa.DEFMETHOD("figure_out_scope",function(a){a=k(a,{screw_ie8:!0,cache:null});var b=this,c=b.parent_scope=null,d=new v,e=null,f=!1,g=0,h=new z(function(b,i){if(a.screw_ie8&&b instanceof Ka){var j=c;return c=new ra(b),c.init_scope_vars(g),c.parent_scope=j,i(),c=j,!0}if(b instanceof ra){b.init_scope_vars(g);var j=b.parent_scope=c,k=e,l=d;return e=c=b,d=new v,++g,i(),--g,c=j,e=k,d=l,!0}if(b instanceof ja){var m=b.label;if(d.has(m.name))throw new Error(o("Label {name} defined twice",m));return d.set(m.name,m),i(),d.del(m.name),!0}if(b instanceof qa)for(var n=c;n;n=n.parent_scope)n.uses_with=!0;else if(b instanceof gb&&(b.scope=c),b instanceof pb&&(b.thedef=b,b.references=[]),b instanceof nb)e.def_function(b);else if(b instanceof mb)(b.scope=e.parent_scope).def_function(b);else if(b instanceof Na)f=b.has_const_pragma();else if(b instanceof jb||b instanceof kb){var p=e.def_variable(b);p.constant=b instanceof kb||f, -p.init=h.parent().value}else if(b instanceof ob)(a.screw_ie8?c:e).def_variable(b);else if(b instanceof rb){var q=d.get(b.name);if(!q)throw new Error(o("Undefined label {name} [{line},{col}]",{name:b.name,line:b.start.line,col:b.start.col}));b.thedef=q}});b.walk(h);var i=null,j=b.globals=new v,h=new z(function(a,c){if(a instanceof ta){var d=i;return i=a,c(),i=d,!0}if(a instanceof Ba&&a.label)return a.label.thedef.references.push(a),!0;if(a instanceof qb){var e=a.name,f=h.parent();if("eval"==e&&f instanceof Qa)for(var g=a.scope;g&&!g.uses_eval;g=g.parent_scope)g.uses_eval=!0;var k=a.scope.find_variable(e);if(a.scope instanceof ta&&"arguments"==e&&(a.scope.uses_arguments=!0),!k){var l;j.has(e)?l=j.get(e):(l=new R(b,j.size(),a),l.undeclared=!0,l.global=!0,j.set(e,l)),k=l}return a.thedef=k,(f instanceof Wa&&("++"===f.operator||"--"===f.operator)||f instanceof _a&&f.left===a)&&(k.modified=!0),a.reference(),!0}});b.walk(h),a.cache&&(this.cname=a.cache.cname)}),ra.DEFMETHOD("init_scope_vars",function(a){this.variables=new v,this.functions=new v,this.uses_with=!1,this.uses_eval=!1,this.parent_scope=null,this.enclosed=[],this.cname=-1,this.nesting=a}),ta.DEFMETHOD("init_scope_vars",function(){ra.prototype.init_scope_vars.apply(this,arguments),this.uses_arguments=!1;var a=new Pa({name:"arguments",start:this.start,end:this.end}),b=new R(this,this.variables.size(),a);this.variables.set(a.name,b)}),qb.DEFMETHOD("reference",function(){var a=this.definition();a.references.push(this);for(var b=this.scope;b&&(n(b.enclosed,a),b!==a.scope);)b=b.parent_scope;this.frame=this.scope.nesting-a.scope.nesting}),ra.DEFMETHOD("find_variable",function(a){return a instanceof gb&&(a=a.name),this.variables.get(a)||this.parent_scope&&this.parent_scope.find_variable(a)}),ra.DEFMETHOD("def_function",function(a){this.functions.set(a.name,this.def_variable(a))}),ra.DEFMETHOD("def_variable",function(a){var b;return this.variables.has(a.name)?(b=this.variables.get(a.name),b.orig.push(a)):(b=new R(this,this.variables.size(),a),this.variables.set(a.name,b),b.global=!this.parent_scope),a.thedef=b}),ra.DEFMETHOD("next_mangled",function(a){var b=this.enclosed;a:for(;;){var c=_b(++this.cname);if(G(c)&&!(a.except.indexOf(c)>=0)){for(var d=b.length;--d>=0;){var e=b[d],f=e.mangled_name||e.unmangleable(a)&&e.name;if(c==f)continue a}return c}}}),va.DEFMETHOD("next_mangled",function(a,b){for(var c=b.orig[0]instanceof lb&&this.name&&this.name.definition(),d=c?c.mangled_name||c.name:null;;){var e=ta.prototype.next_mangled.call(this,a,b);if(!d||d!=e)return e}}),ra.DEFMETHOD("references",function(a){return a instanceof gb&&(a=a.definition()),this.enclosed.indexOf(a)<0?null:a}),gb.DEFMETHOD("unmangleable",function(a){return this.definition().unmangleable(a)}),hb.DEFMETHOD("unmangleable",function(){return!0}),pb.DEFMETHOD("unmangleable",function(){return!1}),gb.DEFMETHOD("unreferenced",function(){return 0==this.definition().references.length&&!(this.scope.uses_eval||this.scope.uses_with)}),gb.DEFMETHOD("undeclared",function(){return this.definition().undeclared}),rb.DEFMETHOD("undeclared",function(){return!1}),pb.DEFMETHOD("undeclared",function(){return!1}),gb.DEFMETHOD("definition",function(){return this.thedef}),gb.DEFMETHOD("global",function(){return this.definition().global}),Na.DEFMETHOD("has_const_pragma",function(){var a=this.start&&this.start.comments_before,b=a&&a[a.length-1];return b&&/@const\b/.test(b.value)}),sa.DEFMETHOD("_default_mangler_options",function(a){return k(a,{except:[],eval:!1,sort:!1,toplevel:!1,screw_ie8:!0,keep_fnames:!1})}),sa.DEFMETHOD("mangle_names",function(a){a=this._default_mangler_options(a),a.except.push("arguments");var b=-1,c=[];a.cache&&this.globals.each(function(b){a.except.indexOf(b.name)<0&&c.push(b)});var d=new z(function(e,f){if(e instanceof ja){var g=b;return f(),b=g,!0}if(e instanceof ra){var h=(d.parent(),[]);return e.variables.each(function(b){a.except.indexOf(b.name)<0&&h.push(b)}),void c.push.apply(c,h)}if(e instanceof pb){var i;do i=_b(++b);while(!G(i));return e.mangled_name=i,!0}if(a.screw_ie8&&e instanceof ob)return void c.push(e.definition())});this.walk(d),c.forEach(function(b){b.mangle(a)}),a.cache&&(a.cache.cname=this.cname)}),sa.DEFMETHOD("compute_char_frequency",function(a){a=this._default_mangler_options(a);var b=new z(function(b){b instanceof tb?_b.consider(b.print_to_string()):b instanceof za?_b.consider("return"):b instanceof Aa?_b.consider("throw"):b instanceof Da?_b.consider("continue"):b instanceof Ca?_b.consider("break"):b instanceof ca?_b.consider("debugger"):b instanceof da?_b.consider(b.value):b instanceof na?_b.consider("while"):b instanceof ma?_b.consider("do while"):b instanceof Ea?(_b.consider("if"),b.alternative&&_b.consider("else")):b instanceof Na?_b.consider("var"):b instanceof Oa?_b.consider("const"):b instanceof ta?_b.consider("function"):b instanceof oa?_b.consider("for"):b instanceof pa?_b.consider("for in"):b instanceof Fa?_b.consider("switch"):b instanceof Ia?_b.consider("case"):b instanceof Ha?_b.consider("default"):b instanceof qa?_b.consider("with"):b instanceof eb?_b.consider("set"+b.key):b instanceof fb?_b.consider("get"+b.key):b instanceof db?_b.consider(b.key):b instanceof Ra?_b.consider("new"):b instanceof sb?_b.consider("this"):b instanceof Ja?_b.consider("try"):b instanceof Ka?_b.consider("catch"):b instanceof La?_b.consider("finally"):b instanceof gb&&b.unmangleable(a)?_b.consider(b.name):b instanceof Wa||b instanceof Za?_b.consider(b.operator):b instanceof Ua&&_b.consider(b.property)});this.walk(b),_b.sort()});var _b=function(){function a(){d=Object.create(null),c=e.split("").map(function(a){return a.charCodeAt(0)}),c.forEach(function(a){d[a]=0})}function b(a){var b="",d=54;a++;do a--,b+=String.fromCharCode(c[a%d]),a=Math.floor(a/d),d=64;while(a>0);return b}var c,d,e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789";return b.consider=function(a){for(var b=a.length;--b>=0;){var c=a.charCodeAt(b);c in d&&++d[c]}},b.sort=function(){c=q(c,function(a,b){return B(a)&&!B(b)?1:B(b)&&!B(a)?-1:d[b]-d[a]})},b.reset=a,a(),b.get=function(){return c},b.freq=function(){return d},b}();sa.DEFMETHOD("scope_warnings",function(a){a=k(a,{undeclared:!1,unreferenced:!0,assign_to_global:!0,func_arguments:!0,nested_defuns:!0,eval:!0});var b=new z(function(c){if(a.undeclared&&c instanceof qb&&c.undeclared()&&aa.warn("Undeclared symbol: {name} [{file}:{line},{col}]",{name:c.name,file:c.start.file,line:c.start.line,col:c.start.col}),a.assign_to_global){var d=null;c instanceof _a&&c.left instanceof qb?d=c.left:c instanceof pa&&c.init instanceof qb&&(d=c.init),d&&(d.undeclared()||d.global()&&d.scope!==d.definition().scope)&&aa.warn("{msg}: {name} [{file}:{line},{col}]",{msg:d.undeclared()?"Accidental global?":"Assignment to global",name:d.name,file:d.start.file,line:d.start.line,col:d.start.col})}a.eval&&c instanceof qb&&c.undeclared()&&"eval"==c.name&&aa.warn("Eval is used [{file}:{line},{col}]",c.start),a.unreferenced&&(c instanceof ib||c instanceof pb)&&!(c instanceof ob)&&c.unreferenced()&&aa.warn("{type} {name} is declared but not referenced [{file}:{line},{col}]",{type:c instanceof pb?"Label":"Symbol",name:c.name,file:c.start.file,line:c.start.line,col:c.start.col}),a.func_arguments&&c instanceof ta&&c.uses_arguments&&aa.warn("arguments used in function {name} [{file}:{line},{col}]",{name:c.name?c.name.name:"anonymous",file:c.start.file,line:c.start.line,col:c.start.col}),a.nested_defuns&&c instanceof wa&&!(b.parent()instanceof ra)&&aa.warn('Function {name} declared in nested statement "{type}" [{file}:{line},{col}]',{name:c.name.name,type:b.parent().TYPE,file:c.start.file,line:c.start.line,col:c.start.col})});this.walk(b)});var ac=/^$|[;{][\s\n]*$/;!function(){function a(a,b){a.DEFMETHOD("_codegen",b)}function b(a,c){Array.isArray(a)?a.forEach(function(a){b(a,c)}):a.DEFMETHOD("needs_parens",c)}function c(a,b,c,d){var e=a.length-1;r=d,a.forEach(function(a,d){r!==!0||a instanceof da||a instanceof ha||a instanceof ea&&a.body instanceof ub||(r=!1),a instanceof ha||(c.indent(),a.print(c),d==e&&b||(c.newline(),b&&c.newline())),r===!0&&a instanceof ea&&a.body instanceof ub&&(r=!1)}),r=!1}function d(a,b,d){a.length>0?b.with_block(function(){c(a,!1,b,d)}):b.print("{}")}function e(a,b){if(b.option("bracketize"))return void n(a.body,b);if(!a.body)return b.force_semicolon();if(a.body instanceof ma)return void n(a.body,b);for(var c=a.body;;)if(c instanceof Ea){if(!c.alternative)return void n(a.body,b);c=c.alternative}else{if(!(c instanceof ia))break;c=c.body}h(a.body,b)}function f(a,b,c){if(c)try{a.walk(new z(function(a){if(a instanceof Za&&"in"==a.operator)throw b})),a.print(b)}catch(c){if(c!==b)throw c;a.print(b,!0)}else a.print(b)}function g(a){return[92,47,46,43,42,63,40,41,91,93,123,125,36,94,58,124,33,10,13,0,65279,8232,8233].indexOf(a)<0}function h(a,b){b.option("bracketize")?!a||a instanceof ha?b.print("{}"):a instanceof ga?a.print(b):b.with_block(function(){b.indent(),a.print(b),b.newline()}):!a||a instanceof ha?b.force_semicolon():a.print(b)}function i(a){for(var b=a.stack(),c=b.length,d=b[--c],e=b[--c];c>0;){if(e instanceof ba&&e.body===d)return!0;if(!(e instanceof Sa&&e.car===d||e instanceof Qa&&e.expression===d&&!(e instanceof Ra)||e instanceof Ua&&e.expression===d||e instanceof Va&&e.expression===d||e instanceof $a&&e.condition===d||e instanceof Za&&e.left===d||e instanceof Ya&&e.expression===d))return!1;d=e,e=b[--c]}}function j(a,b){return a.args.length>0||b.option("beautify")}function k(a){for(var b=a[0],c=b.length,d=1;d=0?d.push("0x"+a.toString(16).toLowerCase(),"0"+a.toString(8)):d.push("-0x"+(-a).toString(16).toLowerCase(),"-0"+(-a).toString(8)),(b=/^(.*?)(0+)$/.exec(a))&&d.push(b[1]+"e"+b[2].length)):(b=/^0?\.(0+)(.*)$/.exec(a))&&d.push(b[2]+"e-"+(b[1].length+b[2].length),c.substr(c.indexOf("."))),k(d)}function n(a,b){return a instanceof ga?void a.print(b):void b.with_block(function(){b.indent(),a.print(b),b.newline()})}function o(a,b){a.DEFMETHOD("add_source_map",function(a){b(this,a)})}function p(a,b){b.add_mapping(a.start)}var q=!1,r=!1;aa.DEFMETHOD("print",function(a,b){function c(){d.add_comments(a),d.add_source_map(a),e(d,a)}var d=this,e=d._codegen,f=q;d instanceof da&&"use asm"==d.value&&a.parent()instanceof ra&&(q=!0),a.push_node(d),b||d.needs_parens(a)?a.with_parens(c):c(),a.pop_node(),d instanceof ra&&(q=f)}),aa.DEFMETHOD("print_to_string",function(a){var b=S(a);return a||(b._readonly=!0),this.print(b),b.get()}),aa.DEFMETHOD("add_comments",function(a){if(!a._readonly){var b=this,c=b.start;if(c&&!c._comments_dumped){c._comments_dumped=!0;var d=c.comments_before||[];b instanceof ya&&b.value&&b.value.walk(new z(function(a){if(a.start&&a.start.comments_before&&(d=d.concat(a.start.comments_before),a.start.comments_before=[]),a instanceof va||a instanceof ab||a instanceof bb)return!0})),d=d.filter(a.option("comments"),b),!a.option("beautify")&&d.length>0&&/comment[134]/.test(d[0].type)&&0!==a.col()&&d[0].nlb&&a.print("\n"),d.forEach(function(b){/comment[134]/.test(b.type)?(a.print("//"+b.value+"\n"),a.indent()):"comment2"==b.type?(a.print("/*"+b.value+"*/"),c.nlb?(a.print("\n"),a.indent()):a.space()):0===a.pos()&&"comment5"==b.type&&a.option("shebang")&&(a.print("#!"+b.value+"\n"),a.indent())})}}}),b(aa,function(){return!1}),b(va,function(a){if(i(a))return!0;if(a.option("wrap_iife")){var b=a.parent();return b instanceof Qa&&b.expression===this}return!1}),b(bb,function(a){return i(a)}),b([Wa,Ab],function(a){var b=a.parent();return b instanceof Ta&&b.expression===this||b instanceof Qa&&b.expression===this}),b(Sa,function(a){var b=a.parent();return b instanceof Qa||b instanceof Wa||b instanceof Za||b instanceof Pa||b instanceof Ta||b instanceof ab||b instanceof cb||b instanceof $a}),b(Za,function(a){var b=a.parent();if(b instanceof Qa&&b.expression===this)return!0;if(b instanceof Wa)return!0;if(b instanceof Ta&&b.expression===this)return!0;if(b instanceof Za){var c=b.operator,d=Yb[c],e=this.operator,f=Yb[e];if(d>f||d==f&&this===b.right)return!0}}),b(Ta,function(a){var b=a.parent();if(b instanceof Ra&&b.expression===this)try{this.walk(new z(function(a){if(a instanceof Qa)throw b}))}catch(a){if(a!==b)throw a;return!0}}),b(Qa,function(a){var b,c=a.parent();return c instanceof Ra&&c.expression===this||this.expression instanceof va&&c instanceof Ta&&c.expression===this&&(b=a.parent(1))instanceof _a&&b.left===c}),b(Ra,function(a){var b=a.parent();if(!j(this,a)&&(b instanceof Ta||b instanceof Qa&&b.expression===this))return!0}),b(vb,function(a){var b=a.parent();if(b instanceof Ta&&b.expression===this){var c=this.getValue();if(c<0||/^0/.test(l(c)))return!0}}),b([_a,$a],function(a){var b=a.parent();return b instanceof Wa||(b instanceof Za&&!(b instanceof _a)||(b instanceof Qa&&b.expression===this||(b instanceof $a&&b.condition===this||(b instanceof Ta&&b.expression===this||void 0))))}),a(da,function(a,b){b.print_string(a.value,a.quote),b.semicolon()}),a(ca,function(a,b){b.print("debugger"),b.semicolon()}),ia.DEFMETHOD("_do_print_body",function(a){h(this.body,a)}),a(ba,function(a,b){a.body.print(b),b.semicolon()}),a(sa,function(a,b){c(a.body,!0,b,!0),b.print("")}),a(ja,function(a,b){a.label.print(b),b.colon(),a.body.print(b)}),a(ea,function(a,b){a.body.print(b),b.semicolon()}),a(ga,function(a,b){d(a.body,b)}),a(ha,function(a,b){b.semicolon()}),a(ma,function(a,b){b.print("do"),b.space(),a._do_print_body(b),b.space(),b.print("while"),b.space(),b.with_parens(function(){a.condition.print(b)}),b.semicolon()}),a(na,function(a,b){b.print("while"),b.space(),b.with_parens(function(){a.condition.print(b)}),b.space(),a._do_print_body(b)}),a(oa,function(a,b){b.print("for"),b.space(),b.with_parens(function(){!a.init||a.init instanceof ha?b.print(";"):(a.init instanceof Ma?a.init.print(b):f(a.init,b,!0),b.print(";"),b.space()),a.condition?(a.condition.print(b),b.print(";"),b.space()):b.print(";"),a.step&&a.step.print(b)}),b.space(),a._do_print_body(b)}),a(pa,function(a,b){b.print("for"),b.space(),b.with_parens(function(){a.init.print(b),b.space(),b.print("in"),b.space(),a.object.print(b)}),b.space(),a._do_print_body(b)}),a(qa,function(a,b){b.print("with"),b.space(),b.with_parens(function(){a.expression.print(b)}),b.space(),a._do_print_body(b)}),ta.DEFMETHOD("_do_print",function(a,b){var c=this;b||a.print("function"),c.name&&(a.space(),c.name.print(a)),a.with_parens(function(){c.argnames.forEach(function(b,c){c&&a.comma(),b.print(a)})}),a.space(),d(c.body,a,!0)}),a(ta,function(a,b){a._do_print(b)}),ya.DEFMETHOD("_do_print",function(a,b){a.print(b),this.value&&(a.space(),this.value.print(a)),a.semicolon()}),a(za,function(a,b){a._do_print(b,"return")}),a(Aa,function(a,b){a._do_print(b,"throw")}),Ba.DEFMETHOD("_do_print",function(a,b){a.print(b),this.label&&(a.space(),this.label.print(a)),a.semicolon()}),a(Ca,function(a,b){a._do_print(b,"break")}),a(Da,function(a,b){a._do_print(b,"continue")}),a(Ea,function(a,b){b.print("if"),b.space(),b.with_parens(function(){a.condition.print(b)}),b.space(),a.alternative?(e(a,b),b.space(),b.print("else"),b.space(),h(a.alternative,b)):a._do_print_body(b)}),a(Fa,function(a,b){b.print("switch"),b.space(),b.with_parens(function(){a.expression.print(b)}),b.space(),a.body.length>0?b.with_block(function(){a.body.forEach(function(a,c){c&&b.newline(),b.indent(!0),a.print(b)})}):b.print("{}")}),Ga.DEFMETHOD("_do_print_body",function(a){this.body.length>0&&(a.newline(),this.body.forEach(function(b){a.indent(),b.print(a),a.newline()}))}),a(Ha,function(a,b){b.print("default:"),a._do_print_body(b)}),a(Ia,function(a,b){b.print("case"),b.space(),a.expression.print(b),b.print(":"),a._do_print_body(b)}),a(Ja,function(a,b){b.print("try"),b.space(),d(a.body,b),a.bcatch&&(b.space(),a.bcatch.print(b)),a.bfinally&&(b.space(),a.bfinally.print(b))}),a(Ka,function(a,b){b.print("catch"),b.space(),b.with_parens(function(){a.argname.print(b)}),b.space(),d(a.body,b)}),a(La,function(a,b){b.print("finally"),b.space(),d(a.body,b)}),Ma.DEFMETHOD("_do_print",function(a,b){a.print(b),a.space(),this.definitions.forEach(function(b,c){c&&a.comma(),b.print(a)});var c=a.parent(),d=c instanceof oa||c instanceof pa,e=d&&c.init===this;e||a.semicolon()}),a(Na,function(a,b){a._do_print(b,"var")}),a(Oa,function(a,b){a._do_print(b,"const")}),a(Pa,function(a,b){if(a.name.print(b),a.value){b.space(),b.print("="),b.space();var c=b.parent(1),d=c instanceof oa||c instanceof pa;f(a.value,b,d)}}),a(Qa,function(a,b){a.expression.print(b),a instanceof Ra&&!j(a,b)||b.with_parens(function(){a.args.forEach(function(a,c){c&&b.comma(),a.print(b)})})}),a(Ra,function(a,b){b.print("new"),b.space(),Qa.prototype._codegen(a,b)}),Sa.DEFMETHOD("_do_print",function(a){this.car.print(a),this.cdr&&(a.comma(),a.should_break()&&(a.newline(),a.indent()),this.cdr.print(a))}),a(Sa,function(a,b){a._do_print(b)}),a(Ua,function(a,b){var c=a.expression;c.print(b),c instanceof vb&&c.getValue()>=0&&(/[xa-f.)]/i.test(b.last())||b.print(".")),b.print("."),b.add_mapping(a.end),b.print_name(a.property)}),a(Va,function(a,b){a.expression.print(b),b.print("["),a.property.print(b),b.print("]")}),a(Xa,function(a,b){var c=a.operator;b.print(c),(/^[a-z]/i.test(c)||/[+-]$/.test(c)&&a.expression instanceof Xa&&/^[+-]/.test(a.expression.operator))&&b.space(),a.expression.print(b)}),a(Ya,function(a,b){a.expression.print(b),b.print(a.operator)}),a(Za,function(a,b){var c=a.operator;a.left.print(b),">"==c[0]&&a.left instanceof Ya&&"--"==a.left.operator?b.print(" "):b.space(),b.print(c),("<"==c||"<<"==c)&&a.right instanceof Xa&&"!"==a.right.operator&&a.right.expression instanceof Xa&&"--"==a.right.expression.operator?b.print(" "):b.space(),a.right.print(b)}),a($a,function(a,b){a.condition.print(b),b.space(),b.print("?"),b.space(),a.consequent.print(b),b.space(),b.colon(),a.alternative.print(b)}),a(ab,function(a,b){b.with_square(function(){var c=a.elements,d=c.length;d>0&&b.space(),c.forEach(function(a,c){c&&b.comma(),a.print(b),c===d-1&&a instanceof Bb&&b.comma()}),d>0&&b.space()})}),a(bb,function(a,b){a.properties.length>0?b.with_block(function(){a.properties.forEach(function(a,c){c&&(b.print(","),b.newline()),b.indent(),a.print(b)}),b.newline()}):b.print("{}")}),a(db,function(a,b){var c=a.key,d=a.quote;b.option("quote_keys")?b.print_string(c+""):("number"==typeof c||!b.option("beautify")&&+c+""==c)&&parseFloat(c)>=0?b.print(l(c)):(Ib(c)?b.option("screw_ie8"):J(c))?d&&b.option("keep_quoted_props")?b.print_string(c,d):b.print_name(c):b.print_string(c,d),b.colon(),a.value.print(b)}),a(eb,function(a,b){b.print("set"),b.space(),a.key.print(b),a.value._do_print(b,!0)}),a(fb,function(a,b){b.print("get"),b.space(),a.key.print(b),a.value._do_print(b,!0)}),a(gb,function(a,b){var c=a.definition();b.print_name(c?c.mangled_name||c.name:a.name)}),a(Ab,function(a,b){b.print("void 0")}),a(Bb,m),a(Cb,function(a,b){b.print("Infinity")}),a(zb,function(a,b){b.print("NaN")}),a(sb,function(a,b){b.print("this")}),a(tb,function(a,b){b.print(a.getValue())}),a(ub,function(a,b){b.print_string(a.getValue(),a.quote,r)}),a(vb,function(a,b){q&&a.start&&null!=a.start.raw?b.print(a.start.raw):b.print(l(a.getValue()))}),a(wb,function(a,b){var c=a.getValue().toString();b.option("ascii_only")?c=b.to_ascii(c):b.option("unescape_regexps")&&(c=c.split("\\\\").map(function(a){return a.replace(/\\u[0-9a-fA-F]{4}|\\x[0-9a-fA-F]{2}/g,function(a){var b=parseInt(a.substr(2),16);return g(b)?String.fromCharCode(b):a})}).join("\\\\")),b.print(c);var d=b.parent();d instanceof Za&&/^in/.test(d.operator)&&d.left===a&&b.print(" ")}),o(aa,m),o(da,p),o(ca,p),o(gb,p),o(xa,p),o(ia,p),o(ja,m),o(ta,p),o(Fa,p),o(Ga,p),o(ga,p),o(sa,m),o(Ra,p),o(Ja,p),o(Ka,p),o(La,p),o(Ma,p),o(tb,p),o(eb,function(a,b){b.add_mapping(a.start,a.key.name)}),o(fb,function(a,b){b.add_mapping(a.start,a.key.name)}),o(cb,function(a,b){b.add_mapping(a.start,a.key)})}(),T.prototype=new Q,l(T.prototype,{option:function(a){return this.options[a]},compress:function(a){for(var b=+this.options.passes||1,c=0;c0&&a.clear_opt_flags(),a=a.transform(this);return a},warn:function(a,b){if(this.options.warnings){var c=o(a,b);c in this.warnings_produced||(this.warnings_produced[c]=!0,aa.warn.apply(aa,arguments))}},clear_warnings:function(){this.warnings_produced={}},before:function(a,b,c){if(a._squeezed)return a;var d=!1;return a instanceof ra&&(a=a.hoist_declarations(this),d=!0),b(a,this),a=a.optimize(this),d&&a instanceof ra&&(a.drop_unused(this),b(a,this)),a._squeezed=!0,a}}),function(){function a(a,b){a.DEFMETHOD("optimize",function(a){var c=this;if(c._optimized)return c;if(a.has_directive("use asm"))return c;var d=b(c,a);return d._optimized=!0,d===c?d:d.transform(a)})}function b(a,b,c){return c||(c={}),b&&(c.start||(c.start=b.start),c.end||(c.end=b.end)),new a(c)}function c(a,c,d){if(c instanceof aa)return c.transform(a);switch(typeof c){case"string":return b(ub,d,{value:c}).optimize(a);case"number":return isNaN(c)?b(zb,d):1/c<0?b(Xa,d,{operator:"-",expression:b(vb,d,{value:-c})}):b(vb,d,{value:c}).optimize(a);case"boolean":return b(c?Fb:Eb,d).optimize(a);case"undefined":return b(Ab,d).optimize(a);default:if(null===c)return b(yb,d,{value:null}).optimize(a);if(c instanceof RegExp)return b(wb,d,{value:c}).optimize(a);throw new Error(o("Can't handle constant of type: {type}",{type:typeof c}))}}function d(a,c,d){return a instanceof Qa&&a.expression===c&&(d instanceof Ta||d instanceof qb&&"eval"===d.name)?b(Sa,c,{car:b(vb,c,{value:0}),cdr:d}):d}function e(a){if(null===a)return[];if(a instanceof ga)return a.body;if(a instanceof ha)return[];if(a instanceof ba)return[a];throw new Error("Can't convert thing to statement array")}function f(a){return null===a||(a instanceof ha||a instanceof ga&&0==a.body.length)}function i(a){return a instanceof Fa?a:(a instanceof oa||a instanceof pa||a instanceof la)&&a.body instanceof ga?a.body:a}function j(a,c){function f(a,c){function e(a,b){return a instanceof qb&&(b instanceof _a&&a===b.left||b instanceof Wa&&b.expression===a&&("++"==b.operator||"--"==b.operator))}function g(f,g,j){if(e(f,g))return f;var m=d(g,f,t.value);return t.value=null,n.splice(s,1),0===n.length&&(a[l]=b(ha,h),i=!0),k.clear_opt_flags(),c.warn("Replacing "+(j?"constant":"variable")+" "+v+" [{file}:{line},{col}]",f.start),u=!0,m}for(var h=c.self(),i=!1,j=a.length;--j>=0;){var k=a[j];if(!(k instanceof Ma)){if([k,k.body,k.alternative,k.bcatch,k.bfinally].forEach(function(a){a&&a.body&&f(a.body,c)}),j<=0)break;var l=j-1,m=a[l];if(m instanceof Ma){var n=m.definitions;if(null!=n)for(var o={},p=!1,q=!1,r={},s=n.length;--s>=0;){var t=n[s];if(null==t.value)break;var v=t.name.name;if(!v||!v.length)break;if(v in o)break;o[v]=!0;var w=h.find_variable&&h.find_variable(v);if(w&&w.references&&1===w.references.length&&"arguments"!=v){var x=w.references[0];if(x.scope.uses_eval||x.scope.uses_with)break;if(t.value instanceof wb||!t.value.is_constant(c)){if(!(p|=q))if(x.scope===h){var y=new z(function(a){a instanceof qb&&e(a,y.parent())&&(r[a.name]=q=!0)});t.value.walk(y);var A=!1,B=new Q(function(a){if(A)return a;var b=B.parent();return a instanceof ta||a instanceof Ja||a instanceof qa||a instanceof Ia||a instanceof ka||b instanceof Ea&&a!==b.condition||b instanceof $a&&a!==b.condition||b instanceof Za&&("&&"==b.operator||"||"==b.operator)&&a===b.right||b instanceof Fa&&a!==b.expression?(p=A=!0,a):void 0},function(a){return A?a:a===x?(A=!0,g(a,B.parent(),!1)):(p|=a.has_side_effects(c))?(A=!0,a):q&&a instanceof qb&&a.name in r?(p=!0,A=!0,a):void 0});k.transform(B)}else p|=t.value.has_side_effects(c)}else{var C=new Q(function(a){if(a===x)return g(a,C.parent(),!0)});k.transform(C)}}else p=!0}}}}if(i)for(var D=a.length;--D>=0;)a.length>1&&a[D]instanceof ha&&a.splice(D,1);return a}function g(a){function d(a){return/@ngInject/.test(a.value)}function e(a){return a.argnames.map(function(a){return b(ub,a,{value:a.name})})}function f(a,c){return b(ab,a,{elements:c})}function g(a,c){return b(ea,a,{body:b(_a,a,{operator:"=",left:b(Ua,c,{expression:b(qb,c,c),property:"$inject"}),right:f(a,e(a))})})}function h(a){a&&a.args&&(a.args.forEach(function(a,b,c){var g=a.start.comments_before;a instanceof ta&&g.length&&d(g[0])&&(c[b]=f(a,e(a).concat(a)))}),a.expression&&a.expression.expression&&h(a.expression.expression))}return a.reduce(function(a,b){if(a.push(b),b.body&&b.body.args)h(b.body);else{var e=b.start,f=e.comments_before;if(f&&f.length>0){var i=f.pop();d(i)&&(b instanceof wa?a.push(g(b,b.name)):b instanceof Ma?b.definitions.forEach(function(b){b.value&&b.value instanceof ta&&a.push(g(b.value,b.name))}):c.warn("Unknown statement marked with @ngInject [{file}:{line},{col}]",e))}}return a},[])}function h(a){var b=[];return a.reduce(function(a,c){return c instanceof ga?(u=!0,a.push.apply(a,h(c.body))):c instanceof ha?u=!0:c instanceof da?b.indexOf(c.value)<0?(a.push(c),b.push(c.value)):u=!0:a.push(c),a},[])}function j(a,c){function d(a){for(var b=0,c=a.length;--c>=0;){var d=a[c];if(d instanceof Ea&&d.body instanceof za&&++b>1)return!0}return!1}var f=c.self(),g=d(a),h=f instanceof ta,j=[];a:for(var l=a.length;--l>=0;){var m=a[l];switch(!0){case h&&m instanceof za&&!m.value&&0==j.length:u=!0;continue a;case m instanceof Ea:if(m.body instanceof za){if((h&&0==j.length||j[0]instanceof za&&!j[0].value)&&!m.body.value&&!m.alternative){u=!0;var o=b(ea,m.condition,{body:m.condition});j.unshift(o);continue a}if(j[0]instanceof za&&m.body.value&&j[0].value&&!m.alternative){u=!0,m=m.clone(),m.alternative=j[0],j[0]=m.transform(c);continue a}if(g&&(0==j.length||j[0]instanceof za)&&m.body.value&&!m.alternative&&h){u=!0,m=m.clone(),m.alternative=j[0]||b(za,m,{value:b(Ab,m)}),j[0]=m.transform(c);continue a}if(!m.body.value&&h){u=!0,m=m.clone(),m.condition=m.condition.negate(c);var q=e(m.alternative).concat(j),r=k(q);m.body=b(ga,m,{body:q}),m.alternative=null,j=r.concat([m.transform(c)]);continue a}if(c.option("sequences")&&1==j.length&&h&&j[0]instanceof ea&&(!m.alternative||m.alternative instanceof ea)){u=!0,j.push(b(za,j[0],{value:b(Ab,j[0])}).transform(c)),j=e(m.alternative).concat(j),j.unshift(m);continue a}}var s=n(m.body),t=s instanceof Ba?c.loopcontrol_target(s.label):null;if(s&&(s instanceof za&&!s.value&&h||s instanceof Da&&f===i(t)||s instanceof Ca&&t instanceof ga&&f===t)){s.label&&p(s.label.thedef.references,s),u=!0;var q=e(m.body).slice(0,-1);m=m.clone(),m.condition=m.condition.negate(c),m.body=b(ga,m,{body:e(m.alternative).concat(j)}),m.alternative=b(ga,m,{body:q}),j=[m.transform(c)];continue a}var s=n(m.alternative),t=s instanceof Ba?c.loopcontrol_target(s.label):null;if(s&&(s instanceof za&&!s.value&&h||s instanceof Da&&f===i(t)||s instanceof Ca&&t instanceof ga&&f===t)){s.label&&p(s.label.thedef.references,s),u=!0,m=m.clone(),m.body=b(ga,m.body,{body:e(m.body).concat(j)}),m.alternative=b(ga,m.alternative,{body:e(m.alternative).slice(0,-1)}),j=[m.transform(c)];continue a}j.unshift(m);break;default:j.unshift(m)}}return j}function m(a,b){var c=!1,d=a.length,e=b.self();return a=a.reduce(function(a,d){if(c)l(b,d,a);else{if(d instanceof Ba){var f=b.loopcontrol_target(d.label);d instanceof Ca&&f instanceof ga&&i(f)===e||d instanceof Da&&i(f)===e?d.label&&p(d.label.thedef.references,d):a.push(d)}else a.push(d);n(d)&&(c=!0)}return a},[]),u=a.length!=d,a}function o(a,c){function d(){e=Sa.from_array(e),e&&f.push(b(ea,e,{body:e})),e=[]}if(a.length<2)return a;var e=[],f=[];return a.forEach(function(a){a instanceof ea&&q(e)0&&(a=o(a,c)),c.option("join_vars")&&(a=s(a,c)),c.option("collapse_vars")&&(a=f(a,c));while(u&&v-- >0);return c.option("negate_iife")&&t(a,c),a}function k(a){for(var b=[],c=a.length-1;c>=0;--c){var d=a[c];d instanceof wa&&(a.splice(c,1),b.unshift(d))}return b}function l(a,b,c){b instanceof wa||a.warn("Dropping unreachable code [{file}:{line},{col}]",b.start),b.walk(new z(function(b){return b instanceof Ma?(a.warn("Declarations in unreachable code! [{file}:{line},{col}]",b.start),b.remove_initializers(),c.push(b),!0):b instanceof wa?(c.push(b),!0):b instanceof ra||void 0}))}function m(a,b){return a.print_to_string().length>b.print_to_string().length?b:a}function n(a){return a&&a.aborts()}function r(a,c){function d(d){d=e(d),a.body instanceof ga?(a.body=a.body.clone(),a.body.body=d.concat(a.body.body.slice(1)),a.body=a.body.transform(c)):a.body=b(ga,a.body,{body:d}).transform(c),r(a,c)}var f=a.body instanceof ga?a.body.body[0]:a.body;f instanceof Ea&&(f.body instanceof Ca&&c.loopcontrol_target(f.body.label)===a?(a.condition?a.condition=b(Za,a.condition,{left:a.condition,operator:"&&",right:f.condition.negate(c)}):a.condition=f.condition.negate(c),d(f.alternative)):f.alternative instanceof Ca&&c.loopcontrol_target(f.alternative.label)===a&&(a.condition?a.condition=b(Za,a.condition,{left:a.condition,operator:"&&",right:f.condition}):a.condition=f.condition,d(f.body)))}function s(a,b){var c=b.option("pure_getters");b.options.pure_getters=!1;var d=a.has_side_effects(b);return b.options.pure_getters=c,d}function x(a,c){return c.option("booleans")&&c.in_boolean_context()&&!a.has_side_effects(c)?b(Fb,a):a}a(aa,function(a,b){return a}),aa.DEFMETHOD("equivalent_to",function(a){return this.print_to_string()==a.print_to_string()}),aa.DEFMETHOD("clear_opt_flags",function(){this.walk(new z(function(a){a instanceof da||a instanceof tb||(a._squeezed=!1,a._optimized=!1)}))}),function(a){var b=["!","delete"],c=["in","instanceof","==","!=","===","!==","<","<=",">=",">"];a(aa,function(){return!1}),a(Xa,function(){return g(this.operator,b)}),a(Za,function(){return g(this.operator,c)||("&&"==this.operator||"||"==this.operator)&&this.left.is_boolean()&&this.right.is_boolean()}),a($a,function(){return this.consequent.is_boolean()&&this.alternative.is_boolean()}),a(_a,function(){return"="==this.operator&&this.right.is_boolean()}),a(Sa,function(){return this.cdr.is_boolean()}),a(Fb,function(){return!0}),a(Eb,function(){return!0})}(function(a,b){a.DEFMETHOD("is_boolean",b)}),function(a){a(aa,function(){return!1}),a(ub,function(){return!0}),a(Xa,function(){return"typeof"==this.operator}),a(Za,function(a){ -return"+"==this.operator&&(this.left.is_string(a)||this.right.is_string(a))}),a(_a,function(a){return("="==this.operator||"+="==this.operator)&&this.right.is_string(a)}),a(Sa,function(a){return this.cdr.is_string(a)}),a($a,function(a){return this.consequent.is_string(a)&&this.alternative.is_string(a)}),a(Qa,function(a){return a.option("unsafe")&&this.expression instanceof qb&&"String"==this.expression.name&&this.expression.undeclared()})}(function(a,b){a.DEFMETHOD("is_string",b)}),function(a){function b(a,b){if(!b)throw new Error("Compressor must be passed");return a._eval(b)}aa.DEFMETHOD("evaluate",function(b){if(!b.option("evaluate"))return[this];try{var d=this._eval(b);return[m(c(b,d,this),this),d]}catch(b){if(b!==a)throw b;return[this]}}),aa.DEFMETHOD("is_constant",function(a){return this instanceof tb||this instanceof Xa&&"!"==this.operator&&this.expression instanceof tb||this.evaluate(a).length>1}),aa.DEFMETHOD("constant_value",function(a){if(this instanceof tb)return this.value;if(this instanceof Xa&&"!"==this.operator&&this.expression instanceof tb)return!this.expression.value;var b=this.evaluate(a);return b.length>1?b[1]:void 0}),a(ba,function(){throw new Error(o("Cannot evaluate a statement [{file}:{line},{col}]",this.start))}),a(va,function(){throw a}),a(aa,function(){throw a}),a(tb,function(){return this.getValue()}),a(Xa,function(c){var d=this.expression;switch(this.operator){case"!":return!b(d,c);case"typeof":if(d instanceof va)return"function";if(d=b(d,c),d instanceof RegExp)throw a;return typeof d;case"void":return void b(d,c);case"~":return~b(d,c);case"-":return-b(d,c);case"+":return+b(d,c)}throw a}),a(Za,function(c){var d,e=this.left,f=this.right;switch(this.operator){case"&&":d=b(e,c)&&b(f,c);break;case"||":d=b(e,c)||b(f,c);break;case"|":d=b(e,c)|b(f,c);break;case"&":d=b(e,c)&b(f,c);break;case"^":d=b(e,c)^b(f,c);break;case"+":d=b(e,c)+b(f,c);break;case"*":d=b(e,c)*b(f,c);break;case"/":d=b(e,c)/b(f,c);break;case"%":d=b(e,c)%b(f,c);break;case"-":d=b(e,c)-b(f,c);break;case"<<":d=b(e,c)<>":d=b(e,c)>>b(f,c);break;case">>>":d=b(e,c)>>>b(f,c);break;case"==":d=b(e,c)==b(f,c);break;case"===":d=b(e,c)===b(f,c);break;case"!=":d=b(e,c)!=b(f,c);break;case"!==":d=b(e,c)!==b(f,c);break;case"<":d=b(e,c)":d=b(e,c)>b(f,c);break;case">=":d=b(e,c)>=b(f,c);break;default:throw a}if(isNaN(d)&&c.find_parent(qa))throw a;return d}),a($a,function(a){return b(this.condition,a)?b(this.consequent,a):b(this.alternative,a)}),a(qb,function(c){if(this._evaluating)throw a;this._evaluating=!0;try{var d=this.definition();if(d&&(d.constant||c.option("reduce_vars")&&!d.modified)&&d.init)return b(d.init,c)}finally{this._evaluating=!1}throw a}),a(Ua,function(c){if(c.option("unsafe")&&"length"==this.property){var d=b(this.expression,c);if("string"==typeof d)return d.length}throw a})}(function(a,b){a.DEFMETHOD("_eval",b)}),function(a){function c(a){return b(Xa,a,{operator:"!",expression:a})}a(aa,function(){return c(this)}),a(ba,function(){throw new Error("Cannot negate a statement")}),a(va,function(){return c(this)}),a(Xa,function(){return"!"==this.operator?this.expression:c(this)}),a(Sa,function(a){var b=this.clone();return b.cdr=b.cdr.negate(a),b}),a($a,function(a){var b=this.clone();return b.consequent=b.consequent.negate(a),b.alternative=b.alternative.negate(a),m(c(this),b)}),a(Za,function(a){var b=this.clone(),d=this.operator;if(a.option("unsafe_comps"))switch(d){case"<=":return b.operator=">",b;case"<":return b.operator=">=",b;case">=":return b.operator="<",b;case">":return b.operator="<=",b}switch(d){case"==":return b.operator="!=",b;case"!=":return b.operator="==",b;case"===":return b.operator="!==",b;case"!==":return b.operator="===",b;case"&&":return b.operator="||",b.left=b.left.negate(a),b.right=b.right.negate(a),m(c(this),b);case"||":return b.operator="&&",b.left=b.left.negate(a),b.right=b.right.negate(a),m(c(this),b)}return c(this)})}(function(a,b){a.DEFMETHOD("negate",function(a){return b.call(this,a)})}),function(a){a(aa,function(a){return!0}),a(ha,function(a){return!1}),a(tb,function(a){return!1}),a(sb,function(a){return!1}),a(Qa,function(a){var b=a.option("pure_funcs");return!b||("function"==typeof b?b(this):b.indexOf(this.expression.print_to_string())<0)}),a(fa,function(a){for(var b=this.body.length;--b>=0;)if(this.body[b].has_side_effects(a))return!0;return!1}),a(ea,function(a){return this.body.has_side_effects(a)}),a(wa,function(a){return!0}),a(va,function(a){return!1}),a(Za,function(a){return this.left.has_side_effects(a)||this.right.has_side_effects(a)}),a(_a,function(a){return!0}),a($a,function(a){return this.condition.has_side_effects(a)||this.consequent.has_side_effects(a)||this.alternative.has_side_effects(a)}),a(Wa,function(a){return"delete"==this.operator||"++"==this.operator||"--"==this.operator||this.expression.has_side_effects(a)}),a(qb,function(a){return this.global()&&this.undeclared()}),a(bb,function(a){for(var b=this.properties.length;--b>=0;)if(this.properties[b].has_side_effects(a))return!0;return!1}),a(cb,function(a){return this.value.has_side_effects(a)}),a(ab,function(a){for(var b=this.elements.length;--b>=0;)if(this.elements[b].has_side_effects(a))return!0;return!1}),a(Ua,function(a){return!a.option("pure_getters")||this.expression.has_side_effects(a)}),a(Va,function(a){return!a.option("pure_getters")||(this.expression.has_side_effects(a)||this.property.has_side_effects(a))}),a(Ta,function(a){return!a.option("pure_getters")}),a(Sa,function(a){return this.car.has_side_effects(a)||this.cdr.has_side_effects(a)})}(function(a,b){a.DEFMETHOD("has_side_effects",b)}),function(a){function b(){var a=this.body.length;return a>0&&n(this.body[a-1])}a(ba,function(){return null}),a(xa,function(){return this}),a(ga,b),a(Ga,b),a(Ea,function(){return this.alternative&&n(this.body)&&n(this.alternative)&&this})}(function(a,b){a.DEFMETHOD("aborts",b)}),a(da,function(a,c){return"up"===c.has_directive(a.value)?b(ha,a):a}),a(ca,function(a,c){return c.option("drop_debugger")?b(ha,a):a}),a(ja,function(a,c){return a.body instanceof Ca&&c.loopcontrol_target(a.body.label)===a.body?b(ha,a):0==a.label.references.length?a.body:a}),a(fa,function(a,b){return a.body=j(a.body,b),a}),a(ga,function(a,c){switch(a.body=j(a.body,c),a.body.length){case 1:return a.body[0];case 0:return b(ha,a)}return a}),ra.DEFMETHOD("drop_unused",function(a){var c=this;if(a.has_directive("use asm"))return c;if(a.option("unused")&&!(c instanceof sa)&&!c.uses_eval&&!c.uses_with){var d=[],e={},f=new v,g=this,h=new z(function(b,i){if(b!==c){if(b instanceof wa)return f.add(b.name.name,b),!0;if(b instanceof Ma&&g===c)return b.definitions.forEach(function(b){b.value&&(f.add(b.name.name,b.value),b.value.has_side_effects(a)&&b.value.walk(h))}),!0;if(b instanceof qb){var j=b.definition();return j.id in e||(e[j.id]=!0,d.push(j)),!0}if(b instanceof ra){var k=g;return g=b,i(),g=k,!0}}});c.walk(h);for(var i=0;i=0;){var k=h[i];if(!k.unreferenced())break;h.pop(),a.warn("Dropping unused function argument {name} [{file}:{line},{col}]",{name:k.name,file:k.start.file,line:k.start.line,col:k.start.col})}if(d instanceof wa&&d!==c)return d.name.definition().id in e?d:(a.warn("Dropping unused function {name} [{file}:{line},{col}]",{name:d.name.name,file:d.name.start.file,line:d.name.start.line,col:d.name.start.col}),b(ha,d));if(d instanceof Ma&&!(j.parent()instanceof pa)){var l=d.definitions.filter(function(b){if(b.name.definition().id in e)return!0;var c={name:b.name.name,file:b.name.start.file,line:b.name.start.line,col:b.name.start.col};return b.value&&b.value.has_side_effects(a)?(b._unused_side_effects=!0,a.warn("Side effects in initialization of unused variable {name} [{file}:{line},{col}]",c),!0):(a.warn("Dropping unused variable {name} [{file}:{line},{col}]",c),!1)});l=q(l,function(a,b){return!a.value&&b.value?-1:!b.value&&a.value?1:0});for(var m=[],i=0;i0&&(m.push(n.value),n.value=Sa.from_array(m),m=[]),++i)}return m=m.length>0?b(ga,d,{body:[b(ea,d,{body:Sa.from_array(m)})]}):null,0!=l.length||m?0==l.length?g?$.splice(m.body):m:(d.definitions=l,m?(m.body.unshift(d),g?$.splice(m.body):m):d):b(ha,d)}if(d instanceof oa&&(f(d,this),d.init instanceof ga)){var o=d.init.body.slice(0,-1);return d.init=d.init.body.slice(-1)[0].body,o.push(d),g?$.splice(o):b(ga,d,{body:o})}return d instanceof ra&&d!==c?d:void 0});c.transform(j)}}),ra.DEFMETHOD("hoist_declarations",function(a){var c=this;if(a.has_directive("use asm"))return c;var d=a.option("hoist_funs"),e=a.option("hoist_vars");if(d||e){var f=[],g=[],i=new v,j=0,k=0;c.walk(new z(function(a){return a instanceof ra&&a!==c||(a instanceof Na?(++k,!0):void 0)})),e=e&&k>1;var l=new Q(function(a){if(a!==c){if(a instanceof da)return f.push(a),b(ha,a);if(a instanceof wa&&d)return g.push(a),b(ha,a);if(a instanceof Na&&e){a.definitions.forEach(function(a){i.set(a.name.name,a),++j});var h=a.to_assignments(),k=l.parent();if(k instanceof pa&&k.init===a){if(null==h){var m=a.definitions[0].name;return b(qb,m,m)}return h}return k instanceof oa&&k.init===a?h:h?b(ea,a,{body:h}):b(ha,a)}if(a instanceof ra)return a}});if(c=c.transform(l),j>0){var m=[];if(i.each(function(a,b){c instanceof ta&&h(function(b){return b.name==a.name.name},c.argnames)?i.del(b):(a=a.clone(),a.value=null,m.push(a),i.set(b,a))}),m.length>0){for(var n=0;n1){if(d[1])return b(oa,a,{body:a.body});if(a instanceof na&&c.option("dead_code")){var e=[];return l(c,a.body,e),b(ga,a,{body:e})}}return a}),a(na,function(a,c){return c.option("loops")?(a=la.prototype.optimize.call(a,c),a instanceof na&&(r(a,c),a=b(oa,a,a).transform(c)),a):a}),a(oa,function(a,c){var d=a.condition;if(d&&(d=d.evaluate(c),a.condition=d[0]),!c.option("loops"))return a;if(d&&d.length>1&&!d[1]&&c.option("dead_code")){var e=[];return a.init instanceof ba?e.push(a.init):a.init&&e.push(b(ea,a.init,{body:a.init})),l(c,a.body,e),b(ga,a,{body:e})}return r(a,c),a}),a(Ea,function(a,c){if(!c.option("conditionals"))return a;var d=a.condition.evaluate(c);if(a.condition=d[0],d.length>1)if(d[1]){if(c.warn("Condition always true [{file}:{line},{col}]",a.condition.start),c.option("dead_code")){var e=[];return a.alternative&&l(c,a.alternative,e),e.push(a.body),b(ga,a,{body:e}).transform(c)}}else if(c.warn("Condition always false [{file}:{line},{col}]",a.condition.start),c.option("dead_code")){var e=[];return l(c,a.body,e),a.alternative&&e.push(a.alternative),b(ga,a,{body:e}).transform(c)}f(a.alternative)&&(a.alternative=null);var g=a.condition.negate(c),h=a.condition.print_to_string().length,i=g.print_to_string().length,j=i=Yb[a.operator]||e(null,!0)),/^[!=]==?$/.test(a.operator))){if(a.left instanceof qb&&a.right instanceof $a){if(a.right.consequent instanceof qb&&a.right.consequent.definition()===a.left.definition()){if(/^==/.test(a.operator))return a.right.condition;if(/^!=/.test(a.operator))return a.right.condition.negate(c)}if(a.right.alternative instanceof qb&&a.right.alternative.definition()===a.left.definition()){if(/^==/.test(a.operator))return a.right.condition.negate(c);if(/^!=/.test(a.operator))return a.right.condition}}if(a.right instanceof qb&&a.left instanceof $a){if(a.left.consequent instanceof qb&&a.left.consequent.definition()===a.right.definition()){if(/^==/.test(a.operator))return a.left.condition;if(/^!=/.test(a.operator))return a.left.condition.negate(c)}if(a.left.alternative instanceof qb&&a.left.alternative.definition()===a.right.definition()){if(/^==/.test(a.operator))return a.left.condition.negate(c);if(/^!=/.test(a.operator))return a.left.condition}}}if(a=a.lift_sequences(c),c.option("comparisons"))switch(a.operator){case"===":case"!==":(a.left.is_string(c)&&a.right.is_string(c)||a.left.is_boolean()&&a.right.is_boolean())&&(a.operator=a.operator.substr(0,2));case"==":case"!=":a.left instanceof ub&&"undefined"==a.left.value&&a.right instanceof Xa&&"typeof"==a.right.operator&&c.option("unsafe")&&(a.right.expression instanceof qb&&a.right.expression.undeclared()||(a.right=a.right.expression,a.left=b(Ab,a.left).optimize(c),2==a.operator.length&&(a.operator+="=")))}if(c.option("conditionals"))if("&&"==a.operator){var f=a.left.evaluate(c);if(f.length>1)return f[1]?(c.warn("Condition left of && always true [{file}:{line},{col}]",a.start),d(c.parent(),a,a.right.evaluate(c)[0])):(c.warn("Condition left of && always false [{file}:{line},{col}]",a.start),d(c.parent(),a,f[0]))}else if("||"==a.operator){var f=a.left.evaluate(c);if(f.length>1)return f[1]?(c.warn("Condition left of || always true [{file}:{line},{col}]",a.start),d(c.parent(),a,f[0])):(c.warn("Condition left of || always false [{file}:{line},{col}]",a.start),d(c.parent(),a,a.right.evaluate(c)[0]))}if(c.option("booleans")&&c.in_boolean_context())switch(a.operator){case"&&":var f=a.left.evaluate(c),g=a.right.evaluate(c);if(f.length>1&&!f[1]||g.length>1&&!g[1])return c.warn("Boolean && always false [{file}:{line},{col}]",a.start),a.left.has_side_effects(c)?b(Sa,a,{car:a.left,cdr:b(Eb)}).optimize(c):b(Eb,a);if(f.length>1&&f[1])return g[0];if(g.length>1&&g[1])return f[0];break;case"||":var f=a.left.evaluate(c),g=a.right.evaluate(c);if(f.length>1&&f[1]||g.length>1&&g[1])return c.warn("Boolean || always true [{file}:{line},{col}]",a.start),a.left.has_side_effects(c)?b(Sa,a,{car:a.left,cdr:b(Fb)}).optimize(c):b(Fb,a);if(f.length>1&&!f[1])return g[0];if(g.length>1&&!g[1])return f[0];break;case"+":var f=a.left.evaluate(c),g=a.right.evaluate(c);if(f.length>1&&f[0]instanceof ub&&f[1]&&!a.right.has_side_effects(c)||g.length>1&&g[0]instanceof ub&&g[1]&&!a.left.has_side_effects(c))return c.warn("+ in boolean context always true [{file}:{line},{col}]",a.start),b(Fb,a)}if(c.option("comparisons")&&a.is_boolean()){if(!(c.parent()instanceof Za)||c.parent()instanceof _a){var h=b(Xa,a,{operator:"!",expression:a.negate(c)});a=m(a,h)}if(c.option("unsafe_comps"))switch(a.operator){case"<":e(">");break;case"<=":e(">=")}}return"+"==a.operator&&a.right instanceof ub&&""===a.right.getValue()&&a.left instanceof Za&&"+"==a.left.operator&&a.left.is_string(c)?a.left:(c.option("evaluate")&&"+"==a.operator&&(a.left instanceof tb&&a.right instanceof Za&&"+"==a.right.operator&&a.right.left instanceof tb&&a.right.is_string(c)&&(a=b(Za,a,{operator:"+",left:b(ub,null,{value:""+a.left.getValue()+a.right.left.getValue(),start:a.left.start,end:a.right.left.end}),right:a.right.right})),a.right instanceof tb&&a.left instanceof Za&&"+"==a.left.operator&&a.left.right instanceof tb&&a.left.is_string(c)&&(a=b(Za,a,{operator:"+",left:a.left.left,right:b(ub,null,{value:""+a.left.right.getValue()+a.right.getValue(),start:a.left.right.start,end:a.right.end})})),a.left instanceof Za&&"+"==a.left.operator&&a.left.is_string(c)&&a.left.right instanceof tb&&a.right instanceof Za&&"+"==a.right.operator&&a.right.left instanceof tb&&a.right.is_string(c)&&(a=b(Za,a,{operator:"+",left:b(Za,a.left,{operator:"+",left:a.left.left,right:b(ub,null,{value:""+a.left.right.getValue()+a.right.left.getValue(),start:a.left.right.start,end:a.right.left.end})}),right:a.right.right}))),a.right instanceof Za&&a.right.operator==a.operator&&("&&"==a.operator||"||"==a.operator)?(a.left=b(Za,a.left,{operator:a.operator,left:a.left,right:a.right.left}),a.right=a.right.right,a.transform(c)):a.evaluate(c)[0])}),a(qb,function(a,d){function e(a,b){return b instanceof Za&&"="===b.operator&&b.left===a}if(a.undeclared()&&!e(a,d.parent())){var f=d.option("global_defs");if(f&&w(f,a.name))return c(d,f[a.name],a);if(!a.scope.uses_with||!d.find_parent(qa))switch(a.name){case"undefined":return b(Ab,a);case"NaN":return b(zb,a).transform(d);case"Infinity":return b(Cb,a).transform(d)}}return a}),a(Cb,function(a,c){return b(Za,a,{operator:"/",left:b(vb,a,{value:1}),right:b(vb,a,{value:0})})}),a(Ab,function(a,c){if(c.option("unsafe")){var d=c.find_parent(ra),e=d.find_variable("undefined");if(e){var f=b(qb,a,{name:"undefined",scope:d,thedef:e});return f.reference(),f}}return a});var A=["+","-","/","*","%",">>","<<",">>>","|","^","&"],B=["*","|","^","&"];a(_a,function(a,b){return a=a.lift_sequences(b),"="==a.operator&&a.left instanceof qb&&a.right instanceof Za&&(a.right.left instanceof qb&&a.right.left.name==a.left.name&&g(a.right.operator,A)?(a.operator=a.right.operator+"=",a.right=a.right.right):a.right.right instanceof qb&&a.right.right.name==a.left.name&&g(a.right.operator,B)&&!a.right.left.has_side_effects(b)&&(a.operator=a.right.operator+"=",a.right=a.right.left)),a}),a($a,function(a,e){function f(a){return a.is_boolean()?a:b(Xa,a,{operator:"!",expression:a.negate(e)})}function g(a){return a instanceof Fb||a instanceof Xa&&"!"==a.operator&&a.expression instanceof tb&&!a.expression.value}function h(a){return a instanceof Eb||a instanceof Xa&&"!"==a.operator&&a.expression instanceof tb&&!!a.expression.value}if(!e.option("conditionals"))return a;if(a.condition instanceof Sa){var i=a.condition.car;return a.condition=a.condition.cdr,Sa.cons(i,a)}var j=a.condition.evaluate(e);if(j.length>1)return j[1]?(e.warn("Condition always true [{file}:{line},{col}]",a.start),d(e.parent(),a,a.consequent)):(e.warn("Condition always false [{file}:{line},{col}]",a.start),d(e.parent(),a,a.alternative));var k=j[0].negate(e);m(j[0],k)===k&&(a=b($a,a,{condition:k,consequent:a.alternative,alternative:a.consequent}));var l=a.consequent,n=a.alternative;if(l instanceof _a&&n instanceof _a&&l.operator==n.operator&&l.left.equivalent_to(n.left)&&!l.left.has_side_effects(e))return b(_a,a,{operator:l.operator,left:l.left,right:b($a,a,{condition:a.condition,consequent:l.right,alternative:n.right})});if(l instanceof Qa&&n.TYPE===l.TYPE&&l.args.length==n.args.length&&!l.expression.has_side_effects(e)&&l.expression.equivalent_to(n.expression)){if(0==l.args.length)return b(Sa,a,{car:a.condition,cdr:l});if(1==l.args.length)return l.args[0]=b($a,a,{condition:a.condition,consequent:l.args[0],alternative:n.args[0]}),l}if(l instanceof $a&&l.alternative.equivalent_to(n))return b($a,a,{condition:b(Za,a,{left:a.condition,operator:"&&",right:l.condition}),consequent:l.consequent,alternative:n});if(l.is_constant(e)&&n.is_constant(e)&&l.equivalent_to(n)){var o=l.constant_value(e);return a.condition.has_side_effects(e)?Sa.from_array([a.condition,c(e,o,a)]):c(e,o,a)}return g(a.consequent)?h(a.alternative)?f(a.condition):b(Za,a,{operator:"||",left:f(a.condition),right:a.alternative}):h(a.consequent)?g(a.alternative)?f(a.condition.negate(e)):b(Za,a,{operator:"&&",left:f(a.condition.negate(e)),right:a.alternative}):g(a.alternative)?b(Za,a,{operator:"||",left:f(a.condition.negate(e)),right:a.consequent}):h(a.alternative)?b(Za,a,{operator:"&&",left:f(a.condition),right:a.consequent}):a}),a(Db,function(a,c){if(c.option("booleans")){var d=c.parent();return d instanceof Za&&("=="==d.operator||"!="==d.operator)?(c.warn("Non-strict equality against boolean: {operator} {value} [{file}:{line},{col}]",{operator:d.operator,value:a.value,file:d.start.file,line:d.start.line,col:d.start.col}),b(vb,a,{value:+a.value})):b(Xa,a,{operator:"!",expression:b(vb,a,{value:1-a.value})})}return a}),a(Va,function(a,c){var d=a.property;if(d instanceof ub&&c.option("properties")){if(d=d.getValue(),Ib(d)?c.option("screw_ie8"):J(d))return b(Ua,a,{expression:a.expression,property:d}).optimize(c);var e=parseFloat(d);isNaN(e)||e.toString()!=d||(a.property=b(vb,a.property,{value:e}))}return a}),a(Ua,function(a,c){var d=a.property;return Ib(d)&&!c.option("screw_ie8")?b(Va,a,{expression:a.expression,property:b(ub,a,{value:d})}).optimize(c):a.evaluate(c)[0]}),a(ab,x),a(bb,x),a(wb,x),a(za,function(a,b){return a.value instanceof Ab&&(a.value=null),a})}(),function(){function a(a){if("Literal"==a.type)return null!=a.raw?a.raw:a.value+""}function b(b){var c=b.loc,d=c&&c.start,e=b.range;return new _({file:c&&c.source,line:d&&d.line,col:d&&d.column,pos:e?e[0]:b.start,endline:d&&d.line,endcol:d&&d.column,endpos:e?e[0]:b.start,raw:a(b)})}function d(b){var c=b.loc,d=c&&c.end,e=b.range;return new _({file:c&&c.source,line:d&&d.line,col:d&&d.column,pos:e?e[1]:b.end,endline:d&&d.line,endcol:d&&d.column,endpos:e?e[1]:b.end,raw:a(b)})}function e(a,e,g){var k="function From_Moz_"+a+"(M){\n";k+="return new U2."+e.name+"({\nstart: my_start_token(M),\nend: my_end_token(M)";var m="function To_Moz_"+a+"(M){\n";m+="return {\ntype: "+JSON.stringify(a),g&&g.split(/\s*,\s*/).forEach(function(a){var b=/([a-z0-9$_]+)(=|@|>|%)([a-z0-9$_]+)/i.exec(a);if(!b)throw new Error("Can't understand property map: "+a);var c=b[1],d=b[2],e=b[3];switch(k+=",\n"+e+": ",m+=",\n"+c+": ",d){case"@":k+="M."+c+".map(from_moz)",m+="M."+e+".map(to_moz)";break;case">":k+="from_moz(M."+c+")",m+="to_moz(M."+e+")";break;case"=":k+="M."+c,m+="M."+e;break;case"%":k+="from_moz(M."+c+").body",m+="to_moz_block(M)";break;default:throw new Error("Can't understand operator in propmap: "+a)}}),k+="\n})\n}",m+="\n}\n}",k=new Function("U2","my_start_token","my_end_token","from_moz","return("+k+")")(c,b,d,f),m=new Function("to_moz","to_moz_block","return("+m+")")(i,j),l[a]=k,h(e,m)}function f(a){m.push(a);var b=null!=a?l[a.type](a):null;return m.pop(),b}function g(a,b,c){var d=a.start,e=a.end;return null!=d.pos&&null!=e.endpos&&(b.range=[d.pos,e.endpos]),d.line&&(b.loc={start:{line:d.line,column:d.col},end:e.endline?{line:e.endline,column:e.endcol}:null},d.file&&(b.loc.source=d.file)),b}function h(a,b){a.DEFMETHOD("to_mozilla_ast",function(){return g(this,b(this))})}function i(a){return null!=a?a.to_mozilla_ast():null}function j(a){return{type:"BlockStatement",body:a.body.map(i)}}var k=function(a){for(var b=!0,c=0;c1||a.guardedHandlers&&a.guardedHandlers.length)throw new Error("Multiple catch clauses are not supported.");return new Ja({start:b(a),end:d(a),body:f(a.block).body,bcatch:f(c[0]),bfinally:a.finalizer?new La(f(a.finalizer)):null})},Property:function(a){var c=a.key,e="Identifier"==c.type?c.name:c.value,g={start:b(c),end:d(a.value),key:e,value:f(a.value)};switch(a.kind){case"init":return new db(g);case"set":return g.value.name=f(c),new eb(g);case"get":return g.value.name=f(c),new fb(g)}},ArrayExpression:function(a){return new ab({start:b(a),end:d(a),elements:a.elements.map(function(a){return null===a?new Bb:f(a)})})},ObjectExpression:function(a){return new bb({start:b(a),end:d(a),properties:a.properties.map(function(a){return a.type="Property",f(a)})})},SequenceExpression:function(a){return Sa.from_array(a.expressions.map(f))},MemberExpression:function(a){return new(a.computed?Va:Ua)({start:b(a),end:d(a),property:a.computed?f(a.property):a.property.name,expression:f(a.object)})},SwitchCase:function(a){return new(a.test?Ia:Ha)({start:b(a),end:d(a),expression:f(a.test),body:a.consequent.map(f)})},VariableDeclaration:function(a){return new("const"===a.kind?Oa:Na)({start:b(a),end:d(a),definitions:a.declarations.map(f)})},Literal:function(a){var c=a.value,e={start:b(a),end:d(a)};if(null===c)return new yb(e);switch(typeof c){case"string":return e.value=c,new ub(e);case"number":return e.value=c,new vb(e);case"boolean":return new(c?Fb:Eb)(e);default:var f=a.regex;return f&&f.pattern?e.value=new RegExp(f.pattern,f.flags).toString():e.value=a.regex&&a.raw?a.raw:c,new wb(e)}},Identifier:function(a){var c=m[m.length-2];return new("LabeledStatement"==c.type?pb:"VariableDeclarator"==c.type&&c.id===a?"const"==c.kind?kb:jb:"FunctionExpression"==c.type?c.id===a?nb:lb:"FunctionDeclaration"==c.type?c.id===a?mb:lb:"CatchClause"==c.type?ob:"BreakStatement"==c.type||"ContinueStatement"==c.type?rb:qb)({start:b(a),end:d(a),name:a.name})}};l.UpdateExpression=l.UnaryExpression=function(a){var c="prefix"in a?a.prefix:"UnaryExpression"==a.type;return new(c?Xa:Ya)({start:b(a),end:d(a),operator:a.operator,expression:f(a.argument)})},e("EmptyStatement",ha),e("BlockStatement",ga,"body@body"),e("IfStatement",Ea,"test>condition, consequent>body, alternate>alternative"),e("LabeledStatement",ja,"label>label, body>body"),e("BreakStatement",Ca,"label>label"),e("ContinueStatement",Da,"label>label"),e("WithStatement",qa,"object>expression, body>body"),e("SwitchStatement",Fa,"discriminant>expression, cases@body"),e("ReturnStatement",za,"argument>value"),e("ThrowStatement",Aa,"argument>value"),e("WhileStatement",na,"test>condition, body>body"),e("DoWhileStatement",ma,"test>condition, body>body"),e("ForStatement",oa,"init>init, test>condition, update>step, body>body"),e("ForInStatement",pa,"left>init, right>object, body>body"),e("DebuggerStatement",ca),e("VariableDeclarator",Pa,"id>name, init>value"),e("CatchClause",Ka,"param>argname, body%body"),e("ThisExpression",sb),e("BinaryExpression",Za,"operator=operator, left>left, right>right"),e("LogicalExpression",Za,"operator=operator, left>left, right>right"),e("AssignmentExpression",_a,"operator=operator, left>left, right>right"),e("ConditionalExpression",$a,"test>condition, consequent>consequent, alternate>alternative"),e("NewExpression",Ra,"callee>expression, arguments@args"),e("CallExpression",Qa,"callee>expression, arguments@args"),h(sa,function(a){return{type:"Program",body:a.body.map(i)}}),h(wa,function(a){return{type:"FunctionDeclaration",id:i(a.name),params:a.argnames.map(i),body:j(a)}}),h(va,function(a){return{type:"FunctionExpression",id:i(a.name),params:a.argnames.map(i),body:j(a)}}),h(da,function(a){return{type:"ExpressionStatement",expression:{type:"Literal",value:a.value}}}),h(ea,function(a){return{type:"ExpressionStatement",expression:i(a.body)}}),h(Ga,function(a){return{type:"SwitchCase",test:i(a.expression),consequent:a.body.map(i)}}),h(Ja,function(a){return{type:"TryStatement",block:j(a),handler:i(a.bcatch),guardedHandlers:[],finalizer:i(a.bfinally)}}),h(Ka,function(a){return{type:"CatchClause",param:i(a.argname),guard:null,body:j(a)}}),h(Ma,function(a){return{type:"VariableDeclaration",kind:a instanceof Oa?"const":"var",declarations:a.definitions.map(i)}}),h(Sa,function(a){return{type:"SequenceExpression",expressions:a.to_array().map(i)}}),h(Ta,function(a){var b=a instanceof Va;return{type:"MemberExpression",object:i(a.expression),computed:b,property:b?i(a.property):{type:"Identifier",name:a.property}}}),h(Wa,function(a){return{type:"++"==a.operator||"--"==a.operator?"UpdateExpression":"UnaryExpression",operator:a.operator,prefix:a instanceof Xa,argument:i(a.expression)}}),h(Za,function(a){return{type:"&&"==a.operator||"||"==a.operator?"LogicalExpression":"BinaryExpression",left:i(a.left),operator:a.operator,right:i(a.right)}}),h(ab,function(a){return{type:"ArrayExpression",elements:a.elements.map(i)}}),h(bb,function(a){return{type:"ObjectExpression",properties:a.properties.map(i)}}),h(cb,function(a){var b,c=G(a.key)?{type:"Identifier",name:a.key}:{type:"Literal",value:a.key};return a instanceof db?b="init":a instanceof fb?b="get":a instanceof eb&&(b="set"),{type:"Property",kind:b,key:c,value:i(a.value)}}),h(gb,function(a){var b=a.definition();return{type:"Identifier",name:b?b.mangled_name||b.name:a.name}}),h(wb,function(a){var b=a.value;return{type:"Literal",value:b,raw:b.toString(),regex:{pattern:b.source,flags:b.toString().match(/[gimuy]*$/)[0]}}}),h(tb,function(a){var b=a.value;return"number"==typeof b&&(b<0||0===b&&1/b<0)?{type:"UnaryExpression",operator:"-",prefix:!0,argument:{type:"Literal",value:-b,raw:a.start.raw}}:{type:"Literal",value:b,raw:a.start.raw}}),h(xb,function(a){return{type:"Identifier",name:String(a.value)}}),Db.DEFMETHOD("to_mozilla_ast",tb.prototype.to_mozilla_ast),yb.DEFMETHOD("to_mozilla_ast",tb.prototype.to_mozilla_ast),Bb.DEFMETHOD("to_mozilla_ast",function(){return null}),fa.DEFMETHOD("to_mozilla_ast",ga.prototype.to_mozilla_ast),ta.DEFMETHOD("to_mozilla_ast",va.prototype.to_mozilla_ast);var m=null;aa.from_mozilla_ast=function(a){var b=m;m=[];var c=f(a);return m=b,c}}(),c.Compressor=T,c.DefaultsError=j,c.Dictionary=v,c.JS_Parse_Error=L,c.MAP=$,c.OutputStream=S,c.SourceMap=U,c.TreeTransformer=Q,c.TreeWalker=z,c.base54=_b,c.defaults=k,c.mangle_properties=W,c.merge=l,c.parse=P,c.push_uniq=n,c.string_template=o,c.tokenizer=O,c.is_identifier=G,c.SymbolDef=R,"undefined"!=typeof DEBUG&&DEBUG&&(c.EXPECT_DIRECTIVE=ac),c.sys=X,c.MOZ_SourceMap=Y,c.UglifyJS=Z,c.array_to_hash=d,c.slice=e,c.characters=f,c.member=g,c.find_if=h,c.repeat_string=i,c.DefaultsError=j,c.defaults=k,c.merge=l,c.noop=m,c.MAP=$,c.push_uniq=n,c.string_template=o,c.remove=p,c.mergeSort=q,c.set_difference=r,c.set_intersection=s,c.makePredicate=t,c.all=u,c.Dictionary=v,c.HOP=w,c.DEFNODE=x,c.AST_Token=_,c.AST_Node=aa,c.AST_Statement=ba,c.AST_Debugger=ca,c.AST_Directive=da,c.AST_SimpleStatement=ea,c.walk_body=y,c.AST_Block=fa,c.AST_BlockStatement=ga,c.AST_EmptyStatement=ha,c.AST_StatementWithBody=ia,c.AST_LabeledStatement=ja,c.AST_IterationStatement=ka,c.AST_DWLoop=la,c.AST_Do=ma,c.AST_While=na,c.AST_For=oa,c.AST_ForIn=pa,c.AST_With=qa,c.AST_Scope=ra,c.AST_Toplevel=sa,c.AST_Lambda=ta,c.AST_Accessor=ua,c.AST_Function=va,c.AST_Defun=wa,c.AST_Jump=xa,c.AST_Exit=ya,c.AST_Return=za,c.AST_Throw=Aa,c.AST_LoopControl=Ba,c.AST_Break=Ca,c.AST_Continue=Da,c.AST_If=Ea,c.AST_Switch=Fa,c.AST_SwitchBranch=Ga,c.AST_Default=Ha,c.AST_Case=Ia,c.AST_Try=Ja,c.AST_Catch=Ka,c.AST_Finally=La,c.AST_Definitions=Ma,c.AST_Var=Na,c.AST_Const=Oa,c.AST_VarDef=Pa,c.AST_Call=Qa,c.AST_New=Ra,c.AST_Seq=Sa,c.AST_PropAccess=Ta,c.AST_Dot=Ua,c.AST_Sub=Va,c.AST_Unary=Wa,c.AST_UnaryPrefix=Xa,c.AST_UnaryPostfix=Ya,c.AST_Binary=Za,c.AST_Conditional=$a,c.AST_Assign=_a,c.AST_Array=ab,c.AST_Object=bb,c.AST_ObjectProperty=cb,c.AST_ObjectKeyVal=db,c.AST_ObjectSetter=eb,c.AST_ObjectGetter=fb,c.AST_Symbol=gb,c.AST_SymbolAccessor=hb,c.AST_SymbolDeclaration=ib,c.AST_SymbolVar=jb,c.AST_SymbolConst=kb,c.AST_SymbolFunarg=lb,c.AST_SymbolDefun=mb,c.AST_SymbolLambda=nb,c.AST_SymbolCatch=ob,c.AST_Label=pb,c.AST_SymbolRef=qb,c.AST_LabelRef=rb,c.AST_This=sb,c.AST_Constant=tb,c.AST_String=ub,c.AST_Number=vb,c.AST_RegExp=wb,c.AST_Atom=xb,c.AST_Null=yb,c.AST_NaN=zb,c.AST_Undefined=Ab,c.AST_Hole=Bb,c.AST_Infinity=Cb,c.AST_Boolean=Db,c.AST_False=Eb,c.AST_True=Fb,c.TreeWalker=z,c.KEYWORDS=Gb,c.KEYWORDS_ATOM=Hb,c.RESERVED_WORDS=Ib,c.KEYWORDS_BEFORE_EXPRESSION=Jb,c.OPERATOR_CHARS=Kb,c.RE_HEX_NUMBER=Lb,c.RE_OCT_NUMBER=Mb,c.OPERATORS=Nb,c.WHITESPACE_CHARS=Ob,c.NEWLINE_CHARS=Pb,c.PUNC_BEFORE_EXPRESSION=Qb,c.PUNC_CHARS=Rb,c.REGEXP_MODIFIERS=Sb,c.UNICODE=Tb,c.is_letter=A,c.is_digit=B,c.is_alphanumeric_char=C,c.is_unicode_digit=D,c.is_unicode_combining_mark=E,c.is_unicode_connector_punctuation=F,c.is_identifier=G,c.is_identifier_start=H,c.is_identifier_char=I,c.is_identifier_string=J,c.parse_js_number=K,c.JS_Parse_Error=L,c.js_error=M,c.is_token=N,c.EX_EOF=Ub,c.tokenizer=O,c.UNARY_PREFIX=Vb,c.UNARY_POSTFIX=Wb,c.ASSIGNMENT=Xb,c.PRECEDENCE=Yb,c.STATEMENTS_WITH_LABELS=Zb,c.ATOMIC_START_TOKEN=$b,c.parse=P,c.TreeTransformer=Q,c.SymbolDef=R,c.base54=_b,c.EXPECT_DIRECTIVE=ac,c.OutputStream=S,c.Compressor=T,c.SourceMap=U,c.find_builtins=V,c.mangle_properties=W,c.AST_Node.warn_function=function(a){"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(a)},c.minify=function(a,c){function d(a,b){var d=c.fromString?a:fs.readFileSync(a,"utf8");f[b]=d,e=Z.parse(d,{filename:b,toplevel:e,bare_returns:c.parse?c.parse.bare_returns:void 0})}c=Z.defaults(c,{spidermonkey:!1,outSourceMap:null,sourceRoot:null,inSourceMap:null,sourceMapUrl:null,sourceMapInline:!1,fromString:!1,warnings:!1,mangle:{},mangleProperties:!1,nameCache:null,output:null,compress:{},parse:{}}),Z.base54.reset();var e=null,f={};if(c.spidermonkey?e=Z.AST_Node.from_mozilla_ast(a):(c.fromString||(a=Z.simple_glob(a)),[].concat(a).forEach(function(a,b){if("string"==typeof a)d(a,c.fromString?b:a);else for(var e in a)d(a[e],e)})),c.wrap&&(e=e.wrap_commonjs(c.wrap,c.exportAll)),c.compress){var g={warnings:c.warnings};Z.merge(g,c.compress),e.figure_out_scope();var h=Z.Compressor(g);e=h.compress(e)}(c.mangleProperties||c.nameCache)&&(c.mangleProperties.cache=Z.readNameCache(c.nameCache,"props"),e=Z.mangle_properties(e,c.mangleProperties),Z.writeNameCache(c.nameCache,"props",c.mangleProperties.cache)),c.mangle&&(e.figure_out_scope(c.mangle),e.compute_char_frequency(c.mangle),e.mangle_names(c.mangle));var i=c.inSourceMap,j={};if("string"==typeof c.inSourceMap&&(i=JSON.parse(fs.readFileSync(c.inSourceMap,"utf8"))),(c.outSourceMap||c.sourceMapInline)&&(j.source_map=Z.SourceMap({file:c.outSourceMap,orig:i,root:c.sourceRoot}),c.sourceMapIncludeSources))for(var k in f)f.hasOwnProperty(k)&&j.source_map.get().setSourceContent(k,f[k]);c.output&&Z.merge(j,c.output);var l=Z.OutputStream(j);e.print(l);var m=j.source_map;m&&(m+="");var n="\n//# sourceMappingURL=";return c.sourceMapInline?l+=n+"data:application/json;charset=utf-8;base64,"+new b(m).toString("base64"):c.outSourceMap&&"string"==typeof c.outSourceMap&&c.sourceMapUrl!==!1&&(l+=n+("string"==typeof c.sourceMapUrl?c.sourceMapUrl:c.outSourceMap)),{code:l+"",map:m}},c.describe_ast=function(){function a(c){b.print("AST_"+c.TYPE);var d=c.SELF_PROPS.filter(function(a){return!/^\$/.test(a)});d.length>0&&(b.space(),b.with_parens(function(){d.forEach(function(a,c){c&&b.space(),b.print(a)})})),c.documentation&&(b.space(),b.print_string(c.documentation)),c.SUBCLASSES.length>0&&(b.space(),b.with_block(function(){c.SUBCLASSES.forEach(function(c,d){b.indent(),a(c),b.newline()})}))}var b=Z.OutputStream({beautify:!0});return a(Z.AST_Node),b+""}}).call(this,a("buffer").Buffer)},{buffer:6,"source-map":137,util:144}],139:[function(a,b,c){"use strict";function d(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function e(a,b,c){if(a&&j.isObject(a)&&a instanceof d)return a;var e=new d;return e.parse(a,b,c),e}function f(a){return j.isString(a)&&(a=e(a)),a instanceof d?a.format():d.prototype.format.call(a)}function g(a,b){return e(a,!1,!0).resolve(b)}function h(a,b){return a?e(a,!1,!0).resolveObject(b):b}var i=a("punycode"),j=a("./util");c.parse=e,c.resolve=g,c.resolveObject=h,c.format=f,c.Url=d;var k=/^([a-z0-9.+-]+:)/i,l=/:[0-9]*$/,m=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,n=["<",">",'"',"`"," ","\r","\n","\t"],o=["{","}","|","\\","^","`"].concat(n),p=["'"].concat(o),q=["%","/","?",";","#"].concat(p),r=["/","?","#"],s=255,t=/^[+a-z0-9A-Z_-]{0,63}$/,u=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},x={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=a("querystring");d.prototype.parse=function(a,b,c){if(!j.isString(a))throw new TypeError("Parameter 'url' must be a string, not "+typeof a);var d=a.indexOf("?"),e=d!==-1&&d127?"x":I[K];if(!J.match(t)){var M=G.slice(0,B),N=G.slice(B+1),O=I.match(u);O&&(M.push(O[1]),N.unshift(O[2])),N.length&&(h="/"+N.join(".")+h),this.hostname=M.join(".");break}}}this.hostname.length>s?this.hostname="":this.hostname=this.hostname.toLowerCase(),F||(this.hostname=i.toASCII(this.hostname));var P=this.port?":"+this.port:"",Q=this.hostname||"";this.host=Q+P,this.href+=this.host,F&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==h[0]&&(h="/"+h))}if(!v[o])for(var B=0,H=p.length;B0)&&c.host.split("@");z&&(c.auth=z.shift(),c.host=c.hostname=z.shift())}return c.search=a.search,c.query=a.query,j.isNull(c.pathname)&&j.isNull(c.search)||(c.path=(c.pathname?c.pathname:"")+(c.search?c.search:"")),c.href=c.format(),c}if(!v.length)return c.pathname=null,c.search?c.path="/"+c.search:c.path=null,c.href=c.format(),c;for(var A=v.slice(-1)[0],B=(c.host||a.host||v.length>1)&&("."===A||".."===A)||""===A,C=0,D=v.length;D>=0;D--)A=v[D],"."===A?v.splice(D,1):".."===A?(v.splice(D,1),C++):C&&(v.splice(D,1),C--);if(!t&&!u)for(;C--;C)v.unshift("..");!t||""===v[0]||v[0]&&"/"===v[0].charAt(0)||v.unshift(""),B&&"/"!==v.join("/").substr(-1)&&v.push("");var E=""===v[0]||v[0]&&"/"===v[0].charAt(0);if(y){c.hostname=c.host=E?"":v.length?v.shift():"";var z=!!(c.host&&c.host.indexOf("@")>0)&&c.host.split("@");z&&(c.auth=z.shift(),c.host=c.hostname=z.shift())}return t=t||c.host&&v.length,t&&!E&&v.unshift(""),v.length?c.pathname=v.join("/"):(c.pathname=null,c.path=null),j.isNull(c.pathname)&&j.isNull(c.search)||(c.path=(c.pathname?c.pathname:"")+(c.search?c.search:"")),c.auth=a.auth||c.auth,c.slashes=c.slashes||a.slashes,c.href=c.format(),c},d.prototype.parseHost=function(){var a=this.host,b=l.exec(a);b&&(b=b[0],":"!==b&&(this.port=b.substr(1)),a=a.substr(0,a.length-b.length)),a&&(this.hostname=a)}},{"./util":140,punycode:82,querystring:85}],140:[function(a,b,c){"use strict";b.exports={isString:function(a){return"string"==typeof a},isObject:function(a){return"object"==typeof a&&null!==a},isNull:function(a){return null===a},isNullOrUndefined:function(a){return null==a}}},{}],141:[function(a,b,c){(function(a){function c(a,b){function c(){if(!e){if(d("throwDeprecation"))throw new Error(b);d("traceDeprecation")?console.trace(b):console.warn(b),e=!0}return a.apply(this,arguments)}if(d("noDeprecation"))return a;var e=!1;return c}function d(b){try{if(!a.localStorage)return!1}catch(a){return!1}var c=a.localStorage[b];return null!=c&&"true"===String(c).toLowerCase()}b.exports=c}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],142:[function(a,b,c){arguments[4][74][0].apply(c,arguments)},{dup:74}],143:[function(a,b,c){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],144:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a,b){return a}function h(a){var b={};return a.forEach(function(a,c){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(d<0)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;g-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return a<10?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(a){return"[Circular]"}default:return a}}),h=d[c];c=0;d--)c[d]="(?:("+a.customAttrSurround[d][0].source+")\\s*"+b+"\\s*("+a.customAttrSurround[d][1].source+"))";c.push("(?:"+b+")"),b="(?:"+c.join("|")+")"}return new RegExp("^\\s*"+b)}function f(a){return k.concat(a.customAttrAssign||[]).map(function(a){return"(?:"+a.source+")"}).join("|")}function g(a,b){function c(a){var b=a.match(n);if(b){var c={tagName:b[1],attrs:[]};a=a.slice(b[0].length);for(var d,e;!(d=a.match(o))&&(e=a.match(l));)a=a.slice(e[0].length),c.attrs.push(e);if(d)return c.unarySlash=d[1],c.rest=a.slice(d[0].length),c}}function d(a){var c=a.tagName,d=a.unarySlash;if(b.html5&&"p"===g&&x(c)&&f("",g),!b.html5)for(;g&&t(g);)f("",g);u(c)&&g===c&&f("",c);var e=s(c)||"html"===c&&"head"===g||!!d,h=a.attrs.map(function(a){function c(b){return h=a[b],e=a[b+1],"undefined"!=typeof e?'"':(e=a[b+2],"undefined"!=typeof e?"'":(e=a[b+3],"undefined"==typeof e&&v(d)&&(e=d),""))}var d,e,f,g,h,i,j=7;r&&a[0].indexOf('""')===-1&&(""===a[3]&&delete a[3],""===a[4]&&delete a[4],""===a[5]&&delete a[5]);var k=1;if(b.customAttrSurround)for(var l=0,m=b.customAttrSurround.length;l=0&&k[d].tag.toLowerCase()!==e;d--);}else d=0;if(d>=0){for(var f=k.length-1;f>=d;f--)b.end&&b.end(k[f].tag,k[f].attrs,f>d||!a);k.length=d,g=d&&k[d-1].tag}else"br"===c.toLowerCase()?b.start&&b.start(c,[],!0,""):"p"===c.toLowerCase()&&(b.start&&b.start(c,[],!1,"",!0),b.end&&b.end(c,[]))}for(var g,h,i,j,k=[],l=e(b);a;){if(h=a,g&&w(g)){var m=g.toLowerCase(),z=y[m]||(y[m]=new RegExp("([\\s\\S]*?)]*>","i"));a=a.replace(z,function(a,c){return"script"!==m&&"style"!==m&&"noscript"!==m&&(c=c.replace(//g,"$1").replace(//g,"$1")),b.chars&&b.chars(c),""}),f("",m)}else{var A=a.indexOf("<");if(0===A){if(/^");if(B>=0){b.comment&&b.comment(a.substring(4,B)),a=a.substring(B+3),i="";continue}}if(/^");if(C>=0){b.comment&&b.comment(a.substring(2,C+1),!0),a=a.substring(C+2),i="";continue}}var D=a.match(q);if(D){b.doctype&&b.doctype(D[0]),a=a.substring(D[0].length),i="";continue}var E=a.match(p);if(E){a=a.substring(E[0].length),E[0].replace(p,f),i="/"+E[1].toLowerCase();continue}var F=c(a);if(F){a=F.rest,d(F),i=F.tagName.toLowerCase();continue}}var G;A>=0?(G=a.substring(0,A),a=a.substring(A)):(G=a,a="");var H=c(a);H?j=H.tagName:(H=a.match(p),j=H?"/"+H[1]:""),b.chars&&b.chars(G,i,j),i=""}if(a===h)throw new Error("Parse Error: "+a)}b.partialMarkup||f()}var h=a("./utils").createMapFromString,i=/([^\s"'<>\/=]+)/,j=/=/,k=[j],l=[/"([^"]*)"+/.source,/'([^']*)'+/.source,/([^\s"'=<>`]+)/.source],m=function(){var b=a("ncname").source.slice(1,-1);return"((?:"+b+"\\:)?"+b+")"}(),n=new RegExp("^<"+m),o=/^\s*(\/?)>/,p=new RegExp("^<\\/"+m+"[^>]*>"),q=/^]+>/i,r=!1;"x".replace(/x(.)?/g,function(a,b){r=""===b});var s=d("area,base,basefont,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),t=d("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,noscript,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,svg,textarea,tt,u,var"),u=d("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),v=d("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),w=d("script,style"),x=d("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),y={};c.HTMLParser=g,c.HTMLtoXML=function(a){var b="";return new g(a,{start:function(a,c,d){b+="<"+a;for(var e=0,f=c.length;e"},end:function(a){b+=""},chars:function(a){b+=a},comment:function(a){b+=""},ignore:function(a){b+=a}}),b},c.HTMLtoDOM=function(a,b){var c={html:!0,head:!0,body:!0,title:!0},d={link:"head",base:"head"};b?b=b.ownerDocument||b.getOwnerDocument&&b.getOwnerDocument()||b:"undefined"!=typeof DOMDocument?b=new DOMDocument:"undefined"!=typeof document&&document.implementation&&document.implementation.createDocument?b=document.implementation.createDocument("","",null):"undefined"!=typeof ActiveX&&(b=new ActiveXObject("Msxml.DOMDocument"));var e=[],f=b.documentElement||b.getDocumentElement&&b.getDocumentElement();if(!f&&b.createElement&&!function(){var a=b.createElement("html"),c=b.createElement("head");c.appendChild(b.createElement("title")),a.appendChild(c),a.appendChild(b.createElement("body")),b.appendChild(a)}(),b.getElementsByTagName)for(var h in c)c[h]=b.getElementsByTagName(h)[0];var i=c.body;return new g(a,{start:function(a,f,g){if(c[a])return void(i=c[a]);var h=b.createElement(a);for(var j in f)h.setAttribute(f[j].name,f[j].value);d[a]&&"boolean"!=typeof c[d[a]]?c[d[a]].appendChild(h):i&&i.appendChild&&i.appendChild(h),g||(e.push(h),i=h)},end:function(){e.length-=1,i=e[e.length-1]},chars:function(a){i.appendChild(b.createTextNode(a))},comment:function(){},ignore:function(){}}),b}},{"./utils":149,ncname:77}],148:[function(a,b,c){"use strict";function d(){}function e(){}d.prototype.sort=function(a,b){b=b||0;for(var c=0,d=this.tokens.length;ce?-1:bc?1:0}).filter(function(c){if(a[c].processed]+$/.test(a)}function l(a,b){for(var c=a.length;c--;)if(a[c].name.toLowerCase()===b)return!0;return!1}function m(a,b,c,d){return c=c?aa(c.toLowerCase()):"","script"===a&&"language"===b&&"javascript"===c||"form"===a&&"method"===b&&"get"===c||"input"===a&&"type"===b&&"text"===c||"script"===a&&"charset"===b&&!l(d,"src")||"a"===a&&"name"===b&&l(d,"id")||"area"===a&&"shape"===b&&"rect"===c}function n(a){return a=aa(a.split(/;/,2)[0]).toLowerCase(),""===a||fa(a)}function o(a,b){if("script"!==a)return!1;for(var c=0,d=b.length;c)([\s\S]*?)(-1)return T(a,b);return a}function F(a,b){switch(a){case"html":case"head":return!0;case"body":return!la(b);case"colgroup":return"col"===b;case"tbody":return"tr"===b}return!1}function G(a,b){switch(b){case"colgroup":return"colgroup"===a;case"tbody":return ta(a)}return!1}function H(a,b){switch(a){case"html":case"head":case"body":case"colgroup":case"caption":return!0;case"li":case"optgroup":case"tr":return b===a;case"dt":case"dd":return ma(b);case"p":return na(b);case"rb":case"rt":case"rp":return pa(b);case"rtc":return qa(b);case"option":return ra(b);case"thead":case"tbody":return sa(b);case"tfoot":return"tbody"===b;case"td":case"th":return ua(b)}return!1}function I(a,b,c,d){var e=!c||/^\s*$/.test(c);return!!e&&("function"==typeof d.removeEmptyAttributes?d.removeEmptyAttributes(b,a):"input"===a&&"value"===b||Aa.test(b))}function J(a,b){for(var c=b.length-1;c>=0;c--)if(b[c].name===a)return!0;return!1}function K(a,b){switch(a){case"textarea":return!1;case"audio":case"script":case"video":if(J("src",b))return!1;break;case"iframe":if(J("src",b)||J("srcdoc",b))return!1;break;case"object":if(J("data",b))return!1;break;case"applet":if(J("code",b))return!1}return!0}function L(a){return!/^(?:script|style|pre|textarea)$/.test(a)}function M(a){return!/^(?:pre|textarea)$/.test(a)}function N(a,b,c,d){var e=d.caseSensitive?a.name:a.name.toLowerCase(),f=a.value;if(d.decodeEntities&&f&&(f=W(f,{isAttributeValue:!0})),!(d.removeRedundantAttributes&&m(c,e,f,b)||d.removeScriptTypeAttributes&&"script"===c&&"type"===e&&n(f)||d.removeStyleLinkTypeAttributes&&("style"===c||"link"===c)&&"type"===e&&p(f)||(f=x(c,e,f,d,b),d.removeEmptyAttributes&&I(c,e,f,d))))return d.decodeEntities&&f&&(f=f.replace(/&(#?[0-9a-zA-Z]+;)/g,"&$1")),{attr:a,name:e,value:f}}function O(a,b,c,d,e){var f,g,h=a.name,i=a.value,j=a.attr,l=j.quote;if("undefined"==typeof i||c.removeAttributeQuotes&&!~i.indexOf(e)&&k(i))g=!d||b||/\/$/.test(i)?i+" ":i;else{if(!c.preventAttributesEscaping){if("undefined"==typeof c.quoteCharacter){var m=(i.match(/'/g)||[]).length,n=(i.match(/"/g)||[]).length;l=m/,/<\?[\s\S]*?\?>/]),a.minifyURLs||(a.minifyURLs=P),"function"!=typeof a.minifyURLs){var e=a.minifyURLs;"string"==typeof e?e={site:e}:"object"!=typeof e&&(e={}),a.minifyURLs=function(b){try{return Y.relate(b,e)}catch(c){return a.log(c),b}}}if(a.minifyJS||(a.minifyJS=P),"function"!=typeof a.minifyJS){var f=a.minifyJS;"object"!=typeof f&&(f={}),f.fromString=!0,(f.output||(f.output={})).inline_script=!0,a.minifyJS=function(b,c){var d=b.match(/^\s*\s*$/,""):b;try{return c&&(e=Ba+e+Ca),e=$.minify(e,f).code,c&&(e=e.slice(Ba.length,-Ca.length)),/;$/.test(e)&&(e=e.slice(0,-1)),e}catch(c){return a.log(c),b}}}if(a.minifyCSS||(a.minifyCSS=P),"function"!=typeof a.minifyCSS){var g=a.minifyCSS;"object"!=typeof g&&(g={}),"undefined"==typeof g.advanced&&(g.advanced=!1),a.minifyCSS=function(b){b=b.replace(/(url\s*\(\s*)("|'|)(.*?)\2(\s*\))/gi,function(b,c,d,e,f){return c+d+a.minifyURLs(e)+d+f});var c=b.match(/^\s*\s*$/,""):b;try{return new V(g).minify(d).styles}catch(c){return a.log(c),b}}}}function R(a){var b;do b=Math.random().toString(36).replace(/^0\.[0-9]*/,"");while(~a.indexOf(b));return b}function S(a,b,c,d){function e(a){return a.map(function(a){return b.caseSensitive?a.name:a.name.toLowerCase()})}function f(a,b){return!b||a.indexOf(b)===-1}function g(a){return f(a,c)&&f(a,d)}function h(a){var c,d;new X(a,{start:function(a,f){i&&(i[a]||(i[a]=new Z),i[a].add(e(f).filter(g)));for(var h=0,k=f.length;h-1&&h(a)}})}var i=b.sortAttributes&&Object.create(null),j=b.sortClassName&&new Z,k=b.log;if(b.log=null,b.sortAttributes=!1,b.sortClassName=!1,h(T(a,b)),b.log=k,i){var l=Object.create(null);for(var m in i)l[m]=i[m].createSorter();b.sortAttributes=function(a,b){var c=l[a];if(c){var d=Object.create(null),f=e(b);f.forEach(function(a,c){(d[a]||(d[a]=[])).push(b[c])}),c.sort(f).forEach(function(a,c){b[c]=d[a].shift()})}}}if(j){var n=j.createSorter();b.sortClassName=function(a){return n.sort(a.split(/\s+/)).join(" ")}}}function T(a,b,c){function d(a){return a.replace(w,function(a,b,c){var d=V[+c];return d[1]+v+c+d[2]})}function j(a,c){return L(a)||b.canCollapseWhitespace(a,c)}function k(a,c){return M(a)||b.canTrimWhitespace(a,c)}function l(){for(var a=x.length-1;a>0&&!/^<[^\/!]/.test(x[a]);)a--;x.length=Math.max(0,a)}function m(){for(var a=x.length-1;a>0&&!/^<\//.test(x[a]);)a--;x.length=Math.max(0,a)}function n(a,c){for(var d=null;a>=0&&k(d);a--){var e=x[a],f=e.match(/^<\/([\w:-]+)>$/);if(f)d=f[1];else if(/>$/.test(e)||(x[a]=g(e,null,c,b)))break}}function p(a){var b=x.length-1;if(x.length>1){var c=x[x.length-1];/^(?:([\s\S]*?)/g,function(c,d){if(!u){u=R(a);var e=new RegExp("^"+u+"([0-9]+)$");b.ignoreCustomComments?b.ignoreCustomComments.push(e):b.ignoreCustomComments=[e]}var f="";return T.push(d),f});var Y=b.ignoreCustomFragments.map(function(a){return a.source});if(Y.length){var Z=new RegExp("\\s*(?:"+Y.join("|")+")+\\s*","g");a=a.replace(Z,function(c){if(!v){v=R(a),w=new RegExp("(\\s*)"+v+"([0-9]+)(\\s*)","g");var e=b.minifyCSS;e&&(b.minifyCSS=function(a){return e(d(a))});var f=b.minifyJS;f&&(b.minifyJS=function(a,b){return f(d(a),b)})}var g=v+V.length;return V.push(/^(\s*)[\s\S]*?(\s*)$/.exec(c)),"\t"+g+"\t"})}(b.sortAttributes&&"function"!=typeof b.sortAttributes||b.sortClassName&&"function"!=typeof b.sortClassName)&&S(a,b,u,v),new X(a,{partialMarkup:c,html5:b.html5,start:function(a,c,d,e,f){var g=a.toLowerCase();if("svg"===g){r.push(b);var h={};for(var i in b)h[i]=b[i];h.keepClosingSlash=!0,h.caseSensitive=!0,b=h}a=b.caseSensitive?a:g,z=a,s=a,da(a)||(y=""),t=!1,A=c;var n=b.removeOptionalTags;if(n){var o=za(a);o&&F(I,a)&&l(),I="",o&&H(J,a)&&(m(),n=!G(J,a)),J=""}b.collapseWhitespace&&(B.length||p(a),k(a,c)||B.push(a),j(a,c)||C.push(a));var q="<"+a,u=e&&b.keepClosingSlash;x.push(q),b.sortAttributes&&b.sortAttributes(a,c);for(var w=[],D=c.length,E=!0;--D>=0;){var K=N(c[D],c,a,b);K&&(w.unshift(O(K,u,b,E,v)),E=!1)}w.length>0?(x.push(" "),x.push.apply(x,w)):n&&ja(a)&&(I=a),x.push(x.pop()+(u?"/":"")+">"),f&&!b.includeAutoGeneratedTags&&(l(),I="")},end:function(a,c,d){var e=a.toLowerCase();"svg"===e&&(b=r.pop()),a=b.caseSensitive?a:e,b.collapseWhitespace&&(B.length?a===B[B.length-1]&&B.pop():p("/"+a),C.length&&a===C[C.length-1]&&C.pop());var f=!1;a===z&&(z="",f=!t),b.removeOptionalTags&&(f&&va(I)&&l(),I="",!za(a)||!J||ya(J)||"p"===J&&oa(a)||m(),J=ka(a)?a:""),b.removeEmptyElements&&f&&K(a,c)?(l(),I="",J=""):(d&&!b.includeAutoGeneratedTags?J="":x.push(""),s="/"+a,ca(a)?f&&(y+="|"):y="")},chars:function(a,c,d){if(c=""===c?"comment":c,d=""===d?"comment":d,b.decodeEntities&&a&&!Da(z)&&(a=W(a)),b.collapseWhitespace){if(!B.length){if("comment"===c){var e=x[x.length-1];if(e.indexOf(u)===-1&&(e||(c=s),x.length>1&&(!e||!b.conservativeCollapse&&/ $/.test(y)))){var h=x.length-2;x[h]=x[h].replace(/\s+$/,function(b){return a=b+a,""})}}if(c)if("/nobr"===c||"wbr"===c){if(/^\s/.test(a)){for(var i=x.length-1;i>0&&0!==x[i].lastIndexOf("<"+c);)i--;n(i-1,"br")}}else da("/"===c.charAt(0)?c.slice(1):c)&&(a=f(a,b,/(?:^|\s)$/.test(y)));a=c||d?g(a,c,d,b):f(a,b,!0,!0),!a&&/\s$/.test(y)&&c&&"/"===c.charAt(0)&&n(x.length-1,d)}C.length||"html"===d||c&&d||(a=f(a,b,!1,!1,!0))}b.processScripts&&Da(z)&&(a=E(a,b,A)),o(z,A)&&(a=b.minifyJS(a)),q(z,A)&&(a=b.minifyCSS(a)),b.removeOptionalTags&&a&&(("html"===I||"body"===I&&!/^\s/.test(a))&&l(),I="",(wa(J)||xa(J)&&!/^\s/.test(a))&&m(),J=""),s=/^\s*$/.test(a)?c:"comment",b.decodeEntities&&a&&!Da(z)&&(a=a.replace(/&(#?[0-9a-zA-Z]+;)/g,"&$1").replace(/":"-->";a=h(a)?d+D(a,b)+e:b.removeComments?i(a,b)?"":"":d+a+e,b.removeOptionalTags&&a&&(I="",J=""),x.push(a)},doctype:function(a){x.push(b.useShortDoctype?"":e(a))},customAttrAssign:b.customAttrAssign,customAttrSurround:b.customAttrSurround}),b.removeOptionalTags&&(va(I)&&l(),J&&!ya(J)&&m()),b.collapseWhitespace&&p("br");var $=U(x,b);return w&&($=$.replace(w,function(a,c,d,e){var g=V[+d][0];return b.collapseWhitespace?("\t"!==c&&(g=c+g),"\t"!==e&&(g+=e),f(g,{preserveLineBreaks:b.preserveLineBreaks,conservativeCollapse:!b.trimCustomFragments},/^\s/.test(g),/\s$/.test(g))):g})),u&&($=$.replace(new RegExp("","g"),function(a,b){return T[+b]})),b.log("minified in: "+(Date.now()-P)+"ms"),$}function U(a,b){var c,d=b.maxLineLength;if(d){for(var e,g=[],h="",i=0,j=a.length;i0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===a[b-2]?2:"="===a[b-1]?1:0}function e(a){return 3*a.length/4-d(a)}function f(a){var b,c,e,f,g,h,i=a.length;g=d(a),h=new l(3*i/4-g),e=g>0?i-4:i;var j=0;for(b=0,c=0;b>16&255,h[j++]=f>>8&255,h[j++]=255&f;return 2===g?(f=k[a.charCodeAt(b)]<<2|k[a.charCodeAt(b+1)]>>4,h[j++]=255&f):1===g&&(f=k[a.charCodeAt(b)]<<10|k[a.charCodeAt(b+1)]<<4|k[a.charCodeAt(b+2)]>>2,h[j++]=f>>8&255,h[j++]=255&f),h}function g(a){return j[a>>18&63]+j[a>>12&63]+j[a>>6&63]+j[63&a]}function h(a,b,c){for(var d,e=[],f=b;fk?k:i+g));return 1===d?(b=a[c-1],e+=j[b>>2],e+=j[b<<4&63],e+="=="):2===d&&(b=(a[c-2]<<8)+a[c-1],e+=j[b>>10],e+=j[b>>4&63],e+=j[b<<2&63],e+="="),f.push(e),f.join("")}c.byteLength=e,c.toByteArray=f,c.fromByteArray=i;for(var j=[],k=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,o=m.length;ng)throw new RangeError("size is too large");var d=c,f=b;void 0===f&&(d=void 0,f=0);var h=new e(a);if("string"==typeof f)for(var i=new e(f,d),j=i.length,k=-1;++kg)throw new RangeError("size is too large");return new e(a)},c.from=function(a,c,d){if("function"==typeof e.from&&(!b.Uint8Array||Uint8Array.from!==e.from))return e.from(a,c,d);if("number"==typeof a)throw new TypeError('"value" argument must not be a number');if("string"==typeof a)return new e(a,c);if("undefined"!=typeof ArrayBuffer&&a instanceof ArrayBuffer){var f=c;if(1===arguments.length)return new e(a);"undefined"==typeof f&&(f=0);var g=d;if("undefined"==typeof g&&(g=a.byteLength-f),f>=a.byteLength)throw new RangeError("'offset' is out of bounds");if(g>a.byteLength-f)throw new RangeError("'length' is out of bounds");return new e(a.slice(f,f+g))}if(e.isBuffer(a)){var h=new e(a.length);return a.copy(h,0,0,a.length),h}if(a){if(Array.isArray(a)||"undefined"!=typeof ArrayBuffer&&a.buffer instanceof ArrayBuffer||"length"in a)return new e(a);if("Buffer"===a.type&&Array.isArray(a.data))return new e(a.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},c.allocUnsafeSlow=function(a){if("function"==typeof e.allocUnsafeSlow)return e.allocUnsafeSlow(a);if("number"!=typeof a)throw new TypeError("size must be a number");if(a>=g)throw new RangeError("size is too large");return new f(a)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{buffer:5}],5:[function(a,b,c){(function(b){"use strict";function d(){try{var a=new Uint8Array(1);return a.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===a.foo()&&"function"==typeof a.subarray&&0===a.subarray(1,1).byteLength}catch(a){return!1}}function e(){return g.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function f(a,b){if(e()=e())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+e().toString(16)+" bytes");return 0|a}function q(a){return+a!=a&&(a=0),g.alloc(+a)}function r(a,b){if(g.isBuffer(a))return a.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(a)||a instanceof ArrayBuffer))return a.byteLength;"string"!=typeof a&&(a=""+a);var c=a.length;if(0===c)return 0;for(var d=!1;;)switch(b){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":case void 0:return T(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return W(a).length;default:if(d)return T(a).length;b=(""+b).toLowerCase(),d=!0}}function s(a,b,c){var d=!1;if((void 0===b||b<0)&&(b=0),b>this.length)return"";if((void 0===c||c>this.length)&&(c=this.length),c<=0)return"";if(c>>>=0,b>>>=0,c<=b)return"";for(a||(a="utf8");;)switch(a){case"hex":return H(this,b,c);case"utf8":case"utf-8":return D(this,b,c);case"ascii":return F(this,b,c);case"latin1":case"binary":return G(this,b,c);case"base64":return C(this,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,b,c);default:if(d)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),d=!0}}function t(a,b,c){var d=a[b];a[b]=a[c],a[c]=d}function u(a,b,c,d,e){if(0===a.length)return-1;if("string"==typeof c?(d=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,isNaN(c)&&(c=e?0:a.length-1),c<0&&(c=a.length+c),c>=a.length){if(e)return-1;c=a.length-1}else if(c<0){if(!e)return-1;c=0}if("string"==typeof b&&(b=g.from(b,d)),g.isBuffer(b))return 0===b.length?-1:v(a,b,c,d,e);if("number"==typeof b)return b&=255,g.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?e?Uint8Array.prototype.indexOf.call(a,b,c):Uint8Array.prototype.lastIndexOf.call(a,b,c):v(a,[b],c,d,e);throw new TypeError("val must be string, number or Buffer")}function v(a,b,c,d,e){function f(a,b){return 1===g?a[b]:a.readUInt16BE(b*g)}var g=1,h=a.length,i=b.length;if(void 0!==d&&(d=String(d).toLowerCase(),"ucs2"===d||"ucs-2"===d||"utf16le"===d||"utf-16le"===d)){if(a.length<2||b.length<2)return-1;g=2,h/=2,i/=2,c/=2}var j;if(e){var k=-1;for(j=c;jh&&(c=h-i),j=c;j>=0;j--){for(var l=!0,m=0;me&&(d=e)):d=e;var f=b.length;if(f%2!==0)throw new TypeError("Invalid hex string");d>f/2&&(d=f/2);for(var g=0;g239?4:f>223?3:f>191?2:1;if(e+h<=c){var i,j,k,l;switch(h){case 1:f<128&&(g=f);break;case 2:i=a[e+1],128===(192&i)&&(l=(31&f)<<6|63&i,l>127&&(g=l));break;case 3:i=a[e+1],j=a[e+2],128===(192&i)&&128===(192&j)&&(l=(15&f)<<12|(63&i)<<6|63&j,l>2047&&(l<55296||l>57343)&&(g=l));break;case 4:i=a[e+1],j=a[e+2],k=a[e+3],128===(192&i)&&128===(192&j)&&128===(192&k)&&(l=(15&f)<<18|(63&i)<<12|(63&j)<<6|63&k,l>65535&&l<1114112&&(g=l))}}null===g?(g=65533,h=1):g>65535&&(g-=65536,d.push(g>>>10&1023|55296),g=56320|1023&g),d.push(g),e+=h}return E(d)}function E(a){var b=a.length;if(b<=aa)return String.fromCharCode.apply(String,a);for(var c="",d=0;dd)&&(c=d);for(var e="",f=b;fc)throw new RangeError("Trying to access beyond buffer length")}function K(a,b,c,d,e,f){if(!g.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(b>e||ba.length)throw new RangeError("Index out of range")}function L(a,b,c,d){b<0&&(b=65535+b+1);for(var e=0,f=Math.min(a.length-c,2);e>>8*(d?e:1-e)}function M(a,b,c,d){b<0&&(b=4294967295+b+1);for(var e=0,f=Math.min(a.length-c,4);e>>8*(d?e:3-e)&255}function N(a,b,c,d,e,f){if(c+d>a.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function O(a,b,c,d,e){return e||N(a,b,c,4,0xf.fffff(e+31),-0xf.fffff(e+31)),$.write(a,b,c,d,23,4),c+4}function P(a,b,c,d,e){return e||N(a,b,c,8,1.7976931348623157e308,-1.7976931348623157e308),$.write(a,b,c,d,52,8),c+8}function Q(a){if(a=R(a).replace(ba,""),a.length<2)return"";for(;a.length%4!==0;)a+="=";return a}function R(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function S(a){return a<16?"0"+a.toString(16):a.toString(16)}function T(a,b){b=b||1/0;for(var c,d=a.length,e=null,f=[],g=0;g55295&&c<57344){if(!e){if(c>56319){(b-=3)>-1&&f.push(239,191,189);continue}if(g+1===d){(b-=3)>-1&&f.push(239,191,189);continue}e=c;continue}if(c<56320){(b-=3)>-1&&f.push(239,191,189),e=c;continue}c=(e-55296<<10|c-56320)+65536}else e&&(b-=3)>-1&&f.push(239,191,189);if(e=null,c<128){if((b-=1)<0)break;f.push(c)}else if(c<2048){if((b-=2)<0)break;f.push(c>>6|192,63&c|128)}else if(c<65536){if((b-=3)<0)break;f.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(c<1114112))throw new Error("Invalid code point");if((b-=4)<0)break;f.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return f}function U(a){for(var b=[],c=0;c>8,e=c%256,f.push(e),f.push(d);return f}function W(a){return Z.toByteArray(Q(a))}function X(a,b,c,d){for(var e=0;e=b.length||e>=a.length);++e)b[e+c]=a[e];return e}function Y(a){return a!==a}var Z=a("base64-js"),$=a("ieee754"),_=a("isarray");c.Buffer=g,c.SlowBuffer=q,c.INSPECT_MAX_BYTES=50,g.TYPED_ARRAY_SUPPORT=void 0!==b.TYPED_ARRAY_SUPPORT?b.TYPED_ARRAY_SUPPORT:d(),c.kMaxLength=e(),g.poolSize=8192,g._augment=function(a){return a.__proto__=g.prototype,a},g.from=function(a,b,c){return h(null,a,b,c)},g.TYPED_ARRAY_SUPPORT&&(g.prototype.__proto__=Uint8Array.prototype,g.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&g[Symbol.species]===g&&Object.defineProperty(g,Symbol.species,{value:null,configurable:!0})),g.alloc=function(a,b,c){return j(null,a,b,c)},g.allocUnsafe=function(a){return k(null,a)},g.allocUnsafeSlow=function(a){return k(null,a)},g.isBuffer=function(a){return!(null==a||!a._isBuffer)},g.compare=function(a,b){if(!g.isBuffer(a)||!g.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var c=a.length,d=b.length,e=0,f=Math.min(c,d);e0&&(a=this.toString("hex",0,b).match(/.{2}/g).join(" "),this.length>b&&(a+=" ... ")),""},g.prototype.compare=function(a,b,c,d,e){if(!g.isBuffer(a))throw new TypeError("Argument must be a Buffer");if(void 0===b&&(b=0),void 0===c&&(c=a?a.length:0),void 0===d&&(d=0),void 0===e&&(e=this.length),b<0||c>a.length||d<0||e>this.length)throw new RangeError("out of range index");if(d>=e&&b>=c)return 0;if(d>=e)return-1;if(b>=c)return 1;if(b>>>=0,c>>>=0,d>>>=0,e>>>=0,this===a)return 0;for(var f=e-d,h=c-b,i=Math.min(f,h),j=this.slice(d,e),k=a.slice(b,c),l=0;le)&&(c=e),a.length>0&&(c<0||b<0)||b>this.length)throw new RangeError("Attempt to write outside buffer bounds");d||(d="utf8");for(var f=!1;;)switch(d){case"hex":return w(this,a,b,c);case"utf8":case"utf-8":return x(this,a,b,c);case"ascii":return y(this,a,b,c);case"latin1":case"binary":return z(this,a,b,c);case"base64":return A(this,a,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,a,b,c);default:if(f)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),f=!0}},g.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var aa=4096;g.prototype.slice=function(a,b){var c=this.length;a=~~a,b=void 0===b?c:~~b,a<0?(a+=c,a<0&&(a=0)):a>c&&(a=c),b<0?(b+=c,b<0&&(b=0)):b>c&&(b=c),b0&&(e*=256);)d+=this[a+--b]*e;return d},g.prototype.readUInt8=function(a,b){return b||J(a,1,this.length),this[a]},g.prototype.readUInt16LE=function(a,b){return b||J(a,2,this.length),this[a]|this[a+1]<<8},g.prototype.readUInt16BE=function(a,b){return b||J(a,2,this.length),this[a]<<8|this[a+1]},g.prototype.readUInt32LE=function(a,b){return b||J(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]},g.prototype.readUInt32BE=function(a,b){return b||J(a,4,this.length),16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])},g.prototype.readIntLE=function(a,b,c){a|=0,b|=0,c||J(a,b,this.length);for(var d=this[a],e=1,f=0;++f=e&&(d-=Math.pow(2,8*b)),d},g.prototype.readIntBE=function(a,b,c){a|=0,b|=0,c||J(a,b,this.length);for(var d=b,e=1,f=this[a+--d];d>0&&(e*=256);)f+=this[a+--d]*e;return e*=128,f>=e&&(f-=Math.pow(2,8*b)),f},g.prototype.readInt8=function(a,b){return b||J(a,1,this.length),128&this[a]?(255-this[a]+1)*-1:this[a]},g.prototype.readInt16LE=function(a,b){b||J(a,2,this.length);var c=this[a]|this[a+1]<<8;return 32768&c?4294901760|c:c},g.prototype.readInt16BE=function(a,b){b||J(a,2,this.length);var c=this[a+1]|this[a]<<8;return 32768&c?4294901760|c:c},g.prototype.readInt32LE=function(a,b){return b||J(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},g.prototype.readInt32BE=function(a,b){return b||J(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},g.prototype.readFloatLE=function(a,b){return b||J(a,4,this.length),$.read(this,a,!0,23,4)},g.prototype.readFloatBE=function(a,b){return b||J(a,4,this.length),$.read(this,a,!1,23,4)},g.prototype.readDoubleLE=function(a,b){return b||J(a,8,this.length),$.read(this,a,!0,52,8)},g.prototype.readDoubleBE=function(a,b){return b||J(a,8,this.length),$.read(this,a,!1,52,8)},g.prototype.writeUIntLE=function(a,b,c,d){if(a=+a,b|=0,c|=0,!d){var e=Math.pow(2,8*c)-1;K(this,a,b,c,e,0)}var f=1,g=0;for(this[b]=255&a;++g=0&&(g*=256);)this[b+f]=a/g&255;return b+c},g.prototype.writeUInt8=function(a,b,c){return a=+a,b|=0,c||K(this,a,b,1,255,0),g.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),this[b]=255&a,b+1},g.prototype.writeUInt16LE=function(a,b,c){return a=+a,b|=0,c||K(this,a,b,2,65535,0),g.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8):L(this,a,b,!0),b+2},g.prototype.writeUInt16BE=function(a,b,c){return a=+a,b|=0,c||K(this,a,b,2,65535,0),g.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=255&a):L(this,a,b,!1),b+2},g.prototype.writeUInt32LE=function(a,b,c){return a=+a,b|=0,c||K(this,a,b,4,4294967295,0),g.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=255&a):M(this,a,b,!0),b+4},g.prototype.writeUInt32BE=function(a,b,c){return a=+a,b|=0,c||K(this,a,b,4,4294967295,0),g.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a):M(this,a,b,!1),b+4},g.prototype.writeIntLE=function(a,b,c,d){if(a=+a,b|=0,!d){var e=Math.pow(2,8*c-1);K(this,a,b,c,e-1,-e)}var f=0,g=1,h=0;for(this[b]=255&a;++f>0)-h&255;return b+c},g.prototype.writeIntBE=function(a,b,c,d){if(a=+a,b|=0,!d){var e=Math.pow(2,8*c-1);K(this,a,b,c,e-1,-e)}var f=c-1,g=1,h=0;for(this[b+f]=255&a;--f>=0&&(g*=256);)a<0&&0===h&&0!==this[b+f+1]&&(h=1),this[b+f]=(a/g>>0)-h&255;return b+c},g.prototype.writeInt8=function(a,b,c){return a=+a,b|=0,c||K(this,a,b,1,127,-128),g.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),a<0&&(a=255+a+1),this[b]=255&a,b+1},g.prototype.writeInt16LE=function(a,b,c){return a=+a,b|=0,c||K(this,a,b,2,32767,-32768),g.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8):L(this,a,b,!0),b+2},g.prototype.writeInt16BE=function(a,b,c){return a=+a,b|=0,c||K(this,a,b,2,32767,-32768),g.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=255&a):L(this,a,b,!1),b+2},g.prototype.writeInt32LE=function(a,b,c){return a=+a,b|=0,c||K(this,a,b,4,2147483647,-2147483648),g.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):M(this,a,b,!0),b+4},g.prototype.writeInt32BE=function(a,b,c){return a=+a,b|=0,c||K(this,a,b,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),g.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a):M(this,a,b,!1),b+4},g.prototype.writeFloatLE=function(a,b,c){return O(this,a,b,!0,c)},g.prototype.writeFloatBE=function(a,b,c){return O(this,a,b,!1,c)},g.prototype.writeDoubleLE=function(a,b,c){return P(this,a,b,!0,c)},g.prototype.writeDoubleBE=function(a,b,c){return P(this,a,b,!1,c)},g.prototype.copy=function(a,b,c,d){if(c||(c=0),d||0===d||(d=this.length),b>=a.length&&(b=a.length),b||(b=0),d>0&&d=this.length)throw new RangeError("sourceStart out of bounds");if(d<0)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),a.length-b=0;--e)a[e+b]=this[e+c];else if(f<1e3||!g.TYPED_ARRAY_SUPPORT)for(e=0;e>>=0,c=void 0===c?this.length:c>>>0,a||(a=0);var f;if("number"==typeof a)for(f=b;f0?j.errors:null,e):e})})}function e(a){return a?function(a){return a()}:c.nextTick}function f(a,b){var c;return c=i(a,b),c=r.One in b.options.level?j(a,b):a,c=r.Two in b.options.level?k(a,b,!0):c}function g(a,b){return a.stats=h(a.styles,b),a.errors=b.errors,a.inlinedStylesheets=b.inlinedStylesheets,a.warnings=b.warnings,a}function h(a,b){var c=Date.now(),d=c-b.stats.startedAt;return delete b.stats.startedAt,b.stats.timeSpent=d,b.stats.efficiency=1-a.length/b.stats.originalSize,b.stats.minifiedSize=a.length,b.stats}var i=a("./optimizer/level-0/optimize"),j=a("./optimizer/level-1/optimize"),k=a("./optimizer/level-2/optimize"),l=a("./optimizer/validator"),m=a("./options/compatibility"),n=a("./options/format").formatFrom,o=a("./options/inline"),p=a("./options/inline-request"),q=a("./options/inline-timeout"),r=a("./options/optimization-level").OptimizationLevel,s=a("./options/optimization-level").optimizationLevelFrom,t=a("./options/rebase"),u=a("./options/rebase-to"),v=a("./reader/input-source-map-tracker"),w=a("./reader/read-sources"),x=a("./writer/simple"),y=a("./writer/source-maps"),z=b.exports=function(a){a=a||{},this.options={compatibility:m(a.compatibility),format:n(a.format),inline:o(a.inline),inlineRequest:p(a.inlineRequest),inlineTimeout:q(a.inlineTimeout),level:s(a.level),rebase:t(a.rebase),rebaseTo:u(a.rebaseTo),returnPromise:!!a.returnPromise,sourceMap:!!a.sourceMap,sourceMapInlineSources:!!a.sourceMapInlineSources}};z.prototype.minify=function(a,b,c){var e=this.options;return e.returnPromise?new Promise(function(c,f){d(a,e,b,function(a,b){return a?f(a):c(b)})}):d(a,e,b,c)}}).call(this,a("_process"))},{"./optimizer/level-0/optimize":10,"./optimizer/level-1/optimize":11,"./optimizer/level-2/optimize":30,"./optimizer/validator":56,"./options/compatibility":58,"./options/format":59,"./options/inline":62,"./options/inline-request":60,"./options/inline-timeout":61,"./options/optimization-level":63,"./options/rebase":65,"./options/rebase-to":64,"./reader/input-source-map-tracker":69,"./reader/read-sources":75,"./writer/simple":98,"./writer/source-maps":99,_process:112}],9:[function(a,b,c){var d={ASTERISK:"asterisk",BANG:"bang",BACKSLASH:"backslash",UNDERSCORE:"underscore"};b.exports=d},{}],10:[function(a,b,c){function d(a){return a}b.exports=d},{}],11:[function(a,b,c){function d(a){return a&&"-"==a[1][0]&&parseFloat(a[1])<0}function e(a){return ha.test(a)}function f(a){return ja.test(a)}function g(a){return a.replace(ja,"url(").replace(/\\?\n|\\?\r\n/g,"")}function h(a){var b=a.value;1==b.length&&"none"==b[0][1]&&(b[0][1]="0 0"),1==b.length&&"transparent"==b[0][1]&&(b[0][1]="0 0")}function i(a){var b,c=a.value;3==c.length&&"/"==c[1][1]&&c[0][1]==c[2][1]?b=1:5==c.length&&"/"==c[2][1]&&c[0][1]==c[3][1]&&c[1][1]==c[4][1]?b=2:7==c.length&&"/"==c[3][1]&&c[0][1]==c[4][1]&&c[1][1]==c[5][1]&&c[2][1]==c[6][1]?b=3:9==c.length&&"/"==c[4][1]&&c[0][1]==c[5][1]&&c[1][1]==c[6][1]&&c[2][1]==c[7][1]&&c[3][1]==c[8][1]&&(b=4),b&&(a.value.splice(b),a.dirty=!0)}function j(a,b,c){return b.indexOf("#")===-1&&b.indexOf("rgb")==-1&&b.indexOf("hsl")==-1?I(b):(b=b.replace(/rgb\((\-?\d+),(\-?\d+),(\-?\d+)\)/g,function(a,b,c,d){return K(b,c,d)}).replace(/hsl\((-?\d+),(-?\d+)%?,(-?\d+)%?\)/g,function(a,b,c,d){return J(b,c,d)}).replace(/(^|[^='"])#([0-9a-f]{6})/gi,function(a,b,c){return c[0]==c[1]&&c[2]==c[3]&&c[4]==c[5]?(b+"#"+c[0]+c[2]+c[4]).toLowerCase():(b+"#"+c).toLowerCase()}).replace(/(^|[^='"])#([0-9a-f]{3})/gi,function(a,b,c){return b+"#"+c.toLowerCase()}).replace(/(rgb|rgba|hsl|hsla)\(([^\)]+)\)/g,function(a,b,c){var d=c.split(","),e="hsl"==b&&3==d.length||"hsla"==b&&4==d.length||"rgb"==b&&3==d.length&&c.indexOf("%")>0||"rgba"==b&&4==d.length&&c.indexOf("%")>0;return e?(d[1].indexOf("%")==-1&&(d[1]+="%"),d[2].indexOf("%")==-1&&(d[2]+="%"),b+"("+d.join(",")+")"):a}),c.colors.opacity&&a.indexOf("background")==-1&&(b=b.replace(/(?:rgba|hsla)\(0,0%?,0%?,0\)/g,function(a){return X(b,",").pop().indexOf("gradient(")>-1?a:"transparent"})),I(b))}function k(a){1==a.value.length&&(a.value[0][1]=a.value[0][1].replace(/progid:DXImageTransform\.Microsoft\.(Alpha|Chroma)(\W)/,function(a,b,c){return b.toLowerCase()+c})),a.value[0][1]=a.value[0][1].replace(/,(\S)/g,", $1").replace(/ ?= ?/g,"=")}function l(a,b){var c,d=a.value,e=aa.indexOf(d[0][1])>-1||d[1]&&aa.indexOf(d[1][1])>-1||d[2]&&aa.indexOf(d[2][1])>-1,f=b.level[T.One].optimizeFontWeight,g=0;f&&(e||d[1]&&"/"==d[1][1]||("normal"==d[0][1]&&g++,d[1]&&"normal"==d[1][1]&&g++,d[2]&&"normal"==d[2][1]&&g++,g>1||(ca.indexOf(d[0][1])>-1?c=0:d[1]&&ca.indexOf(d[1][1])>-1?c=1:d[2]&&ca.indexOf(d[2][1])>-1?c=2:ba.indexOf(d[0][1])>-1?c=0:d[1]&&ba.indexOf(d[1][1])>-1?c=1:d[2]&&ba.indexOf(d[2][1])>-1&&(c=2),void 0!==c&&f&&(m(a,c),a.dirty=!0))))}function m(a,b){var c=a.value[b][1];"normal"==c?c="400":"bold"==c&&(c="700"),a.value[b][1]=c}function n(a){var b,c=a.value;4==c.length&&"0"===c[0][1]&&"0"===c[1][1]&&"0"===c[2][1]&&"0"===c[3][1]&&(b=a.name.indexOf("box-shadow")>-1?2:1),b&&(a.value.splice(b),a.dirty=!0)}function o(a){var b=a.value;1==b.length&&"none"==b[0][1]&&(b[0][1]="0")}function p(a,b,c){return da.test(b)?b.replace(da,function(a,b){var d,e=parseInt(b);return 0===e?a:(c.properties.shorterLengthUnits&&c.units.pt&&3*e%4===0&&(d=3*e/4+"pt"),c.properties.shorterLengthUnits&&c.units.pc&&e%16===0&&(d=e/16+"pc"),c.properties.shorterLengthUnits&&c.units.in&&e%96===0&&(d=e/96+"in"),d&&(d=a.substring(0,a.indexOf(b))+d),d&&d.length0&&("height"==a||"max-height"==a)?b:b.replace(c,"$10$2").replace(c,"$10$2")}function t(a,b){return a.indexOf("filter")>-1||b.indexOf(" ")==-1||0===b.indexOf("expression")?b:b.indexOf(V.SINGLE_QUOTE)>-1||b.indexOf(V.DOUBLE_QUOTE)>-1?b:(b=b.replace(/\s+/g," "),b.indexOf("calc")>-1&&(b=b.replace(/\) ?\/ ?/g,")/ ")),b.replace(/(\(;?)\s+/g,"$1").replace(/\s+(;?\))/g,"$1").replace(/, /g,","))}function u(a,b){return b.indexOf("0deg")==-1?b:b.replace(/\(0deg\)/g,"(0)")}function v(a,b){return b.indexOf("0")==-1?b:(b.indexOf("-")>-1&&(b=b.replace(/([^\w\d\-]|^)\-0([^\.]|$)/g,"$10$2").replace(/([^\w\d\-]|^)\-0([^\.]|$)/g,"$10$2")),b.replace(/(^|\s)0+([1-9])/g,"$1$2").replace(/(^|\D)\.0+(\D|$)/g,"$10$2").replace(/(^|\D)\.0+(\D|$)/g,"$10$2").replace(/\.([1-9]*)0+(\D|$)/g,function(a,b,c){return(b.length>0?".":"")+b+c}).replace(/(^|\D)0\.(\d)/g,"$1.$2"))}function w(a,b){return"content"==a?b:ia.test(b)?b.substring(1,b.length-1):b}function x(a){return!/^url\(['"].+['"]\)$/.test(a)||/^url\(['"].*[\*\s\(\)'"].*['"]\)$/.test(a)||/^url\(['"]data:[^;]+;charset/.test(a)?a:a.replace(/["']/g,"")}function y(a,b,c){var d=c(a,b);return void 0===d?b:d===!1?Y:d}function z(a,b){var c,B,C,D,E,F,H=b.options,I=H.level[T.One],J=S(a,!0);a:for(var K=0,L=J.length;K0&&I.optimizeBorderRadius?i(c):"filter"==B&&I.optimizeFilter&&H.compatibility.properties.ieFilters?k(c):"font"==B&&I.optimizeFont?l(c,H):"font-weight"==B&&I.optimizeFontWeight?m(c,0):"outline"==B&&I.optimizeOutline&&o(c)}R(J),Q(J),J.length!=a.length&&A(a,H)}function A(a,b){var c,d;for(d=0;d0&&(d.matcher=new RegExp("(\\d*)(\\.\\d+)("+e.join("|")+")","g")),d}function F(a){return ga.test(a[1])}function G(a){var b;return("filter"==a.name||"-ms-filter"==a.name)&&(b=a.value[0][1],b.indexOf("progid")>-1||0===b.indexOf("alpha")||0===b.indexOf("chroma"))}function H(a,b){var c=b.options,d=c.level[T.One],e=c.compatibility.selectors.ie7Hack,f=c.compatibility.selectors.adjacentSpace,g=c.compatibility.properties.spaceAfterClosingBrace,h=c.format,i=!1,j=!1;c.unitsRegexp=c.unitsRegexp||D(c),c.precision=c.precision||E(d.roundingPrecision),c.commentsKept=c.commentsKept||0;for(var k=0,l=a.length;k1?L(m[1],d.selectorsSortingMethod):m[1],z(m[2],b),j=!0}(0===m[1].length||m[2]&&0===m[2].length)&&(a.splice(k,1),k--,l--)}return d.cleanupCharsets&&i&&C(a),a}var I=a("./shorten-hex"),J=a("./shorten-hsl"),K=a("./shorten-rgb"),L=a("./sort-selectors"),M=a("./tidy-rules"),N=a("./tidy-block"),O=a("./tidy-at-rule"),P=a("../hack"),Q=a("../remove-unused"),R=a("../restore-from-optimizing"),S=a("../wrap-for-optimizing").all,T=a("../../options/optimization-level").OptimizationLevel,U=a("../../tokenizer/token"),V=a("../../tokenizer/marker"),W=a("../../utils/format-position"),X=a("../../utils/split"),Y="ignore-property",Z="@charset",$=new RegExp("^"+Z,"i"),_=a("../../options/rounding-precision").DEFAULT,aa=["100","200","300","400","500","600","700","800","900"],ba=["normal","bold","bolder","lighter"],ca=["bold","bolder","lighter"],da=/(?:^|\s|\()(-?\d+)px/,ea=/^(\-?[\d\.]+)(m?s)$/,fa=/^(?:\-chrome\-|\-[\w\-]+\w|\w[\w\-]+\w|\-\-\S+)$/,ga=/^@import/i,ha=/^('.*'|".*")$/,ia=/^['"][a-zA-Z][a-zA-Z\d\-_]+['"]$/,ja=/^url\(/i;b.exports=H},{"../../options/optimization-level":63,"../../options/rounding-precision":66,"../../tokenizer/marker":81,"../../tokenizer/token":82,"../../utils/format-position":85,"../../utils/split":95,"../hack":9,"../remove-unused":54,"../restore-from-optimizing":55,"../wrap-for-optimizing":57,"./shorten-hex":12,"./shorten-hsl":13,"./shorten-rgb":14,"./sort-selectors":15,"./tidy-at-rule":16,"./tidy-block":17,"./tidy-rules":18}],12:[function(a,b,c){function d(a,b,c,d){return b+h[c.toLowerCase()]+d}function e(a,b,c){return i[b.toLowerCase()]+c}function f(a){var b=a.indexOf("#")>-1,c=a.replace(l,d);return c!=a&&(c=c.replace(l,d)),b?c.replace(m,e):c}var g={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#0ff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000",blanchedalmond:"#ffebcd",blue:"#00f",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#0ff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",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:"#f0f",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",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",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#0f0",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",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:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#f00",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:"#fff",whitesmoke:"#f5f5f5",yellow:"#ff0",yellowgreen:"#9acd32"},h={},i={};for(var j in g){var k=g[j];j.length100&&(b=100),b=~~b/100,c<0?c=0:c>100&&(c=100),c=~~c/100,0===b)d=f=g=c;else{var h=c<.5?c*(1+b):c+b-c*b,i=2*c-h;d=e(i,h,a+1/3),f=e(i,h,a),g=e(i,h,a-1/3)}return[~~(255*d),~~(255*f),~~(255*g)]}function e(a,b,c){return c<0&&(c+=1),c>1&&(c-=1),c<1/6?a+6*(b-a)*c:c<.5?b:c<2/3?a+(b-a)*(2/3-c)*6:a}function f(a,b,c){var e=d(a,b,c),f=e[0].toString(16),g=e[1].toString(16),h=e[2].toString(16);return"#"+((1==f.length?"0":"")+f)+((1==g.length?"0":"")+g)+((1==h.length?"0":"")+h)}b.exports=f},{}],14:[function(a,b,c){function d(a,b,c){var d=Math.max(0,Math.min(parseInt(a),255)),e=Math.max(0,Math.min(parseInt(b),255)),f=Math.max(0,Math.min(parseInt(c),255));return"#"+("00000"+(d<<16|e<<8|f).toString(16)).slice(-6)}b.exports=d},{}],15:[function(a,b,c){function d(a,b){return g(a[1],b[1])}function e(a,b){return a[1]>b[1]?1:-1}function f(a,b){var c;switch(b){case"natural":c=d;break;case"standard":c=e}return a.sort(c)}var g=a("../../utils/natural-compare");b.exports=f},{"../../utils/natural-compare":93}],16:[function(a,b,c){function d(a){return a.replace(/\s+/g," ").replace(/url\(\s+/g,"url(").replace(/\s+\)/g,")").trim()}b.exports=d},{}],17:[function(a,b,c){function d(a,b){var c;for(c=a.length-1;c>=0;c--)a[c][1]=a[c][1].replace(/\n|\r\n/g," ").replace(/\s+/g," ").replace(/(,|:|\() /g,"$1").replace(/ \)/g,")").replace(/'([a-zA-Z][a-zA-Z\d\-_]+)'/,"$1").replace(/"([a-zA-Z][a-zA-Z\d\-_]+)"/,"$1").replace(b?null:/\) /g,")");return a}b.exports=d},{}],18:[function(a,b,c){function d(a){var b,c,d,e,f=!1,g=!1;for(d=0,e=a.length;d0)&&!j||q&&w&&!j||(e||d)&&(o||u>0)&&j||(p&&w&&!x?(t.pop(),t.push(c)):p&&!w&&x?(t.push(i.SPACE),t.push(c)):q?t.push(i.SPACE):t.push(c))}else t.push(c),n=!0;else t.push(c),k=!0;else t.push(c),u--;else t.push(c),u++;else t.push(c),o=!1;else t.push(c),o=!0;g=f,f=c==i.BACK_SLASH,v=p,w=q}return t.join("")}function f(a){return a.replace(/='([a-zA-Z][a-zA-Z\d\-_]+)'/g,"=$1").replace(/="([a-zA-Z][a-zA-Z\d\-_]+)"/g,"=$1")}function g(a,b,c,g,h){function i(a,b){return h.push("HTML comment '"+b+"' at "+j(a[2][0])+". Removing."),""}for(var l=[],m=[],p=0,q=a.length;p0&&(s=s.replace(/\+nav(\S|$)/,"+ nav$1")),b&&s.indexOf(n)>-1||b&&s.indexOf(o)>-1||(s.indexOf("*")>-1&&(s=s.replace(/\*([:#\.\[])/g,"$1").replace(/^(\:first\-child)?\+html/,"*$1+html")),m.indexOf(s)>-1||(r[1]=s,m.push(s),l.push(r))))}return 1==l.length&&0===l[0][1].length&&(h.push("Empty selector '"+l[0][1]+"' at "+j(l[0][2][0])+". Ignoring."),l=[]),l}var h=a("../../options/format").Spaces,i=a("../../tokenizer/marker"),j=a("../../utils/format-position"),k=/^(?:(?:)\s*)+/,l=/[>\+~]/,m=/\s/,n="*+html ",o="*:first-child+html ",p="<";b.exports=g},{"../../options/format":59,"../../tokenizer/marker":81,"../../utils/format-position":85}],19:[function(a,b,c){function d(a){return function(b){return"invert"==b[1]||a.isValidColor(b[1])||a.isValidVendorPrefixedValue(b[1])}}function e(a){return function(b){return"inherit"!=b[1]&&a.isValidStyle(b[1])&&!a.isValidColorValue(b[1])}}function f(a,b,c){var d=c[a];return o(d.doubleValues&&2==d.defaultValue.length?[p.PROPERTY,[p.PROPERTY_NAME,a],[p.PROPERTY_VALUE,d.defaultValue[0]],[p.PROPERTY_VALUE,d.defaultValue[1]]]:d.doubleValues&&1==d.defaultValue.length?[p.PROPERTY,[p.PROPERTY_NAME,a],[p.PROPERTY_VALUE,d.defaultValue[0]]]:[p.PROPERTY,[p.PROPERTY_NAME,a],[p.PROPERTY_VALUE,d.defaultValue]])}function g(a){return function(b){return"inherit"!=b[1]&&a.isValidWidth(b[1])&&!a.isValidStyle(b[1])&&!a.isValidColorValue(b[1])}}function h(a,b,c){var d=f("background-image",a,b),e=f("background-position",a,b),g=f("background-size",a,b),h=f("background-repeat",a,b),i=f("background-attachment",a,b),j=f("background-origin",a,b),k=f("background-clip",a,b),l=f("background-color",a,b),m=[d,e,g,h,i,j,k,l],o=a.value,p=!1,r=!1,s=!1,t=!1,u=!1;if(1==a.value.length&&"inherit"==a.value[0][1])return l.value=d.value=h.value=e.value=g.value=j.value=k.value=a.value,m;if(1==a.value.length&&"0 0"==a.value[0][1])return m;for(var v=o.length-1;v>=0;v--){var w=o[v];if(c.isValidBackgroundAttachment(w[1]))i.value=[w],u=!0;else if(c.isValidBackgroundClip(w[1])||c.isValidBackgroundOrigin(w[1]))r?(j.value=[w],s=!0):(k.value=[w],r=!0),u=!0;else if(c.isValidBackgroundRepeat(w[1]))t?h.value.unshift(w):(h.value=[w],t=!0),u=!0;else if(c.isValidBackgroundPositionPart(w[1])||c.isValidBackgroundSizePart(w[1])){if(v>0){var x=o[v-1];"/"==x[1]?g.value=[w]:v>1&&"/"==o[v-2][1]?(g.value=[x,w],v-=2):(p||(e.value=[]),e.value.unshift(w),p=!0)}else p||(e.value=[]),e.value.unshift(w),p=!0;u=!0}else l.value[0][1]!=b[l.name].defaultValue&&"none"!=l.value[0][1]||!c.isValidColor(w[1])&&!c.isValidVendorPrefixedValue(w[1])?(c.isValidUrl(w[1])||c.isValidFunction(w[1]))&&(d.value=[w],u=!0):(l.value=[w],u=!0)}if(r&&!s&&(j.value=k.value.slice(0)),!u)throw new n("Invalid background value at "+q(o[0][2][0])+". Ignoring.");return m}function i(a,b){for(var c=a.value,d=-1,e=0,g=c.length;e-1?c.slice(0,d):c.slice(0),h.components=j(h,b);var i=f(a.name,a,b);i.value=d>-1?c.slice(d+1):c.slice(0),i.components=j(i,b);for(var k=0;k<4;k++)h.components[k].multiplex=!0,h.components[k].value=h.components[k].value.concat(i.components[k].value);return h.components}function j(a,b){var c=b[a.name].components,d=[],e=a.value;if(e.length<1)return[];e.length<2&&(e[1]=e[0].slice(0)),e.length<3&&(e[2]=e[0].slice(0)),e.length<4&&(e[3]=e[1].slice(0));for(var f=c.length-1;f>=0;f--){var g=o([p.PROPERTY,[p.PROPERTY_NAME,c[f]]]);g.value=[e[f]],d.unshift(g)}return d}function k(a){return function(b,c,d){var e,g,h,i,j=[],k=b.value;for(e=0,h=k.length;e0&&c.isValidListStylePosition(i[0][1])&&(e.value=[i[0]]),h}function m(a,b,c){for(var h,i,j,k=b[a.name],l=[f(k.components[0],a,b),f(k.components[1],a,b),f(k.components[2],a,b)],m=0;m<3;m++){var n=l[m];n.name.indexOf("color")>0?h=n:n.name.indexOf("style")>0?i=n:j=n}if(1==a.value.length&&"inherit"==a.value[0][1]||3==a.value.length&&"inherit"==a.value[0][1]&&"inherit"==a.value[1][1]&&"inherit"==a.value[2][1])return h.value=i.value=j.value=[a.value[0]],l;var o,p,q=a.value.slice(0);return q.length>0&&(p=q.filter(g(c)),o=p.length>1&&("none"==p[0][1]||"auto"==p[0][1])?p[1]:p[0],o&&(j.value=[o],q.splice(q.indexOf(o),1))),q.length>0&&(o=q.filter(e(c))[0],o&&(i.value=[o],q.splice(q.indexOf(o),1))),q.length>0&&(o=q.filter(d(c))[0],o&&(h.value=[o],q.splice(q.indexOf(o),1))),l}var n=a("./invalid-property-error"),o=a("../wrap-for-optimizing").single,p=a("../../tokenizer/token"),q=a("../../utils/format-position"),r=",";b.exports={background:h,border:m,borderRadius:i,fourValues:j,listStyle:l,multiplex:k,outline:m}},{"../../tokenizer/token":82,"../../utils/format-position":85,"../wrap-for-optimizing":57,"./invalid-property-error":24}],20:[function(a,b,c){function d(a,b,c){return!(!p(a,b,c,0,!0)&&!a.isValidKeywordValue("background-position",c,!0))&&(!(!a.isValidVariable(b)||!a.isValidVariable(c))||(!!a.isValidKeywordValue("background-position",c,!0)||m(a,b,c)))}function e(a,b,c){return!(!p(a,b,c,0,!0)&&!a.isValidKeywordValue("background-size",c,!0))&&(!(!a.isValidVariable(b)||!a.isValidVariable(c))||(!!a.isValidKeywordValue("background-size",c,!0)||m(a,b,c)))}function f(a,b,c){return!(!p(a,b,c,0,!0)&&!a.isValidColor(c))&&(!(!a.isValidVariable(b)||!a.isValidVariable(c))||!(!a.colorOpacity&&(a.isValidRgbaColor(b)||a.isValidHslaColor(b)))&&(!(!a.colorOpacity&&(a.isValidRgbaColor(c)||a.isValidHslaColor(c)))&&(!(!a.isValidColor(b)||!a.isValidColor(c))||k(a,b,c))))}function g(a){return function(b,c,d,e){return a[e](b,c,d)}}function h(a,b,c){return!(!p(a,b,c,0,!0)&&!a.isValidImage(c))&&(!(!a.isValidVariable(b)||!a.isValidVariable(c))||(!!a.isValidImage(c)||!a.isValidImage(b)&&k(a,b,c)))}function i(a){return function(b,c,d){return!(!p(b,c,d,0,!0)&&!b.isValidKeywordValue(a,d))&&(!(!b.isValidVariable(c)||!b.isValidVariable(d))||b.isValidKeywordValue(a,d,!1))}}function j(a){return function(b,c,d){return!(!p(b,c,d,0,!0)&&!b.isValidKeywordValue(a,d,!0))&&(!(!b.isValidVariable(c)||!b.isValidVariable(d))||b.isValidKeywordValue(a,d,!0))}}function k(a,b,c){return!!a.areSameFunction(b,c)||b===c}function l(a,b,c){return!(!p(a,b,c,0,!0)&&!a.isValidTextShadow(c))&&(!(!a.isValidVariable(b)||!a.isValidVariable(c))||a.isValidTextShadow(c))}function m(a,b,c){return!(!p(a,b,c,0,!0)&&!a.isValidUnitWithoutFunction(c))&&(!(!a.isValidVariable(b)||!a.isValidVariable(c))||!(a.isValidUnitWithoutFunction(b)&&!a.isValidUnitWithoutFunction(c))&&(!!a.isValidUnitWithoutFunction(c)||!a.isValidUnitWithoutFunction(b)&&(!(!a.isValidFunctionWithoutVendorPrefix(b)||!a.isValidFunctionWithoutVendorPrefix(c))||k(a,b,c))))}function n(a){var b=j(a);return function(a,c,d){return m(a,c,d)||b(a,c,d)}}function o(a,b,c){return!(!p(a,b,c,0,!0)&&!a.isValidZIndex(c))&&(!(!a.isValidVariable(b)||!a.isValidVariable(c))||a.isValidZIndex(c))}var p=a("./properties/understandable");b.exports={generic:{color:f,components:g,image:h,unit:m},property:{backgroundAttachment:i("background-attachment"),backgroundClip:j("background-clip"),backgroundOrigin:i("background-origin"),backgroundPosition:d,backgroundRepeat:i("background-repeat"),backgroundSize:e,bottom:n("bottom"),borderCollapse:i("border-collapse"),borderStyle:j("*-style"),clear:j("clear"),cursor:j("cursor"),display:j("display"),float:j("float"),fontStyle:j("font-style"),left:n("left"),fontWeight:j("font-weight"),listStyleType:j("list-style-type"),listStylePosition:j("list-style-position"),outlineStyle:j("*-style"),overflow:j("overflow"),position:j("position"),right:n("right"),textAlign:j("text-align"),textDecoration:j("text-decoration"),textOverflow:j("text-overflow"),textShadow:l,top:n("top"),transform:k,verticalAlign:n("vertical-align"),visibility:j("visibility"),whiteSpace:j("white-space"),zIndex:o}}},{"./properties/understandable":40}],21:[function(a,b,c){function d(a){for(var b=e(a),c=a.components.length-1;c>=0;c--){var d=e(a.components[c]);d.value=a.components[c].value.slice(0),b.components.unshift(d)}return b.dirty=!0,b.value=a.value.slice(0),b}function e(a){var b=f([g.PROPERTY,[g.PROPERTY_NAME,a.name]]);return b.important=a.important,b.hack=a.hack,b.unused=!1,b}var f=a("../wrap-for-optimizing").single,g=a("../../tokenizer/token");b.exports={deep:d,shallow:e}},{"../../tokenizer/token":82,"../wrap-for-optimizing":57}],22:[function(a,b,c){function d(a,b){var c=h(i[a],{});return"componentOf"in c&&(c.componentOf=c.componentOf.map(function(a){return b+a})),"components"in c&&(c.components=c.components.map(function(a){return b+a})),c}var e=a("./break-up"),f=a("./can-override"),g=a("./restore"),h=a("../../utils/override"),i={background:{canOverride:f.generic.components([f.generic.image,f.property.backgroundPosition,f.property.backgroundSize,f.property.backgroundRepeat,f.property.backgroundAttachment,f.property.backgroundOrigin,f.property.backgroundClip,f.generic.color]),components:["background-image","background-position","background-size","background-repeat","background-attachment","background-origin","background-clip","background-color"],breakUp:e.multiplex(e.background),defaultValue:"0 0",restore:g.multiplex(g.background),shortestValue:"0",shorthand:!0},"background-attachment":{canOverride:f.property.backgroundAttachment,componentOf:["background"],defaultValue:"scroll"},"background-clip":{canOverride:f.property.backgroundClip,componentOf:["background"],defaultValue:"border-box",shortestValue:"border-box"},"background-color":{canOverride:f.generic.color,componentOf:["background"],defaultValue:"transparent",multiplexLastOnly:!0,nonMergeableValue:"none",shortestValue:"red"},"background-image":{canOverride:f.generic.image,componentOf:["background"],defaultValue:"none"},"background-origin":{canOverride:f.property.backgroundOrigin,componentOf:["background"],defaultValue:"padding-box",shortestValue:"border-box"},"background-position":{canOverride:f.property.backgroundPosition,componentOf:["background"],defaultValue:["0","0"],doubleValues:!0,shortestValue:"0"},"background-repeat":{canOverride:f.property.backgroundRepeat,componentOf:["background"],defaultValue:["repeat"],doubleValues:!0},"background-size":{canOverride:f.property.backgroundSize,componentOf:["background"],defaultValue:["auto"],doubleValues:!0,shortestValue:"0 0"},bottom:{canOverride:f.property.bottom,defaultValue:"auto"},border:{breakUp:e.border,canOverride:f.generic.components([f.generic.unit,f.property.borderStyle,f.generic.color]),components:["border-width","border-style","border-color"],defaultValue:"none",overridesShorthands:["border-bottom","border-left","border-right","border-top"],restore:g.withoutDefaults,shorthand:!0,shorthandComponents:!0},"border-bottom":{breakUp:e.border,canOverride:f.generic.components([f.generic.unit,f.property.borderStyle,f.generic.color]),components:["border-bottom-width","border-bottom-style","border-bottom-color"],defaultValue:"none",restore:g.withoutDefaults,shorthand:!0},"border-bottom-color":{canOverride:f.generic.color,componentOf:["border-bottom","border-color"],defaultValue:"none"},"border-bottom-left-radius":{canOverride:f.generic.unit,componentOf:["border-radius"],defaultValue:"0",vendorPrefixes:["-moz-","-o-"]},"border-bottom-right-radius":{canOverride:f.generic.unit,componentOf:["border-radius"],defaultValue:"0",vendorPrefixes:["-moz-","-o-"]},"border-bottom-style":{canOverride:f.property.borderStyle,componentOf:["border-bottom","border-style"],defaultValue:"none"},"border-bottom-width":{canOverride:f.generic.unit,componentOf:["border-bottom","border-width"],defaultValue:"medium",shortestValue:"0"},"border-collapse":{canOverride:f.property.borderCollapse,defaultValue:"separate"},"border-color":{breakUp:e.fourValues,canOverride:f.generic.components([f.generic.color,f.generic.color,f.generic.color,f.generic.color]),componentOf:["border"],components:["border-top-color","border-right-color","border-bottom-color","border-left-color"],defaultValue:"none",restore:g.fourValues,shortestValue:"red",shorthand:!0},"border-left":{breakUp:e.border,canOverride:f.generic.components([f.generic.unit,f.property.borderStyle,f.generic.color]),components:["border-left-width","border-left-style","border-left-color"],defaultValue:"none",restore:g.withoutDefaults,shorthand:!0},"border-left-color":{canOverride:f.generic.color,componentOf:["border-color","border-left"],defaultValue:"none"},"border-left-style":{canOverride:f.property.borderStyle,componentOf:["border-left","border-style"],defaultValue:"none"},"border-left-width":{canOverride:f.generic.unit,componentOf:["border-left","border-width"],defaultValue:"medium",shortestValue:"0"},"border-radius":{breakUp:e.borderRadius,canOverride:f.generic.components([f.generic.unit,f.generic.unit,f.generic.unit,f.generic.unit]),components:["border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius"],defaultValue:"0",restore:g.borderRadius,shorthand:!0,vendorPrefixes:["-moz-","-o-"]},"border-right":{breakUp:e.border,canOverride:f.generic.components([f.generic.unit,f.property.borderStyle,f.generic.color]),components:["border-right-width","border-right-style","border-right-color"],defaultValue:"none",restore:g.withoutDefaults,shorthand:!0},"border-right-color":{canOverride:f.generic.color,componentOf:["border-color","border-right"],defaultValue:"none"},"border-right-style":{canOverride:f.property.borderStyle,componentOf:["border-right","border-style"],defaultValue:"none"},"border-right-width":{canOverride:f.generic.unit,componentOf:["border-right","border-width"],defaultValue:"medium",shortestValue:"0"},"border-style":{breakUp:e.fourValues,canOverride:f.generic.components([f.property.borderStyle,f.property.borderStyle,f.property.borderStyle,f.property.borderStyle]),componentOf:["border"],components:["border-top-style","border-right-style","border-bottom-style","border-left-style"],defaultValue:"none",restore:g.fourValues,shorthand:!0},"border-top":{breakUp:e.border,canOverride:f.generic.components([f.generic.unit,f.property.borderStyle,f.generic.color]),components:["border-top-width","border-top-style","border-top-color"],defaultValue:"none",restore:g.withoutDefaults,shorthand:!0},"border-top-color":{canOverride:f.generic.color,componentOf:["border-color","border-top"],defaultValue:"none"},"border-top-left-radius":{canOverride:f.generic.unit,componentOf:["border-radius"],defaultValue:"0",vendorPrefixes:["-moz-","-o-"]},"border-top-right-radius":{canOverride:f.generic.unit,componentOf:["border-radius"],defaultValue:"0",vendorPrefixes:["-moz-","-o-"]},"border-top-style":{canOverride:f.property.borderStyle,componentOf:["border-style","border-top"],defaultValue:"none"},"border-top-width":{canOverride:f.generic.unit,componentOf:["border-top","border-width"],defaultValue:"medium",shortestValue:"0"},"border-width":{breakUp:e.fourValues,canOverride:f.generic.components([f.generic.unit,f.generic.unit,f.generic.unit,f.generic.unit]),components:["border-top-width","border-right-width","border-bottom-width","border-left-width"],defaultValue:"medium",restore:g.fourValues,shortestValue:"0",shorthand:!0},clear:{canOverride:f.property.clear,defaultValue:"none"},color:{canOverride:f.generic.color,defaultValue:"transparent",shortestValue:"red"},cursor:{canOverride:f.property.cursor,defaultValue:"auto"},display:{canOverride:f.property.display},float:{canOverride:f.property.float,defaultValue:"none"},"font-size":{canOverride:f.generic.unit,defaultValue:"medium",shortestValue:"0"},"font-style":{canOverride:f.property.fontStyle,defaultValue:"normal"},"font-weight":{canOverride:f.property.fontWeight,defaultValue:"400",shortestValue:"400"},height:{canOverride:f.generic.unit,defaultValue:"auto",shortestValue:"0"},left:{canOverride:f.property.left,defaultValue:"auto"},"line-height":{canOverride:f.generic.unit,defaultValue:"normal",shortestValue:"0"},"list-style":{canOverride:f.generic.components([f.property.listStyleType,f.property.listStylePosition,f.property.listStyleImage]),components:["list-style-type","list-style-position","list-style-image"],breakUp:e.listStyle,restore:g.withoutDefaults,defaultValue:"outside",shortestValue:"none",shorthand:!0},"list-style-image":{canOverride:f.generic.image,componentOf:["list-style"],defaultValue:"none"},"list-style-position":{canOverride:f.property.listStylePosition,componentOf:["list-style"],defaultValue:"outside",shortestValue:"inside"},"list-style-type":{canOverride:f.property.listStyleType,componentOf:["list-style"],defaultValue:"decimal|disc",shortestValue:"none"},margin:{breakUp:e.fourValues,canOverride:f.generic.components([f.generic.unit,f.generic.unit,f.generic.unit,f.generic.unit]),components:["margin-top","margin-right","margin-bottom","margin-left"],defaultValue:"0",restore:g.fourValues,shorthand:!0},"margin-bottom":{canOverride:f.generic.unit,componentOf:["margin"],defaultValue:"0"},"margin-left":{canOverride:f.generic.unit,componentOf:["margin"],defaultValue:"0"},"margin-right":{canOverride:f.generic.unit,componentOf:["margin"],defaultValue:"0"},"margin-top":{canOverride:f.generic.unit,componentOf:["margin"],defaultValue:"0"},outline:{canOverride:f.generic.components([f.generic.color,f.property.outlineStyle,f.generic.unit]),components:["outline-color","outline-style","outline-width"],breakUp:e.outline,restore:g.withoutDefaults,defaultValue:"0",shorthand:!0},"outline-color":{canOverride:f.generic.color,componentOf:["outline"],defaultValue:"invert",shortestValue:"red"},"outline-style":{canOverride:f.property.outlineStyle,componentOf:["outline"],defaultValue:"none"},"outline-width":{canOverride:f.generic.unit,componentOf:["outline"],defaultValue:"medium",shortestValue:"0"},overflow:{canOverride:f.property.overflow,defaultValue:"visible"},"overflow-x":{canOverride:f.property.overflow,defaultValue:"visible"},"overflow-y":{canOverride:f.property.overflow,defaultValue:"visible"},padding:{breakUp:e.fourValues,canOverride:f.generic.components([f.generic.unit,f.generic.unit,f.generic.unit,f.generic.unit]),components:["padding-top","padding-right","padding-bottom","padding-left"], +defaultValue:"0",restore:g.fourValues,shorthand:!0},"padding-bottom":{canOverride:f.generic.unit,componentOf:["padding"],defaultValue:"0"},"padding-left":{canOverride:f.generic.unit,componentOf:["padding"],defaultValue:"0"},"padding-right":{canOverride:f.generic.unit,componentOf:["padding"],defaultValue:"0"},"padding-top":{canOverride:f.generic.unit,componentOf:["padding"],defaultValue:"0"},position:{canOverride:f.property.position,defaultValue:"static"},right:{canOverride:f.property.right,defaultValue:"auto"},"text-align":{canOverride:f.property.textAlign,defaultValue:"left|right"},"text-decoration":{canOverride:f.property.textDecoration,defaultValue:"none"},"text-overflow":{canOverride:f.property.textOverflow,defaultValue:"none"},"text-shadow":{canOverride:f.property.textShadow,defaultValue:"none"},top:{canOverride:f.property.top,defaultValue:"auto"},transform:{canOverride:f.property.transform,vendorPrefixes:["-moz-","-ms-","-webkit-"]},"vertical-align":{canOverride:f.property.verticalAlign,defaultValue:"baseline"},visibility:{canOverride:f.property.visibility,defaultValue:"visible"},"white-space":{canOverride:f.property.whiteSpace,defaultValue:"normal"},width:{canOverride:f.generic.unit,defaultValue:"auto",shortestValue:"0"},"z-index":{canOverride:f.property.zIndex,defaultValue:"auto"}},j={};for(var k in i){var l=i[k];if("vendorPrefixes"in l){for(var m=0;m~]/.test(g(a[1])),k=0,l=a[2].length;k0?"border-radius":"border-collapse"==a||"border-spacing"==a||"border-image"==a?a:0===a.indexOf("border-")&&/^border\-\w+\-\w+$/.test(a)?a.match(/border\-\w+/)[0]:0===a.indexOf("border-")&&/^border\-\w+$/.test(a)?"border":0===a.indexOf("text-")?a:"-chrome-"==a?a:a.replace(/^\-\w+\-/,"").match(/([a-zA-Z]+)/)[0].toLowerCase()}var f=a("../../tokenizer/token"),g=a("../../writer/one-time").rules,h=a("../../writer/one-time").value;b.exports=d},{"../../tokenizer/token":82,"../../writer/one-time":97}],24:[function(a,b,c){function d(a){this.name="InvalidPropertyError",this.message=a,this.stack=(new Error).stack}d.prototype=Object.create(Error.prototype),d.prototype.constructor=d,b.exports=d},{}],25:[function(a,b,c){function d(a,b,c){var d,h,i,j=m(a,l.COMMA);for(h=0,i=j.length;h-1&&!g(d,f(d),b,c))return!1;return!0}function e(a){return n.test(a)}function f(a){var b,c,d,e,f,g,h=[],i=[],j=s.ROOT,k=0,m=!1,n=!1;for(f=0,g=a.length;f0&&m&&h.push(i.join("")),h}function g(a,b,c,d){return h(b,c,d)&&i(b)&&(b.length<2||!j(a,b))&&(b.length<2||!k(b))}function h(a,b,c){var d,e,f,g;for(f=0,g=a.length;f-1?d.substring(0,d.indexOf(l.OPEN_ROUND_BRACKET)):d,b.indexOf(e)===-1&&c.indexOf(e)===-1)return!1;return!0}function i(a){var b,c,d,e,f,g;for(f=0,g=a.length;f-1,c=e?b.substring(0,d):b,e&&q.indexOf(c)==-1)return!1;if(!e&&q.indexOf(c)>-1)return!1}return!0}function j(a,b){var c,d,e,f,g,h,i,j,k,m=0;for(j=0,k=b.length;j-1?c.substring(0,c.indexOf(l.OPEN_ROUND_BRACKET)):c,h=e.indexOf(l.OPEN_ROUND_BRACKET)>-1?e.substring(0,e.indexOf(l.OPEN_ROUND_BRACKET)):e,g!=p||h!=p))return!0;return!1}function k(a){var b,c,d,e=o.test(a[0]);for(c=0,d=a.length;c\+~]/,s={DOUBLE_QUOTE:"double-quote",SINGLE_QUOTE:"single-quote",ROOT:"root"};b.exports=d},{"../../tokenizer/marker":81,"../../utils/split":95}],26:[function(a,b,c){function d(a,b){for(var c=[null,[],[]],d=b.options,m=d.compatibility.selectors.adjacentSpace,n=d.level[i.One].selectorsSortingMethod,o=d.compatibility.selectors.mergeablePseudoClasses,p=d.compatibility.selectors.mergeablePseudoElements,q=0,r=a.length;q1?g(c[1],n):c[1],s[2]=[]):c=s:c=[null,[],[]]}}var e=a("./is-mergeable"),f=a("./properties/optimize"),g=a("../level-1/sort-selectors"),h=a("../level-1/tidy-rules"),i=a("../../options/optimization-level").OptimizationLevel,j=a("../../writer/one-time").body,k=a("../../writer/one-time").rules,l=a("../../tokenizer/token");b.exports=d},{"../../options/optimization-level":63,"../../tokenizer/token":82,"../../writer/one-time":97,"../level-1/sort-selectors":15,"../level-1/tidy-rules":18,"./is-mergeable":25,"./properties/optimize":36}],27:[function(a,b,c){function d(a,b){for(var c=b.options.level[k.Two].mergeSemantically,d=b.cache.specificity,g={},i=[],m=a.length-1;m>=0;m--){var n=a[m];if(n[0]==l.NESTED_BLOCK){var o=j(n[1]),p=g[o];p||(p=[],g[o]=p),p.push(m)}}for(var q in g){var r=g[q];a:for(var s=r.length-1;s>0;s--){var t=r[s],u=a[t],v=r[s-1],w=a[v];b:for(var x=1;x>=-1;x-=2){for(var y=1==x,z=y?t+1:v-1,A=y?v:t,B=y?1:-1,C=y?u:w,D=y?w:u,E=h(C);z!=A;){var F=h(a[z]);if(z+=B,!(c&&e(E,F,d)||f(E,F,d)))continue b}D[2]=y?C[2].concat(D[2]):D[2].concat(C[2]),C[2]=[],i.push(D);continue a}}}return i}function e(a,b,c){var d,e,f,h,j,k,l,m;for(j=0,k=a.length;j-1||b.indexOf("--")>-1}function f(a){return a.replace(/--[^ ,>\+~:]+/g,"")}function g(a,b){var c=f(n(a[1]));for(var d in b){var e=b[d],g=f(n(e[1]));(g.indexOf(c)>-1||c.indexOf(g)>-1)&&delete b[d]}}function h(a,b){for(var c=b.options,f=c.level[l.Two].mergeSemantically,h=c.compatibility.selectors.adjacentSpace,p=c.level[l.One].selectorsSortingMethod,q=c.compatibility.selectors.mergeablePseudoClasses,r=c.compatibility.selectors.mergeablePseudoElements,s={},t=a.length-1;t>=0;t--){var u=a[t];if(u[0]==o.RULE){u[2].length>0&&!f&&d(n(u[1]))&&(s={}),u[2].length>0&&f&&e(u)&&g(u,s);var v=m(u[2]),w=s[v];w&&i(n(u[1]),q,r)&&i(n(w[1]),q,r)&&(u[2].length>0?(u[1]=k(w[1].concat(u[1]),!1,h,!1,b.warnings),u[1]=u[1].length>1?j(u[1],p):u[1]):u[1]=w[1].concat(u[1]),w[2]=[],s[v]=null),s[m(u[2])]=u}}}var i=a("./is-mergeable"),j=a("../level-1/sort-selectors"),k=a("../level-1/tidy-rules"),l=a("../../options/optimization-level").OptimizationLevel,m=a("../../writer/one-time").body,n=a("../../writer/one-time").rules,o=a("../../tokenizer/token");b.exports=h},{"../../options/optimization-level":63,"../../tokenizer/token":82,"../../writer/one-time":97,"../level-1/sort-selectors":15,"../level-1/tidy-rules":18,"./is-mergeable":25}],29:[function(a,b,c){function d(a,b){var c,d=b.cache.specificity,j={},k=[];for(c=a.length-1;c>=0;c--)if(a[c][0]==i.RULE&&0!==a[c][2].length){var l=h(a[c][1]);j[l]=[c].concat(j[l]||[]),2==j[l].length&&k.push(l)}for(c=k.length-1;c>=0;c--){var m=j[k[c]];a:for(var n=m.length-1;n>0;n--){var o=m[n-1],p=a[o],q=m[n],r=a[q];b:for(var s=1;s>=-1;s-=2){for(var t=1==s,u=t?o+1:q-1,v=t?q:o,w=t?1:-1,x=t?p:r,y=t?r:p,z=f(x);u!=v;){var A=f(a[u]);u+=w;var B=t?e(z,A,d):e(A,z,d);if(!B&&!t)continue a;if(!B&&t)continue b}t?(Array.prototype.push.apply(x[2],y[2]),y[2]=x[2]):Array.prototype.push.apply(y[2],x[2]),g(y[2],!0,!0,b),x[2]=[]}}}}var e=a("./reorderable").canReorder,f=a("./extract-properties"),g=a("./properties/optimize"),h=a("../../writer/one-time").rules,i=a("../../tokenizer/token");b.exports=d},{"../../tokenizer/token":82,"../../writer/one-time":97,"./extract-properties":23,"./properties/optimize":36,"./reorderable":46}],30:[function(a,b,c){function d(a){for(var b=0,c=a.length;b=0;s--)g(q[s][2],b,!1);return d(a),a}var h=a("./merge-adjacent"),i=a("./merge-media-queries"),j=a("./merge-non-adjacent-by-body"),k=a("./merge-non-adjacent-by-selector"),l=a("./reduce-non-adjacent"),m=a("./remove-duplicate-font-at-rules"),n=a("./remove-duplicate-media-queries"),o=a("./remove-duplicates"),p=a("./restructure"),q=a("./properties/optimize"),r=a("../../options/optimization-level").OptimizationLevel,s=a("../../tokenizer/token");b.exports=g},{"../../options/optimization-level":63,"../../tokenizer/token":82,"./merge-adjacent":26,"./merge-media-queries":27,"./merge-non-adjacent-by-body":28,"./merge-non-adjacent-by-selector":29,"./properties/optimize":36,"./reduce-non-adjacent":42,"./remove-duplicate-font-at-rules":43,"./remove-duplicate-media-queries":44,"./remove-duplicates":45,"./restructure":49}],31:[function(a,b,c){function d(a,b,c){var d,f,g,h=b.value.length,i=c.value.length,j=Math.max(h,i),k=Math.min(h,i)-1;for(g=0;g=0;b--)if("inherit"==a.value[b][1])return!0;return!1}b.exports=d},{}],34:[function(a,b,c){function d(a,b,c){return e(a,b)||!c&&!!g[a.name].shorthandComponents&&f(a,b)}function e(a,b){var c=g[a.name];return"components"in c&&c.components.indexOf(b.name)>-1}function f(a,b){return a.components.some(function(a){return e(a,b)})}var g=a("../compactable");b.exports=d},{"../compactable":22}],35:[function(a,b,c){function d(a){var b;for(var c in a){if(void 0!==b&&a[c].important!=b)return!0;b=a[c].important}return!1}function e(a,b){var c,d,e,f,g=[];for(f in a)c=a[f],d=c.all[c.position],e=d[b][d[b].length-1],Array.prototype.push.apply(g,e);return g}function f(a,b,c,d){var f,g,h,p,q=l[c],r=[o.PROPERTY,[o.PROPERTY_NAME,c],[o.PROPERTY_VALUE,q.defaultValue]],s=n(r);s.shorthand=!0,s.dirty=!0,k([s],d,[]);for(var t=0,u=q.components.length;tObject.keys(j).length?delete c[h]:d(j)||f(a,j,h,e)}}function h(a,b){var c,d,e,f,h,i,j,k={};if(!(a.length<3)){for(f=0,h=a.length;f=0&&(a[e].name!=c||a[e].unused||d++,!(d>1));e--);return d>1}function n(a,b){for(var c=0,d=a.components.length;c=0;E--)if(g=a[E],q(g)&&!g.block){f=B[g.name].canOverride;b:for(F=E-1;F>=0;F--)if(l=a[F],q(l)&&!l.block&&!l.unused&&!g.unused&&(!l.hack||g.hack||g.important)&&(l.hack||l.important||!g.hack)&&!(l.important==g.important&&l.hack!=g.hack||v(g)||r(l,g)))if(g.shorthand&&y(g,l)){if(!g.important&&l.important)continue;if(!A([l],g.components))continue;if(!o(e.isValidFunction,l)&&n(g,e))continue;s=x(g,l),f=B[l.name].canOverride,w(f.bind(null,e),l,s)&&(l.unused=!0)}else if(g.shorthand&&z(g,l)){if(!g.important&&l.important)continue;if(!A([l],g.components))continue;if(!o(e.isValidFunction,l)&&n(g,e))continue;for(t=l.shorthand?l.components:[l],G=t.length-1;G>=0;G--)if(u=t[G],C=x(g,u),f=B[u.name].canOverride,!w(f.bind(null,e),l,C))continue b;l.unused=!0}else if(b&&l.shorthand&&!g.shorthand&&y(l,g,!0)){if(g.important&&!l.important)continue;if(!g.important&&l.important){g.unused=!0;continue}if(m(a,E-1,l.name))continue;if(n(l,e))continue;if(s=x(l,g),w(f.bind(null,e),s,g)){var H=!c.properties.backgroundClipMerging&&s.name.indexOf("background-clip")>-1||!c.properties.backgroundOriginMerging&&s.name.indexOf("background-origin")>-1||!c.properties.backgroundSizeMerging&&s.name.indexOf("background-size")>-1,I=B[g.name].nonMergeableValue===g.value[0][1];if(H||I)continue;if(!c.properties.merging&&d(l,e))continue;if(s.value[0][1]!=g.value[0][1]&&(v(l)||v(g)))continue;if(p(l,g))continue;!l.multiplex&&g.multiplex&&j(l,k(g)),h(s,g),l.dirty=!0}}else if(b&&l.shorthand&&g.shorthand&&l.name==g.name){if(!l.multiplex&&g.multiplex)continue;if(!g.important&&l.important){g.unused=!0;continue a}if(g.important&&!l.important){l.unused=!0;continue}for(G=l.components.length-1;G>=0;G--){var J=l.components[G],K=g.components[G];if(f=B[J.name].canOverride,!w(f.bind(null,e),J,K))continue a}i(l,g),l.dirty=!0}else if(b&&l.shorthand&&g.shorthand&&y(l,g)){if(!l.important&&g.important)continue;if(s=x(l,g),f=B[g.name].canOverride,!w(f.bind(null,e),s,g))continue;if(l.important&&!g.important){g.unused=!0;continue}var L=B[g.name].restore(g,B);if(L.length>1)continue;s=x(l,g),h(s,g),g.dirty=!0}else if(l.name==g.name){if(D=!0,g.shorthand)for(G=g.components.length-1;G>=0&&D;G--)u=l.components[G],C=g.components[G],f=B[C.name].canOverride,D=D&&w(f.bind(null,e),u,C);else f=B[g.name].canOverride,D=w(f.bind(null,e),l,g);if(l.important&&!g.important&&D){g.unused=!0;continue}if(!l.important&&g.important&&D){l.unused=!0;continue}if(!D)continue;l.unused=!0}}}var v=a("./has-inherit"),w=a("./every-values-pair"),x=a("./find-component-in"),y=a("./is-component-of"),z=a("./overrides-non-component-shorthand"),A=a("./vendor-prefixes").same,B=a("../compactable"),C=a("../clone").deep,C=a("../clone").deep,D=a("../restore-with-components"),E=a("../clone").shallow,F=a("../../restore-from-optimizing",D),G=a("../../../tokenizer/token"),H=a("../../../tokenizer/marker"),I=a("../../../writer/one-time").property;b.exports=u},{"../../../tokenizer/marker":81,"../../../tokenizer/token":82,"../../../writer/one-time":97,"../../restore-from-optimizing":55,"../clone":21,"../compactable":22,"../restore-with-components":47,"./every-values-pair":31,"./find-component-in":32,"./has-inherit":33,"./is-component-of":34,"./overrides-non-component-shorthand":38,"./vendor-prefixes":41}],38:[function(a,b,c){function d(a,b){return a.name in e&&"overridesShorthands"in e[a.name]&&e[a.name].overridesShorthands.indexOf(b.name)>-1}var e=a("../compactable");b.exports=d},{"../compactable":22}],39:[function(a,b,c){function d(a,b,c){for(var d,g,h,i=a.length-1;i>=0;i--){var j=a[i],k=e[j.name];if(k&&k.shorthand){j.shorthand=!0,j.dirty=!0;try{if(j.components=k.breakUp(j,e,b),k.shorthandComponents)for(g=0,h=j.components.length;g0?j.multiplex=j.components[0].multiplex:j.unused=!0}}}var e=a("../compactable"),f=a("../invalid-property-error");b.exports=d},{"../compactable":22,"../invalid-property-error":24}],40:[function(a,b,c){function d(a,b,c,d,f){return!!e(b,c)&&(!f||a.isValidVariable(b)===a.isValidVariable(c))}var e=a("./vendor-prefixes").same;b.exports=d},{"./vendor-prefixes":41}],41:[function(a,b,c){function d(a){for(var b,c=[];null!==(b=f.exec(a));)c.indexOf(b[0])==-1&&c.push(b[0]);return c}function e(a,b){return d(a).sort().join(",")==d(b).sort().join(",")}var f=/(?:^|\W)(\-\w+\-)/g;b.exports={unique:d,same:e}},{}],42:[function(a,b,c){function d(a,b){for(var c=b.options,d=c.compatibility.selectors.mergeablePseudoClasses,h=c.compatibility.selectors.mergeablePseudoElements,j={},k=[],m=a.length-1;m>=0;m--){var o=a[m];if(o[0]==l.RULE&&0!==o[2].length)for(var p=n(o[1]),q=o[1].length>1&&i(p,d,h),r=e(o[1]),s=q?[p].concat(r):[p],t=0,u=s.length;t0,isComplex:q&&0===t})}}f(a,k,j,c,b),g(a,j,c,b)}function e(a){for(var b=[],c=0;c=0;i--)if(!c.filterOut(i,f)){var l=b[i].where,m=a[l],n=k(m[2]);f=f.concat(n),g.push(n),h.push(l)}j(f,!0,!1,e);for(var o=h.length,p=f.length-1,q=o-1;q>=0;)if((0===q||f[p]&&g[q].indexOf(f[p])>-1)&&p>-1)p--;else{var r=f.splice(p+1);c.callback(a[h[q]],r,o,q),q--}}var i=a("./is-mergeable"),j=a("./properties/optimize"),k=a("../../utils/clone-array"),l=a("../../tokenizer/token"),m=a("../../writer/one-time").body,n=a("../../writer/one-time").rules;b.exports=d},{"../../tokenizer/token":82,"../../utils/clone-array":84,"../../writer/one-time":97,"./is-mergeable":25,"./properties/optimize":36}],43:[function(a,b,c){function d(a){var b,c,d,h,i=[];for(d=0,h=a.length;d-1?b[2]=[]:i.push(c))}var e=a("../../tokenizer/token"),f=a("../../writer/one-time").all,g="@font-face";b.exports=d},{"../../tokenizer/token":82,"../../writer/one-time":97}],44:[function(a,b,c){function d(a){var b,c,d,h,i,j={};for(h=0,i=a.length;h=0;m--)c=a[i[b][m]],d=f(c[2]),h.indexOf(d)>-1?c[2]=[]:h.push(d)}}var e=a("../../tokenizer/token"),f=a("../../writer/one-time").body,g=a("../../writer/one-time").rules;b.exports=d},{"../../tokenizer/token":82,"../../writer/one-time":97}],46:[function(a,b,c){function d(a,b,c){for(var d=b.length-1;d>=0;d--)for(var f=a.length-1;f>=0;f--)if(!e(a[f],b[d],c))return!1;return!0}function e(a,b,c){var d=a[0],e=a[1],q=a[2],r=a[5],s=a[6],t=b[0],u=b[1],v=b[2],w=b[5],x=b[6];return!("font"==d&&"line-height"==t||"font"==t&&"line-height"==d)&&((!o.test(d)||!o.test(t))&&(!(q==v&&g(d)==g(t)&&f(d)^f(t))&&(("border"!=q||!p.test(v)||!("border"==d||d==v||e!=u&&h(d,t)))&&(("border"!=v||!p.test(q)||!("border"==t||t==q||e!=u&&h(d,t)))&&(("border"!=q||"border"!=v||d==t||!(i(d)&&j(t)||j(d)&&i(t)))&&(q!=v||(!(d!=t||q!=v||e!=u&&!k(e,u))||(d!=t&&q==v&&d!=q&&t!=v||(d!=t&&q==v&&e==u||(!(!x||!s||l(q)||l(v)||m(w,r,!1))||!n(r,w,c)))))))))))}function f(a){return/^\-(?:moz|webkit|ms|o)\-/.test(a)}function g(a){return a.replace(/^\-(?:moz|webkit|ms|o)\-/,"")}function h(a,b){return a.split("-").pop()==b.split("-").pop()}function i(a){return"border-top"==a||"border-right"==a||"border-bottom"==a||"border-left"==a}function j(a){return"border-color"==a||"border-style"==a||"border-width"==a}function k(a,b){return f(a)&&f(b)&&a.split("-")[1]!=b.split("-")[2]}function l(a){return"font"==a||"line-height"==a||"list-style"==a}var m=a("./rules-overlap"),n=a("./specificities-overlap"),o=/align\-items|box\-align|box\-pack|flex|justify/,p=/^border\-(top|right|bottom|left|color|style|width|radius)/;b.exports={canReorder:d,canReorderSingle:e}},{"./rules-overlap":50,"./specificities-overlap":51}],47:[function(a,b,c){function d(a){var b=e[a.name];return b&&b.shorthand?b.restore(a,e):a.value}var e=a("./compactable");b.exports=d},{"./compactable":22}],48:[function(a,b,c){function d(a){for(var b=0,c=a.length;b=0;m--){var n=i[m],o=f(n);if("background-clip"==n.name){var p=i[m-1],q=f(p);g=n.value[0][1]==p.value[0][1],h=!g&&(q&&!o||!q&&!o||!q&&o&&n.value[0][1]!=p.value[0][1]),g?e(p):h&&(e(n),e(p)),m--}else if("background-size"==n.name){var r=i[m-1],s=f(r);g=!s&&o,h=!g&&(s&&!o||!s&&!o),g?e(r):h?(e(n),j.unshift([k.PROPERTY_VALUE,l.FORWARD_SLASH]),e(r)):1==r.value.length&&e(r),m--}else{if(o||b[n.name].multiplexLastOnly&&!c)continue;e(n)}}return 0===j.length&&1==a.value.length&&"0"==a.value[0][1]&&j.push(a.value[0]),0===j.length&&j.push([k.PROPERTY_VALUE,b[a.name].defaultValue]),d(j)?[j[0]]:j}function f(a,b){if(a.multiplex){for(var c=j(a),d=j(a),e=0;e<4;e++){var f=a.components[e],h=j(a);h.value=[f.value[0]],c.components.push(h);var i=j(a);i.value=[f.value[1]||f.value[0]],d.components.push(i)}var m=g(c,b),n=g(d,b);return m.length!=n.length||m[0][1]!=n[0][1]||m.length>1&&m[1][1]!=n[1][1]||m.length>2&&m[2][1]!=n[2][1]||m.length>3&&m[3][1]!=n[3][1]?m.concat([[k.PROPERTY_VALUE,l.FORWARD_SLASH]]).concat(n):m}return g(a,b)}function g(a){var b=a.components,c=b[0].value[0],d=b[1].value[0],e=b[2].value[0],f=b[3].value[0];return c[1]==d[1]&&c[1]==e[1]&&c[1]==f[1]?[c]:c[1]==e[1]&&d[1]==f[1]?[c,d]:d[1]==f[1]?[c,d,e]:[c,d,e,f]}function h(a){return function(b,c){if(!b.multiplex)return a(b,c,!0);var d,e,f=0,g=[],h={};for(d=0,e=b.components[0].value.length;d=0;f--){var g=c[f],h=b[g.name];g.value[0][1]!=h.defaultValue&&e.unshift(g.value[0])}return 0===e.length&&e.push([k.PROPERTY_VALUE,b[a.name].defaultValue]),d(e)?[e[0]]:e}var j=a("./clone").shallow,k=a("../../tokenizer/token"),l=a("../../tokenizer/marker");b.exports={background:e,borderRadius:f,fourValues:g,multiplex:h,withoutDefaults:i}},{"../../tokenizer/marker":81,"../../tokenizer/token":82,"./clone":21}],49:[function(a,b,c){function d(a,b){return a>b?1:-1}function e(a,b){var c=l(a);return c[5]=c[5].concat(b[5]),c}function f(a,b){function c(a,b,c){for(var d=c.length-1;d>=0;d--){var e=c[d][0],g=f(b,e);if(G[g].length>1&&y(a,G[g])){l(g);break}}}function f(a,b){var c=o(b);return G[c]=G[c]||[],G[c].push([a,b]),c}function l(a){var b,c=a.split(J),d=[];for(var e in G){var f=e.split(J);for(b=f.length-1;b>=0;b--)if(c.indexOf(f[b])>-1){d.push(e);break}}for(b=d.length-1;b>=0;b--)delete G[d[b]]}function o(a){for(var b=[],c=0,d=a.length;c=0;d--)i(n(a[d][1]),B,C)&&(c.unshift(a[d]),a[d][2].length>0&&b.indexOf(a[d])==-1&&b.push(a[d]));return b.length>1?c:[]}function q(a,b){var d=b[0],e=b[1],f=b[4],g=d.length+e.length+1,h=[],i=[],k=p(E[f]);if(!(k.length<2)){var l=s(k,g,1),m=l[0];if(m[1]>0)return c(a,b,l);for(var n=m[0].length-1;n>=0;n--)h=m[0][n][1].concat(h),i.unshift(m[0][n]);h=j(h),v(a,[b],h,i)}}function r(a,b){return a[1]>b[1]}function s(a,b,c){var d=t(a,b,c,I-1);return d.sort(r)}function t(a,b,c,d){var e=[[a,u(a,b,c)]];if(a.length>2&&d>0)for(var f=a.length-1;f>=0;f--){var g=Array.prototype.slice.call(a,0);g.splice(f,1),e=e.concat(t(g,b,c,d-1))}return e}function u(a,b,c){for(var d=0,e=a.length-1;e>=0;e--)d+=a[e][2].length>c?n(a[e][1]).length:-1;return d-(a.length-1)*b+1}function v(b,c,d,e){var f,g,h,i,j=[];for(f=e.length-1;f>=0;f--){var l=e[f];for(g=l[2].length-1;g>=0;g--){var n=l[2][g];for(h=0,i=c.length;h=0;f--)j.unshift(c[f][3]);var s=[k.RULE,d,j];a.splice(b,0,s)}function w(a,b){var c=b[4],d=E[c];d&&d.length>1&&(x(a,b)||q(a,b))}function x(a,b){var c,d,e=[],f=[],g=b[4],h=p(E[g]);if(!(h.length<2)){a:for(var i in E){var j=E[i];for(c=h.length-1;c>=0;c--)if(j.indexOf(h[c])==-1)continue a;e.push(i)}if(e.length<2)return!1;for(c=e.length-1;c>=0;c--)for(d=F.length-1;d>=0;d--)if(F[d][4]==e[c]){f.unshift([F[d],h]);break}return y(a,f)}}function y(a,b){for(var c,d=0,e=[],f=b.length-1;f>=0;f--){c=b[f][0];var g=c[4];d+=g.length+(f>0?1:0),e.push(c)}var h=b[0][1],i=s(h,d,e.length)[0];if(i[1]>0)return!1;var k=[],l=[];for(f=i[0].length-1;f>=0;f--)k=i[0][f][1].concat(k),l.unshift(i[0][f]);for(k=j(k),v(a,e,k,l),f=e.length-1;f>=0;f--){c=e[f];var m=F.indexOf(c);delete E[c[4]],m>-1&&H.indexOf(m)==-1&&H.push(m)}return!0}function z(a,b,c){var d=a[0],e=b[0];if(d!=e)return!1;var f=b[4],g=E[f];return g&&g.indexOf(c)>-1}for(var A=b.options,B=A.compatibility.selectors.mergeablePseudoClasses,C=A.compatibility.selectors.mergeablePseudoElements,D=b.cache.specificity,E={},F=[],G={},H=[],I=2,J="%",K=a.length-1;K>=0;K--){var L,M,N,O,P,Q=a[K];if(Q[0]==k.RULE)L=!0;else{if(Q[0]!=k.NESTED_BLOCK)continue;L=!1}var R=F.length,S=h(Q);H=[];var T=[];for(M=S.length-1;M>=0;M--)for(N=M-1;N>=0;N--)if(!g(S[M],S[N],D)){T.push(M);break}for(M=S.length-1;M>=0;M--){var U=S[M],V=!1;for(N=0;N-1)){var X=U[4];E[X]=E[X]||[],E[X].push(Q),V?F[P]=e(F[P],U):F.push(U)}}for(H=H.sort(d),M=0,O=H.length;M0&&!p||(b==f.OPEN_ROUND_BRACKET?o++:b==f.CLOSE_ROUND_BRACKET&&1==o?(o--,p=!1):b==f.CLOSE_ROUND_BRACKET?o--:b==g.HASH?n[0]++:b==g.DOT||b==f.OPEN_SQUARE_BRACKET?n[1]++:b!=g.PSEUDO||q||e(a,l)?b==g.PSEUDO?p=!0:(0===l||k)&&h.test(b)&&n[2]++:(n[1]++,p=!1))}else i=!0;else d=!0;c=b==f.BACK_SLASH,q=b==g.PSEUDO,k=!c&&j.test(b)}return n}function e(a,b){return a.indexOf(i,b)===b}var f=a("../../tokenizer/marker"),g={ADJACENT_SIBLING:"+",DESCENDANT:">",DOT:".",HASH:"#",NON_ADJACENT_SIBLING:"~",PSEUDO:":"},h=/[a-zA-Z]/,i=":not(",j=/[\s,\(>~\+]/;b.exports=d},{"../../tokenizer/marker":81}],53:[function(a,b,c){function d(a,b){return a[1]>b[1]?1:-1}function e(a){for(var b=[],c=[],e=0,f=a.length;e=0;b--){var c=a[b];c.unused&&c.all.splice(c.position,1)}}b.exports=d},{}],55:[function(a,b,c){function d(a,b){var c,d,g,h;for(h=a.length-1;h>=0;h--)c=a[h],c.unused||(c.dirty||c.important||c.hack)&&(b?(d=b(c),c.value=d):d=c.value,c.important&&e(c),c.hack&&f(c),"all"in c&&(g=c.all[c.position],g[1][1]=c.name,g.splice(2,g.length-1),Array.prototype.push.apply(g,d)))}function e(a){a.value[a.value.length-1][1]+=k}function f(a){a.hack==g.UNDERSCORE?a.name=l+a.name:a.hack==g.ASTERISK?a.name=i+a.name:a.hack==g.BACKSLASH?a.value[a.value.length-1][1]+=j:a.hack==g.BANG&&(a.value[a.value.length-1][1]+=h.SPACE+m)}var g=a("./hack"),h=a("../tokenizer/marker"),i="*",j="\\9",k="!important",l="_",m="!ie";b.exports=d},{"../tokenizer/marker":81,"./hack":9}],56:[function(a,b,c){function d(a,b){if(!o(a)||!o(b))return!1;var c=a.substring(0,a.indexOf("(")),d=b.substring(0,b.indexOf("("));return c===d}function e(a){return Z.test(a)}function f(a){return Y["background-attachment"].indexOf(a)>-1}function g(a){return Y["background-clip"].indexOf(a)>-1}function h(a){return Y["background-repeat"].indexOf(a)>-1}function i(a){return Y["background-origin"].indexOf(a)>-1}function j(a){var b,c,d;if("inherit"===a)return!0;for(b=a.split(" "),c=0,d=b.length;c-1||V.test(a)}function l(a){return Y["background-size"].indexOf(a)>-1||U.test(a)}function m(a){return x(a)||n(a)}function n(a){return r(a)||y(a)||s(a)}function o(a){return!W.test(a)&&T.test(a)}function p(a){return!W.test(a)&&R.test(a)}function q(a){return X.indexOf(a)>-1}function r(a){return(4===a.length||7===a.length)&&"#"===a[0]}function s(a){return a.length>0&&0===a.indexOf("hsla(")&&a.indexOf(")")===a.length-1}function t(a){return"none"==a||"inherit"==a||D(a)}function u(a,b,c){return Y[a].indexOf(b)>-1||c&&q(b)}function v(a){return Y["list-style-type"].indexOf(a)>-1}function w(a){return Y["list-style-position"].indexOf(a)>-1}function x(a){return"auto"!==a&&("transparent"===a||"inherit"===a||/^[a-zA-Z]+$/.test(a))}function y(a){return a.length>0&&0===a.indexOf("rgba(")&&a.indexOf(")")===a.length-1}function z(a){return Y["*-style"].indexOf(a)>-1}function A(a,b){return C(a,b)||m(b)||q(b)}function B(a,b){return a.test(b)}function C(a,b){return a.test(b)}function D(a){return W.test(a)}function E(a){return S.test(a)}function F(a){return/^-([A-Za-z0-9]|-)*$/gi.test(a)}function G(a,b){return B(a,b)||Y.width.indexOf(b)>-1}function H(a){return"auto"==a||q(a)||a.length>0&&a==""+parseInt(a)}function I(a){var b=J.slice(0).filter(function(b){return!(b in a.units)||a.units[b]===!0}),c="(\\-?\\.?\\d+\\.?\\d*("+b.join("|")+"|)|auto|inherit)",I=new RegExp("^"+c+"$","i"),K=new RegExp("^(none|"+Y.width.join("|")+"|"+c+"|"+O+"|"+M+"|"+N+")$","i"),L=a.colors.opacity;return{areSameFunction:d,colorOpacity:L,hasNoVendorPrefix:e,isValidBackgroundAttachment:f,isValidBackgroundClip:g,isValidBackgroundOrigin:i,isValidBackgroundPosition:j,isValidBackgroundPositionPart:k,isValidBackgroundRepeat:h,isValidBackgroundSizePart:l,isValidColor:m,isValidColorValue:n,isValidFunction:o,isValidFunctionWithoutVendorPrefix:p,isValidGlobalValue:q,isValidHexColor:r,isValidHslaColor:s,isValidImage:t,isValidKeywordValue:u,isValidListStylePosition:w,isValidListStyleType:v,isValidNamedColor:x,isValidRgbaColor:y,isValidStyle:z,isValidTextShadow:A.bind(null,I),isValidUnit:B.bind(null,K),isValidUnitWithoutFunction:C.bind(null,I),isValidUrl:D,isValidVariable:E,isValidVendorPrefixedValue:F,isValidWidth:G.bind(null,I),isValidZIndex:H}}var J=["%","ch","cm","em","ex","in","mm","pc","pt","px","rem","vh","vm","vmax","vmin","vw"],K="(\\-?\\.?\\d+\\.?\\d*("+J.join("|")+"|)|auto|inherit)",L="(\\-moz\\-|\\-webkit\\-)?calc\\([^\\)]+\\)",M="[A-Z]+(\\-|[A-Z]|[0-9])+\\(.*?\\)",N="\\-(\\-|[A-Z]|[0-9])+\\(.*?\\)",O="var\\(\\-\\-[^\\)]+\\)",P="("+O+"|"+M+"|"+N+")",Q="("+K+"|"+L+")",R=new RegExp("^"+M+"$","i"),S=new RegExp("^"+O+"$","i"),T=new RegExp("^"+P+"$","i"),U=new RegExp("^"+K+"$","i"),V=new RegExp("^"+Q+"$","i"),W=/^url\([\s\S]+\)$/i,X=["inherit","initial","unset"],Y={"*-style":["auto","dashed","dotted","double","groove","hidden","inset","none","outset","ridge","solid"],"background-attachment":["fixed","inherit","local","scroll"],"background-clip":["border-box","content-box","inherit","padding-box","text"],"background-origin":["border-box","content-box","inherit","padding-box"],"background-position":["bottom","center","left","right","top"],"background-repeat":["no-repeat","inherit","repeat","repeat-x","repeat-y","round","space"],"background-size":["auto","cover","contain"],"border-collapse":["collapse","inherit","separate"],bottom:["auto"],clear:["both","left","none","right"],cursor:["all-scroll","auto","col-resize","crosshair","default","e-resize","help","move","n-resize","ne-resize","no-drop","not-allowed","nw-resize","pointer","progress","row-resize","s-resize","se-resize","sw-resize","text","vertical-text","w-resize","wait"],display:["block","inline","inline-block","inline-table","list-item","none","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group"],float:["left","none","right"],left:["auto"],"font-style":["italic","normal","oblique"],"font-weight":["100","200","300","400","500","600","700","800","900","bold","bolder","lighter","normal"],"list-style-position":["inside","outside"],"list-style-type":["armenian","circle","decimal","decimal-leading-zero","disc","decimal|disc","georgian","lower-alpha","lower-greek","lower-latin","lower-roman","none","square","upper-alpha","upper-latin","upper-roman"],overflow:["auto","hidden","scroll","visible"],position:["absolute","fixed","relative","static"],right:["auto"],"text-align":["center","justify","left","left|right","right"],"text-decoration":["line-through","none","overline","underline"],"text-overflow":["clip","ellipsis"],top:["auto"],"vertical-align":["baseline","bottom","middle","sub","super","text-bottom","text-top","top"],visibility:["collapse","hidden","visible"],"white-space":["normal","nowrap","pre"],width:["inherit","initial","medium","thick","thin"]},Z=/(^|\W)-\w+\-/;b.exports=I},{}],57:[function(a,b,c){function d(a,b){var c,d,f,g=[];for(f=a.length-1;f>=0;f--)d=a[f],d[0]==p.PROPERTY&&(!b&&e(d)||(c=m(d),c.all=a,c.position=f,g.unshift(c)));return g}function e(a){var b,c,d;for(b=2,c=a.length;b0&&!d[1].match(q.IMPORTANT_WORD_PATTERN)&&q.BANG_SUFFIX_PATTERN.test(d[1])?b=n.BANG:d[1].indexOf(q.BACKSLASH)>0&&d[1].indexOf(q.BACKSLASH)==d[1].length-q.BACKSLASH.length-1?b=n.BACKSLASH:0===d[1].indexOf(q.BACKSLASH)&&2==d[1].length&&(b=n.BACKSLASH):b=n.BANG,b}function i(a){if(a.length<3)return!1;var b=a[a.length-1];return!!q.IMPORTANT_TOKEN_PATTERN.test(b[1])||!(!q.IMPORTANT_WORD_PATTERN.test(b[1])||!q.SUFFIX_BANG_PATTERN.test(a[a.length-2][1]))}function j(a){var b=a[a.length-1],c=a[a.length-2];q.IMPORTANT_TOKEN_PATTERN.test(b[1])?b[1]=b[1].replace(q.IMPORTANT_TOKEN_PATTERN,""):(b[1]=b[1].replace(q.IMPORTANT_WORD_PATTERN,""),c[1]=c[1].replace(q.SUFFIX_BANG_PATTERN,"")),0===b[1].length&&a.pop(),0===c[1].length&&a.pop()}function k(a){a[1][1]=a[1][1].substring(1)}function l(a,b){var c=a[a.length-1];c[1]=c[1].substring(0,c[1].indexOf(b==n.BACKSLASH?q.BACKSLASH:q.BANG)).trim(),0===c[1].length&&a.pop()}function m(a){var b=i(a);b&&j(a);var c=h(a);return c==n.ASTERISK||c==n.UNDERSCORE?k(a):c!=n.BACKSLASH&&c!=n.BANG||l(a,c),{block:a[2]&&a[2][0]==p.PROPERTY_BLOCK,components:[],dirty:!1,hack:c,important:b,name:a[1][1],multiplex:a.length>3&&g(a),position:0,shorthand:!1,unused:!1,value:a.slice(2)}}var n=a("./hack"),o=a("../tokenizer/marker"),p=a("../tokenizer/token"),q={ASTERISK:"*",BACKSLASH:"\\",BANG:"!",BANG_SUFFIX_PATTERN:/!\w+$/,IMPORTANT_TOKEN:"!important",IMPORTANT_TOKEN_PATTERN:new RegExp("!important$","i"),IMPORTANT_WORD:"important",IMPORTANT_WORD_PATTERN:new RegExp("important$","i"),SUFFIX_BANG_PATTERN:/!$/,UNDERSCORE:"_",VARIABLE_REFERENCE_PATTERN:/var\(--.+\)$/};b.exports={all:d,single:m}},{"../tokenizer/marker":81,"../tokenizer/token":82,"./hack":9}],58:[function(a,b,c){function d(a){return e(g["*"],f(a))}function e(a,b){for(var c in a){var d=a[c];"object"!=typeof d||Array.isArray(d)?b[c]=c in b?b[c]:d:b[c]=e(d,b[c]||{})}return b}function f(a){if("object"==typeof a)return a;if(!/[,\+\-]/.test(a))return g[a]||g["*"];var b=a.split(","),c=b[0]in g?g[b.shift()]:g["*"];return a={},b.forEach(function(b){var c="+"==b[0],d=b.substring(1).split("."),e=d[0],f=d[1];a[e]=a[e]||{},a[e][f]=c}),e(c,a)}var g={"*":{colors:{opacity:!0},properties:{backgroundClipMerging:!0,backgroundOriginMerging:!0,backgroundSizeMerging:!0,colors:!0,ieBangHack:!1,ieFilters:!1,iePrefixHack:!1,ieSuffixHack:!1,merging:!0,shorterLengthUnits:!1,spaceAfterClosingBrace:!0,urlQuotes:!1,zeroUnits:!0},selectors:{adjacentSpace:!1,ie7Hack:!1,mergeablePseudoClasses:[":active",":after",":before",":empty",":checked",":disabled",":empty",":enabled",":first-child",":first-letter",":first-line",":first-of-type",":focus",":hover",":lang",":last-child",":last-of-type",":link",":not",":nth-child",":nth-last-child",":nth-last-of-type",":nth-of-type",":only-child",":only-of-type",":root",":target",":visited"],mergeablePseudoElements:["::after","::before","::first-letter","::first-line"]},units:{ch:!0,in:!0,pc:!0,pt:!0,rem:!0,vh:!0,vm:!0,vmax:!0,vmin:!0,vw:!0}}};g.ie11=g["*"],g.ie10=g["*"],g.ie9=e(g["*"],{properties:{ieFilters:!0,ieSuffixHack:!0}}),g.ie8=e(g.ie9,{colors:{opacity:!1},properties:{backgroundClipMerging:!1,backgroundOriginMerging:!1,backgroundSizeMerging:!1,iePrefixHack:!0,merging:!1},selectors:{mergeablePseudoClasses:[":after",":before",":first-child",":first-letter",":focus",":hover",":visited"],mergeablePseudoElements:[]},units:{ch:!1,rem:!1,vh:!1,vm:!1,vmax:!1,vmin:!1,vw:!1}}),g.ie7=e(g.ie8,{properties:{ieBangHack:!0},selectors:{ie7Hack:!0,mergeablePseudoClasses:[":first-child",":first-letter",":hover",":visited"]}}),b.exports=d},{}],59:[function(a,b,c){function d(a){var b={};return b[l.AfterAtRule]=a,b[l.AfterBlockBegins]=a,b[l.AfterBlockEnds]=a,b[l.AfterComment]=a,b[l.AfterProperty]=a,b[l.AfterRuleBegins]=a,b[l.AfterRuleEnds]=a,b[l.BeforeBlockEnds]=a,b[l.BetweenSelectors]=a,b}function e(a){var b={};return b[n.AroundSelectorRelation]=a,b[n.BeforeBlockBegins]=a,b[n.BeforeValue]=a,b}function f(a){return void 0!==a&&a!==!1&&("object"==typeof a&&"indentBy"in a&&(a=k(a,{indentBy:parseInt(a.indentBy)})),"object"==typeof a&&"indentWith"in a&&(a=k(a,{indentWith:j(a.indentWith)})),"object"==typeof a?k(o,a):"object"==typeof a?k(o,a):"string"==typeof a&&a==p?k(o,{breaks:d(!0),indentBy:2,spaces:e(!0)}):"string"==typeof a&&a==q?k(o,{breaks:{afterAtRule:!0,afterBlockBegins:!0,afterBlockEnds:!0,afterComment:!0,afterRuleEnds:!0,beforeBlockEnds:!0}}):"string"==typeof a?k(o,g(a)):o)}function g(a){return a.split(r).reduce(function(a,b){var c=b.split(s),d=c[0],e=c[1];return"breaks"==d||"spaces"==d?a[d]=h(e):"indentBy"==d||"wrapAt"==d?a[d]=parseInt(e):"indentWith"==d&&(a[d]=j(e)),a},{})}function h(a){return a.split(t).reduce(function(a,b){var c=b.split(u),d=c[0],e=c[1];return a[d]=i(e),a},{})}function i(a){switch(a){case v:case w:return!1;case x:case y:return!0;default:return a}}function j(a){switch(a){case"space":return m.Space;case"tab":return m.Tab;default:return a}}var k=a("../utils/override"),l={AfterAtRule:"afterAtRule",AfterBlockBegins:"afterBlockBegins",AfterBlockEnds:"afterBlockEnds",AfterComment:"afterComment",AfterProperty:"afterProperty",AfterRuleBegins:"afterRuleBegins",AfterRuleEnds:"afterRuleEnds",BeforeBlockEnds:"beforeBlockEnds",BetweenSelectors:"betweenSelectors"},m={Space:" ",Tab:"\t"},n={AroundSelectorRelation:"aroundSelectorRelation",BeforeBlockBegins:"beforeBlockBegins",BeforeValue:"beforeValue"},o={breaks:d(!1),indentBy:0,indentWith:m.Space,spaces:e(!1),wrapAt:!1},p="beautify",q="keep-breaks",r=";",s=":",t=",",u="=",v="false",w="off",x="true",y="on";b.exports={Breaks:l,Spaces:n,formatFrom:f}},{"../utils/override":94}],60:[function(a,b,c){(function(c){function d(a){return g(e(c.env.HTTP_PROXY||c.env.http_proxy),a||{})}function e(a){return a?{hostname:f.parse(a).hostname,port:parseInt(f.parse(a).port)}:{}}var f=a("url"),g=a("../utils/override");b.exports=d}).call(this,a("_process"))},{"../utils/override":94,_process:112,url:159}],61:[function(a,b,c){function d(a){return a||e}var e=5e3;b.exports=d},{}],62:[function(a,b,c){function d(a){return Array.isArray(a)?a:void 0===a?["local"]:a.split(",")}b.exports=d},{}],63:[function(a,b,c){function d(){}function e(a){var b=k(m,{}),c=l.Zero,d=l.One,e=l.Two;return void 0===a?(delete b[e],b):("string"==typeof a&&(a=parseInt(a)),"number"==typeof a&&a===parseInt(e)?b:"number"==typeof a&&a===parseInt(d)?(delete b[e],b):"number"==typeof a&&a===parseInt(c)?(delete b[e],delete b[d],b):("object"==typeof a&&(a=h(a)),d in a&&"roundingPrecision"in a[d]&&(a[d].roundingPrecision=j(a[d].roundingPrecision)),(c in a||d in a||e in a)&&(b[c]=k(b[c],a[c])),d in a&&n in a[d]&&(b[d]=k(b[d],f(d,g(a[d][n]))),delete a[d][n]),d in a&&o in a[d]&&(b[d]=k(b[d],f(d,g(a[d][o]))),delete a[d][o]),d in a||e in a?b[d]=k(b[d],a[d]):delete b[d],e in a&&n in a[e]&&(b[e]=k(b[e],f(e,g(a[e][n]))),delete a[e][n]),e in a&&o in a[e]&&(b[e]=k(b[e],f(e,g(a[e][o]))),delete a[e][o]),e in a?b[e]=k(b[e],a[e]):delete b[e],b))}function f(a,b){var c,d=k(m[a],{});for(c in d)"boolean"==typeof d[c]&&(d[c]=b);return d}function g(a){switch(a){case p:case q:return!1;case r:case s:return!0;default:return a}}function h(a){var b,c,d=k(a,{});for(c=0;c<=2;c++)b=""+c,b in d&&(void 0===d[b]||d[b]===!1)&&delete d[b],b in d&&d[b]===!0&&(d[b]={}),b in d&&"string"==typeof d[b]&&(d[b]=i(d[b],b));return d}function i(a,b){return a.split(t).reduce(function(a,c){var d=c.split(u),e=d[0],h=d[1],i=g(h);return n==e||o==e?a=k(a,f(b,i)):a[e]=i,a},{})}var j=a("./rounding-precision").roundingPrecisionFrom,k=a("../utils/override"),l={Zero:"0",One:"1",Two:"2"},m={};m[l.Zero]={},m[l.One]={cleanupCharsets:!0,normalizeUrls:!0,optimizeBackground:!0,optimizeBorderRadius:!0,optimizeFilter:!0,optimizeFont:!0,optimizeFontWeight:!0,optimizeOutline:!0,removeNegativePaddings:!0,removeQuotes:!0,removeWhitespace:!0,replaceMultipleZeros:!0,replaceTimeUnits:!0,replaceZeroUnits:!0,roundingPrecision:j(void 0),selectorsSortingMethod:"standard",specialComments:"all",tidyAtRules:!0,tidyBlockScopes:!0,tidySelectors:!0,transform:d},m[l.Two]={mergeAdjacentRules:!0,mergeIntoShorthands:!0,mergeMedia:!0,mergeNonAdjacentRules:!0,mergeSemantically:!1,overrideProperties:!0,reduceNonAdjacentRules:!0,removeDuplicateFontRules:!0,removeDuplicateMediaBlocks:!0,removeDuplicateRules:!0,restructureRules:!1};var n="*",o="all",p="false",q="off",r="true",s="on",t=";",u=":";b.exports={OptimizationLevel:l,optimizationLevelFrom:e}},{"../utils/override":94,"./rounding-precision":66}],64:[function(a,b,c){(function(c){function d(a){return a?e.resolve(a):c.cwd()}var e=a("path");b.exports=d}).call(this,a("_process"))},{_process:112,path:110}],65:[function(a,b,c){function d(a){return void 0===a||!!a}b.exports=d},{}],66:[function(a,b,c){function d(a){return g(e(j),f(a))}function e(a){return{ch:a,cm:a,em:a,ex:a,in:a,mm:a,pc:a,pt:a,px:a,q:a,rem:a,vh:a,vmax:a,vmin:a,vw:a,"%":a}}function f(a){return null===a||void 0===a?{}:"boolean"==typeof a?{}:"number"==typeof a&&a==-1?e(j):"number"==typeof a?e(a):"string"==typeof a&&h.test(a)?e(parseInt(a)):"string"==typeof a&&a==j?e(j):"object"==typeof a?a:a.split(k).reduce(function(a,b){var c=b.split(l),d=c[0],f=parseInt(c[1]);return(isNaN(f)||f==-1)&&(f=j),i.indexOf(d)>-1?a=g(a,e(f)):a[d]=f,a},{})}var g=a("../utils/override"),h=/^\d+$/,i=["*","all"],j="off",k=",",l="=";b.exports={DEFAULT:j,roundingPrecisionFrom:d}},{"../utils/override":94}],67:[function(a,b,c){(function(c,d){function e(a,b,c){var d={callback:c,index:0,inline:b.options.inline,inlineRequest:b.options.inlineRequest,inlineTimeout:b.options.inlineTimeout,inputSourceMapTracker:b.inputSourceMapTracker,localOnly:b.localOnly,processedTokens:[],rebaseTo:b.options.rebaseTo,sourceTokens:a,warnings:b.warnings};return a.length>0?f(d):c(a)}function f(a){var b,c,d,e=[],f=g(a.sourceTokens[0]);for(d=a.sourceTokens.length;a.indexi;)k.column--,e=a[j].originalPositionFor(k);return null===e.line&&f>1&&d>0?g(a,[f-1,i,j],c,d-1):null!==e.line?h(e):b}function h(a){return[a.line,a.column,a.source]}function i(a,b,c){a[b]=new j(c)}var j=a("source-map").SourceMapConsumer;b.exports=d},{"source-map":151}],70:[function(a,b,c){function d(a,b,c){var h,k,l,m,n,o,p=!0;if(0===c.length)return!1;for(b&&!i(a)&&(a=j+a),h=b?g.parse(a).host:a,k=b?a:f.resolve(a),o=0;o399?l(e.statusCode,null):e.statusCode>299?(f=g.resolve(a,e.headers.location),d(f,b,c,l)):(e.on("data",function(a){h.push(a.toString())}),void e.on("end",function(){var a=h.join("");l(null,a)}))}).on("error",function(a){p||(p=!0,l(a.message,null))}).on("timeout",function(){p||(p=!0,l("timeout",null))}).setTimeout(c)}var e=a("http"),f=a("https"),g=a("url"),h=a("../utils/is-http-resource"),i=a("../utils/is-https-resource"),j=a("../utils/override"),k="http:";b.exports=d},{"../utils/is-http-resource":89,"../utils/is-https-resource":90,"../utils/override":94,http:152,https:103,url:159}],73:[function(a,b,c){function d(a){return e.exec(a)}var e=/^data:(\S*?)?(;charset=[^;]+)?(;[^,]+?)?,(.+)/;b.exports=d},{}],74:[function(a,b,c){function d(a){return a.replace(f,e)}var e="/",f=/\\/g;b.exports=d},{}],75:[function(a,b,c){(function(c,d){function e(a,b,c){return f(a,b,function(a){return v(a,b,function(){return b.options.sourceMapInlineSources?y(b,function(){return c(a)}):c(a)})})}function f(a,b,d){return"string"==typeof a?g(a,b,d):c.isBuffer(a)?g(a.toString(),b,d):Array.isArray(a)?h(a,b,d):"object"==typeof a?i(a,b,d):void 0}function g(a,b,c){return b.source=void 0,b.sourcesContent[void 0]=a,b.stats.originalSize+=a.length,l(a,b,{inline:b.options.inline},c)}function h(a,b,c){var d=a.reduce(function(a,b){var c=L(b)?b:A(b);return a.push(k(c)),a},[]);return l(d.join(""),b,{inline:["all"]},c)}function i(a,b,c){var d,e,f,g=[];for(d in a)f=a[d],e=L(d)?d:A(d),g.push(k(e)),b.sourcesContent[e]=f.styles,f.sourceMap&&j(f.sourceMap,e,b);return l(g.join(""),b,{inline:["all"]},c)}function j(a,b,c){var d="string"==typeof a?JSON.parse(a):a,e=L(b)?D(d,b):C(d,b||M,c.options.rebaseTo);c.inputSourceMapTracker.track(b,e)}function k(a){var b,c,d=u.resolve("");return L(a)?E(a,"")+H.SEMICOLON:(b=J(a)?a:u.resolve(a),c=u.relative(d,b),E(c,"")+H.SEMICOLON)}function l(a,b,c,d){var e,f={};return b.source?L(b.source)?(f.fromBase=b.source,f.toBase=b.source):J(b.source)?(f.fromBase=u.dirname(b.source),f.toBase=b.options.rebaseTo):(f.fromBase=u.dirname(u.resolve(b.source)),f.toBase=b.options.rebaseTo):(f.fromBase=u.resolve(""),f.toBase=b.options.rebaseTo),e=F(a,b),e=B(e,b.options.rebase,b.validator,f),m(c.inline)?n(e,b,c,d):d(e)}function m(a){return!(1==a.length&&"none"==a[0])}function n(a,b,c,d){var e={afterContent:!1,callback:d,errors:b.errors,externalContext:b,inlinedStylesheets:c.inlinedStylesheets||b.inlinedStylesheets,inline:c.inline,inlineRequest:b.options.inlineRequest,inlineTimeout:b.options.inlineTimeout,isRemote:c.isRemote||!1,localOnly:b.localOnly,outputTokens:[],rebaseTo:b.options.rebaseTo,sourceTokens:a,warnings:b.warnings};return o(e)}function o(a){var b,c,d;for(c=0,d=a.sourceTokens.length;c-1?(e.warnings.push('Ignoring remote @import of "'+a+'" as it has already been imported.'),e.sourceTokens=e.sourceTokens.slice(1),o(e)):e.localOnly&&e.afterContent?(e.warnings.push('Ignoring remote @import of "'+a+'" as no callback given and after other content.'),e.sourceTokens=e.sourceTokens.slice(1),o(e)):j?(e.warnings.push('Skipping remote @import of "'+a+'" as no protocol given.'),e.outputTokens=e.outputTokens.concat(e.sourceTokens.slice(0,1)),e.sourceTokens=e.sourceTokens.slice(1),o(e)):e.localOnly&&!i?(e.warnings.push('Skipping remote @import of "'+a+'" as no callback given.'),e.outputTokens=e.outputTokens.concat(e.sourceTokens.slice(0,1)),e.sourceTokens=e.sourceTokens.slice(1),o(e)):!g&&e.afterContent?(e.warnings.push('Ignoring remote @import of "'+a+'" as resource is not allowed and after other content.'),e.sourceTokens=e.sourceTokens.slice(1),o(e)):g?(e.inlinedStylesheets.push(a),i?f(null,e.externalContext.sourcesContent[a]):z(a,e.inlineRequest,e.inlineTimeout,f)):(e.warnings.push('Skipping remote @import of "'+a+'" as resource is not allowed.'),e.outputTokens=e.outputTokens.concat(e.sourceTokens.slice(0,1)),e.sourceTokens=e.sourceTokens.slice(1),o(e))}function r(a,b,c,d){var e,f,g=u.resolve(""),h=J(a)?u.resolve(g,a.substring(1)):u.resolve(d.rebaseTo,a),i=u.relative(g,h),j=x(a,!1,d.inline),k=A(i),m=k in d.externalContext.sourcesContent;return d.inlinedStylesheets.indexOf(h)>-1?d.warnings.push('Ignoring local @import of "'+a+'" as it has already been imported.'):m||t.existsSync(h)&&t.statSync(h).isFile()?!j&&d.afterContent?d.warnings.push('Ignoring local @import of "'+a+'" as resource is not allowed and after other content.'):d.afterContent?d.warnings.push('Ignoring local @import of "'+a+'" as after other content.'):j?(e=m?d.externalContext.sourcesContent[k]:t.readFileSync(h,"utf-8"),d.inlinedStylesheets.push(h),d.inline=d.externalContext.options.inline,d.externalContext.source=k,d.externalContext.sourcesContent[k]=e,d.externalContext.stats.originalSize+=e.length,f=l(e,d.externalContext,d,function(a){return a}),f=s(f,b,c),d.outputTokens=d.outputTokens.concat(f)):(d.warnings.push('Skipping local @import of "'+a+'" as resource is not allowed.'),d.outputTokens=d.outputTokens.concat(d.sourceTokens.slice(0,1))):d.errors.push('Ignoring local @import of "'+a+'" as resource is missing.'),d.sourceTokens=d.sourceTokens.slice(1),o(d)}function s(a,b,c){return b?[[G.NESTED_BLOCK,[[G.NESTED_BLOCK_SCOPE,"@media "+b,c]],a]]:a; +}var t=a("fs"),u=a("path"),v=a("./apply-source-maps"),w=a("./extract-import-url-and-media"),x=a("./is-allowed-resource"),y=a("./load-original-sources"),z=a("./load-remote-resource"),A=a("./normalize-path"),B=a("./rebase"),C=a("./rebase-local-map"),D=a("./rebase-remote-map"),E=a("./restore-import"),F=a("../tokenizer/tokenize"),G=a("../tokenizer/token"),H=a("../tokenizer/marker"),I=a("../utils/has-protocol"),J=a("../utils/is-absolute-resource"),K=a("../utils/is-import"),L=a("../utils/is-remote-resource"),M="uri:unknown";b.exports=e}).call(this,{isBuffer:a("../../../is-buffer/index.js")},a("_process"))},{"../../../is-buffer/index.js":106,"../tokenizer/marker":81,"../tokenizer/token":82,"../tokenizer/tokenize":83,"../utils/has-protocol":86,"../utils/is-absolute-resource":87,"../utils/is-import":91,"../utils/is-remote-resource":92,"./apply-source-maps":67,"./extract-import-url-and-media":68,"./is-allowed-resource":70,"./load-original-sources":71,"./load-remote-resource":72,"./normalize-path":74,"./rebase":78,"./rebase-local-map":76,"./rebase-remote-map":77,"./restore-import":79,_process:112,fs:3,path:110}],76:[function(a,b,c){function d(a,b,c){var d=e.resolve(""),f=e.resolve(d,b),g=e.dirname(f);return a.sources=a.sources.map(function(a){return e.relative(c,e.resolve(g,a))}),a}var e=a("path");b.exports=d},{path:110}],77:[function(a,b,c){function d(a,b){var c=e.dirname(b);return a.sources=a.sources.map(function(a){return f.resolve(c,a)}),a}var e=a("path"),f=a("url");b.exports=d},{path:110,url:159}],78:[function(a,b,c){function d(a,b,c,d){return b?e(a,c,d):f(a,c,d)}function e(a,b,c){var d,f,j;for(f=0,j=a.length;f-1?s:a.indexOf(s)>-1?t:n(a)||o(a)?t:""}function n(a){return B.test(a)}function o(a){return y.test(a)}function p(a,b,c){var e=a.replace(z,"").replace(A,"").trim(),f=e.replace(w,"").replace(x,"").trim(),g=e[0]==t||e[0]==s?e[0]:m(f);return c?d(f,b):u+g+d(f,b)+g+v}var q=a("path"),r=a("url"),s='"',t="'",u="url(",v=")",w=/^["']/,x=/["']$/,y=/[\(\)]/,z=/^url\(/i,A=/\)$/,B=/\s/,C="win32"==c.platform;b.exports=p}).call(this,a("_process"))},{_process:112,path:110,url:159}],81:[function(a,b,c){var d={ASTERISK:"*",AT:"@",BACK_SLASH:"\\",CLOSE_CURLY_BRACKET:"}",CLOSE_ROUND_BRACKET:")",CLOSE_SQUARE_BRACKET:"]",COLON:":",COMMA:",",DOUBLE_QUOTE:'"',EXCLAMATION:"!",FORWARD_SLASH:"/",NEW_LINE_NIX:"\n",NEW_LINE_WIN:"\r",OPEN_CURLY_BRACKET:"{",OPEN_ROUND_BRACKET:"(",OPEN_SQUARE_BRACKET:"[",SEMICOLON:";",SINGLE_QUOTE:"'",SPACE:" ",TAB:"\t",UNDERSCORE:"_"};b.exports=d},{}],82:[function(a,b,c){var d={AT_RULE:"at-rule",AT_RULE_BLOCK:"at-rule-block",AT_RULE_BLOCK_SCOPE:"at-rule-block-scope",COMMENT:"comment",NESTED_BLOCK:"nested-block",NESTED_BLOCK_SCOPE:"nested-block-scope",PROPERTY:"property",PROPERTY_BLOCK:"property-block",PROPERTY_NAME:"property-name",PROPERTY_VALUE:"property-value",RULE:"rule",RULE_SCOPE:"rule-scope"};b.exports=d},{}],83:[function(a,b,c){function d(a,b){var c={level:l.BLOCK,position:{source:b.source||void 0,line:1,column:0,index:0}};return e(a,b,c,!1)}function e(a,b,c,d){for(var m,n,p,q,r,s,t,u,v,w,x,y,z=[],A=z,B=[],C=[],D=c.level,E=[],F=[],G=[],H=0,I=!1,J=!1,K=!1,L=!1,M=c.position;M.index1)C.push(q),F.push(N),G.push(F.slice(0,F.length-2)),F=F.slice(F.length-2),q=[M.line,M.column-1,M.source],E.push(D),D=l.COMMENT;else if(w)E.push(D),D=l.COMMENT,F.push(N);else if(x)r=F.join("").trim()+N,m=[j.COMMENT,r,[f(q,r,b)]],A.push(m),D=E.pop(),q=C.pop()||null,F=G.pop()||[];else if(N!=i.SINGLE_QUOTE||s)if(N==i.SINGLE_QUOTE&&D==l.SINGLE_QUOTE)D=E.pop(),F.push(N);else if(N!=i.DOUBLE_QUOTE||s)if(N==i.DOUBLE_QUOTE&&D==l.DOUBLE_QUOTE)D=E.pop(),F.push(N);else if(!w&&!x&&N!=i.CLOSE_ROUND_BRACKET&&N!=i.OPEN_ROUND_BRACKET&&D!=l.COMMENT&&!s&&H>0)F.push(N);else if(N!=i.OPEN_ROUND_BRACKET||s||D==l.COMMENT||K)if(N!=i.CLOSE_ROUND_BRACKET||s||D==l.COMMENT||K)if(N==i.SEMICOLON&&D==l.BLOCK&&F[0]==i.AT)r=F.join("").trim(),z.push([j.AT_RULE,r,[f(q,r,b)]]),F=[];else if(N==i.COMMA&&D==l.BLOCK&&n)r=F.join("").trim(),n[1].push([h(n[0]),r,[f(q,r,b,n[1].length)]]),F=[];else if(N==i.COMMA&&D==l.BLOCK&&g(F)==j.AT_RULE)F.push(N);else if(N==i.COMMA&&D==l.BLOCK)n=[g(F),[],[]],r=F.join("").trim(),n[1].push([h(n[0]),r,[f(q,r,b,0)]]),F=[];else if(N==i.OPEN_CURLY_BRACKET&&D==l.BLOCK&&n&&n[0]==j.NESTED_BLOCK)r=F.join("").trim(),n[1].push([j.NESTED_BLOCK_SCOPE,r,[f(q,r,b)]]),z.push(n),E.push(D),M.column++,M.index++,F=[],n[2]=e(a,b,c,!0),n=null;else if(N==i.OPEN_CURLY_BRACKET&&D==l.BLOCK&&g(F)==j.NESTED_BLOCK)r=F.join("").trim(),n=n||[j.NESTED_BLOCK,[],[]],n[1].push([j.NESTED_BLOCK_SCOPE,r,[f(q,r,b)]]),z.push(n),E.push(D),M.column++,M.index++,F=[],n[2]=e(a,b,c,!0),n=null;else if(N==i.OPEN_CURLY_BRACKET&&D==l.BLOCK)r=F.join("").trim(),n=n||[g(F),[],[]],n[1].push([h(n[0]),r,[f(q,r,b,n[1].length)]]),A=n[2],z.push(n),E.push(D),D=l.RULE,F=[];else if(N==i.OPEN_CURLY_BRACKET&&D==l.RULE&&K)B.push(n),n=[j.PROPERTY_BLOCK,[]],p.push(n),A=n[1],E.push(D),D=l.RULE,K=!1;else if(N!=i.COLON||D!=l.RULE||K)if(N==i.SEMICOLON&&D==l.RULE&&p&&B.length>0&&F.length>0&&F[0]==i.AT)r=F.join("").trim(),n[1].push([j.AT_RULE,r,[f(q,r,b)]]),F=[];else if(N==i.SEMICOLON&&D==l.RULE&&p&&F.length>0)r=F.join("").trim(),p.push([j.PROPERTY_VALUE,r,[f(q,r,b)]]),p=null,K=!1,F=[];else if(N==i.SEMICOLON&&D==l.RULE&&p&&0===F.length)K=!1;else if(N==i.SEMICOLON&&D==l.RULE&&F.length>0&&F[0]==i.AT)r=F.join(""),A.push([j.AT_RULE,r,[f(q,r,b)]]),K=!1,F=[];else if(N==i.SEMICOLON&&D==l.RULE&&L)L=!1,F=[];else if(N==i.SEMICOLON&&D==l.RULE&&0===F.length);else if(N==i.CLOSE_CURLY_BRACKET&&D==l.RULE&&p&&K&&F.length>0&&B.length>0)r=F.join(""),p.push([j.PROPERTY_VALUE,r,[f(q,r,b)]]),p=null,n=B.pop(),A=n[2],D=E.pop(),K=!1,F=[];else if(N==i.CLOSE_CURLY_BRACKET&&D==l.RULE&&p&&F.length>0&&F[0]==i.AT&&B.length>0)r=F.join(""),n[1].push([j.AT_RULE,r,[f(q,r,b)]]),p=null,n=B.pop(),A=n[2],D=E.pop(),K=!1,F=[];else if(N==i.CLOSE_CURLY_BRACKET&&D==l.RULE&&p&&B.length>0)p=null,n=B.pop(),A=n[2],D=E.pop(),K=!1;else if(N==i.CLOSE_CURLY_BRACKET&&D==l.RULE&&p&&F.length>0)r=F.join(""),p.push([j.PROPERTY_VALUE,r,[f(q,r,b)]]),p=null,n=B.pop(),A=z,D=E.pop(),K=!1,F=[];else if(N==i.CLOSE_CURLY_BRACKET&&D==l.RULE&&F.length>0&&F[0]==i.AT)n=null,r=F.join("").trim(),A.push([j.AT_RULE,r,[f(q,r,b)]]),A=z,D=E.pop(),K=!1,F=[];else if(N==i.CLOSE_CURLY_BRACKET&&D==l.RULE&&E[E.length-1]==l.RULE)n=B.pop(),A=n[2],D=E.pop(),K=!1,L=!0,F=[];else if(N==i.CLOSE_CURLY_BRACKET&&D==l.RULE)n=null,A=z,D=E.pop(),K=!1;else if(N==i.CLOSE_CURLY_BRACKET&&D==l.BLOCK&&!d&&M.index<=a.length-1)b.warnings.push("Unexpected '}' at "+k([M.line,M.column,M.source])+"."),F.push(N);else{if(N==i.CLOSE_CURLY_BRACKET&&D==l.BLOCK)break;N==i.OPEN_ROUND_BRACKET&&D==l.RULE&&K?(F.push(N),H++):N==i.CLOSE_ROUND_BRACKET&&D==l.RULE&&K&&1==H?(F.push(N),r=F.join("").trim(),p.push([j.PROPERTY_VALUE,r,[f(q,r,b)]]),H--,F=[]):N==i.CLOSE_ROUND_BRACKET&&D==l.RULE&&K?(F.push(N),H--):N==i.FORWARD_SLASH&&a[M.index+1]!=i.ASTERISK&&D==l.RULE&&K&&F.length>0?(r=F.join("").trim(),p.push([j.PROPERTY_VALUE,r,[f(q,r,b)]]),p.push([j.PROPERTY_VALUE,N,[[M.line,M.column,M.source]]]),F=[]):N==i.FORWARD_SLASH&&a[M.index+1]!=i.ASTERISK&&D==l.RULE&&K?(p.push([j.PROPERTY_VALUE,N,[[M.line,M.column,M.source]]]),F=[]):N==i.COMMA&&D==l.RULE&&K&&F.length>0?(r=F.join("").trim(),p.push([j.PROPERTY_VALUE,r,[f(q,r,b)]]),p.push([j.PROPERTY_VALUE,N,[[M.line,M.column,M.source]]]),F=[]):N==i.COMMA&&D==l.RULE&&K?(p.push([j.PROPERTY_VALUE,N,[[M.line,M.column,M.source]]]),F=[]):(t||u&&!v)&&D==l.RULE&&K&&p&&F.length>0?(r=F.join("").trim(),p.push([j.PROPERTY_VALUE,r,[f(q,r,b)]]),F=[]):v&&D==l.RULE&&K&&p&&F.length>1?(r=F.join("").trim(),p.push([j.PROPERTY_VALUE,r,[f(q,r,b)]]),F=[]):v&&D==l.RULE&&K?F=[]:1==F.length&&v?F.pop():(F.length>0||!t&&!u&&!v)&&F.push(N)}else r=F.join("").trim(),p=[j.PROPERTY,[j.PROPERTY_NAME,r,[f(q,r,b)]]],A.push(p),K=!0,F=[];else F.push(N),H--;else F.push(N),H++;else E.push(D),D=l.DOUBLE_QUOTE,F.push(N);else E.push(D),D=l.SINGLE_QUOTE,F.push(N);else F.push(N);y=N==i.BACK_SLASH,I=w,J=x,M.line=v||u?M.line+1:M.line,M.column=v||u?0:M.column+1}return K&&b.warnings.push("Missing '}' at "+k([M.line,M.column,M.source])+"."),K&&F.length>0&&(r=F.join("").replace(o,""),p.push([j.PROPERTY_VALUE,r,[f(q,r,b)]]),F=[]),F.length>0&&b.warnings.push("Invalid character(s) '"+F.join("")+"' at "+k(q)+". Ignoring."),z}function f(a,b,c,d){var e=a[2];return c.inputSourceMapTracker.isTracking(e)?c.inputSourceMapTracker.originalPositionFor(a,b.length,d):a}function g(a){var b=a[0]==i.AT||a[0]==i.UNDERSCORE,c=a.join("").split(/\s/)[0];return b&&n.indexOf(c)>-1?j.NESTED_BLOCK:b&&m.indexOf(c)>-1?j.AT_RULE:b?j.AT_RULE_BLOCK:j.RULE}function h(a){return a==j.RULE?j.RULE_SCOPE:a==j.NESTED_BLOCK?j.NESTED_BLOCK_SCOPE:a==j.AT_RULE_BLOCK?j.AT_RULE_BLOCK_SCOPE:void 0}var i=a("./marker"),j=a("./token"),k=a("../utils/format-position"),l={BLOCK:"block",COMMENT:"comment",DOUBLE_QUOTE:"double-quote",RULE:"rule",SINGLE_QUOTE:"single-quote"},m=["@charset","@import"],n=["@-moz-document","@document","@-moz-keyframes","@-ms-keyframes","@-o-keyframes","@-webkit-keyframes","@keyframes","@media","@supports"],o=/[\s|\}]*$/;b.exports=d},{"../utils/format-position":85,"./marker":81,"./token":82}],84:[function(a,b,c){function d(a){for(var b=a.slice(0),c=0,e=b.length;cd?1:-1;return i.length>j.length?1:i.length==j.length?0:-1}function e(a){return""+parseInt(a)==a?parseInt(a):a}var f=/([0-9]+)/;b.exports=d},{}],94:[function(a,b,c){function d(a,b){var c,e,f,g={};for(c in a)f=a[c],Array.isArray(f)?g[c]=f.slice(0):"object"==typeof f&&null!==f?g[c]=d(f,{}):g[c]=f;for(e in b)f=b[e],e in g&&Array.isArray(f)?g[e]=f.slice(0):e in g&&"object"==typeof f&&null!==f?g[e]=d(g[e],f):g[e]=f;return g}b.exports=d},{}],95:[function(a,b,c){function d(a,b){var c,d,f=e.OPEN_ROUND_BRACKET,g=e.CLOSE_ROUND_BRACKET,h=0,i=0,j=0,k=a.length,l=[];if(a.indexOf(b)==-1)return[a];if(a.indexOf(f)==-1)return a.split(b);for(;i0&&i+1=0&&a[b][0]==D.COMMENT;b--);return b}function o(a,b,c,d){var e=a.store,f=b[c],g=f[2][0]==D.PROPERTY_BLOCK,h=ca.format.wrapAt&&(f(a,i),a.output.push(i))}function f(a,b){var c=b.split("\n");a.line+=c.length-1,a.column=c.length>1?0:a.column+c.pop().length}function g(a,b){var c={column:0,format:b.options.format,indentBy:0,indentWith:"",line:1,output:[],spaceAfterClosingBrace:b.options.compatibility.properties.spaceAfterClosingBrace,store:d,wrap:b.options.format.wrapAt?e:function(){}};return h(c,a),{styles:c.output.join("")}}var h=a("./helpers").all,i=a("os").EOL;b.exports=g},{"./helpers":96,os:109}],99:[function(a,b,c){(function(c){function d(a,b){var c="string"==typeof b,d=c?b:b[1],e=c?null:b[2],g=a.wrap;g(a,d),f(a,d,e),a.output.push(d)}function e(a,b){a.column+b.length>a.format.wrapAt&&(f(a,l,!1),a.output.push(l))}function f(a,b,c){var d=b.split("\n");c&&g(a,c),a.line+=d.length-1,a.column=d.length>1?0:a.column+d.pop().length}function g(a,b){for(var c=0,d=b.length;c0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),"function"==typeof console.trace&&console.trace())),this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){function c(){this.removeListener(a,c),d||(d=!0,b.apply(this,arguments))}if(!e(b))throw TypeError("listener must be a function");var d=!1;return c.listener=b,this.on(a,c),this},d.prototype.removeListener=function(a,b){var c,d,f,h;if(!e(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],f=c.length,d=-1,c===b||e(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(g(c)){for(h=f;h-- >0;)if(c[h]===b||c[h].listener&&c[h].listener===b){d=h;break}if(d<0)return this;1===c.length?(c.length=0,delete this._events[a]):c.splice(d,1),this._events.removeListener&&this.emit("removeListener",a,b)}return this},d.prototype.removeAllListeners=function(a){var b,c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(c=this._events[a],e(c))this.removeListener(a,c);else if(c)for(;c.length;)this.removeListener(a,c[c.length-1]);return delete this._events[a],this},d.prototype.listeners=function(a){var b;return b=this._events&&this._events[a]?e(this._events[a])?[this._events[a]]:this._events[a].slice():[]},d.prototype.listenerCount=function(a){if(this._events){var b=this._events[a];if(e(b))return 1;if(b)return b.length}return 0},d.listenerCount=function(a,b){return a.listenerCount(b)}},{}],102:[function(a,b,c){(function(a){!function(d){var e="object"==typeof c&&c,f="object"==typeof b&&b&&b.exports==e&&b,g="object"==typeof a&&a;g.global!==g&&g.window!==g||(d=g);var h=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,i=/[\x01-\x7F]/g,j=/[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,k=/<\u20D2|=\u20E5|>\u20D2|\u205F\u200A|\u219D\u0338|\u2202\u0338|\u2220\u20D2|\u2229\uFE00|\u222A\uFE00|\u223C\u20D2|\u223D\u0331|\u223E\u0333|\u2242\u0338|\u224B\u0338|\u224D\u20D2|\u224E\u0338|\u224F\u0338|\u2250\u0338|\u2261\u20E5|\u2264\u20D2|\u2265\u20D2|\u2266\u0338|\u2267\u0338|\u2268\uFE00|\u2269\uFE00|\u226A\u0338|\u226A\u20D2|\u226B\u0338|\u226B\u20D2|\u227F\u0338|\u2282\u20D2|\u2283\u20D2|\u228A\uFE00|\u228B\uFE00|\u228F\u0338|\u2290\u0338|\u2293\uFE00|\u2294\uFE00|\u22B4\u20D2|\u22B5\u20D2|\u22D8\u0338|\u22D9\u0338|\u22DA\uFE00|\u22DB\uFE00|\u22F5\u0338|\u22F9\u0338|\u2933\u0338|\u29CF\u0338|\u29D0\u0338|\u2A6D\u0338|\u2A70\u0338|\u2A7D\u0338|\u2A7E\u0338|\u2AA1\u0338|\u2AA2\u0338|\u2AAC\uFE00|\u2AAD\uFE00|\u2AAF\u0338|\u2AB0\u0338|\u2AC5\u0338|\u2AC6\u0338|\u2ACB\uFE00|\u2ACC\uFE00|\u2AFD\u20E5|[\xA0-\u0113\u0116-\u0122\u0124-\u012B\u012E-\u014D\u0150-\u017E\u0192\u01B5\u01F5\u0237\u02C6\u02C7\u02D8-\u02DD\u0311\u0391-\u03A1\u03A3-\u03A9\u03B1-\u03C9\u03D1\u03D2\u03D5\u03D6\u03DC\u03DD\u03F0\u03F1\u03F5\u03F6\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E\u045F\u2002-\u2005\u2007-\u2010\u2013-\u2016\u2018-\u201A\u201C-\u201E\u2020-\u2022\u2025\u2026\u2030-\u2035\u2039\u203A\u203E\u2041\u2043\u2044\u204F\u2057\u205F-\u2063\u20AC\u20DB\u20DC\u2102\u2105\u210A-\u2113\u2115-\u211E\u2122\u2124\u2127-\u2129\u212C\u212D\u212F-\u2131\u2133-\u2138\u2145-\u2148\u2153-\u215E\u2190-\u219B\u219D-\u21A7\u21A9-\u21AE\u21B0-\u21B3\u21B5-\u21B7\u21BA-\u21DB\u21DD\u21E4\u21E5\u21F5\u21FD-\u2205\u2207-\u2209\u220B\u220C\u220F-\u2214\u2216-\u2218\u221A\u221D-\u2238\u223A-\u2257\u2259\u225A\u225C\u225F-\u2262\u2264-\u228B\u228D-\u229B\u229D-\u22A5\u22A7-\u22B0\u22B2-\u22BB\u22BD-\u22DB\u22DE-\u22E3\u22E6-\u22F7\u22F9-\u22FE\u2305\u2306\u2308-\u2310\u2312\u2313\u2315\u2316\u231C-\u231F\u2322\u2323\u232D\u232E\u2336\u233D\u233F\u237C\u23B0\u23B1\u23B4-\u23B6\u23DC-\u23DF\u23E2\u23E7\u2423\u24C8\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2550-\u256C\u2580\u2584\u2588\u2591-\u2593\u25A1\u25AA\u25AB\u25AD\u25AE\u25B1\u25B3-\u25B5\u25B8\u25B9\u25BD-\u25BF\u25C2\u25C3\u25CA\u25CB\u25EC\u25EF\u25F8-\u25FC\u2605\u2606\u260E\u2640\u2642\u2660\u2663\u2665\u2666\u266A\u266D-\u266F\u2713\u2717\u2720\u2736\u2758\u2772\u2773\u27C8\u27C9\u27E6-\u27ED\u27F5-\u27FA\u27FC\u27FF\u2902-\u2905\u290C-\u2913\u2916\u2919-\u2920\u2923-\u292A\u2933\u2935-\u2939\u293C\u293D\u2945\u2948-\u294B\u294E-\u2976\u2978\u2979\u297B-\u297F\u2985\u2986\u298B-\u2996\u299A\u299C\u299D\u29A4-\u29B7\u29B9\u29BB\u29BC\u29BE-\u29C5\u29C9\u29CD-\u29D0\u29DC-\u29DE\u29E3-\u29E5\u29EB\u29F4\u29F6\u2A00-\u2A02\u2A04\u2A06\u2A0C\u2A0D\u2A10-\u2A17\u2A22-\u2A27\u2A29\u2A2A\u2A2D-\u2A31\u2A33-\u2A3C\u2A3F\u2A40\u2A42-\u2A4D\u2A50\u2A53-\u2A58\u2A5A-\u2A5D\u2A5F\u2A66\u2A6A\u2A6D-\u2A75\u2A77-\u2A9A\u2A9D-\u2AA2\u2AA4-\u2AB0\u2AB3-\u2AC8\u2ACB\u2ACC\u2ACF-\u2ADB\u2AE4\u2AE6-\u2AE9\u2AEB-\u2AF3\u2AFD\uFB00-\uFB04]|\uD835[\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDD6B]/g,l={"­":"shy","‌":"zwnj","‍":"zwj","‎":"lrm","⁣":"ic","⁢":"it","⁡":"af","‏":"rlm","​":"ZeroWidthSpace","⁠":"NoBreak","̑":"DownBreve","⃛":"tdot","⃜":"DotDot","\t":"Tab","\n":"NewLine"," ":"puncsp"," ":"MediumSpace"," ":"thinsp"," ":"hairsp"," ":"emsp13"," ":"ensp"," ":"emsp14"," ":"emsp"," ":"numsp"," ":"nbsp","  ":"ThickSpace","‾":"oline",_:"lowbar","‐":"dash","–":"ndash","—":"mdash","―":"horbar",",":"comma",";":"semi","⁏":"bsemi",":":"colon","⩴":"Colone","!":"excl","¡":"iexcl","?":"quest","¿":"iquest",".":"period","‥":"nldr","…":"mldr","·":"middot","'":"apos","‘":"lsquo","’":"rsquo","‚":"sbquo","‹":"lsaquo","›":"rsaquo",'"':"quot","“":"ldquo","”":"rdquo","„":"bdquo","«":"laquo","»":"raquo","(":"lpar",")":"rpar","[":"lsqb","]":"rsqb","{":"lcub","}":"rcub","⌈":"lceil","⌉":"rceil","⌊":"lfloor","⌋":"rfloor","⦅":"lopar","⦆":"ropar","⦋":"lbrke","⦌":"rbrke","⦍":"lbrkslu","⦎":"rbrksld","⦏":"lbrksld","⦐":"rbrkslu","⦑":"langd","⦒":"rangd","⦓":"lparlt","⦔":"rpargt","⦕":"gtlPar","⦖":"ltrPar","⟦":"lobrk","⟧":"robrk","⟨":"lang","⟩":"rang","⟪":"Lang","⟫":"Rang","⟬":"loang","⟭":"roang","❲":"lbbrk","❳":"rbbrk","‖":"Vert","§":"sect","¶":"para","@":"commat","*":"ast","/":"sol",undefined:null,"&":"amp","#":"num","%":"percnt","‰":"permil","‱":"pertenk","†":"dagger","‡":"Dagger","•":"bull","⁃":"hybull","′":"prime","″":"Prime","‴":"tprime","⁗":"qprime","‵":"bprime","⁁":"caret","`":"grave","´":"acute","˜":"tilde","^":"Hat","¯":"macr","˘":"breve","˙":"dot","¨":"die","˚":"ring","˝":"dblac","¸":"cedil","˛":"ogon","ˆ":"circ","ˇ":"caron","°":"deg","©":"copy","®":"reg","℗":"copysr","℘":"wp","℞":"rx","℧":"mho","℩":"iiota","←":"larr","↚":"nlarr","→":"rarr","↛":"nrarr","↑":"uarr","↓":"darr","↔":"harr","↮":"nharr","↕":"varr","↖":"nwarr","↗":"nearr","↘":"searr","↙":"swarr","↝":"rarrw","↝̸":"nrarrw","↞":"Larr","↟":"Uarr","↠":"Rarr","↡":"Darr","↢":"larrtl","↣":"rarrtl","↤":"mapstoleft","↥":"mapstoup","↦":"map","↧":"mapstodown","↩":"larrhk","↪":"rarrhk","↫":"larrlp","↬":"rarrlp","↭":"harrw","↰":"lsh","↱":"rsh","↲":"ldsh","↳":"rdsh","↵":"crarr","↶":"cularr","↷":"curarr","↺":"olarr","↻":"orarr","↼":"lharu","↽":"lhard","↾":"uharr","↿":"uharl","⇀":"rharu","⇁":"rhard","⇂":"dharr","⇃":"dharl","⇄":"rlarr","⇅":"udarr","⇆":"lrarr","⇇":"llarr","⇈":"uuarr","⇉":"rrarr","⇊":"ddarr","⇋":"lrhar","⇌":"rlhar","⇐":"lArr","⇍":"nlArr","⇑":"uArr","⇒":"rArr","⇏":"nrArr","⇓":"dArr","⇔":"iff","⇎":"nhArr","⇕":"vArr","⇖":"nwArr","⇗":"neArr","⇘":"seArr","⇙":"swArr","⇚":"lAarr","⇛":"rAarr","⇝":"zigrarr","⇤":"larrb","⇥":"rarrb","⇵":"duarr","⇽":"loarr","⇾":"roarr","⇿":"hoarr","∀":"forall","∁":"comp","∂":"part","∂̸":"npart","∃":"exist","∄":"nexist","∅":"empty","∇":"Del","∈":"in","∉":"notin","∋":"ni","∌":"notni","϶":"bepsi","∏":"prod","∐":"coprod","∑":"sum","+":"plus","±":"pm","÷":"div","×":"times","<":"lt","≮":"nlt","<⃒":"nvlt","=":"equals","≠":"ne","=⃥":"bne","⩵":"Equal",">":"gt","≯":"ngt",">⃒":"nvgt","¬":"not","|":"vert","¦":"brvbar","−":"minus","∓":"mp","∔":"plusdo","⁄":"frasl","∖":"setmn","∗":"lowast","∘":"compfn","√":"Sqrt","∝":"prop","∞":"infin","∟":"angrt","∠":"ang","∠⃒":"nang","∡":"angmsd","∢":"angsph","∣":"mid","∤":"nmid","∥":"par","∦":"npar","∧":"and","∨":"or","∩":"cap","∩︀":"caps","∪":"cup","∪︀":"cups","∫":"int","∬":"Int","∭":"tint","⨌":"qint","∮":"oint","∯":"Conint","∰":"Cconint","∱":"cwint","∲":"cwconint","∳":"awconint","∴":"there4","∵":"becaus","∶":"ratio","∷":"Colon","∸":"minusd","∺":"mDDot","∻":"homtht","∼":"sim","≁":"nsim","∼⃒":"nvsim","∽":"bsim","∽̱":"race","∾":"ac","∾̳":"acE","∿":"acd","≀":"wr","≂":"esim","≂̸":"nesim","≃":"sime","≄":"nsime","≅":"cong","≇":"ncong","≆":"simne","≈":"ap","≉":"nap","≊":"ape","≋":"apid","≋̸":"napid","≌":"bcong","≍":"CupCap","≭":"NotCupCap","≍⃒":"nvap","≎":"bump","≎̸":"nbump","≏":"bumpe","≏̸":"nbumpe","≐":"doteq","≐̸":"nedot","≑":"eDot","≒":"efDot","≓":"erDot","≔":"colone","≕":"ecolon","≖":"ecir","≗":"cire","≙":"wedgeq","≚":"veeeq","≜":"trie","≟":"equest","≡":"equiv","≢":"nequiv","≡⃥":"bnequiv","≤":"le","≰":"nle","≤⃒":"nvle","≥":"ge","≱":"nge","≥⃒":"nvge","≦":"lE","≦̸":"nlE","≧":"gE","≧̸":"ngE","≨︀":"lvnE","≨":"lnE","≩":"gnE","≩︀":"gvnE","≪":"ll","≪̸":"nLtv","≪⃒":"nLt","≫":"gg","≫̸":"nGtv","≫⃒":"nGt","≬":"twixt","≲":"lsim","≴":"nlsim","≳":"gsim","≵":"ngsim","≶":"lg","≸":"ntlg","≷":"gl","≹":"ntgl","≺":"pr","⊀":"npr","≻":"sc","⊁":"nsc","≼":"prcue","⋠":"nprcue","≽":"sccue","⋡":"nsccue","≾":"prsim","≿":"scsim","≿̸":"NotSucceedsTilde","⊂":"sub","⊄":"nsub","⊂⃒":"vnsub","⊃":"sup","⊅":"nsup","⊃⃒":"vnsup","⊆":"sube","⊈":"nsube","⊇":"supe","⊉":"nsupe","⊊︀":"vsubne","⊊":"subne","⊋︀":"vsupne","⊋":"supne","⊍":"cupdot","⊎":"uplus","⊏":"sqsub","⊏̸":"NotSquareSubset","⊐":"sqsup","⊐̸":"NotSquareSuperset","⊑":"sqsube","⋢":"nsqsube","⊒":"sqsupe","⋣":"nsqsupe","⊓":"sqcap","⊓︀":"sqcaps","⊔":"sqcup","⊔︀":"sqcups","⊕":"oplus","⊖":"ominus","⊗":"otimes","⊘":"osol","⊙":"odot","⊚":"ocir","⊛":"oast","⊝":"odash","⊞":"plusb","⊟":"minusb","⊠":"timesb","⊡":"sdotb","⊢":"vdash","⊬":"nvdash","⊣":"dashv","⊤":"top","⊥":"bot","⊧":"models","⊨":"vDash","⊭":"nvDash","⊩":"Vdash","⊮":"nVdash","⊪":"Vvdash","⊫":"VDash","⊯":"nVDash","⊰":"prurel","⊲":"vltri","⋪":"nltri","⊳":"vrtri","⋫":"nrtri","⊴":"ltrie","⋬":"nltrie","⊴⃒":"nvltrie","⊵":"rtrie","⋭":"nrtrie","⊵⃒":"nvrtrie","⊶":"origof","⊷":"imof","⊸":"mumap","⊹":"hercon","⊺":"intcal","⊻":"veebar","⊽":"barvee","⊾":"angrtvb", +"⊿":"lrtri","⋀":"Wedge","⋁":"Vee","⋂":"xcap","⋃":"xcup","⋄":"diam","⋅":"sdot","⋆":"Star","⋇":"divonx","⋈":"bowtie","⋉":"ltimes","⋊":"rtimes","⋋":"lthree","⋌":"rthree","⋍":"bsime","⋎":"cuvee","⋏":"cuwed","⋐":"Sub","⋑":"Sup","⋒":"Cap","⋓":"Cup","⋔":"fork","⋕":"epar","⋖":"ltdot","⋗":"gtdot","⋘":"Ll","⋘̸":"nLl","⋙":"Gg","⋙̸":"nGg","⋚︀":"lesg","⋚":"leg","⋛":"gel","⋛︀":"gesl","⋞":"cuepr","⋟":"cuesc","⋦":"lnsim","⋧":"gnsim","⋨":"prnsim","⋩":"scnsim","⋮":"vellip","⋯":"ctdot","⋰":"utdot","⋱":"dtdot","⋲":"disin","⋳":"isinsv","⋴":"isins","⋵":"isindot","⋵̸":"notindot","⋶":"notinvc","⋷":"notinvb","⋹":"isinE","⋹̸":"notinE","⋺":"nisd","⋻":"xnis","⋼":"nis","⋽":"notnivc","⋾":"notnivb","⌅":"barwed","⌆":"Barwed","⌌":"drcrop","⌍":"dlcrop","⌎":"urcrop","⌏":"ulcrop","⌐":"bnot","⌒":"profline","⌓":"profsurf","⌕":"telrec","⌖":"target","⌜":"ulcorn","⌝":"urcorn","⌞":"dlcorn","⌟":"drcorn","⌢":"frown","⌣":"smile","⌭":"cylcty","⌮":"profalar","⌶":"topbot","⌽":"ovbar","⌿":"solbar","⍼":"angzarr","⎰":"lmoust","⎱":"rmoust","⎴":"tbrk","⎵":"bbrk","⎶":"bbrktbrk","⏜":"OverParenthesis","⏝":"UnderParenthesis","⏞":"OverBrace","⏟":"UnderBrace","⏢":"trpezium","⏧":"elinters","␣":"blank","─":"boxh","│":"boxv","┌":"boxdr","┐":"boxdl","└":"boxur","┘":"boxul","├":"boxvr","┤":"boxvl","┬":"boxhd","┴":"boxhu","┼":"boxvh","═":"boxH","║":"boxV","╒":"boxdR","╓":"boxDr","╔":"boxDR","╕":"boxdL","╖":"boxDl","╗":"boxDL","╘":"boxuR","╙":"boxUr","╚":"boxUR","╛":"boxuL","╜":"boxUl","╝":"boxUL","╞":"boxvR","╟":"boxVr","╠":"boxVR","╡":"boxvL","╢":"boxVl","╣":"boxVL","╤":"boxHd","╥":"boxhD","╦":"boxHD","╧":"boxHu","╨":"boxhU","╩":"boxHU","╪":"boxvH","╫":"boxVh","╬":"boxVH","▀":"uhblk","▄":"lhblk","█":"block","░":"blk14","▒":"blk12","▓":"blk34","□":"squ","▪":"squf","▫":"EmptyVerySmallSquare","▭":"rect","▮":"marker","▱":"fltns","△":"xutri","▴":"utrif","▵":"utri","▸":"rtrif","▹":"rtri","▽":"xdtri","▾":"dtrif","▿":"dtri","◂":"ltrif","◃":"ltri","◊":"loz","○":"cir","◬":"tridot","◯":"xcirc","◸":"ultri","◹":"urtri","◺":"lltri","◻":"EmptySmallSquare","◼":"FilledSmallSquare","★":"starf","☆":"star","☎":"phone","♀":"female","♂":"male","♠":"spades","♣":"clubs","♥":"hearts","♦":"diams","♪":"sung","✓":"check","✗":"cross","✠":"malt","✶":"sext","❘":"VerticalSeparator","⟈":"bsolhsub","⟉":"suphsol","⟵":"xlarr","⟶":"xrarr","⟷":"xharr","⟸":"xlArr","⟹":"xrArr","⟺":"xhArr","⟼":"xmap","⟿":"dzigrarr","⤂":"nvlArr","⤃":"nvrArr","⤄":"nvHarr","⤅":"Map","⤌":"lbarr","⤍":"rbarr","⤎":"lBarr","⤏":"rBarr","⤐":"RBarr","⤑":"DDotrahd","⤒":"UpArrowBar","⤓":"DownArrowBar","⤖":"Rarrtl","⤙":"latail","⤚":"ratail","⤛":"lAtail","⤜":"rAtail","⤝":"larrfs","⤞":"rarrfs","⤟":"larrbfs","⤠":"rarrbfs","⤣":"nwarhk","⤤":"nearhk","⤥":"searhk","⤦":"swarhk","⤧":"nwnear","⤨":"toea","⤩":"tosa","⤪":"swnwar","⤳":"rarrc","⤳̸":"nrarrc","⤵":"cudarrr","⤶":"ldca","⤷":"rdca","⤸":"cudarrl","⤹":"larrpl","⤼":"curarrm","⤽":"cularrp","⥅":"rarrpl","⥈":"harrcir","⥉":"Uarrocir","⥊":"lurdshar","⥋":"ldrushar","⥎":"LeftRightVector","⥏":"RightUpDownVector","⥐":"DownLeftRightVector","⥑":"LeftUpDownVector","⥒":"LeftVectorBar","⥓":"RightVectorBar","⥔":"RightUpVectorBar","⥕":"RightDownVectorBar","⥖":"DownLeftVectorBar","⥗":"DownRightVectorBar","⥘":"LeftUpVectorBar","⥙":"LeftDownVectorBar","⥚":"LeftTeeVector","⥛":"RightTeeVector","⥜":"RightUpTeeVector","⥝":"RightDownTeeVector","⥞":"DownLeftTeeVector","⥟":"DownRightTeeVector","⥠":"LeftUpTeeVector","⥡":"LeftDownTeeVector","⥢":"lHar","⥣":"uHar","⥤":"rHar","⥥":"dHar","⥦":"luruhar","⥧":"ldrdhar","⥨":"ruluhar","⥩":"rdldhar","⥪":"lharul","⥫":"llhard","⥬":"rharul","⥭":"lrhard","⥮":"udhar","⥯":"duhar","⥰":"RoundImplies","⥱":"erarr","⥲":"simrarr","⥳":"larrsim","⥴":"rarrsim","⥵":"rarrap","⥶":"ltlarr","⥸":"gtrarr","⥹":"subrarr","⥻":"suplarr","⥼":"lfisht","⥽":"rfisht","⥾":"ufisht","⥿":"dfisht","⦚":"vzigzag","⦜":"vangrt","⦝":"angrtvbd","⦤":"ange","⦥":"range","⦦":"dwangle","⦧":"uwangle","⦨":"angmsdaa","⦩":"angmsdab","⦪":"angmsdac","⦫":"angmsdad","⦬":"angmsdae","⦭":"angmsdaf","⦮":"angmsdag","⦯":"angmsdah","⦰":"bemptyv","⦱":"demptyv","⦲":"cemptyv","⦳":"raemptyv","⦴":"laemptyv","⦵":"ohbar","⦶":"omid","⦷":"opar","⦹":"operp","⦻":"olcross","⦼":"odsold","⦾":"olcir","⦿":"ofcir","⧀":"olt","⧁":"ogt","⧂":"cirscir","⧃":"cirE","⧄":"solb","⧅":"bsolb","⧉":"boxbox","⧍":"trisb","⧎":"rtriltri","⧏":"LeftTriangleBar","⧏̸":"NotLeftTriangleBar","⧐":"RightTriangleBar","⧐̸":"NotRightTriangleBar","⧜":"iinfin","⧝":"infintie","⧞":"nvinfin","⧣":"eparsl","⧤":"smeparsl","⧥":"eqvparsl","⧫":"lozf","⧴":"RuleDelayed","⧶":"dsol","⨀":"xodot","⨁":"xoplus","⨂":"xotime","⨄":"xuplus","⨆":"xsqcup","⨍":"fpartint","⨐":"cirfnint","⨑":"awint","⨒":"rppolint","⨓":"scpolint","⨔":"npolint","⨕":"pointint","⨖":"quatint","⨗":"intlarhk","⨢":"pluscir","⨣":"plusacir","⨤":"simplus","⨥":"plusdu","⨦":"plussim","⨧":"plustwo","⨩":"mcomma","⨪":"minusdu","⨭":"loplus","⨮":"roplus","⨯":"Cross","⨰":"timesd","⨱":"timesbar","⨳":"smashp","⨴":"lotimes","⨵":"rotimes","⨶":"otimesas","⨷":"Otimes","⨸":"odiv","⨹":"triplus","⨺":"triminus","⨻":"tritime","⨼":"iprod","⨿":"amalg","⩀":"capdot","⩂":"ncup","⩃":"ncap","⩄":"capand","⩅":"cupor","⩆":"cupcap","⩇":"capcup","⩈":"cupbrcap","⩉":"capbrcup","⩊":"cupcup","⩋":"capcap","⩌":"ccups","⩍":"ccaps","⩐":"ccupssm","⩓":"And","⩔":"Or","⩕":"andand","⩖":"oror","⩗":"orslope","⩘":"andslope","⩚":"andv","⩛":"orv","⩜":"andd","⩝":"ord","⩟":"wedbar","⩦":"sdote","⩪":"simdot","⩭":"congdot","⩭̸":"ncongdot","⩮":"easter","⩯":"apacir","⩰":"apE","⩰̸":"napE","⩱":"eplus","⩲":"pluse","⩳":"Esim","⩷":"eDDot","⩸":"equivDD","⩹":"ltcir","⩺":"gtcir","⩻":"ltquest","⩼":"gtquest","⩽":"les","⩽̸":"nles","⩾":"ges","⩾̸":"nges","⩿":"lesdot","⪀":"gesdot","⪁":"lesdoto","⪂":"gesdoto","⪃":"lesdotor","⪄":"gesdotol","⪅":"lap","⪆":"gap","⪇":"lne","⪈":"gne","⪉":"lnap","⪊":"gnap","⪋":"lEg","⪌":"gEl","⪍":"lsime","⪎":"gsime","⪏":"lsimg","⪐":"gsiml","⪑":"lgE","⪒":"glE","⪓":"lesges","⪔":"gesles","⪕":"els","⪖":"egs","⪗":"elsdot","⪘":"egsdot","⪙":"el","⪚":"eg","⪝":"siml","⪞":"simg","⪟":"simlE","⪠":"simgE","⪡":"LessLess","⪡̸":"NotNestedLessLess","⪢":"GreaterGreater","⪢̸":"NotNestedGreaterGreater","⪤":"glj","⪥":"gla","⪦":"ltcc","⪧":"gtcc","⪨":"lescc","⪩":"gescc","⪪":"smt","⪫":"lat","⪬":"smte","⪬︀":"smtes","⪭":"late","⪭︀":"lates","⪮":"bumpE","⪯":"pre","⪯̸":"npre","⪰":"sce","⪰̸":"nsce","⪳":"prE","⪴":"scE","⪵":"prnE","⪶":"scnE","⪷":"prap","⪸":"scap","⪹":"prnap","⪺":"scnap","⪻":"Pr","⪼":"Sc","⪽":"subdot","⪾":"supdot","⪿":"subplus","⫀":"supplus","⫁":"submult","⫂":"supmult","⫃":"subedot","⫄":"supedot","⫅":"subE","⫅̸":"nsubE","⫆":"supE","⫆̸":"nsupE","⫇":"subsim","⫈":"supsim","⫋︀":"vsubnE","⫋":"subnE","⫌︀":"vsupnE","⫌":"supnE","⫏":"csub","⫐":"csup","⫑":"csube","⫒":"csupe","⫓":"subsup","⫔":"supsub","⫕":"subsub","⫖":"supsup","⫗":"suphsub","⫘":"supdsub","⫙":"forkv","⫚":"topfork","⫛":"mlcp","⫤":"Dashv","⫦":"Vdashl","⫧":"Barv","⫨":"vBar","⫩":"vBarv","⫫":"Vbar","⫬":"Not","⫭":"bNot","⫮":"rnmid","⫯":"cirmid","⫰":"midcir","⫱":"topcir","⫲":"nhpar","⫳":"parsim","⫽":"parsl","⫽⃥":"nparsl","♭":"flat","♮":"natur","♯":"sharp","¤":"curren","¢":"cent",$:"dollar","£":"pound","¥":"yen","€":"euro","¹":"sup1","½":"half","⅓":"frac13","¼":"frac14","⅕":"frac15","⅙":"frac16","⅛":"frac18","²":"sup2","⅔":"frac23","⅖":"frac25","³":"sup3","¾":"frac34","⅗":"frac35","⅜":"frac38","⅘":"frac45","⅚":"frac56","⅝":"frac58","⅞":"frac78","𝒶":"ascr","𝕒":"aopf","𝔞":"afr","𝔸":"Aopf","𝔄":"Afr","𝒜":"Ascr","ª":"ordf","á":"aacute","Á":"Aacute","à":"agrave","À":"Agrave","ă":"abreve","Ă":"Abreve","â":"acirc","Â":"Acirc","å":"aring","Å":"angst","ä":"auml","Ä":"Auml","ã":"atilde","Ã":"Atilde","ą":"aogon","Ą":"Aogon","ā":"amacr","Ā":"Amacr","æ":"aelig","Æ":"AElig","𝒷":"bscr","𝕓":"bopf","𝔟":"bfr","𝔹":"Bopf","ℬ":"Bscr","𝔅":"Bfr","𝔠":"cfr","𝒸":"cscr","𝕔":"copf","ℭ":"Cfr","𝒞":"Cscr","ℂ":"Copf","ć":"cacute","Ć":"Cacute","ĉ":"ccirc","Ĉ":"Ccirc","č":"ccaron","Č":"Ccaron","ċ":"cdot","Ċ":"Cdot","ç":"ccedil","Ç":"Ccedil","℅":"incare","𝔡":"dfr","ⅆ":"dd","𝕕":"dopf","𝒹":"dscr","𝒟":"Dscr","𝔇":"Dfr","ⅅ":"DD","𝔻":"Dopf","ď":"dcaron","Ď":"Dcaron","đ":"dstrok","Đ":"Dstrok","ð":"eth","Ð":"ETH","ⅇ":"ee","ℯ":"escr","𝔢":"efr","𝕖":"eopf","ℰ":"Escr","𝔈":"Efr","𝔼":"Eopf","é":"eacute","É":"Eacute","è":"egrave","È":"Egrave","ê":"ecirc","Ê":"Ecirc","ě":"ecaron","Ě":"Ecaron","ë":"euml","Ë":"Euml","ė":"edot","Ė":"Edot","ę":"eogon","Ę":"Eogon","ē":"emacr","Ē":"Emacr","𝔣":"ffr","𝕗":"fopf","𝒻":"fscr","𝔉":"Ffr","𝔽":"Fopf","ℱ":"Fscr","ff":"fflig","ffi":"ffilig","ffl":"ffllig","fi":"filig",fj:"fjlig","fl":"fllig","ƒ":"fnof","ℊ":"gscr","𝕘":"gopf","𝔤":"gfr","𝒢":"Gscr","𝔾":"Gopf","𝔊":"Gfr","ǵ":"gacute","ğ":"gbreve","Ğ":"Gbreve","ĝ":"gcirc","Ĝ":"Gcirc","ġ":"gdot","Ġ":"Gdot","Ģ":"Gcedil","𝔥":"hfr","ℎ":"planckh","𝒽":"hscr","𝕙":"hopf","ℋ":"Hscr","ℌ":"Hfr","ℍ":"Hopf","ĥ":"hcirc","Ĥ":"Hcirc","ℏ":"hbar","ħ":"hstrok","Ħ":"Hstrok","𝕚":"iopf","𝔦":"ifr","𝒾":"iscr","ⅈ":"ii","𝕀":"Iopf","ℐ":"Iscr","ℑ":"Im","í":"iacute","Í":"Iacute","ì":"igrave","Ì":"Igrave","î":"icirc","Î":"Icirc","ï":"iuml","Ï":"Iuml","ĩ":"itilde","Ĩ":"Itilde","İ":"Idot","į":"iogon","Į":"Iogon","ī":"imacr","Ī":"Imacr","ij":"ijlig","IJ":"IJlig","ı":"imath","𝒿":"jscr","𝕛":"jopf","𝔧":"jfr","𝒥":"Jscr","𝔍":"Jfr","𝕁":"Jopf","ĵ":"jcirc","Ĵ":"Jcirc","ȷ":"jmath","𝕜":"kopf","𝓀":"kscr","𝔨":"kfr","𝒦":"Kscr","𝕂":"Kopf","𝔎":"Kfr","ķ":"kcedil","Ķ":"Kcedil","𝔩":"lfr","𝓁":"lscr","ℓ":"ell","𝕝":"lopf","ℒ":"Lscr","𝔏":"Lfr","𝕃":"Lopf","ĺ":"lacute","Ĺ":"Lacute","ľ":"lcaron","Ľ":"Lcaron","ļ":"lcedil","Ļ":"Lcedil","ł":"lstrok","Ł":"Lstrok","ŀ":"lmidot","Ŀ":"Lmidot","𝔪":"mfr","𝕞":"mopf","𝓂":"mscr","𝔐":"Mfr","𝕄":"Mopf","ℳ":"Mscr","𝔫":"nfr","𝕟":"nopf","𝓃":"nscr","ℕ":"Nopf","𝒩":"Nscr","𝔑":"Nfr","ń":"nacute","Ń":"Nacute","ň":"ncaron","Ň":"Ncaron","ñ":"ntilde","Ñ":"Ntilde","ņ":"ncedil","Ņ":"Ncedil","№":"numero","ŋ":"eng","Ŋ":"ENG","𝕠":"oopf","𝔬":"ofr","ℴ":"oscr","𝒪":"Oscr","𝔒":"Ofr","𝕆":"Oopf","º":"ordm","ó":"oacute","Ó":"Oacute","ò":"ograve","Ò":"Ograve","ô":"ocirc","Ô":"Ocirc","ö":"ouml","Ö":"Ouml","ő":"odblac","Ő":"Odblac","õ":"otilde","Õ":"Otilde","ø":"oslash","Ø":"Oslash","ō":"omacr","Ō":"Omacr","œ":"oelig","Œ":"OElig","𝔭":"pfr","𝓅":"pscr","𝕡":"popf","ℙ":"Popf","𝔓":"Pfr","𝒫":"Pscr","𝕢":"qopf","𝔮":"qfr","𝓆":"qscr","𝒬":"Qscr","𝔔":"Qfr","ℚ":"Qopf","ĸ":"kgreen","𝔯":"rfr","𝕣":"ropf","𝓇":"rscr","ℛ":"Rscr","ℜ":"Re","ℝ":"Ropf","ŕ":"racute","Ŕ":"Racute","ř":"rcaron","Ř":"Rcaron","ŗ":"rcedil","Ŗ":"Rcedil","𝕤":"sopf","𝓈":"sscr","𝔰":"sfr","𝕊":"Sopf","𝔖":"Sfr","𝒮":"Sscr","Ⓢ":"oS","ś":"sacute","Ś":"Sacute","ŝ":"scirc","Ŝ":"Scirc","š":"scaron","Š":"Scaron","ş":"scedil","Ş":"Scedil","ß":"szlig","𝔱":"tfr","𝓉":"tscr","𝕥":"topf","𝒯":"Tscr","𝔗":"Tfr","𝕋":"Topf","ť":"tcaron","Ť":"Tcaron","ţ":"tcedil","Ţ":"Tcedil","™":"trade","ŧ":"tstrok","Ŧ":"Tstrok","𝓊":"uscr","𝕦":"uopf","𝔲":"ufr","𝕌":"Uopf","𝔘":"Ufr","𝒰":"Uscr","ú":"uacute","Ú":"Uacute","ù":"ugrave","Ù":"Ugrave","ŭ":"ubreve","Ŭ":"Ubreve","û":"ucirc","Û":"Ucirc","ů":"uring","Ů":"Uring","ü":"uuml","Ü":"Uuml","ű":"udblac","Ű":"Udblac","ũ":"utilde","Ũ":"Utilde","ų":"uogon","Ų":"Uogon","ū":"umacr","Ū":"Umacr","𝔳":"vfr","𝕧":"vopf","𝓋":"vscr","𝔙":"Vfr","𝕍":"Vopf","𝒱":"Vscr","𝕨":"wopf","𝓌":"wscr","𝔴":"wfr","𝒲":"Wscr","𝕎":"Wopf","𝔚":"Wfr","ŵ":"wcirc","Ŵ":"Wcirc","𝔵":"xfr","𝓍":"xscr","𝕩":"xopf","𝕏":"Xopf","𝔛":"Xfr","𝒳":"Xscr","𝔶":"yfr","𝓎":"yscr","𝕪":"yopf","𝒴":"Yscr","𝔜":"Yfr","𝕐":"Yopf","ý":"yacute","Ý":"Yacute","ŷ":"ycirc","Ŷ":"Ycirc","ÿ":"yuml","Ÿ":"Yuml","𝓏":"zscr","𝔷":"zfr","𝕫":"zopf","ℨ":"Zfr","ℤ":"Zopf","𝒵":"Zscr","ź":"zacute","Ź":"Zacute","ž":"zcaron","Ž":"Zcaron","ż":"zdot","Ż":"Zdot","Ƶ":"imped","þ":"thorn","Þ":"THORN","ʼn":"napos","α":"alpha","Α":"Alpha","β":"beta","Β":"Beta","γ":"gamma","Γ":"Gamma","δ":"delta","Δ":"Delta","ε":"epsi","ϵ":"epsiv","Ε":"Epsilon","ϝ":"gammad","Ϝ":"Gammad","ζ":"zeta","Ζ":"Zeta","η":"eta","Η":"Eta","θ":"theta","ϑ":"thetav","Θ":"Theta","ι":"iota","Ι":"Iota","κ":"kappa","ϰ":"kappav","Κ":"Kappa","λ":"lambda","Λ":"Lambda","μ":"mu","µ":"micro","Μ":"Mu","ν":"nu","Ν":"Nu","ξ":"xi","Ξ":"Xi","ο":"omicron","Ο":"Omicron","π":"pi","ϖ":"piv","Π":"Pi","ρ":"rho","ϱ":"rhov","Ρ":"Rho","σ":"sigma","Σ":"Sigma","ς":"sigmaf","τ":"tau","Τ":"Tau","υ":"upsi","Υ":"Upsilon","ϒ":"Upsi","φ":"phi","ϕ":"phiv","Φ":"Phi","χ":"chi","Χ":"Chi","ψ":"psi","Ψ":"Psi","ω":"omega","Ω":"ohm","а":"acy","А":"Acy","б":"bcy","Б":"Bcy","в":"vcy","В":"Vcy","г":"gcy","Г":"Gcy","ѓ":"gjcy","Ѓ":"GJcy","д":"dcy","Д":"Dcy","ђ":"djcy","Ђ":"DJcy","е":"iecy","Е":"IEcy","ё":"iocy","Ё":"IOcy","є":"jukcy","Є":"Jukcy","ж":"zhcy","Ж":"ZHcy","з":"zcy","З":"Zcy","ѕ":"dscy","Ѕ":"DScy","и":"icy","И":"Icy","і":"iukcy","І":"Iukcy","ї":"yicy","Ї":"YIcy","й":"jcy","Й":"Jcy","ј":"jsercy","Ј":"Jsercy","к":"kcy","К":"Kcy","ќ":"kjcy","Ќ":"KJcy","л":"lcy","Л":"Lcy","љ":"ljcy","Љ":"LJcy","м":"mcy","М":"Mcy","н":"ncy","Н":"Ncy","њ":"njcy","Њ":"NJcy","о":"ocy","О":"Ocy","п":"pcy","П":"Pcy","р":"rcy","Р":"Rcy","с":"scy","С":"Scy","т":"tcy","Т":"Tcy","ћ":"tshcy","Ћ":"TSHcy","у":"ucy","У":"Ucy","ў":"ubrcy","Ў":"Ubrcy","ф":"fcy","Ф":"Fcy","х":"khcy","Х":"KHcy","ц":"tscy","Ц":"TScy","ч":"chcy","Ч":"CHcy","џ":"dzcy","Џ":"DZcy","ш":"shcy","Ш":"SHcy","щ":"shchcy","Щ":"SHCHcy","ъ":"hardcy","Ъ":"HARDcy","ы":"ycy","Ы":"Ycy","ь":"softcy","Ь":"SOFTcy","э":"ecy","Э":"Ecy","ю":"yucy","Ю":"YUcy","я":"yacy","Я":"YAcy","ℵ":"aleph","ℶ":"beth","ℷ":"gimel","ℸ":"daleth"},m=/["&'<>`]/g,n={'"':""","&":"&","'":"'","<":"<",">":">","`":"`"},o=/&#(?:[xX][^a-fA-F0-9]|[^0-9xX])/,p=/[\0-\x08\x0B\x0E-\x1F\x7F-\x9F\uFDD0-\uFDEF\uFFFE\uFFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDFFE\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,q=/&#([0-9]+)(;?)|&#[xX]([a-fA-F0-9]+)(;?)|&([0-9a-zA-Z]+);|&(Aacute|Agrave|Atilde|Ccedil|Eacute|Egrave|Iacute|Igrave|Ntilde|Oacute|Ograve|Oslash|Otilde|Uacute|Ugrave|Yacute|aacute|agrave|atilde|brvbar|ccedil|curren|divide|eacute|egrave|frac12|frac14|frac34|iacute|igrave|iquest|middot|ntilde|oacute|ograve|oslash|otilde|plusmn|uacute|ugrave|yacute|AElig|Acirc|Aring|Ecirc|Icirc|Ocirc|THORN|Ucirc|acirc|acute|aelig|aring|cedil|ecirc|icirc|iexcl|laquo|micro|ocirc|pound|raquo|szlig|thorn|times|ucirc|Auml|COPY|Euml|Iuml|Ouml|QUOT|Uuml|auml|cent|copy|euml|iuml|macr|nbsp|ordf|ordm|ouml|para|quot|sect|sup1|sup2|sup3|uuml|yuml|AMP|ETH|REG|amp|deg|eth|not|reg|shy|uml|yen|GT|LT|gt|lt)([=a-zA-Z0-9])?/g,r={aacute:"á",Aacute:"Á",abreve:"ă",Abreve:"Ă",ac:"∾",acd:"∿",acE:"∾̳",acirc:"â",Acirc:"Â",acute:"´",acy:"а",Acy:"А",aelig:"æ",AElig:"Æ",af:"⁡",afr:"𝔞",Afr:"𝔄",agrave:"à",Agrave:"À",alefsym:"ℵ",aleph:"ℵ",alpha:"α",Alpha:"Α",amacr:"ā",Amacr:"Ā",amalg:"⨿",amp:"&",AMP:"&",and:"∧",And:"⩓",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",aogon:"ą",Aogon:"Ą",aopf:"𝕒",Aopf:"𝔸",ap:"≈",apacir:"⩯",ape:"≊",apE:"⩰",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",aring:"å",Aring:"Å",ascr:"𝒶",Ascr:"𝒜",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",atilde:"ã",Atilde:"Ã",auml:"ä",Auml:"Ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",barwed:"⌅",Barwed:"⌆",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",bcy:"б",Bcy:"Б",bdquo:"„",becaus:"∵",because:"∵",Because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",beta:"β",Beta:"Β",beth:"ℶ",between:"≬",bfr:"𝔟",Bfr:"𝔅",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bnot:"⌐",bNot:"⫭",bopf:"𝕓",Bopf:"𝔹",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxdl:"┐",boxdL:"╕",boxDl:"╖",boxDL:"╗",boxdr:"┌",boxdR:"╒",boxDr:"╓",boxDR:"╔",boxh:"─",boxH:"═",boxhd:"┬",boxhD:"╥",boxHd:"╤",boxHD:"╦",boxhu:"┴",boxhU:"╨",boxHu:"╧",boxHU:"╩",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxul:"┘",boxuL:"╛",boxUl:"╜",boxUL:"╝",boxur:"└",boxuR:"╘",boxUr:"╙",boxUR:"╚",boxv:"│",boxV:"║",boxvh:"┼",boxvH:"╪",boxVh:"╫",boxVH:"╬",boxvl:"┤",boxvL:"╡",boxVl:"╢",boxVL:"╣",boxvr:"├",boxvR:"╞",boxVr:"╟",boxVR:"╠",bprime:"‵",breve:"˘",Breve:"˘",brvbar:"¦",bscr:"𝒷",Bscr:"ℬ",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpe:"≏",bumpE:"⪮",bumpeq:"≏",Bumpeq:"≎",cacute:"ć",Cacute:"Ć",cap:"∩",Cap:"⋒",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",ccaron:"č",Ccaron:"Č",ccedil:"ç",Ccedil:"Ç",ccirc:"ĉ",Ccirc:"Ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",cdot:"ċ",Cdot:"Ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",centerdot:"·",CenterDot:"·",cfr:"𝔠",Cfr:"ℭ",chcy:"ч",CHcy:"Ч",check:"✓",checkmark:"✓",chi:"χ",Chi:"Χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cire:"≗",cirE:"⧃",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",colon:":",Colon:"∷",colone:"≔",Colone:"⩴",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",conint:"∮",Conint:"∯",ContourIntegral:"∮",copf:"𝕔",Copf:"ℂ",coprod:"∐",Coproduct:"∐",copy:"©",COPY:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",cross:"✗",Cross:"⨯",cscr:"𝒸",Cscr:"𝒞",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",cup:"∪",Cup:"⋓",cupbrcap:"⩈",cupcap:"⩆",CupCap:"≍",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",dagger:"†",Dagger:"‡",daleth:"ℸ",darr:"↓",dArr:"⇓",Darr:"↡",dash:"‐",dashv:"⊣",Dashv:"⫤",dbkarow:"⤏",dblac:"˝",dcaron:"ď",Dcaron:"Ď",dcy:"д",Dcy:"Д",dd:"ⅆ",DD:"ⅅ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",delta:"δ",Delta:"Δ",demptyv:"⦱",dfisht:"⥿",dfr:"𝔡",Dfr:"𝔇",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",diamond:"⋄",Diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",djcy:"ђ",DJcy:"Ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",dopf:"𝕕",Dopf:"𝔻",dot:"˙",Dot:"¨",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",downarrow:"↓",Downarrow:"⇓",DownArrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",dscr:"𝒹",Dscr:"𝒟",dscy:"ѕ",DScy:"Ѕ",dsol:"⧶",dstrok:"đ",Dstrok:"Đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",dzcy:"џ",DZcy:"Џ",dzigrarr:"⟿",eacute:"é",Eacute:"É",easter:"⩮",ecaron:"ě",Ecaron:"Ě",ecir:"≖",ecirc:"ê",Ecirc:"Ê",ecolon:"≕",ecy:"э",Ecy:"Э",eDDot:"⩷",edot:"ė",eDot:"≑",Edot:"Ė",ee:"ⅇ",efDot:"≒",efr:"𝔢",Efr:"𝔈",eg:"⪚",egrave:"è",Egrave:"È",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",emacr:"ē",Emacr:"Ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",eng:"ŋ",ENG:"Ŋ",ensp:" ",eogon:"ę",Eogon:"Ę",eopf:"𝕖",Eopf:"𝔼",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",epsilon:"ε",Epsilon:"Ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",escr:"ℯ",Escr:"ℰ",esdot:"≐",esim:"≂",Esim:"⩳",eta:"η",Eta:"Η",eth:"ð",ETH:"Ð",euml:"ë",Euml:"Ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",exponentiale:"ⅇ",ExponentialE:"ⅇ",fallingdotseq:"≒",fcy:"ф",Fcy:"Ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",ffr:"𝔣",Ffr:"𝔉",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",fopf:"𝕗",Fopf:"𝔽",forall:"∀",ForAll:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",fscr:"𝒻",Fscr:"ℱ",gacute:"ǵ",gamma:"γ",Gamma:"Γ",gammad:"ϝ",Gammad:"Ϝ",gap:"⪆",gbreve:"ğ",Gbreve:"Ğ",Gcedil:"Ģ",gcirc:"ĝ",Gcirc:"Ĝ",gcy:"г",Gcy:"Г",gdot:"ġ",Gdot:"Ġ",ge:"≥",gE:"≧",gel:"⋛",gEl:"⪌",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",gfr:"𝔤",Gfr:"𝔊",gg:"≫",Gg:"⋙",ggg:"⋙",gimel:"ℷ",gjcy:"ѓ",GJcy:"Ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gne:"⪈",gnE:"≩",gneq:"⪈",gneqq:"≩",gnsim:"⋧",gopf:"𝕘",Gopf:"𝔾",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",gscr:"ℊ",Gscr:"𝒢",gsim:"≳",gsime:"⪎",gsiml:"⪐",gt:">",Gt:"≫",GT:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",hardcy:"ъ",HARDcy:"Ъ",harr:"↔",hArr:"⇔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",hcirc:"ĥ",Hcirc:"Ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",hfr:"𝔥",Hfr:"ℌ",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",hopf:"𝕙",Hopf:"ℍ",horbar:"―",HorizontalLine:"─",hscr:"𝒽",Hscr:"ℋ",hslash:"ℏ",hstrok:"ħ",Hstrok:"Ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",iacute:"í",Iacute:"Í",ic:"⁣",icirc:"î",Icirc:"Î",icy:"и",Icy:"И",Idot:"İ",iecy:"е",IEcy:"Е",iexcl:"¡",iff:"⇔",ifr:"𝔦",Ifr:"ℑ",igrave:"ì",Igrave:"Ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",ijlig:"ij",IJlig:"IJ",Im:"ℑ",imacr:"ī",Imacr:"Ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",int:"∫",Int:"∬",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",iocy:"ё",IOcy:"Ё",iogon:"į",Iogon:"Į",iopf:"𝕚",Iopf:"𝕀",iota:"ι",Iota:"Ι",iprod:"⨼",iquest:"¿",iscr:"𝒾",Iscr:"ℐ",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",itilde:"ĩ",Itilde:"Ĩ",iukcy:"і",Iukcy:"І",iuml:"ï",Iuml:"Ï",jcirc:"ĵ",Jcirc:"Ĵ",jcy:"й",Jcy:"Й",jfr:"𝔧",Jfr:"𝔍",jmath:"ȷ",jopf:"𝕛",Jopf:"𝕁",jscr:"𝒿",Jscr:"𝒥",jsercy:"ј",Jsercy:"Ј",jukcy:"є",Jukcy:"Є",kappa:"κ",Kappa:"Κ",kappav:"ϰ",kcedil:"ķ",Kcedil:"Ķ",kcy:"к",Kcy:"К",kfr:"𝔨",Kfr:"𝔎",kgreen:"ĸ",khcy:"х",KHcy:"Х",kjcy:"ќ",KJcy:"Ќ",kopf:"𝕜",Kopf:"𝕂",kscr:"𝓀",Kscr:"𝒦",lAarr:"⇚",lacute:"ĺ",Lacute:"Ĺ",laemptyv:"⦴",lagran:"ℒ",lambda:"λ",Lambda:"Λ",lang:"⟨",Lang:"⟪",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",larr:"←",lArr:"⇐",Larr:"↞",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",latail:"⤙",lAtail:"⤛",late:"⪭",lates:"⪭︀",lbarr:"⤌",lBarr:"⤎",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",lcaron:"ľ",Lcaron:"Ľ",lcedil:"ļ",Lcedil:"Ļ",lceil:"⌈",lcub:"{",lcy:"л",Lcy:"Л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",le:"≤",lE:"≦",LeftAngleBracket:"⟨",leftarrow:"←",Leftarrow:"⇐",LeftArrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",leftrightarrow:"↔",Leftrightarrow:"⇔",LeftRightArrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",leg:"⋚",lEg:"⪋",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",lfr:"𝔩",Lfr:"𝔏",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",ljcy:"љ",LJcy:"Љ",ll:"≪",Ll:"⋘",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",lmidot:"ŀ",Lmidot:"Ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lne:"⪇",lnE:"≨",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",longleftarrow:"⟵",Longleftarrow:"⟸",LongLeftArrow:"⟵",longleftrightarrow:"⟷",Longleftrightarrow:"⟺",LongLeftRightArrow:"⟷",longmapsto:"⟼",longrightarrow:"⟶",Longrightarrow:"⟹",LongRightArrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",lopf:"𝕝",Lopf:"𝕃",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",lscr:"𝓁",Lscr:"ℒ",lsh:"↰",Lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",lstrok:"ł",Lstrok:"Ł",lt:"<",Lt:"≪",LT:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",map:"↦",Map:"⤅",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",mcy:"м",Mcy:"М",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",mfr:"𝔪",Mfr:"𝔐",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",mopf:"𝕞",Mopf:"𝕄",mp:"∓",mscr:"𝓂",Mscr:"ℳ",mstpos:"∾",mu:"μ",Mu:"Μ",multimap:"⊸",mumap:"⊸",nabla:"∇",nacute:"ń",Nacute:"Ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",ncaron:"ň",Ncaron:"Ň",ncedil:"ņ",Ncedil:"Ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",ncy:"н",Ncy:"Н",ndash:"–",ne:"≠",nearhk:"⤤",nearr:"↗",neArr:"⇗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",nfr:"𝔫",Nfr:"𝔑",nge:"≱",ngE:"≧̸",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",ngt:"≯",nGt:"≫⃒",ngtr:"≯",nGtv:"≫̸",nharr:"↮",nhArr:"⇎",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",njcy:"њ",NJcy:"Њ",nlarr:"↚",nlArr:"⇍",nldr:"‥",nle:"≰",nlE:"≦̸",nleftarrow:"↚",nLeftarrow:"⇍",nleftrightarrow:"↮",nLeftrightarrow:"⇎",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nlt:"≮",nLt:"≪⃒",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",nopf:"𝕟",Nopf:"ℕ",not:"¬",Not:"⫬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrarr:"↛",nrArr:"⇏",nrarrc:"⤳̸",nrarrw:"↝̸",nrightarrow:"↛",nRightarrow:"⇏",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",nscr:"𝓃",Nscr:"𝒩",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsube:"⊈",nsubE:"⫅̸",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupe:"⊉",nsupE:"⫆̸",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",ntilde:"ñ",Ntilde:"Ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",nu:"ν",Nu:"Ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nvdash:"⊬",nvDash:"⊭",nVdash:"⊮",nVDash:"⊯",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwarr:"↖",nwArr:"⇖",nwarrow:"↖",nwnear:"⤧",oacute:"ó",Oacute:"Ó",oast:"⊛",ocir:"⊚",ocirc:"ô",Ocirc:"Ô",ocy:"о",Ocy:"О",odash:"⊝",odblac:"ő",Odblac:"Ő",odiv:"⨸",odot:"⊙",odsold:"⦼",oelig:"œ",OElig:"Œ",ofcir:"⦿",ofr:"𝔬",Ofr:"𝔒",ogon:"˛",ograve:"ò",Ograve:"Ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",omacr:"ō",Omacr:"Ō",omega:"ω",Omega:"Ω",omicron:"ο",Omicron:"Ο",omid:"⦶",ominus:"⊖",oopf:"𝕠",Oopf:"𝕆",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",or:"∨",Or:"⩔",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",oscr:"ℴ",Oscr:"𝒪",oslash:"ø",Oslash:"Ø",osol:"⊘",otilde:"õ",Otilde:"Õ",otimes:"⊗",Otimes:"⨷",otimesas:"⨶",ouml:"ö",Ouml:"Ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",pcy:"п",Pcy:"П",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",pfr:"𝔭",Pfr:"𝔓",phi:"φ",Phi:"Φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",pi:"π",Pi:"Π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",popf:"𝕡",Popf:"ℙ",pound:"£",pr:"≺",Pr:"⪻",prap:"⪷",prcue:"≼",pre:"⪯",prE:"⪳",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",prime:"′",Prime:"″",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",pscr:"𝓅",Pscr:"𝒫",psi:"ψ",Psi:"Ψ",puncsp:" ",qfr:"𝔮",Qfr:"𝔔",qint:"⨌",qopf:"𝕢",Qopf:"ℚ",qprime:"⁗",qscr:"𝓆",Qscr:"𝒬",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",quot:'"',QUOT:'"',rAarr:"⇛",race:"∽̱",racute:"ŕ",Racute:"Ŕ",radic:"√",raemptyv:"⦳",rang:"⟩",Rang:"⟫",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",rarr:"→",rArr:"⇒",Rarr:"↠",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",rarrtl:"↣",Rarrtl:"⤖",rarrw:"↝",ratail:"⤚",rAtail:"⤜",ratio:"∶",rationals:"ℚ", +rbarr:"⤍",rBarr:"⤏",RBarr:"⤐",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",rcaron:"ř",Rcaron:"Ř",rcedil:"ŗ",Rcedil:"Ŗ",rceil:"⌉",rcub:"}",rcy:"р",Rcy:"Р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",reg:"®",REG:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",rfr:"𝔯",Rfr:"ℜ",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",rho:"ρ",Rho:"Ρ",rhov:"ϱ",RightAngleBracket:"⟩",rightarrow:"→",Rightarrow:"⇒",RightArrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",ropf:"𝕣",Ropf:"ℝ",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",rscr:"𝓇",Rscr:"ℛ",rsh:"↱",Rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",sacute:"ś",Sacute:"Ś",sbquo:"‚",sc:"≻",Sc:"⪼",scap:"⪸",scaron:"š",Scaron:"Š",sccue:"≽",sce:"⪰",scE:"⪴",scedil:"ş",Scedil:"Ş",scirc:"ŝ",Scirc:"Ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",scy:"с",Scy:"С",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",searr:"↘",seArr:"⇘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",sfr:"𝔰",Sfr:"𝔖",sfrown:"⌢",sharp:"♯",shchcy:"щ",SHCHcy:"Щ",shcy:"ш",SHcy:"Ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",sigma:"σ",Sigma:"Σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",softcy:"ь",SOFTcy:"Ь",sol:"/",solb:"⧄",solbar:"⌿",sopf:"𝕤",Sopf:"𝕊",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",square:"□",Square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",sscr:"𝓈",Sscr:"𝒮",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",star:"☆",Star:"⋆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",sub:"⊂",Sub:"⋐",subdot:"⪽",sube:"⊆",subE:"⫅",subedot:"⫃",submult:"⫁",subne:"⊊",subnE:"⫋",subplus:"⪿",subrarr:"⥹",subset:"⊂",Subset:"⋐",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",sum:"∑",Sum:"∑",sung:"♪",sup:"⊃",Sup:"⋑",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supe:"⊇",supE:"⫆",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supne:"⊋",supnE:"⫌",supplus:"⫀",supset:"⊃",Supset:"⋑",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swarr:"↙",swArr:"⇙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",tau:"τ",Tau:"Τ",tbrk:"⎴",tcaron:"ť",Tcaron:"Ť",tcedil:"ţ",Tcedil:"Ţ",tcy:"т",Tcy:"Т",tdot:"⃛",telrec:"⌕",tfr:"𝔱",Tfr:"𝔗",there4:"∴",therefore:"∴",Therefore:"∴",theta:"θ",Theta:"Θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",thorn:"þ",THORN:"Þ",tilde:"˜",Tilde:"∼",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",topf:"𝕥",Topf:"𝕋",topfork:"⫚",tosa:"⤩",tprime:"‴",trade:"™",TRADE:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",tscr:"𝓉",Tscr:"𝒯",tscy:"ц",TScy:"Ц",tshcy:"ћ",TSHcy:"Ћ",tstrok:"ŧ",Tstrok:"Ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",uacute:"ú",Uacute:"Ú",uarr:"↑",uArr:"⇑",Uarr:"↟",Uarrocir:"⥉",ubrcy:"ў",Ubrcy:"Ў",ubreve:"ŭ",Ubreve:"Ŭ",ucirc:"û",Ucirc:"Û",ucy:"у",Ucy:"У",udarr:"⇅",udblac:"ű",Udblac:"Ű",udhar:"⥮",ufisht:"⥾",ufr:"𝔲",Ufr:"𝔘",ugrave:"ù",Ugrave:"Ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",umacr:"ū",Umacr:"Ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",uogon:"ų",Uogon:"Ų",uopf:"𝕦",Uopf:"𝕌",uparrow:"↑",Uparrow:"⇑",UpArrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",updownarrow:"↕",Updownarrow:"⇕",UpDownArrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",upsi:"υ",Upsi:"ϒ",upsih:"ϒ",upsilon:"υ",Upsilon:"Υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",uring:"ů",Uring:"Ů",urtri:"◹",uscr:"𝓊",Uscr:"𝒰",utdot:"⋰",utilde:"ũ",Utilde:"Ũ",utri:"▵",utrif:"▴",uuarr:"⇈",uuml:"ü",Uuml:"Ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",varr:"↕",vArr:"⇕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",vBar:"⫨",Vbar:"⫫",vBarv:"⫩",vcy:"в",Vcy:"В",vdash:"⊢",vDash:"⊨",Vdash:"⊩",VDash:"⊫",Vdashl:"⫦",vee:"∨",Vee:"⋁",veebar:"⊻",veeeq:"≚",vellip:"⋮",verbar:"|",Verbar:"‖",vert:"|",Vert:"‖",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",vfr:"𝔳",Vfr:"𝔙",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",vopf:"𝕧",Vopf:"𝕍",vprop:"∝",vrtri:"⊳",vscr:"𝓋",Vscr:"𝒱",vsubne:"⊊︀",vsubnE:"⫋︀",vsupne:"⊋︀",vsupnE:"⫌︀",Vvdash:"⊪",vzigzag:"⦚",wcirc:"ŵ",Wcirc:"Ŵ",wedbar:"⩟",wedge:"∧",Wedge:"⋀",wedgeq:"≙",weierp:"℘",wfr:"𝔴",Wfr:"𝔚",wopf:"𝕨",Wopf:"𝕎",wp:"℘",wr:"≀",wreath:"≀",wscr:"𝓌",Wscr:"𝒲",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",xfr:"𝔵",Xfr:"𝔛",xharr:"⟷",xhArr:"⟺",xi:"ξ",Xi:"Ξ",xlarr:"⟵",xlArr:"⟸",xmap:"⟼",xnis:"⋻",xodot:"⨀",xopf:"𝕩",Xopf:"𝕏",xoplus:"⨁",xotime:"⨂",xrarr:"⟶",xrArr:"⟹",xscr:"𝓍",Xscr:"𝒳",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",yacute:"ý",Yacute:"Ý",yacy:"я",YAcy:"Я",ycirc:"ŷ",Ycirc:"Ŷ",ycy:"ы",Ycy:"Ы",yen:"¥",yfr:"𝔶",Yfr:"𝔜",yicy:"ї",YIcy:"Ї",yopf:"𝕪",Yopf:"𝕐",yscr:"𝓎",Yscr:"𝒴",yucy:"ю",YUcy:"Ю",yuml:"ÿ",Yuml:"Ÿ",zacute:"ź",Zacute:"Ź",zcaron:"ž",Zcaron:"Ž",zcy:"з",Zcy:"З",zdot:"ż",Zdot:"Ż",zeetrf:"ℨ",ZeroWidthSpace:"​",zeta:"ζ",Zeta:"Ζ",zfr:"𝔷",Zfr:"ℨ",zhcy:"ж",ZHcy:"Ж",zigrarr:"⇝",zopf:"𝕫",Zopf:"ℤ",zscr:"𝓏",Zscr:"𝒵",zwj:"‍",zwnj:"‌"},s={aacute:"á",Aacute:"Á",acirc:"â",Acirc:"Â",acute:"´",aelig:"æ",AElig:"Æ",agrave:"à",Agrave:"À",amp:"&",AMP:"&",aring:"å",Aring:"Å",atilde:"ã",Atilde:"Ã",auml:"ä",Auml:"Ä",brvbar:"¦",ccedil:"ç",Ccedil:"Ç",cedil:"¸",cent:"¢",copy:"©",COPY:"©",curren:"¤",deg:"°",divide:"÷",eacute:"é",Eacute:"É",ecirc:"ê",Ecirc:"Ê",egrave:"è",Egrave:"È",eth:"ð",ETH:"Ð",euml:"ë",Euml:"Ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",GT:">",iacute:"í",Iacute:"Í",icirc:"î",Icirc:"Î",iexcl:"¡",igrave:"ì",Igrave:"Ì",iquest:"¿",iuml:"ï",Iuml:"Ï",laquo:"«",lt:"<",LT:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",ntilde:"ñ",Ntilde:"Ñ",oacute:"ó",Oacute:"Ó",ocirc:"ô",Ocirc:"Ô",ograve:"ò",Ograve:"Ò",ordf:"ª",ordm:"º",oslash:"ø",Oslash:"Ø",otilde:"õ",Otilde:"Õ",ouml:"ö",Ouml:"Ö",para:"¶",plusmn:"±",pound:"£",quot:'"',QUOT:'"',raquo:"»",reg:"®",REG:"®",sect:"§",shy:"­",sup1:"¹",sup2:"²",sup3:"³",szlig:"ß",thorn:"þ",THORN:"Þ",times:"×",uacute:"ú",Uacute:"Ú",ucirc:"û",Ucirc:"Û",ugrave:"ù",Ugrave:"Ù",uml:"¨",uuml:"ü",Uuml:"Ü",yacute:"ý",Yacute:"Ý",yen:"¥",yuml:"ÿ"},t={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"},u=[1,2,3,4,5,6,7,8,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,64976,64977,64978,64979,64980,64981,64982,64983,64984,64985,64986,64987,64988,64989,64990,64991,64992,64993,64994,64995,64996,64997,64998,64999,65e3,65001,65002,65003,65004,65005,65006,65007,65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111],v=String.fromCharCode,w={},x=w.hasOwnProperty,y=function(a,b){return x.call(a,b)},z=function(a,b){for(var c=-1,d=a.length;++c=55296&&a<=57343||a>1114111?(b&&E("character reference outside the permissible Unicode range"),"�"):y(t,a)?(b&&E("disallowed character reference"),t[a]):(b&&z(u,a)&&E("disallowed character reference"),a>65535&&(a-=65536,c+=v(a>>>10&1023|55296),a=56320|1023&a),c+=v(a))},C=function(a){return"&#x"+a.toString(16).toUpperCase()+";"},D=function(a){return"&#"+a+";"},E=function(a){throw Error("Parse error: "+a)},F=function(a,b){b=A(b,F.options);var c=b.strict;c&&p.test(a)&&E("forbidden code point");var d=b.encodeEverything,e=b.useNamedReferences,f=b.allowUnsafeSymbols,g=b.decimal?D:C,n=function(a){return g(a.charCodeAt(0))};return d?(a=a.replace(i,function(a){return e&&y(l,a)?"&"+l[a]+";":n(a)}),e&&(a=a.replace(/>\u20D2/g,">⃒").replace(/<\u20D2/g,"<⃒").replace(/fj/g,"fj")),e&&(a=a.replace(k,function(a){return"&"+l[a]+";"}))):e?(f||(a=a.replace(m,function(a){return"&"+l[a]+";"})),a=a.replace(/>\u20D2/g,">⃒").replace(/<\u20D2/g,"<⃒"),a=a.replace(k,function(a){return"&"+l[a]+";"})):f||(a=a.replace(m,n)),a.replace(h,function(a){var b=a.charCodeAt(0),c=a.charCodeAt(1),d=1024*(b-55296)+c-56320+65536;return g(d)}).replace(j,n)};F.options={allowUnsafeSymbols:!1,encodeEverything:!1,strict:!1,useNamedReferences:!1,decimal:!1};var G=function(a,b){b=A(b,G.options);var c=b.strict;return c&&o.test(a)&&E("malformed character reference"),a.replace(q,function(a,d,e,f,g,h,i,j){var k,l,m,n,o,p;return d?(m=d,l=e,c&&!l&&E("character reference was not terminated by a semicolon"),k=parseInt(m,10),B(k,c)):f?(n=f,l=g,c&&!l&&E("character reference was not terminated by a semicolon"),k=parseInt(n,16),B(k,c)):h?(o=h,y(r,o)?r[o]:(c&&E("named character reference was not terminated by a semicolon"),a)):(o=i,p=j,p&&b.isAttributeValue?(c&&"="==p&&E("`&` did not start a character reference"),a):(c&&E("named character reference was not terminated by a semicolon"),s[o]+(p||"")))})};G.options={isAttributeValue:!1,strict:!1};var H=function(a){return a.replace(m,function(a){return n[a]})},I={version:"1.1.1",encode:F,decode:G,escape:H,unescape:G};if("function"==typeof define&&"object"==typeof define.amd&&define.amd)define(function(){return I});else if(e&&!e.nodeType)if(f)f.exports=I;else for(var J in I)y(I,J)&&(e[J]=I[J]);else d.he=I}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],103:[function(a,b,c){var d=a("http"),e=b.exports;for(var f in d)d.hasOwnProperty(f)&&(e[f]=d[f]);e.request=function(a,b){return a||(a={}),a.scheme="https",a.protocol="https:",d.request.call(this,a,b)}},{http:152}],104:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?NaN:(n?-1:1)*(1/0);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=b<0||0===b&&1/b<0?1:0;for(b=Math.abs(b),isNaN(b)||b===1/0?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],105:[function(a,b,c){"function"==typeof Object.create?b.exports=function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:b.exports=function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],106:[function(a,b,c){function d(a){return!!a.constructor&&"function"==typeof a.constructor.isBuffer&&a.constructor.isBuffer(a)}function e(a){return"function"==typeof a.readFloatLE&&"function"==typeof a.slice&&d(a.slice(0,0))}b.exports=function(a){return null!=a&&(d(a)||e(a)||!!a._isBuffer)}},{}],107:[function(a,b,c){var d={}.toString;b.exports=Array.isArray||function(a){return"[object Array]"==d.call(a)}},{}],108:[function(a,b,c){"use strict";function d(a){return a.source.slice(1,-1)}var e=a("xml-char-classes");b.exports=new RegExp("^["+d(e.letter)+"_]["+d(e.letter)+d(e.digit)+"\\.\\-_"+d(e.combiningChar)+d(e.extender)+"]*$")},{"xml-char-classes":165}],109:[function(a,b,c){c.endianness=function(){return"LE"},c.hostname=function(){return"undefined"!=typeof location?location.hostname:""},c.loadavg=function(){return[]},c.uptime=function(){return 0},c.freemem=function(){return Number.MAX_VALUE},c.totalmem=function(){return Number.MAX_VALUE},c.cpus=function(){return[]},c.type=function(){return"Browser"},c.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},c.networkInterfaces=c.getNetworkInterfaces=function(){return{}},c.arch=function(){return"javascript"},c.platform=function(){return"browser"},c.tmpdir=c.tmpDir=function(){return"/tmp"},c.EOL="\n"},{}],110:[function(a,b,c){(function(a){function b(a,b){for(var c=0,d=a.length-1;d>=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;c1&&(d=c[0]+"@",a=c[1]),a=a.replace(G,".");var e=a.split("."),g=f(e,b).join(".");return d+g}function h(a){for(var b,c,d=[],e=0,f=a.length;e=55296&&b<=56319&&e65535&&(a-=65536,b+=K(a>>>10&1023|55296),a=56320|1023&a),b+=K(a)}).join("")}function j(a){return a-48<10?a-22:a-65<26?a-65:a-97<26?a-97:w}function k(a,b){return a+22+75*(a<26)-((0!=b)<<5)}function l(a,b,c){var d=0;for(a=c?J(a/A):a>>1,a+=J(a/b);a>I*y>>1;d+=w)a=J(a/I);return J(d+(I+1)*a/(a+z))}function m(a){var b,c,d,f,g,h,k,m,n,o,p=[],q=a.length,r=0,s=C,t=B;for(c=a.lastIndexOf(D),c<0&&(c=0),d=0;d=128&&e("not-basic"),p.push(a.charCodeAt(d));for(f=c>0?c+1:0;f=q&&e("invalid-input"),m=j(a.charCodeAt(f++)),(m>=w||m>J((v-r)/h))&&e("overflow"),r+=m*h,n=k<=t?x:k>=t+y?y:k-t,!(mJ(v/o)&&e("overflow"),h*=o;b=p.length+1,t=l(r-g,b,0==g),J(r/b)>v-s&&e("overflow"),s+=J(r/b),r%=b,p.splice(r++,0,s)}return i(p)}function n(a){var b,c,d,f,g,i,j,m,n,o,p,q,r,s,t,u=[];for(a=h(a),q=a.length,b=C,c=0,g=B,i=0;i=b&&pJ((v-c)/r)&&e("overflow"),c+=(j-b)*r,b=j,i=0;iv&&e("overflow"),p==b){for(m=c,n=w;o=n<=g?x:n>=g+y?y:n-g,!(m= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=w-x,J=Math.floor,K=String.fromCharCode;if(t={version:"1.4.1",ucs2:{decode:h,encode:i},decode:m,encode:n,toASCII:p,toUnicode:o},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return t});else if(q&&r)if(b.exports==q)r.exports=t;else for(u in t)t.hasOwnProperty(u)&&(q[u]=t[u]);else d.punycode=t}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],114:[function(a,b,c){"use strict";function d(a,b){return Object.prototype.hasOwnProperty.call(a,b)}b.exports=function(a,b,c,f){b=b||"&",c=c||"=";var g={};if("string"!=typeof a||0===a.length)return g;var h=/\+/g;a=a.split(b);var i=1e3;f&&"number"==typeof f.maxKeys&&(i=f.maxKeys);var j=a.length;i>0&&j>i&&(j=i);for(var k=0;k=0?(l=p.substr(0,q),m=p.substr(q+1)):(l=p,m=""),n=decodeURIComponent(l),o=decodeURIComponent(m),d(g,n)?e(g[n])?g[n].push(o):g[n]=[g[n],o]:g[n]=o}return g};var e=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}},{}],115:[function(a,b,c){"use strict";function d(a,b){if(a.map)return a.map(b);for(var c=[],d=0;d0)if(b.ended&&!e){var g=new Error("stream.push() after EOF");a.emit("error",g)}else if(b.endEmitted&&e){var i=new Error("stream.unshift() after end event");a.emit("error",i)}else{var j;!b.decoder||e||d||(c=b.decoder.write(c),j=!b.objectMode&&0===c.length),e||(b.reading=!1),j||(b.flowing&&0===b.length&&!b.sync?(a.emit("data",c),a.read(0)):(b.length+=b.objectMode?1:c.length,e?b.buffer.unshift(c):b.buffer.push(c),b.needReadable&&m(a))),o(a,b)}else e||(b.reading=!1);return h(b)}function h(a){return!a.ended&&(a.needReadable||a.length=P?a=P:(a--,a|=a>>>1,a|=a>>>2,a|=a>>>4,a|=a>>>8,a|=a>>>16,a++),a}function j(a,b){return a<=0||0===b.length&&b.ended?0:b.objectMode?1:a!==a?b.flowing&&b.length?b.buffer.head.data.length:b.length:(a>b.highWaterMark&&(b.highWaterMark=i(a)),a<=b.length?a:b.ended?b.length:(b.needReadable=!0,0))}function k(a,b){var c=null;return I.isBuffer(b)||"string"==typeof b||null===b||void 0===b||a.objectMode||(c=new TypeError("Invalid non-string/buffer chunk")),c}function l(a,b){if(!b.ended){if(b.decoder){var c=b.decoder.end();c&&c.length&&(b.buffer.push(c),b.length+=b.objectMode?1:c.length)}b.ended=!0,m(a)}}function m(a){var b=a._readableState;b.needReadable=!1,b.emittedReadable||(M("emitReadable",b.flowing),b.emittedReadable=!0,b.sync?E(n,a):n(a))}function n(a){M("emit readable"),a.emit("readable"),u(a)}function o(a,b){b.readingMore||(b.readingMore=!0,E(p,a,b))}function p(a,b){for(var c=b.length;!b.reading&&!b.flowing&&!b.ended&&b.length=b.length?(c=b.decoder?b.buffer.join(""):1===b.buffer.length?b.buffer.head.data:b.buffer.concat(b.length),b.buffer.clear()):c=w(a,b.buffer,b.decoder),c}function w(a,b,c){var d;return af.length?f.length:a;if(e+=g===f.length?f:f.slice(0,a),a-=g,0===a){g===f.length?(++d,c.next?b.head=c.next:b.head=b.tail=null):(b.head=c,c.data=f.slice(g));break}++d}return b.length-=d,e}function y(a,b){var c=J.allocUnsafe(a),d=b.head,e=1;for(d.data.copy(c),a-=d.data.length;d=d.next;){var f=d.data,g=a>f.length?f.length:a;if(f.copy(c,c.length-a,0,g),a-=g,0===a){g===f.length?(++e,d.next?b.head=d.next:b.head=b.tail=null):(b.head=d,d.data=f.slice(g));break}++e}return b.length-=e,c}function z(a){var b=a._readableState;if(b.length>0)throw new Error('"endReadable()" called on non-empty stream');b.endEmitted||(b.ended=!0,E(A,b,a))}function A(a,b){a.endEmitted||0!==a.length||(a.endEmitted=!0,b.readable=!1,b.emit("end"))}function B(a,b){for(var c=0,d=a.length;c=b.highWaterMark||b.ended))return M("read: emitReadable",b.length,b.ended),0===b.length&&b.ended?z(this):m(this),null;if(a=j(a,b),0===a&&b.ended)return 0===b.length&&z(this),null;var d=b.needReadable;M("need readable",d),(0===b.length||b.length-a0?v(a,b):null,null===e?(b.needReadable=!0,a=0):b.length-=a,0===b.length&&(b.ended||(b.needReadable=!0),c!==a&&b.ended&&z(this)),null!==e&&this.emit("data",e),e},f.prototype._read=function(a){this.emit("error",new Error("_read() is not implemented"))},f.prototype.pipe=function(a,b){function e(a){M("onunpipe"),a===m&&g()}function f(){M("onend"),a.end()}function g(){M("cleanup"),a.removeListener("close",j),a.removeListener("finish",k),a.removeListener("drain",r),a.removeListener("error",i),a.removeListener("unpipe",e),m.removeListener("end",f),m.removeListener("end",g),m.removeListener("data",h),s=!0,!n.awaitDrain||a._writableState&&!a._writableState.needDrain||r()}function h(b){M("ondata"),t=!1;var c=a.write(b);!1!==c||t||((1===n.pipesCount&&n.pipes===a||n.pipesCount>1&&C(n.pipes,a)!==-1)&&!s&&(M("false write response, pause",m._readableState.awaitDrain),m._readableState.awaitDrain++,t=!0),m.pause())}function i(b){M("onerror",b),l(),a.removeListener("error",i),0===H(a,"error")&&a.emit("error",b)}function j(){a.removeListener("finish",k),l()}function k(){M("onfinish"),a.removeListener("close",j),l()}function l(){ +M("unpipe"),m.unpipe(a)}var m=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=a;break;case 1:n.pipes=[n.pipes,a];break;default:n.pipes.push(a)}n.pipesCount+=1,M("pipe count=%d opts=%j",n.pipesCount,b);var o=(!b||b.end!==!1)&&a!==c.stdout&&a!==c.stderr,p=o?f:g;n.endEmitted?E(p):m.once("end",p),a.on("unpipe",e);var r=q(m);a.on("drain",r);var s=!1,t=!1;return m.on("data",h),d(a,"error",i),a.once("close",j),a.once("finish",k),a.emit("pipe",m),n.flowing||(M("pipe resume"),m.resume()),a},f.prototype.unpipe=function(a){var b=this._readableState;if(0===b.pipesCount)return this;if(1===b.pipesCount)return a&&a!==b.pipes?this:(a||(a=b.pipes),b.pipes=null,b.pipesCount=0,b.flowing=!1,a&&a.emit("unpipe",this),this);if(!a){var c=b.pipes,d=b.pipesCount;b.pipes=null,b.pipesCount=0,b.flowing=!1;for(var e=0;e-1?setImmediate:y;g.WritableState=f;var A=a("core-util-is");A.inherits=a("inherits");var B,C={deprecate:a("util-deprecate")};!function(){try{B=a("stream")}catch(a){}finally{B||(B=a("events").EventEmitter)}}();var D=a("buffer").Buffer,E=a("buffer-shims");A.inherits(g,B),f.prototype.getBuffer=function(){for(var a=this.bufferedRequest,b=[];a;)b.push(a),a=a.next;return b},function(){try{Object.defineProperty(f.prototype,"buffer",{get:C.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(a){}}();var F;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(F=Function.prototype[Symbol.hasInstance],Object.defineProperty(g,Symbol.hasInstance,{value:function(a){return!!F.call(this,a)||a&&a._writableState instanceof f}})):F=function(a){return a instanceof this},g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},g.prototype.write=function(a,b,c){var e=this._writableState,f=!1;return"function"==typeof b&&(c=b,b=null),D.isBuffer(a)?b="buffer":b||(b=e.defaultEncoding),"function"!=typeof c&&(c=d),e.ended?h(this,c):i(this,e,a,c)&&(e.pendingcb++,f=k(this,e,a,b,c)),f},g.prototype.cork=function(){var a=this._writableState;a.corked++},g.prototype.uncork=function(){var a=this._writableState;a.corked&&(a.corked--,a.writing||a.corked||a.finished||a.bufferProcessing||!a.bufferedRequest||r(this,a))},g.prototype.setDefaultEncoding=function(a){if("string"==typeof a&&(a=a.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((a+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+a);return this._writableState.defaultEncoding=a,this},g.prototype._write=function(a,b,c){c(new Error("_write() is not implemented"))},g.prototype._writev=null,g.prototype.end=function(a,b,c){var d=this._writableState;"function"==typeof a?(c=a,a=null,b=null):"function"==typeof b&&(c=b,b=null),null!==a&&void 0!==a&&this.write(a,b),d.corked&&(d.corked=1,this.uncork()),d.ending||d.finished||v(this,d,c)}}).call(this,a("_process"))},{"./_stream_duplex":117,_process:112,buffer:5,"buffer-shims":4,"core-util-is":100,events:101,inherits:105,"process-nextick-args":111,"util-deprecate":161}],122:[function(a,b,c){"use strict";function d(){this.head=null,this.tail=null,this.length=0}var e=(a("buffer").Buffer,a("buffer-shims"));b.exports=d,d.prototype.push=function(a){var b={data:a,next:null};this.length>0?this.tail.next=b:this.head=b,this.tail=b,++this.length},d.prototype.unshift=function(a){var b={data:a,next:this.head};0===this.length&&(this.tail=b),this.head=b,++this.length},d.prototype.shift=function(){if(0!==this.length){var a=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,a}},d.prototype.clear=function(){this.head=this.tail=null,this.length=0},d.prototype.join=function(a){if(0===this.length)return"";for(var b=this.head,c=""+b.data;b=b.next;)c+=a+b.data;return c},d.prototype.concat=function(a){if(0===this.length)return e.alloc(0);if(1===this.length)return this.head.data;for(var b=e.allocUnsafe(a>>>0),c=this.head,d=0;c;)c.data.copy(b,d),d+=c.data.length,c=c.next;return b}},{buffer:5,"buffer-shims":4}],123:[function(a,b,c){(function(d){var e=function(){try{return a("stream")}catch(a){}}();c=b.exports=a("./lib/_stream_readable.js"),c.Stream=e||c,c.Readable=c,c.Writable=a("./lib/_stream_writable.js"),c.Duplex=a("./lib/_stream_duplex.js"),c.Transform=a("./lib/_stream_transform.js"),c.PassThrough=a("./lib/_stream_passthrough.js"),!d.browser&&"disable"===d.env.READABLE_STREAM&&e&&(b.exports=e)}).call(this,a("_process"))},{"./lib/_stream_duplex.js":117,"./lib/_stream_passthrough.js":118,"./lib/_stream_readable.js":119,"./lib/_stream_transform.js":120,"./lib/_stream_writable.js":121,_process:112}],124:[function(a,b,c){"use strict";b.exports={ABSOLUTE:"absolute",PATH_RELATIVE:"pathRelative",ROOT_RELATIVE:"rootRelative",SHORTEST:"shortest"}},{}],125:[function(a,b,c){"use strict";function d(a,b){return!a.auth||b.removeAuth||!a.extra.relation.maximumHost&&b.output!==p.ABSOLUTE?"":a.auth+"@"}function e(a,b){return a.hash?a.hash:""}function f(a,b){return a.host.full&&(a.extra.relation.maximumAuth||b.output===p.ABSOLUTE)?a.host.full:""}function g(a,b){var c="",d=a.path.absolute.string,e=a.path.relative.string,f=o(a,b);if(a.extra.relation.maximumHost||b.output===p.ABSOLUTE||b.output===p.ROOT_RELATIVE)c=d;else if(e.length<=d.length&&b.output===p.SHORTEST||b.output===p.PATH_RELATIVE){if(c=e,""===c){var g=n(a,b)&&!!m(a,b);a.extra.relation.maximumPath&&!f?c="./":!a.extra.relation.overridesQuery||f||g||(c="./")}}else c=d;return"/"!==c||f||!b.removeRootTrailingSlash||a.extra.relation.minimumPort&&b.output!==p.ABSOLUTE||(c=""),c}function h(a,b){return a.port&&!a.extra.portIsDefault&&a.extra.relation.maximumHost?":"+a.port:""}function i(a,b){return n(a,b)?m(a,b):""}function j(a,b){return o(a,b)?a.resource:""}function k(a,b){var c="";return(a.extra.relation.maximumHost||b.output===p.ABSOLUTE)&&(c+=a.extra.relation.minimumScheme&&b.schemeRelative&&b.output!==p.ABSOLUTE?"//":a.scheme+"://"),c}function l(a,b){var c="";return c+=k(a,b),c+=d(a,b),c+=f(a,b),c+=h(a,b),c+=g(a,b),c+=j(a,b),c+=i(a,b),c+=e(a,b)}function m(a,b){var c=b.removeEmptyQueries&&a.extra.relation.minimumPort;return a.query.string[c?"stripped":"full"]}function n(a,b){return!a.extra.relation.minimumQuery||b.output===p.ABSOLUTE||b.output===p.ROOT_RELATIVE}function o(a,b){var c=b.removeDirectoryIndexes&&a.extra.resourceIsIndex,d=a.extra.relation.minimumResource&&b.output!==p.ABSOLUTE&&b.output!==p.ROOT_RELATIVE;return!!a.resource&&!d&&!c}var p=a("./constants");b.exports=l},{"./constants":124}],126:[function(a,b,c){"use strict";function d(a,b){this.options=g(b,{defaultPorts:{ftp:21,http:80,https:443},directoryIndexes:["index.html"],ignore_www:!1,output:d.SHORTEST,rejectedSchemes:["data","javascript","mailto"],removeAuth:!1,removeDirectoryIndexes:!0,removeEmptyQueries:!1,removeRootTrailingSlash:!0,schemeRelative:!0,site:void 0,slashesDenoteHost:!0}),this.from=i.from(a,this.options,null)}var e=a("./constants"),f=a("./format"),g=a("./options"),h=a("./util/object"),i=a("./parse"),j=a("./relate");d.prototype.relate=function(a,b,c){if(h.isPlainObject(b)?(c=b,b=a,a=null):b||(b=a,a=null),c=g(c,this.options),a=a||c.site,a=i.from(a,c,this.from),!a||!a.href)throw new Error("from value not defined.");if(a.extra.hrefInfo.minimumPathOnly)throw new Error("from value supplied is not absolute: "+a.href);return b=i.to(b,c),b.valid===!1?b.href:(b=j(a,b,c),b=f(b,c))},d.relate=function(a,b,c){return(new d).relate(a,b,c)},h.shallowMerge(d,e),b.exports=d},{"./constants":124,"./format":125,"./options":127,"./parse":130,"./relate":137,"./util/object":139}],127:[function(a,b,c){"use strict";function d(a,b){if(f.isPlainObject(a)){var c={};for(var d in b)b.hasOwnProperty(d)&&(void 0!==a[d]?c[d]=e(a[d],b[d]):c[d]=b[d]);return c}return b}function e(a,b){return b instanceof Object&&a instanceof Object?b instanceof Array&&a instanceof Array?b.concat(a):f.shallowMerge(a,b):a}var f=a("./util/object");b.exports=d},{"./util/object":139}],128:[function(a,b,c){"use strict";function d(a,b){if(b.ignore_www){var c=a.host.full;if(c){var d=c;0===c.indexOf("www.")&&(d=c.substr(4)),a.host.stripped=d}}}b.exports=d},{}],129:[function(a,b,c){"use strict";function d(a){var b=!(a.scheme||a.auth||a.host.full||a.port),c=b&&!a.path.absolute.string,d=c&&!a.resource,e=d&&!a.query.string.full.length,f=e&&!a.hash;a.extra.hrefInfo.minimumPathOnly=b,a.extra.hrefInfo.minimumResourceOnly=c,a.extra.hrefInfo.minimumQueryOnly=d,a.extra.hrefInfo.minimumHashOnly=e,a.extra.hrefInfo.empty=f}b.exports=d},{}],130:[function(a,b,c){"use strict";function d(a,b,c){if(a){var d=e(a,b),f=l.resolveDotSegments(d.path.absolute.array);return d.path.absolute.array=f,d.path.absolute.string="/"+l.join(f),d}return c}function e(a,b){var c=k(a,b);return c.valid===!1?c:(g(c,b),i(c,b),h(c,b),j(c,b),f(c),c)}var f=a("./hrefInfo"),g=a("./host"),h=a("./path"),i=a("./port"),j=a("./query"),k=a("./urlstring"),l=a("../util/path");b.exports={from:d,to:e}},{"../util/path":140,"./host":128,"./hrefInfo":129,"./path":131,"./port":132,"./query":133,"./urlstring":134}],131:[function(a,b,c){"use strict";function d(a,b){var c=!1;return b.directoryIndexes.every(function(b){return b!==a||(c=!0,!1)}),c}function e(a,b){var c=a.path.absolute.string;if(c){var e=c.lastIndexOf("/");if(e>-1){if(++e-1&&(c=c.toString(),null===a.port&&(a.port=c),a.extra.portIsDefault=a.port===c)}b.exports=d},{}],133:[function(a,b,c){"use strict";function d(a,b){a.query.string.full=e(a.query.object,!1),b.removeEmptyQueries&&(a.query.string.stripped=e(a.query.object,!0))}function e(a,b){var c=0,d="";for(var e in a)if(""!==e&&f.call(a,e)===!0){var g=a[e];""===g&&b||(d+=1===++c?"?":"&",e=encodeURIComponent(e),d+=""!==g?e+"="+encodeURIComponent(g).replace(/%20/g,"+"):e)}return d}var f=Object.prototype.hasOwnProperty;b.exports=d},{}],134:[function(a,b,c){"use strict";function d(a){var b=a.protocol;return b&&b.indexOf(":")===b.length-1&&(b=b.substr(0,b.length-1)),a.host={full:a.hostname,stripped:null},a.path={absolute:{array:null,string:a.pathname},relative:{array:null,string:null}},a.query={object:a.query,string:{full:null,stripped:null}},a.extra={hrefInfo:{minimumPathOnly:null,minimumResourceOnly:null,minimumQueryOnly:null,minimumHashOnly:null,empty:null,separatorOnlyQuery:"?"===a.search},portIsDefault:null,relation:{maximumScheme:null,maximumAuth:null,maximumHost:null,maximumPort:null,maximumPath:null,maximumResource:null,maximumQuery:null,maximumHash:null,minimumScheme:null,minimumAuth:null,minimumHost:null,minimumPort:null,minimumPath:null,minimumResource:null,minimumQuery:null,minimumHash:null,overridesQuery:null},resourceIsIndex:null,slashes:a.slashes},a.resource=null,a.scheme=b,delete a.hostname,delete a.pathname,delete a.protocol,delete a.search,delete a.slashes,a}function e(a,b){var c=!0;return b.rejectedSchemes.every(function(b){return c=!(0===a.indexOf(b+":"))}),c}function f(a,b){return e(a,b)?d(g(a,!0,b.slashesDenoteHost)):{href:a,valid:!1}}var g=a("url").parse;b.exports=f},{url:159}],135:[function(a,b,c){"use strict";function d(a,b,c){h.upToPath(a,b,c),a.extra.relation.minimumScheme&&(a.scheme=b.scheme),a.extra.relation.minimumAuth&&(a.auth=b.auth),a.extra.relation.minimumHost&&(a.host=i.clone(b.host)),a.extra.relation.minimumPort&&f(a,b),a.extra.relation.minimumScheme&&e(a,b),h.pathOn(a,b,c),a.extra.relation.minimumResource&&g(a,b),a.extra.relation.minimumQuery&&(a.query=i.clone(b.query)),a.extra.relation.minimumHash&&(a.hash=b.hash)}function e(a,b){if(a.extra.relation.maximumHost||!a.extra.hrefInfo.minimumResourceOnly){var c=a.path.absolute.array,d="/";c?(a.extra.hrefInfo.minimumPathOnly&&0!==a.path.absolute.string.indexOf("/")&&(c=b.path.absolute.array.concat(c)),c=j.resolveDotSegments(c),d+=j.join(c)):c=[],a.path.absolute.array=c,a.path.absolute.string=d}else a.path=i.clone(b.path)}function f(a,b){a.port=b.port,a.extra.portIsDefault=b.extra.portIsDefault}function g(a,b){a.resource=b.resource,a.extra.resourceIsIndex=b.extra.resourceIsIndex}var h=a("./findRelation"),i=a("../util/object"),j=a("../util/path");b.exports=d},{"../util/object":139,"../util/path":140,"./findRelation":136}],136:[function(a,b,c){"use strict";function d(a,b,c){var d=a.extra.hrefInfo.minimumPathOnly,e=a.scheme===b.scheme||!a.scheme,f=e&&(a.auth===b.auth||c.removeAuth||d),g=c.ignore_www?"stripped":"full",h=f&&(a.host[g]===b.host[g]||d),i=h&&(a.port===b.port||d);a.extra.relation.minimumScheme=e,a.extra.relation.minimumAuth=f,a.extra.relation.minimumHost=h,a.extra.relation.minimumPort=i,a.extra.relation.maximumScheme=!e||e&&!f,a.extra.relation.maximumAuth=!e||e&&!h,a.extra.relation.maximumHost=!e||e&&!i}function e(a,b,c){var d=a.extra.hrefInfo.minimumQueryOnly,e=a.extra.hrefInfo.minimumHashOnly,f=a.extra.hrefInfo.empty,g=a.extra.relation.minimumPort,h=a.extra.relation.minimumScheme,i=g&&a.path.absolute.string===b.path.absolute.string,j=a.resource===b.resource||!a.resource&&b.extra.resourceIsIndex||c.removeDirectoryIndexes&&a.extra.resourceIsIndex&&!b.resource,k=i&&(j||d||e||f),l=c.removeEmptyQueries?"stripped":"full",m=a.query.string[l],n=b.query.string[l],o=k&&!!m&&m===n||(e||f)&&!a.extra.hrefInfo.separatorOnlyQuery,p=o&&a.hash===b.hash;a.extra.relation.minimumPath=i,a.extra.relation.minimumResource=k,a.extra.relation.minimumQuery=o,a.extra.relation.minimumHash=p,a.extra.relation.maximumPort=!h||h&&!i,a.extra.relation.maximumPath=!h||h&&!k,a.extra.relation.maximumResource=!h||h&&!o,a.extra.relation.maximumQuery=!h||h&&!p,a.extra.relation.maximumHash=!h||h&&!p,a.extra.relation.overridesQuery=i&&a.extra.relation.maximumResource&&!o&&!!n}b.exports={pathOn:e,upToPath:d}},{}],137:[function(a,b,c){"use strict";function d(a,b,c){return e(b,a,c),f(b,a,c),b}var e=a("./absolutize"),f=a("./relativize");b.exports=d},{"./absolutize":135,"./relativize":138}],138:[function(a,b,c){"use strict";function d(a,b){var c=[],d=!0,e=-1;return b.forEach(function(b,f){d&&(a[f]!==b?d=!1:e=f),d||c.push("..")}),a.forEach(function(a,b){b>e&&c.push(a)}),c}function e(a,b,c){if(a.extra.relation.minimumScheme){var e=d(a.path.absolute.array,b.path.absolute.array);a.path.relative.array=e,a.path.relative.string=f.join(e)}}var f=a("../util/path");b.exports=e},{"../util/path":140}],139:[function(a,b,c){"use strict";function d(a){if(a instanceof Object){var b=a instanceof Array?[]:{};for(var c in a)a.hasOwnProperty(c)&&(b[c]=d(a[c]));return b}return a}function e(a){return!!a&&"object"==typeof a&&a.constructor===Object}function f(a,b){if(a instanceof Object&&b instanceof Object)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}b.exports={clone:d,isPlainObject:e,shallowMerge:f}},{}],140:[function(a,b,c){"use strict";function d(a){return a.length>0?a.join("/")+"/":""}function e(a){var b=[];return a.forEach(function(a){".."!==a?"."!==a&&b.push(a):b.length>0&&b.splice(b.length-1,1)}),b}b.exports={join:d,resolveDotSegments:e}},{}],141:[function(a,b,c){function d(){this._array=[],this._set=Object.create(null)}var e=a("./util"),f=Object.prototype.hasOwnProperty;d.fromArray=function(a,b){for(var c=new d,e=0,f=a.length;e=0&&a>1;return b?-c:c}var f=a("./base64"),g=5,h=1<>>=g,e>0&&(b|=j),c+=f.encode(b);while(e>0);return c},c.decode=function(a,b,c){var d,h,k=a.length,l=0,m=0;do{if(b>=k)throw new Error("Expected more digits in base 64 VLQ value.");if(h=f.decode(a.charCodeAt(b++)),h===-1)throw new Error("Invalid base64 digit: "+a.charAt(b-1));d=!!(h&j),h&=i,l+=h<0?b-i>1?d(i,b,e,f,g,h):h==c.LEAST_UPPER_BOUND?b1?d(a,i,e,f,g,h):h==c.LEAST_UPPER_BOUND?i:a<0?-1:a}c.GREATEST_LOWER_BOUND=1,c.LEAST_UPPER_BOUND=2,c.search=function(a,b,e,f){if(0===b.length)return-1;var g=d(-1,b.length,a,b,e,f||c.GREATEST_LOWER_BOUND);if(g<0)return-1;for(;g-1>=0&&0===e(b[g],b[g-1],!0);)--g;return g}},{}],145:[function(a,b,c){function d(a,b){var c=a.generatedLine,d=b.generatedLine,e=a.generatedColumn,g=b.generatedColumn;return d>c||d==c&&g>=e||f.compareByGeneratedPositionsInflated(a,b)<=0}function e(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var f=a("./util");e.prototype.unsortedForEach=function(a,b){this._array.forEach(a,b)},e.prototype.add=function(a){d(this._last,a)?(this._last=a,this._array.push(a)):(this._sorted=!1,this._array.push(a))},e.prototype.toArray=function(){return this._sorted||(this._array.sort(f.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},c.MappingList=e},{"./util":150}],146:[function(a,b,c){function d(a,b,c){var d=a[b];a[b]=a[c],a[c]=d}function e(a,b){return Math.round(a+Math.random()*(b-a))}function f(a,b,c,g){if(c=0){var f=this._originalMappings[e];if(void 0===a.column)for(var g=f.originalLine;f&&f.originalLine===g;)d.push({line:h.getArg(f,"generatedLine",null),column:h.getArg(f,"generatedColumn",null),lastColumn:h.getArg(f,"lastGeneratedColumn",null)}),f=this._originalMappings[++e];else for(var j=f.originalColumn;f&&f.originalLine===b&&f.originalColumn==j;)d.push({line:h.getArg(f,"generatedLine",null),column:h.getArg(f,"generatedColumn",null),lastColumn:h.getArg(f,"lastGeneratedColumn",null)}),f=this._originalMappings[++e]}return d},c.SourceMapConsumer=d,e.prototype=Object.create(d.prototype),e.prototype.consumer=d,e.fromSourceMap=function(a){var b=Object.create(e.prototype),c=b._names=j.fromArray(a._names.toArray(),!0),d=b._sources=j.fromArray(a._sources.toArray(),!0);b.sourceRoot=a._sourceRoot,b.sourcesContent=a._generateSourcesContent(b._sources.toArray(),b.sourceRoot),b.file=a._file;for(var g=a._mappings.toArray().slice(),i=b.__generatedMappings=[],k=b.__originalMappings=[],m=0,n=g.length;m1&&(c.source=p+e[1],p+=e[1],c.originalLine=n+e[2],n=c.originalLine,c.originalLine+=1,c.originalColumn=o+e[3],o=c.originalColumn,e.length>4&&(c.name=q+e[4],q+=e[4])),w.push(c),"number"==typeof c.originalLine&&v.push(c)}l(w,h.compareByGeneratedPositionsDeflated),this.__generatedMappings=w,l(v,h.compareByOriginalPositions),this.__originalMappings=v},e.prototype._findMapping=function(a,b,c,d,e,f){if(a[c]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+a[c]);if(a[d]<0)throw new TypeError("Column must be greater than or equal to 0, got "+a[d]);return i.search(a,b,e,f)},e.prototype.computeColumnSpans=function(){for(var a=0;a=0){var e=this._generatedMappings[c];if(e.generatedLine===b.generatedLine){var f=h.getArg(e,"source",null);null!==f&&(f=this._sources.at(f),null!=this.sourceRoot&&(f=h.join(this.sourceRoot,f)));var g=h.getArg(e,"name",null);return null!==g&&(g=this._names.at(g)),{source:f,line:h.getArg(e,"originalLine",null),column:h.getArg(e,"originalColumn",null),name:g}}}return{source:null,line:null,column:null,name:null}},e.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(a){return null==a}))},e.prototype.sourceContentFor=function(a,b){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(a=h.relative(this.sourceRoot,a)),this._sources.has(a))return this.sourcesContent[this._sources.indexOf(a)];var c;if(null!=this.sourceRoot&&(c=h.urlParse(this.sourceRoot))){var d=a.replace(/^file:\/\//,"");if("file"==c.scheme&&this._sources.has(d))return this.sourcesContent[this._sources.indexOf(d)];if((!c.path||"/"==c.path)&&this._sources.has("/"+a))return this.sourcesContent[this._sources.indexOf("/"+a)]}if(b)return null;throw new Error('"'+a+'" is not in the SourceMap.')},e.prototype.generatedPositionFor=function(a){var b=h.getArg(a,"source");if(null!=this.sourceRoot&&(b=h.relative(this.sourceRoot,b)),!this._sources.has(b))return{line:null,column:null,lastColumn:null};b=this._sources.indexOf(b);var c={source:b,originalLine:h.getArg(a,"line"),originalColumn:h.getArg(a,"column")},e=this._findMapping(c,this._originalMappings,"originalLine","originalColumn",h.compareByOriginalPositions,h.getArg(a,"bias",d.GREATEST_LOWER_BOUND));if(e>=0){var f=this._originalMappings[e];if(f.source===c.source)return{line:h.getArg(f,"generatedLine",null),column:h.getArg(f,"generatedColumn",null),lastColumn:h.getArg(f,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},c.BasicSourceMapConsumer=e,g.prototype=Object.create(d.prototype),g.prototype.constructor=d,g.prototype._version=3,Object.defineProperty(g.prototype,"sources",{get:function(){for(var a=[],b=0;b0&&a.column>=0)||b||c||d)&&!(a&&"line"in a&&"column"in a&&b&&"line"in b&&"column"in b&&a.line>0&&a.column>=0&&b.line>0&&b.column>=0&&c))throw new Error("Invalid mapping: "+JSON.stringify({generated:a,source:c,original:b,name:d}))},d.prototype._serializeMappings=function(){for(var a,b,c,d,g=0,h=1,i=0,j=0,k=0,l=0,m="",n=this._mappings.toArray(),o=0,p=n.length;o0){if(!f.compareByGeneratedPositionsInflated(b,n[o-1]))continue;a+=","}a+=e.encode(b.generatedColumn-g),g=b.generatedColumn,null!=b.source&&(d=this._sources.indexOf(b.source),a+=e.encode(d-l),l=d,a+=e.encode(b.originalLine-1-j),j=b.originalLine-1,a+=e.encode(b.originalColumn-i),i=b.originalColumn,null!=b.name&&(c=this._names.indexOf(b.name),a+=e.encode(c-k),k=c)),m+=a}return m},d.prototype._generateSourcesContent=function(a,b){return a.map(function(a){if(!this._sourcesContents)return null;null!=b&&(a=f.relative(b,a));var c=f.toSetString(a);return Object.prototype.hasOwnProperty.call(this._sourcesContents,c)?this._sourcesContents[c]:null},this)},d.prototype.toJSON=function(){var a={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(a.file=this._file),null!=this._sourceRoot&&(a.sourceRoot=this._sourceRoot),this._sourcesContents&&(a.sourcesContent=this._generateSourcesContent(a.sources,a.sourceRoot)),a},d.prototype.toString=function(){return JSON.stringify(this.toJSON())},c.SourceMapGenerator=d},{"./array-set":141,"./base64-vlq":142,"./mapping-list":145,"./util":150}],149:[function(a,b,c){function d(a,b,c,d,e){this.children=[],this.sourceContents={},this.line=null==a?null:a,this.column=null==b?null:b,this.source=null==c?null:c,this.name=null==e?null:e,this[i]=!0,null!=d&&this.add(d)}var e=a("./source-map-generator").SourceMapGenerator,f=a("./util"),g=/(\r?\n)/,h=10,i="$$$isSourceNode$$$";d.fromStringWithSourceMap=function(a,b,c){function e(a,b){if(null===a||void 0===a.source)h.add(b);else{var e=c?f.join(c,a.source):a.source;h.add(new d(a.originalLine,a.originalColumn,e,b,a.name))}}var h=new d,i=a.split(g),j=function(){var a=i.shift(),b=i.shift()||"";return a+b},k=1,l=0,m=null;return b.eachMapping(function(a){if(null!==m){if(!(k0&&(m&&e(m,j()),h.add(i.join(""))),b.sources.forEach(function(a){var d=b.sourceContentFor(a);null!=d&&(null!=c&&(a=f.join(c,a)),h.setSourceContent(a,d))}),h},d.prototype.add=function(a){if(Array.isArray(a))a.forEach(function(a){this.add(a)},this);else{if(!a[i]&&"string"!=typeof a)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+a);a&&this.children.push(a)}return this},d.prototype.prepend=function(a){if(Array.isArray(a))for(var b=a.length-1;b>=0;b--)this.prepend(a[b]);else{if(!a[i]&&"string"!=typeof a)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+a);this.children.unshift(a)}return this},d.prototype.walk=function(a){for(var b,c=0,d=this.children.length;c0){for(b=[],c=0;c=0;k--)g=i[k],"."===g?i.splice(k,1):".."===g?j++:j>0&&(""===g?(i.splice(k+1,j),j=0):(i.splice(k,2),j--));return b=i.join("/"),""===b&&(b=h?"/":"."),d?(d.path=b,f(d)):b}function h(a,b){""===a&&(a="."),""===b&&(b=".");var c=e(b),d=e(a);if(d&&(a=d.path||"/"),c&&!c.scheme)return d&&(c.scheme=d.scheme),f(c);if(c||b.match(s))return b;if(d&&!d.host&&!d.path)return d.host=b,f(d);var h="/"===b.charAt(0)?b:g(a.replace(/\/+$/,"")+"/"+b);return d?(d.path=h,f(d)):h}function i(a,b){""===a&&(a="."),a=a.replace(/\/$/,"");for(var c=0;0!==b.indexOf(a+"/");){var d=a.lastIndexOf("/");if(d<0)return b;if(a=a.slice(0,d),a.match(/^([^\/]+:\/)?\/*$/))return b;++c}return Array(c+1).join("../")+b.substr(a.length+1)}function j(a){return a}function k(a){return m(a)?"$"+a:a}function l(a){return m(a)?a.slice(1):a}function m(a){if(!a)return!1;var b=a.length;if(b<9)return!1;if(95!==a.charCodeAt(b-1)||95!==a.charCodeAt(b-2)||111!==a.charCodeAt(b-3)||116!==a.charCodeAt(b-4)||111!==a.charCodeAt(b-5)||114!==a.charCodeAt(b-6)||112!==a.charCodeAt(b-7)||95!==a.charCodeAt(b-8)||95!==a.charCodeAt(b-9))return!1;for(var c=b-10;c>=0;c--)if(36!==a.charCodeAt(c))return!1;return!0}function n(a,b,c){var d=a.source-b.source;return 0!==d?d:(d=a.originalLine-b.originalLine,0!==d?d:(d=a.originalColumn-b.originalColumn,0!==d||c?d:(d=a.generatedColumn-b.generatedColumn,0!==d?d:(d=a.generatedLine-b.generatedLine,0!==d?d:a.name-b.name))))}function o(a,b,c){var d=a.generatedLine-b.generatedLine;return 0!==d?d:(d=a.generatedColumn-b.generatedColumn,0!==d||c?d:(d=a.source-b.source,0!==d?d:(d=a.originalLine-b.originalLine,0!==d?d:(d=a.originalColumn-b.originalColumn,0!==d?d:a.name-b.name))))}function p(a,b){return a===b?0:a>b?1:-1}function q(a,b){var c=a.generatedLine-b.generatedLine;return 0!==c?c:(c=a.generatedColumn-b.generatedColumn,0!==c?c:(c=p(a.source,b.source),0!==c?c:(c=a.originalLine-b.originalLine,0!==c?c:(c=a.originalColumn-b.originalColumn,0!==c?c:p(a.name,b.name)))))}c.getArg=d;var r=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,s=/^data:.+\,.+$/;c.urlParse=e,c.urlGenerate=f,c.normalize=g,c.join=h,c.isAbsolute=function(a){return"/"===a.charAt(0)||!!a.match(r)},c.relative=i;var t=function(){var a=Object.create(null);return!("__proto__"in a)}();c.toSetString=t?j:k,c.fromSetString=t?j:l,c.compareByOriginalPositions=n,c.compareByGeneratedPositionsDeflated=o,c.compareByGeneratedPositionsInflated=q},{}],151:[function(a,b,c){c.SourceMapGenerator=a("./lib/source-map-generator").SourceMapGenerator,c.SourceMapConsumer=a("./lib/source-map-consumer").SourceMapConsumer,c.SourceNode=a("./lib/source-node").SourceNode},{"./lib/source-map-consumer":147,"./lib/source-map-generator":148,"./lib/source-node":149}],152:[function(a,b,c){(function(b){var d=a("./lib/request"),e=a("xtend"),f=a("builtin-status-codes"),g=a("url"),h=c;h.request=function(a,c){a="string"==typeof a?g.parse(a):e(a);var f=b.location.protocol.search(/^https?:$/)===-1?"http:":"",h=a.protocol||f,i=a.hostname||a.host,j=a.port,k=a.path||"/";i&&i.indexOf(":")!==-1&&(i="["+i+"]"),a.url=(i?h+"//"+i:"")+(j?":"+j:"")+k,a.method=(a.method||"GET").toUpperCase(),a.headers=a.headers||{};var l=new d(a);return c&&l.on("response",c),l},h.get=function(a,b){var c=h.request(a,b);return c.end(),c},h.Agent=function(){},h.Agent.defaultMaxSockets=4,h.STATUS_CODES=f,h.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/request":154,"builtin-status-codes":6,url:159,xtend:166}],153:[function(a,b,c){(function(a){function b(){if(void 0!==f)return f;if(a.XMLHttpRequest){f=new a.XMLHttpRequest;try{f.open("GET",a.XDomainRequest?"/":"https://example.com")}catch(a){f=null}}else f=null;return f}function d(a){var c=b();if(!c)return!1;try{return c.responseType=a,c.responseType===a}catch(a){}return!1}function e(a){return"function"==typeof a}c.fetch=e(a.fetch)&&e(a.ReadableStream),c.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),c.blobConstructor=!0}catch(a){}var f,g="undefined"!=typeof a.ArrayBuffer,h=g&&e(a.ArrayBuffer.prototype.slice);c.arraybuffer=c.fetch||g&&d("arraybuffer"),c.msstream=!c.fetch&&h&&d("ms-stream"),c.mozchunkedarraybuffer=!c.fetch&&g&&d("moz-chunked-arraybuffer"),c.overrideMimeType=c.fetch||!!b()&&e(b().overrideMimeType),c.vbArray=e(a.VBArray),f=null}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],154:[function(a,b,c){(function(c,d,e){function f(a,b){return h.fetch&&b?"fetch":h.mozchunkedarraybuffer?"moz-chunked-arraybuffer":h.msstream?"ms-stream":h.arraybuffer&&a?"arraybuffer":h.vbArray&&a?"text:vbarray":"text"}function g(a){try{var b=a.status;return null!==b&&0!==b}catch(a){return!1}}var h=a("./capability"),i=a("inherits"),j=a("./response"),k=a("readable-stream"),l=a("to-arraybuffer"),m=j.IncomingMessage,n=j.readyStates,o=b.exports=function(a){var b=this;k.Writable.call(b),b._opts=a,b._body=[],b._headers={},a.auth&&b.setHeader("Authorization","Basic "+new e(a.auth).toString("base64")),Object.keys(a.headers).forEach(function(c){b.setHeader(c,a.headers[c])});var c,d=!0;if("disable-fetch"===a.mode||"timeout"in a)d=!1,c=!0;else if("prefer-streaming"===a.mode)c=!1;else if("allow-wrong-content-type"===a.mode)c=!h.overrideMimeType;else{if(a.mode&&"default"!==a.mode&&"prefer-fast"!==a.mode)throw new Error("Invalid value for opts.mode");c=!0}b._mode=f(c,d),b.on("finish",function(){b._onFinish()})};i(o,k.Writable),o.prototype.setHeader=function(a,b){var c=this,d=a.toLowerCase();p.indexOf(d)===-1&&(c._headers[d]={name:a,value:b})},o.prototype.getHeader=function(a){var b=this;return b._headers[a.toLowerCase()].value},o.prototype.removeHeader=function(a){var b=this;delete b._headers[a.toLowerCase()]},o.prototype._onFinish=function(){var a=this;if(!a._destroyed){var b=a._opts,f=a._headers,g=null;if("POST"!==b.method&&"PUT"!==b.method&&"PATCH"!==b.method&&"MERGE"!==b.method||(g=h.blobConstructor?new d.Blob(a._body.map(function(a){return l(a)}),{type:(f["content-type"]||{}).value||""}):e.concat(a._body).toString()),"fetch"===a._mode){var i=Object.keys(f).map(function(a){return[f[a].name,f[a].value]});d.fetch(a._opts.url,{method:a._opts.method,headers:i,body:g||void 0,mode:"cors",credentials:b.withCredentials?"include":"same-origin"}).then(function(b){a._fetchResponse=b,a._connect()},function(b){a.emit("error",b)})}else{var j=a._xhr=new d.XMLHttpRequest;try{j.open(a._opts.method,a._opts.url,!0)}catch(b){return void c.nextTick(function(){a.emit("error",b)})}"responseType"in j&&(j.responseType=a._mode.split(":")[0]),"withCredentials"in j&&(j.withCredentials=!!b.withCredentials),"text"===a._mode&&"overrideMimeType"in j&&j.overrideMimeType("text/plain; charset=x-user-defined"),"timeout"in b&&(j.timeout=b.timeout,j.ontimeout=function(){a.emit("timeout")}),Object.keys(f).forEach(function(a){j.setRequestHeader(f[a].name,f[a].value)}),a._response=null,j.onreadystatechange=function(){switch(j.readyState){case n.LOADING:case n.DONE:a._onXHRProgress()}},"moz-chunked-arraybuffer"===a._mode&&(j.onprogress=function(){a._onXHRProgress()}),j.onerror=function(){a._destroyed||a.emit("error",new Error("XHR error"))};try{j.send(g)}catch(b){return void c.nextTick(function(){a.emit("error",b)})}}}},o.prototype._onXHRProgress=function(){var a=this;g(a._xhr)&&!a._destroyed&&(a._response||a._connect(),a._response._onXHRProgress())},o.prototype._connect=function(){var a=this;a._destroyed||(a._response=new m(a._xhr,a._fetchResponse,a._mode),a._response.on("error",function(b){a.emit("error",b)}),a.emit("response",a._response))},o.prototype._write=function(a,b,c){var d=this;d._body.push(a),c()},o.prototype.abort=o.prototype.destroy=function(){var a=this;a._destroyed=!0,a._response&&(a._response._destroyed=!0),a._xhr&&a._xhr.abort()},o.prototype.end=function(a,b,c){var d=this;"function"==typeof a&&(c=a,a=void 0),k.Writable.prototype.end.call(d,a,b,c)},o.prototype.flushHeaders=function(){},o.prototype.setTimeout=function(){},o.prototype.setNoDelay=function(){},o.prototype.setSocketKeepAlive=function(){};var p=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"]}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},a("buffer").Buffer)},{"./capability":153,"./response":155,_process:112,buffer:5,inherits:105,"readable-stream":123,"to-arraybuffer":157}],155:[function(a,b,c){(function(b,d,e){var f=a("./capability"),g=a("inherits"),h=a("readable-stream"),i=c.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},j=c.IncomingMessage=function(a,c,d){function g(){j.read().then(function(a){if(!i._destroyed){if(a.done)return void i.push(null);i.push(new e(a.value)),g()}}).catch(function(a){i.emit("error",a)})}var i=this;if(h.Readable.call(i),i._mode=d,i.headers={},i.rawHeaders=[],i.trailers={},i.rawTrailers=[],i.on("end",function(){b.nextTick(function(){i.emit("close")})}),"fetch"===d){i._fetchResponse=c,i.url=c.url,i.statusCode=c.status,i.statusMessage=c.statusText,c.headers.forEach(function(a,b){i.headers[b.toLowerCase()]=a,i.rawHeaders.push(b,a)});var j=c.body.getReader();g()}else{i._xhr=a,i._pos=0,i.url=a.responseURL,i.statusCode=a.status,i.statusMessage=a.statusText;var k=a.getAllResponseHeaders().split(/\r?\n/);if(k.forEach(function(a){var b=a.match(/^([^:]+):\s*(.*)/);if(b){var c=b[1].toLowerCase();"set-cookie"===c?(void 0===i.headers[c]&&(i.headers[c]=[]),i.headers[c].push(b[2])):void 0!==i.headers[c]?i.headers[c]+=", "+b[2]:i.headers[c]=b[2],i.rawHeaders.push(b[1],b[2])}}),i._charset="x-user-defined",!f.overrideMimeType){var l=i.rawHeaders["mime-type"];if(l){var m=l.match(/;\s*charset=([^;])(;|$)/);m&&(i._charset=m[1].toLowerCase())}i._charset||(i._charset="utf-8")}}};g(j,h.Readable),j.prototype._read=function(){},j.prototype._onXHRProgress=function(){var a=this,b=a._xhr,c=null;switch(a._mode){case"text:vbarray":if(b.readyState!==i.DONE)break;try{c=new d.VBArray(b.responseBody).toArray()}catch(a){}if(null!==c){a.push(new e(c));break}case"text":try{c=b.responseText}catch(b){a._mode="text:vbarray";break}if(c.length>a._pos){var f=c.substr(a._pos);if("x-user-defined"===a._charset){for(var g=new e(f.length),h=0;ha._pos&&(a.push(new e(new Uint8Array(j.result.slice(a._pos)))),a._pos=j.result.byteLength)},j.onload=function(){a.push(null)},j.readAsArrayBuffer(c)}a._xhr.readyState===i.DONE&&"ms-stream"!==a._mode&&a.push(null)}}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},a("buffer").Buffer)},{"./capability":153,_process:112,buffer:5,inherits:105,"readable-stream":123}],156:[function(a,b,c){function d(a){if(a&&!i(a))throw new Error("Unknown encoding: "+a)}function e(a){return a.toString(this.encoding)}function f(a){this.charReceived=a.length%2,this.charLength=this.charReceived?2:0}function g(a){this.charReceived=a.length%3,this.charLength=this.charReceived?3:0}var h=a("buffer").Buffer,i=h.isEncoding||function(a){switch(a&&a.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},j=c.StringDecoder=function(a){switch(this.encoding=(a||"utf8").toLowerCase().replace(/[-_]/,""),d(a),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=f;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=g;break;default:return void(this.write=e)}this.charBuffer=new h(6),this.charReceived=0,this.charLength=0};j.prototype.write=function(a){for(var b="";this.charLength;){var c=a.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:a.length;if(a.copy(this.charBuffer,this.charReceived,0,c),this.charReceived+=c,this.charReceived=55296&&d<=56319)){if(this.charReceived=this.charLength=0,0===a.length)return b;break}this.charLength+=this.surrogateSize,b=""}this.detectIncompleteChar(a);var e=a.length;this.charLength&&(a.copy(this.charBuffer,0,a.length-this.charReceived,e),e-=this.charReceived),b+=a.toString(this.encoding,0,e);var e=b.length-1,d=b.charCodeAt(e);if(d>=55296&&d<=56319){var f=this.surrogateSize;return this.charLength+=f,this.charReceived+=f,this.charBuffer.copy(this.charBuffer,f,0,f),a.copy(this.charBuffer,0,0,f),b.substring(0,e)}return b},j.prototype.detectIncompleteChar=function(a){for(var b=a.length>=3?3:a.length;b>0;b--){var c=a[a.length-b];if(1==b&&c>>5==6){this.charLength=2;break}if(b<=2&&c>>4==14){this.charLength=3;break}if(b<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=b},j.prototype.end=function(a){var b="";if(a&&a.length&&(b=this.write(a)),this.charReceived){var c=this.charReceived,d=this.charBuffer,e=this.encoding;b+=d.slice(0,c).toString(e)}return b}},{buffer:5}],157:[function(a,b,c){var d=a("buffer").Buffer;b.exports=function(a){if(a instanceof Uint8Array){if(0===a.byteOffset&&a.byteLength===a.buffer.byteLength)return a.buffer;if("function"==typeof a.buffer.slice)return a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength)}if(d.isBuffer(a)){for(var b=new Uint8Array(a.length),c=a.length,e=0;e=0}function h(a,b){for(var c=0,d=b.length;c>1);return c+=c,1&b&&(c+=a),c}function j(a,b){Error.call(this,a),this.msg=a,this.defs=b}function k(a,b,c){a===!0&&(a={});var d=a||{};if(c)for(var e in d)y(d,e)&&!y(b,e)&&j.croak("`"+e+"` is not a supported option",b);for(var e in b)y(b,e)&&(d[e]=a&&y(a,e)?a[e]:b[e]);return d}function l(a,b){var c=0;for(var d in b)y(b,d)&&(a[d]=b[d],c++);return c}function m(){}function n(){return!1}function o(){return!0}function p(a,b){a.indexOf(b)<0&&a.push(b)}function q(a,b){return a.replace(/\{(.+?)\}/g,function(a,c){return b[c]})}function r(a,b){for(var c=a.length;--c>=0;)a[c]===b&&a.splice(c,1)}function s(a,b){function c(a,c){for(var d=[],e=0,f=0,g=0;e=0})}function v(a){function b(a){return JSON.stringify(a).replace(/[\u2028\u2029]/g,function(a){switch(a){case"\u2028":return"\\u2028";case"\u2029":return"\\u2029"}return a})}function c(a){if(1==a.length)return d+="return str === "+b(a[0])+";";d+="switch(str){";for(var c=0;c3){e.sort(function(a,b){return b.length-a.length}),d+="switch(str.length){";for(var f=0;f=0;)if(!b(a[c]))return!1;return!0}function x(){this._values=Object.create(null),this._size=0}function y(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function z(a,b,d,e){arguments.length<4&&(e=ea),b=b?b.split(/\s+/):[];var f=b;e&&e.PROPS&&(b=b.concat(e.PROPS));for(var g="return function AST_"+a+"(props){ if (props) { ",h=b.length;--h>=0;)g+="this."+b[h]+" = props."+b[h]+";";var i=e&&new e;(i&&i.initialize||d&&d.initialize)&&(g+="this.initialize();"),g+="}}";var j=new Function(g)();if(i&&(j.prototype=i,j.BASE=e),e&&e.SUBCLASSES.push(j),j.prototype.CTOR=j,j.PROPS=b||null,j.SELF_PROPS=f,j.SUBCLASSES=[],a&&(j.prototype.TYPE=j.TYPE=a),d)for(h in d)y(d,h)&&(/^\$/.test(h)?j[h.substr(1)]=d[h]:j.prototype[h]=d[h]);return j.DEFMETHOD=function(a,b){this.prototype[a]=b},c["AST_"+a]=j,j}function A(a,b){a.body instanceof fa?a.body._walk(b):a.body.forEach(function(a){a._walk(b)})}function B(a){this.visit=a,this.stack=[],this.directives=Object.create(null)}function C(a){return a>=97&&a<=122||a>=65&&a<=90||a>=170&&Xb.letter.test(String.fromCharCode(a)); +}function D(a){return a>=48&&a<=57}function E(a){return D(a)||C(a)}function F(a){return Xb.digit.test(String.fromCharCode(a))}function G(a){return Xb.non_spacing_mark.test(a)||Xb.space_combining_mark.test(a)}function H(a){return Xb.connector_punctuation.test(a)}function I(a){return!Mb(a)&&/^[a-z_$][a-z0-9_$]*$/i.test(a)}function J(a){return 36==a||95==a||C(a)}function K(a){var b=a.charCodeAt(0);return J(b)||D(b)||8204==b||8205==b||G(a)||H(a)||F(b)}function L(a){return/^[a-z_$][a-z0-9_$]*$/i.test(a)}function M(a){if(Pb.test(a))return parseInt(a.substr(2),16);if(Qb.test(a))return parseInt(a.substr(1),8);var b=parseFloat(a);return b==a?b:void 0}function N(a,b,c,d,e){this.message=a,this.filename=b,this.line=c,this.col=d,this.pos=e,this.stack=(new Error).stack}function O(a,b,c,d,e){throw new N(a,b,c,d,e)}function P(a,b,c){return a.type==b&&(null==c||a.value==c)}function Q(a,b,c,d){function e(){return B.text.charAt(B.pos)}function f(a,b){var c=B.text.charAt(B.pos++);if(a&&!c)throw Yb;return Tb(c)?(B.newline_before=B.newline_before||!b,++B.line,B.col=0,b||"\r"!=c||"\n"!=e()||(++B.pos,c="\n")):++B.col,c}function g(a){for(;a-- >0;)f()}function h(a){return B.text.substr(B.pos,a.length)==a}function i(){for(var a=B.text,b=B.pos,c=B.text.length;b="0"&&b<="7"?r(b):b}function r(a){var b=e();return b>="0"&&b<="7"&&(a+=f(!0),a[0]<="3"&&(b=e())>="0"&&b<="7"&&(a+=f(!0))),"0"===a?"\0":(a.length>0&&A.has_directive("use strict")&&o("SyntaxError: Legacy octal escape sequences are not allowed in strict mode"),String.fromCharCode(parseInt(a,8)))}function s(a){for(var b=0;a>0;--a){var c=parseInt(f(!0),16);isNaN(c)&&o("SyntaxError: Invalid hex-character pattern in string"),b=b<<4|c}return b}function t(a){var b,c=B.regex_allowed,d=i();return d==-1?(b=B.text.substr(B.pos),B.pos=B.text.length):(b=B.text.substring(B.pos,d),B.pos=d),B.col=B.tokcol+(B.pos-B.tokpos),B.comments_before.push(l(a,b,!0)),B.regex_allowed=c,A}function u(){for(var a,b,c=!1,d="",g=!1;null!=(a=e());)if(c)"u"!=a&&o("SyntaxError: Expecting UnicodeEscapeSequence -- uXXXX"),a=q(),K(a)||o("SyntaxError: Unicode char: "+a.charCodeAt(0)+" is not valid in identifier"),d+=a,c=!1;else if("\\"==a)g=c=!0,f();else{if(!K(a))break;d+=f()}return Kb(d)&&g&&(b=d.charCodeAt(0).toString(16).toUpperCase(),d="\\u"+"0000".substr(b.length)+b+d.slice(1)),d}function v(a){function b(a){if(!e())return a;var c=a+e();return Rb(c)?(f(),b(c)):a}return l("operator",b(a||f()))}function w(){switch(f(),e()){case"/":return f(),t("comment1");case"*":return f(),G()}return B.regex_allowed?H(""):v("/")}function x(){return f(),D(e().charCodeAt(0))?p("."):l("punc",".")}function y(){var a=u();return C?l("name",a):Lb(a)?l("atom",a):Kb(a)?Rb(a)?l("operator",a):l("keyword",a):l("name",a)}function z(a,b){return function(c){try{return b(c)}catch(b){if(b!==Yb)throw b;o(a)}}}function A(a){if(null!=a)return H(a);for(;;){if(m(),k(),c){if(h("")&&B.newline_before){g(3),t("comment4");continue}}var b=e();if(!b)return l("eof");var i=b.charCodeAt(0);switch(i){case 34:case 39:return F(b);case 46:return x();case 47:var j=w();if(j===A)continue;return j}if(D(i))return p();if(Vb(b))return l("punc",f());if(Ob(b))return v();if(92==i||J(i))return y();if(!d||0!=B.pos||!h("#!"))break;g(2),t("comment5")}o("SyntaxError: Unexpected character '"+b+"'")}var B={text:a,filename:b,pos:0,tokpos:0,line:1,tokline:0,col:0,tokcol:0,newline_before:!1,regex_allowed:!1,comments_before:[],directives:{},directive_stack:[]},C=!1,F=z("SyntaxError: Unterminated string constant",function(a){for(var b=f(),c="";;){var d=f(!0,!0);if("\\"==d)d=q(!0);else if(Tb(d))o("SyntaxError: Unterminated string constant");else if(d==b)break;c+=d}var e=l("string",c);return e.quote=a,e}),G=z("SyntaxError: Unterminated multiline comment",function(){var a=B.regex_allowed,b=j("*/",!0),c=B.text.substring(B.pos,b).replace(/\r\n|\r|\u2028|\u2029/g,"\n");return g(c.length+2),B.comments_before.push(l("comment2",c,!0)),B.regex_allowed=a,A}),H=z("SyntaxError: Unterminated regular expression",function(a){for(var b,c=!1,d=!1;b=f(!0);)if(Tb(b))o("SyntaxError: Unexpected line terminator");else if(c)a+="\\"+b,c=!1;else if("["==b)d=!0,a+=b;else if("]"==b&&d)d=!1,a+=b;else{if("/"==b&&!d)break;"\\"==b?c=!0:a+=b}var e=u();try{return l("regexp",new RegExp(a,e))}catch(a){o("SyntaxError: "+a.message)}});return A.context=function(a){return a&&(B=a),B},A.add_directive=function(a){B.directive_stack[B.directive_stack.length-1].push(a),void 0===B.directives[a]?B.directives[a]=1:B.directives[a]++},A.push_directives_stack=function(){B.directive_stack.push([])},A.pop_directives_stack=function(){for(var a=B.directive_stack[B.directive_stack.length-1],b=0;b0},A}function R(a,b){function c(a,b){return P(R.token,a,b)}function d(){return R.peeked||(R.peeked=R.input())}function e(){return R.prev=R.token,R.peeked?(R.token=R.peeked,R.peeked=null):R.token=R.input(),R.in_directives=R.in_directives&&("string"==R.token.type||c("punc",";")),R.token}function f(){return R.prev}function g(a,b,c,d){var e=R.input.context();O(a,e.filename,null!=b?b:e.tokline,null!=c?c:e.tokcol,null!=d?d:e.tokpos)}function i(a,b){g(b,a.line,a.col)}function j(a){null==a&&(a=R.token),i(a,"SyntaxError: Unexpected token: "+a.type+" ("+a.value+")")}function l(a,b){return c(a,b)?e():void i(R.token,"SyntaxError: Unexpected token "+R.token.type+" «"+R.token.value+"», expected "+a+" «"+b+"»")}function m(a){return l("punc",a)}function n(){return!b.strict&&(R.token.nlb||c("eof")||c("punc","}"))}function o(a){c("punc",";")?e():a||n()||j()}function p(){m("(");var a=da(!0);return m(")"),a}function q(a){return function(){var b=R.token,c=a(),d=f();return c.start=b,c.end=d,c}}function r(){(c("operator","/")||c("operator","/="))&&(R.peeked=null,R.token=R.input(R.token.value.substr(1)))}function s(){var a=I(tb);h(function(b){return b.name==a.name},R.labels)&&g("SyntaxError: Label "+a.name+" defined twice"),m(":"),R.labels.push(a);var b=S();return R.labels.pop(),b instanceof oa||a.references.forEach(function(b){b instanceof Ha&&(b=b.label.start,g("SyntaxError: Continue label `"+a.name+"` refers to non-IterationStatement.",b.line,b.col,b.pos))}),new na({body:b,label:a})}function t(a){return new ia({body:(a=da(!0),o(),a)})}function u(a){var b,c=null;n()||(c=I(vb,!0)),null!=c?(b=h(function(a){return a.name==c.name},R.labels),b||g("SyntaxError: Undefined label "+c.name),c.thedef=b):0==R.in_loop&&g("SyntaxError: "+a.TYPE+" not inside a loop or switch"),o();var d=new a({label:c});return b&&b.references.push(d),d}function v(){m("(");var a=null;return!c("punc",";")&&(a=c("keyword","var")?(e(),U(!0)):da(!0,!0),c("operator","in"))?(a instanceof Ra&&a.definitions.length>1&&g("SyntaxError: Only one variable declaration allowed in for..in loop"),e(),x(a)):w(a)}function w(a){m(";");var b=c("punc",";")?null:da(!0);m(";");var d=c("punc",")")?null:da(!0);return m(")"),new sa({init:a,condition:b,step:d,body:N(S)})}function x(a){var b=a instanceof Ra?a.definitions[0].name:null,c=da(!0);return m(")"),new ta({init:a,name:b,object:c,body:N(S)})}function y(){var a=p(),b=S(),d=null;return c("keyword","else")&&(e(),d=S()),new Ia({condition:a,body:b,alternative:d})}function z(){m("{");for(var a=[];!c("punc","}");)c("eof")&&j(),a.push(S());return e(),a}function A(){m("{");for(var a,b=[],d=null,g=null;!c("punc","}");)c("eof")&&j(),c("keyword","case")?(g&&(g.end=f()),d=[],g=new Ma({start:(a=R.token,e(),a),expression:da(!0),body:d}),b.push(g),m(":")):c("keyword","default")?(g&&(g.end=f()),d=[],g=new La({start:(a=R.token,e(),m(":"),a),body:d}),b.push(g)):(d||j(),d.push(S()));return g&&(g.end=f()),e(),b}function B(){var a=z(),b=null,d=null;if(c("keyword","catch")){var h=R.token;e(),m("(");var i=I(sb);m(")"),b=new Oa({start:h,argname:i,body:z(),end:f()})}if(c("keyword","finally")){var h=R.token;e(),d=new Pa({start:h,body:z(),end:f()})}return b||d||g("SyntaxError: Missing catch/finally blocks"),new Na({body:a,bcatch:b,bfinally:d})}function C(a,b){for(var d=[];d.push(new Ta({start:R.token,name:I(b?ob:nb),value:c("operator","=")?(e(),da(!1,a)):null,end:f()})),c("punc",",");)e();return d}function D(){var a,b=R.token;switch(b.type){case"name":case"keyword":a=H(ub);break;case"num":a=new zb({start:b,end:b,value:b.value});break;case"string":a=new yb({start:b,end:b,value:b.value,quote:b.quote});break;case"regexp":a=new Ab({start:b,end:b,value:b.value});break;case"atom":switch(b.value){case"false":a=new Ib({start:b,end:b});break;case"true":a=new Jb({start:b,end:b});break;case"null":a=new Cb({start:b,end:b})}break;case"operator":L(b.value)||g("SyntaxError: Invalid getter/setter name: "+b.value,b.line,b.col,b.pos),a=H(ub)}return e(),a}function E(a,b,d){for(var f=!0,g=[];!c("punc",a)&&(f?f=!1:m(","),!b||!c("punc",a));)c("punc",",")&&d?g.push(new Fb({start:R.token,end:R.token})):g.push(da(!1));return e(),g}function F(){var a=R.token;switch(e(),a.type){case"num":case"string":case"name":case"operator":case"keyword":case"atom":return a.value;default:j()}}function G(){var a=R.token;switch(e(),a.type){case"name":case"operator":case"keyword":case"atom":return a.value;default:j()}}function H(a){var b=R.token.value;return new("this"==b?wb:a)({name:String(b),start:R.token,end:R.token})}function I(a,b){if(!c("name"))return b||g("SyntaxError: Name expected"),null;var d=H(a);return e(),d}function J(a,b,c){return"++"!=b&&"--"!=b||M(c)||g("SyntaxError: Invalid use of "+b+" operator"),new a({operator:b,expression:c})}function K(a){return aa(_(!0),0,a)}function M(a){return!b.strict||!(a instanceof wb)&&(a instanceof Xa||a instanceof kb)}function N(a){++R.in_loop;var b=a();return--R.in_loop,b}b=k(b,{strict:!1,filename:null,toplevel:null,expression:!1,html5_comments:!0,bare_returns:!1,shebang:!0});var R={input:"string"==typeof a?Q(a,b.filename,b.html5_comments,b.shebang):a,token:null,prev:null,peeked:null,in_function:0,in_directives:!0,in_loop:0,labels:[]};R.token=e();var S=q(function(){var a;switch(r(),R.token.type){case"string":var h=!1;R.in_directives===!0&&((P(d(),"punc",";")||d().nlb)&&R.token.raw.indexOf("\\")===-1?R.input.add_directive(R.token.value):R.in_directives=!1);var h=R.in_directives,i=t();return h?new ha({start:i.body.start,end:i.body.end,quote:i.body.quote,value:i.body.value}):i;case"num":case"regexp":case"operator":case"atom":return t();case"name":return P(d(),"punc",":")?s():t();case"punc":switch(R.token.value){case"{":return new ka({start:R.token,body:z(),end:f()});case"[":case"(":return t();case";":return R.in_directives=!1,e(),new la;default:j()}case"keyword":switch(a=R.token.value,e(),a){case"break":return u(Ga);case"continue":return u(Ha);case"debugger":return o(),new ga;case"do":return new qa({body:N(S),condition:(l("keyword","while"),a=p(),o(!0),a)});case"while":return new ra({condition:p(),body:N(S)});case"for":return v();case"function":return T(Aa);case"if":return y();case"return":return 0!=R.in_function||b.bare_returns||g("SyntaxError: 'return' outside of function"),new Da({value:c("punc",";")?(e(),null):n()?null:(a=da(!0),o(),a)});case"switch":return new Ja({expression:p(),body:N(A)});case"throw":return R.token.nlb&&g("SyntaxError: Illegal newline after 'throw'"),new Ea({value:(a=da(!0),o(),a)});case"try":return B();case"var":return a=U(),o(),a;case"const":return a=V(),o(),a;case"with":return R.input.has_directive("use strict")&&g("SyntaxError: Strict mode may not include a with statement"),new ua({expression:p(),body:S()});default:j()}}}),T=function(a){var b=a===Aa,d=c("name")?I(b?qb:rb):null;return b&&!d&&j(),m("("),new a({name:d,argnames:function(a,b){for(;!c("punc",")");)a?a=!1:m(","),b.push(I(pb));return e(),b}(!0,[]),body:function(a,b){++R.in_function,R.in_directives=!0,R.input.push_directives_stack(),R.in_loop=0,R.labels=[];var c=z();return R.input.pop_directives_stack(),--R.in_function,R.in_loop=a,R.labels=b,c}(R.in_loop,R.labels)})},U=function(a){return new Ra({start:f(),definitions:C(a,!1),end:f()})},V=function(){return new Sa({start:f(),definitions:C(!1,!0),end:f()})},W=function(a){var b=R.token;l("operator","new");var d,g=X(!1);return c("punc","(")?(e(),d=E(")")):d=[],$(new Va({start:b,expression:g,args:d,end:f()}),a)},X=function(a){if(c("operator","new"))return W(a);var b=R.token;if(c("punc")){switch(b.value){case"(":e();var d=da(!0);return d.start=b,d.end=R.token,m(")"),$(d,a);case"[":return $(Y(),a);case"{":return $(Z(),a)}j()}if(c("keyword","function")){e();var g=T(za);return g.start=b,g.end=f(),$(g,a)}return cc[R.token.type]?$(D(),a):void j()},Y=q(function(){return m("["),new eb({elements:E("]",!b.strict,!0)})}),Z=q(function(){m("{");for(var a=!0,d=[];!c("punc","}")&&(a?a=!1:m(","),b.strict||!c("punc","}"));){var g=R.token,h=g.type,i=F();if("name"==h&&!c("punc",":")){if("get"==i){d.push(new jb({start:g,key:D(),value:T(ya),end:f()}));continue}if("set"==i){d.push(new ib({start:g,key:D(),value:T(ya),end:f()}));continue}}m(":"),d.push(new hb({start:g,quote:g.quote,key:i,value:da(!1),end:f()}))}return e(),new fb({properties:d})}),$=function(a,b){var d=a.start;if(c("punc","."))return e(),$(new Ya({start:d,expression:a,property:G(),end:f()}),b);if(c("punc","[")){e();var g=da(!0);return m("]"),$(new Za({start:d,expression:a,property:g,end:f()}),b)}return b&&c("punc","(")?(e(),$(new Ua({start:d,expression:a,args:E(")"),end:f()}),!0)):a},_=function(a){var b=R.token;if(c("operator")&&Zb(b.value)){e(),r();var d=J(_a,b.value,_(a));return d.start=b,d.end=f(),d}for(var g=X(a);c("operator")&&$b(R.token.value)&&!R.token.nlb;)g=J(ab,R.token.value,g),g.start=b,g.end=R.token,e();return g},aa=function(a,b,d){var f=c("operator")?R.token.value:null;"in"==f&&d&&(f=null);var g=null!=f?ac[f]:null;if(null!=g&&g>b){e();var h=aa(_(!0),g,d);return aa(new bb({start:a.start,left:a,operator:f,right:h,end:h.end}),b,d)}return a},ba=function(a){var b=R.token,d=K(a);if(c("operator","?")){e();var g=da(!1);return m(":"),new cb({start:b,condition:d,consequent:g,alternative:da(!1,a),end:f()})}return d},ca=function(a){var b=R.token,d=ba(a),h=R.token.value;if(c("operator")&&_b(h)){if(M(d))return e(),new db({start:b,left:d,operator:h,right:ca(a),end:f()});g("SyntaxError: Invalid assignment")}return d},da=function(a,b){var f=R.token,g=ca(b);return a&&c("punc",",")?(e(),new Wa({start:f,car:g,cdr:da(!0,b),end:d()})):g};return b.expression?da(!0):function(){var a=R.token,d=[];for(R.input.push_directives_stack();!c("eof");)d.push(S());R.input.pop_directives_stack();var e=f(),g=b.toplevel;return g?(g.body=g.body.concat(d),g.end=e):g=new wa({start:a,body:d,end:e}),g}()}function S(a,b){B.call(this),this.before=a,this.after=b}function T(a,b,c){this.name=c.name,this.orig=[c],this.scope=a,this.references=[],this.global=!1,this.mangled_name=null,this.undeclared=!1,this.constant=!1,this.index=b,this.id=T.next_id++}function U(a){var b=a.value,c=a.type;return"comment2"==c?/@preserve|@license|@cc_on/i.test(b):"comment5"==c}function V(a){return"comment5"==a.type}function W(a){function b(a,b){return a.replace(/[\u0000-\u001f\u007f-\uffff]/g,function(a){var c=a.charCodeAt(0).toString(16);if(c.length<=2&&!b){for(;c.length<2;)c="0"+c;return"\\x"+c}for(;c.length<4;)c="0"+c;return"\\u"+c})}function c(c,d){function e(){return"'"+c.replace(/\x27/g,"\\'")+"'"}function f(){return'"'+c.replace(/\x22/g,'\\"')+'"'}var g=0,h=0;switch(c=c.replace(/[\\\b\f\n\r\v\t\x22\x27\u2028\u2029\0\ufeff]/g,function(b,d){switch(b){case'"':return++g,'"';case"'":return++h,"'";case"\\":return"\\\\";case"\n":return"\\n";case"\r":return"\\r";case"\t":return"\\t";case"\b":return"\\b";case"\f":return"\\f";case"\v":return a.screw_ie8?"\\v":"\\x0B";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";case"\ufeff":return"\\ufeff";case"\0":return/[0-7]/.test(c.charAt(d+1))?"\\x00":"\\0"}return b}),a.ascii_only&&(c=b(c)),a.quote_style){case 1:return e();case 2:return f();case 3:return"'"==d?e():f();default:return g>h?e():f()}}function d(b,d){var e=c(b,d);return a.inline_script&&(e=e.replace(/<\x2fscript([>\/\t\n\f\r ])/gi,"<\\/script$1"),e=e.replace(/\x3c!--/g,"\\x3c!--"),e=e.replace(/--\x3e/g,"--\\x3e")),e}function e(c){return c=c.toString(),a.ascii_only&&(c=b(c,!0)),c}function f(b){return i(" ",a.indent_start+A-b*a.indent_level)}function g(){return H.charAt(H.length-1)}function h(){a.max_line_len&&B>a.max_line_len&&j("\n")}function j(b){b=String(b);var c=b.charAt(0);if(G&&(G=!1,c&&!(";}".indexOf(c)<0)||/[;]$/.test(H)||(a.semicolons||I(c)?(E+=";",B++,D++):(E+="\n",D++,C++,B=0,/^\s+$/.test(b)&&(G=!0)),a.beautify||(F=!1))),!a.beautify&&a.preserve_line&&Q[Q.length-1])for(var d=Q[Q.length-1].start.line;C=a.width},newline:N,print:j,space:J,comma:t,colon:u,last:function(){return H},semicolon:O,force_semicolon:l,to_ascii:b,print_name:function(a){j(e(a))},print_string:function(a,b,c){var e=d(a,b);c===!0&&e.indexOf("\\")===-1&&(ec.test(E)||l(),l()),j(e)},encode_string:d,next_indent:p,with_indent:M,with_block:q,with_parens:r,with_square:s,add_mapping:P,option:function(b){return a[b]},comment_filter:x,line:function(){return C},col:function(){return B},pos:function(){return D},push_node:function(a){Q.push(a)},pop_node:function(){return Q.pop()},stack:function(){return Q},parent:function(a){return Q[Q.length-2-(a||0)]}}}function X(a,b){if(!(this instanceof X))return new X(a,b);S.call(this,this.before,this.after),this.options=k(a,{sequences:!b,properties:!b,dead_code:!b,drop_debugger:!b,unsafe:!1,unsafe_comps:!1,conditionals:!b,comparisons:!b,evaluate:!b,booleans:!b,loops:!b,unused:!b,hoist_funs:!b,keep_fargs:!0,keep_fnames:!1,hoist_vars:!1,if_return:!b,join_vars:!b,collapse_vars:!1,reduce_vars:!1,cascade:!b,side_effects:!b,pure_getters:!1,pure_funcs:null,negate_iife:!b,screw_ie8:!0,drop_console:!1,angular:!1,warnings:!0,global_defs:{},passes:1},!0);var c=this.options.sequences;this.sequences_limit=1==c?200:0|c,this.warnings_produced={}}function Y(a){function b(b,e,f,g,h,i){if(d){var j=d.originalPositionFor({line:g,column:h});if(null===j.source)return;b=j.source,g=j.line,h=j.column,i=j.name||i}c.addMapping({generated:{line:e+a.dest_line_diff,column:f},original:{line:g+a.orig_line_diff,column:h},source:b,name:i})}a=k(a,{file:null,root:null,orig:null,orig_line_diff:0,dest_line_diff:0});var c=new aa.SourceMapGenerator({file:a.file,sourceRoot:a.root}),d=a.orig&&new aa.SourceMapConsumer(a.orig);return d&&Array.isArray(a.orig.sources)&&d._sources.toArray().forEach(function(a){var b=d.sourceContentFor(a,!0);b&&c.setSourceContent(a,b)}),{add:b,get:function(){return c},toString:function(){return JSON.stringify(c.toJSON())}}}function Z(){function a(a){p(b,a)}var b=[];return[Object,Array,Function,Number,String,Boolean,Error,Math,Date,RegExp].forEach(function(b){Object.getOwnPropertyNames(b).map(a),b.prototype&&Object.getOwnPropertyNames(b.prototype).map(a)}),b}function $(a,b){function c(a){return!(r.indexOf(a)>=0)&&(!(i.indexOf(a)>=0)&&(b.only_cache?j.props.has(a):!/^[0-9.]+$/.test(a)))}function d(a){return!(n&&a in s)&&(!(m&&!m.test(a))&&(!(i.indexOf(a)>=0)&&(j.props.has(a)||q.indexOf(a)>=0)))}function e(a,b){return b?void(s[a]=!0):(c(a)&&p(q,a),void(d(a)||p(r,a)))}function f(a){if(!d(a))return a;var b=j.props.get(a);if(!b){if(o){var e="_$"+a+"$"+l+"_";!c(e)||n&&e in s||(b=e)}if(!b)do b=dc(++j.cname);while(!c(b)||n&&b in s);j.props.set(a,b)}return b}function g(a,b){var c={};try{!function a(d){d.walk(new B(function(d){if(d instanceof Wa)return a(d.cdr),!0;if(d instanceof yb)return e(d.value,b),!0;if(d instanceof cb)return a(d.consequent),a(d.alternative),!0;throw c}))}(a)}catch(a){if(a!==c)throw a}}function h(a){return a.transform(new S(function(a){return a instanceof Wa?a.cdr=h(a.cdr):a instanceof yb?a.value=f(a.value):a instanceof cb&&(a.consequent=h(a.consequent),a.alternative=h(a.alternative)),a}))}b=k(b,{reserved:null,cache:null,only_cache:!1,regex:null,ignore_quoted:!1,debug:!1});var i=b.reserved;null==i&&(i=Z());var j=b.cache;null==j&&(j={cname:-1,props:new x});var l,m=b.regex,n=b.ignore_quoted,o=b.debug!==!1;o&&(l=b.debug===!0?"":b.debug);var q=[],r=[],s={};return a.walk(new B(function(a){a instanceof hb?e(a.key,n&&a.quote):a instanceof gb?e(a.key.name):a instanceof Ya?e(a.property):a instanceof Za&&g(a.property,n)})),a.transform(new S(function(a){a instanceof hb?n&&a.quote||(a.key=f(a.key)):a instanceof gb?a.key.name=f(a.key.name):a instanceof Ya?a.property=f(a.property):a instanceof Za&&(n||(a.property=h(a.property)))}))}var _=a("util"),aa=a("source-map"),ba=c;j.prototype=Object.create(Error.prototype),j.prototype.constructor=j,j.croak=function(a,b){throw new j(a,b)};var ca=function(){function a(a,f,g){function h(){var h=f(a[i],i),l=h instanceof d;return l&&(h=h.v),h instanceof b?(h=h.v,h instanceof c?k.push.apply(k,g?h.v.slice().reverse():h.v):k.push(h)):h!==e&&(h instanceof c?j.push.apply(j,g?h.v.slice().reverse():h.v):j.push(h)),l}var i,j=[],k=[];if(a instanceof Array)if(g){for(i=a.length;--i>=0&&!h(););j.reverse(),k.reverse()}else for(i=0;i SymbolDef for all variables/functions defined in this scope",functions:"[Object/S] like `variables`, but only lists function declarations",uses_with:"[boolean/S] tells whether this scope uses the `with` statement",uses_eval:"[boolean/S] tells whether this scope contains a direct call to the global `eval`",parent_scope:"[AST_Scope?/S] link to the parent scope",enclosed:"[SymbolDef*/S] a list of all symbol definitions that are accessed from this scope or any subscopes",cname:"[integer/S] current index for mangling variables (used internally by the mangler)"}},ja),wa=z("Toplevel","globals",{$documentation:"The toplevel scope",$propdoc:{globals:"[Object/S] a map of name -> SymbolDef for all undeclared names"},wrap_enclose:function(a){var b=this,c=[],d=[];a.forEach(function(a){var b=a.lastIndexOf(":");c.push(a.substr(0,b)),d.push(a.substr(b+1))});var e="(function("+d.join(",")+"){ '$ORIG'; })("+c.join(",")+")";return e=R(e),e=e.transform(new S(function(a){if(a instanceof ha&&"$ORIG"==a.value)return ca.splice(b.body)}))},wrap_commonjs:function(a,b){var c=this,d=[];b&&(c.figure_out_scope(),c.walk(new B(function(a){a instanceof mb&&a.definition().global&&(h(function(b){return b.name==a.name},d)||d.push(a))})));var e="(function(exports, global){ '$ORIG'; '$EXPORTS'; global['"+a+"'] = exports; }({}, (function(){return this}())))";return e=R(e),e=e.transform(new S(function(a){if(a instanceof ha)switch(a.value){case"$ORIG":return ca.splice(c.body);case"$EXPORTS":var b=[];return d.forEach(function(a){b.push(new ia({body:new db({left:new Za({expression:new ub({name:"exports"}),property:new yb({value:a.name})}),operator:"=",right:new ub(a)})}))}),ca.splice(b)}}))}},va),xa=z("Lambda","name argnames uses_arguments",{$documentation:"Base class for functions",$propdoc:{name:"[AST_SymbolDeclaration?] the name of this function",argnames:"[AST_SymbolFunarg*] array of function arguments",uses_arguments:"[boolean/S] tells whether this function accesses the arguments array"},_walk:function(a){return a._visit(this,function(){this.name&&this.name._walk(a),this.argnames.forEach(function(b){b._walk(a)}),A(this,a)})}},va),ya=z("Accessor",null,{$documentation:"A setter/getter function. The `name` property is always null."},xa),za=z("Function",null,{ +$documentation:"A function expression"},xa),Aa=z("Defun",null,{$documentation:"A function definition"},xa),Ba=z("Jump",null,{$documentation:"Base class for “jumps” (for now that's `return`, `throw`, `break` and `continue`)"},fa),Ca=z("Exit","value",{$documentation:"Base class for “exits” (`return` and `throw`)",$propdoc:{value:"[AST_Node?] the value returned or thrown by this statement; could be null for AST_Return"},_walk:function(a){return a._visit(this,this.value&&function(){this.value._walk(a)})}},Ba),Da=z("Return",null,{$documentation:"A `return` statement"},Ca),Ea=z("Throw",null,{$documentation:"A `throw` statement"},Ca),Fa=z("LoopControl","label",{$documentation:"Base class for loop control statements (`break` and `continue`)",$propdoc:{label:"[AST_LabelRef?] the label, or null if none"},_walk:function(a){return a._visit(this,this.label&&function(){this.label._walk(a)})}},Ba),Ga=z("Break",null,{$documentation:"A `break` statement"},Fa),Ha=z("Continue",null,{$documentation:"A `continue` statement"},Fa),Ia=z("If","condition alternative",{$documentation:"A `if` statement",$propdoc:{condition:"[AST_Node] the `if` condition",alternative:"[AST_Statement?] the `else` part, or null if not present"},_walk:function(a){return a._visit(this,function(){this.condition._walk(a),this.body._walk(a),this.alternative&&this.alternative._walk(a)})}},ma),Ja=z("Switch","expression",{$documentation:"A `switch` statement",$propdoc:{expression:"[AST_Node] the `switch` “discriminant”"},_walk:function(a){return a._visit(this,function(){this.expression._walk(a),A(this,a)})}},ja),Ka=z("SwitchBranch",null,{$documentation:"Base class for `switch` branches"},ja),La=z("Default",null,{$documentation:"A `default` switch branch"},Ka),Ma=z("Case","expression",{$documentation:"A `case` switch branch",$propdoc:{expression:"[AST_Node] the `case` expression"},_walk:function(a){return a._visit(this,function(){this.expression._walk(a),A(this,a)})}},Ka),Na=z("Try","bcatch bfinally",{$documentation:"A `try` statement",$propdoc:{bcatch:"[AST_Catch?] the catch block, or null if not present",bfinally:"[AST_Finally?] the finally block, or null if not present"},_walk:function(a){return a._visit(this,function(){A(this,a),this.bcatch&&this.bcatch._walk(a),this.bfinally&&this.bfinally._walk(a)})}},ja),Oa=z("Catch","argname",{$documentation:"A `catch` node; only makes sense as part of a `try` statement",$propdoc:{argname:"[AST_SymbolCatch] symbol for the exception"},_walk:function(a){return a._visit(this,function(){this.argname._walk(a),A(this,a)})}},ja),Pa=z("Finally",null,{$documentation:"A `finally` node; only makes sense as part of a `try` statement"},ja),Qa=z("Definitions","definitions",{$documentation:"Base class for `var` or `const` nodes (variable declarations/initializations)",$propdoc:{definitions:"[AST_VarDef*] array of variable definitions"},_walk:function(a){return a._visit(this,function(){this.definitions.forEach(function(b){b._walk(a)})})}},fa),Ra=z("Var",null,{$documentation:"A `var` statement"},Qa),Sa=z("Const",null,{$documentation:"A `const` statement"},Qa),Ta=z("VarDef","name value",{$documentation:"A variable declaration; only appears in a AST_Definitions node",$propdoc:{name:"[AST_SymbolVar|AST_SymbolConst] name of the variable",value:"[AST_Node?] initializer, or null of there's no initializer"},_walk:function(a){return a._visit(this,function(){this.name._walk(a),this.value&&this.value._walk(a)})}}),Ua=z("Call","expression args",{$documentation:"A function call expression",$propdoc:{expression:"[AST_Node] expression to invoke as function",args:"[AST_Node*] array of arguments"},_walk:function(a){return a._visit(this,function(){this.expression._walk(a),this.args.forEach(function(b){b._walk(a)})})}}),Va=z("New",null,{$documentation:"An object instantiation. Derives from a function call since it has exactly the same properties"},Ua),Wa=z("Seq","car cdr",{$documentation:"A sequence expression (two comma-separated expressions)",$propdoc:{car:"[AST_Node] first element in sequence",cdr:"[AST_Node] second element in sequence"},$cons:function(a,b){var c=new Wa(a);return c.car=a,c.cdr=b,c},$from_array:function(a){if(0==a.length)return null;if(1==a.length)return a[0].clone();for(var b=null,c=a.length;--c>=0;)b=Wa.cons(a[c],b);for(var d=b;d;){if(d.cdr&&!d.cdr.cdr){d.cdr=d.cdr.car;break}d=d.cdr}return b},to_array:function(){for(var a=this,b=[];a;){if(b.push(a.car),a.cdr&&!(a.cdr instanceof Wa)){b.push(a.cdr);break}a=a.cdr}return b},add:function(a){for(var b=this;b;){if(!(b.cdr instanceof Wa)){var c=Wa.cons(b.cdr,a);return b.cdr=c}b=b.cdr}},len:function(){return this.cdr instanceof Wa?this.cdr.len()+1:2},_walk:function(a){return a._visit(this,function(){this.car._walk(a),this.cdr&&this.cdr._walk(a)})}}),Xa=z("PropAccess","expression property",{$documentation:'Base class for property access expressions, i.e. `a.foo` or `a["foo"]`',$propdoc:{expression:"[AST_Node] the “container” expression",property:"[AST_Node|string] the property to access. For AST_Dot this is always a plain string, while for AST_Sub it's an arbitrary AST_Node"}}),Ya=z("Dot",null,{$documentation:"A dotted property access expression",_walk:function(a){return a._visit(this,function(){this.expression._walk(a)})}},Xa),Za=z("Sub",null,{$documentation:'Index-style property access, i.e. `a["foo"]`',_walk:function(a){return a._visit(this,function(){this.expression._walk(a),this.property._walk(a)})}},Xa),$a=z("Unary","operator expression",{$documentation:"Base class for unary expressions",$propdoc:{operator:"[string] the operator",expression:"[AST_Node] expression that this unary operator applies to"},_walk:function(a){return a._visit(this,function(){this.expression._walk(a)})}}),_a=z("UnaryPrefix",null,{$documentation:"Unary prefix expression, i.e. `typeof i` or `++i`"},$a),ab=z("UnaryPostfix",null,{$documentation:"Unary postfix expression, i.e. `i++`"},$a),bb=z("Binary","left operator right",{$documentation:"Binary expression, i.e. `a + b`",$propdoc:{left:"[AST_Node] left-hand side expression",operator:"[string] the operator",right:"[AST_Node] right-hand side expression"},_walk:function(a){return a._visit(this,function(){this.left._walk(a),this.right._walk(a)})}}),cb=z("Conditional","condition consequent alternative",{$documentation:"Conditional expression using the ternary operator, i.e. `a ? b : c`",$propdoc:{condition:"[AST_Node]",consequent:"[AST_Node]",alternative:"[AST_Node]"},_walk:function(a){return a._visit(this,function(){this.condition._walk(a),this.consequent._walk(a),this.alternative._walk(a)})}}),db=z("Assign",null,{$documentation:"An assignment expression — `a = b + 5`"},bb),eb=z("Array","elements",{$documentation:"An array literal",$propdoc:{elements:"[AST_Node*] array of elements"},_walk:function(a){return a._visit(this,function(){this.elements.forEach(function(b){b._walk(a)})})}}),fb=z("Object","properties",{$documentation:"An object literal",$propdoc:{properties:"[AST_ObjectProperty*] array of properties"},_walk:function(a){return a._visit(this,function(){this.properties.forEach(function(b){b._walk(a)})})}}),gb=z("ObjectProperty","key value",{$documentation:"Base class for literal object properties",$propdoc:{key:"[string] the property name converted to a string for ObjectKeyVal. For setters and getters this is an arbitrary AST_Node.",value:"[AST_Node] property value. For setters and getters this is an AST_Function."},_walk:function(a){return a._visit(this,function(){this.value._walk(a)})}}),hb=z("ObjectKeyVal","quote",{$documentation:"A key: value object property",$propdoc:{quote:"[string] the original quote character"}},gb),ib=z("ObjectSetter",null,{$documentation:"An object setter property"},gb),jb=z("ObjectGetter",null,{$documentation:"An object getter property"},gb),kb=z("Symbol","scope name thedef",{$propdoc:{name:"[string] name of this symbol",scope:"[AST_Scope/S] the current scope (not necessarily the definition scope)",thedef:"[SymbolDef/S] the definition of this symbol"},$documentation:"Base class for all symbols"}),lb=z("SymbolAccessor",null,{$documentation:"The name of a property accessor (setter/getter function)"},kb),mb=z("SymbolDeclaration","init",{$documentation:"A declaration symbol (symbol in var/const, function name or argument, symbol in catch)",$propdoc:{init:"[AST_Node*/S] array of initializers for this declaration."}},kb),nb=z("SymbolVar",null,{$documentation:"Symbol defining a variable"},mb),ob=z("SymbolConst",null,{$documentation:"A constant declaration"},mb),pb=z("SymbolFunarg",null,{$documentation:"Symbol naming a function argument"},nb),qb=z("SymbolDefun",null,{$documentation:"Symbol defining a function"},mb),rb=z("SymbolLambda",null,{$documentation:"Symbol naming a function expression"},mb),sb=z("SymbolCatch",null,{$documentation:"Symbol naming the exception in catch"},mb),tb=z("Label","references",{$documentation:"Symbol naming a label (declaration)",$propdoc:{references:"[AST_LoopControl*] a list of nodes referring to this label"},initialize:function(){this.references=[],this.thedef=this}},kb),ub=z("SymbolRef",null,{$documentation:"Reference to some symbol (not definition/declaration)"},kb),vb=z("LabelRef",null,{$documentation:"Reference to a label symbol"},kb),wb=z("This",null,{$documentation:"The `this` symbol"},kb),xb=z("Constant",null,{$documentation:"Base class for all constants",getValue:function(){return this.value}}),yb=z("String","value quote",{$documentation:"A string literal",$propdoc:{value:"[string] the contents of this string",quote:"[string] the original quote character"}},xb),zb=z("Number","value literal",{$documentation:"A number literal",$propdoc:{value:"[number] the numeric value",literal:"[string] numeric value as string (optional)"}},xb),Ab=z("RegExp","value",{$documentation:"A regexp literal",$propdoc:{value:"[RegExp] the actual regexp"}},xb),Bb=z("Atom",null,{$documentation:"Base class for atoms"},xb),Cb=z("Null",null,{$documentation:"The `null` atom",value:null},Bb),Db=z("NaN",null,{$documentation:"The impossible value",value:NaN},Bb),Eb=z("Undefined",null,{$documentation:"The `undefined` value",value:void 0},Bb),Fb=z("Hole",null,{$documentation:"A hole in an array",value:void 0},Bb),Gb=z("Infinity",null,{$documentation:"The `Infinity` value",value:1/0},Bb),Hb=z("Boolean",null,{$documentation:"Base class for booleans"},Bb),Ib=z("False",null,{$documentation:"The `false` atom",value:!1},Hb),Jb=z("True",null,{$documentation:"The `true` atom",value:!0},Hb);B.prototype={_visit:function(a,b){this.push(a);var c=this.visit(a,b?function(){b.call(a)}:m);return!c&&b&&b.call(a),this.pop(a),c},parent:function(a){return this.stack[this.stack.length-2-(a||0)]},push:function(a){a instanceof xa?this.directives=Object.create(this.directives):a instanceof ha&&(this.directives[a.value]=!this.directives[a.value]||"up"),this.stack.push(a)},pop:function(a){this.stack.pop(),a instanceof xa&&(this.directives=Object.getPrototypeOf(this.directives))},self:function(){return this.stack[this.stack.length-1]},find_parent:function(a){for(var b=this.stack,c=b.length;--c>=0;){var d=b[c];if(d instanceof a)return d}},has_directive:function(a){var b=this.directives[a];if(b)return b;var c=this.stack[this.stack.length-1];if(c instanceof va)for(var d=0;d0;){var d=a[--b];if(d instanceof Ia&&d.condition===c||d instanceof cb&&d.condition===c||d instanceof pa&&d.condition===c||d instanceof sa&&d.condition===c||d instanceof _a&&"!"==d.operator&&d.expression===c)return!0;if(!(d instanceof bb)||"&&"!=d.operator&&"||"!=d.operator)return!1;c=d}},loopcontrol_target:function(a){var b=this.stack;if(a)for(var c=b.length;--c>=0;){var d=b[c];if(d instanceof na&&d.label.name==a.name)return d.body}else for(var c=b.length;--c>=0;){var d=b[c];if(d instanceof Ja||d instanceof oa)return d}}};var Kb="break case catch const continue debugger default delete do else finally for function if in instanceof new return switch throw try typeof var void while with",Lb="false null true",Mb="abstract boolean byte char class double enum export extends final float goto implements import int interface let long native package private protected public short static super synchronized this throws transient volatile yield "+Lb+" "+Kb,Nb="return new delete throw else case";Kb=v(Kb),Mb=v(Mb),Nb=v(Nb),Lb=v(Lb);var Ob=v(f("+-*&%=<>!?|~^")),Pb=/^0x[0-9a-f]+$/i,Qb=/^0[0-7]+$/,Rb=v(["in","instanceof","typeof","new","void","delete","++","--","+","-","!","~","&","|","^","*","/","%",">>","<<",">>>","<",">","<=",">=","==","===","!=","!==","?","=","+=","-=","/=","*=","%=",">>=","<<=",">>>=","|=","^=","&=","&&","||"]),Sb=v(f("  \n\r\t\f\v​           \u2028\u2029   \ufeff")),Tb=v(f("\n\r\u2028\u2029")),Ub=v(f("[{(,.;:")),Vb=v(f("[]{}(),;:")),Wb=v(f("gmsiy")),Xb={letter:new RegExp("[\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),digit:new RegExp("[\\u0030-\\u0039\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0BE6-\\u0BEF\\u0C66-\\u0C6F\\u0CE6-\\u0CEF\\u0D66-\\u0D6F\\u0DE6-\\u0DEF\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F29\\u1040-\\u1049\\u1090-\\u1099\\u17E0-\\u17E9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19D9\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\uA620-\\uA629\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uA9F0-\\uA9F9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19]"),non_spacing_mark:new RegExp("[\\u0300-\\u036F\\u0483-\\u0487\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u065E\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0900-\\u0902\\u093C\\u0941-\\u0948\\u094D\\u0951-\\u0955\\u0962\\u0963\\u0981\\u09BC\\u09C1-\\u09C4\\u09CD\\u09E2\\u09E3\\u0A01\\u0A02\\u0A3C\\u0A41\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81\\u0A82\\u0ABC\\u0AC1-\\u0AC5\\u0AC7\\u0AC8\\u0ACD\\u0AE2\\u0AE3\\u0B01\\u0B3C\\u0B3F\\u0B41-\\u0B44\\u0B4D\\u0B56\\u0B62\\u0B63\\u0B82\\u0BC0\\u0BCD\\u0C3E-\\u0C40\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0CBC\\u0CBF\\u0CC6\\u0CCC\\u0CCD\\u0CE2\\u0CE3\\u0D41-\\u0D44\\u0D4D\\u0D62\\u0D63\\u0DCA\\u0DD2-\\u0DD4\\u0DD6\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F71-\\u0F7E\\u0F80-\\u0F84\\u0F86\\u0F87\\u0F90-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1030\\u1032-\\u1037\\u1039\\u103A\\u103D\\u103E\\u1058\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108D\\u109D\\u135F\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B7-\\u17BD\\u17C6\\u17C9-\\u17D3\\u17DD\\u180B-\\u180D\\u18A9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193B\\u1A17\\u1A18\\u1A56\\u1A58-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A6C\\u1A73-\\u1A7C\\u1A7F\\u1B00-\\u1B03\\u1B34\\u1B36-\\u1B3A\\u1B3C\\u1B42\\u1B6B-\\u1B73\\u1B80\\u1B81\\u1BA2-\\u1BA5\\u1BA8\\u1BA9\\u1C2C-\\u1C33\\u1C36\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE0\\u1CE2-\\u1CE8\\u1CED\\u1DC0-\\u1DE6\\u1DFD-\\u1DFF\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2CEF-\\u2CF1\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F\\uA67C\\uA67D\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA825\\uA826\\uA8C4\\uA8E0-\\uA8F1\\uA926-\\uA92D\\uA947-\\uA951\\uA980-\\uA982\\uA9B3\\uA9B6-\\uA9B9\\uA9BC\\uAA29-\\uAA2E\\uAA31\\uAA32\\uAA35\\uAA36\\uAA43\\uAA4C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uABE5\\uABE8\\uABED\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE26]"),space_combining_mark:new RegExp("[\\u0903\\u093E-\\u0940\\u0949-\\u094C\\u094E\\u0982\\u0983\\u09BE-\\u09C0\\u09C7\\u09C8\\u09CB\\u09CC\\u09D7\\u0A03\\u0A3E-\\u0A40\\u0A83\\u0ABE-\\u0AC0\\u0AC9\\u0ACB\\u0ACC\\u0B02\\u0B03\\u0B3E\\u0B40\\u0B47\\u0B48\\u0B4B\\u0B4C\\u0B57\\u0BBE\\u0BBF\\u0BC1\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCC\\u0BD7\\u0C01-\\u0C03\\u0C41-\\u0C44\\u0C82\\u0C83\\u0CBE\\u0CC0-\\u0CC4\\u0CC7\\u0CC8\\u0CCA\\u0CCB\\u0CD5\\u0CD6\\u0D02\\u0D03\\u0D3E-\\u0D40\\u0D46-\\u0D48\\u0D4A-\\u0D4C\\u0D57\\u0D82\\u0D83\\u0DCF-\\u0DD1\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0F3E\\u0F3F\\u0F7F\\u102B\\u102C\\u1031\\u1038\\u103B\\u103C\\u1056\\u1057\\u1062-\\u1064\\u1067-\\u106D\\u1083\\u1084\\u1087-\\u108C\\u108F\\u109A-\\u109C\\u17B6\\u17BE-\\u17C5\\u17C7\\u17C8\\u1923-\\u1926\\u1929-\\u192B\\u1930\\u1931\\u1933-\\u1938\\u19B0-\\u19C0\\u19C8\\u19C9\\u1A19-\\u1A1B\\u1A55\\u1A57\\u1A61\\u1A63\\u1A64\\u1A6D-\\u1A72\\u1B04\\u1B35\\u1B3B\\u1B3D-\\u1B41\\u1B43\\u1B44\\u1B82\\u1BA1\\u1BA6\\u1BA7\\u1BAA\\u1C24-\\u1C2B\\u1C34\\u1C35\\u1CE1\\u1CF2\\uA823\\uA824\\uA827\\uA880\\uA881\\uA8B4-\\uA8C3\\uA952\\uA953\\uA983\\uA9B4\\uA9B5\\uA9BA\\uA9BB\\uA9BD-\\uA9C0\\uAA2F\\uAA30\\uAA33\\uAA34\\uAA4D\\uAA7B\\uABE3\\uABE4\\uABE6\\uABE7\\uABE9\\uABEA\\uABEC]"),connector_punctuation:new RegExp("[\\u005F\\u203F\\u2040\\u2054\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFF3F]")};N.prototype.toString=function(){return this.message+" (line: "+this.line+", col: "+this.col+", pos: "+this.pos+")\n\n"+this.stack};var Yb={},Zb=v(["typeof","void","delete","--","++","!","~","-","+"]),$b=v(["--","++"]),_b=v(["=","+=","-=","/=","*=","%=",">>=","<<=",">>>=","|=","^=","&="]),ac=function(a,b){for(var c=0;c","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]],{}),bc=d(["for","do","while","switch"]),cc=d(["atom","num","string","regexp","name"]);S.prototype=new B,function(a){function b(b,c){b.DEFMETHOD("transform",function(b,d){var e,f;return b.push(this),b.before&&(e=b.before(this,c,d)),e===a&&(b.after?(b.stack[b.stack.length-1]=e=this,c(e,b),f=b.after(e,d),f!==a&&(e=f)):(e=this,c(e,b))),b.pop(this),e})}function c(a,b){return ca(a,function(a){return a.transform(b,!0)})}b(ea,m),b(na,function(a,b){a.label=a.label.transform(b),a.body=a.body.transform(b)}),b(ia,function(a,b){a.body=a.body.transform(b)}),b(ja,function(a,b){a.body=c(a.body,b)}),b(pa,function(a,b){a.condition=a.condition.transform(b),a.body=a.body.transform(b)}),b(sa,function(a,b){a.init&&(a.init=a.init.transform(b)),a.condition&&(a.condition=a.condition.transform(b)),a.step&&(a.step=a.step.transform(b)),a.body=a.body.transform(b)}),b(ta,function(a,b){a.init=a.init.transform(b),a.object=a.object.transform(b),a.body=a.body.transform(b)}),b(ua,function(a,b){a.expression=a.expression.transform(b),a.body=a.body.transform(b)}),b(Ca,function(a,b){a.value&&(a.value=a.value.transform(b))}),b(Fa,function(a,b){a.label&&(a.label=a.label.transform(b))}),b(Ia,function(a,b){a.condition=a.condition.transform(b),a.body=a.body.transform(b),a.alternative&&(a.alternative=a.alternative.transform(b))}),b(Ja,function(a,b){a.expression=a.expression.transform(b),a.body=c(a.body,b)}),b(Ma,function(a,b){a.expression=a.expression.transform(b),a.body=c(a.body,b)}),b(Na,function(a,b){a.body=c(a.body,b),a.bcatch&&(a.bcatch=a.bcatch.transform(b)),a.bfinally&&(a.bfinally=a.bfinally.transform(b))}),b(Oa,function(a,b){a.argname=a.argname.transform(b),a.body=c(a.body,b)}),b(Qa,function(a,b){a.definitions=c(a.definitions,b)}),b(Ta,function(a,b){a.name=a.name.transform(b),a.value&&(a.value=a.value.transform(b))}),b(xa,function(a,b){a.name&&(a.name=a.name.transform(b)),a.argnames=c(a.argnames,b),a.body=c(a.body,b)}),b(Ua,function(a,b){a.expression=a.expression.transform(b),a.args=c(a.args,b)}),b(Wa,function(a,b){a.car=a.car.transform(b),a.cdr=a.cdr.transform(b)}),b(Ya,function(a,b){a.expression=a.expression.transform(b)}),b(Za,function(a,b){a.expression=a.expression.transform(b),a.property=a.property.transform(b)}),b($a,function(a,b){a.expression=a.expression.transform(b)}),b(bb,function(a,b){a.left=a.left.transform(b),a.right=a.right.transform(b)}),b(cb,function(a,b){a.condition=a.condition.transform(b),a.consequent=a.consequent.transform(b),a.alternative=a.alternative.transform(b)}),b(eb,function(a,b){a.elements=c(a.elements,b)}),b(fb,function(a,b){a.properties=c(a.properties,b)}),b(gb,function(a,b){a.value=a.value.transform(b)})}(),T.next_id=1,T.prototype={unmangleable:function(a){return a||(a={}),this.global&&!a.toplevel||this.undeclared||!a.eval&&(this.scope.uses_eval||this.scope.uses_with)||a.keep_fnames&&(this.orig[0]instanceof rb||this.orig[0]instanceof qb)},mangle:function(a){var b=a.cache&&a.cache.props;if(this.global&&b&&b.has(this.name))this.mangled_name=b.get(this.name);else if(!this.mangled_name&&!this.unmangleable(a)){var c=this.scope;!a.screw_ie8&&this.orig[0]instanceof rb&&(c=c.parent_scope),this.mangled_name=c.next_mangled(a,this),this.global&&b&&b.set(this.name,this.mangled_name)}}},wa.DEFMETHOD("figure_out_scope",function(a){a=k(a,{screw_ie8:!0,cache:null});var b=this,c=b.parent_scope=null,d=new x,e=null,f=!1,g=0,h=new B(function(b,i){if(a.screw_ie8&&b instanceof Oa){var j=c;return c=new va(b),c.init_scope_vars(g),c.parent_scope=j,i(),c=j,!0}if(b instanceof va){b.init_scope_vars(g);var j=b.parent_scope=c,k=e,l=d;return e=c=b,d=new x,++g,i(),--g,c=j,e=k,d=l,!0}if(b instanceof na){var m=b.label;if(d.has(m.name))throw new Error(q("Label {name} defined twice",m));return d.set(m.name,m),i(),d.del(m.name),!0}if(b instanceof ua)for(var n=c;n;n=n.parent_scope)n.uses_with=!0;else if(b instanceof kb&&(b.scope=c),b instanceof tb&&(b.thedef=b,b.references=[]),b instanceof rb)e.def_function(b);else if(b instanceof qb)(b.scope=e.parent_scope).def_function(b);else if(b instanceof Ra)f=b.has_const_pragma();else if(b instanceof nb||b instanceof ob){var o=e.def_variable(b);o.constant=b instanceof ob||f,o.init=h.parent().value}else if(b instanceof sb)(a.screw_ie8?c:e).def_variable(b);else if(b instanceof vb){var p=d.get(b.name);if(!p)throw new Error(q("Undefined label {name} [{line},{col}]",{name:b.name,line:b.start.line,col:b.start.col}));b.thedef=p}});b.walk(h);var i=null,j=b.globals=new x,h=new B(function(a,c){if(a instanceof xa){var d=i;return i=a,c(),i=d,!0}if(a instanceof Fa&&a.label)return a.label.thedef.references.push(a),!0;if(a instanceof ub){var e=a.name,f=h.parent();if("eval"==e&&f instanceof Ua)for(var g=a.scope;g&&!g.uses_eval;g=g.parent_scope)g.uses_eval=!0;var k=a.scope.find_variable(e);if(a.scope instanceof xa&&"arguments"==e&&(a.scope.uses_arguments=!0),!k){var l;j.has(e)?l=j.get(e):(l=new T(b,j.size(),a),l.undeclared=!0,l.global=!0,j.set(e,l)),k=l}return a.thedef=k,(f instanceof $a&&("++"===f.operator||"--"===f.operator)||f instanceof db&&f.left===a)&&(k.modified=!0),a.reference(),!0}});b.walk(h),a.cache&&(this.cname=a.cache.cname)}),va.DEFMETHOD("init_scope_vars",function(a){this.variables=new x,this.functions=new x,this.uses_with=!1,this.uses_eval=!1,this.parent_scope=null,this.enclosed=[],this.cname=-1,this.nesting=a}),xa.DEFMETHOD("init_scope_vars",function(){va.prototype.init_scope_vars.apply(this,arguments),this.uses_arguments=!1;var a=new Ta({name:"arguments",start:this.start,end:this.end}),b=new T(this,this.variables.size(),a);this.variables.set(a.name,b)}),ub.DEFMETHOD("reference",function(){var a=this.definition();a.references.push(this);for(var b=this.scope;b&&(p(b.enclosed,a),b!==a.scope);)b=b.parent_scope;this.frame=this.scope.nesting-a.scope.nesting}),va.DEFMETHOD("find_variable",function(a){return a instanceof kb&&(a=a.name),this.variables.get(a)||this.parent_scope&&this.parent_scope.find_variable(a)}),va.DEFMETHOD("def_function",function(a){this.functions.set(a.name,this.def_variable(a))}),va.DEFMETHOD("def_variable",function(a){var b;return this.variables.has(a.name)?(b=this.variables.get(a.name),b.orig.push(a)):(b=new T(this,this.variables.size(),a),this.variables.set(a.name,b),b.global=!this.parent_scope),a.thedef=b}),va.DEFMETHOD("next_mangled",function(a){var b=this.enclosed;a:for(;;){var c=dc(++this.cname);if(I(c)&&!(a.except.indexOf(c)>=0)){for(var d=b.length;--d>=0;){var e=b[d],f=e.mangled_name||e.unmangleable(a)&&e.name;if(c==f)continue a}return c}}}),za.DEFMETHOD("next_mangled",function(a,b){for(var c=b.orig[0]instanceof pb&&this.name&&this.name.definition(),d=c?c.mangled_name||c.name:null;;){var e=xa.prototype.next_mangled.call(this,a,b);if(!d||d!=e)return e}}),va.DEFMETHOD("references",function(a){return a instanceof kb&&(a=a.definition()),this.enclosed.indexOf(a)<0?null:a}),kb.DEFMETHOD("unmangleable",function(a){return this.definition().unmangleable(a)}),lb.DEFMETHOD("unmangleable",function(){return!0}),tb.DEFMETHOD("unmangleable",function(){return!1}),kb.DEFMETHOD("unreferenced",function(){return 0==this.definition().references.length&&!(this.scope.uses_eval||this.scope.uses_with)}),kb.DEFMETHOD("undeclared",function(){return this.definition().undeclared}),vb.DEFMETHOD("undeclared",function(){return!1}),tb.DEFMETHOD("undeclared",function(){return!1}),kb.DEFMETHOD("definition",function(){return this.thedef}),kb.DEFMETHOD("global",function(){return this.definition().global}),Ra.DEFMETHOD("has_const_pragma",function(){var a=this.start&&this.start.comments_before,b=a&&a[a.length-1];return b&&/@const\b/.test(b.value)}),wa.DEFMETHOD("_default_mangler_options",function(a){return k(a,{except:[],eval:!1,sort:!1,toplevel:!1,screw_ie8:!0,keep_fnames:!1})}),wa.DEFMETHOD("mangle_names",function(a){a=this._default_mangler_options(a),a.except.push("arguments");var b=-1,c=[];a.cache&&this.globals.each(function(b){a.except.indexOf(b.name)<0&&c.push(b)});var d=new B(function(e,f){if(e instanceof na){var g=b;return f(),b=g,!0}if(e instanceof va){var h=(d.parent(),[]);return e.variables.each(function(b){a.except.indexOf(b.name)<0&&h.push(b)}),void c.push.apply(c,h)}if(e instanceof tb){var i;do i=dc(++b);while(!I(i));return e.mangled_name=i,!0}if(a.screw_ie8&&e instanceof sb)return void c.push(e.definition())});this.walk(d),c.forEach(function(b){b.mangle(a)}),a.cache&&(a.cache.cname=this.cname)}),wa.DEFMETHOD("compute_char_frequency",function(a){a=this._default_mangler_options(a);var b=new B(function(b){b instanceof xb?dc.consider(b.print_to_string()):b instanceof Da?dc.consider("return"):b instanceof Ea?dc.consider("throw"):b instanceof Ha?dc.consider("continue"):b instanceof Ga?dc.consider("break"):b instanceof ga?dc.consider("debugger"):b instanceof ha?dc.consider(b.value):b instanceof ra?dc.consider("while"):b instanceof qa?dc.consider("do while"):b instanceof Ia?(dc.consider("if"),b.alternative&&dc.consider("else")):b instanceof Ra?dc.consider("var"):b instanceof Sa?dc.consider("const"):b instanceof xa?dc.consider("function"):b instanceof sa?dc.consider("for"):b instanceof ta?dc.consider("for in"):b instanceof Ja?dc.consider("switch"):b instanceof Ma?dc.consider("case"):b instanceof La?dc.consider("default"):b instanceof ua?dc.consider("with"):b instanceof ib?dc.consider("set"+b.key):b instanceof jb?dc.consider("get"+b.key):b instanceof hb?dc.consider(b.key):b instanceof Va?dc.consider("new"):b instanceof wb?dc.consider("this"):b instanceof Na?dc.consider("try"):b instanceof Oa?dc.consider("catch"):b instanceof Pa?dc.consider("finally"):b instanceof kb&&b.unmangleable(a)?dc.consider(b.name):b instanceof $a||b instanceof bb?dc.consider(b.operator):b instanceof Ya&&dc.consider(b.property); +});this.walk(b),dc.sort()});var dc=function(){function a(){d=Object.create(null),c=e.split("").map(function(a){return a.charCodeAt(0)}),c.forEach(function(a){d[a]=0})}function b(a){var b="",d=54;a++;do a--,b+=String.fromCharCode(c[a%d]),a=Math.floor(a/d),d=64;while(a>0);return b}var c,d,e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789";return b.consider=function(a){for(var b=a.length;--b>=0;){var c=a.charCodeAt(b);c in d&&++d[c]}},b.sort=function(){c=s(c,function(a,b){return D(a)&&!D(b)?1:D(b)&&!D(a)?-1:d[b]-d[a]})},b.reset=a,a(),b.get=function(){return c},b.freq=function(){return d},b}();wa.DEFMETHOD("scope_warnings",function(a){a=k(a,{undeclared:!1,unreferenced:!0,assign_to_global:!0,func_arguments:!0,nested_defuns:!0,eval:!0});var b=new B(function(c){if(a.undeclared&&c instanceof ub&&c.undeclared()&&ea.warn("Undeclared symbol: {name} [{file}:{line},{col}]",{name:c.name,file:c.start.file,line:c.start.line,col:c.start.col}),a.assign_to_global){var d=null;c instanceof db&&c.left instanceof ub?d=c.left:c instanceof ta&&c.init instanceof ub&&(d=c.init),d&&(d.undeclared()||d.global()&&d.scope!==d.definition().scope)&&ea.warn("{msg}: {name} [{file}:{line},{col}]",{msg:d.undeclared()?"Accidental global?":"Assignment to global",name:d.name,file:d.start.file,line:d.start.line,col:d.start.col})}a.eval&&c instanceof ub&&c.undeclared()&&"eval"==c.name&&ea.warn("Eval is used [{file}:{line},{col}]",c.start),a.unreferenced&&(c instanceof mb||c instanceof tb)&&!(c instanceof sb)&&c.unreferenced()&&ea.warn("{type} {name} is declared but not referenced [{file}:{line},{col}]",{type:c instanceof tb?"Label":"Symbol",name:c.name,file:c.start.file,line:c.start.line,col:c.start.col}),a.func_arguments&&c instanceof xa&&c.uses_arguments&&ea.warn("arguments used in function {name} [{file}:{line},{col}]",{name:c.name?c.name.name:"anonymous",file:c.start.file,line:c.start.line,col:c.start.col}),a.nested_defuns&&c instanceof Aa&&!(b.parent()instanceof va)&&ea.warn('Function {name} declared in nested statement "{type}" [{file}:{line},{col}]',{name:c.name.name,type:b.parent().TYPE,file:c.start.file,line:c.start.line,col:c.start.col})});this.walk(b)});var ec=/^$|[;{][\s\n]*$/;!function(){function a(a,b){a.DEFMETHOD("_codegen",b)}function b(a,c){Array.isArray(a)?a.forEach(function(a){b(a,c)}):a.DEFMETHOD("needs_parens",c)}function c(a,b,c,d){var e=a.length-1;r=d,a.forEach(function(a,d){r!==!0||a instanceof ha||a instanceof la||a instanceof ia&&a.body instanceof yb||(r=!1),a instanceof la||(c.indent(),a.print(c),d==e&&b||(c.newline(),b&&c.newline())),r===!0&&a instanceof ia&&a.body instanceof yb&&(r=!1)}),r=!1}function d(a,b,d){a.length>0?b.with_block(function(){c(a,!1,b,d)}):b.print("{}")}function e(a,b){if(b.option("bracketize"))return void n(a.body,b);if(!a.body)return b.force_semicolon();if(a.body instanceof qa)return void n(a.body,b);for(var c=a.body;;)if(c instanceof Ia){if(!c.alternative)return void n(a.body,b);c=c.alternative}else{if(!(c instanceof ma))break;c=c.body}h(a.body,b)}function f(a,b,c){if(c)try{a.walk(new B(function(a){if(a instanceof bb&&"in"==a.operator)throw b})),a.print(b)}catch(c){if(c!==b)throw c;a.print(b,!0)}else a.print(b)}function g(a){return[92,47,46,43,42,63,40,41,91,93,123,125,36,94,58,124,33,10,13,0,65279,8232,8233].indexOf(a)<0}function h(a,b){b.option("bracketize")?!a||a instanceof la?b.print("{}"):a instanceof ka?a.print(b):b.with_block(function(){b.indent(),a.print(b),b.newline()}):!a||a instanceof la?b.force_semicolon():a.print(b)}function i(a){for(var b=a.stack(),c=b.length,d=b[--c],e=b[--c];c>0;){if(e instanceof fa&&e.body===d)return!0;if(!(e instanceof Wa&&e.car===d||e instanceof Ua&&e.expression===d&&!(e instanceof Va)||e instanceof Ya&&e.expression===d||e instanceof Za&&e.expression===d||e instanceof cb&&e.condition===d||e instanceof bb&&e.left===d||e instanceof ab&&e.expression===d))return!1;d=e,e=b[--c]}}function j(a,b){return a.args.length>0||b.option("beautify")}function k(a){for(var b=a[0],c=b.length,d=1;d=0?d.push("0x"+a.toString(16).toLowerCase(),"0"+a.toString(8)):d.push("-0x"+(-a).toString(16).toLowerCase(),"-0"+(-a).toString(8)),(b=/^(.*?)(0+)$/.exec(a))&&d.push(b[1]+"e"+b[2].length)):(b=/^0?\.(0+)(.*)$/.exec(a))&&d.push(b[2]+"e-"+(b[1].length+b[2].length),c.substr(c.indexOf("."))),k(d)}function n(a,b){return a instanceof ka?void a.print(b):void b.with_block(function(){b.indent(),a.print(b),b.newline()})}function o(a,b){a.DEFMETHOD("add_source_map",function(a){b(this,a)})}function p(a,b){b.add_mapping(a.start)}var q=!1,r=!1;ea.DEFMETHOD("print",function(a,b){function c(){d.add_comments(a),d.add_source_map(a),e(d,a)}var d=this,e=d._codegen,f=q;d instanceof ha&&"use asm"==d.value&&a.parent()instanceof va&&(q=!0),a.push_node(d),b||d.needs_parens(a)?a.with_parens(c):c(),a.pop_node(),d instanceof va&&(q=f)}),ea.DEFMETHOD("print_to_string",function(a){var b=W(a);return a||(b._readonly=!0),this.print(b),b.get()}),ea.DEFMETHOD("add_comments",function(a){if(!a._readonly){var b=this,c=b.start;if(c&&!c._comments_dumped){c._comments_dumped=!0;var d=c.comments_before||[];b instanceof Ca&&b.value&&b.value.walk(new B(function(a){if(a.start&&a.start.comments_before&&(d=d.concat(a.start.comments_before),a.start.comments_before=[]),a instanceof za||a instanceof eb||a instanceof fb)return!0})),d=d.filter(a.comment_filter,b),!a.option("beautify")&&d.length>0&&/comment[134]/.test(d[0].type)&&0!==a.col()&&d[0].nlb&&a.print("\n"),d.forEach(function(b){/comment[134]/.test(b.type)?(a.print("//"+b.value+"\n"),a.indent()):"comment2"==b.type?(a.print("/*"+b.value+"*/"),c.nlb?(a.print("\n"),a.indent()):a.space()):0===a.pos()&&"comment5"==b.type&&a.option("shebang")&&(a.print("#!"+b.value+"\n"),a.indent())})}}}),b(ea,function(){return!1}),b(za,function(a){if(i(a))return!0;if(a.option("wrap_iife")){var b=a.parent();return b instanceof Ua&&b.expression===this}return!1}),b(fb,function(a){return i(a)}),b([$a,Eb],function(a){var b=a.parent();return b instanceof Xa&&b.expression===this||b instanceof Ua&&b.expression===this}),b(Wa,function(a){var b=a.parent();return b instanceof Ua||b instanceof $a||b instanceof bb||b instanceof Ta||b instanceof Xa||b instanceof eb||b instanceof gb||b instanceof cb}),b(bb,function(a){var b=a.parent();if(b instanceof Ua&&b.expression===this)return!0;if(b instanceof $a)return!0;if(b instanceof Xa&&b.expression===this)return!0;if(b instanceof bb){var c=b.operator,d=ac[c],e=this.operator,f=ac[e];if(d>f||d==f&&this===b.right)return!0}}),b(Xa,function(a){var b=a.parent();if(b instanceof Va&&b.expression===this)try{this.walk(new B(function(a){if(a instanceof Ua)throw b}))}catch(a){if(a!==b)throw a;return!0}}),b(Ua,function(a){var b,c=a.parent();return c instanceof Va&&c.expression===this||this.expression instanceof za&&c instanceof Xa&&c.expression===this&&(b=a.parent(1))instanceof db&&b.left===c}),b(Va,function(a){var b=a.parent();if(!j(this,a)&&(b instanceof Xa||b instanceof Ua&&b.expression===this))return!0}),b(zb,function(a){var b=a.parent();if(b instanceof Xa&&b.expression===this){var c=this.getValue();if(c<0||/^0/.test(l(c)))return!0}}),b([db,cb],function(a){var b=a.parent();return b instanceof $a||(b instanceof bb&&!(b instanceof db)||(b instanceof Ua&&b.expression===this||(b instanceof cb&&b.condition===this||(b instanceof Xa&&b.expression===this||void 0))))}),a(ha,function(a,b){b.print_string(a.value,a.quote),b.semicolon()}),a(ga,function(a,b){b.print("debugger"),b.semicolon()}),ma.DEFMETHOD("_do_print_body",function(a){h(this.body,a)}),a(fa,function(a,b){a.body.print(b),b.semicolon()}),a(wa,function(a,b){c(a.body,!0,b,!0),b.print("")}),a(na,function(a,b){a.label.print(b),b.colon(),a.body.print(b)}),a(ia,function(a,b){a.body.print(b),b.semicolon()}),a(ka,function(a,b){d(a.body,b)}),a(la,function(a,b){b.semicolon()}),a(qa,function(a,b){b.print("do"),b.space(),a._do_print_body(b),b.space(),b.print("while"),b.space(),b.with_parens(function(){a.condition.print(b)}),b.semicolon()}),a(ra,function(a,b){b.print("while"),b.space(),b.with_parens(function(){a.condition.print(b)}),b.space(),a._do_print_body(b)}),a(sa,function(a,b){b.print("for"),b.space(),b.with_parens(function(){!a.init||a.init instanceof la?b.print(";"):(a.init instanceof Qa?a.init.print(b):f(a.init,b,!0),b.print(";"),b.space()),a.condition?(a.condition.print(b),b.print(";"),b.space()):b.print(";"),a.step&&a.step.print(b)}),b.space(),a._do_print_body(b)}),a(ta,function(a,b){b.print("for"),b.space(),b.with_parens(function(){a.init.print(b),b.space(),b.print("in"),b.space(),a.object.print(b)}),b.space(),a._do_print_body(b)}),a(ua,function(a,b){b.print("with"),b.space(),b.with_parens(function(){a.expression.print(b)}),b.space(),a._do_print_body(b)}),xa.DEFMETHOD("_do_print",function(a,b){var c=this;b||a.print("function"),c.name&&(a.space(),c.name.print(a)),a.with_parens(function(){c.argnames.forEach(function(b,c){c&&a.comma(),b.print(a)})}),a.space(),d(c.body,a,!0)}),a(xa,function(a,b){a._do_print(b)}),Ca.DEFMETHOD("_do_print",function(a,b){a.print(b),this.value&&(a.space(),this.value.print(a)),a.semicolon()}),a(Da,function(a,b){a._do_print(b,"return")}),a(Ea,function(a,b){a._do_print(b,"throw")}),Fa.DEFMETHOD("_do_print",function(a,b){a.print(b),this.label&&(a.space(),this.label.print(a)),a.semicolon()}),a(Ga,function(a,b){a._do_print(b,"break")}),a(Ha,function(a,b){a._do_print(b,"continue")}),a(Ia,function(a,b){b.print("if"),b.space(),b.with_parens(function(){a.condition.print(b)}),b.space(),a.alternative?(e(a,b),b.space(),b.print("else"),b.space(),h(a.alternative,b)):a._do_print_body(b)}),a(Ja,function(a,b){b.print("switch"),b.space(),b.with_parens(function(){a.expression.print(b)}),b.space(),a.body.length>0?b.with_block(function(){a.body.forEach(function(a,c){c&&b.newline(),b.indent(!0),a.print(b)})}):b.print("{}")}),Ka.DEFMETHOD("_do_print_body",function(a){this.body.length>0&&(a.newline(),this.body.forEach(function(b){a.indent(),b.print(a),a.newline()}))}),a(La,function(a,b){b.print("default:"),a._do_print_body(b)}),a(Ma,function(a,b){b.print("case"),b.space(),a.expression.print(b),b.print(":"),a._do_print_body(b)}),a(Na,function(a,b){b.print("try"),b.space(),d(a.body,b),a.bcatch&&(b.space(),a.bcatch.print(b)),a.bfinally&&(b.space(),a.bfinally.print(b))}),a(Oa,function(a,b){b.print("catch"),b.space(),b.with_parens(function(){a.argname.print(b)}),b.space(),d(a.body,b)}),a(Pa,function(a,b){b.print("finally"),b.space(),d(a.body,b)}),Qa.DEFMETHOD("_do_print",function(a,b){a.print(b),a.space(),this.definitions.forEach(function(b,c){c&&a.comma(),b.print(a)});var c=a.parent(),d=c instanceof sa||c instanceof ta,e=d&&c.init===this;e||a.semicolon()}),a(Ra,function(a,b){a._do_print(b,"var")}),a(Sa,function(a,b){a._do_print(b,"const")}),a(Ta,function(a,b){if(a.name.print(b),a.value){b.space(),b.print("="),b.space();var c=b.parent(1),d=c instanceof sa||c instanceof ta;f(a.value,b,d)}}),a(Ua,function(a,b){a.expression.print(b),a instanceof Va&&!j(a,b)||b.with_parens(function(){a.args.forEach(function(a,c){c&&b.comma(),a.print(b)})})}),a(Va,function(a,b){b.print("new"),b.space(),Ua.prototype._codegen(a,b)}),Wa.DEFMETHOD("_do_print",function(a){this.car.print(a),this.cdr&&(a.comma(),a.should_break()&&(a.newline(),a.indent()),this.cdr.print(a))}),a(Wa,function(a,b){a._do_print(b)}),a(Ya,function(a,b){var c=a.expression;c.print(b),c instanceof zb&&c.getValue()>=0&&(/[xa-f.)]/i.test(b.last())||b.print(".")),b.print("."),b.add_mapping(a.end),b.print_name(a.property)}),a(Za,function(a,b){a.expression.print(b),b.print("["),a.property.print(b),b.print("]")}),a(_a,function(a,b){var c=a.operator;b.print(c),(/^[a-z]/i.test(c)||/[+-]$/.test(c)&&a.expression instanceof _a&&/^[+-]/.test(a.expression.operator))&&b.space(),a.expression.print(b)}),a(ab,function(a,b){a.expression.print(b),b.print(a.operator)}),a(bb,function(a,b){var c=a.operator;a.left.print(b),">"==c[0]&&a.left instanceof ab&&"--"==a.left.operator?b.print(" "):b.space(),b.print(c),("<"==c||"<<"==c)&&a.right instanceof _a&&"!"==a.right.operator&&a.right.expression instanceof _a&&"--"==a.right.expression.operator?b.print(" "):b.space(),a.right.print(b)}),a(cb,function(a,b){a.condition.print(b),b.space(),b.print("?"),b.space(),a.consequent.print(b),b.space(),b.colon(),a.alternative.print(b)}),a(eb,function(a,b){b.with_square(function(){var c=a.elements,d=c.length;d>0&&b.space(),c.forEach(function(a,c){c&&b.comma(),a.print(b),c===d-1&&a instanceof Fb&&b.comma()}),d>0&&b.space()})}),a(fb,function(a,b){a.properties.length>0?b.with_block(function(){a.properties.forEach(function(a,c){c&&(b.print(","),b.newline()),b.indent(),a.print(b)}),b.newline()}):b.print("{}")}),a(hb,function(a,b){var c=a.key,d=a.quote;b.option("quote_keys")?b.print_string(c+""):("number"==typeof c||!b.option("beautify")&&+c+""==c)&&parseFloat(c)>=0?b.print(l(c)):(Mb(c)?b.option("screw_ie8"):L(c))?d&&b.option("keep_quoted_props")?b.print_string(c,d):b.print_name(c):b.print_string(c,d),b.colon(),a.value.print(b)}),a(ib,function(a,b){b.print("set"),b.space(),a.key.print(b),a.value._do_print(b,!0)}),a(jb,function(a,b){b.print("get"),b.space(),a.key.print(b),a.value._do_print(b,!0)}),a(kb,function(a,b){var c=a.definition();b.print_name(c?c.mangled_name||c.name:a.name)}),a(Eb,function(a,b){b.print("void 0")}),a(Fb,m),a(Gb,function(a,b){b.print("Infinity")}),a(Db,function(a,b){b.print("NaN")}),a(wb,function(a,b){b.print("this")}),a(xb,function(a,b){b.print(a.getValue())}),a(yb,function(a,b){b.print_string(a.getValue(),a.quote,r)}),a(zb,function(a,b){q&&a.start&&null!=a.start.raw?b.print(a.start.raw):b.print(l(a.getValue()))}),a(Ab,function(a,b){var c=a.getValue().toString();b.option("ascii_only")?c=b.to_ascii(c):b.option("unescape_regexps")&&(c=c.split("\\\\").map(function(a){return a.replace(/\\u[0-9a-fA-F]{4}|\\x[0-9a-fA-F]{2}/g,function(a){var b=parseInt(a.substr(2),16);return g(b)?String.fromCharCode(b):a})}).join("\\\\")),b.print(c);var d=b.parent();d instanceof bb&&/^in/.test(d.operator)&&d.left===a&&b.print(" ")}),o(ea,m),o(ha,p),o(ga,p),o(kb,p),o(Ba,p),o(ma,p),o(na,m),o(xa,p),o(Ja,p),o(Ka,p),o(ka,p),o(wa,m),o(Va,p),o(Na,p),o(Oa,p),o(Pa,p),o(Qa,p),o(xb,p),o(ib,function(a,b){b.add_mapping(a.start,a.key.name)}),o(jb,function(a,b){b.add_mapping(a.start,a.key.name)}),o(gb,function(a,b){b.add_mapping(a.start,a.key)})}(),X.prototype=new S,l(X.prototype,{option:function(a){return this.options[a]},compress:function(a){for(var b=+this.options.passes||1,c=0;c0&&a.clear_opt_flags(),a=a.transform(this);return a},warn:function(a,b){if(this.options.warnings){var c=q(a,b);c in this.warnings_produced||(this.warnings_produced[c]=!0,ea.warn.apply(ea,arguments))}},clear_warnings:function(){this.warnings_produced={}},before:function(a,b,c){if(a._squeezed)return a;var d=!1;return a instanceof va&&(a=a.hoist_declarations(this),d=!0),b(a,this),a=a.optimize(this),d&&a instanceof va&&(a.drop_unused(this),b(a,this)),a._squeezed=!0,a}}),function(){function a(a,b){a.DEFMETHOD("optimize",function(a){var c=this;if(c._optimized)return c;if(a.has_directive("use asm"))return c;var d=b(c,a);return d._optimized=!0,d===c?d:d.transform(a)})}function b(a,b,c){return c||(c={}),b&&(c.start||(c.start=b.start),c.end||(c.end=b.end)),new a(c)}function c(a,c,d){if(c instanceof ea)return c.transform(a);switch(typeof c){case"string":return b(yb,d,{value:c}).optimize(a);case"number":return isNaN(c)?b(Db,d):1/c<0?b(_a,d,{operator:"-",expression:b(zb,d,{value:-c})}):b(zb,d,{value:c}).optimize(a);case"boolean":return b(c?Jb:Ib,d).optimize(a);case"undefined":return b(Eb,d).optimize(a);default:if(null===c)return b(Cb,d,{value:null}).optimize(a);if(c instanceof RegExp)return b(Ab,d,{value:c}).optimize(a);throw new Error(q("Can't handle constant of type: {type}",{type:typeof c}))}}function d(a,c,d){return a instanceof Ua&&a.expression===c&&(d instanceof Xa||d instanceof ub&&"eval"===d.name)?b(Wa,c,{car:b(zb,c,{value:0}),cdr:d}):d}function e(a){if(null===a)return[];if(a instanceof ka)return a.body;if(a instanceof la)return[];if(a instanceof fa)return[a];throw new Error("Can't convert thing to statement array")}function f(a){return null===a||(a instanceof la||a instanceof ka&&0==a.body.length)}function i(a){return a instanceof Ja?a:(a instanceof sa||a instanceof ta||a instanceof pa)&&a.body instanceof ka?a.body:a}function j(a,c){function f(a,c){function e(a,b){return a instanceof ub&&(b instanceof db&&a===b.left||b instanceof $a&&b.expression===a&&("++"==b.operator||"--"==b.operator))}function g(f,g,j){if(e(f,g))return f;var m=d(g,f,t.value);return t.value=null,n.splice(s,1),0===n.length&&(a[l]=b(la,h),i=!0),k.clear_opt_flags(),c.warn("Replacing "+(j?"constant":"variable")+" "+v+" [{file}:{line},{col}]",f.start),u=!0,m}for(var h=c.self(),i=!1,j=a.length;--j>=0;){var k=a[j];if(!(k instanceof Qa)){if([k,k.body,k.alternative,k.bcatch,k.bfinally].forEach(function(a){a&&a.body&&f(a.body,c)}),j<=0)break;var l=j-1,m=a[l];if(m instanceof Qa){var n=m.definitions;if(null!=n)for(var o={},p=!1,q=!1,r={},s=n.length;--s>=0;){var t=n[s];if(null==t.value)break;var v=t.name.name;if(!v||!v.length)break;if(v in o)break;o[v]=!0;var w=h.find_variable&&h.find_variable(v);if(w&&w.references&&1===w.references.length&&"arguments"!=v){var x=w.references[0];if(x.scope.uses_eval||x.scope.uses_with)break;if(t.value instanceof Ab||!t.value.is_constant(c)){if(!(p|=q))if(x.scope===h){var y=new B(function(a){a instanceof ub&&e(a,y.parent())&&(r[a.name]=q=!0)});t.value.walk(y);var z=!1,A=new S(function(a){if(z)return a;var b=A.parent();return a instanceof xa||a instanceof Na||a instanceof ua||a instanceof Ma||a instanceof oa||b instanceof Ia&&a!==b.condition||b instanceof cb&&a!==b.condition||b instanceof bb&&("&&"==b.operator||"||"==b.operator)&&a===b.right||b instanceof Ja&&a!==b.expression?(p=z=!0,a):void 0},function(a){return z?a:a===x?(z=!0,g(a,A.parent(),!1)):(p|=a.has_side_effects(c))?(z=!0,a):q&&a instanceof ub&&a.name in r?(p=!0,z=!0,a):void 0});k.transform(A)}else p|=t.value.has_side_effects(c)}else{var C=new S(function(a){if(a===x)return g(a,C.parent(),!0)});k.transform(C)}}else p=!0}}}}if(i)for(var D=a.length;--D>=0;)a.length>1&&a[D]instanceof la&&a.splice(D,1);return a}function g(a){function d(a){return/@ngInject/.test(a.value)}function e(a){return a.argnames.map(function(a){return b(yb,a,{value:a.name})})}function f(a,c){return b(eb,a,{elements:c})}function g(a,c){return b(ia,a,{body:b(db,a,{operator:"=",left:b(Ya,c,{expression:b(ub,c,c),property:"$inject"}),right:f(a,e(a))})})}function h(a){a&&a.args&&(a.args.forEach(function(a,b,c){var g=a.start.comments_before;a instanceof xa&&g.length&&d(g[0])&&(c[b]=f(a,e(a).concat(a)))}),a.expression&&a.expression.expression&&h(a.expression.expression))}return a.reduce(function(a,b){if(a.push(b),b.body&&b.body.args)h(b.body);else{var e=b.start,f=e.comments_before;if(f&&f.length>0){var i=f.pop();d(i)&&(b instanceof Aa?a.push(g(b,b.name)):b instanceof Qa?b.definitions.forEach(function(b){b.value&&b.value instanceof xa&&a.push(g(b.value,b.name))}):c.warn("Unknown statement marked with @ngInject [{file}:{line},{col}]",e))}}return a},[])}function h(a){var b=[];return a.reduce(function(a,c){return c instanceof ka?(u=!0,a.push.apply(a,h(c.body))):c instanceof la?u=!0:c instanceof ha?b.indexOf(c.value)<0?(a.push(c),b.push(c.value)):u=!0:a.push(c),a},[])}function j(a,c){function d(a){for(var b=0,c=a.length;--c>=0;){var d=a[c];if(d instanceof Ia&&d.body instanceof Da&&++b>1)return!0}return!1}var f=c.self(),g=d(a),h=f instanceof xa,j=[];a:for(var l=a.length;--l>=0;){var m=a[l];switch(!0){case h&&m instanceof Da&&!m.value&&0==j.length:u=!0;continue a;case m instanceof Ia:if(m.body instanceof Da){if((h&&0==j.length||j[0]instanceof Da&&!j[0].value)&&!m.body.value&&!m.alternative){u=!0;var n=b(ia,m.condition,{body:m.condition});j.unshift(n);continue a}if(j[0]instanceof Da&&m.body.value&&j[0].value&&!m.alternative){u=!0,m=m.clone(),m.alternative=j[0],j[0]=m.transform(c);continue a}if(g&&(0==j.length||j[0]instanceof Da)&&m.body.value&&!m.alternative&&h){u=!0,m=m.clone(),m.alternative=j[0]||b(Da,m,{value:b(Eb,m)}),j[0]=m.transform(c);continue a}if(!m.body.value&&h){u=!0,m=m.clone(),m.condition=m.condition.negate(c);var o=e(m.alternative).concat(j),q=k(o);m.body=b(ka,m,{body:o}),m.alternative=null,j=q.concat([m.transform(c)]);continue a}if(c.option("sequences")&&1==j.length&&h&&j[0]instanceof ia&&(!m.alternative||m.alternative instanceof ia)){u=!0,j.push(b(Da,j[0],{value:b(Eb,j[0])}).transform(c)),j=e(m.alternative).concat(j),j.unshift(m);continue a}}var s=p(m.body),t=s instanceof Fa?c.loopcontrol_target(s.label):null;if(s&&(s instanceof Da&&!s.value&&h||s instanceof Ha&&f===i(t)||s instanceof Ga&&t instanceof ka&&f===t)){s.label&&r(s.label.thedef.references,s),u=!0;var o=e(m.body).slice(0,-1);m=m.clone(),m.condition=m.condition.negate(c),m.body=b(ka,m,{body:e(m.alternative).concat(j)}),m.alternative=b(ka,m,{body:o}),j=[m.transform(c)];continue a}var s=p(m.alternative),t=s instanceof Fa?c.loopcontrol_target(s.label):null;if(s&&(s instanceof Da&&!s.value&&h||s instanceof Ha&&f===i(t)||s instanceof Ga&&t instanceof ka&&f===t)){s.label&&r(s.label.thedef.references,s),u=!0,m=m.clone(),m.body=b(ka,m.body,{body:e(m.body).concat(j)}),m.alternative=b(ka,m.alternative,{body:e(m.alternative).slice(0,-1)}),j=[m.transform(c)];continue a}j.unshift(m);break;default:j.unshift(m)}}return j}function m(a,b){var c=!1,d=a.length,e=b.self();return a=a.reduce(function(a,d){if(c)l(b,d,a);else{if(d instanceof Fa){var f=b.loopcontrol_target(d.label);d instanceof Ga&&f instanceof ka&&i(f)===e||d instanceof Ha&&i(f)===e?d.label&&r(d.label.thedef.references,d):a.push(d)}else a.push(d);p(d)&&(c=!0)}return a},[]),u=a.length!=d,a}function n(a,c){function d(){e=Wa.from_array(e),e&&f.push(b(ia,e,{body:e})),e=[]}if(a.length<2)return a;var e=[],f=[];return a.forEach(function(a){a instanceof ia&&o(e)0&&(a=n(a,c)),c.option("join_vars")&&(a=s(a,c)),c.option("collapse_vars")&&(a=f(a,c));while(u&&v-- >0);return c.option("negate_iife")&&t(a,c),a}function k(a){for(var b=[],c=a.length-1;c>=0;--c){var d=a[c];d instanceof Aa&&(a.splice(c,1),b.unshift(d))}return b}function l(a,b,c){b instanceof Aa||a.warn("Dropping unreachable code [{file}:{line},{col}]",b.start),b.walk(new B(function(b){return b instanceof Qa?(a.warn("Declarations in unreachable code! [{file}:{line},{col}]",b.start),b.remove_initializers(),c.push(b),!0):b instanceof Aa?(c.push(b),!0):b instanceof va||void 0}))}function m(a,b){return a.print_to_string().length>b.print_to_string().length?b:a}function p(a){return a&&a.aborts()}function t(a,c){function d(d){d=e(d),a.body instanceof ka?(a.body=a.body.clone(),a.body.body=d.concat(a.body.body.slice(1)),a.body=a.body.transform(c)):a.body=b(ka,a.body,{body:d}).transform(c),t(a,c)}var f=a.body instanceof ka?a.body.body[0]:a.body;f instanceof Ia&&(f.body instanceof Ga&&c.loopcontrol_target(f.body.label)===a?(a.condition?a.condition=b(bb,a.condition,{left:a.condition,operator:"&&",right:f.condition.negate(c)}):a.condition=f.condition.negate(c),d(f.alternative)):f.alternative instanceof Ga&&c.loopcontrol_target(f.alternative.label)===a&&(a.condition?a.condition=b(bb,a.condition,{left:a.condition,operator:"&&",right:f.condition}):a.condition=f.condition,d(f.body)))}function u(a,b){var c=b.option("pure_getters");b.options.pure_getters=!1;var d=a.has_side_effects(b);return b.options.pure_getters=c,d}function z(a,c){return c.option("booleans")&&c.in_boolean_context()&&!a.has_side_effects(c)?b(Jb,a):a}a(ea,function(a,b){return a}),ea.DEFMETHOD("equivalent_to",function(a){return this.print_to_string()==a.print_to_string()}),ea.DEFMETHOD("clear_opt_flags",function(){this.walk(new B(function(a){a instanceof ha||a instanceof xb||(a._squeezed=!1,a._optimized=!1)}))}),function(a){var b=["!","delete"],c=["in","instanceof","==","!=","===","!==","<","<=",">=",">"];a(ea,n),a(_a,function(){return g(this.operator,b)}),a(bb,function(){return g(this.operator,c)||("&&"==this.operator||"||"==this.operator)&&this.left.is_boolean()&&this.right.is_boolean()}),a(cb,function(){return this.consequent.is_boolean()&&this.alternative.is_boolean()}),a(db,function(){return"="==this.operator&&this.right.is_boolean()}),a(Wa,function(){return this.cdr.is_boolean()}),a(Jb,o),a(Ib,o)}(function(a,b){a.DEFMETHOD("is_boolean",b)}),function(a){a(ea,n),a(yb,o),a(_a,function(){return"typeof"==this.operator}),a(bb,function(a){return"+"==this.operator&&(this.left.is_string(a)||this.right.is_string(a))}),a(db,function(a){return("="==this.operator||"+="==this.operator)&&this.right.is_string(a)}),a(Wa,function(a){return this.cdr.is_string(a)}),a(cb,function(a){return this.consequent.is_string(a)&&this.alternative.is_string(a)}),a(Ua,function(a){return a.option("unsafe")&&this.expression instanceof ub&&"String"==this.expression.name&&this.expression.undeclared()})}(function(a,b){a.DEFMETHOD("is_string",b)}),function(a){function b(a,b){if(!b)throw new Error("Compressor must be passed");return a._eval(b)}ea.DEFMETHOD("evaluate",function(b){if(!b.option("evaluate"))return[this];try{var d=this._eval(b);return[m(c(b,d,this),this),d]}catch(b){if(b!==a)throw b;return[this]}}),ea.DEFMETHOD("is_constant",function(a){return this instanceof xb||this instanceof _a&&"!"==this.operator&&this.expression instanceof xb||this.evaluate(a).length>1}),ea.DEFMETHOD("constant_value",function(a){if(this instanceof xb)return this.value;if(this instanceof _a&&"!"==this.operator&&this.expression instanceof xb)return!this.expression.value;var b=this.evaluate(a);return b.length>1?b[1]:void 0}),a(fa,function(){throw new Error(q("Cannot evaluate a statement [{file}:{line},{col}]",this.start))}),a(za,function(){throw a}),a(ea,function(){throw a}),a(xb,function(){return this.getValue()}),a(_a,function(c){var d=this.expression;switch(this.operator){case"!":return!b(d,c);case"typeof":if(d instanceof za)return"function";if(d=b(d,c),d instanceof RegExp)throw a;return typeof d;case"void":return void b(d,c);case"~":return~b(d,c);case"-":return-b(d,c);case"+":return+b(d,c)}throw a}),a(bb,function(c){var d,e=this.left,f=this.right;switch(this.operator){case"&&":d=b(e,c)&&b(f,c);break;case"||":d=b(e,c)||b(f,c);break;case"|":d=b(e,c)|b(f,c);break;case"&":d=b(e,c)&b(f,c);break;case"^":d=b(e,c)^b(f,c);break;case"+":d=b(e,c)+b(f,c);break;case"*":d=b(e,c)*b(f,c);break;case"/":d=b(e,c)/b(f,c);break;case"%":d=b(e,c)%b(f,c);break;case"-":d=b(e,c)-b(f,c);break;case"<<":d=b(e,c)<>":d=b(e,c)>>b(f,c);break;case">>>":d=b(e,c)>>>b(f,c);break;case"==":d=b(e,c)==b(f,c);break;case"===":d=b(e,c)===b(f,c);break;case"!=":d=b(e,c)!=b(f,c);break;case"!==":d=b(e,c)!==b(f,c);break;case"<":d=b(e,c)":d=b(e,c)>b(f,c);break;case">=":d=b(e,c)>=b(f,c);break;default:throw a}if(isNaN(d)&&c.find_parent(ua))throw a;return d}),a(cb,function(a){return b(this.condition,a)?b(this.consequent,a):b(this.alternative,a)}),a(ub,function(c){if(this._evaluating)throw a;this._evaluating=!0;try{var d=this.definition();if(d&&(d.constant||c.option("reduce_vars")&&!d.modified)&&d.init)return b(d.init,c)}finally{this._evaluating=!1}throw a}),a(Ya,function(c){if(c.option("unsafe")&&"length"==this.property){var d=b(this.expression,c);if("string"==typeof d)return d.length}throw a})}(function(a,b){a.DEFMETHOD("_eval",b)}),function(a){function c(a){return b(_a,a,{operator:"!",expression:a})}a(ea,function(){return c(this)}),a(fa,function(){throw new Error("Cannot negate a statement")}),a(za,function(){return c(this)}),a(_a,function(){return"!"==this.operator?this.expression:c(this)}),a(Wa,function(a){var b=this.clone();return b.cdr=b.cdr.negate(a),b}),a(cb,function(a){var b=this.clone();return b.consequent=b.consequent.negate(a),b.alternative=b.alternative.negate(a),m(c(this),b)}),a(bb,function(a){var b=this.clone(),d=this.operator;if(a.option("unsafe_comps"))switch(d){case"<=":return b.operator=">",b;case"<":return b.operator=">=",b;case">=":return b.operator="<",b;case">":return b.operator="<=",b}switch(d){case"==":return b.operator="!=",b;case"!=":return b.operator="==",b;case"===":return b.operator="!==",b;case"!==":return b.operator="===",b;case"&&":return b.operator="||",b.left=b.left.negate(a),b.right=b.right.negate(a),m(c(this),b);case"||":return b.operator="&&",b.left=b.left.negate(a),b.right=b.right.negate(a),m(c(this),b)}return c(this)})}(function(a,b){a.DEFMETHOD("negate",function(a){return b.call(this,a)})}),function(a){a(ea,o),a(la,n),a(xb,n),a(wb,n),a(Ua,function(a){var b=a.option("pure_funcs");return!b||("function"==typeof b?b(this):b.indexOf(this.expression.print_to_string())<0)}),a(ja,function(a){for(var b=this.body.length;--b>=0;)if(this.body[b].has_side_effects(a))return!0;return!1}),a(ia,function(a){return this.body.has_side_effects(a)}),a(Aa,o),a(za,n),a(bb,function(a){return this.left.has_side_effects(a)||this.right.has_side_effects(a)}),a(db,o),a(cb,function(a){return this.condition.has_side_effects(a)||this.consequent.has_side_effects(a)||this.alternative.has_side_effects(a)}),a($a,function(a){return"delete"==this.operator||"++"==this.operator||"--"==this.operator||this.expression.has_side_effects(a)}),a(ub,function(a){return this.global()&&this.undeclared()}),a(fb,function(a){for(var b=this.properties.length;--b>=0;)if(this.properties[b].has_side_effects(a))return!0;return!1}),a(gb,function(a){return this.value.has_side_effects(a)}),a(eb,function(a){for(var b=this.elements.length;--b>=0;)if(this.elements[b].has_side_effects(a))return!0;return!1}),a(Ya,function(a){return!a.option("pure_getters")||this.expression.has_side_effects(a)}),a(Za,function(a){return!a.option("pure_getters")||(this.expression.has_side_effects(a)||this.property.has_side_effects(a))}),a(Xa,function(a){return!a.option("pure_getters")}),a(Wa,function(a){return this.car.has_side_effects(a)||this.cdr.has_side_effects(a)})}(function(a,b){a.DEFMETHOD("has_side_effects",b)}),function(a){function b(){var a=this.body.length;return a>0&&p(this.body[a-1])}a(fa,function(){return null; +}),a(Ba,function(){return this}),a(ka,b),a(Ka,b),a(Ia,function(){return this.alternative&&p(this.body)&&p(this.alternative)&&this})}(function(a,b){a.DEFMETHOD("aborts",b)}),a(ha,function(a,c){return"up"===c.has_directive(a.value)?b(la,a):a}),a(ga,function(a,c){return c.option("drop_debugger")?b(la,a):a}),a(na,function(a,c){return a.body instanceof Ga&&c.loopcontrol_target(a.body.label)===a.body?b(la,a):0==a.label.references.length?a.body:a}),a(ja,function(a,b){return a.body=j(a.body,b),a}),a(ka,function(a,c){switch(a.body=j(a.body,c),a.body.length){case 1:return a.body[0];case 0:return b(la,a)}return a}),va.DEFMETHOD("drop_unused",function(a){var c=this;if(a.has_directive("use asm"))return c;if(a.option("unused")&&!(c instanceof wa)&&!c.uses_eval&&!c.uses_with){var d=[],e={},f=new x,g=this,h=new B(function(b,i){if(b!==c){if(b instanceof Aa)return f.add(b.name.name,b),!0;if(b instanceof Qa&&g===c)return b.definitions.forEach(function(b){b.value&&(f.add(b.name.name,b.value),b.value.has_side_effects(a)&&b.value.walk(h))}),!0;if(b instanceof ub){var j=b.definition();return j.id in e||(e[j.id]=!0,d.push(j)),!0}if(b instanceof va){var k=g;return g=b,i(),g=k,!0}}});c.walk(h);for(var i=0;i=0;){var k=h[i];if(!k.unreferenced())break;h.pop(),a.warn("Dropping unused function argument {name} [{file}:{line},{col}]",{name:k.name,file:k.start.file,line:k.start.line,col:k.start.col})}if(d instanceof Aa&&d!==c)return d.name.definition().id in e?d:(a.warn("Dropping unused function {name} [{file}:{line},{col}]",{name:d.name.name,file:d.name.start.file,line:d.name.start.line,col:d.name.start.col}),b(la,d));if(d instanceof Qa&&!(j.parent()instanceof ta)){var l=d.definitions.filter(function(b){if(b.name.definition().id in e)return!0;var c={name:b.name.name,file:b.name.start.file,line:b.name.start.line,col:b.name.start.col};return b.value&&b.value.has_side_effects(a)?(b._unused_side_effects=!0,a.warn("Side effects in initialization of unused variable {name} [{file}:{line},{col}]",c),!0):(a.warn("Dropping unused variable {name} [{file}:{line},{col}]",c),!1)});l=s(l,function(a,b){return!a.value&&b.value?-1:!b.value&&a.value?1:0});for(var m=[],i=0;i0&&(m.push(n.value),n.value=Wa.from_array(m),m=[]),++i)}return m=m.length>0?b(ka,d,{body:[b(ia,d,{body:Wa.from_array(m)})]}):null,0!=l.length||m?0==l.length?g?ca.splice(m.body):m:(d.definitions=l,m?(m.body.unshift(d),g?ca.splice(m.body):m):d):b(la,d)}if(d instanceof sa&&(f(d,this),d.init instanceof ka)){var o=d.init.body.slice(0,-1);return d.init=d.init.body.slice(-1)[0].body,o.push(d),g?ca.splice(o):b(ka,d,{body:o})}return d instanceof va&&d!==c?d:void 0});c.transform(j)}}),va.DEFMETHOD("hoist_declarations",function(a){var c=this;if(a.has_directive("use asm"))return c;var d=a.option("hoist_funs"),e=a.option("hoist_vars");if(d||e){var f=[],g=[],i=new x,j=0,k=0;c.walk(new B(function(a){return a instanceof va&&a!==c||(a instanceof Ra?(++k,!0):void 0)})),e=e&&k>1;var l=new S(function(a){if(a!==c){if(a instanceof ha)return f.push(a),b(la,a);if(a instanceof Aa&&d)return g.push(a),b(la,a);if(a instanceof Ra&&e){a.definitions.forEach(function(a){i.set(a.name.name,a),++j});var h=a.to_assignments(),k=l.parent();if(k instanceof ta&&k.init===a){if(null==h){var m=a.definitions[0].name;return b(ub,m,m)}return h}return k instanceof sa&&k.init===a?h:h?b(ia,a,{body:h}):b(la,a)}if(a instanceof va)return a}});if(c=c.transform(l),j>0){var m=[];if(i.each(function(a,b){c instanceof xa&&h(function(b){return b.name==a.name.name},c.argnames)?i.del(b):(a=a.clone(),a.value=null,m.push(a),i.set(b,a))}),m.length>0){for(var n=0;n1){if(d[1])return b(sa,a,{body:a.body});if(a instanceof ra&&c.option("dead_code")){var e=[];return l(c,a.body,e),b(ka,a,{body:e})}}return a}),a(ra,function(a,c){return c.option("loops")?(a=pa.prototype.optimize.call(a,c),a instanceof ra&&(t(a,c),a=b(sa,a,a).transform(c)),a):a}),a(sa,function(a,c){var d=a.condition;if(d&&(d=d.evaluate(c),a.condition=d[0]),!c.option("loops"))return a;if(d&&d.length>1&&!d[1]&&c.option("dead_code")){var e=[];return a.init instanceof fa?e.push(a.init):a.init&&e.push(b(ia,a.init,{body:a.init})),l(c,a.body,e),b(ka,a,{body:e})}return t(a,c),a}),a(Ia,function(a,c){if(!c.option("conditionals"))return a;var d=a.condition.evaluate(c);if(a.condition=d[0],d.length>1)if(d[1]){if(c.warn("Condition always true [{file}:{line},{col}]",a.condition.start),c.option("dead_code")){var e=[];return a.alternative&&l(c,a.alternative,e),e.push(a.body),b(ka,a,{body:e}).transform(c)}}else if(c.warn("Condition always false [{file}:{line},{col}]",a.condition.start),c.option("dead_code")){var e=[];return l(c,a.body,e),a.alternative&&e.push(a.alternative),b(ka,a,{body:e}).transform(c)}f(a.alternative)&&(a.alternative=null);var g=a.condition.negate(c),h=a.condition.print_to_string().length,i=g.print_to_string().length,j=i=ac[a.operator]||e(null,!0)),/^[!=]==?$/.test(a.operator))){if(a.left instanceof ub&&a.right instanceof cb){if(a.right.consequent instanceof ub&&a.right.consequent.definition()===a.left.definition()){if(/^==/.test(a.operator))return a.right.condition;if(/^!=/.test(a.operator))return a.right.condition.negate(c)}if(a.right.alternative instanceof ub&&a.right.alternative.definition()===a.left.definition()){if(/^==/.test(a.operator))return a.right.condition.negate(c);if(/^!=/.test(a.operator))return a.right.condition}}if(a.right instanceof ub&&a.left instanceof cb){if(a.left.consequent instanceof ub&&a.left.consequent.definition()===a.right.definition()){if(/^==/.test(a.operator))return a.left.condition;if(/^!=/.test(a.operator))return a.left.condition.negate(c)}if(a.left.alternative instanceof ub&&a.left.alternative.definition()===a.right.definition()){if(/^==/.test(a.operator))return a.left.condition.negate(c);if(/^!=/.test(a.operator))return a.left.condition}}}if(a=a.lift_sequences(c),c.option("comparisons"))switch(a.operator){case"===":case"!==":(a.left.is_string(c)&&a.right.is_string(c)||a.left.is_boolean()&&a.right.is_boolean())&&(a.operator=a.operator.substr(0,2));case"==":case"!=":a.left instanceof yb&&"undefined"==a.left.value&&a.right instanceof _a&&"typeof"==a.right.operator&&c.option("unsafe")&&(a.right.expression instanceof ub&&a.right.expression.undeclared()||(a.right=a.right.expression,a.left=b(Eb,a.left).optimize(c),2==a.operator.length&&(a.operator+="=")))}if(c.option("conditionals"))if("&&"==a.operator){var f=a.left.evaluate(c);if(f.length>1)return f[1]?(c.warn("Condition left of && always true [{file}:{line},{col}]",a.start),d(c.parent(),a,a.right.evaluate(c)[0])):(c.warn("Condition left of && always false [{file}:{line},{col}]",a.start),d(c.parent(),a,f[0]))}else if("||"==a.operator){var f=a.left.evaluate(c);if(f.length>1)return f[1]?(c.warn("Condition left of || always true [{file}:{line},{col}]",a.start),d(c.parent(),a,f[0])):(c.warn("Condition left of || always false [{file}:{line},{col}]",a.start),d(c.parent(),a,a.right.evaluate(c)[0]))}if(c.option("booleans")&&c.in_boolean_context())switch(a.operator){case"&&":var f=a.left.evaluate(c),g=a.right.evaluate(c);if(f.length>1&&!f[1]||g.length>1&&!g[1])return c.warn("Boolean && always false [{file}:{line},{col}]",a.start),a.left.has_side_effects(c)?b(Wa,a,{car:a.left,cdr:b(Ib)}).optimize(c):b(Ib,a);if(f.length>1&&f[1])return g[0];if(g.length>1&&g[1])return f[0];break;case"||":var f=a.left.evaluate(c),g=a.right.evaluate(c);if(f.length>1&&f[1]||g.length>1&&g[1])return c.warn("Boolean || always true [{file}:{line},{col}]",a.start),a.left.has_side_effects(c)?b(Wa,a,{car:a.left,cdr:b(Jb)}).optimize(c):b(Jb,a);if(f.length>1&&!f[1])return g[0];if(g.length>1&&!g[1])return f[0];break;case"+":var f=a.left.evaluate(c),g=a.right.evaluate(c);if(f.length>1&&f[0]instanceof yb&&f[1]&&!a.right.has_side_effects(c)||g.length>1&&g[0]instanceof yb&&g[1]&&!a.left.has_side_effects(c))return c.warn("+ in boolean context always true [{file}:{line},{col}]",a.start),b(Jb,a)}if(c.option("comparisons")&&a.is_boolean()){if(!(c.parent()instanceof bb)||c.parent()instanceof db){var h=b(_a,a,{operator:"!",expression:a.negate(c)});a=m(a,h)}if(c.option("unsafe_comps"))switch(a.operator){case"<":e(">");break;case"<=":e(">=")}}return"+"==a.operator&&a.right instanceof yb&&""===a.right.getValue()&&a.left instanceof bb&&"+"==a.left.operator&&a.left.is_string(c)?a.left:(c.option("evaluate")&&"+"==a.operator&&(a.left instanceof xb&&a.right instanceof bb&&"+"==a.right.operator&&a.right.left instanceof xb&&a.right.is_string(c)&&(a=b(bb,a,{operator:"+",left:b(yb,null,{value:""+a.left.getValue()+a.right.left.getValue(),start:a.left.start,end:a.right.left.end}),right:a.right.right})),a.right instanceof xb&&a.left instanceof bb&&"+"==a.left.operator&&a.left.right instanceof xb&&a.left.is_string(c)&&(a=b(bb,a,{operator:"+",left:a.left.left,right:b(yb,null,{value:""+a.left.right.getValue()+a.right.getValue(),start:a.left.right.start,end:a.right.end})})),a.left instanceof bb&&"+"==a.left.operator&&a.left.is_string(c)&&a.left.right instanceof xb&&a.right instanceof bb&&"+"==a.right.operator&&a.right.left instanceof xb&&a.right.is_string(c)&&(a=b(bb,a,{operator:"+",left:b(bb,a.left,{operator:"+",left:a.left.left,right:b(yb,null,{value:""+a.left.right.getValue()+a.right.left.getValue(),start:a.left.right.start,end:a.right.left.end})}),right:a.right.right}))),a.right instanceof bb&&a.right.operator==a.operator&&("&&"==a.operator||"||"==a.operator)?(a.left=b(bb,a.left,{operator:a.operator,left:a.left,right:a.right.left}),a.right=a.right.right,a.transform(c)):a.evaluate(c)[0])}),a(ub,function(a,d){function e(a,b){return b instanceof bb&&"="===b.operator&&b.left===a}if(a.undeclared()&&!e(a,d.parent())){var f=d.option("global_defs");if(f&&y(f,a.name))return c(d,f[a.name],a);if(!a.scope.uses_with||!d.find_parent(ua))switch(a.name){case"undefined":return b(Eb,a);case"NaN":return b(Db,a).transform(d);case"Infinity":return b(Gb,a).transform(d)}}return a}),a(Gb,function(a,c){return b(bb,a,{operator:"/",left:b(zb,a,{value:1}),right:b(zb,a,{value:0})})}),a(Eb,function(a,c){if(c.option("unsafe")){var d=c.find_parent(va),e=d.find_variable("undefined");if(e){var f=b(ub,a,{name:"undefined",scope:d,thedef:e});return f.reference(),f}}return a});var C=["+","-","/","*","%",">>","<<",">>>","|","^","&"],D=["*","|","^","&"];a(db,function(a,b){return a=a.lift_sequences(b),"="==a.operator&&a.left instanceof ub&&a.right instanceof bb&&(a.right.left instanceof ub&&a.right.left.name==a.left.name&&g(a.right.operator,C)?(a.operator=a.right.operator+"=",a.right=a.right.right):a.right.right instanceof ub&&a.right.right.name==a.left.name&&g(a.right.operator,D)&&!a.right.left.has_side_effects(b)&&(a.operator=a.right.operator+"=",a.right=a.right.left)),a}),a(cb,function(a,e){function f(a){return a.is_boolean()?a:b(_a,a,{operator:"!",expression:a.negate(e)})}function g(a){return a instanceof Jb||a instanceof _a&&"!"==a.operator&&a.expression instanceof xb&&!a.expression.value}function h(a){return a instanceof Ib||a instanceof _a&&"!"==a.operator&&a.expression instanceof xb&&!!a.expression.value}if(!e.option("conditionals"))return a;if(a.condition instanceof Wa){var i=a.condition.car;return a.condition=a.condition.cdr,Wa.cons(i,a)}var j=a.condition.evaluate(e);if(j.length>1)return j[1]?(e.warn("Condition always true [{file}:{line},{col}]",a.start),d(e.parent(),a,a.consequent)):(e.warn("Condition always false [{file}:{line},{col}]",a.start),d(e.parent(),a,a.alternative));var k=j[0].negate(e);m(j[0],k)===k&&(a=b(cb,a,{condition:k,consequent:a.alternative,alternative:a.consequent}));var l=a.consequent,n=a.alternative;if(l instanceof db&&n instanceof db&&l.operator==n.operator&&l.left.equivalent_to(n.left)&&!l.left.has_side_effects(e))return b(db,a,{operator:l.operator,left:l.left,right:b(cb,a,{condition:a.condition,consequent:l.right,alternative:n.right})});if(l instanceof Ua&&n.TYPE===l.TYPE&&l.args.length==n.args.length&&!l.expression.has_side_effects(e)&&l.expression.equivalent_to(n.expression)){if(0==l.args.length)return b(Wa,a,{car:a.condition,cdr:l});if(1==l.args.length)return l.args[0]=b(cb,a,{condition:a.condition,consequent:l.args[0],alternative:n.args[0]}),l}if(l instanceof cb&&l.alternative.equivalent_to(n))return b(cb,a,{condition:b(bb,a,{left:a.condition,operator:"&&",right:l.condition}),consequent:l.consequent,alternative:n});if(l.is_constant(e)&&n.is_constant(e)&&l.equivalent_to(n)){var o=l.constant_value(e);return a.condition.has_side_effects(e)?Wa.from_array([a.condition,c(e,o,a)]):c(e,o,a)}return g(a.consequent)?h(a.alternative)?f(a.condition):b(bb,a,{operator:"||",left:f(a.condition),right:a.alternative}):h(a.consequent)?g(a.alternative)?f(a.condition.negate(e)):b(bb,a,{operator:"&&",left:f(a.condition.negate(e)),right:a.alternative}):g(a.alternative)?b(bb,a,{operator:"||",left:f(a.condition.negate(e)),right:a.consequent}):h(a.alternative)?b(bb,a,{operator:"&&",left:f(a.condition),right:a.consequent}):a}),a(Hb,function(a,c){if(c.option("booleans")){var d=c.parent();return d instanceof bb&&("=="==d.operator||"!="==d.operator)?(c.warn("Non-strict equality against boolean: {operator} {value} [{file}:{line},{col}]",{operator:d.operator,value:a.value,file:d.start.file,line:d.start.line,col:d.start.col}),b(zb,a,{value:+a.value})):b(_a,a,{operator:"!",expression:b(zb,a,{value:1-a.value})})}return a}),a(Za,function(a,c){var d=a.property;if(d instanceof yb&&c.option("properties")){if(d=d.getValue(),Mb(d)?c.option("screw_ie8"):L(d))return b(Ya,a,{expression:a.expression,property:d}).optimize(c);var e=parseFloat(d);isNaN(e)||e.toString()!=d||(a.property=b(zb,a.property,{value:e}))}return a}),a(Ya,function(a,c){var d=a.property;return Mb(d)&&!c.option("screw_ie8")?b(Za,a,{expression:a.expression,property:b(yb,a,{value:d})}).optimize(c):a.evaluate(c)[0]}),a(eb,z),a(fb,z),a(Ab,z),a(Da,function(a,b){return a.value instanceof Eb&&(a.value=null),a})}(),function(){function a(a){if("Literal"==a.type)return null!=a.raw?a.raw:a.value+""}function b(b){var c=b.loc,d=c&&c.start,e=b.range;return new da({file:c&&c.source,line:d&&d.line,col:d&&d.column,pos:e?e[0]:b.start,endline:d&&d.line,endcol:d&&d.column,endpos:e?e[0]:b.start,raw:a(b)})}function d(b){var c=b.loc,d=c&&c.end,e=b.range;return new da({file:c&&c.source,line:d&&d.line,col:d&&d.column,pos:e?e[1]:b.end,endline:d&&d.line,endcol:d&&d.column,endpos:e?e[1]:b.end,raw:a(b)})}function e(a,e,g){var k="function From_Moz_"+a+"(M){\n";k+="return new U2."+e.name+"({\nstart: my_start_token(M),\nend: my_end_token(M)";var m="function To_Moz_"+a+"(M){\n";m+="return {\ntype: "+JSON.stringify(a),g&&g.split(/\s*,\s*/).forEach(function(a){var b=/([a-z0-9$_]+)(=|@|>|%)([a-z0-9$_]+)/i.exec(a);if(!b)throw new Error("Can't understand property map: "+a);var c=b[1],d=b[2],e=b[3];switch(k+=",\n"+e+": ",m+=",\n"+c+": ",d){case"@":k+="M."+c+".map(from_moz)",m+="M."+e+".map(to_moz)";break;case">":k+="from_moz(M."+c+")",m+="to_moz(M."+e+")";break;case"=":k+="M."+c,m+="M."+e;break;case"%":k+="from_moz(M."+c+").body",m+="to_moz_block(M)";break;default:throw new Error("Can't understand operator in propmap: "+a)}}),k+="\n})\n}",m+="\n}\n}",k=new Function("U2","my_start_token","my_end_token","from_moz","return("+k+")")(c,b,d,f),m=new Function("to_moz","to_moz_block","return("+m+")")(i,j),l[a]=k,h(e,m)}function f(a){m.push(a);var b=null!=a?l[a.type](a):null;return m.pop(),b}function g(a,b,c){var d=a.start,e=a.end;return null!=d.pos&&null!=e.endpos&&(b.range=[d.pos,e.endpos]),d.line&&(b.loc={start:{line:d.line,column:d.col},end:e.endline?{line:e.endline,column:e.endcol}:null},d.file&&(b.loc.source=d.file)),b}function h(a,b){a.DEFMETHOD("to_mozilla_ast",function(){return g(this,b(this))})}function i(a){return null!=a?a.to_mozilla_ast():null}function j(a){return{type:"BlockStatement",body:a.body.map(i)}}var k=function(a){for(var b=!0,c=0;c1||a.guardedHandlers&&a.guardedHandlers.length)throw new Error("Multiple catch clauses are not supported.");return new Na({start:b(a),end:d(a),body:f(a.block).body,bcatch:f(c[0]),bfinally:a.finalizer?new Pa(f(a.finalizer)):null})},Property:function(a){var c=a.key,e="Identifier"==c.type?c.name:c.value,g={start:b(c),end:d(a.value),key:e,value:f(a.value)};switch(a.kind){case"init":return new hb(g);case"set":return g.value.name=f(c),new ib(g);case"get":return g.value.name=f(c),new jb(g)}},ArrayExpression:function(a){return new eb({start:b(a),end:d(a),elements:a.elements.map(function(a){return null===a?new Fb:f(a)})})},ObjectExpression:function(a){return new fb({start:b(a),end:d(a),properties:a.properties.map(function(a){return a.type="Property",f(a)})})},SequenceExpression:function(a){return Wa.from_array(a.expressions.map(f))},MemberExpression:function(a){return new(a.computed?Za:Ya)({start:b(a),end:d(a),property:a.computed?f(a.property):a.property.name,expression:f(a.object)})},SwitchCase:function(a){return new(a.test?Ma:La)({start:b(a),end:d(a),expression:f(a.test),body:a.consequent.map(f)})},VariableDeclaration:function(a){return new("const"===a.kind?Sa:Ra)({start:b(a),end:d(a),definitions:a.declarations.map(f)})},Literal:function(a){var c=a.value,e={start:b(a),end:d(a)};if(null===c)return new Cb(e);switch(typeof c){case"string":return e.value=c,new yb(e);case"number":return e.value=c,new zb(e);case"boolean":return new(c?Jb:Ib)(e);default:var f=a.regex;return f&&f.pattern?e.value=new RegExp(f.pattern,f.flags).toString():e.value=a.regex&&a.raw?a.raw:c,new Ab(e)}},Identifier:function(a){var c=m[m.length-2];return new("LabeledStatement"==c.type?tb:"VariableDeclarator"==c.type&&c.id===a?"const"==c.kind?ob:nb:"FunctionExpression"==c.type?c.id===a?rb:pb:"FunctionDeclaration"==c.type?c.id===a?qb:pb:"CatchClause"==c.type?sb:"BreakStatement"==c.type||"ContinueStatement"==c.type?vb:ub)({start:b(a),end:d(a),name:a.name})}};l.UpdateExpression=l.UnaryExpression=function(a){var c="prefix"in a?a.prefix:"UnaryExpression"==a.type;return new(c?_a:ab)({start:b(a),end:d(a),operator:a.operator,expression:f(a.argument)})},e("EmptyStatement",la),e("BlockStatement",ka,"body@body"),e("IfStatement",Ia,"test>condition, consequent>body, alternate>alternative"),e("LabeledStatement",na,"label>label, body>body"),e("BreakStatement",Ga,"label>label"),e("ContinueStatement",Ha,"label>label"),e("WithStatement",ua,"object>expression, body>body"),e("SwitchStatement",Ja,"discriminant>expression, cases@body"),e("ReturnStatement",Da,"argument>value"),e("ThrowStatement",Ea,"argument>value"),e("WhileStatement",ra,"test>condition, body>body"),e("DoWhileStatement",qa,"test>condition, body>body"),e("ForStatement",sa,"init>init, test>condition, update>step, body>body"),e("ForInStatement",ta,"left>init, right>object, body>body"),e("DebuggerStatement",ga),e("VariableDeclarator",Ta,"id>name, init>value"),e("CatchClause",Oa,"param>argname, body%body"),e("ThisExpression",wb),e("BinaryExpression",bb,"operator=operator, left>left, right>right"),e("LogicalExpression",bb,"operator=operator, left>left, right>right"),e("AssignmentExpression",db,"operator=operator, left>left, right>right"),e("ConditionalExpression",cb,"test>condition, consequent>consequent, alternate>alternative"),e("NewExpression",Va,"callee>expression, arguments@args"),e("CallExpression",Ua,"callee>expression, arguments@args"),h(wa,function(a){return{type:"Program",body:a.body.map(i)}}),h(Aa,function(a){return{type:"FunctionDeclaration",id:i(a.name),params:a.argnames.map(i),body:j(a)}}),h(za,function(a){return{type:"FunctionExpression",id:i(a.name),params:a.argnames.map(i),body:j(a)}}),h(ha,function(a){return{type:"ExpressionStatement",expression:{type:"Literal",value:a.value}}}),h(ia,function(a){return{type:"ExpressionStatement",expression:i(a.body)}}),h(Ka,function(a){return{type:"SwitchCase",test:i(a.expression),consequent:a.body.map(i)}}),h(Na,function(a){return{type:"TryStatement",block:j(a),handler:i(a.bcatch),guardedHandlers:[],finalizer:i(a.bfinally)}}),h(Oa,function(a){return{type:"CatchClause",param:i(a.argname),guard:null,body:j(a)}}),h(Qa,function(a){return{type:"VariableDeclaration",kind:a instanceof Sa?"const":"var",declarations:a.definitions.map(i)}}),h(Wa,function(a){return{type:"SequenceExpression",expressions:a.to_array().map(i)}}),h(Xa,function(a){var b=a instanceof Za;return{type:"MemberExpression",object:i(a.expression),computed:b,property:b?i(a.property):{type:"Identifier",name:a.property}}}),h($a,function(a){return{type:"++"==a.operator||"--"==a.operator?"UpdateExpression":"UnaryExpression",operator:a.operator,prefix:a instanceof _a,argument:i(a.expression)}}),h(bb,function(a){return{type:"&&"==a.operator||"||"==a.operator?"LogicalExpression":"BinaryExpression",left:i(a.left),operator:a.operator,right:i(a.right)}}),h(eb,function(a){return{type:"ArrayExpression",elements:a.elements.map(i)}}),h(fb,function(a){return{type:"ObjectExpression",properties:a.properties.map(i)}}),h(gb,function(a){var b,c=I(a.key)?{type:"Identifier",name:a.key}:{type:"Literal",value:a.key};return a instanceof hb?b="init":a instanceof jb?b="get":a instanceof ib&&(b="set"),{type:"Property",kind:b,key:c,value:i(a.value)}}),h(kb,function(a){var b=a.definition();return{type:"Identifier",name:b?b.mangled_name||b.name:a.name}}),h(Ab,function(a){var b=a.value;return{type:"Literal",value:b,raw:b.toString(),regex:{pattern:b.source,flags:b.toString().match(/[gimuy]*$/)[0]}}}),h(xb,function(a){ +var b=a.value;return"number"==typeof b&&(b<0||0===b&&1/b<0)?{type:"UnaryExpression",operator:"-",prefix:!0,argument:{type:"Literal",value:-b,raw:a.start.raw}}:{type:"Literal",value:b,raw:a.start.raw}}),h(Bb,function(a){return{type:"Identifier",name:String(a.value)}}),Hb.DEFMETHOD("to_mozilla_ast",xb.prototype.to_mozilla_ast),Cb.DEFMETHOD("to_mozilla_ast",xb.prototype.to_mozilla_ast),Fb.DEFMETHOD("to_mozilla_ast",function(){return null}),ja.DEFMETHOD("to_mozilla_ast",ka.prototype.to_mozilla_ast),xa.DEFMETHOD("to_mozilla_ast",za.prototype.to_mozilla_ast);var m=null;ea.from_mozilla_ast=function(a){var b=m;m=[];var c=f(a);return m=b,c}}(),c.Compressor=X,c.DefaultsError=j,c.Dictionary=x,c.JS_Parse_Error=N,c.MAP=ca,c.OutputStream=W,c.SourceMap=Y,c.TreeTransformer=S,c.TreeWalker=B,c.base54=dc,c.defaults=k,c.mangle_properties=$,c.merge=l,c.parse=R,c.push_uniq=p,c.string_template=q,c.tokenizer=Q,c.is_identifier=I,c.SymbolDef=T,"undefined"!=typeof DEBUG&&DEBUG&&(c.EXPECT_DIRECTIVE=ec),c.sys=_,c.MOZ_SourceMap=aa,c.UglifyJS=ba,c.array_to_hash=d,c.slice=e,c.characters=f,c.member=g,c.find_if=h,c.repeat_string=i,c.DefaultsError=j,c.defaults=k,c.merge=l,c.noop=m,c.return_false=n,c.return_true=o,c.MAP=ca,c.push_uniq=p,c.string_template=q,c.remove=r,c.mergeSort=s,c.set_difference=t,c.set_intersection=u,c.makePredicate=v,c.all=w,c.Dictionary=x,c.HOP=y,c.DEFNODE=z,c.AST_Token=da,c.AST_Node=ea,c.AST_Statement=fa,c.AST_Debugger=ga,c.AST_Directive=ha,c.AST_SimpleStatement=ia,c.walk_body=A,c.AST_Block=ja,c.AST_BlockStatement=ka,c.AST_EmptyStatement=la,c.AST_StatementWithBody=ma,c.AST_LabeledStatement=na,c.AST_IterationStatement=oa,c.AST_DWLoop=pa,c.AST_Do=qa,c.AST_While=ra,c.AST_For=sa,c.AST_ForIn=ta,c.AST_With=ua,c.AST_Scope=va,c.AST_Toplevel=wa,c.AST_Lambda=xa,c.AST_Accessor=ya,c.AST_Function=za,c.AST_Defun=Aa,c.AST_Jump=Ba,c.AST_Exit=Ca,c.AST_Return=Da,c.AST_Throw=Ea,c.AST_LoopControl=Fa,c.AST_Break=Ga,c.AST_Continue=Ha,c.AST_If=Ia,c.AST_Switch=Ja,c.AST_SwitchBranch=Ka,c.AST_Default=La,c.AST_Case=Ma,c.AST_Try=Na,c.AST_Catch=Oa,c.AST_Finally=Pa,c.AST_Definitions=Qa,c.AST_Var=Ra,c.AST_Const=Sa,c.AST_VarDef=Ta,c.AST_Call=Ua,c.AST_New=Va,c.AST_Seq=Wa,c.AST_PropAccess=Xa,c.AST_Dot=Ya,c.AST_Sub=Za,c.AST_Unary=$a,c.AST_UnaryPrefix=_a,c.AST_UnaryPostfix=ab,c.AST_Binary=bb,c.AST_Conditional=cb,c.AST_Assign=db,c.AST_Array=eb,c.AST_Object=fb,c.AST_ObjectProperty=gb,c.AST_ObjectKeyVal=hb,c.AST_ObjectSetter=ib,c.AST_ObjectGetter=jb,c.AST_Symbol=kb,c.AST_SymbolAccessor=lb,c.AST_SymbolDeclaration=mb,c.AST_SymbolVar=nb,c.AST_SymbolConst=ob,c.AST_SymbolFunarg=pb,c.AST_SymbolDefun=qb,c.AST_SymbolLambda=rb,c.AST_SymbolCatch=sb,c.AST_Label=tb,c.AST_SymbolRef=ub,c.AST_LabelRef=vb,c.AST_This=wb,c.AST_Constant=xb,c.AST_String=yb,c.AST_Number=zb,c.AST_RegExp=Ab,c.AST_Atom=Bb,c.AST_Null=Cb,c.AST_NaN=Db,c.AST_Undefined=Eb,c.AST_Hole=Fb,c.AST_Infinity=Gb,c.AST_Boolean=Hb,c.AST_False=Ib,c.AST_True=Jb,c.TreeWalker=B,c.KEYWORDS=Kb,c.KEYWORDS_ATOM=Lb,c.RESERVED_WORDS=Mb,c.KEYWORDS_BEFORE_EXPRESSION=Nb,c.OPERATOR_CHARS=Ob,c.RE_HEX_NUMBER=Pb,c.RE_OCT_NUMBER=Qb,c.OPERATORS=Rb,c.WHITESPACE_CHARS=Sb,c.NEWLINE_CHARS=Tb,c.PUNC_BEFORE_EXPRESSION=Ub,c.PUNC_CHARS=Vb,c.REGEXP_MODIFIERS=Wb,c.UNICODE=Xb,c.is_letter=C,c.is_digit=D,c.is_alphanumeric_char=E,c.is_unicode_digit=F,c.is_unicode_combining_mark=G,c.is_unicode_connector_punctuation=H,c.is_identifier=I,c.is_identifier_start=J,c.is_identifier_char=K,c.is_identifier_string=L,c.parse_js_number=M,c.JS_Parse_Error=N,c.js_error=O,c.is_token=P,c.EX_EOF=Yb,c.tokenizer=Q,c.UNARY_PREFIX=Zb,c.UNARY_POSTFIX=$b,c.ASSIGNMENT=_b,c.PRECEDENCE=ac,c.STATEMENTS_WITH_LABELS=bc,c.ATOMIC_START_TOKEN=cc,c.parse=R,c.TreeTransformer=S,c.SymbolDef=T,c.base54=dc,c.EXPECT_DIRECTIVE=ec,c.is_some_comments=U,c.is_comment5=V,c.OutputStream=W,c.Compressor=X,c.SourceMap=Y,c.find_builtins=Z,c.mangle_properties=$,c.AST_Node.warn_function=function(a){"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(a)},c.minify=function(a,c){function d(a,b){var d=c.fromString?a:fs.readFileSync(a,"utf8");f[b]=d,e=ba.parse(d,{filename:b,toplevel:e,bare_returns:c.parse?c.parse.bare_returns:void 0})}c=ba.defaults(c,{spidermonkey:!1,outSourceMap:null,outFileName:null,sourceRoot:null,inSourceMap:null,sourceMapUrl:null,sourceMapInline:!1,fromString:!1,warnings:!1,mangle:{},mangleProperties:!1,nameCache:null,output:null,compress:{},parse:{}}),ba.base54.reset();var e=null,f={};if(c.spidermonkey?e=ba.AST_Node.from_mozilla_ast(a):(c.fromString||(a=ba.simple_glob(a)),[].concat(a).forEach(function(a,b){if("string"==typeof a)d(a,c.fromString?b:a);else for(var e in a)d(a[e],e)})),c.wrap&&(e=e.wrap_commonjs(c.wrap,c.exportAll)),c.compress){var g={warnings:c.warnings};ba.merge(g,c.compress),e.figure_out_scope();var h=ba.Compressor(g);e=h.compress(e)}(c.mangleProperties||c.nameCache)&&(c.mangleProperties.cache=ba.readNameCache(c.nameCache,"props"),e=ba.mangle_properties(e,c.mangleProperties),ba.writeNameCache(c.nameCache,"props",c.mangleProperties.cache)),c.mangle&&(e.figure_out_scope(c.mangle),e.compute_char_frequency(c.mangle),e.mangle_names(c.mangle));var i=c.inSourceMap,j={};if("string"==typeof c.inSourceMap&&(i=JSON.parse(fs.readFileSync(c.inSourceMap,"utf8"))),(c.outSourceMap||c.sourceMapInline)&&(j.source_map=ba.SourceMap({file:c.outFileName||("string"==typeof c.outSourceMap?c.outSourceMap.replace(/\.map$/i,""):null),orig:i,root:c.sourceRoot}),c.sourceMapIncludeSources))for(var k in f)f.hasOwnProperty(k)&&j.source_map.get().setSourceContent(k,f[k]);c.output&&ba.merge(j,c.output);var l=ba.OutputStream(j);e.print(l);var m=j.source_map;m&&(m+="");var n="\n//# sourceMappingURL=";return c.sourceMapInline?l+=n+"data:application/json;charset=utf-8;base64,"+new b(m).toString("base64"):c.outSourceMap&&"string"==typeof c.outSourceMap&&c.sourceMapUrl!==!1&&(l+=n+("string"==typeof c.sourceMapUrl?c.sourceMapUrl:c.outSourceMap)),{code:l+"",map:m}},c.describe_ast=function(){function a(c){b.print("AST_"+c.TYPE);var d=c.SELF_PROPS.filter(function(a){return!/^\$/.test(a)});d.length>0&&(b.space(),b.with_parens(function(){d.forEach(function(a,c){c&&b.space(),b.print(a)})})),c.documentation&&(b.space(),b.print_string(c.documentation)),c.SUBCLASSES.length>0&&(b.space(),b.with_block(function(){c.SUBCLASSES.forEach(function(c,d){b.indent(),a(c),b.newline()})}))}var b=ba.OutputStream({beautify:!0});return a(ba.AST_Node),b+""}}).call(this,a("buffer").Buffer)},{buffer:5,"source-map":151,util:164}],159:[function(a,b,c){"use strict";function d(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function e(a,b,c){if(a&&j.isObject(a)&&a instanceof d)return a;var e=new d;return e.parse(a,b,c),e}function f(a){return j.isString(a)&&(a=e(a)),a instanceof d?a.format():d.prototype.format.call(a)}function g(a,b){return e(a,!1,!0).resolve(b)}function h(a,b){return a?e(a,!1,!0).resolveObject(b):b}var i=a("punycode"),j=a("./util");c.parse=e,c.resolve=g,c.resolveObject=h,c.format=f,c.Url=d;var k=/^([a-z0-9.+-]+:)/i,l=/:[0-9]*$/,m=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,n=["<",">",'"',"`"," ","\r","\n","\t"],o=["{","}","|","\\","^","`"].concat(n),p=["'"].concat(o),q=["%","/","?",";","#"].concat(p),r=["/","?","#"],s=255,t=/^[+a-z0-9A-Z_-]{0,63}$/,u=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},x={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=a("querystring");d.prototype.parse=function(a,b,c){if(!j.isString(a))throw new TypeError("Parameter 'url' must be a string, not "+typeof a);var d=a.indexOf("?"),e=d!==-1&&d127?"x":I[K];if(!J.match(t)){var M=G.slice(0,B),N=G.slice(B+1),O=I.match(u);O&&(M.push(O[1]),N.unshift(O[2])),N.length&&(h="/"+N.join(".")+h),this.hostname=M.join(".");break}}}this.hostname.length>s?this.hostname="":this.hostname=this.hostname.toLowerCase(),F||(this.hostname=i.toASCII(this.hostname));var P=this.port?":"+this.port:"",Q=this.hostname||"";this.host=Q+P,this.href+=this.host,F&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==h[0]&&(h="/"+h))}if(!v[o])for(var B=0,H=p.length;B0)&&c.host.split("@");z&&(c.auth=z.shift(),c.host=c.hostname=z.shift())}return c.search=a.search,c.query=a.query,j.isNull(c.pathname)&&j.isNull(c.search)||(c.path=(c.pathname?c.pathname:"")+(c.search?c.search:"")),c.href=c.format(),c}if(!v.length)return c.pathname=null,c.search?c.path="/"+c.search:c.path=null,c.href=c.format(),c;for(var A=v.slice(-1)[0],B=(c.host||a.host||v.length>1)&&("."===A||".."===A)||""===A,C=0,D=v.length;D>=0;D--)A=v[D],"."===A?v.splice(D,1):".."===A?(v.splice(D,1),C++):C&&(v.splice(D,1),C--);if(!t&&!u)for(;C--;C)v.unshift("..");!t||""===v[0]||v[0]&&"/"===v[0].charAt(0)||v.unshift(""),B&&"/"!==v.join("/").substr(-1)&&v.push("");var E=""===v[0]||v[0]&&"/"===v[0].charAt(0);if(y){c.hostname=c.host=E?"":v.length?v.shift():"";var z=!!(c.host&&c.host.indexOf("@")>0)&&c.host.split("@");z&&(c.auth=z.shift(),c.host=c.hostname=z.shift())}return t=t||c.host&&v.length,t&&!E&&v.unshift(""),v.length?c.pathname=v.join("/"):(c.pathname=null,c.path=null),j.isNull(c.pathname)&&j.isNull(c.search)||(c.path=(c.pathname?c.pathname:"")+(c.search?c.search:"")),c.auth=a.auth||c.auth,c.slashes=c.slashes||a.slashes,c.href=c.format(),c},d.prototype.parseHost=function(){var a=this.host,b=l.exec(a);b&&(b=b[0],":"!==b&&(this.port=b.substr(1)),a=a.substr(0,a.length-b.length)),a&&(this.hostname=a)}},{"./util":160,punycode:113,querystring:116}],160:[function(a,b,c){"use strict";b.exports={isString:function(a){return"string"==typeof a},isObject:function(a){return"object"==typeof a&&null!==a},isNull:function(a){return null===a},isNullOrUndefined:function(a){return null==a}}},{}],161:[function(a,b,c){(function(a){function c(a,b){function c(){if(!e){if(d("throwDeprecation"))throw new Error(b);d("traceDeprecation")?console.trace(b):console.warn(b),e=!0}return a.apply(this,arguments)}if(d("noDeprecation"))return a;var e=!1;return c}function d(b){try{if(!a.localStorage)return!1}catch(a){return!1}var c=a.localStorage[b];return null!=c&&"true"===String(c).toLowerCase()}b.exports=c}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],162:[function(a,b,c){arguments[4][105][0].apply(c,arguments)},{dup:105}],163:[function(a,b,c){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],164:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a,b){return a}function h(a){var b={};return a.forEach(function(a,c){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(d<0)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;g-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return a<10?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(a){return"[Circular]"}default:return a}}),h=d[c];c=0;d--)c[d]="(?:("+a.customAttrSurround[d][0].source+")\\s*"+b+"\\s*("+a.customAttrSurround[d][1].source+"))";c.push("(?:"+b+")"),b="(?:"+c.join("|")+")"}return new RegExp("^\\s*"+b)}function f(a){return k.concat(a.customAttrAssign||[]).map(function(a){return"(?:"+a.source+")"}).join("|")}function g(a,b){function c(a){var b=a.match(n);if(b){var c={tagName:b[1],attrs:[]};a=a.slice(b[0].length);for(var d,e;!(d=a.match(o))&&(e=a.match(l));)a=a.slice(e[0].length),c.attrs.push(e);if(d)return c.unarySlash=d[1],c.rest=a.slice(d[0].length),c}}function d(a){var c=a.tagName,d=a.unarySlash;if(b.html5&&"p"===g&&x(c)&&f("",g),!b.html5)for(;g&&t(g);)f("",g);u(c)&&g===c&&f("",c);var e=s(c)||"html"===c&&"head"===g||!!d,h=a.attrs.map(function(a){function c(b){return h=a[b],e=a[b+1],"undefined"!=typeof e?'"':(e=a[b+2],"undefined"!=typeof e?"'":(e=a[b+3],"undefined"==typeof e&&v(d)&&(e=d),""))}var d,e,f,g,h,i,j=7;r&&a[0].indexOf('""')===-1&&(""===a[3]&&delete a[3],""===a[4]&&delete a[4],""===a[5]&&delete a[5]);var k=1;if(b.customAttrSurround)for(var l=0,m=b.customAttrSurround.length;l=0&&k[d].tag.toLowerCase()!==e;d--);}else d=0;if(d>=0){for(var f=k.length-1;f>=d;f--)b.end&&b.end(k[f].tag,k[f].attrs,f>d||!a);k.length=d,g=d&&k[d-1].tag}else"br"===c.toLowerCase()?b.start&&b.start(c,[],!0,""):"p"===c.toLowerCase()&&(b.start&&b.start(c,[],!1,"",!0),b.end&&b.end(c,[]))}for(var g,h,i,j,k=[],l=e(b);a;){if(h=a,g&&w(g)){var m=g.toLowerCase(),z=y[m]||(y[m]=new RegExp("([\\s\\S]*?)]*>","i"));a=a.replace(z,function(a,c){return"script"!==m&&"style"!==m&&"noscript"!==m&&(c=c.replace(//g,"$1").replace(//g,"$1")),b.chars&&b.chars(c),""}),f("",m)}else{var A=a.indexOf("<");if(0===A){if(/^");if(B>=0){b.comment&&b.comment(a.substring(4,B)),a=a.substring(B+3),i="";continue}}if(/^");if(C>=0){b.comment&&b.comment(a.substring(2,C+1),!0),a=a.substring(C+2),i="";continue}}var D=a.match(q);if(D){b.doctype&&b.doctype(D[0]),a=a.substring(D[0].length),i="";continue}var E=a.match(p);if(E){a=a.substring(E[0].length),E[0].replace(p,f),i="/"+E[1].toLowerCase();continue}var F=c(a);if(F){a=F.rest,d(F),i=F.tagName.toLowerCase();continue}}var G;A>=0?(G=a.substring(0,A),a=a.substring(A)):(G=a,a="");var H=c(a);H?j=H.tagName:(H=a.match(p),j=H?"/"+H[1]:""),b.chars&&b.chars(G,i,j),i=""}if(a===h)throw new Error("Parse Error: "+a)}b.partialMarkup||f()}var h=a("./utils").createMapFromString,i=/([^\s"'<>\/=]+)/,j=/=/,k=[j],l=[/"([^"]*)"+/.source,/'([^']*)'+/.source,/([^\s"'=<>`]+)/.source],m=function(){var b=a("ncname").source.slice(1,-1);return"((?:"+b+"\\:)?"+b+")"}(),n=new RegExp("^<"+m),o=/^\s*(\/?)>/,p=new RegExp("^<\\/"+m+"[^>]*>"),q=/^]+>/i,r=!1;"x".replace(/x(.)?/g,function(a,b){r=""===b});var s=d("area,base,basefont,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),t=d("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,noscript,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,svg,textarea,tt,u,var"),u=d("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),v=d("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),w=d("script,style"),x=d("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),y={};c.HTMLParser=g,c.HTMLtoXML=function(a){var b="";return new g(a,{start:function(a,c,d){b+="<"+a;for(var e=0,f=c.length;e"},end:function(a){b+=""},chars:function(a){b+=a},comment:function(a){b+=""},ignore:function(a){b+=a}}),b},c.HTMLtoDOM=function(a,b){var c={html:!0,head:!0,body:!0,title:!0},d={link:"head",base:"head"};b?b=b.ownerDocument||b.getOwnerDocument&&b.getOwnerDocument()||b:"undefined"!=typeof DOMDocument?b=new DOMDocument:"undefined"!=typeof document&&document.implementation&&document.implementation.createDocument?b=document.implementation.createDocument("","",null):"undefined"!=typeof ActiveX&&(b=new ActiveXObject("Msxml.DOMDocument")); +var e=[],f=b.documentElement||b.getDocumentElement&&b.getDocumentElement();if(!f&&b.createElement&&!function(){var a=b.createElement("html"),c=b.createElement("head");c.appendChild(b.createElement("title")),a.appendChild(c),a.appendChild(b.createElement("body")),b.appendChild(a)}(),b.getElementsByTagName)for(var h in c)c[h]=b.getElementsByTagName(h)[0];var i=c.body;return new g(a,{start:function(a,f,g){if(c[a])return void(i=c[a]);var h=b.createElement(a);for(var j in f)h.setAttribute(f[j].name,f[j].value);d[a]&&"boolean"!=typeof c[d[a]]?c[d[a]].appendChild(h):i&&i.appendChild&&i.appendChild(h),g||(e.push(h),i=h)},end:function(){e.length-=1,i=e[e.length-1]},chars:function(a){i.appendChild(b.createTextNode(a))},comment:function(){},ignore:function(){}}),b}},{"./utils":169,ncname:108}],168:[function(a,b,c){"use strict";function d(){}function e(){}d.prototype.sort=function(a,b){b=b||0;for(var c=0,d=this.tokens.length;ce?-1:bc?1:0}).filter(function(c){if(a[c].processed]+$/.test(a)}function l(a,b){for(var c=a.length;c--;)if(a[c].name.toLowerCase()===b)return!0;return!1}function m(a,b,c,d){return c=c?aa(c.toLowerCase()):"","script"===a&&"language"===b&&"javascript"===c||"form"===a&&"method"===b&&"get"===c||"input"===a&&"type"===b&&"text"===c||"script"===a&&"charset"===b&&!l(d,"src")||"a"===a&&"name"===b&&l(d,"id")||"area"===a&&"shape"===b&&"rect"===c}function n(a){return a=aa(a.split(/;/,2)[0]).toLowerCase(),""===a||fa(a)}function o(a,b){if("script"!==a)return!1;for(var c=0,d=b.length;c)([\s\S]*?)(-1)return T(a,b);return a}function F(a,b){switch(a){case"html":case"head":return!0;case"body":return!la(b);case"colgroup":return"col"===b;case"tbody":return"tr"===b}return!1}function G(a,b){switch(b){case"colgroup":return"colgroup"===a;case"tbody":return ta(a)}return!1}function H(a,b){switch(a){case"html":case"head":case"body":case"colgroup":case"caption":return!0;case"li":case"optgroup":case"tr":return b===a;case"dt":case"dd":return ma(b);case"p":return na(b);case"rb":case"rt":case"rp":return pa(b);case"rtc":return qa(b);case"option":return ra(b);case"thead":case"tbody":return sa(b);case"tfoot":return"tbody"===b;case"td":case"th":return ua(b)}return!1}function I(a,b,c,d){var e=!c||/^\s*$/.test(c);return!!e&&("function"==typeof d.removeEmptyAttributes?d.removeEmptyAttributes(b,a):"input"===a&&"value"===b||Aa.test(b))}function J(a,b){for(var c=b.length-1;c>=0;c--)if(b[c].name===a)return!0;return!1}function K(a,b){switch(a){case"textarea":return!1;case"audio":case"script":case"video":if(J("src",b))return!1;break;case"iframe":if(J("src",b)||J("srcdoc",b))return!1;break;case"object":if(J("data",b))return!1;break;case"applet":if(J("code",b))return!1}return!0}function L(a){return!/^(?:script|style|pre|textarea)$/.test(a)}function M(a){return!/^(?:pre|textarea)$/.test(a)}function N(a,b,c,d){var e=d.caseSensitive?a.name:a.name.toLowerCase(),f=a.value;if(d.decodeEntities&&f&&(f=W(f,{isAttributeValue:!0})),!(d.removeRedundantAttributes&&m(c,e,f,b)||d.removeScriptTypeAttributes&&"script"===c&&"type"===e&&n(f)||d.removeStyleLinkTypeAttributes&&("style"===c||"link"===c)&&"type"===e&&p(f)||(f=x(c,e,f,d,b),d.removeEmptyAttributes&&I(c,e,f,d))))return d.decodeEntities&&f&&(f=f.replace(/&(#?[0-9a-zA-Z]+;)/g,"&$1")),{attr:a,name:e,value:f}}function O(a,b,c,d,e){var f,g,h=a.name,i=a.value,j=a.attr,l=j.quote;if("undefined"==typeof i||c.removeAttributeQuotes&&!~i.indexOf(e)&&k(i))g=!d||b||/\/$/.test(i)?i+" ":i;else{if(!c.preventAttributesEscaping){if("undefined"==typeof c.quoteCharacter){var m=(i.match(/'/g)||[]).length,n=(i.match(/"/g)||[]).length;l=m/,/<\?[\s\S]*?\?>/]),a.minifyURLs||(a.minifyURLs=P),"function"!=typeof a.minifyURLs){var e=a.minifyURLs;"string"==typeof e?e={site:e}:"object"!=typeof e&&(e={}),a.minifyURLs=function(b){try{return Y.relate(b,e)}catch(c){return a.log(c),b}}}if(a.minifyJS||(a.minifyJS=P),"function"!=typeof a.minifyJS){var f=a.minifyJS;"object"!=typeof f&&(f={}),f.fromString=!0,(f.output||(f.output={})).inline_script=!0,a.minifyJS=function(b,c){var d=b.match(/^\s*\s*$/,""):b;try{return c&&(e=Ba+e+Ca),e=$.minify(e,f).code,c&&(e=e.slice(Ba.length,-Ca.length)),/;$/.test(e)&&(e=e.slice(0,-1)),e}catch(c){return a.log(c),b}}}if(a.minifyCSS||(a.minifyCSS=P),"function"!=typeof a.minifyCSS){var g=a.minifyCSS;"object"!=typeof g&&(g={}),a.minifyCSS=function(b){b=b.replace(/(url\s*\(\s*)("|'|)(.*?)\2(\s*\))/gi,function(b,c,d,e,f){return c+d+a.minifyURLs(e)+d+f});try{return new V(g).minify(b).styles}catch(c){return a.log(c),b}}}}function R(a){var b;do b=Math.random().toString(36).replace(/^0\.[0-9]*/,"");while(~a.indexOf(b));return b}function S(a,b,c,d){function e(a){return a.map(function(a){return b.caseSensitive?a.name:a.name.toLowerCase()})}function f(a,b){return!b||a.indexOf(b)===-1}function g(a){return f(a,c)&&f(a,d)}function h(a){var c,d;new X(a,{start:function(a,f){i&&(i[a]||(i[a]=new Z),i[a].add(e(f).filter(g)));for(var h=0,k=f.length;h-1&&h(a)}})}var i=b.sortAttributes&&Object.create(null),j=b.sortClassName&&new Z,k=b.log;if(b.log=null,b.sortAttributes=!1,b.sortClassName=!1,h(T(a,b)),b.log=k,i){var l=Object.create(null);for(var m in i)l[m]=i[m].createSorter();b.sortAttributes=function(a,b){var c=l[a];if(c){var d=Object.create(null),f=e(b);f.forEach(function(a,c){(d[a]||(d[a]=[])).push(b[c])}),c.sort(f).forEach(function(a,c){b[c]=d[a].shift()})}}}if(j){var n=j.createSorter();b.sortClassName=function(a){return n.sort(a.split(/\s+/)).join(" ")}}}function T(a,b,c){function d(a){return a.replace(w,function(a,b,c){var d=V[+c];return d[1]+v+c+d[2]})}function j(a,c){return L(a)||b.canCollapseWhitespace(a,c)}function k(a,c){return M(a)||b.canTrimWhitespace(a,c)}function l(){for(var a=x.length-1;a>0&&!/^<[^\/!]/.test(x[a]);)a--;x.length=Math.max(0,a)}function m(){for(var a=x.length-1;a>0&&!/^<\//.test(x[a]);)a--;x.length=Math.max(0,a)}function n(a,c){for(var d=null;a>=0&&k(d);a--){var e=x[a],f=e.match(/^<\/([\w:-]+)>$/);if(f)d=f[1];else if(/>$/.test(e)||(x[a]=g(e,null,c,b)))break}}function p(a){var b=x.length-1;if(x.length>1){var c=x[x.length-1];/^(?:([\s\S]*?)/g,function(c,d){if(!u){u=R(a);var e=new RegExp("^"+u+"([0-9]+)$");b.ignoreCustomComments?b.ignoreCustomComments.push(e):b.ignoreCustomComments=[e]}var f="";return T.push(d),f});var Y=b.ignoreCustomFragments.map(function(a){return a.source});if(Y.length){var Z=new RegExp("\\s*(?:"+Y.join("|")+")+\\s*","g");a=a.replace(Z,function(c){if(!v){v=R(a),w=new RegExp("(\\s*)"+v+"([0-9]+)(\\s*)","g");var e=b.minifyCSS;e&&(b.minifyCSS=function(a){return e(d(a))});var f=b.minifyJS;f&&(b.minifyJS=function(a,b){return f(d(a),b)})}var g=v+V.length;return V.push(/^(\s*)[\s\S]*?(\s*)$/.exec(c)),"\t"+g+"\t"})}(b.sortAttributes&&"function"!=typeof b.sortAttributes||b.sortClassName&&"function"!=typeof b.sortClassName)&&S(a,b,u,v),new X(a,{partialMarkup:c,html5:b.html5,start:function(a,c,d,e,f){var g=a.toLowerCase();if("svg"===g){r.push(b);var h={};for(var i in b)h[i]=b[i];h.keepClosingSlash=!0,h.caseSensitive=!0,b=h}a=b.caseSensitive?a:g,z=a,s=a,da(a)||(y=""),t=!1,A=c;var n=b.removeOptionalTags;if(n){var o=za(a);o&&F(I,a)&&l(),I="",o&&H(J,a)&&(m(),n=!G(J,a)),J=""}b.collapseWhitespace&&(B.length||p(a),k(a,c)||B.push(a),j(a,c)||C.push(a));var q="<"+a,u=e&&b.keepClosingSlash;x.push(q),b.sortAttributes&&b.sortAttributes(a,c);for(var w=[],D=c.length,E=!0;--D>=0;){var K=N(c[D],c,a,b);K&&(w.unshift(O(K,u,b,E,v)),E=!1)}w.length>0?(x.push(" "),x.push.apply(x,w)):n&&ja(a)&&(I=a),x.push(x.pop()+(u?"/":"")+">"),f&&!b.includeAutoGeneratedTags&&(l(),I="")},end:function(a,c,d){var e=a.toLowerCase();"svg"===e&&(b=r.pop()),a=b.caseSensitive?a:e,b.collapseWhitespace&&(B.length?a===B[B.length-1]&&B.pop():p("/"+a),C.length&&a===C[C.length-1]&&C.pop());var f=!1;a===z&&(z="",f=!t),b.removeOptionalTags&&(f&&va(I)&&l(),I="",!za(a)||!J||ya(J)||"p"===J&&oa(a)||m(),J=ka(a)?a:""),b.removeEmptyElements&&f&&K(a,c)?(l(),I="",J=""):(d&&!b.includeAutoGeneratedTags?J="":x.push(""),s="/"+a,ca(a)?f&&(y+="|"):y="")},chars:function(a,c,d){if(c=""===c?"comment":c,d=""===d?"comment":d,b.decodeEntities&&a&&!Da(z)&&(a=W(a)),b.collapseWhitespace){if(!B.length){if("comment"===c){var e=x[x.length-1];if(e.indexOf(u)===-1&&(e||(c=s),x.length>1&&(!e||!b.conservativeCollapse&&/ $/.test(y)))){var h=x.length-2;x[h]=x[h].replace(/\s+$/,function(b){return a=b+a,""})}}if(c)if("/nobr"===c||"wbr"===c){if(/^\s/.test(a)){for(var i=x.length-1;i>0&&0!==x[i].lastIndexOf("<"+c);)i--;n(i-1,"br")}}else da("/"===c.charAt(0)?c.slice(1):c)&&(a=f(a,b,/(?:^|\s)$/.test(y)));a=c||d?g(a,c,d,b):f(a,b,!0,!0),!a&&/\s$/.test(y)&&c&&"/"===c.charAt(0)&&n(x.length-1,d)}C.length||"html"===d||c&&d||(a=f(a,b,!1,!1,!0))}b.processScripts&&Da(z)&&(a=E(a,b,A)),o(z,A)&&(a=b.minifyJS(a)),q(z,A)&&(a=b.minifyCSS(a)),b.removeOptionalTags&&a&&(("html"===I||"body"===I&&!/^\s/.test(a))&&l(),I="",(wa(J)||xa(J)&&!/^\s/.test(a))&&m(),J=""),s=/^\s*$/.test(a)?c:"comment",b.decodeEntities&&a&&!Da(z)&&(a=a.replace(/&(#?[0-9a-zA-Z]+;)/g,"&$1").replace(/":"-->";a=h(a)?d+D(a,b)+e:b.removeComments?i(a,b)?"":"":d+a+e,b.removeOptionalTags&&a&&(I="",J=""),x.push(a)},doctype:function(a){x.push(b.useShortDoctype?"":e(a))},customAttrAssign:b.customAttrAssign,customAttrSurround:b.customAttrSurround}),b.removeOptionalTags&&(va(I)&&l(),J&&!ya(J)&&m()),b.collapseWhitespace&&p("br");var $=U(x,b);return w&&($=$.replace(w,function(a,c,d,e){var g=V[+d][0];return b.collapseWhitespace?("\t"!==c&&(g=c+g),"\t"!==e&&(g+=e),f(g,{preserveLineBreaks:b.preserveLineBreaks,conservativeCollapse:!b.trimCustomFragments},/^\s/.test(g),/\s$/.test(g))):g})),u&&($=$.replace(new RegExp("","g"),function(a,b){return T[+b]})),b.log("minified in: "+(Date.now()-P)+"ms"),$}function U(a,b){var c,d=b.maxLineLength;if(d){for(var e,g=[],h="",i=0,j=a.length;i
              -

              HTML Minifier (v3.2.3)

              +

              HTML Minifier (v3.3.0)

              diff --git a/package.json b/package.json index 55a229e..e52825a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "html-minifier", "description": "Highly configurable, well-tested, JavaScript-based HTML minifier.", - "version": "3.2.3", + "version": "3.3.0", "keywords": [ "cli", "compress", diff --git a/tests/index.html b/tests/index.html index b200e3f..f577aed 100644 --- a/tests/index.html +++ b/tests/index.html @@ -3,12 +3,12 @@ HTML Minifier Tests - +
              - + -- 2.34.1