fancy-nginx-jswebdav/html/coffee-script.js

12 lines
195 KiB
JavaScript
Raw Normal View History

2015-05-11 19:44:13 +02:00
/**
* CoffeeScript Compiler v1.6.2
* http://coffeescript.org
*
* Copyright 2011, Jeremy Ashkenas
* Released under the MIT License
*/
(function(root){var CoffeeScript=function(){function require(e){return require[e]}return require["./helpers"]=new function(){var e=this;(function(){var t,n,i,r,s,a;e.starts=function(e,t,n){return t===e.substr(n,t.length)},e.ends=function(e,t,n){var i;return i=t.length,t===e.substr(e.length-i-(n||0),i)},e.repeat=s=function(e,t){var n;for(n="";t>0;)1&t&&(n+=e),t>>>=1,e+=e;return n},e.compact=function(e){var t,n,i,r;for(r=[],n=0,i=e.length;i>n;n++)t=e[n],t&&r.push(t);return r},e.count=function(e,t){var n,i;if(n=i=0,!t.length)return 1/0;for(;i=1+e.indexOf(t,i);)n++;return n},e.merge=function(e,t){return n(n({},e),t)},n=e.extend=function(e,t){var n,i;for(n in t)i=t[n],e[n]=i;return e},e.flatten=i=function(e){var t,n,r,s;for(n=[],r=0,s=e.length;s>r;r++)t=e[r],t instanceof Array?n=n.concat(i(t)):n.push(t);return n},e.del=function(e,t){var n;return n=e[t],delete e[t],n},e.last=r=function(e,t){return e[e.length-(t||0)-1]},e.some=null!=(a=Array.prototype.some)?a:function(e){var t,n,i;for(n=0,i=this.length;i>n;n++)if(t=this[n],e(t))return!0;return!1},e.invertLiterate=function(e){var t,n,i;return i=!0,n=function(){var n,r,s,a;for(s=e.split("\n"),a=[],n=0,r=s.length;r>n;n++)t=s[n],i&&/^([ ]{4}|[ ]{0,3}\t)/.test(t)?a.push(t):(i=/^\s*$/.test(t))?a.push(t):a.push("# "+t);return a}(),n.join("\n")},t=function(e,t){return t?{first_line:e.first_line,first_column:e.first_column,last_line:t.last_line,last_column:t.last_column}:e},e.addLocationDataFn=function(e,n){return function(i){return"object"==typeof i&&i.updateLocationDataIfMissing&&i.updateLocationDataIfMissing(t(e,n)),i}},e.locationDataToString=function(e){var t;return"2"in e&&"first_line"in e[2]?t=e[2]:"first_line"in e&&(t=e),t?""+(t.first_line+1)+":"+(t.first_column+1)+"-"+(""+(t.last_line+1)+":"+(t.last_column+1)):"No location data"},e.baseFileName=function(e,t,n){var i;return null==t&&(t=!1),null==n&&(n="/"),i=e.split(n),e=i[i.length-1],t?(i=e.split("."),i.pop(),"coffee"===i[i.length-1]&&i.length>1&&i.pop(),i.join(".")):e},e.isCoffee=function(e){return/\.((lit)?coffee|coffee\.md)$/.test(e)},e.isLiterate=function(e){return/\.(litcoffee|coffee\.md)$/.test(e)},e.throwSyntaxError=function(e,t){var n,i,r;throw null==(i=t.last_line)&&(t.last_line=t.first_line),null==(r=t.last_column)&&(t.last_column=t.first_column),n=new SyntaxError(e),n.location=t,n},e.prettyErrorMessage=function(e,t,n,i){var r,a,o,c,h,l,u,p,d,f,m;return e.location?(m=e.location,h=m.first_line,c=m.first_column,u=m.last_line,l=m.last_column,r=n.split("\n")[h],f=c,o=h===u?l+1:r.length,p=s(" ",f)+s("^",o-f),i&&(a=function(e){return""+e+""},r=r.slice(0,f)+a(r.slice(f,o))+r.slice(o),p=a(p)),d=""+t+":"+(h+1)+":"+(c+1)+": error: "+e.message+"\n"+r+"\n"+p):e.stack||""+e}}).call(this)},require["./rewriter"]=new function(){var e=this;(function(){var t,n,i,r,s,a,o,c,h,l,u,p,d,f,m,g,b,k,v,y=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1},w=[].slice;for(f=function(e,t){var n;return n=[e,t],n.generated=!0,n},e.Rewriter=function(){function e(){}return e.prototype.rewrite=function(e){return this.tokens=e,this.removeLeadingNewlines(),this.removeMidExpressionNewlines(),this.closeOpenCalls(),this.closeOpenIndexes(),this.addImplicitIndentation(),this.tagPostfixConditionals(),this.addImplicitBracesAndParens(),this.addLocationDataToGeneratedTokens(),this.tokens},e.prototype.scanTokens=function(e){var t,n,i;for(i=this.tokens,t=0;n=i[t];)t+=e.call(this,n,t,i);return!0},e.prototype.detectEnd=function(e,t,n){var s,a,o,c,h;for(o=this.tokens,s=0;a=o[e];){if(0===s&&t.call(this,a,e))return n.call(this,a,e);if(!a||0>s)return n.call(this,a,e-1);c=a[0],y.call(r,c)>=0?s+=1:(h=a[0],y.call(i,h)>=0&&(s-=1)),e+=1}return e-1},e.prototype.removeLeadingNewlines=function(){var e,t,n,i,r;for(r=this.tokens,e=n=0,i=r.length;i>n&&(t=r[e][0],"TERMINATOR"===t);e=++n);return e?this.tokens.splice(0,e):void 0},e.prototype.removeMidExpressionNewlines=function(){return this.scanTokens(function(e,t,i){var r;return"TERMINATOR"===e[0]&&(r=this.tag(t+1),y.call(n,r)>=0)?(i.splice(t,1),0):1})},e.prototype.closeO
break;case 55:this.$=i.addLocationDataFn(a[o],a[o])([]);break;case 56:this.$=i.addLocationDataFn(a[o],a[o])([s[o]]);break;case 57:this.$=i.addLocationDataFn(a[o-2],a[o])(s[o-2].concat(s[o]));break;case 58:this.$=i.addLocationDataFn(a[o-3],a[o])(s[o-3].concat(s[o]));break;case 59:this.$=i.addLocationDataFn(a[o-5],a[o])(s[o-5].concat(s[o-2]));break;case 60:this.$=i.addLocationDataFn(a[o],a[o])(new i.Param(s[o]));break;case 61:this.$=i.addLocationDataFn(a[o-1],a[o])(new i.Param(s[o-1],null,!0));break;case 62:this.$=i.addLocationDataFn(a[o-2],a[o])(new i.Param(s[o-2],s[o]));break;case 63:this.$=s[o];break;case 64:this.$=s[o];break;case 65:this.$=s[o];break;case 66:this.$=s[o];break;case 67:this.$=i.addLocationDataFn(a[o-1],a[o])(new i.Splat(s[o-1]));break;case 68:this.$=i.addLocationDataFn(a[o],a[o])(new i.Value(s[o]));break;case 69:this.$=i.addLocationDataFn(a[o-1],a[o])(s[o-1].add(s[o]));break;case 70:this.$=i.addLocationDataFn(a[o-1],a[o])(new i.Value(s[o-1],[].concat(s[o])));break;case 71:this.$=s[o];break;case 72:this.$=s[o];break;case 73:this.$=i.addLocationDataFn(a[o],a[o])(new i.Value(s[o]));break;case 74:this.$=i.addLocationDataFn(a[o],a[o])(new i.Value(s[o]));break;case 75:this.$=s[o];break;case 76:this.$=i.addLocationDataFn(a[o],a[o])(new i.Value(s[o]));break;case 77:this.$=i.addLocationDataFn(a[o],a[o])(new i.Value(s[o]));break;case 78:this.$=i.addLocationDataFn(a[o],a[o])(new i.Value(s[o]));break;case 79:this.$=s[o];break;case 80:this.$=i.addLocationDataFn(a[o-1],a[o])(new i.Access(s[o]));break;case 81:this.$=i.addLocationDataFn(a[o-1],a[o])(new i.Access(s[o],"soak"));break;case 82:this.$=i.addLocationDataFn(a[o-1],a[o])([i.addLocationDataFn(a[o-1])(new i.Access(new i.Literal("prototype"))),i.addLocationDataFn(a[o])(new i.Access(s[o]))]);break;case 83:this.$=i.addLocationDataFn(a[o-1],a[o])([i.addLocationDataFn(a[o-1])(new i.Access(new i.Literal("prototype"),"soak")),i.addLocationDataFn(a[o])(new i.Access(s[o]))]);break;case 84:this.$=i.addLocationDataFn(a[o],a[o])(new i.Access(new i.Literal("prototype")));break;case 85:this.$=s[o];break;case 86:this.$=i.addLocationDataFn(a[o-2],a[o])(s[o-1]);break;case 87:this.$=i.addLocationDataFn(a[o-1],a[o])(i.extend(s[o],{soak:!0}));break;case 88:this.$=i.addLocationDataFn(a[o],a[o])(new i.Index(s[o]));break;case 89:this.$=i.addLocationDataFn(a[o],a[o])(new i.Slice(s[o]));break;case 90:this.$=i.addLocationDataFn(a[o-3],a[o])(new i.Obj(s[o-2],s[o-3].generated));break;case 91:this.$=i.addLocationDataFn(a[o],a[o])([]);break;case 92:this.$=i.addLocationDataFn(a[o],a[o])([s[o]]);break;case 93:this.$=i.addLocationDataFn(a[o-2],a[o])(s[o-2].concat(s[o]));break;case 94:this.$=i.addLocationDataFn(a[o-3],a[o])(s[o-3].concat(s[o]));break;case 95:this.$=i.addLocationDataFn(a[o-5],a[o])(s[o-5].concat(s[o-2]));break;case 96:this.$=i.addLocationDataFn(a[o],a[o])(new i.Class);break;case 97:this.$=i.addLocationDataFn(a[o-1],a[o])(new i.Class(null,null,s[o]));break;case 98:this.$=i.addLocationDataFn(a[o-2],a[o])(new i.Class(null,s[o]));break;case 99:this.$=i.addLocationDataFn(a[o-3],a[o])(new i.Class(null,s[o-1],s[o]));break;case 100:this.$=i.addLocationDataFn(a[o-1],a[o])(new i.Class(s[o]));break;case 101:this.$=i.addLocationDataFn(a[o-2],a[o])(new i.Class(s[o-1],null,s[o]));break;case 102:this.$=i.addLocationDataFn(a[o-3],a[o])(new i.Class(s[o-2],s[o]));break;case 103:this.$=i.addLocationDataFn(a[o-4],a[o])(new i.Class(s[o-3],s[o-1],s[o]));break;case 104:this.$=i.addLocationDataFn(a[o-2],a[o])(new i.Call(s[o-2],s[o],s[o-1]));break;case 105:this.$=i.addLocationDataFn(a[o-2],a[o])(new i.Call(s[o-2],s[o],s[o-1]));break;case 106:this.$=i.addLocationDataFn(a[o],a[o])(new i.Call("super",[new i.Splat(new i.Literal("arguments"))]));break;case 107:this.$=i.addLocationDataFn(a[o-1],a[o])(new i.Call("super",s[o]));break;case 108:this.$=i.addLocationDataFn(a[o],a[o])(!1);break;case 109:this.$=i.addLocationDataFn(a[o],a[o])(!0);break;case 110:this.$=i.addLocationDataFn(a[o-1],a[o])([]);break;case 111:this.$=i.addLocationDataFn(a[o-3],a[o])(s[o-2]);break;case 112:this.$=i.addLocationDataFn(a[o],a[o])(n
},parse:function(e){function t(){var e;return e=n.lexer.lex()||1,"number"!=typeof e&&(e=n.symbols_[e]||e),e}var n=this,i=[0],r=[null],s=[],a=this.table,o="",c=0,h=0,l=0;this.lexer.setInput(e),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,this.lexer.yylloc===void 0&&(this.lexer.yylloc={});var u=this.lexer.yylloc;s.push(u);var p=this.lexer.options&&this.lexer.options.ranges;"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var d,f,m,g,b,k,v,y,w,T={};;){if(m=i[i.length-1],this.defaultActions[m]?g=this.defaultActions[m]:((null===d||d===void 0)&&(d=t()),g=a[m]&&a[m][d]),g===void 0||!g.length||!g[0]){var C="";if(!l){w=[];for(k in a[m])this.terminals_[k]&&k>2&&w.push("'"+this.terminals_[k]+"'");C=this.lexer.showPosition?"Parse error on line "+(c+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+w.join(", ")+", got '"+(this.terminals_[d]||d)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==d?"end of input":"'"+(this.terminals_[d]||d)+"'"),this.parseError(C,{text:this.lexer.match,token:this.terminals_[d]||d,line:this.lexer.yylineno,loc:u,expected:w})}}if(g[0]instanceof Array&&g.length>1)throw Error("Parse Error: multiple actions possible at state: "+m+", token: "+d);switch(g[0]){case 1:i.push(d),r.push(this.lexer.yytext),s.push(this.lexer.yylloc),i.push(g[1]),d=null,f?(d=f,f=null):(h=this.lexer.yyleng,o=this.lexer.yytext,c=this.lexer.yylineno,u=this.lexer.yylloc,l>0&&l--);break;case 2:if(v=this.productions_[g[1]][1],T.$=r[r.length-v],T._$={first_line:s[s.length-(v||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(v||1)].first_column,last_column:s[s.length-1].last_column},p&&(T._$.range=[s[s.length-(v||1)].range[0],s[s.length-1].range[1]]),b=this.performAction.call(T,o,h,c,this.yy,g[1],r,s),b!==void 0)return b;v&&(i=i.slice(0,2*-1*v),r=r.slice(0,-1*v),s=s.slice(0,-1*v)),i.push(this.productions_[g[1]][0]),r.push(T.$),s.push(T._$),y=a[i[i.length-2]][i[i.length-1]],i.push(y);break;case 3:return!0}}return!0}};return e.prototype=t,t.Parser=e,new e}();require!==void 0&&e!==void 0&&(e.parser=t,e.Parser=t.Parser,e.parse=function(){return t.parse.apply(t,arguments)},e.main=function(t){t[1]||(console.log("Usage: "+t[0]+" FILE"),process.exit(1));var n=require("fs").readFileSync(require("path").normalize(t[1]),"utf8");return e.parser.parse(n)},"undefined"!=typeof module&&require.main===module&&e.main(process.argv.slice(1)))},require["./scope"]=new function(){var e=this;(function(){var t,n,i,r;r=require("./helpers"),n=r.extend,i=r.last,e.Scope=t=function(){function e(t,n,i){this.parent=t,this.expressions=n,this.method=i,this.variables=[{name:"arguments",type:"arguments"}],this.positions={},this.parent||(e.root=this)}return e.root=null,e.prototype.add=function(e,t,n){return this.shared&&!n?this.parent.add(e,t,n):Object.prototype.hasOwnProperty.call(this.positions,e)?this.variables[this.positions[e]].type=t:this.positions[e]=this.variables.push({name:e,type:t})-1},e.prototype.namedMethod=function(){var e;return(null!=(e=this.method)?e.name:void 0)||!this.parent?this.method:this.parent.namedMethod()},e.prototype.find=function(e){return this.check(e)?!0:(this.add(e,"var"),!1)},e.prototype.parameter=function(e){return this.shared&&this.parent.check(e,!0)?void 0:this.add(e,"param")},e.prototype.check=function(e){var t;return!!(this.type(e)||(null!=(t=this.parent)?t.check(e):void 0))},e.prototype.temporary=function(e,t){return e.length>1?"_"+e+(t>1?t-1:""):"_"+(t+parseInt(e,36)).toString(36).replace(/\d/g,"a")},e.prototype.type=function(e){var t,n,i,r;for(r=this.variables,n=0,i=r.length;i>n;n++)if(t=r[n],t.name===e)return t.type;return null},e.prototype.freeVariable=function(e,t){var n,i;for(null==t&&(t=!0),n=0;this.check(i=this.temporary(e,n));)n++;return t&&this.add(i,"var",!0),i},e.prototype.assign=function(e,t){return this.add(e,{value:t,assigned:!0},!0),this.hasAssignments=!0},e.prototype.hasDeclarations=function(){return!!this.declaredVariables().length},e.prototype.declaredVariables=function(){var e,t,n,i,r,s;for(e=[],t=[],s=this.variables,i=0,r=s.length;r>i;i++)n
return v||this.subpattern||r.push(L),a=this.joinFragmentArrays(r,", "),C>e.level?a:this.wrapInBraces(a)},n.prototype.compileConditional=function(e){var t,i,r;return r=this.variable.cacheReference(e),t=r[0],i=r[1],!t.properties.length&&t.base instanceof E&&"this"!==t.base.value&&!e.scope.check(t.base.value)&&this.variable.error('the variable "'+t.base.value+"\" can't be assigned with "+this.context+" because it has not been declared before"),yt.call(this.context,"?")>=0&&(e.isExistentialEquals=!0),new R(this.context.slice(0,-1),t,new n(i,this.value,"=")).compileToFragments(e)},n.prototype.compileSplice=function(e){var t,n,i,r,s,a,o,c,h,l,u,p;return l=this.variable.properties.pop().range,i=l.from,o=l.to,n=l.exclusive,a=this.variable.compile(e),i?(u=this.cacheToCodeFragments(i.cache(e,F)),r=u[0],s=u[1]):r=s="0",o?(null!=i?i.isSimpleNumber():void 0)&&o.isSimpleNumber()?(o=+o.compile(e)-+s,n||(o+=1)):(o=o.compile(e,w)+" - "+s,n||(o+=" + 1")):o="9e9",p=this.value.cache(e,C),c=p[0],h=p[1],t=[].concat(this.makeCode("[].splice.apply("+a+", ["+r+", "+o+"].concat("),c,this.makeCode(")), "),h),e.level>N?this.wrapInBraces(t):t},n}(r),e.Code=h=function(e){function t(e,t,n){this.params=e||[],this.body=t||new s,this.bound="boundfunc"===n,this.bound&&(this.context="_this")}return vt(t,e),t.prototype.children=["params","body"],t.prototype.isStatement=function(){return!!this.ctor},t.prototype.jumps=S,t.prototype.compileNode=function(e){var t,r,s,a,o,c,h,l,u,p,d,f,m,g,b,v,y,T,C,F,L,N,D,x,S,A,_,I,$;for(e.scope=new B(e.scope,this.body,this),e.scope.shared=et(e,"sharedScope"),e.indent+=H,delete e.bare,delete e.isExistentialEquals,u=[],s=[],this.eachParamName(function(t){return e.scope.check(t)?void 0:e.scope.parameter(t)}),S=this.params,b=0,C=S.length;C>b;b++)if(l=S[b],l.splat){for(A=this.params,v=0,F=A.length;F>v;v++)h=A[v].name,h["this"]&&(h=h.properties[0].name),h.value&&e.scope.add(h.value,"var",!0);d=new i(new K(new n(function(){var t,n,i,r;for(i=this.params,r=[],t=0,n=i.length;n>t;t++)h=i[t],r.push(h.asReference(e));return r}.call(this))),new K(new E("arguments")));break}for(_=this.params,y=0,L=_.length;L>y;y++)l=_[y],l.isComplex()?(m=p=l.asReference(e),l.value&&(m=new R("?",p,l.value)),s.push(new i(new K(l.name),m,"=",{param:!0}))):(p=l,l.value&&(c=new E(p.name.value+" == null"),m=new i(new K(l.name),l.value,"="),s.push(new k(c,m)))),d||u.push(p);for(g=this.body.isEmpty(),d&&s.unshift(d),s.length&&(I=this.body.expressions).unshift.apply(I,s),a=T=0,N=u.length;N>T;a=++T)h=u[a],u[a]=h.compileToFragments(e),e.scope.parameter(rt(u[a]));for(f=[],this.eachParamName(function(e,t){return yt.call(f,e)>=0&&t.error("multiple parameters named '"+e+"'"),f.push(e)}),g||this.noReturn||this.body.makeReturn(),this.bound&&((null!=($=e.scope.parent.method)?$.bound:void 0)?this.bound=this.context=e.scope.parent.method.context:this["static"]||e.scope.parent.assign("_this","this")),o=e.indent,r="function",this.ctor&&(r+=" "+this.name),r+="(",t=[this.makeCode(r)],a=x=0,D=u.length;D>x;a=++x)h=u[a],a&&t.push(this.makeCode(", ")),t.push.apply(t,h);return t.push(this.makeCode(") {")),this.body.isEmpty()||(t=t.concat(this.makeCode("\n"),this.body.compileWithDeclarations(e),this.makeCode("\n"+this.tab))),t.push(this.makeCode("}")),this.ctor?[this.makeCode(this.tab)].concat(wt.call(t)):this.front||e.level>=w?this.wrapInBraces(t):t},t.prototype.eachParamName=function(e){var t,n,i,r,s;for(r=this.params,s=[],n=0,i=r.length;i>n;n++)t=r[n],s.push(t.eachName(e));return s},t.prototype.traverseChildren=function(e,n){return e?t.__super__.traverseChildren.call(this,e,n):void 0},t}(r),e.Param=_=function(e){function t(e,t,n){var i;this.name=e,this.value=t,this.splat=n,i=e=this.name.unwrapAll().value,yt.call(V,i)>=0&&this.name.error('parameter name "'+e+'" is not allowed')}return vt(t,e),t.prototype.children=["name","value"],t.prototype.compileToFragments=function(e){return this.name.compileToFragments(e,C)},t.prototype.asReference=function(e){var t;return this.reference?this.reference:(t=this.name,t["this"]?(t=t.properties[0].name,t.value.reserved&&(t=new E(e.scope.freeVariable
if(4===i.readyState){if(0!==(r=i.status)&&200!==r)throw Error("Could not load "+e);if(CoffeeScript.run(i.responseText,n),t)return t()}},i.send(null)},runScripts=function(){var e,t,n,i,r,s,a;return a=document.getElementsByTagName("script"),t=["text/coffeescript","text/literate-coffeescript"],e=function(){var e,n,i,r;for(r=[],e=0,n=a.length;n>e;e++)s=a[e],i=s.type,__indexOf.call(t,i)>=0&&r.push(s);return r}(),i=0,r=e.length,(n=function(){var r,s,a;return a=e[i++],r=null!=a?a.type:void 0,__indexOf.call(t,r)>=0?(s={literate:"text/literate-coffeescript"===r},a.src?CoffeeScript.load(a.src,n,s):(s.sourceFiles=["embedded"],CoffeeScript.run(a.innerHTML,s),n())):void 0})(),null},window.addEventListener?addEventListener("DOMContentLoaded",runScripts,!1):attachEvent("onload",runScripts))}).call(this)},require["./coffee-script"]}();"function"==typeof define&&define.amd?define(function(){return CoffeeScript}):root.CoffeeScript=CoffeeScript})(this);