Walks the @lazysprite atrule and get the value to extract the target images.
@param  {Node}   css
@param  {Object} options
@return {Promise}
335126
function extractImages(css, options) {
	var images = [];
	var stylesheetRelative = options.stylesheetRelative || path.dirname(css.source.input.file);

	if (!stylesheetRelative) {
		log(options.logLevel, 'lv1', ['Lazysprite:', colors.red('option `stylesheetRelative` is undefined!')]);
	}

	// When the css file is in the second or more depth level directory of destination
	// which relative to `stylesheetRelative`,
	// ref path in css will wrong, so has to be fix it.
	if (css.source.input.file) {
		var stylesheetInputDirRelative = path.relative(options.stylesheetInput, path.dirname(css.source.input.file));
		stylesheetRelative = path.join(stylesheetRelative, stylesheetInputDirRelative);
	}

	// Find @lazysprite string from css
	css.walkAtRules('lazysprite', function (atRule) {
		// Get the directory of images from atRule value
		var params = space(atRule.params);
		var atRuleValue = getAtRuleValue(params);
		var sliceDir = atRuleValue[0];

		// Get absolute path of directory.
		var imageDir = path.resolve(options.imagePath, sliceDir);

		// Check whether dir exist.
		if (!fs.existsSync(imageDir)) {
			log(options.logLevel, 'lv1', ['Lazysprite:', colors.red('No exist "' + imageDir + '"')]);
			return null;
		}

		// Get indent format of the css content.
		var atRuleNext = atRule.parent.nodes;
		var rawNode = _.find(atRuleNext, function (node) {
			return node.type === 'rule';
		});

		// Store the indent format.
		if (rawNode === undefined) {
			options.cloneRaws.between = '';
			options.cloneRaws.after = '';
		} else {
			options.cloneRaws.between = rawNode.raws.between;
			options.cloneRaws.after = rawNode.raws.after;
		}

		// Foreach the images and set image object.
		var files = fs.readdirSync(imageDir);
		files = _.orderBy(files); // Fix orders issue in mac and win's difference.
		_.forEach(files, function (filename) {
			// Have to be png or svg file
			var reg = /\.(png|svg)\b/i;
			if (!reg.test(filename)) {
				return null;
			}

			var image = {
				path: null, // Absolute path
				name: null, // Filename
				stylesheetRelative: stylesheetRelative,
				ratio: 1,
				groups: [],
				isSVG: false,
				token: ''
			};

			image.name = filename;

			// Set the directory name as sprite file name,
			// .pop() to get the last element in array
			image.dir = imageDir.split(path.sep).pop();
			image.groups = [image.dir];

			// For svg file
			if (/^\.svg/.test(path.extname(filename))) {
				image.isSVG = true;
				image.groups.push('GROUP_SVG_FLAG');
			}

			image.selector = setSelector(image, options, atRuleValue[1]);

			// Get absolute path of image
			image.path = path.resolve(imageDir, filename);

			// For retina
			if (isRetinaImage(image.name)) {
				image.ratio = getRetinaRatio(image.name);
				image.selector = setSelector(image, options, atRuleValue[1], true);
			}

			// Push image obj to array.
			images.push(image);
		});
	});
	return Promise.resolve([images, options]);
}
446878
function lazyLoadImages() {
  var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

  // If we have `srcset` support, initialize the lazyloader.
  /* istanbul ignore else: unreasonable to test browser support just for a no-op */
  if ('srcset' in document.createElement('img')) {
    return initialize(config);
  }

  // If there’s no support, return a no-op.
  /* istanbul ignore next: unreasonable to test browser support just for a no-op */
  return function () {
    /* no-op */
  };
}
497875
function(filename, options) {
    var input = readFile(filename),
        result = CSSLint.verify(input, gatherRules(options)),
        formatId = options.format || "text",
        messages = result.messages || [],
        exitCode = 0;

    if (!input) {
        print("csslint: Could not read file data in " + filename + ". Is the file empty?");
        exitCode = 1;
    } else {
        print(CSSLint.getFormatter(formatId).formatResults(result, filename, formatId));

        if (messages.length > 0 && pluckByType(messages, 'error').length > 0) {
            exitCode = 1;
        }
    }
    
    return exitCode;
}
929548
function parseStyles(s) {
  var parser = new parserlib.css.Parser();
  var result = { property: Object.create(null), priority: Object.create(null) };
  parser.addListener("property", function(e) {
    if (e.invalid) return; // Skip errors
    result.property[e.property.text] = e.value.text;
    if (e.important) result.priority[e.property.text] = 'important';
  });
  s = (''+s).replace(/^;/, '');
  parser.parseStyleAttribute(s);
  return result;
}
826983
function extractSass(files) {

        // note:  The way we're setting up webpack here seems a bit of a hack:
        //
        // Although the setup creates two bundles seperating the js and css as desired,
        // it's also producing an extra styles.js file which we're throwing away/ignoring.
        // The alternative, more supported way of things, is to leave the css inline
        // within js and let the styles plugin add the css at runtime to the html page.
        // At the moment keeping with the extracted css as:
        // 1. more familar to angular 1 developers (?)
        // 2. maintains backwards compatibility with the existing apps that expects
        //    the css to be delivered to the browser as a seperate file

        const filename = env.prod ? `${libraryName}.min.css` : `${libraryName}.css`;
        const extractor = new ExtractTextPlugin(filename);
        let loader;
        if (env.debug || env.prod) {
            loader = 'css-loader?sourceMap!sass-loader?sourceMap';
        } else {
            loader = 'css-loader!sass-loader';
        }
        return {
            entry: {
                styles: files
            },
            module: {
                rules: [
                    {
                        test: /\.scss$/,
                        loader: extractor.extract(loader),
                        include: files
                    }
                ]
            },
            plugins: [
                extractor
            ]
        };
    }
698930
function getChildRules(css, parent) {
  var result = [];
  var selectorRegExp = new RegExp(parent.selector);

  // Walk all rules to mach child selectors
  css.walkRules(selectorRegExp, function (rule) {
    var childRule = (0, _matchChild.matchChild)(parent, rule);
    if (childRule) {
      result.push(rule);
    }
  });

  // Walk all at-rules to match nested child selectors
  css.walkAtRules(function (atRule) {
    atRule.walkRules(selectorRegExp, function (rule) {
      var childRule = (0, _matchChild.matchChild)(parent, rule);
      // Create new at-rule to append only necessary selector to critical
      var criticalAtRule = _postcss2.default.atRule({
        name: atRule.name,
        params: atRule.params
      });
      /**
       * Should append even if parent selector, but make sure the two rules
       * aren't identical.
       */
      if ((rule.selector === parent.selector || childRule) && _postcss2.default.parse(rule).toString() !== _postcss2.default.parse(parent).toString()) {
        var clone = rule.clone();
        criticalAtRule.append(clone);
        result.push(criticalAtRule);
      }
    });
  });

  return result;
}
923750
function(s, v) {
    if (arguments.length == 0) {
      // get full style
      return this.node.style.cssText || ''

    } else if (arguments.length < 2) {
      // apply every style individually if an object is passed
      if (typeof s == 'object') {
        for (v in s) this.style(v, s[v])

      } else if (SVG.regex.isCss.test(s)) {
        // parse css string
        s = s.split(';')

        // apply every definition individually
        for (var i = 0; i < s.length; i++) {
          v = s[i].split(':')
          this.style(v[0].replace(/\s+/g, ''), v[1])
        }
      } else {
        // act as a getter if the first and only argument is not an object
        return this.node.style[camelCase(s)]
      }

    } else {
      this.node.style[camelCase(s)] = v === null || SVG.regex.isBlank.test(v) ? '' : v
    }

    return this
  }
451716
function create_extract_css_plugin(css_bundle_filename, useMiniCssExtractPlugin)
{
	if (useMiniCssExtractPlugin)
	{
		const MiniCssExtractPlugin = require('mini-css-extract-plugin')

		return new MiniCssExtractPlugin
		({
			// Options similar to the same options in webpackOptions.output
			// both options are optional
			filename : css_bundle_filename
		})
	}

	const ExtractTextPlugin = require('extract-text-webpack-plugin')

	// "allChunks: true" option means that the styles from all chunks
	// (think "entry points") will be extracted into a single big CSS file.
	//
	return new ExtractTextPlugin
	({
		filename  : css_bundle_filename,
		allChunks : true
	})
}
1225847
def from_css(Class, csstext, encoding=None, href=None, media=None, title=None, validate=None):
        
        styles = Class()
        cssStyleSheet = cssutils.parseString(csstext, encoding=encoding, href=href, media=media, title=title, validate=validate)
        for rule in cssStyleSheet.cssRules:
            if rule.type==cssutils.css.CSSRule.FONT_FACE_RULE:
                if styles.get('@font-face') is None: styles['@font-face'] = []
                styles['@font-face'].append(Class.styleProperties(rule.style))
            
            elif rule.type==cssutils.css.CSSRule.IMPORT_RULE:
                if styles.get('@import') is None: styles['@import'] = []
                styles['@import'].append("url(%s)" % rule.href)

            elif rule.type==cssutils.css.CSSRule.NAMESPACE_RULE:
                if styles.get('@namespace') is None: styles['@namespace'] = {}
                styles['@namespace'][rule.prefix] = rule.namespaceURI
            
            elif rule.type==cssutils.css.CSSRule.MEDIA_RULE:
                if styles.get('@media') is None: styles['@media'] = []
                styles['@media'].append(rule.cssText)
            
            elif rule.type==cssutils.css.CSSRule.PAGE_RULE:
                if styles.get('@page') is None: styles['@page'] = []
                styles['@page'].append(rule.cssText)

            elif rule.type==cssutils.css.CSSRule.STYLE_RULE:
                for selector in rule.selectorList:
                    sel = selector.selectorText
                    if sel not in styles:
                        styles[sel] = Class.styleProperties(rule.style)
            
            elif rule.type==cssutils.css.CSSRule.CHARSET_RULE:
                styles['@charset'] = rule.encoding

            elif rule.type==cssutils.css.CSSRule.COMMENT:   # comments are thrown away
                pass

            elif rule.type==cssutils.css.CSSRule.VARIABLES_RULE:
                pass
            
            else:
                log.warning("Unknown rule type: %r" % rule.cssText)

        return styles
405750
function writeFile(file, css) {
  return new Promise((resolve, reject) => {
    fs.writeFile(file, css, err => {
      if (err) {
        return reject(err);
      }
      resolve();
    })
  });
}
177721
function generateLoaders(loader, loaderOptions) {
    const loaders = [ cssLoader ];
    if (loader) {
      loaders.push({
        loader: loader + '-loader',
        options: Object.assign({}, loaderOptions, {
          sourceMap: options.sourceMap,
        }),
      });
    }

    // Extract CSS when that option is specified
    // (which is the case during production build)
    if (options.extract) {
      return [ MiniCssExtractPlugin.loader ].concat(loaders);
    }
    return [ 'vue-style-loader' ].concat(loaders);
  }
183922
function(tree, options) {
      if (!options) {
        options = {
          ext: '.css',
          importFormat: null, // to be initialized just bellow
          encoding: 'utf-8'
        };
      }

      if (!options.ext) {
        options.ext = '.css';
      }

      if (!options.importFormat) {
        if (options.ext === '.css') {
          options.importFormat = function(path) {
            return '@import "' + path + '";';
          };
        } else if (options.ext === '.less') {
          options.importFormat = function(path) {
            return '@import (less) "' + path + '";';
          };
        }
      }

      if (!options.encoding) {
        options.encoding = 'utf-8';
      }

      generate(tree, null, options);
    }
794562
async function getCustomPropertiesFromCSSFile(from) {
	const css = await readFile(from);
	const root = postcss.parse(css, { from });

	return getCustomPropertiesFromRoot(root, { preserve: true });
}
754859
function updateReferences(images, options, sprites, css) {
	return new Promise(function (resolve) {
		css.walkComments(function (comment) {
			var rule, image, backgroundImage, backgroundPosition, backgroundSize;
			// Manipulate only token comments
			if (isToken(comment)) {
				// Match from the path with the tokens comments
				image = _.find(images, {path: comment.text});
				if (image) {
					// 2x check even dimensions.
					if (image.ratio === 2 && (image.coordinates.width % 2 !== 0 || image.coordinates.height % 2 !== 0)) {
						throw log(options.logLevel, 'lv1', ['Lazysprite:', colors.red(path.relative(process.cwd(), image.path)), '`2x` image should have' +
						' even dimensions.']);
					}

					// 3x check dimensions.
					if (image.ratio === 3 && (image.coordinates.width % 3 !== 0 || image.coordinates.height % 3 !== 0)) {
						throw log(options.logLevel, 'lv1', ['Lazysprite:', colors.red(path.relative(process.cwd(), image.path)), '`3x` image should have' +
						' correct dimensions.']);
					}

					// Generate correct ref to the sprite
					image.spriteRef = path.relative(image.stylesheetRelative, image.spritePath);
					image.spriteRef = image.spriteRef.split(path.sep).join('/');

					backgroundImage = postcss.decl({
						prop: 'background-image',
						value: getBackgroundImageUrl(image)
					});

					backgroundPosition = postcss.decl({
						prop: 'background-position',
						value: getBackgroundPosition(image)
					});

					// Replace the comment and append necessary properties.
					comment.replaceWith(backgroundImage);

					// Output the dimensions (only with 1x)
					if (options.outputDimensions && image.ratio === 1) {
						['height', 'width'].forEach(function (prop) {
							backgroundImage.after(
								postcss.decl({
									prop: prop,
									value: (image.ratio > 1 ? image.coordinates[prop] / image.ratio : image.coordinates[prop]) + 'px'
								})
							);
						});
					}

					backgroundImage.after(backgroundPosition);

					if (image.ratio > 1) {
						backgroundSize = postcss.decl({
							prop: 'background-size',
							value: getBackgroundSize(image)
						});

						backgroundPosition.after(backgroundSize);
					}
				}
			}
		});

		resolve([images, options, sprites, css]);
	});
}
1005205
function getCss(el, prop) {
  var styles = parse(el.attribs.style);
  if (typeof prop === 'string') {
    return styles[prop];
  } else if (Array.isArray(prop)) {
    return _.pick(styles, prop);
  } else {
    return styles;
  }
}
1255050
function (module) {
        "use strict";
    
        // find a css value
        var retrieve = function (value) {
    
            var process = value.split('-');
            value = beyond.css.values;
            for (var i in process) {
    
                value = value[process[i]];
                if (typeof value === 'undefined') return;
    
            }
    
            return value;
    
        };
    
        this.process = function (styles) {
    
            var regexp = /value\((.*?)\)/g, styles;
            var value = regexp.exec(styles);
    
            var replace = {};
    
            while (value) {
    
                var retrieved = retrieve(value[1]);
    
                if (typeof retrieved !== 'string') {
    
                    console.warn(
                        'invalid css value "' + value[1] +
                        '" value, it must be an string and it is ' + typeof retrieved)
    
                }
                else replace[value[0]] = retrieved;
    
                value = regexp.exec(styles);
    
            }
    
            // replace all values with their values
            for (var name in replace) {
    
                var value = replace[name];
                while (styles.indexOf(name) !== -1) {
                    styles = styles.replace(name, value);
                }
    
            }
    
            return styles;
    
        };
    
    }
963280
function updateImageSizeCSS(editor, model) {
	const pos = editor.getCursorBufferPosition();
	const property = getImageCSSNode(editor, model, pos);
	const urlToken = findUrlToken(property, pos);
	const src = urlToken && getImageSrcCSS(urlToken);

	if (!src) {
		return Promise.reject(new Error('No valid image source'));
	}

	locateFile(editor, src)
	.then(getImageSize)
	.then(size => {
		// since this action is asynchronous, we have to ensure that editor wasn’t
		// changed and user didn’t moved caret outside <img> node
		if (getImageCSSNode(editor, model, pos) === property) {
			updateCSSNode(editor, property, size.width, size.height);
		}
	})
	.catch(err => console.warn('Error while updating image size:', err));
}