/*
LESS variables are information about icon's compiled state, stored under its original file name

.icon-home {
  width: @icon-home-width;
}

The large array-like variables contain all information about a single icon
@icon-home: x y offset_x offset_y width height total_width total_height image_path name;

At the bottom of this section, we provide information about the spritesheet itself
@spritesheet: width height image @spritesheet-sprites;
*/
@del-name: 'del';
@del-x: 0px;
@del-y: 122px;
@del-offset-x: 0px;
@del-offset-y: -122px;
@del-width: 48px;
@del-height: 54px;
@del-total-width: 222px;
@del-total-height: 176px;
@del-image: 'sprite.png';
@del: 0px 122px 0px -122px 48px 54px 222px 176px 'sprite.png' 'del';
@no-data-name: 'noData';
@no-data-x: 0px;
@no-data-y: 0px;
@no-data-offset-x: 0px;
@no-data-offset-y: 0px;
@no-data-width: 222px;
@no-data-height: 122px;
@no-data-total-width: 222px;
@no-data-total-height: 176px;
@no-data-image: 'sprite.png';
@no-data: 0px 0px 0px 0px 222px 122px 222px 176px 'sprite.png' 'noData';
@shuaxin-name: 'shuaxin';
@shuaxin-x: 90px;
@shuaxin-y: 122px;
@shuaxin-offset-x: -90px;
@shuaxin-offset-y: -122px;
@shuaxin-width: 39px;
@shuaxin-height: 39px;
@shuaxin-total-width: 222px;
@shuaxin-total-height: 176px;
@shuaxin-image: 'sprite.png';
@shuaxin: 90px 122px -90px -122px 39px 39px 222px 176px 'sprite.png' 'shuaxin';
@tip-name: 'tip';
@tip-x: 48px;
@tip-y: 122px;
@tip-offset-x: -48px;
@tip-offset-y: -122px;
@tip-width: 42px;
@tip-height: 42px;
@tip-total-width: 222px;
@tip-total-height: 176px;
@tip-image: 'sprite.png';
@tip: 48px 122px -48px -122px 42px 42px 222px 176px 'sprite.png' 'tip';
@spritesheet-width: 222px;
@spritesheet-height: 176px;
@spritesheet-image: 'sprite.png';
@spritesheet-sprites: @del @no-data @shuaxin @tip;
@spritesheet: 222px 176px 'sprite.png' @spritesheet-sprites;

/*
The provided classes are intended to be used with the array-like variables

.icon-home {
  .sprite-width(@icon-home);
}
.icon-email {
  .sprite(@icon-email);
}

Example usage in HTML:

`display: block` sprite:
<div class="icon-home"></div>

To change `display` (e.g. `display: inline-block;`), we suggest using a common CSS class:

// CSS
.icon {
  display: inline-block;
}

// HTML
<i class="icon icon-home"></i>
*/
.sprite-width(@sprite) {
  width: extract(@sprite, 5);
}

.sprite-height(@sprite) {
  height: extract(@sprite, 6);
}

.sprite-position(@sprite) {
  @sprite-offset-x: extract(@sprite, 3);
  @sprite-offset-y: extract(@sprite, 4);
  background-position: @sprite-offset-x @sprite-offset-y;
}

.sprite-image(@sprite) {
  @sprite-image: extract(@sprite, 9);
  background-image: e(%('url(%a)', e(@sprite-image)));
}

.sprite(@sprite) {
  .sprite-image(@sprite);
  .sprite-position(@sprite);
  .sprite-width(@sprite);
  .sprite-height(@sprite);
}

/*
The `.sprites` mixin generates identical output to the CSS template
  but can be overridden inside of LESS

This must be run when you have at least 2 sprites.
  If run with a single sprite, then there will be reference errors.

.sprites(@spritesheet-sprites);
*/
.sprites(@sprites, @i: 1) when (@i <= length(@sprites)) {
  @sprite: extract(@sprites, @i);
  @sprite-name: e(extract(@sprite, 10));
  .@{sprite-name} {
    .sprite(@sprite);
  }
  .sprites(@sprites, @i + 1);
}
