@sencha/cmd-linux-64
Version:
Productivity and performance optimization tool for building applications with Sencha Ext JS
3 lines • 79.6 kB
JavaScript
"use strict";function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}var _get=function get(object,property,receiver){null===object&&(object=Function.prototype);var desc=Object.getOwnPropertyDescriptor(object,property);if(void 0===desc){var parent=Object.getPrototypeOf(object);return null===parent?void 0:get(parent,property,receiver)}if("value"in desc)return desc.value;var getter=desc.get;if(void 0!==getter)return getter.call(receiver)},_createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};!function(f){if("object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.Fashion=f()}}(function(){return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r}()({1:[function(require,module,exports){var _Fashion$apply,Fashion=require("./src/export/Base.js"),CssVariableManager=require("./src/export/css/CssVariableManager.js"),css=new CssVariableManager;Fashion.apply(Fashion,(_Fashion$apply={css:css,CssExport:CssVariableManager,Types:require("./src/export/type/Types.js"),ValueParser:require("./src/export/parse/ValueParser.js"),Type:require("./src/export/type/Type.js"),Bool:require("./src/export/type/Bool.js"),Literal:require("./src/export/type/Literal.js"),ParentheticalExpression:require("./src/export/type/ParentheticalExpression.js"),Text:require("./src/export/type/Text.js"),Numeric:require("./src/export/type/Numeric.js"),List:require("./src/export/type/List.js"),Map:require("./src/export/type/Map.js"),Color:require("./src/export/type/Color.js"),ColorRGBA:require("./src/export/type/ColorRGBA.js"),ColorHSLA:require("./src/export/type/ColorHSLA.js"),ColorStop:require("./src/export/type/ColorStop.js"),FunctionCall:require("./src/export/type/FunctionCall.js"),LinearGradient:require("./src/export/type/LinearGradient.js"),RadialGradient:require("./src/export/type/RadialGradient.js"),Statics:require("./src/export/type/Statics.js"),SourceBuilder:require("./src/export/type/SourceBuilder.js")},_defineProperty(_Fashion$apply,"Types",require("./src/export/type/Types.js")),_defineProperty(_Fashion$apply,"TypeVisitor",require("./src/export/type/TypeVisitor.js")),_defineProperty(_Fashion$apply,"Output",require("./src/export/Output.js")),_defineProperty(_Fashion$apply,"Runtime",require("./src/export/Runtime.js")),_Fashion$apply)),module.exports=Fashion},{"./src/export/Base.js":3,"./src/export/Output.js":4,"./src/export/Runtime.js":5,"./src/export/css/CssVariableManager.js":6,"./src/export/parse/ValueParser.js":7,"./src/export/type/Bool.js":8,"./src/export/type/Color.js":9,"./src/export/type/ColorHSLA.js":10,"./src/export/type/ColorRGBA.js":11,"./src/export/type/ColorStop.js":12,"./src/export/type/FunctionCall.js":13,"./src/export/type/LinearGradient.js":14,"./src/export/type/List.js":15,"./src/export/type/Literal.js":16,"./src/export/type/Map.js":17,"./src/export/type/Numeric.js":18,"./src/export/type/ParentheticalExpression.js":19,"./src/export/type/RadialGradient.js":20,"./src/export/type/SourceBuilder.js":21,"./src/export/type/Statics.js":22,"./src/export/type/Text.js":23,"./src/export/type/Type.js":24,"./src/export/type/TypeVisitor.js":25,"./src/export/type/Types.js":26}],2:[function(require,module,exports){function getJsName(name){return name.replace(/\-/g,"_").replace(/\//g,"_fs_").replace(/\\/g,"_bs_")}var NameConverter=function(){function NameConverter(){_classCallCheck(this,NameConverter),this.variableNameMap={}}return _createClass(NameConverter,[{key:"convertName",value:function(name){var map=this.variableNameMap,converted=map[name];return void 0===converted&&(converted=map[name]=getJsName(name)),converted}}]),NameConverter}(),converter=new NameConverter;module.exports={NameConverter:NameConverter,getJsName:function(name){return converter.convertName(name)}}},{}],3:[function(require,module,exports){function _chainFunc(){}function apply(target,source){if(target=target||{},source)for(var name in source)target[name]=source[name];return target}function merge(destination,object){destination=destination||{};var key,value,sourceKey;if(object)for(key in object)value=object[key],value&&value.constructor===Object?(sourceKey=destination[key],sourceKey&&sourceKey.constructor===Object?merge(sourceKey,value):destination[key]=value):destination[key]=value;return destination}function createMessage(message,source){return source&&source.isFashionScanner?message+=": "+source.currentFile+":"+source.lineNumber:source&&(message+=": "+source.file+":"+source.lineNumber),message}function isFunction(obj){return obj&&"function"==typeof obj}function trace(message,source){debugging.trace&&console.log(createMessage("[DBG] "+message,source))}function debug(message,source){console.log(createMessage("[DBG] "+message,source))}function log(message,source){console.log(createMessage("[LOG] "+message,source))}function info(message,source){console.log(createMessage("[INF] "+message,source))}function warn(message,source){console.log(createMessage("[WRN] "+message,source))}function error(message,source){console.log(createMessage("[ERR] "+message,source))}function raise(message,extra){Fashion.inspect,"string"!=typeof message&&(extra=message,message=extra.message,delete extra.message);var error=Error(message);throw error.$isFashionError=!0,apply(error,extra)}function raiseAt(message,source,stack){var extra;source&&(message=createMessage(message,source),extra=source.isFashionScanner?{file:source.currentFile,lineNumber:source.lineNumber}:{node:source,lineNumber:source.lineNumber,file:source.file}),stack&&(extra||(extra={}),extra.fashionStack=stack),raise(message,extra)}function filter(array,func){for(var result=[],i=0;i<array.length;i++){var item=array[i];func(item,i)&&result.push(item)}return result}function convert(array,func){for(var converted=[],i=0;i<array.length;i++)converted.push(func(array[i]));return converted}function _first(array){return array.length&&array[0]}function _last(array){return array.length&&array[array.length-1]}function _tail(array){return array.length>2?array.slice(1):[]}function getAllKeys(obj,stop){for(var i,key,n,names,keys=[],map={};obj&&obj!==stop;obj=Object.getPrototypeOf(obj))for(names=Object.getOwnPropertyNames(obj),i=0,n=names.length;i<n;++i)key=names[i],map[key]||(map[key]=!0,keys.push(key));return keys}function mixin(target,bases){Array.isArray(bases)||(bases=Array.prototype.slice.call(arguments,1));for(var proto=target.prototype,b=0;b<bases.length;b++){var base=bases[b],baseProto=base.prototype;getAllKeys(baseProto,Base.prototype).forEach(function(name){name in baseProto&&(name in proto||(proto[name]=baseProto[name]))})}}function flatten(array,level,output){output=output||[],level=void 0===level?1e3:level;for(var i=0;i<array.length;i++){var item=array[i];Array.isArray(item)&&level?flatten(item,level-1,output):output.push(item)}return output}var NameConverter=require("./../NameConverter.js"),debugging={trace:!1},Base=function Base(config){_classCallCheck(this,Base),config&&merge(this,config)},BaseSet=function(){function BaseSet(){_classCallCheck(this,BaseSet)}return _createClass(BaseSet,[{key:"first",value:function(){return _first(this.items)}},{key:"last",value:function(){return _last(this.items)}},{key:"tail",value:function(){return _tail(this.items)}}]),BaseSet}();BaseSet.prototype.items=null;var chain=Object.create||function(Parent){return _chainFunc.prototype=Parent,new _chainFunc};module.exports={EmptyArray:[],getJsName:NameConverter.getJsName,chain:chain,Base:Base,BaseSet:BaseSet,apply:apply,merge:merge,createMessage:createMessage,isFunction:isFunction,debugging:debugging,trace:trace,debug:debug,log:log,info:info,warn:warn,error:error,raise:raise,raiseAt:raiseAt,filter:filter,convert:convert,first:_first,last:_last,tail:_tail,mixin:mixin,flatten:flatten}},{"./../NameConverter.js":2}],4:[function(require,module,exports){var Fashion=require("./Base.js"),Base=Fashion.Base,Output=function(_Base){function Output(){_classCallCheck(this,Output);var _this=_possibleConstructorReturn(this,(Output.__proto__||Object.getPrototypeOf(Output)).call(this));return _this.output="",_this}return _inherits(Output,_Base),_createClass(Output,[{key:"space",value:function(){this.add(" ")}},{key:"add",value:function(text){this.output+=text}},{key:"addComment",value:function(text){this.output+=text}},{key:"indent",value:function(){this.indentation+=this.indentstr}},{key:"unindent",value:function(){this.indentation=this.indentation.substr(this.indentstr.length)}},{key:"addln",value:function(ln){this.output+="\n"+this.indentation+(ln||"")}},{key:"addCommentLn",value:function(ln){ln&&0===ln.indexOf("//")||this.addln(ln)}},{key:"get",value:function(){return this.output}},{key:"indentln",value:function(ln){this.addln(ln),this.indent()}},{key:"unindentln",value:function(ln){this.unindent(),this.addln(ln)}},{key:"reset",value:function(){this.indentation="",this.output=""}}]),Output}(Base);Fashion.apply(Output.prototype,{indentation:"",output:"",isCompressed:!1,indentstr:" ",splitThreshold:1e6,selectorCount:0}),module.exports=Output},{"./Base.js":3}],5:[function(require,module,exports){var Fashion=require("./Base.js"),Base=Fashion.Base,Type=require("./type/Type.js"),List=require("./type/List.js"),Bool=require("./type/Bool.js"),Color=require("./type/Color.js"),ColorRGBA=require("./type/ColorRGBA.js"),Text=require("./type/Text.js"),Literal=require("./type/Literal.js"),Statics=require("./type/Statics.js"),TypeVisitor=require("./type/TypeVisitor.js"),Types=require("./type/Types.js"),Scope=function(){function Scope(prev){_classCallCheck(this,Scope),this.prev=prev,this.map={},this.sourceInfo=null}return _createClass(Scope,[{key:"get",value:function(name){for(var value,map=this.map,prev=this;map;){if(value=map[name])return value;prev=prev.prev,map=prev&&prev.map}return value}},{key:"has",value:function(name){for(var map=this.map,prev=this;map;){if(name in map)return!0;prev=prev.prev,map=prev&&prev.map}return!1}},{key:"put",value:function(name,value){return this.map[name]=value,value}},{key:"addEntries",value:function(names){this.prev&&this.prev.addEntries(names);for(var name in this.map)names[name]=this.map[name]}},{key:"getEntries",value:function(entries){return entries=entries||{},this.addEntries(entries),entries}},{key:"getSourceInfo",value:function(){return this.sourceInfo}},{key:"getCallStack",value:function(stack){return stack=stack||[],this.sourceInfo&&stack.push(this.sourceInfo),this.prev&&this.prev.getCallStack(stack),stack}}]),Scope}();Fashion.apply(Scope.prototype,{$isScope:!0,map:void 0,prev:void 0,resetScope:void 0});var Runtime=function(_Base2){function Runtime(config){_classCallCheck(this,Runtime);var _this2=_possibleConstructorReturn(this,(Runtime.__proto__||Object.getPrototypeOf(Runtime)).call(this,config)),me=_this2;return me.mixins={},me.functions={},me.processors=[],me.registered={runtime:me,box:Statics.boxType,unbox:Statics.unboxType,isArray:function(array){return Array.isArray(array)},getRuntime:function(){return this.runtime},handleArgs:function(args,keys){for(var key,scope={},index=0,a=0;a<args.length;a++){var arg=args[a];if(void 0!==arg)if(arg===!0||arg===!1)scope[keys[index]]=arg,index++;else if(void 0===arg.type)for(key in arg)scope[key.replace(/^\$/,"")]=arg[key];else key=keys[index],key instanceof Array?(key=key[0],scope[key]=scope[key]||new List,scope[key].add(arg)):(scope[key]=arg,index++)}return scope},sliceArgs:function(args,start,end){return this.getRuntime().sliceArgs(args,start,end).items},tailArgs:function(start,args){var tail=Array.prototype.slice.call(args,start);return 1==tail.length&&this.isArray(tail)&&(tail=tail[0]),tail}},_this2}return _inherits(Runtime,_Base2),_createClass(Runtime,[{key:"bool",value:function(value){return new Bool(value)}},{key:"color",value:function color(name){var rgb=Color.map[name],color=new ColorRGBA(rgb[0],rgb[1],rgb[2],rgb[3]);return color.stringified=name,color}},{key:"quote",value:function(value){return"string"===value.type?value:new Text(""+value)}},{key:"unquote",value:function(value){return value.$isFashionType?value.unquote():new Literal(""+value)}},{key:"not",value:function(expression){return this.box(0==this.unbox(expression))}},{key:"operate",value:function(operation,left,right){return(null!=left&&!left.$isFashionNull||"=="==operation||"!="==operation)&&(null!=right&&!right.$isFashionNull||"=="==operation||"!="==operation)?left.operate(operation,right):Literal.Null}},{key:"reset",value:function(){this._currentScope=null,this._currentCallStackScope=this.createCallStackScope(),this._globalScope=this.createScope(),this._dynamics={}}},{key:"run",value:function(code,metadata){return this.load(code),this.compile(code),this.execute(metadata)}},{key:"createTypesBlock",value:function(types){types=types||this.types;for(var name,keys=Object.getOwnPropertyNames(types),buff=[],i=0;i<keys.length;i++)name=keys[i],buff.push(name+" = Types."+name),buff.push("__"+name+" = "+name);return 0===buff.length?"":"var "+buff.join(",\n ")+";\n"}},{key:"createMethodBlock",value:function(proto){proto=proto||this.constructor.prototype;for(var keys,name,buff=[];proto;){keys=Object.getOwnPropertyNames(proto);for(var i=0;i<keys.length;i++)name=keys[i],"function"==typeof proto[name]&&buff.push("__rt_"+name+" = __rt."+name+".bind(__rt)");proto=Object.getPrototypeOf(proto)}return 0===buff.length?"":"var "+buff.join(",\n ")+";\n"}},{key:"createPropertyBlock",value:function(){for(var name,keys=Object.getOwnPropertyNames(this),buff=[],i=0;i<keys.length;i++)name=keys[i],buff.push("__rt_"+name+" = __rt."+name);return 0===buff.length?"":"var "+buff.join(",\n ")+";\n"}},{key:"createPrefixedFunctionBody",value:function(code){return code=this.createTypesBlock()+this.createMethodBlock()+this.createPropertyBlock()+code}},{key:"createWrappedFn",value:function(code){return Function("Types","__rt","__gs","__udf","__dyn",this.createPrefixedFunctionBody(code))}},{key:"callWrappedFn",value:function(fn,dynamics){return fn(Fashion,this,this._globalScope,void 0,dynamics||{})}},{key:"compile",value:function(code){var theFn,me=this;return this.code=code,theFn=this.createWrappedFn(code),this.fn=function(rt,overrides,dyn){var runtime=rt||me,dynamics=dyn||{};runtime.reset(),overrides&&(overrides.$isScope?runtime._globalScope=overrides:runtime._globalScope.map=overrides),dyn&&(runtime._dynamics=dyn),runtime._currentScope=runtime._globalScope,runtime._scopeStack=[runtime._currentScope];try{theFn(me.types,runtime,runtime._globalScope,void 0,dynamics)}catch(err){Fashion.raiseAt(err.message||err,null,runtime.getCallStack())}return runtime._globalScope},this.fn}},{key:"execute",value:function(metadata){return this.fn(this,metadata)}},{key:"load",value:function(code){return this.code=code,this}},{key:"registerProcessor",value:function(proc){this.processors.push(new TypeVisitor(proc))}},{key:"register",value:function(methods){methods.dynamic&&(Fashion.error('Cannot register javascript function named "dynamic"'),delete methods.dynamic),methods.require&&(Fashion.error('Cannot register javascript function named "require"'),delete methods.require),Fashion.apply(this.registered,methods)}},{key:"isRegistered",value:function(name){return name=this.reserved[name]?"__"+name:name,!!this.registered[name]}},{key:"getGlobalScope",value:function(){return this._globalScope}},{key:"getCurrentScope",value:function(){return this._currentScope}},{key:"getRegisteredFunctions",value:function(){return this.registered}},{key:"getFunctions",value:function(){return this.functions}},{key:"getMixins",value:function(){return this.mixins}},{key:"createScope",value:function(scope){var currScope=scope||this._currentScope,newScope=new Scope(currScope);return this.pushScope(newScope)}},{key:"pushScope",value:function(scope){return scope.resetScope=this._currentScope,this._currentScope=scope,scope}},{key:"popScope",value:function(){return this._currentScope=this._currentScope.resetScope,this._currentScope}},{key:"createCallStackScope",value:function(scope){var currScope=scope||this._currentCallStackScope,newScope=new Scope(currScope);return this.pushCallStackScope(newScope)}},{key:"pushCallStackScope",value:function(scope){return scope.resetScope=this._currentCallStackScope,this._currentCallStackScope=scope,scope}},{key:"popCallStackScope",value:function(){return this._currentCallStackScope=this._currentCallStackScope.resetScope,this._currentCallStackScope}},{key:"getCallStack",value:function(){return this._currentCallStackScope?this._currentCallStackScope.getCallStack():null}},{key:"pushSourceInfo",value:function(info){return this._currentCallStackScope&&(this._currentCallStackScope.sourceInfo=info),!0}},{key:"getSourceInfo",value:function(){var stack=this._currentCallStackScope,info=stack&&stack.sourceInfo;return info&&info.length?{lineNumber:info[0],file:info[1]}:null}},{key:"get",value:function(name){var scope=this.getScopeForName(name),res=scope.map[name];return void 0===res&&(name in scope.map||Fashion.raiseAt("Reference to undeclared variable : "+name,null,this.getCallStack())),this.box(res)}},{key:"getScopeForName",value:function(jsName){for(var scope=this._currentScope;scope;){if(jsName in scope.map)return scope;scope=scope.prev}return this._currentScope}},{key:"getDefault",value:function(val){if(null!=val&&void 0!==val){if(!val.$isFashionNull)return this.box(val);if(this.constructor.allowNullDefaults)return val}}},{key:"getGlobalDefault",value:function(jsName){var obj=this._globalScope.get(jsName);return this.getDefault(obj)}},{key:"getLocalDefault",value:function(jsName){var obj=this._currentScope.get(jsName);return this.getDefault(obj)}},{key:"setGlobal",value:function(jsName,value,astNodeId){var currScope=this._globalScope;return value&&value.$isFashionLiteral||(value=this.box(value)),value.ast=value.ast||this.getAstNode(astNodeId),currScope.map[jsName]=value,value}},{key:"setDynamic",value:function(name,value,astNodeId){var newValue,jsName=Fashion.getJsName(name),currScope=this._globalScope;return value&&value.$isFashionLiteral||(value=this.box(value)),value.ast=value.ast||this.getAstNode(astNodeId),value.$referenceName||value.$constant?(newValue=value.clone(),newValue.$previousReference=value,value=newValue,value.ast=this.getAstNode(astNodeId)):value.$referenceName=name,currScope.map[jsName]=value,value}},{key:"setScoped",value:function(jsName,value){var currScope=this.getScopeForName(jsName);return value&&value.$isFashionLiteral||(value=this.box(value)),currScope.map[jsName]=value,value}},{key:"set",value:function(jsName,value){var currScope=this._currentScope;return value&&value.$isFashionLiteral||(value=this.box(value)),currScope.map[jsName]=value,value}},{key:"getDocs",value:function(id){if(this.docCache)return this.docCache.get(id)}},{key:"getString",value:function(id){if(this.stringCache)return this.stringCache.get(id)}},{key:"getAstNode",value:function(id){if(this.nodeCache)return this.nodeCache.get(id)}},{key:"applySpread",value:function(arg){return arg.spread=!0,arg}},{key:"sliceArgs",value:function(args,start,end){start=start||0,end=end||args.length;var spread,a,arg,filtered=[],newArgs=[],separator=", ";for(a=start;a<end;a++)arg=args[a],arg?arg.spread&&arg.$isFashionList?(spread&&filtered.push(spread),spread=arg,separator=spread.separator||separator):filtered.push(arg):spread||filtered.push(arg);for(a=0;a<filtered.length;a++)arg=filtered[a],separator=arg&&arg.splatSeparator||separator,newArgs.push(filtered[a]);return spread&&newArgs.push.apply(newArgs,spread.items),new List(newArgs,separator)}},{key:"applySpreadArgs",value:function(args,name){var arg,a,item,i,items,key,map,defaults,proc,param,paramName,newArgs=[],hadSpread=!1,offset=0;for(proc=this.context&&this.context.preprocessor,proc&&(defaults=proc.mixinDeclarations[name],defaults?offset=1:defaults=proc.functionDeclarations[name],defaults=defaults&&defaults.parameters),a=0;a<args.length;a++){if(arg=args[a],arg&&arg.spread&&arg.$isFashionMap&&defaults){items=arg.items,map={};for(key in arg.map)map["$"+Fashion.getJsName(key)]=arg.map[key];for(var p=0;p<defaults.length;p++)param=defaults[p],paramName=Fashion.getJsName(param.name),paramName in map?(newArgs.push(items[map[paramName]]),delete map[paramName]):param.varArgs||newArgs.push(void 0);for(key in map)item=items[map[key]],newArgs.push(item);hadSpread=!0}else if(arg&&arg.spread&&arg.$isFashionList){for(items=arg.getItems(),i=0;i<items.length;i++)item=items[i],item&&(item.splatSeparator=arg.separator),newArgs.push(item);hadSpread=!0}else!arg&&hadSpread||newArgs.push(arg);arg&&(arg.spread=void 0)}var misisngParams=this.context&&this.context.missingParameters;if(misisngParams&&"error"==misisngParams&&defaults)for(var d=0;d<defaults.length;d++)defaults[d].hasOwnProperty("default")||defaults[d].varArgs||void 0===newArgs[d+offset]&&Fashion.raiseAt("No value supplied for argument : "+defaults[d].name,null,this.getCallStack());return newArgs}},{key:"warn",value:function(arg){Fashion.warn(arg,this.getSourceInfo())}},{key:"error",value:function(arg){Fashion.raiseAt(arg,null,this.getCallStack())}},{key:"debug",value:function(){Fashion.debug.apply(Fashion,arguments)}},{key:"setCaches",value:function(transpiler){this.docCache=transpiler.docCache,this.stringCache=transpiler.stringCache,this.nodeCache=transpiler.nodeCache}},{key:"copyRuntimeState",value:function(runtime){this._dynamics=runtime._dynamics,this.registered=runtime.registered,this.functions=runtime.functions,this.mixins=runtime.mixins}},{key:"test",value:function(val){return val=this.unbox(val),null!=val&&val!==!1}},{key:"and",value:function(a,b){return this.test(a)?b:a}},{key:"or",value:function(a,b){return this.test(a)?a:b}}]),Runtime}(Base);Fashion.apply(Runtime.prototype,{box:Type.box,unbox:Type.unbox,Scope:Scope,isFashionRuntime:!0,functions:null,code:null,fn:null,stringCache:null,docCache:null,types:Types,_globalScope:null,_currentScope:null,_dynamics:null,context:null,reserved:{"if":!0,"else":!0}}),module.exports=Runtime},{"./Base.js":3,"./type/Bool.js":8,"./type/Color.js":9,"./type/ColorRGBA.js":11,"./type/List.js":15,"./type/Literal.js":16,"./type/Statics.js":22,"./type/Text.js":23,"./type/Type.js":24,"./type/TypeVisitor.js":25,"./type/Types.js":26}],6:[function(require,module,exports){var Fashion=require("../Base.js"),Runtime=require("../Runtime.js"),ValueParser=require("../parse/ValueParser.js"),SourceBuilder=require("../type/SourceBuilder.js"),CssVariableManager=function(){function CssVariableManager(){_classCallCheck(this,CssVariableManager),this.reset()}return _createClass(CssVariableManager,[{key:"reset",value:function(){this.initFns=[],this.calcFns=[],this.variableMap={},this.runtime=null}},{key:"createRuntime",value:function(){return new Runtime}},{key:"getRuntime",value:function(){var me=this,rt=me.runtime;if(!rt){rt=me.createRuntime();for(var i=0;i<me.initFns.length;i++)me.initFns[i](rt);me.runtime=rt}return rt}},{key:"calculate",value:function(vars){var key,scope,sb,name,names,jsName,value,me=this,rt=me.getRuntime(),parser=new ValueParser,map=me.variableMap;scope=new rt.Scope;for(name in vars)key=Fashion.getJsName(name.replace(me.nameRe,"")),0!==key.indexOf("$")&&(key="$"+key),scope.put(key,parser.parse(vars[name]));rt._globalScope=scope,rt._currentScope=scope;for(var i=0;i<me.calcFns.length;i++)me.calcFns[i](rt);sb=new SourceBuilder,vars={};for(name in map){names=map[name];for(var i=0;i<names.length;i++)key=names[i],jsName="$"+Fashion.getJsName(key),value=scope.get(jsName),value&&(value.$isWrapper&&(value=value.value),vars[key]=sb.toSource(value))}return vars}},{key:"applyVariables",value:function(vars){var me=this,map=me.variableMap;for(var selector in map){var variables=map[selector],els=document.querySelectorAll(selector);if(els)for(var i=0;i<els.length;i++)for(var j=0;j<variables.length;j++){var varName=variables[j];els[i].style.setProperty("--"+varName,vars[varName])}}}},{key:"setVariables",value:function(vars){this.applyVariables(this.calculate(vars))}},{key:"register",value:function(init,calc,map){if(init&&this.initFns.push(init),calc&&this.calcFns.push(calc),map){var vars=this.variableMap;for(var name in map){var curr=vars[name];curr?curr.push.apply(curr,map[name]):vars[name]=map[name]}}}},{key:"buildName",value:function(name){return name.replace(/^--/,"").replace(/^\$/,"")}},{key:"buildJsName",value:function(name){return Fashion.getJsName(name)}},{key:"buildNames",value:function(names){var name,out={};for(name in names)out[name]=this.buildName(names[name]);return out}},{key:"buildJsNames",value:function(names){var name,out={};for(name in names)out[name]=this.buildJsName(names[name]);return out}},{key:"getVariables",value:function(){var me=this,map=me.variableMap,out={};for(var selector in map){var variables=map[selector],els=document.querySelectorAll(selector);if(els)for(var i=0;i<els.length;i++)for(var j=0;j<variables.length;j++){var varName=variables[j];out[varName]=els[i].style.getPropertyValue("--"+varName)}}return out}}]),CssVariableManager}();Fashion.apply(CssVariableManager.prototype,{$isExport:!0,nameRe:/^--/}),module.exports=CssVariableManager},{"../Base.js":3,"../Runtime.js":5,"../parse/ValueParser.js":7,"../type/SourceBuilder.js":21}],7:[function(require,module,exports){var Fashion=require("../Base.js"),Type=require("../type/Type.js"),Types=(require("../type/Statics.js"),require("../type/Types.js")),Color=Types.Color,Text=Types.Text,Numeric=Types.Numeric,List=Types.List,Bool=Types.Bool,Literal=Types.Literal,ColorRGBA=Types.ColorRGBA,ColorHSLA=Types.ColorHSLA,FunctionCall=Types.FunctionCall,Parser=function(){function Parser(){_classCallCheck(this,Parser),this.index=0}return _createClass(Parser,[{key:"_advance",value:function(){for(var ch,me=this,buff="",str=me.str,len=str.length,isString=!1,escaped=!1,isParen=0;me.index<len;)if(ch=str[me.index],me.index++,ch<=" "&&!isString&&!isParen){if(buff.length)break}else{if(";"===ch&&!isString&&!escaped)break;if("("===ch&&isParen++,")"===ch&&isParen&&isParen--,","===ch&&!isString&&!escaped&&!isParen){if(buff.length){me.index--;break}return ch}"\\"===ch&&isString?(escaped=1,me.index++):('"'!==ch&&"'"!==ch||(isString?isString===ch&&(isString=!1):isString=ch),escaped=!1,buff+=ch)}return buff}},{key:"parseValue",value:function(token){var match,value,rx={number:/^(\d+)(px|pt|pc|cm|mm|in|em|rem|ex)?$/g,shortHexColor:/^#([A-Fa-f0-9]{3})$/,longHexColor:/^#([A-Fa-f0-9]{6})$/,functionCall:/^([A-Za-z0-9_]+)\((.*)\)$/,parenList:/^\((.*?)\)$/};if('"'===token[0]||"'"===token[0])return value=token=token.substring(1,token.length-1),new Text(value,token[0]);if("true"===token)return new Bool((!0));if("false"===token)return new Bool((!1));if("null"===token)return Literal.Null;if("none"===token)return Literal.None;if(Fashion.Color.map[token]){var rgb=Color.map[token],color=new ColorRGBA(rgb[0],rgb[1],rgb[2],rgb[3]);return color.stringified=token,color}if(match=rx.number.exec(token))return new Numeric(parseFloat(match[1]),match[2]);if(match=rx.shortHexColor.exec(token))return ColorRGBA.fromHex(match[1]);if(match=rx.longHexColor.exec(token))return ColorRGBA.fromHex(match[1]);if(match=rx.functionCall.exec(token)){var name=match[1],args=this.parse(match[2]).items;return"hsla"===name||"hsl"===name?new ColorHSLA(Type.unbox(args[0]),Type.unbox(args[1]),Type.unbox(args[2]),Type.unbox(args[3])||1):"rgba"===name||"rgb"===name?new ColorRGBA(Type.unbox(args[0]),Type.unbox(args[1]),Type.unbox(args[2]),Type.unbox(args[3])||1):new FunctionCall(name,args)}return(match=rx.parenList.exec(token))?new FunctionCall(this.parse(match[1])):new Fashion.Literal(token)}},{key:"parse",value:function(str){var token,me=this,tokens=[],values=[],csv=null;for(me.str=str,me.index=0;token=me._advance();)tokens.push(token);for(var i=0;i<tokens.length;i++)token=tokens[i].trim(),","===tokens[i+1]?(csv=csv||[],csv.push(me.parseValue(token)),i++):csv?(csv.push(me.parseValue(token)),values.push(new List(csv,", ")),csv=null):values.push(me.parseValue(token));return 1===values.length?values[0]:new List(values," ")}}]),Parser}();module.exports=Parser},{"../Base.js":3,"../type/Statics.js":22,"../type/Type.js":24,"../type/Types.js":26}],8:[function(require,module,exports){var Fashion=require("../Base.js"),Type=require("./Type.js"),Bool=function(_Type){function Bool(value){_classCallCheck(this,Bool);var _this3=_possibleConstructorReturn(this,(Bool.__proto__||Object.getPrototypeOf(Bool)).call(this));return _this3.value=!!value,_this3}return _inherits(Bool,_Type),_createClass(Bool,[{key:"doVisit",value:function(visitor){visitor.bool(this)}},{key:"toString",value:function(){return this.value?"true":"false"}},{key:"copy",value:function(){return new Bool(this.value)}}]),Bool}(Type);Fashion.apply(Bool.prototype,{type:"bool",$isFashionBool:!0,value:null}),Bool.True=new Bool((!0)),Bool.True.$constant=!0,Bool.False=new Bool((!1)),Bool.False.$constant=!0,module.exports=Bool},{"../Base.js":3,"./Type.js":24}],9:[function(require,module,exports){var Fashion=require("../Base.js"),Type=require("./Type.js"),Bool=require("./Bool.js"),Numeric=require("./Numeric.js"),Color=function(_Type2){function Color(){return _classCallCheck(this,Color),_possibleConstructorReturn(this,(Color.__proto__||Object.getPrototypeOf(Color)).call(this))}return _inherits(Color,_Type2),_createClass(Color,[{key:"toBoolean",value:function(){return Bool.True}},{key:"getRGBA",value:function(){return this}},{key:"getHSLA",value:function(){return this}}],[{key:"component",value:function(color,_component){var targetColor,unit=Color.units[_component],type=Color.types[_component],prop=Color.comps[_component];return targetColor="hsla"==type?color.getHSLA():color.getRGBA(),new Numeric(targetColor[prop],unit)}},{key:"adjust",value:function(color,component,amount){var hsl=color.getHSLA().copy(),prop=Color.comps[component],value=amount.value;return hsl[prop]+=value,hsl.h=Color.constrainDegrees(hsl.h),hsl.s=Color.constrainPercentage(hsl.s),hsl.l=Color.constrainPercentage(hsl.l),
hsl.getRGBA()}},{key:"constrainChannel",value:function(channel){return Math.max(0,Math.min(channel,255))}},{key:"constrainPercentage",value:function(per){return Math.max(0,Math.min(per,100))}},{key:"constrainDegrees",value:function(deg){return deg%=360,deg<0?360+deg:deg}},{key:"constrainAlpha",value:function(alpha){return void 0===alpha?1:Math.max(0,Math.min(alpha,1))}}]),Color}(Type);Fashion.apply(Color,{units:{lightness:"%",saturation:"%",hue:"deg"},types:{red:"rgba",blue:"rgba",green:"rgba",alpha:"rgba",hue:"hsla",saturation:"hsla",lightness:"hsla"},comps:{red:"r",green:"g",blue:"b",alpha:"a",hue:"h",saturation:"s",lightness:"l"},map:{aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[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],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],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,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],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],lightgreen:[144,238,144],lightgrey:[211,211,211],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],magenta:[255,0,255],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,203],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:[119,128,144],slategrey:[119,128,144],snow:[255,255,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,5],transparent:[0,0,0,0]}}),Fashion.apply(Color.prototype,{type:"color",$isFashionColor:!0,$isFashionRGBA:!1,$isFashionHSLA:!1,$canUnbox:!1}),module.exports=Color},{"../Base.js":3,"./Bool.js":8,"./Numeric.js":18,"./Type.js":24}],10:[function(require,module,exports){var Fashion=require("../Base.js"),Color=require("./Color.js"),ColorRGBA=require("./ColorRGBA.js"),ColorHSLA=function(_Color){function ColorHSLA(h,s,l,a){_classCallCheck(this,ColorHSLA);var _this5=_possibleConstructorReturn(this,(ColorHSLA.__proto__||Object.getPrototypeOf(ColorHSLA)).call(this));return _this5.h=Color.constrainDegrees(h),_this5.s=s,_this5.l=l,void 0!==a&&(_this5.a=a),_this5}return _inherits(ColorHSLA,_Color),_createClass(ColorHSLA,[{key:"doVisit",value:function(visitor){visitor.hsla(this)}},{key:"operate",value:function(operation,right){return this.getRGBA().operate(operation,right)}},{key:"copy",value:function(){return new ColorHSLA(this.h,this.s,this.l,this.a)}},{key:"getRGBA",value:function(){return ColorRGBA.fromHSLA(this)}},{key:"toString",value:function(){return""+this.getRGBA()}},{key:"add",value:function(h,s,l,a){return new ColorHSLA(Color.constrainDegrees(this.h+h),Color.constrainPercentage(this.s+s),Color.constrainPercentage(this.l+l),Color.constrainAlpha(this.a*a))}},{key:"subtract",value:function(h,s,l){return this.add(-h,-s,-l)}},{key:"adjustLightness",value:function(percent){return this.l=Color.constrainPercentage(this.l+percent),this}},{key:"adjustHue",value:function(deg){return this.h=Color.constrainDegrees(this.h+deg),this}}],[{key:"fromRGBA",value:function(rgba){if(rgba.$isFashionHSLA)return rgba.clone();var r=rgba.r/255,g=rgba.g/255,b=rgba.b/255,a=rgba.a,max=Math.max(r,g,b),min=Math.min(r,g,b),delta=max-min,h=0,s=0,l=.5*(max+min);return min!=max&&(s=l<.5?delta/(max+min):delta/(2-max-min),h=r==max?60*(g-b)/delta:g==max?120+60*(b-r)/delta:240+60*(r-g)/delta,h<0&&(h+=360),h>=360&&(h-=360)),new ColorHSLA(Color.constrainDegrees(h),Color.constrainPercentage(100*s),Color.constrainPercentage(100*l),a)}}]),ColorHSLA}(Color);ColorRGBA.prototype.getHSLA=function(){return ColorHSLA.fromRGBA(this)},Fashion.apply(ColorHSLA.prototype,{type:"hsla",$isFashionHSLA:!0,h:null,s:null,l:null,a:1}),module.exports=ColorHSLA},{"../Base.js":3,"./Color.js":9,"./ColorRGBA.js":11}],11:[function(require,module,exports){function hex2(v){var s=v.toString(16);return s.length<2&&(s="0"+s),s}var Fashion=require("../Base.js"),Color=require("./Color.js"),ColorRGBA=function(_Color2){function ColorRGBA(r,g,b,a){_classCallCheck(this,ColorRGBA);var _this6=_possibleConstructorReturn(this,(ColorRGBA.__proto__||Object.getPrototypeOf(ColorRGBA)).call(this));return _this6.r=Math.min(255,Math.max(0,r)),_this6.g=Math.min(255,Math.max(0,g)),_this6.b=Math.min(255,Math.max(0,b)),void 0!==a&&(_this6.a=Math.min(1,Math.max(0,a))),_this6}return _inherits(ColorRGBA,_Color2),_createClass(ColorRGBA,[{key:"doVisit",value:function(visitor){visitor.rgba(this)}},{key:"copy",value:function(){return new ColorRGBA(this.r,this.g,this.b,this.a)}},{key:"getHSLA",value:function(){return null}},{key:"stringify",value:function(){var me=this,round=Math.round,r=round(me.r),g=round(me.g),b=round(me.b),a=me.a,stringified="";return stringified=1===a?"#"+hex2(r)+hex2(g)+hex2(b):"rgba("+r+", "+g+", "+b+", "+a+")",stringified=stringified.toLowerCase()}},{key:"getCompressedValue",value:function(lowerVal){var name=ColorRGBA.stringifiedMap[lowerVal],shortName=ColorRGBA.shortFormMap[lowerVal];return name&&(lowerVal=lowerVal.length>name.length?name:lowerVal),ColorRGBA.useShortValues&&shortName&&(lowerVal=lowerVal.length>shortName.length?shortName:lowerVal),lowerVal}},{key:"toString",value:function(){return this.stringified||(this.stringified=this.getCompressedValue(this.stringify())),this.stringified}},{key:"toIeHexStr",value:function(){var me=this,round=Math.round,r=round(me.r),g=round(me.g),b=round(me.b),a=round(255*me.a);return"#"+hex2(a)+hex2(r)+hex2(g)+hex2(b)}},{key:"add",value:function(r,g,b,a){return new ColorRGBA(this.r+r,this.g+g,this.b+b,this.a*a)}},{key:"subtract",value:function(r,g,b){return new ColorRGBA(this.r-r,this.g-g,this.b-b,this.a)}},{key:"multiply",value:function(number){return new ColorRGBA(this.r*number,this.g*number,this.b*number,this.a)}},{key:"divide",value:function(number){return new ColorRGBA(this.r/number,this.g/number,this.b/number,this.a)}}],[{key:"fromHex",value:function(value){"#"==value.charAt(0)&&(value=value.substr(1));var r,g,b;3===value.length?(r=parseInt(value.charAt(0),16),g=parseInt(value.charAt(1),16),b=parseInt(value.charAt(2),16),r=(r<<4)+r,g=(g<<4)+g,b=(b<<4)+b):(r=parseInt(value.substring(0,2),16),g=parseInt(value.substring(2,4),16),b=parseInt(value.substring(4,6),16));var result=new ColorRGBA(r,g,b);return ColorRGBA.preserveInputStrings&&(result.stringified="#"+value),result}},{key:"fromHSLA",value:function(color){function hue(h){return h<0&&++h,h>1&&--h,6*h<1?m1+(m2-m1)*h*6:2*h<1?m2:3*h<2?m1+(m2-m1)*(2/3-h)*6:m1}if(color.$isFashionRGBA)return color.clone();var hsla=color,h=hsla.h/360,s=hsla.s/100,l=hsla.l/100,a=hsla.a,m2=l<=.5?l*(s+1):l+s-l*s,m1=2*l-m2,r=Color.constrainChannel(255*hue(h+1/3)),g=Color.constrainChannel(255*hue(h)),b=Color.constrainChannel(255*hue(h-1/3));return new ColorRGBA(r,g,b,a)}}]),ColorRGBA}(Color);Fashion.apply(ColorRGBA,{stringifiedMap:{"rgba(0, 0, 0, 0)":"transparent"},shortFormMap:{},useShortValues:!0,preserveInputStrings:!1}),Fashion.apply(ColorRGBA.prototype,{type:"rgba",$isFashionRGBA:!0,r:null,g:null,b:null,a:1,stringified:null,"+.number":function(right){var value=right.value,unit=right.unit;switch(unit){case"%":return this.getHSLA().adjustLightness(value).getRGBA();case"deg":return this.getHSLA().adjustHue(value).getRGBA();default:return this.add(value,value,value,1)}},"+.rgba":function(right){return this.add(right.r,right.g,right.b,right.a)},"+.hsla":function(right){return this.getHSLA().add(right.h,right.s,right.l)},"-.number":function(right){var value=right.value,unit=right.unit;switch(unit){case"%":return this.getHSLA().adjustLightness(-value).getRGBA();case"deg":return this.getHSLA().adjustHue(-value).getRGBA();default:return this.subtract(value,value,value)}},"-.rgba":function(right){return this.subtract(right.r,right.g,right.b)},"-.hsla":function(right){return this.getHSLA().subtract(right.h,right.s,right.l)},"*.number":function(right){return this.multiply(right.value)},"/.number":function(right){return this.divide(right.value)},"*.rgba":function(right){return new ColorRGBA(this.r*right.r,this.g*right.g,this.b*right.b,this.a*right.a)},"/.rgba":function(right){return new ColorRGBA(Math.floor(this.r/right.r),Math.floor(this.g/right.g),Math.floor(this.b/right.b),Math.floor(this.a/right.a))}}),module.exports=ColorRGBA,function(ColorRGBA,stringifiedMap,colorMap,shortMap){var i,colorChars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],names=Object.keys(colorMap);for(names.sort(),i=0;i<names.length;i++){var name=names[i],val=colorMap[name],color=new ColorRGBA(val[0],val[1],val[2],val[3]),str=color.stringify();stringifiedMap[str]=name}colorChars.forEach(function(short1){var long1=short1+short1;colorChars.forEach(function(short2){var long2=short2+short2;colorChars.forEach(function(short3){var long3=short3+short3,shortName="#"+short1+short2+short3,longName="#"+long1+long2+long3;if(shortMap[longName]){var curr=shortMap[longName];shortName=curr.length>shortName.length?shortName:curr}shortMap[longName]=shortName})})})}(ColorRGBA,ColorRGBA.stringifiedMap,Color.map,ColorRGBA.shortFormMap)},{"../Base.js":3,"./Color.js":9}],12:[function(require,module,exports){var Fashion=require("../Base.js"),Type=require("./Type.js"),Numeric=require("./Numeric.js"),ColorStop=function(_Type3){function ColorStop(color,stop){_classCallCheck(this,ColorStop);var _this7=_possibleConstructorReturn(this,(ColorStop.__proto__||Object.getPrototypeOf(ColorStop)).call(this));return _this7.color=color,_this7.stop=stop,_this7}return _inherits(ColorStop,_Type3),_createClass(ColorStop,[{key:"doVisit",value:function(visitor){visitor.colorstop(this)}},{key:"descend",value:function(visitor){visitor.visit(this.color),visitor.visit(this.stop)}},{key:"toString",value:function(){var string=""+this.color,stop=this.stop;return stop&&(stop=stop.copy(),string+=" ",stop.unit||(stop.value*=100,stop.unit="%"),string+=""+stop),string}},{key:"toOriginalWebkitString",value:function(){var stop=this.stop;return stop||(stop=new Numeric(0,"%")),stop=stop.copy(),stop.unit||(stop.value*=100,stop.unit="%"),"color-stop("+stop+", "+this.color+")"}},{key:"copy",value:function(){return new ColorStop(this.color&&this.color.clone(),this.stop&&this.stop.clone())}}]),ColorStop}(Type);Fashion.apply(ColorStop.prototype,{type:"colorstop",$isFashionColorStop:!0,$canUnbox:!1,color:null,stop:null}),module.exports=ColorStop},{"../Base.js":3,"./Numeric.js":18,"./Type.js":24}],13:[function(require,module,exports){var Fashion=require("../Base.js"),Type=require("./Type.js"),List=require("./List.js"),FunctionCall=function(_Type4){function FunctionCall(name,args){_classCallCheck(this,FunctionCall);var _this8=_possibleConstructorReturn(this,(FunctionCall.__proto__||Object.getPrototypeOf(FunctionCall)).call(this));return _this8.name=name,Array.isArray(args)&&(args=new List(args)),_this8.args=args,_this8}return _inherits(FunctionCall,_Type4),_createClass(FunctionCall,[{key:"toString",value:function(){var argsStr,args=this.args;return argsStr=Array.isArray(args)?args.join(", "):""+args,this.name+"("+argsStr+")"}},{key:"doVisit",value:function(visitor){visitor.functioncall(this)}},{key:"descend",value:function(visitor){this.args&&visitor.visit(this.args)}},{key:"copy",value:function(){return new FunctionCall(this.name,this.args&&this.args.copy())}}]),FunctionCall}(Type);Fashion.apply(FunctionCall.prototype,{type:"functioncall",$isFashionFunctionCall:!0,$canUnbox:!1,name:null,args:null}),module.exports=FunctionCall},{"../Base.js":3,"./List.js":15,"./Type.js":24}],14:[function(require,module,exports){var Fashion=require("../Base.js"),Type=require("./Type.js"),LinearGradient=function(_Type5){function LinearGradient(position,stops){_classCallCheck(this,LinearGradient);var _this9=_possibleConstructorReturn(this,(LinearGradient.__proto__||Object.getPrototypeOf(LinearGradient)).call(this));return _this9.position=position,_this9.stops=stops,_this9}return _inherits(LinearGradient,_Type5),_createClass(LinearGradient,[{key:"doVisit",value:function(visitor){visitor.lineargradient(this)}},{key:"descend",value:function(visitor){visitor.visit(this.position),visitor.visit(this.stops)}},{key:"copy",value:function(){return new LinearGradient(this.position&&this.position.clone(),this.stops&&this.stops.clone())}},{key:"gradientPoints",value:function(position){}},{key:"operate",value:function(operation,right){switch(operation){case"!=":if("literal"==right.type&&("null"==right.value||"none"==right.value))return!0;case"==":if("literal"==right.type&&("null"==right.value||"none"==right.value))return!1}return _get(LinearGradient.prototype.__proto__||Object.getPrototypeOf(LinearGradient.prototype),"operate",this).call(this,operation,right)}},{key:"supports",value:function(prefix){return!!this.vendorPrefixes[prefix.toLowerCase()]}},{key:"toString",value:function(){var string="linear-gradient(";return this.position&&(string+=this.position+", "),string+this.stops+")"}},{key:"toOriginalWebkitString",value:function(){var i,args=[],stops=this.stops.items,ln=stops.length;for(args.push("top"),args.push("bottom"),i=0;i<ln;i++)args.push(stops[i].toOriginalWebkitString());return"-webkit-gradient(linear, "+args.join(", ")+")"}},{key:"toPrefixedString",value:function(prefix){return"owg"===prefix?this.toOriginalWebkitString():prefix+(""+this)}}]),LinearGradient}(Type);Fashion.apply(LinearGradient.prototype,{type:"lineargradient",$isFashionLinearGradient:!0,$canUnbox:!1,position:null,stops:null,vendorPrefixes:{webkit:!0,moz:!0,svg:!0,pie:!0,css2:!0,o:!0,owg:!0}}),module.exports=LinearGradient},{"../Base.js":3,"./Type.js":24}],15:[function(require,module,exports){var Fashion=require("../Base.js"),Type=require("./Type.js"),List=function(_Type6){function List(items,separator){_classCallCheck(this,List);var _this10=_possibleConstructorReturn(this,(List.__proto__||Object.getPrototypeOf(List)).call(this));return _this10.items=items||[],_this10.separator=void 0===separator?" ":separator,_this10}return _inherits(List,_Type6),_createClass(List,[{key:"doVisit",value:function(visitor){visitor.list(this)}},{key:"descend",value:function(visitor){for(var i=0;i<this.items.length;i++)visitor.visit(this.items[i])}},{key:"copy",value:function(){for(var items=this.items,len=items.length,newItems=[],i=0;i<len;i++)newItems.push(items[i].clone());return new List(newItems,this.separator)}},{key:"clone",value:function(match,replace){if(replace&&this.matches(match))return replace.clone();for(var items=this.items,len=items.length,newItems=[],i=0;i<len;i++){var item=items[i];item?newItems.push(item.clone(match,replace)):newItems.push(item)}var copy=new List(newItems,this.separator);return copy.$referenceName=this.$referenceName,copy.$referenceBase=this.$referenceBase,copy.$previousReference=this.$previousReference,copy}},{key:"add",value:function(item){return this.items.push(item)}},{key:"get",value:function(index){return this.items[index-1]||null}},{key:"operate",value:function(operation,right){switch(operation){case"!=":if(right.$isFashionLiteral&&("null"===right.value||"none"===right.value))return!0;break;case"==":if(right.$isFashionLiteral&&("null"===right.value||"none"===right.value))return!1}return _get(List.prototype.__proto__||Object.getPrototypeOf(List.prototype),"operate",this).call(this,operation,right)}},{key:"supports",value:function(prefix){for(var i=0;i<this.items.length;i++){var item=this.items[i];if(item.supports(prefix))return!0}return!1}},{key:"toBoolean",value:function(){return!!this.items.length}},{key:"getItems",value:function(){return this.items}},{key:"toString",value:function(){return this.items.join(this.separator)}},{key:"unquote",value:function(){for(var item,items=[],i=0;i<this.items.length;i++)item=this.items[i],item?items.push(item.unquote()):items.push(item);return new List(items,this.separator)}},{key:"toPrefixedString",value:function(prefix){for(var items=[],i=0;i<this.items.length;i++){var item=this.items[i];item&&items.push(item.toPrefixedString(prefix))}return items.join(this.separator)}},{key:"==.list",value:function(right){for(var equals=this.separator==right.separator&&this.items.length==right.items.length,i=0;equals&&i<this.items.length;++i)equals=this.items[i].operate("==",right.items[i]);return equals}}]),List}(Type);Fashion.apply(List.prototype,{type:"list",$isFashionList:!0,items:null,separator:null}),module.exports=List},{"../Base.js":3,"./Type.js":24}],16:[function(require,module,exports){var Fashion=require("../Base.js"),Type=require("./Type.js"),Numeric=require("./Numeric.js"),Literal=function(_Type7){function Literal(value){_classCallCheck(this,Literal);var _this11=_possibleConstructorReturn(this,(Literal.__proto__||Object.getPrototypeOf(Literal)).call(this));return _this11.value=value,_this11}return _inherits(Literal,_Type7),_createClass(Literal,[{key:"doVisit",value:function(visitor){visitor.literal(this)}},{key:"_getHash",value:function(){return this.value}},{key:"toString",value:function(){return this.value||""}},{key:"toBoolean",value:function(){return this.value.length}},{key:"copy",value:function(){return new Literal(this.value)}},{key:"+",value:function(right){return new Literal(this.value+right.getHash())}},{key:"+.number",value:function(right){return null===this.value?right:new Literal(this.value+(""+right))}},{key:"/",value:function(right){return new Literal(this.value+"/"+right.getHash())}},{key:"-",value:function(right){return new Literal(this.value+"-"+right.getHash())}},{key:"%",value:function(right){return new Literal(this.value+"%"+right.getHash())}},{key:"normalizeStart",value:function(startVal){var start=Type.unbox(startVal)||0;return start>0&&(start-=1),start<0&&(start=this.value.length+start),start<0&&(start=0),start}},{key:"normalizeEnd",value:function(endVal){var end=Type.unbox(endVal)||-1;return end>0&&(end-=1),end<0&&(end=this.value.length+end),end<0&&(end=0),end>0&&(end+=1),end}},{key:"slice",value:function(start,end){return start=this.normalizeStart(start),end=this.normalizeEnd(end),new Literal(this.value.slice(start,end))}},{key:"toUpperCase",value:function(){return new Literal(this.value.toUpperCase())}},{key:"toLowerCase",value:function(){return new Literal(this.value.toLowerCase())}},{key:"indexOf",value:function(str){var idx=this.value.indexOf(str.value);if(idx!==-1)return new Numeric(idx+1)}},{key:"insert",value:function(str,startVal){var start=Type.unbox(startVal)||0,inserted=this.value;return start>0&&(start=Math.min(start-1,inserted.length)),start<0&&(start=inserted.length+start+1,start=Math.max(start,0)),inserted=inserted.substring(0,start)+str.value+inserted.substring(start),new Literal(Literal.deEscape(inserted))}},{key:"toDisplayString",value:function(){var val=this.value;return null===val?"null":""+this}}],[{key:"tryCoerce",value:function(obj){if(!obj.$isFashionNumber)return obj.$isFashionString?new Literal(obj.value):obj.$isFashionLiteral?obj:new Literal(obj.getHash())}},{key:"deEscape",value:function(str){var i,ch,buff="";for(i=0;i<str.length;i++)ch=str.charAt(i),"\\"===ch&&(i++,ch=str.charAt(i)),buff+=ch;return buff}}]),Literal}(Type);Fashion.apply(Literal.prototype,{type:"literal",$isFashionLiteral:!0,value:null});var FashionNull=function(_Literal){function FashionNull(value){return _classCallCheck(this,FashionNull),_possibleConstructorReturn(this,(FashionNull.__proto__||Object.getPrototypeOf(FashionNull)).call(this,value||null))}return _inherits(FashionNull,_Literal),_createClass(FashionNull,[{key:"copy",value:function(){return new FashionNull(this.value)}}]),FashionNull}(Literal);Fashion.apply(FashionNull.prototype,{$isFashionNull:!0,$constant:!0}),FashionNull.prototype.$isFashionNull=!0,Literal.Null=new FashionNull(null),Literal.None=new Literal("none"),module.exports=Literal},{"../Base.js":3,"./Numeric.js":18,"./Type.js":24}],17:[function(require,module,exports){var Fashion=require("../Base.js"),List=require("./List.js"),Type=require("./Type.js"),Literal=require("./Literal.js"),Null=Literal.Null,Numeric=require("./Numeric.js"),Map=function(_List){function Map(pairs){_classCallCheck(this,Map);var _this13=_possibleConstructorReturn(this,(Map.__proto__||Object.getPrototypeOf(Map)).call(this,pairs));if(_this13.map={},pairs)for(var i=0;i<pairs.length-1;i+=2){var key=_this13.toKey(pairs[i]);pairs[i+1];_this13.map[key]=i+1}return _this13}return _inherits(Map,_List),_createClass(Map,[{key:"doVisit",value:function(visitor){visitor.map(this)}},{key:"descend",value:function(visitor){for(var i=0;i<this.items.length;i++)visitor.visit(this.items[i])}},{key:"get",value:function(key){return key instanceof Numeric&&(key=Type.unbox(key)),"number"==typeof key?new List([this.items[2*key-2],this.items[2*key-1]]," "):(key=this.toKey(key),this.items[this.map[key]]||Null)}},{key:"getItems",value:function(){for(var values=[],i=0;i<this.items.length-1;i+=2){var key=this.toKey(this.items[i]);values.push(this.map[key])}return values}},{key:"put",value:function(key,value){var keyStr=this.toKey(key);this.map.hasOwnProperty(keyStr)?this.items[this.map[keyStr]]=value:(this.items.push(key,value),this.map[keyStr]=this.items.length-1)}},{key:"toString",value:function(){for(var str="",count=0,i=0;i<this.items.length-1;i+=2){var key=this.toKey(this.items[i]),value=this.map[key];value&&(count>0&&(str+=", "),str+=key+": "+value,count++)}return str}},{key:"toKey",value:function(key){return""+this.unquoteKey(key)}},{key:"unquoteKey",value:function(string){return string.$isFashionType?string.unquote():string}},{key:"remove",value:function(key){if(key=this.toKey(key),this.map[key]){var idx=this.map[key];delete this.items[idx-1],delete this.items[idx],delete this.map[key]}}},{key:"getKeys",value:function(){for(var keys=[],i=0;i<this.items.length;i+=2){var k=this.items[i];k&&keys.push(k)}return keys}},{key:"getValues",value:function(){for(var values=[],i=1;i<this.items.length;i+=2){var v=this.items[i];v&&values.push(v)}return values}},{key:"hasKey",value:function(key){return key=this.toKey(key),!!this.map.hasOwnProperty(key)}}]),Map}(List);Fashion.apply(Map.prototype,{type:"map",$isFashionMap:!0,$canUnbox:!1,map:null}),module.exports=Map},{"../Base.js":3,"./List.js":15,"./Literal.js":16,"./Numeric.js":18,"./Type.js":24}],18:[function(require,module,exports){var Fashion=require("../Base.js"),Type=require("./Type.js"),Bool=require("./Bool.js"),Literal=require("./Literal.js"),Numeric=function(_Type8){function Numeric(value,unit,numeratorUnits,denominatorUnits){_classCallCheck(this,Numeric);var _this14=_possibleConstructorReturn(this,(Numeric.__proto__||Object.getPrototypeOf(Numeric)).call(this));return _this14.value=value,_this14.unit=unit,unit&&!numeratorUnits?_this14.numeratorUnits=[unit]:_this14.numeratorUnits=numeratorUnits||[],_this14.denominatorUnits=denominatorUnits||[],_this14}return _inherits(Numeric,_Type8),_createClass(Numeric,[{key:"doVisit",value:function(visitor){visitor.number(this)}},{key:"unitless",value:function(){return(!this.numeratorUnits||!this.numeratorUnits.length)&&(!this.denominatorUnits||!this.denominatorUnits.length)}},{key:"getUnitStr",value:function(){this.normalizeUnits();var unitStr=this.numeratorUnits.join("*");return this.denominatorUnits.length&&(unitStr+="/"+this.denominatorUnits.join("*")),unitStr}},{key:"_getHash",value:function(){return this.value}},{key:"stringify",value:function(){this.normalizeUnits();var valStr,value=this.value;return valStr=Math.round(1e5*value)/1e5+"",valStr+this.getUnitStr()}},{key:"toString",value:function(){return this.stringify()}},{key:"toBoolean",value:function(){return!!this.unit||!!this.value}},{key:"copy",value:function(){return new Numeric(this.value,this.unit)}},{key:"-.literal",value:function(right){return new Literal(0===this.value&&this.unitless()?"-"+right:""+this+"-"+right)}},{key:"-.string",value:function(right){return new Literal(0===this.value&&this.unitless()?"-"+right:""+this+"-"+right)}},{key:"-.number",value:function(right){var value=right.value;return"%"==right.unit&&right.unit!==this.unit&&(value=this.value*(right.value/100)),new Numeric(this.value-value,this.unit||right.unit)}},{key:"+.literal",value:function(right){return new Literal(right.$isFashionString?""+this+right.value:""+this+(""+right))}},{key:"+.number",value:function(right){var value=right.value;return"%"==right.unit&&right.unit!==this.unit&&(value=this.value*(right.value/100)),new Numeric(this.value+value,this.unit||right.unit)}},{key:"/",value:function(right){return new Numeric(this.value/right.value,this.unit==right.unit?null:this.unit||right.unit)}},{key:"*",value:function(right){return new Numeric(this.value*right.value,this.unit||right.unit)}},{key:"%",value:function(right){return new Numeric(this.value%right.value,this.unit||right.unit)}},{key:"**",value:function(right){return new Numeric(Math.pow(this.value,right.value),this.unit||right.unit)}},{key:"operate",value:function(operation,right){var normalized;this.unit||right.unit;return right.$isFashionRGBA||right.$isFashionHSLA?new Literal(this+operation+right):right.$isFashionNumber?this.numericOperate(operation,right):right.$isFashionLiteral&&(normalized=this.tryCoerce(right))?this.performOperation(operation,normalized):_get(Numeric.prototype.__proto__||Object.getPrototypeOf(Numeric.prototype),"operate",this).call(this,operation,right)}},{key:"tryNormalize",value:function(other){var value=other.value,unit=other.unit;if(other.$isFashionNumber)switch(this.unit){case"mm":switch(unit){case"in":return new Numeric(25.4*value,"mm");case"cm":return new Numeric(2.54*value,"mm")}break;case"cm":switch(unit){case"in":return new Numeric(2.54*value,"cm");case"mm":return new Numeric(value/10,"cm")}break;case"in":switch(unit){case"mm":return new Numeric(value/25.4,"in");case"cm":return new Numeric(value/2.54,"in")}break;case"ms":switch(unit){case"s":return new Numeric(1e3*value,"ms")}break;case"s":switch(unit){case"ms":return new Numeric(value/1e3,"s")}break;case"Hz":switch(unit){case"kHz":return new Numeric(1e3*value,"Hz")}break;case"kHz":switch(unit){case"Hz":return new Numeric(value/1e3,"kHz")}break;case"%":switch(unit){default:return new Numeric(value)}}}},{key:"normalize",value:function(other){var norm=this.tryNormalize(other);return void 0===norm&&raise("Could not normalize "+this+" with "+other),norm}},{key:"comparable",value:function(other){var unit1=this.unit,unit2=other.unit;return!!other.$isFashionNumber&&(unit1===unit2||"mm"===unit1&&("in"===unit2||"cm"===unit2)||"cm"===unit1&&("in"===unit2||"mm"===unit2)||"in"===unit1&&("mm"===unit2||"cm"===unit2)||"ms"===unit1&&"s"===unit2||"s"===unit1&&"ms"===unit2||"Hz"===unit1&&"kHz"===unit2||"kHz"===unit1&&"Hz"===unit2)}},{key:"normalizeUnits",value:function(){if(!this.normalized&&(this.normalized=!0,!this.unitless())){var clean=this.removeCommonUnits(this.numeratorUnits,this.denominatorUnits);clean.num=Fashion.filter(clean.num,function(val){return!!val}),clean.den=Fashion.filter(clean.den,function(val){return!!val}),this.numeratorUnits=clean.num,this.denominatorUnits=clean.den}}},{key:"numericOperate",value:function(operation,right){this.normalizeUnits(),right.normalizeUnits();var result,me=this,other=right,ops=Numeric.OPERATIONS,moreOps=Numeric.NON_COERCE_OPERATIONS,op=ops[operation];if(op)try{me.unitless()?me=me.coerceUnits(other.numeratorUnits,other.denominatorUnits):other=other.coerceUnits(me.numeratorUnits,me.denominatorUnits)}catch(e){if("=="==operation)return Bool.False;if("!="==operation)return Bool.True;throw e}else op=moreOps[operation];if(op&&(result=op(me.value,other.value)),"number"==typeof result){var units=this.computeUnits(me,other,operation);return new Numeric(result,units.num.length?units.num[0]:null,units.num,units.den)}return new Bool(result)}},{key:"computeUnits",value:function(left,right,op){switch(op){case"*":return{num:left.numeratorUnits.slice().concat(right.numeratorUnits),den:left.denominatorUnits.slice().concat(right.denominatorUnits)};case"/":return{num:left.numeratorUnits.slice().concat(right.denominatorUnits),den:left.denominatorUnits.slice().concat(right.numeratorUnits)};default:return{num:left.numeratorUnits,den:left.denominatorUnits}}}},{key:"coerceUnits",value:function(units,denominatorUnits){var value=this.value;return this.unitless()||(value=value*this.coercionFactor(this.numeratorUnits,units)/this.coercionFactor(this.denominatorUnits,denominatorUnits)),new Numeric(value,units&&units[0],units,denominatorUnits)}},{key:"coercionFactor",value:function(units,otherUnits){var res=this.removeCommonUnits(units,otherUnits),fromUnits=res.num,toUnits=res.den;fromUnits.length===toUnits.length&&this.convertable(fromUnits||toUnits)||Fashion.raise("Incompatible units: "+fromUnits.join("*")+" and "+toUnits.join("*"));for(var i=0;i<fromUnits.length;i++)for(var fromUnit=fromUnits[i],j=0;j<toUnits.length;j++){var toUnit=toUnits[j],factor=this.conversionFactor(fromUnit,toUnit);if(null!==factor)return factor}return 1}},{key:"conversionFactor",value:function(fromUnit,toUnit){var cUnits=Numeric.CONVERTABLE_UNITS,cTable=Numeric.CONVERSION_TABLE,factor=null;return cUnits[fromUnit]&&cUnits[toUnit]&&(factor=cTable[cUnits[fromUnit]][cUnits[toUnit]]),null===factor&&cUnits[toUnit]&&cUnits[fromUnit]&&(factor=1/cTable[cUnits[toUnit]][cUnits[fromUnit]]),factor}},{key:"convertable",value:function(units){if(units&&!Array.isArray(units)&&(units=[units]),units&&units.length)for(var convertableUnits=Numeric.CONVERTABLE_UNITS,i=0;i<units.length;i++)if(void 0===convertableUnits[units[i]])return!1;return!0}},{key:"removeCommonUnits",value:function(numUnits,denUnits){var i,unit,unit,map={},num=[],den=[];for(i=0;i<numUnits.length;i++)unit=numUnits[i],
map[unit]=(map[unit]||0)+1;for(i=0;i<denUnits.length;i++)unit=denUnits[i],map[unit]=(map[unit]||0)-1;for(i=0;i<numUnits.length;i++)unit=numUnits[i],map[unit]>0&&(num.push(unit),map[unit]--);for(i=0;i<denUnits.length;i++)unit=denUnits[i],map[unit]<0&&(den.push(unit),map[unit]++);return{num:num,den:den}}}],[{key:"tryGetNumber",value:function(value){if(/^\d*$/.test(value)&&(value=parseFloat(value)),!isNaN(value))return new Numeric(value)}},{key:"tryCoerce",value:function(obj){return obj.$isFashionNumber?obj:obj.$isFashionLiteral?this.tryGetNumber(obj.value):void 0}}]),Numeric}(Type);Fashion.apply(Numeric,{OPERATIONS:{"!=":function(l,r){return l!=r},"+":function(l,r){return l+r},"-":function(l,r){return l-r},"<=":function(l,r){return l<=r},"<":function(l,r){return l<r},">":function(l,r){return l>r},">=":function(l,r){return l>=r},"==":function(l,r){return l==r},"%":function(l,r){return Math.abs(l%r)}},NON_COERCE_OPERATIONS:{"*":function(l,r){return l*r},"**":function(l,r){return Math.pow(l,r)},"/":function(l,r){return l/r}},CONVERTABLE_UNITS:{"in":0,cm:1,pc:2,mm:3,pt:4,px:5},CONVERSION_TABLE:[[1,2.54,6,25.4,72,96],[null,1,2.36220473,10,28.3464567,37.795276],[null,null,1,4.23333333,12,16],[null,null,null,1,2.83464567,3.7795276],[null,null,null,null,1,1.3333333],[null,null,null,null,null,1]]}),Fashion.apply(Numeric.prototype,{type:"number",$isFashionNumber:!0,value:void 0,unit:void 0,numeratorUnits:void 0,denominatorUnits:void 0,normalized:!1}),module.exports=Numeric},{"../Base.js":3,"./Bool.js":8,"./Literal.js":16,"./Type.js":24}],19:[function(require,module,exports){var Fashion=require("../Base.js"),Type=require("./Type.js"),ParentheticalExpression=function(_Type9){function ParentheticalExpression(value){_classCallCheck(this,ParentheticalExpression);var _this15=_possibleConstructorReturn(this,(ParentheticalExpression.__proto__||Object.getPrototypeOf(ParentheticalExpression)).call(this));return _this15.value=value,_this15}return _inherits(ParentheticalExpression,_Type9),_createClass(ParentheticalExpression,[{key:"toString",value:function(){return"("+(this.value&&""+this.value)+")"}},{key:"doVisit",value:function(visitor){visitor.parenthetical(this)}}]),ParentheticalExpression}(Type);Fashion.apply(ParentheticalExpression.prototype,{value:null,type:"parenthetical"}),module.exports=ParentheticalExpression},{"../Base.js":3,"./Type.js":24}],20:[function(require,module,exports){var Fashion=require("../Base.js"),Type=require("./Type.js"),RadialGradient=function(_Type10){function RadialGradient(position,shape,stops){_classCallCheck(this,RadialGradient);var _this16=_possibleConstructorReturn(this,(RadialGradient.__proto__||Object.getPrototypeOf(RadialGradient)).call(this));return _this16.position=position,_this16.stops=stops,_this16.shape=shape,_this16}return _inherits(RadialGradient,_Type10),_createClass(RadialGradient,[{key:"doVisit",value:function(visitor){visitor.radialgradient(this)}},{key:"descend",value:function(visitor){visitor.visit(this.position),visitor.visit(this.stops),visitor.visit(this.shape)}},{key:"copy",value:function(){return new RadialGradient(this.position,this.shape,this.stops)}},{key:"toString",value:function(){var string="radial-gradient(";return this.position&&(string+=this.position+", "),this.shape&&(string+=this.shape+", "),string+this.stops+")"}},{key:"toOriginalWebkitString",value:function(){var i,args=[],stops=this.stops.items,ln=stops.length;for(args.push("center 0%"),args.push("center 100%"),i=0;i<ln;i++)args.push(stops[i].toOriginalWebkitString());return"-webkit-gradient(radial, "+args.join(", ")+")"}},{key:"supports",value:function(prefix){return["owg","webkit"].indexOf(prefix.toLowerCase())!==-1}},{key:"toPrefixedString",value:function(prefix){return"owg"===prefix?this.toOriginalWebkitString():prefix+(""+this)}},{key:"gradientPoints",value:function(position){}}]),RadialGradient}(Type);Fashion.apply(RadialGradient.prototype,{type:"radialgradient",$isFashionRadialGradient:!0,$canUnbox:!1,position:null,stops:null,shape:null}),module.exports=RadialGradient},{"../Base.js":3,"./Type.js":24}],21:[function(require,module,exports){var Fashion=require("../Base.js"),TypeVisitor=require("./TypeVisitor.js"),Output=require("../Output.js"),SourceBuilder=function(_TypeVisitor){function SourceBuilder(cfg){_classCallCheck(this,SourceBuilder);var _this17=_possibleConstructorReturn(this,(SourceBuilder.__proto__||Object.getPrototypeOf(SourceBuilder)).call(this,cfg));return _this17.nullFound=!1,_this17}return _inherits(SourceBuilder,_TypeVisitor),_createClass(SourceBuilder,[{key:"list",value:function(obj){for(var delta,output=this.output,items=obj.items,len=output.output.length,sep=obj.separator,sepLen=sep&&sep.length,hasSpace=sep&&sep.indexOf(" ")>-1,prev=output.output,i=0;i<items.length;i++)items[i]&&!items[i].$isFashionNull?(this.visit(items[i]),delta=output.output.length-len,!delta&&sepLen&&i>0&&(output.output=prev),prev=output.output,i<items.length-1&&sepLen&&(output.add(sep),hasSpace||output.space()),len=output.output.length):this.nullFound=!0}},{key:"map",value:function(obj){var key,value,output=this.output,items=obj.items;this.currDeclaration&&Fashion.raise("("+obj+") isn't a valid CSS value.");for(var i=0;i<items.length-1;i+=2)key=items[i],value=items[i+1],key&&value&&(i>0&&(output.add(","),output.space()),this.visit(key),output.add(": "),this.visit(value))}},{key:"literal",value:function(obj){obj.value&&this.output.add(obj.value)}},{key:"string",value:function(obj){var output=this.output;output.add(obj.quoteChar),output.add(obj.value),output.add(obj.quoteChar)}},{key:"functioncall",value:function(obj){var output=this.output;output.add(obj.name),output.add("("),this.visit(obj.args),output.add(")")}},{key:"parenthetical",value:function(obj){this.output.add("("),this.visit(obj.value),this.output.add(")")}},{key:"number",value:function(obj){var val=obj.stringify();"."!==val.indexOf(".")||this.output.isCompressed||(val="0"+val),this.output.add(val)}},{key:"bool",value:function(obj){this.output.add(obj.value?"true":"false")}},{key:"hsla",value:function(obj){this.output.add(""+obj)}},{key:"rgba",value:function(obj){this.output.add(""+obj)}},{key:"colorstop",value:function(obj){var output=this.output,stop=obj.stop;this.visit(obj.color),stop&&(stop=stop.clone(),output.add(" "),stop.unit||(stop.value*=100,stop.unit="%"),this.visit(stop))}},{key:"lineargradient",value:function(obj){var output=this.output;output.add("linear-gradient("),obj.position&&(this.visit(obj.position),output.add(","),output.space()),this.visit(obj.stops),output.add(")")}},{key:"radialgradient",value:function(obj){var output=this.output;output.add("radial-gradient("),obj.position&&(this.visit(obj.position),output.add(","),output.space()),obj.shape&&(this.visit(obj.shape),output.add(","),output.space()),this.visit(obj.stops),output.add(")")}},{key:"toSource",value:function(obj,output){return this.output=output||new Output,this.visit(obj),this.output.get()}}],[{key:"toSource",value:function(obj,output){var sb=new SourceBuilder;return sb.toSource(obj,output)}}]),SourceBuilder}(TypeVisitor);Fashion.apply(SourceBuilder.prototype,{output:null}),module.exports=SourceBuilder},{"../Base.js":3,"../Output.js":4,"./TypeVisitor.js":25}],22:[function(require,module,exports){var Fashion=require("../Base.js"),Type=require("./Type.js"),Text=require("./Text.js"),Numeric=require("./Numeric.js"),Bool=require("./Bool.js"),True=Bool.True,False=Bool.False,Literal=require("./Literal.js"),Null=Literal.Null;module.exports={unboxType:function(expression){var val=expression;return val&&val.$isFashionType&&val.$canUnbox&&(val=val.value,expression.$isFashionString||expression.$isFashionLiteral?"none"!==val&&"null"!==val||(val=null):expression.$isFashionList&&(val=expression.items)),val},boxType:function(expression){if(expression&&expression.$isFashionType)return expression;if(null==expression)return Null;if(expression===!0)return True;if(expression===!1)return False;var typeOf=void 0===expression?"undefined":_typeof(expression);switch(typeOf){case"string":return new Text(expression);case"number":return new Numeric(expression)}return expression}},Fashion.apply(Type,{box:module.exports.boxType,unbox:module.exports.unboxType})},{"../Base.js":3,"./Bool.js":8,"./Literal.js":16,"./Numeric.js":18,"./Text.js":23,"./Type.js":24}],23:[function(require,module,exports){var Fashion=require("../Base.js"),Literal=require("./Literal.js"),Text=function(_Literal2){function Text(value,quoteChar){_classCallCheck(this,Text);var _this18=_possibleConstructorReturn(this,(Text.__proto__||Object.getPrototypeOf(Text)).call(this,value));return void 0!==quoteChar&&(Text.preferDoubleQuotes&&""===quoteChar?_this18.quoteChar="":_this18.quoteChar=quoteChar),_this18}return _inherits(Text,_Literal2),_createClass(Text,[{key:"doVisit",value:function(visitor){visitor.string(this)}},{key:"toString",value:function(){return this.quoteChar+this.value+this.quoteChar}},{key:"unquote",value:function(){return new Literal(this.value)}},{key:"copy",value:function(){return new Text(this.value,this.quoteChar)}},{key:"slice",value:function(start,end){return new Text(_get(Text.prototype.__proto__||Object.getPrototypeOf(Text.prototype),"slice",this).call(this,start,end).value,this.quoteChar)}},{key:"toUpperCase",value:function(){return new Text(this.value.toUpperCase(),this.quoteChar)}},{key:"toLowerCase",value:function(){return new Text(this.value.toLowerCase(),this.quoteChar)}},{key:"insert",value:function(str,startVal){return new Text(_get(Text.prototype.__proto__||Object.getPrototypeOf(Text.prototype),"insert",this).call(this,str,startVal).value,this.quoteChar)}}],[{key:"tryCoerce",value:function(obj){if(!obj.$isFashionNumber)return new Text(obj.$isFashionLiteral?obj.value:obj.getHash())}}]),Text}(Literal);Text.preferDoubleQuotes=!1,Fashion.apply(Text.prototype,{type:"string",$isFashionString:!0,value:null,quoteChar:'"',"+":function(right){return new Text(this.value+right.getHash())},"+.number":function(right){return new Text(this.value+(""+right))},"/":function(right){return new Text(this.value+"/"+right.getHash())}}),module.exports=Text},{"../Base.js":3,"./Literal.js":16}],24:[function(require,module,exports){var Fashion=require("../Base.js"),Type=function(){function Type(){_classCallCheck(this,Type)}return _createClass(Type,[{key:"coerce",value:function(obj){var converted=this.tryCoerce(obj);return converted||obj}},{key:"_getHash",value:function(){return this.visitTarget?""+this.visitTarget:""+this}},{key:"getHash",value:function(){return null==this._hash&&(this._hash=this._getHash()),this._hash}},{key:"tryCoerce",value:function(obj){var me=this;return me.constructor===obj.constructor?obj:me.constructor.tryCoerce?me.constructor.tryCoerce(obj):void 0}},{key:"supports",value:function(prefix){return!1}},{key:"operate",value:function(operation,right){return this.performOperation(operation,this.coerce(right))}},{key:"performOperation",value:function(operation,right){var method=this[operation+"."+right.type]||this[operation];method||Fashion.raise("Failed to find method for operation "+operation+" on type "+right.type+" with value "+right+".");var res=method.call(this,right);return res&&res.$isFashionType||(res=Type.box(res)),res}},{key:"==",value:function(right){return this.getHash()===right.getHash()}},{key:"!=",value:function(right){return this.getHash()!==right.getHash()}},{key:">=",value:function(right){return this.getHash()>=right.getHash()}},{key:"<=",value:function(right){return this.getHash()<=right.getHash()}},{key:">",value:function(right){return this.getHash()>right.getHash()}},{key:"<",value:function(right){return this.getHash()<right.getHash()}},{key:"+",value:function(right){return this.getHash()+right.getHash()}},{key:"copy",value:function(){return this}},{key:"matches",value:function(match){return!(!match||match!=""+this)}},{key:"clone",value:function(match,replace){if(replace&&this.matches(match))return replace.copy();var copy=this.copy();return copy.ast=this.ast,copy.$referenceName=this.$referenceName,copy.$referenceBase=this.$referenceBase,copy.$previousReference=this.$previousReference,copy}},{key:"unquote",value:function(){return this}},{key:"toPrefixedString",value:function(prefix){return""+this}},{key:"doVisit",value:function(visitor){}},{key:"descend",value:function(visitoir){}},{key:"hasTag",value:function(tag,prefix,enable,disable){prefix=prefix||"fashion",enable=enable||RegExp("^\\s*//#\\s*"+prefix+"\\s*\\+?"+tag+"\\s*$"),disable=disable||RegExp("^\\s*//#\\s*"+prefix+"\\s*\\-"+tag+"\\s*$");var docs=this.docs;if(docs&&docs.length)for(var d=0;d<this.docs.length;d++){var doc=docs[d];if(enable.test(doc))return!0;if(disable.test(doc))return!1}return this.parentNode?this.parentNode.hasTag(tag,prefix,enable,disable):null}},{key:"toDisplayString",value:function(){return"["+this.constructor.name+" : "+this+"]"}}]),Type}();Fashion.apply(Type.prototype,{visitTarget:void 0,$isFashionType:!0,$canUnbox:!0,$isFashionLiteral:!1,$isFashionNumber:!1,$isFashionString:!1,$isFashionBool:!1,$constant:!1,$referenceName:void 0,$referenceBase:void 0,$previousReference:void 0,value:void 0,unit:void 0,parentNode:void 0,docs:void 0,ast:void 0}),module.exports=Type},{"../Base.js":3}],25:[function(require,module,exports){var Fashion=require("../Base.js"),TypeVisitor=function(){function TypeVisitor(cfg){_classCallCheck(this,TypeVisitor),cfg&&Fashion.apply(this,cfg)}return _createClass(TypeVisitor,[{key:"literal",value:function(obj){obj.descend(this)}},{key:"bool",value:function(obj){obj.descend(this)}},{key:"string",value:function(obj){obj.descend(this)}},{key:"number",value:function(obj){obj.descend(this)}},{key:"map",value:function(obj){obj.descend(this)}},{key:"functioncall",value:function(obj){obj.descend(this)}},{key:"parenthetical",value:function(obj){obj.descend(this)}},{key:"list",value:function(obj){obj.descend(this)}},{key:"hsla",value:function(obj){obj.descend(this)}},{key:"rgba",value:function(obj){obj.descend(this)}},{key:"colorstop",value:function(obj){obj.descend(this)}},{key:"lineargradient",value:function(obj){obj.descend(this)}},{key:"radialgradient",value:function(obj){obj.descend(this)}},{key:"visitItem",value:function(obj){obj.doVisit(this)}},{key:"visit",value:function(obj){for(;obj&&void 0!==obj.visitTarget;)obj=obj.visitTarget;if(obj)if(Array.isArray(obj))for(var i=0;i<obj.length;i++)this.visit(obj[i]);else this.visitItem(obj)}},{key:"execute",value:function(obj,context){this.visit(obj)}}]),TypeVisitor}();TypeVisitor.prototype.context=null,module.exports=TypeVisitor},{"../Base.js":3}],26:[function(require,module,exports){var Bool=require("./Bool.js"),Literal=require("./Literal.js"),Types={Bool:Bool,Literal:Literal,Text:require("./Text.js"),Numeric:require("./Numeric.js"),Color:require("./Color.js"),ColorRGBA:require("./ColorRGBA.js"),ColorHSLA:require("./ColorHSLA.js"),ColorStop:require("./ColorStop.js"),LinearGradient:require("./LinearGradient.js"),RadialGradient:require("./RadialGradient.js"),List:require("./List.js"),Map:require("./Map.js"),ParentheticalExpression:require("./ParentheticalExpression.js"),FunctionCall:require("./FunctionCall.js"),Null:Literal.Null,None:Literal.None,True:Bool.True,False:Bool.False};module.exports=Types},{"./Bool.js":8,"./Color.js":9,"./ColorHSLA.js":10,"./ColorRGBA.js":11,"./ColorStop.js":12,"./FunctionCall.js":13,"./LinearGradient.js":14,"./List.js":15,"./Literal.js":16,"./Map.js":17,"./Numeric.js":18,"./ParentheticalExpression.js":19,"./RadialGradient.js":20,"./Text.js":23}]},{},[1])(1)});