returnb=b?binstanceofd.Keyword?b.value:b.toCSS():"",newd.Dimension(a.value,b)},convert:function(a,b){returna.convertTo(b.value)},round:function(a,b){varc="undefined"==typeofb?0:b.value;returne(function(a){returna.toFixed(c)},null,a)},pi:function(){returnnewd.Dimension(Math.PI)},mod:function(a,b){returnnewd.Dimension(a.value%b.value,a.unit)},pow:function(a,b){if("number"==typeofa&&"number"==typeofb)a=newd.Dimension(a),b=newd.Dimension(b);elseif(!(ainstanceofd.Dimension&&binstanceofd.Dimension))throw{type:"Argument",message:"arguments must be numbers"};returnnewd.Dimension(Math.pow(a.value,b.value),a.unit)},_minmax:function(a,c){switch(c=Array.prototype.slice.call(c),c.length){case0:throw{type:"Argument",message:"one or more arguments required"}}vare,f,g,h,i,j,k,l,m=[],n={};for(e=0;e<c.length;e++)if(g=c[e],ginstanceofd.Dimension)if(h=""===g.unit.toString()&&l!==b?newd.Dimension(g.value,l).unify():g.unify(),j=""===h.unit.toString()&&k!==b?k:h.unit.toString(),k=""!==j&&k===b||""!==j&&""===m[0].unify().unit.toString()?j:k,l=""!==j&&l===b?g.unit.toString():l,f=n[""]!==b&&""!==j&&j===k?n[""]:n[j],f!==b)i=""===m[f].unit.toString()&&l!==b?newd.Dimension(m[f].value,l).unify():m[f].unify(),(a&&h.value<i.value||!a&&h.value>i.value)&&(m[f]=g);else{if(k!==b&&j!==k)throw{type:"Argument",message:"incompatible types"};n[j]=m.length,m.push(g)}elseArray.isArray(c[e].value)&&Array.prototype.push.apply(c,Array.prototype.slice.call(c[e].value));return1==m.length?m[0]:(c=m.map(function(a){returna.toCSS(this.env)}).join(this.env.compress?",":", "),newd.Anonymous((a?"min":"max")+"("+c+")"))},min:function(){returnthis._minmax(!0,arguments)},max:function(){returnthis._minmax(!1,arguments)},"get-unit":function(a){returnnewd.Anonymous(a.unit)},argb:function(a){returnnewd.Anonymous(a.toARGB())},percentage:function(a){returnnewd.Dimension(100*a.value,"%")},color:function(a){if(ainstanceofd.Quoted){varb,c=a.value;if(b=d.Color.fromKeyword(c))returnb;if(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/.test(c))returnnewd.Color(c.slice(1));throw{type:"Argument",message:"argument must be a color keyword or 3/6 digit hex e.g. #FFF"}}throw{type:"Argument",message:"argument must be a string"}},iscolor:function(a){returnthis._isa(a,d.Color)},isnumber:function(a){returnthis._isa(a,d.Dimension)},isstring:function(a){returnthis._isa(a,d.Quoted)},iskeyword:function(a){returnthis._isa(a,d.Keyword)},isurl:function(a){returnthis._isa(a,d.URL)},ispixel:function(a){returnthis.isunit(a,"px")},ispercentage:function(a){returnthis.isunit(a,"%")},isem:function(a){returnthis.isunit(a,"em")},isunit:function(a,b){returnainstanceofd.Dimension&&a.unit.is(b.value||b)?d.True:d.False},_isa:function(a,b){returnainstanceofb?d.True:d.False},tint:function(a,b){returnthis.mix(this.rgb(255,255,255),a,b)},shade:function(a,b){returnthis.mix(this.rgb(0,0,0),a,b)},extract:function(a,b){returnb=b.value-1,Array.isArray(a.value)?a.value[b]:Array(a)[b]},length:function(a){varb=Array.isArray(a.value)?a.value.length:1;returnnewd.Dimension(b)},"data-uri":function(b,e){if("undefined"!=typeofa)returnnewd.URL(e||b,this.currentFileInfo).eval(this.env);varf=b.value,g=e&&e.value,h=c("fs"),i=c("path"),j=!1;if(arguments.length<2&&(g=f),this.env.isPathRelative(g)&&(g=this.currentFileInfo.relativeUrls?i.join(this.currentFileInfo.currentDirectory,g):i.join(this.currentFileInfo.entryPath,g)),arguments.length<2){vark;try{k=c("mime")}catch(l){k=d._mime}f=k.lookup(g);varm=k.charsets.lookup(f);j=["US-ASCII","UTF-8"].indexOf(m)<0,j&&(f+=";base64")}elsej=/;base64$/.test(f);varn=h.readFileSync(g),o=32,p=parseInt(n.length/1024,10);if(p>=o&&this.env.ieCompat!==!1)returnthis.env.silent||console.warn("Skipped data-uri embedding of %s because its size (%dKB) exceeds IE8-safe %dKB!",g,p,o),newd.URL(e||b,this.currentFileInfo).eval(this.env);n=j?n.toString("base64"):encodeURIComponent(n);varq='"data:'+f+","+n+'"';returnnewd.URL(newd.Anonymous(q))},"svg-gradient":function(a){functione(){throw{type:"Argument",message:"svg-gradientexpectsdirection,start_co
}),f=0;f<b.frames.length;f++)if((c=b.frames[f].find(this.selector)).length>0){for(j=!0,g=0;g<c.length;g++){for(d=c[g],i=!1,h=0;h<b.frames.length;h++)if(!(dinstanceofa.mixin.Definition)&&d===(b.frames[h].originalRuleset||b.frames[h])){i=!0;break}if(!i&&d.matchArgs(e,b)){if(l={mixin:d,group:t},d.matchCondition){for(h=0;2>h;h++)s.value(h),r[h]=d.matchCondition(e,b);(r[0]||r[1])&&(r[0]!=r[1]&&(l.group=r[1]?u:v),q.push(l))}elseq.push(l);p=!0}}for(s.reset(),n=[0,0,0],g=0;g<q.length;g++)n[q[g].group]++;if(n[t]>0)m=v;elseif(m=u,n[u]+n[v]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(e)+"`",index:this.index,filename:this.currentFileInfo.filename};for(g=0;g<q.length;g++)if(l=q[g].group,l===t||l===m)try{d=q[g].mixin,dinstanceofa.mixin.Definition||(d=newa.mixin.Definition("",[],d.rules,null,!1),d.originalRuleset=c[g].originalRuleset||c[g]),Array.prototype.push.apply(o,d.evalCall(b,e,this.important).rules)}catch(w){throw{message:w.message,index:this.index,filename:this.currentFileInfo.filename,stack:w.stack}}if(p){if(!this.currentFileInfo||!this.currentFileInfo.reference)for(f=0;f<o.length;f++)k=o[f],k.markReferenced&&k.markReferenced();returno}}throwj?{type:"Runtime",message:"No matching definition was found for `"+this.format(e)+"`",index:this.index,filename:this.currentFileInfo.filename}:{type:"Name",message:this.selector.toCSS().trim()+" is undefined",index:this.index,filename:this.currentFileInfo.filename}},format:function(a){returnthis.selector.toCSS().trim()+"("+(a?a.map(function(a){varb="";returna.name&&(b+=a.name+":"),b+=a.value.toCSS?a.value.toCSS():"???"}).join(", "):"")+")"}},a.mixin.Definition=function(b,c,d,e,f,g){this.name=b,this.selectors=[newa.Selector([newa.Element(null,b,this.index,this.currentFileInfo)])],this.params=c,this.condition=e,this.variadic=f,this.arity=c.length,this.rules=d,this._lookups={},this.required=c.reduce(function(a,b){return!b.name||b.name&&!b.value?a+1:a},0),this.parent=a.Ruleset.prototype,this.frames=g},a.mixin.Definition.prototype={type:"MixinDefinition",accept:function(a){this.params&&this.params.length&&(this.params=a.visitArray(this.params)),this.rules=a.visitArray(this.rules),this.condition&&(this.condition=a.visit(this.condition))},variable:function(a){returnthis.parent.variable.call(this,a)},variables:function(){returnthis.parent.variables.call(this)},find:function(){returnthis.parent.find.apply(this,arguments)},rulesets:function(){returnthis.parent.rulesets.apply(this)},evalParams:function(b,c,d,e){varf,g,h,i,j,k,l,m,n=newa.Ruleset(null,null),o=this.params.slice(0),p=0;if(c=newa.evalEnv(c,[n].concat(c.frames)),d)for(d=d.slice(0),p=d.length,h=0;p>h;h++)if(g=d[h],k=g&&g.name){for(l=!1,i=0;i<o.length;i++)if(!e[i]&&k===o[i].name){e[i]=g.value.eval(b),n.prependRule(newa.Rule(k,g.value.eval(b))),l=!0;break}if(l){d.splice(h,1),h--;continue}throw{type:"Runtime",message:"Named argument for "+this.name+" "+d[h].name+" not found"}}for(m=0,h=0;h<o.length;h++)if(!e[h]){if(g=d&&d[m],k=o[h].name)if(o[h].variadic){for(f=[],i=m;p>i;i++)f.push(d[i].value.eval(b));n.prependRule(newa.Rule(k,newa.Expression(f).eval(b)))}else{if(j=g&&g.value)j=j.eval(b);else{if(!o[h].value)throw{type:"Runtime",message:"wrong number of arguments for "+this.name+" ("+p+" for "+this.arity+")"};j=o[h].value.eval(c),n.resetCache()}n.prependRule(newa.Rule(k,j)),e[h]=j}if(o[h].variadic&&d)for(i=m;p>i;i++)e[i]=d[i].value.eval(b);m++}returnn},eval:function(b){returnnewa.mixin.Definition(this.name,this.params,this.rules,this.condition,this.variadic,this.frames||b.frames.slice(0))},evalCall:function(b,c,d){vare,f,g=[],h=this.frames?this.frames.concat(b.frames):b.frames,i=this.evalParams(b,newa.evalEnv(b,h),c,g);returni.prependRule(newa.Rule("@arguments",newa.Expression(g).eval(b))),e=this.rules.slice(0),f=newa.Ruleset(null,e),f.originalRuleset=this,f=f.eval(newa.evalEnv(b,[this,i].concat(h))),d&&(f=this.parent.makeImportant.apply(f)),f},matchCondition:function(b,c){returnthis.condition&&!this.condition.eval(newa.evalEnv(c,[this.evalParams(c,new
})}},cb),hb=v("ForIn","init name object",{$documentation:"A `for ... in` statement",$propdoc:{init:"[AST_Node] the `for/in` initialization code",name:"[AST_SymbolRef?] the loop variable, only if `init` is AST_Var",object:"[AST_Node] the object that we're looping through"},_walk:function(a){returna._visit(this,function(){this.init._walk(a),this.object._walk(a),this.body._walk(a)})}},cb),ib=v("With","expression",{$documentation:"A `with` statement",$propdoc:{expression:"[AST_Node] the `with` expression"},_walk:function(a){returna._visit(this,function(){this.expression._walk(a),this.body._walk(a)})}},ab),jb=v("Scope","directives variables functions uses_with uses_eval parent_scope enclosed cname",{$documentation:"Base class for all statements introducing a lexical scope",$propdoc:{directives:"[string*/S] an array of directives declared in this scope",variables:"[Object/S] a map of name -> SymbolDef for all variables/functions defined in this scope",functions:"[Object/S] like `variables`, but only lists function declarations",uses_with:"[boolean/S] tells whether this scope uses the `with` statement",uses_eval:"[boolean/S] tells whether this scope contains a direct call to the global `eval`",parent_scope:"[AST_Scope?/S] link to the parent scope",enclosed:"[SymbolDef*/S] a list of all symbol definitions that are accessed from this scope or any subscopes",cname:"[integer/S] current index for mangling variables (used internally by the mangler)"}},Z),kb=v("Toplevel","globals",{$documentation:"The toplevel scope",$propdoc:{globals:"[Object/S] a map of name -> SymbolDef for all undeclared names"},wrap_enclose:function(a){varb=this,c=[],d=[];a.forEach(function(a){varb=a.split(":");c.push(b[0]),d.push(b[1])});vare="(function("+d.join(",")+"){ '$ORIG'; })("+c.join(",")+")";returne=M(e),e=e.transform(newN(function(a){returnainstanceofX&&"$ORIG"==a.value?S.splice(b.body):void0}))},wrap_commonjs:function(a,b){varc=this,d=[];b&&(c.figure_out_scope(),c.walk(newx(function(a){ainstanceofac&&a.definition().global&&(g(function(b){returnb.name==a.name},d)||d.push(a))})));vare="(function(exports, global){ global['"+a+"'] = exports; '$ORIG'; '$EXPORTS'; }({}, (function(){return this}())))";returne=M(e),e=e.transform(newN(function(a){if(ainstanceofY&&(a=a.body,ainstanceofmc))switch(a.getValue()){case"$ORIG":returnS.splice(c.body);case"$EXPORTS":varb=[];returnd.forEach(function(a){b.push(newY({body:newTb({left:newNb({expression:newic({name:"exports"}),property:newmc({value:a.name})}),operator:"=",right:newic(a)})}))}),S.splice(b)}}))}},jb),lb=v("Lambda","name argnames uses_arguments",{$documentation:"Base class for functions",$propdoc:{name:"[AST_SymbolDeclaration?] the name of this function",argnames:"[AST_SymbolFunarg*] array of function arguments",uses_arguments:"[boolean/S] tells whether this function accesses the arguments array"},_walk:function(a){returna._visit(this,function(){this.name&&this.name._walk(a),this.argnames.forEach(function(b){b._walk(a)}),w(this,a)})}},jb),mb=v("Accessor",null,{$documentation:"A setter/getter function. The `name` property is always null."},lb),nb=v("Function",null,{$documentation:"A function expression"},lb),ob=v("Defun",null,{$documentation:"A function definition"},lb),pb=v("Jump",null,{$documentation:"Base class for “jumps” (for now that's `return`, `throw`, `break` and `continue`)"},V),qb=v("Exit","value",{$documentation:"Base class for “exits” (`return` and `throw`)",$propdoc:{value:"[AST_Node?] the value returned or thrown by this statement; could be null for AST_Return"},_walk:function(a){returna._visit(this,this.value&&function(){this.value._walk(a)})}},pb),rb=v("Return",null,{$documentation:"A `return` statement"},qb),sb=v("Throw",null,{$documentation:"A `throw` statement"},qb),tb=v("LoopControl","label",{$documentation:"Base class for loop control statements (`break` and `continue`)",$propdoc:{label:"[AST_LabelRef?] the label, or null if none"},_walk:function(a){returna._visit(this,this.label&&function(){this.label._walk(a)})}},pb),ub=v("Break",null,{$docume
});this.walk(b),Tc.sort()});varTc=function(){functiona(){d=Object.create(null),c=e.split("").map(function(a){returna.charCodeAt(0)}),c.forEach(function(a){d[a]=0})}functionb(a){varb="",d=54;dob+=String.fromCharCode(c[a%d]),a=Math.floor(a/d),d=64;while(a>0);returnb}varc,d,e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789";returnb.consider=function(a){for(varb=a.length;--b>=0;){varc=a.charCodeAt(b);cind&&++d[c]}},b.sort=function(){c=p(c,function(a,b){returnz(a)&&!z(b)?1:z(b)&&!z(a)?-1:d[b]-d[a]})},b.reset=a,a(),b.get=function(){returnc},b.freq=function(){returnd},b}();kb.DEFMETHOD("scope_warnings",function(a){a=j(a,{undeclared:!1,unreferenced:!0,assign_to_global:!0,func_arguments:!0,nested_defuns:!0,eval:!0});varb=newx(function(c){if(a.undeclared&&cinstanceofic&&c.undeclared()&&U.warn("Undeclared symbol: {name} [{file}:{line},{col}]",{name:c.name,file:c.start.file,line:c.start.line,col:c.start.col}),a.assign_to_global){vard=null;cinstanceofTb&&c.leftinstanceofic?d=c.left:cinstanceofhb&&c.initinstanceofic&&(d=c.init),d&&(d.undeclared()||d.global()&&d.scope!==d.definition().scope)&&U.warn("{msg}: {name} [{file}:{line},{col}]",{msg:d.undeclared()?"Accidental global?":"Assignment to global",name:d.name,file:d.start.file,line:d.start.line,col:d.start.col})}a.eval&&cinstanceofic&&c.undeclared()&&"eval"==c.name&&U.warn("Eval is used [{file}:{line},{col}]",c.start),a.unreferenced&&(cinstanceofac||cinstanceofhc)&&c.unreferenced()&&U.warn("{type} {name} is declared but not referenced [{file}:{line},{col}]",{type:cinstanceofhc?"Label":"Symbol",name:c.name,file:c.start.file,line:c.start.line,col:c.start.col}),a.func_arguments&&cinstanceoflb&&c.uses_arguments&&U.warn("arguments used in function {name} [{file}:{line},{col}]",{name:c.name?c.name.name:"anonymous",file:c.start.file,line:c.start.line,col:c.start.col}),a.nested_defuns&&cinstanceofob&&!(b.parent()instanceofjb)&&U.warn('Function {name} declared in nested statement "{type}" [{file}:{line},{col}]',{name:c.name.name,type:b.parent().TYPE,file:c.start.file,line:c.start.line,col:c.start.col})});this.walk(b)}),function(){functiona(a,b){a.DEFMETHOD("_codegen",b)}functionb(a,b){a.DEFMETHOD("needs_parens",b)}functionc(a){varb=a.parent();returnbinstanceofOb?!0:binstanceofRb&&!(binstanceofTb)?!0:binstanceofIb&&b.expression===this?!0:binstanceofSb&&b.condition===this?!0:binstanceofLb&&b.expression===this?!0:void0}functiond(a,b,c){vard=a.length-1;a.forEach(function(a,e){ainstanceof_||(c.indent(),a.print(c),e==d&&b||(c.newline(),b&&c.newline()))})}functione(a,b){a.length>0?b.with_block(function(){d(a,!1,b)}):b.print("{}")}functionf(a,b){if(b.option("bracketize"))returnvoido(a.body,b);if(!a.body)returnb.force_semicolon();if(a.bodyinstanceofeb&&!b.option("screw_ie8"))returnvoido(a.body,b);for(varc=a.body;;)if(cinstanceofwb){if(!c.alternative)returnvoido(a.body,b);c=c.alternative}else{if(!(cinstanceofab))break;c=c.body}i(a.body,b)}functiong(a,b,c){if(c)try{a.walk(newx(function(a){if(ainstanceofRb&&"in"==a.operator)throwb})),a.print(b)}catch(d){if(d!==b)throwd;a.print(b,!0)}elsea.print(b)}functionh(a){return[92,47,46,43,42,63,40,41,91,93,123,125,36,94,58,124,33,10,13,0,65279,8232,8233].indexOf(a)<0}functioni(a,b){b.option("bracketize")?!a||ainstanceof_?b.print("{}"):ainstanceof$?a.print(b):b.with_block(function(){b.indent(),a.print(b),b.newline()}):!a||ainstanceof_?b.force_semicolon():a.print(b)}functionj(a){for(varb=a.stack(),c=b.length,d=b[--c],e=b[--c];c>0;){if(einstanceofV&&e.body===d)return!0;if(!(einstanceofKb&&e.car===d||einstanceofIb&&e.expression===d&&!(einstanceofJb)||einstanceofMb&&e.expression===d||einstanceofNb&&e.expression===d||einstanceofSb&&e.condition===d||einstanceofRb&&e.left===d||einstanceofQb&&e.expression===d))return!1;d=e,e=b[--c]}}functionk(a,b){return0==a.args.length&&!b.option("beautify")}functionm(a){for(varb=a[0],c=b.length,d=1;d<a.length;++d)a[d].length<c&&(b=a[d],c=b.length);returnb}functionn(a){varb,c=a.toString(10),d=[c.repl