_.dependency(null, [ 'minimalist' ], (name, mn) => {


var generateRulesForSides = (() => {
    var sides = {
        t: {top: 1}, b: {bottom: 1},
        l: {left: 1}, r: {right: 1},
        v: {top: 1, bottom: 1},
        h: {left: 1, right: 1},
        lt: {top: 1, left: 1},
        rt: {top: 1, right: 1},
        lb: {bottom: 1, left: 1},
        rb: {bottom: 1, right: 1}
    };
    return (dst, essencePrefix, attrPrefix, attrSuffix) => {
        attrPrefix || (attrPrefix = '');
        attrSuffix || (attrSuffix = '');
        if(attrPrefix){
            dst[essencePrefix] = [ attrPrefix ];
            attrPrefix += '-';
        }
        var props, sideMap, sideSuffix;
        for(var sideName in sides){
            props = dst[essencePrefix + sideName] = [];
            sideMap = sides[sideName];
            for(sideSuffix in sideMap)props.push(attrPrefix + sideSuffix + attrSuffix); 
        }
    };
})();


//grid rows, grid columns, grid-auto-rows: 1fr
var essencesMap = {
    tn: [ 'transition' ],

    g: [ 'grid-template' ],
    gr: [ 'grid-template-rows' ],
    gc: [ 'grid-template-columns' ],
    gar: [ 'grid-auto-rows' ],

    gg: [ 'grid-gap' ],

    gRow: [ 'grid-row' ],
    gCol: [ 'grid-column' ],

    fx: [ 'flex' ],

    ff: [ 'font-family' ],

    tp: [ 'transition-property' ],
    r: [ 'border-radius' ]
};


_.forEach({
    h: [ 'height' ], 
    w: ['width' ], 
    sq: [ 'height', 'width' ]
}, (attrs, essencePrefix) => {
    _.forEach({
        Max: 'max-', 
        Min: 'min-', 
        '': ''
    }, (prefix, suffix) => {
        var props = essencesMap[essencePrefix + suffix] = [];
        for(var prop in attrs)props.push(prefix + prop);
    });
});

_.forEach([ 
    [ 'b', 'border' ],
    [ 'mg', 'margin' ],
    [ 'pd', 'padding' ],
    [ 'd' ]
], (v) => generateRulesForSides(essencesMap, v[0], v[1], v[2]));

(() => {
    var replacer = (all, escaped) => escaped ? '_' : ' ';
    var regexp = /(\\_)|(_)/g;
    var paramsPattern = '_(.*):value';
    _.forEach(essencesMap, (propNames, essencePrefix) => {
        var length = propNames.length;
        var priority = 4 - length;
        mn.use(essencePrefix + paramsPattern, (req, set) => {
            var params = req.params;
            var value = (params.value || '').replace(regexp, replacer);
            var style = {};
            for(var i = length; i--;)style[ propNames[i] ] = value;
            set.essence({ style, priority });
        });
    });
})();


_.forEach({
    rlv: 'relative',
    fxd: 'fixed',
    abs: 'absolute',
    static: 'static'
}, (position, essenceName) => mn.set(essenceName, { style: { position } }));



mn.use((req, set, next) => {
    if(req.camel)return next();
    var options = req.options;
    var v = (req.value || '0') + (req.params.w || 'px');
    var style = {};
    for(var l = options.length; l--;)style[ options[l] ] = v;
    set.essence({ style });
}, {
    st: [ 'top', 'left', 'right' ],
    sb: [ 'bottom', 'left', 'right' ],
    sl: [ 'top', 'left', 'bottom' ],
    sr: [ 'top', 'right', 'bottom' ],
    slt: [ 'left', 'top' ],
    slb: [ 'left', 'bottom' ],
    srt: [ 'right', 'top' ],
    srb: [ 'right', 'bottom' ]
}, [ '(%):w' ]);



mn.use((req, set) => {
    var params = req.params;
    set({transform: 'translate(' +
        ((req.num || '0') + (params.w || 'px')) + ',' +
        ((params.y || '0') + (params.wy || 'px')) +
    ')' + (params.s ? (' scale(' + (0.01 * params.s) + ')') : '') + (params.important ? '' : '!important') });
}, [ 'x' ], [ '^-?[0-9]+(%):w?([yY](-?[0-9]+):y(%):wy?)?([sS]([0-9]+):s)?(-i):important?$' ]);


(() => {
    var inited = false;
    mn.use(({ options, value, params }, set) => {
        isNaN(v = parseInt(value || '3000')) || v > 0 && set({
            animation: 'spinner-animate ' + v + 'ms infinite linear'
        });

        if(inited)return;
        inited = true;
        mn.setKeyframes('spinner-animate', {
            from: { transform: 'rotateZ(0deg)' },
            to: { transform: 'rotateZ(360deg)' }
        });   

    }, [ 'spnr' ]);
})();



mn.use((req, set, next) => {
    var value = req.value;
    if(!value)return next();
    var options = req.options;
    var params = req.params;
    set.essence(
        mn.wrapSides(options.prop, _.lowerCase(params.side),
        value + (params.w || 'px') + (params.i ? '' : '!important'), options.suffix)
    );
}, {
    pd: {prop: 'padding'},
    mg: {prop: 'margin'},
    b: {prop: 'border', suffix: '-width'},
    d: {prop: ''}
}, [ '^\\d+(%):w?([A-Za-z]*):side(.*?)(-i):i?$' ]);



mn.set('break', {
    style: {
        whiteSpace: 'normal',
        wordBreak: 'break-word'
    }
});


//.shadow1{
//  @include echo( cross(box-shadow,inset 0px 0px 10px 5px rgba(0, 0, 0, .15)) );
//}
//.sh10-5c0001
mn.use(({ name, value, params, options }, set, next) => {
    var repeatCount = _.intval(params.m, 1, 0);
    if(!value || repeatCount < 1)return next();
    var x = params.x || 0, y = params.y || 0, r = params.r || 0;
    var altColors = mn.color(params.c || '0');
    var prefixIn = (params['in'] ? 'inset ' : '');
    var sample, v, ci = 0, cl = altColors.length;
    var output = new Array(cl), color;
    for(;ci < cl; ci++){
        color = altColors[ci];
        sample = prefixIn + (name == 'sh' ? [ x , y, value, r, color ] : [ x , y, value, color ]).join('px ');
        v = new Array(repeatCount);
        for(i = repeatCount; i--;)v[i] = sample;
        output[ci] = v.join(', ');
    }
    var style = {};
    style[options] = output;
    set(style);
}, {
    sh: 'boxShadow',
    tsh: 'textShadow'
}, [
    '((r|R)(\\-?[0-9]+):r)',
    '((x|X)(\\-?[0-9]+):x)',
    '((y|Y)(\\-?[0-9]+):y)',
    '((m|M)([0-9]+):m)',
    '(c([0-9A-F]+):c)',
    '(in):in'
]);


/*
//font-size
@each $size in 10, 11, 12, 13, 14, 16, 17, 18, 20, 22, 24, 26, 30, 36, 40, 50, 60, 80
{ #{'.f' + $size + $suffix} { font-size:$size + px; } }
*/

/*
//border-radius
.r{border-radius: 10000px;};
@each $size in 0, 3, 4, 5, 10, 15, 20 { #{'.r' + $size} { border-radius:$size + px; } }
*/
mn.use((req, set, next) => {
    if(req.camel || req.negative)return next();
    var options = req.options;
    var params = req.params;
    var style = {};
    style[options.prop] = (req.num || options.val) + (params.unit || options.unit)
    set.essence({ style });
}, {
    f: {prop: 'font-size', val: 14, unit: 'px'},
    r: {prop: 'borderRadius', val: 10000, unit: 'px'}
}, [ '([a-z%]+):unit']);




/*
//z-index
@each $size in -1, 0, 1, 2 { #{'.z' + $size} { z-index:$size; } }
*/
mn.use((req, set, next) =>
    req.camel ? next() : set({zIndex: (req.num || '1') + (req.params.important ? '' : ' !important') }), 
[ 'z' ], [ '(-i):important' ]);


/*
.lh{line-height:1;}
//line-height
@each $size in 6, 7, 8, 9, 10, 11, 12, 13 { #{'.lh' + $size} { &, &>*{ line-height: 0.1 * $size; } } }
*/
mn.use((req, set, next) => {
    var num = req.num;
    req.camel ? next() : set({lineHeight: num ? (req.params.w ? (num * 0.01) : (num + 'px')) : '1' })
}, [ 'lh' ], [ '(%):w' ]);



/*
 //spaces
 @each $size in (20, 25, 34, 40, 55, 150){
     .sq#{$size}{
         width: $size + px;
         height: $size + px;
     }
 }
#{'.w' +  $suffix} { width: 100%; }
#{'.min-w' + $suffix} { min-width: 100%; }
#{'.max-w' + $suffix} { max-width: 100%; }


@each $size in 70 {
    #{'.w' + $size + $suffix} { width:$size + px; }
    #{'.min-w' + $size + $suffix} { min-width:$size + px; }
    #{'.max-w' + $size + $suffix} { max-width:$size + px; }
}


#{'.h' +  $suffix} { height: 100%; }
#{'.hMin' + $suffix} { hMineight: 100%; }
#{'.max-h' + $suffix} { max-height: 100%; }
@each $size in 0, 34, 40, 50, 70, 90, 100, 130 {
    #{'.h' + $size + $suffix} { height:$size + px; }
    #{'.hMin' + $size + $suffix} { hMineight:$size + px; }
    #{'.max-h' + $size + $suffix} { max-height:$size + px; }
}
 */

mn.use((req, set, next) => {
    if(req.negative)return next();
    var props = req.options;  
    var num = req.num;
    var params = req.params;
    var size = (num ? (num + (params.w || 'px')) : '100%') + (params.important ? '' : ' !important');
    var prefix = params.prefix;
    prefix = prefix ? (_.lowerCase(prefix) + '-') : '';
    var css = {};
    var l = props.length, i = l;
    for(; i--;)css[prefix + props[i]] = size;
    set(css, 2 - l);
}, {
    sq: [ 'width', 'height' ],
    w: [ 'width' ],
    h: [ 'height' ]
}, [ '^\\d+(%):w?(m(in|ax)):prefix?(.*)(-i):important?$' ]);


/*
.tbl#{$suffix}{ display:table; &>*{ float:none !important; display:table-cell; vertical-align:middle; } }
.inw#{$suffix}{display:inline-block;}
.inline#{$suffix}{display:inline;}
.block#{$suffix}{display:block; &.tbl, &[class*='tbl-']{&, &>*{display:block;}}}
@mixin clearfix(){
  &:before,&:after{
    content: " ";
    clear: both;
    display: table;
  }
  @content
}

*/

mn.set('tbl', {
    inited: true,
    style: {display: 'table'},
});
mn.set('tbl.cell', {
    selectors: [ '>*' ], 
    style: {
        float: 'none !important',
        display: 'table-cell',
        verticalAlign: 'middle'
    }
});

mn.set('cfx.pale',  {
    selectors: [':before', ':after'], 
    style: {content: '" "', clear: 'both', display: 'table'}
});

mn.set('layout', {
    style: {
        boxSizing: 'border-box',
        display: [ '-webkit-box', '-webkit-flex', 'flex' ]
    }
});
mn.set('layout-row', {
    exts: [ 'layout' ],
    style: {
        '-webkit-box-direction': 'normal',
        '-webkit-box-orient': 'horizontal',
        '-webkit-flex-direction': 'row',
        'flex-direction': 'row',

        
        '-webkit-box-pack': 'start', 
        '-webkit-justify-content': 'flex-start', 
        'justify-content': 'flex-start',

        '-webkit-box-align': 'center',
        '-webkit-align-items': 'center',
        'align-items': 'center',
        '-webkit-align-content': 'center',
        'align-content': 'center'
    }
});
mn.set('layout-column', {
    exts: [ 'layout' ],
    style: {
        '-webkit-box-direction': 'normal',
        '-webkit-box-orient': 'vertical',
        '-webkit-flex-direction': 'column',
        'flex-direction': 'column'
    }
});



//flex horizontal align
((aligns) => {
    mn.use('ha(Start|Center|End|Around|Between):direction', (req, set, next) => {
        set(aligns[ _.lowerFirst(req.params.direction) ], 1);
    });
})({
    start: {'-webkit-box-pack': 'start', '-webkit-justify-content': 'flex-start', 'justify-content': 'flex-start'},
    center: {'-webkit-box-pack': 'center', '-webkit-justify-content': 'center', 'justify-content': 'center'},
    end: {'-webkit-box-pack': 'end', '-webkit-justify-content': 'flex-end', 'justify-content': 'flex-end'},
    around: {'-webkit-justify-content': 'space-around', 'justify-content': 'space-around'},
    between: {'-webkit-box-pack': 'justify', '-webkit-justify-content': 'space-between', 'justify-content': 'space-between'}
});

//flex vertical align
((aligns) => {
    mn.use('va(Start|Center|End|Stretch):direction', (req, set, next) => {
        set(aligns[ _.lowerFirst(req.params.direction) ], 1);
    });
})({
    start: {
        '-webkit-box-align': 'start',
        '-webkit-align-items': 'flex-start',
        'align-items': 'flex-start',
        '-webkit-align-content': 'flex-start',
        'align-content': 'flex-start'
    },
    center: {
        '-webkit-box-align': 'center',
        '-webkit-align-items': 'center',
        'align-items': 'center',
        '-webkit-align-content': 'center',
        'align-content': 'center'
    },
    end: {
        '-webkit-box-align': 'end',
        '-webkit-align-items': 'flex-end',
        'align-items': 'flex-end',
        '-webkit-align-content': 'flex-end',
        'align-content': 'flex-end'
    },
    stretch: {
        '-webkit-box-align': 'stretch',
        '-webkit-align-items': 'stretch',
        'align-items': 'stretch',
        '-webkit-align-content': 'stretch',
        'align-content': 'stretch'
    }
});









/*
//row
@each $size in 0, 2, 5, 10, 15
{ #{'.row' + $size + $suffix} { @extend .clearfix#{$suffix}; @include row($size); } }
*/
mn.use((req, set, next) => {
    var camel = req.camel;
    if(camel)return next();
    var params = req.params;
    var type = params.w || 'px';
    var v = req.value || 10, pd = v + type, mg = (-v) + type;
    set.essence({
        style: {marginLeft: mg, marginRight: mg},
        childs: {
            pale:{
                selectors: [ ':before', ':after' ],
                style: {content: '" "', clear: 'both', display: 'table'}
            },
            columns: {
                selectors: [ 
                    '>[class^="col"]', '>[class*=" col"]',
                    '>*>[class^="col"]', '>*>[class*=" col"]' 
                ],
                style: {  paddingLeft: pd, paddingRight: pd }
            }
        }
    });
}, [ 'row' ], [ '(%):w?' ]);

/*
@mixin ex($name,$value:''){
  @each $prefix in $prefixes { #{$prefix + $name} : $value; }
}
@mixin duration($sec: 0.25s){
  @include ex(transition-duration,$sec);
}
.duration, .duration250{ @include duration(.25s); }
.duration500{ @include duration(.5s); }
.duration1000{ @include duration(1s); }
.noDuration{ @include duration(.0s !important); }
*/
mn.use((req, set, next) => {
    if(req.camel || req.negative)return next();
    var important = req.params.important || '';
    var num = req.num;
    if(num){
        set({ transitionDuration: num + 'ms' + (important ? '' : '!important') });
        return;
    }
    set.essence({
        exts: [ 'dn250' + important ]
    });
}, [ 'dn' ], ['(-i):important' ] );

/*

//color
@each $index, $color in (
    (1,#FFF), (2,#000), (3,#d6d6d6),
    (4,#6e91b7), (5,#39383d), (6,#6a6a6a),
    (7,#3b7aa9), (8, #ac3032),
) {
    .c#{$index}, .c#{$index}-h:hover{
        color: $color !important;
    }
}
*/

mn.use((req, set, next) => {
    var params = req.params;
    var value = params.value;
    if(!value)return next();
    var alts = mn.color(value);
    if(!params.important)alts = _.joinArrays([], alts, [ '!important' ]);
    var style = {};
    style[req.options] = alts;
    set(style);
}, { 
    c: 'color',
    stroke: 'stroke'
}, [ '^(([A-Z][a-z]+):camel|([A-F0-9]+):color):value(.*)(-i):important?$' ]);


/*
//background color
@each $index, $color in (
    (1,#FFF), (2,#000), (3,#d6d6d6),
    (4,#6e91b7), (5,#f2f2f2), (6,#5b92ba), (7,#e30613)
) {
    .bg#{$index}, .bg#{$index}-h:hover{
        background-color: $color !important;
    }
}
*/
    
mn.use((req, set, next) => {
    var params = req.params;
    var v = params.bg || req.suffix;
    if(req.negative || !v)return next();
    var bg = mn.getBackground(v);
    var background = bg.alts;
    if(!params.important)background = _.joinArrays([], background, [ '!important' ]);
    set({ background });
}, [ 'bg' ], ['^(.+):bg(-i):important?$' ]);


/*
//rotate x
@each $v in 180
{ .rot#{$v}x, .rot#{$v}x-h:hover{ @include echo( cross(transform, rotateX( $v + deg )) ); } }
//rotate y
@each $v in 90
{ .rot#{$v}y, .rot#{$v}y-h:hover{ @include echo( cross(transform, rotateY( $v + deg )) ); } }
//rotate z
@each $v in -90, -45, 0, 45, 90
{ .rot#{$v}z, .rot#{$v}z-h:hover{ @include echo( cross(transform, rotateZ( $v + deg )) ); } }
*/

mn.use(({ options, value, params }, set) => {
    var suffix = params.suffix;
    set({
        transform: 'rotate' + (suffix ? _.upperCase(suffix) : 'X') + '(' + (value || '180') + 'deg)'
    });
}, [ 'rot' ], [ '(x|y|z):suffix' ]);

/*
.vc#{$suffix}{&, & td, &.tbl>*, &[class*='tbl-']>*{vertical-align:middle;}}
.vt#{$suffix}{&, & td, &.tbl>*, &[class*='tbl-']>*{vertical-align:top;}}
.vb#{$suffix}{&, & td, &.tbl>*, &[class*='tbl-']>*{vertical-align:bottom;}}
*/
mn.use((req, set) => {
    var v = req.options;
    if(!req.params.important)v += '!important';
    set.essence({       
        priority: 1,
        style: {
            verticalAlign: v
        } 
    })
}, { vc: 'middle', vt: 'top', vb: 'bottom'}, [ '(-i):important' ]);

/*
.tl#{$suffix}{text-align:left;}
.tc#{$suffix}{text-align:center;}
.tr#{$suffix}{text-align:right;}
*/
mn.use((req, set, next) => {
    req.value ? next() : set({textAlign: req.options + (!req.params.important ? ' !important' : '')});
}, { tl: 'left', tc: 'center', tr: 'right'}, [ '(-i):important' ]);





/*
.lt#{$suffix},[class*='tbl']>.lt#{$suffix}{float:left !important;}
.ct#{$suffix}{margin-left:auto;margin-right:auto;}
.rt#{$suffix},[class*='tbl']>.rt#{$suffix}{float:right !important;}
*/
mn.use((req, set) => {
    var options = req.options;
    if(!req.params.important){
        var dst = {};
        for(var k in options)dst[k] = options[k] + ' !important';
        set(dst);
    }else{
        set(options);
    }
}, {
    lt: {float: 'left'},
    ct: {marginLeft: 'auto', marginRight: 'auto'},
    rt: {float: 'right'}
}, [ '(-i):important' ]);

/*
.wt9#{$suffix}{font-weight:900;}
.wt8#{$suffix}{font-weight:800;}
.wt7#{$suffix}{font-weight:700;}
.wt6#{$suffix}{font-weight:600;}
.wt5#{$suffix}{font-weight:500;}
.wt4#{$suffix}{font-weight:400;}
.wt3#{$suffix}{font-weight:300;}
.wt2#{$suffix}{font-weight:200;}
.wt1#{$suffix}{font-weight:100;}
*/
mn.use(({ options, num, camel, negative, params }, set, next) => {
    var v = parseInt(num || '9');
    if(camel || negative || v < 1 || v > 9)return next();
    set({fontWeight: 100 * v});
}, [ 'wt' ]);


/*
.overlay{
  position: absolute;
  display: block;
  top:0px;left:0px;right:0px;bottom:0px;
}
*/
mn.use((req, set, next) => {
    if(req.camel)return next();
    var v = (req.num || '0') + (req.params.w || 'px');
    set({
        display: 'block',
        position: 'absolute',
        top: v, left: v, right: v, bottom: v
    });
}, [ 'overlay' ], [ '((%):w)?' ]);

/*
%hide{
  @include duration(.25s);
  @include echo( cross(pointer-events, none) );
  @include opacity(0);
  z-index:-1;
}
%show{
  @include duration(.25s);
  @include echo( cross(pointer-events, auto) );
  @include opacity(1);
  z-index:1;
}
*/

mn.set('xHide', {
    exts: [ 'dn' ],
    style: {
        pointerEvents: 'none',
        opacity: 0,
        zIndex: -1
    }
});
mn.set('xShow', {
    exts: [ 'dn' ],
    priority: 1,
    style: {
        pointerEvents: 'auto',
        opacity: 1,
        zIndex: 1
    }
});

/*
//opacity
.o,.o-h:hover{ @include opacity(0); }
.no-o,.no-o-h:hover{ @include opacity(1); }
@each $size in 50, 70, 90 {
  #{'.o' + $size}, #{'.o' + $size + '-h:hover'} { @include opacity( 0.01 * $size ); }
}
*/
mn.use((req, set, next) => {
    if(req.camel || req.negative)return next();
    set({ opacity: (req.num || 0) * 0.01 });
}, [ 'o' ]);


/*
.noSelect{ @include echo( cross(user-select, none) ); }
.select{ @include echo( cross(user-select, initial) ); }
.noEvent{ @include echo( cross(pointer-events, none) ); }
.event{ @include echo( cross(pointer-events, auto) ); }
*/

mn.use((req, set, next) => {
    var camel = req.camel;
    if(req.num || camel && _.lowerCase(camel) !== 'no')return next();
    var options = req.options;
    var style = {};
    style[options.prop] = (camel ? options.no : options.yes) + ' !important';
    set(style);
}, {
    e: {prop: 'pointerEvents', no: 'none', yes: 'auto'},
    select: {prop: 'userSelect', no: 'none', yes: 'initial'}
});


/*
.blur{ @include echo( cross( filter, blur(4px) ) ); }
*/
mn.use((req, set, next) => {
    req.camel || req.negative ? next() : set({filter: 'blur(' + (req.value || '4') + 'px)'});
}, [ 'blur' ]);

/*
%lt#{$suffix}{float: left;}
$i: 12;
@while $i > 0 {
  .col#{$suffix}-#{$i}{
    @extend %lt#{$suffix};
    width: 100 * $i / 12  + %;
  }
  .col#{$suffix}-offset-#{$i}{ margin-left: 100 * $i / 12  + %;}
  $i: $i - 1;
}
*/
mn.use((req, set, next) => {
    if(req.camel)return next();
    var params = req.params;
    var width = (100 * (Math.abs(req.num) || 12) / (params.grid || 12)) + '%';
    var style = {minHeight: '1px'};
    if(req.negative){
        if(params.r){
            style.marginRight = width;
        }else{
            style.marginLeft = width;
        }
    }else{
        style[ params.min ? 'min-width' : 'width'] = width;
    }
    if(!params.important){
        for(var k in style)style[k] += ' !important';
    }
    set(style);

}, [ 'col' ], [ 
    //'(r):r', '[0-9]+\\-([0-9]+):grid', '(min):min', '(-i):important' 
    '^(-?[0-9]+(\\-([0-9]+):grid)?)?(min):min?(r|R):r?(.*)(-i):important?$'
]);


/*
//flex
mn.use(({ value, num, negative, params, camel, options }, set, next) => {
    if(camel)return next();
    var v = (100 * (Math.abs(num) || 12) / (params.grid || 12)) + '%';
    set({
        flex: num ? ('0 0 ' + v) : '1',
        maxWidth: v
    });
}, [ 'flex' ], [ '(\\-([0-9]+):grid)?' ]);
*/




/*
.overflow{overflow:hidden;}
.overflowX{overflow-x:hidden;}
.overflowY{overflow-y:hidden;}
.scrollX{overflow-x:scroll;}
.scrollY{overflow-y:scroll;}
.autoX{overflow-x:auto;}
.autoY{overflow-y:auto;}
*/
mn.use((req, set, next) => {
    var camel = req.camel;
    if(!camel)return next();
    var d = req.params.d;
    var prop = 'overflow';
    var priority = 0;
    if(d){
        prop += ('-' + _.lowerCase(d));
        priority++;
    }
    var style = {};
    style[prop] = _.lowerCase(camel);
    set(style, priority);
}, [ 'ov' ], [ '([XxYy]):d' ]);



/*
//border
@each $key, $value in (
    (1, solid 1px #eee),
(2, solid 1px #fff),
(3, solid 1px #ddd)
)
{ @include side-focus('.b' + $key, border, $value); }


/*
.dotted{border-style: dotted;}
.dashed{border-style: dashed;}
.solid{border-style: solid;}
*/
mn.use((req, set, next) => {
    var camel = req.camel;
    if(!camel)return next();
    var params = req.params;
    set.essence(mn.wrapSides('border', params.side, _.lowerCase(camel) + 
        (!params.important ? ' !important' : ''), '-style')) ;
}, [ 'bs' ], [ '^[A-Z][a-z]+([A-Za-z]+):side?(.*)(-i):important?$' ]);



/*
//border-color
@each $key, $value in (
    (1, transparent),
)
{ @include side-focus('.bc' + $key, border, $value, '-color'); }
*/

mn.use((req, set, next) => {
    var params = req.params;
    var value = params.value;
    if(!value)return next();
    var alts = mn.color(value);
    if(!params.important)alts = _.joinArrays([], alts, [ ' !important' ]);
    var data = mn.wrapSides('border', _.lowerCase(params.side), alts, '-color');
    var style = data.style;
    if(req.options == 2)style.color = alts;
    set.essence(data);
}, {
    bc: 1, cc: 2
}, [ '^(([A-Z][a-z]+):camel|([A-F0-9]+):color):value([A-Za-z]+):side?(.*)(-i):important?$' ]);



//flex-direction
mn.use((req, set, next) => {
    var suffix = req.suffix;
    if(!suffix)return next();
    var important = req.params.important;
    var importantSuffix = important ? '' : ' !important';
    if(important)suffix = suffix.substr(0, suffix.length - important.length);
    var style = {};
    style[req.options] = _.kebabCase(suffix) + importantSuffix;
    set(style); 
}, {
    fd: 'flex-direction',
    fs: 'font-style',
    jc: 'justify-content',
    ai: 'align-items',
    tt: 'text-transform',
    td: 'text-decoration',
    to: 'text-overflow',
    cr: 'cursor',
    ol: 'outline',
    ws: 'white-space',
    v: 'display'
}, [ '(-i):important' ]);



//other... example: border-collapse: separate; -> $borderCollapse_separate
(() => {
    var regexp = /^\$([^\$].+[^_])$/;
    mn.use((req, set, next) => {
        var path = req.path;
        var macths = path.match(regexp);
        if(!macths)return next();
        var parts = macths[1].split('_');
        if(parts.length < 2)return next();
        var property = parts.shift(), value = parts.join(' ');
        var style = {};
        style[property] = value;
        set(style); 
    });

})();



});