ethstats-server/web-app/.meteor/local/build/programs/web.browser/packages/spacebars.js.map
2015-08-14 19:22:53 +02:00

2 lines
14 KiB
Plaintext

)]}'
{"version":3,"sources":["spacebars/spacebars-runtime.js","spacebars/dynamic.html","spacebars/dynamic.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,e;;AAEA,uD;;AAEA,0E;AACA,2B;AACA,gB;;AAEA,iD;AACA,sC;AACA,qC;AACA,uE;AACA,mE;AACA,G;;AAEA,0D;AACA,0D;AACA,qC;AACA,0B;AACA,kB;;AAEA,qC;AACA,uE;;AAEA,yD;AACA,K;AACA,mC;AACA,kC;AACA,8B;AACA,4C;AACA,O;AACA,K;;AAEA,c;AACA,E;;AAEA,+D;AACA,2D;AACA,2B;AACA,E;AACA,oD;AACA,oE;AACA,U;AACA,qD;AACA,uB;AACA,kE;AACA,wB;AACA,wB;AACA,mC;AACA,yC;AACA,0B;AACA,wD;AACA,6B;AACA,mD;AACA,oB;AACA,Y;AACA,yD;AACA,uB;AACA,8B;AACA,2B;AACA,yD;AACA,O;AACA,oD;AACA,K;AACA,G;;AAEA,0C;AACA,E;;AAEA,iD;AACA,6D;;AAEA,6C;AACA,uC;AACA,M;AACA,uE;AACA,kE;AACA,6E;AACA,wE;AACA,E;;AAEA,qD;AACA,6D;;AAEA,wC;AACA,gB;AACA,0C;AACA,kB;AACA,+E;AACA,iB;AACA,qB;AACA,e;AACA,U;AACA,0E;AACA,G;AACA,E;;AAEA,qD;AACA,6D;;AAEA,gB;AACA,E;;AAEA,mC;AACA,E;AACA,mE;AACA,qD;AACA,sC;AACA,yC;AACA,gB;AACA,qC;AACA,iB;AACA,M;AACA,2B;AACA,E;;AAEA,2D;AACA,8D;AACA,iE;AACA,sB;AACA,6C;AACA,oC;AACA,iE;AACA,qB;AACA,gD;AACA,6B;AACA,+D;AACA,K;;AAEA,sC;AACA,U;AACA,6B;AACA,2D;;AAEA,iB;AACA,G;AACA,E;;AAEA,0D;AACA,gC;AACA,gC;AACA,uC;AACA,wC;AACA,kC;;AAEA,yB;AACA,E;;AAEA,sE;AACA,gF;AACA,wC;AACA,+C;AACA,wC;AACA,0C;;AAEA,yC;AACA,E;AACA,iE;;AAEA,6D;AACA,2D;AACA,4D;AACA,4D;AACA,2D;AACA,W;AACA,E;AACA,gE;AACA,qE;AACA,oE;AACA,E;AACA,4D;AACA,E;AACA,qC;AACA,E;AACA,4D;AACA,E;AACA,yC;AACA,E;AACA,8D;AACA,qD;AACA,6B;AACA,mE;AACA,qC;AACA,4B;AACA,mD;AACA,6C;AACA,wE;AACA,qD;AACA,G;;AAEA,kC;AACA,oB;;AAEA,c;AACA,qD;;AAEA,0B;AACA,mC;AACA,kB;AACA,oD;AACA,mE;AACA,mC;AACA,0C;AACA,I;AACA,E;;AAEA,+D;AACA,8D;AACA,8D;AACA,2D;AACA,uB;AACA,4D;AACA,qC;AACA,uD;AACA,yD;AACA,iE;AACA,8D;AACA,8B;AACA,K;AACA,kC;AACA,8B;AACA,4B;;AAEA,wD;AACA,4D;AACA,2C;;AAEA,wC;AACA,6B;AACA,S;;AAEA,gE;AACA,+D;AACA,+C;AACA,Q;AACA,2C;AACA,Q;AACA,qD;AACA,gC;AACA,mC;AACA,kC;AACA,oC;AACA,Q;AACA,kE;AACA,sE;AACA,oE;AACA,qE;AACA,uB;AACA,Q;AACA,oE;AACA,uD;AACA,8C;AACA,Q;AACA,uC;AACA,8C;AACA,oB;AACA,4D;AACA,Q;AACA,6B;AACA,Q;AACA,iE;AACA,oB;AACA,4D;AACA,Q;AACA,oE;AACA,gE;AACA,sE;AACA,gE;AACA,oB;AACA,O;AACA,K;;AAEA,c;AACA,E;;AAEA,wB;AACA,6C;;;;;;;;;;;;;;;;;;;;ACnRA,kC;AACA,wE;AACA,kB;AACA,yD;AACA,2D;AACA,mC;AACA,6D;AACA,iB;AACA,oG;AACA,iB;AACA,6D;AACA,c;AACA,0D;AACA,+C;AACA,Q;AACA,mB;AACA,gF;AACA,iB;AACA,O;AACA,I;;AAEA,iD;AACA,sG;AACA,kB;AACA,oC;AACA,0F;AACA,iB;AACA,uD;AACA,sE;AACA,mB;AACA,0D;AACA,qB;AACA,K;AACA,I;;;;;;;;;;;;;;;;;;;AClCA,G;AACA,mB;AACA,qB;AACA,oB;AACA,8D;AACA,mB;AACA,gE;AACA,sF;AACA,G;;AAEA,2C;AACA,mC;AACA,kC;AACA,G;AACA,G;;AAEA,4B;AACA,mC;AACA,+B;AACA,I;AACA,6B;AACA,oC;AACA,uE;AACA,oD;AACA,K;;AAEA,kC;AACA,6C;AACA,wE;AACA,2B;AACA,O;AACA,O;AACA,G;AACA,G","file":"/packages/spacebars.js","sourcesContent":["Spacebars = {};\n\nvar tripleEquals = function (a, b) { return a === b; };\n\nSpacebars.include = function (templateOrFunction, contentFunc, elseFunc) {\n if (! templateOrFunction)\n return null;\n\n if (typeof templateOrFunction !== 'function') {\n var template = templateOrFunction;\n if (! Blaze.isTemplate(template))\n throw new Error(\"Expected template or null, found: \" + template);\n return templateOrFunction.constructView(contentFunc, elseFunc);\n }\n\n var templateVar = Blaze.ReactiveVar(null, tripleEquals);\n var view = Blaze.View('Spacebars.include', function () {\n var template = templateVar.get();\n if (template === null)\n return null;\n\n if (! Blaze.isTemplate(template))\n throw new Error(\"Expected template or null, found: \" + template);\n\n return template.constructView(contentFunc, elseFunc);\n });\n view.__templateVar = templateVar;\n view.onViewCreated(function () {\n this.autorun(function () {\n templateVar.set(templateOrFunction());\n });\n });\n\n return view;\n};\n\n// Executes `{{foo bar baz}}` when called on `(foo, bar, baz)`.\n// If `bar` and `baz` are functions, they are called before\n// `foo` is called on them.\n//\n// This is the shared part of Spacebars.mustache and\n// Spacebars.attrMustache, which differ in how they post-process the\n// result.\nSpacebars.mustacheImpl = function (value/*, args*/) {\n var args = arguments;\n // if we have any arguments (pos or kw), add an options argument\n // if there isn't one.\n if (args.length > 1) {\n var kw = args[args.length - 1];\n if (! (kw instanceof Spacebars.kw)) {\n kw = Spacebars.kw();\n // clone arguments into an actual array, then push\n // the empty kw object.\n args = Array.prototype.slice.call(arguments);\n args.push(kw);\n } else {\n // For each keyword arg, call it if it's a function\n var newHash = {};\n for (var k in kw.hash) {\n var v = kw.hash[k];\n newHash[k] = (typeof v === 'function' ? v() : v);\n }\n args[args.length - 1] = Spacebars.kw(newHash);\n }\n }\n\n return Spacebars.call.apply(null, args);\n};\n\nSpacebars.mustache = function (value/*, args*/) {\n var result = Spacebars.mustacheImpl.apply(null, arguments);\n\n if (result instanceof Spacebars.SafeString)\n return HTML.Raw(result.toString());\n else\n // map `null`, `undefined`, and `false` to null, which is important\n // so that attributes with nully values are considered absent.\n // stringify anything else (e.g. strings, booleans, numbers including 0).\n return (result == null || result === false) ? null : String(result);\n};\n\nSpacebars.attrMustache = function (value/*, args*/) {\n var result = Spacebars.mustacheImpl.apply(null, arguments);\n\n if (result == null || result === '') {\n return null;\n } else if (typeof result === 'object') {\n return result;\n } else if (typeof result === 'string' && HTML.isValidAttributeName(result)) {\n var obj = {};\n obj[result] = '';\n return obj;\n } else {\n throw new Error(\"Expected valid attribute name, '', null, or object\");\n }\n};\n\nSpacebars.dataMustache = function (value/*, args*/) {\n var result = Spacebars.mustacheImpl.apply(null, arguments);\n\n return result;\n};\n\n// Idempotently wrap in `HTML.Raw`.\n//\n// Called on the return value from `Spacebars.mustache` in case the\n// template uses triple-stache (`{{{foo bar baz}}}`).\nSpacebars.makeRaw = function (value) {\n if (value == null) // null or undefined\n return null;\n else if (value instanceof HTML.Raw)\n return value;\n else\n return HTML.Raw(value);\n};\n\n// If `value` is a function, called it on the `args`, after\n// evaluating the args themselves (by calling them if they are\n// functions). Otherwise, simply return `value` (and assert that\n// there are no args).\nSpacebars.call = function (value/*, args*/) {\n if (typeof value === 'function') {\n // evaluate arguments if they are functions (by calling them)\n var newArgs = [];\n for (var i = 1; i < arguments.length; i++) {\n var arg = arguments[i];\n newArgs[i-1] = (typeof arg === 'function' ? arg() : arg);\n }\n\n return value.apply(null, newArgs);\n } else {\n if (arguments.length > 1)\n throw new Error(\"Can't call non-function: \" + value);\n\n return value;\n }\n};\n\n// Call this as `Spacebars.kw({ ... })`. The return value\n// is `instanceof Spacebars.kw`.\nSpacebars.kw = function (hash) {\n if (! (this instanceof Spacebars.kw))\n // called without new; call with new\n return new Spacebars.kw(hash);\n\n this.hash = hash || {};\n};\n\n// Call this as `Spacebars.SafeString(\"some HTML\")`. The return value\n// is `instanceof Spacebars.SafeString` (and `instanceof Handlebars.SafeString).\nSpacebars.SafeString = function (html) {\n if (! (this instanceof Spacebars.SafeString))\n // called without new; call with new\n return new Spacebars.SafeString(html);\n\n return new Handlebars.SafeString(html);\n};\nSpacebars.SafeString.prototype = Handlebars.SafeString.prototype;\n\n// `Spacebars.dot(foo, \"bar\", \"baz\")` performs a special kind\n// of `foo.bar.baz` that allows safe indexing of `null` and\n// indexing of functions (which calls the function). If the\n// result is a function, it is always a bound function (e.g.\n// a wrapped version of `baz` that always uses `foo.bar` as\n// `this`).\n//\n// In `Spacebars.dot(foo, \"bar\")`, `foo` is assumed to be either\n// a non-function value or a \"fully-bound\" function wrapping a value,\n// where fully-bound means it takes no arguments and ignores `this`.\n//\n// `Spacebars.dot(foo, \"bar\")` performs the following steps:\n//\n// * If `foo` is falsy, return `foo`.\n//\n// * If `foo` is a function, call it (set `foo` to `foo()`).\n//\n// * If `foo` is falsy now, return `foo`.\n//\n// * Return `foo.bar`, binding it to `foo` if it's a function.\nSpacebars.dot = function (value, id1/*, id2, ...*/) {\n if (arguments.length > 2) {\n // Note: doing this recursively is probably less efficient than\n // doing it in an iterative loop.\n var argsForRecurse = [];\n argsForRecurse.push(Spacebars.dot(value, id1));\n argsForRecurse.push.apply(argsForRecurse,\n Array.prototype.slice.call(arguments, 2));\n return Spacebars.dot.apply(null, argsForRecurse);\n }\n\n if (typeof value === 'function')\n value = value();\n\n if (! value)\n return value; // falsy, don't index, pass through\n\n var result = value[id1];\n if (typeof result !== 'function')\n return result;\n // `value[id1]` (or `value()[id1]`) is a function.\n // Bind it so that when called, `value` will be placed in `this`.\n return function (/*arguments*/) {\n return result.apply(value, arguments);\n };\n};\n\n// Spacebars.With implements the conditional logic of rendering\n// the `{{else}}` block if the argument is falsy. It combines\n// a Blaze.If with a Blaze.With (the latter only in the truthy\n// case, since the else block is evaluated without entering\n// a new data context).\nSpacebars.With = function (argFunc, contentFunc, elseFunc) {\n var argVar = new Blaze.ReactiveVar;\n var view = Blaze.View('Spacebars_with', function () {\n return Blaze.If(function () { return argVar.get(); },\n function () { return Blaze.With(function () {\n return argVar.get(); }, contentFunc); },\n elseFunc);\n });\n view.onViewCreated(function () {\n this.autorun(function () {\n argVar.set(argFunc());\n\n // This is a hack so that autoruns inside the body\n // of the #with get stopped sooner. It reaches inside\n // our ReactiveVar to access its dep.\n\n Tracker.onInvalidate(function () {\n argVar.dep.changed();\n });\n\n // Take the case of `{{#with A}}{{B}}{{/with}}`. The goal\n // is to not re-render `B` if `A` changes to become falsy\n // and `B` is simultaneously invalidated.\n //\n // A series of autoruns are involved:\n //\n // 1. This autorun (argument to Spacebars.With)\n // 2. Argument to Blaze.If\n // 3. Blaze.If view re-render\n // 4. Argument to Blaze.With\n // 5. The template tag `{{B}}`\n //\n // When (3) is invalidated, it immediately stops (4) and (5)\n // because of a Tracker.onInvalidate built into materializeView.\n // (When a View's render method is invalidated, it immediately\n // tears down all the subviews, via a Tracker.onInvalidate much\n // like this one.\n //\n // Suppose `A` changes to become falsy, and `B` changes at the\n // same time (i.e. without an intervening flush).\n // Without the code above, this happens:\n //\n // - (1) and (5) are invalidated.\n // - (1) runs, invalidating (2) and (4).\n // - (5) runs.\n // - (2) runs, invalidating (3), stopping (4) and (5).\n //\n // With the code above:\n //\n // - (1) and (5) are invalidated, invalidating (2) and (4).\n // - (1) runs.\n // - (2) runs, invalidating (3), stopping (4) and (5).\n //\n // If the re-run of (5) is originally enqueued before (1), all\n // bets are off, but typically that doesn't seem to be the\n // case. Anyway, doing this is always better than not doing it,\n // because it might save a bunch of DOM from being updated\n // needlessly.\n });\n });\n\n return view;\n};\n\n// XXX COMPAT WITH 0.9.0\nSpacebars.TemplateWith = Blaze._TemplateWith;\n","\nTemplate.__checkName(\"__dynamic\");\nTemplate[\"__dynamic\"] = new Template(\"Template.__dynamic\", (function() {\n var view = this;\n return [ Blaze.View(\"lookup:checkContext\", function() {\n return Spacebars.mustache(view.lookup(\"checkContext\"));\n }), \"\\n \", Blaze.If(function() {\n return Spacebars.call(view.lookup(\"dataContextPresent\"));\n }, function() {\n return [ \"\\n \", Spacebars.include(view.lookupTemplate(\"__dynamicWithDataContext\")), \"\\n \" ];\n }, function() {\n return [ \"\\n \\n \", Blaze._TemplateWith(function() {\n return {\n template: Spacebars.call(view.lookup(\"template\")),\n data: Spacebars.call(view.lookup(\"..\"))\n };\n }, function() {\n return Spacebars.include(view.lookupTemplate(\"__dynamicWithDataContext\"));\n }), \"\\n \" ];\n }) ];\n}));\n\nTemplate.__checkName(\"__dynamicWithDataContext\");\nTemplate[\"__dynamicWithDataContext\"] = new Template(\"Template.__dynamicWithDataContext\", (function() {\n var view = this;\n return Spacebars.With(function() {\n return Spacebars.dataMustache(view.lookup(\"chooseTemplate\"), view.lookup(\"template\"));\n }, function() {\n return [ \"\\n \", Blaze._TemplateWith(function() {\n return Spacebars.call(Spacebars.dot(view.lookup(\"..\"), \"data\"));\n }, function() {\n return Spacebars.include(view.lookupTemplate(\"..\"));\n }), \" \\n \" ];\n });\n}));\n","/**\n * @isTemplate true\n * @memberOf Template\n * @function dynamic\n * @summary Choose a template to include dynamically, by name.\n * @locus Templates\n * @param {String} template The name of the template to include.\n * @param {Object} [data] Optional. The data context in which to include the template.\n */\n\nTemplate.__dynamicWithDataContext.helpers({\n chooseTemplate: function (name) {\n return Template[name] || null;\n }\n});\n\nTemplate.__dynamic.helpers({\n dataContextPresent: function () {\n return _.has(this, \"data\");\n },\n checkContext: function () {\n if (! _.has(this, \"template\")) {\n throw new Error(\"Must specify name in the 'template' argument \" +\n \"to {{> Template.dynamic}}.\");\n }\n\n _.each(this, function (v, k) {\n if (k !== \"template\" && k !== \"data\") {\n throw new Error(\"Invalid argument to {{> Template.dynamic}}: \" +\n k);\n }\n });\n }\n});\n"]}