removed 1.4.1 and 1.8.1
1.10.1 is comming
This commit is contained in:
		
							parent
							
								
									b35bf2a665
								
							
						
					
					
						commit
						9896083362
					
				
					 79 changed files with 0 additions and 36784 deletions
				
			
		| 
						 | 
				
			
			@ -1,55 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2015-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Base;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Range
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
class Range
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var float|int
 | 
			
		||||
     */
 | 
			
		||||
    public $first;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var float|int
 | 
			
		||||
     */
 | 
			
		||||
    public $last;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Initialize range
 | 
			
		||||
     *
 | 
			
		||||
     * @param integer|float $first
 | 
			
		||||
     * @param integer|float $last
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct($first, $last)
 | 
			
		||||
    {
 | 
			
		||||
        $this->first = $first;
 | 
			
		||||
        $this->last = $last;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Test for inclusion in range
 | 
			
		||||
     *
 | 
			
		||||
     * @param integer|float $value
 | 
			
		||||
     *
 | 
			
		||||
     * @return boolean
 | 
			
		||||
     */
 | 
			
		||||
    public function includes($value)
 | 
			
		||||
    {
 | 
			
		||||
        return $value >= $this->first && $value <= $this->last;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										71
									
								
								include/thirdparty/ScssPhp/ScssPhp141/Block.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										71
									
								
								include/thirdparty/ScssPhp/ScssPhp141/Block.php
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,71 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Block
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
class Block
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public $type;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var \ScssPhp\ScssPhp\Block
 | 
			
		||||
     */
 | 
			
		||||
    public $parent;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public $sourceName;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     */
 | 
			
		||||
    public $sourceIndex;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     */
 | 
			
		||||
    public $sourceLine;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     */
 | 
			
		||||
    public $sourceColumn;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array|null
 | 
			
		||||
     */
 | 
			
		||||
    public $selectors;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array
 | 
			
		||||
     */
 | 
			
		||||
    public $comments;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array
 | 
			
		||||
     */
 | 
			
		||||
    public $children;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var \ScssPhp\ScssPhp\Block|null
 | 
			
		||||
     */
 | 
			
		||||
    public $selfParent;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										270
									
								
								include/thirdparty/ScssPhp/ScssPhp141/Cache.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										270
									
								
								include/thirdparty/ScssPhp/ScssPhp141/Cache.php
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,270 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
use Exception;
 | 
			
		||||
use ScssPhp\ScssPhp\Version;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * The scss cache manager.
 | 
			
		||||
 *
 | 
			
		||||
 * In short:
 | 
			
		||||
 *
 | 
			
		||||
 * allow to put in cache/get from cache a generic result from a known operation on a generic dataset,
 | 
			
		||||
 * taking in account options that affects the result
 | 
			
		||||
 *
 | 
			
		||||
 * The cache manager is agnostic about data format and only the operation is expected to be described by string
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSS cache
 | 
			
		||||
 *
 | 
			
		||||
 * @author Cedric Morin <cedric@yterium.com>
 | 
			
		||||
 */
 | 
			
		||||
class Cache
 | 
			
		||||
{
 | 
			
		||||
    const CACHE_VERSION = 1;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * directory used for storing data
 | 
			
		||||
     *
 | 
			
		||||
     * @var string|false
 | 
			
		||||
     */
 | 
			
		||||
    public static $cacheDir = false;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * prefix for the storing data
 | 
			
		||||
     *
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public static $prefix = 'scssphp_';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * force a refresh : 'once' for refreshing the first hit on a cache only, true to never use the cache in this hit
 | 
			
		||||
     *
 | 
			
		||||
     * @var bool|string
 | 
			
		||||
     */
 | 
			
		||||
    public static $forceRefresh = false;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * specifies the number of seconds after which data cached will be seen as 'garbage' and potentially cleaned up
 | 
			
		||||
     *
 | 
			
		||||
     * @var int
 | 
			
		||||
     */
 | 
			
		||||
    public static $gcLifetime = 604800;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * array of already refreshed cache if $forceRefresh==='once'
 | 
			
		||||
     *
 | 
			
		||||
     * @var array<string, bool>
 | 
			
		||||
     */
 | 
			
		||||
    protected static $refreshed = [];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructor
 | 
			
		||||
     *
 | 
			
		||||
     * @param array $options
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-param array{cacheDir?: string, prefix?: string, forceRefresh?: string} $options
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct($options)
 | 
			
		||||
    {
 | 
			
		||||
        // check $cacheDir
 | 
			
		||||
        if (isset($options['cacheDir'])) {
 | 
			
		||||
            self::$cacheDir = $options['cacheDir'];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (empty(self::$cacheDir)) {
 | 
			
		||||
            throw new Exception('cacheDir not set');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (isset($options['prefix'])) {
 | 
			
		||||
            self::$prefix = $options['prefix'];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (empty(self::$prefix)) {
 | 
			
		||||
            throw new Exception('prefix not set');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (isset($options['forceRefresh'])) {
 | 
			
		||||
            self::$forceRefresh = $options['forceRefresh'];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        self::checkCacheDir();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the cached result of $operation on $what,
 | 
			
		||||
     * which is known as dependant from the content of $options
 | 
			
		||||
     *
 | 
			
		||||
     * @param string   $operation    parse, compile...
 | 
			
		||||
     * @param mixed    $what         content key (e.g., filename to be treated)
 | 
			
		||||
     * @param array    $options      any option that affect the operation result on the content
 | 
			
		||||
     * @param int|null $lastModified last modified timestamp
 | 
			
		||||
     *
 | 
			
		||||
     * @return mixed
 | 
			
		||||
     *
 | 
			
		||||
     * @throws \Exception
 | 
			
		||||
     */
 | 
			
		||||
    public function getCache($operation, $what, $options = [], $lastModified = null)
 | 
			
		||||
    {
 | 
			
		||||
        $fileCache = self::$cacheDir . self::cacheName($operation, $what, $options);
 | 
			
		||||
 | 
			
		||||
        if (
 | 
			
		||||
            ((self::$forceRefresh === false) || (self::$forceRefresh === 'once' &&
 | 
			
		||||
            isset(self::$refreshed[$fileCache]))) && file_exists($fileCache)
 | 
			
		||||
        ) {
 | 
			
		||||
            $cacheTime = filemtime($fileCache);
 | 
			
		||||
 | 
			
		||||
            if (
 | 
			
		||||
                (\is_null($lastModified) || $cacheTime > $lastModified) &&
 | 
			
		||||
                $cacheTime + self::$gcLifetime > time()
 | 
			
		||||
            ) {
 | 
			
		||||
                $c = file_get_contents($fileCache);
 | 
			
		||||
                $c = unserialize($c);
 | 
			
		||||
 | 
			
		||||
                if (\is_array($c) && isset($c['value'])) {
 | 
			
		||||
                    return $c['value'];
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Put in cache the result of $operation on $what,
 | 
			
		||||
     * which is known as dependant from the content of $options
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $operation
 | 
			
		||||
     * @param mixed  $what
 | 
			
		||||
     * @param mixed  $value
 | 
			
		||||
     * @param array  $options
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function setCache($operation, $what, $value, $options = [])
 | 
			
		||||
    {
 | 
			
		||||
        $fileCache = self::$cacheDir . self::cacheName($operation, $what, $options);
 | 
			
		||||
 | 
			
		||||
        $c = ['value' => $value];
 | 
			
		||||
        $c = serialize($c);
 | 
			
		||||
 | 
			
		||||
        file_put_contents($fileCache, $c);
 | 
			
		||||
 | 
			
		||||
        if (self::$forceRefresh === 'once') {
 | 
			
		||||
            self::$refreshed[$fileCache] = true;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the cache name for the caching of $operation on $what,
 | 
			
		||||
     * which is known as dependant from the content of $options
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $operation
 | 
			
		||||
     * @param mixed  $what
 | 
			
		||||
     * @param array  $options
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    private static function cacheName($operation, $what, $options = [])
 | 
			
		||||
    {
 | 
			
		||||
        $t = [
 | 
			
		||||
          'version' => self::CACHE_VERSION,
 | 
			
		||||
          'scssphpVersion' => Version::VERSION,
 | 
			
		||||
          'operation' => $operation,
 | 
			
		||||
          'what' => $what,
 | 
			
		||||
          'options' => $options
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        $t = self::$prefix
 | 
			
		||||
          . sha1(json_encode($t))
 | 
			
		||||
          . ".$operation"
 | 
			
		||||
          . ".scsscache";
 | 
			
		||||
 | 
			
		||||
        return $t;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Check that the cache dir exists and is writeable
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     *
 | 
			
		||||
     * @throws \Exception
 | 
			
		||||
     */
 | 
			
		||||
    public static function checkCacheDir()
 | 
			
		||||
    {
 | 
			
		||||
        self::$cacheDir = str_replace('\\', '/', self::$cacheDir);
 | 
			
		||||
        self::$cacheDir = rtrim(self::$cacheDir, '/') . '/';
 | 
			
		||||
 | 
			
		||||
        if (! is_dir(self::$cacheDir)) {
 | 
			
		||||
            throw new Exception('Cache directory doesn\'t exist: ' . self::$cacheDir);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (! is_writable(self::$cacheDir)) {
 | 
			
		||||
            throw new Exception('Cache directory isn\'t writable: ' . self::$cacheDir);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Delete unused cached files
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public static function cleanCache()
 | 
			
		||||
    {
 | 
			
		||||
        static $clean = false;
 | 
			
		||||
 | 
			
		||||
        if ($clean || empty(self::$cacheDir)) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $clean = true;
 | 
			
		||||
 | 
			
		||||
        // only remove files with extensions created by SCSSPHP Cache
 | 
			
		||||
        // css files removed based on the list files
 | 
			
		||||
        $removeTypes = ['scsscache' => 1];
 | 
			
		||||
 | 
			
		||||
        $files = scandir(self::$cacheDir);
 | 
			
		||||
 | 
			
		||||
        if (! $files) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $checkTime = time() - self::$gcLifetime;
 | 
			
		||||
 | 
			
		||||
        foreach ($files as $file) {
 | 
			
		||||
            // don't delete if the file wasn't created with SCSSPHP Cache
 | 
			
		||||
            if (strpos($file, self::$prefix) !== 0) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $parts = explode('.', $file);
 | 
			
		||||
            $type = array_pop($parts);
 | 
			
		||||
 | 
			
		||||
            if (! isset($removeTypes[$type])) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $fullPath = self::$cacheDir . $file;
 | 
			
		||||
            $mtime = filemtime($fullPath);
 | 
			
		||||
 | 
			
		||||
            // don't delete if it's a relatively new file
 | 
			
		||||
            if ($mtime > $checkTime) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            unlink($fullPath);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										245
									
								
								include/thirdparty/ScssPhp/ScssPhp141/Colors.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										245
									
								
								include/thirdparty/ScssPhp/ScssPhp141/Colors.php
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,245 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * CSS Colors
 | 
			
		||||
 *
 | 
			
		||||
 * @author Leaf Corcoran <leafot@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
class Colors
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * CSS Colors
 | 
			
		||||
     *
 | 
			
		||||
     * @see http://www.w3.org/TR/css3-color
 | 
			
		||||
     *
 | 
			
		||||
     * @var array<string, string>
 | 
			
		||||
     */
 | 
			
		||||
    protected static $cssColors = [
 | 
			
		||||
        'aliceblue' => '240,248,255',
 | 
			
		||||
        'antiquewhite' => '250,235,215',
 | 
			
		||||
        'aqua' => '0,255,255',
 | 
			
		||||
        'cyan' => '0,255,255',
 | 
			
		||||
        'aquamarine' => '127,255,212',
 | 
			
		||||
        'azure' => '240,255,255',
 | 
			
		||||
        'beige' => '245,245,220',
 | 
			
		||||
        'bisque' => '255,228,196',
 | 
			
		||||
        'black' => '0,0,0',
 | 
			
		||||
        'blanchedalmond' => '255,235,205',
 | 
			
		||||
        'blue' => '0,0,255',
 | 
			
		||||
        'blueviolet' => '138,43,226',
 | 
			
		||||
        'brown' => '165,42,42',
 | 
			
		||||
        'burlywood' => '222,184,135',
 | 
			
		||||
        'cadetblue' => '95,158,160',
 | 
			
		||||
        'chartreuse' => '127,255,0',
 | 
			
		||||
        'chocolate' => '210,105,30',
 | 
			
		||||
        'coral' => '255,127,80',
 | 
			
		||||
        'cornflowerblue' => '100,149,237',
 | 
			
		||||
        'cornsilk' => '255,248,220',
 | 
			
		||||
        'crimson' => '220,20,60',
 | 
			
		||||
        'darkblue' => '0,0,139',
 | 
			
		||||
        'darkcyan' => '0,139,139',
 | 
			
		||||
        'darkgoldenrod' => '184,134,11',
 | 
			
		||||
        'darkgray' => '169,169,169',
 | 
			
		||||
        'darkgrey' => '169,169,169',
 | 
			
		||||
        'darkgreen' => '0,100,0',
 | 
			
		||||
        'darkkhaki' => '189,183,107',
 | 
			
		||||
        'darkmagenta' => '139,0,139',
 | 
			
		||||
        'darkolivegreen' => '85,107,47',
 | 
			
		||||
        'darkorange' => '255,140,0',
 | 
			
		||||
        'darkorchid' => '153,50,204',
 | 
			
		||||
        'darkred' => '139,0,0',
 | 
			
		||||
        'darksalmon' => '233,150,122',
 | 
			
		||||
        'darkseagreen' => '143,188,143',
 | 
			
		||||
        'darkslateblue' => '72,61,139',
 | 
			
		||||
        'darkslategray' => '47,79,79',
 | 
			
		||||
        'darkslategrey' => '47,79,79',
 | 
			
		||||
        'darkturquoise' => '0,206,209',
 | 
			
		||||
        'darkviolet' => '148,0,211',
 | 
			
		||||
        'deeppink' => '255,20,147',
 | 
			
		||||
        'deepskyblue' => '0,191,255',
 | 
			
		||||
        'dimgray' => '105,105,105',
 | 
			
		||||
        'dimgrey' => '105,105,105',
 | 
			
		||||
        'dodgerblue' => '30,144,255',
 | 
			
		||||
        'firebrick' => '178,34,34',
 | 
			
		||||
        'floralwhite' => '255,250,240',
 | 
			
		||||
        'forestgreen' => '34,139,34',
 | 
			
		||||
        'fuchsia' => '255,0,255',
 | 
			
		||||
        'magenta' => '255,0,255',
 | 
			
		||||
        'gainsboro' => '220,220,220',
 | 
			
		||||
        'ghostwhite' => '248,248,255',
 | 
			
		||||
        'gold' => '255,215,0',
 | 
			
		||||
        'goldenrod' => '218,165,32',
 | 
			
		||||
        'gray' => '128,128,128',
 | 
			
		||||
        'grey' => '128,128,128',
 | 
			
		||||
        'green' => '0,128,0',
 | 
			
		||||
        'greenyellow' => '173,255,47',
 | 
			
		||||
        'honeydew' => '240,255,240',
 | 
			
		||||
        'hotpink' => '255,105,180',
 | 
			
		||||
        'indianred' => '205,92,92',
 | 
			
		||||
        'indigo' => '75,0,130',
 | 
			
		||||
        'ivory' => '255,255,240',
 | 
			
		||||
        'khaki' => '240,230,140',
 | 
			
		||||
        'lavender' => '230,230,250',
 | 
			
		||||
        'lavenderblush' => '255,240,245',
 | 
			
		||||
        'lawngreen' => '124,252,0',
 | 
			
		||||
        'lemonchiffon' => '255,250,205',
 | 
			
		||||
        'lightblue' => '173,216,230',
 | 
			
		||||
        'lightcoral' => '240,128,128',
 | 
			
		||||
        'lightcyan' => '224,255,255',
 | 
			
		||||
        'lightgoldenrodyellow' => '250,250,210',
 | 
			
		||||
        'lightgray' => '211,211,211',
 | 
			
		||||
        'lightgrey' => '211,211,211',
 | 
			
		||||
        'lightgreen' => '144,238,144',
 | 
			
		||||
        'lightpink' => '255,182,193',
 | 
			
		||||
        'lightsalmon' => '255,160,122',
 | 
			
		||||
        'lightseagreen' => '32,178,170',
 | 
			
		||||
        'lightskyblue' => '135,206,250',
 | 
			
		||||
        'lightslategray' => '119,136,153',
 | 
			
		||||
        'lightslategrey' => '119,136,153',
 | 
			
		||||
        'lightsteelblue' => '176,196,222',
 | 
			
		||||
        'lightyellow' => '255,255,224',
 | 
			
		||||
        'lime' => '0,255,0',
 | 
			
		||||
        'limegreen' => '50,205,50',
 | 
			
		||||
        'linen' => '250,240,230',
 | 
			
		||||
        'maroon' => '128,0,0',
 | 
			
		||||
        'mediumaquamarine' => '102,205,170',
 | 
			
		||||
        'mediumblue' => '0,0,205',
 | 
			
		||||
        'mediumorchid' => '186,85,211',
 | 
			
		||||
        'mediumpurple' => '147,112,219',
 | 
			
		||||
        'mediumseagreen' => '60,179,113',
 | 
			
		||||
        'mediumslateblue' => '123,104,238',
 | 
			
		||||
        'mediumspringgreen' => '0,250,154',
 | 
			
		||||
        'mediumturquoise' => '72,209,204',
 | 
			
		||||
        'mediumvioletred' => '199,21,133',
 | 
			
		||||
        'midnightblue' => '25,25,112',
 | 
			
		||||
        'mintcream' => '245,255,250',
 | 
			
		||||
        'mistyrose' => '255,228,225',
 | 
			
		||||
        'moccasin' => '255,228,181',
 | 
			
		||||
        'navajowhite' => '255,222,173',
 | 
			
		||||
        'navy' => '0,0,128',
 | 
			
		||||
        'oldlace' => '253,245,230',
 | 
			
		||||
        'olive' => '128,128,0',
 | 
			
		||||
        'olivedrab' => '107,142,35',
 | 
			
		||||
        'orange' => '255,165,0',
 | 
			
		||||
        'orangered' => '255,69,0',
 | 
			
		||||
        'orchid' => '218,112,214',
 | 
			
		||||
        'palegoldenrod' => '238,232,170',
 | 
			
		||||
        'palegreen' => '152,251,152',
 | 
			
		||||
        'paleturquoise' => '175,238,238',
 | 
			
		||||
        'palevioletred' => '219,112,147',
 | 
			
		||||
        'papayawhip' => '255,239,213',
 | 
			
		||||
        'peachpuff' => '255,218,185',
 | 
			
		||||
        'peru' => '205,133,63',
 | 
			
		||||
        'pink' => '255,192,203',
 | 
			
		||||
        'plum' => '221,160,221',
 | 
			
		||||
        'powderblue' => '176,224,230',
 | 
			
		||||
        'purple' => '128,0,128',
 | 
			
		||||
        'red' => '255,0,0',
 | 
			
		||||
        'rosybrown' => '188,143,143',
 | 
			
		||||
        'royalblue' => '65,105,225',
 | 
			
		||||
        'saddlebrown' => '139,69,19',
 | 
			
		||||
        'salmon' => '250,128,114',
 | 
			
		||||
        'sandybrown' => '244,164,96',
 | 
			
		||||
        'seagreen' => '46,139,87',
 | 
			
		||||
        'seashell' => '255,245,238',
 | 
			
		||||
        'sienna' => '160,82,45',
 | 
			
		||||
        'silver' => '192,192,192',
 | 
			
		||||
        'skyblue' => '135,206,235',
 | 
			
		||||
        'slateblue' => '106,90,205',
 | 
			
		||||
        'slategray' => '112,128,144',
 | 
			
		||||
        'slategrey' => '112,128,144',
 | 
			
		||||
        'snow' => '255,250,250',
 | 
			
		||||
        'springgreen' => '0,255,127',
 | 
			
		||||
        'steelblue' => '70,130,180',
 | 
			
		||||
        'tan' => '210,180,140',
 | 
			
		||||
        'teal' => '0,128,128',
 | 
			
		||||
        'thistle' => '216,191,216',
 | 
			
		||||
        'tomato' => '255,99,71',
 | 
			
		||||
        'turquoise' => '64,224,208',
 | 
			
		||||
        'violet' => '238,130,238',
 | 
			
		||||
        'wheat' => '245,222,179',
 | 
			
		||||
        'white' => '255,255,255',
 | 
			
		||||
        'whitesmoke' => '245,245,245',
 | 
			
		||||
        'yellow' => '255,255,0',
 | 
			
		||||
        'yellowgreen' => '154,205,50',
 | 
			
		||||
        'rebeccapurple' => '102,51,153',
 | 
			
		||||
        'transparent' => '0,0,0,0',
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Convert named color in a [r,g,b[,a]] array
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $colorName
 | 
			
		||||
     *
 | 
			
		||||
     * @return int[]|null
 | 
			
		||||
     */
 | 
			
		||||
    public static function colorNameToRGBa($colorName)
 | 
			
		||||
    {
 | 
			
		||||
        if (\is_string($colorName) && isset(static::$cssColors[$colorName])) {
 | 
			
		||||
            $rgba = explode(',', static::$cssColors[$colorName]);
 | 
			
		||||
 | 
			
		||||
            // only case with opacity is transparent, with opacity=0, so we can intval on opacity also
 | 
			
		||||
            $rgba = array_map('intval', $rgba);
 | 
			
		||||
 | 
			
		||||
            return $rgba;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Reverse conversion : from RGBA to a color name if possible
 | 
			
		||||
     *
 | 
			
		||||
     * @param integer $r
 | 
			
		||||
     * @param integer $g
 | 
			
		||||
     * @param integer $b
 | 
			
		||||
     * @param integer|float $a
 | 
			
		||||
     *
 | 
			
		||||
     * @return string|null
 | 
			
		||||
     */
 | 
			
		||||
    public static function RGBaToColorName($r, $g, $b, $a = 1)
 | 
			
		||||
    {
 | 
			
		||||
        static $reverseColorTable = null;
 | 
			
		||||
 | 
			
		||||
        if (! is_numeric($r) || ! is_numeric($g) || ! is_numeric($b) || ! is_numeric($a)) {
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($a < 1) {
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (\is_null($reverseColorTable)) {
 | 
			
		||||
            $reverseColorTable = [];
 | 
			
		||||
 | 
			
		||||
            foreach (static::$cssColors as $name => $rgb_str) {
 | 
			
		||||
                $rgb_str = explode(',', $rgb_str);
 | 
			
		||||
 | 
			
		||||
                if (
 | 
			
		||||
                    \count($rgb_str) == 3 &&
 | 
			
		||||
                    ! isset($reverseColorTable[\intval($rgb_str[0])][\intval($rgb_str[1])][\intval($rgb_str[2])])
 | 
			
		||||
                ) {
 | 
			
		||||
                    $reverseColorTable[\intval($rgb_str[0])][\intval($rgb_str[1])][\intval($rgb_str[2])] = $name;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (isset($reverseColorTable[\intval($r)][\intval($g)][\intval($b)])) {
 | 
			
		||||
            return $reverseColorTable[\intval($r)][\intval($g)][\intval($b)];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,69 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
class CompilationResult
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    private $css;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string|null
 | 
			
		||||
     */
 | 
			
		||||
    private $sourceMap;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string[]
 | 
			
		||||
     */
 | 
			
		||||
    private $includedFiles;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param string $css
 | 
			
		||||
     * @param string|null $sourceMap
 | 
			
		||||
     * @param string[] $includedFiles
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct($css, $sourceMap, array $includedFiles)
 | 
			
		||||
    {
 | 
			
		||||
        $this->css = $css;
 | 
			
		||||
        $this->sourceMap = $sourceMap;
 | 
			
		||||
        $this->includedFiles = $includedFiles;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function getCss()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->css;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return string[]
 | 
			
		||||
     */
 | 
			
		||||
    public function getIncludedFiles()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->includedFiles;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The sourceMap content, if it was generated
 | 
			
		||||
     *
 | 
			
		||||
     * @return null|string
 | 
			
		||||
     */
 | 
			
		||||
    public function getSourceMap()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->sourceMap;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										9801
									
								
								include/thirdparty/ScssPhp/ScssPhp141/Compiler.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9801
									
								
								include/thirdparty/ScssPhp/ScssPhp141/Compiler.php
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -1,77 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Compiler;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\CompilationResult;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class CachedResult
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var CompilationResult
 | 
			
		||||
     */
 | 
			
		||||
    private $result;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array<string, int>
 | 
			
		||||
     */
 | 
			
		||||
    private $parsedFiles;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array
 | 
			
		||||
     * @phpstan-var list<array{currentDir: string|null, path: string, filePath: string}>
 | 
			
		||||
     */
 | 
			
		||||
    private $resolvedImports;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param CompilationResult  $result
 | 
			
		||||
     * @param array<string, int> $parsedFiles
 | 
			
		||||
     * @param array              $resolvedImports
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-param list<array{currentDir: string|null, path: string, filePath: string}> $resolvedImports
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct(CompilationResult $result, array $parsedFiles, array $resolvedImports)
 | 
			
		||||
    {
 | 
			
		||||
        $this->result = $result;
 | 
			
		||||
        $this->parsedFiles = $parsedFiles;
 | 
			
		||||
        $this->resolvedImports = $resolvedImports;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return CompilationResult
 | 
			
		||||
     */
 | 
			
		||||
    public function getResult()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->result;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return array<string, int>
 | 
			
		||||
     */
 | 
			
		||||
    public function getParsedFiles()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->parsedFiles;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return array
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-return list<array{currentDir: string|null, path: string, filePath: string}>
 | 
			
		||||
     */
 | 
			
		||||
    public function getResolvedImports()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->resolvedImports;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,46 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Compiler;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Compiler environment
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
class Environment
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var \ScssPhp\ScssPhp\Block|null
 | 
			
		||||
     */
 | 
			
		||||
    public $block;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var \ScssPhp\ScssPhp\Compiler\Environment|null
 | 
			
		||||
     */
 | 
			
		||||
    public $parent;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array
 | 
			
		||||
     */
 | 
			
		||||
    public $store;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array
 | 
			
		||||
     */
 | 
			
		||||
    public $storeUnreduced;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     */
 | 
			
		||||
    public $depth;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,22 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Exception;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Compiler exception
 | 
			
		||||
 *
 | 
			
		||||
 * @author Oleksandr Savchenko <traveltino@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
class CompilerException extends \Exception implements SassException
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,48 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Exception;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Parser Exception
 | 
			
		||||
 *
 | 
			
		||||
 * @author Oleksandr Savchenko <traveltino@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
class ParserException extends \Exception implements SassException
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array
 | 
			
		||||
     */
 | 
			
		||||
    private $sourcePosition;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get source position
 | 
			
		||||
     *
 | 
			
		||||
     * @api
 | 
			
		||||
     */
 | 
			
		||||
    public function getSourcePosition()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->sourcePosition;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set source position
 | 
			
		||||
     *
 | 
			
		||||
     * @api
 | 
			
		||||
     *
 | 
			
		||||
     * @param array $sourcePosition
 | 
			
		||||
     */
 | 
			
		||||
    public function setSourcePosition($sourcePosition)
 | 
			
		||||
    {
 | 
			
		||||
        $this->sourcePosition = $sourcePosition;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,22 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Exception;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Range exception
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
class RangeException extends \Exception implements SassException
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,7 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Exception;
 | 
			
		||||
 | 
			
		||||
interface SassException
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,32 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Exception;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * An exception thrown by SassScript.
 | 
			
		||||
 *
 | 
			
		||||
 * This class does not implement SassException on purpose, as it should
 | 
			
		||||
 * never be returned to the outside code. The compilation will catch it
 | 
			
		||||
 * and replace it with a SassException reporting the location of the
 | 
			
		||||
 * error.
 | 
			
		||||
 */
 | 
			
		||||
class SassScriptException extends \Exception
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Creates a SassScriptException with support for an argument name.
 | 
			
		||||
     *
 | 
			
		||||
     * This helper ensures a consistent handling of argument names in the
 | 
			
		||||
     * error message, without duplicating it.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string      $message
 | 
			
		||||
     * @param string|null $name    The argument name, without $
 | 
			
		||||
     *
 | 
			
		||||
     * @return SassScriptException
 | 
			
		||||
     */
 | 
			
		||||
    public static function forArgument($message, $name = null)
 | 
			
		||||
    {
 | 
			
		||||
        $varDisplay = !\is_null($name) ? "\${$name}: " : '';
 | 
			
		||||
 | 
			
		||||
        return new self($varDisplay . $message);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,22 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Exception;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Server Exception
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
class ServerException extends \Exception implements SassException
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										362
									
								
								include/thirdparty/ScssPhp/ScssPhp141/Formatter.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										362
									
								
								include/thirdparty/ScssPhp/ScssPhp141/Formatter.php
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,362 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Formatter\OutputBlock;
 | 
			
		||||
use ScssPhp\ScssPhp\SourceMap\SourceMapGenerator;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Base formatter
 | 
			
		||||
 *
 | 
			
		||||
 * @author Leaf Corcoran <leafot@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
abstract class Formatter
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     */
 | 
			
		||||
    public $indentLevel;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public $indentChar;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public $break;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public $open;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public $close;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public $tagSeparator;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public $assignSeparator;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var boolean
 | 
			
		||||
     */
 | 
			
		||||
    public $keepSemicolons;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var \ScssPhp\ScssPhp\Formatter\OutputBlock
 | 
			
		||||
     */
 | 
			
		||||
    protected $currentBlock;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     */
 | 
			
		||||
    protected $currentLine;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     */
 | 
			
		||||
    protected $currentColumn;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var \ScssPhp\ScssPhp\SourceMap\SourceMapGenerator|null
 | 
			
		||||
     */
 | 
			
		||||
    protected $sourceMapGenerator;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    protected $strippedSemicolon;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Initialize formatter
 | 
			
		||||
     *
 | 
			
		||||
     * @api
 | 
			
		||||
     */
 | 
			
		||||
    abstract public function __construct();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Return indentation (whitespace)
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    protected function indentStr()
 | 
			
		||||
    {
 | 
			
		||||
        return '';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Return property assignment
 | 
			
		||||
     *
 | 
			
		||||
     * @api
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $name
 | 
			
		||||
     * @param mixed  $value
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function property($name, $value)
 | 
			
		||||
    {
 | 
			
		||||
        return rtrim($name) . $this->assignSeparator . $value . ';';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Return custom property assignment
 | 
			
		||||
     * differs in that you have to keep spaces in the value as is
 | 
			
		||||
     *
 | 
			
		||||
     * @api
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $name
 | 
			
		||||
     * @param mixed  $value
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function customProperty($name, $value)
 | 
			
		||||
    {
 | 
			
		||||
        return rtrim($name) . trim($this->assignSeparator) . $value . ';';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Output lines inside a block
 | 
			
		||||
     *
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    protected function blockLines(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        $inner = $this->indentStr();
 | 
			
		||||
        $glue  = $this->break . $inner;
 | 
			
		||||
 | 
			
		||||
        $this->write($inner . implode($glue, $block->lines));
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->children)) {
 | 
			
		||||
            $this->write($this->break);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Output block selectors
 | 
			
		||||
     *
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    protected function blockSelectors(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        assert(! empty($block->selectors));
 | 
			
		||||
 | 
			
		||||
        $inner = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        $this->write($inner
 | 
			
		||||
            . implode($this->tagSeparator, $block->selectors)
 | 
			
		||||
            . $this->open . $this->break);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Output block children
 | 
			
		||||
     *
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    protected function blockChildren(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        foreach ($block->children as $child) {
 | 
			
		||||
            $this->block($child);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Output non-empty block
 | 
			
		||||
     *
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    protected function block(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        if (empty($block->lines) && empty($block->children)) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->currentBlock = $block;
 | 
			
		||||
 | 
			
		||||
        $pre = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->selectors)) {
 | 
			
		||||
            $this->blockSelectors($block);
 | 
			
		||||
 | 
			
		||||
            $this->indentLevel++;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->lines)) {
 | 
			
		||||
            $this->blockLines($block);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->children)) {
 | 
			
		||||
            $this->blockChildren($block);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->selectors)) {
 | 
			
		||||
            $this->indentLevel--;
 | 
			
		||||
 | 
			
		||||
            if (! $this->keepSemicolons) {
 | 
			
		||||
                $this->strippedSemicolon = '';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (empty($block->children)) {
 | 
			
		||||
                $this->write($this->break);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $this->write($pre . $this->close . $this->break);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Test and clean safely empty children
 | 
			
		||||
     *
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
 | 
			
		||||
     *
 | 
			
		||||
     * @return boolean
 | 
			
		||||
     */
 | 
			
		||||
    protected function testEmptyChildren($block)
 | 
			
		||||
    {
 | 
			
		||||
        $isEmpty = empty($block->lines);
 | 
			
		||||
 | 
			
		||||
        if ($block->children) {
 | 
			
		||||
            foreach ($block->children as $k => &$child) {
 | 
			
		||||
                if (! $this->testEmptyChildren($child)) {
 | 
			
		||||
                    $isEmpty = false;
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if ($child->type === Type::T_MEDIA || $child->type === Type::T_DIRECTIVE) {
 | 
			
		||||
                    $child->children = [];
 | 
			
		||||
                    $child->selectors = null;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $isEmpty;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Entry point to formatting a block
 | 
			
		||||
     *
 | 
			
		||||
     * @api
 | 
			
		||||
     *
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock             $block              An abstract syntax tree
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\SourceMap\SourceMapGenerator|null $sourceMapGenerator Optional source map generator
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function format(OutputBlock $block, SourceMapGenerator $sourceMapGenerator = null)
 | 
			
		||||
    {
 | 
			
		||||
        $this->sourceMapGenerator = null;
 | 
			
		||||
 | 
			
		||||
        if ($sourceMapGenerator) {
 | 
			
		||||
            $this->currentLine        = 1;
 | 
			
		||||
            $this->currentColumn      = 0;
 | 
			
		||||
            $this->sourceMapGenerator = $sourceMapGenerator;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->testEmptyChildren($block);
 | 
			
		||||
 | 
			
		||||
        ob_start();
 | 
			
		||||
 | 
			
		||||
        $this->block($block);
 | 
			
		||||
 | 
			
		||||
        $out = ob_get_clean();
 | 
			
		||||
 | 
			
		||||
        return $out;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Output content
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $str
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    protected function write($str)
 | 
			
		||||
    {
 | 
			
		||||
        if (! empty($this->strippedSemicolon)) {
 | 
			
		||||
            echo $this->strippedSemicolon;
 | 
			
		||||
 | 
			
		||||
            $this->strippedSemicolon = '';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /*
 | 
			
		||||
         * Maybe Strip semi-colon appended by property(); it's a separator, not a terminator
 | 
			
		||||
         * will be striped for real before a closing, otherwise displayed unchanged starting the next write
 | 
			
		||||
         */
 | 
			
		||||
        if (
 | 
			
		||||
            ! $this->keepSemicolons &&
 | 
			
		||||
            $str &&
 | 
			
		||||
            (strpos($str, ';') !== false) &&
 | 
			
		||||
            (substr($str, -1) === ';')
 | 
			
		||||
        ) {
 | 
			
		||||
            $str = substr($str, 0, -1);
 | 
			
		||||
 | 
			
		||||
            $this->strippedSemicolon = ';';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($this->sourceMapGenerator) {
 | 
			
		||||
            $lines = explode("\n", $str);
 | 
			
		||||
            $lastLine = array_pop($lines);
 | 
			
		||||
 | 
			
		||||
            foreach ($lines as $line) {
 | 
			
		||||
                // If the written line starts is empty, adding a mapping would add it for
 | 
			
		||||
                // a non-existent column as we are at the end of the line
 | 
			
		||||
                if ($line !== '') {
 | 
			
		||||
                    $this->sourceMapGenerator->addMapping(
 | 
			
		||||
                        $this->currentLine,
 | 
			
		||||
                        $this->currentColumn,
 | 
			
		||||
                        $this->currentBlock->sourceLine,
 | 
			
		||||
                        //columns from parser are off by one
 | 
			
		||||
                        $this->currentBlock->sourceColumn > 0 ? $this->currentBlock->sourceColumn - 1 : 0,
 | 
			
		||||
                        $this->currentBlock->sourceName
 | 
			
		||||
                    );
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $this->currentLine++;
 | 
			
		||||
                $this->currentColumn = 0;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if ($lastLine !== '') {
 | 
			
		||||
                $this->sourceMapGenerator->addMapping(
 | 
			
		||||
                    $this->currentLine,
 | 
			
		||||
                    $this->currentColumn,
 | 
			
		||||
                    $this->currentBlock->sourceLine,
 | 
			
		||||
                    //columns from parser are off by one
 | 
			
		||||
                    $this->currentBlock->sourceColumn > 0 ? $this->currentBlock->sourceColumn - 1 : 0,
 | 
			
		||||
                    $this->currentBlock->sourceName
 | 
			
		||||
                );
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $this->currentColumn += \strlen($lastLine);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        echo $str;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,50 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Compact formatter
 | 
			
		||||
 *
 | 
			
		||||
 * @author Leaf Corcoran <leafot@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @deprecated since 1.4.0. Use the Compressed formatter instead.
 | 
			
		||||
 */
 | 
			
		||||
class Compact extends Formatter
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        @trigger_error('The Compact formatter is deprecated since 1.4.0. Use the Compressed formatter instead.', E_USER_DEPRECATED);
 | 
			
		||||
 | 
			
		||||
        $this->indentLevel = 0;
 | 
			
		||||
        $this->indentChar = '';
 | 
			
		||||
        $this->break = '';
 | 
			
		||||
        $this->open = ' {';
 | 
			
		||||
        $this->close = "}\n\n";
 | 
			
		||||
        $this->tagSeparator = ',';
 | 
			
		||||
        $this->assignSeparator = ':';
 | 
			
		||||
        $this->keepSemicolons = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function indentStr()
 | 
			
		||||
    {
 | 
			
		||||
        return ' ';
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,83 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Compressed formatter
 | 
			
		||||
 *
 | 
			
		||||
 * @author Leaf Corcoran <leafot@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
class Compressed extends Formatter
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        $this->indentLevel = 0;
 | 
			
		||||
        $this->indentChar = '  ';
 | 
			
		||||
        $this->break = '';
 | 
			
		||||
        $this->open = '{';
 | 
			
		||||
        $this->close = '}';
 | 
			
		||||
        $this->tagSeparator = ',';
 | 
			
		||||
        $this->assignSeparator = ':';
 | 
			
		||||
        $this->keepSemicolons = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function blockLines(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        $inner = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        $glue = $this->break . $inner;
 | 
			
		||||
 | 
			
		||||
        foreach ($block->lines as $index => $line) {
 | 
			
		||||
            if (substr($line, 0, 2) === '/*' && substr($line, 2, 1) !== '!') {
 | 
			
		||||
                unset($block->lines[$index]);
 | 
			
		||||
            } elseif (substr($line, 0, 3) === '/*!') {
 | 
			
		||||
                $block->lines[$index] = '/*' . substr($line, 3);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->write($inner . implode($glue, $block->lines));
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->children)) {
 | 
			
		||||
            $this->write($this->break);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Output block selectors
 | 
			
		||||
     *
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
 | 
			
		||||
     */
 | 
			
		||||
    protected function blockSelectors(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        assert(! empty($block->selectors));
 | 
			
		||||
 | 
			
		||||
        $inner = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        $this->write(
 | 
			
		||||
            $inner
 | 
			
		||||
            . implode(
 | 
			
		||||
                $this->tagSeparator,
 | 
			
		||||
                str_replace([' > ', ' + ', ' ~ '], ['>', '+', '~'], $block->selectors)
 | 
			
		||||
            )
 | 
			
		||||
            . $this->open . $this->break
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,85 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Crunched formatter
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @deprecated since 1.4.0. Use the Compressed formatter instead.
 | 
			
		||||
 */
 | 
			
		||||
class Crunched extends Formatter
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        @trigger_error('The Crunched formatter is deprecated since 1.4.0. Use the Compressed formatter instead.', E_USER_DEPRECATED);
 | 
			
		||||
 | 
			
		||||
        $this->indentLevel = 0;
 | 
			
		||||
        $this->indentChar = '  ';
 | 
			
		||||
        $this->break = '';
 | 
			
		||||
        $this->open = '{';
 | 
			
		||||
        $this->close = '}';
 | 
			
		||||
        $this->tagSeparator = ',';
 | 
			
		||||
        $this->assignSeparator = ':';
 | 
			
		||||
        $this->keepSemicolons = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function blockLines(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        $inner = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        $glue = $this->break . $inner;
 | 
			
		||||
 | 
			
		||||
        foreach ($block->lines as $index => $line) {
 | 
			
		||||
            if (substr($line, 0, 2) === '/*') {
 | 
			
		||||
                unset($block->lines[$index]);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->write($inner . implode($glue, $block->lines));
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->children)) {
 | 
			
		||||
            $this->write($this->break);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Output block selectors
 | 
			
		||||
     *
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
 | 
			
		||||
     */
 | 
			
		||||
    protected function blockSelectors(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        assert(! empty($block->selectors));
 | 
			
		||||
 | 
			
		||||
        $inner = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        $this->write(
 | 
			
		||||
            $inner
 | 
			
		||||
            . implode(
 | 
			
		||||
                $this->tagSeparator,
 | 
			
		||||
                str_replace([' > ', ' + ', ' ~ '], ['>', '+', '~'], $block->selectors)
 | 
			
		||||
            )
 | 
			
		||||
            . $this->open . $this->break
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,125 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Debug formatter
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @deprecated since 1.4.0.
 | 
			
		||||
 */
 | 
			
		||||
class Debug extends Formatter
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        @trigger_error('The Debug formatter is deprecated since 1.4.0.', E_USER_DEPRECATED);
 | 
			
		||||
 | 
			
		||||
        $this->indentLevel = 0;
 | 
			
		||||
        $this->indentChar = '';
 | 
			
		||||
        $this->break = "\n";
 | 
			
		||||
        $this->open = ' {';
 | 
			
		||||
        $this->close = ' }';
 | 
			
		||||
        $this->tagSeparator = ', ';
 | 
			
		||||
        $this->assignSeparator = ': ';
 | 
			
		||||
        $this->keepSemicolons = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    protected function indentStr()
 | 
			
		||||
    {
 | 
			
		||||
        return str_repeat('  ', $this->indentLevel);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    protected function blockLines(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        $indent = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        if (empty($block->lines)) {
 | 
			
		||||
            $this->write("{$indent}block->lines: []\n");
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        foreach ($block->lines as $index => $line) {
 | 
			
		||||
            $this->write("{$indent}block->lines[{$index}]: $line\n");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    protected function blockSelectors(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        $indent = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        if (empty($block->selectors)) {
 | 
			
		||||
            $this->write("{$indent}block->selectors: []\n");
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        foreach ($block->selectors as $index => $selector) {
 | 
			
		||||
            $this->write("{$indent}block->selectors[{$index}]: $selector\n");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    protected function blockChildren(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        $indent = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        if (empty($block->children)) {
 | 
			
		||||
            $this->write("{$indent}block->children: []\n");
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->indentLevel++;
 | 
			
		||||
 | 
			
		||||
        foreach ($block->children as $i => $child) {
 | 
			
		||||
            $this->block($child);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->indentLevel--;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    protected function block(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        $indent = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        $this->write("{$indent}block->type: {$block->type}\n" .
 | 
			
		||||
             "{$indent}block->depth: {$block->depth}\n");
 | 
			
		||||
 | 
			
		||||
        $this->currentBlock = $block;
 | 
			
		||||
 | 
			
		||||
        $this->blockSelectors($block);
 | 
			
		||||
        $this->blockLines($block);
 | 
			
		||||
        $this->blockChildren($block);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,68 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Expanded formatter
 | 
			
		||||
 *
 | 
			
		||||
 * @author Leaf Corcoran <leafot@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
class Expanded extends Formatter
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        $this->indentLevel = 0;
 | 
			
		||||
        $this->indentChar = '  ';
 | 
			
		||||
        $this->break = "\n";
 | 
			
		||||
        $this->open = ' {';
 | 
			
		||||
        $this->close = '}';
 | 
			
		||||
        $this->tagSeparator = ', ';
 | 
			
		||||
        $this->assignSeparator = ': ';
 | 
			
		||||
        $this->keepSemicolons = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    protected function indentStr()
 | 
			
		||||
    {
 | 
			
		||||
        return str_repeat($this->indentChar, $this->indentLevel);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    protected function blockLines(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        $inner = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        $glue = $this->break . $inner;
 | 
			
		||||
 | 
			
		||||
        foreach ($block->lines as $index => $line) {
 | 
			
		||||
            if (substr($line, 0, 2) === '/*') {
 | 
			
		||||
                $block->lines[$index] = preg_replace('/\r\n?|\n|\f/', $this->break, $line);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->write($inner . implode($glue, $block->lines));
 | 
			
		||||
 | 
			
		||||
        if (empty($block->selectors) || ! empty($block->children)) {
 | 
			
		||||
            $this->write($this->break);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,234 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
use ScssPhp\ScssPhp\Type;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Nested formatter
 | 
			
		||||
 *
 | 
			
		||||
 * @author Leaf Corcoran <leafot@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @deprecated since 1.4.0. Use the Expanded formatter instead.
 | 
			
		||||
 */
 | 
			
		||||
class Nested extends Formatter
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     */
 | 
			
		||||
    private $depth;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        @trigger_error('The Nested formatter is deprecated since 1.4.0. Use the Expanded formatter instead.', E_USER_DEPRECATED);
 | 
			
		||||
 | 
			
		||||
        $this->indentLevel = 0;
 | 
			
		||||
        $this->indentChar = '  ';
 | 
			
		||||
        $this->break = "\n";
 | 
			
		||||
        $this->open = ' {';
 | 
			
		||||
        $this->close = ' }';
 | 
			
		||||
        $this->tagSeparator = ', ';
 | 
			
		||||
        $this->assignSeparator = ': ';
 | 
			
		||||
        $this->keepSemicolons = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    protected function indentStr()
 | 
			
		||||
    {
 | 
			
		||||
        $n = $this->depth - 1;
 | 
			
		||||
 | 
			
		||||
        return str_repeat($this->indentChar, max($this->indentLevel + $n, 0));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    protected function blockLines(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        $inner = $this->indentStr();
 | 
			
		||||
        $glue  = $this->break . $inner;
 | 
			
		||||
 | 
			
		||||
        foreach ($block->lines as $index => $line) {
 | 
			
		||||
            if (substr($line, 0, 2) === '/*') {
 | 
			
		||||
                $block->lines[$index] = preg_replace('/\r\n?|\n|\f/', $this->break, $line);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->write($inner . implode($glue, $block->lines));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    protected function block(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        static $depths;
 | 
			
		||||
        static $downLevel;
 | 
			
		||||
        static $closeBlock;
 | 
			
		||||
        static $previousEmpty;
 | 
			
		||||
        static $previousHasSelector;
 | 
			
		||||
 | 
			
		||||
        if ($block->type === 'root') {
 | 
			
		||||
            $depths = [ 0 ];
 | 
			
		||||
            $downLevel = '';
 | 
			
		||||
            $closeBlock = '';
 | 
			
		||||
            $this->depth = 0;
 | 
			
		||||
            $previousEmpty = false;
 | 
			
		||||
            $previousHasSelector = false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $isMediaOrDirective = \in_array($block->type, [Type::T_DIRECTIVE, Type::T_MEDIA]);
 | 
			
		||||
        $isSupport = ($block->type === Type::T_DIRECTIVE
 | 
			
		||||
            && $block->selectors && strpos(implode('', $block->selectors), '@supports') !== false);
 | 
			
		||||
 | 
			
		||||
        while ($block->depth < end($depths) || ($block->depth == 1 && end($depths) == 1)) {
 | 
			
		||||
            array_pop($depths);
 | 
			
		||||
            $this->depth--;
 | 
			
		||||
 | 
			
		||||
            if (
 | 
			
		||||
                ! $this->depth && ($block->depth <= 1 || (! $this->indentLevel && $block->type === Type::T_COMMENT)) &&
 | 
			
		||||
                (($block->selectors && ! $isMediaOrDirective) || $previousHasSelector)
 | 
			
		||||
            ) {
 | 
			
		||||
                $downLevel = $this->break;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (empty($block->lines) && empty($block->children)) {
 | 
			
		||||
                $previousEmpty = true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (empty($block->lines) && empty($block->children)) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->currentBlock = $block;
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->lines) || (! empty($block->children) && ($this->depth < 1 || $isSupport))) {
 | 
			
		||||
            if ($block->depth > end($depths)) {
 | 
			
		||||
                if (! $previousEmpty || $this->depth < 1) {
 | 
			
		||||
                    $this->depth++;
 | 
			
		||||
 | 
			
		||||
                    $depths[] = $block->depth;
 | 
			
		||||
                } else {
 | 
			
		||||
                    // keep the current depth unchanged but take the block depth as a new reference for following blocks
 | 
			
		||||
                    array_pop($depths);
 | 
			
		||||
 | 
			
		||||
                    $depths[] = $block->depth;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $previousEmpty = ($block->type === Type::T_COMMENT);
 | 
			
		||||
        $previousHasSelector = false;
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->selectors)) {
 | 
			
		||||
            if ($closeBlock) {
 | 
			
		||||
                $this->write($closeBlock);
 | 
			
		||||
                $closeBlock = '';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if ($downLevel) {
 | 
			
		||||
                $this->write($downLevel);
 | 
			
		||||
                $downLevel = '';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $this->blockSelectors($block);
 | 
			
		||||
 | 
			
		||||
            $this->indentLevel++;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->lines)) {
 | 
			
		||||
            if ($closeBlock) {
 | 
			
		||||
                $this->write($closeBlock);
 | 
			
		||||
                $closeBlock = '';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if ($downLevel) {
 | 
			
		||||
                $this->write($downLevel);
 | 
			
		||||
                $downLevel = '';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $this->blockLines($block);
 | 
			
		||||
 | 
			
		||||
            $closeBlock = $this->break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->children)) {
 | 
			
		||||
            if ($this->depth > 0 && ($isMediaOrDirective || ! $this->hasFlatChild($block))) {
 | 
			
		||||
                array_pop($depths);
 | 
			
		||||
 | 
			
		||||
                $this->depth--;
 | 
			
		||||
                $this->blockChildren($block);
 | 
			
		||||
                $this->depth++;
 | 
			
		||||
 | 
			
		||||
                $depths[] = $block->depth;
 | 
			
		||||
            } else {
 | 
			
		||||
                $this->blockChildren($block);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // reclear to not be spoiled by children if T_DIRECTIVE
 | 
			
		||||
        if ($block->type === Type::T_DIRECTIVE) {
 | 
			
		||||
            $previousHasSelector = false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->selectors)) {
 | 
			
		||||
            $this->indentLevel--;
 | 
			
		||||
 | 
			
		||||
            if (! $this->keepSemicolons) {
 | 
			
		||||
                $this->strippedSemicolon = '';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $this->write($this->close);
 | 
			
		||||
 | 
			
		||||
            $closeBlock = $this->break;
 | 
			
		||||
 | 
			
		||||
            if ($this->depth > 1 && ! empty($block->children)) {
 | 
			
		||||
                array_pop($depths);
 | 
			
		||||
                $this->depth--;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (! $isMediaOrDirective) {
 | 
			
		||||
                $previousHasSelector = true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($block->type === 'root') {
 | 
			
		||||
            $this->write($this->break);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Block has flat child
 | 
			
		||||
     *
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
 | 
			
		||||
     *
 | 
			
		||||
     * @return boolean
 | 
			
		||||
     */
 | 
			
		||||
    private function hasFlatChild($block)
 | 
			
		||||
    {
 | 
			
		||||
        foreach ($block->children as $child) {
 | 
			
		||||
            if (empty($child->selectors)) {
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,66 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Output block
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
class OutputBlock
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public $type;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     */
 | 
			
		||||
    public $depth;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array|null
 | 
			
		||||
     */
 | 
			
		||||
    public $selectors;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string[]
 | 
			
		||||
     */
 | 
			
		||||
    public $lines;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var OutputBlock[]
 | 
			
		||||
     */
 | 
			
		||||
    public $children;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var OutputBlock|null
 | 
			
		||||
     */
 | 
			
		||||
    public $parent;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string|null
 | 
			
		||||
     */
 | 
			
		||||
    public $sourceName;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer|null
 | 
			
		||||
     */
 | 
			
		||||
    public $sourceLine;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer|null
 | 
			
		||||
     */
 | 
			
		||||
    public $sourceColumn;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,48 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Logger;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Interface implemented by loggers for warnings and debug messages.
 | 
			
		||||
 *
 | 
			
		||||
 * The official Sass implementation recommends that loggers report the
 | 
			
		||||
 * messages immediately rather than waiting for the end of the
 | 
			
		||||
 * compilation, to provide a better debugging experience when the
 | 
			
		||||
 * compilation does not end (error or infinite loop after the warning
 | 
			
		||||
 * for instance).
 | 
			
		||||
 */
 | 
			
		||||
interface LoggerInterface
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Emits a warning with the given message.
 | 
			
		||||
     *
 | 
			
		||||
     * If $deprecation is true, it indicates that this is a deprecation
 | 
			
		||||
     * warning. Implementations should surface all this information to
 | 
			
		||||
     * the end user.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $message
 | 
			
		||||
     * @param bool  $deprecation
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function warn($message, $deprecation = false);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Emits a debugging message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $message
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function debug($message);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,27 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Logger;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * A logger that silently ignores all messages.
 | 
			
		||||
 */
 | 
			
		||||
class QuietLogger implements LoggerInterface
 | 
			
		||||
{
 | 
			
		||||
    public function warn($message, $deprecation = false)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function debug($message)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,57 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Logger;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * A logger that prints to a PHP stream (for instance stderr)
 | 
			
		||||
 */
 | 
			
		||||
class StreamLogger implements LoggerInterface
 | 
			
		||||
{
 | 
			
		||||
    private $stream;
 | 
			
		||||
    private $closeOnDestruct;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param resource $stream          A stream resource
 | 
			
		||||
     * @param bool     $closeOnDestruct If true, takes ownership of the stream and close it on destruct to avoid leaks.
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct($stream, $closeOnDestruct = false)
 | 
			
		||||
    {
 | 
			
		||||
        $this->stream = $stream;
 | 
			
		||||
        $this->closeOnDestruct = $closeOnDestruct;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function __destruct()
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->closeOnDestruct) {
 | 
			
		||||
            fclose($this->stream);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @inheritDoc
 | 
			
		||||
     */
 | 
			
		||||
    public function warn($message, $deprecation = false)
 | 
			
		||||
    {
 | 
			
		||||
        $prefix = ($deprecation ? 'DEPRECATION ' : '') . 'WARNING: ';
 | 
			
		||||
 | 
			
		||||
        fwrite($this->stream, $prefix . $message . "\n\n");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @inheritDoc
 | 
			
		||||
     */
 | 
			
		||||
    public function debug($message)
 | 
			
		||||
    {
 | 
			
		||||
        fwrite($this->stream, $message . "\n");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										41
									
								
								include/thirdparty/ScssPhp/ScssPhp141/Node.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										41
									
								
								include/thirdparty/ScssPhp/ScssPhp141/Node.php
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,41 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Base node
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
abstract class Node
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public $type;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     */
 | 
			
		||||
    public $sourceIndex;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var int|null
 | 
			
		||||
     */
 | 
			
		||||
    public $sourceLine;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var int|null
 | 
			
		||||
     */
 | 
			
		||||
    public $sourceColumn;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,800 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Node;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Base\Range;
 | 
			
		||||
use ScssPhp\ScssPhp\Compiler;
 | 
			
		||||
use ScssPhp\ScssPhp\Exception\RangeException;
 | 
			
		||||
use ScssPhp\ScssPhp\Exception\SassScriptException;
 | 
			
		||||
use ScssPhp\ScssPhp\Node;
 | 
			
		||||
use ScssPhp\ScssPhp\Type;
 | 
			
		||||
use ScssPhp\ScssPhp\Util;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Dimension + optional units
 | 
			
		||||
 *
 | 
			
		||||
 * {@internal
 | 
			
		||||
 *     This is a work-in-progress.
 | 
			
		||||
 *
 | 
			
		||||
 *     The \ArrayAccess interface is temporary until the migration is complete.
 | 
			
		||||
 * }}
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @template-implements \ArrayAccess<int, mixed>
 | 
			
		||||
 */
 | 
			
		||||
class Number extends Node implements \ArrayAccess
 | 
			
		||||
{
 | 
			
		||||
    const PRECISION = 10;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     * @deprecated use {Number::PRECISION} instead to read the precision. Configuring it is not supported anymore.
 | 
			
		||||
     */
 | 
			
		||||
    public static $precision = self::PRECISION;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @see http://www.w3.org/TR/2012/WD-css3-values-20120308/
 | 
			
		||||
     *
 | 
			
		||||
     * @var array
 | 
			
		||||
     * @phpstan-var array<string, array<string, float|int>>
 | 
			
		||||
     */
 | 
			
		||||
    protected static $unitTable = [
 | 
			
		||||
        'in' => [
 | 
			
		||||
            'in' => 1,
 | 
			
		||||
            'pc' => 6,
 | 
			
		||||
            'pt' => 72,
 | 
			
		||||
            'px' => 96,
 | 
			
		||||
            'cm' => 2.54,
 | 
			
		||||
            'mm' => 25.4,
 | 
			
		||||
            'q'  => 101.6,
 | 
			
		||||
        ],
 | 
			
		||||
        'turn' => [
 | 
			
		||||
            'deg'  => 360,
 | 
			
		||||
            'grad' => 400,
 | 
			
		||||
            'rad'  => 6.28318530717958647692528676, // 2 * M_PI
 | 
			
		||||
            'turn' => 1,
 | 
			
		||||
        ],
 | 
			
		||||
        's' => [
 | 
			
		||||
            's'  => 1,
 | 
			
		||||
            'ms' => 1000,
 | 
			
		||||
        ],
 | 
			
		||||
        'Hz' => [
 | 
			
		||||
            'Hz'  => 1,
 | 
			
		||||
            'kHz' => 0.001,
 | 
			
		||||
        ],
 | 
			
		||||
        'dpi' => [
 | 
			
		||||
            'dpi'  => 1,
 | 
			
		||||
            'dpcm' => 1 / 2.54,
 | 
			
		||||
            'dppx' => 1 / 96,
 | 
			
		||||
        ],
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer|float
 | 
			
		||||
     */
 | 
			
		||||
    private $dimension;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string[]
 | 
			
		||||
     * @phpstan-var list<string>
 | 
			
		||||
     */
 | 
			
		||||
    private $numeratorUnits;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string[]
 | 
			
		||||
     * @phpstan-var list<string>
 | 
			
		||||
     */
 | 
			
		||||
    private $denominatorUnits;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Initialize number
 | 
			
		||||
     *
 | 
			
		||||
     * @param integer|float   $dimension
 | 
			
		||||
     * @param string[]|string $numeratorUnits
 | 
			
		||||
     * @param string[]        $denominatorUnits
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-param list<string>|string $numeratorUnits
 | 
			
		||||
     * @phpstan-param list<string>        $denominatorUnits
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct($dimension, $numeratorUnits, array $denominatorUnits = [])
 | 
			
		||||
    {
 | 
			
		||||
        if (is_string($numeratorUnits)) {
 | 
			
		||||
            $numeratorUnits = $numeratorUnits ? [$numeratorUnits] : [];
 | 
			
		||||
        } elseif (isset($numeratorUnits['numerator_units'], $numeratorUnits['denominator_units'])) {
 | 
			
		||||
            // TODO get rid of this once `$number[2]` is not used anymore
 | 
			
		||||
            $denominatorUnits = $numeratorUnits['denominator_units'];
 | 
			
		||||
            $numeratorUnits = $numeratorUnits['numerator_units'];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->dimension = $dimension;
 | 
			
		||||
        $this->numeratorUnits = $numeratorUnits;
 | 
			
		||||
        $this->denominatorUnits = $denominatorUnits;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return float|int
 | 
			
		||||
     */
 | 
			
		||||
    public function getDimension()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->dimension;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return string[]
 | 
			
		||||
     */
 | 
			
		||||
    public function getNumeratorUnits()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->numeratorUnits;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return string[]
 | 
			
		||||
     */
 | 
			
		||||
    public function getDenominatorUnits()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->denominatorUnits;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function offsetExists($offset)
 | 
			
		||||
    {
 | 
			
		||||
        if ($offset === -3) {
 | 
			
		||||
            return ! \is_null($this->sourceColumn);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($offset === -2) {
 | 
			
		||||
            return ! \is_null($this->sourceLine);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (
 | 
			
		||||
            $offset === -1 ||
 | 
			
		||||
            $offset === 0 ||
 | 
			
		||||
            $offset === 1 ||
 | 
			
		||||
            $offset === 2
 | 
			
		||||
        ) {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function offsetGet($offset)
 | 
			
		||||
    {
 | 
			
		||||
        switch ($offset) {
 | 
			
		||||
            case -3:
 | 
			
		||||
                return $this->sourceColumn;
 | 
			
		||||
 | 
			
		||||
            case -2:
 | 
			
		||||
                return $this->sourceLine;
 | 
			
		||||
 | 
			
		||||
            case -1:
 | 
			
		||||
                return $this->sourceIndex;
 | 
			
		||||
 | 
			
		||||
            case 0:
 | 
			
		||||
                return Type::T_NUMBER;
 | 
			
		||||
 | 
			
		||||
            case 1:
 | 
			
		||||
                return $this->dimension;
 | 
			
		||||
 | 
			
		||||
            case 2:
 | 
			
		||||
                return array('numerator_units' => $this->numeratorUnits, 'denominator_units' => $this->denominatorUnits);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function offsetSet($offset, $value)
 | 
			
		||||
    {
 | 
			
		||||
        throw new \BadMethodCallException('Number is immutable');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function offsetUnset($offset)
 | 
			
		||||
    {
 | 
			
		||||
        throw new \BadMethodCallException('Number is immutable');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns true if the number is unitless
 | 
			
		||||
     *
 | 
			
		||||
     * @return boolean
 | 
			
		||||
     */
 | 
			
		||||
    public function unitless()
 | 
			
		||||
    {
 | 
			
		||||
        return \count($this->numeratorUnits) === 0 && \count($this->denominatorUnits) === 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Checks whether the number has exactly this unit
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $unit
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool
 | 
			
		||||
     */
 | 
			
		||||
    public function hasUnit($unit)
 | 
			
		||||
    {
 | 
			
		||||
        return \count($this->numeratorUnits) === 1 && \count($this->denominatorUnits) === 0 && $this->numeratorUnits[0] === $unit;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns unit(s) as the product of numerator units divided by the product of denominator units
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function unitStr()
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->unitless()) {
 | 
			
		||||
            return '';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return self::getUnitString($this->numeratorUnits, $this->denominatorUnits);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param float|int $min
 | 
			
		||||
     * @param float|int $max
 | 
			
		||||
     * @param string|null $name
 | 
			
		||||
     *
 | 
			
		||||
     * @return float|int
 | 
			
		||||
     * @throws SassScriptException
 | 
			
		||||
     */
 | 
			
		||||
    public function valueInRange($min, $max, $name = null)
 | 
			
		||||
    {
 | 
			
		||||
        try {
 | 
			
		||||
            return Util::checkRange('', new Range($min, $max), $this);
 | 
			
		||||
        } catch (RangeException $e) {
 | 
			
		||||
            throw SassScriptException::forArgument(sprintf('Expected %s to be within %s%s and %s%3$s', $this, $min, $this->unitStr(), $max), $name);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param string|null $varName
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function assertNoUnits($varName = null)
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->unitless()) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        throw SassScriptException::forArgument(sprintf('Expected %s to have no units.', $this), $varName);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param string      $unit
 | 
			
		||||
     * @param string|null $varName
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function assertUnit($unit, $varName = null)
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->hasUnit($unit)) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        throw SassScriptException::forArgument(sprintf('Expected %s to have unit "%s".', $this, $unit), $varName);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function assertSameUnitOrUnitless(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        if ($other->unitless()) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($this->numeratorUnits === $other->numeratorUnits && $this->denominatorUnits === $other->denominatorUnits) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        throw new SassScriptException(sprintf(
 | 
			
		||||
            'Incompatible units %s and %s.',
 | 
			
		||||
            self::getUnitString($this->numeratorUnits, $this->denominatorUnits),
 | 
			
		||||
            self::getUnitString($other->numeratorUnits, $other->denominatorUnits)
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns a copy of this number, converted to the units represented by $newNumeratorUnits and $newDenominatorUnits.
 | 
			
		||||
     *
 | 
			
		||||
     * This does not throw an error if this number is unitless and
 | 
			
		||||
     * $newNumeratorUnits/$newDenominatorUnits are not empty, or vice versa. Instead,
 | 
			
		||||
     * it treats all unitless numbers as convertible to and from all units without
 | 
			
		||||
     * changing the value.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string[] $newNumeratorUnits
 | 
			
		||||
     * @param string[] $newDenominatorUnits
 | 
			
		||||
     *
 | 
			
		||||
     * @return Number
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-param list<string> $newNumeratorUnits
 | 
			
		||||
     * @phpstan-param list<string> $newDenominatorUnits
 | 
			
		||||
     *
 | 
			
		||||
     * @throws SassScriptException if this number's units are not compatible with $newNumeratorUnits and $newDenominatorUnits
 | 
			
		||||
     */
 | 
			
		||||
    public function coerce(array $newNumeratorUnits, array $newDenominatorUnits)
 | 
			
		||||
    {
 | 
			
		||||
        return new Number($this->valueInUnits($newNumeratorUnits, $newDenominatorUnits), $newNumeratorUnits, $newDenominatorUnits);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool
 | 
			
		||||
     */
 | 
			
		||||
    public function isComparableTo(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->unitless() || $other->unitless()) {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            $this->greaterThan($other);
 | 
			
		||||
            return true;
 | 
			
		||||
        } catch (SassScriptException $e) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool
 | 
			
		||||
     */
 | 
			
		||||
    public function lessThan(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->coerceUnits($other, function ($num1, $num2) {
 | 
			
		||||
            return $num1 < $num2;
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool
 | 
			
		||||
     */
 | 
			
		||||
    public function lessThanOrEqual(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->coerceUnits($other, function ($num1, $num2) {
 | 
			
		||||
            return $num1 <= $num2;
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool
 | 
			
		||||
     */
 | 
			
		||||
    public function greaterThan(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->coerceUnits($other, function ($num1, $num2) {
 | 
			
		||||
            return $num1 > $num2;
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool
 | 
			
		||||
     */
 | 
			
		||||
    public function greaterThanOrEqual(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->coerceUnits($other, function ($num1, $num2) {
 | 
			
		||||
            return $num1 >= $num2;
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return Number
 | 
			
		||||
     */
 | 
			
		||||
    public function plus(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->coerceNumber($other, function ($num1, $num2) {
 | 
			
		||||
            return $num1 + $num2;
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return Number
 | 
			
		||||
     */
 | 
			
		||||
    public function minus(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->coerceNumber($other, function ($num1, $num2) {
 | 
			
		||||
            return $num1 - $num2;
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return Number
 | 
			
		||||
     */
 | 
			
		||||
    public function unaryMinus()
 | 
			
		||||
    {
 | 
			
		||||
        return new Number(-$this->dimension, $this->numeratorUnits, $this->denominatorUnits);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return Number
 | 
			
		||||
     */
 | 
			
		||||
    public function modulo(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->coerceNumber($other, function ($num1, $num2) {
 | 
			
		||||
            if ($num2 == 0) {
 | 
			
		||||
                return NAN;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $result = fmod($num1, $num2);
 | 
			
		||||
 | 
			
		||||
            if ($result == 0) {
 | 
			
		||||
                return 0;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if ($num2 < 0 xor $num1 < 0) {
 | 
			
		||||
                $result += $num2;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return $result;
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return Number
 | 
			
		||||
     */
 | 
			
		||||
    public function times(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->multiplyUnits($this->dimension * $other->dimension, $this->numeratorUnits, $this->denominatorUnits, $other->numeratorUnits, $other->denominatorUnits);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return Number
 | 
			
		||||
     */
 | 
			
		||||
    public function dividedBy(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        if ($other->dimension == 0) {
 | 
			
		||||
            if ($this->dimension == 0) {
 | 
			
		||||
                $value = NAN;
 | 
			
		||||
            } elseif ($this->dimension > 0) {
 | 
			
		||||
                $value = INF;
 | 
			
		||||
            } else {
 | 
			
		||||
                $value = -INF;
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            $value = $this->dimension / $other->dimension;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->multiplyUnits($value, $this->numeratorUnits, $this->denominatorUnits, $other->denominatorUnits, $other->numeratorUnits);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool
 | 
			
		||||
     */
 | 
			
		||||
    public function equals(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        // Unitless numbers are convertable to unit numbers, but not equal, so we special-case unitless here.
 | 
			
		||||
        if ($this->unitless() !== $other->unitless()) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // In Sass, neither NaN nor Infinity are equal to themselves, while PHP defines INF==INF
 | 
			
		||||
        if (is_nan($this->dimension) || is_nan($other->dimension) || !is_finite($this->dimension) || !is_finite($other->dimension)) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($this->unitless()) {
 | 
			
		||||
            return round($this->dimension, self::PRECISION) == round($other->dimension, self::PRECISION);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            return $this->coerceUnits($other, function ($num1, $num2) {
 | 
			
		||||
                return round($num1,self::PRECISION) == round($num2, self::PRECISION);
 | 
			
		||||
            });
 | 
			
		||||
        } catch (SassScriptException $e) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Output number
 | 
			
		||||
     *
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\Compiler $compiler
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function output(Compiler $compiler = null)
 | 
			
		||||
    {
 | 
			
		||||
        $dimension = round($this->dimension, self::PRECISION);
 | 
			
		||||
 | 
			
		||||
        if (is_nan($dimension)) {
 | 
			
		||||
            return 'NaN';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($dimension === INF) {
 | 
			
		||||
            return 'Infinity';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($dimension === -INF) {
 | 
			
		||||
            return '-Infinity';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($compiler) {
 | 
			
		||||
            $unit = $this->unitStr();
 | 
			
		||||
        } elseif (isset($this->numeratorUnits[0])) {
 | 
			
		||||
            $unit = $this->numeratorUnits[0];
 | 
			
		||||
        } else {
 | 
			
		||||
            $unit = '';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $dimension = number_format($dimension, self::PRECISION, '.', '');
 | 
			
		||||
 | 
			
		||||
        return rtrim(rtrim($dimension, '0'), '.') . $unit;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function __toString()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->output();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number   $other
 | 
			
		||||
     * @param callable $operation
 | 
			
		||||
     *
 | 
			
		||||
     * @return Number
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-param callable(int|float, int|float): (int|float) $operation
 | 
			
		||||
     */
 | 
			
		||||
    private function coerceNumber(Number $other, $operation)
 | 
			
		||||
    {
 | 
			
		||||
        $result = $this->coerceUnits($other, $operation);
 | 
			
		||||
 | 
			
		||||
        if (!$this->unitless()) {
 | 
			
		||||
            return new Number($result, $this->numeratorUnits, $this->denominatorUnits);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return new Number($result, $other->numeratorUnits, $other->denominatorUnits);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     * @param callable $operation
 | 
			
		||||
     *
 | 
			
		||||
     * @return mixed
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-template T
 | 
			
		||||
     * @phpstan-param callable(int|float, int|float): T $operation
 | 
			
		||||
     * @phpstan-return T
 | 
			
		||||
     */
 | 
			
		||||
    private function coerceUnits(Number $other, $operation)
 | 
			
		||||
    {
 | 
			
		||||
        if (!$this->unitless()) {
 | 
			
		||||
            $num1 = $this->dimension;
 | 
			
		||||
            $num2 = $other->valueInUnits($this->numeratorUnits, $this->denominatorUnits);
 | 
			
		||||
        } else {
 | 
			
		||||
            $num1 = $this->valueInUnits($other->numeratorUnits, $other->denominatorUnits);
 | 
			
		||||
            $num2 = $other->dimension;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return \call_user_func($operation, $num1, $num2);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param string[] $numeratorUnits
 | 
			
		||||
     * @param string[] $denominatorUnits
 | 
			
		||||
     *
 | 
			
		||||
     * @return int|float
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-param list<string> $numeratorUnits
 | 
			
		||||
     * @phpstan-param list<string> $denominatorUnits
 | 
			
		||||
     *
 | 
			
		||||
     * @throws SassScriptException if this number's units are not compatible with $numeratorUnits and $denominatorUnits
 | 
			
		||||
     */
 | 
			
		||||
    private function valueInUnits(array $numeratorUnits, array $denominatorUnits)
 | 
			
		||||
    {
 | 
			
		||||
        if (
 | 
			
		||||
            $this->unitless()
 | 
			
		||||
            || (\count($numeratorUnits) === 0 && \count($denominatorUnits) === 0)
 | 
			
		||||
            || ($this->numeratorUnits === $numeratorUnits && $this->denominatorUnits === $denominatorUnits)
 | 
			
		||||
        ) {
 | 
			
		||||
            return $this->dimension;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $value = $this->dimension;
 | 
			
		||||
        $oldNumerators = $this->numeratorUnits;
 | 
			
		||||
 | 
			
		||||
        foreach ($numeratorUnits as $newNumerator) {
 | 
			
		||||
            foreach ($oldNumerators as $key => $oldNumerator) {
 | 
			
		||||
                $conversionFactor = self::getConversionFactor($newNumerator, $oldNumerator);
 | 
			
		||||
 | 
			
		||||
                if (\is_null($conversionFactor)) {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $value *= $conversionFactor;
 | 
			
		||||
                unset($oldNumerators[$key]);
 | 
			
		||||
                continue 2;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            throw new SassScriptException(sprintf(
 | 
			
		||||
                'Incompatible units %s and %s.',
 | 
			
		||||
                self::getUnitString($this->numeratorUnits, $this->denominatorUnits),
 | 
			
		||||
                self::getUnitString($numeratorUnits, $denominatorUnits)
 | 
			
		||||
            ));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $oldDenominators = $this->denominatorUnits;
 | 
			
		||||
 | 
			
		||||
        foreach ($denominatorUnits as $newDenominator) {
 | 
			
		||||
            foreach ($oldDenominators as $key => $oldDenominator) {
 | 
			
		||||
                $conversionFactor = self::getConversionFactor($newDenominator, $oldDenominator);
 | 
			
		||||
 | 
			
		||||
                if (\is_null($conversionFactor)) {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $value /= $conversionFactor;
 | 
			
		||||
                unset($oldDenominators[$key]);
 | 
			
		||||
                continue 2;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            throw new SassScriptException(sprintf(
 | 
			
		||||
                'Incompatible units %s and %s.',
 | 
			
		||||
                self::getUnitString($this->numeratorUnits, $this->denominatorUnits),
 | 
			
		||||
                self::getUnitString($numeratorUnits, $denominatorUnits)
 | 
			
		||||
            ));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (\count($oldNumerators) || \count($oldDenominators)) {
 | 
			
		||||
            throw new SassScriptException(sprintf(
 | 
			
		||||
                'Incompatible units %s and %s.',
 | 
			
		||||
                self::getUnitString($this->numeratorUnits, $this->denominatorUnits),
 | 
			
		||||
                self::getUnitString($numeratorUnits, $denominatorUnits)
 | 
			
		||||
            ));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $value;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param int|float $value
 | 
			
		||||
     * @param string[] $numerators1
 | 
			
		||||
     * @param string[] $denominators1
 | 
			
		||||
     * @param string[] $numerators2
 | 
			
		||||
     * @param string[] $denominators2
 | 
			
		||||
     *
 | 
			
		||||
     * @return Number
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-param list<string> $numerators1
 | 
			
		||||
     * @phpstan-param list<string> $denominators1
 | 
			
		||||
     * @phpstan-param list<string> $numerators2
 | 
			
		||||
     * @phpstan-param list<string> $denominators2
 | 
			
		||||
     */
 | 
			
		||||
    private function multiplyUnits($value, array $numerators1, array $denominators1, array $numerators2, array $denominators2)
 | 
			
		||||
    {
 | 
			
		||||
        $newNumerators = array();
 | 
			
		||||
 | 
			
		||||
        foreach ($numerators1 as $numerator) {
 | 
			
		||||
            foreach ($denominators2 as $key => $denominator) {
 | 
			
		||||
                $conversionFactor = self::getConversionFactor($numerator, $denominator);
 | 
			
		||||
 | 
			
		||||
                if (\is_null($conversionFactor)) {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $value /= $conversionFactor;
 | 
			
		||||
                unset($denominators2[$key]);
 | 
			
		||||
                continue 2;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $newNumerators[] = $numerator;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        foreach ($numerators2 as $numerator) {
 | 
			
		||||
            foreach ($denominators1 as $key => $denominator) {
 | 
			
		||||
                $conversionFactor = self::getConversionFactor($numerator, $denominator);
 | 
			
		||||
 | 
			
		||||
                if (\is_null($conversionFactor)) {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $value /= $conversionFactor;
 | 
			
		||||
                unset($denominators1[$key]);
 | 
			
		||||
                continue 2;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $newNumerators[] = $numerator;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $newDenominators = array_values(array_merge($denominators1, $denominators2));
 | 
			
		||||
 | 
			
		||||
        return new Number($value, $newNumerators, $newDenominators);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the number of [unit1]s per [unit2].
 | 
			
		||||
     *
 | 
			
		||||
     * Equivalently, `1unit1 * conversionFactor(unit1, unit2) = 1unit2`.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $unit1
 | 
			
		||||
     * @param string $unit2
 | 
			
		||||
     *
 | 
			
		||||
     * @return float|int|null
 | 
			
		||||
     */
 | 
			
		||||
    private static function getConversionFactor($unit1, $unit2)
 | 
			
		||||
    {
 | 
			
		||||
        if ($unit1 === $unit2) {
 | 
			
		||||
            return 1;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        foreach (static::$unitTable as $unitVariants) {
 | 
			
		||||
            if (isset($unitVariants[$unit1]) && isset($unitVariants[$unit2])) {
 | 
			
		||||
                return $unitVariants[$unit1] / $unitVariants[$unit2];
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns unit(s) as the product of numerator units divided by the product of denominator units
 | 
			
		||||
     *
 | 
			
		||||
     * @param string[] $numerators
 | 
			
		||||
     * @param string[] $denominators
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-param list<string> $numerators
 | 
			
		||||
     * @phpstan-param list<string> $denominators
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    private static function getUnitString(array $numerators, array $denominators)
 | 
			
		||||
    {
 | 
			
		||||
        if (!\count($numerators)) {
 | 
			
		||||
            if (\count($denominators) === 0) {
 | 
			
		||||
                return 'no units';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (\count($denominators) === 1) {
 | 
			
		||||
                return $denominators[0] . '^-1';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return '(' . implode('*', $denominators) . ')^-1';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return implode('*', $numerators) . (\count($denominators) ? '/' . implode('*', $denominators) : '');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,9 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
final class OutputStyle
 | 
			
		||||
{
 | 
			
		||||
    const EXPANDED = 'expanded';
 | 
			
		||||
    const COMPRESSED = 'compressed';
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4103
									
								
								include/thirdparty/ScssPhp/ScssPhp141/Parser.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4103
									
								
								include/thirdparty/ScssPhp/ScssPhp141/Parser.php
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -1,185 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\SourceMap;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Base 64 Encode/Decode
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
class Base64
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array<int, string>
 | 
			
		||||
     */
 | 
			
		||||
    private static $encodingMap = [
 | 
			
		||||
        0 => 'A',
 | 
			
		||||
        1 => 'B',
 | 
			
		||||
        2 => 'C',
 | 
			
		||||
        3 => 'D',
 | 
			
		||||
        4 => 'E',
 | 
			
		||||
        5 => 'F',
 | 
			
		||||
        6 => 'G',
 | 
			
		||||
        7 => 'H',
 | 
			
		||||
        8 => 'I',
 | 
			
		||||
        9 => 'J',
 | 
			
		||||
        10 => 'K',
 | 
			
		||||
        11 => 'L',
 | 
			
		||||
        12 => 'M',
 | 
			
		||||
        13 => 'N',
 | 
			
		||||
        14 => 'O',
 | 
			
		||||
        15 => 'P',
 | 
			
		||||
        16 => 'Q',
 | 
			
		||||
        17 => 'R',
 | 
			
		||||
        18 => 'S',
 | 
			
		||||
        19 => 'T',
 | 
			
		||||
        20 => 'U',
 | 
			
		||||
        21 => 'V',
 | 
			
		||||
        22 => 'W',
 | 
			
		||||
        23 => 'X',
 | 
			
		||||
        24 => 'Y',
 | 
			
		||||
        25 => 'Z',
 | 
			
		||||
        26 => 'a',
 | 
			
		||||
        27 => 'b',
 | 
			
		||||
        28 => 'c',
 | 
			
		||||
        29 => 'd',
 | 
			
		||||
        30 => 'e',
 | 
			
		||||
        31 => 'f',
 | 
			
		||||
        32 => 'g',
 | 
			
		||||
        33 => 'h',
 | 
			
		||||
        34 => 'i',
 | 
			
		||||
        35 => 'j',
 | 
			
		||||
        36 => 'k',
 | 
			
		||||
        37 => 'l',
 | 
			
		||||
        38 => 'm',
 | 
			
		||||
        39 => 'n',
 | 
			
		||||
        40 => 'o',
 | 
			
		||||
        41 => 'p',
 | 
			
		||||
        42 => 'q',
 | 
			
		||||
        43 => 'r',
 | 
			
		||||
        44 => 's',
 | 
			
		||||
        45 => 't',
 | 
			
		||||
        46 => 'u',
 | 
			
		||||
        47 => 'v',
 | 
			
		||||
        48 => 'w',
 | 
			
		||||
        49 => 'x',
 | 
			
		||||
        50 => 'y',
 | 
			
		||||
        51 => 'z',
 | 
			
		||||
        52 => '0',
 | 
			
		||||
        53 => '1',
 | 
			
		||||
        54 => '2',
 | 
			
		||||
        55 => '3',
 | 
			
		||||
        56 => '4',
 | 
			
		||||
        57 => '5',
 | 
			
		||||
        58 => '6',
 | 
			
		||||
        59 => '7',
 | 
			
		||||
        60 => '8',
 | 
			
		||||
        61 => '9',
 | 
			
		||||
        62 => '+',
 | 
			
		||||
        63 => '/',
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array<string|int, int>
 | 
			
		||||
     */
 | 
			
		||||
    private static $decodingMap = [
 | 
			
		||||
        'A' => 0,
 | 
			
		||||
        'B' => 1,
 | 
			
		||||
        'C' => 2,
 | 
			
		||||
        'D' => 3,
 | 
			
		||||
        'E' => 4,
 | 
			
		||||
        'F' => 5,
 | 
			
		||||
        'G' => 6,
 | 
			
		||||
        'H' => 7,
 | 
			
		||||
        'I' => 8,
 | 
			
		||||
        'J' => 9,
 | 
			
		||||
        'K' => 10,
 | 
			
		||||
        'L' => 11,
 | 
			
		||||
        'M' => 12,
 | 
			
		||||
        'N' => 13,
 | 
			
		||||
        'O' => 14,
 | 
			
		||||
        'P' => 15,
 | 
			
		||||
        'Q' => 16,
 | 
			
		||||
        'R' => 17,
 | 
			
		||||
        'S' => 18,
 | 
			
		||||
        'T' => 19,
 | 
			
		||||
        'U' => 20,
 | 
			
		||||
        'V' => 21,
 | 
			
		||||
        'W' => 22,
 | 
			
		||||
        'X' => 23,
 | 
			
		||||
        'Y' => 24,
 | 
			
		||||
        'Z' => 25,
 | 
			
		||||
        'a' => 26,
 | 
			
		||||
        'b' => 27,
 | 
			
		||||
        'c' => 28,
 | 
			
		||||
        'd' => 29,
 | 
			
		||||
        'e' => 30,
 | 
			
		||||
        'f' => 31,
 | 
			
		||||
        'g' => 32,
 | 
			
		||||
        'h' => 33,
 | 
			
		||||
        'i' => 34,
 | 
			
		||||
        'j' => 35,
 | 
			
		||||
        'k' => 36,
 | 
			
		||||
        'l' => 37,
 | 
			
		||||
        'm' => 38,
 | 
			
		||||
        'n' => 39,
 | 
			
		||||
        'o' => 40,
 | 
			
		||||
        'p' => 41,
 | 
			
		||||
        'q' => 42,
 | 
			
		||||
        'r' => 43,
 | 
			
		||||
        's' => 44,
 | 
			
		||||
        't' => 45,
 | 
			
		||||
        'u' => 46,
 | 
			
		||||
        'v' => 47,
 | 
			
		||||
        'w' => 48,
 | 
			
		||||
        'x' => 49,
 | 
			
		||||
        'y' => 50,
 | 
			
		||||
        'z' => 51,
 | 
			
		||||
        0 => 52,
 | 
			
		||||
        1 => 53,
 | 
			
		||||
        2 => 54,
 | 
			
		||||
        3 => 55,
 | 
			
		||||
        4 => 56,
 | 
			
		||||
        5 => 57,
 | 
			
		||||
        6 => 58,
 | 
			
		||||
        7 => 59,
 | 
			
		||||
        8 => 60,
 | 
			
		||||
        9 => 61,
 | 
			
		||||
        '+' => 62,
 | 
			
		||||
        '/' => 63,
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Convert to base64
 | 
			
		||||
     *
 | 
			
		||||
     * @param integer $value
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public static function encode($value)
 | 
			
		||||
    {
 | 
			
		||||
        return self::$encodingMap[$value];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Convert from base64
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $value
 | 
			
		||||
     *
 | 
			
		||||
     * @return integer
 | 
			
		||||
     */
 | 
			
		||||
    public static function decode($value)
 | 
			
		||||
    {
 | 
			
		||||
        return self::$decodingMap[$value];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,149 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\SourceMap;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Base 64 VLQ
 | 
			
		||||
 *
 | 
			
		||||
 * Based on the Base 64 VLQ implementation in Closure Compiler:
 | 
			
		||||
 * https://github.com/google/closure-compiler/blob/master/src/com/google/debugging/sourcemap/Base64VLQ.java
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright 2011 The Closure Compiler Authors.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 *
 | 
			
		||||
 * @author John Lenz <johnlenz@google.com>
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
class Base64VLQ
 | 
			
		||||
{
 | 
			
		||||
    // A Base64 VLQ digit can represent 5 bits, so it is base-32.
 | 
			
		||||
    const VLQ_BASE_SHIFT = 5;
 | 
			
		||||
 | 
			
		||||
    // A mask of bits for a VLQ digit (11111), 31 decimal.
 | 
			
		||||
    const VLQ_BASE_MASK = 31;
 | 
			
		||||
 | 
			
		||||
    // The continuation bit is the 6th bit.
 | 
			
		||||
    const VLQ_CONTINUATION_BIT = 32;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the VLQ encoded value.
 | 
			
		||||
     *
 | 
			
		||||
     * @param integer $value
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public static function encode($value)
 | 
			
		||||
    {
 | 
			
		||||
        $encoded = '';
 | 
			
		||||
        $vlq = self::toVLQSigned($value);
 | 
			
		||||
 | 
			
		||||
        do {
 | 
			
		||||
            $digit = $vlq & self::VLQ_BASE_MASK;
 | 
			
		||||
 | 
			
		||||
            //$vlq >>>= self::VLQ_BASE_SHIFT; // unsigned right shift
 | 
			
		||||
            $vlq = (($vlq >> 1) & PHP_INT_MAX) >> (self::VLQ_BASE_SHIFT - 1);
 | 
			
		||||
 | 
			
		||||
            if ($vlq > 0) {
 | 
			
		||||
                $digit |= self::VLQ_CONTINUATION_BIT;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $encoded .= Base64::encode($digit);
 | 
			
		||||
        } while ($vlq > 0);
 | 
			
		||||
 | 
			
		||||
        return $encoded;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Decodes VLQValue.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $str
 | 
			
		||||
     * @param integer $index
 | 
			
		||||
     *
 | 
			
		||||
     * @return integer
 | 
			
		||||
     */
 | 
			
		||||
    public static function decode($str, &$index)
 | 
			
		||||
    {
 | 
			
		||||
        $result = 0;
 | 
			
		||||
        $shift = 0;
 | 
			
		||||
 | 
			
		||||
        do {
 | 
			
		||||
            $c = $str[$index++];
 | 
			
		||||
            $digit = Base64::decode($c);
 | 
			
		||||
            $continuation = ($digit & self::VLQ_CONTINUATION_BIT) != 0;
 | 
			
		||||
            $digit &= self::VLQ_BASE_MASK;
 | 
			
		||||
            $result = $result + ($digit << $shift);
 | 
			
		||||
            $shift = $shift + self::VLQ_BASE_SHIFT;
 | 
			
		||||
        } while ($continuation);
 | 
			
		||||
 | 
			
		||||
        return self::fromVLQSigned($result);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Converts from a two-complement value to a value where the sign bit is
 | 
			
		||||
     * 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)
 | 
			
		||||
     *
 | 
			
		||||
     * @param integer $value
 | 
			
		||||
     *
 | 
			
		||||
     * @return integer
 | 
			
		||||
     */
 | 
			
		||||
    private static function toVLQSigned($value)
 | 
			
		||||
    {
 | 
			
		||||
        if ($value < 0) {
 | 
			
		||||
            return ((-$value) << 1) + 1;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return ($value << 1) + 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Converts to a two-complement value from a value where the sign bit is
 | 
			
		||||
     * 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
 | 
			
		||||
     *
 | 
			
		||||
     * @param integer $value
 | 
			
		||||
     *
 | 
			
		||||
     * @return integer
 | 
			
		||||
     */
 | 
			
		||||
    private static function fromVLQSigned($value)
 | 
			
		||||
    {
 | 
			
		||||
        $negate = ($value & 1) === 1;
 | 
			
		||||
 | 
			
		||||
        //$value >>>= 1; // unsigned right shift
 | 
			
		||||
        $value = ($value >> 1) & PHP_INT_MAX;
 | 
			
		||||
 | 
			
		||||
        if (! $negate) {
 | 
			
		||||
            return $value;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // We need to OR 0x80000000 here to ensure the 32nd bit (the sign bit) is
 | 
			
		||||
        // always set for negative numbers. If `value` were 1, (meaning `negate` is
 | 
			
		||||
        // true and all other bits were zeros), `value` would now be 0. -0 is just
 | 
			
		||||
        // 0, and doesn't flip the 32nd bit as intended. All positive numbers will
 | 
			
		||||
        // successfully flip the 32nd bit without issue, so it's a noop for them.
 | 
			
		||||
        return -$value | 0x80000000;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,379 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\SourceMap;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Exception\CompilerException;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Source Map Generator
 | 
			
		||||
 *
 | 
			
		||||
 * {@internal Derivative of oyejorge/less.php's lib/SourceMap/Generator.php, relicensed with permission. }}
 | 
			
		||||
 *
 | 
			
		||||
 * @author Josh Schmidt <oyejorge@gmail.com>
 | 
			
		||||
 * @author Nicolas FRANÇOIS <nicolas.francois@frog-labs.com>
 | 
			
		||||
 */
 | 
			
		||||
class SourceMapGenerator
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * What version of source map does the generator generate?
 | 
			
		||||
     */
 | 
			
		||||
    const VERSION = 3;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Array of default options
 | 
			
		||||
     *
 | 
			
		||||
     * @var array
 | 
			
		||||
     * @phpstan-var array{sourceRoot: string, sourceMapFilename: string|null, sourceMapURL: string|null, sourceMapWriteTo: string|null, outputSourceFiles: bool, sourceMapRootpath: string, sourceMapBasepath: string}
 | 
			
		||||
     */
 | 
			
		||||
    protected $defaultOptions = [
 | 
			
		||||
        // an optional source root, useful for relocating source files
 | 
			
		||||
        // on a server or removing repeated values in the 'sources' entry.
 | 
			
		||||
        // This value is prepended to the individual entries in the 'source' field.
 | 
			
		||||
        'sourceRoot' => '',
 | 
			
		||||
 | 
			
		||||
        // an optional name of the generated code that this source map is associated with.
 | 
			
		||||
        'sourceMapFilename' => null,
 | 
			
		||||
 | 
			
		||||
        // url of the map
 | 
			
		||||
        'sourceMapURL' => null,
 | 
			
		||||
 | 
			
		||||
        // absolute path to a file to write the map to
 | 
			
		||||
        'sourceMapWriteTo' => null,
 | 
			
		||||
 | 
			
		||||
        // output source contents?
 | 
			
		||||
        'outputSourceFiles' => false,
 | 
			
		||||
 | 
			
		||||
        // base path for filename normalization
 | 
			
		||||
        'sourceMapRootpath' => '',
 | 
			
		||||
 | 
			
		||||
        // base path for filename normalization
 | 
			
		||||
        'sourceMapBasepath' => ''
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The base64 VLQ encoder
 | 
			
		||||
     *
 | 
			
		||||
     * @var \ScssPhp\ScssPhp\SourceMap\Base64VLQ
 | 
			
		||||
     */
 | 
			
		||||
    protected $encoder;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Array of mappings
 | 
			
		||||
     *
 | 
			
		||||
     * @var array
 | 
			
		||||
     * @phpstan-var list<array{generated_line: int, generated_column: int, original_line: int, original_column: int, source_file: string}>
 | 
			
		||||
     */
 | 
			
		||||
    protected $mappings = [];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Array of contents map
 | 
			
		||||
     *
 | 
			
		||||
     * @var array
 | 
			
		||||
     */
 | 
			
		||||
    protected $contentsMap = [];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * File to content map
 | 
			
		||||
     *
 | 
			
		||||
     * @var array<string, string>
 | 
			
		||||
     */
 | 
			
		||||
    protected $sources = [];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array<string, int>
 | 
			
		||||
     */
 | 
			
		||||
    protected $sourceKeys = [];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array
 | 
			
		||||
     * @phpstan-var array{sourceRoot: string, sourceMapFilename: string|null, sourceMapURL: string|null, sourceMapWriteTo: string|null, outputSourceFiles: bool, sourceMapRootpath: string, sourceMapBasepath: string}
 | 
			
		||||
     */
 | 
			
		||||
    private $options;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @phpstan-param array{sourceRoot?: string, sourceMapFilename?: string|null, sourceMapURL?: string|null, sourceMapWriteTo?: string|null, outputSourceFiles?: bool, sourceMapRootpath?: string, sourceMapBasepath?: string} $options
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct(array $options = [])
 | 
			
		||||
    {
 | 
			
		||||
        $this->options = array_merge($this->defaultOptions, $options);
 | 
			
		||||
        $this->encoder = new Base64VLQ();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Adds a mapping
 | 
			
		||||
     *
 | 
			
		||||
     * @param integer $generatedLine   The line number in generated file
 | 
			
		||||
     * @param integer $generatedColumn The column number in generated file
 | 
			
		||||
     * @param integer $originalLine    The line number in original file
 | 
			
		||||
     * @param integer $originalColumn  The column number in original file
 | 
			
		||||
     * @param string  $sourceFile      The original source file
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function addMapping($generatedLine, $generatedColumn, $originalLine, $originalColumn, $sourceFile)
 | 
			
		||||
    {
 | 
			
		||||
        $this->mappings[] = [
 | 
			
		||||
            'generated_line'   => $generatedLine,
 | 
			
		||||
            'generated_column' => $generatedColumn,
 | 
			
		||||
            'original_line'    => $originalLine,
 | 
			
		||||
            'original_column'  => $originalColumn,
 | 
			
		||||
            'source_file'      => $sourceFile
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        $this->sources[$sourceFile] = $sourceFile;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Saves the source map to a file
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $content The content to write
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     *
 | 
			
		||||
     * @throws \ScssPhp\ScssPhp\Exception\CompilerException If the file could not be saved
 | 
			
		||||
     * @deprecated
 | 
			
		||||
     */
 | 
			
		||||
    public function saveMap($content)
 | 
			
		||||
    {
 | 
			
		||||
        $file = $this->options['sourceMapWriteTo'];
 | 
			
		||||
        $dir  = \dirname($file);
 | 
			
		||||
 | 
			
		||||
        // directory does not exist
 | 
			
		||||
        if (! is_dir($dir)) {
 | 
			
		||||
            // FIXME: create the dir automatically?
 | 
			
		||||
            throw new CompilerException(
 | 
			
		||||
                sprintf('The directory "%s" does not exist. Cannot save the source map.', $dir)
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // FIXME: proper saving, with dir write check!
 | 
			
		||||
        if (file_put_contents($file, $content) === false) {
 | 
			
		||||
            throw new CompilerException(sprintf('Cannot save the source map to "%s"', $file));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->options['sourceMapURL'];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Generates the JSON source map
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $prefix A prefix added in the output file, which needs to shift mappings
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     *
 | 
			
		||||
     * @see https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#
 | 
			
		||||
     */
 | 
			
		||||
    public function generateJson($prefix = '')
 | 
			
		||||
    {
 | 
			
		||||
        $sourceMap = [];
 | 
			
		||||
        $mappings  = $this->generateMappings($prefix);
 | 
			
		||||
 | 
			
		||||
        // File version (always the first entry in the object) and must be a positive integer.
 | 
			
		||||
        $sourceMap['version'] = self::VERSION;
 | 
			
		||||
 | 
			
		||||
        // An optional name of the generated code that this source map is associated with.
 | 
			
		||||
        $file = $this->options['sourceMapFilename'];
 | 
			
		||||
 | 
			
		||||
        if ($file) {
 | 
			
		||||
            $sourceMap['file'] = $file;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // An optional source root, useful for relocating source files on a server or removing repeated values in the
 | 
			
		||||
        // 'sources' entry. This value is prepended to the individual entries in the 'source' field.
 | 
			
		||||
        $root = $this->options['sourceRoot'];
 | 
			
		||||
 | 
			
		||||
        if ($root) {
 | 
			
		||||
            $sourceMap['sourceRoot'] = $root;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // A list of original sources used by the 'mappings' entry.
 | 
			
		||||
        $sourceMap['sources'] = [];
 | 
			
		||||
 | 
			
		||||
        foreach ($this->sources as $sourceUri => $sourceFilename) {
 | 
			
		||||
            $sourceMap['sources'][] = $this->normalizeFilename($sourceFilename);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // A list of symbol names used by the 'mappings' entry.
 | 
			
		||||
        $sourceMap['names'] = [];
 | 
			
		||||
 | 
			
		||||
        // A string with the encoded mapping data.
 | 
			
		||||
        $sourceMap['mappings'] = $mappings;
 | 
			
		||||
 | 
			
		||||
        if ($this->options['outputSourceFiles']) {
 | 
			
		||||
            // An optional list of source content, useful when the 'source' can't be hosted.
 | 
			
		||||
            // The contents are listed in the same order as the sources above.
 | 
			
		||||
            // 'null' may be used if some original sources should be retrieved by name.
 | 
			
		||||
            $sourceMap['sourcesContent'] = $this->getSourcesContent();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // less.js compat fixes
 | 
			
		||||
        if (\count($sourceMap['sources']) && empty($sourceMap['sourceRoot'])) {
 | 
			
		||||
            unset($sourceMap['sourceRoot']);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return json_encode($sourceMap, JSON_UNESCAPED_SLASHES);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the sources contents
 | 
			
		||||
     *
 | 
			
		||||
     * @return string[]|null
 | 
			
		||||
     */
 | 
			
		||||
    protected function getSourcesContent()
 | 
			
		||||
    {
 | 
			
		||||
        if (empty($this->sources)) {
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $content = [];
 | 
			
		||||
 | 
			
		||||
        foreach ($this->sources as $sourceFile) {
 | 
			
		||||
            $content[] = file_get_contents($sourceFile);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $content;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Generates the mappings string
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $prefix A prefix added in the output file, which needs to shift mappings
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function generateMappings($prefix = '')
 | 
			
		||||
    {
 | 
			
		||||
        if (! \count($this->mappings)) {
 | 
			
		||||
            return '';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $prefixLines = substr_count($prefix, "\n");
 | 
			
		||||
        $lastPrefixNewLine = strrpos($prefix, "\n");
 | 
			
		||||
        $lastPrefixLineStart = false === $lastPrefixNewLine ? 0 : $lastPrefixNewLine + 1;
 | 
			
		||||
        $prefixColumn = strlen($prefix) - $lastPrefixLineStart;
 | 
			
		||||
 | 
			
		||||
        $this->sourceKeys = array_flip(array_keys($this->sources));
 | 
			
		||||
 | 
			
		||||
        // group mappings by generated line number.
 | 
			
		||||
        $groupedMap = $groupedMapEncoded = [];
 | 
			
		||||
 | 
			
		||||
        foreach ($this->mappings as $m) {
 | 
			
		||||
            $groupedMap[$m['generated_line']][] = $m;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        ksort($groupedMap);
 | 
			
		||||
 | 
			
		||||
        $lastGeneratedLine = $lastOriginalIndex = $lastOriginalLine = $lastOriginalColumn = 0;
 | 
			
		||||
 | 
			
		||||
        foreach ($groupedMap as $lineNumber => $lineMap) {
 | 
			
		||||
            if ($lineNumber > 1) {
 | 
			
		||||
                // The prefix only impacts the column for the first line of the original output
 | 
			
		||||
                $prefixColumn = 0;
 | 
			
		||||
            }
 | 
			
		||||
            $lineNumber += $prefixLines;
 | 
			
		||||
 | 
			
		||||
            while (++$lastGeneratedLine < $lineNumber) {
 | 
			
		||||
                $groupedMapEncoded[] = ';';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $lineMapEncoded = [];
 | 
			
		||||
            $lastGeneratedColumn = 0;
 | 
			
		||||
 | 
			
		||||
            foreach ($lineMap as $m) {
 | 
			
		||||
                $generatedColumn = $m['generated_column'] + $prefixColumn;
 | 
			
		||||
 | 
			
		||||
                $mapEncoded = $this->encoder->encode($generatedColumn - $lastGeneratedColumn);
 | 
			
		||||
                $lastGeneratedColumn = $generatedColumn;
 | 
			
		||||
 | 
			
		||||
                // find the index
 | 
			
		||||
                if ($m['source_file']) {
 | 
			
		||||
                    $index = $this->findFileIndex($m['source_file']);
 | 
			
		||||
 | 
			
		||||
                    if ($index !== false) {
 | 
			
		||||
                        $mapEncoded .= $this->encoder->encode($index - $lastOriginalIndex);
 | 
			
		||||
                        $lastOriginalIndex = $index;
 | 
			
		||||
                        // lines are stored 0-based in SourceMap spec version 3
 | 
			
		||||
                        $mapEncoded .= $this->encoder->encode($m['original_line'] - 1 - $lastOriginalLine);
 | 
			
		||||
                        $lastOriginalLine = $m['original_line'] - 1;
 | 
			
		||||
                        $mapEncoded .= $this->encoder->encode($m['original_column'] - $lastOriginalColumn);
 | 
			
		||||
                        $lastOriginalColumn = $m['original_column'];
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $lineMapEncoded[] = $mapEncoded;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $groupedMapEncoded[] = implode(',', $lineMapEncoded) . ';';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return rtrim(implode($groupedMapEncoded), ';');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Finds the index for the filename
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $filename
 | 
			
		||||
     *
 | 
			
		||||
     * @return integer|false
 | 
			
		||||
     */
 | 
			
		||||
    protected function findFileIndex($filename)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->sourceKeys[$filename];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Normalize filename
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $filename
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    protected function normalizeFilename($filename)
 | 
			
		||||
    {
 | 
			
		||||
        $filename = $this->fixWindowsPath($filename);
 | 
			
		||||
        $rootpath = $this->options['sourceMapRootpath'];
 | 
			
		||||
        $basePath = $this->options['sourceMapBasepath'];
 | 
			
		||||
 | 
			
		||||
        // "Trim" the 'sourceMapBasepath' from the output filename.
 | 
			
		||||
        if (\strlen($basePath) && strpos($filename, $basePath) === 0) {
 | 
			
		||||
            $filename = substr($filename, \strlen($basePath));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Remove extra leading path separators.
 | 
			
		||||
        if (strpos($filename, '\\') === 0 || strpos($filename, '/') === 0) {
 | 
			
		||||
            $filename = substr($filename, 1);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $rootpath . $filename;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Fix windows paths
 | 
			
		||||
     *
 | 
			
		||||
     * @param string  $path
 | 
			
		||||
     * @param boolean $addEndSlash
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function fixWindowsPath($path, $addEndSlash = false)
 | 
			
		||||
    {
 | 
			
		||||
        $slash = ($addEndSlash) ? '/' : '';
 | 
			
		||||
 | 
			
		||||
        if (! empty($path)) {
 | 
			
		||||
            $path = str_replace('\\', '/', $path);
 | 
			
		||||
            $path = rtrim($path, '/') . $slash;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $path;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										76
									
								
								include/thirdparty/ScssPhp/ScssPhp141/Type.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										76
									
								
								include/thirdparty/ScssPhp/ScssPhp141/Type.php
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,76 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Block/node types
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
class Type
 | 
			
		||||
{
 | 
			
		||||
    const T_ASSIGN = 'assign';
 | 
			
		||||
    const T_AT_ROOT = 'at-root';
 | 
			
		||||
    const T_BLOCK = 'block';
 | 
			
		||||
    /** @deprecated */
 | 
			
		||||
    const T_BREAK = 'break';
 | 
			
		||||
    const T_CHARSET = 'charset';
 | 
			
		||||
    const T_COLOR = 'color';
 | 
			
		||||
    const T_COMMENT = 'comment';
 | 
			
		||||
    /** @deprecated */
 | 
			
		||||
    const T_CONTINUE = 'continue';
 | 
			
		||||
    /** @deprecated */
 | 
			
		||||
    const T_CONTROL = 'control';
 | 
			
		||||
    const T_CUSTOM_PROPERTY = 'custom';
 | 
			
		||||
    const T_DEBUG = 'debug';
 | 
			
		||||
    const T_DIRECTIVE = 'directive';
 | 
			
		||||
    const T_EACH = 'each';
 | 
			
		||||
    const T_ELSE = 'else';
 | 
			
		||||
    const T_ELSEIF = 'elseif';
 | 
			
		||||
    const T_ERROR = 'error';
 | 
			
		||||
    const T_EXPRESSION = 'exp';
 | 
			
		||||
    const T_EXTEND = 'extend';
 | 
			
		||||
    const T_FOR = 'for';
 | 
			
		||||
    const T_FUNCTION = 'function';
 | 
			
		||||
    const T_FUNCTION_REFERENCE = 'function-reference';
 | 
			
		||||
    const T_FUNCTION_CALL = 'fncall';
 | 
			
		||||
    const T_HSL = 'hsl';
 | 
			
		||||
    const T_HWB = 'hwb';
 | 
			
		||||
    const T_IF = 'if';
 | 
			
		||||
    const T_IMPORT = 'import';
 | 
			
		||||
    const T_INCLUDE = 'include';
 | 
			
		||||
    const T_INTERPOLATE = 'interpolate';
 | 
			
		||||
    const T_INTERPOLATED = 'interpolated';
 | 
			
		||||
    const T_KEYWORD = 'keyword';
 | 
			
		||||
    const T_LIST = 'list';
 | 
			
		||||
    const T_MAP = 'map';
 | 
			
		||||
    const T_MEDIA = 'media';
 | 
			
		||||
    const T_MEDIA_EXPRESSION = 'mediaExp';
 | 
			
		||||
    const T_MEDIA_TYPE = 'mediaType';
 | 
			
		||||
    const T_MEDIA_VALUE = 'mediaValue';
 | 
			
		||||
    const T_MIXIN = 'mixin';
 | 
			
		||||
    const T_MIXIN_CONTENT = 'mixin_content';
 | 
			
		||||
    const T_NESTED_PROPERTY = 'nestedprop';
 | 
			
		||||
    const T_NOT = 'not';
 | 
			
		||||
    const T_NULL = 'null';
 | 
			
		||||
    const T_NUMBER = 'number';
 | 
			
		||||
    const T_RETURN = 'return';
 | 
			
		||||
    const T_ROOT = 'root';
 | 
			
		||||
    const T_SCSSPHP_IMPORT_ONCE = 'scssphp-import-once';
 | 
			
		||||
    const T_SELF = 'self';
 | 
			
		||||
    const T_STRING = 'string';
 | 
			
		||||
    const T_UNARY = 'unary';
 | 
			
		||||
    const T_VARIABLE = 'var';
 | 
			
		||||
    const T_WARN = 'warn';
 | 
			
		||||
    const T_WHILE = 'while';
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										182
									
								
								include/thirdparty/ScssPhp/ScssPhp141/Util.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										182
									
								
								include/thirdparty/ScssPhp/ScssPhp141/Util.php
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,182 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Base\Range;
 | 
			
		||||
use ScssPhp\ScssPhp\Exception\RangeException;
 | 
			
		||||
use ScssPhp\ScssPhp\Node\Number;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Utility functions
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
class Util
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Asserts that `value` falls within `range` (inclusive), leaving
 | 
			
		||||
     * room for slight floating-point errors.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string       $name  The name of the value. Used in the error message.
 | 
			
		||||
     * @param Range        $range Range of values.
 | 
			
		||||
     * @param array|Number $value The value to check.
 | 
			
		||||
     * @param string       $unit  The unit of the value. Used in error reporting.
 | 
			
		||||
     *
 | 
			
		||||
     * @return mixed `value` adjusted to fall within range, if it was outside by a floating-point margin.
 | 
			
		||||
     *
 | 
			
		||||
     * @throws \ScssPhp\ScssPhp\Exception\RangeException
 | 
			
		||||
     */
 | 
			
		||||
    public static function checkRange($name, Range $range, $value, $unit = '')
 | 
			
		||||
    {
 | 
			
		||||
        $val = $value[1];
 | 
			
		||||
        $grace = new Range(-0.00001, 0.00001);
 | 
			
		||||
 | 
			
		||||
        if (! \is_numeric($val)) {
 | 
			
		||||
            throw new RangeException("$name {$val} is not a number.");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($range->includes($val)) {
 | 
			
		||||
            return $val;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($grace->includes($val - $range->first)) {
 | 
			
		||||
            return $range->first;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($grace->includes($val - $range->last)) {
 | 
			
		||||
            return $range->last;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        throw new RangeException("$name {$val} must be between {$range->first} and {$range->last}$unit");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Encode URI component
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $string
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public static function encodeURIComponent($string)
 | 
			
		||||
    {
 | 
			
		||||
        $revert = ['%21' => '!', '%2A' => '*', '%27' => "'", '%28' => '(', '%29' => ')'];
 | 
			
		||||
 | 
			
		||||
        return strtr(rawurlencode($string), $revert);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * mb_chr() wrapper
 | 
			
		||||
     *
 | 
			
		||||
     * @param integer $code
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public static function mbChr($code)
 | 
			
		||||
    {
 | 
			
		||||
        // Use the native implementation if available, but not on PHP 7.2 as mb_chr(0) is buggy there
 | 
			
		||||
        if (\PHP_VERSION_ID > 70300 && \function_exists('mb_chr')) {
 | 
			
		||||
            return mb_chr($code, 'UTF-8');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (0x80 > $code %= 0x200000) {
 | 
			
		||||
            $s = \chr($code);
 | 
			
		||||
        } elseif (0x800 > $code) {
 | 
			
		||||
            $s = \chr(0xC0 | $code >> 6) . \chr(0x80 | $code & 0x3F);
 | 
			
		||||
        } elseif (0x10000 > $code) {
 | 
			
		||||
            $s = \chr(0xE0 | $code >> 12) . \chr(0x80 | $code >> 6 & 0x3F) . \chr(0x80 | $code & 0x3F);
 | 
			
		||||
        } else {
 | 
			
		||||
            $s = \chr(0xF0 | $code >> 18) . \chr(0x80 | $code >> 12 & 0x3F)
 | 
			
		||||
                . \chr(0x80 | $code >> 6 & 0x3F) . \chr(0x80 | $code & 0x3F);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $s;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * mb_strlen() wrapper
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $string
 | 
			
		||||
     * @return int
 | 
			
		||||
     */
 | 
			
		||||
    public static function mbStrlen($string)
 | 
			
		||||
    {
 | 
			
		||||
        // Use the native implementation if available.
 | 
			
		||||
        if (\function_exists('mb_strlen')) {
 | 
			
		||||
            return mb_strlen($string, 'UTF-8');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (\function_exists('iconv_strlen')) {
 | 
			
		||||
            return (int) @iconv_strlen($string, 'UTF-8');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        throw new \LogicException('Either mbstring (recommended) or iconv is necessary to use Scssphp.');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * mb_substr() wrapper
 | 
			
		||||
     * @param string $string
 | 
			
		||||
     * @param int $start
 | 
			
		||||
     * @param null|int $length
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public static function mbSubstr($string, $start, $length = null)
 | 
			
		||||
    {
 | 
			
		||||
        // Use the native implementation if available.
 | 
			
		||||
        if (\function_exists('mb_substr')) {
 | 
			
		||||
            return mb_substr($string, $start, $length, 'UTF-8');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (\function_exists('iconv_substr')) {
 | 
			
		||||
            if ($start < 0) {
 | 
			
		||||
                $start = static::mbStrlen($string) + $start;
 | 
			
		||||
                if ($start < 0) {
 | 
			
		||||
                    $start = 0;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (null === $length) {
 | 
			
		||||
                $length = 2147483647;
 | 
			
		||||
            } elseif ($length < 0) {
 | 
			
		||||
                $length = static::mbStrlen($string) + $length - $start;
 | 
			
		||||
                if ($length < 0) {
 | 
			
		||||
                    return '';
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return (string)iconv_substr($string, $start, $length, 'UTF-8');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        throw new \LogicException('Either mbstring (recommended) or iconv is necessary to use Scssphp.');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * mb_strpos wrapper
 | 
			
		||||
     * @param string $haystack
 | 
			
		||||
     * @param string $needle
 | 
			
		||||
     * @param int $offset
 | 
			
		||||
     *
 | 
			
		||||
     * @return int|false
 | 
			
		||||
     */
 | 
			
		||||
    public static function mbStrpos($haystack, $needle, $offset = 0)
 | 
			
		||||
    {
 | 
			
		||||
        if (\function_exists('mb_strpos')) {
 | 
			
		||||
            return mb_strpos($haystack, $needle, $offset, 'UTF-8');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (\function_exists('iconv_strpos')) {
 | 
			
		||||
            return iconv_strpos($haystack, $needle, $offset, 'UTF-8');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        throw new \LogicException('Either mbstring (recommended) or iconv is necessary to use Scssphp.');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,77 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Util;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class Path
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @param string $path
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool
 | 
			
		||||
     */
 | 
			
		||||
    public static function isAbsolute($path)
 | 
			
		||||
    {
 | 
			
		||||
        if ($path === '') {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($path[0] === '/') {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (\DIRECTORY_SEPARATOR !== '\\') {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($path[0] === '\\') {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (\strlen($path) < 3) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($path[1] !== ':') {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($path[2] !== '/' && $path[2] !== '\\') {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!preg_match('/^[A-Za-z]$/', $path[0])) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param string $part1
 | 
			
		||||
     * @param string $part2
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public static function join($part1, $part2)
 | 
			
		||||
    {
 | 
			
		||||
        if ($part1 === '' || self::isAbsolute($part2)) {
 | 
			
		||||
            return $part2;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($part2 === '') {
 | 
			
		||||
            return $part1;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $last = $part1[\strlen($part1) - 1];
 | 
			
		||||
        $separator = \DIRECTORY_SEPARATOR;
 | 
			
		||||
 | 
			
		||||
        if ($last === '/' || $last === \DIRECTORY_SEPARATOR) {
 | 
			
		||||
            $separator = '';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $part1 . $separator . $part2;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,23 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP version
 | 
			
		||||
 *
 | 
			
		||||
 * @author Leaf Corcoran <leafot@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
class Version
 | 
			
		||||
{
 | 
			
		||||
    const VERSION = '1.4.1';
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										84
									
								
								include/thirdparty/ScssPhp/ScssPhp141/Warn.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										84
									
								
								include/thirdparty/ScssPhp/ScssPhp141/Warn.php
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,84 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
final class Warn
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var callable|null
 | 
			
		||||
     * @phpstan-var (callable(string, bool): void)|null
 | 
			
		||||
     */
 | 
			
		||||
    private static $callback;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Prints a warning message associated with the current `@import` or function call.
 | 
			
		||||
     *
 | 
			
		||||
     * This may only be called within a custom function or importer callback.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $message
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public static function warning($message)
 | 
			
		||||
    {
 | 
			
		||||
        self::reportWarning($message, false);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Prints a deprecation warning message associated with the current `@import` or function call.
 | 
			
		||||
     *
 | 
			
		||||
     * This may only be called within a custom function or importer callback.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $message
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public static function deprecation($message)
 | 
			
		||||
    {
 | 
			
		||||
        self::reportWarning($message, true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param callable|null $callback
 | 
			
		||||
     *
 | 
			
		||||
     * @return callable|null The previous warn callback
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-param (callable(string, bool): void)|null $callback
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-return (callable(string, bool): void)|null
 | 
			
		||||
     *
 | 
			
		||||
     * @internal
 | 
			
		||||
     */
 | 
			
		||||
    public static function setCallback(callable $callback = null)
 | 
			
		||||
    {
 | 
			
		||||
        $previousCallback = self::$callback;
 | 
			
		||||
        self::$callback = $callback;
 | 
			
		||||
 | 
			
		||||
        return $previousCallback;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param string $message
 | 
			
		||||
     * @param bool   $deprecation
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    private static function reportWarning($message, $deprecation)
 | 
			
		||||
    {
 | 
			
		||||
        if (self::$callback === null) {
 | 
			
		||||
            throw new \BadMethodCallException('The warning Reporter may only be called within a custom function or importer callback.');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        \call_user_func(self::$callback, $message, $deprecation);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,57 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2015-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Base;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Range
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class Range
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var float|int
 | 
			
		||||
     */
 | 
			
		||||
    public $first;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var float|int
 | 
			
		||||
     */
 | 
			
		||||
    public $last;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Initialize range
 | 
			
		||||
     *
 | 
			
		||||
     * @param integer|float $first
 | 
			
		||||
     * @param integer|float $last
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct($first, $last)
 | 
			
		||||
    {
 | 
			
		||||
        $this->first = $first;
 | 
			
		||||
        $this->last = $last;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Test for inclusion in range
 | 
			
		||||
     *
 | 
			
		||||
     * @param integer|float $value
 | 
			
		||||
     *
 | 
			
		||||
     * @return boolean
 | 
			
		||||
     */
 | 
			
		||||
    public function includes($value)
 | 
			
		||||
    {
 | 
			
		||||
        return $value >= $this->first && $value <= $this->last;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										73
									
								
								include/thirdparty/ScssPhp/Scssphp181/Block.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										73
									
								
								include/thirdparty/ScssPhp/Scssphp181/Block.php
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,73 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Block
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class Block
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public $type;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var \ScssPhp\ScssPhp\Block
 | 
			
		||||
     */
 | 
			
		||||
    public $parent;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public $sourceName;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     */
 | 
			
		||||
    public $sourceIndex;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     */
 | 
			
		||||
    public $sourceLine;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     */
 | 
			
		||||
    public $sourceColumn;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array|null
 | 
			
		||||
     */
 | 
			
		||||
    public $selectors;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array
 | 
			
		||||
     */
 | 
			
		||||
    public $comments;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array
 | 
			
		||||
     */
 | 
			
		||||
    public $children;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var \ScssPhp\ScssPhp\Block|null
 | 
			
		||||
     */
 | 
			
		||||
    public $selfParent;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										272
									
								
								include/thirdparty/ScssPhp/Scssphp181/Cache.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										272
									
								
								include/thirdparty/ScssPhp/Scssphp181/Cache.php
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,272 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
use Exception;
 | 
			
		||||
use ScssPhp\ScssPhp\Version;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * The scss cache manager.
 | 
			
		||||
 *
 | 
			
		||||
 * In short:
 | 
			
		||||
 *
 | 
			
		||||
 * allow to put in cache/get from cache a generic result from a known operation on a generic dataset,
 | 
			
		||||
 * taking in account options that affects the result
 | 
			
		||||
 *
 | 
			
		||||
 * The cache manager is agnostic about data format and only the operation is expected to be described by string
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSS cache
 | 
			
		||||
 *
 | 
			
		||||
 * @author Cedric Morin <cedric@yterium.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class Cache
 | 
			
		||||
{
 | 
			
		||||
    const CACHE_VERSION = 1;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * directory used for storing data
 | 
			
		||||
     *
 | 
			
		||||
     * @var string|false
 | 
			
		||||
     */
 | 
			
		||||
    public static $cacheDir = false;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * prefix for the storing data
 | 
			
		||||
     *
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public static $prefix = 'scssphp_';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * force a refresh : 'once' for refreshing the first hit on a cache only, true to never use the cache in this hit
 | 
			
		||||
     *
 | 
			
		||||
     * @var bool|string
 | 
			
		||||
     */
 | 
			
		||||
    public static $forceRefresh = false;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * specifies the number of seconds after which data cached will be seen as 'garbage' and potentially cleaned up
 | 
			
		||||
     *
 | 
			
		||||
     * @var int
 | 
			
		||||
     */
 | 
			
		||||
    public static $gcLifetime = 604800;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * array of already refreshed cache if $forceRefresh==='once'
 | 
			
		||||
     *
 | 
			
		||||
     * @var array<string, bool>
 | 
			
		||||
     */
 | 
			
		||||
    protected static $refreshed = [];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructor
 | 
			
		||||
     *
 | 
			
		||||
     * @param array $options
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-param array{cacheDir?: string, prefix?: string, forceRefresh?: string} $options
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct($options)
 | 
			
		||||
    {
 | 
			
		||||
        // check $cacheDir
 | 
			
		||||
        if (isset($options['cacheDir'])) {
 | 
			
		||||
            self::$cacheDir = $options['cacheDir'];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (empty(self::$cacheDir)) {
 | 
			
		||||
            throw new Exception('cacheDir not set');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (isset($options['prefix'])) {
 | 
			
		||||
            self::$prefix = $options['prefix'];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (empty(self::$prefix)) {
 | 
			
		||||
            throw new Exception('prefix not set');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (isset($options['forceRefresh'])) {
 | 
			
		||||
            self::$forceRefresh = $options['forceRefresh'];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        self::checkCacheDir();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the cached result of $operation on $what,
 | 
			
		||||
     * which is known as dependant from the content of $options
 | 
			
		||||
     *
 | 
			
		||||
     * @param string   $operation    parse, compile...
 | 
			
		||||
     * @param mixed    $what         content key (e.g., filename to be treated)
 | 
			
		||||
     * @param array    $options      any option that affect the operation result on the content
 | 
			
		||||
     * @param int|null $lastModified last modified timestamp
 | 
			
		||||
     *
 | 
			
		||||
     * @return mixed
 | 
			
		||||
     *
 | 
			
		||||
     * @throws \Exception
 | 
			
		||||
     */
 | 
			
		||||
    public function getCache($operation, $what, $options = [], $lastModified = null)
 | 
			
		||||
    {
 | 
			
		||||
        $fileCache = self::$cacheDir . self::cacheName($operation, $what, $options);
 | 
			
		||||
 | 
			
		||||
        if (
 | 
			
		||||
            ((self::$forceRefresh === false) || (self::$forceRefresh === 'once' &&
 | 
			
		||||
            isset(self::$refreshed[$fileCache]))) && file_exists($fileCache)
 | 
			
		||||
        ) {
 | 
			
		||||
            $cacheTime = filemtime($fileCache);
 | 
			
		||||
 | 
			
		||||
            if (
 | 
			
		||||
                (\is_null($lastModified) || $cacheTime > $lastModified) &&
 | 
			
		||||
                $cacheTime + self::$gcLifetime > time()
 | 
			
		||||
            ) {
 | 
			
		||||
                $c = file_get_contents($fileCache);
 | 
			
		||||
                $c = unserialize($c);
 | 
			
		||||
 | 
			
		||||
                if (\is_array($c) && isset($c['value'])) {
 | 
			
		||||
                    return $c['value'];
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Put in cache the result of $operation on $what,
 | 
			
		||||
     * which is known as dependant from the content of $options
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $operation
 | 
			
		||||
     * @param mixed  $what
 | 
			
		||||
     * @param mixed  $value
 | 
			
		||||
     * @param array  $options
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function setCache($operation, $what, $value, $options = [])
 | 
			
		||||
    {
 | 
			
		||||
        $fileCache = self::$cacheDir . self::cacheName($operation, $what, $options);
 | 
			
		||||
 | 
			
		||||
        $c = ['value' => $value];
 | 
			
		||||
        $c = serialize($c);
 | 
			
		||||
 | 
			
		||||
        file_put_contents($fileCache, $c);
 | 
			
		||||
 | 
			
		||||
        if (self::$forceRefresh === 'once') {
 | 
			
		||||
            self::$refreshed[$fileCache] = true;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the cache name for the caching of $operation on $what,
 | 
			
		||||
     * which is known as dependant from the content of $options
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $operation
 | 
			
		||||
     * @param mixed  $what
 | 
			
		||||
     * @param array  $options
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    private static function cacheName($operation, $what, $options = [])
 | 
			
		||||
    {
 | 
			
		||||
        $t = [
 | 
			
		||||
          'version' => self::CACHE_VERSION,
 | 
			
		||||
          'scssphpVersion' => Version::VERSION,
 | 
			
		||||
          'operation' => $operation,
 | 
			
		||||
          'what' => $what,
 | 
			
		||||
          'options' => $options
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        $t = self::$prefix
 | 
			
		||||
          . sha1(json_encode($t))
 | 
			
		||||
          . ".$operation"
 | 
			
		||||
          . ".scsscache";
 | 
			
		||||
 | 
			
		||||
        return $t;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Check that the cache dir exists and is writeable
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     *
 | 
			
		||||
     * @throws \Exception
 | 
			
		||||
     */
 | 
			
		||||
    public static function checkCacheDir()
 | 
			
		||||
    {
 | 
			
		||||
        self::$cacheDir = str_replace('\\', '/', self::$cacheDir);
 | 
			
		||||
        self::$cacheDir = rtrim(self::$cacheDir, '/') . '/';
 | 
			
		||||
 | 
			
		||||
        if (! is_dir(self::$cacheDir)) {
 | 
			
		||||
            throw new Exception('Cache directory doesn\'t exist: ' . self::$cacheDir);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (! is_writable(self::$cacheDir)) {
 | 
			
		||||
            throw new Exception('Cache directory isn\'t writable: ' . self::$cacheDir);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Delete unused cached files
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public static function cleanCache()
 | 
			
		||||
    {
 | 
			
		||||
        static $clean = false;
 | 
			
		||||
 | 
			
		||||
        if ($clean || empty(self::$cacheDir)) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $clean = true;
 | 
			
		||||
 | 
			
		||||
        // only remove files with extensions created by SCSSPHP Cache
 | 
			
		||||
        // css files removed based on the list files
 | 
			
		||||
        $removeTypes = ['scsscache' => 1];
 | 
			
		||||
 | 
			
		||||
        $files = scandir(self::$cacheDir);
 | 
			
		||||
 | 
			
		||||
        if (! $files) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $checkTime = time() - self::$gcLifetime;
 | 
			
		||||
 | 
			
		||||
        foreach ($files as $file) {
 | 
			
		||||
            // don't delete if the file wasn't created with SCSSPHP Cache
 | 
			
		||||
            if (strpos($file, self::$prefix) !== 0) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $parts = explode('.', $file);
 | 
			
		||||
            $type = array_pop($parts);
 | 
			
		||||
 | 
			
		||||
            if (! isset($removeTypes[$type])) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $fullPath = self::$cacheDir . $file;
 | 
			
		||||
            $mtime = filemtime($fullPath);
 | 
			
		||||
 | 
			
		||||
            // don't delete if it's a relatively new file
 | 
			
		||||
            if ($mtime > $checkTime) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            unlink($fullPath);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										247
									
								
								include/thirdparty/ScssPhp/Scssphp181/Colors.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										247
									
								
								include/thirdparty/ScssPhp/Scssphp181/Colors.php
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,247 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * CSS Colors
 | 
			
		||||
 *
 | 
			
		||||
 * @author Leaf Corcoran <leafot@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class Colors
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * CSS Colors
 | 
			
		||||
     *
 | 
			
		||||
     * @see http://www.w3.org/TR/css3-color
 | 
			
		||||
     *
 | 
			
		||||
     * @var array<string, string>
 | 
			
		||||
     */
 | 
			
		||||
    protected static $cssColors = [
 | 
			
		||||
        'aliceblue' => '240,248,255',
 | 
			
		||||
        'antiquewhite' => '250,235,215',
 | 
			
		||||
        'aqua' => '0,255,255',
 | 
			
		||||
        'cyan' => '0,255,255',
 | 
			
		||||
        'aquamarine' => '127,255,212',
 | 
			
		||||
        'azure' => '240,255,255',
 | 
			
		||||
        'beige' => '245,245,220',
 | 
			
		||||
        'bisque' => '255,228,196',
 | 
			
		||||
        'black' => '0,0,0',
 | 
			
		||||
        'blanchedalmond' => '255,235,205',
 | 
			
		||||
        'blue' => '0,0,255',
 | 
			
		||||
        'blueviolet' => '138,43,226',
 | 
			
		||||
        'brown' => '165,42,42',
 | 
			
		||||
        'burlywood' => '222,184,135',
 | 
			
		||||
        'cadetblue' => '95,158,160',
 | 
			
		||||
        'chartreuse' => '127,255,0',
 | 
			
		||||
        'chocolate' => '210,105,30',
 | 
			
		||||
        'coral' => '255,127,80',
 | 
			
		||||
        'cornflowerblue' => '100,149,237',
 | 
			
		||||
        'cornsilk' => '255,248,220',
 | 
			
		||||
        'crimson' => '220,20,60',
 | 
			
		||||
        'darkblue' => '0,0,139',
 | 
			
		||||
        'darkcyan' => '0,139,139',
 | 
			
		||||
        'darkgoldenrod' => '184,134,11',
 | 
			
		||||
        'darkgray' => '169,169,169',
 | 
			
		||||
        'darkgrey' => '169,169,169',
 | 
			
		||||
        'darkgreen' => '0,100,0',
 | 
			
		||||
        'darkkhaki' => '189,183,107',
 | 
			
		||||
        'darkmagenta' => '139,0,139',
 | 
			
		||||
        'darkolivegreen' => '85,107,47',
 | 
			
		||||
        'darkorange' => '255,140,0',
 | 
			
		||||
        'darkorchid' => '153,50,204',
 | 
			
		||||
        'darkred' => '139,0,0',
 | 
			
		||||
        'darksalmon' => '233,150,122',
 | 
			
		||||
        'darkseagreen' => '143,188,143',
 | 
			
		||||
        'darkslateblue' => '72,61,139',
 | 
			
		||||
        'darkslategray' => '47,79,79',
 | 
			
		||||
        'darkslategrey' => '47,79,79',
 | 
			
		||||
        'darkturquoise' => '0,206,209',
 | 
			
		||||
        'darkviolet' => '148,0,211',
 | 
			
		||||
        'deeppink' => '255,20,147',
 | 
			
		||||
        'deepskyblue' => '0,191,255',
 | 
			
		||||
        'dimgray' => '105,105,105',
 | 
			
		||||
        'dimgrey' => '105,105,105',
 | 
			
		||||
        'dodgerblue' => '30,144,255',
 | 
			
		||||
        'firebrick' => '178,34,34',
 | 
			
		||||
        'floralwhite' => '255,250,240',
 | 
			
		||||
        'forestgreen' => '34,139,34',
 | 
			
		||||
        'fuchsia' => '255,0,255',
 | 
			
		||||
        'magenta' => '255,0,255',
 | 
			
		||||
        'gainsboro' => '220,220,220',
 | 
			
		||||
        'ghostwhite' => '248,248,255',
 | 
			
		||||
        'gold' => '255,215,0',
 | 
			
		||||
        'goldenrod' => '218,165,32',
 | 
			
		||||
        'gray' => '128,128,128',
 | 
			
		||||
        'grey' => '128,128,128',
 | 
			
		||||
        'green' => '0,128,0',
 | 
			
		||||
        'greenyellow' => '173,255,47',
 | 
			
		||||
        'honeydew' => '240,255,240',
 | 
			
		||||
        'hotpink' => '255,105,180',
 | 
			
		||||
        'indianred' => '205,92,92',
 | 
			
		||||
        'indigo' => '75,0,130',
 | 
			
		||||
        'ivory' => '255,255,240',
 | 
			
		||||
        'khaki' => '240,230,140',
 | 
			
		||||
        'lavender' => '230,230,250',
 | 
			
		||||
        'lavenderblush' => '255,240,245',
 | 
			
		||||
        'lawngreen' => '124,252,0',
 | 
			
		||||
        'lemonchiffon' => '255,250,205',
 | 
			
		||||
        'lightblue' => '173,216,230',
 | 
			
		||||
        'lightcoral' => '240,128,128',
 | 
			
		||||
        'lightcyan' => '224,255,255',
 | 
			
		||||
        'lightgoldenrodyellow' => '250,250,210',
 | 
			
		||||
        'lightgray' => '211,211,211',
 | 
			
		||||
        'lightgrey' => '211,211,211',
 | 
			
		||||
        'lightgreen' => '144,238,144',
 | 
			
		||||
        'lightpink' => '255,182,193',
 | 
			
		||||
        'lightsalmon' => '255,160,122',
 | 
			
		||||
        'lightseagreen' => '32,178,170',
 | 
			
		||||
        'lightskyblue' => '135,206,250',
 | 
			
		||||
        'lightslategray' => '119,136,153',
 | 
			
		||||
        'lightslategrey' => '119,136,153',
 | 
			
		||||
        'lightsteelblue' => '176,196,222',
 | 
			
		||||
        'lightyellow' => '255,255,224',
 | 
			
		||||
        'lime' => '0,255,0',
 | 
			
		||||
        'limegreen' => '50,205,50',
 | 
			
		||||
        'linen' => '250,240,230',
 | 
			
		||||
        'maroon' => '128,0,0',
 | 
			
		||||
        'mediumaquamarine' => '102,205,170',
 | 
			
		||||
        'mediumblue' => '0,0,205',
 | 
			
		||||
        'mediumorchid' => '186,85,211',
 | 
			
		||||
        'mediumpurple' => '147,112,219',
 | 
			
		||||
        'mediumseagreen' => '60,179,113',
 | 
			
		||||
        'mediumslateblue' => '123,104,238',
 | 
			
		||||
        'mediumspringgreen' => '0,250,154',
 | 
			
		||||
        'mediumturquoise' => '72,209,204',
 | 
			
		||||
        'mediumvioletred' => '199,21,133',
 | 
			
		||||
        'midnightblue' => '25,25,112',
 | 
			
		||||
        'mintcream' => '245,255,250',
 | 
			
		||||
        'mistyrose' => '255,228,225',
 | 
			
		||||
        'moccasin' => '255,228,181',
 | 
			
		||||
        'navajowhite' => '255,222,173',
 | 
			
		||||
        'navy' => '0,0,128',
 | 
			
		||||
        'oldlace' => '253,245,230',
 | 
			
		||||
        'olive' => '128,128,0',
 | 
			
		||||
        'olivedrab' => '107,142,35',
 | 
			
		||||
        'orange' => '255,165,0',
 | 
			
		||||
        'orangered' => '255,69,0',
 | 
			
		||||
        'orchid' => '218,112,214',
 | 
			
		||||
        'palegoldenrod' => '238,232,170',
 | 
			
		||||
        'palegreen' => '152,251,152',
 | 
			
		||||
        'paleturquoise' => '175,238,238',
 | 
			
		||||
        'palevioletred' => '219,112,147',
 | 
			
		||||
        'papayawhip' => '255,239,213',
 | 
			
		||||
        'peachpuff' => '255,218,185',
 | 
			
		||||
        'peru' => '205,133,63',
 | 
			
		||||
        'pink' => '255,192,203',
 | 
			
		||||
        'plum' => '221,160,221',
 | 
			
		||||
        'powderblue' => '176,224,230',
 | 
			
		||||
        'purple' => '128,0,128',
 | 
			
		||||
        'red' => '255,0,0',
 | 
			
		||||
        'rosybrown' => '188,143,143',
 | 
			
		||||
        'royalblue' => '65,105,225',
 | 
			
		||||
        'saddlebrown' => '139,69,19',
 | 
			
		||||
        'salmon' => '250,128,114',
 | 
			
		||||
        'sandybrown' => '244,164,96',
 | 
			
		||||
        'seagreen' => '46,139,87',
 | 
			
		||||
        'seashell' => '255,245,238',
 | 
			
		||||
        'sienna' => '160,82,45',
 | 
			
		||||
        'silver' => '192,192,192',
 | 
			
		||||
        'skyblue' => '135,206,235',
 | 
			
		||||
        'slateblue' => '106,90,205',
 | 
			
		||||
        'slategray' => '112,128,144',
 | 
			
		||||
        'slategrey' => '112,128,144',
 | 
			
		||||
        'snow' => '255,250,250',
 | 
			
		||||
        'springgreen' => '0,255,127',
 | 
			
		||||
        'steelblue' => '70,130,180',
 | 
			
		||||
        'tan' => '210,180,140',
 | 
			
		||||
        'teal' => '0,128,128',
 | 
			
		||||
        'thistle' => '216,191,216',
 | 
			
		||||
        'tomato' => '255,99,71',
 | 
			
		||||
        'turquoise' => '64,224,208',
 | 
			
		||||
        'violet' => '238,130,238',
 | 
			
		||||
        'wheat' => '245,222,179',
 | 
			
		||||
        'white' => '255,255,255',
 | 
			
		||||
        'whitesmoke' => '245,245,245',
 | 
			
		||||
        'yellow' => '255,255,0',
 | 
			
		||||
        'yellowgreen' => '154,205,50',
 | 
			
		||||
        'rebeccapurple' => '102,51,153',
 | 
			
		||||
        'transparent' => '0,0,0,0',
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Convert named color in a [r,g,b[,a]] array
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $colorName
 | 
			
		||||
     *
 | 
			
		||||
     * @return int[]|null
 | 
			
		||||
     */
 | 
			
		||||
    public static function colorNameToRGBa($colorName)
 | 
			
		||||
    {
 | 
			
		||||
        if (\is_string($colorName) && isset(static::$cssColors[$colorName])) {
 | 
			
		||||
            $rgba = explode(',', static::$cssColors[$colorName]);
 | 
			
		||||
 | 
			
		||||
            // only case with opacity is transparent, with opacity=0, so we can intval on opacity also
 | 
			
		||||
            $rgba = array_map('intval', $rgba);
 | 
			
		||||
 | 
			
		||||
            return $rgba;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Reverse conversion : from RGBA to a color name if possible
 | 
			
		||||
     *
 | 
			
		||||
     * @param integer $r
 | 
			
		||||
     * @param integer $g
 | 
			
		||||
     * @param integer $b
 | 
			
		||||
     * @param integer|float $a
 | 
			
		||||
     *
 | 
			
		||||
     * @return string|null
 | 
			
		||||
     */
 | 
			
		||||
    public static function RGBaToColorName($r, $g, $b, $a = 1)
 | 
			
		||||
    {
 | 
			
		||||
        static $reverseColorTable = null;
 | 
			
		||||
 | 
			
		||||
        if (! is_numeric($r) || ! is_numeric($g) || ! is_numeric($b) || ! is_numeric($a)) {
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($a < 1) {
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (\is_null($reverseColorTable)) {
 | 
			
		||||
            $reverseColorTable = [];
 | 
			
		||||
 | 
			
		||||
            foreach (static::$cssColors as $name => $rgb_str) {
 | 
			
		||||
                $rgb_str = explode(',', $rgb_str);
 | 
			
		||||
 | 
			
		||||
                if (
 | 
			
		||||
                    \count($rgb_str) == 3 &&
 | 
			
		||||
                    ! isset($reverseColorTable[\intval($rgb_str[0])][\intval($rgb_str[1])][\intval($rgb_str[2])])
 | 
			
		||||
                ) {
 | 
			
		||||
                    $reverseColorTable[\intval($rgb_str[0])][\intval($rgb_str[1])][\intval($rgb_str[2])] = $name;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (isset($reverseColorTable[\intval($r)][\intval($g)][\intval($b)])) {
 | 
			
		||||
            return $reverseColorTable[\intval($r)][\intval($g)][\intval($b)];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,69 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
class CompilationResult
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    private $css;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string|null
 | 
			
		||||
     */
 | 
			
		||||
    private $sourceMap;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string[]
 | 
			
		||||
     */
 | 
			
		||||
    private $includedFiles;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param string $css
 | 
			
		||||
     * @param string|null $sourceMap
 | 
			
		||||
     * @param string[] $includedFiles
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct($css, $sourceMap, array $includedFiles)
 | 
			
		||||
    {
 | 
			
		||||
        $this->css = $css;
 | 
			
		||||
        $this->sourceMap = $sourceMap;
 | 
			
		||||
        $this->includedFiles = $includedFiles;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function getCss()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->css;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return string[]
 | 
			
		||||
     */
 | 
			
		||||
    public function getIncludedFiles()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->includedFiles;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The sourceMap content, if it was generated
 | 
			
		||||
     *
 | 
			
		||||
     * @return null|string
 | 
			
		||||
     */
 | 
			
		||||
    public function getSourceMap()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->sourceMap;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										10087
									
								
								include/thirdparty/ScssPhp/Scssphp181/Compiler.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10087
									
								
								include/thirdparty/ScssPhp/Scssphp181/Compiler.php
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -1,77 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Compiler;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\CompilationResult;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class CachedResult
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var CompilationResult
 | 
			
		||||
     */
 | 
			
		||||
    private $result;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array<string, int>
 | 
			
		||||
     */
 | 
			
		||||
    private $parsedFiles;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array
 | 
			
		||||
     * @phpstan-var list<array{currentDir: string|null, path: string, filePath: string}>
 | 
			
		||||
     */
 | 
			
		||||
    private $resolvedImports;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param CompilationResult  $result
 | 
			
		||||
     * @param array<string, int> $parsedFiles
 | 
			
		||||
     * @param array              $resolvedImports
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-param list<array{currentDir: string|null, path: string, filePath: string}> $resolvedImports
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct(CompilationResult $result, array $parsedFiles, array $resolvedImports)
 | 
			
		||||
    {
 | 
			
		||||
        $this->result = $result;
 | 
			
		||||
        $this->parsedFiles = $parsedFiles;
 | 
			
		||||
        $this->resolvedImports = $resolvedImports;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return CompilationResult
 | 
			
		||||
     */
 | 
			
		||||
    public function getResult()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->result;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return array<string, int>
 | 
			
		||||
     */
 | 
			
		||||
    public function getParsedFiles()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->parsedFiles;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return array
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-return list<array{currentDir: string|null, path: string, filePath: string}>
 | 
			
		||||
     */
 | 
			
		||||
    public function getResolvedImports()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->resolvedImports;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,48 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Compiler;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Compiler environment
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class Environment
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var \ScssPhp\ScssPhp\Block|null
 | 
			
		||||
     */
 | 
			
		||||
    public $block;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var \ScssPhp\ScssPhp\Compiler\Environment|null
 | 
			
		||||
     */
 | 
			
		||||
    public $parent;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array
 | 
			
		||||
     */
 | 
			
		||||
    public $store;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array
 | 
			
		||||
     */
 | 
			
		||||
    public $storeUnreduced;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     */
 | 
			
		||||
    public $depth;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,24 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Exception;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Compiler exception
 | 
			
		||||
 *
 | 
			
		||||
 * @author Oleksandr Savchenko <traveltino@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class CompilerException extends \Exception implements SassException
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,50 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Exception;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Parser Exception
 | 
			
		||||
 *
 | 
			
		||||
 * @author Oleksandr Savchenko <traveltino@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class ParserException extends \Exception implements SassException
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array
 | 
			
		||||
     */
 | 
			
		||||
    private $sourcePosition;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get source position
 | 
			
		||||
     *
 | 
			
		||||
     * @api
 | 
			
		||||
     */
 | 
			
		||||
    public function getSourcePosition()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->sourcePosition;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Set source position
 | 
			
		||||
     *
 | 
			
		||||
     * @api
 | 
			
		||||
     *
 | 
			
		||||
     * @param array $sourcePosition
 | 
			
		||||
     */
 | 
			
		||||
    public function setSourcePosition($sourcePosition)
 | 
			
		||||
    {
 | 
			
		||||
        $this->sourcePosition = $sourcePosition;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,24 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Exception;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Range exception
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class RangeException extends \Exception implements SassException
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,7 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Exception;
 | 
			
		||||
 | 
			
		||||
interface SassException
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,32 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Exception;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * An exception thrown by SassScript.
 | 
			
		||||
 *
 | 
			
		||||
 * This class does not implement SassException on purpose, as it should
 | 
			
		||||
 * never be returned to the outside code. The compilation will catch it
 | 
			
		||||
 * and replace it with a SassException reporting the location of the
 | 
			
		||||
 * error.
 | 
			
		||||
 */
 | 
			
		||||
class SassScriptException extends \Exception
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Creates a SassScriptException with support for an argument name.
 | 
			
		||||
     *
 | 
			
		||||
     * This helper ensures a consistent handling of argument names in the
 | 
			
		||||
     * error message, without duplicating it.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string      $message
 | 
			
		||||
     * @param string|null $name    The argument name, without $
 | 
			
		||||
     *
 | 
			
		||||
     * @return SassScriptException
 | 
			
		||||
     */
 | 
			
		||||
    public static function forArgument($message, $name = null)
 | 
			
		||||
    {
 | 
			
		||||
        $varDisplay = !\is_null($name) ? "\${$name}: " : '';
 | 
			
		||||
 | 
			
		||||
        return new self($varDisplay . $message);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,26 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Exception;
 | 
			
		||||
 | 
			
		||||
@trigger_error(sprintf('The "%s" class is deprecated.', ServerException::class), E_USER_DEPRECATED);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Server Exception
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @deprecated The Scssphp server should define its own exception instead.
 | 
			
		||||
 */
 | 
			
		||||
class ServerException extends \Exception implements SassException
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										364
									
								
								include/thirdparty/ScssPhp/Scssphp181/Formatter.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										364
									
								
								include/thirdparty/ScssPhp/Scssphp181/Formatter.php
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,364 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Formatter\OutputBlock;
 | 
			
		||||
use ScssPhp\ScssPhp\SourceMap\SourceMapGenerator;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Base formatter
 | 
			
		||||
 *
 | 
			
		||||
 * @author Leaf Corcoran <leafot@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
abstract class Formatter
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     */
 | 
			
		||||
    public $indentLevel;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public $indentChar;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public $break;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public $open;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public $close;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public $tagSeparator;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public $assignSeparator;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var boolean
 | 
			
		||||
     */
 | 
			
		||||
    public $keepSemicolons;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var \ScssPhp\ScssPhp\Formatter\OutputBlock
 | 
			
		||||
     */
 | 
			
		||||
    protected $currentBlock;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     */
 | 
			
		||||
    protected $currentLine;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     */
 | 
			
		||||
    protected $currentColumn;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var \ScssPhp\ScssPhp\SourceMap\SourceMapGenerator|null
 | 
			
		||||
     */
 | 
			
		||||
    protected $sourceMapGenerator;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    protected $strippedSemicolon;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Initialize formatter
 | 
			
		||||
     *
 | 
			
		||||
     * @api
 | 
			
		||||
     */
 | 
			
		||||
    abstract public function __construct();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Return indentation (whitespace)
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    protected function indentStr()
 | 
			
		||||
    {
 | 
			
		||||
        return '';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Return property assignment
 | 
			
		||||
     *
 | 
			
		||||
     * @api
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $name
 | 
			
		||||
     * @param mixed  $value
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function property($name, $value)
 | 
			
		||||
    {
 | 
			
		||||
        return rtrim($name) . $this->assignSeparator . $value . ';';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Return custom property assignment
 | 
			
		||||
     * differs in that you have to keep spaces in the value as is
 | 
			
		||||
     *
 | 
			
		||||
     * @api
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $name
 | 
			
		||||
     * @param mixed  $value
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function customProperty($name, $value)
 | 
			
		||||
    {
 | 
			
		||||
        return rtrim($name) . trim($this->assignSeparator) . $value . ';';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Output lines inside a block
 | 
			
		||||
     *
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    protected function blockLines(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        $inner = $this->indentStr();
 | 
			
		||||
        $glue  = $this->break . $inner;
 | 
			
		||||
 | 
			
		||||
        $this->write($inner . implode($glue, $block->lines));
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->children)) {
 | 
			
		||||
            $this->write($this->break);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Output block selectors
 | 
			
		||||
     *
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    protected function blockSelectors(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        assert(! empty($block->selectors));
 | 
			
		||||
 | 
			
		||||
        $inner = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        $this->write($inner
 | 
			
		||||
            . implode($this->tagSeparator, $block->selectors)
 | 
			
		||||
            . $this->open . $this->break);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Output block children
 | 
			
		||||
     *
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    protected function blockChildren(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        foreach ($block->children as $child) {
 | 
			
		||||
            $this->block($child);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Output non-empty block
 | 
			
		||||
     *
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    protected function block(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        if (empty($block->lines) && empty($block->children)) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->currentBlock = $block;
 | 
			
		||||
 | 
			
		||||
        $pre = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->selectors)) {
 | 
			
		||||
            $this->blockSelectors($block);
 | 
			
		||||
 | 
			
		||||
            $this->indentLevel++;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->lines)) {
 | 
			
		||||
            $this->blockLines($block);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->children)) {
 | 
			
		||||
            $this->blockChildren($block);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->selectors)) {
 | 
			
		||||
            $this->indentLevel--;
 | 
			
		||||
 | 
			
		||||
            if (! $this->keepSemicolons) {
 | 
			
		||||
                $this->strippedSemicolon = '';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (empty($block->children)) {
 | 
			
		||||
                $this->write($this->break);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $this->write($pre . $this->close . $this->break);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Test and clean safely empty children
 | 
			
		||||
     *
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
 | 
			
		||||
     *
 | 
			
		||||
     * @return boolean
 | 
			
		||||
     */
 | 
			
		||||
    protected function testEmptyChildren($block)
 | 
			
		||||
    {
 | 
			
		||||
        $isEmpty = empty($block->lines);
 | 
			
		||||
 | 
			
		||||
        if ($block->children) {
 | 
			
		||||
            foreach ($block->children as $k => &$child) {
 | 
			
		||||
                if (! $this->testEmptyChildren($child)) {
 | 
			
		||||
                    $isEmpty = false;
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if ($child->type === Type::T_MEDIA || $child->type === Type::T_DIRECTIVE) {
 | 
			
		||||
                    $child->children = [];
 | 
			
		||||
                    $child->selectors = null;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $isEmpty;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Entry point to formatting a block
 | 
			
		||||
     *
 | 
			
		||||
     * @api
 | 
			
		||||
     *
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock             $block              An abstract syntax tree
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\SourceMap\SourceMapGenerator|null $sourceMapGenerator Optional source map generator
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function format(OutputBlock $block, SourceMapGenerator $sourceMapGenerator = null)
 | 
			
		||||
    {
 | 
			
		||||
        $this->sourceMapGenerator = null;
 | 
			
		||||
 | 
			
		||||
        if ($sourceMapGenerator) {
 | 
			
		||||
            $this->currentLine        = 1;
 | 
			
		||||
            $this->currentColumn      = 0;
 | 
			
		||||
            $this->sourceMapGenerator = $sourceMapGenerator;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->testEmptyChildren($block);
 | 
			
		||||
 | 
			
		||||
        ob_start();
 | 
			
		||||
 | 
			
		||||
        $this->block($block);
 | 
			
		||||
 | 
			
		||||
        $out = ob_get_clean();
 | 
			
		||||
 | 
			
		||||
        return $out;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Output content
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $str
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    protected function write($str)
 | 
			
		||||
    {
 | 
			
		||||
        if (! empty($this->strippedSemicolon)) {
 | 
			
		||||
            echo $this->strippedSemicolon;
 | 
			
		||||
 | 
			
		||||
            $this->strippedSemicolon = '';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /*
 | 
			
		||||
         * Maybe Strip semi-colon appended by property(); it's a separator, not a terminator
 | 
			
		||||
         * will be striped for real before a closing, otherwise displayed unchanged starting the next write
 | 
			
		||||
         */
 | 
			
		||||
        if (
 | 
			
		||||
            ! $this->keepSemicolons &&
 | 
			
		||||
            $str &&
 | 
			
		||||
            (strpos($str, ';') !== false) &&
 | 
			
		||||
            (substr($str, -1) === ';')
 | 
			
		||||
        ) {
 | 
			
		||||
            $str = substr($str, 0, -1);
 | 
			
		||||
 | 
			
		||||
            $this->strippedSemicolon = ';';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($this->sourceMapGenerator) {
 | 
			
		||||
            $lines = explode("\n", $str);
 | 
			
		||||
            $lastLine = array_pop($lines);
 | 
			
		||||
 | 
			
		||||
            foreach ($lines as $line) {
 | 
			
		||||
                // If the written line starts is empty, adding a mapping would add it for
 | 
			
		||||
                // a non-existent column as we are at the end of the line
 | 
			
		||||
                if ($line !== '') {
 | 
			
		||||
                    $this->sourceMapGenerator->addMapping(
 | 
			
		||||
                        $this->currentLine,
 | 
			
		||||
                        $this->currentColumn,
 | 
			
		||||
                        $this->currentBlock->sourceLine,
 | 
			
		||||
                        //columns from parser are off by one
 | 
			
		||||
                        $this->currentBlock->sourceColumn > 0 ? $this->currentBlock->sourceColumn - 1 : 0,
 | 
			
		||||
                        $this->currentBlock->sourceName
 | 
			
		||||
                    );
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $this->currentLine++;
 | 
			
		||||
                $this->currentColumn = 0;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if ($lastLine !== '') {
 | 
			
		||||
                $this->sourceMapGenerator->addMapping(
 | 
			
		||||
                    $this->currentLine,
 | 
			
		||||
                    $this->currentColumn,
 | 
			
		||||
                    $this->currentBlock->sourceLine,
 | 
			
		||||
                    //columns from parser are off by one
 | 
			
		||||
                    $this->currentBlock->sourceColumn > 0 ? $this->currentBlock->sourceColumn - 1 : 0,
 | 
			
		||||
                    $this->currentBlock->sourceName
 | 
			
		||||
                );
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $this->currentColumn += \strlen($lastLine);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        echo $str;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,52 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Compact formatter
 | 
			
		||||
 *
 | 
			
		||||
 * @author Leaf Corcoran <leafot@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @deprecated since 1.4.0. Use the Compressed formatter instead.
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class Compact extends Formatter
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        @trigger_error('The Compact formatter is deprecated since 1.4.0. Use the Compressed formatter instead.', E_USER_DEPRECATED);
 | 
			
		||||
 | 
			
		||||
        $this->indentLevel = 0;
 | 
			
		||||
        $this->indentChar = '';
 | 
			
		||||
        $this->break = '';
 | 
			
		||||
        $this->open = ' {';
 | 
			
		||||
        $this->close = "}\n\n";
 | 
			
		||||
        $this->tagSeparator = ',';
 | 
			
		||||
        $this->assignSeparator = ':';
 | 
			
		||||
        $this->keepSemicolons = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function indentStr()
 | 
			
		||||
    {
 | 
			
		||||
        return ' ';
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,85 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Compressed formatter
 | 
			
		||||
 *
 | 
			
		||||
 * @author Leaf Corcoran <leafot@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class Compressed extends Formatter
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        $this->indentLevel = 0;
 | 
			
		||||
        $this->indentChar = '  ';
 | 
			
		||||
        $this->break = '';
 | 
			
		||||
        $this->open = '{';
 | 
			
		||||
        $this->close = '}';
 | 
			
		||||
        $this->tagSeparator = ',';
 | 
			
		||||
        $this->assignSeparator = ':';
 | 
			
		||||
        $this->keepSemicolons = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function blockLines(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        $inner = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        $glue = $this->break . $inner;
 | 
			
		||||
 | 
			
		||||
        foreach ($block->lines as $index => $line) {
 | 
			
		||||
            if (substr($line, 0, 2) === '/*' && substr($line, 2, 1) !== '!') {
 | 
			
		||||
                unset($block->lines[$index]);
 | 
			
		||||
            } elseif (substr($line, 0, 3) === '/*!') {
 | 
			
		||||
                $block->lines[$index] = '/*' . substr($line, 3);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->write($inner . implode($glue, $block->lines));
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->children)) {
 | 
			
		||||
            $this->write($this->break);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Output block selectors
 | 
			
		||||
     *
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
 | 
			
		||||
     */
 | 
			
		||||
    protected function blockSelectors(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        assert(! empty($block->selectors));
 | 
			
		||||
 | 
			
		||||
        $inner = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        $this->write(
 | 
			
		||||
            $inner
 | 
			
		||||
            . implode(
 | 
			
		||||
                $this->tagSeparator,
 | 
			
		||||
                str_replace([' > ', ' + ', ' ~ '], ['>', '+', '~'], $block->selectors)
 | 
			
		||||
            )
 | 
			
		||||
            . $this->open . $this->break
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,87 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Crunched formatter
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @deprecated since 1.4.0. Use the Compressed formatter instead.
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class Crunched extends Formatter
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        @trigger_error('The Crunched formatter is deprecated since 1.4.0. Use the Compressed formatter instead.', E_USER_DEPRECATED);
 | 
			
		||||
 | 
			
		||||
        $this->indentLevel = 0;
 | 
			
		||||
        $this->indentChar = '  ';
 | 
			
		||||
        $this->break = '';
 | 
			
		||||
        $this->open = '{';
 | 
			
		||||
        $this->close = '}';
 | 
			
		||||
        $this->tagSeparator = ',';
 | 
			
		||||
        $this->assignSeparator = ':';
 | 
			
		||||
        $this->keepSemicolons = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function blockLines(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        $inner = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        $glue = $this->break . $inner;
 | 
			
		||||
 | 
			
		||||
        foreach ($block->lines as $index => $line) {
 | 
			
		||||
            if (substr($line, 0, 2) === '/*') {
 | 
			
		||||
                unset($block->lines[$index]);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->write($inner . implode($glue, $block->lines));
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->children)) {
 | 
			
		||||
            $this->write($this->break);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Output block selectors
 | 
			
		||||
     *
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
 | 
			
		||||
     */
 | 
			
		||||
    protected function blockSelectors(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        assert(! empty($block->selectors));
 | 
			
		||||
 | 
			
		||||
        $inner = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        $this->write(
 | 
			
		||||
            $inner
 | 
			
		||||
            . implode(
 | 
			
		||||
                $this->tagSeparator,
 | 
			
		||||
                str_replace([' > ', ' + ', ' ~ '], ['>', '+', '~'], $block->selectors)
 | 
			
		||||
            )
 | 
			
		||||
            . $this->open . $this->break
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,127 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Debug formatter
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @deprecated since 1.4.0.
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class Debug extends Formatter
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        @trigger_error('The Debug formatter is deprecated since 1.4.0.', E_USER_DEPRECATED);
 | 
			
		||||
 | 
			
		||||
        $this->indentLevel = 0;
 | 
			
		||||
        $this->indentChar = '';
 | 
			
		||||
        $this->break = "\n";
 | 
			
		||||
        $this->open = ' {';
 | 
			
		||||
        $this->close = ' }';
 | 
			
		||||
        $this->tagSeparator = ', ';
 | 
			
		||||
        $this->assignSeparator = ': ';
 | 
			
		||||
        $this->keepSemicolons = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    protected function indentStr()
 | 
			
		||||
    {
 | 
			
		||||
        return str_repeat('  ', $this->indentLevel);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    protected function blockLines(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        $indent = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        if (empty($block->lines)) {
 | 
			
		||||
            $this->write("{$indent}block->lines: []\n");
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        foreach ($block->lines as $index => $line) {
 | 
			
		||||
            $this->write("{$indent}block->lines[{$index}]: $line\n");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    protected function blockSelectors(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        $indent = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        if (empty($block->selectors)) {
 | 
			
		||||
            $this->write("{$indent}block->selectors: []\n");
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        foreach ($block->selectors as $index => $selector) {
 | 
			
		||||
            $this->write("{$indent}block->selectors[{$index}]: $selector\n");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    protected function blockChildren(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        $indent = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        if (empty($block->children)) {
 | 
			
		||||
            $this->write("{$indent}block->children: []\n");
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->indentLevel++;
 | 
			
		||||
 | 
			
		||||
        foreach ($block->children as $i => $child) {
 | 
			
		||||
            $this->block($child);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->indentLevel--;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    protected function block(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        $indent = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        $this->write("{$indent}block->type: {$block->type}\n" .
 | 
			
		||||
             "{$indent}block->depth: {$block->depth}\n");
 | 
			
		||||
 | 
			
		||||
        $this->currentBlock = $block;
 | 
			
		||||
 | 
			
		||||
        $this->blockSelectors($block);
 | 
			
		||||
        $this->blockLines($block);
 | 
			
		||||
        $this->blockChildren($block);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,70 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Expanded formatter
 | 
			
		||||
 *
 | 
			
		||||
 * @author Leaf Corcoran <leafot@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class Expanded extends Formatter
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        $this->indentLevel = 0;
 | 
			
		||||
        $this->indentChar = '  ';
 | 
			
		||||
        $this->break = "\n";
 | 
			
		||||
        $this->open = ' {';
 | 
			
		||||
        $this->close = '}';
 | 
			
		||||
        $this->tagSeparator = ', ';
 | 
			
		||||
        $this->assignSeparator = ': ';
 | 
			
		||||
        $this->keepSemicolons = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    protected function indentStr()
 | 
			
		||||
    {
 | 
			
		||||
        return str_repeat($this->indentChar, $this->indentLevel);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    protected function blockLines(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        $inner = $this->indentStr();
 | 
			
		||||
 | 
			
		||||
        $glue = $this->break . $inner;
 | 
			
		||||
 | 
			
		||||
        foreach ($block->lines as $index => $line) {
 | 
			
		||||
            if (substr($line, 0, 2) === '/*') {
 | 
			
		||||
                $block->lines[$index] = preg_replace('/\r\n?|\n|\f/', $this->break, $line);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->write($inner . implode($glue, $block->lines));
 | 
			
		||||
 | 
			
		||||
        if (empty($block->selectors) || ! empty($block->children)) {
 | 
			
		||||
            $this->write($this->break);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,236 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
use ScssPhp\ScssPhp\Type;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Nested formatter
 | 
			
		||||
 *
 | 
			
		||||
 * @author Leaf Corcoran <leafot@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @deprecated since 1.4.0. Use the Expanded formatter instead.
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class Nested extends Formatter
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     */
 | 
			
		||||
    private $depth;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        @trigger_error('The Nested formatter is deprecated since 1.4.0. Use the Expanded formatter instead.', E_USER_DEPRECATED);
 | 
			
		||||
 | 
			
		||||
        $this->indentLevel = 0;
 | 
			
		||||
        $this->indentChar = '  ';
 | 
			
		||||
        $this->break = "\n";
 | 
			
		||||
        $this->open = ' {';
 | 
			
		||||
        $this->close = ' }';
 | 
			
		||||
        $this->tagSeparator = ', ';
 | 
			
		||||
        $this->assignSeparator = ': ';
 | 
			
		||||
        $this->keepSemicolons = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    protected function indentStr()
 | 
			
		||||
    {
 | 
			
		||||
        $n = $this->depth - 1;
 | 
			
		||||
 | 
			
		||||
        return str_repeat($this->indentChar, max($this->indentLevel + $n, 0));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    protected function blockLines(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        $inner = $this->indentStr();
 | 
			
		||||
        $glue  = $this->break . $inner;
 | 
			
		||||
 | 
			
		||||
        foreach ($block->lines as $index => $line) {
 | 
			
		||||
            if (substr($line, 0, 2) === '/*') {
 | 
			
		||||
                $block->lines[$index] = preg_replace('/\r\n?|\n|\f/', $this->break, $line);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->write($inner . implode($glue, $block->lines));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    protected function block(OutputBlock $block)
 | 
			
		||||
    {
 | 
			
		||||
        static $depths;
 | 
			
		||||
        static $downLevel;
 | 
			
		||||
        static $closeBlock;
 | 
			
		||||
        static $previousEmpty;
 | 
			
		||||
        static $previousHasSelector;
 | 
			
		||||
 | 
			
		||||
        if ($block->type === 'root') {
 | 
			
		||||
            $depths = [ 0 ];
 | 
			
		||||
            $downLevel = '';
 | 
			
		||||
            $closeBlock = '';
 | 
			
		||||
            $this->depth = 0;
 | 
			
		||||
            $previousEmpty = false;
 | 
			
		||||
            $previousHasSelector = false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $isMediaOrDirective = \in_array($block->type, [Type::T_DIRECTIVE, Type::T_MEDIA]);
 | 
			
		||||
        $isSupport = ($block->type === Type::T_DIRECTIVE
 | 
			
		||||
            && $block->selectors && strpos(implode('', $block->selectors), '@supports') !== false);
 | 
			
		||||
 | 
			
		||||
        while ($block->depth < end($depths) || ($block->depth == 1 && end($depths) == 1)) {
 | 
			
		||||
            array_pop($depths);
 | 
			
		||||
            $this->depth--;
 | 
			
		||||
 | 
			
		||||
            if (
 | 
			
		||||
                ! $this->depth && ($block->depth <= 1 || (! $this->indentLevel && $block->type === Type::T_COMMENT)) &&
 | 
			
		||||
                (($block->selectors && ! $isMediaOrDirective) || $previousHasSelector)
 | 
			
		||||
            ) {
 | 
			
		||||
                $downLevel = $this->break;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (empty($block->lines) && empty($block->children)) {
 | 
			
		||||
                $previousEmpty = true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (empty($block->lines) && empty($block->children)) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->currentBlock = $block;
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->lines) || (! empty($block->children) && ($this->depth < 1 || $isSupport))) {
 | 
			
		||||
            if ($block->depth > end($depths)) {
 | 
			
		||||
                if (! $previousEmpty || $this->depth < 1) {
 | 
			
		||||
                    $this->depth++;
 | 
			
		||||
 | 
			
		||||
                    $depths[] = $block->depth;
 | 
			
		||||
                } else {
 | 
			
		||||
                    // keep the current depth unchanged but take the block depth as a new reference for following blocks
 | 
			
		||||
                    array_pop($depths);
 | 
			
		||||
 | 
			
		||||
                    $depths[] = $block->depth;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $previousEmpty = ($block->type === Type::T_COMMENT);
 | 
			
		||||
        $previousHasSelector = false;
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->selectors)) {
 | 
			
		||||
            if ($closeBlock) {
 | 
			
		||||
                $this->write($closeBlock);
 | 
			
		||||
                $closeBlock = '';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if ($downLevel) {
 | 
			
		||||
                $this->write($downLevel);
 | 
			
		||||
                $downLevel = '';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $this->blockSelectors($block);
 | 
			
		||||
 | 
			
		||||
            $this->indentLevel++;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->lines)) {
 | 
			
		||||
            if ($closeBlock) {
 | 
			
		||||
                $this->write($closeBlock);
 | 
			
		||||
                $closeBlock = '';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if ($downLevel) {
 | 
			
		||||
                $this->write($downLevel);
 | 
			
		||||
                $downLevel = '';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $this->blockLines($block);
 | 
			
		||||
 | 
			
		||||
            $closeBlock = $this->break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->children)) {
 | 
			
		||||
            if ($this->depth > 0 && ($isMediaOrDirective || ! $this->hasFlatChild($block))) {
 | 
			
		||||
                array_pop($depths);
 | 
			
		||||
 | 
			
		||||
                $this->depth--;
 | 
			
		||||
                $this->blockChildren($block);
 | 
			
		||||
                $this->depth++;
 | 
			
		||||
 | 
			
		||||
                $depths[] = $block->depth;
 | 
			
		||||
            } else {
 | 
			
		||||
                $this->blockChildren($block);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // reclear to not be spoiled by children if T_DIRECTIVE
 | 
			
		||||
        if ($block->type === Type::T_DIRECTIVE) {
 | 
			
		||||
            $previousHasSelector = false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (! empty($block->selectors)) {
 | 
			
		||||
            $this->indentLevel--;
 | 
			
		||||
 | 
			
		||||
            if (! $this->keepSemicolons) {
 | 
			
		||||
                $this->strippedSemicolon = '';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $this->write($this->close);
 | 
			
		||||
 | 
			
		||||
            $closeBlock = $this->break;
 | 
			
		||||
 | 
			
		||||
            if ($this->depth > 1 && ! empty($block->children)) {
 | 
			
		||||
                array_pop($depths);
 | 
			
		||||
                $this->depth--;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (! $isMediaOrDirective) {
 | 
			
		||||
                $previousHasSelector = true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($block->type === 'root') {
 | 
			
		||||
            $this->write($this->break);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Block has flat child
 | 
			
		||||
     *
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
 | 
			
		||||
     *
 | 
			
		||||
     * @return boolean
 | 
			
		||||
     */
 | 
			
		||||
    private function hasFlatChild($block)
 | 
			
		||||
    {
 | 
			
		||||
        foreach ($block->children as $child) {
 | 
			
		||||
            if (empty($child->selectors)) {
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,68 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Formatter;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Output block
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class OutputBlock
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public $type;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     */
 | 
			
		||||
    public $depth;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array|null
 | 
			
		||||
     */
 | 
			
		||||
    public $selectors;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string[]
 | 
			
		||||
     */
 | 
			
		||||
    public $lines;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var OutputBlock[]
 | 
			
		||||
     */
 | 
			
		||||
    public $children;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var OutputBlock|null
 | 
			
		||||
     */
 | 
			
		||||
    public $parent;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string|null
 | 
			
		||||
     */
 | 
			
		||||
    public $sourceName;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer|null
 | 
			
		||||
     */
 | 
			
		||||
    public $sourceLine;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer|null
 | 
			
		||||
     */
 | 
			
		||||
    public $sourceColumn;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										20
									
								
								include/thirdparty/ScssPhp/Scssphp181/LICENSE.md
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								include/thirdparty/ScssPhp/Scssphp181/LICENSE.md
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,20 +0,0 @@
 | 
			
		|||
Copyright (c) 2015 Leaf Corcoran, http://scssphp.github.io/scssphp
 | 
			
		||||
 
 | 
			
		||||
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.
 | 
			
		||||
| 
						 | 
				
			
			@ -1,48 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Logger;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Interface implemented by loggers for warnings and debug messages.
 | 
			
		||||
 *
 | 
			
		||||
 * The official Sass implementation recommends that loggers report the
 | 
			
		||||
 * messages immediately rather than waiting for the end of the
 | 
			
		||||
 * compilation, to provide a better debugging experience when the
 | 
			
		||||
 * compilation does not end (error or infinite loop after the warning
 | 
			
		||||
 * for instance).
 | 
			
		||||
 */
 | 
			
		||||
interface LoggerInterface
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Emits a warning with the given message.
 | 
			
		||||
     *
 | 
			
		||||
     * If $deprecation is true, it indicates that this is a deprecation
 | 
			
		||||
     * warning. Implementations should surface all this information to
 | 
			
		||||
     * the end user.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $message
 | 
			
		||||
     * @param bool  $deprecation
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function warn($message, $deprecation = false);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Emits a debugging message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $message
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function debug($message);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,27 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Logger;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * A logger that silently ignores all messages.
 | 
			
		||||
 */
 | 
			
		||||
class QuietLogger implements LoggerInterface
 | 
			
		||||
{
 | 
			
		||||
    public function warn($message, $deprecation = false)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function debug($message)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,60 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Logger;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * A logger that prints to a PHP stream (for instance stderr)
 | 
			
		||||
 */
 | 
			
		||||
class StreamLogger implements LoggerInterface
 | 
			
		||||
{
 | 
			
		||||
    private $stream;
 | 
			
		||||
    private $closeOnDestruct;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param resource $stream          A stream resource
 | 
			
		||||
     * @param bool     $closeOnDestruct If true, takes ownership of the stream and close it on destruct to avoid leaks.
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct($stream, $closeOnDestruct = false)
 | 
			
		||||
    {
 | 
			
		||||
        $this->stream = $stream;
 | 
			
		||||
        $this->closeOnDestruct = $closeOnDestruct;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @internal
 | 
			
		||||
     */
 | 
			
		||||
    public function __destruct()
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->closeOnDestruct) {
 | 
			
		||||
            fclose($this->stream);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @inheritDoc
 | 
			
		||||
     */
 | 
			
		||||
    public function warn($message, $deprecation = false)
 | 
			
		||||
    {
 | 
			
		||||
        $prefix = ($deprecation ? 'DEPRECATION ' : '') . 'WARNING: ';
 | 
			
		||||
 | 
			
		||||
        fwrite($this->stream, $prefix . $message . "\n\n");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @inheritDoc
 | 
			
		||||
     */
 | 
			
		||||
    public function debug($message)
 | 
			
		||||
    {
 | 
			
		||||
        fwrite($this->stream, $message . "\n");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										43
									
								
								include/thirdparty/ScssPhp/Scssphp181/Node.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										43
									
								
								include/thirdparty/ScssPhp/Scssphp181/Node.php
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,43 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Base node
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
abstract class Node
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    public $type;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     */
 | 
			
		||||
    public $sourceIndex;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var int|null
 | 
			
		||||
     */
 | 
			
		||||
    public $sourceLine;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var int|null
 | 
			
		||||
     */
 | 
			
		||||
    public $sourceColumn;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,804 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Node;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Base\Range;
 | 
			
		||||
use ScssPhp\ScssPhp\Compiler;
 | 
			
		||||
use ScssPhp\ScssPhp\Exception\RangeException;
 | 
			
		||||
use ScssPhp\ScssPhp\Exception\SassScriptException;
 | 
			
		||||
use ScssPhp\ScssPhp\Node;
 | 
			
		||||
use ScssPhp\ScssPhp\Type;
 | 
			
		||||
use ScssPhp\ScssPhp\Util;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Dimension + optional units
 | 
			
		||||
 *
 | 
			
		||||
 * {@internal
 | 
			
		||||
 *     This is a work-in-progress.
 | 
			
		||||
 *
 | 
			
		||||
 *     The \ArrayAccess interface is temporary until the migration is complete.
 | 
			
		||||
 * }}
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @template-implements \ArrayAccess<int, mixed>
 | 
			
		||||
 */
 | 
			
		||||
class Number extends Node implements \ArrayAccess
 | 
			
		||||
{
 | 
			
		||||
    const PRECISION = 10;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer
 | 
			
		||||
     * @deprecated use {Number::PRECISION} instead to read the precision. Configuring it is not supported anymore.
 | 
			
		||||
     */
 | 
			
		||||
    public static $precision = self::PRECISION;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @see http://www.w3.org/TR/2012/WD-css3-values-20120308/
 | 
			
		||||
     *
 | 
			
		||||
     * @var array
 | 
			
		||||
     * @phpstan-var array<string, array<string, float|int>>
 | 
			
		||||
     */
 | 
			
		||||
    protected static $unitTable = [
 | 
			
		||||
        'in' => [
 | 
			
		||||
            'in' => 1,
 | 
			
		||||
            'pc' => 6,
 | 
			
		||||
            'pt' => 72,
 | 
			
		||||
            'px' => 96,
 | 
			
		||||
            'cm' => 2.54,
 | 
			
		||||
            'mm' => 25.4,
 | 
			
		||||
            'q'  => 101.6,
 | 
			
		||||
        ],
 | 
			
		||||
        'turn' => [
 | 
			
		||||
            'deg'  => 360,
 | 
			
		||||
            'grad' => 400,
 | 
			
		||||
            'rad'  => 6.28318530717958647692528676, // 2 * M_PI
 | 
			
		||||
            'turn' => 1,
 | 
			
		||||
        ],
 | 
			
		||||
        's' => [
 | 
			
		||||
            's'  => 1,
 | 
			
		||||
            'ms' => 1000,
 | 
			
		||||
        ],
 | 
			
		||||
        'Hz' => [
 | 
			
		||||
            'Hz'  => 1,
 | 
			
		||||
            'kHz' => 0.001,
 | 
			
		||||
        ],
 | 
			
		||||
        'dpi' => [
 | 
			
		||||
            'dpi'  => 1,
 | 
			
		||||
            'dpcm' => 1 / 2.54,
 | 
			
		||||
            'dppx' => 1 / 96,
 | 
			
		||||
        ],
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var integer|float
 | 
			
		||||
     */
 | 
			
		||||
    private $dimension;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string[]
 | 
			
		||||
     * @phpstan-var list<string>
 | 
			
		||||
     */
 | 
			
		||||
    private $numeratorUnits;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string[]
 | 
			
		||||
     * @phpstan-var list<string>
 | 
			
		||||
     */
 | 
			
		||||
    private $denominatorUnits;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Initialize number
 | 
			
		||||
     *
 | 
			
		||||
     * @param integer|float   $dimension
 | 
			
		||||
     * @param string[]|string $numeratorUnits
 | 
			
		||||
     * @param string[]        $denominatorUnits
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-param list<string>|string $numeratorUnits
 | 
			
		||||
     * @phpstan-param list<string>        $denominatorUnits
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct($dimension, $numeratorUnits, array $denominatorUnits = [])
 | 
			
		||||
    {
 | 
			
		||||
        if (is_string($numeratorUnits)) {
 | 
			
		||||
            $numeratorUnits = $numeratorUnits ? [$numeratorUnits] : [];
 | 
			
		||||
        } elseif (isset($numeratorUnits['numerator_units'], $numeratorUnits['denominator_units'])) {
 | 
			
		||||
            // TODO get rid of this once `$number[2]` is not used anymore
 | 
			
		||||
            $denominatorUnits = $numeratorUnits['denominator_units'];
 | 
			
		||||
            $numeratorUnits = $numeratorUnits['numerator_units'];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->dimension = $dimension;
 | 
			
		||||
        $this->numeratorUnits = $numeratorUnits;
 | 
			
		||||
        $this->denominatorUnits = $denominatorUnits;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return float|int
 | 
			
		||||
     */
 | 
			
		||||
    public function getDimension()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->dimension;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return string[]
 | 
			
		||||
     */
 | 
			
		||||
    public function getNumeratorUnits()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->numeratorUnits;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return string[]
 | 
			
		||||
     */
 | 
			
		||||
    public function getDenominatorUnits()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->denominatorUnits;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    #[\ReturnTypeWillChange]
 | 
			
		||||
    public function offsetExists($offset)
 | 
			
		||||
    {
 | 
			
		||||
        if ($offset === -3) {
 | 
			
		||||
            return ! \is_null($this->sourceColumn);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($offset === -2) {
 | 
			
		||||
            return ! \is_null($this->sourceLine);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (
 | 
			
		||||
            $offset === -1 ||
 | 
			
		||||
            $offset === 0 ||
 | 
			
		||||
            $offset === 1 ||
 | 
			
		||||
            $offset === 2
 | 
			
		||||
        ) {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    #[\ReturnTypeWillChange]
 | 
			
		||||
    public function offsetGet($offset)
 | 
			
		||||
    {
 | 
			
		||||
        switch ($offset) {
 | 
			
		||||
            case -3:
 | 
			
		||||
                return $this->sourceColumn;
 | 
			
		||||
 | 
			
		||||
            case -2:
 | 
			
		||||
                return $this->sourceLine;
 | 
			
		||||
 | 
			
		||||
            case -1:
 | 
			
		||||
                return $this->sourceIndex;
 | 
			
		||||
 | 
			
		||||
            case 0:
 | 
			
		||||
                return Type::T_NUMBER;
 | 
			
		||||
 | 
			
		||||
            case 1:
 | 
			
		||||
                return $this->dimension;
 | 
			
		||||
 | 
			
		||||
            case 2:
 | 
			
		||||
                return array('numerator_units' => $this->numeratorUnits, 'denominator_units' => $this->denominatorUnits);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    #[\ReturnTypeWillChange]
 | 
			
		||||
    public function offsetSet($offset, $value)
 | 
			
		||||
    {
 | 
			
		||||
        throw new \BadMethodCallException('Number is immutable');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    #[\ReturnTypeWillChange]
 | 
			
		||||
    public function offsetUnset($offset)
 | 
			
		||||
    {
 | 
			
		||||
        throw new \BadMethodCallException('Number is immutable');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns true if the number is unitless
 | 
			
		||||
     *
 | 
			
		||||
     * @return boolean
 | 
			
		||||
     */
 | 
			
		||||
    public function unitless()
 | 
			
		||||
    {
 | 
			
		||||
        return \count($this->numeratorUnits) === 0 && \count($this->denominatorUnits) === 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Checks whether the number has exactly this unit
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $unit
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool
 | 
			
		||||
     */
 | 
			
		||||
    public function hasUnit($unit)
 | 
			
		||||
    {
 | 
			
		||||
        return \count($this->numeratorUnits) === 1 && \count($this->denominatorUnits) === 0 && $this->numeratorUnits[0] === $unit;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns unit(s) as the product of numerator units divided by the product of denominator units
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function unitStr()
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->unitless()) {
 | 
			
		||||
            return '';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return self::getUnitString($this->numeratorUnits, $this->denominatorUnits);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param float|int $min
 | 
			
		||||
     * @param float|int $max
 | 
			
		||||
     * @param string|null $name
 | 
			
		||||
     *
 | 
			
		||||
     * @return float|int
 | 
			
		||||
     * @throws SassScriptException
 | 
			
		||||
     */
 | 
			
		||||
    public function valueInRange($min, $max, $name = null)
 | 
			
		||||
    {
 | 
			
		||||
        try {
 | 
			
		||||
            return Util::checkRange('', new Range($min, $max), $this);
 | 
			
		||||
        } catch (RangeException $e) {
 | 
			
		||||
            throw SassScriptException::forArgument(sprintf('Expected %s to be within %s%s and %s%3$s', $this, $min, $this->unitStr(), $max), $name);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param string|null $varName
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function assertNoUnits($varName = null)
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->unitless()) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        throw SassScriptException::forArgument(sprintf('Expected %s to have no units.', $this), $varName);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param string      $unit
 | 
			
		||||
     * @param string|null $varName
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function assertUnit($unit, $varName = null)
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->hasUnit($unit)) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        throw SassScriptException::forArgument(sprintf('Expected %s to have unit "%s".', $this, $unit), $varName);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function assertSameUnitOrUnitless(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        if ($other->unitless()) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($this->numeratorUnits === $other->numeratorUnits && $this->denominatorUnits === $other->denominatorUnits) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        throw new SassScriptException(sprintf(
 | 
			
		||||
            'Incompatible units %s and %s.',
 | 
			
		||||
            self::getUnitString($this->numeratorUnits, $this->denominatorUnits),
 | 
			
		||||
            self::getUnitString($other->numeratorUnits, $other->denominatorUnits)
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns a copy of this number, converted to the units represented by $newNumeratorUnits and $newDenominatorUnits.
 | 
			
		||||
     *
 | 
			
		||||
     * This does not throw an error if this number is unitless and
 | 
			
		||||
     * $newNumeratorUnits/$newDenominatorUnits are not empty, or vice versa. Instead,
 | 
			
		||||
     * it treats all unitless numbers as convertible to and from all units without
 | 
			
		||||
     * changing the value.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string[] $newNumeratorUnits
 | 
			
		||||
     * @param string[] $newDenominatorUnits
 | 
			
		||||
     *
 | 
			
		||||
     * @return Number
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-param list<string> $newNumeratorUnits
 | 
			
		||||
     * @phpstan-param list<string> $newDenominatorUnits
 | 
			
		||||
     *
 | 
			
		||||
     * @throws SassScriptException if this number's units are not compatible with $newNumeratorUnits and $newDenominatorUnits
 | 
			
		||||
     */
 | 
			
		||||
    public function coerce(array $newNumeratorUnits, array $newDenominatorUnits)
 | 
			
		||||
    {
 | 
			
		||||
        return new Number($this->valueInUnits($newNumeratorUnits, $newDenominatorUnits), $newNumeratorUnits, $newDenominatorUnits);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool
 | 
			
		||||
     */
 | 
			
		||||
    public function isComparableTo(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->unitless() || $other->unitless()) {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            $this->greaterThan($other);
 | 
			
		||||
            return true;
 | 
			
		||||
        } catch (SassScriptException $e) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool
 | 
			
		||||
     */
 | 
			
		||||
    public function lessThan(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->coerceUnits($other, function ($num1, $num2) {
 | 
			
		||||
            return $num1 < $num2;
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool
 | 
			
		||||
     */
 | 
			
		||||
    public function lessThanOrEqual(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->coerceUnits($other, function ($num1, $num2) {
 | 
			
		||||
            return $num1 <= $num2;
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool
 | 
			
		||||
     */
 | 
			
		||||
    public function greaterThan(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->coerceUnits($other, function ($num1, $num2) {
 | 
			
		||||
            return $num1 > $num2;
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool
 | 
			
		||||
     */
 | 
			
		||||
    public function greaterThanOrEqual(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->coerceUnits($other, function ($num1, $num2) {
 | 
			
		||||
            return $num1 >= $num2;
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return Number
 | 
			
		||||
     */
 | 
			
		||||
    public function plus(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->coerceNumber($other, function ($num1, $num2) {
 | 
			
		||||
            return $num1 + $num2;
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return Number
 | 
			
		||||
     */
 | 
			
		||||
    public function minus(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->coerceNumber($other, function ($num1, $num2) {
 | 
			
		||||
            return $num1 - $num2;
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return Number
 | 
			
		||||
     */
 | 
			
		||||
    public function unaryMinus()
 | 
			
		||||
    {
 | 
			
		||||
        return new Number(-$this->dimension, $this->numeratorUnits, $this->denominatorUnits);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return Number
 | 
			
		||||
     */
 | 
			
		||||
    public function modulo(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->coerceNumber($other, function ($num1, $num2) {
 | 
			
		||||
            if ($num2 == 0) {
 | 
			
		||||
                return NAN;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $result = fmod($num1, $num2);
 | 
			
		||||
 | 
			
		||||
            if ($result == 0) {
 | 
			
		||||
                return 0;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if ($num2 < 0 xor $num1 < 0) {
 | 
			
		||||
                $result += $num2;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return $result;
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return Number
 | 
			
		||||
     */
 | 
			
		||||
    public function times(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->multiplyUnits($this->dimension * $other->dimension, $this->numeratorUnits, $this->denominatorUnits, $other->numeratorUnits, $other->denominatorUnits);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return Number
 | 
			
		||||
     */
 | 
			
		||||
    public function dividedBy(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        if ($other->dimension == 0) {
 | 
			
		||||
            if ($this->dimension == 0) {
 | 
			
		||||
                $value = NAN;
 | 
			
		||||
            } elseif ($this->dimension > 0) {
 | 
			
		||||
                $value = INF;
 | 
			
		||||
            } else {
 | 
			
		||||
                $value = -INF;
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            $value = $this->dimension / $other->dimension;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->multiplyUnits($value, $this->numeratorUnits, $this->denominatorUnits, $other->denominatorUnits, $other->numeratorUnits);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool
 | 
			
		||||
     */
 | 
			
		||||
    public function equals(Number $other)
 | 
			
		||||
    {
 | 
			
		||||
        // Unitless numbers are convertable to unit numbers, but not equal, so we special-case unitless here.
 | 
			
		||||
        if ($this->unitless() !== $other->unitless()) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // In Sass, neither NaN nor Infinity are equal to themselves, while PHP defines INF==INF
 | 
			
		||||
        if (is_nan($this->dimension) || is_nan($other->dimension) || !is_finite($this->dimension) || !is_finite($other->dimension)) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($this->unitless()) {
 | 
			
		||||
            return round($this->dimension, self::PRECISION) == round($other->dimension, self::PRECISION);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            return $this->coerceUnits($other, function ($num1, $num2) {
 | 
			
		||||
                return round($num1,self::PRECISION) == round($num2, self::PRECISION);
 | 
			
		||||
            });
 | 
			
		||||
        } catch (SassScriptException $e) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Output number
 | 
			
		||||
     *
 | 
			
		||||
     * @param \ScssPhp\ScssPhp\Compiler $compiler
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function output(Compiler $compiler = null)
 | 
			
		||||
    {
 | 
			
		||||
        $dimension = round($this->dimension, self::PRECISION);
 | 
			
		||||
 | 
			
		||||
        if (is_nan($dimension)) {
 | 
			
		||||
            return 'NaN';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($dimension === INF) {
 | 
			
		||||
            return 'Infinity';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($dimension === -INF) {
 | 
			
		||||
            return '-Infinity';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($compiler) {
 | 
			
		||||
            $unit = $this->unitStr();
 | 
			
		||||
        } elseif (isset($this->numeratorUnits[0])) {
 | 
			
		||||
            $unit = $this->numeratorUnits[0];
 | 
			
		||||
        } else {
 | 
			
		||||
            $unit = '';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $dimension = number_format($dimension, self::PRECISION, '.', '');
 | 
			
		||||
 | 
			
		||||
        return rtrim(rtrim($dimension, '0'), '.') . $unit;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    public function __toString()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->output();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number   $other
 | 
			
		||||
     * @param callable $operation
 | 
			
		||||
     *
 | 
			
		||||
     * @return Number
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-param callable(int|float, int|float): (int|float) $operation
 | 
			
		||||
     */
 | 
			
		||||
    private function coerceNumber(Number $other, $operation)
 | 
			
		||||
    {
 | 
			
		||||
        $result = $this->coerceUnits($other, $operation);
 | 
			
		||||
 | 
			
		||||
        if (!$this->unitless()) {
 | 
			
		||||
            return new Number($result, $this->numeratorUnits, $this->denominatorUnits);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return new Number($result, $other->numeratorUnits, $other->denominatorUnits);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param Number $other
 | 
			
		||||
     * @param callable $operation
 | 
			
		||||
     *
 | 
			
		||||
     * @return mixed
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-template T
 | 
			
		||||
     * @phpstan-param callable(int|float, int|float): T $operation
 | 
			
		||||
     * @phpstan-return T
 | 
			
		||||
     */
 | 
			
		||||
    private function coerceUnits(Number $other, $operation)
 | 
			
		||||
    {
 | 
			
		||||
        if (!$this->unitless()) {
 | 
			
		||||
            $num1 = $this->dimension;
 | 
			
		||||
            $num2 = $other->valueInUnits($this->numeratorUnits, $this->denominatorUnits);
 | 
			
		||||
        } else {
 | 
			
		||||
            $num1 = $this->valueInUnits($other->numeratorUnits, $other->denominatorUnits);
 | 
			
		||||
            $num2 = $other->dimension;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return \call_user_func($operation, $num1, $num2);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param string[] $numeratorUnits
 | 
			
		||||
     * @param string[] $denominatorUnits
 | 
			
		||||
     *
 | 
			
		||||
     * @return int|float
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-param list<string> $numeratorUnits
 | 
			
		||||
     * @phpstan-param list<string> $denominatorUnits
 | 
			
		||||
     *
 | 
			
		||||
     * @throws SassScriptException if this number's units are not compatible with $numeratorUnits and $denominatorUnits
 | 
			
		||||
     */
 | 
			
		||||
    private function valueInUnits(array $numeratorUnits, array $denominatorUnits)
 | 
			
		||||
    {
 | 
			
		||||
        if (
 | 
			
		||||
            $this->unitless()
 | 
			
		||||
            || (\count($numeratorUnits) === 0 && \count($denominatorUnits) === 0)
 | 
			
		||||
            || ($this->numeratorUnits === $numeratorUnits && $this->denominatorUnits === $denominatorUnits)
 | 
			
		||||
        ) {
 | 
			
		||||
            return $this->dimension;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $value = $this->dimension;
 | 
			
		||||
        $oldNumerators = $this->numeratorUnits;
 | 
			
		||||
 | 
			
		||||
        foreach ($numeratorUnits as $newNumerator) {
 | 
			
		||||
            foreach ($oldNumerators as $key => $oldNumerator) {
 | 
			
		||||
                $conversionFactor = self::getConversionFactor($newNumerator, $oldNumerator);
 | 
			
		||||
 | 
			
		||||
                if (\is_null($conversionFactor)) {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $value *= $conversionFactor;
 | 
			
		||||
                unset($oldNumerators[$key]);
 | 
			
		||||
                continue 2;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            throw new SassScriptException(sprintf(
 | 
			
		||||
                'Incompatible units %s and %s.',
 | 
			
		||||
                self::getUnitString($this->numeratorUnits, $this->denominatorUnits),
 | 
			
		||||
                self::getUnitString($numeratorUnits, $denominatorUnits)
 | 
			
		||||
            ));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $oldDenominators = $this->denominatorUnits;
 | 
			
		||||
 | 
			
		||||
        foreach ($denominatorUnits as $newDenominator) {
 | 
			
		||||
            foreach ($oldDenominators as $key => $oldDenominator) {
 | 
			
		||||
                $conversionFactor = self::getConversionFactor($newDenominator, $oldDenominator);
 | 
			
		||||
 | 
			
		||||
                if (\is_null($conversionFactor)) {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $value /= $conversionFactor;
 | 
			
		||||
                unset($oldDenominators[$key]);
 | 
			
		||||
                continue 2;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            throw new SassScriptException(sprintf(
 | 
			
		||||
                'Incompatible units %s and %s.',
 | 
			
		||||
                self::getUnitString($this->numeratorUnits, $this->denominatorUnits),
 | 
			
		||||
                self::getUnitString($numeratorUnits, $denominatorUnits)
 | 
			
		||||
            ));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (\count($oldNumerators) || \count($oldDenominators)) {
 | 
			
		||||
            throw new SassScriptException(sprintf(
 | 
			
		||||
                'Incompatible units %s and %s.',
 | 
			
		||||
                self::getUnitString($this->numeratorUnits, $this->denominatorUnits),
 | 
			
		||||
                self::getUnitString($numeratorUnits, $denominatorUnits)
 | 
			
		||||
            ));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $value;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param int|float $value
 | 
			
		||||
     * @param string[] $numerators1
 | 
			
		||||
     * @param string[] $denominators1
 | 
			
		||||
     * @param string[] $numerators2
 | 
			
		||||
     * @param string[] $denominators2
 | 
			
		||||
     *
 | 
			
		||||
     * @return Number
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-param list<string> $numerators1
 | 
			
		||||
     * @phpstan-param list<string> $denominators1
 | 
			
		||||
     * @phpstan-param list<string> $numerators2
 | 
			
		||||
     * @phpstan-param list<string> $denominators2
 | 
			
		||||
     */
 | 
			
		||||
    private function multiplyUnits($value, array $numerators1, array $denominators1, array $numerators2, array $denominators2)
 | 
			
		||||
    {
 | 
			
		||||
        $newNumerators = array();
 | 
			
		||||
 | 
			
		||||
        foreach ($numerators1 as $numerator) {
 | 
			
		||||
            foreach ($denominators2 as $key => $denominator) {
 | 
			
		||||
                $conversionFactor = self::getConversionFactor($numerator, $denominator);
 | 
			
		||||
 | 
			
		||||
                if (\is_null($conversionFactor)) {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $value /= $conversionFactor;
 | 
			
		||||
                unset($denominators2[$key]);
 | 
			
		||||
                continue 2;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $newNumerators[] = $numerator;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        foreach ($numerators2 as $numerator) {
 | 
			
		||||
            foreach ($denominators1 as $key => $denominator) {
 | 
			
		||||
                $conversionFactor = self::getConversionFactor($numerator, $denominator);
 | 
			
		||||
 | 
			
		||||
                if (\is_null($conversionFactor)) {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $value /= $conversionFactor;
 | 
			
		||||
                unset($denominators1[$key]);
 | 
			
		||||
                continue 2;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $newNumerators[] = $numerator;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $newDenominators = array_values(array_merge($denominators1, $denominators2));
 | 
			
		||||
 | 
			
		||||
        return new Number($value, $newNumerators, $newDenominators);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the number of [unit1]s per [unit2].
 | 
			
		||||
     *
 | 
			
		||||
     * Equivalently, `1unit1 * conversionFactor(unit1, unit2) = 1unit2`.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $unit1
 | 
			
		||||
     * @param string $unit2
 | 
			
		||||
     *
 | 
			
		||||
     * @return float|int|null
 | 
			
		||||
     */
 | 
			
		||||
    private static function getConversionFactor($unit1, $unit2)
 | 
			
		||||
    {
 | 
			
		||||
        if ($unit1 === $unit2) {
 | 
			
		||||
            return 1;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        foreach (static::$unitTable as $unitVariants) {
 | 
			
		||||
            if (isset($unitVariants[$unit1]) && isset($unitVariants[$unit2])) {
 | 
			
		||||
                return $unitVariants[$unit1] / $unitVariants[$unit2];
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns unit(s) as the product of numerator units divided by the product of denominator units
 | 
			
		||||
     *
 | 
			
		||||
     * @param string[] $numerators
 | 
			
		||||
     * @param string[] $denominators
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-param list<string> $numerators
 | 
			
		||||
     * @phpstan-param list<string> $denominators
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    private static function getUnitString(array $numerators, array $denominators)
 | 
			
		||||
    {
 | 
			
		||||
        if (!\count($numerators)) {
 | 
			
		||||
            if (\count($denominators) === 0) {
 | 
			
		||||
                return 'no units';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (\count($denominators) === 1) {
 | 
			
		||||
                return $denominators[0] . '^-1';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return '(' . implode('*', $denominators) . ')^-1';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return implode('*', $numerators) . (\count($denominators) ? '/' . implode('*', $denominators) : '');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,9 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
final class OutputStyle
 | 
			
		||||
{
 | 
			
		||||
    const EXPANDED = 'expanded';
 | 
			
		||||
    const COMPRESSED = 'compressed';
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4128
									
								
								include/thirdparty/ScssPhp/Scssphp181/Parser.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4128
									
								
								include/thirdparty/ScssPhp/Scssphp181/Parser.php
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										72
									
								
								include/thirdparty/ScssPhp/Scssphp181/README.md
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										72
									
								
								include/thirdparty/ScssPhp/Scssphp181/README.md
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,72 +0,0 @@
 | 
			
		|||
# scssphp 1.8.1  Fix compatibility with PHP 8.1 ---  MIT License 
 | 
			
		||||
 | 
			
		||||
### <https://scssphp.github.io/scssphp>
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
[](https://packagist.org/packages/scssphp/scssphp)
 | 
			
		||||
 | 
			
		||||
`scssphp` is a compiler for SCSS written in PHP.
 | 
			
		||||
 | 
			
		||||
Checkout the homepage, <https://scssphp.github.io/scssphp>, for directions on how to use.
 | 
			
		||||
 | 
			
		||||
## Running Tests
 | 
			
		||||
 | 
			
		||||
`scssphp` uses [PHPUnit](https://github.com/sebastianbergmann/phpunit) for testing.
 | 
			
		||||
 | 
			
		||||
Run the following command from the root directory to run every test:
 | 
			
		||||
 | 
			
		||||
    vendor/bin/phpunit tests
 | 
			
		||||
 | 
			
		||||
There are several tests in the `tests/` directory:
 | 
			
		||||
 | 
			
		||||
* `ApiTest.php` contains various unit tests that test the PHP interface.
 | 
			
		||||
* `ExceptionTest.php` contains unit tests that test for exceptions thrown by the parser and compiler.
 | 
			
		||||
* `FailingTest.php` contains tests reported in Github issues that demonstrate compatibility bugs.
 | 
			
		||||
* `InputTest.php` compiles every `.scss` file in the `tests/inputs` directory
 | 
			
		||||
  then compares to the respective `.css` file in the `tests/outputs` directory.
 | 
			
		||||
* `SassSpecTest.php` extracts tests from the `sass/sass-spec` repository.
 | 
			
		||||
 | 
			
		||||
When changing any of the tests in `tests/inputs`, the tests will most likely
 | 
			
		||||
fail because the output has changed. Once you verify that the output is correct
 | 
			
		||||
you can run the following command to rebuild all the tests:
 | 
			
		||||
 | 
			
		||||
    BUILD=1 vendor/bin/phpunit tests
 | 
			
		||||
 | 
			
		||||
This will compile all the tests, and save results into `tests/outputs`. It also
 | 
			
		||||
updates the list of excluded specs from sass-spec.
 | 
			
		||||
 | 
			
		||||
To enable the full `sass-spec` compatibility tests:
 | 
			
		||||
 | 
			
		||||
    TEST_SASS_SPEC=1 vendor/bin/phpunit tests
 | 
			
		||||
 | 
			
		||||
## Coding Standard
 | 
			
		||||
 | 
			
		||||
`scssphp` source conforms to [PSR12](https://www.php-fig.org/psr/psr-12/).
 | 
			
		||||
 | 
			
		||||
Run the following command from the root directory to check the code for "sniffs".
 | 
			
		||||
 | 
			
		||||
    vendor/bin/phpcs --standard=PSR12 --extensions=php bin src tests *.php
 | 
			
		||||
 | 
			
		||||
## Static Analysis
 | 
			
		||||
 | 
			
		||||
`scssphp` uses [phpstan](https://phpstan.org/) for static analysis.
 | 
			
		||||
 | 
			
		||||
Run the following command from the root directory to analyse the codebase:
 | 
			
		||||
 | 
			
		||||
    make phpstan
 | 
			
		||||
 | 
			
		||||
As most of the codebase is composed of legacy code which cannot be type-checked
 | 
			
		||||
fully, the setup contains a baseline file with all errors we want to ignore. In
 | 
			
		||||
particular, we ignore all errors related to not specifying the types inside arrays
 | 
			
		||||
when these arrays correspond to the representation of Sass values and Sass AST nodes
 | 
			
		||||
in the parser and compiler.
 | 
			
		||||
When contributing, the proper process to deal with static analysis is the following:
 | 
			
		||||
 | 
			
		||||
1. Make your change in the codebase
 | 
			
		||||
2. Run `make phpstan`
 | 
			
		||||
3. Fix errors reported by phpstan when possible
 | 
			
		||||
4. Repeat step 2 and 3 until nothing gets fixed anymore at step 3
 | 
			
		||||
5. Run `make phpstan-baseline` to regenerate the phpstan baseline
 | 
			
		||||
 | 
			
		||||
Additions to the baseline will be reviewed to avoid ignoring errors that should have
 | 
			
		||||
been fixed.
 | 
			
		||||
| 
						 | 
				
			
			@ -1,187 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\SourceMap;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Base 64 Encode/Decode
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class Base64
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array<int, string>
 | 
			
		||||
     */
 | 
			
		||||
    private static $encodingMap = [
 | 
			
		||||
        0 => 'A',
 | 
			
		||||
        1 => 'B',
 | 
			
		||||
        2 => 'C',
 | 
			
		||||
        3 => 'D',
 | 
			
		||||
        4 => 'E',
 | 
			
		||||
        5 => 'F',
 | 
			
		||||
        6 => 'G',
 | 
			
		||||
        7 => 'H',
 | 
			
		||||
        8 => 'I',
 | 
			
		||||
        9 => 'J',
 | 
			
		||||
        10 => 'K',
 | 
			
		||||
        11 => 'L',
 | 
			
		||||
        12 => 'M',
 | 
			
		||||
        13 => 'N',
 | 
			
		||||
        14 => 'O',
 | 
			
		||||
        15 => 'P',
 | 
			
		||||
        16 => 'Q',
 | 
			
		||||
        17 => 'R',
 | 
			
		||||
        18 => 'S',
 | 
			
		||||
        19 => 'T',
 | 
			
		||||
        20 => 'U',
 | 
			
		||||
        21 => 'V',
 | 
			
		||||
        22 => 'W',
 | 
			
		||||
        23 => 'X',
 | 
			
		||||
        24 => 'Y',
 | 
			
		||||
        25 => 'Z',
 | 
			
		||||
        26 => 'a',
 | 
			
		||||
        27 => 'b',
 | 
			
		||||
        28 => 'c',
 | 
			
		||||
        29 => 'd',
 | 
			
		||||
        30 => 'e',
 | 
			
		||||
        31 => 'f',
 | 
			
		||||
        32 => 'g',
 | 
			
		||||
        33 => 'h',
 | 
			
		||||
        34 => 'i',
 | 
			
		||||
        35 => 'j',
 | 
			
		||||
        36 => 'k',
 | 
			
		||||
        37 => 'l',
 | 
			
		||||
        38 => 'm',
 | 
			
		||||
        39 => 'n',
 | 
			
		||||
        40 => 'o',
 | 
			
		||||
        41 => 'p',
 | 
			
		||||
        42 => 'q',
 | 
			
		||||
        43 => 'r',
 | 
			
		||||
        44 => 's',
 | 
			
		||||
        45 => 't',
 | 
			
		||||
        46 => 'u',
 | 
			
		||||
        47 => 'v',
 | 
			
		||||
        48 => 'w',
 | 
			
		||||
        49 => 'x',
 | 
			
		||||
        50 => 'y',
 | 
			
		||||
        51 => 'z',
 | 
			
		||||
        52 => '0',
 | 
			
		||||
        53 => '1',
 | 
			
		||||
        54 => '2',
 | 
			
		||||
        55 => '3',
 | 
			
		||||
        56 => '4',
 | 
			
		||||
        57 => '5',
 | 
			
		||||
        58 => '6',
 | 
			
		||||
        59 => '7',
 | 
			
		||||
        60 => '8',
 | 
			
		||||
        61 => '9',
 | 
			
		||||
        62 => '+',
 | 
			
		||||
        63 => '/',
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array<string|int, int>
 | 
			
		||||
     */
 | 
			
		||||
    private static $decodingMap = [
 | 
			
		||||
        'A' => 0,
 | 
			
		||||
        'B' => 1,
 | 
			
		||||
        'C' => 2,
 | 
			
		||||
        'D' => 3,
 | 
			
		||||
        'E' => 4,
 | 
			
		||||
        'F' => 5,
 | 
			
		||||
        'G' => 6,
 | 
			
		||||
        'H' => 7,
 | 
			
		||||
        'I' => 8,
 | 
			
		||||
        'J' => 9,
 | 
			
		||||
        'K' => 10,
 | 
			
		||||
        'L' => 11,
 | 
			
		||||
        'M' => 12,
 | 
			
		||||
        'N' => 13,
 | 
			
		||||
        'O' => 14,
 | 
			
		||||
        'P' => 15,
 | 
			
		||||
        'Q' => 16,
 | 
			
		||||
        'R' => 17,
 | 
			
		||||
        'S' => 18,
 | 
			
		||||
        'T' => 19,
 | 
			
		||||
        'U' => 20,
 | 
			
		||||
        'V' => 21,
 | 
			
		||||
        'W' => 22,
 | 
			
		||||
        'X' => 23,
 | 
			
		||||
        'Y' => 24,
 | 
			
		||||
        'Z' => 25,
 | 
			
		||||
        'a' => 26,
 | 
			
		||||
        'b' => 27,
 | 
			
		||||
        'c' => 28,
 | 
			
		||||
        'd' => 29,
 | 
			
		||||
        'e' => 30,
 | 
			
		||||
        'f' => 31,
 | 
			
		||||
        'g' => 32,
 | 
			
		||||
        'h' => 33,
 | 
			
		||||
        'i' => 34,
 | 
			
		||||
        'j' => 35,
 | 
			
		||||
        'k' => 36,
 | 
			
		||||
        'l' => 37,
 | 
			
		||||
        'm' => 38,
 | 
			
		||||
        'n' => 39,
 | 
			
		||||
        'o' => 40,
 | 
			
		||||
        'p' => 41,
 | 
			
		||||
        'q' => 42,
 | 
			
		||||
        'r' => 43,
 | 
			
		||||
        's' => 44,
 | 
			
		||||
        't' => 45,
 | 
			
		||||
        'u' => 46,
 | 
			
		||||
        'v' => 47,
 | 
			
		||||
        'w' => 48,
 | 
			
		||||
        'x' => 49,
 | 
			
		||||
        'y' => 50,
 | 
			
		||||
        'z' => 51,
 | 
			
		||||
        0 => 52,
 | 
			
		||||
        1 => 53,
 | 
			
		||||
        2 => 54,
 | 
			
		||||
        3 => 55,
 | 
			
		||||
        4 => 56,
 | 
			
		||||
        5 => 57,
 | 
			
		||||
        6 => 58,
 | 
			
		||||
        7 => 59,
 | 
			
		||||
        8 => 60,
 | 
			
		||||
        9 => 61,
 | 
			
		||||
        '+' => 62,
 | 
			
		||||
        '/' => 63,
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Convert to base64
 | 
			
		||||
     *
 | 
			
		||||
     * @param integer $value
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public static function encode($value)
 | 
			
		||||
    {
 | 
			
		||||
        return self::$encodingMap[$value];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Convert from base64
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $value
 | 
			
		||||
     *
 | 
			
		||||
     * @return integer
 | 
			
		||||
     */
 | 
			
		||||
    public static function decode($value)
 | 
			
		||||
    {
 | 
			
		||||
        return self::$decodingMap[$value];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,151 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\SourceMap;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Base 64 VLQ
 | 
			
		||||
 *
 | 
			
		||||
 * Based on the Base 64 VLQ implementation in Closure Compiler:
 | 
			
		||||
 * https://github.com/google/closure-compiler/blob/master/src/com/google/debugging/sourcemap/Base64VLQ.java
 | 
			
		||||
 *
 | 
			
		||||
 * Copyright 2011 The Closure Compiler Authors.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 *
 | 
			
		||||
 * @author John Lenz <johnlenz@google.com>
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class Base64VLQ
 | 
			
		||||
{
 | 
			
		||||
    // A Base64 VLQ digit can represent 5 bits, so it is base-32.
 | 
			
		||||
    const VLQ_BASE_SHIFT = 5;
 | 
			
		||||
 | 
			
		||||
    // A mask of bits for a VLQ digit (11111), 31 decimal.
 | 
			
		||||
    const VLQ_BASE_MASK = 31;
 | 
			
		||||
 | 
			
		||||
    // The continuation bit is the 6th bit.
 | 
			
		||||
    const VLQ_CONTINUATION_BIT = 32;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the VLQ encoded value.
 | 
			
		||||
     *
 | 
			
		||||
     * @param integer $value
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public static function encode($value)
 | 
			
		||||
    {
 | 
			
		||||
        $encoded = '';
 | 
			
		||||
        $vlq = self::toVLQSigned($value);
 | 
			
		||||
 | 
			
		||||
        do {
 | 
			
		||||
            $digit = $vlq & self::VLQ_BASE_MASK;
 | 
			
		||||
 | 
			
		||||
            //$vlq >>>= self::VLQ_BASE_SHIFT; // unsigned right shift
 | 
			
		||||
            $vlq = (($vlq >> 1) & PHP_INT_MAX) >> (self::VLQ_BASE_SHIFT - 1);
 | 
			
		||||
 | 
			
		||||
            if ($vlq > 0) {
 | 
			
		||||
                $digit |= self::VLQ_CONTINUATION_BIT;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $encoded .= Base64::encode($digit);
 | 
			
		||||
        } while ($vlq > 0);
 | 
			
		||||
 | 
			
		||||
        return $encoded;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Decodes VLQValue.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $str
 | 
			
		||||
     * @param integer $index
 | 
			
		||||
     *
 | 
			
		||||
     * @return integer
 | 
			
		||||
     */
 | 
			
		||||
    public static function decode($str, &$index)
 | 
			
		||||
    {
 | 
			
		||||
        $result = 0;
 | 
			
		||||
        $shift = 0;
 | 
			
		||||
 | 
			
		||||
        do {
 | 
			
		||||
            $c = $str[$index++];
 | 
			
		||||
            $digit = Base64::decode($c);
 | 
			
		||||
            $continuation = ($digit & self::VLQ_CONTINUATION_BIT) != 0;
 | 
			
		||||
            $digit &= self::VLQ_BASE_MASK;
 | 
			
		||||
            $result = $result + ($digit << $shift);
 | 
			
		||||
            $shift = $shift + self::VLQ_BASE_SHIFT;
 | 
			
		||||
        } while ($continuation);
 | 
			
		||||
 | 
			
		||||
        return self::fromVLQSigned($result);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Converts from a two-complement value to a value where the sign bit is
 | 
			
		||||
     * 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)
 | 
			
		||||
     *
 | 
			
		||||
     * @param integer $value
 | 
			
		||||
     *
 | 
			
		||||
     * @return integer
 | 
			
		||||
     */
 | 
			
		||||
    private static function toVLQSigned($value)
 | 
			
		||||
    {
 | 
			
		||||
        if ($value < 0) {
 | 
			
		||||
            return ((-$value) << 1) + 1;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return ($value << 1) + 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Converts to a two-complement value from a value where the sign bit is
 | 
			
		||||
     * 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
 | 
			
		||||
     *
 | 
			
		||||
     * @param integer $value
 | 
			
		||||
     *
 | 
			
		||||
     * @return integer
 | 
			
		||||
     */
 | 
			
		||||
    private static function fromVLQSigned($value)
 | 
			
		||||
    {
 | 
			
		||||
        $negate = ($value & 1) === 1;
 | 
			
		||||
 | 
			
		||||
        //$value >>>= 1; // unsigned right shift
 | 
			
		||||
        $value = ($value >> 1) & PHP_INT_MAX;
 | 
			
		||||
 | 
			
		||||
        if (! $negate) {
 | 
			
		||||
            return $value;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // We need to OR 0x80000000 here to ensure the 32nd bit (the sign bit) is
 | 
			
		||||
        // always set for negative numbers. If `value` were 1, (meaning `negate` is
 | 
			
		||||
        // true and all other bits were zeros), `value` would now be 0. -0 is just
 | 
			
		||||
        // 0, and doesn't flip the 32nd bit as intended. All positive numbers will
 | 
			
		||||
        // successfully flip the 32nd bit without issue, so it's a noop for them.
 | 
			
		||||
        return -$value | 0x80000000;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,381 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\SourceMap;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Exception\CompilerException;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Source Map Generator
 | 
			
		||||
 *
 | 
			
		||||
 * {@internal Derivative of oyejorge/less.php's lib/SourceMap/Generator.php, relicensed with permission. }}
 | 
			
		||||
 *
 | 
			
		||||
 * @author Josh Schmidt <oyejorge@gmail.com>
 | 
			
		||||
 * @author Nicolas FRANÇOIS <nicolas.francois@frog-labs.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class SourceMapGenerator
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * What version of source map does the generator generate?
 | 
			
		||||
     */
 | 
			
		||||
    const VERSION = 3;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Array of default options
 | 
			
		||||
     *
 | 
			
		||||
     * @var array
 | 
			
		||||
     * @phpstan-var array{sourceRoot: string, sourceMapFilename: string|null, sourceMapURL: string|null, sourceMapWriteTo: string|null, outputSourceFiles: bool, sourceMapRootpath: string, sourceMapBasepath: string}
 | 
			
		||||
     */
 | 
			
		||||
    protected $defaultOptions = [
 | 
			
		||||
        // an optional source root, useful for relocating source files
 | 
			
		||||
        // on a server or removing repeated values in the 'sources' entry.
 | 
			
		||||
        // This value is prepended to the individual entries in the 'source' field.
 | 
			
		||||
        'sourceRoot' => '',
 | 
			
		||||
 | 
			
		||||
        // an optional name of the generated code that this source map is associated with.
 | 
			
		||||
        'sourceMapFilename' => null,
 | 
			
		||||
 | 
			
		||||
        // url of the map
 | 
			
		||||
        'sourceMapURL' => null,
 | 
			
		||||
 | 
			
		||||
        // absolute path to a file to write the map to
 | 
			
		||||
        'sourceMapWriteTo' => null,
 | 
			
		||||
 | 
			
		||||
        // output source contents?
 | 
			
		||||
        'outputSourceFiles' => false,
 | 
			
		||||
 | 
			
		||||
        // base path for filename normalization
 | 
			
		||||
        'sourceMapRootpath' => '',
 | 
			
		||||
 | 
			
		||||
        // base path for filename normalization
 | 
			
		||||
        'sourceMapBasepath' => ''
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The base64 VLQ encoder
 | 
			
		||||
     *
 | 
			
		||||
     * @var \ScssPhp\ScssPhp\SourceMap\Base64VLQ
 | 
			
		||||
     */
 | 
			
		||||
    protected $encoder;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Array of mappings
 | 
			
		||||
     *
 | 
			
		||||
     * @var array
 | 
			
		||||
     * @phpstan-var list<array{generated_line: int, generated_column: int, original_line: int, original_column: int, source_file: string}>
 | 
			
		||||
     */
 | 
			
		||||
    protected $mappings = [];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Array of contents map
 | 
			
		||||
     *
 | 
			
		||||
     * @var array
 | 
			
		||||
     */
 | 
			
		||||
    protected $contentsMap = [];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * File to content map
 | 
			
		||||
     *
 | 
			
		||||
     * @var array<string, string>
 | 
			
		||||
     */
 | 
			
		||||
    protected $sources = [];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array<string, int>
 | 
			
		||||
     */
 | 
			
		||||
    protected $sourceKeys = [];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array
 | 
			
		||||
     * @phpstan-var array{sourceRoot: string, sourceMapFilename: string|null, sourceMapURL: string|null, sourceMapWriteTo: string|null, outputSourceFiles: bool, sourceMapRootpath: string, sourceMapBasepath: string}
 | 
			
		||||
     */
 | 
			
		||||
    private $options;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @phpstan-param array{sourceRoot?: string, sourceMapFilename?: string|null, sourceMapURL?: string|null, sourceMapWriteTo?: string|null, outputSourceFiles?: bool, sourceMapRootpath?: string, sourceMapBasepath?: string} $options
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct(array $options = [])
 | 
			
		||||
    {
 | 
			
		||||
        $this->options = array_merge($this->defaultOptions, $options);
 | 
			
		||||
        $this->encoder = new Base64VLQ();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Adds a mapping
 | 
			
		||||
     *
 | 
			
		||||
     * @param integer $generatedLine   The line number in generated file
 | 
			
		||||
     * @param integer $generatedColumn The column number in generated file
 | 
			
		||||
     * @param integer $originalLine    The line number in original file
 | 
			
		||||
     * @param integer $originalColumn  The column number in original file
 | 
			
		||||
     * @param string  $sourceFile      The original source file
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function addMapping($generatedLine, $generatedColumn, $originalLine, $originalColumn, $sourceFile)
 | 
			
		||||
    {
 | 
			
		||||
        $this->mappings[] = [
 | 
			
		||||
            'generated_line'   => $generatedLine,
 | 
			
		||||
            'generated_column' => $generatedColumn,
 | 
			
		||||
            'original_line'    => $originalLine,
 | 
			
		||||
            'original_column'  => $originalColumn,
 | 
			
		||||
            'source_file'      => $sourceFile
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        $this->sources[$sourceFile] = $sourceFile;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Saves the source map to a file
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $content The content to write
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     *
 | 
			
		||||
     * @throws \ScssPhp\ScssPhp\Exception\CompilerException If the file could not be saved
 | 
			
		||||
     * @deprecated
 | 
			
		||||
     */
 | 
			
		||||
    public function saveMap($content)
 | 
			
		||||
    {
 | 
			
		||||
        $file = $this->options['sourceMapWriteTo'];
 | 
			
		||||
        $dir  = \dirname($file);
 | 
			
		||||
 | 
			
		||||
        // directory does not exist
 | 
			
		||||
        if (! is_dir($dir)) {
 | 
			
		||||
            // FIXME: create the dir automatically?
 | 
			
		||||
            throw new CompilerException(
 | 
			
		||||
                sprintf('The directory "%s" does not exist. Cannot save the source map.', $dir)
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // FIXME: proper saving, with dir write check!
 | 
			
		||||
        if (file_put_contents($file, $content) === false) {
 | 
			
		||||
            throw new CompilerException(sprintf('Cannot save the source map to "%s"', $file));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->options['sourceMapURL'];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Generates the JSON source map
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $prefix A prefix added in the output file, which needs to shift mappings
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     *
 | 
			
		||||
     * @see https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#
 | 
			
		||||
     */
 | 
			
		||||
    public function generateJson($prefix = '')
 | 
			
		||||
    {
 | 
			
		||||
        $sourceMap = [];
 | 
			
		||||
        $mappings  = $this->generateMappings($prefix);
 | 
			
		||||
 | 
			
		||||
        // File version (always the first entry in the object) and must be a positive integer.
 | 
			
		||||
        $sourceMap['version'] = self::VERSION;
 | 
			
		||||
 | 
			
		||||
        // An optional name of the generated code that this source map is associated with.
 | 
			
		||||
        $file = $this->options['sourceMapFilename'];
 | 
			
		||||
 | 
			
		||||
        if ($file) {
 | 
			
		||||
            $sourceMap['file'] = $file;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // An optional source root, useful for relocating source files on a server or removing repeated values in the
 | 
			
		||||
        // 'sources' entry. This value is prepended to the individual entries in the 'source' field.
 | 
			
		||||
        $root = $this->options['sourceRoot'];
 | 
			
		||||
 | 
			
		||||
        if ($root) {
 | 
			
		||||
            $sourceMap['sourceRoot'] = $root;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // A list of original sources used by the 'mappings' entry.
 | 
			
		||||
        $sourceMap['sources'] = [];
 | 
			
		||||
 | 
			
		||||
        foreach ($this->sources as $sourceUri => $sourceFilename) {
 | 
			
		||||
            $sourceMap['sources'][] = $this->normalizeFilename($sourceFilename);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // A list of symbol names used by the 'mappings' entry.
 | 
			
		||||
        $sourceMap['names'] = [];
 | 
			
		||||
 | 
			
		||||
        // A string with the encoded mapping data.
 | 
			
		||||
        $sourceMap['mappings'] = $mappings;
 | 
			
		||||
 | 
			
		||||
        if ($this->options['outputSourceFiles']) {
 | 
			
		||||
            // An optional list of source content, useful when the 'source' can't be hosted.
 | 
			
		||||
            // The contents are listed in the same order as the sources above.
 | 
			
		||||
            // 'null' may be used if some original sources should be retrieved by name.
 | 
			
		||||
            $sourceMap['sourcesContent'] = $this->getSourcesContent();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // less.js compat fixes
 | 
			
		||||
        if (\count($sourceMap['sources']) && empty($sourceMap['sourceRoot'])) {
 | 
			
		||||
            unset($sourceMap['sourceRoot']);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return json_encode($sourceMap, JSON_UNESCAPED_SLASHES);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the sources contents
 | 
			
		||||
     *
 | 
			
		||||
     * @return string[]|null
 | 
			
		||||
     */
 | 
			
		||||
    protected function getSourcesContent()
 | 
			
		||||
    {
 | 
			
		||||
        if (empty($this->sources)) {
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $content = [];
 | 
			
		||||
 | 
			
		||||
        foreach ($this->sources as $sourceFile) {
 | 
			
		||||
            $content[] = file_get_contents($sourceFile);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $content;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Generates the mappings string
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $prefix A prefix added in the output file, which needs to shift mappings
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function generateMappings($prefix = '')
 | 
			
		||||
    {
 | 
			
		||||
        if (! \count($this->mappings)) {
 | 
			
		||||
            return '';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $prefixLines = substr_count($prefix, "\n");
 | 
			
		||||
        $lastPrefixNewLine = strrpos($prefix, "\n");
 | 
			
		||||
        $lastPrefixLineStart = false === $lastPrefixNewLine ? 0 : $lastPrefixNewLine + 1;
 | 
			
		||||
        $prefixColumn = strlen($prefix) - $lastPrefixLineStart;
 | 
			
		||||
 | 
			
		||||
        $this->sourceKeys = array_flip(array_keys($this->sources));
 | 
			
		||||
 | 
			
		||||
        // group mappings by generated line number.
 | 
			
		||||
        $groupedMap = $groupedMapEncoded = [];
 | 
			
		||||
 | 
			
		||||
        foreach ($this->mappings as $m) {
 | 
			
		||||
            $groupedMap[$m['generated_line']][] = $m;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        ksort($groupedMap);
 | 
			
		||||
 | 
			
		||||
        $lastGeneratedLine = $lastOriginalIndex = $lastOriginalLine = $lastOriginalColumn = 0;
 | 
			
		||||
 | 
			
		||||
        foreach ($groupedMap as $lineNumber => $lineMap) {
 | 
			
		||||
            if ($lineNumber > 1) {
 | 
			
		||||
                // The prefix only impacts the column for the first line of the original output
 | 
			
		||||
                $prefixColumn = 0;
 | 
			
		||||
            }
 | 
			
		||||
            $lineNumber += $prefixLines;
 | 
			
		||||
 | 
			
		||||
            while (++$lastGeneratedLine < $lineNumber) {
 | 
			
		||||
                $groupedMapEncoded[] = ';';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $lineMapEncoded = [];
 | 
			
		||||
            $lastGeneratedColumn = 0;
 | 
			
		||||
 | 
			
		||||
            foreach ($lineMap as $m) {
 | 
			
		||||
                $generatedColumn = $m['generated_column'] + $prefixColumn;
 | 
			
		||||
 | 
			
		||||
                $mapEncoded = $this->encoder->encode($generatedColumn - $lastGeneratedColumn);
 | 
			
		||||
                $lastGeneratedColumn = $generatedColumn;
 | 
			
		||||
 | 
			
		||||
                // find the index
 | 
			
		||||
                if ($m['source_file']) {
 | 
			
		||||
                    $index = $this->findFileIndex($m['source_file']);
 | 
			
		||||
 | 
			
		||||
                    if ($index !== false) {
 | 
			
		||||
                        $mapEncoded .= $this->encoder->encode($index - $lastOriginalIndex);
 | 
			
		||||
                        $lastOriginalIndex = $index;
 | 
			
		||||
                        // lines are stored 0-based in SourceMap spec version 3
 | 
			
		||||
                        $mapEncoded .= $this->encoder->encode($m['original_line'] - 1 - $lastOriginalLine);
 | 
			
		||||
                        $lastOriginalLine = $m['original_line'] - 1;
 | 
			
		||||
                        $mapEncoded .= $this->encoder->encode($m['original_column'] - $lastOriginalColumn);
 | 
			
		||||
                        $lastOriginalColumn = $m['original_column'];
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                $lineMapEncoded[] = $mapEncoded;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $groupedMapEncoded[] = implode(',', $lineMapEncoded) . ';';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return rtrim(implode($groupedMapEncoded), ';');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Finds the index for the filename
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $filename
 | 
			
		||||
     *
 | 
			
		||||
     * @return integer|false
 | 
			
		||||
     */
 | 
			
		||||
    protected function findFileIndex($filename)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->sourceKeys[$filename];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Normalize filename
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $filename
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    protected function normalizeFilename($filename)
 | 
			
		||||
    {
 | 
			
		||||
        $filename = $this->fixWindowsPath($filename);
 | 
			
		||||
        $rootpath = $this->options['sourceMapRootpath'];
 | 
			
		||||
        $basePath = $this->options['sourceMapBasepath'];
 | 
			
		||||
 | 
			
		||||
        // "Trim" the 'sourceMapBasepath' from the output filename.
 | 
			
		||||
        if (\strlen($basePath) && strpos($filename, $basePath) === 0) {
 | 
			
		||||
            $filename = substr($filename, \strlen($basePath));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Remove extra leading path separators.
 | 
			
		||||
        if (strpos($filename, '\\') === 0 || strpos($filename, '/') === 0) {
 | 
			
		||||
            $filename = substr($filename, 1);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $rootpath . $filename;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Fix windows paths
 | 
			
		||||
     *
 | 
			
		||||
     * @param string  $path
 | 
			
		||||
     * @param boolean $addEndSlash
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function fixWindowsPath($path, $addEndSlash = false)
 | 
			
		||||
    {
 | 
			
		||||
        $slash = ($addEndSlash) ? '/' : '';
 | 
			
		||||
 | 
			
		||||
        if (! empty($path)) {
 | 
			
		||||
            $path = str_replace('\\', '/', $path);
 | 
			
		||||
            $path = rtrim($path, '/') . $slash;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $path;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										76
									
								
								include/thirdparty/ScssPhp/Scssphp181/Type.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										76
									
								
								include/thirdparty/ScssPhp/Scssphp181/Type.php
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,76 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Block/node types
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
class Type
 | 
			
		||||
{
 | 
			
		||||
    const T_ASSIGN = 'assign';
 | 
			
		||||
    const T_AT_ROOT = 'at-root';
 | 
			
		||||
    const T_BLOCK = 'block';
 | 
			
		||||
    /** @deprecated */
 | 
			
		||||
    const T_BREAK = 'break';
 | 
			
		||||
    const T_CHARSET = 'charset';
 | 
			
		||||
    const T_COLOR = 'color';
 | 
			
		||||
    const T_COMMENT = 'comment';
 | 
			
		||||
    /** @deprecated */
 | 
			
		||||
    const T_CONTINUE = 'continue';
 | 
			
		||||
    /** @deprecated */
 | 
			
		||||
    const T_CONTROL = 'control';
 | 
			
		||||
    const T_CUSTOM_PROPERTY = 'custom';
 | 
			
		||||
    const T_DEBUG = 'debug';
 | 
			
		||||
    const T_DIRECTIVE = 'directive';
 | 
			
		||||
    const T_EACH = 'each';
 | 
			
		||||
    const T_ELSE = 'else';
 | 
			
		||||
    const T_ELSEIF = 'elseif';
 | 
			
		||||
    const T_ERROR = 'error';
 | 
			
		||||
    const T_EXPRESSION = 'exp';
 | 
			
		||||
    const T_EXTEND = 'extend';
 | 
			
		||||
    const T_FOR = 'for';
 | 
			
		||||
    const T_FUNCTION = 'function';
 | 
			
		||||
    const T_FUNCTION_REFERENCE = 'function-reference';
 | 
			
		||||
    const T_FUNCTION_CALL = 'fncall';
 | 
			
		||||
    const T_HSL = 'hsl';
 | 
			
		||||
    const T_HWB = 'hwb';
 | 
			
		||||
    const T_IF = 'if';
 | 
			
		||||
    const T_IMPORT = 'import';
 | 
			
		||||
    const T_INCLUDE = 'include';
 | 
			
		||||
    const T_INTERPOLATE = 'interpolate';
 | 
			
		||||
    const T_INTERPOLATED = 'interpolated';
 | 
			
		||||
    const T_KEYWORD = 'keyword';
 | 
			
		||||
    const T_LIST = 'list';
 | 
			
		||||
    const T_MAP = 'map';
 | 
			
		||||
    const T_MEDIA = 'media';
 | 
			
		||||
    const T_MEDIA_EXPRESSION = 'mediaExp';
 | 
			
		||||
    const T_MEDIA_TYPE = 'mediaType';
 | 
			
		||||
    const T_MEDIA_VALUE = 'mediaValue';
 | 
			
		||||
    const T_MIXIN = 'mixin';
 | 
			
		||||
    const T_MIXIN_CONTENT = 'mixin_content';
 | 
			
		||||
    const T_NESTED_PROPERTY = 'nestedprop';
 | 
			
		||||
    const T_NOT = 'not';
 | 
			
		||||
    const T_NULL = 'null';
 | 
			
		||||
    const T_NUMBER = 'number';
 | 
			
		||||
    const T_RETURN = 'return';
 | 
			
		||||
    const T_ROOT = 'root';
 | 
			
		||||
    const T_SCSSPHP_IMPORT_ONCE = 'scssphp-import-once';
 | 
			
		||||
    const T_SELF = 'self';
 | 
			
		||||
    const T_STRING = 'string';
 | 
			
		||||
    const T_UNARY = 'unary';
 | 
			
		||||
    const T_VARIABLE = 'var';
 | 
			
		||||
    const T_WARN = 'warn';
 | 
			
		||||
    const T_WHILE = 'while';
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										184
									
								
								include/thirdparty/ScssPhp/Scssphp181/Util.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										184
									
								
								include/thirdparty/ScssPhp/Scssphp181/Util.php
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,184 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Base\Range;
 | 
			
		||||
use ScssPhp\ScssPhp\Exception\RangeException;
 | 
			
		||||
use ScssPhp\ScssPhp\Node\Number;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Utility functions
 | 
			
		||||
 *
 | 
			
		||||
 * @author Anthon Pang <anthon.pang@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class Util
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Asserts that `value` falls within `range` (inclusive), leaving
 | 
			
		||||
     * room for slight floating-point errors.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string       $name  The name of the value. Used in the error message.
 | 
			
		||||
     * @param Range        $range Range of values.
 | 
			
		||||
     * @param array|Number $value The value to check.
 | 
			
		||||
     * @param string       $unit  The unit of the value. Used in error reporting.
 | 
			
		||||
     *
 | 
			
		||||
     * @return mixed `value` adjusted to fall within range, if it was outside by a floating-point margin.
 | 
			
		||||
     *
 | 
			
		||||
     * @throws \ScssPhp\ScssPhp\Exception\RangeException
 | 
			
		||||
     */
 | 
			
		||||
    public static function checkRange($name, Range $range, $value, $unit = '')
 | 
			
		||||
    {
 | 
			
		||||
        $val = $value[1];
 | 
			
		||||
        $grace = new Range(-0.00001, 0.00001);
 | 
			
		||||
 | 
			
		||||
        if (! \is_numeric($val)) {
 | 
			
		||||
            throw new RangeException("$name {$val} is not a number.");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($range->includes($val)) {
 | 
			
		||||
            return $val;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($grace->includes($val - $range->first)) {
 | 
			
		||||
            return $range->first;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($grace->includes($val - $range->last)) {
 | 
			
		||||
            return $range->last;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        throw new RangeException("$name {$val} must be between {$range->first} and {$range->last}$unit");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Encode URI component
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $string
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public static function encodeURIComponent($string)
 | 
			
		||||
    {
 | 
			
		||||
        $revert = ['%21' => '!', '%2A' => '*', '%27' => "'", '%28' => '(', '%29' => ')'];
 | 
			
		||||
 | 
			
		||||
        return strtr(rawurlencode($string), $revert);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * mb_chr() wrapper
 | 
			
		||||
     *
 | 
			
		||||
     * @param integer $code
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public static function mbChr($code)
 | 
			
		||||
    {
 | 
			
		||||
        // Use the native implementation if available, but not on PHP 7.2 as mb_chr(0) is buggy there
 | 
			
		||||
        if (\PHP_VERSION_ID > 70300 && \function_exists('mb_chr')) {
 | 
			
		||||
            return mb_chr($code, 'UTF-8');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (0x80 > $code %= 0x200000) {
 | 
			
		||||
            $s = \chr($code);
 | 
			
		||||
        } elseif (0x800 > $code) {
 | 
			
		||||
            $s = \chr(0xC0 | $code >> 6) . \chr(0x80 | $code & 0x3F);
 | 
			
		||||
        } elseif (0x10000 > $code) {
 | 
			
		||||
            $s = \chr(0xE0 | $code >> 12) . \chr(0x80 | $code >> 6 & 0x3F) . \chr(0x80 | $code & 0x3F);
 | 
			
		||||
        } else {
 | 
			
		||||
            $s = \chr(0xF0 | $code >> 18) . \chr(0x80 | $code >> 12 & 0x3F)
 | 
			
		||||
                . \chr(0x80 | $code >> 6 & 0x3F) . \chr(0x80 | $code & 0x3F);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $s;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * mb_strlen() wrapper
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $string
 | 
			
		||||
     * @return int
 | 
			
		||||
     */
 | 
			
		||||
    public static function mbStrlen($string)
 | 
			
		||||
    {
 | 
			
		||||
        // Use the native implementation if available.
 | 
			
		||||
        if (\function_exists('mb_strlen')) {
 | 
			
		||||
            return mb_strlen($string, 'UTF-8');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (\function_exists('iconv_strlen')) {
 | 
			
		||||
            return (int) @iconv_strlen($string, 'UTF-8');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        throw new \LogicException('Either mbstring (recommended) or iconv is necessary to use Scssphp.');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * mb_substr() wrapper
 | 
			
		||||
     * @param string $string
 | 
			
		||||
     * @param int $start
 | 
			
		||||
     * @param null|int $length
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public static function mbSubstr($string, $start, $length = null)
 | 
			
		||||
    {
 | 
			
		||||
        // Use the native implementation if available.
 | 
			
		||||
        if (\function_exists('mb_substr')) {
 | 
			
		||||
            return mb_substr($string, $start, $length, 'UTF-8');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (\function_exists('iconv_substr')) {
 | 
			
		||||
            if ($start < 0) {
 | 
			
		||||
                $start = static::mbStrlen($string) + $start;
 | 
			
		||||
                if ($start < 0) {
 | 
			
		||||
                    $start = 0;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (null === $length) {
 | 
			
		||||
                $length = 2147483647;
 | 
			
		||||
            } elseif ($length < 0) {
 | 
			
		||||
                $length = static::mbStrlen($string) + $length - $start;
 | 
			
		||||
                if ($length < 0) {
 | 
			
		||||
                    return '';
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return (string)iconv_substr($string, $start, $length, 'UTF-8');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        throw new \LogicException('Either mbstring (recommended) or iconv is necessary to use Scssphp.');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * mb_strpos wrapper
 | 
			
		||||
     * @param string $haystack
 | 
			
		||||
     * @param string $needle
 | 
			
		||||
     * @param int $offset
 | 
			
		||||
     *
 | 
			
		||||
     * @return int|false
 | 
			
		||||
     */
 | 
			
		||||
    public static function mbStrpos($haystack, $needle, $offset = 0)
 | 
			
		||||
    {
 | 
			
		||||
        if (\function_exists('mb_strpos')) {
 | 
			
		||||
            return mb_strpos($haystack, $needle, $offset, 'UTF-8');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (\function_exists('iconv_strpos')) {
 | 
			
		||||
            return iconv_strpos($haystack, $needle, $offset, 'UTF-8');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        throw new \LogicException('Either mbstring (recommended) or iconv is necessary to use Scssphp.');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,77 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp\Util;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
class Path
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @param string $path
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool
 | 
			
		||||
     */
 | 
			
		||||
    public static function isAbsolute($path)
 | 
			
		||||
    {
 | 
			
		||||
        if ($path === '') {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($path[0] === '/') {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (\DIRECTORY_SEPARATOR !== '\\') {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($path[0] === '\\') {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (\strlen($path) < 3) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($path[1] !== ':') {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($path[2] !== '/' && $path[2] !== '\\') {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!preg_match('/^[A-Za-z]$/', $path[0])) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param string $part1
 | 
			
		||||
     * @param string $part2
 | 
			
		||||
     *
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public static function join($part1, $part2)
 | 
			
		||||
    {
 | 
			
		||||
        if ($part1 === '' || self::isAbsolute($part2)) {
 | 
			
		||||
            return $part2;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($part2 === '') {
 | 
			
		||||
            return $part1;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $last = $part1[\strlen($part1) - 1];
 | 
			
		||||
        $separator = \DIRECTORY_SEPARATOR;
 | 
			
		||||
 | 
			
		||||
        if ($last === '/' || $last === \DIRECTORY_SEPARATOR) {
 | 
			
		||||
            $separator = '';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $part1 . $separator . $part2;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,95 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
use ScssPhp\ScssPhp\Node\Number;
 | 
			
		||||
 | 
			
		||||
final class ValueConverter
 | 
			
		||||
{
 | 
			
		||||
    // Prevent instantiating it
 | 
			
		||||
    private function __construct()
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Parses a value from a Scss source string.
 | 
			
		||||
     *
 | 
			
		||||
     * The returned value is guaranteed to be supported by the
 | 
			
		||||
     * Compiler methods for registering custom variables. No other
 | 
			
		||||
     * guarantee about it is provided. It should be considered
 | 
			
		||||
     * opaque values by the caller.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $source
 | 
			
		||||
     *
 | 
			
		||||
     * @return mixed
 | 
			
		||||
     */
 | 
			
		||||
    public static function parseValue($source)
 | 
			
		||||
    {
 | 
			
		||||
        $parser = new Parser(__CLASS__);
 | 
			
		||||
 | 
			
		||||
        if (!$parser->parseValue($source, $value)) {
 | 
			
		||||
            throw new \InvalidArgumentException(sprintf('Invalid value source "%s".', $source));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $value;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Converts a PHP value to a Sass value
 | 
			
		||||
     *
 | 
			
		||||
     * The returned value is guaranteed to be supported by the
 | 
			
		||||
     * Compiler methods for registering custom variables. No other
 | 
			
		||||
     * guarantee about it is provided. It should be considered
 | 
			
		||||
     * opaque values by the caller.
 | 
			
		||||
     *
 | 
			
		||||
     * @param mixed $value
 | 
			
		||||
     *
 | 
			
		||||
     * @return mixed
 | 
			
		||||
     */
 | 
			
		||||
    public static function fromPhp($value)
 | 
			
		||||
    {
 | 
			
		||||
        if ($value instanceof Number) {
 | 
			
		||||
            return $value;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (is_array($value) && isset($value[0]) && \in_array($value[0], [Type::T_NULL, Type::T_COLOR, Type::T_KEYWORD, Type::T_LIST, Type::T_MAP, Type::T_STRING])) {
 | 
			
		||||
            return $value;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($value === null) {
 | 
			
		||||
            return Compiler::$null;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($value === true) {
 | 
			
		||||
            return Compiler::$true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($value === false) {
 | 
			
		||||
            return Compiler::$false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($value === '') {
 | 
			
		||||
            return Compiler::$emptyString;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (\is_int($value) || \is_float($value)) {
 | 
			
		||||
            return new Number($value, '');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (\is_string($value)) {
 | 
			
		||||
            return [Type::T_STRING, '"', [$value]];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        throw new \InvalidArgumentException(sprintf('Cannot convert the value of type "%s" to a Sass value.', gettype($value)));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,23 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP version
 | 
			
		||||
 *
 | 
			
		||||
 * @author Leaf Corcoran <leafot@gmail.com>
 | 
			
		||||
 */
 | 
			
		||||
class Version
 | 
			
		||||
{
 | 
			
		||||
    const VERSION = '1.8.1';
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										84
									
								
								include/thirdparty/ScssPhp/Scssphp181/Warn.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										84
									
								
								include/thirdparty/ScssPhp/Scssphp181/Warn.php
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,84 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SCSSPHP
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright 2012-2020 Leaf Corcoran
 | 
			
		||||
 *
 | 
			
		||||
 * @license http://opensource.org/licenses/MIT MIT
 | 
			
		||||
 *
 | 
			
		||||
 * @link http://scssphp.github.io/scssphp
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace ScssPhp\ScssPhp;
 | 
			
		||||
 | 
			
		||||
final class Warn
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var callable|null
 | 
			
		||||
     * @phpstan-var (callable(string, bool): void)|null
 | 
			
		||||
     */
 | 
			
		||||
    private static $callback;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Prints a warning message associated with the current `@import` or function call.
 | 
			
		||||
     *
 | 
			
		||||
     * This may only be called within a custom function or importer callback.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $message
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public static function warning($message)
 | 
			
		||||
    {
 | 
			
		||||
        self::reportWarning($message, false);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Prints a deprecation warning message associated with the current `@import` or function call.
 | 
			
		||||
     *
 | 
			
		||||
     * This may only be called within a custom function or importer callback.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $message
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public static function deprecation($message)
 | 
			
		||||
    {
 | 
			
		||||
        self::reportWarning($message, true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param callable|null $callback
 | 
			
		||||
     *
 | 
			
		||||
     * @return callable|null The previous warn callback
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-param (callable(string, bool): void)|null $callback
 | 
			
		||||
     *
 | 
			
		||||
     * @phpstan-return (callable(string, bool): void)|null
 | 
			
		||||
     *
 | 
			
		||||
     * @internal
 | 
			
		||||
     */
 | 
			
		||||
    public static function setCallback(callable $callback = null)
 | 
			
		||||
    {
 | 
			
		||||
        $previousCallback = self::$callback;
 | 
			
		||||
        self::$callback = $callback;
 | 
			
		||||
 | 
			
		||||
        return $previousCallback;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param string $message
 | 
			
		||||
     * @param bool   $deprecation
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    private static function reportWarning($message, $deprecation)
 | 
			
		||||
    {
 | 
			
		||||
        if (self::$callback === null) {
 | 
			
		||||
            throw new \BadMethodCallException('The warning Reporter may only be called within a custom function or importer callback.');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        \call_user_func(self::$callback, $message, $deprecation);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,12 +0,0 @@
 | 
			
		|||
<?xml version="1.0"?>
 | 
			
		||||
<ruleset name="PSR12 (adapted for PHP 5.6+)">
 | 
			
		||||
    <rule ref="PSR12">
 | 
			
		||||
        <!-- Ignore this PHP 7.1+ sniff as long as we support PHP 5.6+ -->
 | 
			
		||||
        <exclude name="PSR12.Properties.ConstantVisibility.NotFound"/>
 | 
			
		||||
 | 
			
		||||
        <!-- This sniff doesn't ignore comment blocks -->
 | 
			
		||||
<!--
 | 
			
		||||
        <exclude name="Generic.Files.LineLength"/>
 | 
			
		||||
-->
 | 
			
		||||
    </rule>
 | 
			
		||||
</ruleset>
 | 
			
		||||
| 
						 | 
				
			
			@ -1,21 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
if (version_compare(PHP_VERSION, '5.6') < 0) {
 | 
			
		||||
    throw new \Exception('scssphp requires PHP 5.6 or above');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (! class_exists('ScssPhp\ScssPhp\Version')) {
 | 
			
		||||
    spl_autoload_register(function ($class) {
 | 
			
		||||
        if (0 !== strpos($class, 'ScssPhp\ScssPhp\\')) {
 | 
			
		||||
            // Not a ScssPhp class
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $subClass = substr($class, strlen('ScssPhp\ScssPhp\\'));
 | 
			
		||||
        $path = __DIR__ . '/src/' . str_replace('\\', '/', $subClass) . '.php';
 | 
			
		||||
 | 
			
		||||
        if (file_exists($path)) {
 | 
			
		||||
            require $path;
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in a new issue