consul/ui/javascripts/libs/handlebars-1.1.2.min.js

28 lines
41 KiB
JavaScript
Raw Normal View History

2014-05-02 18:08:47 +00:00
/*!
handlebars v1.1.2
Copyright (C) 2011 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
*/
var Handlebars=function(){var t=function(){"use strict";function t(t){this.string=t}var e;return t.prototype.toString=function(){return""+this.string},e=t}(),e=function(t){"use strict";function e(t){return a[t]||"&amp;"}function s(t,e){for(var s in e)e.hasOwnProperty(s)&&(t[s]=e[s])}function i(t){return t instanceof o?t.toString():t||0===t?(t=""+t,c.test(t)?t.replace(h,e):t):""}function n(t){return t||0===t?u(t)&&0===t.length?!0:!1:!0}var r={},o=t,a={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},h=/[&<>"'`]/g,c=/[&<>"'`]/;r.extend=s;var p=Object.prototype.toString;r.toString=p;var l=function(t){return"function"==typeof t};l(/x/)&&(l=function(t){return"function"==typeof t&&"[object Function]"===p.call(t)});var l;r.isFunction=l;var u=Array.isArray||function(t){return t&&"object"==typeof t?"[object Array]"===p.call(t):!1};return r.isArray=u,r.escapeExpression=i,r.isEmpty=n,r}(t),s=function(){"use strict";function t(){for(var t=Error.prototype.constructor.apply(this,arguments),e=0;e<s.length;e++)this[s[e]]=t[s[e]]}var e,s=["description","fileName","lineNumber","message","name","number","stack"];return t.prototype=new Error,e=t}(),i=function(t,e){"use strict";function s(t,e){this.helpers=t||{},this.partials=e||{},i(this)}function i(t){t.registerHelper("helperMissing",function(t){if(2===arguments.length)return void 0;throw new Error("Missing helper: '"+t+"'")}),t.registerHelper("blockHelperMissing",function(e,s){var i=s.inverse||function(){},n=s.fn;return u(e)&&(e=e.call(this)),e===!0?n(this):e===!1||null==e?i(this):l(e)?e.length>0?t.helpers.each(e,s):i(this):n(e)}),t.registerHelper("each",function(t,e){var s,i=e.fn,n=e.inverse,r=0,o="";if(u(t)&&(t=t.call(this)),e.data&&(s=m(e.data)),t&&"object"==typeof t)if(l(t))for(var a=t.length;a>r;r++)s&&(s.index=r,s.first=0===r,s.last=r===t.length-1),o+=i(t[r],{data:s});else for(var h in t)t.hasOwnProperty(h)&&(s&&(s.key=h),o+=i(t[h],{data:s}),r++);return 0===r&&(o=n(this)),o}),t.registerHelper("if",function(t,e){return u(t)&&(t=t.call(this)),!e.hash.includeZero&&!t||o.isEmpty(t)?e.inverse(this):e.fn(this)}),t.registerHelper("unless",function(e,s){return t.helpers["if"].call(this,e,{fn:s.inverse,inverse:s.fn,hash:s.hash})}),t.registerHelper("with",function(t,e){return u(t)&&(t=t.call(this)),o.isEmpty(t)?void 0:e.fn(t)}),t.registerHelper("log",function(e,s){var i=s.data&&null!=s.data.level?parseInt(s.data.level,10):1;t.log(i,e)})}function n(t,e){g.log(t,e)}var r={},o=t,a=e,h="1.1.2";r.VERSION=h;var c=4;r.COMPILER_REVISION=c;var p={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"};r.REVISION_CHANGES=p;var l=o.isArray,u=o.isFunction,f=o.toString,d="[object Object]";r.HandlebarsEnvironment=s,s.prototype={constructor:s,logger:g,log:n,registerHelper:function(t,e,s){if(f.call(t)===d){if(s||e)throw new a("Arg not supported with multiple helpers");o.extend(this.helpers,t)}else s&&(e.not=s),this.helpers[t]=e},registerPartial:function(t,e){f.call(t)===d?o.extend(this.partials,t):this.partials[t]=e}};var g={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(t,e){if(g.level<=t){var s=g.methodMap[t];"undefined"!=typeof console&&console[s]&&console[s].call(console,e)}}};r.logger=g,r.log=n;var m=function(t){var e={};return o.extend(e,t),e};return r.createFrame=m,r}(e,s),n=function(t,e,s){"use strict";function i(t){var e=t&&t[0]||1,s=u;if(e!==s){if(s>e){var i=f[s],n=f[e];throw new Error("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+i+") or downgrade your runtime to an older version ("+n+").")}throw new Error("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+t[1]+").")}}function n(t,e){if(!e)throw new Error("No environment passed to template");var s;s=e.compile?function(t,s,i,n,r,o){var h=a.apply(this,arguments);if(h)return h;var c={helpers:n,partials:r,data:o};return r[s]=e.compile(t,{data:void 0!==o},e),r[s](i,c)}:function(t,e){var
o.push("hash:"+this.popStack()),n=this.popStack(),r=this.popStack(),(r||n)&&(r||(this.context.aliases.self="this",r="self.noop"),n||(this.context.aliases.self="this",n="self.noop"),o.push("inverse:"+n),o.push("fn:"+r));for(var c=0;t>c;c++)i=this.popStack(),e.push(i),this.options.stringParams&&(h.push(this.popStack()),a.push(this.popStack()));return this.options.stringParams&&(o.push("contexts:["+a.join(",")+"]"),o.push("types:["+h.join(",")+"]"),o.push("hashContexts:hashContexts"),o.push("hashTypes:hashTypes")),this.options.data&&o.push("data:data"),o="{"+o.join(",")+"}",s?(this.register("options",o),e.push("options")):e.push(o),e.join(", ")}};for(var a="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),h=s.RESERVED_WORDS={},c=0,p=a.length;p>c;c++)h[a[c]]=!0;return s.isValidJavaScriptVariableName=function(t){return!s.RESERVED_WORDS[t]&&/^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(t)?!0:!1},i=s}(i),p=function(t,e,s,i){"use strict";function n(){}function r(t,e){if(null==t||"string"!=typeof t&&t.constructor!==l.ProgramNode)throw new h("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+t);e=e||{},"data"in e||(e.data=!0);var s=c(t),i=(new n).compile(s,e);return(new p).compile(i,e)}function o(t,e,s){function i(){var i=c(t),r=(new n).compile(i,e),o=(new p).compile(r,e,void 0,!0);return s.template(o)}if(null==t||"string"!=typeof t&&t.constructor!==l.ProgramNode)throw new h("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+t);e=e||{},"data"in e||(e.data=!0);var r;return function(t,e){return r||(r=i()),r.call(this,t,e)}}var a={},h=t,c=e.parse,p=s,l=i;return a.Compiler=n,n.prototype={compiler:n,disassemble:function(){for(var t,e,s,i=this.opcodes,n=[],r=0,o=i.length;o>r;r++)if(t=i[r],"DECLARE"===t.opcode)n.push("DECLARE "+t.name+"="+t.value);else{e=[];for(var a=0;a<t.args.length;a++)s=t.args[a],"string"==typeof s&&(s='"'+s.replace("\n","\\n")+'"'),e.push(s);n.push(t.opcode+" "+e.join(" "))}return n.join("\n")},equals:function(t){var e=this.opcodes.length;if(t.opcodes.length!==e)return!1;for(var s=0;e>s;s++){var i=this.opcodes[s],n=t.opcodes[s];if(i.opcode!==n.opcode||i.args.length!==n.args.length)return!1;for(var r=0;r<i.args.length;r++)if(i.args[r]!==n.args[r])return!1}if(e=this.children.length,t.children.length!==e)return!1;for(s=0;e>s;s++)if(!this.children[s].equals(t.children[s]))return!1;return!0},guid:0,compile:function(t,e){this.opcodes=[],this.children=[],this.depths={list:[]},this.options=e;var s=this.options.knownHelpers;if(this.options.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0},s)for(var i in s)this.options.knownHelpers[i]=s[i];return this.accept(t)},accept:function(t){var e,s=t.strip||{};return s.left&&this.opcode("strip"),e=this[t.type](t),s.right&&this.opcode("strip"),e},program:function(t){for(var e=t.statements,s=0,i=e.length;i>s;s++)this.accept(e[s]);return this.isSimple=1===i,this.depths.list=this.depths.list.sort(function(t,e){return t-e}),this},compileProgram:function(t){var e,s=(new this.compiler).compile(t,this.options),i=this.guid++;this.usePartial=this.usePartial||s.usePartial,this.children[i]=s;for(var n=0,r=s.depths.list.length;r>n;n++)e=s.depths.list[n],2>e||this.addDepth(e-1);return i},block:function(t){var e=t.mustache,s=t.program,i=t.inverse;s&&(s=this.compileProgram(s)),i&&(i=this.compileProgram(i));var n=this.classifyMustache(e);"helper"===n?this.helperMustache(e,s,i):"simple"===n?(this.simpleMustache(e),this.opcode("pushProgram",s),this.opcode("pushProgram",i),this.opcode("emptyHash"),this.opcode("blockValue")):(this.ambiguousMustache(e,s,i),this.opcode("pushProgram",s),this.opcode("pushProgram",i),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),th