mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
27 lines
8.8 KiB
JavaScript
27 lines
8.8 KiB
JavaScript
/*
|
|
|
|
handlebars v2.0.0
|
|
|
|
Copyright (C) 2011-2014 by Yehuda Katz
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
all copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
THE SOFTWARE.
|
|
|
|
@license
|
|
*/
|
|
(function(a,b){if(typeof define==="function"&&define.amd){define([],b)}else{if(typeof exports==="object"){module.exports=b()}else{a.Handlebars=a.Handlebars||b()}}}(this,function(){var f=(function(){var g;function h(i){this.string=i}h.prototype.toString=function(){return""+this.string};g=h;return g})();var c=(function(q){var r={};var k=q;var s={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};var g=/[&<>"'`]/g;var l=/[&<>"'`]/;function t(u){return s[u]}function p(w){for(var v=1;v<arguments.length;v++){for(var u in arguments[v]){if(Object.prototype.hasOwnProperty.call(arguments[v],u)){w[u]=arguments[v][u]}}}return w}r.extend=p;var i=Object.prototype.toString;r.toString=i;var h=function(u){return typeof u==="function"};if(h(/x/)){h=function(u){return typeof u==="function"&&i.call(u)==="[object Function]"}}var h;r.isFunction=h;var o=Array.isArray||function(u){return(u&&typeof u==="object")?i.call(u)==="[object Array]":false};r.isArray=o;function n(u){if(u instanceof k){return u.toString()}else{if(u==null){return""}else{if(!u){return u+""}}}u=""+u;if(!l.test(u)){return u}return u.replace(g,t)}r.escapeExpression=n;function m(u){if(!u&&u!==0){return true}else{if(o(u)&&u.length===0){return true}else{return false}}}r.isEmpty=m;function j(u,v){return(u?u+".":"")+v}r.appendContextPath=j;return r})(f);var d=(function(){var h;var i=["description","fileName","lineNumber","message","name","number","stack"];function g(n,m){var k;if(m&&m.firstLine){k=m.firstLine;n+=" - "+k+":"+m.firstColumn}var l=Error.prototype.constructor.call(this,n);for(var j=0;j<i.length;j++){this[i[j]]=l[i[j]]}if(k){this.lineNumber=k;this.column=m.firstColumn}}g.prototype=new Error();h=g;return h})();var e=(function(r,u){var t={};var p=r;var n=u;var w="2.0.0";t.VERSION=w;var h=6;t.COMPILER_REVISION=h;var k={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1"};t.REVISION_CHANGES=k;var o=p.isArray,j=p.isFunction,i=p.toString,g="[object Object]";function m(y,x){this.helpers=y||{};this.partials=x||{};q(this)}t.HandlebarsEnvironment=m;m.prototype={constructor:m,logger:s,log:l,registerHelper:function(x,y){if(i.call(x)===g){if(y){throw new n("Arg not supported with multiple helpers")}p.extend(this.helpers,x)}else{this.helpers[x]=y}},unregisterHelper:function(x){delete this.helpers[x]},registerPartial:function(y,x){if(i.call(y)===g){p.extend(this.partials,y)}else{this.partials[y]=x}},unregisterPartial:function(x){delete this.partials[x]}};function q(x){x.registerHelper("helperMissing",function(){if(arguments.length===1){return undefined}else{throw new n("Missing helper: '"+arguments[arguments.length-1].name+"'")}});x.registerHelper("blockHelperMissing",function(A,z){var y=z.inverse,B=z.fn;if(A===true){return B(this)}else{if(A===false||A==null){return y(this)}else{if(o(A)){if(A.length>0){if(z.ids){z.ids=[z.name]}return x.helpers.each(A,z)}else{return y(this)}}else{if(z.data&&z.ids){var C=v(z.data);C.contextPath=p.appendContextPath(z.data.contextPath,z.name);z={data:C}}return B(A,z)}}}});x.registerHelper("each",function(y,H){if(!H){throw new n("Must pass iterator to #each")}var F=H.fn,B=H.inverse;var D=0,E="",C;var z;if(H.data&&H.ids){z=p.appendContextPath(H.data.contextPath,H.ids[0])+"."}if(j(y)){y=y.call(this)}if(H.data){C=v(H.data)}if(y&&typeof y==="object"){if(o(y)){for(var A=y.length;D<A;D++){if(C){C.index=D;C.first=(D===0);C.last=(D===(y.length-1));if(z){C.contextPath=z+D}}E=E+F(y[D],{data:C})}}else{for(var G in y){if(y.hasOwnProperty(G)){if(C){C.key=G;C.index=D;C.first=(D===0);if(z){C.contextPath=z+G}}E=E+F(y[G],{data:C});D++}}}}if(D===0){E=B(this)}return E});x.registerHelper("if",function(z,y){if(j(z)){z=z.call(this)}if((!y.hash.includeZero&&!z)||p.isEmpty(z)){return y.inverse(this)}else{return y.fn(this)}});x.registerHelper("unless",function(z,y){return x.helpers["if"].call(this,z,{fn:y.inverse,inverse:y.fn,hash:y.hash})});x.registerHelper("with",function(z,y){if(j(z)){z=z.call(this)}var A=y.fn;if(!p.isEmpty(z)){if(y.data&&y.ids){var B=v(y.data);B.contextPath=p.appendContextPath(y.data.contextPath,y.ids[0]);y={data:B}}return A(z,y)}else{return y.inverse(this)}});x.registerHelper("log",function(z,y){var A=y.data&&y.data.level!=null?parseInt(y.data.level,10):1;x.log(A,z)});x.registerHelper("lookup",function(z,y){return z&&z[y]})}var s={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(z,x){if(s.level<=z){var y=s.methodMap[z];if(typeof console!=="undefined"&&console[y]){console[y].call(console,x)}}}};t.logger=s;var l=s.log;t.log=l;var v=function(x){var y=p.extend({},x);y._parent=x;return y};t.createFrame=v;return t})(c,d);var b=(function(o,t,j){var r={};var n=o;var l=t;var i=j.COMPILER_REVISION;var k=j.REVISION_CHANGES;var u=j.createFrame;function h(x){var w=x&&x[0]||1,z=i;if(w!==z){if(w<z){var v=k[z],y=k[w];throw new l("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+v+") or downgrade your runtime to an older version ("+y+").")}else{throw new l("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+x[1]+").")}}}r.checkRevision=h;function q(v,z){if(!z){throw new l("No environment passed to template")}if(!v||!v.main){throw new l("Unknown template object: "+typeof v)}z.VM.checkRevision(v.compiler);var y=function(J,D,A,C,G,B,I,H,K){if(G){C=n.extend({},C,G)}var N=z.VM.invokePartial.call(this,J,A,C,B,I,H,K);if(N==null&&z.compile){var M={helpers:B,partials:I,data:H,depths:K};I[A]=z.compile(J,{data:H!==undefined,compat:v.compat},z);N=I[A](C,M)}if(N!=null){if(D){var L=N.split("\n");for(var F=0,E=L.length;F<E;F++){if(!L[F]&&F+1===E){break}L[F]=D+L[F]}N=L.join("\n")}return N}else{throw new l("The partial "+A+" could not be compiled when running in runtime-only mode")}};var w={lookup:function(D,B){var A=D.length;for(var C=0;C<A;C++){if(D[C]&&D[C][B]!=null){return D[C][B]}}},lambda:function(B,A){return typeof B==="function"?B.call(A):B},escapeExpression:n.escapeExpression,invokePartial:y,fn:function(A){return v[A]},programs:[],program:function(B,D,E){var A=this.programs[B],C=this.fn(B);if(D||E){A=m(this,B,C,D,E)}else{if(!A){A=this.programs[B]=m(this,B,C)}}return A},data:function(A,B){while(A&&B--){A=A._parent}return A},merge:function(C,B){var A=C||B;if(C&&B&&(C!==B)){A=n.extend({},B,C)}return A},noop:z.VM.noop,compilerInfo:v.compiler};var x=function(B,A){A=A||{};var C=A.data;x._setup(A);if(!A.partial&&v.useData){C=p(B,C)}var D;if(v.useDepths){D=A.depths?[B].concat(A.depths):[B]}return v.main.call(w,B,w.helpers,w.partials,C,D)};x.isTop=true;x._setup=function(A){if(!A.partial){w.helpers=w.merge(A.helpers,z.helpers);if(v.usePartial){w.partials=w.merge(A.partials,z.partials)}}else{w.helpers=A.helpers;w.partials=A.partials}};x._child=function(A,B,C){if(v.useDepths&&!C){throw new l("must pass parent depths")}return m(w,A,v[A],B,C)};return x}r.template=q;function m(v,w,x,y,A){var z=function(C,B){B=B||{};return x.call(v,C,v.helpers,v.partials,B.data||y,A&&[C].concat(A))};z.program=w;z.depth=A?A.length:0;return z}r.program=m;function g(v,x,z,A,y,B,C){var w={partial:true,helpers:A,partials:y,data:B,depths:C};if(v===undefined){throw new l("The partial "+x+" could not be found")}else{if(v instanceof Function){return v(z,w)}}}r.invokePartial=g;function s(){return""}r.noop=s;function p(v,w){if(!w||!("root" in w)){w=w?u(w):{};w.root=v}return w}return r})(c,d,e);var a=(function(q,s,i,m,p){var r;var g=q;var j=s;var l=i;var o=m;var k=p;var n=function(){var t=new g.HandlebarsEnvironment();o.extend(t,g);t.SafeString=j;t.Exception=l;t.Utils=o;t.escapeExpression=o.escapeExpression;t.VM=k;t.template=function(u){return k.template(u,t)};return t};var h=n();h.create=n;h["default"]=h;r=h;return r})(e,f,d,c,b);return a})); |